nuxeo-development-framework 5.6.9 → 5.7.1

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.
@@ -792,7 +792,7 @@
792
792
  expandedSidenav: true
793
793
  };
794
794
  this.userPreferenceStatus = this.defaults;
795
- this.clientCustomTranslateFiles = { arFile: rxjs.of({}), enFile: rxjs.of({}) };
795
+ this.clientCustomTranslateFiles = { ar: {}, en: {} };
796
796
  this.onChangeSubject = new rxjs.BehaviorSubject(this.userPreferenceStatus);
797
797
  this.onChange = this.onChangeSubject.asObservable();
798
798
  }
@@ -1682,16 +1682,13 @@
1682
1682
  */
1683
1683
  TranslationService.prototype.loadTranslation = function (lang, fallback) {
1684
1684
  var _this = this;
1685
- var clientTranslation;
1686
1685
  if (lang === exports.Lang.Arabic) {
1687
1686
  this.renderer.addClass(document.body, 'rtl');
1688
1687
  this.isArabic.next(true);
1689
- clientTranslation = __classPrivateFieldGet(this, _TranslationService_instances, "a", _TranslationService_ClientTranslationFiles_get).arFile;
1690
1688
  }
1691
1689
  else {
1692
1690
  this.renderer.removeClass(document.body, 'rtl');
1693
1691
  this.isArabic.next(false);
1694
- clientTranslation = __classPrivateFieldGet(this, _TranslationService_instances, "a", _TranslationService_ClientTranslationFiles_get).enFile;
1695
1692
  }
1696
1693
  var arabicFile$ = this.getOrCreateTranslationFile('ar');
1697
1694
  var englishFile$ = this.getOrCreateTranslationFile('en');
@@ -1699,7 +1696,6 @@
1699
1696
  arabicFile$,
1700
1697
  englishFile$,
1701
1698
  this.translate.getTranslation(lang),
1702
- clientTranslation
1703
1699
  ]).subscribe(function (res) {
1704
1700
  _this.arabicFile = res[0];
1705
1701
  _this.englishFile = res[1];
@@ -1707,7 +1703,7 @@
1707
1703
  var ArorEnFile = lang === 'en'
1708
1704
  ? JSON.parse(res[1].properties['note:note'])
1709
1705
  : JSON.parse(res[0].properties['note:note']);
1710
- _this.translate.setTranslation(_this.translate.currentLang, Object.assign(Object.assign({}, (res[3] || {})), ArorEnFile), true);
1706
+ _this.translate.setTranslation(_this.translate.currentLang, Object.assign(Object.assign({}, (__classPrivateFieldGet(_this, _TranslationService_instances, "a", _TranslationService_ClientTranslationFiles_get)[lang] || {})), ArorEnFile), true);
1711
1707
  _this.onTranslationChanged(lang);
1712
1708
  }, function () {
1713
1709
  if (fallback && fallback !== lang) {
@@ -18587,7 +18583,7 @@
18587
18583
  _this.sourceState$ = _this._sourceState.asObservable().pipe(operators.filter(function (data) { return !!(data === null || data === void 0 ? void 0 : data.fieldConfig) && !!data.aggregation; }));
18588
18584
  _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
18585
  _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) {
18586
+ _this.options$ = _this.sourceState$.pipe(operators.switchMap(function (res) { return _this._aggregationService.prepareAggregationFiled(res); }), operators.tap(function (options) {
18591
18587
  _this._optionsSub.next(options);
18592
18588
  }));
18593
18589
  return _this;
@@ -20562,9 +20558,9 @@
20562
20558
  return;
20563
20559
  }
20564
20560
  Object.keys(changes).forEach(function (key) {
20565
- _this._componentRef.instance[key] = changes[key].currentValue;
20561
+ _this._componentRef.instance[key] = ___default["default"].cloneDeep(changes[key].currentValue);
20566
20562
  });
20567
- this._componentRef.changeDetectorRef.markForCheck();
20563
+ this._componentRef.changeDetectorRef.detectChanges();
20568
20564
  };
20569
20565
  BaseField.prototype.ngOnDestroy = function () {
20570
20566
  if (this._componentRef) {
@@ -20680,9 +20676,11 @@
20680
20676
  (_d = (_c = this.handlers)[componentType]) === null || _d === void 0 ? void 0 : _d.call(_c);
20681
20677
  }
20682
20678
  };
20679
+ AggregationFieldComponent.prototype.ngOnChanges = function (changes) {
20680
+ _super.prototype.ngOnChanges.call(this, changes);
20681
+ };
20683
20682
  AggregationFieldComponent.prototype._prepareField = function () {
20684
- var instance = this._componentRef
20685
- .instance;
20683
+ var instance = this._componentRef.instance;
20686
20684
  instance.aggregation = this.aggregation;
20687
20685
  instance.fieldConfig = this.fieldConfig;
20688
20686
  if (this.contentTemplate) {
@@ -20696,14 +20694,14 @@
20696
20694
  {
20697
20695
  provide: i2.NG_VALUE_ACCESSOR,
20698
20696
  useExisting: i0.forwardRef(function () { return AggregationFieldComponent; }),
20699
- multi: true,
20697
+ multi: true
20700
20698
  },
20701
20699
  {
20702
20700
  provide: i2.NG_VALIDATORS,
20703
20701
  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 });
20702
+ multi: true
20703
+ }
20704
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, template: '<ng-container #dynamicContainer></ng-container>', isInline: true, styles: [""], encapsulation: i0__namespace.ViewEncapsulation.None });
20707
20705
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: AggregationFieldComponent, decorators: [{
20708
20706
  type: i0.Component,
20709
20707
  args: [{
@@ -20715,17 +20713,17 @@
20715
20713
  {
20716
20714
  provide: i2.NG_VALUE_ACCESSOR,
20717
20715
  useExisting: i0.forwardRef(function () { return AggregationFieldComponent; }),
20718
- multi: true,
20716
+ multi: true
20719
20717
  },
20720
20718
  {
20721
20719
  provide: i2.NG_VALIDATORS,
20722
20720
  useExisting: i0.forwardRef(function () { return AggregationFieldComponent; }),
20723
- multi: true,
20724
- },
20721
+ multi: true
20722
+ }
20725
20723
  ],
20726
20724
  host: {
20727
- '[class]': "'aggregation-field' + ' aggregation-field__fieldConfig?.render?.type' ",
20728
- },
20725
+ '[class]': "'aggregation-field' + ' aggregation-field__fieldConfig?.render?.type' "
20726
+ }
20729
20727
  }]
20730
20728
  }], propDecorators: { aggregation: [{
20731
20729
  type: i0.Input
@@ -47202,7 +47200,8 @@
47202
47200
  _this.isPanelOpened = false;
47203
47201
  _this.isLoadingResult = false;
47204
47202
  _this.isExpanded = false;
47205
- _this.activeQuery = {};
47203
+ // activeQuery: Record<string, any> = {};
47204
+ _this._activeQuerySub = new rxjs.BehaviorSubject(null);
47206
47205
  _this._activeFiltersQuerySub = new rxjs.ReplaySubject();
47207
47206
  _this.activeFiltersQuery$ = _this._activeFiltersQuerySub.asObservable();
47208
47207
  _this._configSubject = new rxjs.BehaviorSubject(null);
@@ -47225,6 +47224,14 @@
47225
47224
  });
47226
47225
  return _this;
47227
47226
  }
47227
+ Object.defineProperty(NdfReportsComponent.prototype, "activeQuery", {
47228
+ get: function () {
47229
+ var _a;
47230
+ return (_a = this._activeQuerySub.getValue()) === null || _a === void 0 ? void 0 : _a.current;
47231
+ },
47232
+ enumerable: false,
47233
+ configurable: true
47234
+ });
47228
47235
  Object.defineProperty(NdfReportsComponent.prototype, "showDetails", {
47229
47236
  get: function () {
47230
47237
  return !!this._reportDetailsSubject.getValue();
@@ -47371,8 +47378,8 @@
47371
47378
  return this._filtersMapper.preparePayload(fields, criteria);
47372
47379
  };
47373
47380
  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];
47381
+ return Object.entries(criteria).reduce(function (acc, _g) {
47382
+ var _h = __read(_g, 2), key = _h[0], value = _h[1];
47376
47383
  acc[key] = Array.isArray(value) ? JSON.stringify(value) : value;
47377
47384
  return acc;
47378
47385
  }, {});
@@ -47386,8 +47393,8 @@
47386
47393
  ]).pipe(operators.tap(function () {
47387
47394
  _this.isLoadingResult = true;
47388
47395
  _this._cdr.detectChanges();
47389
- }), operators.switchMap(function (_d) {
47390
- var _e = __read(_d, 2), criteria = _e[0], config = _e[1];
47396
+ }), operators.switchMap(function (_g) {
47397
+ var _h = __read(_g, 2), criteria = _h[0], config = _h[1];
47391
47398
  var request = config === null || config === void 0 ? void 0 : config.request;
47392
47399
  if (!request) {
47393
47400
  return rxjs.of(null);
@@ -47403,8 +47410,8 @@
47403
47410
  _this._cdr.detectChanges();
47404
47411
  }));
47405
47412
  return rxjs.forkJoin([rxjs.of(config), data$]);
47406
- }), operators.map(function (_d) {
47407
- var _e = __read(_d, 2), config = _e[0], response = _e[1];
47413
+ }), operators.map(function (_g) {
47414
+ var _h = __read(_g, 2), config = _h[0], response = _h[1];
47408
47415
  _this._prepareAggregations(response === null || response === void 0 ? void 0 : response.aggregations);
47409
47416
  return {
47410
47417
  config: config,
@@ -47430,23 +47437,59 @@
47430
47437
  };
47431
47438
  };
47432
47439
  NdfReportsComponent.prototype._updateActiveQuery = function (query) {
47433
- this.activeQuery = query;
47440
+ this._activeQuerySub.next({
47441
+ previous: this.activeQuery,
47442
+ current: query
47443
+ });
47434
47444
  this._activeFiltersQuerySub.next({
47435
47445
  query: query,
47436
47446
  emitEvent: false
47437
47447
  });
47438
47448
  };
47439
47449
  NdfReportsComponent.prototype._prepareAggregations = function (aggregations) {
47440
- var _a;
47450
+ var _a, _b, _c;
47441
47451
  if (this._isConfigChanged && this.aggregations) {
47442
47452
  this.aggregations = null;
47443
47453
  }
47444
- if (this.aggregations && ((_a = this.config.filters) === null || _a === void 0 ? void 0 : _a.reloadStrategy) === 'never') {
47454
+ 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;
47455
+ if (this.aggregations && reloadStrategy === 'never') {
47456
+ return;
47457
+ }
47458
+ if (this.aggregations && reloadStrategy === 'onChange') {
47459
+ if (this._shouldReloadOnChange()) {
47460
+ this._updateAggregations(aggregations);
47461
+ }
47445
47462
  return;
47446
47463
  }
47447
- this.aggregations = aggregations;
47464
+ this._updateAggregations(aggregations);
47448
47465
  this._isConfigChanged = false;
47449
47466
  };
47467
+ NdfReportsComponent.prototype._shouldReloadOnChange = function () {
47468
+ var _a, _b, _c, _d, _e, _f;
47469
+ 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') {
47470
+ return false;
47471
+ }
47472
+ 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;
47473
+ if (!Array.isArray(triggerFields)) {
47474
+ return false;
47475
+ }
47476
+ var validFields = triggerFields.filter(Boolean);
47477
+ if (!validFields.length) {
47478
+ return false;
47479
+ }
47480
+ var activatedQuery = this._activeQuerySub.getValue();
47481
+ var currentValue = (activatedQuery === null || activatedQuery === void 0 ? void 0 : activatedQuery.current) || {};
47482
+ var previousValue = (activatedQuery === null || activatedQuery === void 0 ? void 0 : activatedQuery.previous) || {};
47483
+ var changedKeys = this._getChangedKeys(previousValue, currentValue);
47484
+ return validFields.some(function (field) { return changedKeys.includes(field); });
47485
+ };
47486
+ NdfReportsComponent.prototype._getChangedKeys = function (previous, current) {
47487
+ var allKeys = ___default["default"].union(___default["default"].keys(previous), ___default["default"].keys(current));
47488
+ return allKeys.filter(function (key) { return !___default["default"].isEqual(previous[key], current[key]); });
47489
+ };
47490
+ NdfReportsComponent.prototype._updateAggregations = function (aggregations) {
47491
+ this.aggregations = ___default["default"].cloneDeep(aggregations);
47492
+ };
47450
47493
  NdfReportsComponent.prototype._checkConfigChange = function (value) {
47451
47494
  var activeQuery = value.activeQuery, config = __rest(value, ["activeQuery"]);
47452
47495
  var _a = this._configSubject.getValue() || {}, aq = _a.activeQuery, currentConfig = __rest(_a, ["activeQuery"]);