nuxeo-development-framework 5.5.5 → 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 +72 -59
  2. package/bundles/nuxeo-development-framework.umd.js.map +1 -1
  3. package/esm2015/lib/components/reports/charts/chart.token.js +1 -1
  4. package/esm2015/lib/components/reports/charts/components/chart.component.js +1 -1
  5. package/esm2015/lib/components/reports/charts/utility/colors.js +7 -1
  6. package/esm2015/lib/components/reports/charts/utility/css.js +32 -1
  7. package/esm2015/lib/components/reports/ndf-reports/base/base-graph.report.js +30 -1
  8. package/esm2015/lib/components/reports/ndf-reports/charts-components/graph-chart/graph-chart.component.js +1 -1
  9. package/esm2015/lib/components/reports/ndf-reports/components/dynamic-timeline-report/dynamic-timeline-report.component.js +1 -23
  10. package/esm2015/lib/components/reports/ndf-reports/components/graph-report/graph-report.component.js +2 -24
  11. package/esm2015/lib/components/reports/ndf-reports/services/report-config-mapper.service.js +3 -9
  12. package/esm2015/lib/components/reports/ndf-reports/utilities/dataset-colors.js +3 -5
  13. package/esm2015/lib/components/spell-checker-field/spell-checker-field.module.js +1 -1
  14. package/fesm2015/nuxeo-development-framework.js +69 -55
  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
@@ -43474,6 +43474,12 @@
43474
43474
  gradient.addColorStop(0, colors === null || colors === void 0 ? void 0 : colors.startColor);
43475
43475
  gradient.addColorStop(1, colors === null || colors === void 0 ? void 0 : colors.endColor);
43476
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 !== '';
43477
43483
  }
43478
43484
 
43479
43485
  function flatArray(data) {
@@ -43590,6 +43596,36 @@
43590
43596
  var luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
43591
43597
  return luminance > 0.6 ? darkColor : lightColor;
43592
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
+ }
43593
43629
  /*
43594
43630
  * Converts a hexadecimal color code to an RGB array.
43595
43631
  *
@@ -43627,6 +43663,7 @@
43627
43663
  createShade: createShade,
43628
43664
  createColorVariants: createColorVariants,
43629
43665
  createConicGradient: createConicGradient,
43666
+ isColor: isColor,
43630
43667
  flatArray: flatArray,
43631
43668
  isObject: isObject,
43632
43669
  getCssVariable: getCssVariable,
@@ -43634,7 +43671,11 @@
43634
43671
  getGridColor: getGridColor,
43635
43672
  getTicksColor: getTicksColor,
43636
43673
  getColors: getColors,
43637
- getTextColor: getTextColor
43674
+ getTextColor: getTextColor,
43675
+ getCssColors: getCssColors,
43676
+ isCssVar: isCssVar,
43677
+ extractCssVar: extractCssVar,
43678
+ resolveColor: resolveColor
43638
43679
  });
43639
43680
 
43640
43681
  var StatisticService = /** @class */ (function (_super) {
@@ -45445,10 +45486,8 @@
45445
45486
  // Keep the original replaceColors for processing individual values
45446
45487
  function replaceColors(data) {
45447
45488
  var e_2, _a;
45448
- if (typeof data === 'string' && (data.startsWith('var') || data.startsWith('--'))) {
45449
- var match = data.match(/var\((--[^)]+)\)/);
45450
- var value = match ? match[1] : data;
45451
- return getColor(value);
45489
+ if (isCssVar(data)) {
45490
+ return getColor(extractCssVar(data));
45452
45491
  }
45453
45492
  if (data === null || typeof data !== 'object') {
45454
45493
  return data;
@@ -45554,14 +45593,7 @@
45554
45593
  return ((_a = _optionsMap[key]) === null || _a === void 0 ? void 0 : _a.call(_optionsMap, options)) || {};
45555
45594
  };
45556
45595
  ReportConfigMapperService.prototype._prepareColors = function (colors) {
45557
- var _colors = (colors || []).map(function (color) {
45558
- var str = "" + color;
45559
- if (str.startsWith('var(')) {
45560
- var match = str.match(/^var\((--[^)]+)\)/);
45561
- return match ? getColor(match[1]) : str;
45562
- }
45563
- return str.startsWith('--') ? getColor(str) : str;
45564
- });
45596
+ var _colors = getCssColors(colors || []);
45565
45597
  return __spreadArray(__spreadArray([], __read(_colors)), __read(getColors()));
45566
45598
  };
45567
45599
  return ReportConfigMapperService;
@@ -46062,6 +46094,31 @@
46062
46094
  direction: this.direction
46063
46095
  });
46064
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
+ };
46065
46122
  return BaseGraphReport;
46066
46123
  }(BaseReport));
46067
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 });
@@ -46453,13 +46510,6 @@
46453
46510
  }));
46454
46511
  return _this;
46455
46512
  }
46456
- GraphReportComponent.prototype.ngAfterViewInit = function () {
46457
- this._setupThemeWatcher();
46458
- };
46459
- GraphReportComponent.prototype.ngOnDestroy = function () {
46460
- _super.prototype.ngOnDestroy.call(this);
46461
- this._chartThemeService.destroy();
46462
- };
46463
46513
  GraphReportComponent.prototype.changeChartType = function (type) {
46464
46514
  var _d;
46465
46515
  var _a, _b;
@@ -46480,21 +46530,6 @@
46480
46530
  this.graphChartComponent.printChart();
46481
46531
  }
46482
46532
  };
46483
- GraphReportComponent.prototype._setupThemeWatcher = function () {
46484
- var _this = this;
46485
- this._chartThemeService.theme$
46486
- .pipe(operators.filter(function (value) { return value !== _this._initialTheme && !!_this._definition; }), operators.takeUntil(this.destroy$))
46487
- .subscribe(function (theme) {
46488
- _this._initialTheme = theme;
46489
- var _a = _this._configSub.getValue(), chart = _a.chart, config = __rest(_a, ["chart"]);
46490
- var data = ___default["default"].merge({}, _this._definition, {
46491
- chart: {
46492
- type: chart.type
46493
- }
46494
- });
46495
- _this._configSub.next(_this._prepareConfig(data));
46496
- });
46497
- };
46498
46533
  return GraphReportComponent;
46499
46534
  }(BaseGraphReport));
46500
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 });
@@ -46711,21 +46746,14 @@
46711
46746
  _this._timelineService = _this.injector.get(DynamicTimelineReportService);
46712
46747
  _this._criteria$ = _this.criteria$.pipe(operators.distinctUntilChanged(function (a, b) { return ___default["default"].isEqual(a, b); }));
46713
46748
  _this.selectedGroup$ = _this._timelineService.selectedGroup$;
46714
- _this.filterCriteria$ = rxjs.combineLatest([_this._criteria$, _this._timelineService.selectedGroup$]).pipe(operators.map(function (_b) {
46715
- 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];
46716
46751
  return ___default["default"].cloneDeep(___default["default"].merge(criteria || {}, _this._timelineService.prepareSelectedGroups(_this.config)));
46717
46752
  }));
46718
46753
  _this.report$ = rxjs.combineLatest([_this.config$, _this._criteria$, _this._timelineService.rebuild$]).pipe(_this._timelineService.prepareData());
46719
46754
  _this._subscribeToLanguage();
46720
46755
  return _this;
46721
46756
  }
46722
- DynamicTimelineReportComponent.prototype.ngAfterViewInit = function () {
46723
- this._setupThemeWatcher();
46724
- };
46725
- DynamicTimelineReportComponent.prototype.ngOnDestroy = function () {
46726
- _super.prototype.ngOnDestroy.call(this);
46727
- this._chartThemeService.destroy();
46728
- };
46729
46757
  DynamicTimelineReportComponent.prototype._subscribeToLanguage = function () {
46730
46758
  var _this = this;
46731
46759
  this._translateService.onLangChange
@@ -46748,21 +46776,6 @@
46748
46776
  DynamicTimelineReportComponent.prototype.openDetails = function () {
46749
46777
  this.onOpen.emit(this._timelineService.payload);
46750
46778
  };
46751
- DynamicTimelineReportComponent.prototype._setupThemeWatcher = function () {
46752
- var _this = this;
46753
- this._chartThemeService.theme$
46754
- .pipe(operators.filter(function (value) { return value !== _this._initialTheme && !!_this._definition; }), operators.takeUntil(this.destroy$))
46755
- .subscribe(function (theme) {
46756
- _this._initialTheme = theme;
46757
- var _a = _this._configSub.getValue(), chart = _a.chart, config = __rest(_a, ["chart"]);
46758
- var data = ___default["default"].merge({}, _this._definition, {
46759
- chart: {
46760
- type: chart.type
46761
- }
46762
- });
46763
- _this._configSub.next(_this._prepareConfig(data));
46764
- });
46765
- };
46766
46779
  return DynamicTimelineReportComponent;
46767
46780
  }(BaseGraphReport));
46768
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 });