@sumaris-net/ngx-components 0.27.1 → 0.27.5

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.
@@ -1,11 +1,11 @@
1
1
  import { Injectable, Pipe } from '@angular/core';
2
2
  import * as i0 from "@angular/core";
3
3
  export class NumberFormatPipe {
4
- transform(val) {
4
+ transform(val, numberFormatOptions) {
5
5
  // Format the output to display any way you want here.
6
6
  // For instance:
7
7
  if (val !== undefined && val !== null) {
8
- return val.toLocaleString( /*arguments you need*/);
8
+ return val.toLocaleString(undefined, numberFormatOptions);
9
9
  }
10
10
  else {
11
11
  return '';
@@ -19,4 +19,4 @@ NumberFormatPipe.decorators = [
19
19
  },] },
20
20
  { type: Injectable, args: [{ providedIn: 'root' },] }
21
21
  ];
22
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnVtYmVyLWZvcm1hdC5waXBlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2FwcC9zaGFyZWQvcGlwZXMvbnVtYmVyLWZvcm1hdC5waXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBQyxVQUFVLEVBQUUsSUFBSSxFQUFnQixNQUFNLGVBQWUsQ0FBQzs7QUFNOUQsTUFBTSxPQUFPLGdCQUFnQjtJQUV6QixTQUFTLENBQUMsR0FBVztRQUNuQixzREFBc0Q7UUFDdEQsZ0JBQWdCO1FBQ2hCLElBQUksR0FBRyxLQUFLLFNBQVMsSUFBSSxHQUFHLEtBQUssSUFBSSxFQUFFO1lBQ3JDLE9BQU8sR0FBRyxDQUFDLGNBQWMsRUFBQyxzQkFBc0IsQ0FBQyxDQUFDO1NBQ25EO2FBQU07WUFDTCxPQUFPLEVBQUUsQ0FBQztTQUNYO0lBQ0gsQ0FBQzs7OztZQWRKLElBQUksU0FBQztnQkFDRixJQ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AgICAgIHJldHVybiB2YWwudG9Mb2NhbGVTdHJpbmcodW5kZWZpbmVkLCBudW1iZXJGb3JtYXRPcHRpb25zKTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHJldHVybiAnJztcbiAgICAgIH1cbiAgICB9XG59XG4iXX0=
@@ -1927,11 +1927,11 @@ LongitudeFormatPipe.decorators = [
1927
1927
  ];
1928
1928
 
1929
1929
  class NumberFormatPipe {
1930
- transform(val) {
1930
+ transform(val, numberFormatOptions) {
1931
1931
  // Format the output to display any way you want here.
1932
1932
  // For instance:
1933
1933
  if (val !== undefined && val !== null) {
1934
- return val.toLocaleString( /*arguments you need*/);
1934
+ return val.toLocaleString(undefined, numberFormatOptions);
1935
1935
  }
1936
1936
  else {
1937
1937
  return '';
@@ -2918,6 +2918,13 @@ class AppNullForm {
2918
2918
  markAsDirty(opts) { }
2919
2919
  markAsLoading(opts) { }
2920
2920
  markAsLoaded(opts) { }
2921
+ markAsReady(opts) { }
2922
+ waitIdle(opts) {
2923
+ return Promise.reject(false);
2924
+ }
2925
+ ready() {
2926
+ return Promise.reject(true);
2927
+ }
2921
2928
  }
2922
2929
  class AppFormProvider {
2923
2930
  constructor(getterFn) {
@@ -2961,6 +2968,9 @@ class AppFormProvider {
2961
2968
  get loading() {
2962
2969
  return this.delegate.loading;
2963
2970
  }
2971
+ ready() {
2972
+ return this.delegate.ready();
2973
+ }
2964
2974
  disable(opts) {
2965
2975
  return this.delegate.disable(opts);
2966
2976
  }
@@ -2988,6 +2998,9 @@ class AppFormProvider {
2988
2998
  markAsLoaded(opts) {
2989
2999
  return this.delegate.markAsLoaded(opts);
2990
3000
  }
3001
+ markAsReady(opts) {
3002
+ return this.delegate.markAsReady(opts);
3003
+ }
2991
3004
  }
2992
3005
  AppFormProvider.NULL_FORM = new AppNullForm();
2993
3006
  // TODO continue to use this kind of declaration ?
@@ -16553,6 +16566,7 @@ class AppForm {
16553
16566
  this._loading = true;
16554
16567
  this.i18nFieldPrefix = null;
16555
16568
  this._subscription = new Subscription();
16569
+ this._$ready = new BehaviorSubject(true);
16556
16570
  this.debug = false;
16557
16571
  this.onCancel = new EventEmitter();
16558
16572
  this.onSubmit = new EventEmitter();
@@ -16631,6 +16645,7 @@ class AppForm {
16631
16645
  this.onCancel.unsubscribe();
16632
16646
  this.onSubmit.complete();
16633
16647
  this.onSubmit.unsubscribe();
16648
+ this._$ready.complete();
16634
16649
  }
16635
16650
  cancel() {
16636
16651
  this.onCancel.emit();
@@ -16720,6 +16735,22 @@ class AppForm {
16720
16735
  this.markForCheck();
16721
16736
  }
16722
16737
  }
16738
+ markAsReady(opts) {
16739
+ if (!this._$ready.value) {
16740
+ this._$ready.next(true);
16741
+ // If subclasses implements OnReady
16742
+ if (typeof this['nngOnReady'] === 'function') {
16743
+ this.ngOnReady();
16744
+ }
16745
+ }
16746
+ }
16747
+ /**
16748
+ * Wait form is ready
16749
+ * @param opts
16750
+ */
16751
+ ready(opts) {
16752
+ return firstTruePromise(this._$ready);
16753
+ }
16723
16754
  /**
16724
16755
  * Wait form is idle (not loading)
16725
16756
  * @param opts
@@ -20334,6 +20365,7 @@ class AppTable {
20334
20365
  this.allowRowDetail = true;
20335
20366
  this.excludesColumns = [];
20336
20367
  this.totalRowCount = null;
20368
+ this.readySubject = new BehaviorSubject(false);
20337
20369
  this.loadingSubject = new BehaviorSubject(true);
20338
20370
  this.savingSubject = new BehaviorSubject(false);
20339
20371
  this.dirtySubject = new BehaviorSubject(false);
@@ -20537,6 +20569,14 @@ class AppTable {
20537
20569
  (_a = row.validator) === null || _a === void 0 ? void 0 : _a.markAsDirty(opts);
20538
20570
  this.markAsDirty(opts);
20539
20571
  }
20572
+ markAsReady(opts) {
20573
+ if (this.readySubject.value !== false) {
20574
+ this.readySubject.next(false);
20575
+ if (!opts || opts.emitEvent !== false) {
20576
+ this.markForCheck();
20577
+ }
20578
+ }
20579
+ }
20540
20580
  get loading() {
20541
20581
  return this.loadingSubject.value;
20542
20582
  }
@@ -21132,6 +21172,9 @@ class AppTable {
21132
21172
  moveRow(id, direction) {
21133
21173
  this.dataSource.move(id, direction);
21134
21174
  }
21175
+ ready() {
21176
+ return firstTruePromise(this.readySubject);
21177
+ }
21135
21178
  waitIdle() {
21136
21179
  return firstFalsePromise(this.loadingSubject);
21137
21180
  }
@@ -21814,8 +21857,8 @@ AppTable.propDecorators = {
21814
21857
  class AppTabEditorOptions {
21815
21858
  }
21816
21859
  // eslint-disable-next-line @angular-eslint/directive-class-suffix
21817
- class AppTabEditor {
21818
- constructor(route, router, alertCtrl, translate, options) {
21860
+ class AppEditor {
21861
+ constructor(route, router, alertCtrl, translate) {
21819
21862
  this.route = route;
21820
21863
  this.router = router;
21821
21864
  this.alertCtrl = alertCtrl;
@@ -21824,16 +21867,11 @@ class AppTabEditor {
21824
21867
  this._enabled = false;
21825
21868
  this._dirty = false;
21826
21869
  this._loading = true;
21827
- this._selectedTabIndex = 0;
21870
+ this._$ready = new BehaviorSubject(false);
21828
21871
  this.debug = false;
21829
21872
  this.submitted = false;
21830
21873
  this.toolbar = null;
21831
21874
  this.formButtonsBar = null;
21832
- this.selectedTabIndexChange = new EventEmitter();
21833
- options = Object.assign({ tabCount: 1, enableSwipe: true, tabGroupAnimationDuration: '200ms' }, options);
21834
- this.tabCount = options.tabCount;
21835
- this.enableSwipe = options.enableSwipe;
21836
- this.tabGroupAnimationDuration = options.tabGroupAnimationDuration;
21837
21875
  }
21838
21876
  get tables() {
21839
21877
  return this._children && this._children.filter(c => c instanceof AppTable);
@@ -21873,31 +21911,7 @@ class AppTabEditor {
21873
21911
  get empty() {
21874
21912
  return this._enabled;
21875
21913
  }
21876
- get selectedTabIndex() {
21877
- return this._selectedTabIndex;
21878
- }
21879
- set selectedTabIndex(value) {
21880
- this.setSelectedTabIndex(value);
21881
- }
21882
21914
  ngOnInit() {
21883
- this.queryTabIndexParamName = this.queryTabIndexParamName || 'tab';
21884
- // Read the selected tab index, from path query params
21885
- if (this.tabGroup) {
21886
- this.registerSubscription(this.route.queryParams
21887
- .subscribe(queryParams => {
21888
- this.queryParams = Object.assign({}, queryParams);
21889
- // Parse tab param
21890
- if (this.tabCount > 1 && this.queryTabIndexParamName) {
21891
- const tabIndex = queryParams[this.queryTabIndexParamName];
21892
- this.queryParams[this.queryTabIndexParamName] = tabIndex && parseInt(tabIndex) || undefined;
21893
- if (isNotNil(this.queryParams[this.queryTabIndexParamName])) {
21894
- this.selectedTabIndex = this.queryParams[this.queryTabIndexParamName];
21895
- }
21896
- }
21897
- // Realign tab, after a delay because the tab can be disabled when component is created
21898
- setTimeout(() => this.tabGroup.realignInkBar(), 500);
21899
- }));
21900
- }
21901
21915
  if (this.formButtonsBar) {
21902
21916
  this.registerSubscription(this.formButtonsBar.onBack.subscribe(event => this.goBack(event)));
21903
21917
  }
@@ -21907,7 +21921,6 @@ class AppTabEditor {
21907
21921
  }
21908
21922
  ngOnDestroy() {
21909
21923
  this._subscription.unsubscribe();
21910
- this.selectedTabIndexChange.complete();
21911
21924
  }
21912
21925
  addChildForm(form) {
21913
21926
  if (!form)
@@ -21989,65 +22002,16 @@ class AppTabEditor {
21989
22002
  this.markForCheck();
21990
22003
  }
21991
22004
  }
21992
- onTabChange(event, queryTabIndexParamName) {
21993
- queryTabIndexParamName = queryTabIndexParamName || this.queryTabIndexParamName;
21994
- if (!queryTabIndexParamName)
21995
- return true; // Skip if tab query param not set
21996
- if (!this.queryParams || +this.queryParams[queryTabIndexParamName] !== event.index) {
21997
- this.queryParams = this.queryParams || {};
21998
- this.queryParams[queryTabIndexParamName] = event.index;
21999
- if (queryTabIndexParamName === 'tab' && isNotNil(this.queryParams['subtab'])) {
22000
- delete this.queryParams.subtab; // clean subtab
22001
- }
22002
- this.router.navigate(['.'], {
22003
- relativeTo: this.route,
22004
- queryParams: this.queryParams,
22005
- replaceUrl: true
22006
- });
22007
- return true;
22008
- }
22009
- return false;
22005
+ markAsReady(opts) {
22006
+ var _a;
22007
+ (_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(c => c.markAsReady(opts));
22008
+ this._$ready.next(true);
22010
22009
  }
22011
- /**
22012
- * Action triggered when user swipes
22013
- */
22014
- onSwipeTab(event) {
22015
- // DEBUG
22016
- // if (this.debug) console.debug("[tab-page] onSwipeTab()");
22017
- // Skip, if not a valid swipe event
22018
- if (!this.enableSwipe || !event
22019
- || event.defaultPrevented || (event.srcEvent && event.srcEvent.defaultPrevented)
22020
- || event.pointerType !== 'touch') {
22021
- return false;
22022
- }
22023
- // DEBUG
22024
- //if (this.debug)
22025
- //console.debug("[tab-page] Detected swipe: " + event.type, event);
22026
- let selectTabIndex = this.selectedTabIndex;
22027
- switch (event.type) {
22028
- // Open next tab
22029
- case 'swipeleft':
22030
- const isLast = selectTabIndex >= (this.tabCount - 1);
22031
- selectTabIndex = isLast ? 0 : selectTabIndex + 1;
22032
- break;
22033
- // Open previous tab
22034
- case 'swiperight':
22035
- const isFirst = selectTabIndex <= 0;
22036
- selectTabIndex = isFirst ? this.tabCount : selectTabIndex - 1;
22037
- break;
22038
- // Other case
22039
- default:
22040
- console.error('[tab-page] Unknown swipe action: ' + event.type);
22041
- return false;
22042
- }
22043
- setTimeout(() => {
22044
- this.selectedTabIndex = selectTabIndex;
22045
- this.markForCheck();
22046
- });
22047
- return true;
22010
+ ready(opts) {
22011
+ return firstTruePromise(this._$ready);
22048
22012
  }
22049
- onSubTabChange(event) {
22050
- this.onTabChange(event, 'subtab');
22013
+ waitIdle(opts) {
22014
+ return AppFormUtils.waitIdle(this, opts);
22051
22015
  }
22052
22016
  cancel(event) {
22053
22017
  return __awaiter(this, void 0, void 0, function* () {
@@ -22068,7 +22032,6 @@ class AppTabEditor {
22068
22032
  return __awaiter(this, void 0, void 0, function* () {
22069
22033
  console.debug('[tab-page] Unloading data...');
22070
22034
  this.markAsLoading();
22071
- this.selectedTabIndex = 0;
22072
22035
  this._children.forEach(f => {
22073
22036
  if (f instanceof AppForm) {
22074
22037
  f.reset(null, opts);
@@ -22129,28 +22092,11 @@ class AppTabEditor {
22129
22092
  }
22130
22093
  });
22131
22094
  }
22132
- setSelectedTabIndex(value, opts) {
22133
- // Fix value
22134
- if (value < 0) {
22135
- value = 0;
22136
- }
22137
- else if (value > this.tabCount - 1) {
22138
- value = this.tabCount - 1;
22139
- }
22140
- this._selectedTabIndex = value;
22141
- this.selectedTabIndexChange.next(value);
22142
- if (this.tabGroup && (!opts || opts.realignInkBar !== false)) {
22143
- this.tabGroup.selectedIndex = value;
22144
- this.markForCheck();
22145
- // Wait tab change in UI, before realign ink tab
22146
- setTimeout(() => this.tabGroup.realignInkBar(), 200);
22147
- }
22148
- else if (!opts || opts.emitEvent !== false) {
22149
- this.markForCheck();
22150
- }
22151
- }
22152
- waitIdle(opts) {
22153
- return AppFormUtils.waitIdle(this, opts);
22095
+ logFormErrors() {
22096
+ var _a;
22097
+ if (this.debug)
22098
+ console.debug('[app-tab-editor] Page not valid. Checking where (forms, tables)...');
22099
+ (_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(c => this.logChildrenFormErrors(c));
22154
22100
  }
22155
22101
  /* -- protected methods -- */
22156
22102
  scrollToTop(duration) {
@@ -22227,16 +22173,10 @@ class AppTabEditor {
22227
22173
  yield Toasts.show(this.toastController, this.translate, opts);
22228
22174
  });
22229
22175
  }
22230
- logFormErrors() {
22231
- var _a;
22232
- if (this.debug)
22233
- console.debug('[app-tab-editor] Page not valid. Checking where (forms, tables)...');
22234
- (_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(c => this.logChildrenFormErrors(c));
22235
- }
22236
22176
  logChildrenFormErrors(c, prefix, path) {
22237
22177
  prefix = prefix || '[app-tab-editor] ';
22238
22178
  // If editor
22239
- if (c instanceof AppTabEditor) {
22179
+ if (c instanceof AppEditor) {
22240
22180
  c.logFormErrors();
22241
22181
  }
22242
22182
  // Angular form control
@@ -22278,6 +22218,156 @@ class AppTabEditor {
22278
22218
  // Should be override by subclasses, if change detection is Push
22279
22219
  }
22280
22220
  }
22221
+ AppEditor.decorators = [
22222
+ { type: Directive }
22223
+ ];
22224
+ AppEditor.ctorParameters = () => [
22225
+ { type: ActivatedRoute },
22226
+ { type: Router },
22227
+ { type: AlertController },
22228
+ { type: TranslateService }
22229
+ ];
22230
+ AppEditor.propDecorators = {
22231
+ toolbar: [{ type: ViewChild, args: [ToolbarToken,] }],
22232
+ formButtonsBar: [{ type: ViewChild, args: [FormButtonsBarToken, { static: true },] }],
22233
+ content: [{ type: ViewChild, args: [IonContent, { static: true },] }]
22234
+ };
22235
+ // eslint-disable-next-line @angular-eslint/directive-class-suffix
22236
+ class AppTabEditor extends AppEditor {
22237
+ constructor(route, router, alertCtrl, translate, options) {
22238
+ super(route, router, alertCtrl, translate);
22239
+ this.route = route;
22240
+ this.router = router;
22241
+ this.alertCtrl = alertCtrl;
22242
+ this.translate = translate;
22243
+ this._selectedTabIndex = 0;
22244
+ this.selectedTabIndexChange = new EventEmitter();
22245
+ options = Object.assign({ tabCount: 1, enableSwipe: true, tabGroupAnimationDuration: '200ms' }, options);
22246
+ this.tabCount = options.tabCount;
22247
+ this.enableSwipe = options.enableSwipe;
22248
+ this.tabGroupAnimationDuration = options.tabGroupAnimationDuration;
22249
+ }
22250
+ set selectedTabIndex(value) {
22251
+ this.setSelectedTabIndex(value);
22252
+ }
22253
+ get selectedTabIndex() {
22254
+ return this._selectedTabIndex;
22255
+ }
22256
+ ngOnInit() {
22257
+ super.ngOnInit();
22258
+ this.queryTabIndexParamName = this.queryTabIndexParamName || 'tab';
22259
+ // Read the selected tab index, from path query params
22260
+ if (this.tabGroup) {
22261
+ this.registerSubscription(this.route.queryParams
22262
+ .subscribe(queryParams => {
22263
+ this.queryParams = Object.assign({}, queryParams);
22264
+ // Parse tab param
22265
+ if (this.tabCount > 1 && this.queryTabIndexParamName) {
22266
+ const tabIndex = queryParams[this.queryTabIndexParamName];
22267
+ this.queryParams[this.queryTabIndexParamName] = tabIndex && parseInt(tabIndex) || undefined;
22268
+ if (isNotNil(this.queryParams[this.queryTabIndexParamName])) {
22269
+ this.selectedTabIndex = this.queryParams[this.queryTabIndexParamName];
22270
+ }
22271
+ }
22272
+ // Realign tab, after a delay because the tab can be disabled when component is created
22273
+ setTimeout(() => this.tabGroup.realignInkBar(), 500);
22274
+ }));
22275
+ }
22276
+ }
22277
+ ngOnDestroy() {
22278
+ super.ngOnDestroy();
22279
+ this.selectedTabIndexChange.complete();
22280
+ }
22281
+ setSelectedTabIndex(value, opts) {
22282
+ // Fix value
22283
+ if (value < 0) {
22284
+ value = 0;
22285
+ }
22286
+ else if (value > this.tabCount - 1) {
22287
+ value = this.tabCount - 1;
22288
+ }
22289
+ this._selectedTabIndex = value;
22290
+ this.selectedTabIndexChange.next(value);
22291
+ if (this.tabGroup && (!opts || opts.realignInkBar !== false)) {
22292
+ this.tabGroup.selectedIndex = value;
22293
+ this.markForCheck();
22294
+ // Wait tab change in UI, before realign ink tab
22295
+ setTimeout(() => this.tabGroup.realignInkBar(), 200);
22296
+ }
22297
+ else if (!opts || opts.emitEvent !== false) {
22298
+ this.markForCheck();
22299
+ }
22300
+ }
22301
+ onTabChange(event, queryTabIndexParamName) {
22302
+ queryTabIndexParamName = queryTabIndexParamName || this.queryTabIndexParamName;
22303
+ if (!queryTabIndexParamName)
22304
+ return true; // Skip if tab query param not set
22305
+ if (!this.queryParams || +this.queryParams[queryTabIndexParamName] !== event.index) {
22306
+ this.queryParams = this.queryParams || {};
22307
+ this.queryParams[queryTabIndexParamName] = event.index;
22308
+ if (queryTabIndexParamName === 'tab' && isNotNil(this.queryParams['subtab'])) {
22309
+ delete this.queryParams.subtab; // clean subtab
22310
+ }
22311
+ this.router.navigate(['.'], {
22312
+ relativeTo: this.route,
22313
+ queryParams: this.queryParams,
22314
+ replaceUrl: true
22315
+ });
22316
+ return true;
22317
+ }
22318
+ return false;
22319
+ }
22320
+ /**
22321
+ * Action triggered when user swipes
22322
+ */
22323
+ onSwipeTab(event) {
22324
+ // DEBUG
22325
+ // if (this.debug) console.debug("[tab-page] onSwipeTab()");
22326
+ // Skip, if not a valid swipe event
22327
+ if (!this.enableSwipe || !event
22328
+ || event.defaultPrevented || (event.srcEvent && event.srcEvent.defaultPrevented)
22329
+ || event.pointerType !== 'touch') {
22330
+ return false;
22331
+ }
22332
+ // DEBUG
22333
+ //if (this.debug)
22334
+ //console.debug("[tab-page] Detected swipe: " + event.type, event);
22335
+ let selectTabIndex = this.selectedTabIndex;
22336
+ switch (event.type) {
22337
+ // Open next tab
22338
+ case 'swipeleft':
22339
+ const isLast = selectTabIndex >= (this.tabCount - 1);
22340
+ selectTabIndex = isLast ? 0 : selectTabIndex + 1;
22341
+ break;
22342
+ // Open previous tab
22343
+ case 'swiperight':
22344
+ const isFirst = selectTabIndex <= 0;
22345
+ selectTabIndex = isFirst ? this.tabCount : selectTabIndex - 1;
22346
+ break;
22347
+ // Other case
22348
+ default:
22349
+ console.error('[tab-page] Unknown swipe action: ' + event.type);
22350
+ return false;
22351
+ }
22352
+ setTimeout(() => {
22353
+ this.selectedTabIndex = selectTabIndex;
22354
+ this.markForCheck();
22355
+ });
22356
+ return true;
22357
+ }
22358
+ onSubTabChange(event) {
22359
+ this.onTabChange(event, 'subtab');
22360
+ }
22361
+ unload(opts) {
22362
+ const _super = Object.create(null, {
22363
+ unload: { get: () => super.unload }
22364
+ });
22365
+ return __awaiter(this, void 0, void 0, function* () {
22366
+ this.selectedTabIndex = 0;
22367
+ yield _super.unload.call(this, opts);
22368
+ });
22369
+ }
22370
+ }
22281
22371
  AppTabEditor.decorators = [
22282
22372
  { type: Directive }
22283
22373
  ];
@@ -22290,12 +22380,9 @@ AppTabEditor.ctorParameters = () => [
22290
22380
  ];
22291
22381
  AppTabEditor.propDecorators = {
22292
22382
  queryTabIndexParamName: [{ type: Input }],
22293
- tabGroup: [{ type: ViewChild, args: ['tabGroup', { static: true },] }],
22294
- toolbar: [{ type: ViewChild, args: [ToolbarToken,] }],
22295
- formButtonsBar: [{ type: ViewChild, args: [FormButtonsBarToken, { static: true },] }],
22296
- content: [{ type: ViewChild, args: [IonContent, { static: true },] }],
22297
22383
  selectedTabIndex: [{ type: Input }],
22298
- selectedTabIndexChange: [{ type: Output }]
22384
+ selectedTabIndexChange: [{ type: Output }],
22385
+ tabGroup: [{ type: ViewChild, args: ['tabGroup', { static: true },] }]
22299
22386
  };
22300
22387
 
22301
22388
  class AppEditorOptions extends AppTabEditorOptions {
@@ -22486,6 +22573,7 @@ class AppEntityEditor extends AppTabEditor {
22486
22573
  opts = Object.assign({ updateRoute: this._autoUpdateRoute && idChanged && !this.loading, openTabIndex: this._autoOpenNextTab && idChanged && isNil(this.previousDataId) && this.computeNextTabIndex() }, opts);
22487
22574
  this.data = data;
22488
22575
  this.previousDataId = data.id || null;
22576
+ yield this.ready();
22489
22577
  const promiseOrVoid = this.setValue(data);
22490
22578
  if (promiseOrVoid)
22491
22579
  yield promiseOrVoid;
@@ -24002,5 +24090,5 @@ const ErrorCodes = {
24002
24090
  * Generated bundle index. Do not edit.
24003
24091
  */
24004
24092
 
24005
- 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, AnimationState, 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, CellValueChangeListener, ChipsTestPage, Color, ColorScale, ComponentDirtyGuard, ConfigService, Configuration, CoreModule, 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, DurationPipe, ENTITIES_STORAGE_KEY_PREFIX, ENVIRONMENT, EmptyArrayPipe, EntitiesService, EntitiesStorage, EntitiesTableDataSource, Entity, EntityClass, EntityClasses, EntityFilter, EntityFilterUtils, EntityMetadataComponent, EntityStore, EntityUtils, Environment, ErrorCodes, EvenPipe, FileService, FileSizePipe, FormArrayHelper, FormButtonsBarComponent, FormButtonsBarToken, FormErrorTranslatePipe, FormErrorTranslator, FormFieldValuesHolder, 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, MatBooleanField, MatChipsField, MatDate, MatDateShort, MatDateTime, MatDuration, MatLatLongField, MatNumpadComponent, MatNumpadContainerComponent, MatNumpadContent, MatPaginatorI18n, MatStepperI18n, MatSwipeField, MaterialChipsModule, MaterialTestingModule, MaterialTestingPage, MathAbsPipe, MenuComponent, MenuItems, MenuService, ModalToolbarComponent, NetworkService, NgInitDirective, 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, ReferentialRef, ReferentialUtils, RegisterConfirmPage, SETTINGS_DISPLAY_COLUMNS, SETTINGS_FILTER, SETTINGS_PAGE_SIZE, SETTINGS_SORTED_COLUMN, SETTINGS_STORAGE_KEY, SETTINGS_TRANSIENT_PROPERTIES, SPACE_PLACEHOLDER_CHAR, SelectPeerModal, SettingsPage, SharedDirectivesModule, SharedFormArrayValidators, SharedFormGroupValidators, SharedHotkeysModule, SharedMatAutocompleteModule, SharedMatBooleanModule, SharedMatDateTimeModule, SharedMatDurationModule, SharedMatLatLongModule, SharedMatNumpadModule, SharedMatSwipeModule, SharedMaterialModule, SharedModule, SharedPipesModule, SharedRoutingModule, SharedTestingModule, SharedValidators, SocialModule, Software, StartableService, StatusById, StatusIds, StatusList, StrLengthPipe, SwipeTestPage, TableSelectColumnsComponent, ToStringPipe, Toasts, ToolbarComponent, ToolbarToken, TranslatablePipe, TranslateContextPipe, TranslateContextService, UserEvent, UserEventFilter, 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, equalsOrNil, fadeInAnimation, fadeInOutAnimation, filterFalse, filterNotNil, filterNumberInput, filterTrue, firstArrayValue, firstFalsePromise, firstNotNil, firstNotNilPromise, 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, isControlHasInput, isEmptyArray, isInputElement, isInstanceOf, isInt, isNil, isNilOrBlank, isNilOrNaN, isNotEmptyArray, isNotNil, isNotNilOrBlank, isNotNilOrNaN, isNotNilString, isNumber, isNumberRange, joinProperties, joinPropertiesPath, logFormErrors, markAllAsTouched, markAsUntouched, markControlAsTouched, markFormGroupAsTouched, 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, toBoolean, toDateISOString, toDuration, toFloat, toInt, toNotNil, toNumber, trimEmptyToNull, uncapitalizeFirstLetter, updateValueAndValidity, waitFor, waitIdle, waitWhilePending, ɵ0$5 as ɵ0, CustomReuseStrategy as ɵa, MatNumpadDomService as ɵb, SharedMatBadgeIconModule as ɵc, MatBadgeIconDirective as ɵd, isFocusableElement as ɵe, MatBadgeIconTestPage as ɵf, RegisterForm as ɵg, AccountValidatorService as ɵh, RegisterModal as ɵi, UserSettingsValidatorService as ɵj, LocalSettingsValidatorService as ɵk };
24093
+ 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, 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, CellValueChangeListener, ChipsTestPage, Color, ColorScale, ComponentDirtyGuard, ConfigService, Configuration, CoreModule, 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, DurationPipe, ENTITIES_STORAGE_KEY_PREFIX, ENVIRONMENT, EmptyArrayPipe, EntitiesService, EntitiesStorage, EntitiesTableDataSource, Entity, EntityClass, EntityClasses, EntityFilter, EntityFilterUtils, EntityMetadataComponent, EntityStore, EntityUtils, Environment, ErrorCodes, EvenPipe, FileService, FileSizePipe, FormArrayHelper, FormButtonsBarComponent, FormButtonsBarToken, FormErrorTranslatePipe, FormErrorTranslator, FormFieldValuesHolder, 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, MatBooleanField, MatChipsField, MatDate, MatDateShort, MatDateTime, MatDuration, MatLatLongField, MatNumpadComponent, MatNumpadContainerComponent, MatNumpadContent, MatPaginatorI18n, MatStepperI18n, MatSwipeField, MaterialChipsModule, MaterialTestingModule, MaterialTestingPage, MathAbsPipe, MenuComponent, MenuItems, MenuService, ModalToolbarComponent, NetworkService, NgInitDirective, 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, ReferentialRef, ReferentialUtils, RegisterConfirmPage, SETTINGS_DISPLAY_COLUMNS, SETTINGS_FILTER, SETTINGS_PAGE_SIZE, SETTINGS_SORTED_COLUMN, SETTINGS_STORAGE_KEY, SETTINGS_TRANSIENT_PROPERTIES, SPACE_PLACEHOLDER_CHAR, SelectPeerModal, SettingsPage, SharedDirectivesModule, SharedFormArrayValidators, SharedFormGroupValidators, SharedHotkeysModule, SharedMatAutocompleteModule, SharedMatBooleanModule, SharedMatDateTimeModule, SharedMatDurationModule, SharedMatLatLongModule, SharedMatNumpadModule, SharedMatSwipeModule, SharedMaterialModule, SharedModule, SharedPipesModule, SharedRoutingModule, SharedTestingModule, SharedValidators, SocialModule, Software, StartableService, StatusById, StatusIds, StatusList, StrLengthPipe, SwipeTestPage, TableSelectColumnsComponent, ToStringPipe, Toasts, ToolbarComponent, ToolbarToken, TranslatablePipe, TranslateContextPipe, TranslateContextService, UserEvent, UserEventFilter, 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, equalsOrNil, fadeInAnimation, fadeInOutAnimation, filterFalse, filterNotNil, filterNumberInput, filterTrue, firstArrayValue, firstFalsePromise, firstNotNil, firstNotNilPromise, 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, isControlHasInput, isEmptyArray, isInputElement, isInstanceOf, isInt, isNil, isNilOrBlank, isNilOrNaN, isNotEmptyArray, isNotNil, isNotNilOrBlank, isNotNilOrNaN, isNotNilString, isNumber, isNumberRange, joinProperties, joinPropertiesPath, logFormErrors, markAllAsTouched, markAsUntouched, markControlAsTouched, markFormGroupAsTouched, 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, toBoolean, toDateISOString, toDuration, toFloat, toInt, toNotNil, toNumber, trimEmptyToNull, uncapitalizeFirstLetter, updateValueAndValidity, waitFor, waitIdle, waitWhilePending, ɵ0$5 as ɵ0, CustomReuseStrategy as ɵa, MatNumpadDomService as ɵb, SharedMatBadgeIconModule as ɵc, MatBadgeIconDirective as ɵd, isFocusableElement as ɵe, MatBadgeIconTestPage as ɵf, RegisterForm as ɵg, AccountValidatorService as ɵh, RegisterModal as ɵi, UserSettingsValidatorService as ɵj, LocalSettingsValidatorService as ɵk };
24006
24094
  //# sourceMappingURL=sumaris-net.ngx-components.js.map