@sumaris-net/ngx-components 0.12.0 → 0.13.2

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.
@@ -12552,6 +12552,13 @@
12552
12552
  enumerable: false,
12553
12553
  configurable: true
12554
12554
  });
12555
+ Object.defineProperty(GraphqlService.prototype, "defaultFetchPolicy", {
12556
+ get: function () {
12557
+ return this._defaultFetchPolicy;
12558
+ },
12559
+ enumerable: false,
12560
+ configurable: true
12561
+ });
12555
12562
  GraphqlService.prototype.ready = function () {
12556
12563
  if (this._started)
12557
12564
  return Promise.resolve();
@@ -13353,7 +13360,15 @@
13353
13360
  this._logPrefix = "[base-graphql-service] ";
13354
13361
  }
13355
13362
  BaseGraphqlService.prototype.mutableWatchQuery = function (opts) {
13363
+ opts.fetchPolicy = opts.fetchPolicy || this.graphql.defaultFetchPolicy;
13364
+ // Standard query (no cache)
13365
+ if (opts.fetchPolicy === 'no-cache') {
13366
+ return this.graphql.watchQuery(opts);
13367
+ }
13368
+ // No arrayFieldName
13356
13369
  if (!opts.arrayFieldName) {
13370
+ if (this._debug)
13371
+ console.warn(this._logPrefix + '̀Missing \'opts.arrayFieldName\' : unable to create a mutable watch query');
13357
13372
  return this.graphql.watchQuery(opts);
13358
13373
  }
13359
13374
  // Create the query id
@@ -13367,8 +13382,9 @@
13367
13382
  queryRef = mutableQuery.queryRef;
13368
13383
  if (this._debug)
13369
13384
  console.debug(this._logPrefix + ("Find same mutable watch query (same variables) {" + queryId + "}. Skip register"));
13370
- // Refetch if need
13371
- if (opts.fetchPolicy && (opts.fetchPolicy === 'network-only' || opts.fetchPolicy === 'no-cache' || opts.fetchPolicy === 'cache-and-network')) {
13385
+ // Refetch if need data from network
13386
+ if (opts.fetchPolicy === 'network-only' || opts.fetchPolicy === 'cache-and-network') {
13387
+ console.warn(this._logPrefix + ' Mutable query already exists, and fetchPolicy=' + opts.fetchPolicy + '. Force refetch query...');
13372
13388
  queryRef.refetch(mutableQuery.variables);
13373
13389
  }
13374
13390
  //if (mutableQuery.counter > 3) {
@@ -13383,6 +13399,7 @@
13383
13399
  queryRef: queryRef,
13384
13400
  variables: opts.variables,
13385
13401
  arrayFieldName: opts.arrayFieldName,
13402
+ totalFieldName: opts.totalFieldName,
13386
13403
  insertFilterFn: opts.insertFilterFn,
13387
13404
  sortFn: opts.sortFn,
13388
13405
  counter: 1
@@ -13406,6 +13423,7 @@
13406
13423
  query: query.query,
13407
13424
  variables: query.variables,
13408
13425
  arrayFieldName: query.arrayFieldName,
13426
+ totalFieldName: query.totalFieldName,
13409
13427
  sortFn: query.sortFn,
13410
13428
  data: data
13411
13429
  });
@@ -13419,6 +13437,7 @@
13419
13437
  query: query.query,
13420
13438
  variables: query.variables,
13421
13439
  arrayFieldName: query.arrayFieldName,
13440
+ totalFieldName: query.totalFieldName,
13422
13441
  sortFn: query.sortFn,
13423
13442
  data: opts.data
13424
13443
  });
@@ -13437,6 +13456,7 @@
13437
13456
  query: query.query,
13438
13457
  variables: query.variables,
13439
13458
  arrayFieldName: query.arrayFieldName,
13459
+ totalFieldName: query.totalFieldName,
13440
13460
  ids: opts.ids
13441
13461
  });
13442
13462
  }
@@ -13445,6 +13465,7 @@
13445
13465
  query: query.query,
13446
13466
  variables: query.variables,
13447
13467
  arrayFieldName: query.arrayFieldName,
13468
+ totalFieldName: query.totalFieldName,
13448
13469
  ids: opts.ids
13449
13470
  }) ? 1 : 0;
13450
13471
  }
@@ -19691,7 +19712,7 @@
19691
19712
  FormButtonsBarComponent.decorators = [
19692
19713
  { type: i0.Component, args: [{
19693
19714
  selector: 'app-form-buttons-bar',
19694
- template: "<ion-toolbar [class]=\"classList\">\n <ion-row class=\"ion-no-padding\" nowrap>\n <ion-col>\n <ng-content></ng-content>\n </ion-col>\n\n <ion-col size=\"auto\">\n\n <ion-button fill=\"clear\" color=\"dark\" (click)=\"onBack.emit($event)\" (keyup.enter)=\"onBack.emit($event)\" *ngIf=\"onBack.observers.length\">\n <ion-label translate>COMMON.BTN_CLOSE</ion-label>\n </ion-button>\n\n <ion-button fill=\"clear\" color=\"dark\" (click)=\"onCancel.emit($event)\" (keyup.enter)=\"onCancel.emit($event)\" [disabled]=\"disabledCancel\">\n <ion-icon slot=\"start\" name=\"refresh\"></ion-icon>\n <ion-label translate>COMMON.BTN_RESET</ion-label>\n </ion-button>\n\n\n <ion-button fill=\"solid\" (click)=\"onNext.emit($event)\" (keyup.enter)=\"onNext.emit($event)\" *ngIf=\"onNext.observers.length\">\n <ion-label translate>COMMON.BTN_NEXT</ion-label>\n <ion-icon slot=\"end\" name=\"arrow-forward\"></ion-icon>\n </ion-button>\n\n <ion-button [fill]=\"disabled? 'clear' : 'solid'\" (click)=\"onSave.emit($event)\" (keyup.enter)=\"onSave.emit($event)\" color=\"danger\" [disabled]=\"disabled\">\n <ion-label [innerHTML]=\"'COMMON.BTN_SAVE_WITH_SHORTCUT'|translate\" [title]=\"'COMMON.BTN_SAVE_WITH_SHORTCUT_HELP'|translate\"></ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n</ion-toolbar>\n",
19715
+ template: "<ion-toolbar [class]=\"classList\">\n <ion-row class=\"ion-no-padding\" nowrap>\n <ion-col>\n <ng-content></ng-content>\n </ion-col>\n\n <ion-col size=\"auto\">\n\n <!-- close (go back) -->\n <ion-button fill=\"clear\" color=\"dark\" (click)=\"onBack.emit($event)\" (keyup.enter)=\"onBack.emit($event)\" *ngIf=\"onBack.observers | isNotEmptyArray\">\n <ion-label translate>COMMON.BTN_CLOSE</ion-label>\n </ion-button>\n\n <!-- reload -->\n <ion-button fill=\"clear\" color=\"dark\" (click)=\"onCancel.emit($event)\" (keyup.enter)=\"onCancel.emit($event)\" [disabled]=\"disabledCancel\">\n <ion-icon slot=\"start\" name=\"refresh\"></ion-icon>\n <ion-label translate>COMMON.BTN_RESET</ion-label>\n </ion-button>\n\n <!-- next -->\n <ion-button fill=\"solid\" (click)=\"onNext.emit($event)\" (keyup.enter)=\"onNext.emit($event)\" *ngIf=\"onNext.observers | isNotEmptyArray\">\n <ion-label translate>COMMON.BTN_NEXT</ion-label>\n <ion-icon slot=\"end\" name=\"arrow-forward\"></ion-icon>\n </ion-button>\n\n <!-- save -->\n <ion-button [fill]=\"disabled ? 'clear' : 'solid'\" (click)=\"onSave.emit($event)\" (keyup.enter)=\"onSave.emit($event)\" color=\"danger\"\n [disabled]=\"disabled\">\n <ion-label [innerHTML]=\"'COMMON.BTN_SAVE_WITH_SHORTCUT'|translate\" [title]=\"'COMMON.BTN_SAVE_WITH_SHORTCUT_HELP'|translate\"></ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n</ion-toolbar>\n",
19695
19716
  providers: [
19696
19717
  { provide: FormButtonsBarToken, useExisting: FormButtonsBarComponent }
19697
19718
  ],
@@ -23241,18 +23262,18 @@
23241
23262
  return true;
23242
23263
  };
23243
23264
  AppTable.prototype.save = function (opts) {
23244
- var _a;
23245
23265
  return __awaiter(this, void 0, void 0, function () {
23246
23266
  var editedRowId, isOK, err_1;
23247
23267
  var _this = this;
23248
23268
  return __generator(this, function (_d) {
23249
23269
  switch (_d.label) {
23250
23270
  case 0:
23271
+ opts = Object.assign({ keepEditing: this.keepEditedRowOnSave }, opts);
23251
23272
  if (this.readOnly) {
23252
23273
  throw { code: ErrorCodes$2.TABLE_READ_ONLY, message: 'ERROR.TABLE_READ_ONLY' };
23253
23274
  }
23254
23275
  this.resetError();
23255
- editedRowId = toBoolean(opts === null || opts === void 0 ? void 0 : opts.keepEditing, this.keepEditedRowOnSave) && ((_a = this.editedRow) === null || _a === void 0 ? void 0 : _a.editing) && this.editedRow.id;
23276
+ editedRowId = opts.keepEditing && this.editedRow && this.editedRow.editing && this.editedRow.id;
23256
23277
  if (!this.confirmEditCreate()) {
23257
23278
  throw { code: ErrorCodes$2.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
23258
23279
  }
@@ -23499,7 +23520,7 @@
23499
23520
  return false;
23500
23521
  }
23501
23522
  // DEBUG
23502
- console.debug("[table] Detect click on row");
23523
+ //console.debug("[table] Detect click on row");
23503
23524
  if (row.id === -1 || row.editing)
23504
23525
  return true; // Already in edition
23505
23526
  if (event === null || event === void 0 ? void 0 : event.defaultPrevented)
@@ -24371,6 +24392,9 @@
24371
24392
  this.registerSubscription(this.formButtonsBar.onBack.subscribe(function (event) { return _this.onBackClick(event); }));
24372
24393
  }
24373
24394
  };
24395
+ AppTabEditor.prototype.ngAfterViewInit = function () {
24396
+ // Can be override by subclasses
24397
+ };
24374
24398
  AppTabEditor.prototype.ngOnDestroy = function () {
24375
24399
  this._subscription.unsubscribe();
24376
24400
  };
@@ -24965,6 +24989,7 @@
24965
24989
  };
24966
24990
  AppEntityEditor.prototype.ngAfterViewInit = function () {
24967
24991
  var _this = this;
24992
+ _super.prototype.ngAfterViewInit.call(this);
24968
24993
  // Load data
24969
24994
  if (this._autoLoad) {
24970
24995
  setTimeout(function () { return _this.loadFromRoute(); }, this._autoLoadDelay);