nuxeo-development-framework 5.6.9 → 5.7.0

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.
@@ -18587,7 +18587,7 @@
18587
18587
  _this.sourceState$ = _this._sourceState.asObservable().pipe(operators.filter(function (data) { return !!(data === null || data === void 0 ? void 0 : data.fieldConfig) && !!data.aggregation; }));
18588
18588
  _this.renderOptions$ = _this.sourceState$.pipe(operators.map(function (data) { var _a, _b; return (_b = (_a = data.fieldConfig) === null || _a === void 0 ? void 0 : _a.render) === null || _b === void 0 ? void 0 : _b.options; }), operators.filter(Boolean));
18589
18589
  _this._optionsSub = new rxjs.BehaviorSubject([]);
18590
- _this.options$ = _this.sourceState$.pipe(operators.switchMap(function (res) { return _this._aggregationService.prepareAggregationFiled(res); }), operators.filter(function (data) { return !!(data === null || data === void 0 ? void 0 : data.length); }), operators.tap(function (options) {
18590
+ _this.options$ = _this.sourceState$.pipe(operators.switchMap(function (res) { return _this._aggregationService.prepareAggregationFiled(res); }), operators.tap(function (options) {
18591
18591
  _this._optionsSub.next(options);
18592
18592
  }));
18593
18593
  return _this;
@@ -20562,9 +20562,9 @@
20562
20562
  return;
20563
20563
  }
20564
20564
  Object.keys(changes).forEach(function (key) {
20565
- _this._componentRef.instance[key] = changes[key].currentValue;
20565
+ _this._componentRef.instance[key] = ___default["default"].cloneDeep(changes[key].currentValue);
20566
20566
  });
20567
- this._componentRef.changeDetectorRef.markForCheck();
20567
+ this._componentRef.changeDetectorRef.detectChanges();
20568
20568
  };
20569
20569
  BaseField.prototype.ngOnDestroy = function () {
20570
20570
  if (this._componentRef) {
@@ -20680,9 +20680,11 @@
20680
20680
  (_d = (_c = this.handlers)[componentType]) === null || _d === void 0 ? void 0 : _d.call(_c);
20681
20681
  }
20682
20682
  };
20683
+ AggregationFieldComponent.prototype.ngOnChanges = function (changes) {
20684
+ _super.prototype.ngOnChanges.call(this, changes);
20685
+ };
20683
20686
  AggregationFieldComponent.prototype._prepareField = function () {
20684
- var instance = this._componentRef
20685
- .instance;
20687
+ var instance = this._componentRef.instance;
20686
20688
  instance.aggregation = this.aggregation;
20687
20689
  instance.fieldConfig = this.fieldConfig;
20688
20690
  if (this.contentTemplate) {
@@ -20696,14 +20698,14 @@
20696
20698
  {
20697
20699
  provide: i2.NG_VALUE_ACCESSOR,
20698
20700
  useExisting: i0.forwardRef(function () { return AggregationFieldComponent; }),
20699
- multi: true,
20701
+ multi: true
20700
20702
  },
20701
20703
  {
20702
20704
  provide: i2.NG_VALIDATORS,
20703
20705
  useExisting: i0.forwardRef(function () { return AggregationFieldComponent; }),
20704
- multi: true,
20705
- },
20706
- ], usesInheritance: true, ngImport: i0__namespace, template: '<ng-container #dynamicContainer></ng-container>', isInline: true, styles: [""], encapsulation: i0__namespace.ViewEncapsulation.None });
20706
+ multi: true
20707
+ }
20708
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, template: '<ng-container #dynamicContainer></ng-container>', isInline: true, styles: [""], encapsulation: i0__namespace.ViewEncapsulation.None });
20707
20709
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: AggregationFieldComponent, decorators: [{
20708
20710
  type: i0.Component,
20709
20711
  args: [{
@@ -20715,17 +20717,17 @@
20715
20717
  {
20716
20718
  provide: i2.NG_VALUE_ACCESSOR,
20717
20719
  useExisting: i0.forwardRef(function () { return AggregationFieldComponent; }),
20718
- multi: true,
20720
+ multi: true
20719
20721
  },
20720
20722
  {
20721
20723
  provide: i2.NG_VALIDATORS,
20722
20724
  useExisting: i0.forwardRef(function () { return AggregationFieldComponent; }),
20723
- multi: true,
20724
- },
20725
+ multi: true
20726
+ }
20725
20727
  ],
20726
20728
  host: {
20727
- '[class]': "'aggregation-field' + ' aggregation-field__fieldConfig?.render?.type' ",
20728
- },
20729
+ '[class]': "'aggregation-field' + ' aggregation-field__fieldConfig?.render?.type' "
20730
+ }
20729
20731
  }]
20730
20732
  }], propDecorators: { aggregation: [{
20731
20733
  type: i0.Input
@@ -47202,7 +47204,8 @@
47202
47204
  _this.isPanelOpened = false;
47203
47205
  _this.isLoadingResult = false;
47204
47206
  _this.isExpanded = false;
47205
- _this.activeQuery = {};
47207
+ // activeQuery: Record<string, any> = {};
47208
+ _this._activeQuerySub = new rxjs.BehaviorSubject(null);
47206
47209
  _this._activeFiltersQuerySub = new rxjs.ReplaySubject();
47207
47210
  _this.activeFiltersQuery$ = _this._activeFiltersQuerySub.asObservable();
47208
47211
  _this._configSubject = new rxjs.BehaviorSubject(null);
@@ -47225,6 +47228,14 @@
47225
47228
  });
47226
47229
  return _this;
47227
47230
  }
47231
+ Object.defineProperty(NdfReportsComponent.prototype, "activeQuery", {
47232
+ get: function () {
47233
+ var _a;
47234
+ return (_a = this._activeQuerySub.getValue()) === null || _a === void 0 ? void 0 : _a.current;
47235
+ },
47236
+ enumerable: false,
47237
+ configurable: true
47238
+ });
47228
47239
  Object.defineProperty(NdfReportsComponent.prototype, "showDetails", {
47229
47240
  get: function () {
47230
47241
  return !!this._reportDetailsSubject.getValue();
@@ -47371,8 +47382,8 @@
47371
47382
  return this._filtersMapper.preparePayload(fields, criteria);
47372
47383
  };
47373
47384
  NdfReportsComponent.prototype._stringifyValues = function (criteria) {
47374
- return Object.entries(criteria).reduce(function (acc, _d) {
47375
- var _e = __read(_d, 2), key = _e[0], value = _e[1];
47385
+ return Object.entries(criteria).reduce(function (acc, _g) {
47386
+ var _h = __read(_g, 2), key = _h[0], value = _h[1];
47376
47387
  acc[key] = Array.isArray(value) ? JSON.stringify(value) : value;
47377
47388
  return acc;
47378
47389
  }, {});
@@ -47386,8 +47397,8 @@
47386
47397
  ]).pipe(operators.tap(function () {
47387
47398
  _this.isLoadingResult = true;
47388
47399
  _this._cdr.detectChanges();
47389
- }), operators.switchMap(function (_d) {
47390
- var _e = __read(_d, 2), criteria = _e[0], config = _e[1];
47400
+ }), operators.switchMap(function (_g) {
47401
+ var _h = __read(_g, 2), criteria = _h[0], config = _h[1];
47391
47402
  var request = config === null || config === void 0 ? void 0 : config.request;
47392
47403
  if (!request) {
47393
47404
  return rxjs.of(null);
@@ -47403,8 +47414,8 @@
47403
47414
  _this._cdr.detectChanges();
47404
47415
  }));
47405
47416
  return rxjs.forkJoin([rxjs.of(config), data$]);
47406
- }), operators.map(function (_d) {
47407
- var _e = __read(_d, 2), config = _e[0], response = _e[1];
47417
+ }), operators.map(function (_g) {
47418
+ var _h = __read(_g, 2), config = _h[0], response = _h[1];
47408
47419
  _this._prepareAggregations(response === null || response === void 0 ? void 0 : response.aggregations);
47409
47420
  return {
47410
47421
  config: config,
@@ -47430,23 +47441,59 @@
47430
47441
  };
47431
47442
  };
47432
47443
  NdfReportsComponent.prototype._updateActiveQuery = function (query) {
47433
- this.activeQuery = query;
47444
+ this._activeQuerySub.next({
47445
+ previous: this.activeQuery,
47446
+ current: query
47447
+ });
47434
47448
  this._activeFiltersQuerySub.next({
47435
47449
  query: query,
47436
47450
  emitEvent: false
47437
47451
  });
47438
47452
  };
47439
47453
  NdfReportsComponent.prototype._prepareAggregations = function (aggregations) {
47440
- var _a;
47454
+ var _a, _b, _c;
47441
47455
  if (this._isConfigChanged && this.aggregations) {
47442
47456
  this.aggregations = null;
47443
47457
  }
47444
- if (this.aggregations && ((_a = this.config.filters) === null || _a === void 0 ? void 0 : _a.reloadStrategy) === 'never') {
47458
+ var reloadStrategy = (_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.reload) === null || _c === void 0 ? void 0 : _c.strategy;
47459
+ if (this.aggregations && reloadStrategy === 'never') {
47460
+ return;
47461
+ }
47462
+ if (this.aggregations && reloadStrategy === 'onChange') {
47463
+ if (this._shouldReloadOnChange()) {
47464
+ this._updateAggregations(aggregations);
47465
+ }
47445
47466
  return;
47446
47467
  }
47447
- this.aggregations = aggregations;
47468
+ this._updateAggregations(aggregations);
47448
47469
  this._isConfigChanged = false;
47449
47470
  };
47471
+ NdfReportsComponent.prototype._shouldReloadOnChange = function () {
47472
+ var _a, _b, _c, _d, _e, _f;
47473
+ if (((_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.reload) === null || _c === void 0 ? void 0 : _c.strategy) !== 'onChange') {
47474
+ return false;
47475
+ }
47476
+ var triggerFields = (_f = (_e = (_d = this.config) === null || _d === void 0 ? void 0 : _d.filters) === null || _e === void 0 ? void 0 : _e.reload) === null || _f === void 0 ? void 0 : _f.triggerFields;
47477
+ if (!Array.isArray(triggerFields)) {
47478
+ return false;
47479
+ }
47480
+ var validFields = triggerFields.filter(Boolean);
47481
+ if (!validFields.length) {
47482
+ return false;
47483
+ }
47484
+ var activatedQuery = this._activeQuerySub.getValue();
47485
+ var currentValue = (activatedQuery === null || activatedQuery === void 0 ? void 0 : activatedQuery.current) || {};
47486
+ var previousValue = (activatedQuery === null || activatedQuery === void 0 ? void 0 : activatedQuery.previous) || {};
47487
+ var changedKeys = this._getChangedKeys(previousValue, currentValue);
47488
+ return validFields.some(function (field) { return changedKeys.includes(field); });
47489
+ };
47490
+ NdfReportsComponent.prototype._getChangedKeys = function (previous, current) {
47491
+ var allKeys = ___default["default"].union(___default["default"].keys(previous), ___default["default"].keys(current));
47492
+ return allKeys.filter(function (key) { return !___default["default"].isEqual(previous[key], current[key]); });
47493
+ };
47494
+ NdfReportsComponent.prototype._updateAggregations = function (aggregations) {
47495
+ this.aggregations = ___default["default"].cloneDeep(aggregations);
47496
+ };
47450
47497
  NdfReportsComponent.prototype._checkConfigChange = function (value) {
47451
47498
  var activeQuery = value.activeQuery, config = __rest(value, ["activeQuery"]);
47452
47499
  var _a = this._configSubject.getValue() || {}, aq = _a.activeQuery, currentConfig = __rest(_a, ["activeQuery"]);