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.
@@ -16953,7 +16953,7 @@ class BaseAggregationField extends BaseSelector {
16953
16953
  this.sourceState$ = this._sourceState.asObservable().pipe(filter$1((data) => !!(data === null || data === void 0 ? void 0 : data.fieldConfig) && !!data.aggregation));
16954
16954
  this.renderOptions$ = this.sourceState$.pipe(map((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; }), filter$1(Boolean));
16955
16955
  this._optionsSub = new BehaviorSubject([]);
16956
- this.options$ = this.sourceState$.pipe(switchMap((res) => this._aggregationService.prepareAggregationFiled(res)), filter$1((data) => !!(data === null || data === void 0 ? void 0 : data.length)), tap((options) => {
16956
+ this.options$ = this.sourceState$.pipe(switchMap((res) => this._aggregationService.prepareAggregationFiled(res)), tap((options) => {
16957
16957
  this._optionsSub.next(options);
16958
16958
  }));
16959
16959
  }
@@ -18761,9 +18761,9 @@ class BaseField extends BaseCustomValueAccessor {
18761
18761
  return;
18762
18762
  }
18763
18763
  Object.keys(changes).forEach((key) => {
18764
- this._componentRef.instance[key] = changes[key].currentValue;
18764
+ this._componentRef.instance[key] = ___default.cloneDeep(changes[key].currentValue);
18765
18765
  });
18766
- this._componentRef.changeDetectorRef.markForCheck();
18766
+ this._componentRef.changeDetectorRef.detectChanges();
18767
18767
  }
18768
18768
  ngOnDestroy() {
18769
18769
  if (this._componentRef) {
@@ -18860,7 +18860,7 @@ class AggregationFieldComponent extends BaseField {
18860
18860
  [AGGREGATION_FIELD_TYPES.switch]: this._prepareField.bind(this),
18861
18861
  [AGGREGATION_FIELD_TYPES.autocomplete]: this._prepareField.bind(this),
18862
18862
  [AGGREGATION_FIELD_TYPES.dateList]: this._prepareField.bind(this),
18863
- [AGGREGATION_FIELD_TYPES.custom]: this._prepareField.bind(this),
18863
+ [AGGREGATION_FIELD_TYPES.custom]: this._prepareField.bind(this)
18864
18864
  };
18865
18865
  }
18866
18866
  ngOnInit() {
@@ -18872,9 +18872,11 @@ class AggregationFieldComponent extends BaseField {
18872
18872
  (_d = (_c = this.handlers)[componentType]) === null || _d === void 0 ? void 0 : _d.call(_c);
18873
18873
  }
18874
18874
  }
18875
+ ngOnChanges(changes) {
18876
+ super.ngOnChanges(changes);
18877
+ }
18875
18878
  _prepareField() {
18876
- const instance = this._componentRef
18877
- .instance;
18879
+ const instance = this._componentRef.instance;
18878
18880
  instance.aggregation = this.aggregation;
18879
18881
  instance.fieldConfig = this.fieldConfig;
18880
18882
  if (this.contentTemplate) {
@@ -18887,14 +18889,14 @@ AggregationFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.
18887
18889
  {
18888
18890
  provide: NG_VALUE_ACCESSOR,
18889
18891
  useExisting: forwardRef(() => AggregationFieldComponent),
18890
- multi: true,
18892
+ multi: true
18891
18893
  },
18892
18894
  {
18893
18895
  provide: NG_VALIDATORS,
18894
18896
  useExisting: forwardRef(() => AggregationFieldComponent),
18895
- multi: true,
18896
- },
18897
- ], usesInheritance: true, ngImport: i0, template: '<ng-container #dynamicContainer></ng-container>', isInline: true, styles: [""], encapsulation: i0.ViewEncapsulation.None });
18897
+ multi: true
18898
+ }
18899
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-container #dynamicContainer></ng-container>', isInline: true, styles: [""], encapsulation: i0.ViewEncapsulation.None });
18898
18900
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AggregationFieldComponent, decorators: [{
18899
18901
  type: Component,
18900
18902
  args: [{
@@ -18906,17 +18908,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
18906
18908
  {
18907
18909
  provide: NG_VALUE_ACCESSOR,
18908
18910
  useExisting: forwardRef(() => AggregationFieldComponent),
18909
- multi: true,
18911
+ multi: true
18910
18912
  },
18911
18913
  {
18912
18914
  provide: NG_VALIDATORS,
18913
18915
  useExisting: forwardRef(() => AggregationFieldComponent),
18914
- multi: true,
18915
- },
18916
+ multi: true
18917
+ }
18916
18918
  ],
18917
18919
  host: {
18918
- '[class]': "'aggregation-field' + ' aggregation-field__fieldConfig?.render?.type' ",
18919
- },
18920
+ '[class]': "'aggregation-field' + ' aggregation-field__fieldConfig?.render?.type' "
18921
+ }
18920
18922
  }]
18921
18923
  }], propDecorators: { aggregation: [{
18922
18924
  type: Input
@@ -44237,7 +44239,8 @@ class NdfReportsComponent extends DestroySubject {
44237
44239
  this.isPanelOpened = false;
44238
44240
  this.isLoadingResult = false;
44239
44241
  this.isExpanded = false;
44240
- this.activeQuery = {};
44242
+ // activeQuery: Record<string, any> = {};
44243
+ this._activeQuerySub = new BehaviorSubject(null);
44241
44244
  this._activeFiltersQuerySub = new ReplaySubject();
44242
44245
  this.activeFiltersQuery$ = this._activeFiltersQuerySub.asObservable();
44243
44246
  this._configSubject = new BehaviorSubject(null);
@@ -44259,6 +44262,10 @@ class NdfReportsComponent extends DestroySubject {
44259
44262
  this.direction = res.lang === 'ar' ? 'rtl' : 'ltr';
44260
44263
  });
44261
44264
  }
44265
+ get activeQuery() {
44266
+ var _a;
44267
+ return (_a = this._activeQuerySub.getValue()) === null || _a === void 0 ? void 0 : _a.current;
44268
+ }
44262
44269
  get showDetails() {
44263
44270
  return !!this._reportDetailsSubject.getValue();
44264
44271
  }
@@ -44440,23 +44447,59 @@ class NdfReportsComponent extends DestroySubject {
44440
44447
  };
44441
44448
  }
44442
44449
  _updateActiveQuery(query) {
44443
- this.activeQuery = query;
44450
+ this._activeQuerySub.next({
44451
+ previous: this.activeQuery,
44452
+ current: query
44453
+ });
44444
44454
  this._activeFiltersQuerySub.next({
44445
44455
  query,
44446
44456
  emitEvent: false
44447
44457
  });
44448
44458
  }
44449
44459
  _prepareAggregations(aggregations) {
44450
- var _a;
44460
+ var _a, _b, _c;
44451
44461
  if (this._isConfigChanged && this.aggregations) {
44452
44462
  this.aggregations = null;
44453
44463
  }
44454
- if (this.aggregations && ((_a = this.config.filters) === null || _a === void 0 ? void 0 : _a.reloadStrategy) === 'never') {
44464
+ const 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;
44465
+ if (this.aggregations && reloadStrategy === 'never') {
44455
44466
  return;
44456
44467
  }
44457
- this.aggregations = aggregations;
44468
+ if (this.aggregations && reloadStrategy === 'onChange') {
44469
+ if (this._shouldReloadOnChange()) {
44470
+ this._updateAggregations(aggregations);
44471
+ }
44472
+ return;
44473
+ }
44474
+ this._updateAggregations(aggregations);
44458
44475
  this._isConfigChanged = false;
44459
44476
  }
44477
+ _shouldReloadOnChange() {
44478
+ var _a, _b, _c, _d, _e, _f;
44479
+ 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') {
44480
+ return false;
44481
+ }
44482
+ const 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;
44483
+ if (!Array.isArray(triggerFields)) {
44484
+ return false;
44485
+ }
44486
+ const validFields = triggerFields.filter(Boolean);
44487
+ if (!validFields.length) {
44488
+ return false;
44489
+ }
44490
+ const activatedQuery = this._activeQuerySub.getValue();
44491
+ const currentValue = (activatedQuery === null || activatedQuery === void 0 ? void 0 : activatedQuery.current) || {};
44492
+ const previousValue = (activatedQuery === null || activatedQuery === void 0 ? void 0 : activatedQuery.previous) || {};
44493
+ const changedKeys = this._getChangedKeys(previousValue, currentValue);
44494
+ return validFields.some((field) => changedKeys.includes(field));
44495
+ }
44496
+ _getChangedKeys(previous, current) {
44497
+ const allKeys = ___default.union(___default.keys(previous), ___default.keys(current));
44498
+ return allKeys.filter((key) => !___default.isEqual(previous[key], current[key]));
44499
+ }
44500
+ _updateAggregations(aggregations) {
44501
+ this.aggregations = ___default.cloneDeep(aggregations);
44502
+ }
44460
44503
  _checkConfigChange(value) {
44461
44504
  const { activeQuery } = value, config = __rest(value, ["activeQuery"]);
44462
44505
  const _a = this._configSubject.getValue() || {}, { activeQuery: aq } = _a, currentConfig = __rest(_a, ["activeQuery"]);