@sumaris-net/ngx-components 0.28.2 → 0.28.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.
@@ -19139,7 +19139,7 @@
19139
19139
  this.error = null;
19140
19140
  this._enable = false;
19141
19141
  this._$ready = new rxjs.BehaviorSubject(false);
19142
- this._loading = true;
19142
+ this._$loading = new rxjs.BehaviorSubject(true);
19143
19143
  this.i18nFieldPrefix = null;
19144
19144
  this._subscription = new rxjs.Subscription();
19145
19145
  this.debug = false;
@@ -19155,9 +19155,25 @@
19155
19155
  });
19156
19156
  this.autocompleteFields = this.autocompleteHelper.fields;
19157
19157
  }
19158
- Object.defineProperty(AppForm.prototype, "_ready", {
19158
+ Object.defineProperty(AppForm.prototype, "_loading", {
19159
+ /**
19160
+ * @deprecated
19161
+ */
19159
19162
  get: function () {
19160
- return this._$ready.value == true;
19163
+ return this._$loading.value;
19164
+ },
19165
+ /**
19166
+ * @deprecated
19167
+ */
19168
+ set: function (value) {
19169
+ this._$loading.next(value);
19170
+ },
19171
+ enumerable: false,
19172
+ configurable: true
19173
+ });
19174
+ Object.defineProperty(AppForm.prototype, "loading", {
19175
+ get: function () {
19176
+ return this._$loading.value;
19161
19177
  },
19162
19178
  enumerable: false,
19163
19179
  configurable: true
@@ -19295,11 +19311,11 @@
19295
19311
  if (this.debug)
19296
19312
  console.debug('[form] Updating form (using entity)', data);
19297
19313
  // Convert object to json, then apply it to form (e.g. convert 'undefined' into 'null')
19298
- AppFormUtils.copyEntity2Form(data, this.form, Object.assign({ emitEvent: false, onlySelf: true }, opts));
19299
- if (this._loading)
19300
- this.markAsLoaded(Object.assign({ emitEvent: false, onlySelf: true }, opts));
19301
- if (!opts || opts.emitEvent !== true)
19314
+ AppFormUtils.copyEntity2Form(data, this.form, opts);
19315
+ if (!opts || opts.emitEvent !== false) {
19316
+ this.markAsLoaded({ emitEvent: false });
19302
19317
  this.markForCheck();
19318
+ }
19303
19319
  };
19304
19320
  AppForm.prototype.reset = function (data, opts) {
19305
19321
  if (data) {
@@ -19348,15 +19364,15 @@
19348
19364
  this.markForCheck();
19349
19365
  };
19350
19366
  AppForm.prototype.markAsLoading = function (opts) {
19351
- if (!this._loading) {
19352
- this._loading = true;
19367
+ if (this._$loading.value !== true) {
19368
+ this._$loading.next(true);
19353
19369
  if (!opts || opts.emitEvent !== false)
19354
19370
  this.markForCheck();
19355
19371
  }
19356
19372
  };
19357
19373
  AppForm.prototype.markAsLoaded = function (opts) {
19358
- if (this._loading) {
19359
- this._loading = false;
19374
+ if (this._$loading.value !== false) {
19375
+ this._$loading.next(false);
19360
19376
  if (!opts || opts.emitEvent !== false)
19361
19377
  this.markForCheck();
19362
19378
  }
@@ -19457,7 +19473,6 @@
19457
19473
  _this.network = network;
19458
19474
  _this.cd = cd;
19459
19475
  _this.environment = environment;
19460
- _this.loading = false;
19461
19476
  _this.canWorkOffline = false;
19462
19477
  _this.showPwd = false;
19463
19478
  _this.onCancel = new i0.EventEmitter();
@@ -19508,13 +19523,13 @@
19508
19523
  }
19509
19524
  if (this.form.invalid || this.loading)
19510
19525
  return;
19511
- this.loading = true;
19526
+ this.markAsLoading();
19512
19527
  var data = this.form.value;
19513
19528
  this.showPwd = false; // Hide password
19514
19529
  this.error = null; // Reset error
19515
19530
  this.registerSubscription(this.onSubmit
19516
19531
  .pipe(operators.debounceTime(500))
19517
- .subscribe(function (res) { return _this.loading = false; }));
19532
+ .subscribe(function (res) { return _this.markAsLoaded(); }));
19518
19533
  setTimeout(function () { return _this.onSubmit.emit({
19519
19534
  username: data.username,
19520
19535
  password: data.password,
@@ -20269,7 +20284,6 @@
20269
20284
  _this.translate = translate;
20270
20285
  _this.settings = settings;
20271
20286
  _this.cd = cd;
20272
- _this.loading = true;
20273
20287
  _this.email = {
20274
20288
  confirmed: false,
20275
20289
  notConfirmed: false,
@@ -20299,7 +20313,7 @@
20299
20313
  _this.onLogin(_this.accountService.account);
20300
20314
  }
20301
20315
  else {
20302
- _this.loading = false;
20316
+ _this.markAsLoaded();
20303
20317
  }
20304
20318
  }));
20305
20319
  return _this;
@@ -20317,7 +20331,7 @@
20317
20331
  this.enable();
20318
20332
  this.markAsPristine();
20319
20333
  this.startListenChanges();
20320
- this.loading = false;
20334
+ this.markAsLoaded();
20321
20335
  };
20322
20336
  AccountPage.prototype.onLogout = function () {
20323
20337
  this.isLogin = false;
@@ -20335,7 +20349,7 @@
20335
20349
  return __awaiter(this, void 0, void 0, function () {
20336
20350
  return __generator(this, function (_a) {
20337
20351
  this.disable();
20338
- this.loading = true;
20352
+ this.markAsLoading();
20339
20353
  return [2 /*return*/, this.accountService.refresh()];
20340
20354
  });
20341
20355
  });
@@ -20869,7 +20883,6 @@
20869
20883
  _this.cd = cd;
20870
20884
  _this.network = network;
20871
20885
  _this.locales = locales;
20872
- _this.loading = true;
20873
20886
  _this.saving = false;
20874
20887
  _this.usageModes = ['FIELD', 'DESK'];
20875
20888
  _this.propertyDefinitionsByKey = {};
@@ -20959,7 +20972,7 @@
20959
20972
  return __generator(this, function (_a) {
20960
20973
  switch (_a.label) {
20961
20974
  case 0:
20962
- this.loading = true;
20975
+ this.markAsLoading();
20963
20976
  console.debug('[settings] Loading settings...');
20964
20977
  data = this.settings.settings;
20965
20978
  // Set defaults
@@ -20995,7 +21008,7 @@
20995
21008
  this.enable({ emitEvent: false });
20996
21009
  // Apply inheritance
20997
21010
  this.setAccountInheritance(data.accountInheritance, { emitEvent: false });
20998
- this.loading = false;
21011
+ this.markAsLoaded();
20999
21012
  this.error = null;
21000
21013
  this.markForCheck();
21001
21014
  };
@@ -21234,7 +21247,6 @@
21234
21247
  _this.settings = settings;
21235
21248
  _this.cd = cd;
21236
21249
  _this.formGroupDir = formGroupDir;
21237
- _this.loading = true;
21238
21250
  _this.definitionsMapByKey = {};
21239
21251
  _this.definitionsByIndex = {};
21240
21252
  return _this;
@@ -21313,7 +21325,7 @@
21313
21325
  this.helper.resize(values.length);
21314
21326
  this.helper.formArray.patchValue(values, { emitEvent: false });
21315
21327
  this.markAsPristine();
21316
- this.loading = false;
21328
+ this.markAsLoaded();
21317
21329
  };
21318
21330
  /* -- protected methods -- */
21319
21331
  AppPropertiesForm.prototype.getPropertyFormGroup = function (data) {
@@ -21359,7 +21371,6 @@
21359
21371
  _this.settings = settings;
21360
21372
  _this.cd = cd;
21361
21373
  _this.formGroupDir = formGroupDir;
21362
- _this.loading = true;
21363
21374
  _this.selection = new collections.SelectionModel(true, []);
21364
21375
  _this.displayWithFn = referentialToString;
21365
21376
  _this.onNewItem = new i0.EventEmitter();
@@ -21485,7 +21496,7 @@
21485
21496
  }
21486
21497
  this.selection.clear();
21487
21498
  this.markAsPristine();
21488
- this.loading = false;
21499
+ this.markAsLoaded();
21489
21500
  };
21490
21501
  /** Whether the number of selected elements matches the total number of rows. */
21491
21502
  AppListForm.prototype.isAllSelected = function () {