@adaptabletools/adaptable 15.4.0 → 15.4.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "15.4.0",
3
+ "version": "15.4.1",
4
4
  "description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
5
5
  "keywords": [
6
6
  "web-components",
@@ -1,2 +1,2 @@
1
- declare const _default: 1686584389051;
1
+ declare const _default: 1686647280452;
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = 1686584389051;
3
+ exports.default = 1686647280452;
@@ -113,7 +113,7 @@ function StringFormatter(input, options = {}) {
113
113
  return undefined;
114
114
  }
115
115
  if (options.Empty) {
116
- return '';
116
+ return ' ';
117
117
  }
118
118
  let s = preparedInput;
119
119
  if (options.Prefix !== undefined) {
@@ -1,5 +1,9 @@
1
1
  import { AdaptableStyle } from '../../types';
2
2
  export declare const AgGridCellStyleProperties: readonly ["backgroundColor", "color", "fontWeight", "fontStyle", "fontSize", "borderColor"];
3
+ export declare const normalizeStyleForAgGrid: (style: Record<string, any>) => {
4
+ [x: string]: any;
5
+ };
6
+ export declare const sanitizeStyle: (style: Record<string, any>) => Record<string, any>;
3
7
  export declare const convertAdaptableStyleToCSS: (style: AdaptableStyle) => {
4
8
  [cssProperty: string]: string;
5
9
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getVariableColor = exports.toStyle = exports.convertCSSAbsoluteFontSizeToPt = exports.convertAdaptableStyleToCSS = exports.AgGridCellStyleProperties = void 0;
3
+ exports.getVariableColor = exports.toStyle = exports.convertCSSAbsoluteFontSizeToPt = exports.convertAdaptableStyleToCSS = exports.sanitizeStyle = exports.normalizeStyleForAgGrid = exports.AgGridCellStyleProperties = void 0;
4
4
  const EnumExtensions_1 = require("../Extensions/EnumExtensions");
5
5
  // required for hacky fix for https://github.com/AdaptableTools/adaptable/issues/2119
6
6
  exports.AgGridCellStyleProperties = [
@@ -11,6 +11,30 @@ exports.AgGridCellStyleProperties = [
11
11
  'fontSize',
12
12
  'borderColor',
13
13
  ];
14
+ // see https://github.com/AdaptableTools/adaptable/issues/2119
15
+ // since v29 AG Grid ignores style properties with null or undefined values
16
+ // Fix: pass empty string instead of null/undefined
17
+ const normalizeStyleForAgGrid = (style) => {
18
+ const normalizedStyle = Object.assign({}, style);
19
+ exports.AgGridCellStyleProperties.forEach((cellStylePropKey) => {
20
+ if (normalizedStyle[cellStylePropKey] == null) {
21
+ normalizedStyle[cellStylePropKey] = '';
22
+ }
23
+ });
24
+ return normalizedStyle;
25
+ };
26
+ exports.normalizeStyleForAgGrid = normalizeStyleForAgGrid;
27
+ // the inverse of normalizeStyleForAgGrid, see comments above
28
+ const sanitizeStyle = (style) => {
29
+ const sanitizedStyle = {};
30
+ Object.keys(style).forEach((key) => {
31
+ if (style[key] != null && style[key] !== '') {
32
+ sanitizedStyle[key] = style[key];
33
+ }
34
+ });
35
+ return sanitizedStyle;
36
+ };
37
+ exports.sanitizeStyle = sanitizeStyle;
14
38
  const convertAdaptableStyleToCSS = (style) => {
15
39
  let result = {};
16
40
  if (style.BackColor !== undefined && style.BackColor !== null) {
@@ -3277,13 +3277,7 @@ class Adaptable {
3277
3277
  const cellStyle = (params) => {
3278
3278
  const isQuickSearchActive = hasQuickSearchStyle && this.isQuickSearchActive(abColumn, params);
3279
3279
  const result = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, this.getReadOnlyCellStyle(abColumn, params)), this.getEditableCellStyle(abColumn, params)), (typeof userCellStyle === 'function' ? userCellStyle(params) : userCellStyle)), this.getFormatColumnAndStyledColumnCellStyle(abColumn, colId, params)), (isQuickSearchActive ? quickSearchStyle : {})), this.getAlertCellStyle(abColumn, params)), this.getFlashingCellStyle(abColumn, params)), this.getCellHighlightStyle(abColumn, params));
3280
- // see https://github.com/AdaptableTools/adaptable/issues/2119
3281
- StyleHelper_1.AgGridCellStyleProperties.forEach((cellStylePropKey) => {
3282
- if (result[cellStylePropKey] == null) {
3283
- result[cellStylePropKey] = '';
3284
- }
3285
- });
3286
- return result;
3280
+ return (0, StyleHelper_1.normalizeStyleForAgGrid)(result);
3287
3281
  };
3288
3282
  return cellStyle;
3289
3283
  });
@@ -3614,7 +3608,7 @@ class Adaptable {
3614
3608
  }
3615
3609
  // we allowed it go reach this point
3616
3610
  // just to run isCellEditable
3617
- // and since this has already run and we have no other valitaions
3611
+ // and since this has already run and we have no other validations
3618
3612
  // just assign the new value and exit
3619
3613
  if (field) {
3620
3614
  params.data[field] = params.newValue;
@@ -4654,8 +4648,9 @@ class Adaptable {
4654
4648
  }
4655
4649
  return result;
4656
4650
  }, {}));
4657
- if (Object.values(adaptableStyle).some((style) => style != null)) {
4658
- excelStyles.push(this.convertCSSToExcelStyle(adaptableStyle));
4651
+ const sanitizedAdaptableStyle = (0, StyleHelper_1.sanitizeStyle)(adaptableStyle);
4652
+ if (Object.values(sanitizedAdaptableStyle).some((style) => style != null)) {
4653
+ excelStyles.push(this.convertCSSToExcelStyle(sanitizedAdaptableStyle));
4659
4654
  }
4660
4655
  const excelDataType = this.api.exportApi.internalApi.getExcelDataType(colDef === null || colDef === void 0 ? void 0 : colDef.type);
4661
4656
  const rawValue = this.getRawValueFromRowNode(node, column.getId());
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "15.4.0";
1
+ declare const _default: "15.4.1";
2
2
  export default _default;
package/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '15.4.0'; // PLEASE DONT UPDATE THIS!!! - will be updated at build time with the correct version
3
+ exports.default = '15.4.1'; // PLEASE DONT UPDATE THIS!!! - will be updated at build time with the correct version