@adaptabletools/adaptable 12.1.2 → 12.1.5

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 (98) hide show
  1. package/bundle.cjs.js +116 -143
  2. package/package.json +1 -1
  3. package/publishTimestamp.d.ts +1 -1
  4. package/publishTimestamp.js +1 -1
  5. package/src/Api/ColumnApi.d.ts +6 -0
  6. package/src/Api/Events/SearchChanged.d.ts +1 -0
  7. package/src/Api/FormatColumnApi.d.ts +5 -3
  8. package/src/Api/Implementation/ColumnApiImpl.d.ts +2 -0
  9. package/src/Api/Implementation/ColumnApiImpl.js +14 -0
  10. package/src/Api/Implementation/FilterApiImpl.js +3 -0
  11. package/src/Api/Implementation/FormatColumnApiImpl.d.ts +5 -3
  12. package/src/Api/Implementation/FormatColumnApiImpl.js +40 -11
  13. package/src/PredefinedConfig/AlertState.d.ts +2 -2
  14. package/src/PredefinedConfig/Common/AdaptablePredicate.js +9 -1
  15. package/src/PredefinedConfig/Common/Types.d.ts +1 -0
  16. package/src/PredefinedConfig/Common/Types.js +38 -1
  17. package/src/PredefinedConfig/FlashingCellState.d.ts +1 -1
  18. package/src/PredefinedConfig/FormatColumnState.d.ts +2 -2
  19. package/src/Redux/Store/AdaptableStore.js +8 -0
  20. package/src/Strategy/AlertModule.js +1 -1
  21. package/src/Strategy/BulkUpdateModule.js +1 -1
  22. package/src/Strategy/CalculatedColumnModule.js +1 -1
  23. package/src/Strategy/CellSummaryModule.js +1 -1
  24. package/src/Strategy/ChartingModule.js +1 -1
  25. package/src/Strategy/ConditionalStyleModule.js +1 -1
  26. package/src/Strategy/CustomSortModule.js +1 -1
  27. package/src/Strategy/DashboardModule.js +1 -1
  28. package/src/Strategy/DataChangeHistoryModule.js +1 -1
  29. package/src/Strategy/DataSetModule.js +1 -1
  30. package/src/Strategy/ExportModule.js +1 -1
  31. package/src/Strategy/FilterModule.js +1 -1
  32. package/src/Strategy/FlashingCellModule.js +1 -1
  33. package/src/Strategy/FormatColumnModule.js +2 -2
  34. package/src/Strategy/FreeTextColumnModule.js +1 -1
  35. package/src/Strategy/GridInfoModule.js +1 -1
  36. package/src/Strategy/LayoutModule.js +3 -3
  37. package/src/Strategy/PlusMinusModule.js +1 -1
  38. package/src/Strategy/QueryModule.js +1 -1
  39. package/src/Strategy/QuickSearchModule.js +1 -1
  40. package/src/Strategy/ScheduleModule.js +1 -1
  41. package/src/Strategy/ShortcutModule.js +1 -1
  42. package/src/Strategy/SmartEditModule.js +1 -1
  43. package/src/Strategy/StateManagementModule.js +1 -1
  44. package/src/Strategy/StatusBarModule.js +1 -1
  45. package/src/Strategy/SystemStatusModule.js +1 -1
  46. package/src/Strategy/TeamSharingModule.js +1 -1
  47. package/src/Strategy/ThemeModule.js +1 -1
  48. package/src/Strategy/ToolPanelModule.js +1 -1
  49. package/src/Utilities/Constants/ModuleConstants.d.ts +68 -0
  50. package/src/Utilities/Constants/ModuleConstants.js +70 -1
  51. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +2 -1
  52. package/src/Utilities/Services/Interface/IMetamodelService.d.ts +5 -0
  53. package/src/Utilities/Services/MetamodelService.d.ts +4 -4
  54. package/src/Utilities/Services/MetamodelService.js +19 -12
  55. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ColumnsList.js +193 -135
  56. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +23 -15
  57. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizardColumnsStep.js +3 -7
  58. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/EntitlementsForm.d.ts +2 -2
  59. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/EntitlementsForm.js +148 -8
  60. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/GridOptionsForm.js +0 -7
  61. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsActionColumnsForm.d.ts +6 -0
  62. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsActionColumnsForm.js +33 -0
  63. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsSidebarForm.d.ts +6 -0
  64. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsSidebarForm.js +82 -0
  65. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsStatusbarForm.d.ts +6 -0
  66. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsStatusbarForm.js +109 -0
  67. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UiOptionsForm.d.ts +8 -0
  68. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UiOptionsForm.js +16 -0
  69. package/src/View/AdaptableWizardView/Wizard.js +2 -1
  70. package/src/View/AdaptableWizardView/helper.d.ts +1 -1
  71. package/src/View/AdaptableWizardView/helper.js +3 -10
  72. package/src/View/Alert/Wizard/AlertBehaviourWizardSection.d.ts +1 -0
  73. package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +6 -2
  74. package/src/View/Alert/Wizard/AlertWizard.js +1 -1
  75. package/src/View/Components/FilterForm/FilterForm.js +2 -1
  76. package/src/View/Components/RangesComponent.js +1 -1
  77. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.d.ts +2 -2
  78. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +3 -3
  79. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.d.ts +1 -0
  80. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +6 -1
  81. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +2 -2
  82. package/src/View/Layout/Wizard/LayoutWizard.js +11 -4
  83. package/src/View/Layout/Wizard/sections/AggregationsSection.js +1 -1
  84. package/src/View/Layout/Wizard/sections/ColumnsSection.js +8 -4
  85. package/src/View/Layout/Wizard/sections/PivotColumnsSection.js +3 -2
  86. package/src/View/Layout/Wizard/sections/RowGroupingSection.js +1 -1
  87. package/src/View/Layout/Wizard/sections/SettingsSection.js +2 -2
  88. package/src/View/Layout/Wizard/sections/SortSection.js +1 -1
  89. package/src/View/Wizard/OnePageAdaptableWizard.d.ts +1 -1
  90. package/src/agGrid/Adaptable.d.ts +1 -1
  91. package/src/agGrid/Adaptable.js +14 -10
  92. package/src/agGrid/PercentBarRenderer.d.ts +2 -1
  93. package/src/agGrid/PercentBarRenderer.js +3 -3
  94. package/src/agGrid/agGridHelper.d.ts +1 -1
  95. package/src/agGrid/agGridHelper.js +2 -2
  96. package/src/metamodel/adaptable.metamodel.js +1 -1
  97. package/version.d.ts +1 -1
  98. package/version.js +1 -1
@@ -5,12 +5,13 @@ const React = tslib_1.__importStar(require("react"));
5
5
  const useSelection_1 = tslib_1.__importDefault(require("./useSelection"));
6
6
  const CheckBox_1 = require("../../../components/CheckBox");
7
7
  const Radio_1 = tslib_1.__importDefault(require("../../../components/Radio"));
8
- const AdaptableObjectRow_1 = require("../../Components/AdaptableObjectRow");
9
- const AdaptableObjectCollection_1 = require("../../Components/AdaptableObjectCollection");
10
8
  const Dropdown_1 = tslib_1.__importDefault(require("../../../components/Dropdown"));
11
9
  const Input_1 = tslib_1.__importDefault(require("../../../components/Input"));
12
10
  const react_1 = require("react");
13
11
  const StringExtensions_1 = tslib_1.__importDefault(require("../../../Utilities/Extensions/StringExtensions"));
12
+ const InfiniteTable_1 = require("../../../components/InfiniteTable");
13
+ const rebass_1 = require("rebass");
14
+ const throttle_1 = tslib_1.__importDefault(require("lodash/throttle"));
14
15
  const dataTypes = [
15
16
  {
16
17
  value: 'abColDefString',
@@ -28,7 +29,7 @@ const dataTypes = [
28
29
  ];
29
30
  const inputStyle = {
30
31
  width: '100%',
31
- minWidth: 50,
32
+ minWidth: 80,
32
33
  textAlign: 'start',
33
34
  };
34
35
  const useForceRender = () => {
@@ -37,6 +38,26 @@ const useForceRender = () => {
37
38
  setNow(Date.now());
38
39
  };
39
40
  };
41
+ const ThrottledInput = React.memo((props) => {
42
+ const [stateValue, setStateValue] = react_1.useState(props.value);
43
+ const throttleOnChange = React.useRef(throttle_1.default(props.onChange, 600, { leading: false }));
44
+ const handleChange = React.useCallback((event) => {
45
+ const newValue = event.target.value;
46
+ setStateValue(newValue);
47
+ throttleOnChange.current(newValue);
48
+ }, []);
49
+ React.useEffect(() => {
50
+ setStateValue(props.value);
51
+ }, [props.value]);
52
+ return React.createElement(Input_1.default, { style: props.style, value: stateValue, onChange: handleChange });
53
+ });
54
+ const tableDOMProps = {
55
+ style: {
56
+ height: '100%',
57
+ minWidth: '10rem',
58
+ minHeight: 600,
59
+ },
60
+ };
40
61
  const ColumnsList = ({ columns: cols, handle, onValidityChange, onChange, onSelectionChange, selectedColumns, }) => {
41
62
  const rerender = useForceRender();
42
63
  const columnsRef = react_1.useRef(cols);
@@ -72,7 +93,7 @@ const ColumnsList = ({ columns: cols, handle, onValidityChange, onChange, onSele
72
93
  }
73
94
  return c;
74
95
  });
75
- silentSetColumns(cols);
96
+ setColumns(cols);
76
97
  };
77
98
  const onColumnTypeChange = (col, type) => {
78
99
  const cols = getColumns().map((c) => {
@@ -131,144 +152,181 @@ const ColumnsList = ({ columns: cols, handle, onValidityChange, onChange, onSele
131
152
  });
132
153
  const allIncluded = isAllIncludedColumns();
133
154
  const allExcluded = isNoneIncludedColumns();
134
- const colItems = [
135
- { Content: 'Primary Key', Size: 3, key: 'pk' },
136
- {
137
- key: 'included',
138
- Content: (React.createElement("b", null,
139
- React.createElement("div", null, "Included"),
140
- React.createElement(CheckBox_1.CheckBox, { checked: allIncluded ? true : allExcluded ? false : null, onChange: (allIncluded) => {
141
- if (allIncluded) {
142
- includeAllColumns();
143
- }
144
- else {
145
- excludeAllColumns();
155
+ React.useEffect(() => {
156
+ onValidityChange(isIncludedColumn(primaryKeyField));
157
+ }, [includedColumnsMap, primaryKeyField]);
158
+ const rowHeight = 40;
159
+ const data = columns;
160
+ const CellWrapper = (props) => {
161
+ return (React.createElement(rebass_1.Flex, Object.assign({}, props, { style: Object.assign(Object.assign({}, props.style), { position: 'absolute', textAlign: 'center', top: 0, left: 0, height: '100%', width: '100%', whiteSpace: 'normal' }), justifyContent: "center", alignItems: "center" }), props.children));
162
+ };
163
+ const HeaderCellWrapper = (props) => (React.createElement(CellWrapper, Object.assign({}, props, { fontSize: 3, style: { fontWeight: 600 } })));
164
+ const HeaderWithCheckbox = (props) => {
165
+ const { label, onChange, checked } = props, flexProps = tslib_1.__rest(props, ["label", "onChange", "checked"]);
166
+ return (React.createElement(HeaderCellWrapper, Object.assign({}, flexProps, { flexDirection: "column" }),
167
+ React.createElement(rebass_1.Box, null, label),
168
+ React.createElement(rebass_1.Box, { style: { textAlign: 'center' } },
169
+ React.createElement(CheckBox_1.CheckBox, { checked: checked, onChange: onChange }))));
170
+ };
171
+ const columnsMap = {
172
+ pk: {
173
+ header: () => React.createElement(HeaderCellWrapper, null, "Primary Key"),
174
+ maxWidth: 80,
175
+ sortable: false,
176
+ render: (params) => {
177
+ const { data } = params;
178
+ const column = data;
179
+ const isPrimaryKey = (column === null || column === void 0 ? void 0 : column.field) === primaryKeyField;
180
+ return (React.createElement(Radio_1.default, { checked: isPrimaryKey, onChange: (checked) => {
181
+ if (checked && isIncludedColumn(column.field)) {
182
+ setPrimaryKeyField(column.field);
146
183
  }
147
- } }))),
148
- Size: 3,
184
+ } }));
185
+ },
149
186
  },
150
- { Content: 'Field', Size: 5, key: 'field' },
151
- { Content: 'Type', Size: 4, key: 'size' },
152
- {
153
- key: 'sortable',
154
- Content: (React.createElement("b", null,
155
- React.createElement("div", null, "Sortable"),
156
- React.createElement(CheckBox_1.CheckBox, { checked: isAllSortableColumns() ? true : isNoneSortableColumns() ? false : null, onChange: (allSortable) => {
157
- if (allSortable) {
158
- setAllSortable();
159
- }
160
- else {
161
- setAllUnsortable();
162
- }
163
- } }))),
164
- Size: 3,
187
+ included: {
188
+ maxWidth: 80,
189
+ resizable: true,
190
+ header: () => (React.createElement(HeaderWithCheckbox, { label: "Included", checked: allIncluded ? true : allExcluded ? false : null, onChange: (allIncluded) => {
191
+ if (allIncluded) {
192
+ includeAllColumns();
193
+ }
194
+ else {
195
+ excludeAllColumns();
196
+ }
197
+ } })),
198
+ render: (params) => {
199
+ const column = params.data;
200
+ return (React.createElement(CellWrapper, null,
201
+ React.createElement(CheckBox_1.CheckBox, { checked: isIncludedColumn(column.field), onChange: (included) => {
202
+ if (included) {
203
+ includeColumn(column.field);
204
+ }
205
+ else {
206
+ excludeColumn(column.field);
207
+ }
208
+ } })));
209
+ },
165
210
  },
166
- {
167
- key: 'editable',
168
- Content: (React.createElement("b", null,
169
- React.createElement("div", null, "Editable"),
170
- React.createElement(CheckBox_1.CheckBox, { checked: isAllEditableColumns() ? true : isNoneEditableColumns() ? false : null, onChange: (allEditable) => {
171
- if (allEditable) {
172
- setAllEditable();
173
- }
174
- else {
175
- setAllUneditable();
176
- }
177
- } }))),
178
- Size: 3,
211
+ field: {
212
+ header: React.createElement(HeaderCellWrapper, null, "Field"),
213
+ field: 'field',
214
+ minWidth: 150,
215
+ render: (params) => {
216
+ const column = params.data;
217
+ const humanized = StringExtensions_1.default.Humanize(column.field);
218
+ return (React.createElement(rebass_1.Box, { p: 2 },
219
+ React.createElement(ThrottledInput, { key: column.field, style: inputStyle, value: column.caption != undefined ? column.caption : humanized, placeholder: humanized, onChange: (value) => {
220
+ setColumnCaption(value, column.field);
221
+ } })));
222
+ },
179
223
  },
180
- {
181
- Size: 3,
182
- key: 'resizable',
183
- Content: (React.createElement("b", null,
184
- React.createElement("div", null, "Resizable"),
185
- React.createElement(CheckBox_1.CheckBox, { checked: isAllResizableColumns() ? true : isNoneResizableColumns() ? false : null, onChange: (allResizable) => {
186
- if (allResizable) {
187
- setAllResizable();
188
- }
189
- else {
190
- setAllUnresizable();
191
- }
192
- } }))),
224
+ type: {
225
+ header: React.createElement(HeaderCellWrapper, null, "Type"),
226
+ maxWidth: 140,
227
+ render: (params) => {
228
+ var _a;
229
+ const column = params.data;
230
+ return (React.createElement(CellWrapper, { paddingLeft: 1, paddingRight: 1 },
231
+ React.createElement(Dropdown_1.default, { style: inputStyle, showClearButton: false, options: dataTypes, value: (_a = column === null || column === void 0 ? void 0 : column.type) !== null && _a !== void 0 ? _a : '', onChange: onColumnTypeChange.bind(null, column) })));
232
+ },
193
233
  },
194
- {
195
- Size: 3,
196
- key: 'enableRowGroup',
197
- Content: (React.createElement("b", null,
198
- React.createElement("div", null, "Groupable"),
199
- React.createElement(CheckBox_1.CheckBox, { checked: isAllGroupableColumns() ? true : isNoneGroupableColumns() ? false : null, onChange: (allGroupable) => {
200
- if (allGroupable) {
201
- setAllGroupable();
202
- }
203
- else {
204
- setAllUngroupable();
205
- }
206
- } }))),
234
+ sortable: {
235
+ header: (React.createElement(HeaderWithCheckbox, { label: "Sortable", checked: isAllSortableColumns() ? true : isNoneSortableColumns() ? false : null, onChange: (allSortable) => {
236
+ if (allSortable) {
237
+ setAllSortable();
238
+ }
239
+ else {
240
+ setAllUnsortable();
241
+ }
242
+ } })),
243
+ render: (params) => {
244
+ const column = params.data;
245
+ return (React.createElement(CheckBox_1.CheckBox, { checked: isSortableColumn(column.field), onChange: (sortable) => {
246
+ sortable ? setSortableColumn(column.field) : setUnsortableColumn(column.field);
247
+ } }));
248
+ },
207
249
  },
208
- {
209
- Content: (React.createElement("b", null,
210
- React.createElement("div", null, "Filterable"),
211
- React.createElement(CheckBox_1.CheckBox, { checked: isAllFilterableColumns() ? true : isNoneFilterableColumns() ? false : null, onChange: (allFilterable) => {
212
- if (allFilterable) {
213
- setAllFilterable();
214
- }
215
- else {
216
- setAllUnfilterable();
217
- }
218
- } }))),
219
- Size: 3,
220
- key: 'filterable',
250
+ editable: {
251
+ header: (React.createElement(HeaderWithCheckbox, { label: "Editable", checked: isAllEditableColumns() ? true : isNoneEditableColumns() ? false : null, onChange: (allEditable) => {
252
+ if (allEditable) {
253
+ setAllEditable();
254
+ }
255
+ else {
256
+ setAllUneditable();
257
+ }
258
+ } })),
259
+ render: (params) => {
260
+ const col = params.data;
261
+ return (React.createElement(CellWrapper, null,
262
+ React.createElement(CheckBox_1.CheckBox, { checked: isEditableColumn(col.field), onChange: (editable) => {
263
+ editable ? setEditableColumn(col.field) : setUneditableColumn(col.field);
264
+ } })));
265
+ },
221
266
  },
222
- ];
223
- const items = columns.map((col) => {
224
- var _a;
225
- const isPrimaryKey = col.field === primaryKeyField;
226
- const cItems = colItems.map((c) => (Object.assign({}, c)));
227
- cItems[0].Content = (React.createElement(Radio_1.default, { checked: isPrimaryKey, onChange: (checked) => {
228
- if (checked && isIncludedColumn(col.field)) {
229
- setPrimaryKeyField(col.field);
230
- }
231
- } }));
232
- cItems[1].Content = (React.createElement(CheckBox_1.CheckBox, { checked: isIncludedColumn(col.field), onChange: (included) => {
233
- if (included) {
234
- includeColumn(col.field);
235
- }
236
- else {
237
- excludeColumn(col.field);
238
- }
239
- } }));
240
- const humanized = StringExtensions_1.default.Humanize(col.field);
241
- cItems[2].Content = (React.createElement(Input_1.default, { style: inputStyle, defaultValue: col.caption != undefined ? col.caption : humanized, placeholder: humanized, onChange: (event) => {
242
- setColumnCaption(event.target.value, col.field);
243
- } }));
244
- cItems[3].Content = (React.createElement(Dropdown_1.default, { style: inputStyle, showClearButton: false, options: dataTypes, value: (_a = col === null || col === void 0 ? void 0 : col.type) !== null && _a !== void 0 ? _a : '', onChange: onColumnTypeChange.bind(null, col) }));
245
- cItems[4].Content = (React.createElement(CheckBox_1.CheckBox, { checked: isSortableColumn(col.field), onChange: (sortable) => {
246
- sortable ? setSortableColumn(col.field) : setUnsortableColumn(col.field);
247
- } }));
248
- cItems[5].Content = (React.createElement(CheckBox_1.CheckBox, { checked: isEditableColumn(col.field), onChange: (editable) => {
249
- editable ? setEditableColumn(col.field) : setUneditableColumn(col.field);
250
- } }));
251
- cItems[6].Content = (React.createElement(CheckBox_1.CheckBox, { checked: isResizableColumn(col.field), onChange: (resizable) => {
252
- resizable ? setResizableColumn(col.field) : setUnresizableColumn(col.field);
253
- } }));
254
- cItems[7].Content = (React.createElement(CheckBox_1.CheckBox, { checked: isGroupableColumn(col.field), onChange: (groupable) => {
255
- groupable ? setGroupableColumn(col.field) : setUngroupableColumn(col.field);
256
- } }));
257
- cItems[8].Content = (React.createElement(CheckBox_1.CheckBox, { checked: isFilterableColumn(col.field), onChange: (filterable) => {
258
- filterable ? setFilterableColumn(col.field) : setUnFilterableColumn(col.field);
259
- } }));
260
- return React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { key: col.field, colItems: cItems, style: { cursor: 'pointer' } });
261
- });
262
- React.useEffect(() => {
263
- onValidityChange(isIncludedColumn(primaryKeyField));
264
- }, [includedColumnsMap, primaryKeyField]);
265
- return (React.createElement(AdaptableObjectCollection_1.AdaptableObjectCollection, { headerAlign: "flex-start", style: {
266
- display: 'flex',
267
- flex: '1 1 auto',
268
- overflow: 'auto',
269
- flexFlow: 'column',
270
- textAlign: 'center',
271
- }, colItems: colItems, items: items }));
267
+ resizable: {
268
+ header: (React.createElement(HeaderWithCheckbox, { label: "Resizable", checked: isAllResizableColumns() ? true : isNoneResizableColumns() ? false : null, onChange: (allResizable) => {
269
+ if (allResizable) {
270
+ setAllResizable();
271
+ }
272
+ else {
273
+ setAllUnresizable();
274
+ }
275
+ } })),
276
+ render: (params) => {
277
+ const col = params.data;
278
+ return (React.createElement(CellWrapper, null,
279
+ React.createElement(CheckBox_1.CheckBox, { checked: isResizableColumn(col.field), onChange: (resizable) => {
280
+ resizable ? setResizableColumn(col.field) : setUnresizableColumn(col.field);
281
+ } })));
282
+ },
283
+ },
284
+ groupable: {
285
+ header: (React.createElement(HeaderWithCheckbox, { label: "Groupable", checked: isAllGroupableColumns() ? true : isNoneGroupableColumns() ? false : null, onChange: (allGroupable) => {
286
+ if (allGroupable) {
287
+ setAllGroupable();
288
+ }
289
+ else {
290
+ setAllUngroupable();
291
+ }
292
+ } })),
293
+ render: (params) => {
294
+ const col = params.data;
295
+ return (React.createElement(CellWrapper, null,
296
+ React.createElement(CheckBox_1.CheckBox, { checked: isGroupableColumn(col.field), onChange: (groupable) => {
297
+ groupable ? setGroupableColumn(col.field) : setUngroupableColumn(col.field);
298
+ } })));
299
+ },
300
+ },
301
+ filtrable: {
302
+ header: (React.createElement(HeaderWithCheckbox, { label: "Filtrable", checked: isAllFilterableColumns() ? true : isNoneFilterableColumns() ? false : null, onChange: (allFilterable) => {
303
+ if (allFilterable) {
304
+ setAllFilterable();
305
+ }
306
+ else {
307
+ setAllUnfilterable();
308
+ }
309
+ } })),
310
+ render: (params) => {
311
+ const col = params.data;
312
+ return (React.createElement(CellWrapper, null,
313
+ React.createElement(CheckBox_1.CheckBox, { checked: isFilterableColumn(col.field), onChange: (filterable) => {
314
+ filterable ? setFilterableColumn(col.field) : setUnFilterableColumn(col.field);
315
+ } })));
316
+ },
317
+ },
318
+ };
319
+ return (React.createElement(rebass_1.Box, { p: 2, style: { height: '100%' }, className: "light" },
320
+ React.createElement(InfiniteTable_1.DataSource, { data: data, primaryKey: "colId" },
321
+ React.createElement(InfiniteTable_1.InfiniteTable, { columnTypes: {
322
+ default: {
323
+ defaultFlex: 1,
324
+ align: 'center',
325
+ sortable: false,
326
+ },
327
+ }, headerOptions: {
328
+ alwaysReserveSpaceForSortIcon: false,
329
+ }, rowHeight: rowHeight, columnHeaderHeight: 65, domProps: tableDOMProps, columns: columnsMap }))));
272
330
  };
273
331
  function areEqual() {
274
332
  /**
@@ -9,9 +9,19 @@ const OnePageWizards_1 = require("../../Wizard/OnePageWizards");
9
9
  const ConfigurationWizardColumnsStep_1 = require("./ConfigurationWizardColumnsStep");
10
10
  const GridOptionsForm_1 = tslib_1.__importDefault(require("./GridOptionsForm"));
11
11
  const AdaptableOptionsForm_1 = tslib_1.__importDefault(require("./AdaptableOptionsForm"));
12
+ const EntitlementsForm_1 = tslib_1.__importDefault(require("./EntitlementsForm"));
13
+ const UiOptionsForm_1 = require("./UIOptions/UiOptionsForm");
12
14
  const ConfigurationWizard = (props) => {
13
15
  const [isPrimaryKeySelected, setIsValid] = React.useState(true);
14
- const [adaptableOptions, setAdaptableOptions] = react_1.useState(props.adaptableOptions);
16
+ const [adaptableOptions, setAdaptableOptions] = react_1.useState(() => {
17
+ var _a;
18
+ const gridOptionDefaults = {
19
+ sideBar: {
20
+ toolPanels: ['columns', 'filters', 'adaptable'],
21
+ },
22
+ };
23
+ return Object.assign(Object.assign({}, props.adaptableOptions), { gridOptions: Object.assign(Object.assign({}, gridOptionDefaults), (_a = props === null || props === void 0 ? void 0 : props.adaptableOptions) === null || _a === void 0 ? void 0 : _a.gridOptions) });
24
+ });
15
25
  const [selectedColumns, setSelectedColumns] = react_1.useState(() => {
16
26
  return props.adaptableOptions.gridOptions.columnDefs.reduce((acc, col) => {
17
27
  acc[col.field] = true;
@@ -77,22 +87,20 @@ const ConfigurationWizard = (props) => {
77
87
  setAdaptableOptions(abOptions);
78
88
  } })),
79
89
  },
80
- // JW - I would like at some point to do a page of Entitlements
81
- // to show all the Modules and let users select which are Full, ReadOnly or Hidden
82
- /*
83
90
  {
84
- title: 'Entitlements',
85
- details: 'Configure Entitlements',
86
- render: () => (
87
- <EntitlementsForm
88
- adaptableOptions={adaptableOptions}
89
- onChangeadaptableOptions={(abOptions) => {
90
- setAdaptableOptions(abOptions);
91
- }}
92
- />
93
- ),
91
+ title: 'UI Elements',
92
+ details: 'Configure UI Elements',
93
+ render: () => (React.createElement(UiOptionsForm_1.UIElementsForm, { adaptableOptions: adaptableOptions, onChangeadaptableOptions: (abOptions) => {
94
+ setAdaptableOptions(abOptions);
95
+ } })),
96
+ },
97
+ {
98
+ title: 'Entitlements',
99
+ details: 'Configure Entitlements',
100
+ render: () => (React.createElement(EntitlementsForm_1.default, { adaptableOptions: adaptableOptions, onChangeadaptableOptions: (abOptions) => {
101
+ setAdaptableOptions(abOptions);
102
+ } })),
94
103
  },
95
- */
96
104
  ];
97
105
  if (props.startSections) {
98
106
  sections = [
@@ -3,15 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConfigurationWizardColumnsStep = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
- const Panel_1 = tslib_1.__importDefault(require("../../../components/Panel"));
7
6
  const ColumnsList_1 = tslib_1.__importDefault(require("./ColumnsList"));
8
7
  const ConfigurationWizardColumnsStep = (props) => {
9
8
  var _a, _b;
10
- return (React.createElement(Panel_1.default, { header: '', border: "none", bodyScroll: false, bodyProps: {
11
- style: { overflow: 'auto', display: 'flex', flexFlow: 'column' },
12
- }, borderRadius: "none", style: { fontSize: 16, flex: 1 } },
13
- React.createElement(ColumnsList_1.default, { handle: props.columnsHandle, onValidityChange: (valid) => {
14
- props.setPrimaryKeyIsNotSelected(valid);
15
- }, selectedColumns: props.selectedColumns, onChange: props.onColumnChange, onSelectionChange: props.onSelectionChange, columns: (_b = (_a = props.adaptableOptions) === null || _a === void 0 ? void 0 : _a.gridOptions) === null || _b === void 0 ? void 0 : _b.columnDefs })));
9
+ return (React.createElement(ColumnsList_1.default, { handle: props.columnsHandle, onValidityChange: (valid) => {
10
+ props.setPrimaryKeyIsNotSelected(valid);
11
+ }, selectedColumns: props.selectedColumns, onChange: props.onColumnChange, onSelectionChange: props.onSelectionChange, columns: (_b = (_a = props.adaptableOptions) === null || _a === void 0 ? void 0 : _a.gridOptions) === null || _b === void 0 ? void 0 : _b.columnDefs }));
16
12
  };
17
13
  exports.ConfigurationWizardColumnsStep = ConfigurationWizardColumnsStep;
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { AdaptableOptions } from '../../../types';
3
3
  interface EntitlementsFormOptions {
4
4
  adaptableOptions: AdaptableOptions;
5
5
  onChangeadaptableOptions: (adaptableOptions: AdaptableOptions) => void;
6
6
  }
7
- declare const EntitlementsForm: (props: EntitlementsFormOptions) => JSX.Element;
7
+ declare const EntitlementsForm: React.FunctionComponent<EntitlementsFormOptions>;
8
8
  export default EntitlementsForm;
@@ -2,16 +2,156 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const React = tslib_1.__importStar(require("react"));
5
- const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
6
5
  const HelpBlock_1 = tslib_1.__importDefault(require("../../../components/HelpBlock"));
7
- const DefaultAdaptableOptions_1 = require("../../../Utilities/Defaults/DefaultAdaptableOptions");
6
+ const Types_1 = require("../../../PredefinedConfig/Common/Types");
7
+ const AdaptableObjectRow_1 = require("../../Components/AdaptableObjectRow");
8
+ const rebass_1 = require("rebass");
9
+ const Radio_1 = tslib_1.__importDefault(require("../../../components/Radio"));
10
+ const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
11
+ const ModuleConstants_1 = require("../../../Utilities/Constants/ModuleConstants");
12
+ const InfiniteTable_1 = require("../../../components/InfiniteTable");
13
+ const ALL_ENTITLEMENTS_MODULES = Types_1.ALL_MODULES;
14
+ const tableDOMProps = {
15
+ style: {
16
+ height: '100%',
17
+ minWidth: '10rem',
18
+ minHeight: 600,
19
+ },
20
+ };
21
+ const EntitlementsListForm = (props) => {
22
+ var _a, _b;
23
+ let abOptions = props.adaptableOptions;
24
+ const entitlements = (_b = (_a = abOptions === null || abOptions === void 0 ? void 0 : abOptions.entitlementOptions) === null || _a === void 0 ? void 0 : _a.moduleEntitlements) !== null && _b !== void 0 ? _b : [];
25
+ if (typeof entitlements === 'function') {
26
+ return (React.createElement(HelpBlock_1.default, { mt: 2 }, "Entitlements cannot be customized, they are handled by a custom function."));
27
+ }
28
+ const entitlementsMap = React.useMemo(() => {
29
+ return entitlements.reduce((acc, entitlement) => {
30
+ acc[entitlement.adaptableModule] = entitlement.accessLevel;
31
+ return acc;
32
+ }, {});
33
+ }, [abOptions === null || abOptions === void 0 ? void 0 : abOptions.entitlementOptions]);
34
+ const colItems = [
35
+ {
36
+ Content: React.createElement(rebass_1.Box, { style: { textAlign: 'left' } }, "Entitlement"),
37
+ Size: 3,
38
+ key: 'name',
39
+ },
40
+ {
41
+ Content: 'Visible',
42
+ Size: 3,
43
+ key: 'Visible',
44
+ },
45
+ {
46
+ Content: 'Read Only',
47
+ Size: 3,
48
+ key: 'ReadOnly',
49
+ },
50
+ {
51
+ Content: 'Hidden',
52
+ Size: 3,
53
+ key: 'Hidden',
54
+ },
55
+ ];
56
+ const handleOnChange = React.useCallback((module, accessLevel) => {
57
+ let newEntitlements = entitlements;
58
+ // change
59
+ if (entitlementsMap[module]) {
60
+ newEntitlements = newEntitlements.map((entitlement) => {
61
+ if (entitlement.adaptableModule === module) {
62
+ entitlement.accessLevel = accessLevel;
63
+ }
64
+ return entitlement;
65
+ });
66
+ }
67
+ else {
68
+ // new
69
+ newEntitlements = [
70
+ ...newEntitlements,
71
+ { adaptableModule: module, accessLevel: accessLevel },
72
+ ];
73
+ }
74
+ props.onChangeadaptableOptions(Object.assign(Object.assign({}, abOptions), { entitlementOptions: Object.assign(Object.assign({}, abOptions.entitlementOptions), { moduleEntitlements: newEntitlements }) }));
75
+ }, [abOptions === null || abOptions === void 0 ? void 0 : abOptions.entitlementOptions]);
76
+ const items = ALL_ENTITLEMENTS_MODULES.map((module) => {
77
+ const cItems = colItems.map((item) => (Object.assign({}, item)));
78
+ const accessLevel = entitlementsMap[module];
79
+ cItems[0].Content = React.createElement(rebass_1.Box, { style: { textAlign: 'left' } }, ModuleConstants_1.ADAPTABLE_MODULE_MAP[module]);
80
+ cItems[1].Content = (React.createElement(Radio_1.default, { onClick: () => handleOnChange(module, 'Full'), checked: accessLevel === 'Full' }));
81
+ cItems[2].Content = (React.createElement(Radio_1.default, { onClick: () => handleOnChange(module, 'ReadOnly'), checked: accessLevel === 'ReadOnly' }));
82
+ cItems[3].Content = (React.createElement(Radio_1.default, { onClick: () => handleOnChange(module, 'Hidden'), checked: accessLevel === 'Hidden' }));
83
+ return React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { key: module, colItems: cItems, style: { cursor: 'pointer' } });
84
+ });
85
+ if (typeof entitlements === 'function') {
86
+ return (React.createElement(HelpBlock_1.default, { mb: 2 }, "Entitlements cannot be customized, they are handled by a custom function."));
87
+ }
88
+ const columnsMap = {
89
+ name: {
90
+ header: 'Module Name',
91
+ align: 'start',
92
+ renderValue: (params) => {
93
+ return React.createElement(React.Fragment, null, params.data.name);
94
+ },
95
+ },
96
+ full: {
97
+ header: 'Full',
98
+ render: (params) => {
99
+ const module = params.data.name;
100
+ const accessLevel = entitlementsMap[module];
101
+ return (React.createElement(Radio_1.default, { onClick: () => handleOnChange(module, 'Full'), checked: accessLevel === 'Full' }));
102
+ },
103
+ },
104
+ readonly: {
105
+ header: 'Read Only',
106
+ render: (params) => {
107
+ const module = params.data.name;
108
+ const accessLevel = entitlementsMap[module];
109
+ return (React.createElement(Radio_1.default, { onClick: () => handleOnChange(module, 'ReadOnly'), checked: accessLevel === 'ReadOnly' }));
110
+ },
111
+ },
112
+ hidden: {
113
+ header: 'Hidden',
114
+ render: (params) => {
115
+ const module = params.data.name;
116
+ const accessLevel = entitlementsMap[module];
117
+ return (React.createElement(Radio_1.default, { onClick: () => handleOnChange(module, 'Hidden'), checked: accessLevel === 'Hidden' }));
118
+ },
119
+ },
120
+ };
121
+ const data = ALL_ENTITLEMENTS_MODULES.map((module) => ({ name: ModuleConstants_1.ADAPTABLE_MODULE_MAP[module] }));
122
+ return (React.createElement(rebass_1.Box, { flex: 1, height: "100%", className: "light" },
123
+ React.createElement(InfiniteTable_1.DataSource, { data: data, primaryKey: "name" },
124
+ React.createElement(InfiniteTable_1.InfiniteTable, { columnTypes: {
125
+ default: {
126
+ defaultFlex: 1,
127
+ align: 'center',
128
+ sortable: false,
129
+ },
130
+ }, headerOptions: {
131
+ alwaysReserveSpaceForSortIcon: false,
132
+ }, columnHeaderHeight: 50, domProps: tableDOMProps, columns: columnsMap }))));
133
+ };
134
+ const DefaultEntitlementForm = (props) => {
135
+ var _a, _b;
136
+ const abOptions = props.adaptableOptions;
137
+ const entitlementOptions = (_a = props.adaptableOptions) === null || _a === void 0 ? void 0 : _a.entitlementOptions;
138
+ const defaultEntitlement = entitlementOptions === null || entitlementOptions === void 0 ? void 0 : entitlementOptions.defaultAccessLevel;
139
+ if (typeof defaultEntitlement === 'function') {
140
+ return React.createElement(HelpBlock_1.default, { mb: 2 }, "Default Entitlement is controlled by a custom function");
141
+ }
142
+ const handleDefaultEntitlementChange = React.useCallback((accessLevel) => {
143
+ props.onChangeadaptableOptions(Object.assign(Object.assign({}, abOptions), { entitlementOptions: Object.assign(Object.assign({}, abOptions.entitlementOptions), { defaultAccessLevel: accessLevel }) }));
144
+ }, [(_b = abOptions === null || abOptions === void 0 ? void 0 : abOptions.entitlementOptions) === null || _b === void 0 ? void 0 : _b.defaultAccessLevel]);
145
+ return (React.createElement(FormLayout_1.default, { mb: 2 },
146
+ React.createElement(FormLayout_1.FormRow, { label: "Default Entitlement:" },
147
+ React.createElement(Radio_1.default, { onClick: () => handleDefaultEntitlementChange('Full'), checked: defaultEntitlement === 'Full', mr: 3 }, "Visible"),
148
+ React.createElement(Radio_1.default, { onClick: () => handleDefaultEntitlementChange('ReadOnly'), checked: defaultEntitlement === 'ReadOnly', mr: 3 }, "Read Only"),
149
+ React.createElement(Radio_1.default, { onClick: () => handleDefaultEntitlementChange('Hidden'), checked: defaultEntitlement === 'Hidden' }, "Hidden"))));
150
+ };
8
151
  const EntitlementsForm = (props) => {
9
152
  let abOptions = props.adaptableOptions;
10
- const entitlementOptions = Object.assign(Object.assign({}, DefaultAdaptableOptions_1.DefaultAdaptableOptions.entitlementOptions), abOptions.entitlementOptions);
11
- const gridOptions = Object.assign(Object.assign({}, DefaultAdaptableOptions_1.DefaultAdaptableOptions.gridOptions), abOptions.gridOptions);
12
- return (React.createElement(React.Fragment, null,
13
- React.createElement(HelpBlock_1.default, null, "EntitlementOptions Options"),
14
- React.createElement(FormLayout_1.default, { margin: 2, columns: [{ name: 'children' }, { name: 'label', style: { textAlign: 'start' } }] },
15
- React.createElement(FormLayout_1.FormRow, { label: "Entitlements to be set here" }))));
153
+ return (React.createElement(rebass_1.Flex, { height: "100%", flexDirection: "column", p: 2 },
154
+ React.createElement(DefaultEntitlementForm, Object.assign({}, props)),
155
+ React.createElement(EntitlementsListForm, Object.assign({}, props))));
16
156
  };
17
157
  exports.default = EntitlementsForm;