@sumaris-net/ngx-components 0.26.7 → 0.27.3
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.
- package/bundles/sumaris-net.ngx-components.umd.js +409 -308
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/core/form/editor.class.js +174 -127
- package/esm2015/src/app/core/form/entity-editor.class.js +1 -1
- package/esm2015/src/app/core/form/form.class.js +17 -1
- package/esm2015/src/app/core/form/form.utils.js +14 -1
- package/esm2015/src/app/core/graphql/graphql.service.js +1 -2
- package/esm2015/src/app/core/services/config.service.js +1 -1
- package/esm2015/src/app/core/services/platform.service.js +65 -84
- package/esm2015/src/app/core/table/table.class.js +14 -2
- package/esm2015/src/app/shared/pipes/number-format.pipe.js +3 -3
- package/esm2015/src/app/shared/services/startable-service.class.js +12 -5
- package/fesm2015/sumaris-net.ngx-components.js +286 -215
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +3 -3
- package/src/app/core/form/editor.class.d.ts +43 -26
- package/src/app/core/form/form.class.d.ts +10 -0
- package/src/app/core/form/form.utils.d.ts +16 -0
- package/src/app/core/services/platform.service.d.ts +3 -15
- package/src/app/core/table/table.class.d.ts +5 -0
- package/src/app/shared/pipes/number-format.pipe.d.ts +1 -1
- package/src/app/shared/services/startable-service.class.d.ts +2 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -2280,11 +2280,11 @@
|
|
|
2280
2280
|
var NumberFormatPipe = /** @class */ (function () {
|
|
2281
2281
|
function NumberFormatPipe() {
|
|
2282
2282
|
}
|
|
2283
|
-
NumberFormatPipe.prototype.transform = function (val) {
|
|
2283
|
+
NumberFormatPipe.prototype.transform = function (val, numberFormatOptions) {
|
|
2284
2284
|
// Format the output to display any way you want here.
|
|
2285
2285
|
// For instance:
|
|
2286
2286
|
if (val !== undefined && val !== null) {
|
|
2287
|
-
return val.toLocaleString(
|
|
2287
|
+
return val.toLocaleString(undefined, numberFormatOptions);
|
|
2288
2288
|
}
|
|
2289
2289
|
else {
|
|
2290
2290
|
return '';
|
|
@@ -3376,6 +3376,13 @@
|
|
|
3376
3376
|
AppNullForm.prototype.markAsDirty = function (opts) { };
|
|
3377
3377
|
AppNullForm.prototype.markAsLoading = function (opts) { };
|
|
3378
3378
|
AppNullForm.prototype.markAsLoaded = function (opts) { };
|
|
3379
|
+
AppNullForm.prototype.markAsReady = function (opts) { };
|
|
3380
|
+
AppNullForm.prototype.waitIdle = function (opts) {
|
|
3381
|
+
return Promise.reject(false);
|
|
3382
|
+
};
|
|
3383
|
+
AppNullForm.prototype.ready = function () {
|
|
3384
|
+
return Promise.reject(true);
|
|
3385
|
+
};
|
|
3379
3386
|
return AppNullForm;
|
|
3380
3387
|
}());
|
|
3381
3388
|
var AppFormProvider = /** @class */ (function () {
|
|
@@ -3461,6 +3468,9 @@
|
|
|
3461
3468
|
enumerable: false,
|
|
3462
3469
|
configurable: true
|
|
3463
3470
|
});
|
|
3471
|
+
AppFormProvider.prototype.ready = function () {
|
|
3472
|
+
return this.delegate.ready();
|
|
3473
|
+
};
|
|
3464
3474
|
AppFormProvider.prototype.disable = function (opts) {
|
|
3465
3475
|
return this.delegate.disable(opts);
|
|
3466
3476
|
};
|
|
@@ -3488,6 +3498,9 @@
|
|
|
3488
3498
|
AppFormProvider.prototype.markAsLoaded = function (opts) {
|
|
3489
3499
|
return this.delegate.markAsLoaded(opts);
|
|
3490
3500
|
};
|
|
3501
|
+
AppFormProvider.prototype.markAsReady = function (opts) {
|
|
3502
|
+
return this.delegate.markAsReady(opts);
|
|
3503
|
+
};
|
|
3491
3504
|
return AppFormProvider;
|
|
3492
3505
|
}());
|
|
3493
3506
|
AppFormProvider.NULL_FORM = new AppNullForm();
|
|
@@ -8537,13 +8550,14 @@
|
|
|
8537
8550
|
};
|
|
8538
8551
|
|
|
8539
8552
|
var StartableService = /** @class */ (function () {
|
|
8540
|
-
function StartableService(
|
|
8553
|
+
function StartableService(prerequisiteService) {
|
|
8541
8554
|
this.onStart = new rxjs.Subject();
|
|
8542
8555
|
this._debug = false;
|
|
8556
|
+
this._startByReadyFunction = true; // should start when calling ready() ?
|
|
8543
8557
|
this._data = null;
|
|
8544
8558
|
this._started = false;
|
|
8545
|
-
this._startPrerequisite =
|
|
8546
|
-
? function () { return
|
|
8559
|
+
this._startPrerequisite = prerequisiteService
|
|
8560
|
+
? function () { return prerequisiteService.ready(); }
|
|
8547
8561
|
: function () { return Promise.resolve(); };
|
|
8548
8562
|
}
|
|
8549
8563
|
StartableService.prototype.start = function () {
|
|
@@ -8628,9 +8642,15 @@
|
|
|
8628
8642
|
configurable: true
|
|
8629
8643
|
});
|
|
8630
8644
|
StartableService.prototype.ready = function () {
|
|
8645
|
+
var _this = this;
|
|
8631
8646
|
if (this._started)
|
|
8632
8647
|
return Promise.resolve(this._data);
|
|
8633
|
-
|
|
8648
|
+
if (this._startPromise)
|
|
8649
|
+
return this._startPromise;
|
|
8650
|
+
if (this._startByReadyFunction)
|
|
8651
|
+
return this.start();
|
|
8652
|
+
return waitFor(function () { return _this._started; })
|
|
8653
|
+
.then(function () { return _this._data; });
|
|
8634
8654
|
};
|
|
8635
8655
|
StartableService.prototype.ngOnStop = function () {
|
|
8636
8656
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -14078,7 +14098,6 @@
|
|
|
14078
14098
|
.append('Authorization', authorization);
|
|
14079
14099
|
//.append('X-App-Name', environment.name)
|
|
14080
14100
|
//.append('X-App-Version', environment.version)
|
|
14081
|
-
;
|
|
14082
14101
|
// Use the setContext method to set the HTTP headers.
|
|
14083
14102
|
operation.setContext(Object.assign(Object.assign({}, operation.getContext()), { headers: headers }));
|
|
14084
14103
|
// Call the next link in the middleware chain.
|
|
@@ -16464,41 +16483,35 @@
|
|
|
16464
16483
|
var templateObject_1$3, templateObject_2$3, templateObject_3$2, templateObject_4$2, templateObject_5$1;
|
|
16465
16484
|
|
|
16466
16485
|
var moment$2 = momentImported__namespace;
|
|
16467
|
-
var PlatformService = /** @class */ (function () {
|
|
16486
|
+
var PlatformService = /** @class */ (function (_super) {
|
|
16487
|
+
__extends(PlatformService, _super);
|
|
16468
16488
|
function PlatformService(platform, cdkPlatform, toastController, translate, dateAdapter, entitiesStorage, settings, networkService, accountService, configService, cache, storage, audioProvider, environment, statusBar, keyboard, splashScreen, browser, downloader) {
|
|
16469
|
-
this
|
|
16470
|
-
|
|
16471
|
-
|
|
16472
|
-
|
|
16473
|
-
|
|
16474
|
-
|
|
16475
|
-
|
|
16476
|
-
|
|
16477
|
-
|
|
16478
|
-
|
|
16479
|
-
|
|
16480
|
-
|
|
16481
|
-
|
|
16482
|
-
|
|
16483
|
-
|
|
16484
|
-
|
|
16485
|
-
|
|
16486
|
-
|
|
16487
|
-
|
|
16488
|
-
|
|
16489
|
-
|
|
16490
|
-
|
|
16491
|
-
if (
|
|
16489
|
+
var _this = _super.call(this, platform) || this;
|
|
16490
|
+
_this.platform = platform;
|
|
16491
|
+
_this.cdkPlatform = cdkPlatform;
|
|
16492
|
+
_this.toastController = toastController;
|
|
16493
|
+
_this.translate = translate;
|
|
16494
|
+
_this.dateAdapter = dateAdapter;
|
|
16495
|
+
_this.entitiesStorage = entitiesStorage;
|
|
16496
|
+
_this.settings = settings;
|
|
16497
|
+
_this.networkService = networkService;
|
|
16498
|
+
_this.accountService = accountService;
|
|
16499
|
+
_this.configService = configService;
|
|
16500
|
+
_this.cache = cache;
|
|
16501
|
+
_this.storage = storage;
|
|
16502
|
+
_this.audioProvider = audioProvider;
|
|
16503
|
+
_this.environment = environment;
|
|
16504
|
+
_this.statusBar = statusBar;
|
|
16505
|
+
_this.keyboard = keyboard;
|
|
16506
|
+
_this.splashScreen = splashScreen;
|
|
16507
|
+
_this.browser = browser;
|
|
16508
|
+
_this.downloader = downloader;
|
|
16509
|
+
_this._downloadingJobs = new Map();
|
|
16510
|
+
_this._debug = !environment.production;
|
|
16511
|
+
if (_this._debug)
|
|
16492
16512
|
console.debug('[platform] Creating service');
|
|
16493
|
-
|
|
16513
|
+
return _this;
|
|
16494
16514
|
}
|
|
16495
|
-
Object.defineProperty(PlatformService.prototype, "started", {
|
|
16496
|
-
get: function () {
|
|
16497
|
-
return this._started;
|
|
16498
|
-
},
|
|
16499
|
-
enumerable: false,
|
|
16500
|
-
configurable: true
|
|
16501
|
-
});
|
|
16502
16515
|
Object.defineProperty(PlatformService.prototype, "mobile", {
|
|
16503
16516
|
get: function () {
|
|
16504
16517
|
return isNotNil(this._mobile) ? this._mobile : this.platform.is('mobile');
|
|
@@ -16521,7 +16534,7 @@
|
|
|
16521
16534
|
};
|
|
16522
16535
|
Object.defineProperty(PlatformService.prototype, "canDownload", {
|
|
16523
16536
|
get: function () {
|
|
16524
|
-
return this.
|
|
16537
|
+
return isNotNil(this.downloader);
|
|
16525
16538
|
},
|
|
16526
16539
|
enumerable: false,
|
|
16527
16540
|
configurable: true
|
|
@@ -16532,80 +16545,81 @@
|
|
|
16532
16545
|
PlatformService.prototype.height = function () {
|
|
16533
16546
|
return this.platform.height();
|
|
16534
16547
|
};
|
|
16535
|
-
PlatformService.prototype.
|
|
16536
|
-
|
|
16537
|
-
|
|
16538
|
-
|
|
16539
|
-
|
|
16540
|
-
|
|
16541
|
-
|
|
16542
|
-
|
|
16543
|
-
|
|
16544
|
-
|
|
16545
|
-
|
|
16546
|
-
|
|
16547
|
-
|
|
16548
|
-
|
|
16549
|
-
|
|
16550
|
-
|
|
16551
|
-
|
|
16552
|
-
|
|
16553
|
-
|
|
16554
|
-
|
|
16555
|
-
|
|
16556
|
-
|
|
16557
|
-
|
|
16558
|
-
|
|
16559
|
-
|
|
16560
|
-
|
|
16561
|
-
|
|
16562
|
-
|
|
16563
|
-
|
|
16564
|
-
|
|
16565
|
-
|
|
16566
|
-
|
|
16567
|
-
|
|
16568
|
-
|
|
16569
|
-
|
|
16570
|
-
|
|
16571
|
-
|
|
16572
|
-
|
|
16573
|
-
|
|
16574
|
-
|
|
16575
|
-
|
|
16576
|
-
|
|
16577
|
-
|
|
16578
|
-
|
|
16579
|
-
|
|
16580
|
-
|
|
16581
|
-
|
|
16582
|
-
|
|
16583
|
-
|
|
16584
|
-
|
|
16585
|
-
|
|
16586
|
-
|
|
16587
|
-
|
|
16588
|
-
|
|
16589
|
-
|
|
16590
|
-
|
|
16591
|
-
|
|
16592
|
-
|
|
16593
|
-
|
|
16594
|
-
|
|
16595
|
-
|
|
16596
|
-
|
|
16597
|
-
|
|
16598
|
-
|
|
16599
|
-
|
|
16600
|
-
|
|
16601
|
-
|
|
16602
|
-
|
|
16603
|
-
|
|
16604
|
-
|
|
16605
|
-
|
|
16606
|
-
|
|
16607
|
-
|
|
16608
|
-
|
|
16548
|
+
PlatformService.prototype.ngOnStart = function () {
|
|
16549
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
16550
|
+
var now, forage, err_1;
|
|
16551
|
+
var _this = this;
|
|
16552
|
+
return __generator(this, function (_b) {
|
|
16553
|
+
switch (_b.label) {
|
|
16554
|
+
case 0:
|
|
16555
|
+
now = Date.now();
|
|
16556
|
+
this.accountService.tokenType = undefined;
|
|
16557
|
+
console.info('[platform] Starting platform...');
|
|
16558
|
+
_b.label = 1;
|
|
16559
|
+
case 1:
|
|
16560
|
+
_b.trys.push([1, 6, , 7]);
|
|
16561
|
+
this._mobile = this.platform.is('mobile');
|
|
16562
|
+
this._cordova = this.platform.is('cordova');
|
|
16563
|
+
this._android = this.platform.is('android');
|
|
16564
|
+
this.configureCordovaPlugins(this._mobile);
|
|
16565
|
+
this.touchUi = this._mobile || this.platform.is('tablet') || this.platform.is('phablet');
|
|
16566
|
+
// Force mobile in settings
|
|
16567
|
+
if (this._mobile) {
|
|
16568
|
+
this.settings.mobile = this._mobile;
|
|
16569
|
+
this.settings.touchUi = this.touchUi;
|
|
16570
|
+
}
|
|
16571
|
+
// Configure translation
|
|
16572
|
+
return [4 /*yield*/, this.configureTranslate()];
|
|
16573
|
+
case 2:
|
|
16574
|
+
// Configure translation
|
|
16575
|
+
_b.sent();
|
|
16576
|
+
return [4 /*yield*/, this.storageReady()];
|
|
16577
|
+
case 3:
|
|
16578
|
+
forage = _b.sent();
|
|
16579
|
+
return [4 /*yield*/, this.migrateStorage(forage)];
|
|
16580
|
+
case 4:
|
|
16581
|
+
_b.sent();
|
|
16582
|
+
// Start root services
|
|
16583
|
+
return [4 /*yield*/, Promise.all([
|
|
16584
|
+
this.entitiesStorage.ready(),
|
|
16585
|
+
this.cache.ready().then(function () { return _this.configureCache(); }),
|
|
16586
|
+
this.settings.ready(),
|
|
16587
|
+
this.networkService.ready(),
|
|
16588
|
+
this.audioProvider.ready()
|
|
16589
|
+
])];
|
|
16590
|
+
case 5:
|
|
16591
|
+
// Start root services
|
|
16592
|
+
_b.sent();
|
|
16593
|
+
console.info("[platform] Starting platform [OK] {mobile: " + this._mobile + ", touchUi: " + this.touchUi + ", downloader: " + this.canDownload + "} in " + (Date.now() - now) + "ms");
|
|
16594
|
+
// Update cache configuration when network changed
|
|
16595
|
+
this.networkService.onNetworkStatusChanges
|
|
16596
|
+
.pipe(operators.skip(1)) // Skip the first event (behavior subject send event immediately)
|
|
16597
|
+
.subscribe(function (type) { return _this.configureCache(type !== 'none'); });
|
|
16598
|
+
// Update authentication type
|
|
16599
|
+
this.configService.config
|
|
16600
|
+
.pipe(operators.map(function (config) { return config === null || config === void 0 ? void 0 : config.getProperty(CORE_CONFIG_OPTIONS.AUTH_TOKEN_TYPE); }), operators.filter(isNotNilOrBlank), operators.distinctUntilChanged())
|
|
16601
|
+
.subscribe(function (tokenType) {
|
|
16602
|
+
console.info("[platform] Using auth token type {" + tokenType + "}");
|
|
16603
|
+
_this.accountService.tokenType = tokenType;
|
|
16604
|
+
});
|
|
16605
|
+
// Hide the splashscreen (if mobile) - after 1s
|
|
16606
|
+
if (this.mobile) {
|
|
16607
|
+
setTimeout(function () {
|
|
16608
|
+
var _a;
|
|
16609
|
+
(_a = _this.splashScreen) === null || _a === void 0 ? void 0 : _a.hide();
|
|
16610
|
+
// Play startup sound
|
|
16611
|
+
_this.audioProvider.playStartupSound();
|
|
16612
|
+
}, 1000);
|
|
16613
|
+
}
|
|
16614
|
+
return [3 /*break*/, 7];
|
|
16615
|
+
case 6:
|
|
16616
|
+
err_1 = _b.sent();
|
|
16617
|
+
// Manage startup error
|
|
16618
|
+
return [2 /*return*/, this.onStartupError(err_1)];
|
|
16619
|
+
case 7: return [2 /*return*/];
|
|
16620
|
+
}
|
|
16621
|
+
});
|
|
16622
|
+
});
|
|
16609
16623
|
};
|
|
16610
16624
|
PlatformService.prototype.open = function (url, target, features, replace) {
|
|
16611
16625
|
console.info("[platform] Opening link: " + url);
|
|
@@ -16718,22 +16732,22 @@
|
|
|
16718
16732
|
});
|
|
16719
16733
|
};
|
|
16720
16734
|
PlatformService.prototype.configureCache = function (online) {
|
|
16721
|
-
online =
|
|
16735
|
+
online = toBoolean(online, this.cache.isOnline());
|
|
16722
16736
|
var cacheTTL = online ? 3600 /* 1h */ : 3600 * 24 * 30; /* 1 month */
|
|
16723
|
-
console.info("[platform] Configuring cache [OK] {online: " + online + "
|
|
16737
|
+
console.info("[platform] Configuring cache [OK] {online: " + online + ", timeToLive: " + cacheTTL / 3600 + "h, offlineInvalidate: false}");
|
|
16724
16738
|
this.cache.setDefaultTTL(cacheTTL);
|
|
16725
16739
|
this.cache.setOfflineInvalidate(false); // Do not invalidate cache when offline
|
|
16726
16740
|
};
|
|
16727
16741
|
PlatformService.prototype.storageReady = function () {
|
|
16728
16742
|
return __awaiter(this, void 0, void 0, function () {
|
|
16729
16743
|
var forage, driver;
|
|
16730
|
-
return __generator(this, function (
|
|
16731
|
-
switch (
|
|
16744
|
+
return __generator(this, function (_b) {
|
|
16745
|
+
switch (_b.label) {
|
|
16732
16746
|
case 0:
|
|
16733
16747
|
console.info("[platform] Starting storage...");
|
|
16734
16748
|
return [4 /*yield*/, this.storage.ready()];
|
|
16735
16749
|
case 1:
|
|
16736
|
-
forage =
|
|
16750
|
+
forage = _b.sent();
|
|
16737
16751
|
driver = forage.driver();
|
|
16738
16752
|
if (isNil(driver)) {
|
|
16739
16753
|
console.error('[platform] NO DRIVER DEFINED IN STORAGE. Local storage cannot be used !');
|
|
@@ -16748,9 +16762,9 @@
|
|
|
16748
16762
|
};
|
|
16749
16763
|
PlatformService.prototype.migrateStorage = function (forage) {
|
|
16750
16764
|
return __awaiter(this, void 0, void 0, function () {
|
|
16751
|
-
var canMigrate, oldForage, keys, now, toast_1, duration,
|
|
16752
|
-
return __generator(this, function (
|
|
16753
|
-
switch (
|
|
16765
|
+
var canMigrate, oldForage, keys, now, toast_1, duration, err_2;
|
|
16766
|
+
return __generator(this, function (_b) {
|
|
16767
|
+
switch (_b.label) {
|
|
16754
16768
|
case 0:
|
|
16755
16769
|
canMigrate = forage &&
|
|
16756
16770
|
((forage.driver() === 'cordovaSQLiteDriver' && (forage.supports(forage.INDEXEDDB) || forage.supports(forage.WEBSQL))) ||
|
|
@@ -16764,13 +16778,13 @@
|
|
|
16764
16778
|
});
|
|
16765
16779
|
return [4 /*yield*/, oldForage.keys()];
|
|
16766
16780
|
case 1:
|
|
16767
|
-
keys =
|
|
16781
|
+
keys = _b.sent();
|
|
16768
16782
|
if (!isEmptyArray(keys)) return [3 /*break*/, 3];
|
|
16769
16783
|
// Drop the old instance (not need anymore)
|
|
16770
16784
|
console.debug("[platform] Old storage is empty: dropping unused instance {name: '" + forage.config().name + "', driver: '" + oldForage.driver() + "'}");
|
|
16771
16785
|
return [4 /*yield*/, oldForage.dropInstance()];
|
|
16772
16786
|
case 2:
|
|
16773
|
-
|
|
16787
|
+
_b.sent();
|
|
16774
16788
|
return [3 /*break*/, 12];
|
|
16775
16789
|
case 3:
|
|
16776
16790
|
now = Date.now();
|
|
@@ -16778,13 +16792,13 @@
|
|
|
16778
16792
|
return [4 /*yield*/, this.showToast({ message: 'INFO.DATA_MIGRATION_STARTED',
|
|
16779
16793
|
duration: 30000 })];
|
|
16780
16794
|
case 4:
|
|
16781
|
-
toast_1 =
|
|
16782
|
-
|
|
16795
|
+
toast_1 = _b.sent();
|
|
16796
|
+
_b.label = 5;
|
|
16783
16797
|
case 5:
|
|
16784
|
-
|
|
16798
|
+
_b.trys.push([5, 9, , 12]);
|
|
16785
16799
|
return [4 /*yield*/, StorageUtils.copy(oldForage, forage, { keys: keys, deleteAfterCopy: false })];
|
|
16786
16800
|
case 6:
|
|
16787
|
-
|
|
16801
|
+
_b.sent();
|
|
16788
16802
|
duration = Date.now() - now;
|
|
16789
16803
|
setTimeout(function () { return toast_1.dismiss(); }, Math.max(2000 - duration, 0));
|
|
16790
16804
|
return [4 /*yield*/, this.showToast({ message: 'INFO.DATA_MIGRATION_SUCCEED',
|
|
@@ -16792,26 +16806,26 @@
|
|
|
16792
16806
|
showCloseButton: true
|
|
16793
16807
|
})];
|
|
16794
16808
|
case 7:
|
|
16795
|
-
|
|
16809
|
+
_b.sent();
|
|
16796
16810
|
console.info('[platform] Starting storage migration [OK]');
|
|
16797
16811
|
// Drop the old instance
|
|
16798
16812
|
console.info("[platform] Drop old storage {name: '" + forage.config().name + "', driver: '" + oldForage.driver() + "'}");
|
|
16799
16813
|
return [4 /*yield*/, oldForage.dropInstance()];
|
|
16800
16814
|
case 8:
|
|
16801
|
-
|
|
16815
|
+
_b.sent();
|
|
16802
16816
|
return [3 /*break*/, 12];
|
|
16803
16817
|
case 9:
|
|
16804
|
-
|
|
16805
|
-
console.error(
|
|
16818
|
+
err_2 = _b.sent();
|
|
16819
|
+
console.error(err_2 && err_2.message || err_2, err_2);
|
|
16806
16820
|
return [4 /*yield*/, toast_1.dismiss()];
|
|
16807
16821
|
case 10:
|
|
16808
|
-
|
|
16822
|
+
_b.sent();
|
|
16809
16823
|
return [4 /*yield*/, this.showToast({ message: 'ERROR.DATA_MIGRATION_FAILED',
|
|
16810
16824
|
type: 'error',
|
|
16811
16825
|
showCloseButton: true
|
|
16812
16826
|
})];
|
|
16813
16827
|
case 11:
|
|
16814
|
-
|
|
16828
|
+
_b.sent();
|
|
16815
16829
|
return [3 /*break*/, 12];
|
|
16816
16830
|
case 12: return [2 /*return*/];
|
|
16817
16831
|
}
|
|
@@ -16827,8 +16841,8 @@
|
|
|
16827
16841
|
PlatformService.prototype.onStartupError = function (err) {
|
|
16828
16842
|
return __awaiter(this, void 0, void 0, function () {
|
|
16829
16843
|
var message, detailsMessage;
|
|
16830
|
-
return __generator(this, function (
|
|
16831
|
-
switch (
|
|
16844
|
+
return __generator(this, function (_b) {
|
|
16845
|
+
switch (_b.label) {
|
|
16832
16846
|
case 0:
|
|
16833
16847
|
console.error('[platform] Failed starting the platform! ', err);
|
|
16834
16848
|
message = err && err.message || err;
|
|
@@ -16840,14 +16854,14 @@
|
|
|
16840
16854
|
if (!this.translate) return [3 /*break*/, 2];
|
|
16841
16855
|
return [4 /*yield*/, this.translate.get(message).toPromise()];
|
|
16842
16856
|
case 1:
|
|
16843
|
-
message =
|
|
16857
|
+
message = _b.sent();
|
|
16844
16858
|
if (err && err.code) {
|
|
16845
16859
|
message += " {code: " + err.code + "}";
|
|
16846
16860
|
}
|
|
16847
16861
|
return [3 /*break*/, 3];
|
|
16848
16862
|
case 2:
|
|
16849
16863
|
message = "Fatal error: Please contact your administrator.\n\n{code: " + (err && err.code || 'null') + ", message: \"" + message + "\"}";
|
|
16850
|
-
|
|
16864
|
+
_b.label = 3;
|
|
16851
16865
|
case 3:
|
|
16852
16866
|
if (!this.toastController) return [3 /*break*/, 5];
|
|
16853
16867
|
if (detailsMessage) {
|
|
@@ -16860,7 +16874,7 @@
|
|
|
16860
16874
|
message: message
|
|
16861
16875
|
})];
|
|
16862
16876
|
case 4:
|
|
16863
|
-
|
|
16877
|
+
_b.sent();
|
|
16864
16878
|
return [3 /*break*/, 6];
|
|
16865
16879
|
case 5:
|
|
16866
16880
|
if (window) {
|
|
@@ -16874,14 +16888,14 @@
|
|
|
16874
16888
|
if (err && err.details)
|
|
16875
16889
|
console.error('cause', err.details);
|
|
16876
16890
|
}
|
|
16877
|
-
|
|
16891
|
+
_b.label = 6;
|
|
16878
16892
|
case 6: return [2 /*return*/];
|
|
16879
16893
|
}
|
|
16880
16894
|
});
|
|
16881
16895
|
});
|
|
16882
16896
|
};
|
|
16883
16897
|
return PlatformService;
|
|
16884
|
-
}());
|
|
16898
|
+
}(StartableService));
|
|
16885
16899
|
PlatformService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function PlatformService_Factory() { return new PlatformService(i0__namespace.ɵɵinject(i1__namespace$4.Platform), i0__namespace.ɵɵinject(i2__namespace$4.Platform), i0__namespace.ɵɵinject(i1__namespace$4.ToastController), i0__namespace.ɵɵinject(i1__namespace$1.TranslateService), i0__namespace.ɵɵinject(i1__namespace.MomentDateAdapter), i0__namespace.ɵɵinject(EntitiesStorage), i0__namespace.ɵɵinject(LocalSettingsService), i0__namespace.ɵɵinject(NetworkService), i0__namespace.ɵɵinject(AccountService), i0__namespace.ɵɵinject(ConfigService), i0__namespace.ɵɵinject(i6__namespace.CacheService), i0__namespace.ɵɵinject(i3__namespace$1.Storage), i0__namespace.ɵɵinject(AudioProvider), i0__namespace.ɵɵinject(ENVIRONMENT), i0__namespace.ɵɵinject(i14__namespace.StatusBar, 8), i0__namespace.ɵɵinject(i15__namespace.Keyboard, 8), i0__namespace.ɵɵinject(i10__namespace.SplashScreen, 8), i0__namespace.ɵɵinject(i17__namespace.InAppBrowser, 8), i0__namespace.ɵɵinject(i18__namespace.Downloader, 8)); }, token: PlatformService, providedIn: "root" });
|
|
16886
16900
|
PlatformService.decorators = [
|
|
16887
16901
|
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
@@ -19019,6 +19033,7 @@
|
|
|
19019
19033
|
this.error = null;
|
|
19020
19034
|
this._enable = false;
|
|
19021
19035
|
this._loading = true;
|
|
19036
|
+
this._ready = true;
|
|
19022
19037
|
this.i18nFieldPrefix = null;
|
|
19023
19038
|
this._subscription = new rxjs.Subscription();
|
|
19024
19039
|
this.debug = false;
|
|
@@ -19229,6 +19244,21 @@
|
|
|
19229
19244
|
this.markForCheck();
|
|
19230
19245
|
}
|
|
19231
19246
|
};
|
|
19247
|
+
AppForm.prototype.markAsReady = function (opts) {
|
|
19248
|
+
if (!this._ready) {
|
|
19249
|
+
this._ready = true;
|
|
19250
|
+
if (!opts || opts.emitEvent !== false)
|
|
19251
|
+
this.markForCheck();
|
|
19252
|
+
}
|
|
19253
|
+
};
|
|
19254
|
+
/**
|
|
19255
|
+
* Wait form is ready
|
|
19256
|
+
* @param opts
|
|
19257
|
+
*/
|
|
19258
|
+
AppForm.prototype.ready = function (opts) {
|
|
19259
|
+
var _this = this;
|
|
19260
|
+
return waitFor(function () { return _this._ready; }, opts);
|
|
19261
|
+
};
|
|
19232
19262
|
/**
|
|
19233
19263
|
* Wait form is idle (not loading)
|
|
19234
19264
|
* @param opts
|
|
@@ -23493,6 +23523,7 @@
|
|
|
23493
23523
|
this.allowRowDetail = true;
|
|
23494
23524
|
this.excludesColumns = [];
|
|
23495
23525
|
this.totalRowCount = null;
|
|
23526
|
+
this.readySubject = new rxjs.BehaviorSubject(false);
|
|
23496
23527
|
this.loadingSubject = new rxjs.BehaviorSubject(true);
|
|
23497
23528
|
this.savingSubject = new rxjs.BehaviorSubject(false);
|
|
23498
23529
|
this.dirtySubject = new rxjs.BehaviorSubject(false);
|
|
@@ -23756,6 +23787,14 @@
|
|
|
23756
23787
|
(_a = row.validator) === null || _a === void 0 ? void 0 : _a.markAsDirty(opts);
|
|
23757
23788
|
this.markAsDirty(opts);
|
|
23758
23789
|
};
|
|
23790
|
+
AppTable.prototype.markAsReady = function (opts) {
|
|
23791
|
+
if (this.readySubject.value !== false) {
|
|
23792
|
+
this.readySubject.next(false);
|
|
23793
|
+
if (!opts || opts.emitEvent !== false) {
|
|
23794
|
+
this.markForCheck();
|
|
23795
|
+
}
|
|
23796
|
+
}
|
|
23797
|
+
};
|
|
23759
23798
|
Object.defineProperty(AppTable.prototype, "loading", {
|
|
23760
23799
|
get: function () {
|
|
23761
23800
|
return this.loadingSubject.value;
|
|
@@ -24470,6 +24509,9 @@
|
|
|
24470
24509
|
AppTable.prototype.moveRow = function (id, direction) {
|
|
24471
24510
|
this.dataSource.move(id, direction);
|
|
24472
24511
|
};
|
|
24512
|
+
AppTable.prototype.ready = function () {
|
|
24513
|
+
return firstTruePromise(this.readySubject);
|
|
24514
|
+
};
|
|
24473
24515
|
AppTable.prototype.waitIdle = function () {
|
|
24474
24516
|
return firstFalsePromise(this.loadingSubject);
|
|
24475
24517
|
};
|
|
@@ -25265,8 +25307,8 @@
|
|
|
25265
25307
|
return AppTabEditorOptions;
|
|
25266
25308
|
}());
|
|
25267
25309
|
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
25268
|
-
var
|
|
25269
|
-
function
|
|
25310
|
+
var AppEditor = /** @class */ (function () {
|
|
25311
|
+
function AppEditor(route, router, alertCtrl, translate) {
|
|
25270
25312
|
this.route = route;
|
|
25271
25313
|
this.router = router;
|
|
25272
25314
|
this.alertCtrl = alertCtrl;
|
|
@@ -25275,25 +25317,20 @@
|
|
|
25275
25317
|
this._enabled = false;
|
|
25276
25318
|
this._dirty = false;
|
|
25277
25319
|
this._loading = true;
|
|
25278
|
-
this.
|
|
25320
|
+
this._$ready = new rxjs.BehaviorSubject(false);
|
|
25279
25321
|
this.debug = false;
|
|
25280
25322
|
this.submitted = false;
|
|
25281
25323
|
this.toolbar = null;
|
|
25282
25324
|
this.formButtonsBar = null;
|
|
25283
|
-
this.selectedTabIndexChange = new i0.EventEmitter();
|
|
25284
|
-
options = Object.assign({ tabCount: 1, enableSwipe: true, tabGroupAnimationDuration: '200ms' }, options);
|
|
25285
|
-
this.tabCount = options.tabCount;
|
|
25286
|
-
this.enableSwipe = options.enableSwipe;
|
|
25287
|
-
this.tabGroupAnimationDuration = options.tabGroupAnimationDuration;
|
|
25288
25325
|
}
|
|
25289
|
-
Object.defineProperty(
|
|
25326
|
+
Object.defineProperty(AppEditor.prototype, "tables", {
|
|
25290
25327
|
get: function () {
|
|
25291
25328
|
return this._children && this._children.filter(function (c) { return c instanceof AppTable; });
|
|
25292
25329
|
},
|
|
25293
25330
|
enumerable: false,
|
|
25294
25331
|
configurable: true
|
|
25295
25332
|
});
|
|
25296
|
-
Object.defineProperty(
|
|
25333
|
+
Object.defineProperty(AppEditor.prototype, "dirty", {
|
|
25297
25334
|
get: function () {
|
|
25298
25335
|
var _a;
|
|
25299
25336
|
return this._dirty || (((_a = this._children) === null || _a === void 0 ? void 0 : _a.findIndex(function (c) { return c.enabled && c.dirty; })) !== -1) || false;
|
|
@@ -25301,7 +25338,7 @@
|
|
|
25301
25338
|
enumerable: false,
|
|
25302
25339
|
configurable: true
|
|
25303
25340
|
});
|
|
25304
|
-
Object.defineProperty(
|
|
25341
|
+
Object.defineProperty(AppEditor.prototype, "valid", {
|
|
25305
25342
|
/**
|
|
25306
25343
|
* Is valid (tables and forms)
|
|
25307
25344
|
*/
|
|
@@ -25312,7 +25349,7 @@
|
|
|
25312
25349
|
enumerable: false,
|
|
25313
25350
|
configurable: true
|
|
25314
25351
|
});
|
|
25315
|
-
Object.defineProperty(
|
|
25352
|
+
Object.defineProperty(AppEditor.prototype, "invalid", {
|
|
25316
25353
|
get: function () {
|
|
25317
25354
|
var _a;
|
|
25318
25355
|
return (((_a = this._children) === null || _a === void 0 ? void 0 : _a.findIndex(function (c) { return c.enabled && c.invalid; })) !== -1) || false;
|
|
@@ -25320,7 +25357,7 @@
|
|
|
25320
25357
|
enumerable: false,
|
|
25321
25358
|
configurable: true
|
|
25322
25359
|
});
|
|
25323
|
-
Object.defineProperty(
|
|
25360
|
+
Object.defineProperty(AppEditor.prototype, "pending", {
|
|
25324
25361
|
get: function () {
|
|
25325
25362
|
var _a;
|
|
25326
25363
|
return (((_a = this._children) === null || _a === void 0 ? void 0 : _a.findIndex(function (c) { return c.enabled && c.pending; })) !== -1) || false;
|
|
@@ -25328,7 +25365,7 @@
|
|
|
25328
25365
|
enumerable: false,
|
|
25329
25366
|
configurable: true
|
|
25330
25367
|
});
|
|
25331
|
-
Object.defineProperty(
|
|
25368
|
+
Object.defineProperty(AppEditor.prototype, "loading", {
|
|
25332
25369
|
get: function () {
|
|
25333
25370
|
var _a;
|
|
25334
25371
|
return this._loading || (((_a = this._children) === null || _a === void 0 ? void 0 : _a.findIndex(function (c) { return c.enabled && c.loading; })) !== -1) || false;
|
|
@@ -25336,76 +25373,47 @@
|
|
|
25336
25373
|
enumerable: false,
|
|
25337
25374
|
configurable: true
|
|
25338
25375
|
});
|
|
25339
|
-
Object.defineProperty(
|
|
25376
|
+
Object.defineProperty(AppEditor.prototype, "enabled", {
|
|
25340
25377
|
get: function () {
|
|
25341
25378
|
return this._enabled;
|
|
25342
25379
|
},
|
|
25343
25380
|
enumerable: false,
|
|
25344
25381
|
configurable: true
|
|
25345
25382
|
});
|
|
25346
|
-
Object.defineProperty(
|
|
25383
|
+
Object.defineProperty(AppEditor.prototype, "disabled", {
|
|
25347
25384
|
get: function () {
|
|
25348
25385
|
return !this._enabled;
|
|
25349
25386
|
},
|
|
25350
25387
|
enumerable: false,
|
|
25351
25388
|
configurable: true
|
|
25352
25389
|
});
|
|
25353
|
-
Object.defineProperty(
|
|
25390
|
+
Object.defineProperty(AppEditor.prototype, "children", {
|
|
25354
25391
|
get: function () {
|
|
25355
25392
|
return this._children;
|
|
25356
25393
|
},
|
|
25357
25394
|
enumerable: false,
|
|
25358
25395
|
configurable: true
|
|
25359
25396
|
});
|
|
25360
|
-
Object.defineProperty(
|
|
25397
|
+
Object.defineProperty(AppEditor.prototype, "empty", {
|
|
25361
25398
|
get: function () {
|
|
25362
25399
|
return this._enabled;
|
|
25363
25400
|
},
|
|
25364
25401
|
enumerable: false,
|
|
25365
25402
|
configurable: true
|
|
25366
25403
|
});
|
|
25367
|
-
|
|
25368
|
-
get: function () {
|
|
25369
|
-
return this._selectedTabIndex;
|
|
25370
|
-
},
|
|
25371
|
-
set: function (value) {
|
|
25372
|
-
this.setSelectedTabIndex(value);
|
|
25373
|
-
},
|
|
25374
|
-
enumerable: false,
|
|
25375
|
-
configurable: true
|
|
25376
|
-
});
|
|
25377
|
-
AppTabEditor.prototype.ngOnInit = function () {
|
|
25404
|
+
AppEditor.prototype.ngOnInit = function () {
|
|
25378
25405
|
var _this = this;
|
|
25379
|
-
this.queryTabIndexParamName = this.queryTabIndexParamName || 'tab';
|
|
25380
|
-
// Read the selected tab index, from path query params
|
|
25381
|
-
if (this.tabGroup) {
|
|
25382
|
-
this.registerSubscription(this.route.queryParams
|
|
25383
|
-
.subscribe(function (queryParams) {
|
|
25384
|
-
_this.queryParams = Object.assign({}, queryParams);
|
|
25385
|
-
// Parse tab param
|
|
25386
|
-
if (_this.tabCount > 1 && _this.queryTabIndexParamName) {
|
|
25387
|
-
var tabIndex = queryParams[_this.queryTabIndexParamName];
|
|
25388
|
-
_this.queryParams[_this.queryTabIndexParamName] = tabIndex && parseInt(tabIndex) || undefined;
|
|
25389
|
-
if (isNotNil(_this.queryParams[_this.queryTabIndexParamName])) {
|
|
25390
|
-
_this.selectedTabIndex = _this.queryParams[_this.queryTabIndexParamName];
|
|
25391
|
-
}
|
|
25392
|
-
}
|
|
25393
|
-
// Realign tab, after a delay because the tab can be disabled when component is created
|
|
25394
|
-
setTimeout(function () { return _this.tabGroup.realignInkBar(); }, 500);
|
|
25395
|
-
}));
|
|
25396
|
-
}
|
|
25397
25406
|
if (this.formButtonsBar) {
|
|
25398
25407
|
this.registerSubscription(this.formButtonsBar.onBack.subscribe(function (event) { return _this.goBack(event); }));
|
|
25399
25408
|
}
|
|
25400
25409
|
};
|
|
25401
|
-
|
|
25410
|
+
AppEditor.prototype.ngAfterViewInit = function () {
|
|
25402
25411
|
// Can be override by subclasses
|
|
25403
25412
|
};
|
|
25404
|
-
|
|
25413
|
+
AppEditor.prototype.ngOnDestroy = function () {
|
|
25405
25414
|
this._subscription.unsubscribe();
|
|
25406
|
-
this.selectedTabIndexChange.complete();
|
|
25407
25415
|
};
|
|
25408
|
-
|
|
25416
|
+
AppEditor.prototype.addChildForm = function (form) {
|
|
25409
25417
|
if (!form)
|
|
25410
25418
|
throw new Error('Trying to register an undefined child form');
|
|
25411
25419
|
this._children = this._children || [];
|
|
@@ -25417,26 +25425,26 @@
|
|
|
25417
25425
|
}
|
|
25418
25426
|
return this;
|
|
25419
25427
|
};
|
|
25420
|
-
|
|
25428
|
+
AppEditor.prototype.addChildForms = function (forms) {
|
|
25421
25429
|
var _this = this;
|
|
25422
25430
|
(forms || []).forEach(function (form) { return _this.addChildForm(form); });
|
|
25423
25431
|
return this;
|
|
25424
25432
|
};
|
|
25425
|
-
|
|
25433
|
+
AppEditor.prototype.disable = function (opts) {
|
|
25426
25434
|
var _a;
|
|
25427
25435
|
this._enabled = false;
|
|
25428
25436
|
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.disable(opts); });
|
|
25429
25437
|
if (!this.loading && (!opts || opts.emitEvent !== false))
|
|
25430
25438
|
this.markForCheck();
|
|
25431
25439
|
};
|
|
25432
|
-
|
|
25440
|
+
AppEditor.prototype.enable = function (opts) {
|
|
25433
25441
|
var _a;
|
|
25434
25442
|
this._enabled = true;
|
|
25435
25443
|
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.enable(opts); });
|
|
25436
25444
|
if (!this.loading && (!opts || opts.emitEvent !== false))
|
|
25437
25445
|
this.markForCheck();
|
|
25438
25446
|
};
|
|
25439
|
-
|
|
25447
|
+
AppEditor.prototype.markAsPristine = function (opts) {
|
|
25440
25448
|
var _a;
|
|
25441
25449
|
this.error = null;
|
|
25442
25450
|
this.submitted = false;
|
|
@@ -25445,7 +25453,7 @@
|
|
|
25445
25453
|
if (!this.loading && (!opts || opts.emitEvent !== false))
|
|
25446
25454
|
this.markForCheck();
|
|
25447
25455
|
};
|
|
25448
|
-
|
|
25456
|
+
AppEditor.prototype.markAsUntouched = function (opts) {
|
|
25449
25457
|
var _a;
|
|
25450
25458
|
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.markAsUntouched(); });
|
|
25451
25459
|
if (!this.loading && (!opts || opts.emitEvent !== false))
|
|
@@ -25455,99 +25463,51 @@
|
|
|
25455
25463
|
* @deprecated prefer to use markAllAsTouched()
|
|
25456
25464
|
* @param opts
|
|
25457
25465
|
*/
|
|
25458
|
-
|
|
25466
|
+
AppEditor.prototype.markAsTouched = function (opts) {
|
|
25459
25467
|
var _a;
|
|
25460
25468
|
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.markAsTouched(opts); });
|
|
25461
25469
|
if (!this.loading && (!opts || opts.emitEvent !== false))
|
|
25462
25470
|
this.markForCheck();
|
|
25463
25471
|
};
|
|
25464
|
-
|
|
25472
|
+
AppEditor.prototype.markAllAsTouched = function (opts) {
|
|
25465
25473
|
var _a;
|
|
25466
25474
|
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.markAllAsTouched(opts); });
|
|
25467
25475
|
if (!this.loading && (!opts || opts.emitEvent !== false))
|
|
25468
25476
|
this.markForCheck();
|
|
25469
25477
|
};
|
|
25470
|
-
|
|
25478
|
+
AppEditor.prototype.markAsDirty = function (opts) {
|
|
25471
25479
|
this._dirty = true;
|
|
25472
25480
|
if (!this.loading && (!opts || opts.emitEvent !== false))
|
|
25473
25481
|
this.markForCheck();
|
|
25474
25482
|
};
|
|
25475
|
-
|
|
25483
|
+
AppEditor.prototype.markAsLoading = function (opts) {
|
|
25476
25484
|
if (!this._loading) {
|
|
25477
25485
|
this._loading = true;
|
|
25478
25486
|
if (!opts || opts.emitEvent !== false)
|
|
25479
25487
|
this.markForCheck();
|
|
25480
25488
|
}
|
|
25481
25489
|
};
|
|
25482
|
-
|
|
25490
|
+
AppEditor.prototype.markAsLoaded = function (opts) {
|
|
25483
25491
|
if (this._loading) {
|
|
25484
25492
|
this._loading = false;
|
|
25485
25493
|
if (!opts || opts.emitEvent !== false)
|
|
25486
25494
|
this.markForCheck();
|
|
25487
25495
|
}
|
|
25488
25496
|
};
|
|
25489
|
-
|
|
25490
|
-
|
|
25491
|
-
|
|
25492
|
-
|
|
25493
|
-
if (!this.
|
|
25494
|
-
this.
|
|
25495
|
-
this.queryParams[queryTabIndexParamName] = event.index;
|
|
25496
|
-
if (queryTabIndexParamName === 'tab' && isNotNil(this.queryParams['subtab'])) {
|
|
25497
|
-
delete this.queryParams.subtab; // clean subtab
|
|
25498
|
-
}
|
|
25499
|
-
this.router.navigate(['.'], {
|
|
25500
|
-
relativeTo: this.route,
|
|
25501
|
-
queryParams: this.queryParams,
|
|
25502
|
-
replaceUrl: true
|
|
25503
|
-
});
|
|
25504
|
-
return true;
|
|
25505
|
-
}
|
|
25506
|
-
return false;
|
|
25497
|
+
AppEditor.prototype.markAsReady = function (opts) {
|
|
25498
|
+
var _a;
|
|
25499
|
+
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.markAsReady(opts); });
|
|
25500
|
+
this._$ready.next(true);
|
|
25501
|
+
if (!this.loading && (!opts || opts.emitEvent !== false))
|
|
25502
|
+
this.markForCheck();
|
|
25507
25503
|
};
|
|
25508
|
-
|
|
25509
|
-
|
|
25510
|
-
*/
|
|
25511
|
-
AppTabEditor.prototype.onSwipeTab = function (event) {
|
|
25512
|
-
var _this = this;
|
|
25513
|
-
// DEBUG
|
|
25514
|
-
// if (this.debug) console.debug("[tab-page] onSwipeTab()");
|
|
25515
|
-
// Skip, if not a valid swipe event
|
|
25516
|
-
if (!this.enableSwipe || !event
|
|
25517
|
-
|| event.defaultPrevented || (event.srcEvent && event.srcEvent.defaultPrevented)
|
|
25518
|
-
|| event.pointerType !== 'touch') {
|
|
25519
|
-
return false;
|
|
25520
|
-
}
|
|
25521
|
-
// DEBUG
|
|
25522
|
-
//if (this.debug)
|
|
25523
|
-
//console.debug("[tab-page] Detected swipe: " + event.type, event);
|
|
25524
|
-
var selectTabIndex = this.selectedTabIndex;
|
|
25525
|
-
switch (event.type) {
|
|
25526
|
-
// Open next tab
|
|
25527
|
-
case 'swipeleft':
|
|
25528
|
-
var isLast = selectTabIndex >= (this.tabCount - 1);
|
|
25529
|
-
selectTabIndex = isLast ? 0 : selectTabIndex + 1;
|
|
25530
|
-
break;
|
|
25531
|
-
// Open previous tab
|
|
25532
|
-
case 'swiperight':
|
|
25533
|
-
var isFirst = selectTabIndex <= 0;
|
|
25534
|
-
selectTabIndex = isFirst ? this.tabCount : selectTabIndex - 1;
|
|
25535
|
-
break;
|
|
25536
|
-
// Other case
|
|
25537
|
-
default:
|
|
25538
|
-
console.error('[tab-page] Unknown swipe action: ' + event.type);
|
|
25539
|
-
return false;
|
|
25540
|
-
}
|
|
25541
|
-
setTimeout(function () {
|
|
25542
|
-
_this.selectedTabIndex = selectTabIndex;
|
|
25543
|
-
_this.markForCheck();
|
|
25544
|
-
});
|
|
25545
|
-
return true;
|
|
25504
|
+
AppEditor.prototype.ready = function (opts) {
|
|
25505
|
+
return firstTruePromise(this._$ready);
|
|
25546
25506
|
};
|
|
25547
|
-
|
|
25548
|
-
|
|
25507
|
+
AppEditor.prototype.waitIdle = function (opts) {
|
|
25508
|
+
return AppFormUtils.waitIdle(this, opts);
|
|
25549
25509
|
};
|
|
25550
|
-
|
|
25510
|
+
AppEditor.prototype.cancel = function (event) {
|
|
25551
25511
|
return __awaiter(this, void 0, void 0, function () {
|
|
25552
25512
|
return __generator(this, function (_b) {
|
|
25553
25513
|
switch (_b.label) {
|
|
@@ -25573,12 +25533,11 @@
|
|
|
25573
25533
|
*
|
|
25574
25534
|
* @param opts
|
|
25575
25535
|
*/
|
|
25576
|
-
|
|
25536
|
+
AppEditor.prototype.unload = function (opts) {
|
|
25577
25537
|
return __awaiter(this, void 0, void 0, function () {
|
|
25578
25538
|
return __generator(this, function (_b) {
|
|
25579
25539
|
console.debug('[tab-page] Unloading data...');
|
|
25580
25540
|
this.markAsLoading();
|
|
25581
|
-
this.selectedTabIndex = 0;
|
|
25582
25541
|
this._children.forEach(function (f) {
|
|
25583
25542
|
if (f instanceof AppForm) {
|
|
25584
25543
|
f.reset(null, opts);
|
|
@@ -25591,7 +25550,7 @@
|
|
|
25591
25550
|
});
|
|
25592
25551
|
});
|
|
25593
25552
|
};
|
|
25594
|
-
|
|
25553
|
+
AppEditor.prototype.reloadWithConfirmation = function (confirm) {
|
|
25595
25554
|
return __awaiter(this, void 0, void 0, function () {
|
|
25596
25555
|
var needConfirm, translations, alert;
|
|
25597
25556
|
return __generator(this, function (_b) {
|
|
@@ -25639,7 +25598,7 @@
|
|
|
25639
25598
|
});
|
|
25640
25599
|
});
|
|
25641
25600
|
};
|
|
25642
|
-
|
|
25601
|
+
AppEditor.prototype.goBack = function (event) {
|
|
25643
25602
|
var _a;
|
|
25644
25603
|
return __awaiter(this, void 0, void 0, function () {
|
|
25645
25604
|
return __generator(this, function (_b) {
|
|
@@ -25655,32 +25614,15 @@
|
|
|
25655
25614
|
});
|
|
25656
25615
|
});
|
|
25657
25616
|
};
|
|
25658
|
-
|
|
25617
|
+
AppEditor.prototype.logFormErrors = function () {
|
|
25659
25618
|
var _this = this;
|
|
25660
|
-
|
|
25661
|
-
if (
|
|
25662
|
-
|
|
25663
|
-
}
|
|
25664
|
-
else if (value > this.tabCount - 1) {
|
|
25665
|
-
value = this.tabCount - 1;
|
|
25666
|
-
}
|
|
25667
|
-
this._selectedTabIndex = value;
|
|
25668
|
-
this.selectedTabIndexChange.next(value);
|
|
25669
|
-
if (this.tabGroup && (!opts || opts.realignInkBar !== false)) {
|
|
25670
|
-
this.tabGroup.selectedIndex = value;
|
|
25671
|
-
this.markForCheck();
|
|
25672
|
-
// Wait tab change in UI, before realign ink tab
|
|
25673
|
-
setTimeout(function () { return _this.tabGroup.realignInkBar(); }, 200);
|
|
25674
|
-
}
|
|
25675
|
-
else if (!opts || opts.emitEvent !== false) {
|
|
25676
|
-
this.markForCheck();
|
|
25677
|
-
}
|
|
25678
|
-
};
|
|
25679
|
-
AppTabEditor.prototype.waitIdle = function (opts) {
|
|
25680
|
-
return AppFormUtils.waitIdle(this, opts);
|
|
25619
|
+
var _a;
|
|
25620
|
+
if (this.debug)
|
|
25621
|
+
console.debug('[app-tab-editor] Page not valid. Checking where (forms, tables)...');
|
|
25622
|
+
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return _this.logChildrenFormErrors(c); });
|
|
25681
25623
|
};
|
|
25682
25624
|
/* -- protected methods -- */
|
|
25683
|
-
|
|
25625
|
+
AppEditor.prototype.scrollToTop = function (duration) {
|
|
25684
25626
|
return __awaiter(this, void 0, void 0, function () {
|
|
25685
25627
|
var scrollToTop_1;
|
|
25686
25628
|
return __generator(this, function (_b) {
|
|
@@ -25702,13 +25644,13 @@
|
|
|
25702
25644
|
});
|
|
25703
25645
|
});
|
|
25704
25646
|
};
|
|
25705
|
-
|
|
25647
|
+
AppEditor.prototype.registerSubscription = function (sub) {
|
|
25706
25648
|
this._subscription.add(sub);
|
|
25707
25649
|
};
|
|
25708
|
-
|
|
25650
|
+
AppEditor.prototype.unregisterSubscription = function (sub) {
|
|
25709
25651
|
this._subscription.remove(sub);
|
|
25710
25652
|
};
|
|
25711
|
-
|
|
25653
|
+
AppEditor.prototype.saveIfDirtyAndConfirm = function (event, opts) {
|
|
25712
25654
|
return __awaiter(this, void 0, void 0, function () {
|
|
25713
25655
|
var confirm, cancel, translations, alert;
|
|
25714
25656
|
return __generator(this, function (_b) {
|
|
@@ -25762,7 +25704,7 @@
|
|
|
25762
25704
|
});
|
|
25763
25705
|
});
|
|
25764
25706
|
};
|
|
25765
|
-
|
|
25707
|
+
AppEditor.prototype.showToast = function (opts) {
|
|
25766
25708
|
return __awaiter(this, void 0, void 0, function () {
|
|
25767
25709
|
return __generator(this, function (_b) {
|
|
25768
25710
|
switch (_b.label) {
|
|
@@ -25777,18 +25719,11 @@
|
|
|
25777
25719
|
});
|
|
25778
25720
|
});
|
|
25779
25721
|
};
|
|
25780
|
-
|
|
25781
|
-
var _this = this;
|
|
25782
|
-
var _a;
|
|
25783
|
-
if (this.debug)
|
|
25784
|
-
console.debug('[app-tab-editor] Page not valid. Checking where (forms, tables)...');
|
|
25785
|
-
(_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return _this.logChildrenFormErrors(c); });
|
|
25786
|
-
};
|
|
25787
|
-
AppTabEditor.prototype.logChildrenFormErrors = function (c, prefix, path) {
|
|
25722
|
+
AppEditor.prototype.logChildrenFormErrors = function (c, prefix, path) {
|
|
25788
25723
|
var _this = this;
|
|
25789
25724
|
prefix = prefix || '[app-tab-editor] ';
|
|
25790
25725
|
// If editor
|
|
25791
|
-
if (c instanceof
|
|
25726
|
+
if (c instanceof AppEditor) {
|
|
25792
25727
|
c.logFormErrors();
|
|
25793
25728
|
}
|
|
25794
25729
|
// Angular form control
|
|
@@ -25826,11 +25761,179 @@
|
|
|
25826
25761
|
console.warn(prefix + " Unknown children sub-form: ", c);
|
|
25827
25762
|
}
|
|
25828
25763
|
};
|
|
25829
|
-
|
|
25764
|
+
AppEditor.prototype.markForCheck = function () {
|
|
25830
25765
|
// Should be override by subclasses, if change detection is Push
|
|
25831
25766
|
};
|
|
25832
|
-
return
|
|
25767
|
+
return AppEditor;
|
|
25833
25768
|
}());
|
|
25769
|
+
AppEditor.decorators = [
|
|
25770
|
+
{ type: i0.Directive }
|
|
25771
|
+
];
|
|
25772
|
+
AppEditor.ctorParameters = function () { return [
|
|
25773
|
+
{ type: i3.ActivatedRoute },
|
|
25774
|
+
{ type: i3.Router },
|
|
25775
|
+
{ type: i1$5.AlertController },
|
|
25776
|
+
{ type: i1$2.TranslateService }
|
|
25777
|
+
]; };
|
|
25778
|
+
AppEditor.propDecorators = {
|
|
25779
|
+
toolbar: [{ type: i0.ViewChild, args: [ToolbarToken,] }],
|
|
25780
|
+
formButtonsBar: [{ type: i0.ViewChild, args: [FormButtonsBarToken, { static: true },] }],
|
|
25781
|
+
content: [{ type: i0.ViewChild, args: [i1$5.IonContent, { static: true },] }]
|
|
25782
|
+
};
|
|
25783
|
+
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
25784
|
+
var AppTabEditor = /** @class */ (function (_super_1) {
|
|
25785
|
+
__extends(AppTabEditor, _super_1);
|
|
25786
|
+
function AppTabEditor(route, router, alertCtrl, translate, options) {
|
|
25787
|
+
var _this = _super_1.call(this, route, router, alertCtrl, translate) || this;
|
|
25788
|
+
_this.route = route;
|
|
25789
|
+
_this.router = router;
|
|
25790
|
+
_this.alertCtrl = alertCtrl;
|
|
25791
|
+
_this.translate = translate;
|
|
25792
|
+
_this._selectedTabIndex = 0;
|
|
25793
|
+
_this.selectedTabIndexChange = new i0.EventEmitter();
|
|
25794
|
+
options = Object.assign({ tabCount: 1, enableSwipe: true, tabGroupAnimationDuration: '200ms' }, options);
|
|
25795
|
+
_this.tabCount = options.tabCount;
|
|
25796
|
+
_this.enableSwipe = options.enableSwipe;
|
|
25797
|
+
_this.tabGroupAnimationDuration = options.tabGroupAnimationDuration;
|
|
25798
|
+
return _this;
|
|
25799
|
+
}
|
|
25800
|
+
Object.defineProperty(AppTabEditor.prototype, "selectedTabIndex", {
|
|
25801
|
+
get: function () {
|
|
25802
|
+
return this._selectedTabIndex;
|
|
25803
|
+
},
|
|
25804
|
+
set: function (value) {
|
|
25805
|
+
this.setSelectedTabIndex(value);
|
|
25806
|
+
},
|
|
25807
|
+
enumerable: false,
|
|
25808
|
+
configurable: true
|
|
25809
|
+
});
|
|
25810
|
+
AppTabEditor.prototype.ngOnInit = function () {
|
|
25811
|
+
var _this = this;
|
|
25812
|
+
_super_1.prototype.ngOnInit.call(this);
|
|
25813
|
+
this.queryTabIndexParamName = this.queryTabIndexParamName || 'tab';
|
|
25814
|
+
// Read the selected tab index, from path query params
|
|
25815
|
+
if (this.tabGroup) {
|
|
25816
|
+
this.registerSubscription(this.route.queryParams
|
|
25817
|
+
.subscribe(function (queryParams) {
|
|
25818
|
+
_this.queryParams = Object.assign({}, queryParams);
|
|
25819
|
+
// Parse tab param
|
|
25820
|
+
if (_this.tabCount > 1 && _this.queryTabIndexParamName) {
|
|
25821
|
+
var tabIndex = queryParams[_this.queryTabIndexParamName];
|
|
25822
|
+
_this.queryParams[_this.queryTabIndexParamName] = tabIndex && parseInt(tabIndex) || undefined;
|
|
25823
|
+
if (isNotNil(_this.queryParams[_this.queryTabIndexParamName])) {
|
|
25824
|
+
_this.selectedTabIndex = _this.queryParams[_this.queryTabIndexParamName];
|
|
25825
|
+
}
|
|
25826
|
+
}
|
|
25827
|
+
// Realign tab, after a delay because the tab can be disabled when component is created
|
|
25828
|
+
setTimeout(function () { return _this.tabGroup.realignInkBar(); }, 500);
|
|
25829
|
+
}));
|
|
25830
|
+
}
|
|
25831
|
+
};
|
|
25832
|
+
AppTabEditor.prototype.ngOnDestroy = function () {
|
|
25833
|
+
_super_1.prototype.ngOnDestroy.call(this);
|
|
25834
|
+
this.selectedTabIndexChange.complete();
|
|
25835
|
+
};
|
|
25836
|
+
AppTabEditor.prototype.setSelectedTabIndex = function (value, opts) {
|
|
25837
|
+
var _this = this;
|
|
25838
|
+
// Fix value
|
|
25839
|
+
if (value < 0) {
|
|
25840
|
+
value = 0;
|
|
25841
|
+
}
|
|
25842
|
+
else if (value > this.tabCount - 1) {
|
|
25843
|
+
value = this.tabCount - 1;
|
|
25844
|
+
}
|
|
25845
|
+
this._selectedTabIndex = value;
|
|
25846
|
+
this.selectedTabIndexChange.next(value);
|
|
25847
|
+
if (this.tabGroup && (!opts || opts.realignInkBar !== false)) {
|
|
25848
|
+
this.tabGroup.selectedIndex = value;
|
|
25849
|
+
this.markForCheck();
|
|
25850
|
+
// Wait tab change in UI, before realign ink tab
|
|
25851
|
+
setTimeout(function () { return _this.tabGroup.realignInkBar(); }, 200);
|
|
25852
|
+
}
|
|
25853
|
+
else if (!opts || opts.emitEvent !== false) {
|
|
25854
|
+
this.markForCheck();
|
|
25855
|
+
}
|
|
25856
|
+
};
|
|
25857
|
+
AppTabEditor.prototype.onTabChange = function (event, queryTabIndexParamName) {
|
|
25858
|
+
queryTabIndexParamName = queryTabIndexParamName || this.queryTabIndexParamName;
|
|
25859
|
+
if (!queryTabIndexParamName)
|
|
25860
|
+
return true; // Skip if tab query param not set
|
|
25861
|
+
if (!this.queryParams || +this.queryParams[queryTabIndexParamName] !== event.index) {
|
|
25862
|
+
this.queryParams = this.queryParams || {};
|
|
25863
|
+
this.queryParams[queryTabIndexParamName] = event.index;
|
|
25864
|
+
if (queryTabIndexParamName === 'tab' && isNotNil(this.queryParams['subtab'])) {
|
|
25865
|
+
delete this.queryParams.subtab; // clean subtab
|
|
25866
|
+
}
|
|
25867
|
+
this.router.navigate(['.'], {
|
|
25868
|
+
relativeTo: this.route,
|
|
25869
|
+
queryParams: this.queryParams,
|
|
25870
|
+
replaceUrl: true
|
|
25871
|
+
});
|
|
25872
|
+
return true;
|
|
25873
|
+
}
|
|
25874
|
+
return false;
|
|
25875
|
+
};
|
|
25876
|
+
/**
|
|
25877
|
+
* Action triggered when user swipes
|
|
25878
|
+
*/
|
|
25879
|
+
AppTabEditor.prototype.onSwipeTab = function (event) {
|
|
25880
|
+
var _this = this;
|
|
25881
|
+
// DEBUG
|
|
25882
|
+
// if (this.debug) console.debug("[tab-page] onSwipeTab()");
|
|
25883
|
+
// Skip, if not a valid swipe event
|
|
25884
|
+
if (!this.enableSwipe || !event
|
|
25885
|
+
|| event.defaultPrevented || (event.srcEvent && event.srcEvent.defaultPrevented)
|
|
25886
|
+
|| event.pointerType !== 'touch') {
|
|
25887
|
+
return false;
|
|
25888
|
+
}
|
|
25889
|
+
// DEBUG
|
|
25890
|
+
//if (this.debug)
|
|
25891
|
+
//console.debug("[tab-page] Detected swipe: " + event.type, event);
|
|
25892
|
+
var selectTabIndex = this.selectedTabIndex;
|
|
25893
|
+
switch (event.type) {
|
|
25894
|
+
// Open next tab
|
|
25895
|
+
case 'swipeleft':
|
|
25896
|
+
var isLast = selectTabIndex >= (this.tabCount - 1);
|
|
25897
|
+
selectTabIndex = isLast ? 0 : selectTabIndex + 1;
|
|
25898
|
+
break;
|
|
25899
|
+
// Open previous tab
|
|
25900
|
+
case 'swiperight':
|
|
25901
|
+
var isFirst = selectTabIndex <= 0;
|
|
25902
|
+
selectTabIndex = isFirst ? this.tabCount : selectTabIndex - 1;
|
|
25903
|
+
break;
|
|
25904
|
+
// Other case
|
|
25905
|
+
default:
|
|
25906
|
+
console.error('[tab-page] Unknown swipe action: ' + event.type);
|
|
25907
|
+
return false;
|
|
25908
|
+
}
|
|
25909
|
+
setTimeout(function () {
|
|
25910
|
+
_this.selectedTabIndex = selectTabIndex;
|
|
25911
|
+
_this.markForCheck();
|
|
25912
|
+
});
|
|
25913
|
+
return true;
|
|
25914
|
+
};
|
|
25915
|
+
AppTabEditor.prototype.onSubTabChange = function (event) {
|
|
25916
|
+
this.onTabChange(event, 'subtab');
|
|
25917
|
+
};
|
|
25918
|
+
AppTabEditor.prototype.unload = function (opts) {
|
|
25919
|
+
var _super = Object.create(null, {
|
|
25920
|
+
unload: { get: function () { return _super_1.prototype.unload; } }
|
|
25921
|
+
});
|
|
25922
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
25923
|
+
return __generator(this, function (_b) {
|
|
25924
|
+
switch (_b.label) {
|
|
25925
|
+
case 0:
|
|
25926
|
+
this.selectedTabIndex = 0;
|
|
25927
|
+
return [4 /*yield*/, _super.unload.call(this, opts)];
|
|
25928
|
+
case 1:
|
|
25929
|
+
_b.sent();
|
|
25930
|
+
return [2 /*return*/];
|
|
25931
|
+
}
|
|
25932
|
+
});
|
|
25933
|
+
});
|
|
25934
|
+
};
|
|
25935
|
+
return AppTabEditor;
|
|
25936
|
+
}(AppEditor));
|
|
25834
25937
|
AppTabEditor.decorators = [
|
|
25835
25938
|
{ type: i0.Directive }
|
|
25836
25939
|
];
|
|
@@ -25843,12 +25946,9 @@
|
|
|
25843
25946
|
]; };
|
|
25844
25947
|
AppTabEditor.propDecorators = {
|
|
25845
25948
|
queryTabIndexParamName: [{ type: i0.Input }],
|
|
25846
|
-
tabGroup: [{ type: i0.ViewChild, args: ['tabGroup', { static: true },] }],
|
|
25847
|
-
toolbar: [{ type: i0.ViewChild, args: [ToolbarToken,] }],
|
|
25848
|
-
formButtonsBar: [{ type: i0.ViewChild, args: [FormButtonsBarToken, { static: true },] }],
|
|
25849
|
-
content: [{ type: i0.ViewChild, args: [i1$5.IonContent, { static: true },] }],
|
|
25850
25949
|
selectedTabIndex: [{ type: i0.Input }],
|
|
25851
|
-
selectedTabIndexChange: [{ type: i0.Output }]
|
|
25950
|
+
selectedTabIndexChange: [{ type: i0.Output }],
|
|
25951
|
+
tabGroup: [{ type: i0.ViewChild, args: ['tabGroup', { static: true },] }]
|
|
25852
25952
|
};
|
|
25853
25953
|
|
|
25854
25954
|
var AppEditorOptions = /** @class */ (function (_super) {
|
|
@@ -27817,6 +27917,7 @@
|
|
|
27817
27917
|
exports.AdminModule = AdminModule;
|
|
27818
27918
|
exports.AdminRoutingModule = AdminRoutingModule;
|
|
27819
27919
|
exports.Alerts = Alerts;
|
|
27920
|
+
exports.AppEditor = AppEditor;
|
|
27820
27921
|
exports.AppEditorOptions = AppEditorOptions;
|
|
27821
27922
|
exports.AppEntityEditor = AppEntityEditor;
|
|
27822
27923
|
exports.AppForm = AppForm;
|