@adaptabletools/adaptable 12.1.6 → 12.1.8-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/base.css +11 -49
  2. package/bundle.cjs.js +106 -106
  3. package/index.css +13 -60
  4. package/package.json +1 -1
  5. package/publishTimestamp.d.ts +1 -1
  6. package/publishTimestamp.js +1 -1
  7. package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -0
  8. package/src/AdaptableOptions/ColumnOptions.d.ts +2 -4
  9. package/src/AdaptableOptions/FilterOptions.d.ts +12 -0
  10. package/src/AdaptableOptions/FinancePluginOptions.d.ts +22 -1
  11. package/src/AdaptableOptions/StateOptions.d.ts +25 -12
  12. package/src/Api/ColumnApi.d.ts +5 -0
  13. package/src/Api/ExportApi.d.ts +5 -0
  14. package/src/Api/FilterApi.d.ts +23 -0
  15. package/src/Api/FlashingCellApi.d.ts +8 -0
  16. package/src/Api/GridApi.d.ts +1 -0
  17. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
  18. package/src/Api/Implementation/ColumnApiImpl.js +5 -1
  19. package/src/Api/Implementation/ExportApiImpl.d.ts +3 -1
  20. package/src/Api/Implementation/ExportApiImpl.js +19 -3
  21. package/src/Api/Implementation/FilterApiImpl.d.ts +5 -0
  22. package/src/Api/Implementation/FilterApiImpl.js +35 -3
  23. package/src/Api/Implementation/FlashingCellApiImpl.d.ts +1 -0
  24. package/src/Api/Implementation/FlashingCellApiImpl.js +4 -0
  25. package/src/Api/Implementation/GridApiImpl.d.ts +1 -0
  26. package/src/Api/Implementation/InternalApiImpl.d.ts +0 -1
  27. package/src/Api/Implementation/InternalApiImpl.js +0 -3
  28. package/src/Api/Implementation/PredicateApiImpl.js +4 -0
  29. package/src/Api/Implementation/QueryLanguageApiImpl.js +9 -1
  30. package/src/Api/InternalApi.d.ts +0 -1
  31. package/src/Api/SystemStatusApi.d.ts +1 -1
  32. package/src/Api/ToolPanelApi.d.ts +1 -1
  33. package/src/PredefinedConfig/CalculatedColumnState.d.ts +2 -2
  34. package/src/PredefinedConfig/Common/AdaptablePredicate.js +30 -10
  35. package/src/PredefinedConfig/Common/AdaptableQuery.js +1 -1
  36. package/src/PredefinedConfig/Common/AggregationColumns.d.ts +6 -0
  37. package/src/PredefinedConfig/Common/AggregationColumns.js +4 -0
  38. package/src/PredefinedConfig/Common/ColumnFilter.d.ts +2 -2
  39. package/src/PredefinedConfig/Common/Enums.d.ts +0 -15
  40. package/src/PredefinedConfig/Common/Enums.js +1 -18
  41. package/src/PredefinedConfig/Common/SpecialColumnSettings.d.ts +6 -6
  42. package/src/PredefinedConfig/ExportState.d.ts +12 -4
  43. package/src/PredefinedConfig/LayoutState.d.ts +2 -1
  44. package/src/PredefinedConfig/PopupState.d.ts +1 -2
  45. package/src/Redux/ActionsReducers/AlertRedux.d.ts +1 -1
  46. package/src/Redux/ActionsReducers/AlertRedux.js +1 -1
  47. package/src/Redux/ActionsReducers/ConditionalStyleRedux.d.ts +1 -1
  48. package/src/Redux/ActionsReducers/ConditionalStyleRedux.js +1 -1
  49. package/src/Redux/ActionsReducers/CustomSortRedux.d.ts +1 -1
  50. package/src/Redux/ActionsReducers/CustomSortRedux.js +1 -1
  51. package/src/Redux/ActionsReducers/FlashingCellRedux.d.ts +1 -1
  52. package/src/Redux/ActionsReducers/FlashingCellRedux.js +1 -1
  53. package/src/Redux/ActionsReducers/FormatColumnRedux.d.ts +1 -1
  54. package/src/Redux/ActionsReducers/FormatColumnRedux.js +1 -1
  55. package/src/Redux/ActionsReducers/LayoutRedux.d.ts +28 -0
  56. package/src/Redux/ActionsReducers/LayoutRedux.js +80 -2
  57. package/src/Redux/ActionsReducers/PlusMinusRedux.d.ts +1 -1
  58. package/src/Redux/ActionsReducers/PlusMinusRedux.js +1 -1
  59. package/src/Redux/ActionsReducers/PopupRedux.d.ts +0 -2
  60. package/src/Redux/ActionsReducers/PopupRedux.js +1 -28
  61. package/src/Redux/ActionsReducers/ScheduleRedux.d.ts +5 -5
  62. package/src/Redux/ActionsReducers/ScheduleRedux.js +5 -5
  63. package/src/Redux/ActionsReducers/ShortcutRedux.d.ts +1 -1
  64. package/src/Redux/ActionsReducers/ShortcutRedux.js +1 -1
  65. package/src/Redux/ActionsReducers/SystemRedux.d.ts +1 -2
  66. package/src/Redux/ActionsReducers/SystemRedux.js +1 -2
  67. package/src/Redux/Store/AdaptableStore.js +20 -6
  68. package/src/Strategy/AlertModule.d.ts +1 -0
  69. package/src/Strategy/AlertModule.js +20 -0
  70. package/src/Strategy/CalculatedColumnModule.js +2 -2
  71. package/src/Strategy/ExportModule.d.ts +0 -1
  72. package/src/Strategy/ExportModule.js +0 -16
  73. package/src/Strategy/FilterModule.js +6 -0
  74. package/src/Strategy/FlashingCellModule.js +2 -2
  75. package/src/Strategy/Interface/IModule.d.ts +4 -0
  76. package/src/Strategy/LayoutModule.js +20 -20
  77. package/src/Strategy/Utilities/FormatColumn/getFormatColumnStyleViewItems.js +16 -1
  78. package/src/Strategy/Utilities/Layout/getLayoutFilterViewItems.js +15 -11
  79. package/src/Utilities/Constants/DocumentationLinkConstants.d.ts +1 -0
  80. package/src/Utilities/Constants/DocumentationLinkConstants.js +2 -1
  81. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +2 -0
  82. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +12 -2
  83. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +30 -66
  84. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +22 -6
  85. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +423 -220
  86. package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.d.ts +7 -1
  87. package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.js +23 -7
  88. package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.d.ts +0 -1
  89. package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.js +6 -54
  90. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +17 -5
  91. package/src/Utilities/Helpers/CalendarHelper.js +10 -7
  92. package/src/Utilities/Helpers/DateHelper.d.ts +0 -26
  93. package/src/Utilities/Helpers/DateHelper.js +2 -32
  94. package/src/Utilities/Interface/MessagePopups.d.ts +0 -4
  95. package/src/Utilities/ObjectFactory.d.ts +6 -4
  96. package/src/Utilities/ObjectFactory.js +30 -17
  97. package/src/Utilities/Services/AggregatedScalarLiveValue.d.ts +25 -0
  98. package/src/Utilities/Services/AggregatedScalarLiveValue.js +103 -0
  99. package/src/Utilities/Services/AlertService.d.ts +0 -1
  100. package/src/Utilities/Services/AlertService.js +5 -17
  101. package/src/Utilities/Services/CalculatedColumnExpressionService.d.ts +4 -4
  102. package/src/Utilities/Services/CalculatedColumnExpressionService.js +29 -154
  103. package/src/Utilities/Services/Interface/ICalculatedColumnExpressionService.d.ts +2 -2
  104. package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +6 -3
  105. package/src/Utilities/Services/QueryLanguageService.d.ts +6 -3
  106. package/src/Utilities/Services/QueryLanguageService.js +23 -6
  107. package/src/Utilities/Services/ReportService.js +47 -46
  108. package/src/View/AdaptableView.js +1 -2
  109. package/src/View/CalculatedColumn/Utilities/getCalculatedColumnSettingsTags.d.ts +2 -0
  110. package/src/View/CalculatedColumn/Utilities/{getCalculatedColumnSettingTags.js → getCalculatedColumnSettingsTags.js} +5 -3
  111. package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.d.ts +10 -0
  112. package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.js +80 -0
  113. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +21 -15
  114. package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.d.ts +1 -2
  115. package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +10 -53
  116. package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +14 -3
  117. package/src/View/Components/AdaptableDateInput/index.js +1 -1
  118. package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +42 -6
  119. package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +1 -1
  120. package/src/View/Components/EntityRulesEditor/index.js +26 -5
  121. package/src/View/Components/FilterForm/FilterForm.js +8 -4
  122. package/src/View/Components/FilterForm/ListBoxFilterForm.js +1 -0
  123. package/src/View/Components/FilterForm/QuickFilterForm.js +10 -6
  124. package/src/View/Components/PermittedValuesSelector/PermitedValuesSelector.d.ts +9 -0
  125. package/src/View/Components/PermittedValuesSelector/PermitedValuesSelector.js +28 -0
  126. package/src/View/Components/PermittedValuesSelector/index.d.ts +1 -0
  127. package/src/View/Components/PermittedValuesSelector/index.js +5 -0
  128. package/src/View/Components/Popups/AdaptablePopup/Navigation.js +2 -2
  129. package/src/View/Components/Popups/AdaptableToaster.js +2 -7
  130. package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +0 -1
  131. package/src/View/Components/Popups/WindowPopups/windowFactory.js +1 -4
  132. package/src/View/Export/ExportViewPanel.d.ts +1 -2
  133. package/src/View/Export/ExportViewPanel.js +2 -6
  134. package/src/View/Export/Wizard/ReportColumnTypeWizard.d.ts +1 -2
  135. package/src/View/Export/Wizard/ReportColumnTypeWizard.js +11 -12
  136. package/src/View/Export/Wizard/ReportRowTypeWizard.d.ts +1 -2
  137. package/src/View/Export/Wizard/ReportRowTypeWizard.js +12 -13
  138. package/src/View/Export/Wizard/ReportSettingsWizard.js +1 -2
  139. package/src/View/Filter/FilterViewPanel.js +20 -4
  140. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +1 -1
  141. package/src/View/FreeTextColumn/FreeTextColumnSummary.js +1 -2
  142. package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.d.ts +1 -1
  143. package/src/View/FreeTextColumn/Wizard/FreeTextColumnWizard.js +1 -1
  144. package/src/View/Layout/Wizard/{LayoutEditor → Components}/ColumnLabels.d.ts +0 -0
  145. package/src/View/Layout/Wizard/{LayoutEditor → Components}/ColumnLabels.js +0 -0
  146. package/src/View/Layout/Wizard/LayoutWizard.js +1 -0
  147. package/src/View/Layout/Wizard/sections/AggregationsSection.d.ts +1 -0
  148. package/src/View/Layout/Wizard/sections/AggregationsSection.js +69 -8
  149. package/src/View/Layout/Wizard/sections/ColumnsSection.js +1 -1
  150. package/src/View/Query/QueryViewPanel.js +1 -1
  151. package/src/agGrid/Adaptable.d.ts +11 -3
  152. package/src/agGrid/Adaptable.js +224 -150
  153. package/src/agGrid/agGridHelper.d.ts +1 -0
  154. package/src/agGrid/agGridHelper.js +5 -3
  155. package/src/agGrid/agGridMenuHelper.d.ts +1 -0
  156. package/src/agGrid/agGridMenuHelper.js +4 -2
  157. package/src/agGrid/weightedAverage.d.ts +6 -0
  158. package/src/agGrid/weightedAverage.js +66 -0
  159. package/src/bundle-dependencies/bundles/react-toastify/index.js +1 -1
  160. package/src/components/ExpressionEditor/BaseEditorInput.d.ts +1 -0
  161. package/src/components/ExpressionEditor/BaseEditorInput.js +2 -3
  162. package/src/components/ExpressionEditor/EditorInput.d.ts +1 -1
  163. package/src/components/ExpressionEditor/EditorInput.js +24 -4
  164. package/src/components/ExpressionEditor/{EditorInputReactive.d.ts → EditorInputWithWhereClause.d.ts} +3 -3
  165. package/src/components/ExpressionEditor/{EditorInputReactive.js → EditorInputWithWhereClause.js} +6 -5
  166. package/src/components/ExpressionEditor/editorButtonsAggregatedBoolean.d.ts +2 -0
  167. package/src/components/ExpressionEditor/{editorButtonsReactive.js → editorButtonsAggregatedBoolean.js} +22 -37
  168. package/src/components/ExpressionEditor/editorButtonsAggregatedScalar.js +5 -10
  169. package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.d.ts +2 -0
  170. package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.js +50 -0
  171. package/src/components/ExpressionEditor/editorButtonsObservable.d.ts +2 -0
  172. package/src/components/ExpressionEditor/editorButtonsObservable.js +40 -0
  173. package/src/components/ExpressionEditor/index.d.ts +1 -1
  174. package/src/components/ExpressionEditor/index.js +26 -5
  175. package/src/metamodel/adaptable.metamodel.d.ts +55 -1
  176. package/src/metamodel/adaptable.metamodel.js +1 -1
  177. package/src/types.d.ts +3 -3
  178. package/version.d.ts +1 -1
  179. package/version.js +1 -1
  180. package/src/View/CalculatedColumn/Utilities/getCalculatedColumnSettingTags.d.ts +0 -2
  181. package/src/View/Layout/LayoutEditorStandalonePopup.d.ts +0 -3
  182. package/src/View/Layout/LayoutEditorStandalonePopup.js +0 -78
  183. package/src/View/Layout/Wizard/LayoutEditor/ColumnList.d.ts +0 -27
  184. package/src/View/Layout/Wizard/LayoutEditor/ColumnList.js +0 -86
  185. package/src/View/Layout/Wizard/LayoutEditor/ColumnSortList.d.ts +0 -16
  186. package/src/View/Layout/Wizard/LayoutEditor/ColumnSortList.js +0 -89
  187. package/src/View/Layout/Wizard/LayoutEditor/PivotList.d.ts +0 -15
  188. package/src/View/Layout/Wizard/LayoutEditor/PivotList.js +0 -70
  189. package/src/View/Layout/Wizard/LayoutEditor/RowGroupsList.d.ts +0 -15
  190. package/src/View/Layout/Wizard/LayoutEditor/RowGroupsList.js +0 -70
  191. package/src/View/Layout/Wizard/LayoutEditor/droppableIds.d.ts +0 -7
  192. package/src/View/Layout/Wizard/LayoutEditor/droppableIds.js +0 -11
  193. package/src/View/Layout/Wizard/LayoutEditor/getItemStyle.d.ts +0 -6
  194. package/src/View/Layout/Wizard/LayoutEditor/getItemStyle.js +0 -26
  195. package/src/View/Layout/Wizard/LayoutEditor/index.d.ts +0 -9
  196. package/src/View/Layout/Wizard/LayoutEditor/index.js +0 -367
  197. package/src/View/Layout/Wizard/LayoutEditor/reducer.d.ts +0 -28
  198. package/src/View/Layout/Wizard/LayoutEditor/reducer.js +0 -46
  199. package/src/View/Layout/Wizard/LayoutEditor/utils.d.ts +0 -10
  200. package/src/View/Layout/Wizard/LayoutEditor/utils.js +0 -14
  201. package/src/View/Layout/Wizard/LayoutEditorWizard.d.ts +0 -30
  202. package/src/View/Layout/Wizard/LayoutEditorWizard.js +0 -132
  203. package/src/components/ExpressionEditor/editorButtonsReactive.d.ts +0 -2
@@ -1,367 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LayoutEditor = void 0;
4
- const tslib_1 = require("tslib");
5
- const React = tslib_1.__importStar(require("react"));
6
- const react_beautiful_dnd_1 = require("react-beautiful-dnd");
7
- const rebass_1 = require("rebass");
8
- const Panel_1 = tslib_1.__importDefault(require("../../../../components/Panel"));
9
- const ColumnList_1 = require("./ColumnList");
10
- const CheckBox_1 = require("../../../../components/CheckBox");
11
- const icons_1 = require("../../../../components/icons");
12
- const SimpleButton_1 = tslib_1.__importDefault(require("../../../../components/SimpleButton"));
13
- const ColumnSortList_1 = require("./ColumnSortList");
14
- const RowGroupsList_1 = require("./RowGroupsList");
15
- const droppableIds_1 = require("./droppableIds");
16
- const react_1 = require("react");
17
- const getItemStyle_1 = require("./getItemStyle");
18
- const reducer_1 = require("./reducer");
19
- const DropdownButton_1 = tslib_1.__importDefault(require("../../../../components/DropdownButton"));
20
- const PivotList_1 = require("./PivotList");
21
- const ButtonInfo_1 = require("../../../Components/Buttons/ButtonInfo");
22
- const Input_1 = tslib_1.__importDefault(require("../../../../components/Input"));
23
- const StringExtensions_1 = tslib_1.__importDefault(require("../../../../Utilities/Extensions/StringExtensions"));
24
- const ColumnLabels_1 = require("./ColumnLabels");
25
- const verticalPanelStyle = {
26
- minHeight: 150,
27
- overflow: 'auto',
28
- };
29
- const ListPanel = (props) => (React.createElement(Panel_1.default, Object.assign({ variant: "modern", bodyProps: { padding: 0 }, style: Object.assign(Object.assign({}, verticalPanelStyle), props.style) }, props)));
30
- function areEqual(_prevProps, _nextProps) {
31
- /*
32
- * For now we don't need updates from the parent - the initial layout we receive on mount is enough
33
- * so for performance reasons, skip updating this component on subsequent renders
34
- *
35
- */
36
- return true;
37
- }
38
- exports.LayoutEditor = React.memo((props) => {
39
- const { api } = props;
40
- const allColumns = React.useMemo(() => api.columnApi.getColumns(), []);
41
- const initialState = React.useMemo(() => reducer_1.getInitialState(props.layout), []);
42
- const [state, dispatch] = React.useReducer(reducer_1.reducer, initialState);
43
- const { layout } = state;
44
- const allColumnsMap = React.useMemo(() => {
45
- return allColumns.reduce((acc, col) => {
46
- acc[col.columnId] = col;
47
- return acc;
48
- }, {});
49
- }, [allColumns]);
50
- const tmpMap = {};
51
- const [columnList, setColumnList] = React.useState(layout.Columns.map((colId) => {
52
- const col = allColumnsMap[colId];
53
- tmpMap[colId] = col;
54
- return col;
55
- })
56
- .concat(allColumns.filter((col) => {
57
- return !tmpMap[col.columnId];
58
- }))
59
- .filter((c) => c));
60
- const setLayout = (layout) => {
61
- dispatch({
62
- type: reducer_1.LayoutEditorActions.SET_LAYOUT,
63
- payload: layout,
64
- });
65
- if (props.onLayoutChange) {
66
- props.onLayoutChange(layout);
67
- }
68
- };
69
- React.useEffect(() => {
70
- if (props.layout !== state.layout) {
71
- setLayout(props.layout);
72
- }
73
- }, [props.layout]);
74
- const visibleColumnsMap = React.useMemo(() => {
75
- return allColumns.reduce((acc, col) => {
76
- acc[col.columnId] = layout.Columns.indexOf(col.columnId) != -1 ? col : null;
77
- return acc;
78
- }, {});
79
- }, [layout, allColumns]);
80
- const aggregationColumnsMap = React.useMemo(() => {
81
- return Object.keys(layout.AggregationColumns || {}).reduce((acc, colId) => {
82
- let fn = layout.AggregationColumns[colId];
83
- if (typeof fn === 'boolean') {
84
- fn = allColumnsMap[colId].aggregationFunction;
85
- }
86
- acc[colId] = fn;
87
- return acc;
88
- }, {});
89
- }, [allColumnsMap, layout]);
90
- const headerColumnsMap = React.useMemo(() => {
91
- var _a;
92
- return Object.keys((_a = layout.ColumnHeadersMap) !== null && _a !== void 0 ? _a : {}).reduce((acc, colId) => {
93
- let customHeader = layout.ColumnHeadersMap[colId];
94
- if (typeof customHeader === 'string') {
95
- acc[colId] = customHeader;
96
- }
97
- return acc;
98
- }, {});
99
- }, [allColumnsMap, layout]);
100
- const setColumnVisibility = (c, visible) => {
101
- const newLayout = visible
102
- ? Object.assign(Object.assign({}, layout), { Columns: columnList
103
- .filter((col) => visibleColumnsMap[col.columnId] || col.columnId === c.columnId)
104
- .map((c) => c.columnId) }) : Object.assign(Object.assign({}, layout), { Columns: layout.Columns.filter((colId) => colId !== c.columnId) });
105
- const previousGroupCols = getAgGridGroupAutoColumn(layout);
106
- const currentGroupCols = getAgGridGroupAutoColumn(newLayout);
107
- if (previousGroupCols.length !== currentGroupCols.length) {
108
- const missingGroupCols = previousGroupCols.filter((col) => !currentGroupCols.includes(col));
109
- // the AG Grid group auto-columns got lost (because it's not part of the persistent column definition)
110
- // Adaptable can handle this because it will be auto-generated at the next grid init (OK), but it will mess up the teamsharing revisions (NOK)
111
- // therefore we insert them back
112
- newLayout.Columns = [...missingGroupCols, ...newLayout.Columns];
113
- }
114
- setLayout(newLayout);
115
- };
116
- const getAgGridGroupAutoColumn = react_1.useCallback((layout) => layout.Columns.filter((columnId) => api.columnApi.isAutoRowGroupColumn(columnId)), []);
117
- const onDragEndRef = react_1.useRef({
118
- columnList: () => { },
119
- columnSortList: () => { },
120
- rowGroupsList: () => { },
121
- pivotList: () => { },
122
- });
123
- const onDragEnd = react_1.useCallback((result) => {
124
- const { source, destination } = result;
125
- if (!source || !destination) {
126
- return;
127
- }
128
- if (source.droppableId === droppableIds_1.LayoutEditorDroppableIds.ColumnList) {
129
- source.column = columnList[source.index];
130
- source.columnId = source.column.columnId;
131
- }
132
- if (destination.droppableId === droppableIds_1.LayoutEditorDroppableIds.ColumnList) {
133
- onDragEndRef.current.columnList(result);
134
- }
135
- if (destination.droppableId === droppableIds_1.LayoutEditorDroppableIds.ColumnSortList) {
136
- onDragEndRef.current.columnSortList(result);
137
- }
138
- if (destination.droppableId === droppableIds_1.LayoutEditorDroppableIds.RowGroupsList) {
139
- onDragEndRef.current.rowGroupsList(result);
140
- }
141
- if (destination.droppableId === droppableIds_1.LayoutEditorDroppableIds.PivotList) {
142
- onDragEndRef.current.pivotList(result);
143
- }
144
- }, [columnList]);
145
- const onDragStart = react_1.useCallback((snapshot) => {
146
- const { source, draggableId } = snapshot;
147
- const dragSource = source.droppableId;
148
- const column = dragSource === droppableIds_1.LayoutEditorDroppableIds.ColumnList ? allColumnsMap[draggableId] : null;
149
- const invalidSourceForColumns = source.droppableId !== droppableIds_1.LayoutEditorDroppableIds.ColumnList;
150
- const dropDisabledOnColumns = !column || !column.moveable || invalidSourceForColumns;
151
- dispatch({
152
- type: reducer_1.LayoutEditorActions.SET_DROP_DISABLED_ON_COLUMNS,
153
- payload: dropDisabledOnColumns,
154
- });
155
- dispatch({
156
- type: reducer_1.LayoutEditorActions.SET_DRAG_SOURCE,
157
- payload: dragSource,
158
- });
159
- const columnAlreadySorted = column &&
160
- layout.ColumnSorts &&
161
- !!layout.ColumnSorts.filter((c) => c.ColumnId === column.columnId)[0];
162
- const invalidSourceForSort = dragSource !== droppableIds_1.LayoutEditorDroppableIds.ColumnList &&
163
- dragSource !== droppableIds_1.LayoutEditorDroppableIds.ColumnSortList;
164
- const disableDropOnSort = invalidSourceForSort || columnAlreadySorted || (column && !column.sortable);
165
- dispatch({
166
- type: reducer_1.LayoutEditorActions.SET_DROP_DISABLED_ON_SORT,
167
- payload: !!disableDropOnSort,
168
- });
169
- const columnAlreadyRowGrouped = column && layout.RowGroupedColumns
170
- ? !!layout.RowGroupedColumns.filter((colId) => colId === column.columnId)[0]
171
- : false;
172
- const invalidSourceForRowGroups = dragSource !== droppableIds_1.LayoutEditorDroppableIds.ColumnList &&
173
- dragSource !== droppableIds_1.LayoutEditorDroppableIds.RowGroupsList;
174
- const disableDropOnRowGroups = invalidSourceForRowGroups || columnAlreadyRowGrouped || (column && !column.groupable);
175
- dispatch({
176
- type: reducer_1.LayoutEditorActions.SET_DROP_DISABLED_ON_ROW_GROUPS,
177
- payload: !!disableDropOnRowGroups,
178
- });
179
- const columnAlreadyPivoted = column && layout.PivotColumns
180
- ? !!layout.PivotColumns.filter((colId) => colId === column.columnId)[0]
181
- : false;
182
- const invalidSourceForPivot = dragSource !== droppableIds_1.LayoutEditorDroppableIds.ColumnList &&
183
- dragSource !== droppableIds_1.LayoutEditorDroppableIds.PivotList;
184
- const disableDropOnPivot = invalidSourceForPivot || columnAlreadyPivoted || (column && !column.pivotable);
185
- dispatch({
186
- type: reducer_1.LayoutEditorActions.SET_DROP_DISABLED_ON_PIVOT,
187
- payload: !!disableDropOnPivot,
188
- });
189
- }, [state, layout]);
190
- const onColumnOrderChange = react_1.useCallback((columns) => {
191
- setLayout(Object.assign(Object.assign({}, layout), { Columns: columns.filter((c) => visibleColumnsMap[c.columnId]).map((c) => c.columnId) }));
192
- setColumnList(columns);
193
- }, [visibleColumnsMap, layout]);
194
- const onColumnSortsChange = react_1.useCallback((ColumnSorts) => {
195
- setLayout(Object.assign(Object.assign({}, layout), { ColumnSorts }));
196
- }, [layout]);
197
- const onRowGroupsChange = react_1.useCallback((RowGroupedColumns) => {
198
- setLayout(Object.assign(Object.assign({}, layout), { RowGroupedColumns }));
199
- }, [layout]);
200
- const onPivotColumnsChange = react_1.useCallback((PivotColumns) => {
201
- setLayout(Object.assign(Object.assign({}, layout), { PivotColumns }));
202
- }, [layout]);
203
- const showGridInfoLink = props.api.internalApi
204
- .getEntitlementService()
205
- .isGridInfoSectionVisible('ColumnInfo');
206
- return (React.createElement(react_beautiful_dnd_1.DragDropContext, { onDragEnd: onDragEnd, onDragStart: onDragStart },
207
- React.createElement(rebass_1.Box, { className: "ab-LayoutEditor" },
208
- React.createElement(ListPanel, { header: React.createElement(rebass_1.Flex, { width: "100%", flexDirection: "row", justifyContent: "space-between", alignItems: "center" },
209
- React.createElement(rebass_1.Text, null, "Columns"),
210
- React.createElement(CheckBox_1.CheckBox, { mt: 0, mb: 0, checked: !layout.SuppressAggFuncInHeader, onChange: (checked) => {
211
- setLayout(Object.assign(Object.assign({}, layout), { SuppressAggFuncInHeader: !checked }));
212
- } }, "Show aggregation function in headers")), style: { flex: 'none' }, className: "ab-LayoutEditor__ColumnListPanel", bodyProps: { style: { display: 'flex', overflow: 'hidden' }, px: 0 } },
213
- React.createElement(ColumnList_1.ColumnList, { onReady: (onDragEnd) => {
214
- onDragEndRef.current.columnList = onDragEnd;
215
- }, getItemStyle: (c, snapshot, draggableStyle) => {
216
- return getItemStyle_1.getItemStyle(c, layout, state.dragSource, snapshot, draggableStyle);
217
- }, columns: columnList, isDropDisabled: state.dropDisabledOnColumns, onColumnOrderChange: onColumnOrderChange, renderItem: (c) => {
218
- const visible = !!visibleColumnsMap[c.columnId];
219
- const aggregate = !!aggregationColumnsMap[c.columnId];
220
- // enable aggregation if there are row groups or pivoting is enabled
221
- // const aggregateEnabled =
222
- // (layout.RowGroupedColumns && layout.RowGroupedColumns.length) || layout.EnablePivot;
223
- // JW: Not sure we do - why not just make it always visible as we ignore if if not required.
224
- const aggregateEnabled = true;
225
- const customHeader = headerColumnsMap[c.columnId];
226
- const initialHeader = api.columnApi.getFriendlyNameFromColumnId(c.columnId);
227
- return (React.createElement(rebass_1.Flex, { flexDirection: "column", alignItems: "stretch", "data-name": "drag-item", "data-col-id": c.columnId },
228
- React.createElement(rebass_1.Flex, { flexDirection: "row", alignItems: "center", backgroundColor: "secondary", color: "text-on-secondary" },
229
- React.createElement(rebass_1.Flex, { alignItems: "center" },
230
- React.createElement(rebass_1.Box, { ml: 2, mr: 2 },
231
- React.createElement(icons_1.Icon, { name: "drag", size: 30 })),
232
- initialHeader,
233
- ' ',
234
- showGridInfoLink && (React.createElement(ButtonInfo_1.ButtonInfo, { marginLeft: 1, style: { color: 'var(--ab-color-text-on-secondary)' }, onClick: () => {
235
- props.api.internalApi.showPopupScreen('GridInfo', 'GridInfoPopup', {
236
- column: c,
237
- source: 'ContextMenu',
238
- });
239
- } })),
240
- c.columnGroup && c.columnGroup.groupCount > 1 ? (React.createElement(rebass_1.Box, { ml: 2, padding: 1, style: {
241
- borderRadius: 'var(--ab__border-radius)',
242
- background: 'var(--ab-color-defaultbackground)',
243
- color: 'var(--ab-color-text-on-defaultbackground)',
244
- } },
245
- "Group: ",
246
- c.columnGroup.friendlyName)) : null),
247
- React.createElement(CheckBox_1.CheckBox, { title: "Visible", readOnly: !c.hideable && visible, checked: visible, mx: 2, style: {
248
- whiteSpace: 'nowrap',
249
- }, onChange: setColumnVisibility.bind(null, c) }, "Visible")),
250
- React.createElement(rebass_1.Flex, { padding: 2, flexDirection: "column" },
251
- React.createElement(ColumnLabels_1.ColumnLabels, { showTitle: true, sortable: c.sortable, filterable: c.filterable, moveable: c.moveable, pivotable: c.pivotable, groupable: c.groupable, aggregatable: c.aggregatable }, ' '),
252
- React.createElement(rebass_1.Flex, { flexDirection: "row", mt: 2 },
253
- React.createElement(rebass_1.Flex, { flex: 3, alignItems: "baseline" },
254
- React.createElement(rebass_1.Text, { fontSize: 3, mr: 2 }, "Header:"),
255
- React.createElement(Input_1.default, { width: '100%', value: customHeader || '', placeholder: "Custom Name (optional)", onChange: (event) => {
256
- const newTextValue = event.target.value;
257
- const columnHeaders = Object.assign({}, layout.ColumnHeadersMap) || {};
258
- if (StringExtensions_1.default.IsNullOrEmptyOrWhiteSpace(newTextValue)) {
259
- delete columnHeaders[c.columnId];
260
- }
261
- else {
262
- columnHeaders[c.columnId] = newTextValue;
263
- }
264
- setLayout(Object.assign(Object.assign({}, layout), { ColumnHeadersMap: columnHeaders }));
265
- } })),
266
- React.createElement(rebass_1.Flex, { flex: 2 }, c.aggregatable &&
267
- c.availableAggregationFunctions &&
268
- c.availableAggregationFunctions.length ? (React.createElement(CheckBox_1.CheckBox, { key: "checkbox", ml: 3, my: 0, disabled: !aggregateEnabled, onChange: (checked) => {
269
- let aggCols = layout.AggregationColumns || {};
270
- // const aggCols = new Set(layout.AggregationColumns);
271
- if (checked) {
272
- let aggFunc = c.aggregationFunction;
273
- if (!aggFunc && c.availableAggregationFunctions) {
274
- aggFunc = c.availableAggregationFunctions[0];
275
- }
276
- aggCols[c.columnId] = aggFunc;
277
- }
278
- else {
279
- delete aggCols[c.columnId];
280
- if (!Object.keys(aggCols).length) {
281
- aggCols = null;
282
- }
283
- }
284
- setLayout(Object.assign(Object.assign({}, layout), { AggregationColumns: aggCols }));
285
- }, checked: aggregate },
286
- "Aggregate",
287
- React.createElement(DropdownButton_1.default, { style: {
288
- visibility: aggregate ? 'visible' : 'hidden',
289
- }, ml: 2, padding: 0, columns: ['label'], variant: "text", items: c.availableAggregationFunctions.map((fnName) => {
290
- return {
291
- label: fnName,
292
- onClick: () => {
293
- const aggCols = layout.AggregationColumns;
294
- if (!aggCols) {
295
- return;
296
- }
297
- aggCols[c.columnId] = fnName;
298
- setLayout(Object.assign(Object.assign({}, layout), { AggregationColumns: aggCols }));
299
- },
300
- };
301
- }) }, aggregationColumnsMap[c.columnId]))) : null)))));
302
- } })),
303
- React.createElement(ListPanel, { header: "Sorting", className: "ab-LayoutEditor__ColumnSortListPanel" },
304
- React.createElement(ColumnSortList_1.ColumnSortList, { columnSorts: layout.ColumnSorts, onColumnSortsChange: onColumnSortsChange, isDropDisabled: state.dropDisabledOnSort, onReady: (dragEnd) => {
305
- onDragEndRef.current.columnSortList = dragEnd;
306
- }, getItemStyle: (columnId, snapshot, draggableStyle) => {
307
- return getItemStyle_1.getItemStyle(allColumnsMap[columnId], layout, state.dragSource, snapshot, draggableStyle);
308
- }, renderItem: (c, clear, toggleSort) => {
309
- const column = allColumnsMap[c.ColumnId];
310
- if (!column) {
311
- return null; //TODO fix this
312
- }
313
- return (React.createElement(rebass_1.Flex, { flexDirection: "row", alignItems: "center", "data-name": "drag-item" },
314
- React.createElement(rebass_1.Box, { ml: 2, mr: 3 },
315
- React.createElement(icons_1.Icon, { name: "drag", size: 30 })),
316
- React.createElement(rebass_1.Flex, { flex: "1", flexDirection: "row", alignItems: "center" },
317
- column.friendlyName,
318
- " [",
319
- c.SortOrder,
320
- "]"),
321
- React.createElement(SimpleButton_1.default, { variant: "raised", style: { cursor: 'pointer' }, mr: 3, onClick: (e) => {
322
- e.stopPropagation();
323
- toggleSort();
324
- } },
325
- React.createElement(icons_1.Icon, { name: c.SortOrder === 'Asc' ? 'sort-asc' : 'sort-desc' })),
326
- React.createElement(SimpleButton_1.default, { variant: "text", onClick: (e) => {
327
- e.stopPropagation();
328
- clear();
329
- } },
330
- React.createElement(icons_1.Icon, { name: "clear" }))));
331
- } })),
332
- React.createElement(ListPanel, { header: "Row Groups", className: "ab-LayoutEditor__RowGroupsListPanel" },
333
- React.createElement(RowGroupsList_1.RowGroupsList, { rowGroups: layout.RowGroupedColumns, onRowGroupsChange: onRowGroupsChange, isDropDisabled: state.dropDisabledOnRowGroups, onReady: (dragEnd) => {
334
- onDragEndRef.current.rowGroupsList = dragEnd;
335
- }, getItemStyle: (columnId, snapshot, draggableStyle) => {
336
- return getItemStyle_1.getItemStyle(allColumnsMap[columnId], layout, state.dragSource, snapshot, draggableStyle);
337
- }, renderItem: (colId, clear) => {
338
- const column = allColumnsMap[colId];
339
- return (React.createElement(rebass_1.Flex, { flexDirection: "row", alignItems: "center", "data-name": "drag-item" },
340
- React.createElement(rebass_1.Box, { ml: 2, mr: 3 },
341
- React.createElement(icons_1.Icon, { name: "drag", size: 30 })),
342
- React.createElement(rebass_1.Flex, { flexDirection: "row", alignItems: "center", flex: 1 }, column.friendlyName),
343
- React.createElement(SimpleButton_1.default, { variant: "text", onClick: (e) => {
344
- e.stopPropagation();
345
- clear();
346
- } },
347
- React.createElement(icons_1.Icon, { name: "clear" }))));
348
- } })),
349
- React.createElement(ListPanel, { className: "ab-LayoutEditor__PivotListPanel", header: React.createElement(rebass_1.Flex, { width: "100%", flexDirection: "row", justifyContent: "space-between", alignItems: "center" },
350
- React.createElement(rebass_1.Text, null, "Pivoted Columns")), bodyProps: { padding: 0 } },
351
- React.createElement(PivotList_1.PivotList, { pivotColumns: layout.PivotColumns, onPivotColumnsChange: onPivotColumnsChange, isDropDisabled: state.dropDisabledOnPivot, onReady: (dragEnd) => {
352
- onDragEndRef.current.pivotList = dragEnd;
353
- }, renderItem: (colId, clear) => {
354
- const column = allColumnsMap[colId];
355
- return (React.createElement(rebass_1.Flex, { flexDirection: "row", alignItems: "center", "data-name": "drag-item" },
356
- React.createElement(rebass_1.Box, { ml: 2, mr: 3 },
357
- React.createElement(icons_1.Icon, { name: "drag", size: 30 })),
358
- React.createElement(rebass_1.Flex, { flexDirection: "row", alignItems: "center", flex: 1 }, column.friendlyName),
359
- React.createElement(SimpleButton_1.default, { variant: "text", onClick: (e) => {
360
- e.stopPropagation();
361
- clear();
362
- } },
363
- React.createElement(icons_1.Icon, { name: "clear" }))));
364
- }, getItemStyle: (columnId, snapshot, draggableStyle) => {
365
- return getItemStyle_1.getItemStyle(allColumnsMap[columnId], layout, state.dragSource, snapshot, draggableStyle);
366
- } })))));
367
- }, areEqual);
@@ -1,28 +0,0 @@
1
- import { Layout } from '../../../../PredefinedConfig/LayoutState';
2
- import { LayoutEditorDroppableIds } from './droppableIds';
3
- export declare type LayoutEditorState = {
4
- dropDisabledOnColumns: boolean;
5
- dropDisabledOnSort: boolean;
6
- dropDisabledOnRowGroups: boolean;
7
- dropDisabledOnPivot: boolean;
8
- dragSource: LayoutEditorDroppableIds;
9
- layout: Layout;
10
- };
11
- export declare const getInitialState: (layout: Layout) => {
12
- dropDisabledOnColumns: boolean;
13
- dropDisabledOnSort: boolean;
14
- dropDisabledOnRowGroups: boolean;
15
- dropDisabledOnPivot: boolean;
16
- dragSource: LayoutEditorDroppableIds;
17
- layout: Layout;
18
- };
19
- export declare type LayoutEditorAction = any;
20
- export declare const reducer: (state: LayoutEditorState, action: LayoutEditorAction) => LayoutEditorState;
21
- export declare enum LayoutEditorActions {
22
- SET_LAYOUT = "SET_LAYOUT",
23
- SET_DRAG_SOURCE = "SET_DRAG_SOURCE",
24
- SET_DROP_DISABLED_ON_COLUMNS = "SET_DROP_DISABLED_ON_COLUMNS",
25
- SET_DROP_DISABLED_ON_SORT = "SET_DROP_DISABLED_ON_SORT",
26
- SET_DROP_DISABLED_ON_ROW_GROUPS = "SET_DROP_DISABLED_ON_ROW_GROUPS",
27
- SET_DROP_DISABLED_ON_PIVOT = "SET_DROP_DISABLED_ON_PIVOT"
28
- }
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LayoutEditorActions = exports.reducer = exports.getInitialState = void 0;
4
- const droppableIds_1 = require("./droppableIds");
5
- const getInitialState = (layout) => {
6
- return {
7
- dropDisabledOnColumns: false,
8
- dropDisabledOnSort: false,
9
- dropDisabledOnRowGroups: false,
10
- dropDisabledOnPivot: false,
11
- dragSource: droppableIds_1.LayoutEditorDroppableIds.None,
12
- layout,
13
- };
14
- };
15
- exports.getInitialState = getInitialState;
16
- const reducer = (state, action) => {
17
- if (action.type === LayoutEditorActions.SET_DRAG_SOURCE) {
18
- return Object.assign(Object.assign({}, state), { dragSource: action.payload });
19
- }
20
- if (action.type === LayoutEditorActions.SET_DROP_DISABLED_ON_COLUMNS) {
21
- return Object.assign(Object.assign({}, state), { dropDisabledOnColumns: action.payload });
22
- }
23
- if (action.type === LayoutEditorActions.SET_DROP_DISABLED_ON_SORT) {
24
- return Object.assign(Object.assign({}, state), { dropDisabledOnSort: action.payload });
25
- }
26
- if (action.type === LayoutEditorActions.SET_DROP_DISABLED_ON_ROW_GROUPS) {
27
- return Object.assign(Object.assign({}, state), { dropDisabledOnRowGroups: action.payload });
28
- }
29
- if (action.type === LayoutEditorActions.SET_DROP_DISABLED_ON_PIVOT) {
30
- return Object.assign(Object.assign({}, state), { dropDisabledOnPivot: action.payload });
31
- }
32
- if (action.type === LayoutEditorActions.SET_LAYOUT) {
33
- return Object.assign(Object.assign({}, state), { layout: action.payload });
34
- }
35
- return state;
36
- };
37
- exports.reducer = reducer;
38
- var LayoutEditorActions;
39
- (function (LayoutEditorActions) {
40
- LayoutEditorActions["SET_LAYOUT"] = "SET_LAYOUT";
41
- LayoutEditorActions["SET_DRAG_SOURCE"] = "SET_DRAG_SOURCE";
42
- LayoutEditorActions["SET_DROP_DISABLED_ON_COLUMNS"] = "SET_DROP_DISABLED_ON_COLUMNS";
43
- LayoutEditorActions["SET_DROP_DISABLED_ON_SORT"] = "SET_DROP_DISABLED_ON_SORT";
44
- LayoutEditorActions["SET_DROP_DISABLED_ON_ROW_GROUPS"] = "SET_DROP_DISABLED_ON_ROW_GROUPS";
45
- LayoutEditorActions["SET_DROP_DISABLED_ON_PIVOT"] = "SET_DROP_DISABLED_ON_PIVOT";
46
- })(LayoutEditorActions = exports.LayoutEditorActions || (exports.LayoutEditorActions = {}));
@@ -1,10 +0,0 @@
1
- import { CSSProperties } from 'react';
2
- export declare type DraggableSnapshot = {
3
- isDragging: boolean;
4
- draggingOver?: string;
5
- };
6
- export declare type DroppableSnapshot = {
7
- isDraggingOver: boolean;
8
- draggingOverWith?: string;
9
- };
10
- export declare const getListStyle: (droppableSnapshot: DroppableSnapshot) => CSSProperties;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getListStyle = void 0;
4
- const getListStyle = (droppableSnapshot) => {
5
- const style = {
6
- width: '100%',
7
- height: '100%',
8
- };
9
- if (droppableSnapshot.isDraggingOver) {
10
- style.background = 'var(--ab-color-primary)';
11
- }
12
- return style;
13
- };
14
- exports.getListStyle = getListStyle;
@@ -1,30 +0,0 @@
1
- import * as React from 'react';
2
- import { AdaptableWizardStep, AdaptableWizardStepProps } from '../../Wizard/Interface/IAdaptableWizard';
3
- import { Layout } from '../../../PredefinedConfig/LayoutState';
4
- export interface LayoutEditorWizardProps extends AdaptableWizardStepProps<Layout> {
5
- Layouts: Layout[];
6
- onLayoutChange?: (layout: Layout) => void;
7
- }
8
- export interface LayoutEditorWizardState {
9
- layoutName: string;
10
- layout: Layout;
11
- errorMessage: string;
12
- }
13
- export declare class LayoutEditorWizard extends React.Component<any, any> implements AdaptableWizardStep {
14
- constructor(props: LayoutEditorWizardProps);
15
- render(): any;
16
- onLayoutNameChange: (event: React.FormEvent<any>) => void;
17
- getErrorMessage: ({ layout, layoutName }: {
18
- layout: Layout;
19
- layoutName: string;
20
- }) => string;
21
- updateLayout: (layout: Partial<Layout>) => void;
22
- onLayoutChange: (layout: Layout) => void;
23
- getLayout: () => any;
24
- canNext(): boolean;
25
- canBack(): boolean;
26
- next(): void;
27
- back(): void;
28
- getIndexStepIncrement(): number;
29
- getIndexStepDecrement(): number;
30
- }
@@ -1,132 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LayoutEditorWizard = void 0;
4
- const tslib_1 = require("tslib");
5
- const React = tslib_1.__importStar(require("react"));
6
- const WizardPanel_1 = tslib_1.__importDefault(require("../../../components/WizardPanel"));
7
- const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
8
- const Input_1 = tslib_1.__importDefault(require("../../../components/Input"));
9
- const LayoutEditor_1 = require("./LayoutEditor");
10
- const ErrorBox_1 = tslib_1.__importDefault(require("../../../components/ErrorBox"));
11
- const AdaptablePopover_1 = require("../../AdaptablePopover");
12
- const rebass_1 = require("rebass");
13
- const Panel_1 = tslib_1.__importDefault(require("../../../components/Panel"));
14
- const ColumnLabels_1 = require("./LayoutEditor/ColumnLabels");
15
- const CheckBox_1 = require("../../../components/CheckBox");
16
- class LayoutEditorWizard extends React.Component {
17
- constructor(props) {
18
- super(props);
19
- this.onLayoutNameChange = (event) => {
20
- const Name = event.target.value;
21
- const ErrorMessage = this.getErrorMessage(Object.assign(Object.assign({}, this.state), { layoutName: Name }));
22
- this.updateLayout({ Name });
23
- this.setState({
24
- layoutName: Name,
25
- errorMessage: ErrorMessage || null,
26
- }, () => {
27
- this.props.updateGoBackState();
28
- });
29
- };
30
- this.getErrorMessage = ({ layout, layoutName }) => {
31
- const Exists = this.props.Layouts.find((l) => l.Name === layoutName && l.Uuid !== layout.Uuid);
32
- let ErrorMessage = Exists
33
- ? 'A Layout already exists with that name'
34
- : !layoutName
35
- ? 'Layout name cannot be blank'
36
- : null;
37
- // if (!ErrorMessage && !layout.Columns.length) {
38
- // ErrorMessage = 'A Layout must have at least one visible column';
39
- // }
40
- return ErrorMessage;
41
- };
42
- this.updateLayout = (layout) => {
43
- var _a, _b;
44
- const updatedLayout = Object.assign(Object.assign({}, this.state.layout), layout);
45
- Object.assign(this.props.data, updatedLayout);
46
- this.setState({
47
- layout: updatedLayout,
48
- });
49
- (_b = (_a = this.props) === null || _a === void 0 ? void 0 : _a.onLayoutChange) === null || _b === void 0 ? void 0 : _b.call(_a, updatedLayout);
50
- };
51
- this.onLayoutChange = (layout) => {
52
- layout = Object.assign(Object.assign({}, layout), { Name: this.state.layoutName });
53
- this.updateLayout(layout);
54
- this.setState({
55
- layout,
56
- errorMessage: this.getErrorMessage({
57
- layout,
58
- layoutName: this.state.layoutName,
59
- }),
60
- }, () => {
61
- this.props.updateGoBackState();
62
- });
63
- };
64
- this.getLayout = () => {
65
- return Object.assign(Object.assign({}, this.state.layout), { Name: this.state.layoutName });
66
- };
67
- this.state = {
68
- layout: props.data,
69
- layoutName: props.data.Name,
70
- errorMessage: null,
71
- };
72
- }
73
- render() {
74
- const behaviourHeader = 'Column ' + this.props.api.internalApi.getCorrectEnglishVariant('Behaviours');
75
- return (React.createElement("div", { "data-name": 'layout-editor', style: { height: '100%' } },
76
- React.createElement(WizardPanel_1.default, { bodyProps: { padding: 0 } },
77
- React.createElement(rebass_1.Flex, null,
78
- React.createElement(rebass_1.Box, { width: 350 },
79
- React.createElement(FormLayout_1.default, { columns: ['label', 'children'], m: 2 },
80
- React.createElement(FormLayout_1.FormRow, { label: "Layout Name" },
81
- React.createElement(Input_1.default, { value: this.state.layoutName, "data-name": "layout-editor-name-input", width: "100%", autoFocus: true, placeholder: "Type a name", onChange: this.onLayoutNameChange }),
82
- ' '),
83
- this.state.errorMessage ? (React.createElement(FormLayout_1.FormRow, { label: "" },
84
- React.createElement(ErrorBox_1.default, null, this.state.errorMessage))) : null)),
85
- React.createElement(rebass_1.Flex, { flex: 1, alignItems: "center", justifyContent: "flex-end" },
86
- React.createElement(CheckBox_1.CheckBox, { mt: 0, mb: 0, checked: this.state.layout.EnablePivot, onChange: (checked) => {
87
- this.updateLayout({ EnablePivot: checked });
88
- } }, "Enable Pivot Layout")),
89
- React.createElement(rebass_1.Flex, { width: 120, pr: 2, alignItems: "center", justifyContent: "end" },
90
- React.createElement(rebass_1.Text, { mr: 2 }, "Legend"),
91
- React.createElement(AdaptablePopover_1.AdaptablePopover, { popoverMinWidth: 200, bodyText: [
92
- React.createElement(Panel_1.default, { variant: "modern", header: behaviourHeader, className: "ab-LayoutEditor__LegendPanel", style: {
93
- gridRow: '1 /1',
94
- gridColumn: '3/3',
95
- }, bodyProps: {
96
- padding: 2,
97
- backgroundColor: 'defaultbackground',
98
- color: 'text-on-defaultbackground',
99
- } },
100
- React.createElement(ColumnLabels_1.ColumnLabels, { flexDirection: "column", showBoth: true, labels: {
101
- Sortable: 'Able to be sorted',
102
- Filterable: 'Can be filtered',
103
- Aggregatable: 'Shows aggregations (in grouped rows)',
104
- Groupable: 'Can form a row group',
105
- Moveable: 'Is draggable and movable',
106
- Pivotable: 'Eligible for pivoting',
107
- }, sortable: true, filterable: true, moveable: true, pivotable: true, groupable: true, aggregatable: true })),
108
- ] }))),
109
- React.createElement(LayoutEditor_1.LayoutEditor, { api: this.props.api, layout: this.state.layout, onLayoutChange: this.onLayoutChange }))));
110
- }
111
- canNext() {
112
- return !!this.state.layoutName && !this.state.errorMessage;
113
- }
114
- canBack() {
115
- return true;
116
- }
117
- next() {
118
- Object.keys(this.props.data).forEach((key) => {
119
- delete this.props.data[key];
120
- });
121
- const layout = this.getLayout();
122
- Object.assign(this.props.data, layout);
123
- }
124
- back() { }
125
- getIndexStepIncrement() {
126
- return 1;
127
- }
128
- getIndexStepDecrement() {
129
- return 1;
130
- }
131
- }
132
- exports.LayoutEditorWizard = LayoutEditorWizard;
@@ -1,2 +0,0 @@
1
- import { OperatorEditorButton } from './BaseEditorInput';
2
- export declare const editorButtonsReactive: OperatorEditorButton[];