@adaptabletools/adaptable 13.0.0-canary.11 → 13.0.0-canary.13

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 (100) hide show
  1. package/bundle.cjs.js +169 -169
  2. package/package.json +1 -1
  3. package/publishTimestamp.d.ts +1 -1
  4. package/publishTimestamp.js +1 -1
  5. package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -0
  6. package/src/AdaptableOptions/AdaptableQLOptions.d.ts +20 -3
  7. package/src/AdaptableOptions/LayoutOptions.d.ts +2 -1
  8. package/src/Api/AdaptableApi.d.ts +2 -0
  9. package/src/Api/ColumnApi.d.ts +7 -1
  10. package/src/Api/FormatColumnApi.d.ts +2 -23
  11. package/src/Api/Implementation/AdaptableApiImpl.d.ts +2 -0
  12. package/src/Api/Implementation/AdaptableApiImpl.js +2 -0
  13. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
  14. package/src/Api/Implementation/ColumnApiImpl.js +8 -2
  15. package/src/Api/Implementation/FormatColumnApiImpl.d.ts +1 -6
  16. package/src/Api/Implementation/FormatColumnApiImpl.js +15 -115
  17. package/src/Api/Implementation/StyledColumnApiImpl.d.ts +19 -0
  18. package/src/Api/Implementation/StyledColumnApiImpl.js +134 -0
  19. package/src/Api/StyledColumnApi.d.ts +68 -0
  20. package/src/Api/StyledColumnApi.js +2 -0
  21. package/src/PredefinedConfig/AdaptableState.d.ts +2 -0
  22. package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
  23. package/src/PredefinedConfig/Common/Types.d.ts +3 -3
  24. package/src/PredefinedConfig/Common/Types.js +1 -0
  25. package/src/PredefinedConfig/PredefinedConfig.d.ts +5 -0
  26. package/src/PredefinedConfig/StyledColumnState.d.ts +113 -0
  27. package/src/PredefinedConfig/StyledColumnState.js +2 -0
  28. package/src/Redux/ActionsReducers/StyledColumnRedux.d.ts +49 -0
  29. package/src/Redux/ActionsReducers/StyledColumnRedux.js +92 -0
  30. package/src/Redux/Store/AdaptableStore.js +7 -0
  31. package/src/Strategy/StyledColumnModule.d.ts +24 -0
  32. package/src/Strategy/StyledColumnModule.js +165 -0
  33. package/src/Strategy/Utilities/getScopeViewItems.js +1 -1
  34. package/src/Utilities/Constants/ModuleConstants.d.ts +3 -0
  35. package/src/Utilities/Constants/ModuleConstants.js +4 -1
  36. package/src/Utilities/Defaults/DefaultSettingsPanel.js +1 -0
  37. package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.d.ts +1 -4
  38. package/src/Utilities/ObjectFactory.d.ts +3 -0
  39. package/src/Utilities/ObjectFactory.js +11 -3
  40. package/src/Utilities/Services/ModuleService.js +3 -1
  41. package/src/View/CalculatedColumn/CalculatedColumnSummary.d.ts +1 -1
  42. package/src/View/Components/RangesComponent.d.ts +1 -0
  43. package/src/View/Components/RangesComponent.js +19 -19
  44. package/src/View/Components/Selectors/ColumnSelector.d.ts +1 -0
  45. package/src/View/Components/Selectors/ColumnSelector.js +2 -1
  46. package/src/View/Components/StyleComponent.js +2 -2
  47. package/src/View/Components/ToolPanel/AdaptableToolPanel.d.ts +1 -11
  48. package/src/View/Components/ToolPanel/AdaptableToolPanel.js +21 -9
  49. package/src/View/Components/ToolPanel/CustomToolPanelContent.js +1 -1
  50. package/src/View/Components/ToolPanel/ToolPanelPopup.d.ts +1 -1
  51. package/src/View/DataSet/DataSetViewPanel.d.ts +1 -1
  52. package/src/View/Export/ExportViewPanel.d.ts +1 -1
  53. package/src/View/Filter/FilterSummary.d.ts +1 -1
  54. package/src/View/Filter/FilterViewPanel.d.ts +1 -1
  55. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.d.ts +3 -3
  56. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +6 -315
  57. package/src/View/Layout/LayoutViewPanel.d.ts +1 -1
  58. package/src/View/Layout/Wizard/sections/AggregationsSection.js +1 -1
  59. package/src/View/Layout/Wizard/sections/ColumnsSection.js +2 -1
  60. package/src/View/Query/QueryViewPanel.d.ts +1 -1
  61. package/src/View/QuickSearch/QuickSearchViewPanel.d.ts +1 -1
  62. package/src/View/StyledColumn/Wizard/StyledColumnWizard.d.ts +7 -0
  63. package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +77 -0
  64. package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.d.ts +9 -0
  65. package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.js +65 -0
  66. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection.d.ts +9 -0
  67. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection.js +238 -0
  68. package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.d.ts +7 -0
  69. package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.js +59 -0
  70. package/src/View/SystemStatus/SystemStatusViewPanel.d.ts +1 -1
  71. package/src/View/Wizard/OnePageAdaptableWizard.d.ts +1 -1
  72. package/src/agGrid/Adaptable.d.ts +5 -2
  73. package/src/agGrid/Adaptable.js +73 -40
  74. package/src/agGrid/FilterWrapper.js +58 -15
  75. package/src/agGrid/FloatingFilterWrapper.d.ts +2 -2
  76. package/src/agGrid/FloatingFilterWrapper.js +71 -32
  77. package/src/agGrid/PercentBarRenderer.d.ts +6 -2
  78. package/src/agGrid/PercentBarRenderer.js +10 -18
  79. package/src/agGrid/agGridHelper.d.ts +6 -2
  80. package/src/agGrid/agGridHelper.js +4 -2
  81. package/src/agGrid/createAgStatusPanelComponent.d.ts +1 -1
  82. package/src/agGrid/createAgStatusPanelComponent.js +17 -0
  83. package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +4 -1
  84. package/src/agGrid/editors/AdaptableDateEditor/index.js +84 -17
  85. package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +1 -1
  86. package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +2 -3
  87. package/src/agGrid/editors/AdaptableNumberEditor/index.js +78 -27
  88. package/src/components/Datepicker/index.d.ts +1 -1
  89. package/src/components/icons/brush.d.ts +3 -0
  90. package/src/components/icons/brush.js +7 -0
  91. package/src/components/icons/index.js +2 -0
  92. package/src/metamodel/adaptable.metamodel.d.ts +56 -20
  93. package/src/metamodel/adaptable.metamodel.js +1 -1
  94. package/src/renderReactRoot.d.ts +2 -0
  95. package/src/renderReactRoot.js +11 -9
  96. package/src/types.d.ts +3 -1
  97. package/version.d.ts +1 -1
  98. package/version.js +1 -1
  99. package/src/AdaptableComponents.d.ts +0 -1
  100. package/src/AdaptableComponents.js +0 -5
@@ -1,26 +1,72 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FilterWrapperFactory = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const react_1 = require("react");
4
7
  const FilterForm_1 = require("../View/Components/FilterForm/FilterForm");
5
8
  let FilterWrapperFactory = (adaptable) => {
9
+ function isFilterActive(colId) {
10
+ // we need this here
11
+ if (adaptable.isDestroyed) {
12
+ return false;
13
+ }
14
+ //make the small filter icon to appear when there is a filter
15
+ return adaptable.api.filterApi.getColumnFilters().findIndex((x) => x.ColumnId == colId) > -1;
16
+ }
17
+ function getFilterContext(colId, hidePopup) {
18
+ let column = adaptable.api.columnApi.getColumnFromId(colId);
19
+ let filterContext = {
20
+ Column: column,
21
+ Adaptable: adaptable,
22
+ ShowCloseButton: hidePopup,
23
+ };
24
+ return filterContext;
25
+ }
26
+ function getContainerId(colId) {
27
+ return 'filter_' + colId + '_' + adaptable.adaptableOptions.adaptableId;
28
+ }
29
+ if (adaptable.variant === 'react') {
30
+ return (0, react_1.forwardRef)(function ReactFilterWrapper(props, ref) {
31
+ const [filterContext, setFilterContext] = (0, react_1.useState)(null);
32
+ const colId = props.column.getId();
33
+ const column = adaptable.api.columnApi.getColumnFromId(colId);
34
+ (0, react_1.useImperativeHandle)(ref, () => {
35
+ return {
36
+ isFilterActive: () => isFilterActive(colId),
37
+ afterGuiAttached: (params) => {
38
+ var _a;
39
+ const hidePopup = (_a = params === null || params === void 0 ? void 0 : params.hidePopup) !== null && _a !== void 0 ? _a : null;
40
+ const filterContext = getFilterContext(colId, !!hidePopup);
41
+ adaptable.hideFilterFormPopup = hidePopup;
42
+ setFilterContext(filterContext);
43
+ },
44
+ getModel: () => { },
45
+ setModel: () => { },
46
+ //we do not filter here.... we filter using the doesExternalFilterPass. Not sure there is a difference....
47
+ doesFilterPass: () => true,
48
+ };
49
+ });
50
+ if (!column || !filterContext) {
51
+ return null;
52
+ }
53
+ return React.createElement("div", { id: getContainerId(colId) }, (0, FilterForm_1.FilterFormReact)(filterContext));
54
+ });
55
+ }
6
56
  return class FilterWrapper {
7
57
  init(params) {
8
58
  this.params = params;
9
59
  this.column = params.column;
10
60
  this.filterContainer = document.createElement('div');
11
- this.filterContainer.id =
12
- 'filter_' + this.params.column.getColId() + '_' + adaptable.adaptableOptions.adaptableId;
13
- }
14
- isFilterActive() {
15
- //make the small filter icon to appear when there is a filter
16
- return (adaptable.api.filterApi
17
- .getColumnFilters()
18
- .findIndex((x) => x.ColumnId == this.params.column.getColId()) > -1);
61
+ this.filterContainer.id = getContainerId(this.params.column.getColId());
19
62
  }
20
63
  doesFilterPass(params) {
21
64
  //we do not filter here.... we filter using the doesExternalFilterPass. Not sure there is a difference....
22
65
  return true;
23
66
  }
67
+ isFilterActive() {
68
+ return isFilterActive(this.params.column.getColId());
69
+ }
24
70
  getModel() {
25
71
  //
26
72
  }
@@ -31,17 +77,14 @@ let FilterWrapperFactory = (adaptable) => {
31
77
  return this.filterContainer;
32
78
  }
33
79
  afterGuiAttached(params) {
34
- var _a;
80
+ var _a, _b;
35
81
  //we always unmount first so the autofocus from the form works... in other grids we unmount when hidden
36
82
  (_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
37
83
  let column = adaptable.api.columnApi.getColumnFromId(this.column.getColId());
38
84
  if (column) {
39
- let filterContext = {
40
- Column: column,
41
- Adaptable: adaptable,
42
- ShowCloseButton: params != null && params.hidePopup != null,
43
- };
44
- adaptable.hideFilterFormPopup = params ? params.hidePopup : null;
85
+ const hidePopup = (_b = params === null || params === void 0 ? void 0 : params.hidePopup) !== null && _b !== void 0 ? _b : null;
86
+ const filterContext = getFilterContext(this.column.getColId(), !!hidePopup);
87
+ adaptable.hideFilterFormPopup = hidePopup;
45
88
  this.unmountReactRoot = adaptable.renderReactRoot((0, FilterForm_1.FilterFormReact)(filterContext), this.filterContainer);
46
89
  }
47
90
  }
@@ -1,2 +1,2 @@
1
- import { Adaptable } from './Adaptable';
2
- export declare const FloatingFilterWrapperFactory: (adaptable: Adaptable) => any;
1
+ import { IAdaptable } from '../AdaptableInterfaces/IAdaptable';
2
+ export declare const FloatingFilterWrapperFactory: (adaptable: IAdaptable) => any;
@@ -1,43 +1,82 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FloatingFilterWrapperFactory = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const react_1 = require("react");
4
7
  const QuickFilterForm_1 = require("../View/Components/FilterForm/QuickFilterForm");
5
- const FloatingFilterWrapperFactory = (adaptable) => class FloatingFilterWrapper {
6
- onParentModelChanged(parentModel, filterChangedEvent) {
7
- // todo?
8
- }
9
- afterGuiAttached(params) {
10
- // todo: consider theme
11
- this.filterContainer.parentElement.style.overflow = 'visible';
12
- this.filterContainer.parentElement.parentElement.style.padding = 'var(--ab-space-1)';
8
+ const filterContainerStyle = {
9
+ overflow: 'hidden',
10
+ minWidth: '0',
11
+ height: '100%',
12
+ display: 'flex',
13
+ alignItems: 'stretch',
14
+ position: 'relative',
15
+ };
16
+ const FloatingFilterWrapperFactory = (adaptable) => {
17
+ function getContainerId(colId) {
18
+ return `floatingFilter_${colId}_${adaptable.adaptableOptions.adaptableId}`;
13
19
  }
14
- init(params) {
15
- const colId = params.column.getColId();
16
- this.filterContainer = document.createElement('div');
17
- this.filterContainer.id = `floatingFilter_${colId}_${adaptable.adaptableOptions.adaptableId}`;
18
- this.filterContainer.style.overflow = 'hidden';
19
- this.filterContainer.style.minWidth = '0';
20
- this.filterContainer.style.height = '100%';
21
- this.filterContainer.style.display = 'flex';
22
- this.filterContainer.style.alignItems = 'stretch';
23
- this.filterContainer.style.position = 'relative';
20
+ function getFilterContext(colId) {
24
21
  const column = adaptable.api.columnApi.getColumnFromId(colId);
25
- if (column) {
26
- const filterContext = {
27
- Column: column,
28
- Adaptable: adaptable,
29
- ShowCloseButton: false,
30
- };
31
- this.unmountReactRoot = adaptable.renderReactRoot((0, QuickFilterForm_1.QuickFilterFormReact)(filterContext), this.filterContainer);
32
- }
22
+ const filterContext = {
23
+ Column: column,
24
+ Adaptable: adaptable,
25
+ ShowCloseButton: false,
26
+ };
27
+ return filterContext;
33
28
  }
34
- getGui() {
35
- return this.filterContainer;
29
+ function patchParentElement(filterContainer) {
30
+ if (filterContainer) {
31
+ // todo: consider theme
32
+ filterContainer.parentElement.style.overflow = 'visible';
33
+ filterContainer.parentElement.parentElement.style.padding = 'var(--ab-space-1)';
34
+ }
36
35
  }
37
- destroy() {
38
- var _a;
39
- (_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
40
- this.filterContainer = null;
36
+ if (adaptable.variant === 'react') {
37
+ return (0, react_1.forwardRef)(function ReactFloatingFilterWrapper(props, ref) {
38
+ const colId = props.column.getId();
39
+ const column = adaptable.api.columnApi.getColumnFromId(colId);
40
+ (0, react_1.useImperativeHandle)(ref, () => {
41
+ return {
42
+ onParentModelChanged() { },
43
+ };
44
+ });
45
+ if (!column) {
46
+ return null;
47
+ }
48
+ return (React.createElement("div", { ref: patchParentElement, id: getContainerId(colId), style: filterContainerStyle }, (0, QuickFilterForm_1.QuickFilterFormReact)(getFilterContext(colId))));
49
+ });
41
50
  }
51
+ return class FloatingFilterWrapper {
52
+ onParentModelChanged(parentModel, filterChangedEvent) {
53
+ // todo?
54
+ }
55
+ afterGuiAttached() {
56
+ patchParentElement(this.filterContainer);
57
+ }
58
+ init(params) {
59
+ const colId = params.column.getColId();
60
+ this.filterContainer = document.createElement('div');
61
+ this.filterContainer.id = getContainerId(colId);
62
+ Object.keys(filterContainerStyle).forEach((key) => {
63
+ //@ts-ignore
64
+ this.filterContainer.style[key] = filterContainerStyle[key];
65
+ });
66
+ const column = adaptable.api.columnApi.getColumnFromId(colId);
67
+ if (column) {
68
+ const filterContext = getFilterContext(colId);
69
+ this.unmountReactRoot = adaptable.renderReactRoot((0, QuickFilterForm_1.QuickFilterFormReact)(filterContext), this.filterContainer);
70
+ }
71
+ }
72
+ getGui() {
73
+ return this.filterContainer;
74
+ }
75
+ destroy() {
76
+ var _a;
77
+ (_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
78
+ this.filterContainer = null;
79
+ }
80
+ };
42
81
  };
43
82
  exports.FloatingFilterWrapperFactory = FloatingFilterWrapperFactory;
@@ -1,4 +1,8 @@
1
- import { FormatColumn } from '../PredefinedConfig/FormatColumnState';
1
+ import { GradientStyle, PercentBarStyle } from '../PredefinedConfig/FormatColumnState';
2
2
  import { AdaptableApi } from '../Api/AdaptableApi';
3
3
  import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
4
- export declare const getPercentBarRendererForColumn: (formatColumn: FormatColumn, abColumn: AdaptableColumn, api: AdaptableApi) => any;
4
+ export declare const getPercentBarRendererForColumn: (columnStyle: {
5
+ GradientStyle?: GradientStyle;
6
+ PercentBarStyle?: PercentBarStyle;
7
+ CheckBoxStyle?: boolean;
8
+ }, abColumn: AdaptableColumn, api: AdaptableApi) => any;
@@ -4,19 +4,14 @@ exports.getPercentBarRendererForColumn = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const Helper_1 = tslib_1.__importDefault(require("../Utilities/Helpers/Helper"));
6
6
  const clamp_1 = tslib_1.__importDefault(require("lodash/clamp"));
7
- const FormatHelper_1 = tslib_1.__importDefault(require("../Utilities/Helpers/FormatHelper"));
8
- const getPercentBarRendererForColumn = (formatColumn, abColumn, api) => {
9
- var _a;
10
- if (!((_a = formatColumn === null || formatColumn === void 0 ? void 0 : formatColumn.ColumnStyle) === null || _a === void 0 ? void 0 : _a.PercentBarStyle)) {
7
+ const getPercentBarRendererForColumn = (columnStyle, abColumn, api) => {
8
+ if (!columnStyle.PercentBarStyle) {
11
9
  return;
12
10
  }
13
11
  return class PercentBarRenderer {
14
12
  init(params) {
15
- if (!formatColumn.IncludeGroupedRows && api.gridApi.isGroupRowNode(params.node)) {
16
- return;
17
- }
18
- const min = api.formatColumnApi.getNumericStyleMinValue(formatColumn.ColumnStyle, abColumn, params.node, params.value);
19
- const max = api.formatColumnApi.getNumericStyleMaxValue(formatColumn.ColumnStyle, abColumn, params.node, params.value);
13
+ const min = api.styledColumnApi.getNumericStyleMinValue(columnStyle, abColumn, params.node, params.value);
14
+ const max = api.styledColumnApi.getNumericStyleMaxValue(columnStyle, abColumn, params.node, params.value);
20
15
  let value = params.value;
21
16
  if (Helper_1.default.objectNotExists(value)) {
22
17
  value = 0;
@@ -24,12 +19,16 @@ const getPercentBarRendererForColumn = (formatColumn, abColumn, api) => {
24
19
  const clampedValue = (0, clamp_1.default)(value, min, max);
25
20
  const percentageValue = ((clampedValue - min) / (max - min)) * 100;
26
21
  let cellBackColor;
27
- const percentBarStyle = formatColumn.ColumnStyle.PercentBarStyle;
22
+ const percentBarStyle = columnStyle.PercentBarStyle;
28
23
  if (percentBarStyle.ColumnComparison) {
29
24
  cellBackColor = percentBarStyle.ColumnComparison.Color;
30
25
  }
31
26
  else {
32
- const matchingRange = percentBarStyle.CellRanges.find((r) => r.Min <= clampedValue && r.Max >= clampedValue);
27
+ const matchingRange = percentBarStyle.CellRanges.find((r) => {
28
+ const rMin = r.Min === 'Col-Min' ? min : r.Min;
29
+ const rMax = r.Max === 'Col-Max' ? max : r.Max;
30
+ return rMin <= clampedValue && rMax >= clampedValue;
31
+ });
33
32
  if (matchingRange) {
34
33
  cellBackColor = matchingRange.Color;
35
34
  }
@@ -57,13 +56,6 @@ const getPercentBarRendererForColumn = (formatColumn, abColumn, api) => {
57
56
  textEl.className = 'ab-PercentBar__text';
58
57
  textEl.style.lineHeight = '1.2';
59
58
  if (percentBarStyle.CellText.includes('CellValue')) {
60
- if (formatColumn.DisplayFormat) {
61
- const options = formatColumn.DisplayFormat
62
- .Options;
63
- if (options) {
64
- value = FormatHelper_1.default.NumberFormatter(params.value, options);
65
- }
66
- }
67
59
  textEl.innerText = value;
68
60
  }
69
61
  if (percentBarStyle.CellText.includes('PercentageValue')) {
@@ -5,7 +5,7 @@ import { AdaptableNodeComparerFunction } from '../PredefinedConfig/Common/Adapta
5
5
  import { AdaptableColumnType, AdaptableModule } from '../PredefinedConfig/Common/Types';
6
6
  import { IModule } from '../Strategy/Interface/IModule';
7
7
  import { IPPStyle } from '../Utilities/Interface/IPPStyle';
8
- import { FormatColumn } from '../PredefinedConfig/FormatColumnState';
8
+ import { GradientStyle, PercentBarStyle } from '../PredefinedConfig/FormatColumnState';
9
9
  /**
10
10
  * Adaptable AG Grid implementation is getting really big and unwieldy
11
11
  * So lets put some of the more obvious 'Helper' functions here
@@ -22,7 +22,11 @@ export declare class agGridHelper {
22
22
  setUpModules(): Map<AdaptableModule, IModule>;
23
23
  TrySetUpNodeIds(hasAutogeneratedPrimaryKey: boolean): boolean;
24
24
  createCheckboxRendererComp(columnId: string, isColumnReadOnly: boolean): ICellRendererFunc | undefined;
25
- createPercentBarRendererComp(formatColumn: FormatColumn, abColumn: AdaptableColumn): ICellRendererFunc;
25
+ createPercentBarRendererComp(columnStyle: {
26
+ GradientStyle?: GradientStyle;
27
+ PercentBarStyle?: PercentBarStyle;
28
+ CheckBoxStyle?: boolean;
29
+ }, abColumn: AdaptableColumn): ICellRendererFunc;
26
30
  getCleanValue(value: string): string | undefined;
27
31
  getRenderedValue(colDef: ColDef, valueToRender: any): any;
28
32
  createAdaptableColumnFromAgGridColumn(agGridColumn: Column, colsToGroups: Record<string, AdaptableColumnGroup>): AdaptableColumn;
@@ -43,6 +43,7 @@ const StatusBarModule_1 = require("../Strategy/StatusBarModule");
43
43
  const GeneralConstants = tslib_1.__importStar(require("../Utilities/Constants/GeneralConstants"));
44
44
  const GeneralConstants_1 = require("../Utilities/Constants/GeneralConstants");
45
45
  const UIHelper_1 = tslib_1.__importDefault(require("../View/UIHelper"));
46
+ const StyledColumnModule_1 = require("../Strategy/StyledColumnModule");
46
47
  const tinycolor = require('tinycolor2');
47
48
  /**
48
49
  * Adaptable AG Grid implementation is getting really big and unwieldy
@@ -104,6 +105,7 @@ class agGridHelper {
104
105
  modules.set(ModuleConstants.SettingsPanelModuleId, new SettingsPanelModule_1.SettingsPanelModule(api));
105
106
  modules.set(ModuleConstants.StatusBarModuleId, new StatusBarModule_1.StatusBarModule(api));
106
107
  modules.set(ModuleConstants.ChartingModuleId, new ChartingModule_1.ChartingModule(api));
108
+ modules.set(ModuleConstants.StyledColumnModuleId, new StyledColumnModule_1.StyledColumnModule(api));
107
109
  return modules;
108
110
  }
109
111
  TrySetUpNodeIds(hasAutogeneratedPrimaryKey) {
@@ -150,8 +152,8 @@ class agGridHelper {
150
152
  createCheckboxRendererComp(columnId, isColumnReadOnly) {
151
153
  return (0, CheckboxRenderer_1.getCheckboxRendererForColumn)(columnId, isColumnReadOnly, this.adaptable.api);
152
154
  }
153
- createPercentBarRendererComp(formatColumn, abColumn) {
154
- return (0, PercentBarRenderer_1.getPercentBarRendererForColumn)(formatColumn, abColumn, this.adaptable.api);
155
+ createPercentBarRendererComp(columnStyle, abColumn) {
156
+ return (0, PercentBarRenderer_1.getPercentBarRendererForColumn)(columnStyle, abColumn, this.adaptable.api);
155
157
  }
156
158
  getCleanValue(value) {
157
159
  if (value == null || value == 'null' || value == undefined || value == 'undefined') {
@@ -9,7 +9,7 @@ export interface StatusPanelProps {
9
9
  Key: string;
10
10
  };
11
11
  }
12
- export declare const createAgStatusPanelComponent: (component: React.FunctionComponent<StatusPanelProps>, adaptable: IAdaptable, context: StatusPanelProps['context']) => {
12
+ export declare const createAgStatusPanelComponent: (component: React.FunctionComponent<StatusPanelProps>, adaptable: IAdaptable, context: StatusPanelProps['context']) => ((props: IStatusPanelParams) => JSX.Element) | {
13
13
  new (): {
14
14
  params: IStatusPanelParams;
15
15
  eGui: HTMLElement;
@@ -5,6 +5,23 @@ const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
6
  const renderWithAdaptableContext_1 = require("../View/renderWithAdaptableContext");
7
7
  const createAgStatusPanelComponent = (component, adaptable, context) => {
8
+ if (adaptable.variant === 'react') {
9
+ return (props) => {
10
+ const children = (0, renderWithAdaptableContext_1.renderWithAdaptableContext)(React.createElement(component, {
11
+ params: props,
12
+ adaptableApi: adaptable.api,
13
+ context,
14
+ }), adaptable);
15
+ return (React.createElement("div", { className: "ab-StatusBar", ref: (node) => {
16
+ if (node) {
17
+ // in React rendering, ag-grid renders an additional extra div
18
+ // around the status panel container, with className of 'ag-react-container'
19
+ // which needs to be stretched in order to fill the status panel
20
+ node.parentElement.style.display = 'flex';
21
+ }
22
+ } }, children));
23
+ };
24
+ }
8
25
  return class StatusBarRenderer {
9
26
  init(params) {
10
27
  this.params = params;
@@ -1,5 +1,9 @@
1
+ import * as React from 'react';
1
2
  import { ICellEditorParams, ICellEditorComp } from '@ag-grid-community/core';
2
3
  import { IAdaptable } from '../../../AdaptableInterfaces/IAdaptable';
4
+ export declare const ReactAdaptableDateEditor: React.ForwardRefExoticComponent<ICellEditorParams<any, any> & {
5
+ showClearButton?: boolean;
6
+ } & React.RefAttributes<unknown>>;
3
7
  /**
4
8
  * Used by default for all `abColDefDate` columns.
5
9
  *
@@ -38,5 +42,4 @@ export declare class AdaptableDateEditor implements ICellEditorComp {
38
42
  getAdaptableInstance(params: ICellEditorParams): IAdaptable;
39
43
  afterGuiAttached(): void;
40
44
  destroy(): void;
41
- private shouldClearExistingValue;
42
45
  }
@@ -1,12 +1,88 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AdaptableDateEditor = void 0;
3
+ exports.AdaptableDateEditor = exports.ReactAdaptableDateEditor = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
6
  const renderWithAdaptableContext_1 = require("../../../View/renderWithAdaptableContext");
7
7
  const InternalAdaptableDateEditor_1 = require("./InternalAdaptableDateEditor");
8
8
  const core_1 = require("@ag-grid-community/core");
9
9
  const FormatHelper_1 = require("../../../Utilities/Helpers/FormatHelper");
10
+ const react_1 = require("react");
11
+ function shouldClearExistingValue(params) {
12
+ return params.eventKey === core_1.KeyCode.BACKSPACE || params.eventKey === core_1.KeyCode.DELETE;
13
+ }
14
+ function getStartValue(params) {
15
+ return shouldClearExistingValue(params) ? '' : params.value;
16
+ }
17
+ const style = {
18
+ position: 'absolute',
19
+ top: '0px',
20
+ left: '0px',
21
+ right: '0px',
22
+ bottom: '0px',
23
+ };
24
+ const defaultDateValueParser = ({ newValue, oldValue, defaultParser }) => {
25
+ if ((typeof oldValue === 'string' || oldValue == null) && defaultParser) {
26
+ return defaultParser(newValue);
27
+ }
28
+ return newValue;
29
+ };
30
+ exports.ReactAdaptableDateEditor = (0, react_1.forwardRef)((props, ref) => {
31
+ var _a;
32
+ const [initialValue] = (0, react_1.useState)(() => getStartValue(props));
33
+ const valueRef = (0, react_1.useRef)(initialValue);
34
+ const colValueParser = props.column.getColDef().valueParser;
35
+ const valueParser = typeof colValueParser === 'function' ? colValueParser : defaultDateValueParser;
36
+ const adaptable = props.api.__adaptable;
37
+ const editorRef = (0, react_1.useRef)(null);
38
+ (0, react_1.useImperativeHandle)(ref, () => {
39
+ return {
40
+ focusIn() {
41
+ var _a;
42
+ (_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.focus();
43
+ },
44
+ // the final value to send to the grid, on completion of editing
45
+ getValue() {
46
+ return valueRef.current;
47
+ },
48
+ };
49
+ });
50
+ const editorElement = (React.createElement(InternalAdaptableDateEditor_1.InternalAdaptableDateEditor, { defaultValue: initialValue, dateFormat: adaptable.adaptableOptions.userInterfaceOptions.dateInputOptions.dateFormat, onValueChange: (value) => {
51
+ const invalid = isNaN(+value);
52
+ if (valueParser) {
53
+ const params = Object.assign(Object.assign({}, props), { oldValue: props.value, newValue: value, defaultParser: (value) => {
54
+ var _a, _b;
55
+ const Pattern = (_b = (_a = adaptable.adaptableOptions.userInterfaceOptions) === null || _a === void 0 ? void 0 : _a.dateInputOptions) === null || _b === void 0 ? void 0 : _b.dateFormat;
56
+ if (!Pattern) {
57
+ return value;
58
+ }
59
+ return (0, FormatHelper_1.DateFormatter)(value, {
60
+ Pattern,
61
+ });
62
+ } });
63
+ valueRef.current = valueParser(params);
64
+ }
65
+ else {
66
+ valueRef.current = invalid ? null : value;
67
+ }
68
+ if (!invalid) {
69
+ requestAnimationFrame(() => {
70
+ props.stopEditing();
71
+ });
72
+ }
73
+ }, showClearButton: (_a = props.showClearButton) !== null && _a !== void 0 ? _a : true, onStopEdit: (keyboardEventKey) => {
74
+ if (keyboardEventKey === 'Escape') {
75
+ props.api.stopEditing(true);
76
+ }
77
+ else {
78
+ props.stopEditing();
79
+ }
80
+ }, ref: (editor) => {
81
+ editorRef.current = editor;
82
+ editor === null || editor === void 0 ? void 0 : editor.focus();
83
+ } }));
84
+ return React.createElement("div", { style: style }, (0, renderWithAdaptableContext_1.renderWithAdaptableContext)(editorElement, adaptable));
85
+ });
10
86
  /**
11
87
  * Used by default for all `abColDefDate` columns.
12
88
  *
@@ -32,26 +108,20 @@ const FormatHelper_1 = require("../../../Utilities/Helpers/FormatHelper");
32
108
  */
33
109
  class AdaptableDateEditor {
34
110
  constructor() {
35
- this.valueParser = ({ newValue, oldValue, defaultParser }) => {
36
- if ((typeof oldValue === 'string' || oldValue == null) && defaultParser) {
37
- return defaultParser(newValue);
38
- }
39
- return newValue;
40
- };
111
+ this.valueParser = defaultDateValueParser;
41
112
  }
42
113
  init(params) {
43
- this.value = this.shouldClearExistingValue(params) ? '' : params.value;
114
+ this.value = getStartValue(params);
44
115
  const { valueParser } = params.column.getColDef();
45
116
  this.params = params;
46
117
  if (typeof valueParser === 'function') {
47
118
  this.valueParser = valueParser;
48
119
  }
49
120
  this.el = document.createElement('div');
50
- this.el.style.position = 'absolute';
51
- this.el.style.top = '0px';
52
- this.el.style.left = '0px';
53
- this.el.style.right = '0px';
54
- this.el.style.bottom = '0px';
121
+ Object.keys(style).forEach((key) => {
122
+ //@ts-ignore
123
+ this.el.style[key] = style[key];
124
+ });
55
125
  }
56
126
  /* Component Editor Lifecycle methods */
57
127
  // gets called once when grid ready to insert the element
@@ -75,7 +145,7 @@ class AdaptableDateEditor {
75
145
  afterGuiAttached() {
76
146
  var _a;
77
147
  const adaptable = this.getAdaptableInstance(this.params);
78
- const defaultValue = this.shouldClearExistingValue(this.params) ? '' : this.params.value;
148
+ const defaultValue = shouldClearExistingValue(this.params) ? '' : this.params.value;
79
149
  const editorElement = (React.createElement(InternalAdaptableDateEditor_1.InternalAdaptableDateEditor, { defaultValue: defaultValue, dateFormat: adaptable.adaptableOptions.userInterfaceOptions.dateInputOptions.dateFormat, onValueChange: (value) => {
80
150
  const invalid = isNaN(+value);
81
151
  if (this.valueParser) {
@@ -116,8 +186,5 @@ class AdaptableDateEditor {
116
186
  var _a;
117
187
  (_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
118
188
  }
119
- shouldClearExistingValue(params) {
120
- return params.eventKey === core_1.KeyCode.BACKSPACE || params.eventKey === core_1.KeyCode.DELETE;
121
- }
122
189
  }
123
190
  exports.AdaptableDateEditor = AdaptableDateEditor;
@@ -22,7 +22,7 @@ const inputStyle = {
22
22
  width: '100%',
23
23
  border: 'none',
24
24
  };
25
- exports.InternalAdaptableNumberEditor = React.forwardRef((props, ref) => {
25
+ exports.InternalAdaptableNumberEditor = React.forwardRef(function InternalAdaptableNumberEditorFn(props, ref) {
26
26
  var _a;
27
27
  const inputRef = React.useRef(null);
28
28
  const focus = () => {
@@ -1,3 +1,4 @@
1
+ import * as React from 'react';
1
2
  import { ICellEditorComp, ICellEditorParams } from '@ag-grid-community/core';
2
3
  /**
3
4
  * Adaptable number editor parameters extending the AG Grid {@link ICellEditorParams}.
@@ -14,6 +15,7 @@ interface AdaptableNumberCellEditorParams extends ICellEditorParams {
14
15
  */
15
16
  emptyValue: string;
16
17
  }
18
+ export declare const ReactAdaptableNumberEditor: React.ForwardRefExoticComponent<AdaptableNumberCellEditorParams & React.RefAttributes<unknown>>;
17
19
  /**
18
20
  * Used by default for all `abColDefNumber` columns.
19
21
  *
@@ -51,8 +53,5 @@ export declare class AdaptableNumberEditor implements ICellEditorComp {
51
53
  afterGuiAttached(): void;
52
54
  destroy(): void;
53
55
  private onValueChange;
54
- private getStartValue;
55
- private shouldClearExistingValue;
56
- private isValidChar;
57
56
  }
58
57
  export {};