@sumaris-net/ngx-components 1.19.2 → 1.20.0-rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2908,7 +2908,7 @@ const moment$2 = momentImported;
2908
2908
  // @dynamic
2909
2909
  class SharedValidators {
2910
2910
  static getDoubleRegexp(maxDecimals) {
2911
- if (isNil(maxDecimals))
2911
+ if (isNil(maxDecimals) || maxDecimals === -1)
2912
2912
  return this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS.NO_LIMIT;
2913
2913
  if (maxDecimals < 0)
2914
2914
  throw new Error(`Invalid maxDecimals value: ${maxDecimals}`);
@@ -9730,6 +9730,10 @@ class EntityUtils {
9730
9730
  return isNotNil(obj.__typename) && (typeof obj.fromObject === 'function') && (typeof obj.asObject === 'function');
9731
9731
  }
9732
9732
  // Check that the object has a NOT nil attribute (ID by default)
9733
+ static isNotEntity(obj) {
9734
+ return isNil(obj.__typename) || (typeof obj.fromObject !== 'function') || (typeof obj.asObject !== 'function');
9735
+ }
9736
+ // Check that the object has a NOT nil attribute (ID by default)
9733
9737
  static isNotEmpty(obj, checkedAttribute) {
9734
9738
  return !!obj && obj[checkedAttribute] !== null && obj[checkedAttribute] !== undefined;
9735
9739
  }
@@ -17139,12 +17143,32 @@ class AppForm {
17139
17143
  cancel() {
17140
17144
  this.onCancel.emit();
17141
17145
  }
17142
- doSubmit(event) {
17143
- if (!this.form || !this.form.valid) {
17144
- this.markAllAsTouched({ emitEvent: true });
17145
- return;
17146
- }
17147
- this.onSubmit.emit(event);
17146
+ /**
17147
+ *
17148
+ * @param event
17149
+ * @param opts allow to skip validation check, using {checkValid: false}
17150
+ */
17151
+ doSubmit(event, opts) {
17152
+ return __awaiter(this, void 0, void 0, function* () {
17153
+ if (!this._form) {
17154
+ this.markAllAsTouched({ emitEvent: true });
17155
+ return;
17156
+ }
17157
+ // Check if valid (if not disabled)
17158
+ if ((!opts || opts.checkValid !== false) && !this._form.valid) {
17159
+ // Wait validation end
17160
+ yield AppFormUtils.waitWhilePending(this._form);
17161
+ // Form is invalid: exit (+ log if debug)
17162
+ if (this._form.invalid) {
17163
+ this.markAllAsTouched({ emitEvent: true });
17164
+ if (this.debug)
17165
+ AppFormUtils.logFormErrors(this._form);
17166
+ return;
17167
+ }
17168
+ }
17169
+ // Emit event
17170
+ this.onSubmit.emit(event);
17171
+ });
17148
17172
  }
17149
17173
  setForm(form) {
17150
17174
  if (this._form !== form) {
@@ -18251,24 +18275,30 @@ class AuthForm extends AppForm {
18251
18275
  this.onCancel.emit();
18252
18276
  }
18253
18277
  doSubmit(event) {
18254
- if (event) {
18255
- event.preventDefault();
18256
- event.stopPropagation();
18257
- }
18258
- if (this.form.invalid || this.loading)
18259
- return;
18260
- this.markAsLoading();
18261
- const data = this.form.value;
18262
- this.showPwd = false; // Hide password
18263
- this.error = null; // Reset error
18264
- this.registerSubscription(this.onSubmit
18265
- .pipe(debounceTime(500))
18266
- .subscribe(res => this.markAsLoaded()));
18267
- setTimeout(() => this.onSubmit.emit({
18268
- username: data.username,
18269
- password: data.password,
18270
- offline: data.offline
18271
- }));
18278
+ return __awaiter(this, void 0, void 0, function* () {
18279
+ if (event) {
18280
+ event.preventDefault();
18281
+ event.stopPropagation();
18282
+ }
18283
+ if (this.loading)
18284
+ return;
18285
+ if (!this.form.valid) {
18286
+ yield AppFormUtils.waitWhilePending(this.form);
18287
+ if (this.form.invalid) {
18288
+ AppFormUtils.logFormErrors(this.form);
18289
+ return; // Skip if invalid
18290
+ }
18291
+ }
18292
+ this.markAsLoading();
18293
+ const data = this.form.value;
18294
+ this.showPwd = false; // Hide password
18295
+ this.error = null; // Reset error
18296
+ setTimeout(() => this.onSubmit.emit({
18297
+ username: data.username,
18298
+ password: data.password,
18299
+ offline: data.offline
18300
+ }));
18301
+ });
18272
18302
  }
18273
18303
  register() {
18274
18304
  this.onCancel.emit();
@@ -20948,6 +20978,7 @@ CoreModule.decorators = [
20948
20978
  CacheModule,
20949
20979
  IonicStorageModule,
20950
20980
  NgxJdenticonModule,
20981
+ TranslateModule.forChild(),
20951
20982
  // Sub modules
20952
20983
  AppGraphQLModule,
20953
20984
  AppMenuModule
@@ -21536,8 +21567,6 @@ class AppTableUtils {
21536
21567
  }
21537
21568
  }
21538
21569
 
21539
- class AppTableDataSourceOptions {
21540
- }
21541
21570
  // @dynamic
21542
21571
  // eslint-disable-next-line @angular-eslint/directive-class-suffix
21543
21572
  class EntitiesTableDataSource extends TableDataSource {
@@ -21546,34 +21575,27 @@ class EntitiesTableDataSource extends TableDataSource {
21546
21575
  *
21547
21576
  * @param dataService A service to load and save data
21548
21577
  * @param dataType Type of data contained by the Table. If not specified, then `data` with at least one element must be specified.
21549
- * @param environment
21550
21578
  * @param validatorService Service that create instances of the FormGroup used to validate row fields.
21551
21579
  * @param config Additional configuration for table.
21552
21580
  */
21553
21581
  constructor(dataType, dataService, validatorService, config) {
21554
- super([], dataType, validatorService, config);
21582
+ super([], dataType, validatorService, Object.assign({ dataServiceOptions: {}, debug: config && config.suppressErrors === false, keepOriginalDataAfterConfirm: false }, config));
21555
21583
  this.dataService = dataService;
21556
21584
  this._creating = false;
21557
21585
  this._saving = false;
21558
- this._useValidator = false;
21559
21586
  this._stopWatching$ = new Subject();
21560
21587
  this._editingRowCount = 0;
21561
21588
  this._fetchMoreFn = null;
21562
21589
  this.loadingSubject = new BehaviorSubject(undefined);
21563
- this._options = Object.assign({ dataServiceOptions: {}, debug: config && config.suppressErrors === false, keepOriginalDataAfterConfirm: false }, config);
21564
- this._useValidator = isNotNil(validatorService);
21565
21590
  this._logTypeName = removeEnd((new dataType()).__typename || 'UnknownVO', 'VO');
21566
21591
  // For DEV ONLY
21567
- this._debug = this._options.debug === true;
21592
+ this._debug = this.config.debug === true;
21568
21593
  }
21569
21594
  get serviceOptions() {
21570
- return this._options.dataServiceOptions;
21595
+ return this.config.dataServiceOptions;
21571
21596
  }
21572
21597
  set serviceOptions(value) {
21573
- this._options.dataServiceOptions = value;
21574
- }
21575
- get options() {
21576
- return this._options;
21598
+ this.config.dataServiceOptions = value;
21577
21599
  }
21578
21600
  get loaded() {
21579
21601
  return this.loadingSubject.value === false; // Should be false when undefined (initial state)
@@ -21581,12 +21603,11 @@ class EntitiesTableDataSource extends TableDataSource {
21581
21603
  get loading() {
21582
21604
  return this.loadingSubject.value !== false; // Should be true when undefined (initial state)
21583
21605
  }
21584
- ngOnDestroy() {
21606
+ disconnect(collectionViewer) {
21607
+ super.disconnect(collectionViewer);
21585
21608
  this._stopWatching$.next();
21586
21609
  this._stopWatching$.complete();
21587
- this._stopWatching$.unsubscribe();
21588
21610
  this.loadingSubject.complete();
21589
- this.loadingSubject.unsubscribe();
21590
21611
  }
21591
21612
  watchAll(offset, size, sortBy, sortDirection, filter) {
21592
21613
  this._stopWatching$.next();
@@ -21630,27 +21651,26 @@ class EntitiesTableDataSource extends TableDataSource {
21630
21651
  // Get all rows
21631
21652
  const rows = yield this.getRows();
21632
21653
  // Finish editing all rows
21633
- const invalidRows = rows.filter(row => row.editing && !row.confirmEditCreate());
21654
+ const confirmed = yield this.confirmRows(rows);
21634
21655
  // Cannot finish some rows: error
21635
- if (invalidRows.length) {
21656
+ if (!confirmed) {
21636
21657
  // log errors
21637
21658
  if (this._debug)
21638
- invalidRows.forEach(row => AppTableUtils.logRowErrors(row, `[table-datasource] ${this._logTypeName} row #${row.id}`));
21659
+ this.getEditingRows(rows).forEach(row => AppTableUtils.logRowErrors(row, `[table-datasource] ${this._logTypeName} row #${row.id}`));
21639
21660
  // Stop with an error
21640
21661
  throw { code: ErrorCodes.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
21641
21662
  }
21642
21663
  this._editingRowCount = 0;
21643
21664
  let data;
21644
21665
  let dataToSave;
21645
- if (this._useValidator) {
21666
+ if (!!this.validatorService) {
21646
21667
  dataToSave = [];
21647
21668
  data = rows.map(row => {
21648
- const currentData = new this.dataConstructor();
21649
- currentData.fromObject(row.currentData);
21669
+ const entity = this.toEntity(row.currentData);
21650
21670
  // Filter to keep only dirty row
21651
21671
  if (onlyDirtyRows && row.validator.dirty)
21652
- dataToSave.push(currentData);
21653
- return currentData;
21672
+ dataToSave.push(entity);
21673
+ return entity;
21654
21674
  });
21655
21675
  if (!onlyDirtyRows)
21656
21676
  dataToSave = data;
@@ -21687,25 +21707,33 @@ class EntitiesTableDataSource extends TableDataSource {
21687
21707
  }
21688
21708
  });
21689
21709
  }
21690
- updateDatasource(data, opts) {
21691
- if (this._debug)
21692
- console.debug(`[table-datasource] Updating datasource with data:`, data);
21693
- super.updateDatasource(data, opts);
21694
- if (!opts || opts.emitEvent !== false) {
21695
- this.markAsLoaded();
21710
+ getDataFromRows(rows, options = { originalData: false, toEntity: false }) {
21711
+ if (options.toEntity) {
21712
+ return super.getDataFromRows(rows, options)
21713
+ .map(data => this.toEntity(data));
21696
21714
  }
21715
+ return super.getDataFromRows(rows, options);
21697
21716
  }
21698
- // Overwrite default signature
21699
- createNew(insertAt) {
21700
- this.asyncCreateNew(insertAt);
21701
- }
21702
- connect(collectionViewer) {
21703
- // DEBUG console.debug("[entities-datasource] connect");
21704
- return super.connect(collectionViewer);
21717
+ toEntity(data) {
21718
+ if (EntityUtils.isNotEntity(data)) {
21719
+ const entity = new this.dataConstructor();
21720
+ entity.fromObject(data);
21721
+ return entity;
21722
+ }
21723
+ return data;
21705
21724
  }
21706
- disconnect(collectionViewer) {
21707
- super.disconnect(collectionViewer);
21708
- this._stopWatching$.next();
21725
+ updateDatasource(data, opts = { emitEvent: true }) {
21726
+ const _super = Object.create(null, {
21727
+ updateDatasource: { get: () => super.updateDatasource }
21728
+ });
21729
+ return __awaiter(this, void 0, void 0, function* () {
21730
+ if (this._debug)
21731
+ console.debug(`[table-datasource] Updating datasource with data:`, data);
21732
+ yield _super.updateDatasource.call(this, data, opts);
21733
+ if (opts.emitEvent) {
21734
+ this.markAsLoaded();
21735
+ }
21736
+ });
21709
21737
  }
21710
21738
  waitIdle(debounceTimeMs) {
21711
21739
  return firstFalsePromise(this.loadingSubject
@@ -21714,34 +21742,60 @@ class EntitiesTableDataSource extends TableDataSource {
21714
21742
  ));
21715
21743
  }
21716
21744
  confirmCreate(row) {
21717
- if (!super.confirmCreate(row))
21718
- return false;
21719
- if (row.editing && row.validator) {
21720
- console.warn('[table-datasource] Row still has {editing: true} after confirmCreate()! Force editing to false');
21721
- row.validator.disable({ onlySelf: true, emitEvent: false });
21722
- }
21723
- return true;
21745
+ const _super = Object.create(null, {
21746
+ confirmCreate: { get: () => super.confirmCreate }
21747
+ });
21748
+ return __awaiter(this, void 0, void 0, function* () {
21749
+ if (!(yield _super.confirmCreate.call(this, row)))
21750
+ return false;
21751
+ if (row.editing && row.validator) {
21752
+ console.warn('[table-datasource] Row still has {editing: true} after confirmCreate()! Force editing to false');
21753
+ row.validator.disable({ onlySelf: true, emitEvent: false });
21754
+ }
21755
+ return true;
21756
+ });
21724
21757
  }
21725
21758
  confirmEdit(row) {
21726
- if (!super.confirmEdit(row))
21727
- return false;
21728
- if (row.editing && row.validator) {
21729
- console.warn('[table-datasource] Row still has {editing: true} after confirmCreate()! Force editing to false');
21730
- row.validator.disable({ onlySelf: true, emitEvent: false });
21731
- }
21732
- return true;
21759
+ const _super = Object.create(null, {
21760
+ confirmEdit: { get: () => super.confirmEdit }
21761
+ });
21762
+ return __awaiter(this, void 0, void 0, function* () {
21763
+ if (!(yield _super.confirmEdit.call(this, row)))
21764
+ return false;
21765
+ if (row.editing && row.validator) {
21766
+ console.warn('[table-datasource] Row still has {editing: true} after confirmCreate()! Force editing to false');
21767
+ row.validator.disable({ onlySelf: true, emitEvent: false });
21768
+ }
21769
+ return true;
21770
+ });
21733
21771
  }
21734
21772
  startEdit(row) {
21735
- if (this._debug)
21736
- console.debug('[table-datasource] Start to edit row', row);
21737
- row.startEdit();
21738
- this._editingRowCount++;
21773
+ const _super = Object.create(null, {
21774
+ startEdit: { get: () => super.startEdit }
21775
+ });
21776
+ return __awaiter(this, void 0, void 0, function* () {
21777
+ if (row.editing)
21778
+ return; // Already editing
21779
+ if (this._debug)
21780
+ console.debug('[table-datasource] Start to edit row', row);
21781
+ const done = yield _super.startEdit.call(this, row);
21782
+ if (done)
21783
+ this._editingRowCount++;
21784
+ return done;
21785
+ });
21739
21786
  }
21740
- cancelOrDelete(row) {
21741
- if (this._debug)
21742
- console.debug('[table-datasource] Cancelling or deleting row', row);
21743
- row.cancelOrDelete();
21744
- this._editingRowCount--;
21787
+ cancel(row) {
21788
+ const _super = Object.create(null, {
21789
+ cancel: { get: () => super.cancel }
21790
+ });
21791
+ return __awaiter(this, void 0, void 0, function* () {
21792
+ if (this._debug)
21793
+ console.debug('[table-datasource] Cancelling row', row);
21794
+ const done = yield _super.cancel.call(this, row);
21795
+ if (done)
21796
+ this._editingRowCount--;
21797
+ return done;
21798
+ });
21745
21799
  }
21746
21800
  handleError(error, message) {
21747
21801
  const errorMsg = error && error.message || error;
@@ -21756,57 +21810,75 @@ class EntitiesTableDataSource extends TableDataSource {
21756
21810
  throw error;
21757
21811
  }
21758
21812
  delete(id) {
21759
- // If new row: not need to propagate to the dataService
21760
- if (id === -1) {
21761
- return super.delete(id);
21762
- }
21763
- const row = this.getRow(id);
21764
- if (!row) {
21765
- console.error(`[table-datasource] Row to delete with id=${id} not found`);
21766
- return;
21767
- }
21768
- this.loadingSubject.next(true);
21769
- this.dataService.deleteAll([row.currentData], this.serviceOptions)
21770
- .catch(err => this.handleErrorPromise(err))
21771
- .then(() => {
21772
- setTimeout(() => {
21773
- // make sure row has been deleted (because GrapQHl cache remove can failed)
21813
+ const _super = Object.create(null, {
21814
+ delete: { get: () => super.delete }
21815
+ });
21816
+ return __awaiter(this, void 0, void 0, function* () {
21817
+ // If new row: not need to propagate to the dataService
21818
+ if (id === -1) {
21819
+ return _super.delete.call(this, id);
21820
+ }
21821
+ const row = this.getRow(id);
21822
+ if (!row) {
21823
+ console.error(`[table-datasource] Row to delete with id=${id} not found`);
21824
+ return;
21825
+ }
21826
+ this.markAsLoading();
21827
+ try {
21828
+ yield this.dataService.deleteAll([row.currentData], this.serviceOptions);
21829
+ // Make sure row has been deleted (because GrapQHl cache remove can failed)
21830
+ yield sleep(300);
21774
21831
  const present = this.getRow(id) === row;
21775
- if (present)
21776
- super.delete(id);
21777
- this.loadingSubject.next(false);
21778
- }, 300);
21832
+ if (present) {
21833
+ console.warn('[table-datasource] Force deletion of 1 row (Is service applying deletion to observable ?)');
21834
+ yield _super.delete.call(this, id);
21835
+ }
21836
+ }
21837
+ catch (err) {
21838
+ this.handleErrorPromise(err);
21839
+ }
21840
+ finally {
21841
+ this.markAsLoaded();
21842
+ }
21779
21843
  });
21780
21844
  }
21781
21845
  deleteAll(rows) {
21782
- this.markAsLoading();
21783
- const data = rows.map(r => r.currentData);
21784
- const rowsById = rows.reduce((res, row) => {
21785
- res[row.id] = row;
21786
- return res;
21787
- }, {});
21788
- const self = this;
21789
- const selfDelete = super.delete;
21790
- return this.dataService.deleteAll(data, this.serviceOptions)
21791
- .catch(err => this.handleErrorPromise(err))
21792
- .then(() => {
21793
- // Workaround, to be sure all rows has been deleted
21794
- // Sometimes, the service miss deletion, or GrapQHl cache remove failed
21795
- const rowNotDeleted = Object.getOwnPropertyNames(rowsById).reduce((res, id) => {
21796
- const row = rowsById[id];
21797
- const present = self.getRow(+id) === row;
21798
- return present ? res.concat(row) : res;
21799
- }, []).sort((a, b) => a.id > b.id ? -1 : 1);
21800
- // Apply missing deletion
21801
- if (isNotEmptyArray(rowNotDeleted)) {
21802
- console.warn(`[table-datasource] Force deletion of ${rowNotDeleted.length} rows (Is service applying deletion to observable ?)`);
21803
- rowNotDeleted.forEach(r => selfDelete.call(self, r.id));
21846
+ const _super = Object.create(null, {
21847
+ delete: { get: () => super.delete }
21848
+ });
21849
+ return __awaiter(this, void 0, void 0, function* () {
21850
+ this.markAsLoading();
21851
+ const data = this.getDataFromRows(rows);
21852
+ const rowsById = rows.reduce((res, row) => {
21853
+ res[row.id] = row;
21854
+ return res;
21855
+ }, {});
21856
+ const self = this;
21857
+ try {
21858
+ yield this.dataService.deleteAll(data, this.serviceOptions);
21859
+ // Workaround, to be sure all rows has been deleted
21860
+ // Sometimes, the service miss deletion, or GrapQHl cache remove failed
21861
+ const rowNotDeleted = Object.getOwnPropertyNames(rowsById).reduce((res, id) => {
21862
+ const row = rowsById[id];
21863
+ const present = self.getRow(+id) === row;
21864
+ return present ? res.concat(row) : res;
21865
+ }, []).sort((a, b) => a.id > b.id ? -1 : 1);
21866
+ // Apply missing deletion
21867
+ if (isNotEmptyArray(rowNotDeleted)) {
21868
+ console.warn(`[table-datasource] Force deletion of ${rowNotDeleted.length} rows (Is service applying deletion to observable ?)`);
21869
+ yield Promise.all(rowNotDeleted.map(r => _super.delete.call(this, r.id)));
21870
+ }
21871
+ }
21872
+ catch (err) {
21873
+ this.handleErrorPromise(err);
21874
+ }
21875
+ finally {
21876
+ this.markAsLoaded();
21804
21877
  }
21805
- this.loadingSubject.next(false);
21806
21878
  });
21807
21879
  }
21808
21880
  getRows() {
21809
- return firstNotNilPromise(this.connect(null));
21881
+ return this.rowsSubject.toPromise();
21810
21882
  }
21811
21883
  asyncCreateNew(insertAt) {
21812
21884
  const _super = Object.create(null, {
@@ -21818,8 +21890,8 @@ class EntitiesTableDataSource extends TableDataSource {
21818
21890
  this._creating = true;
21819
21891
  _super.createNew.call(this, insertAt);
21820
21892
  const row = this.getRow(-1);
21821
- if (row && this._options && this._options.onRowCreated) {
21822
- const res = this._options.onRowCreated(row);
21893
+ if (row && this.config.onRowCreated) {
21894
+ const res = this.config.onRowCreated(row);
21823
21895
  // If async function, wait the end before ending
21824
21896
  if (res instanceof Promise) {
21825
21897
  try {
@@ -21846,21 +21918,24 @@ class EntitiesTableDataSource extends TableDataSource {
21846
21918
  });
21847
21919
  return __awaiter(this, void 0, void 0, function* () {
21848
21920
  if (!this._fetchMoreFn)
21849
- return false; // Avoid multiple call
21921
+ return false;
21850
21922
  if (this._editingRowCount > 0) {
21851
21923
  console.warn('Cannot fetch more because still editing row');
21852
21924
  return;
21853
21925
  }
21926
+ // Forget the fetchMore function, to avoid multiple call
21927
+ const fetchMoreFn = this._fetchMoreFn;
21928
+ this._fetchMoreFn = null;
21854
21929
  // Fetch next page
21855
- this._fetchMoreFn = null; // Avoid multiple call
21856
- const res = yield this._fetchMoreFn();
21930
+ const res = yield fetchMoreFn();
21857
21931
  // Skip if empty (no more data)
21858
21932
  if (isNotEmptyArray(res === null || res === void 0 ? void 0 : res.data))
21859
21933
  return false;
21860
21934
  // Update the data source
21935
+ // TODO review this, to keep existing rows, instead of creating new TableElement + validator !
21861
21936
  const existingData = yield this.getData();
21862
- _super.updateDatasource.call(this, existingData.concat(...res.data), opts);
21863
- // Remember fetchMore
21937
+ yield _super.updateDatasource.call(this, existingData.concat(...res.data), opts);
21938
+ // Store next fetchMore function
21864
21939
  this._fetchMoreFn = res.fetchMore;
21865
21940
  return true;
21866
21941
  });
@@ -21883,8 +21958,8 @@ EntitiesTableDataSource.decorators = [
21883
21958
  EntitiesTableDataSource.ctorParameters = () => [
21884
21959
  { type: Function },
21885
21960
  { type: undefined },
21886
- { type: ValidatorService },
21887
- { type: AppTableDataSourceOptions }
21961
+ { type: undefined },
21962
+ { type: undefined }
21888
21963
  ];
21889
21964
 
21890
21965
  const SETTINGS_DISPLAY_COLUMNS = 'displayColumns';
@@ -22276,7 +22351,6 @@ class AppTable {
22276
22351
  }
22277
22352
  }
22278
22353
  ngOnDestroy() {
22279
- var _a;
22280
22354
  this._subscription.unsubscribe();
22281
22355
  // Unsubscribe column value changes
22282
22356
  Object.keys(this._cellValueChangesDefs).forEach(col => this.stopCellValueChanges(col, true));
@@ -22301,7 +22375,6 @@ class AppTable {
22301
22375
  this.onError.unsubscribe();
22302
22376
  this._destroy$.next();
22303
22377
  this._destroy$.unsubscribe();
22304
- (_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.ngOnDestroy();
22305
22378
  }
22306
22379
  updateView(res, opts) {
22307
22380
  return __awaiter(this, void 0, void 0, function* () {
@@ -22343,7 +22416,7 @@ class AppTable {
22343
22416
  this._dataSourceLoadingSubscription.unsubscribe();
22344
22417
  this._subscription.remove(this._dataSourceLoadingSubscription);
22345
22418
  }
22346
- (_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.ngOnDestroy();
22419
+ (_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.disconnect();
22347
22420
  this._dataSource = null;
22348
22421
  }
22349
22422
  addColumnDef(column) {
@@ -22514,6 +22587,7 @@ class AppTable {
22514
22587
  // Keep edited row id (should be done BEFORE confirmEditCreate() )
22515
22588
  this.previouslyEditedRowId = opts.keepEditing ? ((((_a = this.editedRow) === null || _a === void 0 ? void 0 : _a.editing) ? this.editedRow.id : undefined) || ((_b = this.singleSelectedRow) === null || _b === void 0 ? void 0 : _b.id)) : undefined;
22516
22589
  const previouslyEditedData = opts.keepEditing ? (isNotNil(this.previouslyEditedRowId) && ((_c = this.editedRow) === null || _c === void 0 ? void 0 : _c.currentData) || ((_d = this.singleSelectedRow) === null || _d === void 0 ? void 0 : _d.currentData)) : undefined;
22590
+ // TODO: remove this, has it redundant with dataSource.confirmAllRows() called in dataSource.save()
22517
22591
  if (!this.confirmEditCreate()) {
22518
22592
  throw { code: ErrorCodes.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
22519
22593
  }
@@ -23351,7 +23425,7 @@ class AppTable {
23351
23425
  var _a, _b;
23352
23426
  return __awaiter(this, void 0, void 0, function* () {
23353
23427
  // Mark row as pristine
23354
- const markRowAsPristine = ((_a = this.dataSource) === null || _a === void 0 ? void 0 : _a.options.keepOriginalDataAfterConfirm) === true;
23428
+ const markRowAsPristine = ((_a = this.dataSource) === null || _a === void 0 ? void 0 : _a.config.keepOriginalDataAfterConfirm) === true;
23355
23429
  if (markRowAsPristine) {
23356
23430
  (_b = row.validator) === null || _b === void 0 ? void 0 : _b.markAsPristine();
23357
23431
  // Check if table is now pristine
@@ -24760,7 +24834,7 @@ AppInMemoryTable.ctorParameters = () => [
24760
24834
  { type: Function },
24761
24835
  { type: InMemoryEntitiesService },
24762
24836
  { type: ValidatorService },
24763
- { type: AppTableDataSourceOptions },
24837
+ { type: undefined },
24764
24838
  { type: undefined }
24765
24839
  ];
24766
24840
  AppInMemoryTable.propDecorators = {
@@ -25936,7 +26010,11 @@ class UsersPage extends AppTable {
25936
26010
  switch (authTokenType) {
25937
26011
  case "basic":
25938
26012
  this.setShowColumn('pubkey', false, { emitEvent: false });
26013
+ this.setShowColumn('username', true, { emitEvent: false });
26014
+ this.setShowColumn('usernameExtranet', true, { emitEvent: false });
26015
+ break;
25939
26016
  case "basic-and-token":
26017
+ this.setShowColumn('pubkey', true, { emitEvent: false });
25940
26018
  this.setShowColumn('username', true, { emitEvent: false });
25941
26019
  this.setShowColumn('usernameExtranet', true, { emitEvent: false });
25942
26020
  break;
@@ -27467,5 +27545,5 @@ CoreTestingModule.decorators = [
27467
27545
  * Generated bundle index. Do not edit.
27468
27546
  */
27469
27547
 
27470
- export { APP_ABOUT_DEVELOPERS, APP_ABOUT_PARTNERS, APP_CONFIG_OPTIONS, APP_FORM_ERROR_I18N_KEYS, APP_GRAPHQL_TYPE_POLICIES, APP_HOME_BUTTONS, APP_LOCALES, APP_LOCAL_SETTINGS, APP_LOCAL_SETTINGS_OPTIONS, APP_LOCAL_STORAGE_TYPE_POLICIES, APP_MENU_ITEMS, APP_TESTING_PAGES, AboutModal, Account, AccountPage, AccountService, AccountToStringPipe, ActionsColumnComponent, AdminModule, AdminRoutingModule, Alerts, AndroidOsEnvironment, AnimationState, AppEditor, AppEditorOptions, AppEntityEditor, AppForm, AppFormField, AppFormProvider, AppFormUtils, AppGestureConfig, AppGraphQLModule, AppHelpModal, AppInMemoryTable, AppInstallUpgradeCard, AppListForm, AppLoadingSpinner, AppMenuModule, AppNullForm, AppPropertiesForm, AppTabEditor, AppTabEditorOptions, AppTable, AppTableDataSourceOptions, AppTableUtils, AppValidatorService, AppendToInputDirective, ArrayFilterPipe, ArrayFirstPipe, ArrayIncludesPipe, ArrayLengthPipe, ArrayPluckPipe, AudioProvider, AuthForm, AuthGuardService, AuthModal, AutocompleteTestPage, AutofocusDirective, Base58, BaseEntityService, BaseGraphqlService, BaseGraphqlServiceOptions, BaseReferential, Beans, CORE_CONFIG_OPTIONS, CORE_TESTING_PAGES, CellValueChangeListener, ChipsTestPage, Color, ColorScale, ComponentDirtyGuard, ConfigService, Configuration, CoreModule, CoreTestingModule, CryptoService, DATE_ISO_PATTERN, DATE_UNIX_MS_TIMESTAMP, DATE_UNIX_TIMESTAMP, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_PLACEHOLDER_CHAR, DEFAULT_REQUIRED_COLUMNS, DateDiffDurationPipe, DateFormatPipe, DateFromNowPipe, DateTimeTestPage, DateUtils, Department, DepartmentToStringPipe, DragAndDropDirective, DurationPipe, ENTITIES_STORAGE_KEY_PREFIX, ENVIRONMENT, EmptyArrayPipe, EntitiesService, EntitiesStorage, EntitiesTableDataSource, Entity, EntityClass, EntityClasses, EntityFilter, EntityFilterUtils, EntityMetadataComponent, EntityStore, EntityUtils, Environment, EvenPipe, FileResponse, FileService, FileSizePipe, FilesUtils, FormArrayHelper, FormButtonsBarComponent, FormButtonsBarToken, FormErrorTranslatePipe, FormErrorTranslator, FormFieldValuesHolder, FormGetArrayPipe, FormGetControlPipe, FormGetGroupPipe, FormGetPipe, Fragments$1 as Fragments, GraphqlService, HAMMER_PRESS_TIME, HAMMER_TAP_TIME, HighlightPipe, HomePage, Hotkeys, HotkeysDialogComponent, InMemoryEntitiesService, IsLoginAccountPipe, IsNilOrBlankPipe, IsNotNilOrBlankPipe, IsNotOnFieldModePipe, IsOnFieldModePipe, JobUtils, KEYBOARD_HIDE_DELAY_MS, LAT_LONG_DEFAULT_MAX_DECIMALS, LAT_LONG_PATTERNS, LatLongFormatPipe, LatLongTestPage, LatitudeFormatPipe, LocalSettingsService, LongitudeFormatPipe, MINIFY_ENTITY_FOR_LOCAL_STORAGE, MINIFY_ENTITY_FOR_POD, MapGetPipe, MapKeysPipe, MapValuesPipe, MatAutocompleteConfigHolder, MatAutocompleteField, MatBadgeIconDirective, MatBooleanField, MatChipsField, MatDate, MatDateShort, MatDateTime, MatDuration, MatLatLongField, MatNumpadComponent, MatNumpadContainerComponent, MatNumpadContent, MatPaginatorI18n, MatStepperI18n, MatSwipeField, MaterialTestingModule, MathAbsPipe, MenuComponent, MenuItems, MenuService, Message, MessageFilter, MessageForm, MessageModal, MessageService, MessageTypeList, MessageTypes, ModalToolbarComponent, NetworkService, NgInitDirective, NgVarDirective, NotEmptyArrayPipe, NumberFormatPipe, NumpadDirective, OddPipe, PRIORITIZED_AUTHORITIES, PUBKEY_REGEXP, Peer, Person, PersonFilter, PersonFragments, PersonService, PersonToStringPipe, PersonUtils, PersonValidatorService, PlatformService, ProgressBarService, ProgressInterceptor, PropertyGetPipe, RESERVED_END_COLUMNS, RESERVED_START_COLUMNS, Referential, ReferentialFilter, ReferentialRef, ReferentialUtils, ReferentialValidatorService, RegisterConfirmPage, SETTINGS_DISPLAY_COLUMNS, SETTINGS_FILTER, SETTINGS_PAGE_SIZE, SETTINGS_SORTED_COLUMN, SETTINGS_STORAGE_KEY, SETTINGS_TRANSIENT_PROPERTIES, SHARED_MATERIAL_TESTING_PAGES, SHARED_TESTING_PAGES, SPACE_PLACEHOLDER_CHAR, SelectPeerModal, SettingsPage, SharedAsyncValidators, SharedDirectivesModule, SharedFormArrayValidators, SharedFormGroupValidators, SharedHotkeysModule, SharedMatAutocompleteModule, SharedMatBadgeIconModule, SharedMatBooleanModule, SharedMatChipsModule, SharedMatDateTimeModule, SharedMatDurationModule, SharedMatLatLongModule, SharedMatNumpadModule, SharedMatSwipeModule, SharedMaterialModule, SharedModule, SharedPipesModule, SharedRoutingModule, SharedTestingModule, SharedTestsPage, SharedValidators, SocialErrorCodes, SocialModule, Software, StartableService, StatusById, StatusIds, StatusList, StrIncludesPipe, StrLengthPipe, SwipeTestPage, TableSelectColumnsComponent, TableTestPage, TableTestingModule, TextForm, TextPopover, TextPopoverTestingModule, TextPopoverTestingPage, ToStringPipe, Toasts, ToolbarComponent, ToolbarToken, TranslatablePipe, TranslateContextPipe, TranslateContextService, UploadFile, UploadFileComponent, UploadFilePopover, UploadFileTestingModule, UploadFileTestingPage, UserEvent, UserEventFilter, UserEventFragments, UserEventService, UserEventTypes, UserEventsTable, UserSettings, UsersPage, accountToString, adaptValueToControl, addValueInArray, arrayDistinct, arrayGroupBy, arraySize, asInputElement, canHaveFocus, capitalizeFirstLetter, chainPromises, changeCaseToUnderscore, clearValueInArray, copyEntity2Form, createPromiseEvent, createPromiseEventEmitter, departmentToString, departmentsToString, disableControls, emitPromiseEvent, entityToString, equals, equalsOrNil, fadeInAnimation, fadeInOutAnimation, filterFalse, filterNotNil, filterNumberInput, filterTrue, firstArrayValue, firstFalse, firstFalsePromise, firstNotNil, firstNotNilPromise, firstTrue, firstTruePromise, focusInput, focusNextInput, focusPreviousInput, formatLatitude, formatLongitude, fromDateISOString, fromScrollEndEvent, fromUnixMsTimestamp, fromUnixTimestamp, getCaretPosition, getColorContrast, getColorShade, getColorTint, getConnectionType, getControlFromPath, getFocusableInputElements, getFormErrors, getFormValueFromEntity, getProperty, getPropertyByPath, getPropertyByPathAsString, getRandomImage, hexToRgb, hexToRgbArray, isAndroid, isBlankString, isControlHasInput, isCordova, isEmptyArray, isIOS, isInputElement, isInstanceOf, isInt, isMobile, isNil, isNilOrBlank, isNilOrNaN, isNotEmptyArray, isNotNil, isNotNilBoolean, isNotNilOrBlank, isNotNilOrNaN, isNotNilString, isNumber, isNumberRange, isProgressEvent, isResponseEvent, isTouchUi, isWindows, joinProperties, joinPropertiesPath, logFormErrors, markAllAsTouched, markAsUntouched, markControlAsTouched, markFormGroupAsTouched, matchMedia, matchUpperCase, mergeLoadResult, mixHex, moveInputCaretToSeparator, noTrailingSlash, notNilOrDefault, nullIfUndefined, parseLatitudeOrLongitude, propertiesPathComparator, propertyComparator, propertyPathComparator, referentialToString, referentialsToString, remove, removeAll, removeDiacritics, removeDuplicatesFromArray, removeEnd, removeValueInArray, replaceAll, resetCalculatedValue, resizeArray, rgbArrayToHex, rgbToHex, round, scrollFactory, selectInputContent, selectInputRange, setCalculatedValue, setTabIndex, sleep, slideInOutAnimation, slideUpDownAnimation, sort, splitById, splitByProperty, startsWithUpperCase, suggestFromArray, suggestFromStringArray, tabindexComparator, testUserAgent, toBoolean, toDateISOString, toDuration, toFloat, toInt, toNotNil, toNumber, trimEmptyToNull, uncapitalizeFirstLetter, updateValueAndValidity, waitFor, waitForTrue, waitIdle, waitWhilePending, ɵ0, CustomReuseStrategy as ɵa, MatNumpadDomService as ɵb, isFocusableElement as ɵc, RegisterForm as ɵd, AccountValidatorService as ɵe, RegisterModal as ɵf, UserSettingsValidatorService as ɵg, LocalSettingsValidatorService as ɵh, AppIconComponent as ɵi, DateTestPage as ɵj, NumpadTestPage as ɵk, MatBadgeIconTestPage as ɵl, ToastTestingModule as ɵm, ToastTestingPage as ɵn };
27548
+ export { APP_ABOUT_DEVELOPERS, APP_ABOUT_PARTNERS, APP_CONFIG_OPTIONS, APP_FORM_ERROR_I18N_KEYS, APP_GRAPHQL_TYPE_POLICIES, APP_HOME_BUTTONS, APP_LOCALES, APP_LOCAL_SETTINGS, APP_LOCAL_SETTINGS_OPTIONS, APP_LOCAL_STORAGE_TYPE_POLICIES, APP_MENU_ITEMS, APP_TESTING_PAGES, AboutModal, Account, AccountPage, AccountService, AccountToStringPipe, ActionsColumnComponent, AdminModule, AdminRoutingModule, Alerts, AndroidOsEnvironment, AnimationState, AppEditor, AppEditorOptions, AppEntityEditor, AppForm, AppFormField, AppFormProvider, AppFormUtils, AppGestureConfig, AppGraphQLModule, AppHelpModal, AppInMemoryTable, AppInstallUpgradeCard, AppListForm, AppLoadingSpinner, AppMenuModule, AppNullForm, AppPropertiesForm, AppTabEditor, AppTabEditorOptions, AppTable, AppTableUtils, AppValidatorService, AppendToInputDirective, ArrayFilterPipe, ArrayFirstPipe, ArrayIncludesPipe, ArrayLengthPipe, ArrayPluckPipe, AudioProvider, AuthForm, AuthGuardService, AuthModal, AutocompleteTestPage, AutofocusDirective, Base58, BaseEntityService, BaseGraphqlService, BaseGraphqlServiceOptions, BaseReferential, Beans, CORE_CONFIG_OPTIONS, CORE_TESTING_PAGES, CellValueChangeListener, ChipsTestPage, Color, ColorScale, ComponentDirtyGuard, ConfigService, Configuration, CoreModule, CoreTestingModule, CryptoService, DATE_ISO_PATTERN, DATE_UNIX_MS_TIMESTAMP, DATE_UNIX_TIMESTAMP, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_PLACEHOLDER_CHAR, DEFAULT_REQUIRED_COLUMNS, DateDiffDurationPipe, DateFormatPipe, DateFromNowPipe, DateTimeTestPage, DateUtils, Department, DepartmentToStringPipe, DragAndDropDirective, DurationPipe, ENTITIES_STORAGE_KEY_PREFIX, ENVIRONMENT, EmptyArrayPipe, EntitiesService, EntitiesStorage, EntitiesTableDataSource, Entity, EntityClass, EntityClasses, EntityFilter, EntityFilterUtils, EntityMetadataComponent, EntityStore, EntityUtils, Environment, EvenPipe, FileResponse, FileService, FileSizePipe, FilesUtils, FormArrayHelper, FormButtonsBarComponent, FormButtonsBarToken, FormErrorTranslatePipe, FormErrorTranslator, FormFieldValuesHolder, FormGetArrayPipe, FormGetControlPipe, FormGetGroupPipe, FormGetPipe, Fragments$1 as Fragments, GraphqlService, HAMMER_PRESS_TIME, HAMMER_TAP_TIME, HighlightPipe, HomePage, Hotkeys, HotkeysDialogComponent, InMemoryEntitiesService, IsLoginAccountPipe, IsNilOrBlankPipe, IsNotNilOrBlankPipe, IsNotOnFieldModePipe, IsOnFieldModePipe, JobUtils, KEYBOARD_HIDE_DELAY_MS, LAT_LONG_DEFAULT_MAX_DECIMALS, LAT_LONG_PATTERNS, LatLongFormatPipe, LatLongTestPage, LatitudeFormatPipe, LocalSettingsService, LongitudeFormatPipe, MINIFY_ENTITY_FOR_LOCAL_STORAGE, MINIFY_ENTITY_FOR_POD, MapGetPipe, MapKeysPipe, MapValuesPipe, MatAutocompleteConfigHolder, MatAutocompleteField, MatBadgeIconDirective, MatBooleanField, MatChipsField, MatDate, MatDateShort, MatDateTime, MatDuration, MatLatLongField, MatNumpadComponent, MatNumpadContainerComponent, MatNumpadContent, MatPaginatorI18n, MatStepperI18n, MatSwipeField, MaterialTestingModule, MathAbsPipe, MenuComponent, MenuItems, MenuService, Message, MessageFilter, MessageForm, MessageModal, MessageService, MessageTypeList, MessageTypes, ModalToolbarComponent, NetworkService, NgInitDirective, NgVarDirective, NotEmptyArrayPipe, NumberFormatPipe, NumpadDirective, OddPipe, PRIORITIZED_AUTHORITIES, PUBKEY_REGEXP, Peer, Person, PersonFilter, PersonFragments, PersonService, PersonToStringPipe, PersonUtils, PersonValidatorService, PlatformService, ProgressBarService, ProgressInterceptor, PropertyGetPipe, RESERVED_END_COLUMNS, RESERVED_START_COLUMNS, Referential, ReferentialFilter, ReferentialRef, ReferentialUtils, ReferentialValidatorService, RegisterConfirmPage, SETTINGS_DISPLAY_COLUMNS, SETTINGS_FILTER, SETTINGS_PAGE_SIZE, SETTINGS_SORTED_COLUMN, SETTINGS_STORAGE_KEY, SETTINGS_TRANSIENT_PROPERTIES, SHARED_MATERIAL_TESTING_PAGES, SHARED_TESTING_PAGES, SPACE_PLACEHOLDER_CHAR, SelectPeerModal, SettingsPage, SharedAsyncValidators, SharedDirectivesModule, SharedFormArrayValidators, SharedFormGroupValidators, SharedHotkeysModule, SharedMatAutocompleteModule, SharedMatBadgeIconModule, SharedMatBooleanModule, SharedMatChipsModule, SharedMatDateTimeModule, SharedMatDurationModule, SharedMatLatLongModule, SharedMatNumpadModule, SharedMatSwipeModule, SharedMaterialModule, SharedModule, SharedPipesModule, SharedRoutingModule, SharedTestingModule, SharedTestsPage, SharedValidators, SocialErrorCodes, SocialModule, Software, StartableService, StatusById, StatusIds, StatusList, StrIncludesPipe, StrLengthPipe, SwipeTestPage, TableSelectColumnsComponent, TableTestPage, TableTestingModule, TextForm, TextPopover, TextPopoverTestingModule, TextPopoverTestingPage, ToStringPipe, Toasts, ToolbarComponent, ToolbarToken, TranslatablePipe, TranslateContextPipe, TranslateContextService, UploadFile, UploadFileComponent, UploadFilePopover, UploadFileTestingModule, UploadFileTestingPage, UserEvent, UserEventFilter, UserEventFragments, UserEventService, UserEventTypes, UserEventsTable, UserSettings, UsersPage, accountToString, adaptValueToControl, addValueInArray, arrayDistinct, arrayGroupBy, arraySize, asInputElement, canHaveFocus, capitalizeFirstLetter, chainPromises, changeCaseToUnderscore, clearValueInArray, copyEntity2Form, createPromiseEvent, createPromiseEventEmitter, departmentToString, departmentsToString, disableControls, emitPromiseEvent, entityToString, equals, equalsOrNil, fadeInAnimation, fadeInOutAnimation, filterFalse, filterNotNil, filterNumberInput, filterTrue, firstArrayValue, firstFalse, firstFalsePromise, firstNotNil, firstNotNilPromise, firstTrue, firstTruePromise, focusInput, focusNextInput, focusPreviousInput, formatLatitude, formatLongitude, fromDateISOString, fromScrollEndEvent, fromUnixMsTimestamp, fromUnixTimestamp, getCaretPosition, getColorContrast, getColorShade, getColorTint, getConnectionType, getControlFromPath, getFocusableInputElements, getFormErrors, getFormValueFromEntity, getProperty, getPropertyByPath, getPropertyByPathAsString, getRandomImage, hexToRgb, hexToRgbArray, isAndroid, isBlankString, isControlHasInput, isCordova, isEmptyArray, isIOS, isInputElement, isInstanceOf, isInt, isMobile, isNil, isNilOrBlank, isNilOrNaN, isNotEmptyArray, isNotNil, isNotNilBoolean, isNotNilOrBlank, isNotNilOrNaN, isNotNilString, isNumber, isNumberRange, isProgressEvent, isResponseEvent, isTouchUi, isWindows, joinProperties, joinPropertiesPath, logFormErrors, markAllAsTouched, markAsUntouched, markControlAsTouched, markFormGroupAsTouched, matchMedia, matchUpperCase, mergeLoadResult, mixHex, moveInputCaretToSeparator, noTrailingSlash, notNilOrDefault, nullIfUndefined, parseLatitudeOrLongitude, propertiesPathComparator, propertyComparator, propertyPathComparator, referentialToString, referentialsToString, remove, removeAll, removeDiacritics, removeDuplicatesFromArray, removeEnd, removeValueInArray, replaceAll, resetCalculatedValue, resizeArray, rgbArrayToHex, rgbToHex, round, scrollFactory, selectInputContent, selectInputRange, setCalculatedValue, setTabIndex, sleep, slideInOutAnimation, slideUpDownAnimation, sort, splitById, splitByProperty, startsWithUpperCase, suggestFromArray, suggestFromStringArray, tabindexComparator, testUserAgent, toBoolean, toDateISOString, toDuration, toFloat, toInt, toNotNil, toNumber, trimEmptyToNull, uncapitalizeFirstLetter, updateValueAndValidity, waitFor, waitForTrue, waitIdle, waitWhilePending, ɵ0, CustomReuseStrategy as ɵa, MatNumpadDomService as ɵb, isFocusableElement as ɵc, RegisterForm as ɵd, AccountValidatorService as ɵe, RegisterModal as ɵf, UserSettingsValidatorService as ɵg, LocalSettingsValidatorService as ɵh, AppIconComponent as ɵi, DateTestPage as ɵj, NumpadTestPage as ɵk, MatBadgeIconTestPage as ɵl, ToastTestingModule as ɵm, ToastTestingPage as ɵn };
27471
27549
  //# sourceMappingURL=sumaris-net.ngx-components.js.map