@sumaris-net/ngx-components 0.28.0 → 0.28.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/sumaris-net.ngx-components.umd.js +135 -63
- 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/account/account.js +4 -5
- package/esm2015/src/app/core/auth/form/form-auth.js +3 -4
- package/esm2015/src/app/core/form/editor.class.js +10 -2
- package/esm2015/src/app/core/form/entity-editor.class.js +15 -7
- package/esm2015/src/app/core/form/form.class.js +24 -10
- package/esm2015/src/app/core/form/list.form.js +2 -3
- package/esm2015/src/app/core/form/properties.form.js +2 -3
- package/esm2015/src/app/core/settings/settings.page.js +3 -4
- package/esm2015/src/app/shared/dates.js +2 -2
- package/esm2015/src/app/shared/pipes/translate-context.pipe.js +4 -8
- package/esm2015/src/app/shared/services/translate-context.service.js +38 -13
- package/fesm2015/sumaris-net.ngx-components.js +95 -46
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/account/account.d.ts +0 -1
- package/src/app/core/auth/form/form-auth.d.ts +0 -1
- package/src/app/core/form/editor.class.d.ts +2 -0
- package/src/app/core/form/form.class.d.ts +10 -2
- package/src/app/core/form/list.form.d.ts +0 -1
- package/src/app/core/form/properties.form.d.ts +0 -1
- package/src/app/core/settings/settings.page.d.ts +0 -1
- package/src/app/shared/services/translate-context.service.d.ts +10 -0
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -2481,7 +2481,7 @@
|
|
|
2481
2481
|
return date1 && date2 && date1.isSameOrBefore(date2) ? date1 : date2;
|
|
2482
2482
|
};
|
|
2483
2483
|
DateUtils.max = function (date1, date2) {
|
|
2484
|
-
return date1
|
|
2484
|
+
return !date1 ? date2 : (!date2 || date1.isSameOrAfter(date2) ? date1 : date2);
|
|
2485
2485
|
};
|
|
2486
2486
|
return DateUtils;
|
|
2487
2487
|
}());
|
|
@@ -2854,23 +2854,42 @@
|
|
|
2854
2854
|
TranslateContextService.prototype.get = function (key, context, interpolateParams) {
|
|
2855
2855
|
var _this = this;
|
|
2856
2856
|
// No context: do a normal translate
|
|
2857
|
-
if (!isNil(context))
|
|
2857
|
+
if (!key || !isNil(context))
|
|
2858
2858
|
return this.translate.get(key, interpolateParams);
|
|
2859
2859
|
// Compute a contextual i18n key, using the context as suffix
|
|
2860
|
-
var
|
|
2860
|
+
var contextualKeys = this.contextualKeys(key, context);
|
|
2861
2861
|
// Return the contextual translation, or default of not exists
|
|
2862
|
-
return this.translate.get(
|
|
2863
|
-
.pipe(operators.
|
|
2862
|
+
return this.translate.get(contextualKeys, interpolateParams)
|
|
2863
|
+
.pipe(operators.map(function (translations) { return _this.findFirstValid(contextualKeys, translations) || key; }));
|
|
2864
2864
|
};
|
|
2865
2865
|
TranslateContextService.prototype.instant = function (key, context, interpolateParams) {
|
|
2866
2866
|
// No context: do a normal translate
|
|
2867
|
-
if (isNilOrBlank(context))
|
|
2867
|
+
if (!key || isNilOrBlank(context))
|
|
2868
2868
|
return this.translate.instant(key, interpolateParams);
|
|
2869
2869
|
// Compute a contextual i18n key, using the context as suffix
|
|
2870
|
-
var
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2870
|
+
var contextualKeys = this.contextualKeys(key, context);
|
|
2871
|
+
var translations = this.translate.instant(contextualKeys, interpolateParams);
|
|
2872
|
+
return this.findFirstValid(contextualKeys, translations) || key;
|
|
2873
|
+
};
|
|
2874
|
+
/**
|
|
2875
|
+
* Compute contextual i18n keys, using the context as suffix.<br>
|
|
2876
|
+
* Suffix can be simple name (like 'aaa' - will return ['<key>.aaa']) or complexe (like 'aaa.bbb' - will return ['<key>.aaa.bbb', '<key>.aaa']
|
|
2877
|
+
*
|
|
2878
|
+
* @param key
|
|
2879
|
+
* @param context
|
|
2880
|
+
* @private
|
|
2881
|
+
*/
|
|
2882
|
+
TranslateContextService.prototype.contextualKeys = function (key, context) {
|
|
2883
|
+
var _this = this;
|
|
2884
|
+
return context.split('.')
|
|
2885
|
+
.filter(isNotNilOrBlank)
|
|
2886
|
+
.reduce(function (res, item) {
|
|
2887
|
+
var inheritedContext = res.length > 0 ? (res[res.length - 1] + '.') : '';
|
|
2888
|
+
return res.concat(inheritedContext + item);
|
|
2889
|
+
}, [])
|
|
2890
|
+
.reverse() // Start with children, ends with parent key
|
|
2891
|
+
.map(function (contextItem) { return _this.contextualKey(key, contextItem); })
|
|
2892
|
+
.concat(key);
|
|
2874
2893
|
};
|
|
2875
2894
|
/**
|
|
2876
2895
|
* Compute a contextual i18n key, using the context as suffix
|
|
@@ -2890,6 +2909,25 @@
|
|
|
2890
2909
|
? "" + context + key
|
|
2891
2910
|
: parts.slice(0, parts.length - 1).concat(context + parts[parts.length - 1]).join('.');
|
|
2892
2911
|
};
|
|
2912
|
+
TranslateContextService.prototype.findFirstValid = function (keys, translations) {
|
|
2913
|
+
var e_1, _a;
|
|
2914
|
+
try {
|
|
2915
|
+
// For eac contextual key: try to find translation, then use the first valid
|
|
2916
|
+
for (var keys_1 = __values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
|
|
2917
|
+
var key = keys_1_1.value;
|
|
2918
|
+
if (translations[key] !== key)
|
|
2919
|
+
return translations[key];
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2923
|
+
finally {
|
|
2924
|
+
try {
|
|
2925
|
+
if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
|
|
2926
|
+
}
|
|
2927
|
+
finally { if (e_1) throw e_1.error; }
|
|
2928
|
+
}
|
|
2929
|
+
return undefined;
|
|
2930
|
+
};
|
|
2893
2931
|
return TranslateContextService;
|
|
2894
2932
|
}());
|
|
2895
2933
|
TranslateContextService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function TranslateContextService_Factory() { return new TranslateContextService(i0__namespace.ɵɵinject(i1__namespace$1.TranslateService)); }, token: TranslateContextService, providedIn: "root" });
|
|
@@ -2937,12 +2975,11 @@
|
|
|
2937
2975
|
};
|
|
2938
2976
|
return TranslateContextPipe;
|
|
2939
2977
|
}());
|
|
2940
|
-
TranslateContextPipe.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function TranslateContextPipe_Factory() { return new TranslateContextPipe(i0__namespace.ɵɵinject(TranslateContextService), i0__namespace.ɵɵinject(i0__namespace.ChangeDetectorRef)); }, token: TranslateContextPipe, providedIn: "root" });
|
|
2941
2978
|
TranslateContextPipe.decorators = [
|
|
2979
|
+
{ type: i0.Injectable },
|
|
2942
2980
|
{ type: i0.Pipe, args: [{
|
|
2943
2981
|
name: 'translateContext'
|
|
2944
|
-
},] }
|
|
2945
|
-
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
2982
|
+
},] }
|
|
2946
2983
|
];
|
|
2947
2984
|
TranslateContextPipe.ctorParameters = function () { return [
|
|
2948
2985
|
{ type: TranslateContextService },
|
|
@@ -2958,12 +2995,11 @@
|
|
|
2958
2995
|
};
|
|
2959
2996
|
return TranslatablePipe;
|
|
2960
2997
|
}());
|
|
2961
|
-
TranslatablePipe.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function TranslatablePipe_Factory() { return new TranslatablePipe(); }, token: TranslatablePipe, providedIn: "root" });
|
|
2962
2998
|
TranslatablePipe.decorators = [
|
|
2963
2999
|
{ type: i0.Pipe, args: [{
|
|
2964
3000
|
name: 'translatable'
|
|
2965
3001
|
},] },
|
|
2966
|
-
{ type: i0.Injectable
|
|
3002
|
+
{ type: i0.Injectable }
|
|
2967
3003
|
];
|
|
2968
3004
|
|
|
2969
3005
|
var PropertyGetPipe = /** @class */ (function () {
|
|
@@ -19141,7 +19177,7 @@
|
|
|
19141
19177
|
this.error = null;
|
|
19142
19178
|
this._enable = false;
|
|
19143
19179
|
this._$ready = new rxjs.BehaviorSubject(false);
|
|
19144
|
-
this.
|
|
19180
|
+
this._$loading = new rxjs.BehaviorSubject(true);
|
|
19145
19181
|
this.i18nFieldPrefix = null;
|
|
19146
19182
|
this._subscription = new rxjs.Subscription();
|
|
19147
19183
|
this.debug = false;
|
|
@@ -19157,9 +19193,25 @@
|
|
|
19157
19193
|
});
|
|
19158
19194
|
this.autocompleteFields = this.autocompleteHelper.fields;
|
|
19159
19195
|
}
|
|
19160
|
-
Object.defineProperty(AppForm.prototype, "
|
|
19196
|
+
Object.defineProperty(AppForm.prototype, "_loading", {
|
|
19197
|
+
/**
|
|
19198
|
+
* @deprecated
|
|
19199
|
+
*/
|
|
19200
|
+
get: function () {
|
|
19201
|
+
return this._$loading.value;
|
|
19202
|
+
},
|
|
19203
|
+
/**
|
|
19204
|
+
* @deprecated
|
|
19205
|
+
*/
|
|
19206
|
+
set: function (value) {
|
|
19207
|
+
this._$loading.next(value);
|
|
19208
|
+
},
|
|
19209
|
+
enumerable: false,
|
|
19210
|
+
configurable: true
|
|
19211
|
+
});
|
|
19212
|
+
Object.defineProperty(AppForm.prototype, "loading", {
|
|
19161
19213
|
get: function () {
|
|
19162
|
-
return this._$
|
|
19214
|
+
return this._$loading.value;
|
|
19163
19215
|
},
|
|
19164
19216
|
enumerable: false,
|
|
19165
19217
|
configurable: true
|
|
@@ -19297,9 +19349,11 @@
|
|
|
19297
19349
|
if (this.debug)
|
|
19298
19350
|
console.debug('[form] Updating form (using entity)', data);
|
|
19299
19351
|
// Convert object to json, then apply it to form (e.g. convert 'undefined' into 'null')
|
|
19300
|
-
AppFormUtils.copyEntity2Form(data, this.form,
|
|
19301
|
-
if (!opts || opts.emitEvent !==
|
|
19352
|
+
AppFormUtils.copyEntity2Form(data, this.form, opts);
|
|
19353
|
+
if (!opts || opts.emitEvent !== false) {
|
|
19354
|
+
this.markAsLoaded({ emitEvent: false });
|
|
19302
19355
|
this.markForCheck();
|
|
19356
|
+
}
|
|
19303
19357
|
};
|
|
19304
19358
|
AppForm.prototype.reset = function (data, opts) {
|
|
19305
19359
|
if (data) {
|
|
@@ -19348,15 +19402,15 @@
|
|
|
19348
19402
|
this.markForCheck();
|
|
19349
19403
|
};
|
|
19350
19404
|
AppForm.prototype.markAsLoading = function (opts) {
|
|
19351
|
-
if (
|
|
19352
|
-
this.
|
|
19405
|
+
if (this._$loading.value !== true) {
|
|
19406
|
+
this._$loading.next(true);
|
|
19353
19407
|
if (!opts || opts.emitEvent !== false)
|
|
19354
19408
|
this.markForCheck();
|
|
19355
19409
|
}
|
|
19356
19410
|
};
|
|
19357
19411
|
AppForm.prototype.markAsLoaded = function (opts) {
|
|
19358
|
-
if (this.
|
|
19359
|
-
this.
|
|
19412
|
+
if (this._$loading.value !== false) {
|
|
19413
|
+
this._$loading.next(false);
|
|
19360
19414
|
if (!opts || opts.emitEvent !== false)
|
|
19361
19415
|
this.markForCheck();
|
|
19362
19416
|
}
|
|
@@ -19457,7 +19511,6 @@
|
|
|
19457
19511
|
_this.network = network;
|
|
19458
19512
|
_this.cd = cd;
|
|
19459
19513
|
_this.environment = environment;
|
|
19460
|
-
_this.loading = false;
|
|
19461
19514
|
_this.canWorkOffline = false;
|
|
19462
19515
|
_this.showPwd = false;
|
|
19463
19516
|
_this.onCancel = new i0.EventEmitter();
|
|
@@ -19508,13 +19561,13 @@
|
|
|
19508
19561
|
}
|
|
19509
19562
|
if (this.form.invalid || this.loading)
|
|
19510
19563
|
return;
|
|
19511
|
-
this.
|
|
19564
|
+
this.markAsLoading();
|
|
19512
19565
|
var data = this.form.value;
|
|
19513
19566
|
this.showPwd = false; // Hide password
|
|
19514
19567
|
this.error = null; // Reset error
|
|
19515
19568
|
this.registerSubscription(this.onSubmit
|
|
19516
19569
|
.pipe(operators.debounceTime(500))
|
|
19517
|
-
.subscribe(function (res) { return _this.
|
|
19570
|
+
.subscribe(function (res) { return _this.markAsLoaded(); }));
|
|
19518
19571
|
setTimeout(function () { return _this.onSubmit.emit({
|
|
19519
19572
|
username: data.username,
|
|
19520
19573
|
password: data.password,
|
|
@@ -20269,7 +20322,6 @@
|
|
|
20269
20322
|
_this.translate = translate;
|
|
20270
20323
|
_this.settings = settings;
|
|
20271
20324
|
_this.cd = cd;
|
|
20272
|
-
_this.loading = true;
|
|
20273
20325
|
_this.email = {
|
|
20274
20326
|
confirmed: false,
|
|
20275
20327
|
notConfirmed: false,
|
|
@@ -20299,7 +20351,7 @@
|
|
|
20299
20351
|
_this.onLogin(_this.accountService.account);
|
|
20300
20352
|
}
|
|
20301
20353
|
else {
|
|
20302
|
-
_this.
|
|
20354
|
+
_this.markAsLoaded();
|
|
20303
20355
|
}
|
|
20304
20356
|
}));
|
|
20305
20357
|
return _this;
|
|
@@ -20317,7 +20369,7 @@
|
|
|
20317
20369
|
this.enable();
|
|
20318
20370
|
this.markAsPristine();
|
|
20319
20371
|
this.startListenChanges();
|
|
20320
|
-
this.
|
|
20372
|
+
this.markAsLoaded();
|
|
20321
20373
|
};
|
|
20322
20374
|
AccountPage.prototype.onLogout = function () {
|
|
20323
20375
|
this.isLogin = false;
|
|
@@ -20335,7 +20387,7 @@
|
|
|
20335
20387
|
return __awaiter(this, void 0, void 0, function () {
|
|
20336
20388
|
return __generator(this, function (_a) {
|
|
20337
20389
|
this.disable();
|
|
20338
|
-
this.
|
|
20390
|
+
this.markAsLoading();
|
|
20339
20391
|
return [2 /*return*/, this.accountService.refresh()];
|
|
20340
20392
|
});
|
|
20341
20393
|
});
|
|
@@ -20869,7 +20921,6 @@
|
|
|
20869
20921
|
_this.cd = cd;
|
|
20870
20922
|
_this.network = network;
|
|
20871
20923
|
_this.locales = locales;
|
|
20872
|
-
_this.loading = true;
|
|
20873
20924
|
_this.saving = false;
|
|
20874
20925
|
_this.usageModes = ['FIELD', 'DESK'];
|
|
20875
20926
|
_this.propertyDefinitionsByKey = {};
|
|
@@ -20959,7 +21010,7 @@
|
|
|
20959
21010
|
return __generator(this, function (_a) {
|
|
20960
21011
|
switch (_a.label) {
|
|
20961
21012
|
case 0:
|
|
20962
|
-
this.
|
|
21013
|
+
this.markAsLoading();
|
|
20963
21014
|
console.debug('[settings] Loading settings...');
|
|
20964
21015
|
data = this.settings.settings;
|
|
20965
21016
|
// Set defaults
|
|
@@ -20995,7 +21046,7 @@
|
|
|
20995
21046
|
this.enable({ emitEvent: false });
|
|
20996
21047
|
// Apply inheritance
|
|
20997
21048
|
this.setAccountInheritance(data.accountInheritance, { emitEvent: false });
|
|
20998
|
-
this.
|
|
21049
|
+
this.markAsLoaded();
|
|
20999
21050
|
this.error = null;
|
|
21000
21051
|
this.markForCheck();
|
|
21001
21052
|
};
|
|
@@ -21234,7 +21285,6 @@
|
|
|
21234
21285
|
_this.settings = settings;
|
|
21235
21286
|
_this.cd = cd;
|
|
21236
21287
|
_this.formGroupDir = formGroupDir;
|
|
21237
|
-
_this.loading = true;
|
|
21238
21288
|
_this.definitionsMapByKey = {};
|
|
21239
21289
|
_this.definitionsByIndex = {};
|
|
21240
21290
|
return _this;
|
|
@@ -21313,7 +21363,7 @@
|
|
|
21313
21363
|
this.helper.resize(values.length);
|
|
21314
21364
|
this.helper.formArray.patchValue(values, { emitEvent: false });
|
|
21315
21365
|
this.markAsPristine();
|
|
21316
|
-
this.
|
|
21366
|
+
this.markAsLoaded();
|
|
21317
21367
|
};
|
|
21318
21368
|
/* -- protected methods -- */
|
|
21319
21369
|
AppPropertiesForm.prototype.getPropertyFormGroup = function (data) {
|
|
@@ -21359,7 +21409,6 @@
|
|
|
21359
21409
|
_this.settings = settings;
|
|
21360
21410
|
_this.cd = cd;
|
|
21361
21411
|
_this.formGroupDir = formGroupDir;
|
|
21362
|
-
_this.loading = true;
|
|
21363
21412
|
_this.selection = new collections.SelectionModel(true, []);
|
|
21364
21413
|
_this.displayWithFn = referentialToString;
|
|
21365
21414
|
_this.onNewItem = new i0.EventEmitter();
|
|
@@ -21485,7 +21534,7 @@
|
|
|
21485
21534
|
}
|
|
21486
21535
|
this.selection.clear();
|
|
21487
21536
|
this.markAsPristine();
|
|
21488
|
-
this.
|
|
21537
|
+
this.markAsLoaded();
|
|
21489
21538
|
};
|
|
21490
21539
|
/** Whether the number of selected elements matches the total number of rows. */
|
|
21491
21540
|
AppListForm.prototype.isAllSelected = function () {
|
|
@@ -25518,6 +25567,13 @@
|
|
|
25518
25567
|
enumerable: false,
|
|
25519
25568
|
configurable: true
|
|
25520
25569
|
});
|
|
25570
|
+
Object.defineProperty(AppEditor.prototype, "forms", {
|
|
25571
|
+
get: function () {
|
|
25572
|
+
return this._children && this._children.filter(function (c) { return c instanceof AppForm; });
|
|
25573
|
+
},
|
|
25574
|
+
enumerable: false,
|
|
25575
|
+
configurable: true
|
|
25576
|
+
});
|
|
25521
25577
|
Object.defineProperty(AppEditor.prototype, "dirty", {
|
|
25522
25578
|
get: function () {
|
|
25523
25579
|
var _a;
|
|
@@ -25676,10 +25732,15 @@
|
|
|
25676
25732
|
}
|
|
25677
25733
|
};
|
|
25678
25734
|
AppEditor.prototype.markAsLoaded = function (opts) {
|
|
25735
|
+
var _a;
|
|
25679
25736
|
if (this._loading) {
|
|
25680
25737
|
this._loading = false;
|
|
25681
|
-
if (!opts || opts.emitEvent !== false)
|
|
25738
|
+
if (!opts || opts.emitEvent !== false) {
|
|
25739
|
+
// Emit to children forms
|
|
25740
|
+
// Tables should be changed by parent
|
|
25741
|
+
(_a = this.forms) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.markAsLoaded(opts); });
|
|
25682
25742
|
this.markForCheck();
|
|
25743
|
+
}
|
|
25683
25744
|
}
|
|
25684
25745
|
};
|
|
25685
25746
|
AppEditor.prototype.markAsReady = function (opts) {
|
|
@@ -26300,49 +26361,60 @@
|
|
|
26300
26361
|
*/
|
|
26301
26362
|
AppEntityEditor.prototype.load = function (id, opts) {
|
|
26302
26363
|
return __awaiter(this, void 0, void 0, function () {
|
|
26303
|
-
var data, data,
|
|
26364
|
+
var data, err_1, data, err_2;
|
|
26304
26365
|
return __generator(this, function (_b) {
|
|
26305
26366
|
switch (_b.label) {
|
|
26306
26367
|
case 0:
|
|
26307
26368
|
if (!this.dataService)
|
|
26308
26369
|
throw new Error('Cannot load data: missing \'dataService\'!');
|
|
26309
26370
|
this.error = null;
|
|
26310
|
-
if (!isNil(id)) return [3 /*break*/,
|
|
26371
|
+
if (!isNil(id)) return [3 /*break*/, 7];
|
|
26372
|
+
_b.label = 1;
|
|
26373
|
+
case 1:
|
|
26374
|
+
_b.trys.push([1, 4, 5, 6]);
|
|
26311
26375
|
data = new this.dataType();
|
|
26312
26376
|
this._usageMode = this.computeUsageMode(data);
|
|
26313
26377
|
return [4 /*yield*/, this.onNewEntity(data, opts)];
|
|
26314
|
-
case
|
|
26378
|
+
case 2:
|
|
26315
26379
|
_b.sent();
|
|
26316
26380
|
return [4 /*yield*/, this.updateView(data, Object.assign({ openTabIndex: 0 }, opts))];
|
|
26317
|
-
case
|
|
26381
|
+
case 3:
|
|
26318
26382
|
_b.sent();
|
|
26383
|
+
return [3 /*break*/, 6];
|
|
26384
|
+
case 4:
|
|
26385
|
+
err_1 = _b.sent();
|
|
26386
|
+
this.setError(err_1);
|
|
26387
|
+
this.selectedTabIndex = 0;
|
|
26388
|
+
return [3 /*break*/, 6];
|
|
26389
|
+
case 5:
|
|
26319
26390
|
this.markAsLoaded();
|
|
26320
|
-
return [
|
|
26321
|
-
case 3
|
|
26322
|
-
|
|
26391
|
+
return [7 /*endfinally*/];
|
|
26392
|
+
case 6: return [3 /*break*/, 13];
|
|
26393
|
+
case 7:
|
|
26394
|
+
_b.trys.push([7, 11, 12, 13]);
|
|
26323
26395
|
return [4 /*yield*/, this.dataService.load(id, opts)];
|
|
26324
|
-
case
|
|
26396
|
+
case 8:
|
|
26325
26397
|
data = _b.sent();
|
|
26326
26398
|
if (!data)
|
|
26327
26399
|
throw { code: ErrorCodes$2.DATA_NOT_FOUND_ERROR, message: 'ERROR.DATA_NO_FOUND' };
|
|
26328
26400
|
this._usageMode = this.computeUsageMode(data);
|
|
26329
26401
|
return [4 /*yield*/, this.onEntityLoaded(data, opts)];
|
|
26330
|
-
case
|
|
26402
|
+
case 9:
|
|
26331
26403
|
_b.sent();
|
|
26332
26404
|
return [4 /*yield*/, this.updateView(data, opts)];
|
|
26333
|
-
case
|
|
26405
|
+
case 10:
|
|
26334
26406
|
_b.sent();
|
|
26335
26407
|
this.startListenRemoteChanges();
|
|
26336
|
-
return [3 /*break*/,
|
|
26337
|
-
case
|
|
26338
|
-
|
|
26339
|
-
this.setError(
|
|
26408
|
+
return [3 /*break*/, 13];
|
|
26409
|
+
case 11:
|
|
26410
|
+
err_2 = _b.sent();
|
|
26411
|
+
this.setError(err_2);
|
|
26340
26412
|
this.selectedTabIndex = 0;
|
|
26341
|
-
return [3 /*break*/,
|
|
26342
|
-
case
|
|
26413
|
+
return [3 /*break*/, 13];
|
|
26414
|
+
case 12:
|
|
26343
26415
|
this.markAsLoaded();
|
|
26344
26416
|
return [7 /*endfinally*/];
|
|
26345
|
-
case
|
|
26417
|
+
case 13: return [2 /*return*/];
|
|
26346
26418
|
}
|
|
26347
26419
|
});
|
|
26348
26420
|
});
|
|
@@ -26517,7 +26589,7 @@
|
|
|
26517
26589
|
*/
|
|
26518
26590
|
AppEntityEditor.prototype.save = function (event, opts) {
|
|
26519
26591
|
return __awaiter(this, void 0, void 0, function () {
|
|
26520
|
-
var data, updatedData,
|
|
26592
|
+
var data, updatedData, err_3;
|
|
26521
26593
|
return __generator(this, function (_b) {
|
|
26522
26594
|
switch (_b.label) {
|
|
26523
26595
|
case 0:
|
|
@@ -26570,15 +26642,15 @@
|
|
|
26570
26642
|
this.submitted = false;
|
|
26571
26643
|
return [2 /*return*/, true];
|
|
26572
26644
|
case 7:
|
|
26573
|
-
|
|
26645
|
+
err_3 = _b.sent();
|
|
26574
26646
|
this.submitted = true;
|
|
26575
|
-
this.setError(
|
|
26647
|
+
this.setError(err_3);
|
|
26576
26648
|
this.selectedTabIndex = 0;
|
|
26577
26649
|
this.scrollToTop(); // Scroll to top (to show error)
|
|
26578
26650
|
this.markAsDirty();
|
|
26579
26651
|
this.enable();
|
|
26580
26652
|
// Concurrent change on pod
|
|
26581
|
-
if (
|
|
26653
|
+
if (err_3.code === ServerErrorCodes.BAD_UPDATE_DATE && isNotNil(this.data.id)) {
|
|
26582
26654
|
// Call a data reload (in background), to update the GraphQL cache, and allow to cancel changes
|
|
26583
26655
|
this.dataService.load(this.data.id, { fetchPolicy: 'network-only' }).then(function () {
|
|
26584
26656
|
console.debug('[data-editor] Data cache reloaded. User can reload page');
|
|
@@ -26631,7 +26703,7 @@
|
|
|
26631
26703
|
};
|
|
26632
26704
|
AppEntityEditor.prototype.delete = function (event) {
|
|
26633
26705
|
return __awaiter(this, void 0, void 0, function () {
|
|
26634
|
-
var confirmation, data, isNew,
|
|
26706
|
+
var confirmation, data, isNew, err_4;
|
|
26635
26707
|
var _this = this;
|
|
26636
26708
|
return __generator(this, function (_b) {
|
|
26637
26709
|
switch (_b.label) {
|
|
@@ -26666,9 +26738,9 @@
|
|
|
26666
26738
|
this.removePageHistory();
|
|
26667
26739
|
return [3 /*break*/, 8];
|
|
26668
26740
|
case 7:
|
|
26669
|
-
|
|
26741
|
+
err_4 = _b.sent();
|
|
26670
26742
|
this.submitted = true;
|
|
26671
|
-
this.setError(
|
|
26743
|
+
this.setError(err_4);
|
|
26672
26744
|
this.selectedTabIndex = 0;
|
|
26673
26745
|
this.markAsSaved();
|
|
26674
26746
|
this.enable();
|