@vuu-ui/vuu-table-extras 0.8.8-debug → 0.8.9-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.js +1598 -1159
- package/cjs/index.js.map +4 -4
- package/esm/index.js +1632 -1143
- package/esm/index.js.map +4 -4
- package/index.css +653 -211
- package/index.css.map +3 -3
- package/package.json +11 -11
- package/types/cell-edit-validators/CaseValidator.d.ts +2 -0
- package/types/cell-edit-validators/PatternValidator.d.ts +2 -0
- package/types/cell-edit-validators/index.d.ts +2 -0
- package/types/cell-renderers/background-cell/index.d.ts +1 -0
- package/types/cell-renderers/background-cell/useDirection.d.ts +3 -0
- package/types/cell-renderers-next/background-cell/BackgroundCell.d.ts +5 -0
- package/types/cell-renderers-next/index.d.ts +1 -0
- package/types/{vuu-table-extras/src/column-expression-input → column-expression-input}/ColumnExpressionInput.d.ts +4 -3
- package/types/{vuu-table-extras/src/column-expression-input → column-expression-input}/useColumnExpressionEditor.d.ts +2 -7
- package/types/column-expression-panel/ColumnExpressionPanel.d.ts +8 -0
- package/types/column-expression-panel/index.d.ts +1 -0
- package/types/column-expression-panel/useColumnExpression.d.ts +11 -0
- package/types/column-formatting-settings/ColumnFormattingPanel.d.ts +12 -0
- package/types/column-formatting-settings/NumericFormattingSettings.d.ts +7 -0
- package/types/column-formatting-settings/index.d.ts +2 -0
- package/types/column-settings/ColumnSettingsPanel.d.ts +12 -0
- package/types/column-settings/useColumnSettings.d.ts +17 -0
- package/types/index.d.ts +11 -0
- package/types/{vuu-table-extras/src/table-settings → table-settings}/TableSettingsPanel.d.ts +6 -4
- package/types/table-settings/useTableSettings.d.ts +17 -0
- package/types/useTableAndColumnSettings.d.ts +15 -0
- package/types/vuu-data/src/array-data-source/array-data-source.d.ts +0 -65
- package/types/vuu-data/src/array-data-source/group-utils.d.ts +0 -10
- package/types/vuu-data/src/array-data-source/sort-utils.d.ts +0 -4
- package/types/vuu-data/src/authenticate.d.ts +0 -1
- package/types/vuu-data/src/connection-manager.d.ts +0 -46
- package/types/vuu-data/src/connectionTypes.d.ts +0 -5
- package/types/vuu-data/src/constants.d.ts +0 -41
- package/types/vuu-data/src/data-source.d.ts +0 -172
- package/types/vuu-data/src/index.d.ts +0 -10
- package/types/vuu-data/src/inlined-worker.d.ts +0 -1
- package/types/vuu-data/src/json-data-source.d.ts +0 -53
- package/types/vuu-data/src/message-utils.d.ts +0 -26
- package/types/vuu-data/src/remote-data-source.d.ts +0 -56
- package/types/vuu-data/src/server-proxy/messages.d.ts +0 -43
- package/types/vuu-data/src/vuuUIMessageTypes.d.ts +0 -202
- package/types/vuu-data/src/websocket-connection.d.ts +0 -25
- package/types/vuu-table-extras/src/datagrid-configuration-ui/calculated-column-panel/CalculatedColumnPanel.d.ts +0 -11
- package/types/vuu-table-extras/src/datagrid-configuration-ui/calculated-column-panel/index.d.ts +0 -1
- package/types/vuu-table-extras/src/datagrid-configuration-ui/column-picker/ColumnListItem.d.ts +0 -4
- package/types/vuu-table-extras/src/datagrid-configuration-ui/column-picker/ColumnPicker.d.ts +0 -13
- package/types/vuu-table-extras/src/datagrid-configuration-ui/column-picker/index.d.ts +0 -1
- package/types/vuu-table-extras/src/datagrid-configuration-ui/column-settings-panel/ColumnSettingsPanel.d.ts +0 -9
- package/types/vuu-table-extras/src/datagrid-configuration-ui/column-type-panel/ColumnTypePanel.d.ts +0 -10
- package/types/vuu-table-extras/src/datagrid-configuration-ui/column-type-panel/NumericColumnPanel.d.ts +0 -4
- package/types/vuu-table-extras/src/datagrid-configuration-ui/column-type-panel/StringColumnPanel.d.ts +0 -4
- package/types/vuu-table-extras/src/datagrid-configuration-ui/column-type-panel/index.d.ts +0 -1
- package/types/vuu-table-extras/src/datagrid-configuration-ui/index.d.ts +0 -1
- package/types/vuu-table-extras/src/datagrid-configuration-ui/settings-panel/DatagridSettingsPanel.d.ts +0 -10
- package/types/vuu-table-extras/src/datagrid-configuration-ui/settings-panel/GridSettingsPanel.d.ts +0 -9
- package/types/vuu-table-extras/src/datagrid-configuration-ui/settings-panel/index.d.ts +0 -1
- package/types/vuu-table-extras/src/datagrid-configuration-ui/settings-panel/useGridSettings.d.ts +0 -59
- package/types/vuu-table-extras/src/index.d.ts +0 -6
- package/types/vuu-table-extras/src/table-settings/useTableSettings.d.ts +0 -14
- package/types/vuu-table-extras/src/table-settings-deprecated/calculated-column-panel/CalculatedColumnPanel.d.ts +0 -11
- package/types/vuu-table-extras/src/table-settings-deprecated/calculated-column-panel/index.d.ts +0 -1
- package/types/vuu-table-extras/src/table-settings-deprecated/column-settings-panel/ColumnSettingsPanel.d.ts +0 -9
- package/types/vuu-table-extras/src/table-settings-deprecated/column-settings-panel/index.d.ts +0 -1
- package/types/vuu-table-extras/src/table-settings-deprecated/column-type-panel/ColumnTypePanel.d.ts +0 -10
- package/types/vuu-table-extras/src/table-settings-deprecated/column-type-panel/NumericColumnPanel.d.ts +0 -4
- package/types/vuu-table-extras/src/table-settings-deprecated/column-type-panel/StringColumnPanel.d.ts +0 -4
- package/types/vuu-table-extras/src/table-settings-deprecated/column-type-panel/index.d.ts +0 -1
- package/types/vuu-table-extras/src/table-settings-deprecated/index.d.ts +0 -1
- package/types/vuu-table-extras/src/table-settings-deprecated/settings-panel/DatagridSettingsPanel.d.ts +0 -10
- package/types/vuu-table-extras/src/table-settings-deprecated/settings-panel/GridSettingsPanel.d.ts +0 -9
- package/types/vuu-table-extras/src/table-settings-deprecated/settings-panel/index.d.ts +0 -1
- package/types/vuu-table-extras/src/table-settings-deprecated/settings-panel/useGridSettings.d.ts +0 -59
- /package/types/{vuu-table-extras/src/cell-renderers → cell-renderers}/background-cell/BackgroundCell.d.ts +0 -0
- /package/types/{vuu-table-extras/src/cell-renderers → cell-renderers}/index.d.ts +0 -0
- /package/types/{vuu-table-extras/src/cell-renderers → cell-renderers}/progress-cell/ProgressCell.d.ts +0 -0
- /package/types/{vuu-table-extras/src/cell-renderers → cell-renderers}/progress-cell/index.d.ts +0 -0
- /package/types/{vuu-table-extras/src/cell-renderers → cell-renderers-next}/background-cell/index.d.ts +0 -0
- /package/types/{vuu-table-extras/src/cell-renderers → cell-renderers-next}/background-cell/useDirection.d.ts +0 -0
- /package/types/{vuu-table-extras/src/column-expression-input → column-expression-input}/column-function-descriptors.d.ts +0 -0
- /package/types/{vuu-table-extras/src/column-expression-input → column-expression-input}/column-language-parser/ColumnExpressionLanguage.d.ts +0 -0
- /package/types/{vuu-table-extras/src/column-expression-input → column-expression-input}/column-language-parser/ColumnExpressionTreeWalker.d.ts +0 -0
- /package/types/{vuu-table-extras/src/column-expression-input → column-expression-input}/column-language-parser/column-expression-parse-utils.d.ts +0 -0
- /package/types/{vuu-table-extras/src/column-expression-input → column-expression-input}/column-language-parser/generated/column-parser.d.ts +0 -0
- /package/types/{vuu-table-extras/src/column-expression-input → column-expression-input}/column-language-parser/generated/column-parser.terms.d.ts +0 -0
- /package/types/{vuu-table-extras/src/column-expression-input → column-expression-input}/column-language-parser/index.d.ts +0 -0
- /package/types/{vuu-table-extras/src/column-expression-input → column-expression-input}/column-language-parser/test.d.mts +0 -0
- /package/types/{vuu-table-extras/src/column-expression-input → column-expression-input}/functionDocInfo.d.ts +0 -0
- /package/types/{vuu-table-extras/src/column-expression-input → column-expression-input}/highlighting.d.ts +0 -0
- /package/types/{vuu-table-extras/src/column-expression-input → column-expression-input}/index.d.ts +0 -0
- /package/types/{vuu-table-extras/src/column-expression-input → column-expression-input}/theme.d.ts +0 -0
- /package/types/{vuu-table-extras/src/column-expression-input → column-expression-input}/useColumnAutoComplete.d.ts +0 -0
- /package/types/{vuu-table-extras/src/column-expression-input → column-expression-input}/useColumnExpressionSuggestionProvider.d.ts +0 -0
- /package/types/{vuu-table-extras/src/column-list → column-list}/ColumnList.d.ts +0 -0
- /package/types/{vuu-table-extras/src/column-list → column-list}/index.d.ts +0 -0
- /package/types/{vuu-table-extras/src/datagrid-configuration-ui/column-settings-panel → column-settings}/index.d.ts +0 -0
- /package/types/{vuu-table-extras/src/datasource-stats → datasource-stats}/DatasourceStats.d.ts +0 -0
- /package/types/{vuu-table-extras/src/datasource-stats → datasource-stats}/index.d.ts +0 -0
- /package/types/{vuu-table-extras/src/table-settings → table-settings}/index.d.ts +0 -0
package/esm/index.js
CHANGED
|
@@ -17,13 +17,55 @@ var __privateSet = (obj, member, value, setter) => {
|
|
|
17
17
|
return value;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
// src/cell-edit-validators/CaseValidator.ts
|
|
21
|
+
import { registerComponent } from "@vuu-ui/vuu-utils";
|
|
22
|
+
var isString = (value) => typeof value === "string";
|
|
23
|
+
var CaseValidator = (rule, value) => {
|
|
24
|
+
if (isString(value)) {
|
|
25
|
+
if (value === "") {
|
|
26
|
+
return true;
|
|
27
|
+
} else if (rule.value === "lower" && value.toLowerCase() !== value) {
|
|
28
|
+
return "value must be all lowercase";
|
|
29
|
+
} else if (rule.value === "upper" && value.toUpperCase() !== value) {
|
|
30
|
+
return "value must be all uppercase";
|
|
31
|
+
} else {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
return "value must be a string";
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
registerComponent("vuu-case", CaseValidator, "data-edit-validator", {});
|
|
39
|
+
|
|
40
|
+
// src/cell-edit-validators/PatternValidator.ts
|
|
41
|
+
import { registerComponent as registerComponent2 } from "@vuu-ui/vuu-utils";
|
|
42
|
+
var isString2 = (value) => typeof value === "string";
|
|
43
|
+
var defaultMessage = "value does not match expected pattern";
|
|
44
|
+
var PatternValidator = (rule, value) => {
|
|
45
|
+
if (typeof rule.value !== "string") {
|
|
46
|
+
throw Error("Pattern validation rule must provide pattern");
|
|
47
|
+
}
|
|
48
|
+
if (isString2(value)) {
|
|
49
|
+
if (value === "") {
|
|
50
|
+
return true;
|
|
51
|
+
} else {
|
|
52
|
+
const { message = defaultMessage } = rule;
|
|
53
|
+
const pattern = new RegExp(rule.value);
|
|
54
|
+
return pattern.test(value) || message;
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
return "value must be a string";
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
registerComponent2("vuu-pattern", PatternValidator, "data-edit-validator", {});
|
|
61
|
+
|
|
20
62
|
// src/cell-renderers/background-cell/BackgroundCell.tsx
|
|
21
63
|
import {
|
|
22
64
|
DOWN1,
|
|
23
65
|
DOWN2,
|
|
24
66
|
isTypeDescriptor as isTypeDescriptor2,
|
|
25
67
|
metadataKeys,
|
|
26
|
-
registerComponent,
|
|
68
|
+
registerComponent as registerComponent3,
|
|
27
69
|
UP1,
|
|
28
70
|
UP2
|
|
29
71
|
} from "@vuu-ui/vuu-utils";
|
|
@@ -55,7 +97,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
55
97
|
var CHAR_ARROW_UP = String.fromCharCode(11014);
|
|
56
98
|
var CHAR_ARROW_DOWN = String.fromCharCode(11015);
|
|
57
99
|
var { KEY } = metadataKeys;
|
|
58
|
-
var classBase = "
|
|
100
|
+
var classBase = "vuuBackgroundCellDeprecated";
|
|
59
101
|
var FlashStyle = {
|
|
60
102
|
ArrowOnly: "arrow",
|
|
61
103
|
BackgroundOnly: "bg-only",
|
|
@@ -85,7 +127,9 @@ var BackgroundCell = ({ column, row }) => {
|
|
|
85
127
|
valueFormatter(row[column.key])
|
|
86
128
|
] });
|
|
87
129
|
};
|
|
88
|
-
|
|
130
|
+
registerComponent3("background", BackgroundCell, "cell-renderer", {
|
|
131
|
+
description: "Background Cell renderer for VuuTable",
|
|
132
|
+
label: "Background Cell (deprecated)",
|
|
89
133
|
serverDataType: ["long", "int", "double"]
|
|
90
134
|
});
|
|
91
135
|
|
|
@@ -93,7 +137,8 @@ registerComponent("background", BackgroundCell, "cell-renderer", {
|
|
|
93
137
|
import {
|
|
94
138
|
isColumnTypeRenderer,
|
|
95
139
|
isTypeDescriptor as isTypeDescriptor3,
|
|
96
|
-
|
|
140
|
+
isValidNumber as isValidNumber2,
|
|
141
|
+
registerComponent as registerComponent4
|
|
97
142
|
} from "@vuu-ui/vuu-utils";
|
|
98
143
|
import cx2 from "classnames";
|
|
99
144
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
@@ -105,22 +150,27 @@ var ProgressCell = ({ column, columnMap, row }) => {
|
|
|
105
150
|
let percentage = 0;
|
|
106
151
|
if (isTypeDescriptor3(type) && isColumnTypeRenderer(type.renderer)) {
|
|
107
152
|
const { associatedField } = type.renderer;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
if (Number.isFinite(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
153
|
+
if (associatedField) {
|
|
154
|
+
const associatedValue = row[columnMap[associatedField]];
|
|
155
|
+
if (typeof isValidNumber2(value) && isValidNumber2(associatedValue)) {
|
|
156
|
+
percentage = Math.min(Math.round(value / associatedValue * 100), 100);
|
|
157
|
+
percentage = Math.min(Math.round(value / associatedValue * 100), 100);
|
|
158
|
+
showProgress = isFinite(percentage);
|
|
159
|
+
} else {
|
|
160
|
+
const floatValue = parseFloat(value);
|
|
161
|
+
if (Number.isFinite(floatValue)) {
|
|
162
|
+
const floatOtherValue = parseFloat(associatedValue);
|
|
163
|
+
if (Number.isFinite(floatOtherValue)) {
|
|
164
|
+
percentage = Math.min(
|
|
165
|
+
Math.round(floatValue / floatOtherValue * 100),
|
|
166
|
+
100
|
|
167
|
+
);
|
|
168
|
+
showProgress = isFinite(percentage);
|
|
169
|
+
}
|
|
122
170
|
}
|
|
123
171
|
}
|
|
172
|
+
} else {
|
|
173
|
+
throw Error("ProgressCell associatedField is required to render");
|
|
124
174
|
}
|
|
125
175
|
}
|
|
126
176
|
const className = cx2(classBase2, {});
|
|
@@ -138,7 +188,84 @@ var ProgressCell = ({ column, columnMap, row }) => {
|
|
|
138
188
|
/* @__PURE__ */ jsx2("span", { className: `${classBase2}-text`, children: `${percentage} %` })
|
|
139
189
|
] });
|
|
140
190
|
};
|
|
141
|
-
|
|
191
|
+
registerComponent4("vuu.progress", ProgressCell, "cell-renderer", {
|
|
192
|
+
description: "Progress formatter",
|
|
193
|
+
label: "Progress formatter",
|
|
194
|
+
serverDataType: ["long", "int", "double"]
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
// src/cell-renderers-next/background-cell/BackgroundCell.tsx
|
|
198
|
+
import {
|
|
199
|
+
DOWN1 as DOWN12,
|
|
200
|
+
DOWN2 as DOWN22,
|
|
201
|
+
isTypeDescriptor as isTypeDescriptor5,
|
|
202
|
+
metadataKeys as metadataKeys2,
|
|
203
|
+
registerComponent as registerComponent5,
|
|
204
|
+
UP1 as UP12,
|
|
205
|
+
UP2 as UP22
|
|
206
|
+
} from "@vuu-ui/vuu-utils";
|
|
207
|
+
import cx3 from "classnames";
|
|
208
|
+
|
|
209
|
+
// src/cell-renderers-next/background-cell/useDirection.ts
|
|
210
|
+
import {
|
|
211
|
+
getMovingValueDirection as getMovingValueDirection2,
|
|
212
|
+
isTypeDescriptor as isTypeDescriptor4,
|
|
213
|
+
isValidNumber as isValidNumber3
|
|
214
|
+
} from "@vuu-ui/vuu-utils";
|
|
215
|
+
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
216
|
+
var INITIAL_VALUE2 = [void 0, void 0, void 0, void 0];
|
|
217
|
+
function useDirection2(key, value, column) {
|
|
218
|
+
var _a;
|
|
219
|
+
const ref = useRef2();
|
|
220
|
+
const [prevKey, prevValue, prevColumn, prevDirection] = ref.current || INITIAL_VALUE2;
|
|
221
|
+
const { type: dataType } = column;
|
|
222
|
+
const decimals = isTypeDescriptor4(dataType) ? (_a = dataType.formatting) == null ? void 0 : _a.decimals : void 0;
|
|
223
|
+
const direction = key === prevKey && isValidNumber3(value) && isValidNumber3(prevValue) && column === prevColumn ? getMovingValueDirection2(value, prevDirection, prevValue, decimals) : "";
|
|
224
|
+
useEffect2(() => {
|
|
225
|
+
ref.current = [key, value, column, direction];
|
|
226
|
+
});
|
|
227
|
+
return direction;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// src/cell-renderers-next/background-cell/BackgroundCell.tsx
|
|
231
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
232
|
+
var CHAR_ARROW_UP2 = String.fromCharCode(11014);
|
|
233
|
+
var CHAR_ARROW_DOWN2 = String.fromCharCode(11015);
|
|
234
|
+
var { KEY: KEY2 } = metadataKeys2;
|
|
235
|
+
var classBase3 = "vuuBackgroundCell";
|
|
236
|
+
var FlashStyle2 = {
|
|
237
|
+
ArrowOnly: "arrow",
|
|
238
|
+
BackgroundOnly: "bg-only",
|
|
239
|
+
ArrowBackground: "arrow-bg"
|
|
240
|
+
};
|
|
241
|
+
var getFlashStyle2 = (colType) => {
|
|
242
|
+
if (isTypeDescriptor5(colType) && colType.renderer) {
|
|
243
|
+
if ("flashStyle" in colType.renderer) {
|
|
244
|
+
return colType.renderer["flashStyle"];
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return FlashStyle2.BackgroundOnly;
|
|
248
|
+
};
|
|
249
|
+
var BackgroundCell2 = ({ column, row }) => {
|
|
250
|
+
const { key, type, valueFormatter } = column;
|
|
251
|
+
const value = row[key];
|
|
252
|
+
const flashStyle = getFlashStyle2(type);
|
|
253
|
+
const direction = useDirection2(row[KEY2], value, column);
|
|
254
|
+
const arrow = flashStyle === FlashStyle2.ArrowOnly || flashStyle === FlashStyle2.ArrowBackground ? direction === UP12 || direction === UP22 ? CHAR_ARROW_UP2 : direction === DOWN12 || direction === DOWN22 ? CHAR_ARROW_DOWN2 : null : null;
|
|
255
|
+
const dirClass = direction ? ` ` + direction : "";
|
|
256
|
+
const className = cx3(classBase3, dirClass, {
|
|
257
|
+
[`${classBase3}-arrowOnly`]: flashStyle === FlashStyle2.ArrowOnly,
|
|
258
|
+
[`${classBase3}-arrowBackground`]: flashStyle === FlashStyle2.ArrowBackground
|
|
259
|
+
});
|
|
260
|
+
return /* @__PURE__ */ jsxs3("div", { className, tabIndex: -1, children: [
|
|
261
|
+
/* @__PURE__ */ jsx3("div", { className: `${classBase3}-flasher`, children: arrow }),
|
|
262
|
+
valueFormatter(row[column.key])
|
|
263
|
+
] });
|
|
264
|
+
};
|
|
265
|
+
console.log("register BackgroundCellNext");
|
|
266
|
+
registerComponent5("background-next", BackgroundCell2, "cell-renderer", {
|
|
267
|
+
description: "Change background color of cell when value changes",
|
|
268
|
+
label: "Background Flash",
|
|
142
269
|
serverDataType: ["long", "int", "double"]
|
|
143
270
|
});
|
|
144
271
|
|
|
@@ -149,10 +276,10 @@ import {
|
|
|
149
276
|
} from "@vuu-ui/vuu-ui-controls";
|
|
150
277
|
import { Checkbox } from "@salt-ds/core";
|
|
151
278
|
import { Switch } from "@salt-ds/lab";
|
|
152
|
-
import
|
|
279
|
+
import cx4 from "classnames";
|
|
153
280
|
import { useCallback } from "react";
|
|
154
|
-
import { jsx as
|
|
155
|
-
var
|
|
281
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
282
|
+
var classBase4 = "vuuColumnList";
|
|
156
283
|
var classBaseListItem = "vuuColumnListItem";
|
|
157
284
|
var ColumnListItem = ({
|
|
158
285
|
className: classNameProp,
|
|
@@ -160,19 +287,19 @@ var ColumnListItem = ({
|
|
|
160
287
|
...listItemProps
|
|
161
288
|
}) => {
|
|
162
289
|
var _a;
|
|
163
|
-
return /* @__PURE__ */
|
|
290
|
+
return /* @__PURE__ */ jsxs4(
|
|
164
291
|
ListItem,
|
|
165
292
|
{
|
|
166
293
|
...listItemProps,
|
|
167
|
-
className:
|
|
294
|
+
className: cx4(classNameProp, classBaseListItem),
|
|
168
295
|
"data-name": item == null ? void 0 : item.name,
|
|
169
296
|
children: [
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
-
/* @__PURE__ */
|
|
172
|
-
/* @__PURE__ */
|
|
297
|
+
(item == null ? void 0 : item.isCalculated) ? /* @__PURE__ */ jsx4("span", { className: `${classBase4}-icon`, "data-icon": "function" }) : /* @__PURE__ */ jsx4(Switch, { className: `${classBase4}-switch`, checked: item == null ? void 0 : item.subscribed }),
|
|
298
|
+
/* @__PURE__ */ jsx4("span", { className: `${classBase4}-text`, children: (_a = item == null ? void 0 : item.label) != null ? _a : item == null ? void 0 : item.name }),
|
|
299
|
+
/* @__PURE__ */ jsx4(
|
|
173
300
|
Checkbox,
|
|
174
301
|
{
|
|
175
|
-
className: `${
|
|
302
|
+
className: `${classBase4}-checkBox`,
|
|
176
303
|
checked: (item == null ? void 0 : item.hidden) !== true,
|
|
177
304
|
disabled: (item == null ? void 0 : item.subscribed) !== true
|
|
178
305
|
}
|
|
@@ -192,29 +319,29 @@ var ColumnList = ({
|
|
|
192
319
|
const input = evt.target;
|
|
193
320
|
const listItem = input.closest(`.${classBaseListItem}`);
|
|
194
321
|
const {
|
|
195
|
-
dataset: { name }
|
|
322
|
+
dataset: { name: name2 }
|
|
196
323
|
} = listItem;
|
|
197
|
-
if (
|
|
198
|
-
const saltSwitch = input.closest(`.${
|
|
324
|
+
if (name2) {
|
|
325
|
+
const saltSwitch = input.closest(`.${classBase4}-switch`);
|
|
199
326
|
const saltCheckbox = input.closest(
|
|
200
|
-
`.${
|
|
327
|
+
`.${classBase4}-checkBox`
|
|
201
328
|
);
|
|
202
329
|
if (saltSwitch) {
|
|
203
|
-
onChange(
|
|
330
|
+
onChange(name2, "subscribed", input.checked);
|
|
204
331
|
} else if (saltCheckbox) {
|
|
205
|
-
onChange(
|
|
332
|
+
onChange(name2, "hidden", input.checked === false);
|
|
206
333
|
}
|
|
207
334
|
}
|
|
208
335
|
},
|
|
209
336
|
[onChange]
|
|
210
337
|
);
|
|
211
|
-
return /* @__PURE__ */
|
|
212
|
-
/* @__PURE__ */
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
-
/* @__PURE__ */
|
|
215
|
-
/* @__PURE__ */
|
|
338
|
+
return /* @__PURE__ */ jsxs4("div", { ...htmlAttributes, className: classBase4, children: [
|
|
339
|
+
/* @__PURE__ */ jsx4("div", { className: `${classBase4}-header`, children: /* @__PURE__ */ jsx4("span", { children: "Column Selection" }) }),
|
|
340
|
+
/* @__PURE__ */ jsxs4("div", { className: `${classBase4}-colHeadings`, children: [
|
|
341
|
+
/* @__PURE__ */ jsx4("span", { children: "Column subscription" }),
|
|
342
|
+
/* @__PURE__ */ jsx4("span", { children: "Visibility" })
|
|
216
343
|
] }),
|
|
217
|
-
/* @__PURE__ */
|
|
344
|
+
/* @__PURE__ */ jsx4(
|
|
218
345
|
List,
|
|
219
346
|
{
|
|
220
347
|
ListItem: ColumnListItem,
|
|
@@ -230,6 +357,410 @@ var ColumnList = ({
|
|
|
230
357
|
] });
|
|
231
358
|
};
|
|
232
359
|
|
|
360
|
+
// src/column-settings/ColumnSettingsPanel.tsx
|
|
361
|
+
import { getDefaultAlignment, isCalculatedColumn } from "@vuu-ui/vuu-utils";
|
|
362
|
+
import {
|
|
363
|
+
Button as Button2,
|
|
364
|
+
FormField as FormField4,
|
|
365
|
+
FormFieldLabel as FormFieldLabel4,
|
|
366
|
+
ToggleButton,
|
|
367
|
+
ToggleButtonGroup
|
|
368
|
+
} from "@salt-ds/core";
|
|
369
|
+
|
|
370
|
+
// src/column-formatting-settings/ColumnFormattingPanel.tsx
|
|
371
|
+
import { Dropdown } from "@vuu-ui/vuu-ui-controls";
|
|
372
|
+
import { FormField as FormField2, FormFieldLabel as FormFieldLabel2 } from "@salt-ds/core";
|
|
373
|
+
import cx5 from "classnames";
|
|
374
|
+
import { useMemo } from "react";
|
|
375
|
+
|
|
376
|
+
// src/column-formatting-settings/NumericFormattingSettings.tsx
|
|
377
|
+
import { FormField, FormFieldLabel, Input } from "@salt-ds/core";
|
|
378
|
+
import { Switch as Switch2 } from "@salt-ds/lab";
|
|
379
|
+
import { getTypeSettingsFromColumn } from "@vuu-ui/vuu-utils";
|
|
380
|
+
import {
|
|
381
|
+
useCallback as useCallback2,
|
|
382
|
+
useState
|
|
383
|
+
} from "react";
|
|
384
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
385
|
+
var classBase5 = "vuuFormattingSettings";
|
|
386
|
+
var NumericFormattingSettings = ({
|
|
387
|
+
column,
|
|
388
|
+
onChange
|
|
389
|
+
}) => {
|
|
390
|
+
var _a;
|
|
391
|
+
const [formattingSettings, setFormattingSettings] = useState(
|
|
392
|
+
getTypeSettingsFromColumn(column)
|
|
393
|
+
);
|
|
394
|
+
const handleInputKeyDown = useCallback2(
|
|
395
|
+
(evt) => {
|
|
396
|
+
if (evt.key === "Enter" || evt.key === "Tab") {
|
|
397
|
+
onChange(formattingSettings);
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
[formattingSettings, onChange]
|
|
401
|
+
);
|
|
402
|
+
const handleChangeDecimals = useCallback2(
|
|
403
|
+
(evt) => {
|
|
404
|
+
const { value } = evt.target;
|
|
405
|
+
const numericValue = value === "" ? void 0 : isNaN(parseInt(value)) ? void 0 : parseInt(value);
|
|
406
|
+
const newFormattingSettings = {
|
|
407
|
+
...formattingSettings,
|
|
408
|
+
decimals: numericValue
|
|
409
|
+
};
|
|
410
|
+
setFormattingSettings(newFormattingSettings);
|
|
411
|
+
},
|
|
412
|
+
[formattingSettings]
|
|
413
|
+
);
|
|
414
|
+
const handleChangeAlignDecimals = useCallback2(
|
|
415
|
+
(evt) => {
|
|
416
|
+
const { checked } = evt.target;
|
|
417
|
+
const newFormattingSettings = {
|
|
418
|
+
...formattingSettings,
|
|
419
|
+
alignOnDecimals: checked
|
|
420
|
+
};
|
|
421
|
+
setFormattingSettings(newFormattingSettings);
|
|
422
|
+
onChange(newFormattingSettings);
|
|
423
|
+
},
|
|
424
|
+
[formattingSettings, onChange]
|
|
425
|
+
);
|
|
426
|
+
const handleChangeZeroPad = useCallback2(
|
|
427
|
+
(evt) => {
|
|
428
|
+
const { checked } = evt.target;
|
|
429
|
+
const newFormattingSettings = {
|
|
430
|
+
...formattingSettings,
|
|
431
|
+
zeroPad: checked
|
|
432
|
+
};
|
|
433
|
+
setFormattingSettings(newFormattingSettings);
|
|
434
|
+
onChange(newFormattingSettings);
|
|
435
|
+
},
|
|
436
|
+
[formattingSettings, onChange]
|
|
437
|
+
);
|
|
438
|
+
return /* @__PURE__ */ jsxs5("div", { className: classBase5, children: [
|
|
439
|
+
/* @__PURE__ */ jsxs5(FormField, { "data-field": "decimals", children: [
|
|
440
|
+
/* @__PURE__ */ jsx5(FormFieldLabel, { children: "Number of decimals" }),
|
|
441
|
+
/* @__PURE__ */ jsx5(
|
|
442
|
+
Input,
|
|
443
|
+
{
|
|
444
|
+
className: "vuuInput",
|
|
445
|
+
onChange: handleChangeDecimals,
|
|
446
|
+
onKeyDown: handleInputKeyDown,
|
|
447
|
+
value: (_a = formattingSettings.decimals) != null ? _a : ""
|
|
448
|
+
}
|
|
449
|
+
)
|
|
450
|
+
] }),
|
|
451
|
+
/* @__PURE__ */ jsxs5(FormField, { labelPlacement: "left", children: [
|
|
452
|
+
/* @__PURE__ */ jsx5(FormFieldLabel, { children: "Align on decimals" }),
|
|
453
|
+
/* @__PURE__ */ jsx5(
|
|
454
|
+
Switch2,
|
|
455
|
+
{
|
|
456
|
+
checked: formattingSettings.alignOnDecimals,
|
|
457
|
+
onChange: handleChangeAlignDecimals,
|
|
458
|
+
value: "align-decimals"
|
|
459
|
+
}
|
|
460
|
+
)
|
|
461
|
+
] }),
|
|
462
|
+
/* @__PURE__ */ jsxs5(FormField, { labelPlacement: "left", children: [
|
|
463
|
+
/* @__PURE__ */ jsx5(FormFieldLabel, { children: "Zero pad decimals" }),
|
|
464
|
+
/* @__PURE__ */ jsx5(
|
|
465
|
+
Switch2,
|
|
466
|
+
{
|
|
467
|
+
checked: formattingSettings.zeroPad,
|
|
468
|
+
onChange: handleChangeZeroPad,
|
|
469
|
+
value: "zero-pad"
|
|
470
|
+
}
|
|
471
|
+
)
|
|
472
|
+
] })
|
|
473
|
+
] });
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
// src/column-formatting-settings/ColumnFormattingPanel.tsx
|
|
477
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
478
|
+
var classBase6 = "vuuColumnFormattingPanel";
|
|
479
|
+
var itemToString = (item) => {
|
|
480
|
+
var _a;
|
|
481
|
+
return (_a = item.label) != null ? _a : item.name;
|
|
482
|
+
};
|
|
483
|
+
var ColumnFormattingPanel = ({
|
|
484
|
+
availableRenderers,
|
|
485
|
+
selectedCellRenderer,
|
|
486
|
+
className,
|
|
487
|
+
column,
|
|
488
|
+
onChangeFormatting,
|
|
489
|
+
onChangeRenderer,
|
|
490
|
+
...htmlAttributes
|
|
491
|
+
}) => {
|
|
492
|
+
const content = useMemo(() => {
|
|
493
|
+
switch (column.serverDataType) {
|
|
494
|
+
case "double":
|
|
495
|
+
case "int":
|
|
496
|
+
case "long":
|
|
497
|
+
return /* @__PURE__ */ jsx6(
|
|
498
|
+
NumericFormattingSettings,
|
|
499
|
+
{
|
|
500
|
+
column,
|
|
501
|
+
onChange: onChangeFormatting
|
|
502
|
+
}
|
|
503
|
+
);
|
|
504
|
+
default:
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
}, [column, onChangeFormatting]);
|
|
508
|
+
const { serverDataType = "string" } = column;
|
|
509
|
+
return /* @__PURE__ */ jsxs6("div", { ...htmlAttributes, className: `vuuColumnSettingsPanel-header`, children: [
|
|
510
|
+
/* @__PURE__ */ jsx6("div", { children: "Formatting" }),
|
|
511
|
+
/* @__PURE__ */ jsxs6(FormField2, { children: [
|
|
512
|
+
/* @__PURE__ */ jsx6(FormFieldLabel2, { children: "Renderer" }),
|
|
513
|
+
/* @__PURE__ */ jsx6(
|
|
514
|
+
Dropdown,
|
|
515
|
+
{
|
|
516
|
+
className: cx5(`${classBase6}-renderer`),
|
|
517
|
+
itemToString,
|
|
518
|
+
onSelectionChange: onChangeRenderer,
|
|
519
|
+
selected: selectedCellRenderer,
|
|
520
|
+
source: availableRenderers,
|
|
521
|
+
width: "100%"
|
|
522
|
+
}
|
|
523
|
+
)
|
|
524
|
+
] }),
|
|
525
|
+
/* @__PURE__ */ jsx6(
|
|
526
|
+
"div",
|
|
527
|
+
{
|
|
528
|
+
className: cx5(classBase6, className, `${classBase6}-${serverDataType}`),
|
|
529
|
+
children: content
|
|
530
|
+
}
|
|
531
|
+
)
|
|
532
|
+
] });
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
// src/column-settings/useColumnSettings.ts
|
|
536
|
+
import {
|
|
537
|
+
getRegisteredCellRenderers,
|
|
538
|
+
isColumnTypeRenderer as isColumnTypeRenderer2,
|
|
539
|
+
isTypeDescriptor as isTypeDescriptor6,
|
|
540
|
+
isValidColumnAlignment,
|
|
541
|
+
isValidPinLocation,
|
|
542
|
+
setCalculatedColumnName,
|
|
543
|
+
updateColumnRenderer,
|
|
544
|
+
updateColumnType
|
|
545
|
+
} from "@vuu-ui/vuu-utils";
|
|
546
|
+
import {
|
|
547
|
+
useCallback as useCallback3,
|
|
548
|
+
useMemo as useMemo2,
|
|
549
|
+
useRef as useRef3,
|
|
550
|
+
useState as useState2
|
|
551
|
+
} from "react";
|
|
552
|
+
var integerCellRenderers = [
|
|
553
|
+
{
|
|
554
|
+
description: "Default formatter for columns with data type integer",
|
|
555
|
+
label: "Default Renderer (data type int, long)",
|
|
556
|
+
name: "default-int"
|
|
557
|
+
}
|
|
558
|
+
];
|
|
559
|
+
var doubleCellRenderers = [
|
|
560
|
+
{
|
|
561
|
+
description: "Default formatter for columns with data type double",
|
|
562
|
+
label: "Default Renderer (data type double)",
|
|
563
|
+
name: "default-double"
|
|
564
|
+
},
|
|
565
|
+
...getRegisteredCellRenderers("double")
|
|
566
|
+
];
|
|
567
|
+
var stringCellRenderers = [
|
|
568
|
+
{
|
|
569
|
+
description: "Default formatter for columns with data type string",
|
|
570
|
+
label: "Default Renderer (data type string)",
|
|
571
|
+
name: "default-string"
|
|
572
|
+
}
|
|
573
|
+
];
|
|
574
|
+
var getAvailableCellRenderers = (column) => {
|
|
575
|
+
switch (column.serverDataType) {
|
|
576
|
+
case "char":
|
|
577
|
+
case "string":
|
|
578
|
+
return stringCellRenderers;
|
|
579
|
+
case "int":
|
|
580
|
+
case "long":
|
|
581
|
+
return integerCellRenderers;
|
|
582
|
+
case "double":
|
|
583
|
+
return doubleCellRenderers;
|
|
584
|
+
default:
|
|
585
|
+
return stringCellRenderers;
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
var getCellRendererDescriptor = (availableRenderers, column) => {
|
|
589
|
+
if (isTypeDescriptor6(column.type)) {
|
|
590
|
+
const { renderer } = column.type;
|
|
591
|
+
if (isColumnTypeRenderer2(renderer)) {
|
|
592
|
+
const cellRenderer = availableRenderers.find(
|
|
593
|
+
(r) => r.name === renderer.name
|
|
594
|
+
);
|
|
595
|
+
if (cellRenderer) {
|
|
596
|
+
return cellRenderer;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
const typedAvailableRenderers = getAvailableCellRenderers(column);
|
|
601
|
+
return typedAvailableRenderers[0];
|
|
602
|
+
};
|
|
603
|
+
var getFieldName = (input) => {
|
|
604
|
+
const saltFormField = input.closest(".saltFormField");
|
|
605
|
+
if (saltFormField && saltFormField.dataset.field) {
|
|
606
|
+
const {
|
|
607
|
+
dataset: { field }
|
|
608
|
+
} = saltFormField;
|
|
609
|
+
return field;
|
|
610
|
+
} else {
|
|
611
|
+
throw Error("named form field not found");
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
var getColumn = (columns, column) => {
|
|
615
|
+
if (column.name === "::") {
|
|
616
|
+
return column;
|
|
617
|
+
} else {
|
|
618
|
+
const col = columns.find((col2) => col2.name === column.name);
|
|
619
|
+
if (col) {
|
|
620
|
+
return col;
|
|
621
|
+
}
|
|
622
|
+
throw Error(`columns does not contain column ${name}`);
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
var replaceColumn = (tableConfig, column) => ({
|
|
626
|
+
...tableConfig,
|
|
627
|
+
columns: tableConfig.columns.map(
|
|
628
|
+
(col) => col.name === column.name ? column : col
|
|
629
|
+
)
|
|
630
|
+
});
|
|
631
|
+
var useColumnSettings = ({
|
|
632
|
+
column: columnProp,
|
|
633
|
+
onConfigChange,
|
|
634
|
+
onCreateCalculatedColumn,
|
|
635
|
+
tableConfig
|
|
636
|
+
}) => {
|
|
637
|
+
const [column, setColumn] = useState2(
|
|
638
|
+
getColumn(tableConfig.columns, columnProp)
|
|
639
|
+
);
|
|
640
|
+
const availableRenderers = useMemo2(() => {
|
|
641
|
+
return getAvailableCellRenderers(column);
|
|
642
|
+
}, [column]);
|
|
643
|
+
const selectedCellRendererRef = useRef3(
|
|
644
|
+
getCellRendererDescriptor(availableRenderers, column)
|
|
645
|
+
);
|
|
646
|
+
const handleInputCommit = useCallback3(() => {
|
|
647
|
+
onConfigChange(replaceColumn(tableConfig, column));
|
|
648
|
+
}, [column, onConfigChange, tableConfig]);
|
|
649
|
+
const handleChange = useCallback3(
|
|
650
|
+
(evt) => {
|
|
651
|
+
const input = evt.target;
|
|
652
|
+
const fieldName = getFieldName(input);
|
|
653
|
+
const { value } = input;
|
|
654
|
+
switch (fieldName) {
|
|
655
|
+
case "column-label":
|
|
656
|
+
setColumn((state) => ({ ...state, label: value }));
|
|
657
|
+
break;
|
|
658
|
+
case "column-name":
|
|
659
|
+
setColumn((state) => setCalculatedColumnName(state, value));
|
|
660
|
+
break;
|
|
661
|
+
case "column-width":
|
|
662
|
+
setColumn((state) => ({ ...state, width: parseInt(value) }));
|
|
663
|
+
break;
|
|
664
|
+
case "column-alignment":
|
|
665
|
+
if (isValidColumnAlignment(value)) {
|
|
666
|
+
const newColumn = {
|
|
667
|
+
...column,
|
|
668
|
+
align: value || void 0
|
|
669
|
+
};
|
|
670
|
+
setColumn(newColumn);
|
|
671
|
+
onConfigChange(replaceColumn(tableConfig, newColumn));
|
|
672
|
+
}
|
|
673
|
+
break;
|
|
674
|
+
case "column-pin":
|
|
675
|
+
if (isValidPinLocation(value)) {
|
|
676
|
+
const newColumn = {
|
|
677
|
+
...column,
|
|
678
|
+
pin: value || void 0
|
|
679
|
+
};
|
|
680
|
+
setColumn(newColumn);
|
|
681
|
+
onConfigChange(replaceColumn(tableConfig, newColumn));
|
|
682
|
+
break;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
},
|
|
686
|
+
[column, onConfigChange, tableConfig]
|
|
687
|
+
);
|
|
688
|
+
const handleChangeRenderer = useCallback3(
|
|
689
|
+
(evt, cellRenderer) => {
|
|
690
|
+
if (cellRenderer) {
|
|
691
|
+
const newColumn = updateColumnRenderer(
|
|
692
|
+
column,
|
|
693
|
+
cellRenderer
|
|
694
|
+
);
|
|
695
|
+
selectedCellRendererRef.current = cellRenderer;
|
|
696
|
+
setColumn(newColumn);
|
|
697
|
+
onConfigChange(replaceColumn(tableConfig, newColumn));
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
[column, onConfigChange, tableConfig]
|
|
701
|
+
);
|
|
702
|
+
const handleChangeFormatting = useCallback3(
|
|
703
|
+
(formatting) => {
|
|
704
|
+
const newColumn = updateColumnType(column, formatting);
|
|
705
|
+
setColumn(newColumn);
|
|
706
|
+
onConfigChange(replaceColumn(tableConfig, newColumn));
|
|
707
|
+
},
|
|
708
|
+
[column, onConfigChange, tableConfig]
|
|
709
|
+
);
|
|
710
|
+
const navigateColumn = useCallback3(
|
|
711
|
+
({ moveBy }) => {
|
|
712
|
+
const { columns } = tableConfig;
|
|
713
|
+
const index = columns.indexOf(column) + moveBy;
|
|
714
|
+
const newColumn = columns[index];
|
|
715
|
+
if (newColumn) {
|
|
716
|
+
selectedCellRendererRef.current = getCellRendererDescriptor(
|
|
717
|
+
availableRenderers,
|
|
718
|
+
newColumn
|
|
719
|
+
);
|
|
720
|
+
setColumn(newColumn);
|
|
721
|
+
}
|
|
722
|
+
},
|
|
723
|
+
[availableRenderers, column, tableConfig]
|
|
724
|
+
);
|
|
725
|
+
const navigateNextColumn = useCallback3(() => {
|
|
726
|
+
navigateColumn({ moveBy: 1 });
|
|
727
|
+
}, [navigateColumn]);
|
|
728
|
+
const navigatePrevColumn = useCallback3(() => {
|
|
729
|
+
navigateColumn({ moveBy: -1 });
|
|
730
|
+
}, [navigateColumn]);
|
|
731
|
+
const handleSaveCalculatedColumn = useCallback3(
|
|
732
|
+
(calculatedColumn) => {
|
|
733
|
+
onCreateCalculatedColumn({
|
|
734
|
+
...column,
|
|
735
|
+
...calculatedColumn
|
|
736
|
+
});
|
|
737
|
+
},
|
|
738
|
+
[column, onCreateCalculatedColumn]
|
|
739
|
+
);
|
|
740
|
+
return {
|
|
741
|
+
availableRenderers,
|
|
742
|
+
selectedCellRenderer: selectedCellRendererRef.current,
|
|
743
|
+
column,
|
|
744
|
+
navigateNextColumn,
|
|
745
|
+
navigatePrevColumn,
|
|
746
|
+
onChange: handleChange,
|
|
747
|
+
onChangeFormatting: handleChangeFormatting,
|
|
748
|
+
onChangeRenderer: handleChangeRenderer,
|
|
749
|
+
onInputCommit: handleInputCommit,
|
|
750
|
+
onSave: handleSaveCalculatedColumn
|
|
751
|
+
};
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
// src/column-expression-panel/ColumnExpressionPanel.tsx
|
|
755
|
+
import { Dropdown as Dropdown2 } from "@vuu-ui/vuu-ui-controls";
|
|
756
|
+
import {
|
|
757
|
+
getCalculatedColumnExpression,
|
|
758
|
+
getCalculatedColumnName,
|
|
759
|
+
getCalculatedColumnType
|
|
760
|
+
} from "@vuu-ui/vuu-utils";
|
|
761
|
+
import { Button, FormField as FormField3, FormFieldLabel as FormFieldLabel3, Input as Input2 } from "@salt-ds/core";
|
|
762
|
+
import { useCallback as useCallback7, useRef as useRef7 } from "react";
|
|
763
|
+
|
|
233
764
|
// src/column-expression-input/useColumnExpressionEditor.ts
|
|
234
765
|
import {
|
|
235
766
|
autocompletion,
|
|
@@ -242,7 +773,7 @@ import {
|
|
|
242
773
|
startCompletion
|
|
243
774
|
} from "@vuu-ui/vuu-codemirror";
|
|
244
775
|
import { createEl } from "@vuu-ui/vuu-utils";
|
|
245
|
-
import { useEffect as
|
|
776
|
+
import { useEffect as useEffect3, useMemo as useMemo3, useRef as useRef4 } from "react";
|
|
246
777
|
|
|
247
778
|
// src/column-expression-input/column-language-parser/ColumnExpressionLanguage.ts
|
|
248
779
|
import {
|
|
@@ -690,8 +1221,8 @@ var walkTree = (tree, source) => {
|
|
|
690
1221
|
const columnExpression = new ColumnExpression();
|
|
691
1222
|
const cursor = tree.cursor();
|
|
692
1223
|
do {
|
|
693
|
-
const { name, from, to } = cursor;
|
|
694
|
-
switch (
|
|
1224
|
+
const { name: name2, from, to } = cursor;
|
|
1225
|
+
switch (name2) {
|
|
695
1226
|
case "AndCondition":
|
|
696
1227
|
columnExpression.setCondition("and");
|
|
697
1228
|
break;
|
|
@@ -876,7 +1407,7 @@ import {
|
|
|
876
1407
|
getValue,
|
|
877
1408
|
syntaxTree
|
|
878
1409
|
} from "@vuu-ui/vuu-codemirror";
|
|
879
|
-
import { useCallback as
|
|
1410
|
+
import { useCallback as useCallback4 } from "react";
|
|
880
1411
|
var applyPrefix = (completions, prefix) => prefix ? completions.map((completion) => {
|
|
881
1412
|
var _a;
|
|
882
1413
|
return {
|
|
@@ -885,6 +1416,13 @@ var applyPrefix = (completions, prefix) => prefix ? completions.map((completion)
|
|
|
885
1416
|
};
|
|
886
1417
|
}) : completions;
|
|
887
1418
|
var isOperator = (node) => node === void 0 ? false : ["Times", "Divide", "Plus", "Minus"].includes(node.name);
|
|
1419
|
+
var completionDone = (onSubmit) => ({
|
|
1420
|
+
apply: () => {
|
|
1421
|
+
onSubmit == null ? void 0 : onSubmit();
|
|
1422
|
+
},
|
|
1423
|
+
label: "Done",
|
|
1424
|
+
boost: 10
|
|
1425
|
+
});
|
|
888
1426
|
var getLastChild = (node, context) => {
|
|
889
1427
|
var _a;
|
|
890
1428
|
let { lastChild: childNode } = node;
|
|
@@ -970,33 +1508,17 @@ var handleConditionalExpression = (node, context, suggestionProvider, maybeCompl
|
|
|
970
1508
|
});
|
|
971
1509
|
case "CloseBrace":
|
|
972
1510
|
if (maybeComplete) {
|
|
973
|
-
const options = [
|
|
974
|
-
{
|
|
975
|
-
apply: () => {
|
|
976
|
-
onSubmit == null ? void 0 : onSubmit();
|
|
977
|
-
},
|
|
978
|
-
label: "Save Expression",
|
|
979
|
-
boost: 10
|
|
980
|
-
}
|
|
981
|
-
];
|
|
1511
|
+
const options = [completionDone(onSubmit)];
|
|
982
1512
|
return { from: context.pos, options };
|
|
983
1513
|
}
|
|
984
1514
|
}
|
|
985
1515
|
};
|
|
986
1516
|
var promptToSave = (context, onSubmit) => {
|
|
987
|
-
const options = [
|
|
988
|
-
{
|
|
989
|
-
apply: () => {
|
|
990
|
-
onSubmit == null ? void 0 : onSubmit();
|
|
991
|
-
},
|
|
992
|
-
label: "Save Expression",
|
|
993
|
-
boost: 10
|
|
994
|
-
}
|
|
995
|
-
];
|
|
1517
|
+
const options = [completionDone(onSubmit)];
|
|
996
1518
|
return { from: context.pos, options };
|
|
997
1519
|
};
|
|
998
1520
|
var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
999
|
-
const makeSuggestions2 =
|
|
1521
|
+
const makeSuggestions2 = useCallback4(
|
|
1000
1522
|
async (context, suggestionType, optionalArgs = {}) => {
|
|
1001
1523
|
const options = await suggestionProvider.getSuggestions(
|
|
1002
1524
|
suggestionType,
|
|
@@ -1007,7 +1529,7 @@ var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
|
1007
1529
|
},
|
|
1008
1530
|
[suggestionProvider]
|
|
1009
1531
|
);
|
|
1010
|
-
return
|
|
1532
|
+
return useCallback4(
|
|
1011
1533
|
async (context) => {
|
|
1012
1534
|
var _a, _b;
|
|
1013
1535
|
const { state, pos } = context;
|
|
@@ -1020,7 +1542,6 @@ var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
|
1020
1542
|
const nodeBefore = tree.resolveInner(pos, -1);
|
|
1021
1543
|
const text = state.doc.toString();
|
|
1022
1544
|
const maybeComplete = isCompleteExpression(text);
|
|
1023
|
-
console.log({ nodeBeforeName: nodeBefore.name });
|
|
1024
1545
|
switch (nodeBefore.name) {
|
|
1025
1546
|
case "If": {
|
|
1026
1547
|
console.log(`conditional expression If`);
|
|
@@ -1036,9 +1557,6 @@ var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
|
1036
1557
|
columnName: getValue(lastChild, state)
|
|
1037
1558
|
});
|
|
1038
1559
|
}
|
|
1039
|
-
console.log(
|
|
1040
|
-
`Condition last child Column, prev child ${prevChild == null ? void 0 : prevChild.name}`
|
|
1041
|
-
);
|
|
1042
1560
|
} else if ((lastChild == null ? void 0 : lastChild.name) === "RelationalOperator") {
|
|
1043
1561
|
return makeSuggestions2(context, "expression");
|
|
1044
1562
|
}
|
|
@@ -1101,9 +1619,6 @@ var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
|
1101
1619
|
prefix: ", "
|
|
1102
1620
|
});
|
|
1103
1621
|
}
|
|
1104
|
-
console.log(
|
|
1105
|
-
`we have a string, column is ${columnName} ${from} ${to}`
|
|
1106
|
-
);
|
|
1107
1622
|
}
|
|
1108
1623
|
break;
|
|
1109
1624
|
case "ArithmeticExpression":
|
|
@@ -1156,13 +1671,7 @@ var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
|
1156
1671
|
if ((lastChild == null ? void 0 : lastChild.name) === "Column") {
|
|
1157
1672
|
if (maybeComplete) {
|
|
1158
1673
|
const options = [
|
|
1159
|
-
|
|
1160
|
-
apply: () => {
|
|
1161
|
-
onSubmit.current();
|
|
1162
|
-
},
|
|
1163
|
-
label: "Save Expression",
|
|
1164
|
-
boost: 10
|
|
1165
|
-
}
|
|
1674
|
+
completionDone(onSubmit.current)
|
|
1166
1675
|
];
|
|
1167
1676
|
const columnName = getValue(lastChild, state);
|
|
1168
1677
|
const columnOptions = await suggestionProvider.getSuggestions("operator", {
|
|
@@ -1175,31 +1684,14 @@ var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
|
1175
1684
|
}
|
|
1176
1685
|
} else if ((lastChild == null ? void 0 : lastChild.name) === "CallExpression") {
|
|
1177
1686
|
if (maybeComplete) {
|
|
1178
|
-
const options = [
|
|
1179
|
-
{
|
|
1180
|
-
apply: () => {
|
|
1181
|
-
onSubmit.current();
|
|
1182
|
-
},
|
|
1183
|
-
label: "Save Expression",
|
|
1184
|
-
boost: 10
|
|
1185
|
-
}
|
|
1186
|
-
];
|
|
1187
1687
|
return {
|
|
1188
1688
|
from: context.pos,
|
|
1189
|
-
options
|
|
1689
|
+
options: [completionDone(onSubmit.current)]
|
|
1190
1690
|
};
|
|
1191
1691
|
}
|
|
1192
1692
|
} else if ((lastChild == null ? void 0 : lastChild.name) === "ArithmeticExpression") {
|
|
1193
1693
|
if (maybeComplete) {
|
|
1194
|
-
let options = [
|
|
1195
|
-
{
|
|
1196
|
-
apply: () => {
|
|
1197
|
-
onSubmit.current();
|
|
1198
|
-
},
|
|
1199
|
-
label: "Save Expression",
|
|
1200
|
-
boost: 10
|
|
1201
|
-
}
|
|
1202
|
-
];
|
|
1694
|
+
let options = [completionDone(onSubmit.current)];
|
|
1203
1695
|
const lastExpressionChild = getLastChild(lastChild, context);
|
|
1204
1696
|
if ((lastExpressionChild == null ? void 0 : lastExpressionChild.name) === "Column") {
|
|
1205
1697
|
const columnName = getValue(lastExpressionChild, state);
|
|
@@ -1263,9 +1755,6 @@ var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
|
1263
1755
|
return promptToSave(context, onSubmit.current);
|
|
1264
1756
|
}
|
|
1265
1757
|
}
|
|
1266
|
-
console.log(
|
|
1267
|
-
`does closebrace denote an ARgList or a parenthetised expression ? ${parentNode}`
|
|
1268
|
-
);
|
|
1269
1758
|
}
|
|
1270
1759
|
break;
|
|
1271
1760
|
default: {
|
|
@@ -1304,20 +1793,21 @@ var injectOptionContent = (completion) => {
|
|
|
1304
1793
|
var useColumnExpressionEditor = ({
|
|
1305
1794
|
onChange,
|
|
1306
1795
|
onSubmitExpression,
|
|
1796
|
+
source,
|
|
1307
1797
|
suggestionProvider
|
|
1308
1798
|
}) => {
|
|
1309
|
-
const editorRef =
|
|
1310
|
-
const
|
|
1311
|
-
const viewRef =
|
|
1312
|
-
const completionFn = useColumnAutoComplete(suggestionProvider,
|
|
1313
|
-
const [createState, clearInput] =
|
|
1799
|
+
const editorRef = useRef4(null);
|
|
1800
|
+
const onSubmitRef = useRef4(noop);
|
|
1801
|
+
const viewRef = useRef4();
|
|
1802
|
+
const completionFn = useColumnAutoComplete(suggestionProvider, onSubmitRef);
|
|
1803
|
+
const [createState, clearInput] = useMemo3(() => {
|
|
1314
1804
|
const parseExpression = () => {
|
|
1315
1805
|
const view = getView(viewRef);
|
|
1316
|
-
const
|
|
1806
|
+
const source2 = view.state.doc.toString();
|
|
1317
1807
|
const tree = ensureSyntaxTree(view.state, view.state.doc.length, 5e3);
|
|
1318
1808
|
if (tree) {
|
|
1319
|
-
const expression = walkTree(tree,
|
|
1320
|
-
return [
|
|
1809
|
+
const expression = walkTree(tree, source2);
|
|
1810
|
+
return [source2, expression];
|
|
1321
1811
|
} else {
|
|
1322
1812
|
return ["", void 0];
|
|
1323
1813
|
}
|
|
@@ -1325,21 +1815,9 @@ var useColumnExpressionEditor = ({
|
|
|
1325
1815
|
const clearInput2 = () => {
|
|
1326
1816
|
getView(viewRef).setState(createState2());
|
|
1327
1817
|
};
|
|
1328
|
-
const
|
|
1329
|
-
const [
|
|
1330
|
-
onSubmitExpression == null ? void 0 : onSubmitExpression(
|
|
1331
|
-
clearInput2();
|
|
1332
|
-
};
|
|
1333
|
-
const submitFilter = (key) => {
|
|
1334
|
-
return keymap.of([
|
|
1335
|
-
{
|
|
1336
|
-
key,
|
|
1337
|
-
run() {
|
|
1338
|
-
submitExpressionAndClearInput();
|
|
1339
|
-
return true;
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
]);
|
|
1818
|
+
const submitExpression = () => {
|
|
1819
|
+
const [source2, expression] = parseExpression();
|
|
1820
|
+
onSubmitExpression == null ? void 0 : onSubmitExpression(source2, expression);
|
|
1343
1821
|
};
|
|
1344
1822
|
const showSuggestions = (key) => {
|
|
1345
1823
|
return keymap.of([
|
|
@@ -1353,7 +1831,7 @@ var useColumnExpressionEditor = ({
|
|
|
1353
1831
|
]);
|
|
1354
1832
|
};
|
|
1355
1833
|
const createState2 = () => EditorState2.create({
|
|
1356
|
-
doc:
|
|
1834
|
+
doc: source,
|
|
1357
1835
|
extensions: [
|
|
1358
1836
|
minimalSetup,
|
|
1359
1837
|
autocompletion({
|
|
@@ -1368,14 +1846,13 @@ var useColumnExpressionEditor = ({
|
|
|
1368
1846
|
}),
|
|
1369
1847
|
columnExpressionLanguageSupport(),
|
|
1370
1848
|
keymap.of(defaultKeymap),
|
|
1371
|
-
submitFilter("Ctrl-Enter"),
|
|
1372
1849
|
showSuggestions("ArrowDown"),
|
|
1373
1850
|
EditorView2.updateListener.of((v) => {
|
|
1374
1851
|
const view = getView(viewRef);
|
|
1375
1852
|
if (v.docChanged) {
|
|
1376
1853
|
startCompletion(view);
|
|
1377
|
-
const
|
|
1378
|
-
onChange == null ? void 0 : onChange(
|
|
1854
|
+
const source2 = view.state.doc.toString();
|
|
1855
|
+
onChange == null ? void 0 : onChange(source2);
|
|
1379
1856
|
}
|
|
1380
1857
|
}),
|
|
1381
1858
|
// Enforces single line view
|
|
@@ -1386,15 +1863,12 @@ var useColumnExpressionEditor = ({
|
|
|
1386
1863
|
vuuHighlighting
|
|
1387
1864
|
]
|
|
1388
1865
|
});
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
setTimeout(() => {
|
|
1392
|
-
getView(viewRef).focus();
|
|
1393
|
-
}, 100);
|
|
1866
|
+
onSubmitRef.current = () => {
|
|
1867
|
+
submitExpression();
|
|
1394
1868
|
};
|
|
1395
1869
|
return [createState2, clearInput2];
|
|
1396
|
-
}, [completionFn, onChange, onSubmitExpression]);
|
|
1397
|
-
|
|
1870
|
+
}, [completionFn, onChange, onSubmitExpression, source]);
|
|
1871
|
+
useEffect3(() => {
|
|
1398
1872
|
if (!editorRef.current) {
|
|
1399
1873
|
throw Error("editor not in dom");
|
|
1400
1874
|
}
|
|
@@ -1411,19 +1885,21 @@ var useColumnExpressionEditor = ({
|
|
|
1411
1885
|
};
|
|
1412
1886
|
|
|
1413
1887
|
// src/column-expression-input/ColumnExpressionInput.tsx
|
|
1414
|
-
import { jsx as
|
|
1415
|
-
var
|
|
1888
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1889
|
+
var classBase7 = "vuuColumnExpressionInput";
|
|
1416
1890
|
var ColumnExpressionInput = ({
|
|
1417
1891
|
onChange,
|
|
1418
1892
|
onSubmitExpression,
|
|
1893
|
+
source = "",
|
|
1419
1894
|
suggestionProvider
|
|
1420
1895
|
}) => {
|
|
1421
1896
|
const { editorRef } = useColumnExpressionEditor({
|
|
1422
1897
|
onChange,
|
|
1423
1898
|
onSubmitExpression,
|
|
1899
|
+
source,
|
|
1424
1900
|
suggestionProvider
|
|
1425
1901
|
});
|
|
1426
|
-
return /* @__PURE__ */
|
|
1902
|
+
return /* @__PURE__ */ jsx7("div", { className: `${classBase7}`, ref: editorRef });
|
|
1427
1903
|
};
|
|
1428
1904
|
|
|
1429
1905
|
// src/column-expression-input/useColumnExpressionSuggestionProvider.ts
|
|
@@ -1439,7 +1915,7 @@ import {
|
|
|
1439
1915
|
useTypeaheadSuggestions
|
|
1440
1916
|
} from "@vuu-ui/vuu-data-react";
|
|
1441
1917
|
import { isNumericColumn, isTextColumn } from "@vuu-ui/vuu-utils";
|
|
1442
|
-
import { useCallback as
|
|
1918
|
+
import { useCallback as useCallback5, useRef as useRef5 } from "react";
|
|
1443
1919
|
|
|
1444
1920
|
// src/column-expression-input/column-function-descriptors.ts
|
|
1445
1921
|
var columnFunctionDescriptors = [
|
|
@@ -1716,7 +2192,7 @@ var columnFunctionDescriptors = [
|
|
|
1716
2192
|
// src/column-expression-input/functionDocInfo.ts
|
|
1717
2193
|
import { createEl as createEl2 } from "@vuu-ui/vuu-utils";
|
|
1718
2194
|
var functionDocInfo = ({
|
|
1719
|
-
name,
|
|
2195
|
+
name: name2,
|
|
1720
2196
|
description,
|
|
1721
2197
|
example,
|
|
1722
2198
|
params,
|
|
@@ -1724,7 +2200,7 @@ var functionDocInfo = ({
|
|
|
1724
2200
|
}) => {
|
|
1725
2201
|
const rootElement = createEl2("div", "vuuFunctionDoc");
|
|
1726
2202
|
const headingElement = createEl2("div", "function-heading");
|
|
1727
|
-
const nameElement = createEl2("span", "function-name",
|
|
2203
|
+
const nameElement = createEl2("span", "function-name", name2);
|
|
1728
2204
|
const paramElement = createEl2("span", "param-list", params.description);
|
|
1729
2205
|
const typeElement = createEl2("span", "function-type", type);
|
|
1730
2206
|
headingElement.appendChild(nameElement);
|
|
@@ -1860,13 +2336,13 @@ var useColumnExpressionSuggestionProvider = ({
|
|
|
1860
2336
|
columns,
|
|
1861
2337
|
table
|
|
1862
2338
|
}) => {
|
|
1863
|
-
const
|
|
1864
|
-
(
|
|
2339
|
+
const findColumn2 = useCallback5(
|
|
2340
|
+
(name2) => name2 ? columns.find((col) => col.name === name2) : void 0,
|
|
1865
2341
|
[columns]
|
|
1866
2342
|
);
|
|
1867
|
-
const latestSuggestionsRef =
|
|
2343
|
+
const latestSuggestionsRef = useRef5();
|
|
1868
2344
|
const getTypeaheadSuggestions = useTypeaheadSuggestions();
|
|
1869
|
-
const getSuggestions =
|
|
2345
|
+
const getSuggestions = useCallback5(
|
|
1870
2346
|
async (suggestionType, options = NONE) => {
|
|
1871
2347
|
const { columnName, functionName, operator, prefix } = options;
|
|
1872
2348
|
switch (suggestionType) {
|
|
@@ -1881,18 +2357,18 @@ var useColumnExpressionSuggestionProvider = ({
|
|
|
1881
2357
|
return latestSuggestionsRef.current = withApplySpace(suggestions);
|
|
1882
2358
|
}
|
|
1883
2359
|
case "operator": {
|
|
1884
|
-
const suggestions = await getOperators(
|
|
2360
|
+
const suggestions = await getOperators(findColumn2(columnName));
|
|
1885
2361
|
return latestSuggestionsRef.current = withApplySpace(suggestions);
|
|
1886
2362
|
}
|
|
1887
2363
|
case "relational-operator": {
|
|
1888
2364
|
const suggestions = await getRelationalOperators(
|
|
1889
|
-
|
|
2365
|
+
findColumn2(columnName)
|
|
1890
2366
|
);
|
|
1891
2367
|
return latestSuggestionsRef.current = withApplySpace(suggestions);
|
|
1892
2368
|
}
|
|
1893
2369
|
case "condition-operator":
|
|
1894
2370
|
{
|
|
1895
|
-
const column =
|
|
2371
|
+
const column = findColumn2(columnName);
|
|
1896
2372
|
if (column) {
|
|
1897
2373
|
const suggestions = await getConditionOperators(column);
|
|
1898
2374
|
if (suggestions) {
|
|
@@ -1929,9 +2405,9 @@ var useColumnExpressionSuggestionProvider = ({
|
|
|
1929
2405
|
}
|
|
1930
2406
|
return [];
|
|
1931
2407
|
},
|
|
1932
|
-
[columns,
|
|
2408
|
+
[columns, findColumn2, getTypeaheadSuggestions, table]
|
|
1933
2409
|
);
|
|
1934
|
-
const isPartialMatch =
|
|
2410
|
+
const isPartialMatch = useCallback5(
|
|
1935
2411
|
async (valueType, columnName, pattern) => {
|
|
1936
2412
|
const { current: latestSuggestions } = latestSuggestionsRef;
|
|
1937
2413
|
let maybe = false;
|
|
@@ -1955,781 +2431,330 @@ var useColumnExpressionSuggestionProvider = ({
|
|
|
1955
2431
|
};
|
|
1956
2432
|
};
|
|
1957
2433
|
|
|
1958
|
-
// src/
|
|
1959
|
-
import { Button as Button2, Panel as Panel5 } from "@salt-ds/core";
|
|
1960
|
-
import cx6 from "classnames";
|
|
1961
|
-
import {
|
|
1962
|
-
useCallback as useCallback8,
|
|
1963
|
-
useState as useState3
|
|
1964
|
-
} from "react";
|
|
1965
|
-
|
|
1966
|
-
// src/datagrid-configuration-ui/column-settings-panel/ColumnSettingsPanel.tsx
|
|
1967
|
-
import { Stack } from "@vuu-ui/vuu-layout";
|
|
1968
|
-
import { StepperInput as StepperInput2 } from "@salt-ds/lab";
|
|
2434
|
+
// src/column-expression-panel/useColumnExpression.ts
|
|
1969
2435
|
import {
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
}
|
|
1984
|
-
|
|
1985
|
-
// src/datagrid-configuration-ui/column-type-panel/ColumnTypePanel.tsx
|
|
1986
|
-
import { getRegisteredCellRenderers } from "@vuu-ui/vuu-utils";
|
|
1987
|
-
import { Dropdown } from "@salt-ds/lab";
|
|
1988
|
-
import { Panel } from "@salt-ds/core";
|
|
1989
|
-
import cx4 from "classnames";
|
|
1990
|
-
import { useMemo as useMemo2 } from "react";
|
|
1991
|
-
|
|
1992
|
-
// src/datagrid-configuration-ui/column-type-panel/NumericColumnPanel.tsx
|
|
1993
|
-
import { StepperInput, Switch as Switch2 } from "@salt-ds/lab";
|
|
1994
|
-
import { FormField, FormFieldLabel, Text } from "@salt-ds/core";
|
|
1995
|
-
import { useCallback as useCallback4 } from "react";
|
|
1996
|
-
import { Fragment, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1997
|
-
var defaultValues = {
|
|
1998
|
-
alignOnDecimals: false,
|
|
1999
|
-
decimals: 4,
|
|
2000
|
-
zeroPad: false
|
|
2001
|
-
};
|
|
2002
|
-
var getColumnValues = (columnType, gridDefaultValues) => {
|
|
2003
|
-
const columnValue = typeof columnType === "object" && columnType.formatting ? columnType.formatting : {};
|
|
2004
|
-
const properties = ["alignOnDecimals", "decimals", "zeroPad"];
|
|
2005
|
-
return properties.reduce((configValues, property) => {
|
|
2006
|
-
if (columnValue[property] !== void 0) {
|
|
2007
|
-
return {
|
|
2008
|
-
...configValues,
|
|
2009
|
-
[property]: columnValue[property]
|
|
2010
|
-
};
|
|
2011
|
-
} else if ((gridDefaultValues == null ? void 0 : gridDefaultValues[property]) !== void 0) {
|
|
2012
|
-
return {
|
|
2013
|
-
...configValues,
|
|
2014
|
-
[property]: gridDefaultValues[property]
|
|
2015
|
-
};
|
|
2016
|
-
}
|
|
2017
|
-
return configValues;
|
|
2018
|
-
}, defaultValues);
|
|
2019
|
-
};
|
|
2020
|
-
var NumericColumnPanel = ({
|
|
2021
|
-
column,
|
|
2022
|
-
dispatchColumnAction
|
|
2023
|
-
}) => {
|
|
2024
|
-
const { decimals, alignOnDecimals, zeroPad } = getColumnValues(column == null ? void 0 : column.type);
|
|
2025
|
-
const dispatchUpdate = useCallback4(
|
|
2026
|
-
(values) => dispatchColumnAction({
|
|
2027
|
-
type: "updateColumnTypeFormatting",
|
|
2028
|
-
column,
|
|
2029
|
-
...values
|
|
2030
|
-
}),
|
|
2031
|
-
[column, dispatchColumnAction]
|
|
2032
|
-
);
|
|
2033
|
-
const handleChangeDecimals = useCallback4(
|
|
2034
|
-
(value) => dispatchUpdate({ decimals: parseInt(value.toString(), 10) }),
|
|
2035
|
-
[dispatchUpdate]
|
|
2036
|
-
);
|
|
2037
|
-
const handleChangeAlignOnDecimals = useCallback4(
|
|
2038
|
-
(evt) => dispatchUpdate({ alignOnDecimals: Boolean(evt.target.value) }),
|
|
2039
|
-
[dispatchUpdate]
|
|
2040
|
-
);
|
|
2041
|
-
const handleChangeZeroPad = useCallback4(
|
|
2042
|
-
(evt) => dispatchUpdate({ zeroPad: Boolean(evt.target.value) }),
|
|
2043
|
-
[dispatchUpdate]
|
|
2044
|
-
);
|
|
2045
|
-
switch (column.serverDataType) {
|
|
2046
|
-
case "double":
|
|
2047
|
-
return /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
2048
|
-
/* @__PURE__ */ jsxs4(FormField, { labelPlacement: "top", children: [
|
|
2049
|
-
/* @__PURE__ */ jsx5(FormFieldLabel, { children: "No of Decimals" }),
|
|
2050
|
-
/* @__PURE__ */ jsx5(StepperInput, { value: decimals, onChange: handleChangeDecimals })
|
|
2051
|
-
] }),
|
|
2052
|
-
/* @__PURE__ */ jsx5(
|
|
2053
|
-
Switch2,
|
|
2054
|
-
{
|
|
2055
|
-
checked: alignOnDecimals,
|
|
2056
|
-
label: "Align on decimals",
|
|
2057
|
-
onChange: handleChangeAlignOnDecimals
|
|
2058
|
-
}
|
|
2059
|
-
),
|
|
2060
|
-
/* @__PURE__ */ jsx5(
|
|
2061
|
-
Switch2,
|
|
2062
|
-
{
|
|
2063
|
-
checked: zeroPad,
|
|
2064
|
-
label: "Zero pad",
|
|
2065
|
-
onChange: handleChangeZeroPad
|
|
2066
|
-
}
|
|
2067
|
-
)
|
|
2068
|
-
] });
|
|
2069
|
-
case "long":
|
|
2070
|
-
case "int":
|
|
2071
|
-
return /* @__PURE__ */ jsx5(Fragment, { children: /* @__PURE__ */ jsx5(Text, { children: "Work in progress" }) });
|
|
2072
|
-
default:
|
|
2073
|
-
return null;
|
|
2436
|
+
getCalculatedColumnDetails,
|
|
2437
|
+
setCalculatedColumnExpression,
|
|
2438
|
+
setCalculatedColumnName as setCalculatedColumnName2,
|
|
2439
|
+
setCalculatedColumnType
|
|
2440
|
+
} from "@vuu-ui/vuu-utils";
|
|
2441
|
+
import { useCallback as useCallback6, useRef as useRef6, useState as useState3 } from "react";
|
|
2442
|
+
var applyDefaults = (column) => {
|
|
2443
|
+
const [name2, expression, type] = getCalculatedColumnDetails(column);
|
|
2444
|
+
if (type === "") {
|
|
2445
|
+
return {
|
|
2446
|
+
...column,
|
|
2447
|
+
name: `${name2}:${expression}:string`
|
|
2448
|
+
};
|
|
2449
|
+
} else {
|
|
2450
|
+
return column;
|
|
2074
2451
|
}
|
|
2075
2452
|
};
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
var StringColumnPanel = ({
|
|
2080
|
-
column,
|
|
2081
|
-
dispatchColumnAction
|
|
2453
|
+
var useColumnExpression = ({
|
|
2454
|
+
column: columnProp,
|
|
2455
|
+
onSave: onSaveProp
|
|
2082
2456
|
}) => {
|
|
2083
|
-
|
|
2084
|
-
|
|
2457
|
+
const [column, setColumn] = useState3(
|
|
2458
|
+
applyDefaults(columnProp)
|
|
2459
|
+
);
|
|
2460
|
+
const expressionRef = useRef6(getCalculatedColumnDetails(column)[1]);
|
|
2461
|
+
const onChangeName = useCallback6((evt) => {
|
|
2462
|
+
const { value } = evt.target;
|
|
2463
|
+
setColumn((state) => setCalculatedColumnName2(state, value));
|
|
2464
|
+
}, []);
|
|
2465
|
+
const onChangeExpression = useCallback6((value) => {
|
|
2466
|
+
expressionRef.current = value.trim();
|
|
2467
|
+
}, []);
|
|
2468
|
+
const onChangeType = useCallback6((evt, value) => {
|
|
2469
|
+
if (typeof value === "string") {
|
|
2470
|
+
setColumn((state) => setCalculatedColumnType(state, value));
|
|
2471
|
+
}
|
|
2472
|
+
}, []);
|
|
2473
|
+
const onSave = useCallback6(() => {
|
|
2474
|
+
const newColumn = setCalculatedColumnExpression(
|
|
2475
|
+
column,
|
|
2476
|
+
expressionRef.current
|
|
2477
|
+
);
|
|
2478
|
+
setColumn(newColumn);
|
|
2479
|
+
onSaveProp(newColumn);
|
|
2480
|
+
}, [column, onSaveProp]);
|
|
2481
|
+
return {
|
|
2482
|
+
column,
|
|
2483
|
+
onChangeExpression,
|
|
2484
|
+
onChangeName,
|
|
2485
|
+
onChangeType,
|
|
2486
|
+
onSave
|
|
2487
|
+
};
|
|
2085
2488
|
};
|
|
2086
2489
|
|
|
2087
|
-
// src/
|
|
2088
|
-
import {
|
|
2089
|
-
var
|
|
2090
|
-
var
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
const customRendererNames = customCellRenderers.map((r) => r.name);
|
|
2096
|
-
console.log({ customRendererNames });
|
|
2097
|
-
switch (column.serverDataType) {
|
|
2098
|
-
case "char":
|
|
2099
|
-
case "string":
|
|
2100
|
-
return stringCellRenderers;
|
|
2101
|
-
case "int":
|
|
2102
|
-
case "long":
|
|
2103
|
-
return integerCellRenderers;
|
|
2104
|
-
case "double":
|
|
2105
|
-
return doubleCellRenderers.concat(customRendererNames);
|
|
2106
|
-
default:
|
|
2107
|
-
return stringCellRenderers;
|
|
2108
|
-
}
|
|
2109
|
-
};
|
|
2110
|
-
var ColumnTypePanel = ({
|
|
2111
|
-
className,
|
|
2112
|
-
column,
|
|
2113
|
-
dispatchColumnAction,
|
|
2114
|
-
...props
|
|
2490
|
+
// src/column-expression-panel/ColumnExpressionPanel.tsx
|
|
2491
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2492
|
+
var classBase8 = "vuuColumnExpressionPanel";
|
|
2493
|
+
var ColumnExpressionPanel = ({
|
|
2494
|
+
column: columnProp,
|
|
2495
|
+
onSave: onSaveProp,
|
|
2496
|
+
tableConfig,
|
|
2497
|
+
vuuTable
|
|
2115
2498
|
}) => {
|
|
2116
|
-
const
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
/* @__PURE__ */
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2499
|
+
const typeRef = useRef7(null);
|
|
2500
|
+
const { column, onChangeExpression, onChangeName, onChangeType, onSave } = useColumnExpression({ column: columnProp, onSave: onSaveProp });
|
|
2501
|
+
const suggestionProvider = useColumnExpressionSuggestionProvider({
|
|
2502
|
+
columns: tableConfig.columns,
|
|
2503
|
+
table: vuuTable
|
|
2504
|
+
});
|
|
2505
|
+
const handleSubmitExpression = useCallback7(() => {
|
|
2506
|
+
requestAnimationFrame(() => {
|
|
2507
|
+
var _a, _b;
|
|
2508
|
+
(_b = (_a = typeRef.current) == null ? void 0 : _a.querySelector("button")) == null ? void 0 : _b.focus();
|
|
2509
|
+
});
|
|
2510
|
+
}, []);
|
|
2511
|
+
return /* @__PURE__ */ jsxs7("div", { className: classBase8, children: [
|
|
2512
|
+
/* @__PURE__ */ jsx8("div", { className: "vuuColumnSettingsPanel-header", children: /* @__PURE__ */ jsx8("span", { children: "Calculation" }) }),
|
|
2513
|
+
/* @__PURE__ */ jsxs7(FormField3, { "data-field": "column-name", children: [
|
|
2514
|
+
/* @__PURE__ */ jsx8(FormFieldLabel3, { children: "Column Name" }),
|
|
2515
|
+
/* @__PURE__ */ jsx8(
|
|
2516
|
+
Input2,
|
|
2517
|
+
{
|
|
2518
|
+
className: "vuuInput",
|
|
2519
|
+
onChange: onChangeName,
|
|
2520
|
+
value: getCalculatedColumnName(column)
|
|
2521
|
+
}
|
|
2522
|
+
)
|
|
2523
|
+
] }),
|
|
2524
|
+
/* @__PURE__ */ jsxs7(FormField3, { "data-field": "column-expression", children: [
|
|
2525
|
+
/* @__PURE__ */ jsx8(FormFieldLabel3, { children: "Expression" }),
|
|
2526
|
+
/* @__PURE__ */ jsx8(
|
|
2527
|
+
ColumnExpressionInput,
|
|
2528
|
+
{
|
|
2529
|
+
onChange: onChangeExpression,
|
|
2530
|
+
onSubmitExpression: handleSubmitExpression,
|
|
2531
|
+
source: getCalculatedColumnExpression(column),
|
|
2532
|
+
suggestionProvider
|
|
2533
|
+
}
|
|
2534
|
+
)
|
|
2535
|
+
] }),
|
|
2536
|
+
/* @__PURE__ */ jsxs7(FormField3, { "data-field": "type", children: [
|
|
2537
|
+
/* @__PURE__ */ jsx8(FormFieldLabel3, { children: "Column type" }),
|
|
2538
|
+
/* @__PURE__ */ jsx8(
|
|
2539
|
+
Dropdown2,
|
|
2540
|
+
{
|
|
2541
|
+
className: `${classBase8}-type`,
|
|
2542
|
+
onSelectionChange: onChangeType,
|
|
2543
|
+
ref: typeRef,
|
|
2544
|
+
selected: getCalculatedColumnType(column) || null,
|
|
2545
|
+
source: ["double", "long", "string"],
|
|
2546
|
+
width: "100%"
|
|
2547
|
+
}
|
|
2548
|
+
)
|
|
2549
|
+
] }),
|
|
2550
|
+
/* @__PURE__ */ jsxs7("div", { className: "vuuColumnSettingsPanel-buttonBar", "data-align": "right", children: [
|
|
2551
|
+
/* @__PURE__ */ jsx8(Button, { className: `${classBase8}-buttonCancel`, tabIndex: -1, children: "cancel" }),
|
|
2552
|
+
/* @__PURE__ */ jsx8(Button, { className: `${classBase8}-buttonApply`, tabIndex: -1, children: "apply" }),
|
|
2553
|
+
/* @__PURE__ */ jsx8(
|
|
2554
|
+
Button,
|
|
2555
|
+
{
|
|
2556
|
+
className: `${classBase8}-buttonSave`,
|
|
2557
|
+
onClick: onSave,
|
|
2558
|
+
variant: "cta",
|
|
2559
|
+
children: "save"
|
|
2560
|
+
}
|
|
2561
|
+
)
|
|
2562
|
+
] })
|
|
2158
2563
|
] });
|
|
2159
2564
|
};
|
|
2160
2565
|
|
|
2161
|
-
// src/
|
|
2162
|
-
import {
|
|
2163
|
-
|
|
2164
|
-
var
|
|
2165
|
-
className: "salt-density-high"
|
|
2166
|
-
};
|
|
2566
|
+
// src/column-settings/ColumnSettingsPanel.tsx
|
|
2567
|
+
import { VuuInput } from "@vuu-ui/vuu-ui-controls";
|
|
2568
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2569
|
+
var classBase9 = "vuuColumnSettingsPanel";
|
|
2167
2570
|
var ColumnSettingsPanel = ({
|
|
2168
|
-
column,
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
var _a, _b, _c, _d;
|
|
2174
|
-
const [activeTab, setActiveTab] = useState(0);
|
|
2175
|
-
const dispatchUpdate = useCallback5(
|
|
2176
|
-
(values) => dispatchColumnAction({
|
|
2177
|
-
type: "updateColumnProp",
|
|
2178
|
-
column,
|
|
2179
|
-
...values
|
|
2180
|
-
}),
|
|
2181
|
-
[column, dispatchColumnAction]
|
|
2182
|
-
);
|
|
2183
|
-
const handleChangeAlign = useCallback5(
|
|
2184
|
-
(evt) => dispatchUpdate({ align: evt.target.value }),
|
|
2185
|
-
[dispatchUpdate]
|
|
2186
|
-
);
|
|
2187
|
-
const handleChangePin = useCallback5(
|
|
2188
|
-
(evt) => dispatchUpdate({ pin: evt.target.value }),
|
|
2189
|
-
[dispatchUpdate]
|
|
2190
|
-
);
|
|
2191
|
-
const handleChangeHidden = useCallback5(
|
|
2192
|
-
(evt) => dispatchUpdate({ hidden: evt.target.checked }),
|
|
2193
|
-
[dispatchUpdate]
|
|
2194
|
-
);
|
|
2195
|
-
const handleChangeLabel = useCallback5(
|
|
2196
|
-
(evt) => dispatchUpdate({ label: evt.target.value }),
|
|
2197
|
-
[dispatchUpdate]
|
|
2198
|
-
);
|
|
2199
|
-
const handleChangeWidth = useCallback5(
|
|
2200
|
-
(value) => dispatchUpdate({ width: parseInt(value.toString(), 10) }),
|
|
2201
|
-
[dispatchUpdate]
|
|
2202
|
-
);
|
|
2203
|
-
return /* @__PURE__ */ jsxs6(
|
|
2204
|
-
"div",
|
|
2205
|
-
{
|
|
2206
|
-
className: classBase6,
|
|
2207
|
-
...props,
|
|
2208
|
-
style: {
|
|
2209
|
-
...styleProp
|
|
2210
|
-
},
|
|
2211
|
-
children: [
|
|
2212
|
-
/* @__PURE__ */ jsx8(Text2, { as: "h4", children: "Column Settings" }),
|
|
2213
|
-
/* @__PURE__ */ jsxs6(
|
|
2214
|
-
Stack,
|
|
2215
|
-
{
|
|
2216
|
-
active: activeTab,
|
|
2217
|
-
className: cx5(`${classBase6}-columnTabs`),
|
|
2218
|
-
onTabSelectionChanged: setActiveTab,
|
|
2219
|
-
TabstripProps: tabstripProps,
|
|
2220
|
-
children: [
|
|
2221
|
-
/* @__PURE__ */ jsxs6(Panel2, { title: "Column", children: [
|
|
2222
|
-
/* @__PURE__ */ jsxs6(FormField2, { labelPlacement: "left", children: [
|
|
2223
|
-
/* @__PURE__ */ jsx8(FormFieldLabel2, { children: "Hidden" }),
|
|
2224
|
-
/* @__PURE__ */ jsx8(
|
|
2225
|
-
Checkbox2,
|
|
2226
|
-
{
|
|
2227
|
-
checked: column.hidden === true,
|
|
2228
|
-
onChange: handleChangeHidden
|
|
2229
|
-
}
|
|
2230
|
-
)
|
|
2231
|
-
] }),
|
|
2232
|
-
/* @__PURE__ */ jsxs6(FormField2, { labelPlacement: "left", children: [
|
|
2233
|
-
/* @__PURE__ */ jsx8(FormFieldLabel2, { children: "Label" }),
|
|
2234
|
-
/* @__PURE__ */ jsx8(
|
|
2235
|
-
Input,
|
|
2236
|
-
{
|
|
2237
|
-
value: (_a = column.label) != null ? _a : column.name,
|
|
2238
|
-
onChange: handleChangeLabel
|
|
2239
|
-
}
|
|
2240
|
-
)
|
|
2241
|
-
] }),
|
|
2242
|
-
/* @__PURE__ */ jsxs6(FormField2, { labelPlacement: "left", children: [
|
|
2243
|
-
/* @__PURE__ */ jsx8(FormFieldLabel2, { children: "Width" }),
|
|
2244
|
-
/* @__PURE__ */ jsx8(
|
|
2245
|
-
StepperInput2,
|
|
2246
|
-
{
|
|
2247
|
-
value: (_b = column.width) != null ? _b : 100,
|
|
2248
|
-
onChange: handleChangeWidth
|
|
2249
|
-
}
|
|
2250
|
-
)
|
|
2251
|
-
] }),
|
|
2252
|
-
/* @__PURE__ */ jsxs6(FormField2, { labelPlacement: "left", children: [
|
|
2253
|
-
/* @__PURE__ */ jsx8(FormFieldLabel2, { children: "ALign" }),
|
|
2254
|
-
/* @__PURE__ */ jsxs6(
|
|
2255
|
-
RadioButtonGroup,
|
|
2256
|
-
{
|
|
2257
|
-
"aria-label": "Column Align",
|
|
2258
|
-
value: (_c = column.align) != null ? _c : "left",
|
|
2259
|
-
onChange: handleChangeAlign,
|
|
2260
|
-
children: [
|
|
2261
|
-
/* @__PURE__ */ jsx8(RadioButton, { label: "Left", value: "left" }),
|
|
2262
|
-
/* @__PURE__ */ jsx8(RadioButton, { label: "Right", value: "right" })
|
|
2263
|
-
]
|
|
2264
|
-
}
|
|
2265
|
-
)
|
|
2266
|
-
] }),
|
|
2267
|
-
/* @__PURE__ */ jsxs6(FormField2, { labelPlacement: "left", children: [
|
|
2268
|
-
/* @__PURE__ */ jsx8(FormFieldLabel2, { children: "Pin Column" }),
|
|
2269
|
-
/* @__PURE__ */ jsxs6(
|
|
2270
|
-
RadioButtonGroup,
|
|
2271
|
-
{
|
|
2272
|
-
"aria-label": "Pin Column",
|
|
2273
|
-
value: (_d = column.pin) != null ? _d : "",
|
|
2274
|
-
onChange: handleChangePin,
|
|
2275
|
-
children: [
|
|
2276
|
-
/* @__PURE__ */ jsx8(RadioButton, { label: "Do not pin", value: "" }),
|
|
2277
|
-
/* @__PURE__ */ jsx8(RadioButton, { label: "Left", value: "left" }),
|
|
2278
|
-
/* @__PURE__ */ jsx8(RadioButton, { label: "Right", value: "right" })
|
|
2279
|
-
]
|
|
2280
|
-
}
|
|
2281
|
-
)
|
|
2282
|
-
] })
|
|
2283
|
-
] }),
|
|
2284
|
-
/* @__PURE__ */ jsx8(
|
|
2285
|
-
ColumnTypePanel,
|
|
2286
|
-
{
|
|
2287
|
-
column,
|
|
2288
|
-
dispatchColumnAction,
|
|
2289
|
-
title: "Data Cell"
|
|
2290
|
-
}
|
|
2291
|
-
),
|
|
2292
|
-
/* @__PURE__ */ jsxs6(Panel2, { title: "Vuu", variant: "secondary", children: [
|
|
2293
|
-
/* @__PURE__ */ jsxs6(FormField2, { labelPlacement: "top", readOnly: true, children: [
|
|
2294
|
-
/* @__PURE__ */ jsx8(FormFieldLabel2, { children: "Name" }),
|
|
2295
|
-
/* @__PURE__ */ jsx8(Input, { value: column.name })
|
|
2296
|
-
] }),
|
|
2297
|
-
/* @__PURE__ */ jsxs6(FormField2, { labelPlacement: "top", readOnly: true, children: [
|
|
2298
|
-
/* @__PURE__ */ jsx8(FormFieldLabel2, { children: "Vuu Type" }),
|
|
2299
|
-
/* @__PURE__ */ jsx8(Input, { value: column.serverDataType })
|
|
2300
|
-
] })
|
|
2301
|
-
] })
|
|
2302
|
-
]
|
|
2303
|
-
}
|
|
2304
|
-
)
|
|
2305
|
-
]
|
|
2306
|
-
}
|
|
2307
|
-
);
|
|
2308
|
-
};
|
|
2309
|
-
|
|
2310
|
-
// src/datagrid-configuration-ui/settings-panel/GridSettingsPanel.tsx
|
|
2311
|
-
import {
|
|
2312
|
-
FormField as FormField3,
|
|
2313
|
-
FormFieldLabel as FormFieldLabel3,
|
|
2314
|
-
Panel as Panel3,
|
|
2315
|
-
RadioButton as RadioButton2,
|
|
2316
|
-
RadioButtonGroup as RadioButtonGroup2,
|
|
2317
|
-
Text as Text3
|
|
2318
|
-
} from "@salt-ds/core";
|
|
2319
|
-
import { StepperInput as StepperInput3 } from "@salt-ds/lab";
|
|
2320
|
-
import { useCallback as useCallback6 } from "react";
|
|
2321
|
-
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2322
|
-
var classBase7 = "vuuGridSettingsPanel";
|
|
2323
|
-
var GridSettingsPanel = ({
|
|
2324
|
-
config,
|
|
2325
|
-
dispatchColumnAction,
|
|
2326
|
-
style: styleProp,
|
|
2327
|
-
...props
|
|
2571
|
+
column: columnProp,
|
|
2572
|
+
onConfigChange,
|
|
2573
|
+
onCreateCalculatedColumn,
|
|
2574
|
+
tableConfig,
|
|
2575
|
+
vuuTable
|
|
2328
2576
|
}) => {
|
|
2329
|
-
|
|
2330
|
-
const
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
);
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2577
|
+
const isNewCalculatedColumn = columnProp.name === "::";
|
|
2578
|
+
const {
|
|
2579
|
+
availableRenderers,
|
|
2580
|
+
selectedCellRenderer,
|
|
2581
|
+
column,
|
|
2582
|
+
navigateNextColumn,
|
|
2583
|
+
navigatePrevColumn,
|
|
2584
|
+
onChange,
|
|
2585
|
+
onChangeFormatting,
|
|
2586
|
+
onChangeRenderer,
|
|
2587
|
+
onInputCommit,
|
|
2588
|
+
onSave
|
|
2589
|
+
} = useColumnSettings({
|
|
2590
|
+
column: columnProp,
|
|
2591
|
+
onConfigChange,
|
|
2592
|
+
onCreateCalculatedColumn,
|
|
2593
|
+
tableConfig
|
|
2594
|
+
});
|
|
2595
|
+
const {
|
|
2596
|
+
serverDataType,
|
|
2597
|
+
align = getDefaultAlignment(serverDataType),
|
|
2598
|
+
name: name2,
|
|
2599
|
+
label = name2,
|
|
2600
|
+
pin,
|
|
2601
|
+
width
|
|
2602
|
+
} = column;
|
|
2603
|
+
return /* @__PURE__ */ jsxs8("div", { className: classBase9, children: [
|
|
2604
|
+
/* @__PURE__ */ jsx9("div", { className: `${classBase9}-header`, children: /* @__PURE__ */ jsx9("span", { children: name2 }) }),
|
|
2605
|
+
/* @__PURE__ */ jsxs8(FormField4, { "data-field": "column-label", children: [
|
|
2606
|
+
/* @__PURE__ */ jsx9(FormFieldLabel4, { children: "Column Label" }),
|
|
2607
|
+
/* @__PURE__ */ jsx9(
|
|
2608
|
+
VuuInput,
|
|
2609
|
+
{
|
|
2610
|
+
className: "vuuInput",
|
|
2611
|
+
onChange,
|
|
2612
|
+
onCommit: onInputCommit,
|
|
2613
|
+
value: label
|
|
2614
|
+
}
|
|
2615
|
+
)
|
|
2616
|
+
] }),
|
|
2617
|
+
/* @__PURE__ */ jsxs8(FormField4, { "data-field": "column-width", children: [
|
|
2618
|
+
/* @__PURE__ */ jsx9(FormFieldLabel4, { children: "Column Width" }),
|
|
2619
|
+
/* @__PURE__ */ jsx9(
|
|
2620
|
+
VuuInput,
|
|
2621
|
+
{
|
|
2622
|
+
className: "vuuInput",
|
|
2623
|
+
onChange,
|
|
2624
|
+
value: width,
|
|
2625
|
+
onCommit: onInputCommit
|
|
2626
|
+
}
|
|
2627
|
+
)
|
|
2628
|
+
] }),
|
|
2629
|
+
/* @__PURE__ */ jsxs8(FormField4, { "data-field": "column-alignment", children: [
|
|
2630
|
+
/* @__PURE__ */ jsx9(FormFieldLabel4, { children: "Alignment" }),
|
|
2631
|
+
/* @__PURE__ */ jsxs8(
|
|
2632
|
+
ToggleButtonGroup,
|
|
2633
|
+
{
|
|
2634
|
+
className: "vuuToggleButtonGroup",
|
|
2635
|
+
onChange,
|
|
2636
|
+
value: align,
|
|
2637
|
+
children: [
|
|
2638
|
+
/* @__PURE__ */ jsx9(
|
|
2639
|
+
ToggleButton,
|
|
2362
2640
|
{
|
|
2363
|
-
"
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
children: [
|
|
2367
|
-
/* @__PURE__ */ jsx9(RadioButton2, { label: "No Formatting", value: void 0 }),
|
|
2368
|
-
/* @__PURE__ */ jsx9(RadioButton2, { label: "Capitalize", value: "capitalize" }),
|
|
2369
|
-
/* @__PURE__ */ jsx9(RadioButton2, { label: "Uppercase", value: "uppercase" })
|
|
2370
|
-
]
|
|
2641
|
+
"data-icon": "align-left",
|
|
2642
|
+
className: "vuuIconToggleButton",
|
|
2643
|
+
value: "left"
|
|
2371
2644
|
}
|
|
2372
|
-
)
|
|
2373
|
-
] }),
|
|
2374
|
-
/* @__PURE__ */ jsxs7(FormField3, { labelPlacement: "left", children: [
|
|
2375
|
-
/* @__PURE__ */ jsx9(FormFieldLabel3, { children: "Default Column Width" }),
|
|
2645
|
+
),
|
|
2376
2646
|
/* @__PURE__ */ jsx9(
|
|
2377
|
-
|
|
2647
|
+
ToggleButton,
|
|
2378
2648
|
{
|
|
2379
|
-
|
|
2380
|
-
|
|
2649
|
+
"data-icon": "align-right",
|
|
2650
|
+
className: "vuuIconToggleButton",
|
|
2651
|
+
value: "right"
|
|
2381
2652
|
}
|
|
2382
2653
|
)
|
|
2383
|
-
]
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
}
|
|
2387
|
-
|
|
2388
|
-
}
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
}
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
return { ...state, columns: stateColumns.concat(columns) };
|
|
2432
|
-
} else if (column) {
|
|
2433
|
-
return { ...state, columns: stateColumns.concat(column) };
|
|
2434
|
-
}
|
|
2435
|
-
}
|
|
2436
|
-
return state;
|
|
2437
|
-
}
|
|
2438
|
-
function addCalculatedColumn(state, { columnName, columnType, expression }) {
|
|
2439
|
-
const { columns: stateColumns } = state;
|
|
2440
|
-
const calculatedColumn = {
|
|
2441
|
-
name: columnName,
|
|
2442
|
-
expression,
|
|
2443
|
-
serverDataType: columnType
|
|
2444
|
-
};
|
|
2445
|
-
return { ...state, columns: stateColumns.concat(calculatedColumn) };
|
|
2446
|
-
}
|
|
2447
|
-
function removeColumn(state, { column }) {
|
|
2448
|
-
const { columns: stateColumns } = state;
|
|
2449
|
-
return {
|
|
2450
|
-
...state,
|
|
2451
|
-
columns: stateColumns.filter((col) => col.name !== column.name)
|
|
2452
|
-
};
|
|
2453
|
-
}
|
|
2454
|
-
function moveColumn(state, { column, moveBy, moveFrom, moveTo }) {
|
|
2455
|
-
const { columns: stateColumns } = state;
|
|
2456
|
-
if (column && typeof moveBy === "number") {
|
|
2457
|
-
const idx = stateColumns.indexOf(column);
|
|
2458
|
-
const newColumns = stateColumns.slice();
|
|
2459
|
-
const [movedColumns] = newColumns.splice(idx, 1);
|
|
2460
|
-
newColumns.splice(idx + moveBy, 0, movedColumns);
|
|
2461
|
-
return {
|
|
2462
|
-
...state,
|
|
2463
|
-
columns: newColumns
|
|
2464
|
-
};
|
|
2465
|
-
} else if (typeof moveFrom === "number" && typeof moveTo === "number") {
|
|
2466
|
-
return {
|
|
2467
|
-
...state,
|
|
2468
|
-
columns: moveItem(stateColumns, moveFrom, moveTo)
|
|
2469
|
-
};
|
|
2470
|
-
} else {
|
|
2471
|
-
return state;
|
|
2472
|
-
}
|
|
2473
|
-
}
|
|
2474
|
-
function updateColumnProp(state, { align, column, hidden, label, width }) {
|
|
2475
|
-
let { columns: stateColumns } = state;
|
|
2476
|
-
if (align === "left" || align === "right") {
|
|
2477
|
-
stateColumns = replaceColumn(stateColumns, { ...column, align });
|
|
2478
|
-
}
|
|
2479
|
-
if (typeof hidden === "boolean") {
|
|
2480
|
-
stateColumns = replaceColumn(stateColumns, { ...column, hidden });
|
|
2481
|
-
}
|
|
2482
|
-
if (typeof label === "string") {
|
|
2483
|
-
stateColumns = replaceColumn(stateColumns, { ...column, label });
|
|
2484
|
-
}
|
|
2485
|
-
if (typeof width === "number") {
|
|
2486
|
-
stateColumns = replaceColumn(stateColumns, { ...column, width });
|
|
2487
|
-
}
|
|
2488
|
-
return {
|
|
2489
|
-
...state,
|
|
2490
|
-
columns: stateColumns
|
|
2491
|
-
};
|
|
2492
|
-
}
|
|
2493
|
-
function updateGridSettings(state, { columnFormatHeader }) {
|
|
2494
|
-
return {
|
|
2495
|
-
...state,
|
|
2496
|
-
columnFormatHeader: columnFormatHeader != null ? columnFormatHeader : state.columnFormatHeader
|
|
2497
|
-
};
|
|
2498
|
-
}
|
|
2499
|
-
function updateColumnTypeFormatting(state, {
|
|
2500
|
-
alignOnDecimals,
|
|
2501
|
-
column,
|
|
2502
|
-
decimals,
|
|
2503
|
-
zeroPad
|
|
2504
|
-
}) {
|
|
2505
|
-
const { columns: stateColumns } = state;
|
|
2506
|
-
const targetColumn = stateColumns.find((col) => col.name === column.name);
|
|
2507
|
-
if (targetColumn) {
|
|
2508
|
-
const {
|
|
2509
|
-
serverDataType = "string",
|
|
2510
|
-
type: columnType = fromServerDataType(serverDataType)
|
|
2511
|
-
} = column;
|
|
2512
|
-
const type = typeof columnType === "string" ? {
|
|
2513
|
-
name: columnType
|
|
2514
|
-
} : {
|
|
2515
|
-
...columnType
|
|
2516
|
-
};
|
|
2517
|
-
if (typeof alignOnDecimals === "boolean") {
|
|
2518
|
-
type.formatting = {
|
|
2519
|
-
...type.formatting,
|
|
2520
|
-
alignOnDecimals
|
|
2521
|
-
};
|
|
2522
|
-
}
|
|
2523
|
-
if (typeof decimals === "number") {
|
|
2524
|
-
type.formatting = {
|
|
2525
|
-
...type.formatting,
|
|
2526
|
-
decimals
|
|
2527
|
-
};
|
|
2528
|
-
}
|
|
2529
|
-
if (typeof zeroPad === "boolean") {
|
|
2530
|
-
type.formatting = {
|
|
2531
|
-
...type.formatting,
|
|
2532
|
-
zeroPad
|
|
2533
|
-
};
|
|
2534
|
-
}
|
|
2535
|
-
return {
|
|
2536
|
-
...state,
|
|
2537
|
-
columns: replaceColumn(stateColumns, { ...column, type })
|
|
2538
|
-
};
|
|
2539
|
-
} else {
|
|
2540
|
-
return state;
|
|
2541
|
-
}
|
|
2542
|
-
}
|
|
2543
|
-
function replaceColumn(columns, column) {
|
|
2544
|
-
return columns.map((col) => col.name === column.name ? column : col);
|
|
2545
|
-
}
|
|
2546
|
-
|
|
2547
|
-
// src/datagrid-configuration-ui/settings-panel/DatagridSettingsPanel.tsx
|
|
2548
|
-
import { Stack as Stack2 } from "@vuu-ui/vuu-layout";
|
|
2549
|
-
|
|
2550
|
-
// src/datagrid-configuration-ui/calculated-column-panel/CalculatedColumnPanel.tsx
|
|
2551
|
-
import {
|
|
2552
|
-
Button,
|
|
2553
|
-
FormField as FormField4,
|
|
2554
|
-
FormFieldLabel as FormFieldLabel4,
|
|
2555
|
-
Input as Input2,
|
|
2556
|
-
Panel as Panel4,
|
|
2557
|
-
Text as Text4
|
|
2558
|
-
} from "@salt-ds/core";
|
|
2559
|
-
import {
|
|
2560
|
-
useCallback as useCallback7,
|
|
2561
|
-
useRef as useRef4,
|
|
2562
|
-
useState as useState2
|
|
2563
|
-
} from "react";
|
|
2564
|
-
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2565
|
-
var CalculatedColumnPanel = ({
|
|
2566
|
-
columns,
|
|
2567
|
-
dispatchColumnAction,
|
|
2568
|
-
table
|
|
2569
|
-
}) => {
|
|
2570
|
-
const [columnName, setColumnName] = useState2("");
|
|
2571
|
-
const [, setExpression] = useState2();
|
|
2572
|
-
const sourceRef = useRef4("");
|
|
2573
|
-
const suggestionProvider = useColumnExpressionSuggestionProvider({
|
|
2574
|
-
columns,
|
|
2575
|
-
table
|
|
2576
|
-
});
|
|
2577
|
-
const handleChangeName = useCallback7(
|
|
2578
|
-
(evt) => {
|
|
2579
|
-
const { value } = evt.target;
|
|
2580
|
-
setColumnName(value);
|
|
2581
|
-
},
|
|
2582
|
-
[]
|
|
2583
|
-
);
|
|
2584
|
-
const handleChangeExpression = useCallback7((source) => {
|
|
2585
|
-
sourceRef.current = source;
|
|
2586
|
-
}, []);
|
|
2587
|
-
const handleSubmitExpression = useCallback7(
|
|
2588
|
-
(source, expression) => {
|
|
2589
|
-
console.log({ source });
|
|
2590
|
-
setExpression(expression);
|
|
2591
|
-
},
|
|
2592
|
-
[]
|
|
2593
|
-
);
|
|
2594
|
-
const handleSave = useCallback7(() => {
|
|
2595
|
-
if (sourceRef.current) {
|
|
2596
|
-
console.log(
|
|
2597
|
-
`save expression ${JSON.stringify(sourceRef.current, null, 2)}`
|
|
2598
|
-
);
|
|
2599
|
-
dispatchColumnAction({
|
|
2600
|
-
type: "addCalculatedColumn",
|
|
2601
|
-
columnName,
|
|
2602
|
-
expression: sourceRef.current,
|
|
2603
|
-
columnType: "string"
|
|
2604
|
-
});
|
|
2605
|
-
}
|
|
2606
|
-
}, [columnName, dispatchColumnAction]);
|
|
2607
|
-
return /* @__PURE__ */ jsxs8(Panel4, { className: "vuuCalculatedColumnPanel", title: "Define Computed Column", children: [
|
|
2608
|
-
/* @__PURE__ */ jsx10(Text4, { styleAs: "h4", children: "Define Computed Column" }),
|
|
2609
|
-
/* @__PURE__ */ jsxs8(FormField4, { labelPlacement: "left", children: [
|
|
2610
|
-
/* @__PURE__ */ jsx10(FormFieldLabel4, { children: "Column Name" }),
|
|
2611
|
-
/* @__PURE__ */ jsx10(Input2, { value: columnName, onChange: handleChangeName })
|
|
2654
|
+
]
|
|
2655
|
+
}
|
|
2656
|
+
)
|
|
2657
|
+
] }),
|
|
2658
|
+
/* @__PURE__ */ jsxs8(FormField4, { "data-field": "column-pin", children: [
|
|
2659
|
+
/* @__PURE__ */ jsx9(FormFieldLabel4, { children: "Pin Column" }),
|
|
2660
|
+
/* @__PURE__ */ jsxs8(
|
|
2661
|
+
ToggleButtonGroup,
|
|
2662
|
+
{
|
|
2663
|
+
className: "vuuToggleButtonGroup",
|
|
2664
|
+
onChange,
|
|
2665
|
+
value: pin != null ? pin : "",
|
|
2666
|
+
children: [
|
|
2667
|
+
/* @__PURE__ */ jsx9(
|
|
2668
|
+
ToggleButton,
|
|
2669
|
+
{
|
|
2670
|
+
className: "vuuIconToggleButton",
|
|
2671
|
+
"data-icon": "cross-circle",
|
|
2672
|
+
value: ""
|
|
2673
|
+
}
|
|
2674
|
+
),
|
|
2675
|
+
/* @__PURE__ */ jsx9(
|
|
2676
|
+
ToggleButton,
|
|
2677
|
+
{
|
|
2678
|
+
className: "vuuIconToggleButton",
|
|
2679
|
+
"data-icon": "pin-left",
|
|
2680
|
+
value: "left"
|
|
2681
|
+
}
|
|
2682
|
+
),
|
|
2683
|
+
/* @__PURE__ */ jsx9(
|
|
2684
|
+
ToggleButton,
|
|
2685
|
+
{
|
|
2686
|
+
className: "vuuIconToggleButton",
|
|
2687
|
+
"data-icon": "pin-float",
|
|
2688
|
+
value: "floating"
|
|
2689
|
+
}
|
|
2690
|
+
),
|
|
2691
|
+
/* @__PURE__ */ jsx9(
|
|
2692
|
+
ToggleButton,
|
|
2693
|
+
{
|
|
2694
|
+
className: "vuuIconToggleButton",
|
|
2695
|
+
"data-icon": "pin-right",
|
|
2696
|
+
value: "right"
|
|
2697
|
+
}
|
|
2698
|
+
)
|
|
2699
|
+
]
|
|
2700
|
+
}
|
|
2701
|
+
)
|
|
2612
2702
|
] }),
|
|
2613
|
-
/* @__PURE__ */
|
|
2614
|
-
|
|
2703
|
+
/* @__PURE__ */ jsx9(
|
|
2704
|
+
ColumnFormattingPanel,
|
|
2615
2705
|
{
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2706
|
+
availableRenderers,
|
|
2707
|
+
selectedCellRenderer,
|
|
2708
|
+
column,
|
|
2709
|
+
onChangeFormatting,
|
|
2710
|
+
onChangeRenderer
|
|
2619
2711
|
}
|
|
2620
2712
|
),
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
"column-chooser",
|
|
2632
|
-
"column-settings",
|
|
2633
|
-
"define-column"
|
|
2634
|
-
];
|
|
2635
|
-
var getTabIcon = (component, tabIndex) => icons[tabIndex];
|
|
2636
|
-
var DatagridSettingsPanel = ({
|
|
2637
|
-
availableColumns,
|
|
2638
|
-
className,
|
|
2639
|
-
gridConfig,
|
|
2640
|
-
onCancel,
|
|
2641
|
-
onConfigChange,
|
|
2642
|
-
...props
|
|
2643
|
-
}) => {
|
|
2644
|
-
var _a;
|
|
2645
|
-
console.log(`DatagridSettingsPanel render`);
|
|
2646
|
-
const [selectedTabIndex, setSelectedTabIndex] = useState3(0);
|
|
2647
|
-
const { gridSettings, dispatchColumnAction } = useGridSettings(gridConfig);
|
|
2648
|
-
const [selectedColumnName, setSelectedColumnName] = useState3(
|
|
2649
|
-
null
|
|
2650
|
-
);
|
|
2651
|
-
const handleColumnSelected = useCallback8(
|
|
2652
|
-
(selected) => {
|
|
2653
|
-
setSelectedColumnName(selected ? selected.name : null);
|
|
2654
|
-
},
|
|
2655
|
-
[]
|
|
2656
|
-
);
|
|
2657
|
-
const handleApply = useCallback8(
|
|
2658
|
-
(evt, closePanel = false) => {
|
|
2659
|
-
console.log(`1) DataGridSettingsPanel fire onConfigChange`);
|
|
2660
|
-
onConfigChange == null ? void 0 : onConfigChange(gridSettings, closePanel);
|
|
2661
|
-
},
|
|
2662
|
-
[gridSettings, onConfigChange]
|
|
2663
|
-
);
|
|
2664
|
-
const handleTabSelectionChanged = useCallback8((selectedTabIndex2) => {
|
|
2665
|
-
setSelectedTabIndex(selectedTabIndex2);
|
|
2666
|
-
}, []);
|
|
2667
|
-
const handleSave = useCallback8(
|
|
2668
|
-
(evt) => handleApply(evt, true),
|
|
2669
|
-
[handleApply]
|
|
2670
|
-
);
|
|
2671
|
-
const selectedColumn = selectedColumnName === null ? null : (_a = gridSettings.columns.find((col) => col.name === selectedColumnName)) != null ? _a : null;
|
|
2672
|
-
const tabstripProps2 = {
|
|
2673
|
-
activeTabIndex: selectedTabIndex,
|
|
2674
|
-
allowRenameTab: false,
|
|
2675
|
-
orientation: "vertical"
|
|
2676
|
-
};
|
|
2677
|
-
const handleAddCalculatedColumn = useCallback8(
|
|
2678
|
-
() => setSelectedTabIndex(3),
|
|
2679
|
-
[]
|
|
2680
|
-
);
|
|
2681
|
-
const panelShift = selectedTabIndex === 2 ? "right" : void 0;
|
|
2682
|
-
return /* @__PURE__ */ jsxs9("div", { ...props, className: cx6(classBase8, className), children: [
|
|
2683
|
-
/* @__PURE__ */ jsxs9(
|
|
2684
|
-
Stack2,
|
|
2713
|
+
isCalculatedColumn(column.name) ? /* @__PURE__ */ jsx9(
|
|
2714
|
+
ColumnExpressionPanel,
|
|
2715
|
+
{
|
|
2716
|
+
column,
|
|
2717
|
+
onSave,
|
|
2718
|
+
tableConfig,
|
|
2719
|
+
vuuTable
|
|
2720
|
+
}
|
|
2721
|
+
) : /* @__PURE__ */ jsxs8(
|
|
2722
|
+
"div",
|
|
2685
2723
|
{
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
getTabIcon,
|
|
2689
|
-
getTabLabel,
|
|
2690
|
-
active: selectedTabIndex === 2 ? 1 : selectedTabIndex,
|
|
2691
|
-
onTabSelectionChanged: handleTabSelectionChanged,
|
|
2724
|
+
className: `${classBase9}-buttonBar`,
|
|
2725
|
+
"data-align": isNewCalculatedColumn ? "right" : void 0,
|
|
2692
2726
|
children: [
|
|
2693
|
-
/* @__PURE__ */
|
|
2694
|
-
|
|
2727
|
+
/* @__PURE__ */ jsx9(
|
|
2728
|
+
Button2,
|
|
2695
2729
|
{
|
|
2696
|
-
|
|
2697
|
-
|
|
2730
|
+
className: `${classBase9}-buttonNavPrev`,
|
|
2731
|
+
variant: "secondary",
|
|
2732
|
+
"data-icon": "arrow-left",
|
|
2733
|
+
onClick: navigatePrevColumn,
|
|
2734
|
+
children: "PREVIOUS"
|
|
2698
2735
|
}
|
|
2699
2736
|
),
|
|
2700
|
-
/* @__PURE__ */
|
|
2701
|
-
|
|
2702
|
-
{
|
|
2703
|
-
column: selectedColumn,
|
|
2704
|
-
dispatchColumnAction,
|
|
2705
|
-
style: { background: "white", flex: "1 0 150px" }
|
|
2706
|
-
}
|
|
2707
|
-
) }),
|
|
2708
|
-
/* @__PURE__ */ jsx11("div", { title: "Column Settings", children: "Column Settings" }),
|
|
2709
|
-
/* @__PURE__ */ jsx11(
|
|
2710
|
-
CalculatedColumnPanel,
|
|
2737
|
+
/* @__PURE__ */ jsx9(
|
|
2738
|
+
Button2,
|
|
2711
2739
|
{
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2740
|
+
className: `${classBase9}-buttonNavNext`,
|
|
2741
|
+
variant: "secondary",
|
|
2742
|
+
"data-icon": "arrow-right",
|
|
2743
|
+
onClick: navigateNextColumn,
|
|
2744
|
+
children: "NEXT"
|
|
2715
2745
|
}
|
|
2716
2746
|
)
|
|
2717
2747
|
]
|
|
2718
2748
|
}
|
|
2719
|
-
)
|
|
2720
|
-
/* @__PURE__ */ jsxs9("div", { className: `${classBase8}-buttonBar`, children: [
|
|
2721
|
-
/* @__PURE__ */ jsx11(Button2, { onClick: onCancel, children: "Cancel" }),
|
|
2722
|
-
/* @__PURE__ */ jsx11(Button2, { onClick: handleApply, children: "Apply" }),
|
|
2723
|
-
/* @__PURE__ */ jsx11(Button2, { onClick: handleSave, children: "Save" })
|
|
2724
|
-
] })
|
|
2749
|
+
)
|
|
2725
2750
|
] });
|
|
2726
2751
|
};
|
|
2727
2752
|
|
|
2728
2753
|
// src/datasource-stats/DatasourceStats.tsx
|
|
2729
|
-
import { useEffect as
|
|
2730
|
-
import
|
|
2731
|
-
import { jsx as
|
|
2732
|
-
var
|
|
2754
|
+
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
2755
|
+
import cx6 from "classnames";
|
|
2756
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2757
|
+
var classBase10 = "vuuDatasourceStats";
|
|
2733
2758
|
var numberFormatter = new Intl.NumberFormat();
|
|
2734
2759
|
var DataSourceStats = ({
|
|
2735
2760
|
className: classNameProp,
|
|
@@ -2737,39 +2762,41 @@ var DataSourceStats = ({
|
|
|
2737
2762
|
}) => {
|
|
2738
2763
|
const [range, setRange] = useState4(dataSource.range);
|
|
2739
2764
|
const [size, setSize] = useState4(dataSource.size);
|
|
2740
|
-
|
|
2765
|
+
useEffect4(() => {
|
|
2741
2766
|
setSize(dataSource.size);
|
|
2742
2767
|
dataSource.on("resize", setSize);
|
|
2743
2768
|
dataSource.on("range", setRange);
|
|
2744
2769
|
}, [dataSource]);
|
|
2745
|
-
const className =
|
|
2770
|
+
const className = cx6(classBase10, classNameProp);
|
|
2746
2771
|
const from = numberFormatter.format(range.from);
|
|
2747
2772
|
const to = numberFormatter.format(range.to - 1);
|
|
2748
2773
|
const value = numberFormatter.format(size);
|
|
2749
|
-
return /* @__PURE__ */
|
|
2750
|
-
/* @__PURE__ */
|
|
2751
|
-
/* @__PURE__ */
|
|
2752
|
-
/* @__PURE__ */
|
|
2753
|
-
/* @__PURE__ */
|
|
2754
|
-
/* @__PURE__ */
|
|
2774
|
+
return /* @__PURE__ */ jsxs9("div", { className, children: [
|
|
2775
|
+
/* @__PURE__ */ jsx10("span", { className: `${classBase10}-label`, children: "Row count" }),
|
|
2776
|
+
/* @__PURE__ */ jsx10("span", { className: `${classBase10}-range`, children: from }),
|
|
2777
|
+
/* @__PURE__ */ jsx10("span", { children: "-" }),
|
|
2778
|
+
/* @__PURE__ */ jsx10("span", { className: `${classBase10}-range`, children: to }),
|
|
2779
|
+
/* @__PURE__ */ jsx10("span", { children: "of" }),
|
|
2780
|
+
/* @__PURE__ */ jsx10("span", { className: `${classBase10}-size`, children: value })
|
|
2755
2781
|
] });
|
|
2756
2782
|
};
|
|
2757
2783
|
|
|
2758
2784
|
// src/table-settings/TableSettingsPanel.tsx
|
|
2759
2785
|
import {
|
|
2786
|
+
Button as Button4,
|
|
2760
2787
|
FormField as FormField5,
|
|
2761
2788
|
FormFieldLabel as FormFieldLabel5,
|
|
2762
|
-
Input as
|
|
2763
|
-
ToggleButton,
|
|
2764
|
-
ToggleButtonGroup
|
|
2789
|
+
Input as Input4,
|
|
2790
|
+
ToggleButton as ToggleButton2,
|
|
2791
|
+
ToggleButtonGroup as ToggleButtonGroup2
|
|
2765
2792
|
} from "@salt-ds/core";
|
|
2766
2793
|
|
|
2767
2794
|
// src/table-settings/useTableSettings.ts
|
|
2768
|
-
import { useLayoutEffectSkipFirst as
|
|
2795
|
+
import { useLayoutEffectSkipFirst as useLayoutEffectSkipFirst3 } from "@vuu-ui/vuu-layout";
|
|
2769
2796
|
|
|
2770
2797
|
// ../vuu-table/src/table/ColumnResizer.tsx
|
|
2771
|
-
import { useCallback as
|
|
2772
|
-
import { jsx as
|
|
2798
|
+
import { useCallback as useCallback8, useRef as useRef8 } from "react";
|
|
2799
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2773
2800
|
|
|
2774
2801
|
// ../vuu-table/src/table/context-menu/buildContextMenuDescriptors.ts
|
|
2775
2802
|
import { isNumericColumn as isNumericColumn2 } from "@vuu-ui/vuu-utils";
|
|
@@ -2794,35 +2821,36 @@ import {
|
|
|
2794
2821
|
buildColumnMap,
|
|
2795
2822
|
getColumnStyle as getColumnStyle3,
|
|
2796
2823
|
isGroupColumn as isGroupColumn2,
|
|
2797
|
-
metadataKeys as
|
|
2824
|
+
metadataKeys as metadataKeys6,
|
|
2798
2825
|
notHidden as notHidden2,
|
|
2799
2826
|
visibleColumnAtIndex
|
|
2800
2827
|
} from "@vuu-ui/vuu-utils";
|
|
2801
|
-
import { useCallback as
|
|
2828
|
+
import { useCallback as useCallback15, useMemo as useMemo4 } from "react";
|
|
2802
2829
|
|
|
2803
2830
|
// ../vuu-table/src/table/TableRow.tsx
|
|
2804
2831
|
import {
|
|
2805
2832
|
isGroupColumn,
|
|
2806
2833
|
isJsonColumn,
|
|
2807
2834
|
isJsonGroup,
|
|
2808
|
-
metadataKeys as
|
|
2809
|
-
notHidden
|
|
2835
|
+
metadataKeys as metadataKeys5,
|
|
2836
|
+
notHidden,
|
|
2837
|
+
RowSelected
|
|
2810
2838
|
} from "@vuu-ui/vuu-utils";
|
|
2811
|
-
import
|
|
2812
|
-
import { memo as memo2, useCallback as
|
|
2839
|
+
import cx8 from "classnames";
|
|
2840
|
+
import { memo as memo2, useCallback as useCallback11 } from "react";
|
|
2813
2841
|
|
|
2814
2842
|
// ../vuu-table/src/table/TableCell.tsx
|
|
2815
|
-
import { getColumnStyle, metadataKeys as
|
|
2843
|
+
import { getColumnStyle, metadataKeys as metadataKeys3 } from "@vuu-ui/vuu-utils";
|
|
2816
2844
|
import { EditableLabel } from "@vuu-ui/vuu-ui-controls";
|
|
2817
|
-
import
|
|
2845
|
+
import cx7 from "classnames";
|
|
2818
2846
|
import {
|
|
2819
2847
|
memo,
|
|
2820
|
-
useCallback as
|
|
2821
|
-
useRef as
|
|
2848
|
+
useCallback as useCallback9,
|
|
2849
|
+
useRef as useRef9,
|
|
2822
2850
|
useState as useState5
|
|
2823
2851
|
} from "react";
|
|
2824
|
-
import { jsx as
|
|
2825
|
-
var { KEY:
|
|
2852
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2853
|
+
var { KEY: KEY3 } = metadataKeys3;
|
|
2826
2854
|
var TableCell = memo(
|
|
2827
2855
|
({
|
|
2828
2856
|
className: classNameProp,
|
|
@@ -2831,7 +2859,7 @@ var TableCell = memo(
|
|
|
2831
2859
|
onClick,
|
|
2832
2860
|
row
|
|
2833
2861
|
}) => {
|
|
2834
|
-
const labelFieldRef =
|
|
2862
|
+
const labelFieldRef = useRef9(null);
|
|
2835
2863
|
const {
|
|
2836
2864
|
align,
|
|
2837
2865
|
CellRenderer,
|
|
@@ -2853,7 +2881,7 @@ var TableCell = memo(
|
|
|
2853
2881
|
setEditing(true);
|
|
2854
2882
|
}
|
|
2855
2883
|
};
|
|
2856
|
-
const handleClick =
|
|
2884
|
+
const handleClick = useCallback9(
|
|
2857
2885
|
(evt) => {
|
|
2858
2886
|
onClick == null ? void 0 : onClick(evt, column);
|
|
2859
2887
|
},
|
|
@@ -2874,7 +2902,7 @@ var TableCell = memo(
|
|
|
2874
2902
|
(_a = labelFieldRef.current) == null ? void 0 : _a.focus();
|
|
2875
2903
|
}
|
|
2876
2904
|
};
|
|
2877
|
-
const className =
|
|
2905
|
+
const className = cx7(classNameProp, {
|
|
2878
2906
|
vuuAlignRight: align === "right",
|
|
2879
2907
|
vuuPinFloating: pin === "floating",
|
|
2880
2908
|
vuuPinLeft: pin === "left",
|
|
@@ -2882,7 +2910,7 @@ var TableCell = memo(
|
|
|
2882
2910
|
"vuuTableCell-resizing": resizing
|
|
2883
2911
|
}) || void 0;
|
|
2884
2912
|
const style = getColumnStyle(column);
|
|
2885
|
-
return editable ? /* @__PURE__ */
|
|
2913
|
+
return editable ? /* @__PURE__ */ jsx12(
|
|
2886
2914
|
"div",
|
|
2887
2915
|
{
|
|
2888
2916
|
className,
|
|
@@ -2890,7 +2918,7 @@ var TableCell = memo(
|
|
|
2890
2918
|
role: "cell",
|
|
2891
2919
|
style,
|
|
2892
2920
|
onKeyDown: handleTitleKeyDown,
|
|
2893
|
-
children: /* @__PURE__ */
|
|
2921
|
+
children: /* @__PURE__ */ jsx12(
|
|
2894
2922
|
EditableLabel,
|
|
2895
2923
|
{
|
|
2896
2924
|
editing,
|
|
@@ -2906,14 +2934,14 @@ var TableCell = memo(
|
|
|
2906
2934
|
"title"
|
|
2907
2935
|
)
|
|
2908
2936
|
}
|
|
2909
|
-
) : /* @__PURE__ */
|
|
2937
|
+
) : /* @__PURE__ */ jsx12(
|
|
2910
2938
|
"div",
|
|
2911
2939
|
{
|
|
2912
2940
|
className,
|
|
2913
2941
|
role: "cell",
|
|
2914
2942
|
style,
|
|
2915
2943
|
onClick: handleClick,
|
|
2916
|
-
children: CellRenderer ? /* @__PURE__ */
|
|
2944
|
+
children: CellRenderer ? /* @__PURE__ */ jsx12(CellRenderer, { column, columnMap, row }) : value
|
|
2917
2945
|
}
|
|
2918
2946
|
);
|
|
2919
2947
|
},
|
|
@@ -2921,22 +2949,22 @@ var TableCell = memo(
|
|
|
2921
2949
|
);
|
|
2922
2950
|
TableCell.displayName = "TableCell";
|
|
2923
2951
|
function cellValuesAreEqual(prev, next) {
|
|
2924
|
-
return prev.column === next.column && prev.onClick === next.onClick && prev.row[
|
|
2952
|
+
return prev.column === next.column && prev.onClick === next.onClick && prev.row[KEY3] === next.row[KEY3] && prev.row[prev.column.key] === next.row[next.column.key];
|
|
2925
2953
|
}
|
|
2926
2954
|
|
|
2927
2955
|
// ../vuu-table/src/table/TableGroupCell.tsx
|
|
2928
2956
|
import {
|
|
2929
2957
|
getColumnStyle as getColumnStyle2,
|
|
2930
2958
|
getGroupValueAndOffset,
|
|
2931
|
-
metadataKeys as
|
|
2959
|
+
metadataKeys as metadataKeys4
|
|
2932
2960
|
} from "@vuu-ui/vuu-utils";
|
|
2933
|
-
import { useCallback as
|
|
2934
|
-
import { jsx as
|
|
2935
|
-
var { IS_LEAF } =
|
|
2961
|
+
import { useCallback as useCallback10 } from "react";
|
|
2962
|
+
import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2963
|
+
var { IS_LEAF } = metadataKeys4;
|
|
2936
2964
|
var TableGroupCell = ({ column, onClick, row }) => {
|
|
2937
2965
|
const { columns } = column;
|
|
2938
2966
|
const [value, offset] = getGroupValueAndOffset(columns, row);
|
|
2939
|
-
const handleClick =
|
|
2967
|
+
const handleClick = useCallback10(
|
|
2940
2968
|
(evt) => {
|
|
2941
2969
|
onClick == null ? void 0 : onClick(evt, column);
|
|
2942
2970
|
},
|
|
@@ -2944,8 +2972,8 @@ var TableGroupCell = ({ column, onClick, row }) => {
|
|
|
2944
2972
|
);
|
|
2945
2973
|
const style = getColumnStyle2(column);
|
|
2946
2974
|
const isLeaf = row[IS_LEAF];
|
|
2947
|
-
const spacers = Array(offset).fill(0).map((n, i) => /* @__PURE__ */
|
|
2948
|
-
return /* @__PURE__ */
|
|
2975
|
+
const spacers = Array(offset).fill(0).map((n, i) => /* @__PURE__ */ jsx13("span", { className: "vuuTableGroupCell-spacer" }, i));
|
|
2976
|
+
return /* @__PURE__ */ jsxs10(
|
|
2949
2977
|
"div",
|
|
2950
2978
|
{
|
|
2951
2979
|
className: "vuuTableGroupCell vuuPinLeft",
|
|
@@ -2954,17 +2982,18 @@ var TableGroupCell = ({ column, onClick, row }) => {
|
|
|
2954
2982
|
style,
|
|
2955
2983
|
children: [
|
|
2956
2984
|
spacers,
|
|
2957
|
-
isLeaf ? null : /* @__PURE__ */
|
|
2958
|
-
/* @__PURE__ */
|
|
2985
|
+
isLeaf ? null : /* @__PURE__ */ jsx13("span", { className: "vuuTableGroupCell-toggle", "data-icon": "triangle-right" }),
|
|
2986
|
+
/* @__PURE__ */ jsx13("span", { children: value })
|
|
2959
2987
|
]
|
|
2960
2988
|
}
|
|
2961
2989
|
);
|
|
2962
2990
|
};
|
|
2963
2991
|
|
|
2964
2992
|
// ../vuu-table/src/table/TableRow.tsx
|
|
2965
|
-
import { jsx as
|
|
2966
|
-
var { IDX, IS_EXPANDED, SELECTED } =
|
|
2967
|
-
var
|
|
2993
|
+
import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2994
|
+
var { IDX, IS_EXPANDED, SELECTED } = metadataKeys5;
|
|
2995
|
+
var { True, First, Last } = RowSelected;
|
|
2996
|
+
var classBase11 = "vuuTableRow";
|
|
2968
2997
|
var TableRow = memo2(function Row({
|
|
2969
2998
|
columnMap,
|
|
2970
2999
|
columns,
|
|
@@ -2977,14 +3006,16 @@ var TableRow = memo2(function Row({
|
|
|
2977
3006
|
const {
|
|
2978
3007
|
[IDX]: rowIndex,
|
|
2979
3008
|
[IS_EXPANDED]: isExpanded,
|
|
2980
|
-
[SELECTED]:
|
|
3009
|
+
[SELECTED]: selectionStatus
|
|
2981
3010
|
} = row;
|
|
2982
|
-
const className =
|
|
2983
|
-
[`${
|
|
2984
|
-
[`${
|
|
2985
|
-
[`${
|
|
3011
|
+
const className = cx8(classBase11, {
|
|
3012
|
+
[`${classBase11}-even`]: rowIndex % 2 === 0,
|
|
3013
|
+
[`${classBase11}-expanded`]: isExpanded,
|
|
3014
|
+
[`${classBase11}-selected`]: selectionStatus & True,
|
|
3015
|
+
[`${classBase11}-selectedStart`]: selectionStatus & First,
|
|
3016
|
+
[`${classBase11}-selectedEnd`]: selectionStatus & Last
|
|
2986
3017
|
});
|
|
2987
|
-
const handleRowClick =
|
|
3018
|
+
const handleRowClick = useCallback11(
|
|
2988
3019
|
(evt) => {
|
|
2989
3020
|
const rangeSelect = evt.shiftKey;
|
|
2990
3021
|
const keepExistingSelection = evt.ctrlKey || evt.metaKey;
|
|
@@ -2992,7 +3023,7 @@ var TableRow = memo2(function Row({
|
|
|
2992
3023
|
},
|
|
2993
3024
|
[onClick, row]
|
|
2994
3025
|
);
|
|
2995
|
-
const handleGroupCellClick =
|
|
3026
|
+
const handleGroupCellClick = useCallback11(
|
|
2996
3027
|
(evt, column) => {
|
|
2997
3028
|
if (isGroupColumn(column) || isJsonGroup(column, row)) {
|
|
2998
3029
|
evt.stopPropagation();
|
|
@@ -3001,10 +3032,10 @@ var TableRow = memo2(function Row({
|
|
|
3001
3032
|
},
|
|
3002
3033
|
[onToggleGroup, row]
|
|
3003
3034
|
);
|
|
3004
|
-
return /* @__PURE__ */
|
|
3035
|
+
return /* @__PURE__ */ jsxs11(
|
|
3005
3036
|
"div",
|
|
3006
3037
|
{
|
|
3007
|
-
"aria-selected":
|
|
3038
|
+
"aria-selected": selectionStatus & True ? true : void 0,
|
|
3008
3039
|
"aria-rowindex": rowIndex,
|
|
3009
3040
|
className,
|
|
3010
3041
|
onClick: handleRowClick,
|
|
@@ -3013,12 +3044,12 @@ var TableRow = memo2(function Row({
|
|
|
3013
3044
|
transform: `translate3d(0px, ${offset}px, 0px)`
|
|
3014
3045
|
},
|
|
3015
3046
|
children: [
|
|
3016
|
-
virtualColSpan > 0 ? /* @__PURE__ */
|
|
3047
|
+
virtualColSpan > 0 ? /* @__PURE__ */ jsx14("div", { role: "cell", style: { width: virtualColSpan } }) : null,
|
|
3017
3048
|
columns.filter(notHidden).map((column) => {
|
|
3018
3049
|
const isGroup = isGroupColumn(column);
|
|
3019
3050
|
const isJsonCell = isJsonColumn(column);
|
|
3020
3051
|
const Cell = isGroup ? TableGroupCell : TableCell;
|
|
3021
|
-
return /* @__PURE__ */
|
|
3052
|
+
return /* @__PURE__ */ jsx14(
|
|
3022
3053
|
Cell,
|
|
3023
3054
|
{
|
|
3024
3055
|
column,
|
|
@@ -3035,37 +3066,38 @@ var TableRow = memo2(function Row({
|
|
|
3035
3066
|
});
|
|
3036
3067
|
|
|
3037
3068
|
// ../vuu-table/src/table/TableGroupHeaderCell.tsx
|
|
3038
|
-
import
|
|
3039
|
-
import { useRef as
|
|
3069
|
+
import cx9 from "classnames";
|
|
3070
|
+
import { useRef as useRef11 } from "react";
|
|
3040
3071
|
|
|
3041
3072
|
// ../vuu-table/src/table/useTableColumnResize.tsx
|
|
3042
|
-
import { useCallback as
|
|
3073
|
+
import { useCallback as useCallback12, useRef as useRef10 } from "react";
|
|
3043
3074
|
|
|
3044
3075
|
// ../vuu-table/src/table/TableGroupHeaderCell.tsx
|
|
3045
|
-
import { jsx as
|
|
3076
|
+
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3046
3077
|
|
|
3047
3078
|
// ../vuu-table/src/table/TableHeaderCell.tsx
|
|
3048
|
-
import
|
|
3049
|
-
import { useCallback as
|
|
3079
|
+
import cx12 from "classnames";
|
|
3080
|
+
import { useCallback as useCallback14, useRef as useRef12 } from "react";
|
|
3050
3081
|
|
|
3051
3082
|
// ../vuu-table/src/table/SortIndicator.tsx
|
|
3052
|
-
import
|
|
3083
|
+
import cx10 from "classnames";
|
|
3084
|
+
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3053
3085
|
|
|
3054
3086
|
// ../vuu-table/src/table/TableHeaderCell.tsx
|
|
3055
3087
|
import { useContextMenu as useContextMenu2 } from "@vuu-ui/vuu-popups";
|
|
3056
3088
|
|
|
3057
3089
|
// ../vuu-table/src/table/filter-indicator.tsx
|
|
3058
3090
|
import { useContextMenu } from "@vuu-ui/vuu-popups";
|
|
3059
|
-
import
|
|
3060
|
-
import { useCallback as
|
|
3061
|
-
import { jsx as
|
|
3091
|
+
import cx11 from "classnames";
|
|
3092
|
+
import { useCallback as useCallback13 } from "react";
|
|
3093
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
3062
3094
|
|
|
3063
3095
|
// ../vuu-table/src/table/TableHeaderCell.tsx
|
|
3064
|
-
import { jsx as
|
|
3096
|
+
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3065
3097
|
|
|
3066
3098
|
// ../vuu-table/src/table/RowBasedTable.tsx
|
|
3067
|
-
import { jsx as
|
|
3068
|
-
var { RENDER_IDX } =
|
|
3099
|
+
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3100
|
+
var { RENDER_IDX } = metadataKeys6;
|
|
3069
3101
|
|
|
3070
3102
|
// ../vuu-table/src/table/useTable.ts
|
|
3071
3103
|
import { useContextMenu as usePopupContextMenu } from "@vuu-ui/vuu-popups";
|
|
@@ -3073,14 +3105,14 @@ import {
|
|
|
3073
3105
|
applySort,
|
|
3074
3106
|
buildColumnMap as buildColumnMap2,
|
|
3075
3107
|
isJsonGroup as isJsonGroup2,
|
|
3076
|
-
metadataKeys as
|
|
3077
|
-
|
|
3108
|
+
metadataKeys as metadataKeys10,
|
|
3109
|
+
moveItemDeprecated as moveItemDeprecated2
|
|
3078
3110
|
} from "@vuu-ui/vuu-utils";
|
|
3079
3111
|
import {
|
|
3080
|
-
useCallback as
|
|
3081
|
-
useEffect as
|
|
3082
|
-
useMemo as
|
|
3083
|
-
useRef as
|
|
3112
|
+
useCallback as useCallback25,
|
|
3113
|
+
useEffect as useEffect9,
|
|
3114
|
+
useMemo as useMemo10,
|
|
3115
|
+
useRef as useRef22,
|
|
3084
3116
|
useState as useState9
|
|
3085
3117
|
} from "react";
|
|
3086
3118
|
|
|
@@ -3089,22 +3121,22 @@ import {
|
|
|
3089
3121
|
isVuuFeatureAction,
|
|
3090
3122
|
isVuuFeatureInvocation
|
|
3091
3123
|
} from "@vuu-ui/vuu-data-react";
|
|
3092
|
-
import { getFullRange, metadataKeys as
|
|
3093
|
-
import { useCallback as
|
|
3094
|
-
var { SELECTED: SELECTED2 } =
|
|
3124
|
+
import { getFullRange, metadataKeys as metadataKeys7, WindowRange } from "@vuu-ui/vuu-utils";
|
|
3125
|
+
import { useCallback as useCallback16, useEffect as useEffect5, useMemo as useMemo5, useRef as useRef13, useState as useState6 } from "react";
|
|
3126
|
+
var { SELECTED: SELECTED2 } = metadataKeys7;
|
|
3095
3127
|
|
|
3096
3128
|
// ../vuu-table/src/table/useDraggableColumn.ts
|
|
3097
3129
|
import { useDragDropNext as useDragDrop } from "@vuu-ui/vuu-ui-controls";
|
|
3098
|
-
import { useCallback as
|
|
3130
|
+
import { useCallback as useCallback17, useRef as useRef14 } from "react";
|
|
3099
3131
|
|
|
3100
3132
|
// ../vuu-table/src/table/useKeyboardNavigation.ts
|
|
3101
3133
|
import { withinRange } from "@vuu-ui/vuu-utils";
|
|
3102
3134
|
import {
|
|
3103
|
-
useCallback as
|
|
3104
|
-
useEffect as
|
|
3135
|
+
useCallback as useCallback18,
|
|
3136
|
+
useEffect as useEffect6,
|
|
3105
3137
|
useLayoutEffect,
|
|
3106
|
-
useMemo as
|
|
3107
|
-
useRef as
|
|
3138
|
+
useMemo as useMemo6,
|
|
3139
|
+
useRef as useRef15
|
|
3108
3140
|
} from "react";
|
|
3109
3141
|
|
|
3110
3142
|
// ../vuu-table/src/table/keyUtils.ts
|
|
@@ -3161,11 +3193,11 @@ var specialKeys = union(
|
|
|
3161
3193
|
);
|
|
3162
3194
|
|
|
3163
3195
|
// ../vuu-table/src/table/useMeasuredContainer.ts
|
|
3164
|
-
import { isValidNumber as
|
|
3165
|
-
import { useCallback as
|
|
3196
|
+
import { isValidNumber as isValidNumber4 } from "@vuu-ui/vuu-utils";
|
|
3197
|
+
import { useCallback as useCallback20, useMemo as useMemo7, useRef as useRef17, useState as useState7 } from "react";
|
|
3166
3198
|
|
|
3167
3199
|
// ../vuu-table/src/table/useResizeObserver.ts
|
|
3168
|
-
import { useCallback as
|
|
3200
|
+
import { useCallback as useCallback19, useEffect as useEffect7, useRef as useRef16 } from "react";
|
|
3169
3201
|
var observedMap = /* @__PURE__ */ new Map();
|
|
3170
3202
|
var getTargetSize = (element, size, dimension) => {
|
|
3171
3203
|
switch (dimension) {
|
|
@@ -3220,11 +3252,11 @@ var resizeObserver = new ResizeObserver((entries) => {
|
|
|
3220
3252
|
import {
|
|
3221
3253
|
deselectItem,
|
|
3222
3254
|
isRowSelected,
|
|
3223
|
-
metadataKeys as
|
|
3255
|
+
metadataKeys as metadataKeys8,
|
|
3224
3256
|
selectItem
|
|
3225
3257
|
} from "@vuu-ui/vuu-utils";
|
|
3226
|
-
import { useCallback as
|
|
3227
|
-
var { IDX: IDX2 } =
|
|
3258
|
+
import { useCallback as useCallback21, useRef as useRef18 } from "react";
|
|
3259
|
+
var { IDX: IDX2 } = metadataKeys8;
|
|
3228
3260
|
|
|
3229
3261
|
// ../vuu-table/src/table/useTableModel.ts
|
|
3230
3262
|
import {
|
|
@@ -3239,21 +3271,22 @@ import {
|
|
|
3239
3271
|
isFilteredColumn,
|
|
3240
3272
|
isGroupColumn as isGroupColumn3,
|
|
3241
3273
|
isPinned,
|
|
3242
|
-
isTypeDescriptor as
|
|
3243
|
-
metadataKeys as
|
|
3274
|
+
isTypeDescriptor as isTypeDescriptor7,
|
|
3275
|
+
metadataKeys as metadataKeys9,
|
|
3244
3276
|
updateColumn,
|
|
3245
3277
|
sortPinnedColumns,
|
|
3246
3278
|
stripFilterFromColumns,
|
|
3247
|
-
|
|
3279
|
+
moveItemDeprecated,
|
|
3280
|
+
getDefaultAlignment as getDefaultAlignment2
|
|
3248
3281
|
} from "@vuu-ui/vuu-utils";
|
|
3249
|
-
import { useReducer
|
|
3250
|
-
var KEY_OFFSET =
|
|
3282
|
+
import { useReducer } from "react";
|
|
3283
|
+
var KEY_OFFSET = metadataKeys9.count;
|
|
3251
3284
|
|
|
3252
3285
|
// ../vuu-table/src/table/useTableScroll.ts
|
|
3253
|
-
import { useCallback as
|
|
3286
|
+
import { useCallback as useCallback22, useRef as useRef19 } from "react";
|
|
3254
3287
|
|
|
3255
|
-
// ../vuu-table/src/table/useTableViewport.ts
|
|
3256
|
-
import { useCallback as
|
|
3288
|
+
// ../vuu-table/src/table-next/useTableViewport.ts
|
|
3289
|
+
import { useCallback as useCallback23, useMemo as useMemo8, useRef as useRef20 } from "react";
|
|
3257
3290
|
import {
|
|
3258
3291
|
actualRowPositioning,
|
|
3259
3292
|
virtualRowPositioning
|
|
@@ -3264,26 +3297,26 @@ import {
|
|
|
3264
3297
|
getColumnsInViewport,
|
|
3265
3298
|
itemsChanged
|
|
3266
3299
|
} from "@vuu-ui/vuu-utils";
|
|
3267
|
-
import { useCallback as
|
|
3300
|
+
import { useCallback as useCallback24, useEffect as useEffect8, useMemo as useMemo9, useRef as useRef21, useState as useState8 } from "react";
|
|
3268
3301
|
|
|
3269
3302
|
// ../vuu-table/src/table/useTable.ts
|
|
3270
|
-
var { KEY:
|
|
3303
|
+
var { KEY: KEY4, IS_EXPANDED: IS_EXPANDED2, IS_LEAF: IS_LEAF2 } = metadataKeys10;
|
|
3271
3304
|
|
|
3272
3305
|
// ../vuu-table/src/table/Table.tsx
|
|
3273
|
-
import
|
|
3306
|
+
import cx13 from "classnames";
|
|
3274
3307
|
import { isDataLoading } from "@vuu-ui/vuu-utils";
|
|
3275
|
-
import { jsx as
|
|
3308
|
+
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3276
3309
|
|
|
3277
3310
|
// ../vuu-table/src/table/cell-renderers/json-cell/JsonCell.tsx
|
|
3278
|
-
import
|
|
3311
|
+
import cx14 from "classnames";
|
|
3279
3312
|
import {
|
|
3280
3313
|
isJsonAttribute,
|
|
3281
|
-
metadataKeys as
|
|
3282
|
-
registerComponent as
|
|
3314
|
+
metadataKeys as metadataKeys11,
|
|
3315
|
+
registerComponent as registerComponent6
|
|
3283
3316
|
} from "@vuu-ui/vuu-utils";
|
|
3284
|
-
import { jsx as
|
|
3285
|
-
var
|
|
3286
|
-
var { IS_EXPANDED: IS_EXPANDED3, KEY:
|
|
3317
|
+
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3318
|
+
var classBase12 = "vuuJsonCell";
|
|
3319
|
+
var { IS_EXPANDED: IS_EXPANDED3, KEY: KEY5 } = metadataKeys11;
|
|
3287
3320
|
var localKey = (key) => {
|
|
3288
3321
|
const pos = key.lastIndexOf("|");
|
|
3289
3322
|
if (pos === -1) {
|
|
@@ -3303,137 +3336,198 @@ var JsonCell = ({ column, row }) => {
|
|
|
3303
3336
|
value = value.slice(0, -1);
|
|
3304
3337
|
isToggle = true;
|
|
3305
3338
|
}
|
|
3306
|
-
const rowKey = localKey(row[
|
|
3307
|
-
const className =
|
|
3308
|
-
[`${
|
|
3309
|
-
[`${
|
|
3310
|
-
[`${
|
|
3339
|
+
const rowKey = localKey(row[KEY5]);
|
|
3340
|
+
const className = cx14({
|
|
3341
|
+
[`${classBase12}-name`]: rowKey === value,
|
|
3342
|
+
[`${classBase12}-value`]: rowKey !== value,
|
|
3343
|
+
[`${classBase12}-group`]: isToggle
|
|
3311
3344
|
});
|
|
3312
3345
|
if (isToggle) {
|
|
3313
3346
|
const toggleIcon = row[IS_EXPANDED3] ? "minus-box" : "plus-box";
|
|
3314
3347
|
return /* @__PURE__ */ jsxs17("span", { className, children: [
|
|
3315
|
-
/* @__PURE__ */
|
|
3316
|
-
/* @__PURE__ */
|
|
3348
|
+
/* @__PURE__ */ jsx21("span", { className: `${classBase12}-value`, children: value }),
|
|
3349
|
+
/* @__PURE__ */ jsx21("span", { className: `${classBase12}-toggle`, "data-icon": toggleIcon })
|
|
3317
3350
|
] });
|
|
3318
3351
|
} else if (value) {
|
|
3319
|
-
return /* @__PURE__ */
|
|
3352
|
+
return /* @__PURE__ */ jsx21("span", { className, children: value });
|
|
3320
3353
|
} else {
|
|
3321
3354
|
return null;
|
|
3322
3355
|
}
|
|
3323
3356
|
};
|
|
3324
|
-
|
|
3357
|
+
registerComponent6("json", JsonCell, "cell-renderer", {
|
|
3358
|
+
description: "JSON formatter",
|
|
3359
|
+
label: "JSON formatter",
|
|
3360
|
+
serverDataType: "json"
|
|
3361
|
+
});
|
|
3325
3362
|
|
|
3326
|
-
// ../vuu-table/src/table-next/
|
|
3327
|
-
import
|
|
3328
|
-
import {
|
|
3363
|
+
// ../vuu-table/src/table-next/header-cell/GroupHeaderCell.tsx
|
|
3364
|
+
import cx17 from "classnames";
|
|
3365
|
+
import { useRef as useRef25 } from "react";
|
|
3329
3366
|
|
|
3330
|
-
// ../vuu-table/src/table-next/
|
|
3331
|
-
import { useCallback as
|
|
3367
|
+
// ../vuu-table/src/table-next/column-resizing/ColumnResizer.tsx
|
|
3368
|
+
import { useCallback as useCallback26, useRef as useRef23 } from "react";
|
|
3369
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
3370
|
+
|
|
3371
|
+
// ../vuu-table/src/table-next/column-resizing/useTableColumnResize.tsx
|
|
3372
|
+
import { useCallback as useCallback27, useRef as useRef24, useState as useState10 } from "react";
|
|
3332
3373
|
|
|
3333
3374
|
// ../vuu-table/src/table-next/useCell.ts
|
|
3334
3375
|
import { getColumnStyle as getColumnStyle4 } from "@vuu-ui/vuu-utils";
|
|
3335
|
-
import
|
|
3336
|
-
import { useMemo as
|
|
3337
|
-
var useCell = (column,
|
|
3376
|
+
import cx15 from "classnames";
|
|
3377
|
+
import { useMemo as useMemo11 } from "react";
|
|
3378
|
+
var useCell = (column, classBase19, isHeader) => (
|
|
3338
3379
|
// TODO measure perf without the memo, might not be worth the cost
|
|
3339
|
-
|
|
3340
|
-
const className =
|
|
3380
|
+
useMemo11(() => {
|
|
3381
|
+
const className = cx15(classBase19, {
|
|
3341
3382
|
vuuPinFloating: column.pin === "floating",
|
|
3342
3383
|
vuuPinLeft: column.pin === "left",
|
|
3343
3384
|
vuuPinRight: column.pin === "right",
|
|
3344
3385
|
vuuEndPin: isHeader && column.endPin,
|
|
3345
|
-
[`${
|
|
3346
|
-
[`${
|
|
3386
|
+
// [`${classBase}-resizing`]: column.resizing,
|
|
3387
|
+
[`${classBase19}-editable`]: column.editable,
|
|
3388
|
+
[`${classBase19}-right`]: column.align === "right"
|
|
3347
3389
|
});
|
|
3348
3390
|
const style = getColumnStyle4(column);
|
|
3349
3391
|
return {
|
|
3350
3392
|
className,
|
|
3351
3393
|
style
|
|
3352
3394
|
};
|
|
3353
|
-
}, [column,
|
|
3395
|
+
}, [column, classBase19, isHeader])
|
|
3354
3396
|
);
|
|
3355
3397
|
|
|
3356
|
-
// ../vuu-table/src/table-next/
|
|
3398
|
+
// ../vuu-table/src/table-next/column-header-pill/ColumnHeaderPill.tsx
|
|
3399
|
+
import cx16 from "classnames";
|
|
3400
|
+
import { useCallback as useCallback28 } from "react";
|
|
3401
|
+
import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3402
|
+
|
|
3403
|
+
// ../vuu-table/src/table-next/column-header-pill/GroupColumnPill.tsx
|
|
3404
|
+
import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3405
|
+
|
|
3406
|
+
// ../vuu-table/src/table-next/column-header-pill/SortIndicator.tsx
|
|
3407
|
+
import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3408
|
+
|
|
3409
|
+
// ../vuu-table/src/table-next/header-cell/GroupHeaderCell.tsx
|
|
3410
|
+
import { jsx as jsx26, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3411
|
+
import { createElement } from "react";
|
|
3412
|
+
|
|
3413
|
+
// ../vuu-table/src/table-next/header-cell/GroupHeaderCellNext.tsx
|
|
3414
|
+
import cx18 from "classnames";
|
|
3415
|
+
import { useCallback as useCallback29, useRef as useRef26, useState as useState11 } from "react";
|
|
3416
|
+
import {
|
|
3417
|
+
OverflowContainer,
|
|
3418
|
+
useLayoutEffectSkipFirst
|
|
3419
|
+
} from "@vuu-ui/vuu-layout";
|
|
3420
|
+
import { jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3421
|
+
import { createElement as createElement2 } from "react";
|
|
3422
|
+
|
|
3423
|
+
// ../vuu-table/src/table-next/header-cell/HeaderCell.tsx
|
|
3424
|
+
import { useCallback as useCallback31, useRef as useRef28 } from "react";
|
|
3425
|
+
|
|
3426
|
+
// ../vuu-table/src/table-next/column-menu/ColumnMenu.tsx
|
|
3357
3427
|
import { useContextMenu as useContextMenu3 } from "@vuu-ui/vuu-popups";
|
|
3358
|
-
import
|
|
3428
|
+
import cx19 from "classnames";
|
|
3359
3429
|
import {
|
|
3360
|
-
useCallback as
|
|
3361
|
-
useRef as
|
|
3362
|
-
useState as
|
|
3430
|
+
useCallback as useCallback30,
|
|
3431
|
+
useRef as useRef27,
|
|
3432
|
+
useState as useState12
|
|
3363
3433
|
} from "react";
|
|
3364
|
-
import { jsx as
|
|
3365
|
-
|
|
3366
|
-
// ../vuu-table/src/table-next/column-resizing/ColumnResizer.tsx
|
|
3367
|
-
import { useCallback as useCallback28, useRef as useRef21 } from "react";
|
|
3368
|
-
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
3434
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
3369
3435
|
|
|
3370
|
-
// ../vuu-table/src/table-next/
|
|
3371
|
-
import
|
|
3436
|
+
// ../vuu-table/src/table-next/header-cell/HeaderCell.tsx
|
|
3437
|
+
import cx20 from "classnames";
|
|
3438
|
+
import { jsx as jsx29, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3372
3439
|
|
|
3373
|
-
// ../vuu-table/src/table-next/
|
|
3374
|
-
import {
|
|
3440
|
+
// ../vuu-table/src/table-next/TableNext.tsx
|
|
3441
|
+
import { ContextMenuProvider as ContextMenuProvider2 } from "@vuu-ui/vuu-popups";
|
|
3442
|
+
import { isGroupColumn as isGroupColumn7, metadataKeys as metadataKeys18, notHidden as notHidden4 } from "@vuu-ui/vuu-utils";
|
|
3443
|
+
import cx23 from "classnames";
|
|
3444
|
+
import { useRef as useRef34 } from "react";
|
|
3375
3445
|
|
|
3376
3446
|
// ../vuu-table/src/table-next/Row.tsx
|
|
3377
3447
|
import {
|
|
3378
3448
|
isGroupColumn as isGroupColumn4,
|
|
3379
|
-
|
|
3449
|
+
isJsonColumn as isJsonColumn2,
|
|
3450
|
+
isJsonGroup as isJsonGroup3,
|
|
3451
|
+
metadataKeys as metadataKeys14,
|
|
3380
3452
|
notHidden as notHidden3,
|
|
3381
|
-
RowSelected
|
|
3453
|
+
RowSelected as RowSelected2
|
|
3382
3454
|
} from "@vuu-ui/vuu-utils";
|
|
3383
|
-
import
|
|
3384
|
-
import { memo as memo3, useCallback as
|
|
3455
|
+
import cx22 from "classnames";
|
|
3456
|
+
import { memo as memo3, useCallback as useCallback34 } from "react";
|
|
3385
3457
|
|
|
3386
|
-
// ../vuu-table/src/table-next/TableCell.tsx
|
|
3387
|
-
import {
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3458
|
+
// ../vuu-table/src/table-next/table-cell/TableCell.tsx
|
|
3459
|
+
import { metadataKeys as metadataKeys12 } from "@vuu-ui/vuu-utils";
|
|
3460
|
+
import { useCallback as useCallback32 } from "react";
|
|
3461
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
3462
|
+
var { IDX: IDX3 } = metadataKeys12;
|
|
3463
|
+
var classBase13 = "vuuTableNextCell";
|
|
3464
|
+
var TableCell2 = ({
|
|
3465
|
+
column,
|
|
3466
|
+
columnMap,
|
|
3467
|
+
onDataEdited,
|
|
3468
|
+
row
|
|
3469
|
+
}) => {
|
|
3470
|
+
const { className, style } = useCell(column, classBase13);
|
|
3471
|
+
const { CellRenderer, name: name2, valueFormatter } = column;
|
|
3472
|
+
const dataIdx = columnMap[name2];
|
|
3473
|
+
const handleDataItemEdited = useCallback32(
|
|
3474
|
+
(value) => {
|
|
3475
|
+
onDataEdited == null ? void 0 : onDataEdited(row[IDX3], name2, value);
|
|
3476
|
+
return true;
|
|
3477
|
+
},
|
|
3478
|
+
[name2, onDataEdited, row]
|
|
3479
|
+
);
|
|
3480
|
+
return /* @__PURE__ */ jsx30("div", { className, role: "cell", style, children: CellRenderer ? /* @__PURE__ */ jsx30(
|
|
3481
|
+
CellRenderer,
|
|
3482
|
+
{
|
|
3483
|
+
column,
|
|
3484
|
+
columnMap,
|
|
3485
|
+
onCommit: handleDataItemEdited,
|
|
3486
|
+
row
|
|
3487
|
+
}
|
|
3488
|
+
) : valueFormatter(row[dataIdx]) });
|
|
3391
3489
|
};
|
|
3392
3490
|
|
|
3393
|
-
// ../vuu-table/src/table-next/TableGroupCell.tsx
|
|
3394
|
-
import { getGroupValueAndOffset as getGroupValueAndOffset2, metadataKeys as
|
|
3395
|
-
import { useCallback as
|
|
3396
|
-
import
|
|
3397
|
-
|
|
3491
|
+
// ../vuu-table/src/table-next/table-cell/TableGroupCell.tsx
|
|
3492
|
+
import { getGroupValueAndOffset as getGroupValueAndOffset2, metadataKeys as metadataKeys13 } from "@vuu-ui/vuu-utils";
|
|
3493
|
+
import { useCallback as useCallback33 } from "react";
|
|
3494
|
+
import cx21 from "classnames";
|
|
3495
|
+
import { jsx as jsx31, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3496
|
+
var { IS_LEAF: IS_LEAF3 } = metadataKeys13;
|
|
3497
|
+
var classBase14 = "vuuTableNextGroupCell";
|
|
3398
3498
|
var TableGroupCell2 = ({ column, onClick, row }) => {
|
|
3399
3499
|
const { columns } = column;
|
|
3400
3500
|
const [value, offset] = getGroupValueAndOffset2(columns, row);
|
|
3401
|
-
const { className, style } = useCell(column,
|
|
3402
|
-
const handleClick =
|
|
3501
|
+
const { className, style } = useCell(column, classBase14);
|
|
3502
|
+
const handleClick = useCallback33(
|
|
3403
3503
|
(evt) => {
|
|
3404
3504
|
onClick == null ? void 0 : onClick(evt, column);
|
|
3405
3505
|
},
|
|
3406
3506
|
[column, onClick]
|
|
3407
3507
|
);
|
|
3408
3508
|
const isLeaf = row[IS_LEAF3];
|
|
3409
|
-
const spacers = Array(offset).fill(0).map((n, i) => /* @__PURE__ */
|
|
3410
|
-
return /* @__PURE__ */
|
|
3509
|
+
const spacers = Array(offset).fill(0).map((n, i) => /* @__PURE__ */ jsx31("span", { className: `${classBase14}-spacer` }, i));
|
|
3510
|
+
return /* @__PURE__ */ jsxs24(
|
|
3411
3511
|
"div",
|
|
3412
3512
|
{
|
|
3413
|
-
className,
|
|
3513
|
+
className: cx21(className, "vuuTableNextCell"),
|
|
3414
3514
|
role: "cell",
|
|
3415
3515
|
style,
|
|
3416
3516
|
onClick: isLeaf ? void 0 : handleClick,
|
|
3417
3517
|
children: [
|
|
3418
3518
|
spacers,
|
|
3419
|
-
isLeaf ? null : /* @__PURE__ */
|
|
3420
|
-
|
|
3421
|
-
{
|
|
3422
|
-
className: "vuuTable2-groupCell-toggle",
|
|
3423
|
-
"data-icon": "vuu-triangle-right"
|
|
3424
|
-
}
|
|
3425
|
-
),
|
|
3426
|
-
/* @__PURE__ */ jsx27("span", { children: value })
|
|
3519
|
+
isLeaf ? null : /* @__PURE__ */ jsx31("span", { className: `${classBase14}-toggle`, "data-icon": "triangle-right" }),
|
|
3520
|
+
/* @__PURE__ */ jsx31("span", { children: value })
|
|
3427
3521
|
]
|
|
3428
3522
|
}
|
|
3429
3523
|
);
|
|
3430
3524
|
};
|
|
3431
3525
|
|
|
3432
3526
|
// ../vuu-table/src/table-next/Row.tsx
|
|
3433
|
-
import { jsx as
|
|
3434
|
-
import { createElement } from "react";
|
|
3435
|
-
var { IDX:
|
|
3436
|
-
var
|
|
3527
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
3528
|
+
import { createElement as createElement3 } from "react";
|
|
3529
|
+
var { IDX: IDX4, IS_EXPANDED: IS_EXPANDED4, SELECTED: SELECTED3 } = metadataKeys14;
|
|
3530
|
+
var classBase15 = "vuuTableNextRow";
|
|
3437
3531
|
var Row2 = memo3(
|
|
3438
3532
|
({
|
|
3439
3533
|
className: classNameProp,
|
|
@@ -3442,15 +3536,17 @@ var Row2 = memo3(
|
|
|
3442
3536
|
row,
|
|
3443
3537
|
offset,
|
|
3444
3538
|
onClick,
|
|
3539
|
+
onDataEdited,
|
|
3445
3540
|
onToggleGroup,
|
|
3541
|
+
zebraStripes = false,
|
|
3446
3542
|
...htmlAttributes
|
|
3447
3543
|
}) => {
|
|
3448
3544
|
const {
|
|
3449
|
-
[
|
|
3545
|
+
[IDX4]: rowIndex,
|
|
3450
3546
|
[IS_EXPANDED4]: isExpanded,
|
|
3451
3547
|
[SELECTED3]: selectionStatus
|
|
3452
3548
|
} = row;
|
|
3453
|
-
const handleRowClick =
|
|
3549
|
+
const handleRowClick = useCallback34(
|
|
3454
3550
|
(evt) => {
|
|
3455
3551
|
const rangeSelect = evt.shiftKey;
|
|
3456
3552
|
const keepExistingSelection = evt.ctrlKey || evt.metaKey;
|
|
@@ -3458,51 +3554,87 @@ var Row2 = memo3(
|
|
|
3458
3554
|
},
|
|
3459
3555
|
[onClick, row]
|
|
3460
3556
|
);
|
|
3461
|
-
const { True, First, Last } =
|
|
3462
|
-
const className =
|
|
3463
|
-
[`${
|
|
3464
|
-
[`${
|
|
3465
|
-
[`${
|
|
3466
|
-
[`${
|
|
3467
|
-
[`${
|
|
3557
|
+
const { True: True2, First: First2, Last: Last2 } = RowSelected2;
|
|
3558
|
+
const className = cx22(classBase15, classNameProp, {
|
|
3559
|
+
[`${classBase15}-even`]: zebraStripes && rowIndex % 2 === 0,
|
|
3560
|
+
[`${classBase15}-expanded`]: isExpanded,
|
|
3561
|
+
[`${classBase15}-selected`]: selectionStatus & True2,
|
|
3562
|
+
[`${classBase15}-selectedStart`]: selectionStatus & First2,
|
|
3563
|
+
[`${classBase15}-selectedEnd`]: selectionStatus & Last2
|
|
3468
3564
|
});
|
|
3469
|
-
const style =
|
|
3470
|
-
|
|
3565
|
+
const style = { transform: `translate3d(0px, ${offset}px, 0px)` };
|
|
3566
|
+
const handleGroupCellClick = useCallback34(
|
|
3567
|
+
(evt, column) => {
|
|
3568
|
+
if (isGroupColumn4(column) || isJsonGroup3(column, row)) {
|
|
3569
|
+
evt.stopPropagation();
|
|
3570
|
+
onToggleGroup == null ? void 0 : onToggleGroup(row, column);
|
|
3571
|
+
}
|
|
3572
|
+
},
|
|
3573
|
+
[onToggleGroup, row]
|
|
3574
|
+
);
|
|
3575
|
+
return /* @__PURE__ */ createElement3(
|
|
3471
3576
|
"div",
|
|
3472
3577
|
{
|
|
3473
3578
|
...htmlAttributes,
|
|
3579
|
+
"aria-rowindex": row[0],
|
|
3474
3580
|
key: `row-${row[0]}`,
|
|
3475
3581
|
role: "row",
|
|
3476
3582
|
className,
|
|
3477
3583
|
onClick: handleRowClick,
|
|
3478
3584
|
style
|
|
3479
3585
|
},
|
|
3480
|
-
/* @__PURE__ */
|
|
3586
|
+
/* @__PURE__ */ jsx32("span", { className: `${classBase15}-selectionDecorator vuuStickyLeft` }),
|
|
3481
3587
|
columns.filter(notHidden3).map((column) => {
|
|
3482
3588
|
const isGroup = isGroupColumn4(column);
|
|
3589
|
+
const isJsonCell = isJsonColumn2(column);
|
|
3483
3590
|
const Cell = isGroup ? TableGroupCell2 : TableCell2;
|
|
3484
|
-
return /* @__PURE__ */
|
|
3591
|
+
return /* @__PURE__ */ jsx32(
|
|
3592
|
+
Cell,
|
|
3593
|
+
{
|
|
3594
|
+
column,
|
|
3595
|
+
columnMap,
|
|
3596
|
+
onClick: isGroup || isJsonCell ? handleGroupCellClick : void 0,
|
|
3597
|
+
onDataEdited,
|
|
3598
|
+
row
|
|
3599
|
+
},
|
|
3600
|
+
column.key
|
|
3601
|
+
);
|
|
3485
3602
|
}),
|
|
3486
|
-
/* @__PURE__ */
|
|
3603
|
+
/* @__PURE__ */ jsx32("span", { className: `${classBase15}-selectionDecorator vuuStickyRight` })
|
|
3487
3604
|
);
|
|
3488
3605
|
}
|
|
3489
3606
|
);
|
|
3490
3607
|
Row2.displayName = "Row";
|
|
3491
3608
|
|
|
3492
3609
|
// ../vuu-table/src/table-next/useTableNext.ts
|
|
3610
|
+
import { useLayoutEffectSkipFirst as useLayoutEffectSkipFirst2 } from "@vuu-ui/vuu-layout";
|
|
3611
|
+
import { useDragDropNext as useDragDrop2 } from "@vuu-ui/vuu-ui-controls";
|
|
3612
|
+
|
|
3613
|
+
// ../vuu-table/src/table-next/useKeyboardNavigation.ts
|
|
3493
3614
|
import {
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3615
|
+
useCallback as useCallback35,
|
|
3616
|
+
useEffect as useEffect10,
|
|
3617
|
+
useMemo as useMemo12,
|
|
3618
|
+
useRef as useRef29
|
|
3619
|
+
} from "react";
|
|
3620
|
+
|
|
3621
|
+
// ../vuu-table/src/table-next/useTableNext.ts
|
|
3498
3622
|
import {
|
|
3499
3623
|
applySort as applySort2,
|
|
3500
|
-
buildColumnMap as
|
|
3501
|
-
|
|
3624
|
+
buildColumnMap as buildColumnMap4,
|
|
3625
|
+
isGroupColumn as isGroupColumn6,
|
|
3626
|
+
isJsonGroup as isJsonGroup4,
|
|
3627
|
+
isValidNumber as isValidNumber5,
|
|
3628
|
+
metadataKeys as metadataKeys17,
|
|
3502
3629
|
updateColumn as updateColumn2,
|
|
3503
3630
|
visibleColumnAtIndex as visibleColumnAtIndex2
|
|
3504
3631
|
} from "@vuu-ui/vuu-utils";
|
|
3505
|
-
import {
|
|
3632
|
+
import {
|
|
3633
|
+
useCallback as useCallback41,
|
|
3634
|
+
useEffect as useEffect13,
|
|
3635
|
+
useMemo as useMemo15,
|
|
3636
|
+
useState as useState14
|
|
3637
|
+
} from "react";
|
|
3506
3638
|
|
|
3507
3639
|
// ../vuu-table/src/table-next/table-config.ts
|
|
3508
3640
|
var updateTableConfig = (config, action) => {
|
|
@@ -3527,82 +3659,265 @@ var updateTableConfig = (config, action) => {
|
|
|
3527
3659
|
};
|
|
3528
3660
|
|
|
3529
3661
|
// ../vuu-table/src/table-next/useDataSource.ts
|
|
3530
|
-
import {
|
|
3662
|
+
import {
|
|
3663
|
+
isVuuFeatureAction as isVuuFeatureAction2,
|
|
3664
|
+
isVuuFeatureInvocation as isVuuFeatureInvocation2
|
|
3665
|
+
} from "@vuu-ui/vuu-data-react/src";
|
|
3666
|
+
import { getFullRange as getFullRange2, NULL_RANGE } from "@vuu-ui/vuu-utils";
|
|
3667
|
+
import { useCallback as useCallback36, useEffect as useEffect11, useMemo as useMemo13, useRef as useRef30, useState as useState13 } from "react";
|
|
3668
|
+
|
|
3669
|
+
// ../vuu-table/src/table-next/moving-window.ts
|
|
3670
|
+
import { metadataKeys as metadataKeys15, WindowRange as WindowRange2 } from "@vuu-ui/vuu-utils";
|
|
3671
|
+
var { SELECTED: SELECTED4 } = metadataKeys15;
|
|
3531
3672
|
|
|
3532
3673
|
// ../vuu-table/src/table-next/useInitialValue.ts
|
|
3533
|
-
import { useMemo as
|
|
3674
|
+
import { useMemo as useMemo14, useRef as useRef31 } from "react";
|
|
3675
|
+
|
|
3676
|
+
// ../vuu-table/src/table-next/useTableContextMenu.ts
|
|
3677
|
+
import { buildColumnMap as buildColumnMap3 } from "@vuu-ui/vuu-utils";
|
|
3678
|
+
import { useCallback as useCallback37 } from "react";
|
|
3679
|
+
import { useContextMenu as usePopupContextMenu2 } from "@vuu-ui/vuu-popups";
|
|
3680
|
+
|
|
3681
|
+
// ../vuu-table/src/table-next/useCellEditing.ts
|
|
3682
|
+
import { isCharacterKey } from "@vuu-ui/vuu-utils";
|
|
3683
|
+
import { useCallback as useCallback38 } from "react";
|
|
3534
3684
|
|
|
3535
3685
|
// ../vuu-table/src/table-next/useTableModel.ts
|
|
3536
|
-
import { moveItem as moveItem4 } from "@vuu-ui/vuu-ui-controls";
|
|
3537
3686
|
import {
|
|
3538
3687
|
applyFilterToColumns as applyFilterToColumns2,
|
|
3539
3688
|
applyGroupByToColumns as applyGroupByToColumns2,
|
|
3540
3689
|
applySortToColumns as applySortToColumns2,
|
|
3541
|
-
findColumn as findColumn2,
|
|
3542
3690
|
getCellRenderer as getCellRenderer2,
|
|
3543
|
-
getColumnName as getColumnName3,
|
|
3544
3691
|
getTableHeadings as getTableHeadings2,
|
|
3545
3692
|
getValueFormatter as getValueFormatter2,
|
|
3693
|
+
hasValidationRules,
|
|
3546
3694
|
isFilteredColumn as isFilteredColumn2,
|
|
3547
3695
|
isGroupColumn as isGroupColumn5,
|
|
3548
3696
|
isPinned as isPinned2,
|
|
3549
|
-
isTypeDescriptor as
|
|
3697
|
+
isTypeDescriptor as isTypeDescriptor8,
|
|
3550
3698
|
logger,
|
|
3551
|
-
metadataKeys as
|
|
3699
|
+
metadataKeys as metadataKeys16,
|
|
3700
|
+
moveItem,
|
|
3552
3701
|
sortPinnedColumns as sortPinnedColumns2,
|
|
3553
|
-
stripFilterFromColumns as stripFilterFromColumns2
|
|
3702
|
+
stripFilterFromColumns as stripFilterFromColumns2,
|
|
3703
|
+
subscribedOnly
|
|
3554
3704
|
} from "@vuu-ui/vuu-utils";
|
|
3555
|
-
import {
|
|
3705
|
+
import { buildValidationChecker } from "@vuu-ui/vuu-ui-controls";
|
|
3706
|
+
import { useReducer as useReducer2 } from "react";
|
|
3556
3707
|
var { info } = logger("useTableModel");
|
|
3557
|
-
var KEY_OFFSET2 =
|
|
3708
|
+
var KEY_OFFSET2 = metadataKeys16.count;
|
|
3558
3709
|
|
|
3559
3710
|
// ../vuu-table/src/table-next/useTableScroll.ts
|
|
3560
|
-
import { useCallback as
|
|
3711
|
+
import { useCallback as useCallback39, useRef as useRef32 } from "react";
|
|
3561
3712
|
|
|
3562
3713
|
// ../vuu-table/src/table-next/useVirtualViewport.ts
|
|
3563
|
-
import { useCallback as
|
|
3714
|
+
import { useCallback as useCallback40, useEffect as useEffect12, useRef as useRef33 } from "react";
|
|
3715
|
+
|
|
3716
|
+
// ../vuu-table/src/table-next/useTableNext.ts
|
|
3717
|
+
var { KEY: KEY6, IS_EXPANDED: IS_EXPANDED5, IS_LEAF: IS_LEAF4 } = metadataKeys17;
|
|
3564
3718
|
|
|
3565
3719
|
// ../vuu-table/src/table-next/TableNext.tsx
|
|
3566
|
-
import {
|
|
3567
|
-
|
|
3720
|
+
import { MeasuredContainer, useId } from "@vuu-ui/vuu-layout";
|
|
3721
|
+
import { jsx as jsx33, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3722
|
+
import { createElement as createElement4 } from "react";
|
|
3723
|
+
var { IDX: IDX5, RENDER_IDX: RENDER_IDX2 } = metadataKeys18;
|
|
3724
|
+
|
|
3725
|
+
// ../vuu-table/src/table-next/cell-renderers/dropdown-cell/DropdownCell.tsx
|
|
3726
|
+
import {
|
|
3727
|
+
Dropdown as Dropdown3
|
|
3728
|
+
} from "@vuu-ui/vuu-ui-controls";
|
|
3729
|
+
import {
|
|
3730
|
+
isColumnTypeRenderer as isColumnTypeRenderer3,
|
|
3731
|
+
isTypeDescriptor as isTypeDescriptor9,
|
|
3732
|
+
registerComponent as registerComponent7
|
|
3733
|
+
} from "@vuu-ui/vuu-utils";
|
|
3734
|
+
import { useCallback as useCallback42, useState as useState15 } from "react";
|
|
3735
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
3736
|
+
var classBase16 = "vuuTableDropdownCell";
|
|
3737
|
+
var openKeys = ["Enter", " "];
|
|
3738
|
+
var DropdownCell = ({ column, columnMap, row }) => {
|
|
3739
|
+
var _a, _b, _c;
|
|
3740
|
+
const values = isTypeDescriptor9(column.type) && isColumnTypeRenderer3((_a = column.type) == null ? void 0 : _a.renderer) ? (_c = (_b = column.type) == null ? void 0 : _b.renderer) == null ? void 0 : _c.values : [];
|
|
3741
|
+
const dataIdx = columnMap[column.name];
|
|
3742
|
+
const [value, setValue] = useState15(row[dataIdx]);
|
|
3743
|
+
const handleSelectionChange = useCallback42(
|
|
3744
|
+
(evt, selectedItem) => {
|
|
3745
|
+
if (selectedItem) {
|
|
3746
|
+
setValue(selectedItem);
|
|
3747
|
+
}
|
|
3748
|
+
},
|
|
3749
|
+
[]
|
|
3750
|
+
);
|
|
3751
|
+
return /* @__PURE__ */ jsx34(
|
|
3752
|
+
Dropdown3,
|
|
3753
|
+
{
|
|
3754
|
+
className: classBase16,
|
|
3755
|
+
onSelectionChange: handleSelectionChange,
|
|
3756
|
+
openKeys,
|
|
3757
|
+
selected: value,
|
|
3758
|
+
source: values,
|
|
3759
|
+
width: column.width - 17
|
|
3760
|
+
}
|
|
3761
|
+
);
|
|
3762
|
+
};
|
|
3763
|
+
registerComponent7("dropdown-cell", DropdownCell, "cell-renderer", {});
|
|
3764
|
+
|
|
3765
|
+
// ../vuu-table/src/table-next/cell-renderers/input-cell/InputCell.tsx
|
|
3766
|
+
import { registerComponent as registerComponent8 } from "@vuu-ui/vuu-utils";
|
|
3767
|
+
import { Input as Input3 } from "@salt-ds/core";
|
|
3768
|
+
import { useEditableText } from "@vuu-ui/vuu-ui-controls";
|
|
3769
|
+
import cx24 from "classnames";
|
|
3770
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
3771
|
+
var classBase17 = "vuuTableInputCell";
|
|
3772
|
+
var WarnCommit = () => {
|
|
3773
|
+
console.warn(
|
|
3774
|
+
"onCommit handler has not been provided to InputCell cell renderer"
|
|
3775
|
+
);
|
|
3776
|
+
return true;
|
|
3777
|
+
};
|
|
3778
|
+
var InputCell = ({
|
|
3779
|
+
column,
|
|
3780
|
+
columnMap,
|
|
3781
|
+
onCommit = WarnCommit,
|
|
3782
|
+
row
|
|
3783
|
+
}) => {
|
|
3784
|
+
const dataIdx = columnMap[column.name];
|
|
3785
|
+
const {
|
|
3786
|
+
align = "left",
|
|
3787
|
+
clientSideEditValidationCheck,
|
|
3788
|
+
valueFormatter
|
|
3789
|
+
} = column;
|
|
3790
|
+
const { warningMessage, ...editProps } = useEditableText({
|
|
3791
|
+
initialValue: valueFormatter(row[dataIdx]),
|
|
3792
|
+
onCommit,
|
|
3793
|
+
clientSideEditValidationCheck
|
|
3794
|
+
});
|
|
3795
|
+
const endAdornment = warningMessage && align === "left" ? /* @__PURE__ */ jsx35("span", { className: `${classBase17}-icon`, "data-icon": "error" }) : void 0;
|
|
3796
|
+
const startAdornment = warningMessage && align === "right" ? /* @__PURE__ */ jsx35("span", { className: `${classBase17}-icon`, "data-icon": "error" }) : void 0;
|
|
3797
|
+
return /* @__PURE__ */ jsx35(
|
|
3798
|
+
Input3,
|
|
3799
|
+
{
|
|
3800
|
+
...editProps,
|
|
3801
|
+
className: cx24(classBase17, {
|
|
3802
|
+
[`${classBase17}-error`]: warningMessage !== void 0
|
|
3803
|
+
}),
|
|
3804
|
+
endAdornment,
|
|
3805
|
+
startAdornment
|
|
3806
|
+
}
|
|
3807
|
+
);
|
|
3808
|
+
};
|
|
3809
|
+
registerComponent8("input-cell", InputCell, "cell-renderer", {});
|
|
3568
3810
|
|
|
3569
3811
|
// src/table-settings/useTableSettings.ts
|
|
3570
|
-
import {
|
|
3812
|
+
import {
|
|
3813
|
+
addColumnToSubscribedColumns,
|
|
3814
|
+
isCalculatedColumn as isCalculatedColumn2,
|
|
3815
|
+
moveItem as moveItem2,
|
|
3816
|
+
subscribedOnly as subscribedOnly2
|
|
3817
|
+
} from "@vuu-ui/vuu-utils";
|
|
3818
|
+
import {
|
|
3819
|
+
useCallback as useCallback43,
|
|
3820
|
+
useMemo as useMemo16,
|
|
3821
|
+
useState as useState16
|
|
3822
|
+
} from "react";
|
|
3823
|
+
var sortOrderFromAvailableColumns = (availableColumns, columns) => {
|
|
3824
|
+
const sortedColumns = [];
|
|
3825
|
+
for (const { name: name2 } of availableColumns) {
|
|
3826
|
+
const column = columns.find((col) => col.name === name2);
|
|
3827
|
+
if (column) {
|
|
3828
|
+
sortedColumns.push(column);
|
|
3829
|
+
}
|
|
3830
|
+
}
|
|
3831
|
+
return sortedColumns;
|
|
3832
|
+
};
|
|
3571
3833
|
var buildColumnItems = (availableColumns, configuredColumns) => {
|
|
3572
|
-
return availableColumns.map(({ name, serverDataType }) => {
|
|
3573
|
-
const configuredColumn = configuredColumns.find((col) => col.name ===
|
|
3834
|
+
return availableColumns.map(({ name: name2, serverDataType }) => {
|
|
3835
|
+
const configuredColumn = configuredColumns.find((col) => col.name === name2);
|
|
3574
3836
|
return {
|
|
3575
3837
|
hidden: configuredColumn == null ? void 0 : configuredColumn.hidden,
|
|
3838
|
+
isCalculated: isCalculatedColumn2(name2),
|
|
3576
3839
|
label: configuredColumn == null ? void 0 : configuredColumn.label,
|
|
3577
|
-
name,
|
|
3840
|
+
name: name2,
|
|
3578
3841
|
serverDataType,
|
|
3579
3842
|
subscribed: configuredColumn !== void 0
|
|
3580
3843
|
};
|
|
3581
3844
|
});
|
|
3582
3845
|
};
|
|
3583
3846
|
var useTableSettings = ({
|
|
3584
|
-
availableColumns,
|
|
3847
|
+
availableColumns: availableColumnsProp,
|
|
3585
3848
|
onConfigChange,
|
|
3849
|
+
onDataSourceConfigChange,
|
|
3586
3850
|
tableConfig: tableConfigProp
|
|
3587
3851
|
}) => {
|
|
3588
|
-
const [tableConfig,
|
|
3589
|
-
|
|
3852
|
+
const [{ availableColumns, tableConfig }, setColumnState] = useState16({
|
|
3853
|
+
availableColumns: availableColumnsProp,
|
|
3854
|
+
tableConfig: tableConfigProp
|
|
3855
|
+
});
|
|
3856
|
+
const columnItems = useMemo16(
|
|
3590
3857
|
() => buildColumnItems(availableColumns, tableConfig.columns),
|
|
3591
3858
|
[availableColumns, tableConfig.columns]
|
|
3592
3859
|
);
|
|
3593
|
-
const handleMoveListItem =
|
|
3860
|
+
const handleMoveListItem = useCallback43(
|
|
3594
3861
|
(fromIndex, toIndex) => {
|
|
3595
|
-
|
|
3862
|
+
setColumnState((state) => {
|
|
3863
|
+
const newAvailableColumns = moveItem2(
|
|
3864
|
+
state.availableColumns,
|
|
3865
|
+
fromIndex,
|
|
3866
|
+
toIndex
|
|
3867
|
+
);
|
|
3868
|
+
const newColumns = sortOrderFromAvailableColumns(
|
|
3869
|
+
newAvailableColumns,
|
|
3870
|
+
tableConfig.columns
|
|
3871
|
+
);
|
|
3872
|
+
return {
|
|
3873
|
+
availableColumns: newAvailableColumns,
|
|
3874
|
+
tableConfig: {
|
|
3875
|
+
...state.tableConfig,
|
|
3876
|
+
columns: newColumns
|
|
3877
|
+
}
|
|
3878
|
+
};
|
|
3879
|
+
});
|
|
3596
3880
|
},
|
|
3597
|
-
[]
|
|
3881
|
+
[tableConfig.columns]
|
|
3598
3882
|
);
|
|
3599
|
-
const handleColumnChange =
|
|
3600
|
-
(
|
|
3601
|
-
const columnItem = columnItems.find((col) => col.name ===
|
|
3883
|
+
const handleColumnChange = useCallback43(
|
|
3884
|
+
(name2, property, value) => {
|
|
3885
|
+
const columnItem = columnItems.find((col) => col.name === name2);
|
|
3602
3886
|
if (property === "subscribed") {
|
|
3603
|
-
|
|
3887
|
+
if (columnItem == null ? void 0 : columnItem.subscribed) {
|
|
3888
|
+
const subscribedColumns = tableConfig.columns.filter((col) => col.name !== name2).map((col) => col.name);
|
|
3889
|
+
setColumnState((state) => ({
|
|
3890
|
+
...state,
|
|
3891
|
+
tableConfig: {
|
|
3892
|
+
...tableConfig,
|
|
3893
|
+
columns: tableConfig.columns.filter(
|
|
3894
|
+
subscribedOnly2(subscribedColumns)
|
|
3895
|
+
)
|
|
3896
|
+
}
|
|
3897
|
+
}));
|
|
3898
|
+
onDataSourceConfigChange({
|
|
3899
|
+
columns: subscribedColumns
|
|
3900
|
+
});
|
|
3901
|
+
} else {
|
|
3902
|
+
const newConfig = {
|
|
3903
|
+
...tableConfig,
|
|
3904
|
+
columns: addColumnToSubscribedColumns(
|
|
3905
|
+
tableConfig.columns,
|
|
3906
|
+
availableColumns,
|
|
3907
|
+
name2
|
|
3908
|
+
)
|
|
3909
|
+
};
|
|
3910
|
+
setColumnState((state) => ({
|
|
3911
|
+
...state,
|
|
3912
|
+
tableConfig: newConfig
|
|
3913
|
+
}));
|
|
3914
|
+
const subscribedColumns = newConfig.columns.map((col) => col.name);
|
|
3915
|
+
onDataSourceConfigChange({
|
|
3916
|
+
columns: subscribedColumns
|
|
3917
|
+
});
|
|
3918
|
+
}
|
|
3604
3919
|
} else if (columnItem == null ? void 0 : columnItem.subscribed) {
|
|
3605
|
-
const column = tableConfig.columns.find((col) => col.name ===
|
|
3920
|
+
const column = tableConfig.columns.find((col) => col.name === name2);
|
|
3606
3921
|
if (column) {
|
|
3607
3922
|
const newConfig = updateTableConfig(tableConfig, {
|
|
3608
3923
|
type: "column-prop",
|
|
@@ -3610,21 +3925,40 @@ var useTableSettings = ({
|
|
|
3610
3925
|
column,
|
|
3611
3926
|
value
|
|
3612
3927
|
});
|
|
3613
|
-
|
|
3928
|
+
setColumnState((state) => ({
|
|
3929
|
+
...state,
|
|
3930
|
+
tableConfig: newConfig
|
|
3931
|
+
}));
|
|
3614
3932
|
}
|
|
3615
3933
|
}
|
|
3616
3934
|
},
|
|
3617
|
-
[columnItems, tableConfig]
|
|
3935
|
+
[availableColumns, columnItems, onDataSourceConfigChange, tableConfig]
|
|
3618
3936
|
);
|
|
3619
|
-
const handleChangeColumnLabels =
|
|
3937
|
+
const handleChangeColumnLabels = useCallback43((evt) => {
|
|
3620
3938
|
const { value } = evt.target;
|
|
3621
3939
|
const columnFormatHeader = value === "0" ? void 0 : value === "1" ? "capitalize" : "uppercase";
|
|
3622
|
-
|
|
3623
|
-
...
|
|
3624
|
-
|
|
3940
|
+
setColumnState((state) => ({
|
|
3941
|
+
...state,
|
|
3942
|
+
tableConfig: {
|
|
3943
|
+
...state.tableConfig,
|
|
3944
|
+
columnFormatHeader
|
|
3945
|
+
}
|
|
3625
3946
|
}));
|
|
3626
3947
|
}, []);
|
|
3627
|
-
|
|
3948
|
+
const handleChangeTableAttribute = useCallback43(
|
|
3949
|
+
(evt) => {
|
|
3950
|
+
const { ariaChecked, value } = evt.target;
|
|
3951
|
+
setColumnState((state) => ({
|
|
3952
|
+
...state,
|
|
3953
|
+
tableConfig: {
|
|
3954
|
+
...state.tableConfig,
|
|
3955
|
+
[value]: ariaChecked !== "true"
|
|
3956
|
+
}
|
|
3957
|
+
}));
|
|
3958
|
+
},
|
|
3959
|
+
[]
|
|
3960
|
+
);
|
|
3961
|
+
useLayoutEffectSkipFirst3(() => {
|
|
3628
3962
|
onConfigChange == null ? void 0 : onConfigChange(tableConfig);
|
|
3629
3963
|
}, [onConfigChange, tableConfig]);
|
|
3630
3964
|
const columnLabelsValue = tableConfig.columnFormatHeader === void 0 ? 0 : tableConfig.columnFormatHeader === "capitalize" ? 1 : 2;
|
|
@@ -3632,59 +3966,66 @@ var useTableSettings = ({
|
|
|
3632
3966
|
columnItems,
|
|
3633
3967
|
columnLabelsValue,
|
|
3634
3968
|
onChangeColumnLabels: handleChangeColumnLabels,
|
|
3969
|
+
onChangeTableAttribute: handleChangeTableAttribute,
|
|
3635
3970
|
onColumnChange: handleColumnChange,
|
|
3636
|
-
onMoveListItem: handleMoveListItem
|
|
3971
|
+
onMoveListItem: handleMoveListItem,
|
|
3972
|
+
tableConfig
|
|
3637
3973
|
};
|
|
3638
3974
|
};
|
|
3639
3975
|
|
|
3640
3976
|
// src/table-settings/TableSettingsPanel.tsx
|
|
3641
|
-
import { jsx as
|
|
3642
|
-
var
|
|
3977
|
+
import { jsx as jsx36, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3978
|
+
var classBase18 = "vuuTableSettingsPanel";
|
|
3643
3979
|
var TableSettingsPanel = ({
|
|
3644
3980
|
availableColumns,
|
|
3981
|
+
onAddCalculatedColumn,
|
|
3645
3982
|
onConfigChange,
|
|
3646
|
-
|
|
3983
|
+
onDataSourceConfigChange,
|
|
3984
|
+
tableConfig: tableConfigProp,
|
|
3647
3985
|
...htmlAttributes
|
|
3648
3986
|
}) => {
|
|
3649
3987
|
const {
|
|
3650
3988
|
columnItems,
|
|
3651
3989
|
columnLabelsValue,
|
|
3652
3990
|
onChangeColumnLabels,
|
|
3991
|
+
onChangeTableAttribute,
|
|
3653
3992
|
onColumnChange,
|
|
3654
|
-
onMoveListItem
|
|
3993
|
+
onMoveListItem,
|
|
3994
|
+
tableConfig
|
|
3655
3995
|
} = useTableSettings({
|
|
3656
3996
|
availableColumns,
|
|
3657
3997
|
onConfigChange,
|
|
3658
|
-
|
|
3998
|
+
onDataSourceConfigChange,
|
|
3999
|
+
tableConfig: tableConfigProp
|
|
3659
4000
|
});
|
|
3660
|
-
return /* @__PURE__ */
|
|
3661
|
-
/* @__PURE__ */
|
|
3662
|
-
/* @__PURE__ */
|
|
3663
|
-
/* @__PURE__ */
|
|
3664
|
-
|
|
4001
|
+
return /* @__PURE__ */ jsxs26("div", { ...htmlAttributes, className: classBase18, children: [
|
|
4002
|
+
/* @__PURE__ */ jsxs26(FormField5, { children: [
|
|
4003
|
+
/* @__PURE__ */ jsx36(FormFieldLabel5, { children: "Column Labels" }),
|
|
4004
|
+
/* @__PURE__ */ jsxs26(
|
|
4005
|
+
ToggleButtonGroup2,
|
|
3665
4006
|
{
|
|
3666
4007
|
className: "vuuToggleButtonGroup",
|
|
3667
4008
|
onChange: onChangeColumnLabels,
|
|
3668
4009
|
value: columnLabelsValue,
|
|
3669
4010
|
children: [
|
|
3670
|
-
/* @__PURE__ */
|
|
3671
|
-
|
|
4011
|
+
/* @__PURE__ */ jsx36(
|
|
4012
|
+
ToggleButton2,
|
|
3672
4013
|
{
|
|
3673
4014
|
className: "vuuIconToggleButton",
|
|
3674
4015
|
"data-icon": "text-strikethrough",
|
|
3675
4016
|
value: 0
|
|
3676
4017
|
}
|
|
3677
4018
|
),
|
|
3678
|
-
/* @__PURE__ */
|
|
3679
|
-
|
|
4019
|
+
/* @__PURE__ */ jsx36(
|
|
4020
|
+
ToggleButton2,
|
|
3680
4021
|
{
|
|
3681
4022
|
className: "vuuIconToggleButton",
|
|
3682
4023
|
"data-icon": "text-Tt",
|
|
3683
4024
|
value: 1
|
|
3684
4025
|
}
|
|
3685
4026
|
),
|
|
3686
|
-
/* @__PURE__ */
|
|
3687
|
-
|
|
4027
|
+
/* @__PURE__ */ jsx36(
|
|
4028
|
+
ToggleButton2,
|
|
3688
4029
|
{
|
|
3689
4030
|
className: "vuuIconToggleButton",
|
|
3690
4031
|
"data-icon": "text-T",
|
|
@@ -3695,26 +4036,173 @@ var TableSettingsPanel = ({
|
|
|
3695
4036
|
}
|
|
3696
4037
|
)
|
|
3697
4038
|
] }),
|
|
3698
|
-
/* @__PURE__ */
|
|
3699
|
-
/* @__PURE__ */
|
|
3700
|
-
/* @__PURE__ */
|
|
4039
|
+
/* @__PURE__ */ jsxs26(FormField5, { children: [
|
|
4040
|
+
/* @__PURE__ */ jsx36(FormFieldLabel5, { children: "Grid separators" }),
|
|
4041
|
+
/* @__PURE__ */ jsxs26("div", { className: "saltToggleButtonGroup vuuToggleButtonGroup saltToggleButtonGroup-horizontal vuuGridSeparators", children: [
|
|
4042
|
+
/* @__PURE__ */ jsx36(
|
|
4043
|
+
ToggleButton2,
|
|
4044
|
+
{
|
|
4045
|
+
className: "vuuIconToggleButton",
|
|
4046
|
+
"data-icon": "row-striping",
|
|
4047
|
+
selected: tableConfig.zebraStripes,
|
|
4048
|
+
onChange: onChangeTableAttribute,
|
|
4049
|
+
value: "zebraStripes"
|
|
4050
|
+
}
|
|
4051
|
+
),
|
|
4052
|
+
/* @__PURE__ */ jsx36(
|
|
4053
|
+
ToggleButton2,
|
|
4054
|
+
{
|
|
4055
|
+
className: "vuuIconToggleButton",
|
|
4056
|
+
"data-icon": "row-lines",
|
|
4057
|
+
selected: tableConfig.rowSeparators,
|
|
4058
|
+
onChange: onChangeTableAttribute,
|
|
4059
|
+
value: "rowSeparators"
|
|
4060
|
+
}
|
|
4061
|
+
),
|
|
4062
|
+
/* @__PURE__ */ jsx36(
|
|
4063
|
+
ToggleButton2,
|
|
4064
|
+
{
|
|
4065
|
+
className: "vuuIconToggleButton",
|
|
4066
|
+
"data-icon": "col-lines",
|
|
4067
|
+
selected: tableConfig.columnSeparators,
|
|
4068
|
+
onChange: onChangeTableAttribute,
|
|
4069
|
+
value: "columnSeparators"
|
|
4070
|
+
}
|
|
4071
|
+
)
|
|
4072
|
+
] })
|
|
4073
|
+
] }),
|
|
4074
|
+
/* @__PURE__ */ jsxs26(FormField5, { children: [
|
|
4075
|
+
/* @__PURE__ */ jsx36(FormFieldLabel5, { children: "Default Column Width" }),
|
|
4076
|
+
/* @__PURE__ */ jsx36(Input4, { className: "vuuInput" })
|
|
3701
4077
|
] }),
|
|
3702
|
-
/* @__PURE__ */
|
|
4078
|
+
/* @__PURE__ */ jsx36(
|
|
3703
4079
|
ColumnList,
|
|
3704
4080
|
{
|
|
3705
4081
|
columnItems,
|
|
3706
4082
|
onChange: onColumnChange,
|
|
3707
4083
|
onMoveListItem
|
|
3708
4084
|
}
|
|
3709
|
-
)
|
|
4085
|
+
),
|
|
4086
|
+
/* @__PURE__ */ jsxs26("div", { className: `${classBase18}-calculatedButtonbar`, children: [
|
|
4087
|
+
/* @__PURE__ */ jsx36(Button4, { "data-icon": "plus", onClick: onAddCalculatedColumn }),
|
|
4088
|
+
/* @__PURE__ */ jsx36("span", { className: `${classBase18}-calculatedLabel`, children: "Add calculated column" })
|
|
4089
|
+
] })
|
|
3710
4090
|
] });
|
|
3711
4091
|
};
|
|
4092
|
+
|
|
4093
|
+
// src/useTableAndColumnSettings.ts
|
|
4094
|
+
import { useLayoutProviderDispatch } from "@vuu-ui/vuu-layout";
|
|
4095
|
+
import { getCalculatedColumnType as getCalculatedColumnType2 } from "@vuu-ui/vuu-utils";
|
|
4096
|
+
import { useCallback as useCallback44, useRef as useRef35, useState as useState17 } from "react";
|
|
4097
|
+
var useTableAndColumnSettings = ({
|
|
4098
|
+
availableColumns: availableColumnsProps,
|
|
4099
|
+
onAvailableColumnsChange,
|
|
4100
|
+
onConfigChange,
|
|
4101
|
+
onCreateCalculatedColumn,
|
|
4102
|
+
onDataSourceConfigChange,
|
|
4103
|
+
tableConfig
|
|
4104
|
+
}) => {
|
|
4105
|
+
const dispatchLayoutAction = useLayoutProviderDispatch();
|
|
4106
|
+
const showTableSettingsRef = useRef35();
|
|
4107
|
+
const [availableColumns, setAvailableColumns] = useState17(
|
|
4108
|
+
availableColumnsProps
|
|
4109
|
+
);
|
|
4110
|
+
const showContextPanel = useCallback44(
|
|
4111
|
+
(componentType, title, props) => {
|
|
4112
|
+
dispatchLayoutAction({
|
|
4113
|
+
type: "set-props",
|
|
4114
|
+
path: "#context-panel",
|
|
4115
|
+
props: {
|
|
4116
|
+
expanded: true,
|
|
4117
|
+
content: {
|
|
4118
|
+
type: componentType,
|
|
4119
|
+
props
|
|
4120
|
+
},
|
|
4121
|
+
title
|
|
4122
|
+
}
|
|
4123
|
+
});
|
|
4124
|
+
},
|
|
4125
|
+
[dispatchLayoutAction]
|
|
4126
|
+
);
|
|
4127
|
+
const handleCreateCalculatedColumn = useCallback44(
|
|
4128
|
+
(column) => {
|
|
4129
|
+
const newAvailableColumns = availableColumns.concat({
|
|
4130
|
+
name: column.name,
|
|
4131
|
+
serverDataType: getCalculatedColumnType2(column)
|
|
4132
|
+
});
|
|
4133
|
+
setAvailableColumns(newAvailableColumns);
|
|
4134
|
+
onAvailableColumnsChange == null ? void 0 : onAvailableColumnsChange(newAvailableColumns);
|
|
4135
|
+
requestAnimationFrame(() => {
|
|
4136
|
+
var _a;
|
|
4137
|
+
(_a = showTableSettingsRef.current) == null ? void 0 : _a.call(showTableSettingsRef);
|
|
4138
|
+
});
|
|
4139
|
+
onCreateCalculatedColumn(column);
|
|
4140
|
+
},
|
|
4141
|
+
[availableColumns, onAvailableColumnsChange, onCreateCalculatedColumn]
|
|
4142
|
+
);
|
|
4143
|
+
const showColumnSettingsPanel = useCallback44(
|
|
4144
|
+
(action) => {
|
|
4145
|
+
showContextPanel("ColumnSettings", "Column Settings", {
|
|
4146
|
+
column: action.column,
|
|
4147
|
+
onConfigChange,
|
|
4148
|
+
onCreateCalculatedColumn: handleCreateCalculatedColumn,
|
|
4149
|
+
tableConfig,
|
|
4150
|
+
vuuTable: action.vuuTable
|
|
4151
|
+
});
|
|
4152
|
+
},
|
|
4153
|
+
[
|
|
4154
|
+
handleCreateCalculatedColumn,
|
|
4155
|
+
onConfigChange,
|
|
4156
|
+
showContextPanel,
|
|
4157
|
+
tableConfig
|
|
4158
|
+
]
|
|
4159
|
+
);
|
|
4160
|
+
const handleAddCalculatedColumn = useCallback44(() => {
|
|
4161
|
+
showColumnSettingsPanel({
|
|
4162
|
+
column: {
|
|
4163
|
+
name: "::",
|
|
4164
|
+
serverDataType: "string"
|
|
4165
|
+
},
|
|
4166
|
+
type: "columnSettings",
|
|
4167
|
+
vuuTable: { module: "SIMUL", table: "instruments" }
|
|
4168
|
+
});
|
|
4169
|
+
}, [showColumnSettingsPanel]);
|
|
4170
|
+
showTableSettingsRef.current = useCallback44(() => {
|
|
4171
|
+
showContextPanel("TableSettings", "DataGrid Settings", {
|
|
4172
|
+
availableColumns: availableColumns != null ? availableColumns : tableConfig.columns.map(({ name: name2, serverDataType }) => ({
|
|
4173
|
+
name: name2,
|
|
4174
|
+
serverDataType
|
|
4175
|
+
})),
|
|
4176
|
+
onAddCalculatedColumn: handleAddCalculatedColumn,
|
|
4177
|
+
onConfigChange,
|
|
4178
|
+
onDataSourceConfigChange,
|
|
4179
|
+
tableConfig
|
|
4180
|
+
});
|
|
4181
|
+
}, [
|
|
4182
|
+
availableColumns,
|
|
4183
|
+
handleAddCalculatedColumn,
|
|
4184
|
+
onConfigChange,
|
|
4185
|
+
onDataSourceConfigChange,
|
|
4186
|
+
showContextPanel,
|
|
4187
|
+
tableConfig
|
|
4188
|
+
]);
|
|
4189
|
+
return {
|
|
4190
|
+
showColumnSettingsPanel,
|
|
4191
|
+
showTableSettingsPanel: showTableSettingsRef.current
|
|
4192
|
+
};
|
|
4193
|
+
};
|
|
3712
4194
|
export {
|
|
4195
|
+
BackgroundCell2 as BackgroundCell,
|
|
4196
|
+
CaseValidator,
|
|
3713
4197
|
ColumnExpressionInput,
|
|
4198
|
+
ColumnExpressionPanel,
|
|
4199
|
+
ColumnFormattingPanel,
|
|
3714
4200
|
ColumnList,
|
|
3715
4201
|
ColumnNamedTerms,
|
|
4202
|
+
ColumnSettingsPanel,
|
|
3716
4203
|
DataSourceStats,
|
|
3717
|
-
|
|
4204
|
+
NumericFormattingSettings,
|
|
4205
|
+
PatternValidator,
|
|
3718
4206
|
TableSettingsPanel,
|
|
3719
4207
|
columnExpressionLanguageSupport,
|
|
3720
4208
|
isCompleteExpression,
|
|
@@ -3722,6 +4210,7 @@ export {
|
|
|
3722
4210
|
lastNamedChild,
|
|
3723
4211
|
useColumnExpressionEditor,
|
|
3724
4212
|
useColumnExpressionSuggestionProvider,
|
|
4213
|
+
useTableAndColumnSettings,
|
|
3725
4214
|
useTableSettings,
|
|
3726
4215
|
walkTree
|
|
3727
4216
|
};
|