@sumaris-net/ngx-components 1.20.16 → 1.20.19

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.
@@ -5,7 +5,7 @@ import { A11yModule } from '@angular/cdk/a11y';
5
5
  import { OverlayModule, OverlayContainer, FullscreenOverlayContainer, Overlay } from '@angular/cdk/overlay';
6
6
  import { ScrollingModule } from '@angular/cdk/scrolling';
7
7
  import { DateAdapter, MatCommonModule, MatRippleModule } from '@angular/material/core';
8
- import { MatTableModule, MatTable, MatColumnDef } from '@angular/material/table';
8
+ import { MatTableModule, MatColumnDef, MatTable } from '@angular/material/table';
9
9
  import { MatSortModule, MatSort } from '@angular/material/sort';
10
10
  import { MatPaginatorModule, MatPaginatorIntl, MatPaginator } from '@angular/material/paginator';
11
11
  import { MatFormFieldModule } from '@angular/material/form-field';
@@ -31,8 +31,8 @@ import { MatDialogModule, MAT_DIALOG_DATA, MatDialog } from '@angular/material/d
31
31
  import { MatAutocomplete, MatAutocompleteTrigger, MatAutocompleteModule, MAT_AUTOCOMPLETE_SCROLL_STRATEGY, MAT_AUTOCOMPLETE_DEFAULT_OPTIONS } from '@angular/material/autocomplete';
32
32
  import { __awaiter, __decorate } from 'tslib';
33
33
  import { Validators, NG_VALUE_ACCESSOR, FormGroupDirective, AbstractControl, FormGroup, FormArray, FormControl, ReactiveFormsModule, FormBuilder } from '@angular/forms';
34
- import { timer, merge, fromEvent, BehaviorSubject, Subscription, Subject, isObservable, from, of, noop as noop$9, Observable, defer, forkJoin, combineLatest, EMPTY } from 'rxjs';
35
- import { filter, first, map, takeUntil, switchMap, tap, debounceTime, startWith, distinctUntilChanged, mergeMap, catchError, throttleTime, skip } from 'rxjs/operators';
34
+ import { timer, merge, fromEvent, BehaviorSubject, Subscription, Subject, isObservable, from, of, noop as noop$9, Observable, defer, forkJoin, interval, combineLatest, EMPTY } from 'rxjs';
35
+ import { filter, first, map, takeUntil, switchMap, tap, debounceTime, startWith, distinctUntilChanged, mergeMap, catchError, throttleTime, skip, bufferWhen } from 'rxjs/operators';
36
36
  import { trigger, transition, style, animate, state } from '@angular/animations';
37
37
  import { TranslateService, TranslateModule } from '@ngx-translate/core';
38
38
  import { IonicModule, Platform, IonRouterOutlet, ModalController, PopoverController, IonicSafeString, createAnimation, ToastController, AlertController, IonicRouteStrategy, NavParams, MenuController, IonContent, IonInfiniteScroll } from '@ionic/angular';
@@ -16356,11 +16356,11 @@ class PlatformService extends StartableService {
16356
16356
  throw err;
16357
16357
  }));
16358
16358
  }
16359
- // Fallback (if not Android and Cordova): opening the URI using the browser
16359
+ // Fallback (if not Android and Cordova): opening the URI
16360
16360
  // TODO: find a way to download under iOS (see https://www.c-sharpcorner.com/article/how-to-download-a-file-using-file-transfer-plugin-in-ionic-3/)
16361
16361
  else {
16362
- console.warn('[platform] Cannot use Cordova downloader plugin: using browser open()');
16363
- this.open(request.uri, '_system', 'location=no', true);
16362
+ FilesUtils.downloadUri(request.uri, request.filename);
16363
+ //this.open(request.uri, '_system', 'location=no', true);
16364
16364
  return of();
16365
16365
  }
16366
16366
  }
@@ -17861,6 +17861,97 @@ TextPopover.propDecorators = {
17861
17861
  autofocus: [{ type: Input }]
17862
17862
  };
17863
17863
 
17864
+ class ResizableDirective {
17865
+ constructor(document, elementRef) {
17866
+ this.document = document;
17867
+ this.elementRef = elementRef;
17868
+ // resize: mousedown -> mousemove -> mouseup
17869
+ this.resizable = fromEvent(this.elementRef.nativeElement, 'mousedown').pipe(tap((e) => {
17870
+ e.preventDefault();
17871
+ e.stopPropagation();
17872
+ }), switchMap(() => {
17873
+ const { width, right } = this.elementRef.nativeElement.closest('th').getBoundingClientRect();
17874
+ return fromEvent(this.document, 'mousemove').pipe(map(({ clientX }) => width + clientX - right), distinctUntilChanged(), takeUntil(fromEvent(this.document, 'mouseup')));
17875
+ }));
17876
+ // fit: doubleclick
17877
+ this.fit = fromEvent(this.elementRef.nativeElement, 'click').pipe(bufferWhen(() => interval(500)), filter((ar) => ar.length === 2));
17878
+ }
17879
+ }
17880
+ ResizableDirective.decorators = [
17881
+ { type: Directive, args: [{
17882
+ selector: '[resizable]',
17883
+ },] }
17884
+ ];
17885
+ ResizableDirective.ctorParameters = () => [
17886
+ { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
17887
+ { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }
17888
+ ];
17889
+ ResizableDirective.propDecorators = {
17890
+ resizable: [{ type: Output }],
17891
+ fit: [{ type: Output }]
17892
+ };
17893
+
17894
+ class ResizableComponent {
17895
+ constructor(columnDef) {
17896
+ this.columnDef = columnDef;
17897
+ this.sizeChanged = new EventEmitter();
17898
+ this.width = null;
17899
+ this.minWidth = null;
17900
+ this.maxWidth = null;
17901
+ this.debug = false;
17902
+ }
17903
+ onResize(width, opts) {
17904
+ if (!this.resizable)
17905
+ return;
17906
+ if (this.debug)
17907
+ console.info(`resize:${width}`);
17908
+ this.minWidth = width + 'px';
17909
+ this.maxWidth = width + 'px';
17910
+ if (!opts || opts.emitEvent) {
17911
+ this.sizeChanged.emit(width);
17912
+ }
17913
+ }
17914
+ onFit(opts) {
17915
+ if (!this.resizable)
17916
+ return;
17917
+ if (this.debug)
17918
+ console.info('fit');
17919
+ this.width = 'auto';
17920
+ this.minWidth = null;
17921
+ this.maxWidth = null;
17922
+ if (!opts || opts.emitEvent) {
17923
+ this.sizeChanged.emit(undefined);
17924
+ }
17925
+ }
17926
+ }
17927
+ ResizableComponent.decorators = [
17928
+ { type: Component, args: [{
17929
+ // eslint-disable-next-line @angular-eslint/component-selector
17930
+ selector: 'th[resizable]',
17931
+ template: "<div class=\"wrapper\">\n <div class=\"content\">\n <ng-content></ng-content>\n </div>\n <div class=\"bar\" [class.cdk-visually-hidden]=\"!resizable\" (resizable)=\"onResize($event)\" (fit)=\"onFit()\"></div>\n</div>\n",
17932
+ styles: [":host:last-child .bar{display:none}.wrapper{display:flex;justify-content:flex-end;align-items:center}.content{flex:1}.bar{height:var(--app-table-header-height,55px);width:10px;justify-self:flex-end;border-left:4px solid transparent;border-right:4px solid transparent;background:var(--ion-color-secondary);background-clip:content-box;cursor:ew-resize;opacity:0;transition:opacity .3s}.bar:active,.bar:hover{opacity:1}:host-context(.mat-table-sticky) .bar{width:12px!important}"]
17933
+ },] }
17934
+ ];
17935
+ ResizableComponent.ctorParameters = () => [
17936
+ { type: MatColumnDef, decorators: [{ type: Optional }] }
17937
+ ];
17938
+ ResizableComponent.propDecorators = {
17939
+ resizable: [{ type: Input }],
17940
+ sizeChanged: [{ type: Output }],
17941
+ width: [{ type: HostBinding, args: ['style.width',] }],
17942
+ minWidth: [{ type: HostBinding, args: ['style.min-width',] }],
17943
+ maxWidth: [{ type: HostBinding, args: ['style.max-width',] }]
17944
+ };
17945
+
17946
+ class ResizableModule {
17947
+ }
17948
+ ResizableModule.decorators = [
17949
+ { type: NgModule, args: [{
17950
+ declarations: [ResizableComponent, ResizableDirective],
17951
+ exports: [ResizableComponent, ResizableDirective],
17952
+ },] }
17953
+ ];
17954
+
17864
17955
  function mergeLoadResult(res1, res2) {
17865
17956
  var _a, _b;
17866
17957
  return {
@@ -24437,7 +24528,8 @@ AppEditor.propDecorators = {
24437
24528
  };
24438
24529
  // eslint-disable-next-line @angular-eslint/directive-class-suffix
24439
24530
  class AppTabEditor extends AppEditor {
24440
- constructor(route, router, alertCtrl, translate, options) {
24531
+ constructor(route, // Modal editor give 'null'
24532
+ router, alertCtrl, translate, options) {
24441
24533
  super(route, router, alertCtrl, translate);
24442
24534
  this.route = route;
24443
24535
  this.router = router;
@@ -24449,6 +24541,7 @@ class AppTabEditor extends AppEditor {
24449
24541
  this.tabCount = options.tabCount;
24450
24542
  this.enableSwipe = options.enableSwipe;
24451
24543
  this.tabGroupAnimationDuration = options.tabGroupAnimationDuration;
24544
+ this.queryTabIndexParamName = 'tab';
24452
24545
  }
24453
24546
  set selectedTabIndex(value) {
24454
24547
  this.setSelectedTabIndex(value);
@@ -24458,9 +24551,8 @@ class AppTabEditor extends AppEditor {
24458
24551
  }
24459
24552
  ngOnInit() {
24460
24553
  super.ngOnInit();
24461
- this.queryTabIndexParamName = this.queryTabIndexParamName || 'tab';
24462
24554
  // Read the selected tab index, from path query params
24463
- if (this.tabGroup) {
24555
+ if (this.tabGroup && this.route && this.queryTabIndexParamName) {
24464
24556
  this.registerSubscription(this.route.queryParams
24465
24557
  .subscribe(queryParams => {
24466
24558
  this.queryParams = Object.assign({}, queryParams);
@@ -24504,8 +24596,8 @@ class AppTabEditor extends AppEditor {
24504
24596
  }
24505
24597
  onTabChange(event, queryTabIndexParamName) {
24506
24598
  queryTabIndexParamName = queryTabIndexParamName || this.queryTabIndexParamName;
24507
- if (!queryTabIndexParamName)
24508
- return true; // Skip if tab query param not set
24599
+ if (!queryTabIndexParamName || !this.route)
24600
+ return true; // Skip if tab query param not set, or no route
24509
24601
  if (!this.queryParams || +this.queryParams[queryTabIndexParamName] !== event.index) {
24510
24602
  this.queryParams = this.queryParams || {};
24511
24603
  this.queryParams[queryTabIndexParamName] = event.index;
@@ -24576,7 +24668,7 @@ AppTabEditor.decorators = [
24576
24668
  { type: Directive }
24577
24669
  ];
24578
24670
  AppTabEditor.ctorParameters = () => [
24579
- { type: ActivatedRoute },
24671
+ { type: ActivatedRoute, decorators: [{ type: Optional }] },
24580
24672
  { type: Router },
24581
24673
  { type: AlertController },
24582
24674
  { type: TranslateService },
@@ -25262,6 +25354,406 @@ AppEntityEditor.ctorParameters = () => [
25262
25354
  { type: AppEditorOptions, decorators: [{ type: Optional }] }
25263
25355
  ];
25264
25356
 
25357
+ class AppEntityEditorModalOptions extends AppTabEditorOptions {
25358
+ }
25359
+ // @dynamic
25360
+ // eslint-disable-next-line @angular-eslint/directive-class-suffix
25361
+ class AppEntityEditorModal extends AppTabEditor {
25362
+ constructor(injector, dataType, options) {
25363
+ super(null, injector.get(Router), injector.get(AlertController), injector.get(TranslateService), options);
25364
+ this.dataType = dataType;
25365
+ this.saving = false;
25366
+ this.$title = new Subject();
25367
+ this.i18nSuffix = null;
25368
+ this.environement = injector.get(ENVIRONMENT);
25369
+ options = Object.assign({
25370
+ // Default options
25371
+ i18nPrefix: '' }, options);
25372
+ this.queryTabIndexParamName = undefined; // Important: avoid query parameter changed
25373
+ this.settings = injector.get(LocalSettingsService);
25374
+ this.errorTranslator = injector.get(FormErrorTranslator);
25375
+ this.cd = injector.get(ChangeDetectorRef);
25376
+ this.dateFormat = injector.get(DateFormatPipe);
25377
+ this.modalCtrl = injector.get(ModalController);
25378
+ this.i18nContext = {
25379
+ prefix: options.i18nPrefix,
25380
+ suffix: this.i18nSuffix || ''
25381
+ };
25382
+ // FOR DEV ONLY ----
25383
+ //this.debug = !environment.production;
25384
+ }
25385
+ set isNewData(value) {
25386
+ this._isNewData = value;
25387
+ }
25388
+ get isNewData() {
25389
+ var _a;
25390
+ return isNotNil(this._isNewData) ? this._isNewData : isNil((_a = this.data) === null || _a === void 0 ? void 0 : _a.id);
25391
+ }
25392
+ set disabled(value) {
25393
+ this._enabled = !value;
25394
+ }
25395
+ get disabled() {
25396
+ return !this._enabled;
25397
+ }
25398
+ get isOnFieldMode() {
25399
+ return this.settings.isOnFieldMode(this._usageMode);
25400
+ }
25401
+ markAsSaving(opts) {
25402
+ if (!this.saving) {
25403
+ this.saving = true;
25404
+ if (!opts || opts.emitEvent !== false)
25405
+ this.markForCheck();
25406
+ }
25407
+ }
25408
+ markAsSaved(opts) {
25409
+ if (this.saving) {
25410
+ this.saving = false;
25411
+ if (!opts || opts.emitEvent !== false)
25412
+ this.markForCheck();
25413
+ }
25414
+ }
25415
+ ngOnInit() {
25416
+ const _super = Object.create(null, {
25417
+ ngOnInit: { get: () => super.ngOnInit }
25418
+ });
25419
+ return __awaiter(this, void 0, void 0, function* () {
25420
+ // Default values
25421
+ this.mobile = isNotNil(this.mobile) ? this.mobile : this.settings.mobile;
25422
+ _super.ngOnInit.call(this);
25423
+ // Register forms
25424
+ this.registerForms();
25425
+ // Disable
25426
+ if (this.disabled)
25427
+ this.disable();
25428
+ // Update title each time value changes
25429
+ if (!this.isNewData) {
25430
+ this.registerSubscription(this.form.valueChanges
25431
+ .pipe(debounceTime(250))
25432
+ .subscribe(json => this.updateTitle(json)));
25433
+ }
25434
+ });
25435
+ }
25436
+ ngAfterViewInit() {
25437
+ super.ngAfterViewInit();
25438
+ if (this.onAfterModalInit) {
25439
+ Promise.resolve(this.onAfterModalInit(this))
25440
+ .then(() => this.load());
25441
+ }
25442
+ else {
25443
+ this.load();
25444
+ }
25445
+ }
25446
+ ngOnDestroy() {
25447
+ super.ngOnDestroy();
25448
+ this.$title.complete();
25449
+ this.$title.unsubscribe();
25450
+ }
25451
+ waitIdle(opts) {
25452
+ // Wait end of saving
25453
+ if (this.saving)
25454
+ return waitFor(() => this.saving !== true);
25455
+ return super.waitIdle(opts);
25456
+ }
25457
+ load() {
25458
+ return __awaiter(this, void 0, void 0, function* () {
25459
+ this.markAsReady();
25460
+ this.markAsLoading();
25461
+ try {
25462
+ yield this.updateView(this.data);
25463
+ }
25464
+ catch (err) {
25465
+ this.setError(err);
25466
+ this.selectedTabIndex = 0;
25467
+ }
25468
+ finally {
25469
+ this.markAsPristine();
25470
+ this.markAsLoaded();
25471
+ }
25472
+ });
25473
+ }
25474
+ reload() {
25475
+ if (this.dirty) {
25476
+ return this.load();
25477
+ }
25478
+ }
25479
+ unload(opts) {
25480
+ throw new Error("No implemented on modal");
25481
+ }
25482
+ updateView(data, opts) {
25483
+ return __awaiter(this, void 0, void 0, function* () {
25484
+ this.resetError();
25485
+ if (!this.data)
25486
+ throw { code: ErrorCodes.DATA_NOT_FOUND_ERROR, message: 'ERROR.DATA_NO_FOUND' };
25487
+ yield this.setValue(data);
25488
+ if (!opts || opts.emitEvent !== false) {
25489
+ this.markAsPristine();
25490
+ this.markAsUntouched();
25491
+ this.updateViewState(data);
25492
+ // Update the title.
25493
+ this.updateTitle(data);
25494
+ }
25495
+ });
25496
+ }
25497
+ /**
25498
+ * Enable or disable state
25499
+ */
25500
+ updateViewState(data, opts) {
25501
+ if (this.isNewData || this.enabled) {
25502
+ this.enable(opts);
25503
+ }
25504
+ else {
25505
+ this.disable(opts);
25506
+ // Allow to sort table
25507
+ this.tables.forEach(t => t.enableSort());
25508
+ }
25509
+ }
25510
+ saveAndClose(event) {
25511
+ return __awaiter(this, void 0, void 0, function* () {
25512
+ const data = yield this.saveAndGetDataIfValid();
25513
+ if (data) {
25514
+ this.modalCtrl.dismiss(data);
25515
+ return true;
25516
+ }
25517
+ return false;
25518
+ });
25519
+ }
25520
+ close(event) {
25521
+ return __awaiter(this, void 0, void 0, function* () {
25522
+ if (this.dirty) {
25523
+ const saveBeforeLeave = yield Alerts.askSaveBeforeLeave(this.alertCtrl, this.translate, event);
25524
+ // User cancelled
25525
+ if (isNil(saveBeforeLeave) || event && event.defaultPrevented) {
25526
+ return;
25527
+ }
25528
+ // Is user confirm: close normally
25529
+ if (saveBeforeLeave === true) {
25530
+ yield this.saveAndClose(event);
25531
+ return;
25532
+ }
25533
+ }
25534
+ yield this.modalCtrl.dismiss();
25535
+ });
25536
+ }
25537
+ /**
25538
+ * Save the editor, by calling the dataService.save().
25539
+ * Ensure that editor if valid. If not, display an error
25540
+ * @param event
25541
+ * @param opts
25542
+ */
25543
+ save(event, opts) {
25544
+ return __awaiter(this, void 0, void 0, function* () {
25545
+ if (this.loading || this.saving || this.disabled) {
25546
+ console.debug(this._logPrefix + 'Skip save: modal is busy (loading or saving)');
25547
+ return false;
25548
+ }
25549
+ if (!this.dirty) {
25550
+ console.debug(this._logPrefix + 'Skip save: modal not dirty');
25551
+ return true;
25552
+ }
25553
+ // Wait end of async validation
25554
+ yield this.waitWhilePending();
25555
+ // If invalid
25556
+ if (this.invalid) {
25557
+ this.logFormErrors();
25558
+ this.setError('COMMON.FORM.HAS_ERROR');
25559
+ this.markAllAsTouched();
25560
+ this.openFirstInvalidTab();
25561
+ this.scrollToTop();
25562
+ this.submitted = true;
25563
+ return false;
25564
+ }
25565
+ this.markAsSaving();
25566
+ this.resetError();
25567
+ if (this.debug)
25568
+ console.debug(this._logPrefix + 'Saving data...');
25569
+ try {
25570
+ // Save all dirty tables
25571
+ const saved = Promise.all((this.tables || [])
25572
+ .filter(c => c.dirty)
25573
+ .map(c => c.save()))
25574
+ .then(res => res.findIndex(r => r !== true) === -1);
25575
+ this.data = yield this.getValue();
25576
+ this.submitted = true;
25577
+ return saved;
25578
+ }
25579
+ catch (err) {
25580
+ this.submitted = true;
25581
+ this.setError(err);
25582
+ this.selectedTabIndex = 0;
25583
+ this.scrollToTop(); // Scroll to top (to show error)
25584
+ this.markAsDirty();
25585
+ this.enable();
25586
+ return false;
25587
+ }
25588
+ finally {
25589
+ this.markAsSaved();
25590
+ }
25591
+ });
25592
+ }
25593
+ /**
25594
+ * Save data (if dirty and valid), and return it. Otherwise, return nil value.
25595
+ */
25596
+ saveAndGetDataIfValid() {
25597
+ return __awaiter(this, void 0, void 0, function* () {
25598
+ // Form is not valid
25599
+ if (!this.valid) {
25600
+ // Make sure validation is finished
25601
+ yield AppFormUtils.waitWhilePending(this);
25602
+ // If invalid: Open the first tab in error
25603
+ if (this.invalid) {
25604
+ this.openFirstInvalidTab();
25605
+ return undefined;
25606
+ }
25607
+ // Continue (valid)
25608
+ }
25609
+ // Form is valid, but not saved
25610
+ if (this.dirty) {
25611
+ const saved = yield this.save(new Event('save'));
25612
+ if (!saved)
25613
+ return undefined;
25614
+ }
25615
+ // Valid and saved data
25616
+ return this.data;
25617
+ });
25618
+ }
25619
+ delete(event) {
25620
+ return __awaiter(this, void 0, void 0, function* () {
25621
+ if (this.loading || this.saving)
25622
+ return false;
25623
+ this.markAsSaving();
25624
+ this.resetError();
25625
+ try {
25626
+ // Delegate deletion to modal caller
25627
+ if (this.onDelete) {
25628
+ const result = yield this.onDelete(event, this.data);
25629
+ // User cancelled
25630
+ if (isNil(result) || (event && event.defaultPrevented))
25631
+ return;
25632
+ if (result) {
25633
+ yield this.modalCtrl.dismiss(this.data, 'delete');
25634
+ }
25635
+ }
25636
+ // Or dismiss, with the role 'delete'
25637
+ else {
25638
+ if (this.isNewData) {
25639
+ console.error(this._logPrefix + "Trying to delete a new data. Make no sense!");
25640
+ }
25641
+ yield this.modalCtrl.dismiss(this.data, 'delete');
25642
+ }
25643
+ }
25644
+ catch (err) {
25645
+ this.submitted = true;
25646
+ this.setError(err);
25647
+ this.selectedTabIndex = 0;
25648
+ this.markAsSaved();
25649
+ if (this.enabled)
25650
+ this.enable();
25651
+ return false;
25652
+ }
25653
+ });
25654
+ }
25655
+ resetError(opts) {
25656
+ if (isNotNilOrBlank(this.error)) {
25657
+ this.error = null;
25658
+ if (!opts || opts.emitEvent !== false)
25659
+ this.markForCheck();
25660
+ }
25661
+ }
25662
+ setError(err, opts) {
25663
+ if (!err) {
25664
+ this.error = undefined;
25665
+ }
25666
+ else if (typeof err === 'string') {
25667
+ console.error('[entity-editor] Error: ' + (err || ''));
25668
+ this.error = err;
25669
+ }
25670
+ else {
25671
+ console.error('[entity-editor] Error: ' + err.message || '', err);
25672
+ let userMessage = err.message && this.translate.instant(err.message) || err;
25673
+ // Add details error (if any) under the main message
25674
+ const detailMessage = (!err.details || typeof err.details === 'string')
25675
+ ? err.details
25676
+ : err.details.message;
25677
+ if (isNotNilOrBlank(detailMessage)) {
25678
+ const cssClass = (opts === null || opts === void 0 ? void 0 : opts.detailsCssClass) || 'hidden-xs hidden-sm';
25679
+ userMessage += `<br/><small class="${cssClass}" title="${detailMessage}">`;
25680
+ userMessage += detailMessage.length < 70 ? detailMessage : detailMessage.substring(0, 67) + '...';
25681
+ userMessage += '</small>';
25682
+ }
25683
+ this.error = userMessage;
25684
+ }
25685
+ if (!opts || opts.emitEvent !== false)
25686
+ this.markForCheck();
25687
+ }
25688
+ /* -- protected methods -- */
25689
+ waitWhilePending(opts) {
25690
+ return AppFormUtils.waitWhilePending(this, opts);
25691
+ }
25692
+ getValue() {
25693
+ return __awaiter(this, void 0, void 0, function* () {
25694
+ const json = yield this.getJsonValueToSave();
25695
+ const res = new this.dataType();
25696
+ res.fromObject(json);
25697
+ return res;
25698
+ });
25699
+ }
25700
+ getJsonValueToSave() {
25701
+ return Promise.resolve(this.form.value);
25702
+ }
25703
+ /**
25704
+ * Compute the title
25705
+ *
25706
+ * @param data
25707
+ */
25708
+ updateTitle(data) {
25709
+ return __awaiter(this, void 0, void 0, function* () {
25710
+ data = data || this.data;
25711
+ const title = yield this.computeTitle(data);
25712
+ this.$title.next(title);
25713
+ });
25714
+ }
25715
+ scrollToTop(duration) {
25716
+ return __awaiter(this, void 0, void 0, function* () {
25717
+ if (this.content) {
25718
+ return this.content.scrollToTop(duration);
25719
+ }
25720
+ });
25721
+ }
25722
+ markForCheck() {
25723
+ var _a;
25724
+ (_a = this.cd) === null || _a === void 0 ? void 0 : _a.markForCheck();
25725
+ }
25726
+ /* -- private functions -- */
25727
+ /**
25728
+ * Open the first tab that is invalid
25729
+ */
25730
+ openFirstInvalidTab() {
25731
+ const invalidTabIndex = this.getFirstInvalidTabIndex();
25732
+ if (invalidTabIndex !== -1 && this.selectedTabIndex !== invalidTabIndex) {
25733
+ this.selectedTabIndex = invalidTabIndex;
25734
+ this.markForCheck();
25735
+ }
25736
+ }
25737
+ }
25738
+ AppEntityEditorModal.decorators = [
25739
+ { type: Directive }
25740
+ ];
25741
+ AppEntityEditorModal.ctorParameters = () => [
25742
+ { type: Injector },
25743
+ { type: Function },
25744
+ { type: undefined, decorators: [{ type: Optional }] }
25745
+ ];
25746
+ AppEntityEditorModal.propDecorators = {
25747
+ data: [{ type: Input }],
25748
+ mobile: [{ type: Input }],
25749
+ usageMode: [{ type: Input }],
25750
+ onAfterModalInit: [{ type: Input }],
25751
+ onDelete: [{ type: Input }],
25752
+ i18nSuffix: [{ type: Input }],
25753
+ isNewData: [{ type: Input }],
25754
+ disabled: [{ type: Input }]
25755
+ };
25756
+
25265
25757
  // @dynamic
25266
25758
  // eslint-disable-next-line @angular-eslint/directive-class-suffix
25267
25759
  class AppInMemoryTable extends AppTable {
@@ -28033,5 +28525,5 @@ CoreTestingModule.decorators = [
28033
28525
  * Generated bundle index. Do not edit.
28034
28526
  */
28035
28527
 
28036
- 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, AutoTitleDirective, AutocompleteTestPage, AutofocusDirective, Base58, BaseEntityService, BaseGraphqlService, BaseGraphqlServiceOptions, BaseReferential, Beans, CORE_CONFIG_OPTIONS, CORE_TESTING_PAGES, CellValueChangeListener, ChipsTestPage, Color, ColorScale, ComponentDirtyGuard, ConfigService, Configuration, CoreModule, CoreTestingModule, CryptoService, CsvUtils, DATE_ISO_PATTERN, DATE_UNIX_MS_TIMESTAMP, DATE_UNIX_TIMESTAMP, DEFAULT_MENU_SHOW_WHEN, 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, ErrorCodes, EvenPipe, FileResponse, FileService, FileSizePipe, FilesUtils, FormArrayHelper, FormButtonsBarComponent, FormButtonsBarToken, FormErrorTranslatePipe, FormErrorTranslator, FormFieldValuesHolder, FormGetArrayPipe, FormGetControlPipe, FormGetGroupPipe, FormGetPipe, FormGetValuePipe, 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, MimeTypes, ModalToolbarComponent, NetworkService, NgInitDirective, NgVarDirective, NotEmptyArrayPipe, NumberFormatPipe, NumpadDirective, OddPipe, PRIORITIZED_AUTHORITIES, PUBKEY_REGEXP, Peer, Person, PersonFilter, PersonFragments, PersonService, PersonToStringPipe, PersonUtils, PersonValidatorService, PlatformService, ProgressBarService, ProgressInterceptor, PropertyFormatPipe, 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, ServerErrorCodes, 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, UriUtils, 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, escapeRegExp, 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, moment$5 as moment, 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, tz, 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, AppUpdateOfflineModeCard as ɵi, AppIconComponent as ɵj, DateTestPage as ɵk, NumpadTestPage as ɵl, MatBadgeIconTestPage as ɵm, ToastTestingModule as ɵn, ToastTestingPage as ɵo };
28528
+ 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, AppEntityEditorModal, AppEntityEditorModalOptions, 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, AutoTitleDirective, AutocompleteTestPage, AutofocusDirective, Base58, BaseEntityService, BaseGraphqlService, BaseGraphqlServiceOptions, BaseReferential, Beans, CORE_CONFIG_OPTIONS, CORE_TESTING_PAGES, CellValueChangeListener, ChipsTestPage, Color, ColorScale, ComponentDirtyGuard, ConfigService, Configuration, CoreModule, CoreTestingModule, CryptoService, CsvUtils, DATE_ISO_PATTERN, DATE_UNIX_MS_TIMESTAMP, DATE_UNIX_TIMESTAMP, DEFAULT_MENU_SHOW_WHEN, 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, ErrorCodes, EvenPipe, FileResponse, FileService, FileSizePipe, FilesUtils, FormArrayHelper, FormButtonsBarComponent, FormButtonsBarToken, FormErrorTranslatePipe, FormErrorTranslator, FormFieldValuesHolder, FormGetArrayPipe, FormGetControlPipe, FormGetGroupPipe, FormGetPipe, FormGetValuePipe, 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, MimeTypes, ModalToolbarComponent, NetworkService, NgInitDirective, NgVarDirective, NotEmptyArrayPipe, NumberFormatPipe, NumpadDirective, OddPipe, PRIORITIZED_AUTHORITIES, PUBKEY_REGEXP, Peer, Person, PersonFilter, PersonFragments, PersonService, PersonToStringPipe, PersonUtils, PersonValidatorService, PlatformService, ProgressBarService, ProgressInterceptor, PropertyFormatPipe, PropertyGetPipe, RESERVED_END_COLUMNS, RESERVED_START_COLUMNS, Referential, ReferentialFilter, ReferentialRef, ReferentialUtils, ReferentialValidatorService, RegisterConfirmPage, ResizableComponent, ResizableDirective, ResizableModule, 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, ServerErrorCodes, 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, UriUtils, 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, escapeRegExp, 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, moment$5 as moment, 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, tz, 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, AppUpdateOfflineModeCard as ɵi, AppIconComponent as ɵj, DateTestPage as ɵk, NumpadTestPage as ɵl, MatBadgeIconTestPage as ɵm, ToastTestingModule as ɵn, ToastTestingPage as ɵo };
28037
28529
  //# sourceMappingURL=sumaris-net.ngx-components.js.map