@finos/legend-data-cube 0.0.35 → 0.0.37

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 (138) hide show
  1. package/README.md +1 -1
  2. package/lib/__lib__/DataCubeEvent.d.ts +21 -0
  3. package/lib/__lib__/DataCubeEvent.d.ts.map +1 -0
  4. package/lib/__lib__/DataCubeEvent.js +22 -0
  5. package/lib/__lib__/DataCubeEvent.js.map +1 -0
  6. package/lib/components/DataCube.d.ts +3 -1
  7. package/lib/components/DataCube.d.ts.map +1 -1
  8. package/lib/components/DataCube.js +10 -9
  9. package/lib/components/DataCube.js.map +1 -1
  10. package/lib/components/DataCubeProvider.js +1 -1
  11. package/lib/components/DataCubeProvider.js.map +1 -1
  12. package/lib/components/core/DataCubeAlert.d.ts +3 -2
  13. package/lib/components/core/DataCubeAlert.d.ts.map +1 -1
  14. package/lib/components/core/DataCubeAlert.js +4 -2
  15. package/lib/components/core/DataCubeAlert.js.map +1 -1
  16. package/lib/components/core/DataCubeFormUtils.d.ts +26 -0
  17. package/lib/components/core/DataCubeFormUtils.d.ts.map +1 -1
  18. package/lib/components/core/DataCubeFormUtils.js +127 -4
  19. package/lib/components/core/DataCubeFormUtils.js.map +1 -1
  20. package/lib/components/core/DataCubeLayoutManager.js +1 -1
  21. package/lib/components/core/DataCubeLayoutManager.js.map +1 -1
  22. package/lib/components/core/DataCubeSettingsPanel.d.ts.map +1 -1
  23. package/lib/components/core/DataCubeSettingsPanel.js +53 -27
  24. package/lib/components/core/DataCubeSettingsPanel.js.map +1 -1
  25. package/lib/components/view/editor/DataCubeEditor.d.ts.map +1 -1
  26. package/lib/components/view/editor/DataCubeEditor.js +6 -5
  27. package/lib/components/view/editor/DataCubeEditor.js.map +1 -1
  28. package/lib/components/view/editor/DataCubeEditorColumnPropertiesPanel.d.ts.map +1 -1
  29. package/lib/components/view/editor/DataCubeEditorColumnPropertiesPanel.js +4 -4
  30. package/lib/components/view/editor/DataCubeEditorColumnPropertiesPanel.js.map +1 -1
  31. package/lib/components/view/editor/DataCubeEditorGeneralPropertiesPanel.d.ts.map +1 -1
  32. package/lib/components/view/editor/DataCubeEditorGeneralPropertiesPanel.js +2 -2
  33. package/lib/components/view/editor/DataCubeEditorGeneralPropertiesPanel.js.map +1 -1
  34. package/lib/components/view/extend/DataCubeColumnEditor.d.ts.map +1 -1
  35. package/lib/components/view/extend/DataCubeColumnEditor.js +12 -12
  36. package/lib/components/view/extend/DataCubeColumnEditor.js.map +1 -1
  37. package/lib/components/view/filter/DataCubeFilterEditor.d.ts.map +1 -1
  38. package/lib/components/view/filter/DataCubeFilterEditor.js +4 -4
  39. package/lib/components/view/filter/DataCubeFilterEditor.js.map +1 -1
  40. package/lib/components/view/grid/DataCubeGrid.d.ts.map +1 -1
  41. package/lib/components/view/grid/DataCubeGrid.js +7 -7
  42. package/lib/components/view/grid/DataCubeGrid.js.map +1 -1
  43. package/lib/index.css +1 -1
  44. package/lib/index.d.ts +7 -2
  45. package/lib/index.d.ts.map +1 -1
  46. package/lib/index.js +7 -2
  47. package/lib/index.js.map +1 -1
  48. package/lib/package.json +2 -2
  49. package/lib/stores/DataCubeOptions.d.ts +6 -5
  50. package/lib/stores/DataCubeOptions.d.ts.map +1 -1
  51. package/lib/stores/DataCubeSettings.d.ts +25 -22
  52. package/lib/stores/DataCubeSettings.d.ts.map +1 -1
  53. package/lib/stores/DataCubeSettings.js +250 -62
  54. package/lib/stores/DataCubeSettings.js.map +1 -1
  55. package/lib/stores/DataCubeState.d.ts +8 -5
  56. package/lib/stores/DataCubeState.d.ts.map +1 -1
  57. package/lib/stores/DataCubeState.js +27 -42
  58. package/lib/stores/DataCubeState.js.map +1 -1
  59. package/lib/stores/core/DataCubeEngine.d.ts +15 -18
  60. package/lib/stores/core/DataCubeEngine.d.ts.map +1 -1
  61. package/lib/stores/core/DataCubeEngine.js +5 -16
  62. package/lib/stores/core/DataCubeEngine.js.map +1 -1
  63. package/lib/stores/core/DataCubeQueryBuilder.d.ts +1 -0
  64. package/lib/stores/core/DataCubeQueryBuilder.d.ts.map +1 -1
  65. package/lib/stores/core/DataCubeQueryBuilder.js.map +1 -1
  66. package/lib/stores/core/DataCubeQueryBuilderUtils.d.ts +3 -0
  67. package/lib/stores/core/DataCubeQueryBuilderUtils.d.ts.map +1 -1
  68. package/lib/stores/core/DataCubeQueryBuilderUtils.js +12 -1
  69. package/lib/stores/core/DataCubeQueryBuilderUtils.js.map +1 -1
  70. package/lib/stores/core/DataCubeQuerySnapshotBuilder.d.ts.map +1 -1
  71. package/lib/stores/core/DataCubeQuerySnapshotBuilder.js +46 -30
  72. package/lib/stores/core/DataCubeQuerySnapshotBuilder.js.map +1 -1
  73. package/lib/stores/core/DataCubeSetting.d.ts +51 -0
  74. package/lib/stores/core/DataCubeSetting.d.ts.map +1 -0
  75. package/lib/stores/core/DataCubeSetting.js +36 -0
  76. package/lib/stores/core/DataCubeSetting.js.map +1 -0
  77. package/lib/stores/core/models/AdhocQueryDataCubeSource.d.ts +29 -0
  78. package/lib/stores/core/models/AdhocQueryDataCubeSource.d.ts.map +1 -0
  79. package/lib/stores/core/models/AdhocQueryDataCubeSource.js +35 -0
  80. package/lib/stores/core/models/AdhocQueryDataCubeSource.js.map +1 -0
  81. package/lib/stores/core/models/DataCubeSource.d.ts +1 -1
  82. package/lib/stores/core/models/DataCubeSource.d.ts.map +1 -1
  83. package/lib/stores/core/models/DataCubeSource.js +1 -1
  84. package/lib/stores/core/models/DataCubeSource.js.map +1 -1
  85. package/lib/stores/view/DataCubeQuerySnapshotManager.d.ts.map +1 -1
  86. package/lib/stores/view/DataCubeQuerySnapshotManager.js +9 -2
  87. package/lib/stores/view/DataCubeQuerySnapshotManager.js.map +1 -1
  88. package/lib/stores/view/DataCubeViewState.d.ts +1 -1
  89. package/lib/stores/view/DataCubeViewState.d.ts.map +1 -1
  90. package/lib/stores/view/DataCubeViewState.js +5 -14
  91. package/lib/stores/view/DataCubeViewState.js.map +1 -1
  92. package/lib/stores/view/extend/DataCubeColumnEditorState.d.ts.map +1 -1
  93. package/lib/stores/view/extend/DataCubeColumnEditorState.js +5 -5
  94. package/lib/stores/view/extend/DataCubeColumnEditorState.js.map +1 -1
  95. package/lib/stores/view/grid/DataCubeGridClientEngine.d.ts +1 -1
  96. package/lib/stores/view/grid/DataCubeGridClientEngine.d.ts.map +1 -1
  97. package/lib/stores/view/grid/DataCubeGridClientEngine.js +11 -7
  98. package/lib/stores/view/grid/DataCubeGridClientEngine.js.map +1 -1
  99. package/lib/stores/view/grid/DataCubeGridQueryBuilder.d.ts.map +1 -1
  100. package/lib/stores/view/grid/DataCubeGridQueryBuilder.js +2 -2
  101. package/lib/stores/view/grid/DataCubeGridQueryBuilder.js.map +1 -1
  102. package/lib/stores/view/grid/DataCubeGridState.d.ts +1 -0
  103. package/lib/stores/view/grid/DataCubeGridState.d.ts.map +1 -1
  104. package/lib/stores/view/grid/DataCubeGridState.js +8 -3
  105. package/lib/stores/view/grid/DataCubeGridState.js.map +1 -1
  106. package/package.json +6 -6
  107. package/src/__lib__/DataCubeEvent.ts +21 -0
  108. package/src/components/DataCube.tsx +14 -8
  109. package/src/components/DataCubeProvider.tsx +1 -1
  110. package/src/components/core/DataCubeAlert.tsx +12 -7
  111. package/src/components/core/DataCubeFormUtils.tsx +245 -16
  112. package/src/components/core/DataCubeLayoutManager.tsx +1 -1
  113. package/src/components/core/DataCubeSettingsPanel.tsx +166 -134
  114. package/src/components/view/editor/DataCubeEditor.tsx +12 -16
  115. package/src/components/view/editor/DataCubeEditorColumnPropertiesPanel.tsx +6 -5
  116. package/src/components/view/editor/DataCubeEditorGeneralPropertiesPanel.tsx +4 -3
  117. package/src/components/view/extend/DataCubeColumnEditor.tsx +24 -28
  118. package/src/components/view/filter/DataCubeFilterEditor.tsx +10 -18
  119. package/src/components/view/grid/DataCubeGrid.tsx +8 -7
  120. package/src/index.tsx +13 -2
  121. package/src/stores/DataCubeOptions.ts +14 -10
  122. package/src/stores/DataCubeSettings.tsx +421 -0
  123. package/src/stores/DataCubeState.tsx +38 -51
  124. package/src/stores/core/DataCubeEngine.tsx +45 -62
  125. package/src/stores/core/DataCubeQueryBuilder.ts +1 -0
  126. package/src/stores/core/DataCubeQueryBuilderUtils.ts +17 -0
  127. package/src/stores/core/DataCubeQuerySnapshotBuilder.ts +59 -30
  128. package/src/stores/core/DataCubeSetting.ts +63 -0
  129. package/src/stores/core/models/AdhocQueryDataCubeSource.ts +45 -0
  130. package/src/stores/core/models/DataCubeSource.ts +1 -1
  131. package/src/stores/view/DataCubeQuerySnapshotManager.ts +16 -4
  132. package/src/stores/view/DataCubeViewState.ts +8 -17
  133. package/src/stores/view/extend/DataCubeColumnEditorState.tsx +8 -6
  134. package/src/stores/view/grid/DataCubeGridClientEngine.ts +22 -11
  135. package/src/stores/view/grid/DataCubeGridQueryBuilder.ts +7 -1
  136. package/src/stores/view/grid/DataCubeGridState.ts +17 -3
  137. package/tsconfig.json +4 -1
  138. package/src/stores/DataCubeSettings.ts +0 -107
@@ -16,179 +16,211 @@
16
16
 
17
17
  import { observer } from 'mobx-react-lite';
18
18
  import { DataCubeIcon } from '@finos/legend-art';
19
- import { FormCheckbox, FormNumberInput } from './DataCubeFormUtils.js';
20
- import { useState } from 'react';
19
+ import {
20
+ FormButton,
21
+ FormCheckbox,
22
+ FormNumberInput,
23
+ FormTextInput,
24
+ } from './DataCubeFormUtils.js';
21
25
  import { useDataCube } from '../DataCubeProvider.js';
22
26
  import {
23
- DataCubeSettingKey,
24
- DEFAULT_SETTINGS,
25
- } from '../../stores/DataCubeSettings.js';
26
-
27
- export const DataCubeSettingsPanel = observer(() => {
28
- const dataCube = useDataCube();
29
-
30
- // NOTE: this makes sure the changes are not applied until saved, but it generates
31
- // a lot of boilerplate code, consider using a more ergonomic approach when we need
32
- // to scale this to more settings.
33
- const [enableDebugMode, setEnableDebugMode] = useState(
34
- dataCube.settings.enableDebugMode,
35
- );
36
- const [gridClientRowBuffer, setGridClientRowBuffer] = useState(
37
- dataCube.settings.gridClientRowBuffer,
38
- );
39
- const [gridClientPurgeClosedRowNodes, setGridClientPurgeClosedRowNodes] =
40
- useState(dataCube.settings.gridClientPurgeClosedRowNodes);
41
- const [
42
- gridClientSuppressLargeDatasetWarning,
43
- setGridClientSuppressLargeDatasetWarning,
44
- ] = useState(dataCube.settings.gridClientSuppressLargeDatasetWarning);
27
+ DataCubeSettingGroup,
28
+ DataCubeSettingType,
29
+ type DataCubeSetting,
30
+ } from '../../stores/core/DataCubeSetting.js';
31
+ import {
32
+ guaranteeIsBoolean,
33
+ guaranteeIsNumber,
34
+ guaranteeIsString,
35
+ } from '@finos/legend-shared';
36
+ import { runInAction } from 'mobx';
45
37
 
46
- const save = () => {
47
- dataCube.settings.setEnableDebugMode(enableDebugMode);
48
- dataCube.settings.setGridClientRowBuffer(gridClientRowBuffer);
49
- dataCube.settings.setGridClientPurgeClosedRowNodes(
50
- gridClientPurgeClosedRowNodes,
51
- );
52
- dataCube.settings.setGridClientSuppressLargeDatasetWarning(
53
- gridClientSuppressLargeDatasetWarning,
54
- );
55
- };
56
- const restoreDefaults = () => {
57
- setEnableDebugMode(DEFAULT_SETTINGS[DataCubeSettingKey.ENABLE_DEBUG_MODE]);
58
- setGridClientRowBuffer(
59
- DEFAULT_SETTINGS[DataCubeSettingKey.GRID_CLIENT_ROW_BUFFER],
60
- );
61
- setGridClientPurgeClosedRowNodes(
62
- DEFAULT_SETTINGS[DataCubeSettingKey.GRID_CLIENT_PURGE_CLOSED_ROW_NODES],
63
- );
64
- setGridClientSuppressLargeDatasetWarning(
65
- DEFAULT_SETTINGS[
66
- DataCubeSettingKey.GRID_CLIENT_SUPPRESS_LARGE_DATASET_WARNING
67
- ],
68
- );
69
- save();
70
- };
38
+ const DataCubeSettingEntryDisplay = observer(
39
+ (props: { configuration: DataCubeSetting }) => {
40
+ const { configuration } = props;
41
+ const dataCube = useDataCube();
42
+ const panel = dataCube.settings;
71
43
 
72
- return (
73
- <>
74
- <div className="h-[calc(100%_-_40px)] w-full p-2 pb-0">
75
- <div className="h-full w-full select-none overflow-auto border border-neutral-300 bg-white p-2">
76
- <div className="flex h-6">
77
- <div className="flex h-full">
78
- <div className="flex h-6 items-center text-xl font-medium">
79
- <DataCubeIcon.Table />
80
- </div>
81
- <div className="ml-1 flex h-6 items-center text-xl font-medium">
82
- Grid
83
- </div>
84
- </div>
85
- </div>
86
- <div className="mt-1.5">
87
- <div className="font-medium">Large Dataset Warning: Disabled</div>
44
+ switch (configuration.type) {
45
+ case DataCubeSettingType.BOOLEAN: {
46
+ const value = guaranteeIsBoolean(
47
+ panel.currentValues.get(configuration.key),
48
+ );
49
+ return (
50
+ <div className="my-2">
51
+ <div className="font-medium">{configuration.title}</div>
88
52
  <div className="flex pr-2">
89
53
  <FormCheckbox
90
- label="Suggests user to enable pagination when handling large datasets to improve performance."
91
- checked={gridClientSuppressLargeDatasetWarning}
92
- onChange={() =>
93
- setGridClientSuppressLargeDatasetWarning(
94
- !gridClientSuppressLargeDatasetWarning,
95
- )
96
- }
54
+ label={configuration.description}
55
+ checked={value}
56
+ onChange={() => {
57
+ runInAction(() => {
58
+ panel.currentValues.set(configuration.key, !value);
59
+ });
60
+ }}
97
61
  />
98
62
  </div>
99
63
  </div>
64
+ );
65
+ }
66
+ case DataCubeSettingType.NUMERIC: {
67
+ const value = guaranteeIsNumber(
68
+ panel.currentValues.get(configuration.key),
69
+ );
70
+ const defaultValue = configuration.defaultValue as number;
71
+ return (
100
72
  <div className="my-2">
101
- <div className="font-medium">Refresh Failed Data Fetch: Action</div>
73
+ <div className="font-medium">{configuration.title}</div>
102
74
  <div className="mb-1.5 text-sm text-neutral-700">
103
- {`Manually re-run all failed data fetches in the grid.`}
104
- </div>
105
- <div className="flex pr-2">
106
- <button
107
- className="ml-2 h-5 min-w-16 border border-neutral-400 bg-neutral-300 px-2 text-sm first-of-type:ml-0 hover:brightness-95"
108
- onClick={() => dataCube.refreshFailedDataFetches()}
109
- >
110
- Run Action
111
- </button>
75
+ {configuration.description}
112
76
  </div>
77
+ <FormNumberInput
78
+ className="w-20 text-sm"
79
+ min={configuration.numericValueMin}
80
+ step={configuration.numericValueStep}
81
+ max={configuration.numericValueMax}
82
+ defaultValue={defaultValue}
83
+ value={value}
84
+ setValue={(newValue) => {
85
+ runInAction(() => {
86
+ panel.currentValues.set(
87
+ configuration.key,
88
+ newValue ?? defaultValue,
89
+ );
90
+ });
91
+ }}
92
+ />
113
93
  </div>
94
+ );
95
+ }
96
+ case DataCubeSettingType.STRING: {
97
+ const value = guaranteeIsString(
98
+ panel.currentValues.get(configuration.key),
99
+ );
100
+ return (
114
101
  <div className="my-2">
115
- <div className="font-medium">Refresh Group Node Data: Enabled</div>
116
- <div className="flex pr-2">
117
- <FormCheckbox
118
- label="Force refresh data when group node is opened."
119
- checked={gridClientPurgeClosedRowNodes}
120
- onChange={() =>
121
- setGridClientPurgeClosedRowNodes(
122
- !gridClientPurgeClosedRowNodes,
123
- )
124
- }
125
- />
102
+ <div className="font-medium">{configuration.title}</div>
103
+ <div className="mb-1.5 text-sm text-neutral-700">
104
+ {configuration.description}
126
105
  </div>
106
+ <FormTextInput
107
+ className="w-80 text-sm"
108
+ value={value}
109
+ onChange={(event) => {
110
+ runInAction(() => {
111
+ panel.currentValues.set(
112
+ configuration.key,
113
+ event.target.value.trim(),
114
+ );
115
+ });
116
+ }}
117
+ />
127
118
  </div>
119
+ );
120
+ }
121
+ case DataCubeSettingType.ACTION: {
122
+ return (
128
123
  <div className="my-2">
129
- <div className="font-medium">Row Buffer</div>
124
+ <div className="font-medium">{configuration.title}</div>
130
125
  <div className="mb-1.5 text-sm text-neutral-700">
131
- {`Sets the number of rows the grid renders outside of the viewable area. e.g. if the buffer is 10 and your grid is showing 50 rows (as that's all that fits on your screen without scrolling), then the grid will actually render 70 in total (10 extra above and 10 extra below). Then when you scroll, the grid will already have 10 rows ready and waiting to show, no redraw is needed. A low small buffer will make initial draws of the grid faster; whereas a big one will reduce the redraw visible vertically scrolling.`}
126
+ {configuration.description}
132
127
  </div>
133
128
  <div className="flex pr-2">
134
- <FormNumberInput
135
- className="w-16 text-sm"
136
- min={10}
137
- step={10}
138
- defaultValue={
139
- DEFAULT_SETTINGS[DataCubeSettingKey.GRID_CLIENT_ROW_BUFFER]
140
- }
141
- value={gridClientRowBuffer}
142
- setValue={(value) => {
143
- setGridClientRowBuffer(
144
- value ??
145
- DEFAULT_SETTINGS[
146
- DataCubeSettingKey.GRID_CLIENT_ROW_BUFFER
147
- ],
148
- );
149
- }}
150
- />
129
+ <FormButton
130
+ compact={true}
131
+ onClick={() => configuration.action?.(undefined)}
132
+ >
133
+ Run Action
134
+ </FormButton>
151
135
  </div>
152
136
  </div>
137
+ );
138
+ }
139
+ default:
140
+ return null;
141
+ }
142
+ },
143
+ );
144
+
145
+ export const DataCubeSettingsPanel = observer(() => {
146
+ const dataCube = useDataCube();
147
+ const panel = dataCube.settings;
148
+ const configurations = Array.from(panel.configurations.values()).toSorted(
149
+ (a, b) => a.title.localeCompare(b.title),
150
+ );
151
+
152
+ return (
153
+ <>
154
+ <div className="h-[calc(100%_-_40px)] w-full p-2 pb-0">
155
+ <div className="h-full w-full select-none overflow-auto border border-neutral-300 bg-white p-2">
156
+ <div className="mt-1 flex h-5">
157
+ <div className="flex h-full">
158
+ <div className="flex h-5 items-center text-xl font-medium">
159
+ <DataCubeIcon.Table />
160
+ </div>
161
+ <div className="ml-1 flex h-5 items-center text-xl font-medium">
162
+ Grid
163
+ </div>
164
+ </div>
165
+ </div>
166
+ {configurations
167
+ .filter((setting) => setting.group === DataCubeSettingGroup.GRID)
168
+ .map((configuration) => (
169
+ <DataCubeSettingEntryDisplay
170
+ key={configuration.key}
171
+ configuration={configuration}
172
+ />
173
+ ))}
153
174
 
154
175
  <div className="my-2 h-[1px] w-full bg-neutral-200" />
155
176
 
156
- <div className="flex h-6">
177
+ <div className="mt-1 flex h-5">
157
178
  <div className="flex h-full">
158
- <div className="flex h-6 items-center text-xl font-medium">
179
+ <div className="flex h-5 items-center text-xl font-medium">
159
180
  <DataCubeIcon.Debug />
160
181
  </div>
161
- <div className="ml-1 flex h-6 items-center text-xl font-medium">
182
+ <div className="ml-1 flex h-5 items-center text-xl font-medium">
162
183
  Debug
163
184
  </div>
164
185
  </div>
165
186
  </div>
166
-
167
- <div className="mt-1.5">
168
- <div className="font-medium">Debug Mode: Enabled</div>
169
- <div className="flex pr-2">
170
- <FormCheckbox
171
- label="Enable debug logging when running data queries, updating snapshots, etc."
172
- checked={enableDebugMode}
173
- onChange={() => setEnableDebugMode(!enableDebugMode)}
187
+ {configurations
188
+ .filter((setting) => setting.group === DataCubeSettingGroup.DEBUG)
189
+ .map((configuration) => (
190
+ <DataCubeSettingEntryDisplay
191
+ key={configuration.key}
192
+ configuration={configuration}
174
193
  />
175
- </div>
176
- </div>
194
+ ))}
177
195
  </div>
178
196
  </div>
179
197
  <div className="flex h-10 items-center justify-end px-2">
180
- <button
181
- className="ml-2 h-6 w-48 border border-neutral-400 bg-neutral-300 px-2 hover:brightness-95"
182
- onClick={restoreDefaults}
198
+ <FormButton
199
+ onClick={() => panel.resetDefaultValues()}
200
+ disabled={panel.currentValuesHashCode === panel.defaultValuesHashCode}
183
201
  >
184
202
  Restore Default Settings
185
- </button>
186
- <button
187
- className="ml-2 h-6 w-36 border border-neutral-400 bg-neutral-300 px-2 hover:brightness-95"
188
- onClick={save}
203
+ </FormButton>
204
+ <FormButton
205
+ className="ml-2"
206
+ onClick={() => {
207
+ panel.display.close();
208
+ }}
209
+ >
210
+ Cancel
211
+ </FormButton>
212
+ <FormButton className="ml-2" onClick={() => panel.save()}>
213
+ Apply
214
+ </FormButton>
215
+ <FormButton
216
+ className="ml-2"
217
+ onClick={() => {
218
+ panel.save();
219
+ panel.display.close();
220
+ }}
189
221
  >
190
- Save Settings
191
- </button>
222
+ OK
223
+ </FormButton>
192
224
  </div>
193
225
  </>
194
226
  );
@@ -24,6 +24,7 @@ import { DataCubeEditorHorizontalPivotsPanel } from './DataCubeEditorHorizontalP
24
24
  import { DataCubeEditorColumnPropertiesPanel } from './DataCubeEditorColumnPropertiesPanel.js';
25
25
  import { cn } from '@finos/legend-art';
26
26
  import type { DataCubeViewState } from '../../../stores/view/DataCubeViewState.js';
27
+ import { FormButton } from '../../core/DataCubeFormUtils.js';
27
28
 
28
29
  export const DataCubeEditor = observer((props: { view: DataCubeViewState }) => {
29
30
  const { view } = props;
@@ -80,34 +81,29 @@ export const DataCubeEditor = observer((props: { view: DataCubeViewState }) => {
80
81
  </div>
81
82
  </div>
82
83
  <div className="flex h-10 items-center justify-end px-2">
83
- <button
84
- className="h-6 w-20 border border-neutral-400 bg-neutral-300 px-2 hover:brightness-95 disabled:cursor-not-allowed disabled:border-neutral-300 disabled:text-neutral-400 disabled:hover:brightness-100"
84
+ <FormButton onClick={() => editor.display.close()}>Cancel</FormButton>
85
+ <FormButton
86
+ className="ml-2"
85
87
  disabled={editor.finalizationState.isInProgress}
86
88
  onClick={() => {
87
89
  editor
88
- .applyChanges({ closeAfterApply: true })
90
+ .applyChanges()
89
91
  .catch((error) => engine.alertUnhandledError(error));
90
92
  }}
91
93
  >
92
- OK
93
- </button>
94
- <button
95
- className="ml-2 h-6 w-20 border border-neutral-400 bg-neutral-300 px-2 hover:brightness-95"
96
- onClick={() => editor.display.close()}
97
- >
98
- Cancel
99
- </button>
100
- <button
101
- className="ml-2 h-6 w-20 border border-neutral-400 bg-neutral-300 px-2 hover:brightness-95 disabled:cursor-not-allowed disabled:border-neutral-300 disabled:text-neutral-400 disabled:hover:brightness-100"
94
+ Apply
95
+ </FormButton>
96
+ <FormButton
97
+ className="ml-2"
102
98
  disabled={editor.finalizationState.isInProgress}
103
99
  onClick={() => {
104
100
  editor
105
- .applyChanges()
101
+ .applyChanges({ closeAfterApply: true })
106
102
  .catch((error) => engine.alertUnhandledError(error));
107
103
  }}
108
104
  >
109
- Apply
110
- </button>
105
+ OK
106
+ </FormButton>
111
107
  </div>
112
108
  </>
113
109
  );
@@ -27,6 +27,7 @@ import {
27
27
  FormNumberInput,
28
28
  FormTextInput,
29
29
  FormDocumentation,
30
+ FormButton,
30
31
  } from '../../core/DataCubeFormUtils.js';
31
32
  import {
32
33
  DataCubeQueryClientSideAggregateOperator,
@@ -58,7 +59,7 @@ export const DataCubeEditorColumnPropertiesPanel = observer(
58
59
  openColumnDropdown,
59
60
  closeColumnDropdown,
60
61
  columnDropdownProps,
61
- columnDropPropsOpen,
62
+ columnDropdownPropsOpen,
62
63
  ] = useDropdownMenu();
63
64
  const [
64
65
  openKindDropdown,
@@ -136,7 +137,7 @@ export const DataCubeEditorColumnPropertiesPanel = observer(
136
137
  <FormDropdownMenuTrigger
137
138
  className="w-80"
138
139
  onClick={openColumnDropdown}
139
- open={columnDropPropsOpen}
140
+ open={columnDropdownPropsOpen}
140
141
  >
141
142
  <div className="flex h-full w-full items-center">
142
143
  <div className="overflow-hidden overflow-ellipsis whitespace-nowrap">
@@ -1220,13 +1221,13 @@ export const DataCubeEditorColumnPropertiesPanel = observer(
1220
1221
  <div className="flex h-6 w-32 flex-shrink-0 items-center text-sm" />
1221
1222
  <div className="w-80">
1222
1223
  <div className="mb-2 h-[1px] w-full bg-neutral-200" />
1223
- <button
1224
- className="flex h-5 items-center justify-center rounded-sm border border-neutral-400 bg-neutral-200 p-0 px-1 text-sm text-neutral-700 disabled:text-neutral-400"
1224
+ <FormButton
1225
+ compact={true}
1225
1226
  disabled={selectedColumn.isUsingDefaultStyling}
1226
1227
  onClick={() => selectedColumn.useDefaultStyling()}
1227
1228
  >
1228
1229
  Use Default Styling
1229
- </button>
1230
+ </FormButton>
1230
1231
  </div>
1231
1232
  </div>
1232
1233
  </>
@@ -42,6 +42,7 @@ import {
42
42
  FormNumberInput,
43
43
  FormBadge_WIP,
44
44
  FormDocumentation,
45
+ FormButton,
45
46
  } from '../../core/DataCubeFormUtils.js';
46
47
  import type { DataCubeViewState } from '../../../stores/view/DataCubeViewState.js';
47
48
  import { DocumentationKey } from '../../../__lib__/DataCubeDocumentation.js';
@@ -773,13 +774,13 @@ export const DataCubeEditorGeneralPropertiesPanel = observer(
773
774
  <div className="flex h-6 w-32 flex-shrink-0 items-center text-sm" />
774
775
  <div className="w-80">
775
776
  <div className="mb-2 h-[1px] w-full bg-neutral-200" />
776
- <button
777
- className="flex h-5 items-center justify-center rounded-sm border border-neutral-400 bg-neutral-200 p-0 px-1 text-sm text-neutral-700 disabled:text-neutral-400"
777
+ <FormButton
778
+ compact={true}
778
779
  disabled={configuration.isUsingDefaultStyling}
779
780
  onClick={() => configuration.useDefaultStyling()}
780
781
  >
781
782
  Use Default Styling
782
- </button>
783
+ </FormButton>
783
784
  </div>
784
785
  </div>
785
786
  </div>
@@ -36,6 +36,7 @@ import {
36
36
  MONACO_EDITOR_OVERFLOW_WIDGETS_ROOT_ID,
37
37
  } from '../../core/DataCubePureCodeEditorUtils.js';
38
38
  import {
39
+ FormButton,
39
40
  FormDocumentation,
40
41
  FormDropdownMenu,
41
42
  FormDropdownMenuItem,
@@ -191,7 +192,7 @@ export const DataCubeColumnCreator = observer(
191
192
 
192
193
  return (
193
194
  <>
194
- <div className="relative h-[calc(100%_-_40px)] w-full px-2 pt-2">
195
+ <div className="h-[calc(100%_-_40px)] w-full px-2 pt-2">
195
196
  <div className="h-full w-full overflow-auto border border-neutral-300 bg-white">
196
197
  <div className="h-full w-full select-none p-0">
197
198
  <div className="h-24 w-full p-2">
@@ -340,26 +341,11 @@ export const DataCubeColumnCreator = observer(
340
341
  </div>
341
342
  </div>
342
343
  <div className="flex h-10 items-center justify-end px-2">
343
- <button
344
- className="h-6 w-20 border border-neutral-400 bg-neutral-300 px-2 hover:brightness-95 disabled:cursor-not-allowed disabled:border-neutral-300 disabled:text-neutral-400 disabled:hover:brightness-100"
345
- disabled={
346
- !state.isNameValid ||
347
- !state.isTypeValid ||
348
- state.validationState.isInProgress ||
349
- state.finalizationState.isInProgress
350
- }
351
- onClick={() => {
352
- state
353
- .applyChanges()
354
- .catch((error) => engine.alertUnhandledError(error));
355
- }}
356
- >
357
- OK
358
- </button>
344
+ <FormButton onClick={() => state.close()}>Cancel</FormButton>
359
345
  {state instanceof DataCubeExistingColumnEditorState && (
360
346
  <>
361
- <button
362
- className="ml-2 h-6 w-20 border border-neutral-400 bg-neutral-300 px-2 hover:brightness-95"
347
+ <FormButton
348
+ className="ml-2"
363
349
  onClick={() => {
364
350
  state.manager
365
351
  .deleteColumn(state.initialData.name)
@@ -367,9 +353,9 @@ export const DataCubeColumnCreator = observer(
367
353
  }}
368
354
  >
369
355
  Delete
370
- </button>
371
- <button
372
- className="ml-2 h-6 w-20 border border-neutral-400 bg-neutral-300 px-2 hover:brightness-95"
356
+ </FormButton>
357
+ <FormButton
358
+ className="ml-2"
373
359
  onClick={() => {
374
360
  state
375
361
  .reset()
@@ -377,15 +363,25 @@ export const DataCubeColumnCreator = observer(
377
363
  }}
378
364
  >
379
365
  Reset
380
- </button>
366
+ </FormButton>
381
367
  </>
382
368
  )}
383
- <button
384
- className="ml-2 h-6 w-20 border border-neutral-400 bg-neutral-300 px-2 hover:brightness-95"
385
- onClick={() => state.close()}
369
+ <FormButton
370
+ className="ml-2"
371
+ disabled={
372
+ !state.isNameValid ||
373
+ !state.isTypeValid ||
374
+ state.validationState.isInProgress ||
375
+ state.finalizationState.isInProgress
376
+ }
377
+ onClick={() => {
378
+ state
379
+ .applyChanges()
380
+ .catch((error) => engine.alertUnhandledError(error));
381
+ }}
386
382
  >
387
- Cancel
388
- </button>
383
+ OK
384
+ </FormButton>
389
385
  </div>
390
386
  </>
391
387
  );
@@ -37,6 +37,7 @@ import {
37
37
  type DataCubeFilterEditorTreeNode,
38
38
  } from '../../../stores/core/filter/DataCubeQueryFilterEditorState.js';
39
39
  import {
40
+ FormButton,
40
41
  FormDropdownMenu,
41
42
  FormDropdownMenuItem,
42
43
  FormDropdownMenuTrigger,
@@ -844,14 +845,13 @@ export const DataCubeFilterEditor = observer(
844
845
  <div>
845
846
  No filter is specified. Click the button below to start.
846
847
  </div>
847
- <button
848
- className="w-30 mt-2 h-6 border border-neutral-400 bg-neutral-300 px-2 hover:brightness-95"
848
+ <FormButton
849
849
  onClick={() => {
850
850
  editor.initializeTree();
851
851
  }}
852
852
  >
853
853
  Create New Filter
854
- </button>
854
+ </FormButton>
855
855
  </div>
856
856
  )}
857
857
  {editor.tree.root && (
@@ -879,27 +879,19 @@ export const DataCubeFilterEditor = observer(
879
879
  </div>
880
880
  </div>
881
881
  <div className="flex h-10 items-center justify-end px-2">
882
- <button
883
- className="h-6 w-20 border border-neutral-400 bg-neutral-300 px-2 hover:brightness-95"
882
+ <FormButton onClick={() => editor.display.close()}>Cancel</FormButton>
883
+ <FormButton className="ml-2" onClick={() => editor.applyChanges()}>
884
+ Apply
885
+ </FormButton>
886
+ <FormButton
887
+ className="ml-2"
884
888
  onClick={() => {
885
889
  editor.applyChanges();
886
890
  editor.display.close();
887
891
  }}
888
892
  >
889
893
  OK
890
- </button>
891
- <button
892
- className="ml-2 h-6 w-20 border border-neutral-400 bg-neutral-300 px-2 hover:brightness-95"
893
- onClick={() => editor.display.close()}
894
- >
895
- Cancel
896
- </button>
897
- <button
898
- className="ml-2 h-6 w-20 border border-neutral-400 bg-neutral-300 px-2 hover:brightness-95"
899
- onClick={() => editor.applyChanges()}
900
- >
901
- Apply
902
- </button>
894
+ </FormButton>
903
895
  </div>
904
896
  </>
905
897
  );
@@ -50,13 +50,6 @@ import type { DataCubeViewState } from '../../../stores/view/DataCubeViewState.j
50
50
  // We MUST NEVER completely surpress this warning in production, else it's a violation of the ag-grid license!
51
51
  // See https://www.ag-grid.com/react-data-grid/licensing/
52
52
  const __INTERNAL__original_console_error = console.error; // eslint-disable-line no-console
53
- // eslint-disable-next-line no-process-env
54
- if (process.env.NODE_ENV === 'development') {
55
- // eslint-disable-next-line no-console
56
- console.error = (message?: unknown, ...agrs: unknown[]) => {
57
- console.debug(`%c ${message}`, 'color: silver'); // eslint-disable-line no-console
58
- };
59
- }
60
53
 
61
54
  function textColorStyle(
62
55
  key: DataCubeConfigurationColorKey,
@@ -332,6 +325,14 @@ const DataCubeGridClient = observer((props: { view: DataCubeViewState }) => {
332
325
  const { view } = props;
333
326
  const grid = view.grid;
334
327
 
328
+ // eslint-disable-next-line no-process-env
329
+ if (process.env.NODE_ENV === 'development' && !grid.isClientConfigured) {
330
+ // eslint-disable-next-line no-console
331
+ console.error = (message?: unknown, ...agrs: unknown[]) => {
332
+ console.debug(`%c ${message}`, 'color: silver'); // eslint-disable-line no-console
333
+ };
334
+ }
335
+
335
336
  return (
336
337
  <div className="relative h-[calc(100%_-_20px)] w-full">
337
338
  <AgGridReact