@adaptabletools/adaptable 13.0.0-canary.12 → 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.
- package/bundle.cjs.js +169 -169
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableOptions/AdaptableQLOptions.d.ts +20 -3
- package/src/AdaptableOptions/LayoutOptions.d.ts +2 -1
- package/src/Api/AdaptableApi.d.ts +2 -0
- package/src/Api/FormatColumnApi.d.ts +2 -23
- package/src/Api/Implementation/AdaptableApiImpl.d.ts +2 -0
- package/src/Api/Implementation/AdaptableApiImpl.js +2 -0
- package/src/Api/Implementation/FormatColumnApiImpl.d.ts +1 -6
- package/src/Api/Implementation/FormatColumnApiImpl.js +13 -111
- package/src/Api/Implementation/StyledColumnApiImpl.d.ts +19 -0
- package/src/Api/Implementation/StyledColumnApiImpl.js +134 -0
- package/src/Api/StyledColumnApi.d.ts +68 -0
- package/src/Api/StyledColumnApi.js +2 -0
- package/src/PredefinedConfig/AdaptableState.d.ts +2 -0
- package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
- package/src/PredefinedConfig/Common/Types.d.ts +3 -3
- package/src/PredefinedConfig/Common/Types.js +1 -0
- package/src/PredefinedConfig/PredefinedConfig.d.ts +5 -0
- package/src/PredefinedConfig/StyledColumnState.d.ts +113 -0
- package/src/PredefinedConfig/StyledColumnState.js +2 -0
- package/src/Redux/ActionsReducers/StyledColumnRedux.d.ts +49 -0
- package/src/Redux/ActionsReducers/StyledColumnRedux.js +92 -0
- package/src/Redux/Store/AdaptableStore.js +7 -0
- package/src/Strategy/StyledColumnModule.d.ts +24 -0
- package/src/Strategy/StyledColumnModule.js +165 -0
- package/src/Strategy/Utilities/getScopeViewItems.js +1 -1
- package/src/Utilities/Constants/ModuleConstants.d.ts +3 -0
- package/src/Utilities/Constants/ModuleConstants.js +4 -1
- package/src/Utilities/Defaults/DefaultSettingsPanel.js +1 -0
- package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.d.ts +1 -4
- package/src/Utilities/ObjectFactory.d.ts +3 -0
- package/src/Utilities/ObjectFactory.js +11 -3
- package/src/Utilities/Services/ModuleService.js +3 -1
- package/src/View/CalculatedColumn/CalculatedColumnSummary.d.ts +1 -1
- package/src/View/Components/RangesComponent.d.ts +1 -0
- package/src/View/Components/RangesComponent.js +12 -12
- package/src/View/Components/Selectors/ColumnSelector.d.ts +1 -0
- package/src/View/Components/Selectors/ColumnSelector.js +2 -1
- package/src/View/Components/StyleComponent.js +2 -2
- package/src/View/Components/ToolPanel/AdaptableToolPanel.d.ts +1 -11
- package/src/View/Components/ToolPanel/AdaptableToolPanel.js +21 -9
- package/src/View/Components/ToolPanel/CustomToolPanelContent.js +1 -1
- package/src/View/Components/ToolPanel/ToolPanelPopup.d.ts +1 -1
- package/src/View/DataSet/DataSetViewPanel.d.ts +1 -1
- package/src/View/Export/ExportViewPanel.d.ts +1 -1
- package/src/View/Filter/FilterSummary.d.ts +1 -1
- package/src/View/Filter/FilterViewPanel.d.ts +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.d.ts +3 -3
- package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +6 -315
- package/src/View/Layout/LayoutViewPanel.d.ts +1 -1
- package/src/View/Query/QueryViewPanel.d.ts +1 -1
- package/src/View/QuickSearch/QuickSearchViewPanel.d.ts +1 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizard.d.ts +7 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +77 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.d.ts +9 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.js +65 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection.d.ts +9 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection.js +238 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.d.ts +7 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.js +59 -0
- package/src/View/SystemStatus/SystemStatusViewPanel.d.ts +1 -1
- package/src/View/Wizard/OnePageAdaptableWizard.d.ts +1 -1
- package/src/agGrid/Adaptable.d.ts +2 -1
- package/src/agGrid/Adaptable.js +50 -35
- package/src/agGrid/FilterWrapper.js +58 -19
- package/src/agGrid/FloatingFilterWrapper.js +10 -12
- package/src/agGrid/PercentBarRenderer.d.ts +6 -2
- package/src/agGrid/PercentBarRenderer.js +10 -18
- package/src/agGrid/agGridHelper.d.ts +6 -2
- package/src/agGrid/agGridHelper.js +4 -2
- package/src/agGrid/createAgStatusPanelComponent.d.ts +1 -1
- package/src/agGrid/createAgStatusPanelComponent.js +17 -0
- package/src/components/Datepicker/index.d.ts +1 -1
- package/src/components/icons/brush.d.ts +3 -0
- package/src/components/icons/brush.js +7 -0
- package/src/components/icons/index.js +2 -0
- package/src/metamodel/adaptable.metamodel.d.ts +56 -20
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +3 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/src/AdaptableComponents.d.ts +0 -1
- package/src/AdaptableComponents.js +0 -5
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StyledColumnWizardStyleSection = exports.renderStyledColumnStyleSummary = exports.renderFormatColumnStyleWizardSummary = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const rebass_1 = require("rebass");
|
|
7
|
+
const CheckBox_1 = require("../../../components/CheckBox");
|
|
8
|
+
const ErrorBox_1 = tslib_1.__importDefault(require("../../../components/ErrorBox"));
|
|
9
|
+
const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
|
|
10
|
+
const Tabs_1 = require("../../../components/Tabs");
|
|
11
|
+
const Tag_1 = require("../../../components/Tag");
|
|
12
|
+
const ColorPicker_1 = require("../../ColorPicker");
|
|
13
|
+
const RangesComponent_1 = require("../../Components/RangesComponent");
|
|
14
|
+
const StyleVisualItem_1 = require("../../Components/StyleVisualItem");
|
|
15
|
+
const UIHelper_1 = require("../../UIHelper");
|
|
16
|
+
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
|
|
17
|
+
const renderFormatColumnStyleWizardSummary = (data) => {
|
|
18
|
+
const { api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
19
|
+
return (0, exports.renderStyledColumnStyleSummary)(data, api);
|
|
20
|
+
};
|
|
21
|
+
exports.renderFormatColumnStyleWizardSummary = renderFormatColumnStyleWizardSummary;
|
|
22
|
+
const getRanges = (ranges) => {
|
|
23
|
+
return ranges.map((r, i) => (React.createElement(rebass_1.Flex, { key: i, alignItems: "center", mr: 3 },
|
|
24
|
+
React.createElement(rebass_1.Box, { mr: 1 },
|
|
25
|
+
r.Min,
|
|
26
|
+
" to ",
|
|
27
|
+
r.Max,
|
|
28
|
+
' '),
|
|
29
|
+
React.createElement(StyleVisualItem_1.StyleVisualItem, { Style: {
|
|
30
|
+
BackColor: r.Color,
|
|
31
|
+
ForeColor: r.Color,
|
|
32
|
+
} }))));
|
|
33
|
+
};
|
|
34
|
+
const getColumnComparison = (columnComparison, api) => {
|
|
35
|
+
return (React.createElement(rebass_1.Flex, { key: 'cc', alignItems: "center", mr: 3 },
|
|
36
|
+
React.createElement(rebass_1.Box, { mr: 1 },
|
|
37
|
+
"Min Value:",
|
|
38
|
+
' ',
|
|
39
|
+
isNaN(Number(columnComparison.MinValue))
|
|
40
|
+
? '[' + api.columnApi.getFriendlyNameFromColumnId(String(columnComparison.MinValue)) + ']'
|
|
41
|
+
: columnComparison.MinValue,
|
|
42
|
+
' ',
|
|
43
|
+
", Max Value:",
|
|
44
|
+
' ',
|
|
45
|
+
isNaN(Number(columnComparison.MaxValue))
|
|
46
|
+
? '[' + api.columnApi.getFriendlyNameFromColumnId(String(columnComparison.MaxValue)) + ']'
|
|
47
|
+
: columnComparison.MaxValue,
|
|
48
|
+
' '),
|
|
49
|
+
React.createElement(StyleVisualItem_1.StyleVisualItem, { Style: {
|
|
50
|
+
BackColor: columnComparison.Color,
|
|
51
|
+
ForeColor: columnComparison.Color,
|
|
52
|
+
} })));
|
|
53
|
+
};
|
|
54
|
+
const renderStyledColumnStyleSummary = (data, api) => {
|
|
55
|
+
if (data.CheckBoxStyle) {
|
|
56
|
+
return React.createElement(Tag_1.Tag, null, "Checkbox Style");
|
|
57
|
+
}
|
|
58
|
+
if (data.GradientStyle) {
|
|
59
|
+
if (data.GradientStyle.CellRanges) {
|
|
60
|
+
return getRanges(data.GradientStyle.CellRanges);
|
|
61
|
+
}
|
|
62
|
+
if (data.GradientStyle.ColumnComparison) {
|
|
63
|
+
return getColumnComparison(data.GradientStyle.ColumnComparison, api);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (data.PercentBarStyle) {
|
|
67
|
+
if (data.PercentBarStyle.CellRanges) {
|
|
68
|
+
return getRanges(data.PercentBarStyle.CellRanges);
|
|
69
|
+
}
|
|
70
|
+
if (data.PercentBarStyle.ColumnComparison) {
|
|
71
|
+
return getColumnComparison(data.PercentBarStyle.ColumnComparison, api);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return React.createElement(Tag_1.Tag, null, "No Styling Defined");
|
|
75
|
+
};
|
|
76
|
+
exports.renderStyledColumnStyleSummary = renderStyledColumnStyleSummary;
|
|
77
|
+
const StyledColumnWizardStyleSection = (props) => {
|
|
78
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
79
|
+
const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
80
|
+
const minMaxRangeValues = React.useMemo(() => {
|
|
81
|
+
const columnId = data.ColumnId;
|
|
82
|
+
if (!columnId) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
const column = api.columnApi.getColumnFromId(columnId);
|
|
86
|
+
return {
|
|
87
|
+
min: api.columnApi.getMinValueForNumericColumn(column),
|
|
88
|
+
max: api.columnApi.getMaxValueForNumericColumn(column),
|
|
89
|
+
};
|
|
90
|
+
}, [data]);
|
|
91
|
+
const scope = { ColumnIds: [data.ColumnId] }; // TODO: remove scope when format column columnStyle is removed
|
|
92
|
+
// gradient
|
|
93
|
+
const onUpdateGradientStyleRanges = (ranges) => {
|
|
94
|
+
const GradientStyle = {
|
|
95
|
+
CellRanges: ranges,
|
|
96
|
+
};
|
|
97
|
+
props.onChange(Object.assign(Object.assign({}, data), { GradientStyle }));
|
|
98
|
+
};
|
|
99
|
+
const onUpdateGradientStyleColumnComparison = (columnComparison) => {
|
|
100
|
+
const GradientStyle = {
|
|
101
|
+
ColumnComparison: columnComparison,
|
|
102
|
+
};
|
|
103
|
+
props.onChange(Object.assign(Object.assign({}, data), { GradientStyle }));
|
|
104
|
+
};
|
|
105
|
+
// percentbar
|
|
106
|
+
const onUpdatePercentBarStyleColumnComparison = (columnComparison) => {
|
|
107
|
+
const PercentBarStyle = {
|
|
108
|
+
ColumnComparison: columnComparison,
|
|
109
|
+
};
|
|
110
|
+
props.onChange(Object.assign(Object.assign({}, data), { PercentBarStyle }));
|
|
111
|
+
};
|
|
112
|
+
const onUpdatePercentBarStyleRanges = (ranges) => {
|
|
113
|
+
const PercentBarStyle = {
|
|
114
|
+
CellRanges: ranges,
|
|
115
|
+
};
|
|
116
|
+
props.onChange(Object.assign(Object.assign({}, data), { PercentBarStyle }));
|
|
117
|
+
};
|
|
118
|
+
const onPercentBarCellTextCellValueChanged = (checked) => {
|
|
119
|
+
let percentBarStyle = data === null || data === void 0 ? void 0 : data.PercentBarStyle;
|
|
120
|
+
if (checked) {
|
|
121
|
+
if (!percentBarStyle.CellText) {
|
|
122
|
+
percentBarStyle.CellText = ['CellValue'];
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
percentBarStyle.CellText.push('CellValue');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
if (percentBarStyle.CellText && percentBarStyle.CellText.includes('PercentageValue')) {
|
|
130
|
+
percentBarStyle.CellText = ['PercentageValue'];
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
percentBarStyle.CellText = [];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
props.onChange(Object.assign(Object.assign({}, data), { PercentBarStyle: percentBarStyle }));
|
|
137
|
+
};
|
|
138
|
+
const onPercentBarCellTextPercentValueChanged = (checked) => {
|
|
139
|
+
let percentBarStyle = data === null || data === void 0 ? void 0 : data.PercentBarStyle;
|
|
140
|
+
if (checked) {
|
|
141
|
+
if (!percentBarStyle.CellText) {
|
|
142
|
+
percentBarStyle.CellText = ['PercentageValue'];
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
percentBarStyle.CellText.push('PercentageValue');
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
if (percentBarStyle.CellText && percentBarStyle.CellText.includes('CellValue')) {
|
|
150
|
+
percentBarStyle.CellText = ['CellValue'];
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
percentBarStyle.CellText = [];
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
props.onChange(Object.assign(Object.assign({}, data), { PercentBarStyle: percentBarStyle }));
|
|
157
|
+
};
|
|
158
|
+
const onPercentBarToolTipTextCellValueChanged = (checked) => {
|
|
159
|
+
let percentBarStyle = data === null || data === void 0 ? void 0 : data.PercentBarStyle;
|
|
160
|
+
if (checked) {
|
|
161
|
+
if (!percentBarStyle.ToolTipText) {
|
|
162
|
+
percentBarStyle.ToolTipText = ['CellValue'];
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
percentBarStyle.ToolTipText.push('CellValue');
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
if (percentBarStyle.ToolTipText && percentBarStyle.ToolTipText.includes('PercentageValue')) {
|
|
170
|
+
percentBarStyle.ToolTipText = ['PercentageValue'];
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
percentBarStyle.ToolTipText = [];
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
props.onChange(Object.assign(Object.assign({}, data), { PercentBarStyle: percentBarStyle }));
|
|
177
|
+
};
|
|
178
|
+
const onPercentBarToolTipTextPercentValueChanged = (checked) => {
|
|
179
|
+
let percentBarStyle = data.PercentBarStyle;
|
|
180
|
+
if (checked) {
|
|
181
|
+
if (!percentBarStyle.ToolTipText) {
|
|
182
|
+
percentBarStyle.ToolTipText = ['PercentageValue'];
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
percentBarStyle.ToolTipText.push('PercentageValue');
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
if (percentBarStyle.ToolTipText && percentBarStyle.ToolTipText.includes('CellValue')) {
|
|
190
|
+
percentBarStyle.ToolTipText = ['CellValue'];
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
percentBarStyle.ToolTipText = [];
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
props.onChange(Object.assign(Object.assign({}, data), { PercentBarStyle: percentBarStyle }));
|
|
197
|
+
};
|
|
198
|
+
const onUsePercentStyleColorCheckChanged = (checked) => {
|
|
199
|
+
let percentBarStyle = data === null || data === void 0 ? void 0 : data.PercentBarStyle;
|
|
200
|
+
percentBarStyle.BackColor = checked ? (0, UIHelper_1.getHexForName)(UIHelper_1.GRAY) : null;
|
|
201
|
+
props.onChange(Object.assign(Object.assign({}, data), { PercentBarStyle: percentBarStyle }));
|
|
202
|
+
};
|
|
203
|
+
const onForeColorSelectChange = (color) => {
|
|
204
|
+
let percentBarStyle = data.PercentBarStyle;
|
|
205
|
+
percentBarStyle.BackColor = color;
|
|
206
|
+
props.onChange(Object.assign(Object.assign({}, data), { PercentBarStyle: percentBarStyle }));
|
|
207
|
+
};
|
|
208
|
+
const disabled = !data.ColumnId;
|
|
209
|
+
return (React.createElement(rebass_1.Box, null,
|
|
210
|
+
data.CheckBoxStyle && (React.createElement(Tabs_1.Tabs, null,
|
|
211
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Check Box Column"),
|
|
212
|
+
React.createElement(Tabs_1.Tabs.Content, null,
|
|
213
|
+
React.createElement(CheckBox_1.CheckBox, { marginLeft: 2, readOnly: true, checked: true }, "Display Column As CheckBox")))),
|
|
214
|
+
(data === null || data === void 0 ? void 0 : data.GradientStyle) && (React.createElement(RangesComponent_1.RangesComponent, { disabled: !data.ColumnId, minMaxRangeValues: minMaxRangeValues, api: api, scope: scope, showRangeDirection: true, ranges: (_a = data.GradientStyle) === null || _a === void 0 ? void 0 : _a.CellRanges, columnComparison: (_b = data === null || data === void 0 ? void 0 : data.GradientStyle) === null || _b === void 0 ? void 0 : _b.ColumnComparison, updateRanges: (ranges) => onUpdateGradientStyleRanges(ranges), updateColumnComparison: (columnComparison) => onUpdateGradientStyleColumnComparison(columnComparison) })),
|
|
215
|
+
data.PercentBarStyle && (React.createElement(React.Fragment, null,
|
|
216
|
+
React.createElement(RangesComponent_1.RangesComponent, { disabled: disabled, minMaxRangeValues: minMaxRangeValues, api: api, scope: scope, showRangeDirection: false, ranges: (_c = data.PercentBarStyle) === null || _c === void 0 ? void 0 : _c.CellRanges, columnComparison: (_d = data === null || data === void 0 ? void 0 : data.PercentBarStyle) === null || _d === void 0 ? void 0 : _d.ColumnComparison, updateRanges: (ranges) => onUpdatePercentBarStyleRanges(ranges), updateColumnComparison: (columnComparison) => onUpdatePercentBarStyleColumnComparison(columnComparison) }),
|
|
217
|
+
React.createElement(FormLayout_1.default, { marginLeft: 2, marginTop: 2 },
|
|
218
|
+
React.createElement(FormLayout_1.FormRow, { label: "Cell Display:" },
|
|
219
|
+
React.createElement(CheckBox_1.CheckBox, { disabled: disabled, marginLeft: 2, checked: (_f = (_e = data.PercentBarStyle) === null || _e === void 0 ? void 0 : _e.CellText) === null || _f === void 0 ? void 0 : _f.includes('CellValue'), onChange: (checked) => onPercentBarCellTextCellValueChanged(checked) }, "Cell Value"),
|
|
220
|
+
' ',
|
|
221
|
+
React.createElement(CheckBox_1.CheckBox, { disabled: disabled, marginLeft: 3, checked: (_h = (_g = data === null || data === void 0 ? void 0 : data.PercentBarStyle) === null || _g === void 0 ? void 0 : _g.CellText) === null || _h === void 0 ? void 0 : _h.includes('PercentageValue'), onChange: (checked) => onPercentBarCellTextPercentValueChanged(checked) },
|
|
222
|
+
"Percent Value",
|
|
223
|
+
' '),
|
|
224
|
+
' '),
|
|
225
|
+
React.createElement(FormLayout_1.FormRow, { label: "ToolTip Display:" },
|
|
226
|
+
React.createElement(CheckBox_1.CheckBox, { disabled: disabled, marginLeft: 2, checked: (_k = (_j = data === null || data === void 0 ? void 0 : data.PercentBarStyle) === null || _j === void 0 ? void 0 : _j.ToolTipText) === null || _k === void 0 ? void 0 : _k.includes('CellValue'), onChange: (checked) => onPercentBarToolTipTextCellValueChanged(checked) }, "Cell Value"),
|
|
227
|
+
' ',
|
|
228
|
+
React.createElement(CheckBox_1.CheckBox, { disabled: disabled, marginLeft: 3, checked: (_m = (_l = data === null || data === void 0 ? void 0 : data.PercentBarStyle) === null || _l === void 0 ? void 0 : _l.ToolTipText) === null || _m === void 0 ? void 0 : _m.includes('PercentageValue'), onChange: (checked) => onPercentBarToolTipTextPercentValueChanged(checked) },
|
|
229
|
+
"Percent Value",
|
|
230
|
+
' '),
|
|
231
|
+
' '),
|
|
232
|
+
React.createElement(FormLayout_1.FormRow, { label: `Back ${api.internalApi.getCorrectEnglishVariant('Colour')}` },
|
|
233
|
+
React.createElement(rebass_1.Flex, { alignItems: "center", marginLeft: 2 },
|
|
234
|
+
React.createElement(CheckBox_1.CheckBox, { disabled: disabled, checked: !!((_o = data.PercentBarStyle) === null || _o === void 0 ? void 0 : _o.BackColor), onChange: (checked) => onUsePercentStyleColorCheckChanged(checked), mr: 2 }),
|
|
235
|
+
((_p = data.PercentBarStyle) === null || _p === void 0 ? void 0 : _p.BackColor) !== undefined && (React.createElement(ColorPicker_1.ColorPicker, { disabled: disabled, api: api, value: (_q = data.PercentBarStyle) === null || _q === void 0 ? void 0 : _q.BackColor, onChange: (x) => onForeColorSelectChange(x) }))))))),
|
|
236
|
+
!data.ColumnId && React.createElement(ErrorBox_1.default, { mt: 2 }, "You need to select a column before styling.")));
|
|
237
|
+
};
|
|
238
|
+
exports.StyledColumnWizardStyleSection = StyledColumnWizardStyleSection;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyledColumn } from '../../../PredefinedConfig/StyledColumnState';
|
|
3
|
+
export declare const renderStyledColumnTypeSummary: (data: StyledColumn) => JSX.Element;
|
|
4
|
+
export interface StyledColumnWizardTypeSectionProps {
|
|
5
|
+
onChange: (styledColumn: StyledColumn) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const StyledColumnWizardTypeSection: React.FunctionComponent<StyledColumnWizardTypeSectionProps>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StyledColumnWizardTypeSection = exports.renderStyledColumnTypeSummary = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const rebass_1 = require("rebass");
|
|
7
|
+
const Radio_1 = tslib_1.__importDefault(require("../../../components/Radio"));
|
|
8
|
+
const Tabs_1 = require("../../../components/Tabs");
|
|
9
|
+
const Tag_1 = require("../../../components/Tag");
|
|
10
|
+
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
|
|
11
|
+
const renderStyledColumnTypeSummary = (data) => {
|
|
12
|
+
let type = null;
|
|
13
|
+
if (data.GradientStyle) {
|
|
14
|
+
type = 'Gradient Column';
|
|
15
|
+
}
|
|
16
|
+
else if (data.PercentBarStyle) {
|
|
17
|
+
type = 'Percent Bar';
|
|
18
|
+
}
|
|
19
|
+
else if (data.CheckBoxStyle) {
|
|
20
|
+
type = 'Check Box';
|
|
21
|
+
}
|
|
22
|
+
return (React.createElement(rebass_1.Text, { pr: 2, py: 2 },
|
|
23
|
+
"Type ",
|
|
24
|
+
React.createElement(Tag_1.Tag, null, type)));
|
|
25
|
+
};
|
|
26
|
+
exports.renderStyledColumnTypeSummary = renderStyledColumnTypeSummary;
|
|
27
|
+
const StyledColumnWizardTypeSection = (props) => {
|
|
28
|
+
const { data } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
29
|
+
const handleTypeChange = (type) => {
|
|
30
|
+
const newStyledColumn = Object.assign({}, data);
|
|
31
|
+
switch (type) {
|
|
32
|
+
case 'gradient':
|
|
33
|
+
newStyledColumn.GradientStyle = {};
|
|
34
|
+
delete newStyledColumn.PercentBarStyle;
|
|
35
|
+
delete newStyledColumn.CheckBoxStyle;
|
|
36
|
+
break;
|
|
37
|
+
case 'percent':
|
|
38
|
+
newStyledColumn.PercentBarStyle = {};
|
|
39
|
+
delete newStyledColumn.GradientStyle;
|
|
40
|
+
delete newStyledColumn.CheckBoxStyle;
|
|
41
|
+
break;
|
|
42
|
+
case 'checkbox':
|
|
43
|
+
newStyledColumn.CheckBoxStyle = true;
|
|
44
|
+
delete newStyledColumn.GradientStyle;
|
|
45
|
+
delete newStyledColumn.PercentBarStyle;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
newStyledColumn.ColumnId = null;
|
|
49
|
+
props.onChange(newStyledColumn);
|
|
50
|
+
};
|
|
51
|
+
return (React.createElement(rebass_1.Flex, { height: "100%", flexDirection: "column", "data-name": "styled-column-type" },
|
|
52
|
+
React.createElement(Tabs_1.Tabs, { autoFocus: false, padding: 2 },
|
|
53
|
+
React.createElement(Tabs_1.Tabs.Tab, null, "Type"),
|
|
54
|
+
React.createElement(Tabs_1.Tabs.Content, null,
|
|
55
|
+
React.createElement(Radio_1.default, { checked: Boolean(data.GradientStyle), onChange: () => handleTypeChange('gradient') }, "Gradient Column"),
|
|
56
|
+
React.createElement(Radio_1.default, { onChange: () => handleTypeChange('percent'), checked: Boolean(data.PercentBarStyle) }, "Percent Bar"),
|
|
57
|
+
React.createElement(Radio_1.default, { onChange: () => handleTypeChange('checkbox'), checked: Boolean(data.CheckBoxStyle) }, "Check Box")))));
|
|
58
|
+
};
|
|
59
|
+
exports.StyledColumnWizardTypeSection = StyledColumnWizardTypeSection;
|
|
@@ -8,5 +8,5 @@ declare class SystemStatusViewPanelComponent extends React.Component<SystemStatu
|
|
|
8
8
|
constructor(props: SystemStatusViewPanelComponentProps);
|
|
9
9
|
render(): JSX.Element;
|
|
10
10
|
}
|
|
11
|
-
export declare let SystemStatusViewPanel: import("react-redux").ConnectedComponent<typeof SystemStatusViewPanelComponent, import("react-redux").Omit<React.ClassAttributes<SystemStatusViewPanelComponent> & SystemStatusViewPanelComponentProps, "api" | "
|
|
11
|
+
export declare let SystemStatusViewPanel: import("react-redux").ConnectedComponent<typeof SystemStatusViewPanelComponent, import("react-redux").Omit<React.ClassAttributes<SystemStatusViewPanelComponent> & SystemStatusViewPanelComponentProps, "api" | "accessLevel" | "moduleInfo" | "SystemStatusMessageInfos" | "viewType">>;
|
|
12
12
|
export {};
|
|
@@ -22,7 +22,7 @@ export interface OnePageAdaptableWizardSection<ENTITY> {
|
|
|
22
22
|
isValid?: (data: ENTITY, api: AdaptableApi, context: OnePageAdaptableWizardContextType<ENTITY>) => true | string;
|
|
23
23
|
isVisible?: (data: ENTITY, api: AdaptableApi, context: OnePageAdaptableWizardContextType<ENTITY>) => boolean;
|
|
24
24
|
render: (data: ENTITY, index: number) => React.ReactNode;
|
|
25
|
-
renderSummary?: (data: ENTITY) => React.ReactNode;
|
|
25
|
+
renderSummary?: (data: ENTITY, api: AdaptableApi) => React.ReactNode;
|
|
26
26
|
}
|
|
27
27
|
export interface OnePageAdaptableWizardProps<ENTITY> {
|
|
28
28
|
moduleInfo: ModuleInfo;
|
|
@@ -157,6 +157,8 @@ export declare class Adaptable implements IAdaptable {
|
|
|
157
157
|
updateColumnsIntoStore(): void;
|
|
158
158
|
private createAdaptableColumn;
|
|
159
159
|
private safeSetColDefs;
|
|
160
|
+
private getStyledColumnStyle;
|
|
161
|
+
private getSpecialColumnStyle;
|
|
160
162
|
private getFormatColumnSpecialColumnStyle;
|
|
161
163
|
private getFormatColumnColumnStyle;
|
|
162
164
|
private getFormatColumnCellStyle;
|
|
@@ -365,7 +367,6 @@ export declare class Adaptable implements IAdaptable {
|
|
|
365
367
|
private setupColumnHeaderAggregations;
|
|
366
368
|
private getConditionalStyleRowClass;
|
|
367
369
|
private getConditionalStyleRowStyle;
|
|
368
|
-
private getFormatColumnRowStyle;
|
|
369
370
|
private getGridOptionsApi;
|
|
370
371
|
canGenerateCharts(): boolean;
|
|
371
372
|
canHaveSparklines(): boolean;
|
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -343,15 +343,16 @@ class Adaptable {
|
|
|
343
343
|
// this is still used internally but should not be used externally as a preference
|
|
344
344
|
async init(adaptableOptions, runtimeConfig, _staticInit) {
|
|
345
345
|
var _a, _b, _c, _d, _e, _f;
|
|
346
|
+
// (globalThis as any).adaptable = this;
|
|
346
347
|
if (runtimeConfig) {
|
|
347
348
|
this.supressReact18RenderWarning = !!runtimeConfig.supressReact18RenderWarning;
|
|
348
349
|
if (runtimeConfig.renderReactRoot) {
|
|
349
350
|
this.renderReactRoot = (el, container) => {
|
|
350
351
|
const unmount = runtimeConfig.renderReactRoot(el, container);
|
|
351
352
|
return () => {
|
|
352
|
-
// we
|
|
353
|
-
//
|
|
354
|
-
//
|
|
353
|
+
// we used to capture here because of FloatingFilters/Filters - see FloatingFilterWrapper and FilterWrapper
|
|
354
|
+
// as we didn't have a native React implementation for our React wrapper
|
|
355
|
+
// but we might need to do this again in the future for some other components that are not native React
|
|
355
356
|
// captureReactWarnings();
|
|
356
357
|
if (typeof unmount === 'function') {
|
|
357
358
|
unmount();
|
|
@@ -911,13 +912,15 @@ class Adaptable {
|
|
|
911
912
|
this.gridOptions.api.setColumnDefs(colDefs);
|
|
912
913
|
this.updateColumnsIntoStore(); // todo remove this from here!!!
|
|
913
914
|
}
|
|
914
|
-
|
|
915
|
-
|
|
915
|
+
getStyledColumnStyle(styledColumn, abColumn, params) {
|
|
916
|
+
return this.getSpecialColumnStyle(styledColumn, abColumn, params);
|
|
917
|
+
}
|
|
918
|
+
getSpecialColumnStyle(columnStyle, abColumn, params) {
|
|
916
919
|
let style = {};
|
|
917
920
|
const gradientStyle = columnStyle === null || columnStyle === void 0 ? void 0 : columnStyle.GradientStyle;
|
|
918
921
|
if (gradientStyle) {
|
|
919
|
-
const min = this.api.
|
|
920
|
-
const max = this.api.
|
|
922
|
+
const min = this.api.styledColumnApi.getNumericStyleMinValue(columnStyle, abColumn, params.node, params.value);
|
|
923
|
+
const max = this.api.styledColumnApi.getNumericStyleMaxValue(columnStyle, abColumn, params.node, params.value);
|
|
921
924
|
const clampedValue = (0, clamp_1.default)(params.value, min, max);
|
|
922
925
|
let cellBackColor;
|
|
923
926
|
let reverseGradient = false;
|
|
@@ -947,10 +950,26 @@ class Adaptable {
|
|
|
947
950
|
}
|
|
948
951
|
return style;
|
|
949
952
|
}
|
|
953
|
+
getFormatColumnSpecialColumnStyle(formatColumn, abColumn, params) {
|
|
954
|
+
return this.getSpecialColumnStyle(formatColumn.ColumnStyle, abColumn, params);
|
|
955
|
+
}
|
|
950
956
|
getFormatColumnColumnStyle(formatColumns) {
|
|
951
957
|
// first has more precedence, then they need to be applied in reverse order
|
|
952
958
|
return formatColumns.reduceRight((style, formatColumn) => {
|
|
953
959
|
const formatColumnStyle = this.convertAdaptableStyleToCSS(formatColumn.Style);
|
|
960
|
+
if (formatColumn.CellAlignment) {
|
|
961
|
+
switch (formatColumn.CellAlignment) {
|
|
962
|
+
case 'Left':
|
|
963
|
+
style.textAlign = 'left';
|
|
964
|
+
break;
|
|
965
|
+
case 'Right':
|
|
966
|
+
style.textAlign = 'right';
|
|
967
|
+
break;
|
|
968
|
+
case 'Center':
|
|
969
|
+
style.textAlign = 'center';
|
|
970
|
+
break;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
954
973
|
return Object.assign(Object.assign({}, style), formatColumnStyle);
|
|
955
974
|
}, {});
|
|
956
975
|
}
|
|
@@ -974,19 +993,6 @@ class Adaptable {
|
|
|
974
993
|
}
|
|
975
994
|
style = Object.assign(Object.assign({}, style), this.getFormatColumnColumnStyle(activeFormatColumnsWithStyle));
|
|
976
995
|
}
|
|
977
|
-
if (formatColumn.CellAlignment) {
|
|
978
|
-
switch (formatColumn.CellAlignment) {
|
|
979
|
-
case 'Left':
|
|
980
|
-
style.textAlign = 'left';
|
|
981
|
-
break;
|
|
982
|
-
case 'Right':
|
|
983
|
-
style.textAlign = 'right';
|
|
984
|
-
break;
|
|
985
|
-
case 'Center':
|
|
986
|
-
style.textAlign = 'center';
|
|
987
|
-
break;
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
996
|
return style;
|
|
991
997
|
}
|
|
992
998
|
getFormatColumnCellClass(formatColumns, abColumn, params) {
|
|
@@ -3205,16 +3211,20 @@ class Adaptable {
|
|
|
3205
3211
|
};
|
|
3206
3212
|
const formatColumn = this.api.formatColumnApi.getActiveFormatColumnForColumn(abColumn);
|
|
3207
3213
|
const formatColumnsWithStyle = this.api.formatColumnApi.getColumnFormatColumnsWithStyle(abColumn);
|
|
3214
|
+
let styledColumn = this.api.styledColumnApi.getStyledColumnByColumnId(colId);
|
|
3215
|
+
if (styledColumn === null || styledColumn === void 0 ? void 0 : styledColumn.IsSuspended) {
|
|
3216
|
+
styledColumn = null;
|
|
3217
|
+
}
|
|
3208
3218
|
const conditionalStyles = this.api.conditionalStyleApi.getConditionalStylesForColumn(abColumn);
|
|
3209
3219
|
const quickSearchStyle = this.getQuickSearchCellStyle();
|
|
3210
3220
|
const hasQuickSearchStyle = quickSearchStyle != undefined;
|
|
3211
3221
|
const cellStyle = (params) => {
|
|
3212
|
-
const formatColumnCellStyle = formatColumn
|
|
3222
|
+
const formatColumnCellStyle = formatColumn && !styledColumn // TODO: remove after refactor columnStyle
|
|
3213
3223
|
? this.getFormatColumnCellStyle(abColumn, formatColumn, formatColumnsWithStyle, params)
|
|
3214
3224
|
: undefined;
|
|
3215
3225
|
const isQuickSearchActive = hasQuickSearchStyle && this.isQuickSearchActive(abColumn, params);
|
|
3216
3226
|
const conditionalStyleObj = this.getConditionalStyleCellStyle(conditionalStyles, abColumn, params);
|
|
3217
|
-
const result = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaultCellStyle), this.getReadOnlyCellStyle(abColumn, params)), this.getEditableCellStyle(abColumn, params)), (typeof userCellStyle === 'function' ? userCellStyle(params) : userCellStyle)), formatColumnCellStyle), conditionalStyleObj), (isQuickSearchActive ? quickSearchStyle : undefined)), this.getAlertCellStyle(abColumn, params)), this.getFlashingCellStyle(abColumn, params)), this.getCellHighlightStyle(abColumn, params));
|
|
3227
|
+
const result = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaultCellStyle), this.getReadOnlyCellStyle(abColumn, params)), this.getEditableCellStyle(abColumn, params)), (typeof userCellStyle === 'function' ? userCellStyle(params) : userCellStyle)), formatColumnCellStyle), (styledColumn ? this.getStyledColumnStyle(styledColumn, abColumn, params) : {})), conditionalStyleObj), (isQuickSearchActive ? quickSearchStyle : undefined)), this.getAlertCellStyle(abColumn, params)), this.getFlashingCellStyle(abColumn, params)), this.getCellHighlightStyle(abColumn, params));
|
|
3218
3228
|
return result;
|
|
3219
3229
|
};
|
|
3220
3230
|
return cellStyle;
|
|
@@ -3236,10 +3246,12 @@ class Adaptable {
|
|
|
3236
3246
|
const readonlyClassName = this.getReadonlyCellClass(abColumn, params);
|
|
3237
3247
|
const highlightAlertClassName = this.getAlertCellClass(abColumn, params);
|
|
3238
3248
|
const flashingClassName = this.getFlashingCellClass(abColumn, params);
|
|
3249
|
+
const styledColumn = this.api.styledColumnApi.getStyledColumnByColumnId(colId);
|
|
3250
|
+
const hasStyledColumn = styledColumn && !styledColumn.IsSuspended;
|
|
3239
3251
|
const returnValue = [
|
|
3240
3252
|
this.getExcelClassNameForCell(colId, primaryKeyValue),
|
|
3241
3253
|
typeof userCellClass === 'function' ? userCellClass(params) : userCellClass,
|
|
3242
|
-
formatColumns.length
|
|
3254
|
+
!hasStyledColumn && formatColumns.length
|
|
3243
3255
|
? this.getFormatColumnCellClass(formatColumns, abColumn, params)
|
|
3244
3256
|
: null,
|
|
3245
3257
|
hasConditionalStylesWithClassNames
|
|
@@ -3254,7 +3266,9 @@ class Adaptable {
|
|
|
3254
3266
|
// we flatten the array because some rules ('userCellClass',conditionalStyles etc) might return a string[]
|
|
3255
3267
|
.flat()
|
|
3256
3268
|
.filter((x) => !!x);
|
|
3257
|
-
|
|
3269
|
+
const result = returnValue.length ? returnValue : undefined;
|
|
3270
|
+
// console.log(result);
|
|
3271
|
+
return result;
|
|
3258
3272
|
};
|
|
3259
3273
|
return cellClass;
|
|
3260
3274
|
});
|
|
@@ -3300,10 +3314,19 @@ class Adaptable {
|
|
|
3300
3314
|
}
|
|
3301
3315
|
setupColumnCellRenderer({ col, colId, abColumn }) {
|
|
3302
3316
|
this.setColDefProperty(col, 'cellRenderer', () => {
|
|
3317
|
+
const styledColumn = this.api.styledColumnApi.getStyledColumnByColumnId(abColumn.columnId);
|
|
3318
|
+
if (styledColumn && !styledColumn.IsSuspended) {
|
|
3319
|
+
if (styledColumn.PercentBarStyle) {
|
|
3320
|
+
return this.agGridHelper.createPercentBarRendererComp(styledColumn, abColumn);
|
|
3321
|
+
}
|
|
3322
|
+
if (styledColumn.CheckBoxStyle) {
|
|
3323
|
+
return this.agGridHelper.createCheckboxRendererComp(abColumn.columnId, abColumn.readOnly);
|
|
3324
|
+
}
|
|
3325
|
+
}
|
|
3303
3326
|
const formatColumn = this.api.formatColumnApi.getActiveFormatColumnForColumn(abColumn);
|
|
3304
3327
|
if (formatColumn && !(formatColumn === null || formatColumn === void 0 ? void 0 : formatColumn.IsSuspended) && formatColumn.ColumnStyle) {
|
|
3305
3328
|
if (formatColumn.ColumnStyle.PercentBarStyle) {
|
|
3306
|
-
return this.agGridHelper.createPercentBarRendererComp(formatColumn, abColumn);
|
|
3329
|
+
return this.agGridHelper.createPercentBarRendererComp(formatColumn.ColumnStyle, abColumn);
|
|
3307
3330
|
}
|
|
3308
3331
|
if (formatColumn.ColumnStyle.CheckBoxStyle) {
|
|
3309
3332
|
return this.agGridHelper.createCheckboxRendererComp(abColumn.columnId, abColumn.readOnly);
|
|
@@ -3322,8 +3345,8 @@ class Adaptable {
|
|
|
3322
3345
|
formatColumn.ColumnStyle.PercentBarStyle.ToolTipText) {
|
|
3323
3346
|
if ((_a = formatColumn === null || formatColumn === void 0 ? void 0 : formatColumn.ColumnStyle) === null || _a === void 0 ? void 0 : _a.PercentBarStyle) {
|
|
3324
3347
|
return (params) => {
|
|
3325
|
-
const min = this.api.
|
|
3326
|
-
const max = this.api.
|
|
3348
|
+
const min = this.api.styledColumnApi.getNumericStyleMinValue(formatColumn === null || formatColumn === void 0 ? void 0 : formatColumn.ColumnStyle, abColumn, params.node, params.value);
|
|
3349
|
+
const max = this.api.styledColumnApi.getNumericStyleMaxValue(formatColumn === null || formatColumn === void 0 ? void 0 : formatColumn.ColumnStyle, abColumn, params.node, params.value);
|
|
3327
3350
|
const textOptions = formatColumn.ColumnStyle.PercentBarStyle.ToolTipText;
|
|
3328
3351
|
let returnValue = '';
|
|
3329
3352
|
if (textOptions.includes('CellValue')) {
|
|
@@ -4443,14 +4466,6 @@ import "@adaptabletools/adaptable/themes/${themeName}.css"`);
|
|
|
4443
4466
|
}
|
|
4444
4467
|
}
|
|
4445
4468
|
}
|
|
4446
|
-
getFormatColumnRowStyle(formatColumns, params) {
|
|
4447
|
-
if (ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(formatColumns)) {
|
|
4448
|
-
const formatColumnWithRowStyle = formatColumns.find((formatColumn) => this.api.formatColumnApi.isFormatColumnActiveForRow(formatColumn, params));
|
|
4449
|
-
if (formatColumnWithRowStyle) {
|
|
4450
|
-
return this.convertAdaptableStyleToCSS(formatColumnWithRowStyle.Style);
|
|
4451
|
-
}
|
|
4452
|
-
}
|
|
4453
|
-
}
|
|
4454
4469
|
getGridOptionsApi() {
|
|
4455
4470
|
if (!this.gridOptions.api) {
|
|
4456
4471
|
(0, LoggingHelper_1.ConsoleLogError)('There is a problem with your instance of AG Grid - it has no gridApi object. Please contact Support.');
|
|
@@ -1,30 +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
|
-
// we need this here
|
|
16
|
-
if (adaptable.isDestroyed) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
//make the small filter icon to appear when there is a filter
|
|
20
|
-
return (adaptable.api.filterApi
|
|
21
|
-
.getColumnFilters()
|
|
22
|
-
.findIndex((x) => x.ColumnId == this.params.column.getColId()) > -1);
|
|
61
|
+
this.filterContainer.id = getContainerId(this.params.column.getColId());
|
|
23
62
|
}
|
|
24
63
|
doesFilterPass(params) {
|
|
25
64
|
//we do not filter here.... we filter using the doesExternalFilterPass. Not sure there is a difference....
|
|
26
65
|
return true;
|
|
27
66
|
}
|
|
67
|
+
isFilterActive() {
|
|
68
|
+
return isFilterActive(this.params.column.getColId());
|
|
69
|
+
}
|
|
28
70
|
getModel() {
|
|
29
71
|
//
|
|
30
72
|
}
|
|
@@ -35,17 +77,14 @@ let FilterWrapperFactory = (adaptable) => {
|
|
|
35
77
|
return this.filterContainer;
|
|
36
78
|
}
|
|
37
79
|
afterGuiAttached(params) {
|
|
38
|
-
var _a;
|
|
80
|
+
var _a, _b;
|
|
39
81
|
//we always unmount first so the autofocus from the form works... in other grids we unmount when hidden
|
|
40
82
|
(_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
41
83
|
let column = adaptable.api.columnApi.getColumnFromId(this.column.getColId());
|
|
42
84
|
if (column) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
ShowCloseButton: params != null && params.hidePopup != null,
|
|
47
|
-
};
|
|
48
|
-
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;
|
|
49
88
|
this.unmountReactRoot = adaptable.renderReactRoot((0, FilterForm_1.FilterFormReact)(filterContext), this.filterContainer);
|
|
50
89
|
}
|
|
51
90
|
}
|