@sumaris-net/ngx-components 1.15.9 → 1.15.12

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.
@@ -4587,6 +4587,21 @@
4587
4587
  },] },
4588
4588
  { type: i0.Injectable, args: [{ providedIn: 'root' },] }
4589
4589
  ];
4590
+ var FormGetGroupPipe = /** @class */ (function () {
4591
+ function FormGetGroupPipe() {
4592
+ }
4593
+ FormGetGroupPipe.prototype.transform = function (form, path) {
4594
+ return form.get(path);
4595
+ };
4596
+ return FormGetGroupPipe;
4597
+ }());
4598
+ FormGetGroupPipe.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function FormGetGroupPipe_Factory() { return new FormGetGroupPipe(); }, token: FormGetGroupPipe, providedIn: "root" });
4599
+ FormGetGroupPipe.decorators = [
4600
+ { type: i0.Pipe, args: [{
4601
+ name: 'formGetGroup'
4602
+ },] },
4603
+ { type: i0.Injectable, args: [{ providedIn: 'root' },] }
4604
+ ];
4590
4605
 
4591
4606
  var SharedPipesModule = /** @class */ (function () {
4592
4607
  function SharedPipesModule() {
@@ -4636,7 +4651,8 @@
4636
4651
  FormErrorTranslatePipe,
4637
4652
  FormGetPipe,
4638
4653
  FormGetControlPipe,
4639
- FormGetArrayPipe
4654
+ FormGetArrayPipe,
4655
+ FormGetGroupPipe
4640
4656
  ],
4641
4657
  exports: [
4642
4658
  PropertyGetPipe,
@@ -4674,7 +4690,8 @@
4674
4690
  FormErrorTranslatePipe,
4675
4691
  FormGetPipe,
4676
4692
  FormGetControlPipe,
4677
- FormGetArrayPipe
4693
+ FormGetArrayPipe,
4694
+ FormGetGroupPipe
4678
4695
  ]
4679
4696
  },] }
4680
4697
  ];
@@ -17529,12 +17546,12 @@
17529
17546
  case 0:
17530
17547
  now = Date.now();
17531
17548
  console.debug('[config] Clear server cache...');
17532
- variables = { name: opts && opts.cacheName } || undefined;
17549
+ variables = opts && opts.cacheName && { name: opts.cacheName } || undefined;
17533
17550
  return [4 /*yield*/, this.graphql.query({
17534
17551
  query: ClearCache,
17535
17552
  variables: variables,
17536
17553
  error: { code: ErrorCodes$2.LOAD_CONFIG_ERROR, message: 'ERROR.LOAD_CONFIG_ERROR' },
17537
- fetchPolicy: 'network-only'
17554
+ fetchPolicy: 'no-cache'
17538
17555
  })];
17539
17556
  case 1:
17540
17557
  res = _a.sent();
@@ -24624,6 +24641,7 @@
24624
24641
  console.debug(this._logPrefix + ("[WS] Listening for changes on " + this._logTypeName + " {" + id + "}..."));
24625
24642
  return this.graphql.subscribe({
24626
24643
  query: opts && opts.query || this.subscriptions.listenChanges,
24644
+ fetchPolicy: opts && opts.fetchPolicy || 'no-cache',
24627
24645
  variables: variables,
24628
24646
  error: {
24629
24647
  code: ErrorCodes$2.SUBSCRIBE_DATA_ERROR,
@@ -27962,23 +27980,31 @@
27962
27980
  AppEntityEditor.prototype.startListenRemoteChanges = function () {
27963
27981
  var _this = this;
27964
27982
  // Skip if disable, or already listening
27965
- if (this._listenChangesSubscription || !this._enableListenChanges || this.isNewData)
27983
+ if (this._listenChangesSubscription || !this._enableListenChanges)
27984
+ return;
27985
+ // Skip if new or local data
27986
+ if (this.isNewData || EntityUtils.isLocal(this.data))
27966
27987
  return;
27967
27988
  // Listen for changes on server
27968
- this._listenChangesSubscription = this.listenChanges(this.data.id, { interval: this._listenIntervalInSeconds })
27989
+ this._listenChangesSubscription = this.listenChanges(this.data.id, {
27990
+ interval: this._listenIntervalInSeconds
27991
+ })
27969
27992
  .pipe(operators.filter(isNotNil))
27970
27993
  .subscribe(function (data) {
27971
- if (momentImported.isMoment(data.updateDate) && data.updateDate.isAfter(_this.data.updateDate)) {
27972
- if (!_this.dirty) {
27973
- if (_this.debug)
27974
- console.debug("[data-editor] Changes detected on server, at {" + data.updateDate + "}: reloading page...");
27975
- _this.updateView(data);
27976
- }
27977
- else {
27978
- if (_this.debug)
27979
- console.debug("[data-editor] Changes detected on server, at {" + data.updateDate + "}, but page is dirty: skip reloading.");
27980
- // TODO: alter user (with a toast ?)
27981
- }
27994
+ var isNewer = momentImported.isMoment(data.updateDate) && data.updateDate.isAfter(_this.data.updateDate);
27995
+ if (!isNewer)
27996
+ return; // Skip
27997
+ // Editor has no changes: reload
27998
+ if (!_this.dirty) {
27999
+ if (_this.debug)
28000
+ console.debug("[data-editor] Changes detected on server, at {" + data.updateDate + "}: reloading page...");
28001
+ _this.reload();
28002
+ }
28003
+ // Cannot reload: alert the user
28004
+ else {
28005
+ if (_this.debug)
28006
+ console.debug("[data-editor] Changes detected on server, at {" + data.updateDate + "}, but page is dirty: skip reloading.");
28007
+ _this.showToast({ message: 'ERROR.DATA_UPDATE_DATE_CHANGED', type: 'warning', showCloseButton: true });
27982
28008
  }
27983
28009
  });
27984
28010
  this._listenChangesSubscription.add(function () { return _this._listenChangesSubscription = null; });
@@ -28517,7 +28543,11 @@
28517
28543
  return parentUrl;
28518
28544
  };
28519
28545
  AppEntityEditor.prototype.listenChanges = function (id, opts) {
28520
- return this.dataService.listenChanges(this.data.id, opts);
28546
+ return this.dataService.listenChanges(this.data.id, Object.assign({
28547
+ // Make sure to skip cache, because NOT the full graph will be fetched by subscription
28548
+ // When a changes occur, we call reload() to force refetching the full graph
28549
+ fetchPolicy: 'no-cache'
28550
+ }, opts));
28521
28551
  };
28522
28552
  AppEntityEditor.prototype.markForCheck = function () {
28523
28553
  this.cd.markForCheck();
@@ -31337,6 +31367,7 @@
31337
31367
  exports.FormFieldValuesHolder = FormFieldValuesHolder;
31338
31368
  exports.FormGetArrayPipe = FormGetArrayPipe;
31339
31369
  exports.FormGetControlPipe = FormGetControlPipe;
31370
+ exports.FormGetGroupPipe = FormGetGroupPipe;
31340
31371
  exports.FormGetPipe = FormGetPipe;
31341
31372
  exports.Fragments = Fragments;
31342
31373
  exports.GraphqlService = GraphqlService;