@sumaris-net/ngx-components 0.27.0 → 0.27.4

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 ?
@@ -14402,9 +14415,6 @@ class PlatformService extends StartableService {
14402
14415
  this._debug = !environment.production;
14403
14416
  if (this._debug)
14404
14417
  console.debug('[platform] Creating service');
14405
- this.start()
14406
- // Manage error
14407
- .catch(err => this.onStartupError(err));
14408
14418
  }
14409
14419
  get mobile() {
14410
14420
  return isNotNil(this._mobile) ? this._mobile : this.platform.is('mobile');
@@ -14423,7 +14433,7 @@ class PlatformService extends StartableService {
14423
14433
  return this._android && this._cordova;
14424
14434
  }
14425
14435
  get canDownload() {
14426
- return this._android && !!this.downloader;
14436
+ return isNotNil(this.downloader);
14427
14437
  }
14428
14438
  width() {
14429
14439
  return this.platform.width();
@@ -16554,6 +16564,7 @@ class AppForm {
16554
16564
  this.error = null;
16555
16565
  this._enable = false;
16556
16566
  this._loading = true;
16567
+ this._$ready = new BehaviorSubject(true);
16557
16568
  this.i18nFieldPrefix = null;
16558
16569
  this._subscription = new Subscription();
16559
16570
  this.debug = false;
@@ -16723,6 +16734,18 @@ class AppForm {
16723
16734
  this.markForCheck();
16724
16735
  }
16725
16736
  }
16737
+ markAsReady(opts) {
16738
+ if (!this._$ready.value) {
16739
+ this._$ready.next(true);
16740
+ }
16741
+ }
16742
+ /**
16743
+ * Wait form is ready
16744
+ * @param opts
16745
+ */
16746
+ ready(opts) {
16747
+ return firstTruePromise(this._$ready);
16748
+ }
16726
16749
  /**
16727
16750
  * Wait form is idle (not loading)
16728
16751
  * @param opts
@@ -20337,6 +20360,7 @@ class AppTable {
20337
20360
  this.allowRowDetail = true;
20338
20361
  this.excludesColumns = [];
20339
20362
  this.totalRowCount = null;
20363
+ this.readySubject = new BehaviorSubject(false);
20340
20364
  this.loadingSubject = new BehaviorSubject(true);
20341
20365
  this.savingSubject = new BehaviorSubject(false);
20342
20366
  this.dirtySubject = new BehaviorSubject(false);
@@ -20540,6 +20564,14 @@ class AppTable {
20540
20564
  (_a = row.validator) === null || _a === void 0 ? void 0 : _a.markAsDirty(opts);
20541
20565
  this.markAsDirty(opts);
20542
20566
  }
20567
+ markAsReady(opts) {
20568
+ if (this.readySubject.value !== false) {
20569
+ this.readySubject.next(false);
20570
+ if (!opts || opts.emitEvent !== false) {
20571
+ this.markForCheck();
20572
+ }
20573
+ }
20574
+ }
20543
20575
  get loading() {
20544
20576
  return this.loadingSubject.value;
20545
20577
  }
@@ -21135,6 +21167,9 @@ class AppTable {
21135
21167
  moveRow(id, direction) {
21136
21168
  this.dataSource.move(id, direction);
21137
21169
  }
21170
+ ready() {
21171
+ return firstTruePromise(this.readySubject);
21172
+ }
21138
21173
  waitIdle() {
21139
21174
  return firstFalsePromise(this.loadingSubject);
21140
21175
  }
@@ -21817,8 +21852,8 @@ AppTable.propDecorators = {
21817
21852
  class AppTabEditorOptions {
21818
21853
  }
21819
21854
  // eslint-disable-next-line @angular-eslint/directive-class-suffix
21820
- class AppTabEditor {
21821
- constructor(route, router, alertCtrl, translate, options) {
21855
+ class AppEditor {
21856
+ constructor(route, router, alertCtrl, translate) {
21822
21857
  this.route = route;
21823
21858
  this.router = router;
21824
21859
  this.alertCtrl = alertCtrl;
@@ -21827,16 +21862,11 @@ class AppTabEditor {
21827
21862
  this._enabled = false;
21828
21863
  this._dirty = false;
21829
21864
  this._loading = true;
21830
- this._selectedTabIndex = 0;
21865
+ this._$ready = new BehaviorSubject(false);
21831
21866
  this.debug = false;
21832
21867
  this.submitted = false;
21833
21868
  this.toolbar = null;
21834
21869
  this.formButtonsBar = null;
21835
- this.selectedTabIndexChange = new EventEmitter();
21836
- options = Object.assign({ tabCount: 1, enableSwipe: true, tabGroupAnimationDuration: '200ms' }, options);
21837
- this.tabCount = options.tabCount;
21838
- this.enableSwipe = options.enableSwipe;
21839
- this.tabGroupAnimationDuration = options.tabGroupAnimationDuration;
21840
21870
  }
21841
21871
  get tables() {
21842
21872
  return this._children && this._children.filter(c => c instanceof AppTable);
@@ -21876,31 +21906,7 @@ class AppTabEditor {
21876
21906
  get empty() {
21877
21907
  return this._enabled;
21878
21908
  }
21879
- get selectedTabIndex() {
21880
- return this._selectedTabIndex;
21881
- }
21882
- set selectedTabIndex(value) {
21883
- this.setSelectedTabIndex(value);
21884
- }
21885
21909
  ngOnInit() {
21886
- this.queryTabIndexParamName = this.queryTabIndexParamName || 'tab';
21887
- // Read the selected tab index, from path query params
21888
- if (this.tabGroup) {
21889
- this.registerSubscription(this.route.queryParams
21890
- .subscribe(queryParams => {
21891
- this.queryParams = Object.assign({}, queryParams);
21892
- // Parse tab param
21893
- if (this.tabCount > 1 && this.queryTabIndexParamName) {
21894
- const tabIndex = queryParams[this.queryTabIndexParamName];
21895
- this.queryParams[this.queryTabIndexParamName] = tabIndex && parseInt(tabIndex) || undefined;
21896
- if (isNotNil(this.queryParams[this.queryTabIndexParamName])) {
21897
- this.selectedTabIndex = this.queryParams[this.queryTabIndexParamName];
21898
- }
21899
- }
21900
- // Realign tab, after a delay because the tab can be disabled when component is created
21901
- setTimeout(() => this.tabGroup.realignInkBar(), 500);
21902
- }));
21903
- }
21904
21910
  if (this.formButtonsBar) {
21905
21911
  this.registerSubscription(this.formButtonsBar.onBack.subscribe(event => this.goBack(event)));
21906
21912
  }
@@ -21910,7 +21916,6 @@ class AppTabEditor {
21910
21916
  }
21911
21917
  ngOnDestroy() {
21912
21918
  this._subscription.unsubscribe();
21913
- this.selectedTabIndexChange.complete();
21914
21919
  }
21915
21920
  addChildForm(form) {
21916
21921
  if (!form)
@@ -21992,65 +21997,16 @@ class AppTabEditor {
21992
21997
  this.markForCheck();
21993
21998
  }
21994
21999
  }
21995
- onTabChange(event, queryTabIndexParamName) {
21996
- queryTabIndexParamName = queryTabIndexParamName || this.queryTabIndexParamName;
21997
- if (!queryTabIndexParamName)
21998
- return true; // Skip if tab query param not set
21999
- if (!this.queryParams || +this.queryParams[queryTabIndexParamName] !== event.index) {
22000
- this.queryParams = this.queryParams || {};
22001
- this.queryParams[queryTabIndexParamName] = event.index;
22002
- if (queryTabIndexParamName === 'tab' && isNotNil(this.queryParams['subtab'])) {
22003
- delete this.queryParams.subtab; // clean subtab
22004
- }
22005
- this.router.navigate(['.'], {
22006
- relativeTo: this.route,
22007
- queryParams: this.queryParams,
22008
- replaceUrl: true
22009
- });
22010
- return true;
22011
- }
22012
- return false;
22000
+ markAsReady(opts) {
22001
+ var _a;
22002
+ (_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(c => c.markAsReady(opts));
22003
+ this._$ready.next(true);
22013
22004
  }
22014
- /**
22015
- * Action triggered when user swipes
22016
- */
22017
- onSwipeTab(event) {
22018
- // DEBUG
22019
- // if (this.debug) console.debug("[tab-page] onSwipeTab()");
22020
- // Skip, if not a valid swipe event
22021
- if (!this.enableSwipe || !event
22022
- || event.defaultPrevented || (event.srcEvent && event.srcEvent.defaultPrevented)
22023
- || event.pointerType !== 'touch') {
22024
- return false;
22025
- }
22026
- // DEBUG
22027
- //if (this.debug)
22028
- //console.debug("[tab-page] Detected swipe: " + event.type, event);
22029
- let selectTabIndex = this.selectedTabIndex;
22030
- switch (event.type) {
22031
- // Open next tab
22032
- case 'swipeleft':
22033
- const isLast = selectTabIndex >= (this.tabCount - 1);
22034
- selectTabIndex = isLast ? 0 : selectTabIndex + 1;
22035
- break;
22036
- // Open previous tab
22037
- case 'swiperight':
22038
- const isFirst = selectTabIndex <= 0;
22039
- selectTabIndex = isFirst ? this.tabCount : selectTabIndex - 1;
22040
- break;
22041
- // Other case
22042
- default:
22043
- console.error('[tab-page] Unknown swipe action: ' + event.type);
22044
- return false;
22045
- }
22046
- setTimeout(() => {
22047
- this.selectedTabIndex = selectTabIndex;
22048
- this.markForCheck();
22049
- });
22050
- return true;
22005
+ ready(opts) {
22006
+ return firstTruePromise(this._$ready);
22051
22007
  }
22052
- onSubTabChange(event) {
22053
- this.onTabChange(event, 'subtab');
22008
+ waitIdle(opts) {
22009
+ return AppFormUtils.waitIdle(this, opts);
22054
22010
  }
22055
22011
  cancel(event) {
22056
22012
  return __awaiter(this, void 0, void 0, function* () {
@@ -22071,7 +22027,6 @@ class AppTabEditor {
22071
22027
  return __awaiter(this, void 0, void 0, function* () {
22072
22028
  console.debug('[tab-page] Unloading data...');
22073
22029
  this.markAsLoading();
22074
- this.selectedTabIndex = 0;
22075
22030
  this._children.forEach(f => {
22076
22031
  if (f instanceof AppForm) {
22077
22032
  f.reset(null, opts);
@@ -22132,28 +22087,11 @@ class AppTabEditor {
22132
22087
  }
22133
22088
  });
22134
22089
  }
22135
- setSelectedTabIndex(value, opts) {
22136
- // Fix value
22137
- if (value < 0) {
22138
- value = 0;
22139
- }
22140
- else if (value > this.tabCount - 1) {
22141
- value = this.tabCount - 1;
22142
- }
22143
- this._selectedTabIndex = value;
22144
- this.selectedTabIndexChange.next(value);
22145
- if (this.tabGroup && (!opts || opts.realignInkBar !== false)) {
22146
- this.tabGroup.selectedIndex = value;
22147
- this.markForCheck();
22148
- // Wait tab change in UI, before realign ink tab
22149
- setTimeout(() => this.tabGroup.realignInkBar(), 200);
22150
- }
22151
- else if (!opts || opts.emitEvent !== false) {
22152
- this.markForCheck();
22153
- }
22154
- }
22155
- waitIdle(opts) {
22156
- return AppFormUtils.waitIdle(this, opts);
22090
+ logFormErrors() {
22091
+ var _a;
22092
+ if (this.debug)
22093
+ console.debug('[app-tab-editor] Page not valid. Checking where (forms, tables)...');
22094
+ (_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(c => this.logChildrenFormErrors(c));
22157
22095
  }
22158
22096
  /* -- protected methods -- */
22159
22097
  scrollToTop(duration) {
@@ -22230,16 +22168,10 @@ class AppTabEditor {
22230
22168
  yield Toasts.show(this.toastController, this.translate, opts);
22231
22169
  });
22232
22170
  }
22233
- logFormErrors() {
22234
- var _a;
22235
- if (this.debug)
22236
- console.debug('[app-tab-editor] Page not valid. Checking where (forms, tables)...');
22237
- (_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(c => this.logChildrenFormErrors(c));
22238
- }
22239
22171
  logChildrenFormErrors(c, prefix, path) {
22240
22172
  prefix = prefix || '[app-tab-editor] ';
22241
22173
  // If editor
22242
- if (c instanceof AppTabEditor) {
22174
+ if (c instanceof AppEditor) {
22243
22175
  c.logFormErrors();
22244
22176
  }
22245
22177
  // Angular form control
@@ -22281,6 +22213,156 @@ class AppTabEditor {
22281
22213
  // Should be override by subclasses, if change detection is Push
22282
22214
  }
22283
22215
  }
22216
+ AppEditor.decorators = [
22217
+ { type: Directive }
22218
+ ];
22219
+ AppEditor.ctorParameters = () => [
22220
+ { type: ActivatedRoute },
22221
+ { type: Router },
22222
+ { type: AlertController },
22223
+ { type: TranslateService }
22224
+ ];
22225
+ AppEditor.propDecorators = {
22226
+ toolbar: [{ type: ViewChild, args: [ToolbarToken,] }],
22227
+ formButtonsBar: [{ type: ViewChild, args: [FormButtonsBarToken, { static: true },] }],
22228
+ content: [{ type: ViewChild, args: [IonContent, { static: true },] }]
22229
+ };
22230
+ // eslint-disable-next-line @angular-eslint/directive-class-suffix
22231
+ class AppTabEditor extends AppEditor {
22232
+ constructor(route, router, alertCtrl, translate, options) {
22233
+ super(route, router, alertCtrl, translate);
22234
+ this.route = route;
22235
+ this.router = router;
22236
+ this.alertCtrl = alertCtrl;
22237
+ this.translate = translate;
22238
+ this._selectedTabIndex = 0;
22239
+ this.selectedTabIndexChange = new EventEmitter();
22240
+ options = Object.assign({ tabCount: 1, enableSwipe: true, tabGroupAnimationDuration: '200ms' }, options);
22241
+ this.tabCount = options.tabCount;
22242
+ this.enableSwipe = options.enableSwipe;
22243
+ this.tabGroupAnimationDuration = options.tabGroupAnimationDuration;
22244
+ }
22245
+ set selectedTabIndex(value) {
22246
+ this.setSelectedTabIndex(value);
22247
+ }
22248
+ get selectedTabIndex() {
22249
+ return this._selectedTabIndex;
22250
+ }
22251
+ ngOnInit() {
22252
+ super.ngOnInit();
22253
+ this.queryTabIndexParamName = this.queryTabIndexParamName || 'tab';
22254
+ // Read the selected tab index, from path query params
22255
+ if (this.tabGroup) {
22256
+ this.registerSubscription(this.route.queryParams
22257
+ .subscribe(queryParams => {
22258
+ this.queryParams = Object.assign({}, queryParams);
22259
+ // Parse tab param
22260
+ if (this.tabCount > 1 && this.queryTabIndexParamName) {
22261
+ const tabIndex = queryParams[this.queryTabIndexParamName];
22262
+ this.queryParams[this.queryTabIndexParamName] = tabIndex && parseInt(tabIndex) || undefined;
22263
+ if (isNotNil(this.queryParams[this.queryTabIndexParamName])) {
22264
+ this.selectedTabIndex = this.queryParams[this.queryTabIndexParamName];
22265
+ }
22266
+ }
22267
+ // Realign tab, after a delay because the tab can be disabled when component is created
22268
+ setTimeout(() => this.tabGroup.realignInkBar(), 500);
22269
+ }));
22270
+ }
22271
+ }
22272
+ ngOnDestroy() {
22273
+ super.ngOnDestroy();
22274
+ this.selectedTabIndexChange.complete();
22275
+ }
22276
+ setSelectedTabIndex(value, opts) {
22277
+ // Fix value
22278
+ if (value < 0) {
22279
+ value = 0;
22280
+ }
22281
+ else if (value > this.tabCount - 1) {
22282
+ value = this.tabCount - 1;
22283
+ }
22284
+ this._selectedTabIndex = value;
22285
+ this.selectedTabIndexChange.next(value);
22286
+ if (this.tabGroup && (!opts || opts.realignInkBar !== false)) {
22287
+ this.tabGroup.selectedIndex = value;
22288
+ this.markForCheck();
22289
+ // Wait tab change in UI, before realign ink tab
22290
+ setTimeout(() => this.tabGroup.realignInkBar(), 200);
22291
+ }
22292
+ else if (!opts || opts.emitEvent !== false) {
22293
+ this.markForCheck();
22294
+ }
22295
+ }
22296
+ onTabChange(event, queryTabIndexParamName) {
22297
+ queryTabIndexParamName = queryTabIndexParamName || this.queryTabIndexParamName;
22298
+ if (!queryTabIndexParamName)
22299
+ return true; // Skip if tab query param not set
22300
+ if (!this.queryParams || +this.queryParams[queryTabIndexParamName] !== event.index) {
22301
+ this.queryParams = this.queryParams || {};
22302
+ this.queryParams[queryTabIndexParamName] = event.index;
22303
+ if (queryTabIndexParamName === 'tab' && isNotNil(this.queryParams['subtab'])) {
22304
+ delete this.queryParams.subtab; // clean subtab
22305
+ }
22306
+ this.router.navigate(['.'], {
22307
+ relativeTo: this.route,
22308
+ queryParams: this.queryParams,
22309
+ replaceUrl: true
22310
+ });
22311
+ return true;
22312
+ }
22313
+ return false;
22314
+ }
22315
+ /**
22316
+ * Action triggered when user swipes
22317
+ */
22318
+ onSwipeTab(event) {
22319
+ // DEBUG
22320
+ // if (this.debug) console.debug("[tab-page] onSwipeTab()");
22321
+ // Skip, if not a valid swipe event
22322
+ if (!this.enableSwipe || !event
22323
+ || event.defaultPrevented || (event.srcEvent && event.srcEvent.defaultPrevented)
22324
+ || event.pointerType !== 'touch') {
22325
+ return false;
22326
+ }
22327
+ // DEBUG
22328
+ //if (this.debug)
22329
+ //console.debug("[tab-page] Detected swipe: " + event.type, event);
22330
+ let selectTabIndex = this.selectedTabIndex;
22331
+ switch (event.type) {
22332
+ // Open next tab
22333
+ case 'swipeleft':
22334
+ const isLast = selectTabIndex >= (this.tabCount - 1);
22335
+ selectTabIndex = isLast ? 0 : selectTabIndex + 1;
22336
+ break;
22337
+ // Open previous tab
22338
+ case 'swiperight':
22339
+ const isFirst = selectTabIndex <= 0;
22340
+ selectTabIndex = isFirst ? this.tabCount : selectTabIndex - 1;
22341
+ break;
22342
+ // Other case
22343
+ default:
22344
+ console.error('[tab-page] Unknown swipe action: ' + event.type);
22345
+ return false;
22346
+ }
22347
+ setTimeout(() => {
22348
+ this.selectedTabIndex = selectTabIndex;
22349
+ this.markForCheck();
22350
+ });
22351
+ return true;
22352
+ }
22353
+ onSubTabChange(event) {
22354
+ this.onTabChange(event, 'subtab');
22355
+ }
22356
+ unload(opts) {
22357
+ const _super = Object.create(null, {
22358
+ unload: { get: () => super.unload }
22359
+ });
22360
+ return __awaiter(this, void 0, void 0, function* () {
22361
+ this.selectedTabIndex = 0;
22362
+ yield _super.unload.call(this, opts);
22363
+ });
22364
+ }
22365
+ }
22284
22366
  AppTabEditor.decorators = [
22285
22367
  { type: Directive }
22286
22368
  ];
@@ -22293,12 +22375,9 @@ AppTabEditor.ctorParameters = () => [
22293
22375
  ];
22294
22376
  AppTabEditor.propDecorators = {
22295
22377
  queryTabIndexParamName: [{ type: Input }],
22296
- tabGroup: [{ type: ViewChild, args: ['tabGroup', { static: true },] }],
22297
- toolbar: [{ type: ViewChild, args: [ToolbarToken,] }],
22298
- formButtonsBar: [{ type: ViewChild, args: [FormButtonsBarToken, { static: true },] }],
22299
- content: [{ type: ViewChild, args: [IonContent, { static: true },] }],
22300
22378
  selectedTabIndex: [{ type: Input }],
22301
- selectedTabIndexChange: [{ type: Output }]
22379
+ selectedTabIndexChange: [{ type: Output }],
22380
+ tabGroup: [{ type: ViewChild, args: ['tabGroup', { static: true },] }]
22302
22381
  };
22303
22382
 
22304
22383
  class AppEditorOptions extends AppTabEditorOptions {
@@ -22489,6 +22568,7 @@ class AppEntityEditor extends AppTabEditor {
22489
22568
  opts = Object.assign({ updateRoute: this._autoUpdateRoute && idChanged && !this.loading, openTabIndex: this._autoOpenNextTab && idChanged && isNil(this.previousDataId) && this.computeNextTabIndex() }, opts);
22490
22569
  this.data = data;
22491
22570
  this.previousDataId = data.id || null;
22571
+ yield this.ready();
22492
22572
  const promiseOrVoid = this.setValue(data);
22493
22573
  if (promiseOrVoid)
22494
22574
  yield promiseOrVoid;
@@ -24005,5 +24085,5 @@ const ErrorCodes = {
24005
24085
  * Generated bundle index. Do not edit.
24006
24086
  */
24007
24087
 
24008
- 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 };
24088
+ 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 };
24009
24089
  //# sourceMappingURL=sumaris-net.ngx-components.js.map