nuxeo-development-framework 5.5.4 → 5.5.6

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.
Files changed (22) hide show
  1. package/bundles/nuxeo-development-framework.umd.js +74 -60
  2. package/bundles/nuxeo-development-framework.umd.js.map +1 -1
  3. package/esm2015/lib/components/dynamic-form/components/dynamic-form-select-users/dynamic-form-select-users.component.js +3 -2
  4. package/esm2015/lib/components/reports/charts/chart.token.js +1 -1
  5. package/esm2015/lib/components/reports/charts/components/chart.component.js +1 -1
  6. package/esm2015/lib/components/reports/charts/utility/colors.js +7 -1
  7. package/esm2015/lib/components/reports/charts/utility/css.js +32 -1
  8. package/esm2015/lib/components/reports/ndf-reports/base/base-graph.report.js +30 -1
  9. package/esm2015/lib/components/reports/ndf-reports/charts-components/graph-chart/graph-chart.component.js +1 -1
  10. package/esm2015/lib/components/reports/ndf-reports/components/dynamic-timeline-report/dynamic-timeline-report.component.js +1 -23
  11. package/esm2015/lib/components/reports/ndf-reports/components/graph-report/graph-report.component.js +2 -24
  12. package/esm2015/lib/components/reports/ndf-reports/services/report-config-mapper.service.js +3 -9
  13. package/esm2015/lib/components/reports/ndf-reports/utilities/dataset-colors.js +3 -5
  14. package/fesm2015/nuxeo-development-framework.js +71 -56
  15. package/fesm2015/nuxeo-development-framework.js.map +1 -1
  16. package/lib/components/reports/charts/chart.token.d.ts +3 -0
  17. package/lib/components/reports/charts/utility/colors.d.ts +1 -0
  18. package/lib/components/reports/charts/utility/css.d.ts +4 -0
  19. package/lib/components/reports/ndf-reports/base/base-graph.report.d.ts +5 -1
  20. package/lib/components/reports/ndf-reports/components/dynamic-timeline-report/dynamic-timeline-report.component.d.ts +2 -5
  21. package/lib/components/reports/ndf-reports/components/graph-report/graph-report.component.d.ts +1 -5
  22. package/package.json +1 -1
@@ -12337,8 +12337,9 @@
12337
12337
  };
12338
12338
  DynamicFormSelectUsersComponent.prototype.ngOnInit = function () {
12339
12339
  var _this = this;
12340
+ var _a;
12340
12341
  this.allUsers = this.deptTitle === 'all' ? true : false;
12341
- this.selection = this.multiple ? [] : undefined;
12342
+ this.selection = (_a = this.selection) !== null && _a !== void 0 ? _a : (this.multiple ? [] : undefined);
12342
12343
  if (this.allUsers) {
12343
12344
  this.loadUsers();
12344
12345
  }
@@ -43473,6 +43474,12 @@
43473
43474
  gradient.addColorStop(0, colors === null || colors === void 0 ? void 0 : colors.startColor);
43474
43475
  gradient.addColorStop(1, colors === null || colors === void 0 ? void 0 : colors.endColor);
43475
43476
  return gradient;
43477
+ }
43478
+ // Check if the string is a valid CSS color
43479
+ function isColor(str) {
43480
+ var s = new Option().style;
43481
+ s.color = str;
43482
+ return s.color !== '';
43476
43483
  }
43477
43484
 
43478
43485
  function flatArray(data) {
@@ -43589,6 +43596,36 @@
43589
43596
  var luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
43590
43597
  return luminance > 0.6 ? darkColor : lightColor;
43591
43598
  }
43599
+ function getCssColors(colors) {
43600
+ var _colors = (colors || []).map(function (color) {
43601
+ var str = "" + color;
43602
+ if (isCssVar(str)) {
43603
+ var _var = extractCssVar(str);
43604
+ return getColor(_var);
43605
+ }
43606
+ return str;
43607
+ });
43608
+ return __spreadArray([], __read(_colors));
43609
+ }
43610
+ function isCssVar(value) {
43611
+ return typeof value === 'string' && (value.startsWith('var') || value.startsWith('--'));
43612
+ }
43613
+ function extractCssVar(data) {
43614
+ var match = data.match(/var\((--[^)]+)\)/);
43615
+ return match ? match[1] : data;
43616
+ }
43617
+ function resolveColor(value, cssVar, fallback) {
43618
+ if (!value && !cssVar) {
43619
+ return fallback;
43620
+ }
43621
+ if (isCssVar(value)) {
43622
+ return getColor(extractCssVar(value), fallback);
43623
+ }
43624
+ if (isColor(value)) {
43625
+ return value;
43626
+ }
43627
+ return getColor(cssVar, fallback);
43628
+ }
43592
43629
  /*
43593
43630
  * Converts a hexadecimal color code to an RGB array.
43594
43631
  *
@@ -43626,6 +43663,7 @@
43626
43663
  createShade: createShade,
43627
43664
  createColorVariants: createColorVariants,
43628
43665
  createConicGradient: createConicGradient,
43666
+ isColor: isColor,
43629
43667
  flatArray: flatArray,
43630
43668
  isObject: isObject,
43631
43669
  getCssVariable: getCssVariable,
@@ -43633,7 +43671,11 @@
43633
43671
  getGridColor: getGridColor,
43634
43672
  getTicksColor: getTicksColor,
43635
43673
  getColors: getColors,
43636
- getTextColor: getTextColor
43674
+ getTextColor: getTextColor,
43675
+ getCssColors: getCssColors,
43676
+ isCssVar: isCssVar,
43677
+ extractCssVar: extractCssVar,
43678
+ resolveColor: resolveColor
43637
43679
  });
43638
43680
 
43639
43681
  var StatisticService = /** @class */ (function (_super) {
@@ -45444,10 +45486,8 @@
45444
45486
  // Keep the original replaceColors for processing individual values
45445
45487
  function replaceColors(data) {
45446
45488
  var e_2, _a;
45447
- if (typeof data === 'string' && (data.startsWith('var') || data.startsWith('--'))) {
45448
- var match = data.match(/var\((--[^)]+)\)/);
45449
- var value = match ? match[1] : data;
45450
- return getColor(value);
45489
+ if (isCssVar(data)) {
45490
+ return getColor(extractCssVar(data));
45451
45491
  }
45452
45492
  if (data === null || typeof data !== 'object') {
45453
45493
  return data;
@@ -45553,14 +45593,7 @@
45553
45593
  return ((_a = _optionsMap[key]) === null || _a === void 0 ? void 0 : _a.call(_optionsMap, options)) || {};
45554
45594
  };
45555
45595
  ReportConfigMapperService.prototype._prepareColors = function (colors) {
45556
- var _colors = (colors || []).map(function (color) {
45557
- var str = "" + color;
45558
- if (str.startsWith('var(')) {
45559
- var match = str.match(/^var\((--[^)]+)\)/);
45560
- return match ? getColor(match[1]) : str;
45561
- }
45562
- return str.startsWith('--') ? getColor(str) : str;
45563
- });
45596
+ var _colors = getCssColors(colors || []);
45564
45597
  return __spreadArray(__spreadArray([], __read(_colors)), __read(getColors()));
45565
45598
  };
45566
45599
  return ReportConfigMapperService;
@@ -46061,6 +46094,31 @@
46061
46094
  direction: this.direction
46062
46095
  });
46063
46096
  };
46097
+ BaseGraphReport.prototype.ngAfterViewInit = function () {
46098
+ this._setupThemeWatcher();
46099
+ };
46100
+ BaseGraphReport.prototype.ngOnDestroy = function () {
46101
+ _super.prototype.ngOnDestroy.call(this);
46102
+ this._chartThemeService.destroy();
46103
+ };
46104
+ BaseGraphReport.prototype._setupThemeWatcher = function () {
46105
+ var _this = this;
46106
+ this._chartThemeService.theme$
46107
+ .pipe(operators.filter(function (value) { return value !== _this._initialTheme && !!_this._definition; }), operators.takeUntil(this.destroy$))
46108
+ .subscribe(function (theme) {
46109
+ _this._initialTheme = theme;
46110
+ var _a = _this._configSub.getValue(), chart = _a.chart, config = __rest(_a, ["chart"]);
46111
+ var data = ___default["default"].merge({}, _this._definition, {
46112
+ chart: {
46113
+ type: chart.type
46114
+ }
46115
+ });
46116
+ _this._configSub.next(_this._prepareConfig(data));
46117
+ Chart__default["default"].defaults.color = getColor('--chart-default-color', '#666');
46118
+ Chart__default["default"].defaults.backgroundColor = getColor('--chart-default-background-color', 'rgba(0, 0, 0, 0.1)');
46119
+ Chart__default["default"].defaults.borderColor = getColor('--chart-default-border-color', 'rgba(0, 0, 0, 0.1)');
46120
+ });
46121
+ };
46064
46122
  return BaseGraphReport;
46065
46123
  }(BaseReport));
46066
46124
  BaseGraphReport.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: BaseGraphReport, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
@@ -46452,13 +46510,6 @@
46452
46510
  }));
46453
46511
  return _this;
46454
46512
  }
46455
- GraphReportComponent.prototype.ngAfterViewInit = function () {
46456
- this._setupThemeWatcher();
46457
- };
46458
- GraphReportComponent.prototype.ngOnDestroy = function () {
46459
- _super.prototype.ngOnDestroy.call(this);
46460
- this._chartThemeService.destroy();
46461
- };
46462
46513
  GraphReportComponent.prototype.changeChartType = function (type) {
46463
46514
  var _d;
46464
46515
  var _a, _b;
@@ -46479,21 +46530,6 @@
46479
46530
  this.graphChartComponent.printChart();
46480
46531
  }
46481
46532
  };
46482
- GraphReportComponent.prototype._setupThemeWatcher = function () {
46483
- var _this = this;
46484
- this._chartThemeService.theme$
46485
- .pipe(operators.filter(function (value) { return value !== _this._initialTheme && !!_this._definition; }), operators.takeUntil(this.destroy$))
46486
- .subscribe(function (theme) {
46487
- _this._initialTheme = theme;
46488
- var _a = _this._configSub.getValue(), chart = _a.chart, config = __rest(_a, ["chart"]);
46489
- var data = ___default["default"].merge({}, _this._definition, {
46490
- chart: {
46491
- type: chart.type
46492
- }
46493
- });
46494
- _this._configSub.next(_this._prepareConfig(data));
46495
- });
46496
- };
46497
46533
  return GraphReportComponent;
46498
46534
  }(BaseGraphReport));
46499
46535
  GraphReportComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: GraphReportComponent, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
@@ -46710,21 +46746,14 @@
46710
46746
  _this._timelineService = _this.injector.get(DynamicTimelineReportService);
46711
46747
  _this._criteria$ = _this.criteria$.pipe(operators.distinctUntilChanged(function (a, b) { return ___default["default"].isEqual(a, b); }));
46712
46748
  _this.selectedGroup$ = _this._timelineService.selectedGroup$;
46713
- _this.filterCriteria$ = rxjs.combineLatest([_this._criteria$, _this._timelineService.selectedGroup$]).pipe(operators.map(function (_b) {
46714
- var _c = __read(_b, 1), criteria = _c[0];
46749
+ _this.filterCriteria$ = rxjs.combineLatest([_this._criteria$, _this._timelineService.selectedGroup$]).pipe(operators.map(function (_a) {
46750
+ var _b = __read(_a, 1), criteria = _b[0];
46715
46751
  return ___default["default"].cloneDeep(___default["default"].merge(criteria || {}, _this._timelineService.prepareSelectedGroups(_this.config)));
46716
46752
  }));
46717
46753
  _this.report$ = rxjs.combineLatest([_this.config$, _this._criteria$, _this._timelineService.rebuild$]).pipe(_this._timelineService.prepareData());
46718
46754
  _this._subscribeToLanguage();
46719
46755
  return _this;
46720
46756
  }
46721
- DynamicTimelineReportComponent.prototype.ngAfterViewInit = function () {
46722
- this._setupThemeWatcher();
46723
- };
46724
- DynamicTimelineReportComponent.prototype.ngOnDestroy = function () {
46725
- _super.prototype.ngOnDestroy.call(this);
46726
- this._chartThemeService.destroy();
46727
- };
46728
46757
  DynamicTimelineReportComponent.prototype._subscribeToLanguage = function () {
46729
46758
  var _this = this;
46730
46759
  this._translateService.onLangChange
@@ -46747,21 +46776,6 @@
46747
46776
  DynamicTimelineReportComponent.prototype.openDetails = function () {
46748
46777
  this.onOpen.emit(this._timelineService.payload);
46749
46778
  };
46750
- DynamicTimelineReportComponent.prototype._setupThemeWatcher = function () {
46751
- var _this = this;
46752
- this._chartThemeService.theme$
46753
- .pipe(operators.filter(function (value) { return value !== _this._initialTheme && !!_this._definition; }), operators.takeUntil(this.destroy$))
46754
- .subscribe(function (theme) {
46755
- _this._initialTheme = theme;
46756
- var _a = _this._configSub.getValue(), chart = _a.chart, config = __rest(_a, ["chart"]);
46757
- var data = ___default["default"].merge({}, _this._definition, {
46758
- chart: {
46759
- type: chart.type
46760
- }
46761
- });
46762
- _this._configSub.next(_this._prepareConfig(data));
46763
- });
46764
- };
46765
46779
  return DynamicTimelineReportComponent;
46766
46780
  }(BaseGraphReport));
46767
46781
  DynamicTimelineReportComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: DynamicTimelineReportComponent, deps: [{ token: i0__namespace.Injector }], target: i0__namespace.ɵɵFactoryTarget.Component });