@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/cjs/index.js
CHANGED
|
@@ -6,8 +6,8 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __export = (target, all) => {
|
|
9
|
-
for (var
|
|
10
|
-
__defProp(target,
|
|
9
|
+
for (var name2 in all)
|
|
10
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
11
11
|
};
|
|
12
12
|
var __copyProps = (to, from, except, desc) => {
|
|
13
13
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -48,11 +48,17 @@ var __privateSet = (obj, member, value, setter) => {
|
|
|
48
48
|
// src/index.ts
|
|
49
49
|
var src_exports = {};
|
|
50
50
|
__export(src_exports, {
|
|
51
|
+
BackgroundCell: () => BackgroundCell2,
|
|
52
|
+
CaseValidator: () => CaseValidator,
|
|
51
53
|
ColumnExpressionInput: () => ColumnExpressionInput,
|
|
54
|
+
ColumnExpressionPanel: () => ColumnExpressionPanel,
|
|
55
|
+
ColumnFormattingPanel: () => ColumnFormattingPanel,
|
|
52
56
|
ColumnList: () => ColumnList,
|
|
53
57
|
ColumnNamedTerms: () => ColumnNamedTerms,
|
|
58
|
+
ColumnSettingsPanel: () => ColumnSettingsPanel,
|
|
54
59
|
DataSourceStats: () => DataSourceStats,
|
|
55
|
-
|
|
60
|
+
NumericFormattingSettings: () => NumericFormattingSettings,
|
|
61
|
+
PatternValidator: () => PatternValidator,
|
|
56
62
|
TableSettingsPanel: () => TableSettingsPanel,
|
|
57
63
|
columnExpressionLanguageSupport: () => columnExpressionLanguageSupport,
|
|
58
64
|
isCompleteExpression: () => isCompleteExpression,
|
|
@@ -60,17 +66,60 @@ __export(src_exports, {
|
|
|
60
66
|
lastNamedChild: () => lastNamedChild,
|
|
61
67
|
useColumnExpressionEditor: () => useColumnExpressionEditor,
|
|
62
68
|
useColumnExpressionSuggestionProvider: () => useColumnExpressionSuggestionProvider,
|
|
69
|
+
useTableAndColumnSettings: () => useTableAndColumnSettings,
|
|
63
70
|
useTableSettings: () => useTableSettings,
|
|
64
71
|
walkTree: () => walkTree
|
|
65
72
|
});
|
|
66
73
|
module.exports = __toCommonJS(src_exports);
|
|
67
74
|
|
|
68
|
-
// src/cell-
|
|
75
|
+
// src/cell-edit-validators/CaseValidator.ts
|
|
76
|
+
var import_vuu_utils = require("@vuu-ui/vuu-utils");
|
|
77
|
+
var isString = (value) => typeof value === "string";
|
|
78
|
+
var CaseValidator = (rule, value) => {
|
|
79
|
+
if (isString(value)) {
|
|
80
|
+
if (value === "") {
|
|
81
|
+
return true;
|
|
82
|
+
} else if (rule.value === "lower" && value.toLowerCase() !== value) {
|
|
83
|
+
return "value must be all lowercase";
|
|
84
|
+
} else if (rule.value === "upper" && value.toUpperCase() !== value) {
|
|
85
|
+
return "value must be all uppercase";
|
|
86
|
+
} else {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
return "value must be a string";
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
(0, import_vuu_utils.registerComponent)("vuu-case", CaseValidator, "data-edit-validator", {});
|
|
94
|
+
|
|
95
|
+
// src/cell-edit-validators/PatternValidator.ts
|
|
69
96
|
var import_vuu_utils2 = require("@vuu-ui/vuu-utils");
|
|
97
|
+
var isString2 = (value) => typeof value === "string";
|
|
98
|
+
var defaultMessage = "value does not match expected pattern";
|
|
99
|
+
var PatternValidator = (rule, value) => {
|
|
100
|
+
if (typeof rule.value !== "string") {
|
|
101
|
+
throw Error("Pattern validation rule must provide pattern");
|
|
102
|
+
}
|
|
103
|
+
if (isString2(value)) {
|
|
104
|
+
if (value === "") {
|
|
105
|
+
return true;
|
|
106
|
+
} else {
|
|
107
|
+
const { message = defaultMessage } = rule;
|
|
108
|
+
const pattern = new RegExp(rule.value);
|
|
109
|
+
return pattern.test(value) || message;
|
|
110
|
+
}
|
|
111
|
+
} else {
|
|
112
|
+
return "value must be a string";
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
(0, import_vuu_utils2.registerComponent)("vuu-pattern", PatternValidator, "data-edit-validator", {});
|
|
116
|
+
|
|
117
|
+
// src/cell-renderers/background-cell/BackgroundCell.tsx
|
|
118
|
+
var import_vuu_utils4 = require("@vuu-ui/vuu-utils");
|
|
70
119
|
var import_classnames = __toESM(require("classnames"), 1);
|
|
71
120
|
|
|
72
121
|
// src/cell-renderers/background-cell/useDirection.ts
|
|
73
|
-
var
|
|
122
|
+
var import_vuu_utils3 = require("@vuu-ui/vuu-utils");
|
|
74
123
|
var import_react = require("react");
|
|
75
124
|
var INITIAL_VALUE = [void 0, void 0, void 0, void 0];
|
|
76
125
|
function useDirection(key, value, column) {
|
|
@@ -78,8 +127,8 @@ function useDirection(key, value, column) {
|
|
|
78
127
|
const ref = (0, import_react.useRef)();
|
|
79
128
|
const [prevKey, prevValue, prevColumn, prevDirection] = ref.current || INITIAL_VALUE;
|
|
80
129
|
const { type: dataType } = column;
|
|
81
|
-
const decimals = (0,
|
|
82
|
-
const direction = key === prevKey && (0,
|
|
130
|
+
const decimals = (0, import_vuu_utils3.isTypeDescriptor)(dataType) ? (_a = dataType.formatting) == null ? void 0 : _a.decimals : void 0;
|
|
131
|
+
const direction = key === prevKey && (0, import_vuu_utils3.isValidNumber)(value) && (0, import_vuu_utils3.isValidNumber)(prevValue) && column === prevColumn ? (0, import_vuu_utils3.getMovingValueDirection)(value, prevDirection, prevValue, decimals) : "";
|
|
83
132
|
(0, import_react.useEffect)(() => {
|
|
84
133
|
ref.current = [key, value, column, direction];
|
|
85
134
|
});
|
|
@@ -90,15 +139,15 @@ function useDirection(key, value, column) {
|
|
|
90
139
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
91
140
|
var CHAR_ARROW_UP = String.fromCharCode(11014);
|
|
92
141
|
var CHAR_ARROW_DOWN = String.fromCharCode(11015);
|
|
93
|
-
var { KEY } =
|
|
94
|
-
var classBase = "
|
|
142
|
+
var { KEY } = import_vuu_utils4.metadataKeys;
|
|
143
|
+
var classBase = "vuuBackgroundCellDeprecated";
|
|
95
144
|
var FlashStyle = {
|
|
96
145
|
ArrowOnly: "arrow",
|
|
97
146
|
BackgroundOnly: "bg-only",
|
|
98
147
|
ArrowBackground: "arrow-bg"
|
|
99
148
|
};
|
|
100
149
|
var getFlashStyle = (colType) => {
|
|
101
|
-
if ((0,
|
|
150
|
+
if ((0, import_vuu_utils4.isTypeDescriptor)(colType) && colType.renderer) {
|
|
102
151
|
if ("flashStyle" in colType.renderer) {
|
|
103
152
|
return colType.renderer["flashStyle"];
|
|
104
153
|
}
|
|
@@ -110,7 +159,7 @@ var BackgroundCell = ({ column, row }) => {
|
|
|
110
159
|
const value = row[key];
|
|
111
160
|
const flashStyle = getFlashStyle(type);
|
|
112
161
|
const direction = useDirection(row[KEY], value, column);
|
|
113
|
-
const arrow = flashStyle === FlashStyle.ArrowOnly || flashStyle === FlashStyle.ArrowBackground ? direction ===
|
|
162
|
+
const arrow = flashStyle === FlashStyle.ArrowOnly || flashStyle === FlashStyle.ArrowBackground ? direction === import_vuu_utils4.UP1 || direction === import_vuu_utils4.UP2 ? CHAR_ARROW_UP : direction === import_vuu_utils4.DOWN1 || direction === import_vuu_utils4.DOWN2 ? CHAR_ARROW_DOWN : null : null;
|
|
114
163
|
const dirClass = direction ? ` ` + direction : "";
|
|
115
164
|
const className = (0, import_classnames.default)(classBase, dirClass, {
|
|
116
165
|
[`${classBase}-arrowOnly`]: flashStyle === FlashStyle.ArrowOnly,
|
|
@@ -121,12 +170,14 @@ var BackgroundCell = ({ column, row }) => {
|
|
|
121
170
|
valueFormatter(row[column.key])
|
|
122
171
|
] });
|
|
123
172
|
};
|
|
124
|
-
(0,
|
|
173
|
+
(0, import_vuu_utils4.registerComponent)("background", BackgroundCell, "cell-renderer", {
|
|
174
|
+
description: "Background Cell renderer for VuuTable",
|
|
175
|
+
label: "Background Cell (deprecated)",
|
|
125
176
|
serverDataType: ["long", "int", "double"]
|
|
126
177
|
});
|
|
127
178
|
|
|
128
179
|
// src/cell-renderers/progress-cell/ProgressCell.tsx
|
|
129
|
-
var
|
|
180
|
+
var import_vuu_utils5 = require("@vuu-ui/vuu-utils");
|
|
130
181
|
var import_classnames2 = __toESM(require("classnames"), 1);
|
|
131
182
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
132
183
|
var classBase2 = "vuuProgressCell";
|
|
@@ -135,24 +186,29 @@ var ProgressCell = ({ column, columnMap, row }) => {
|
|
|
135
186
|
const value = row[column.key];
|
|
136
187
|
let showProgress = false;
|
|
137
188
|
let percentage = 0;
|
|
138
|
-
if ((0,
|
|
189
|
+
if ((0, import_vuu_utils5.isTypeDescriptor)(type) && (0, import_vuu_utils5.isColumnTypeRenderer)(type.renderer)) {
|
|
139
190
|
const { associatedField } = type.renderer;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const
|
|
148
|
-
if (Number.isFinite(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
191
|
+
if (associatedField) {
|
|
192
|
+
const associatedValue = row[columnMap[associatedField]];
|
|
193
|
+
if (typeof (0, import_vuu_utils5.isValidNumber)(value) && (0, import_vuu_utils5.isValidNumber)(associatedValue)) {
|
|
194
|
+
percentage = Math.min(Math.round(value / associatedValue * 100), 100);
|
|
195
|
+
percentage = Math.min(Math.round(value / associatedValue * 100), 100);
|
|
196
|
+
showProgress = isFinite(percentage);
|
|
197
|
+
} else {
|
|
198
|
+
const floatValue = parseFloat(value);
|
|
199
|
+
if (Number.isFinite(floatValue)) {
|
|
200
|
+
const floatOtherValue = parseFloat(associatedValue);
|
|
201
|
+
if (Number.isFinite(floatOtherValue)) {
|
|
202
|
+
percentage = Math.min(
|
|
203
|
+
Math.round(floatValue / floatOtherValue * 100),
|
|
204
|
+
100
|
|
205
|
+
);
|
|
206
|
+
showProgress = isFinite(percentage);
|
|
207
|
+
}
|
|
154
208
|
}
|
|
155
209
|
}
|
|
210
|
+
} else {
|
|
211
|
+
throw Error("ProgressCell associatedField is required to render");
|
|
156
212
|
}
|
|
157
213
|
}
|
|
158
214
|
const className = (0, import_classnames2.default)(classBase2, {});
|
|
@@ -170,7 +226,72 @@ var ProgressCell = ({ column, columnMap, row }) => {
|
|
|
170
226
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: `${classBase2}-text`, children: `${percentage} %` })
|
|
171
227
|
] });
|
|
172
228
|
};
|
|
173
|
-
(0,
|
|
229
|
+
(0, import_vuu_utils5.registerComponent)("vuu.progress", ProgressCell, "cell-renderer", {
|
|
230
|
+
description: "Progress formatter",
|
|
231
|
+
label: "Progress formatter",
|
|
232
|
+
serverDataType: ["long", "int", "double"]
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
// src/cell-renderers-next/background-cell/BackgroundCell.tsx
|
|
236
|
+
var import_vuu_utils7 = require("@vuu-ui/vuu-utils");
|
|
237
|
+
var import_classnames3 = __toESM(require("classnames"), 1);
|
|
238
|
+
|
|
239
|
+
// src/cell-renderers-next/background-cell/useDirection.ts
|
|
240
|
+
var import_vuu_utils6 = require("@vuu-ui/vuu-utils");
|
|
241
|
+
var import_react2 = require("react");
|
|
242
|
+
var INITIAL_VALUE2 = [void 0, void 0, void 0, void 0];
|
|
243
|
+
function useDirection2(key, value, column) {
|
|
244
|
+
var _a;
|
|
245
|
+
const ref = (0, import_react2.useRef)();
|
|
246
|
+
const [prevKey, prevValue, prevColumn, prevDirection] = ref.current || INITIAL_VALUE2;
|
|
247
|
+
const { type: dataType } = column;
|
|
248
|
+
const decimals = (0, import_vuu_utils6.isTypeDescriptor)(dataType) ? (_a = dataType.formatting) == null ? void 0 : _a.decimals : void 0;
|
|
249
|
+
const direction = key === prevKey && (0, import_vuu_utils6.isValidNumber)(value) && (0, import_vuu_utils6.isValidNumber)(prevValue) && column === prevColumn ? (0, import_vuu_utils6.getMovingValueDirection)(value, prevDirection, prevValue, decimals) : "";
|
|
250
|
+
(0, import_react2.useEffect)(() => {
|
|
251
|
+
ref.current = [key, value, column, direction];
|
|
252
|
+
});
|
|
253
|
+
return direction;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// src/cell-renderers-next/background-cell/BackgroundCell.tsx
|
|
257
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
258
|
+
var CHAR_ARROW_UP2 = String.fromCharCode(11014);
|
|
259
|
+
var CHAR_ARROW_DOWN2 = String.fromCharCode(11015);
|
|
260
|
+
var { KEY: KEY2 } = import_vuu_utils7.metadataKeys;
|
|
261
|
+
var classBase3 = "vuuBackgroundCell";
|
|
262
|
+
var FlashStyle2 = {
|
|
263
|
+
ArrowOnly: "arrow",
|
|
264
|
+
BackgroundOnly: "bg-only",
|
|
265
|
+
ArrowBackground: "arrow-bg"
|
|
266
|
+
};
|
|
267
|
+
var getFlashStyle2 = (colType) => {
|
|
268
|
+
if ((0, import_vuu_utils7.isTypeDescriptor)(colType) && colType.renderer) {
|
|
269
|
+
if ("flashStyle" in colType.renderer) {
|
|
270
|
+
return colType.renderer["flashStyle"];
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return FlashStyle2.BackgroundOnly;
|
|
274
|
+
};
|
|
275
|
+
var BackgroundCell2 = ({ column, row }) => {
|
|
276
|
+
const { key, type, valueFormatter } = column;
|
|
277
|
+
const value = row[key];
|
|
278
|
+
const flashStyle = getFlashStyle2(type);
|
|
279
|
+
const direction = useDirection2(row[KEY2], value, column);
|
|
280
|
+
const arrow = flashStyle === FlashStyle2.ArrowOnly || flashStyle === FlashStyle2.ArrowBackground ? direction === import_vuu_utils7.UP1 || direction === import_vuu_utils7.UP2 ? CHAR_ARROW_UP2 : direction === import_vuu_utils7.DOWN1 || direction === import_vuu_utils7.DOWN2 ? CHAR_ARROW_DOWN2 : null : null;
|
|
281
|
+
const dirClass = direction ? ` ` + direction : "";
|
|
282
|
+
const className = (0, import_classnames3.default)(classBase3, dirClass, {
|
|
283
|
+
[`${classBase3}-arrowOnly`]: flashStyle === FlashStyle2.ArrowOnly,
|
|
284
|
+
[`${classBase3}-arrowBackground`]: flashStyle === FlashStyle2.ArrowBackground
|
|
285
|
+
});
|
|
286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className, tabIndex: -1, children: [
|
|
287
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: `${classBase3}-flasher`, children: arrow }),
|
|
288
|
+
valueFormatter(row[column.key])
|
|
289
|
+
] });
|
|
290
|
+
};
|
|
291
|
+
console.log("register BackgroundCellNext");
|
|
292
|
+
(0, import_vuu_utils7.registerComponent)("background-next", BackgroundCell2, "cell-renderer", {
|
|
293
|
+
description: "Change background color of cell when value changes",
|
|
294
|
+
label: "Background Flash",
|
|
174
295
|
serverDataType: ["long", "int", "double"]
|
|
175
296
|
});
|
|
176
297
|
|
|
@@ -178,10 +299,10 @@ var ProgressCell = ({ column, columnMap, row }) => {
|
|
|
178
299
|
var import_vuu_ui_controls = require("@vuu-ui/vuu-ui-controls");
|
|
179
300
|
var import_core = require("@salt-ds/core");
|
|
180
301
|
var import_lab = require("@salt-ds/lab");
|
|
181
|
-
var
|
|
182
|
-
var
|
|
183
|
-
var
|
|
184
|
-
var
|
|
302
|
+
var import_classnames4 = __toESM(require("classnames"), 1);
|
|
303
|
+
var import_react3 = require("react");
|
|
304
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
305
|
+
var classBase4 = "vuuColumnList";
|
|
185
306
|
var classBaseListItem = "vuuColumnListItem";
|
|
186
307
|
var ColumnListItem = ({
|
|
187
308
|
className: classNameProp,
|
|
@@ -189,19 +310,19 @@ var ColumnListItem = ({
|
|
|
189
310
|
...listItemProps
|
|
190
311
|
}) => {
|
|
191
312
|
var _a;
|
|
192
|
-
return /* @__PURE__ */ (0,
|
|
313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
193
314
|
import_vuu_ui_controls.ListItem,
|
|
194
315
|
{
|
|
195
316
|
...listItemProps,
|
|
196
|
-
className: (0,
|
|
317
|
+
className: (0, import_classnames4.default)(classNameProp, classBaseListItem),
|
|
197
318
|
"data-name": item == null ? void 0 : item.name,
|
|
198
319
|
children: [
|
|
199
|
-
/* @__PURE__ */ (0,
|
|
200
|
-
/* @__PURE__ */ (0,
|
|
201
|
-
/* @__PURE__ */ (0,
|
|
320
|
+
(item == null ? void 0 : item.isCalculated) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `${classBase4}-icon`, "data-icon": "function" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lab.Switch, { className: `${classBase4}-switch`, checked: item == null ? void 0 : item.subscribed }),
|
|
321
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `${classBase4}-text`, children: (_a = item == null ? void 0 : item.label) != null ? _a : item == null ? void 0 : item.name }),
|
|
322
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
202
323
|
import_core.Checkbox,
|
|
203
324
|
{
|
|
204
|
-
className: `${
|
|
325
|
+
className: `${classBase4}-checkBox`,
|
|
205
326
|
checked: (item == null ? void 0 : item.hidden) !== true,
|
|
206
327
|
disabled: (item == null ? void 0 : item.subscribed) !== true
|
|
207
328
|
}
|
|
@@ -216,34 +337,34 @@ var ColumnList = ({
|
|
|
216
337
|
onMoveListItem,
|
|
217
338
|
...htmlAttributes
|
|
218
339
|
}) => {
|
|
219
|
-
const handleChange = (0,
|
|
340
|
+
const handleChange = (0, import_react3.useCallback)(
|
|
220
341
|
(evt) => {
|
|
221
342
|
const input = evt.target;
|
|
222
343
|
const listItem = input.closest(`.${classBaseListItem}`);
|
|
223
344
|
const {
|
|
224
|
-
dataset: { name }
|
|
345
|
+
dataset: { name: name2 }
|
|
225
346
|
} = listItem;
|
|
226
|
-
if (
|
|
227
|
-
const saltSwitch = input.closest(`.${
|
|
347
|
+
if (name2) {
|
|
348
|
+
const saltSwitch = input.closest(`.${classBase4}-switch`);
|
|
228
349
|
const saltCheckbox = input.closest(
|
|
229
|
-
`.${
|
|
350
|
+
`.${classBase4}-checkBox`
|
|
230
351
|
);
|
|
231
352
|
if (saltSwitch) {
|
|
232
|
-
onChange(
|
|
353
|
+
onChange(name2, "subscribed", input.checked);
|
|
233
354
|
} else if (saltCheckbox) {
|
|
234
|
-
onChange(
|
|
355
|
+
onChange(name2, "hidden", input.checked === false);
|
|
235
356
|
}
|
|
236
357
|
}
|
|
237
358
|
},
|
|
238
359
|
[onChange]
|
|
239
360
|
);
|
|
240
|
-
return /* @__PURE__ */ (0,
|
|
241
|
-
/* @__PURE__ */ (0,
|
|
242
|
-
/* @__PURE__ */ (0,
|
|
243
|
-
/* @__PURE__ */ (0,
|
|
244
|
-
/* @__PURE__ */ (0,
|
|
361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ...htmlAttributes, className: classBase4, children: [
|
|
362
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: `${classBase4}-header`, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Column Selection" }) }),
|
|
363
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `${classBase4}-colHeadings`, children: [
|
|
364
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Column subscription" }),
|
|
365
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Visibility" })
|
|
245
366
|
] }),
|
|
246
|
-
/* @__PURE__ */ (0,
|
|
367
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
247
368
|
import_vuu_ui_controls.List,
|
|
248
369
|
{
|
|
249
370
|
ListItem: ColumnListItem,
|
|
@@ -259,10 +380,387 @@ var ColumnList = ({
|
|
|
259
380
|
] });
|
|
260
381
|
};
|
|
261
382
|
|
|
383
|
+
// src/column-settings/ColumnSettingsPanel.tsx
|
|
384
|
+
var import_vuu_utils15 = require("@vuu-ui/vuu-utils");
|
|
385
|
+
var import_core5 = require("@salt-ds/core");
|
|
386
|
+
|
|
387
|
+
// src/column-formatting-settings/ColumnFormattingPanel.tsx
|
|
388
|
+
var import_vuu_ui_controls2 = require("@vuu-ui/vuu-ui-controls");
|
|
389
|
+
var import_core3 = require("@salt-ds/core");
|
|
390
|
+
var import_classnames5 = __toESM(require("classnames"), 1);
|
|
391
|
+
var import_react5 = require("react");
|
|
392
|
+
|
|
393
|
+
// src/column-formatting-settings/NumericFormattingSettings.tsx
|
|
394
|
+
var import_core2 = require("@salt-ds/core");
|
|
395
|
+
var import_lab2 = require("@salt-ds/lab");
|
|
396
|
+
var import_vuu_utils8 = require("@vuu-ui/vuu-utils");
|
|
397
|
+
var import_react4 = require("react");
|
|
398
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
399
|
+
var classBase5 = "vuuFormattingSettings";
|
|
400
|
+
var NumericFormattingSettings = ({
|
|
401
|
+
column,
|
|
402
|
+
onChange
|
|
403
|
+
}) => {
|
|
404
|
+
var _a;
|
|
405
|
+
const [formattingSettings, setFormattingSettings] = (0, import_react4.useState)(
|
|
406
|
+
(0, import_vuu_utils8.getTypeSettingsFromColumn)(column)
|
|
407
|
+
);
|
|
408
|
+
const handleInputKeyDown = (0, import_react4.useCallback)(
|
|
409
|
+
(evt) => {
|
|
410
|
+
if (evt.key === "Enter" || evt.key === "Tab") {
|
|
411
|
+
onChange(formattingSettings);
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
[formattingSettings, onChange]
|
|
415
|
+
);
|
|
416
|
+
const handleChangeDecimals = (0, import_react4.useCallback)(
|
|
417
|
+
(evt) => {
|
|
418
|
+
const { value } = evt.target;
|
|
419
|
+
const numericValue = value === "" ? void 0 : isNaN(parseInt(value)) ? void 0 : parseInt(value);
|
|
420
|
+
const newFormattingSettings = {
|
|
421
|
+
...formattingSettings,
|
|
422
|
+
decimals: numericValue
|
|
423
|
+
};
|
|
424
|
+
setFormattingSettings(newFormattingSettings);
|
|
425
|
+
},
|
|
426
|
+
[formattingSettings]
|
|
427
|
+
);
|
|
428
|
+
const handleChangeAlignDecimals = (0, import_react4.useCallback)(
|
|
429
|
+
(evt) => {
|
|
430
|
+
const { checked } = evt.target;
|
|
431
|
+
const newFormattingSettings = {
|
|
432
|
+
...formattingSettings,
|
|
433
|
+
alignOnDecimals: checked
|
|
434
|
+
};
|
|
435
|
+
setFormattingSettings(newFormattingSettings);
|
|
436
|
+
onChange(newFormattingSettings);
|
|
437
|
+
},
|
|
438
|
+
[formattingSettings, onChange]
|
|
439
|
+
);
|
|
440
|
+
const handleChangeZeroPad = (0, import_react4.useCallback)(
|
|
441
|
+
(evt) => {
|
|
442
|
+
const { checked } = evt.target;
|
|
443
|
+
const newFormattingSettings = {
|
|
444
|
+
...formattingSettings,
|
|
445
|
+
zeroPad: checked
|
|
446
|
+
};
|
|
447
|
+
setFormattingSettings(newFormattingSettings);
|
|
448
|
+
onChange(newFormattingSettings);
|
|
449
|
+
},
|
|
450
|
+
[formattingSettings, onChange]
|
|
451
|
+
);
|
|
452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: classBase5, children: [
|
|
453
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_core2.FormField, { "data-field": "decimals", children: [
|
|
454
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core2.FormFieldLabel, { children: "Number of decimals" }),
|
|
455
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
456
|
+
import_core2.Input,
|
|
457
|
+
{
|
|
458
|
+
className: "vuuInput",
|
|
459
|
+
onChange: handleChangeDecimals,
|
|
460
|
+
onKeyDown: handleInputKeyDown,
|
|
461
|
+
value: (_a = formattingSettings.decimals) != null ? _a : ""
|
|
462
|
+
}
|
|
463
|
+
)
|
|
464
|
+
] }),
|
|
465
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_core2.FormField, { labelPlacement: "left", children: [
|
|
466
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core2.FormFieldLabel, { children: "Align on decimals" }),
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
468
|
+
import_lab2.Switch,
|
|
469
|
+
{
|
|
470
|
+
checked: formattingSettings.alignOnDecimals,
|
|
471
|
+
onChange: handleChangeAlignDecimals,
|
|
472
|
+
value: "align-decimals"
|
|
473
|
+
}
|
|
474
|
+
)
|
|
475
|
+
] }),
|
|
476
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_core2.FormField, { labelPlacement: "left", children: [
|
|
477
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core2.FormFieldLabel, { children: "Zero pad decimals" }),
|
|
478
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
479
|
+
import_lab2.Switch,
|
|
480
|
+
{
|
|
481
|
+
checked: formattingSettings.zeroPad,
|
|
482
|
+
onChange: handleChangeZeroPad,
|
|
483
|
+
value: "zero-pad"
|
|
484
|
+
}
|
|
485
|
+
)
|
|
486
|
+
] })
|
|
487
|
+
] });
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
// src/column-formatting-settings/ColumnFormattingPanel.tsx
|
|
491
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
492
|
+
var classBase6 = "vuuColumnFormattingPanel";
|
|
493
|
+
var itemToString = (item) => {
|
|
494
|
+
var _a;
|
|
495
|
+
return (_a = item.label) != null ? _a : item.name;
|
|
496
|
+
};
|
|
497
|
+
var ColumnFormattingPanel = ({
|
|
498
|
+
availableRenderers,
|
|
499
|
+
selectedCellRenderer,
|
|
500
|
+
className,
|
|
501
|
+
column,
|
|
502
|
+
onChangeFormatting,
|
|
503
|
+
onChangeRenderer,
|
|
504
|
+
...htmlAttributes
|
|
505
|
+
}) => {
|
|
506
|
+
const content = (0, import_react5.useMemo)(() => {
|
|
507
|
+
switch (column.serverDataType) {
|
|
508
|
+
case "double":
|
|
509
|
+
case "int":
|
|
510
|
+
case "long":
|
|
511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
512
|
+
NumericFormattingSettings,
|
|
513
|
+
{
|
|
514
|
+
column,
|
|
515
|
+
onChange: onChangeFormatting
|
|
516
|
+
}
|
|
517
|
+
);
|
|
518
|
+
default:
|
|
519
|
+
return null;
|
|
520
|
+
}
|
|
521
|
+
}, [column, onChangeFormatting]);
|
|
522
|
+
const { serverDataType = "string" } = column;
|
|
523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ...htmlAttributes, className: `vuuColumnSettingsPanel-header`, children: [
|
|
524
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children: "Formatting" }),
|
|
525
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core3.FormField, { children: [
|
|
526
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core3.FormFieldLabel, { children: "Renderer" }),
|
|
527
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
528
|
+
import_vuu_ui_controls2.Dropdown,
|
|
529
|
+
{
|
|
530
|
+
className: (0, import_classnames5.default)(`${classBase6}-renderer`),
|
|
531
|
+
itemToString,
|
|
532
|
+
onSelectionChange: onChangeRenderer,
|
|
533
|
+
selected: selectedCellRenderer,
|
|
534
|
+
source: availableRenderers,
|
|
535
|
+
width: "100%"
|
|
536
|
+
}
|
|
537
|
+
)
|
|
538
|
+
] }),
|
|
539
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
540
|
+
"div",
|
|
541
|
+
{
|
|
542
|
+
className: (0, import_classnames5.default)(classBase6, className, `${classBase6}-${serverDataType}`),
|
|
543
|
+
children: content
|
|
544
|
+
}
|
|
545
|
+
)
|
|
546
|
+
] });
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
// src/column-settings/useColumnSettings.ts
|
|
550
|
+
var import_vuu_utils9 = require("@vuu-ui/vuu-utils");
|
|
551
|
+
var import_react6 = require("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
|
+
...(0, import_vuu_utils9.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 ((0, import_vuu_utils9.isTypeDescriptor)(column.type)) {
|
|
590
|
+
const { renderer } = column.type;
|
|
591
|
+
if ((0, import_vuu_utils9.isColumnTypeRenderer)(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] = (0, import_react6.useState)(
|
|
638
|
+
getColumn(tableConfig.columns, columnProp)
|
|
639
|
+
);
|
|
640
|
+
const availableRenderers = (0, import_react6.useMemo)(() => {
|
|
641
|
+
return getAvailableCellRenderers(column);
|
|
642
|
+
}, [column]);
|
|
643
|
+
const selectedCellRendererRef = (0, import_react6.useRef)(
|
|
644
|
+
getCellRendererDescriptor(availableRenderers, column)
|
|
645
|
+
);
|
|
646
|
+
const handleInputCommit = (0, import_react6.useCallback)(() => {
|
|
647
|
+
onConfigChange(replaceColumn(tableConfig, column));
|
|
648
|
+
}, [column, onConfigChange, tableConfig]);
|
|
649
|
+
const handleChange = (0, import_react6.useCallback)(
|
|
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) => (0, import_vuu_utils9.setCalculatedColumnName)(state, value));
|
|
660
|
+
break;
|
|
661
|
+
case "column-width":
|
|
662
|
+
setColumn((state) => ({ ...state, width: parseInt(value) }));
|
|
663
|
+
break;
|
|
664
|
+
case "column-alignment":
|
|
665
|
+
if ((0, import_vuu_utils9.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 ((0, import_vuu_utils9.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 = (0, import_react6.useCallback)(
|
|
689
|
+
(evt, cellRenderer) => {
|
|
690
|
+
if (cellRenderer) {
|
|
691
|
+
const newColumn = (0, import_vuu_utils9.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 = (0, import_react6.useCallback)(
|
|
703
|
+
(formatting) => {
|
|
704
|
+
const newColumn = (0, import_vuu_utils9.updateColumnType)(column, formatting);
|
|
705
|
+
setColumn(newColumn);
|
|
706
|
+
onConfigChange(replaceColumn(tableConfig, newColumn));
|
|
707
|
+
},
|
|
708
|
+
[column, onConfigChange, tableConfig]
|
|
709
|
+
);
|
|
710
|
+
const navigateColumn = (0, import_react6.useCallback)(
|
|
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 = (0, import_react6.useCallback)(() => {
|
|
726
|
+
navigateColumn({ moveBy: 1 });
|
|
727
|
+
}, [navigateColumn]);
|
|
728
|
+
const navigatePrevColumn = (0, import_react6.useCallback)(() => {
|
|
729
|
+
navigateColumn({ moveBy: -1 });
|
|
730
|
+
}, [navigateColumn]);
|
|
731
|
+
const handleSaveCalculatedColumn = (0, import_react6.useCallback)(
|
|
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
|
+
var import_vuu_ui_controls3 = require("@vuu-ui/vuu-ui-controls");
|
|
756
|
+
var import_vuu_utils14 = require("@vuu-ui/vuu-utils");
|
|
757
|
+
var import_core4 = require("@salt-ds/core");
|
|
758
|
+
var import_react11 = require("react");
|
|
759
|
+
|
|
262
760
|
// src/column-expression-input/useColumnExpressionEditor.ts
|
|
263
761
|
var import_vuu_codemirror5 = require("@vuu-ui/vuu-codemirror");
|
|
264
|
-
var
|
|
265
|
-
var
|
|
762
|
+
var import_vuu_utils10 = require("@vuu-ui/vuu-utils");
|
|
763
|
+
var import_react8 = require("react");
|
|
266
764
|
|
|
267
765
|
// src/column-expression-input/column-language-parser/ColumnExpressionLanguage.ts
|
|
268
766
|
var import_vuu_codemirror = require("@vuu-ui/vuu-codemirror");
|
|
@@ -705,8 +1203,8 @@ var walkTree = (tree, source) => {
|
|
|
705
1203
|
const columnExpression = new ColumnExpression();
|
|
706
1204
|
const cursor = tree.cursor();
|
|
707
1205
|
do {
|
|
708
|
-
const { name, from, to } = cursor;
|
|
709
|
-
switch (
|
|
1206
|
+
const { name: name2, from, to } = cursor;
|
|
1207
|
+
switch (name2) {
|
|
710
1208
|
case "AndCondition":
|
|
711
1209
|
columnExpression.setCondition("and");
|
|
712
1210
|
break;
|
|
@@ -881,7 +1379,7 @@ var vuuTheme = import_vuu_codemirror3.EditorView.theme(
|
|
|
881
1379
|
|
|
882
1380
|
// src/column-expression-input/useColumnAutoComplete.ts
|
|
883
1381
|
var import_vuu_codemirror4 = require("@vuu-ui/vuu-codemirror");
|
|
884
|
-
var
|
|
1382
|
+
var import_react7 = require("react");
|
|
885
1383
|
var applyPrefix = (completions, prefix) => prefix ? completions.map((completion) => {
|
|
886
1384
|
var _a;
|
|
887
1385
|
return {
|
|
@@ -890,6 +1388,13 @@ var applyPrefix = (completions, prefix) => prefix ? completions.map((completion)
|
|
|
890
1388
|
};
|
|
891
1389
|
}) : completions;
|
|
892
1390
|
var isOperator = (node) => node === void 0 ? false : ["Times", "Divide", "Plus", "Minus"].includes(node.name);
|
|
1391
|
+
var completionDone = (onSubmit) => ({
|
|
1392
|
+
apply: () => {
|
|
1393
|
+
onSubmit == null ? void 0 : onSubmit();
|
|
1394
|
+
},
|
|
1395
|
+
label: "Done",
|
|
1396
|
+
boost: 10
|
|
1397
|
+
});
|
|
893
1398
|
var getLastChild = (node, context) => {
|
|
894
1399
|
var _a;
|
|
895
1400
|
let { lastChild: childNode } = node;
|
|
@@ -975,33 +1480,17 @@ var handleConditionalExpression = (node, context, suggestionProvider, maybeCompl
|
|
|
975
1480
|
});
|
|
976
1481
|
case "CloseBrace":
|
|
977
1482
|
if (maybeComplete) {
|
|
978
|
-
const options = [
|
|
979
|
-
{
|
|
980
|
-
apply: () => {
|
|
981
|
-
onSubmit == null ? void 0 : onSubmit();
|
|
982
|
-
},
|
|
983
|
-
label: "Save Expression",
|
|
984
|
-
boost: 10
|
|
985
|
-
}
|
|
986
|
-
];
|
|
1483
|
+
const options = [completionDone(onSubmit)];
|
|
987
1484
|
return { from: context.pos, options };
|
|
988
1485
|
}
|
|
989
1486
|
}
|
|
990
1487
|
};
|
|
991
1488
|
var promptToSave = (context, onSubmit) => {
|
|
992
|
-
const options = [
|
|
993
|
-
{
|
|
994
|
-
apply: () => {
|
|
995
|
-
onSubmit == null ? void 0 : onSubmit();
|
|
996
|
-
},
|
|
997
|
-
label: "Save Expression",
|
|
998
|
-
boost: 10
|
|
999
|
-
}
|
|
1000
|
-
];
|
|
1489
|
+
const options = [completionDone(onSubmit)];
|
|
1001
1490
|
return { from: context.pos, options };
|
|
1002
1491
|
};
|
|
1003
1492
|
var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
1004
|
-
const makeSuggestions2 = (0,
|
|
1493
|
+
const makeSuggestions2 = (0, import_react7.useCallback)(
|
|
1005
1494
|
async (context, suggestionType, optionalArgs = {}) => {
|
|
1006
1495
|
const options = await suggestionProvider.getSuggestions(
|
|
1007
1496
|
suggestionType,
|
|
@@ -1012,7 +1501,7 @@ var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
|
1012
1501
|
},
|
|
1013
1502
|
[suggestionProvider]
|
|
1014
1503
|
);
|
|
1015
|
-
return (0,
|
|
1504
|
+
return (0, import_react7.useCallback)(
|
|
1016
1505
|
async (context) => {
|
|
1017
1506
|
var _a, _b;
|
|
1018
1507
|
const { state, pos } = context;
|
|
@@ -1025,7 +1514,6 @@ var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
|
1025
1514
|
const nodeBefore = tree.resolveInner(pos, -1);
|
|
1026
1515
|
const text = state.doc.toString();
|
|
1027
1516
|
const maybeComplete = isCompleteExpression(text);
|
|
1028
|
-
console.log({ nodeBeforeName: nodeBefore.name });
|
|
1029
1517
|
switch (nodeBefore.name) {
|
|
1030
1518
|
case "If": {
|
|
1031
1519
|
console.log(`conditional expression If`);
|
|
@@ -1041,9 +1529,6 @@ var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
|
1041
1529
|
columnName: (0, import_vuu_codemirror4.getValue)(lastChild, state)
|
|
1042
1530
|
});
|
|
1043
1531
|
}
|
|
1044
|
-
console.log(
|
|
1045
|
-
`Condition last child Column, prev child ${prevChild == null ? void 0 : prevChild.name}`
|
|
1046
|
-
);
|
|
1047
1532
|
} else if ((lastChild == null ? void 0 : lastChild.name) === "RelationalOperator") {
|
|
1048
1533
|
return makeSuggestions2(context, "expression");
|
|
1049
1534
|
}
|
|
@@ -1106,9 +1591,6 @@ var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
|
1106
1591
|
prefix: ", "
|
|
1107
1592
|
});
|
|
1108
1593
|
}
|
|
1109
|
-
console.log(
|
|
1110
|
-
`we have a string, column is ${columnName} ${from} ${to}`
|
|
1111
|
-
);
|
|
1112
1594
|
}
|
|
1113
1595
|
break;
|
|
1114
1596
|
case "ArithmeticExpression":
|
|
@@ -1161,13 +1643,7 @@ var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
|
1161
1643
|
if ((lastChild == null ? void 0 : lastChild.name) === "Column") {
|
|
1162
1644
|
if (maybeComplete) {
|
|
1163
1645
|
const options = [
|
|
1164
|
-
|
|
1165
|
-
apply: () => {
|
|
1166
|
-
onSubmit.current();
|
|
1167
|
-
},
|
|
1168
|
-
label: "Save Expression",
|
|
1169
|
-
boost: 10
|
|
1170
|
-
}
|
|
1646
|
+
completionDone(onSubmit.current)
|
|
1171
1647
|
];
|
|
1172
1648
|
const columnName = (0, import_vuu_codemirror4.getValue)(lastChild, state);
|
|
1173
1649
|
const columnOptions = await suggestionProvider.getSuggestions("operator", {
|
|
@@ -1180,31 +1656,14 @@ var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
|
1180
1656
|
}
|
|
1181
1657
|
} else if ((lastChild == null ? void 0 : lastChild.name) === "CallExpression") {
|
|
1182
1658
|
if (maybeComplete) {
|
|
1183
|
-
const options = [
|
|
1184
|
-
{
|
|
1185
|
-
apply: () => {
|
|
1186
|
-
onSubmit.current();
|
|
1187
|
-
},
|
|
1188
|
-
label: "Save Expression",
|
|
1189
|
-
boost: 10
|
|
1190
|
-
}
|
|
1191
|
-
];
|
|
1192
1659
|
return {
|
|
1193
1660
|
from: context.pos,
|
|
1194
|
-
options
|
|
1661
|
+
options: [completionDone(onSubmit.current)]
|
|
1195
1662
|
};
|
|
1196
1663
|
}
|
|
1197
1664
|
} else if ((lastChild == null ? void 0 : lastChild.name) === "ArithmeticExpression") {
|
|
1198
1665
|
if (maybeComplete) {
|
|
1199
|
-
let options = [
|
|
1200
|
-
{
|
|
1201
|
-
apply: () => {
|
|
1202
|
-
onSubmit.current();
|
|
1203
|
-
},
|
|
1204
|
-
label: "Save Expression",
|
|
1205
|
-
boost: 10
|
|
1206
|
-
}
|
|
1207
|
-
];
|
|
1666
|
+
let options = [completionDone(onSubmit.current)];
|
|
1208
1667
|
const lastExpressionChild = getLastChild(lastChild, context);
|
|
1209
1668
|
if ((lastExpressionChild == null ? void 0 : lastExpressionChild.name) === "Column") {
|
|
1210
1669
|
const columnName = (0, import_vuu_codemirror4.getValue)(lastExpressionChild, state);
|
|
@@ -1268,9 +1727,6 @@ var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
|
|
|
1268
1727
|
return promptToSave(context, onSubmit.current);
|
|
1269
1728
|
}
|
|
1270
1729
|
}
|
|
1271
|
-
console.log(
|
|
1272
|
-
`does closebrace denote an ARgList or a parenthetised expression ? ${parentNode}`
|
|
1273
|
-
);
|
|
1274
1730
|
}
|
|
1275
1731
|
break;
|
|
1276
1732
|
default: {
|
|
@@ -1298,8 +1754,8 @@ var noop = () => console.log("noooop");
|
|
|
1298
1754
|
var hasExpressionType = (completion) => "expressionType" in completion;
|
|
1299
1755
|
var injectOptionContent = (completion) => {
|
|
1300
1756
|
if (hasExpressionType(completion)) {
|
|
1301
|
-
const div = (0,
|
|
1302
|
-
const span = (0,
|
|
1757
|
+
const div = (0, import_vuu_utils10.createEl)("div", "expression-type-container");
|
|
1758
|
+
const span = (0, import_vuu_utils10.createEl)("span", "expression-type", completion.expressionType);
|
|
1303
1759
|
div.appendChild(span);
|
|
1304
1760
|
return div;
|
|
1305
1761
|
} else {
|
|
@@ -1309,20 +1765,21 @@ var injectOptionContent = (completion) => {
|
|
|
1309
1765
|
var useColumnExpressionEditor = ({
|
|
1310
1766
|
onChange,
|
|
1311
1767
|
onSubmitExpression,
|
|
1768
|
+
source,
|
|
1312
1769
|
suggestionProvider
|
|
1313
1770
|
}) => {
|
|
1314
|
-
const editorRef = (0,
|
|
1315
|
-
const
|
|
1316
|
-
const viewRef = (0,
|
|
1317
|
-
const completionFn = useColumnAutoComplete(suggestionProvider,
|
|
1318
|
-
const [createState, clearInput] = (0,
|
|
1771
|
+
const editorRef = (0, import_react8.useRef)(null);
|
|
1772
|
+
const onSubmitRef = (0, import_react8.useRef)(noop);
|
|
1773
|
+
const viewRef = (0, import_react8.useRef)();
|
|
1774
|
+
const completionFn = useColumnAutoComplete(suggestionProvider, onSubmitRef);
|
|
1775
|
+
const [createState, clearInput] = (0, import_react8.useMemo)(() => {
|
|
1319
1776
|
const parseExpression = () => {
|
|
1320
1777
|
const view = getView(viewRef);
|
|
1321
|
-
const
|
|
1778
|
+
const source2 = view.state.doc.toString();
|
|
1322
1779
|
const tree = (0, import_vuu_codemirror5.ensureSyntaxTree)(view.state, view.state.doc.length, 5e3);
|
|
1323
1780
|
if (tree) {
|
|
1324
|
-
const expression = walkTree(tree,
|
|
1325
|
-
return [
|
|
1781
|
+
const expression = walkTree(tree, source2);
|
|
1782
|
+
return [source2, expression];
|
|
1326
1783
|
} else {
|
|
1327
1784
|
return ["", void 0];
|
|
1328
1785
|
}
|
|
@@ -1330,35 +1787,23 @@ var useColumnExpressionEditor = ({
|
|
|
1330
1787
|
const clearInput2 = () => {
|
|
1331
1788
|
getView(viewRef).setState(createState2());
|
|
1332
1789
|
};
|
|
1333
|
-
const
|
|
1334
|
-
const [
|
|
1335
|
-
onSubmitExpression == null ? void 0 : onSubmitExpression(
|
|
1336
|
-
clearInput2();
|
|
1790
|
+
const submitExpression = () => {
|
|
1791
|
+
const [source2, expression] = parseExpression();
|
|
1792
|
+
onSubmitExpression == null ? void 0 : onSubmitExpression(source2, expression);
|
|
1337
1793
|
};
|
|
1338
|
-
const
|
|
1794
|
+
const showSuggestions = (key) => {
|
|
1339
1795
|
return import_vuu_codemirror5.keymap.of([
|
|
1340
1796
|
{
|
|
1341
1797
|
key,
|
|
1342
1798
|
run() {
|
|
1343
|
-
|
|
1344
|
-
return true;
|
|
1345
|
-
}
|
|
1346
|
-
}
|
|
1347
|
-
]);
|
|
1348
|
-
};
|
|
1349
|
-
const showSuggestions = (key) => {
|
|
1350
|
-
return import_vuu_codemirror5.keymap.of([
|
|
1351
|
-
{
|
|
1352
|
-
key,
|
|
1353
|
-
run() {
|
|
1354
|
-
(0, import_vuu_codemirror5.startCompletion)(getView(viewRef));
|
|
1799
|
+
(0, import_vuu_codemirror5.startCompletion)(getView(viewRef));
|
|
1355
1800
|
return true;
|
|
1356
1801
|
}
|
|
1357
1802
|
}
|
|
1358
1803
|
]);
|
|
1359
1804
|
};
|
|
1360
1805
|
const createState2 = () => import_vuu_codemirror5.EditorState.create({
|
|
1361
|
-
doc:
|
|
1806
|
+
doc: source,
|
|
1362
1807
|
extensions: [
|
|
1363
1808
|
import_vuu_codemirror5.minimalSetup,
|
|
1364
1809
|
(0, import_vuu_codemirror5.autocompletion)({
|
|
@@ -1373,14 +1818,13 @@ var useColumnExpressionEditor = ({
|
|
|
1373
1818
|
}),
|
|
1374
1819
|
columnExpressionLanguageSupport(),
|
|
1375
1820
|
import_vuu_codemirror5.keymap.of(import_vuu_codemirror5.defaultKeymap),
|
|
1376
|
-
submitFilter("Ctrl-Enter"),
|
|
1377
1821
|
showSuggestions("ArrowDown"),
|
|
1378
1822
|
import_vuu_codemirror5.EditorView.updateListener.of((v) => {
|
|
1379
1823
|
const view = getView(viewRef);
|
|
1380
1824
|
if (v.docChanged) {
|
|
1381
1825
|
(0, import_vuu_codemirror5.startCompletion)(view);
|
|
1382
|
-
const
|
|
1383
|
-
onChange == null ? void 0 : onChange(
|
|
1826
|
+
const source2 = view.state.doc.toString();
|
|
1827
|
+
onChange == null ? void 0 : onChange(source2);
|
|
1384
1828
|
}
|
|
1385
1829
|
}),
|
|
1386
1830
|
// Enforces single line view
|
|
@@ -1391,15 +1835,12 @@ var useColumnExpressionEditor = ({
|
|
|
1391
1835
|
vuuHighlighting
|
|
1392
1836
|
]
|
|
1393
1837
|
});
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
setTimeout(() => {
|
|
1397
|
-
getView(viewRef).focus();
|
|
1398
|
-
}, 100);
|
|
1838
|
+
onSubmitRef.current = () => {
|
|
1839
|
+
submitExpression();
|
|
1399
1840
|
};
|
|
1400
1841
|
return [createState2, clearInput2];
|
|
1401
|
-
}, [completionFn, onChange, onSubmitExpression]);
|
|
1402
|
-
(0,
|
|
1842
|
+
}, [completionFn, onChange, onSubmitExpression, source]);
|
|
1843
|
+
(0, import_react8.useEffect)(() => {
|
|
1403
1844
|
if (!editorRef.current) {
|
|
1404
1845
|
throw Error("editor not in dom");
|
|
1405
1846
|
}
|
|
@@ -1416,26 +1857,28 @@ var useColumnExpressionEditor = ({
|
|
|
1416
1857
|
};
|
|
1417
1858
|
|
|
1418
1859
|
// src/column-expression-input/ColumnExpressionInput.tsx
|
|
1419
|
-
var
|
|
1420
|
-
var
|
|
1860
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1861
|
+
var classBase7 = "vuuColumnExpressionInput";
|
|
1421
1862
|
var ColumnExpressionInput = ({
|
|
1422
1863
|
onChange,
|
|
1423
1864
|
onSubmitExpression,
|
|
1865
|
+
source = "",
|
|
1424
1866
|
suggestionProvider
|
|
1425
1867
|
}) => {
|
|
1426
1868
|
const { editorRef } = useColumnExpressionEditor({
|
|
1427
1869
|
onChange,
|
|
1428
1870
|
onSubmitExpression,
|
|
1871
|
+
source,
|
|
1429
1872
|
suggestionProvider
|
|
1430
1873
|
});
|
|
1431
|
-
return /* @__PURE__ */ (0,
|
|
1874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `${classBase7}`, ref: editorRef });
|
|
1432
1875
|
};
|
|
1433
1876
|
|
|
1434
1877
|
// src/column-expression-input/useColumnExpressionSuggestionProvider.ts
|
|
1435
1878
|
var import_vuu_codemirror6 = require("@vuu-ui/vuu-codemirror");
|
|
1436
1879
|
var import_vuu_data_react = require("@vuu-ui/vuu-data-react");
|
|
1437
|
-
var
|
|
1438
|
-
var
|
|
1880
|
+
var import_vuu_utils12 = require("@vuu-ui/vuu-utils");
|
|
1881
|
+
var import_react9 = require("react");
|
|
1439
1882
|
|
|
1440
1883
|
// src/column-expression-input/column-function-descriptors.ts
|
|
1441
1884
|
var columnFunctionDescriptors = [
|
|
@@ -1710,33 +2153,33 @@ var columnFunctionDescriptors = [
|
|
|
1710
2153
|
];
|
|
1711
2154
|
|
|
1712
2155
|
// src/column-expression-input/functionDocInfo.ts
|
|
1713
|
-
var
|
|
2156
|
+
var import_vuu_utils11 = require("@vuu-ui/vuu-utils");
|
|
1714
2157
|
var functionDocInfo = ({
|
|
1715
|
-
name,
|
|
2158
|
+
name: name2,
|
|
1716
2159
|
description,
|
|
1717
2160
|
example,
|
|
1718
2161
|
params,
|
|
1719
2162
|
type
|
|
1720
2163
|
}) => {
|
|
1721
|
-
const rootElement = (0,
|
|
1722
|
-
const headingElement = (0,
|
|
1723
|
-
const nameElement = (0,
|
|
1724
|
-
const paramElement = (0,
|
|
1725
|
-
const typeElement = (0,
|
|
2164
|
+
const rootElement = (0, import_vuu_utils11.createEl)("div", "vuuFunctionDoc");
|
|
2165
|
+
const headingElement = (0, import_vuu_utils11.createEl)("div", "function-heading");
|
|
2166
|
+
const nameElement = (0, import_vuu_utils11.createEl)("span", "function-name", name2);
|
|
2167
|
+
const paramElement = (0, import_vuu_utils11.createEl)("span", "param-list", params.description);
|
|
2168
|
+
const typeElement = (0, import_vuu_utils11.createEl)("span", "function-type", type);
|
|
1726
2169
|
headingElement.appendChild(nameElement);
|
|
1727
2170
|
headingElement.appendChild(paramElement);
|
|
1728
2171
|
headingElement.appendChild(typeElement);
|
|
1729
|
-
const child2 = (0,
|
|
2172
|
+
const child2 = (0, import_vuu_utils11.createEl)("p", void 0, description);
|
|
1730
2173
|
rootElement.appendChild(headingElement);
|
|
1731
2174
|
rootElement.appendChild(child2);
|
|
1732
2175
|
if (example) {
|
|
1733
|
-
const exampleElement = (0,
|
|
1734
|
-
const expressionElement = (0,
|
|
2176
|
+
const exampleElement = (0, import_vuu_utils11.createEl)("div", "example-container", "Example:");
|
|
2177
|
+
const expressionElement = (0, import_vuu_utils11.createEl)(
|
|
1735
2178
|
"div",
|
|
1736
2179
|
"example-expression",
|
|
1737
2180
|
example.expression
|
|
1738
2181
|
);
|
|
1739
|
-
const resultElement = (0,
|
|
2182
|
+
const resultElement = (0, import_vuu_utils11.createEl)("div", "example-result", example.result);
|
|
1740
2183
|
exampleElement.appendChild(expressionElement);
|
|
1741
2184
|
exampleElement.appendChild(resultElement);
|
|
1742
2185
|
rootElement.appendChild(exampleElement);
|
|
@@ -1755,15 +2198,15 @@ var withApplySpace = (suggestions) => suggestions.map((suggestion) => {
|
|
|
1755
2198
|
});
|
|
1756
2199
|
var getValidColumns = (columns, { functionName, operator }) => {
|
|
1757
2200
|
if (operator) {
|
|
1758
|
-
return columns.filter(
|
|
2201
|
+
return columns.filter(import_vuu_utils12.isNumericColumn);
|
|
1759
2202
|
} else if (functionName) {
|
|
1760
2203
|
const fn = columnFunctionDescriptors.find((f) => f.name === functionName);
|
|
1761
2204
|
if (fn) {
|
|
1762
2205
|
switch (fn.accepts) {
|
|
1763
2206
|
case "string":
|
|
1764
|
-
return columns.filter(
|
|
2207
|
+
return columns.filter(import_vuu_utils12.isTextColumn);
|
|
1765
2208
|
case "number":
|
|
1766
|
-
return columns.filter(
|
|
2209
|
+
return columns.filter(import_vuu_utils12.isNumericColumn);
|
|
1767
2210
|
default:
|
|
1768
2211
|
return columns;
|
|
1769
2212
|
}
|
|
@@ -1792,7 +2235,7 @@ var arithmeticOperators = [
|
|
|
1792
2235
|
{ apply: "- ", boost: 2, label: "-", type: "operator" }
|
|
1793
2236
|
];
|
|
1794
2237
|
var getOperators = (column) => {
|
|
1795
|
-
if (column === void 0 || (0,
|
|
2238
|
+
if (column === void 0 || (0, import_vuu_utils12.isNumericColumn)(column)) {
|
|
1796
2239
|
return arithmeticOperators;
|
|
1797
2240
|
} else {
|
|
1798
2241
|
return NO_OPERATORS;
|
|
@@ -1856,13 +2299,13 @@ var useColumnExpressionSuggestionProvider = ({
|
|
|
1856
2299
|
columns,
|
|
1857
2300
|
table
|
|
1858
2301
|
}) => {
|
|
1859
|
-
const
|
|
1860
|
-
(
|
|
2302
|
+
const findColumn2 = (0, import_react9.useCallback)(
|
|
2303
|
+
(name2) => name2 ? columns.find((col) => col.name === name2) : void 0,
|
|
1861
2304
|
[columns]
|
|
1862
2305
|
);
|
|
1863
|
-
const latestSuggestionsRef = (0,
|
|
2306
|
+
const latestSuggestionsRef = (0, import_react9.useRef)();
|
|
1864
2307
|
const getTypeaheadSuggestions = (0, import_vuu_data_react.useTypeaheadSuggestions)();
|
|
1865
|
-
const getSuggestions = (0,
|
|
2308
|
+
const getSuggestions = (0, import_react9.useCallback)(
|
|
1866
2309
|
async (suggestionType, options = NONE) => {
|
|
1867
2310
|
const { columnName, functionName, operator, prefix } = options;
|
|
1868
2311
|
switch (suggestionType) {
|
|
@@ -1877,18 +2320,18 @@ var useColumnExpressionSuggestionProvider = ({
|
|
|
1877
2320
|
return latestSuggestionsRef.current = withApplySpace(suggestions);
|
|
1878
2321
|
}
|
|
1879
2322
|
case "operator": {
|
|
1880
|
-
const suggestions = await getOperators(
|
|
2323
|
+
const suggestions = await getOperators(findColumn2(columnName));
|
|
1881
2324
|
return latestSuggestionsRef.current = withApplySpace(suggestions);
|
|
1882
2325
|
}
|
|
1883
2326
|
case "relational-operator": {
|
|
1884
2327
|
const suggestions = await (0, import_vuu_codemirror6.getRelationalOperators)(
|
|
1885
|
-
|
|
2328
|
+
findColumn2(columnName)
|
|
1886
2329
|
);
|
|
1887
2330
|
return latestSuggestionsRef.current = withApplySpace(suggestions);
|
|
1888
2331
|
}
|
|
1889
2332
|
case "condition-operator":
|
|
1890
2333
|
{
|
|
1891
|
-
const column =
|
|
2334
|
+
const column = findColumn2(columnName);
|
|
1892
2335
|
if (column) {
|
|
1893
2336
|
const suggestions = await getConditionOperators(column);
|
|
1894
2337
|
if (suggestions) {
|
|
@@ -1925,9 +2368,9 @@ var useColumnExpressionSuggestionProvider = ({
|
|
|
1925
2368
|
}
|
|
1926
2369
|
return [];
|
|
1927
2370
|
},
|
|
1928
|
-
[columns,
|
|
2371
|
+
[columns, findColumn2, getTypeaheadSuggestions, table]
|
|
1929
2372
|
);
|
|
1930
|
-
const isPartialMatch = (0,
|
|
2373
|
+
const isPartialMatch = (0, import_react9.useCallback)(
|
|
1931
2374
|
async (valueType, columnName, pattern) => {
|
|
1932
2375
|
const { current: latestSuggestions } = latestSuggestionsRef;
|
|
1933
2376
|
let maybe = false;
|
|
@@ -1951,812 +2394,390 @@ var useColumnExpressionSuggestionProvider = ({
|
|
|
1951
2394
|
};
|
|
1952
2395
|
};
|
|
1953
2396
|
|
|
1954
|
-
// src/
|
|
1955
|
-
var
|
|
1956
|
-
var
|
|
1957
|
-
var
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
// src/datagrid-configuration-ui/column-type-panel/ColumnTypePanel.tsx
|
|
1967
|
-
var import_vuu_utils7 = require("@vuu-ui/vuu-utils");
|
|
1968
|
-
var import_lab3 = require("@salt-ds/lab");
|
|
1969
|
-
var import_core3 = require("@salt-ds/core");
|
|
1970
|
-
var import_classnames4 = __toESM(require("classnames"), 1);
|
|
1971
|
-
var import_react7 = require("react");
|
|
1972
|
-
|
|
1973
|
-
// src/datagrid-configuration-ui/column-type-panel/NumericColumnPanel.tsx
|
|
1974
|
-
var import_lab2 = require("@salt-ds/lab");
|
|
1975
|
-
var import_core2 = require("@salt-ds/core");
|
|
1976
|
-
var import_react6 = require("react");
|
|
1977
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1978
|
-
var defaultValues = {
|
|
1979
|
-
alignOnDecimals: false,
|
|
1980
|
-
decimals: 4,
|
|
1981
|
-
zeroPad: false
|
|
1982
|
-
};
|
|
1983
|
-
var getColumnValues = (columnType, gridDefaultValues) => {
|
|
1984
|
-
const columnValue = typeof columnType === "object" && columnType.formatting ? columnType.formatting : {};
|
|
1985
|
-
const properties = ["alignOnDecimals", "decimals", "zeroPad"];
|
|
1986
|
-
return properties.reduce((configValues, property) => {
|
|
1987
|
-
if (columnValue[property] !== void 0) {
|
|
1988
|
-
return {
|
|
1989
|
-
...configValues,
|
|
1990
|
-
[property]: columnValue[property]
|
|
1991
|
-
};
|
|
1992
|
-
} else if ((gridDefaultValues == null ? void 0 : gridDefaultValues[property]) !== void 0) {
|
|
1993
|
-
return {
|
|
1994
|
-
...configValues,
|
|
1995
|
-
[property]: gridDefaultValues[property]
|
|
1996
|
-
};
|
|
1997
|
-
}
|
|
1998
|
-
return configValues;
|
|
1999
|
-
}, defaultValues);
|
|
2000
|
-
};
|
|
2001
|
-
var NumericColumnPanel = ({
|
|
2002
|
-
column,
|
|
2003
|
-
dispatchColumnAction
|
|
2004
|
-
}) => {
|
|
2005
|
-
const { decimals, alignOnDecimals, zeroPad } = getColumnValues(column == null ? void 0 : column.type);
|
|
2006
|
-
const dispatchUpdate = (0, import_react6.useCallback)(
|
|
2007
|
-
(values) => dispatchColumnAction({
|
|
2008
|
-
type: "updateColumnTypeFormatting",
|
|
2009
|
-
column,
|
|
2010
|
-
...values
|
|
2011
|
-
}),
|
|
2012
|
-
[column, dispatchColumnAction]
|
|
2013
|
-
);
|
|
2014
|
-
const handleChangeDecimals = (0, import_react6.useCallback)(
|
|
2015
|
-
(value) => dispatchUpdate({ decimals: parseInt(value.toString(), 10) }),
|
|
2016
|
-
[dispatchUpdate]
|
|
2017
|
-
);
|
|
2018
|
-
const handleChangeAlignOnDecimals = (0, import_react6.useCallback)(
|
|
2019
|
-
(evt) => dispatchUpdate({ alignOnDecimals: Boolean(evt.target.value) }),
|
|
2020
|
-
[dispatchUpdate]
|
|
2021
|
-
);
|
|
2022
|
-
const handleChangeZeroPad = (0, import_react6.useCallback)(
|
|
2023
|
-
(evt) => dispatchUpdate({ zeroPad: Boolean(evt.target.value) }),
|
|
2024
|
-
[dispatchUpdate]
|
|
2025
|
-
);
|
|
2026
|
-
switch (column.serverDataType) {
|
|
2027
|
-
case "double":
|
|
2028
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
2029
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_core2.FormField, { labelPlacement: "top", children: [
|
|
2030
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core2.FormFieldLabel, { children: "No of Decimals" }),
|
|
2031
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lab2.StepperInput, { value: decimals, onChange: handleChangeDecimals })
|
|
2032
|
-
] }),
|
|
2033
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2034
|
-
import_lab2.Switch,
|
|
2035
|
-
{
|
|
2036
|
-
checked: alignOnDecimals,
|
|
2037
|
-
label: "Align on decimals",
|
|
2038
|
-
onChange: handleChangeAlignOnDecimals
|
|
2039
|
-
}
|
|
2040
|
-
),
|
|
2041
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2042
|
-
import_lab2.Switch,
|
|
2043
|
-
{
|
|
2044
|
-
checked: zeroPad,
|
|
2045
|
-
label: "Zero pad",
|
|
2046
|
-
onChange: handleChangeZeroPad
|
|
2047
|
-
}
|
|
2048
|
-
)
|
|
2049
|
-
] });
|
|
2050
|
-
case "long":
|
|
2051
|
-
case "int":
|
|
2052
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core2.Text, { children: "Work in progress" }) });
|
|
2053
|
-
default:
|
|
2054
|
-
return null;
|
|
2055
|
-
}
|
|
2056
|
-
};
|
|
2057
|
-
|
|
2058
|
-
// src/datagrid-configuration-ui/column-type-panel/StringColumnPanel.tsx
|
|
2059
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2060
|
-
var StringColumnPanel = ({
|
|
2061
|
-
column,
|
|
2062
|
-
dispatchColumnAction
|
|
2063
|
-
}) => {
|
|
2064
|
-
console.log({ column, dispatchColumnAction });
|
|
2065
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: "what" });
|
|
2066
|
-
};
|
|
2067
|
-
|
|
2068
|
-
// src/datagrid-configuration-ui/column-type-panel/ColumnTypePanel.tsx
|
|
2069
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2070
|
-
var classBase5 = "vuuColumnTypePanel";
|
|
2071
|
-
var integerCellRenderers = ["Default Renderer (int, long)"];
|
|
2072
|
-
var doubleCellRenderers = ["Default Renderer (double)"];
|
|
2073
|
-
var stringCellRenderers = ["Default Renderer (string)"];
|
|
2074
|
-
var getAvailableCellRenderers = (column) => {
|
|
2075
|
-
const customCellRenderers = (0, import_vuu_utils7.getRegisteredCellRenderers)(column.serverDataType);
|
|
2076
|
-
const customRendererNames = customCellRenderers.map((r) => r.name);
|
|
2077
|
-
console.log({ customRendererNames });
|
|
2078
|
-
switch (column.serverDataType) {
|
|
2079
|
-
case "char":
|
|
2080
|
-
case "string":
|
|
2081
|
-
return stringCellRenderers;
|
|
2082
|
-
case "int":
|
|
2083
|
-
case "long":
|
|
2084
|
-
return integerCellRenderers;
|
|
2085
|
-
case "double":
|
|
2086
|
-
return doubleCellRenderers.concat(customRendererNames);
|
|
2087
|
-
default:
|
|
2088
|
-
return stringCellRenderers;
|
|
2397
|
+
// src/column-expression-panel/useColumnExpression.ts
|
|
2398
|
+
var import_vuu_utils13 = require("@vuu-ui/vuu-utils");
|
|
2399
|
+
var import_react10 = require("react");
|
|
2400
|
+
var applyDefaults = (column) => {
|
|
2401
|
+
const [name2, expression, type] = (0, import_vuu_utils13.getCalculatedColumnDetails)(column);
|
|
2402
|
+
if (type === "") {
|
|
2403
|
+
return {
|
|
2404
|
+
...column,
|
|
2405
|
+
name: `${name2}:${expression}:string`
|
|
2406
|
+
};
|
|
2407
|
+
} else {
|
|
2408
|
+
return column;
|
|
2089
2409
|
}
|
|
2090
2410
|
};
|
|
2091
|
-
var
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
dispatchColumnAction,
|
|
2095
|
-
...props
|
|
2411
|
+
var useColumnExpression = ({
|
|
2412
|
+
column: columnProp,
|
|
2413
|
+
onSave: onSaveProp
|
|
2096
2414
|
}) => {
|
|
2097
|
-
const
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
StringColumnPanel,
|
|
2112
|
-
{
|
|
2113
|
-
column,
|
|
2114
|
-
dispatchColumnAction
|
|
2115
|
-
}
|
|
2116
|
-
);
|
|
2415
|
+
const [column, setColumn] = (0, import_react10.useState)(
|
|
2416
|
+
applyDefaults(columnProp)
|
|
2417
|
+
);
|
|
2418
|
+
const expressionRef = (0, import_react10.useRef)((0, import_vuu_utils13.getCalculatedColumnDetails)(column)[1]);
|
|
2419
|
+
const onChangeName = (0, import_react10.useCallback)((evt) => {
|
|
2420
|
+
const { value } = evt.target;
|
|
2421
|
+
setColumn((state) => (0, import_vuu_utils13.setCalculatedColumnName)(state, value));
|
|
2422
|
+
}, []);
|
|
2423
|
+
const onChangeExpression = (0, import_react10.useCallback)((value) => {
|
|
2424
|
+
expressionRef.current = value.trim();
|
|
2425
|
+
}, []);
|
|
2426
|
+
const onChangeType = (0, import_react10.useCallback)((evt, value) => {
|
|
2427
|
+
if (typeof value === "string") {
|
|
2428
|
+
setColumn((state) => (0, import_vuu_utils13.setCalculatedColumnType)(state, value));
|
|
2117
2429
|
}
|
|
2118
|
-
}, [
|
|
2119
|
-
const
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
...props,
|
|
2135
|
-
className: (0, import_classnames4.default)(classBase5, className, `${classBase5}-${serverDataType}`),
|
|
2136
|
-
children: content
|
|
2137
|
-
}
|
|
2138
|
-
)
|
|
2139
|
-
] });
|
|
2430
|
+
}, []);
|
|
2431
|
+
const onSave = (0, import_react10.useCallback)(() => {
|
|
2432
|
+
const newColumn = (0, import_vuu_utils13.setCalculatedColumnExpression)(
|
|
2433
|
+
column,
|
|
2434
|
+
expressionRef.current
|
|
2435
|
+
);
|
|
2436
|
+
setColumn(newColumn);
|
|
2437
|
+
onSaveProp(newColumn);
|
|
2438
|
+
}, [column, onSaveProp]);
|
|
2439
|
+
return {
|
|
2440
|
+
column,
|
|
2441
|
+
onChangeExpression,
|
|
2442
|
+
onChangeName,
|
|
2443
|
+
onChangeType,
|
|
2444
|
+
onSave
|
|
2445
|
+
};
|
|
2140
2446
|
};
|
|
2141
2447
|
|
|
2142
|
-
// src/
|
|
2448
|
+
// src/column-expression-panel/ColumnExpressionPanel.tsx
|
|
2143
2449
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2144
|
-
var
|
|
2145
|
-
var
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
dispatchColumnAction,
|
|
2151
|
-
style: styleProp,
|
|
2152
|
-
...props
|
|
2450
|
+
var classBase8 = "vuuColumnExpressionPanel";
|
|
2451
|
+
var ColumnExpressionPanel = ({
|
|
2452
|
+
column: columnProp,
|
|
2453
|
+
onSave: onSaveProp,
|
|
2454
|
+
tableConfig,
|
|
2455
|
+
vuuTable
|
|
2153
2456
|
}) => {
|
|
2154
|
-
|
|
2155
|
-
const
|
|
2156
|
-
const
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
children:
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
{
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
onChange: handleChangeLabel
|
|
2220
|
-
}
|
|
2221
|
-
)
|
|
2222
|
-
] }),
|
|
2223
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_core4.FormField, { labelPlacement: "left", children: [
|
|
2224
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core4.FormFieldLabel, { children: "Width" }),
|
|
2225
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2226
|
-
import_lab4.StepperInput,
|
|
2227
|
-
{
|
|
2228
|
-
value: (_b = column.width) != null ? _b : 100,
|
|
2229
|
-
onChange: handleChangeWidth
|
|
2230
|
-
}
|
|
2231
|
-
)
|
|
2232
|
-
] }),
|
|
2233
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_core4.FormField, { labelPlacement: "left", children: [
|
|
2234
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core4.FormFieldLabel, { children: "ALign" }),
|
|
2235
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2236
|
-
import_core4.RadioButtonGroup,
|
|
2237
|
-
{
|
|
2238
|
-
"aria-label": "Column Align",
|
|
2239
|
-
value: (_c = column.align) != null ? _c : "left",
|
|
2240
|
-
onChange: handleChangeAlign,
|
|
2241
|
-
children: [
|
|
2242
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core4.RadioButton, { label: "Left", value: "left" }),
|
|
2243
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core4.RadioButton, { label: "Right", value: "right" })
|
|
2244
|
-
]
|
|
2245
|
-
}
|
|
2246
|
-
)
|
|
2247
|
-
] }),
|
|
2248
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_core4.FormField, { labelPlacement: "left", children: [
|
|
2249
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core4.FormFieldLabel, { children: "Pin Column" }),
|
|
2250
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2251
|
-
import_core4.RadioButtonGroup,
|
|
2252
|
-
{
|
|
2253
|
-
"aria-label": "Pin Column",
|
|
2254
|
-
value: (_d = column.pin) != null ? _d : "",
|
|
2255
|
-
onChange: handleChangePin,
|
|
2256
|
-
children: [
|
|
2257
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core4.RadioButton, { label: "Do not pin", value: "" }),
|
|
2258
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core4.RadioButton, { label: "Left", value: "left" }),
|
|
2259
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core4.RadioButton, { label: "Right", value: "right" })
|
|
2260
|
-
]
|
|
2261
|
-
}
|
|
2262
|
-
)
|
|
2263
|
-
] })
|
|
2264
|
-
] }),
|
|
2265
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2266
|
-
ColumnTypePanel,
|
|
2267
|
-
{
|
|
2268
|
-
column,
|
|
2269
|
-
dispatchColumnAction,
|
|
2270
|
-
title: "Data Cell"
|
|
2271
|
-
}
|
|
2272
|
-
),
|
|
2273
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_core4.Panel, { title: "Vuu", variant: "secondary", children: [
|
|
2274
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_core4.FormField, { labelPlacement: "top", readOnly: true, children: [
|
|
2275
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core4.FormFieldLabel, { children: "Name" }),
|
|
2276
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core4.Input, { value: column.name })
|
|
2277
|
-
] }),
|
|
2278
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_core4.FormField, { labelPlacement: "top", readOnly: true, children: [
|
|
2279
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core4.FormFieldLabel, { children: "Vuu Type" }),
|
|
2280
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core4.Input, { value: column.serverDataType })
|
|
2281
|
-
] })
|
|
2282
|
-
] })
|
|
2283
|
-
]
|
|
2284
|
-
}
|
|
2285
|
-
)
|
|
2286
|
-
]
|
|
2287
|
-
}
|
|
2288
|
-
);
|
|
2457
|
+
const typeRef = (0, import_react11.useRef)(null);
|
|
2458
|
+
const { column, onChangeExpression, onChangeName, onChangeType, onSave } = useColumnExpression({ column: columnProp, onSave: onSaveProp });
|
|
2459
|
+
const suggestionProvider = useColumnExpressionSuggestionProvider({
|
|
2460
|
+
columns: tableConfig.columns,
|
|
2461
|
+
table: vuuTable
|
|
2462
|
+
});
|
|
2463
|
+
const handleSubmitExpression = (0, import_react11.useCallback)(() => {
|
|
2464
|
+
requestAnimationFrame(() => {
|
|
2465
|
+
var _a, _b;
|
|
2466
|
+
(_b = (_a = typeRef.current) == null ? void 0 : _a.querySelector("button")) == null ? void 0 : _b.focus();
|
|
2467
|
+
});
|
|
2468
|
+
}, []);
|
|
2469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: classBase8, children: [
|
|
2470
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "vuuColumnSettingsPanel-header", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Calculation" }) }),
|
|
2471
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_core4.FormField, { "data-field": "column-name", children: [
|
|
2472
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core4.FormFieldLabel, { children: "Column Name" }),
|
|
2473
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2474
|
+
import_core4.Input,
|
|
2475
|
+
{
|
|
2476
|
+
className: "vuuInput",
|
|
2477
|
+
onChange: onChangeName,
|
|
2478
|
+
value: (0, import_vuu_utils14.getCalculatedColumnName)(column)
|
|
2479
|
+
}
|
|
2480
|
+
)
|
|
2481
|
+
] }),
|
|
2482
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_core4.FormField, { "data-field": "column-expression", children: [
|
|
2483
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core4.FormFieldLabel, { children: "Expression" }),
|
|
2484
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2485
|
+
ColumnExpressionInput,
|
|
2486
|
+
{
|
|
2487
|
+
onChange: onChangeExpression,
|
|
2488
|
+
onSubmitExpression: handleSubmitExpression,
|
|
2489
|
+
source: (0, import_vuu_utils14.getCalculatedColumnExpression)(column),
|
|
2490
|
+
suggestionProvider
|
|
2491
|
+
}
|
|
2492
|
+
)
|
|
2493
|
+
] }),
|
|
2494
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_core4.FormField, { "data-field": "type", children: [
|
|
2495
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core4.FormFieldLabel, { children: "Column type" }),
|
|
2496
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2497
|
+
import_vuu_ui_controls3.Dropdown,
|
|
2498
|
+
{
|
|
2499
|
+
className: `${classBase8}-type`,
|
|
2500
|
+
onSelectionChange: onChangeType,
|
|
2501
|
+
ref: typeRef,
|
|
2502
|
+
selected: (0, import_vuu_utils14.getCalculatedColumnType)(column) || null,
|
|
2503
|
+
source: ["double", "long", "string"],
|
|
2504
|
+
width: "100%"
|
|
2505
|
+
}
|
|
2506
|
+
)
|
|
2507
|
+
] }),
|
|
2508
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "vuuColumnSettingsPanel-buttonBar", "data-align": "right", children: [
|
|
2509
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core4.Button, { className: `${classBase8}-buttonCancel`, tabIndex: -1, children: "cancel" }),
|
|
2510
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core4.Button, { className: `${classBase8}-buttonApply`, tabIndex: -1, children: "apply" }),
|
|
2511
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2512
|
+
import_core4.Button,
|
|
2513
|
+
{
|
|
2514
|
+
className: `${classBase8}-buttonSave`,
|
|
2515
|
+
onClick: onSave,
|
|
2516
|
+
variant: "cta",
|
|
2517
|
+
children: "save"
|
|
2518
|
+
}
|
|
2519
|
+
)
|
|
2520
|
+
] })
|
|
2521
|
+
] });
|
|
2289
2522
|
};
|
|
2290
2523
|
|
|
2291
|
-
// src/
|
|
2292
|
-
var
|
|
2293
|
-
var import_lab5 = require("@salt-ds/lab");
|
|
2294
|
-
var import_react9 = require("react");
|
|
2524
|
+
// src/column-settings/ColumnSettingsPanel.tsx
|
|
2525
|
+
var import_vuu_ui_controls4 = require("@vuu-ui/vuu-ui-controls");
|
|
2295
2526
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2296
|
-
var
|
|
2297
|
-
var
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2527
|
+
var classBase9 = "vuuColumnSettingsPanel";
|
|
2528
|
+
var ColumnSettingsPanel = ({
|
|
2529
|
+
column: columnProp,
|
|
2530
|
+
onConfigChange,
|
|
2531
|
+
onCreateCalculatedColumn,
|
|
2532
|
+
tableConfig,
|
|
2533
|
+
vuuTable
|
|
2302
2534
|
}) => {
|
|
2303
|
-
|
|
2304
|
-
const
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
);
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2535
|
+
const isNewCalculatedColumn = columnProp.name === "::";
|
|
2536
|
+
const {
|
|
2537
|
+
availableRenderers,
|
|
2538
|
+
selectedCellRenderer,
|
|
2539
|
+
column,
|
|
2540
|
+
navigateNextColumn,
|
|
2541
|
+
navigatePrevColumn,
|
|
2542
|
+
onChange,
|
|
2543
|
+
onChangeFormatting,
|
|
2544
|
+
onChangeRenderer,
|
|
2545
|
+
onInputCommit,
|
|
2546
|
+
onSave
|
|
2547
|
+
} = useColumnSettings({
|
|
2548
|
+
column: columnProp,
|
|
2549
|
+
onConfigChange,
|
|
2550
|
+
onCreateCalculatedColumn,
|
|
2551
|
+
tableConfig
|
|
2552
|
+
});
|
|
2553
|
+
const {
|
|
2554
|
+
serverDataType,
|
|
2555
|
+
align = (0, import_vuu_utils15.getDefaultAlignment)(serverDataType),
|
|
2556
|
+
name: name2,
|
|
2557
|
+
label = name2,
|
|
2558
|
+
pin,
|
|
2559
|
+
width
|
|
2560
|
+
} = column;
|
|
2561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: classBase9, children: [
|
|
2562
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${classBase9}-header`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: name2 }) }),
|
|
2563
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_core5.FormField, { "data-field": "column-label", children: [
|
|
2564
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core5.FormFieldLabel, { children: "Column Label" }),
|
|
2565
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2566
|
+
import_vuu_ui_controls4.VuuInput,
|
|
2567
|
+
{
|
|
2568
|
+
className: "vuuInput",
|
|
2569
|
+
onChange,
|
|
2570
|
+
onCommit: onInputCommit,
|
|
2571
|
+
value: label
|
|
2572
|
+
}
|
|
2573
|
+
)
|
|
2574
|
+
] }),
|
|
2575
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_core5.FormField, { "data-field": "column-width", children: [
|
|
2576
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core5.FormFieldLabel, { children: "Column Width" }),
|
|
2577
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2578
|
+
import_vuu_ui_controls4.VuuInput,
|
|
2579
|
+
{
|
|
2580
|
+
className: "vuuInput",
|
|
2581
|
+
onChange,
|
|
2582
|
+
value: width,
|
|
2583
|
+
onCommit: onInputCommit
|
|
2584
|
+
}
|
|
2585
|
+
)
|
|
2586
|
+
] }),
|
|
2587
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_core5.FormField, { "data-field": "column-alignment", children: [
|
|
2588
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core5.FormFieldLabel, { children: "Alignment" }),
|
|
2589
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2590
|
+
import_core5.ToggleButtonGroup,
|
|
2591
|
+
{
|
|
2592
|
+
className: "vuuToggleButtonGroup",
|
|
2593
|
+
onChange,
|
|
2594
|
+
value: align,
|
|
2595
|
+
children: [
|
|
2596
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2597
|
+
import_core5.ToggleButton,
|
|
2598
|
+
{
|
|
2599
|
+
"data-icon": "align-left",
|
|
2600
|
+
className: "vuuIconToggleButton",
|
|
2601
|
+
value: "left"
|
|
2602
|
+
}
|
|
2603
|
+
),
|
|
2604
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2605
|
+
import_core5.ToggleButton,
|
|
2336
2606
|
{
|
|
2337
|
-
"
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
children: [
|
|
2341
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core5.RadioButton, { label: "No Formatting", value: void 0 }),
|
|
2342
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core5.RadioButton, { label: "Capitalize", value: "capitalize" }),
|
|
2343
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core5.RadioButton, { label: "Uppercase", value: "uppercase" })
|
|
2344
|
-
]
|
|
2607
|
+
"data-icon": "align-right",
|
|
2608
|
+
className: "vuuIconToggleButton",
|
|
2609
|
+
value: "right"
|
|
2345
2610
|
}
|
|
2346
2611
|
)
|
|
2347
|
-
]
|
|
2348
|
-
|
|
2349
|
-
|
|
2612
|
+
]
|
|
2613
|
+
}
|
|
2614
|
+
)
|
|
2615
|
+
] }),
|
|
2616
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_core5.FormField, { "data-field": "column-pin", children: [
|
|
2617
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core5.FormFieldLabel, { children: "Pin Column" }),
|
|
2618
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2619
|
+
import_core5.ToggleButtonGroup,
|
|
2620
|
+
{
|
|
2621
|
+
className: "vuuToggleButtonGroup",
|
|
2622
|
+
onChange,
|
|
2623
|
+
value: pin != null ? pin : "",
|
|
2624
|
+
children: [
|
|
2625
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2626
|
+
import_core5.ToggleButton,
|
|
2627
|
+
{
|
|
2628
|
+
className: "vuuIconToggleButton",
|
|
2629
|
+
"data-icon": "cross-circle",
|
|
2630
|
+
value: ""
|
|
2631
|
+
}
|
|
2632
|
+
),
|
|
2633
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2634
|
+
import_core5.ToggleButton,
|
|
2635
|
+
{
|
|
2636
|
+
className: "vuuIconToggleButton",
|
|
2637
|
+
"data-icon": "pin-left",
|
|
2638
|
+
value: "left"
|
|
2639
|
+
}
|
|
2640
|
+
),
|
|
2641
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2642
|
+
import_core5.ToggleButton,
|
|
2643
|
+
{
|
|
2644
|
+
className: "vuuIconToggleButton",
|
|
2645
|
+
"data-icon": "pin-float",
|
|
2646
|
+
value: "floating"
|
|
2647
|
+
}
|
|
2648
|
+
),
|
|
2350
2649
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2351
|
-
|
|
2650
|
+
import_core5.ToggleButton,
|
|
2352
2651
|
{
|
|
2353
|
-
|
|
2354
|
-
|
|
2652
|
+
className: "vuuIconToggleButton",
|
|
2653
|
+
"data-icon": "pin-right",
|
|
2654
|
+
value: "right"
|
|
2355
2655
|
}
|
|
2356
2656
|
)
|
|
2357
|
-
]
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
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
|
-
return state;
|
|
2411
|
-
}
|
|
2412
|
-
function addCalculatedColumn(state, { columnName, columnType, expression }) {
|
|
2413
|
-
const { columns: stateColumns } = state;
|
|
2414
|
-
const calculatedColumn = {
|
|
2415
|
-
name: columnName,
|
|
2416
|
-
expression,
|
|
2417
|
-
serverDataType: columnType
|
|
2418
|
-
};
|
|
2419
|
-
return { ...state, columns: stateColumns.concat(calculatedColumn) };
|
|
2420
|
-
}
|
|
2421
|
-
function removeColumn(state, { column }) {
|
|
2422
|
-
const { columns: stateColumns } = state;
|
|
2423
|
-
return {
|
|
2424
|
-
...state,
|
|
2425
|
-
columns: stateColumns.filter((col) => col.name !== column.name)
|
|
2426
|
-
};
|
|
2427
|
-
}
|
|
2428
|
-
function moveColumn(state, { column, moveBy, moveFrom, moveTo }) {
|
|
2429
|
-
const { columns: stateColumns } = state;
|
|
2430
|
-
if (column && typeof moveBy === "number") {
|
|
2431
|
-
const idx = stateColumns.indexOf(column);
|
|
2432
|
-
const newColumns = stateColumns.slice();
|
|
2433
|
-
const [movedColumns] = newColumns.splice(idx, 1);
|
|
2434
|
-
newColumns.splice(idx + moveBy, 0, movedColumns);
|
|
2435
|
-
return {
|
|
2436
|
-
...state,
|
|
2437
|
-
columns: newColumns
|
|
2438
|
-
};
|
|
2439
|
-
} else if (typeof moveFrom === "number" && typeof moveTo === "number") {
|
|
2440
|
-
return {
|
|
2441
|
-
...state,
|
|
2442
|
-
columns: (0, import_vuu_ui_controls2.moveItem)(stateColumns, moveFrom, moveTo)
|
|
2443
|
-
};
|
|
2444
|
-
} else {
|
|
2445
|
-
return state;
|
|
2446
|
-
}
|
|
2447
|
-
}
|
|
2448
|
-
function updateColumnProp(state, { align, column, hidden, label, width }) {
|
|
2449
|
-
let { columns: stateColumns } = state;
|
|
2450
|
-
if (align === "left" || align === "right") {
|
|
2451
|
-
stateColumns = replaceColumn(stateColumns, { ...column, align });
|
|
2452
|
-
}
|
|
2453
|
-
if (typeof hidden === "boolean") {
|
|
2454
|
-
stateColumns = replaceColumn(stateColumns, { ...column, hidden });
|
|
2455
|
-
}
|
|
2456
|
-
if (typeof label === "string") {
|
|
2457
|
-
stateColumns = replaceColumn(stateColumns, { ...column, label });
|
|
2458
|
-
}
|
|
2459
|
-
if (typeof width === "number") {
|
|
2460
|
-
stateColumns = replaceColumn(stateColumns, { ...column, width });
|
|
2461
|
-
}
|
|
2462
|
-
return {
|
|
2463
|
-
...state,
|
|
2464
|
-
columns: stateColumns
|
|
2465
|
-
};
|
|
2466
|
-
}
|
|
2467
|
-
function updateGridSettings(state, { columnFormatHeader }) {
|
|
2468
|
-
return {
|
|
2469
|
-
...state,
|
|
2470
|
-
columnFormatHeader: columnFormatHeader != null ? columnFormatHeader : state.columnFormatHeader
|
|
2471
|
-
};
|
|
2472
|
-
}
|
|
2473
|
-
function updateColumnTypeFormatting(state, {
|
|
2474
|
-
alignOnDecimals,
|
|
2475
|
-
column,
|
|
2476
|
-
decimals,
|
|
2477
|
-
zeroPad
|
|
2478
|
-
}) {
|
|
2479
|
-
const { columns: stateColumns } = state;
|
|
2480
|
-
const targetColumn = stateColumns.find((col) => col.name === column.name);
|
|
2481
|
-
if (targetColumn) {
|
|
2482
|
-
const {
|
|
2483
|
-
serverDataType = "string",
|
|
2484
|
-
type: columnType = (0, import_vuu_utils8.fromServerDataType)(serverDataType)
|
|
2485
|
-
} = column;
|
|
2486
|
-
const type = typeof columnType === "string" ? {
|
|
2487
|
-
name: columnType
|
|
2488
|
-
} : {
|
|
2489
|
-
...columnType
|
|
2490
|
-
};
|
|
2491
|
-
if (typeof alignOnDecimals === "boolean") {
|
|
2492
|
-
type.formatting = {
|
|
2493
|
-
...type.formatting,
|
|
2494
|
-
alignOnDecimals
|
|
2495
|
-
};
|
|
2496
|
-
}
|
|
2497
|
-
if (typeof decimals === "number") {
|
|
2498
|
-
type.formatting = {
|
|
2499
|
-
...type.formatting,
|
|
2500
|
-
decimals
|
|
2501
|
-
};
|
|
2502
|
-
}
|
|
2503
|
-
if (typeof zeroPad === "boolean") {
|
|
2504
|
-
type.formatting = {
|
|
2505
|
-
...type.formatting,
|
|
2506
|
-
zeroPad
|
|
2507
|
-
};
|
|
2508
|
-
}
|
|
2509
|
-
return {
|
|
2510
|
-
...state,
|
|
2511
|
-
columns: replaceColumn(stateColumns, { ...column, type })
|
|
2512
|
-
};
|
|
2513
|
-
} else {
|
|
2514
|
-
return state;
|
|
2515
|
-
}
|
|
2516
|
-
}
|
|
2517
|
-
function replaceColumn(columns, column) {
|
|
2518
|
-
return columns.map((col) => col.name === column.name ? column : col);
|
|
2519
|
-
}
|
|
2520
|
-
|
|
2521
|
-
// src/datagrid-configuration-ui/settings-panel/DatagridSettingsPanel.tsx
|
|
2522
|
-
var import_vuu_layout2 = require("@vuu-ui/vuu-layout");
|
|
2523
|
-
|
|
2524
|
-
// src/datagrid-configuration-ui/calculated-column-panel/CalculatedColumnPanel.tsx
|
|
2525
|
-
var import_core6 = require("@salt-ds/core");
|
|
2526
|
-
var import_react11 = require("react");
|
|
2527
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2528
|
-
var CalculatedColumnPanel = ({
|
|
2529
|
-
columns,
|
|
2530
|
-
dispatchColumnAction,
|
|
2531
|
-
table
|
|
2532
|
-
}) => {
|
|
2533
|
-
const [columnName, setColumnName] = (0, import_react11.useState)("");
|
|
2534
|
-
const [, setExpression] = (0, import_react11.useState)();
|
|
2535
|
-
const sourceRef = (0, import_react11.useRef)("");
|
|
2536
|
-
const suggestionProvider = useColumnExpressionSuggestionProvider({
|
|
2537
|
-
columns,
|
|
2538
|
-
table
|
|
2539
|
-
});
|
|
2540
|
-
const handleChangeName = (0, import_react11.useCallback)(
|
|
2541
|
-
(evt) => {
|
|
2542
|
-
const { value } = evt.target;
|
|
2543
|
-
setColumnName(value);
|
|
2544
|
-
},
|
|
2545
|
-
[]
|
|
2546
|
-
);
|
|
2547
|
-
const handleChangeExpression = (0, import_react11.useCallback)((source) => {
|
|
2548
|
-
sourceRef.current = source;
|
|
2549
|
-
}, []);
|
|
2550
|
-
const handleSubmitExpression = (0, import_react11.useCallback)(
|
|
2551
|
-
(source, expression) => {
|
|
2552
|
-
console.log({ source });
|
|
2553
|
-
setExpression(expression);
|
|
2554
|
-
},
|
|
2555
|
-
[]
|
|
2556
|
-
);
|
|
2557
|
-
const handleSave = (0, import_react11.useCallback)(() => {
|
|
2558
|
-
if (sourceRef.current) {
|
|
2559
|
-
console.log(
|
|
2560
|
-
`save expression ${JSON.stringify(sourceRef.current, null, 2)}`
|
|
2561
|
-
);
|
|
2562
|
-
dispatchColumnAction({
|
|
2563
|
-
type: "addCalculatedColumn",
|
|
2564
|
-
columnName,
|
|
2565
|
-
expression: sourceRef.current,
|
|
2566
|
-
columnType: "string"
|
|
2567
|
-
});
|
|
2568
|
-
}
|
|
2569
|
-
}, [columnName, dispatchColumnAction]);
|
|
2570
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_core6.Panel, { className: "vuuCalculatedColumnPanel", title: "Define Computed Column", children: [
|
|
2571
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_core6.Text, { styleAs: "h4", children: "Define Computed Column" }),
|
|
2572
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_core6.FormField, { labelPlacement: "left", children: [
|
|
2573
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_core6.FormFieldLabel, { children: "Column Name" }),
|
|
2574
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_core6.Input, { value: columnName, onChange: handleChangeName })
|
|
2575
|
-
] }),
|
|
2576
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2577
|
-
ColumnExpressionInput,
|
|
2578
|
-
{
|
|
2579
|
-
onChange: handleChangeExpression,
|
|
2580
|
-
onSubmitExpression: handleSubmitExpression,
|
|
2581
|
-
suggestionProvider
|
|
2582
|
-
}
|
|
2583
|
-
),
|
|
2584
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_core6.Button, { onClick: handleSave, children: "Add Column" }) })
|
|
2585
|
-
] });
|
|
2586
|
-
};
|
|
2587
|
-
|
|
2588
|
-
// src/datagrid-configuration-ui/settings-panel/DatagridSettingsPanel.tsx
|
|
2589
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2590
|
-
var classBase8 = "vuuDatagridSettingsPanel";
|
|
2591
|
-
var getTabLabel = () => void 0;
|
|
2592
|
-
var icons = [
|
|
2593
|
-
"table-settings",
|
|
2594
|
-
"column-chooser",
|
|
2595
|
-
"column-settings",
|
|
2596
|
-
"define-column"
|
|
2597
|
-
];
|
|
2598
|
-
var getTabIcon = (component, tabIndex) => icons[tabIndex];
|
|
2599
|
-
var DatagridSettingsPanel = ({
|
|
2600
|
-
availableColumns,
|
|
2601
|
-
className,
|
|
2602
|
-
gridConfig,
|
|
2603
|
-
onCancel,
|
|
2604
|
-
onConfigChange,
|
|
2605
|
-
...props
|
|
2606
|
-
}) => {
|
|
2607
|
-
var _a;
|
|
2608
|
-
console.log(`DatagridSettingsPanel render`);
|
|
2609
|
-
const [selectedTabIndex, setSelectedTabIndex] = (0, import_react12.useState)(0);
|
|
2610
|
-
const { gridSettings, dispatchColumnAction } = useGridSettings(gridConfig);
|
|
2611
|
-
const [selectedColumnName, setSelectedColumnName] = (0, import_react12.useState)(
|
|
2612
|
-
null
|
|
2613
|
-
);
|
|
2614
|
-
const handleColumnSelected = (0, import_react12.useCallback)(
|
|
2615
|
-
(selected) => {
|
|
2616
|
-
setSelectedColumnName(selected ? selected.name : null);
|
|
2617
|
-
},
|
|
2618
|
-
[]
|
|
2619
|
-
);
|
|
2620
|
-
const handleApply = (0, import_react12.useCallback)(
|
|
2621
|
-
(evt, closePanel = false) => {
|
|
2622
|
-
console.log(`1) DataGridSettingsPanel fire onConfigChange`);
|
|
2623
|
-
onConfigChange == null ? void 0 : onConfigChange(gridSettings, closePanel);
|
|
2624
|
-
},
|
|
2625
|
-
[gridSettings, onConfigChange]
|
|
2626
|
-
);
|
|
2627
|
-
const handleTabSelectionChanged = (0, import_react12.useCallback)((selectedTabIndex2) => {
|
|
2628
|
-
setSelectedTabIndex(selectedTabIndex2);
|
|
2629
|
-
}, []);
|
|
2630
|
-
const handleSave = (0, import_react12.useCallback)(
|
|
2631
|
-
(evt) => handleApply(evt, true),
|
|
2632
|
-
[handleApply]
|
|
2633
|
-
);
|
|
2634
|
-
const selectedColumn = selectedColumnName === null ? null : (_a = gridSettings.columns.find((col) => col.name === selectedColumnName)) != null ? _a : null;
|
|
2635
|
-
const tabstripProps2 = {
|
|
2636
|
-
activeTabIndex: selectedTabIndex,
|
|
2637
|
-
allowRenameTab: false,
|
|
2638
|
-
orientation: "vertical"
|
|
2639
|
-
};
|
|
2640
|
-
const handleAddCalculatedColumn = (0, import_react12.useCallback)(
|
|
2641
|
-
() => setSelectedTabIndex(3),
|
|
2642
|
-
[]
|
|
2643
|
-
);
|
|
2644
|
-
const panelShift = selectedTabIndex === 2 ? "right" : void 0;
|
|
2645
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { ...props, className: (0, import_classnames6.default)(classBase8, className), children: [
|
|
2646
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2647
|
-
import_vuu_layout2.Stack,
|
|
2648
|
-
{
|
|
2649
|
-
TabstripProps: tabstripProps2,
|
|
2650
|
-
className: `${classBase8}-stack`,
|
|
2651
|
-
getTabIcon,
|
|
2652
|
-
getTabLabel,
|
|
2653
|
-
active: selectedTabIndex === 2 ? 1 : selectedTabIndex,
|
|
2654
|
-
onTabSelectionChanged: handleTabSelectionChanged,
|
|
2655
|
-
children: [
|
|
2656
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2657
|
-
GridSettingsPanel,
|
|
2658
|
-
{
|
|
2659
|
-
config: gridSettings,
|
|
2660
|
-
dispatchColumnAction
|
|
2661
|
-
}
|
|
2662
|
-
),
|
|
2663
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `${classBase8}-columnPanels`, "data-align": panelShift, children: selectedColumn === null ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_core7.Panel, { className: "vuuColumnSettingsPanel", children: "Select a column" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2664
|
-
ColumnSettingsPanel,
|
|
2665
|
-
{
|
|
2666
|
-
column: selectedColumn,
|
|
2667
|
-
dispatchColumnAction,
|
|
2668
|
-
style: { background: "white", flex: "1 0 150px" }
|
|
2669
|
-
}
|
|
2670
|
-
) }),
|
|
2671
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { title: "Column Settings", children: "Column Settings" }),
|
|
2672
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2673
|
-
CalculatedColumnPanel,
|
|
2674
|
-
{
|
|
2675
|
-
columns: gridSettings.columns,
|
|
2676
|
-
dispatchColumnAction,
|
|
2677
|
-
table: { module: "SIMUL", table: "instruments" }
|
|
2678
|
-
}
|
|
2679
|
-
)
|
|
2680
|
-
]
|
|
2681
|
-
}
|
|
2682
|
-
),
|
|
2683
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `${classBase8}-buttonBar`, children: [
|
|
2684
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_core7.Button, { onClick: onCancel, children: "Cancel" }),
|
|
2685
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_core7.Button, { onClick: handleApply, children: "Apply" }),
|
|
2686
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_core7.Button, { onClick: handleSave, children: "Save" })
|
|
2687
|
-
] })
|
|
2688
|
-
] });
|
|
2657
|
+
]
|
|
2658
|
+
}
|
|
2659
|
+
)
|
|
2660
|
+
] }),
|
|
2661
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2662
|
+
ColumnFormattingPanel,
|
|
2663
|
+
{
|
|
2664
|
+
availableRenderers,
|
|
2665
|
+
selectedCellRenderer,
|
|
2666
|
+
column,
|
|
2667
|
+
onChangeFormatting,
|
|
2668
|
+
onChangeRenderer
|
|
2669
|
+
}
|
|
2670
|
+
),
|
|
2671
|
+
(0, import_vuu_utils15.isCalculatedColumn)(column.name) ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2672
|
+
ColumnExpressionPanel,
|
|
2673
|
+
{
|
|
2674
|
+
column,
|
|
2675
|
+
onSave,
|
|
2676
|
+
tableConfig,
|
|
2677
|
+
vuuTable
|
|
2678
|
+
}
|
|
2679
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2680
|
+
"div",
|
|
2681
|
+
{
|
|
2682
|
+
className: `${classBase9}-buttonBar`,
|
|
2683
|
+
"data-align": isNewCalculatedColumn ? "right" : void 0,
|
|
2684
|
+
children: [
|
|
2685
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2686
|
+
import_core5.Button,
|
|
2687
|
+
{
|
|
2688
|
+
className: `${classBase9}-buttonNavPrev`,
|
|
2689
|
+
variant: "secondary",
|
|
2690
|
+
"data-icon": "arrow-left",
|
|
2691
|
+
onClick: navigatePrevColumn,
|
|
2692
|
+
children: "PREVIOUS"
|
|
2693
|
+
}
|
|
2694
|
+
),
|
|
2695
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2696
|
+
import_core5.Button,
|
|
2697
|
+
{
|
|
2698
|
+
className: `${classBase9}-buttonNavNext`,
|
|
2699
|
+
variant: "secondary",
|
|
2700
|
+
"data-icon": "arrow-right",
|
|
2701
|
+
onClick: navigateNextColumn,
|
|
2702
|
+
children: "NEXT"
|
|
2703
|
+
}
|
|
2704
|
+
)
|
|
2705
|
+
]
|
|
2706
|
+
}
|
|
2707
|
+
)
|
|
2708
|
+
] });
|
|
2689
2709
|
};
|
|
2690
2710
|
|
|
2691
2711
|
// src/datasource-stats/DatasourceStats.tsx
|
|
2692
|
-
var
|
|
2693
|
-
var
|
|
2694
|
-
var
|
|
2695
|
-
var
|
|
2712
|
+
var import_react12 = require("react");
|
|
2713
|
+
var import_classnames6 = __toESM(require("classnames"), 1);
|
|
2714
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2715
|
+
var classBase10 = "vuuDatasourceStats";
|
|
2696
2716
|
var numberFormatter = new Intl.NumberFormat();
|
|
2697
2717
|
var DataSourceStats = ({
|
|
2698
2718
|
className: classNameProp,
|
|
2699
2719
|
dataSource
|
|
2700
2720
|
}) => {
|
|
2701
|
-
const [range, setRange] = (0,
|
|
2702
|
-
const [size, setSize] = (0,
|
|
2703
|
-
(0,
|
|
2721
|
+
const [range, setRange] = (0, import_react12.useState)(dataSource.range);
|
|
2722
|
+
const [size, setSize] = (0, import_react12.useState)(dataSource.size);
|
|
2723
|
+
(0, import_react12.useEffect)(() => {
|
|
2704
2724
|
setSize(dataSource.size);
|
|
2705
2725
|
dataSource.on("resize", setSize);
|
|
2706
2726
|
dataSource.on("range", setRange);
|
|
2707
2727
|
}, [dataSource]);
|
|
2708
|
-
const className = (0,
|
|
2728
|
+
const className = (0, import_classnames6.default)(classBase10, classNameProp);
|
|
2709
2729
|
const from = numberFormatter.format(range.from);
|
|
2710
2730
|
const to = numberFormatter.format(range.to - 1);
|
|
2711
2731
|
const value = numberFormatter.format(size);
|
|
2712
|
-
return /* @__PURE__ */ (0,
|
|
2713
|
-
/* @__PURE__ */ (0,
|
|
2714
|
-
/* @__PURE__ */ (0,
|
|
2715
|
-
/* @__PURE__ */ (0,
|
|
2716
|
-
/* @__PURE__ */ (0,
|
|
2717
|
-
/* @__PURE__ */ (0,
|
|
2732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className, children: [
|
|
2733
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: `${classBase10}-label`, children: "Row count" }),
|
|
2734
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: `${classBase10}-range`, children: from }),
|
|
2735
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "-" }),
|
|
2736
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: `${classBase10}-range`, children: to }),
|
|
2737
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "of" }),
|
|
2738
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: `${classBase10}-size`, children: value })
|
|
2718
2739
|
] });
|
|
2719
2740
|
};
|
|
2720
2741
|
|
|
2721
2742
|
// src/table-settings/TableSettingsPanel.tsx
|
|
2722
|
-
var
|
|
2743
|
+
var import_core8 = require("@salt-ds/core");
|
|
2723
2744
|
|
|
2724
2745
|
// src/table-settings/useTableSettings.ts
|
|
2725
2746
|
var import_vuu_layout4 = require("@vuu-ui/vuu-layout");
|
|
2726
2747
|
|
|
2727
2748
|
// ../vuu-table/src/table/ColumnResizer.tsx
|
|
2728
|
-
var
|
|
2729
|
-
var
|
|
2749
|
+
var import_react13 = require("react");
|
|
2750
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2730
2751
|
|
|
2731
2752
|
// ../vuu-table/src/table/context-menu/buildContextMenuDescriptors.ts
|
|
2732
|
-
var
|
|
2753
|
+
var import_vuu_utils16 = require("@vuu-ui/vuu-utils");
|
|
2733
2754
|
|
|
2734
2755
|
// ../vuu-table/src/table/context-menu/useTableContextMenu.ts
|
|
2735
|
-
var
|
|
2736
|
-
var
|
|
2737
|
-
var { Average, Count, Distinct, High, Low, Sum } =
|
|
2756
|
+
var import_vuu_utils17 = require("@vuu-ui/vuu-utils");
|
|
2757
|
+
var import_vuu_utils18 = require("@vuu-ui/vuu-utils");
|
|
2758
|
+
var { Average, Count, Distinct, High, Low, Sum } = import_vuu_utils18.AggregationType;
|
|
2738
2759
|
|
|
2739
2760
|
// ../vuu-table/src/table/Table.tsx
|
|
2740
2761
|
var import_vuu_popups4 = require("@vuu-ui/vuu-popups");
|
|
2741
|
-
var
|
|
2762
|
+
var import_core6 = require("@salt-ds/core");
|
|
2742
2763
|
|
|
2743
2764
|
// ../vuu-table/src/table/RowBasedTable.tsx
|
|
2744
|
-
var
|
|
2745
|
-
var
|
|
2765
|
+
var import_vuu_utils22 = require("@vuu-ui/vuu-utils");
|
|
2766
|
+
var import_react21 = require("react");
|
|
2746
2767
|
|
|
2747
2768
|
// ../vuu-table/src/table/TableRow.tsx
|
|
2748
|
-
var
|
|
2749
|
-
var
|
|
2750
|
-
var
|
|
2769
|
+
var import_vuu_utils21 = require("@vuu-ui/vuu-utils");
|
|
2770
|
+
var import_classnames8 = __toESM(require("classnames"));
|
|
2771
|
+
var import_react16 = require("react");
|
|
2751
2772
|
|
|
2752
2773
|
// ../vuu-table/src/table/TableCell.tsx
|
|
2753
|
-
var
|
|
2754
|
-
var
|
|
2755
|
-
var
|
|
2756
|
-
var
|
|
2757
|
-
var
|
|
2758
|
-
var { KEY:
|
|
2759
|
-
var TableCell = (0,
|
|
2774
|
+
var import_vuu_utils19 = require("@vuu-ui/vuu-utils");
|
|
2775
|
+
var import_vuu_ui_controls5 = require("@vuu-ui/vuu-ui-controls");
|
|
2776
|
+
var import_classnames7 = __toESM(require("classnames"));
|
|
2777
|
+
var import_react14 = require("react");
|
|
2778
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2779
|
+
var { KEY: KEY3 } = import_vuu_utils19.metadataKeys;
|
|
2780
|
+
var TableCell = (0, import_react14.memo)(
|
|
2760
2781
|
({
|
|
2761
2782
|
className: classNameProp,
|
|
2762
2783
|
column,
|
|
@@ -2764,7 +2785,7 @@ var TableCell = (0, import_react15.memo)(
|
|
|
2764
2785
|
onClick,
|
|
2765
2786
|
row
|
|
2766
2787
|
}) => {
|
|
2767
|
-
const labelFieldRef = (0,
|
|
2788
|
+
const labelFieldRef = (0, import_react14.useRef)(null);
|
|
2768
2789
|
const {
|
|
2769
2790
|
align,
|
|
2770
2791
|
CellRenderer,
|
|
@@ -2774,9 +2795,9 @@ var TableCell = (0, import_react15.memo)(
|
|
|
2774
2795
|
resizing,
|
|
2775
2796
|
valueFormatter
|
|
2776
2797
|
} = column;
|
|
2777
|
-
const [editing, setEditing] = (0,
|
|
2798
|
+
const [editing, setEditing] = (0, import_react14.useState)(false);
|
|
2778
2799
|
const value = valueFormatter(row[key]);
|
|
2779
|
-
const [editableValue, setEditableValue] = (0,
|
|
2800
|
+
const [editableValue, setEditableValue] = (0, import_react14.useState)(value);
|
|
2780
2801
|
const handleTitleMouseDown = () => {
|
|
2781
2802
|
var _a;
|
|
2782
2803
|
(_a = labelFieldRef.current) == null ? void 0 : _a.focus();
|
|
@@ -2786,7 +2807,7 @@ var TableCell = (0, import_react15.memo)(
|
|
|
2786
2807
|
setEditing(true);
|
|
2787
2808
|
}
|
|
2788
2809
|
};
|
|
2789
|
-
const handleClick = (0,
|
|
2810
|
+
const handleClick = (0, import_react14.useCallback)(
|
|
2790
2811
|
(evt) => {
|
|
2791
2812
|
onClick == null ? void 0 : onClick(evt, column);
|
|
2792
2813
|
},
|
|
@@ -2807,15 +2828,15 @@ var TableCell = (0, import_react15.memo)(
|
|
|
2807
2828
|
(_a = labelFieldRef.current) == null ? void 0 : _a.focus();
|
|
2808
2829
|
}
|
|
2809
2830
|
};
|
|
2810
|
-
const className = (0,
|
|
2831
|
+
const className = (0, import_classnames7.default)(classNameProp, {
|
|
2811
2832
|
vuuAlignRight: align === "right",
|
|
2812
2833
|
vuuPinFloating: pin === "floating",
|
|
2813
2834
|
vuuPinLeft: pin === "left",
|
|
2814
2835
|
vuuPinRight: pin === "right",
|
|
2815
2836
|
"vuuTableCell-resizing": resizing
|
|
2816
2837
|
}) || void 0;
|
|
2817
|
-
const style = (0,
|
|
2818
|
-
return editable ? /* @__PURE__ */ (0,
|
|
2838
|
+
const style = (0, import_vuu_utils19.getColumnStyle)(column);
|
|
2839
|
+
return editable ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2819
2840
|
"div",
|
|
2820
2841
|
{
|
|
2821
2842
|
className,
|
|
@@ -2823,8 +2844,8 @@ var TableCell = (0, import_react15.memo)(
|
|
|
2823
2844
|
role: "cell",
|
|
2824
2845
|
style,
|
|
2825
2846
|
onKeyDown: handleTitleKeyDown,
|
|
2826
|
-
children: /* @__PURE__ */ (0,
|
|
2827
|
-
|
|
2847
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2848
|
+
import_vuu_ui_controls5.EditableLabel,
|
|
2828
2849
|
{
|
|
2829
2850
|
editing,
|
|
2830
2851
|
value: editableValue,
|
|
@@ -2839,14 +2860,14 @@ var TableCell = (0, import_react15.memo)(
|
|
|
2839
2860
|
"title"
|
|
2840
2861
|
)
|
|
2841
2862
|
}
|
|
2842
|
-
) : /* @__PURE__ */ (0,
|
|
2863
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2843
2864
|
"div",
|
|
2844
2865
|
{
|
|
2845
2866
|
className,
|
|
2846
2867
|
role: "cell",
|
|
2847
2868
|
style,
|
|
2848
2869
|
onClick: handleClick,
|
|
2849
|
-
children: CellRenderer ? /* @__PURE__ */ (0,
|
|
2870
|
+
children: CellRenderer ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CellRenderer, { column, columnMap, row }) : value
|
|
2850
2871
|
}
|
|
2851
2872
|
);
|
|
2852
2873
|
},
|
|
@@ -2854,27 +2875,27 @@ var TableCell = (0, import_react15.memo)(
|
|
|
2854
2875
|
);
|
|
2855
2876
|
TableCell.displayName = "TableCell";
|
|
2856
2877
|
function cellValuesAreEqual(prev, next) {
|
|
2857
|
-
return prev.column === next.column && prev.onClick === next.onClick && prev.row[
|
|
2878
|
+
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];
|
|
2858
2879
|
}
|
|
2859
2880
|
|
|
2860
2881
|
// ../vuu-table/src/table/TableGroupCell.tsx
|
|
2861
|
-
var
|
|
2862
|
-
var
|
|
2863
|
-
var
|
|
2864
|
-
var { IS_LEAF } =
|
|
2882
|
+
var import_vuu_utils20 = require("@vuu-ui/vuu-utils");
|
|
2883
|
+
var import_react15 = require("react");
|
|
2884
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2885
|
+
var { IS_LEAF } = import_vuu_utils20.metadataKeys;
|
|
2865
2886
|
var TableGroupCell = ({ column, onClick, row }) => {
|
|
2866
2887
|
const { columns } = column;
|
|
2867
|
-
const [value, offset] = (0,
|
|
2868
|
-
const handleClick = (0,
|
|
2888
|
+
const [value, offset] = (0, import_vuu_utils20.getGroupValueAndOffset)(columns, row);
|
|
2889
|
+
const handleClick = (0, import_react15.useCallback)(
|
|
2869
2890
|
(evt) => {
|
|
2870
2891
|
onClick == null ? void 0 : onClick(evt, column);
|
|
2871
2892
|
},
|
|
2872
2893
|
[column, onClick]
|
|
2873
2894
|
);
|
|
2874
|
-
const style = (0,
|
|
2895
|
+
const style = (0, import_vuu_utils20.getColumnStyle)(column);
|
|
2875
2896
|
const isLeaf = row[IS_LEAF];
|
|
2876
|
-
const spacers = Array(offset).fill(0).map((n, i) => /* @__PURE__ */ (0,
|
|
2877
|
-
return /* @__PURE__ */ (0,
|
|
2897
|
+
const spacers = Array(offset).fill(0).map((n, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "vuuTableGroupCell-spacer" }, i));
|
|
2898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2878
2899
|
"div",
|
|
2879
2900
|
{
|
|
2880
2901
|
className: "vuuTableGroupCell vuuPinLeft",
|
|
@@ -2883,18 +2904,19 @@ var TableGroupCell = ({ column, onClick, row }) => {
|
|
|
2883
2904
|
style,
|
|
2884
2905
|
children: [
|
|
2885
2906
|
spacers,
|
|
2886
|
-
isLeaf ? null : /* @__PURE__ */ (0,
|
|
2887
|
-
/* @__PURE__ */ (0,
|
|
2907
|
+
isLeaf ? null : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "vuuTableGroupCell-toggle", "data-icon": "triangle-right" }),
|
|
2908
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: value })
|
|
2888
2909
|
]
|
|
2889
2910
|
}
|
|
2890
2911
|
);
|
|
2891
2912
|
};
|
|
2892
2913
|
|
|
2893
2914
|
// ../vuu-table/src/table/TableRow.tsx
|
|
2894
|
-
var
|
|
2895
|
-
var { IDX, IS_EXPANDED, SELECTED } =
|
|
2896
|
-
var
|
|
2897
|
-
var
|
|
2915
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2916
|
+
var { IDX, IS_EXPANDED, SELECTED } = import_vuu_utils21.metadataKeys;
|
|
2917
|
+
var { True, First, Last } = import_vuu_utils21.RowSelected;
|
|
2918
|
+
var classBase11 = "vuuTableRow";
|
|
2919
|
+
var TableRow = (0, import_react16.memo)(function Row({
|
|
2898
2920
|
columnMap,
|
|
2899
2921
|
columns,
|
|
2900
2922
|
offset,
|
|
@@ -2906,14 +2928,16 @@ var TableRow = (0, import_react17.memo)(function Row({
|
|
|
2906
2928
|
const {
|
|
2907
2929
|
[IDX]: rowIndex,
|
|
2908
2930
|
[IS_EXPANDED]: isExpanded,
|
|
2909
|
-
[SELECTED]:
|
|
2931
|
+
[SELECTED]: selectionStatus
|
|
2910
2932
|
} = row;
|
|
2911
|
-
const className = (0,
|
|
2912
|
-
[`${
|
|
2913
|
-
[`${
|
|
2914
|
-
[`${
|
|
2933
|
+
const className = (0, import_classnames8.default)(classBase11, {
|
|
2934
|
+
[`${classBase11}-even`]: rowIndex % 2 === 0,
|
|
2935
|
+
[`${classBase11}-expanded`]: isExpanded,
|
|
2936
|
+
[`${classBase11}-selected`]: selectionStatus & True,
|
|
2937
|
+
[`${classBase11}-selectedStart`]: selectionStatus & First,
|
|
2938
|
+
[`${classBase11}-selectedEnd`]: selectionStatus & Last
|
|
2915
2939
|
});
|
|
2916
|
-
const handleRowClick = (0,
|
|
2940
|
+
const handleRowClick = (0, import_react16.useCallback)(
|
|
2917
2941
|
(evt) => {
|
|
2918
2942
|
const rangeSelect = evt.shiftKey;
|
|
2919
2943
|
const keepExistingSelection = evt.ctrlKey || evt.metaKey;
|
|
@@ -2921,19 +2945,19 @@ var TableRow = (0, import_react17.memo)(function Row({
|
|
|
2921
2945
|
},
|
|
2922
2946
|
[onClick, row]
|
|
2923
2947
|
);
|
|
2924
|
-
const handleGroupCellClick = (0,
|
|
2948
|
+
const handleGroupCellClick = (0, import_react16.useCallback)(
|
|
2925
2949
|
(evt, column) => {
|
|
2926
|
-
if ((0,
|
|
2950
|
+
if ((0, import_vuu_utils21.isGroupColumn)(column) || (0, import_vuu_utils21.isJsonGroup)(column, row)) {
|
|
2927
2951
|
evt.stopPropagation();
|
|
2928
2952
|
onToggleGroup == null ? void 0 : onToggleGroup(row, column);
|
|
2929
2953
|
}
|
|
2930
2954
|
},
|
|
2931
2955
|
[onToggleGroup, row]
|
|
2932
2956
|
);
|
|
2933
|
-
return /* @__PURE__ */ (0,
|
|
2957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2934
2958
|
"div",
|
|
2935
2959
|
{
|
|
2936
|
-
"aria-selected":
|
|
2960
|
+
"aria-selected": selectionStatus & True ? true : void 0,
|
|
2937
2961
|
"aria-rowindex": rowIndex,
|
|
2938
2962
|
className,
|
|
2939
2963
|
onClick: handleRowClick,
|
|
@@ -2942,12 +2966,12 @@ var TableRow = (0, import_react17.memo)(function Row({
|
|
|
2942
2966
|
transform: `translate3d(0px, ${offset}px, 0px)`
|
|
2943
2967
|
},
|
|
2944
2968
|
children: [
|
|
2945
|
-
virtualColSpan > 0 ? /* @__PURE__ */ (0,
|
|
2946
|
-
columns.filter(
|
|
2947
|
-
const isGroup = (0,
|
|
2948
|
-
const isJsonCell = (0,
|
|
2969
|
+
virtualColSpan > 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { role: "cell", style: { width: virtualColSpan } }) : null,
|
|
2970
|
+
columns.filter(import_vuu_utils21.notHidden).map((column) => {
|
|
2971
|
+
const isGroup = (0, import_vuu_utils21.isGroupColumn)(column);
|
|
2972
|
+
const isJsonCell = (0, import_vuu_utils21.isJsonColumn)(column);
|
|
2949
2973
|
const Cell = isGroup ? TableGroupCell : TableCell;
|
|
2950
|
-
return /* @__PURE__ */ (0,
|
|
2974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2951
2975
|
Cell,
|
|
2952
2976
|
{
|
|
2953
2977
|
column,
|
|
@@ -2964,57 +2988,57 @@ var TableRow = (0, import_react17.memo)(function Row({
|
|
|
2964
2988
|
});
|
|
2965
2989
|
|
|
2966
2990
|
// ../vuu-table/src/table/TableGroupHeaderCell.tsx
|
|
2967
|
-
var
|
|
2968
|
-
var
|
|
2991
|
+
var import_classnames9 = __toESM(require("classnames"));
|
|
2992
|
+
var import_react18 = require("react");
|
|
2969
2993
|
|
|
2970
2994
|
// ../vuu-table/src/table/useTableColumnResize.tsx
|
|
2971
|
-
var
|
|
2995
|
+
var import_react17 = require("react");
|
|
2972
2996
|
|
|
2973
2997
|
// ../vuu-table/src/table/TableGroupHeaderCell.tsx
|
|
2974
|
-
var
|
|
2998
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2975
2999
|
|
|
2976
3000
|
// ../vuu-table/src/table/TableHeaderCell.tsx
|
|
2977
|
-
var
|
|
2978
|
-
var
|
|
3001
|
+
var import_classnames12 = __toESM(require("classnames"));
|
|
3002
|
+
var import_react20 = require("react");
|
|
2979
3003
|
|
|
2980
3004
|
// ../vuu-table/src/table/SortIndicator.tsx
|
|
2981
|
-
var
|
|
2982
|
-
var
|
|
3005
|
+
var import_classnames10 = __toESM(require("classnames"));
|
|
3006
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2983
3007
|
|
|
2984
3008
|
// ../vuu-table/src/table/TableHeaderCell.tsx
|
|
2985
3009
|
var import_vuu_popups2 = require("@vuu-ui/vuu-popups");
|
|
2986
3010
|
|
|
2987
3011
|
// ../vuu-table/src/table/filter-indicator.tsx
|
|
2988
3012
|
var import_vuu_popups = require("@vuu-ui/vuu-popups");
|
|
2989
|
-
var
|
|
2990
|
-
var
|
|
2991
|
-
var
|
|
3013
|
+
var import_classnames11 = __toESM(require("classnames"));
|
|
3014
|
+
var import_react19 = require("react");
|
|
3015
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2992
3016
|
|
|
2993
3017
|
// ../vuu-table/src/table/TableHeaderCell.tsx
|
|
2994
|
-
var
|
|
3018
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2995
3019
|
|
|
2996
3020
|
// ../vuu-table/src/table/RowBasedTable.tsx
|
|
2997
|
-
var
|
|
2998
|
-
var { RENDER_IDX } =
|
|
3021
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3022
|
+
var { RENDER_IDX } = import_vuu_utils22.metadataKeys;
|
|
2999
3023
|
|
|
3000
3024
|
// ../vuu-table/src/table/useTable.ts
|
|
3001
3025
|
var import_vuu_popups3 = require("@vuu-ui/vuu-popups");
|
|
3002
|
-
var
|
|
3003
|
-
var
|
|
3026
|
+
var import_vuu_utils30 = require("@vuu-ui/vuu-utils");
|
|
3027
|
+
var import_react32 = require("react");
|
|
3004
3028
|
|
|
3005
3029
|
// ../vuu-table/src/table/useDataSource.ts
|
|
3006
3030
|
var import_vuu_data_react2 = require("@vuu-ui/vuu-data-react");
|
|
3007
|
-
var
|
|
3008
|
-
var
|
|
3009
|
-
var { SELECTED: SELECTED2 } =
|
|
3031
|
+
var import_vuu_utils23 = require("@vuu-ui/vuu-utils");
|
|
3032
|
+
var import_react22 = require("react");
|
|
3033
|
+
var { SELECTED: SELECTED2 } = import_vuu_utils23.metadataKeys;
|
|
3010
3034
|
|
|
3011
3035
|
// ../vuu-table/src/table/useDraggableColumn.ts
|
|
3012
|
-
var
|
|
3013
|
-
var
|
|
3036
|
+
var import_vuu_ui_controls6 = require("@vuu-ui/vuu-ui-controls");
|
|
3037
|
+
var import_react23 = require("react");
|
|
3014
3038
|
|
|
3015
3039
|
// ../vuu-table/src/table/useKeyboardNavigation.ts
|
|
3016
|
-
var
|
|
3017
|
-
var
|
|
3040
|
+
var import_vuu_utils24 = require("@vuu-ui/vuu-utils");
|
|
3041
|
+
var import_react24 = require("react");
|
|
3018
3042
|
|
|
3019
3043
|
// ../vuu-table/src/table/keyUtils.ts
|
|
3020
3044
|
function union(set1, ...sets) {
|
|
@@ -3070,11 +3094,11 @@ var specialKeys = union(
|
|
|
3070
3094
|
);
|
|
3071
3095
|
|
|
3072
3096
|
// ../vuu-table/src/table/useMeasuredContainer.ts
|
|
3073
|
-
var
|
|
3074
|
-
var
|
|
3097
|
+
var import_vuu_utils25 = require("@vuu-ui/vuu-utils");
|
|
3098
|
+
var import_react26 = require("react");
|
|
3075
3099
|
|
|
3076
3100
|
// ../vuu-table/src/table/useResizeObserver.ts
|
|
3077
|
-
var
|
|
3101
|
+
var import_react25 = require("react");
|
|
3078
3102
|
var observedMap = /* @__PURE__ */ new Map();
|
|
3079
3103
|
var getTargetSize = (element, size, dimension) => {
|
|
3080
3104
|
switch (dimension) {
|
|
@@ -3126,40 +3150,40 @@ var resizeObserver = new ResizeObserver((entries) => {
|
|
|
3126
3150
|
});
|
|
3127
3151
|
|
|
3128
3152
|
// ../vuu-table/src/table/useSelection.ts
|
|
3129
|
-
var
|
|
3130
|
-
var
|
|
3131
|
-
var { IDX: IDX2 } =
|
|
3153
|
+
var import_vuu_utils26 = require("@vuu-ui/vuu-utils");
|
|
3154
|
+
var import_react27 = require("react");
|
|
3155
|
+
var { IDX: IDX2 } = import_vuu_utils26.metadataKeys;
|
|
3132
3156
|
|
|
3133
3157
|
// ../vuu-table/src/table/useTableModel.ts
|
|
3134
|
-
var
|
|
3135
|
-
var
|
|
3136
|
-
var KEY_OFFSET =
|
|
3158
|
+
var import_vuu_utils27 = require("@vuu-ui/vuu-utils");
|
|
3159
|
+
var import_react28 = require("react");
|
|
3160
|
+
var KEY_OFFSET = import_vuu_utils27.metadataKeys.count;
|
|
3137
3161
|
|
|
3138
3162
|
// ../vuu-table/src/table/useTableScroll.ts
|
|
3139
|
-
var
|
|
3163
|
+
var import_react29 = require("react");
|
|
3140
3164
|
|
|
3141
|
-
// ../vuu-table/src/table/useTableViewport.ts
|
|
3142
|
-
var
|
|
3143
|
-
var
|
|
3165
|
+
// ../vuu-table/src/table-next/useTableViewport.ts
|
|
3166
|
+
var import_react30 = require("react");
|
|
3167
|
+
var import_vuu_utils28 = require("@vuu-ui/vuu-utils");
|
|
3144
3168
|
|
|
3145
3169
|
// ../vuu-table/src/table/useVirtualViewport.ts
|
|
3146
|
-
var
|
|
3147
|
-
var
|
|
3170
|
+
var import_vuu_utils29 = require("@vuu-ui/vuu-utils");
|
|
3171
|
+
var import_react31 = require("react");
|
|
3148
3172
|
|
|
3149
3173
|
// ../vuu-table/src/table/useTable.ts
|
|
3150
|
-
var { KEY:
|
|
3174
|
+
var { KEY: KEY4, IS_EXPANDED: IS_EXPANDED2, IS_LEAF: IS_LEAF2 } = import_vuu_utils30.metadataKeys;
|
|
3151
3175
|
|
|
3152
3176
|
// ../vuu-table/src/table/Table.tsx
|
|
3153
|
-
var
|
|
3154
|
-
var
|
|
3155
|
-
var
|
|
3177
|
+
var import_classnames13 = __toESM(require("classnames"));
|
|
3178
|
+
var import_vuu_utils31 = require("@vuu-ui/vuu-utils");
|
|
3179
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3156
3180
|
|
|
3157
3181
|
// ../vuu-table/src/table/cell-renderers/json-cell/JsonCell.tsx
|
|
3158
|
-
var
|
|
3159
|
-
var
|
|
3160
|
-
var
|
|
3161
|
-
var
|
|
3162
|
-
var { IS_EXPANDED: IS_EXPANDED3, KEY:
|
|
3182
|
+
var import_classnames14 = __toESM(require("classnames"));
|
|
3183
|
+
var import_vuu_utils32 = require("@vuu-ui/vuu-utils");
|
|
3184
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3185
|
+
var classBase12 = "vuuJsonCell";
|
|
3186
|
+
var { IS_EXPANDED: IS_EXPANDED3, KEY: KEY5 } = import_vuu_utils32.metadataKeys;
|
|
3163
3187
|
var localKey = (key) => {
|
|
3164
3188
|
const pos = key.lastIndexOf("|");
|
|
3165
3189
|
if (pos === -1) {
|
|
@@ -3175,133 +3199,189 @@ var JsonCell = ({ column, row }) => {
|
|
|
3175
3199
|
} = column;
|
|
3176
3200
|
let value = row[columnKey];
|
|
3177
3201
|
let isToggle = false;
|
|
3178
|
-
if ((0,
|
|
3202
|
+
if ((0, import_vuu_utils32.isJsonAttribute)(value)) {
|
|
3179
3203
|
value = value.slice(0, -1);
|
|
3180
3204
|
isToggle = true;
|
|
3181
3205
|
}
|
|
3182
|
-
const rowKey = localKey(row[
|
|
3183
|
-
const className = (0,
|
|
3184
|
-
[`${
|
|
3185
|
-
[`${
|
|
3186
|
-
[`${
|
|
3206
|
+
const rowKey = localKey(row[KEY5]);
|
|
3207
|
+
const className = (0, import_classnames14.default)({
|
|
3208
|
+
[`${classBase12}-name`]: rowKey === value,
|
|
3209
|
+
[`${classBase12}-value`]: rowKey !== value,
|
|
3210
|
+
[`${classBase12}-group`]: isToggle
|
|
3187
3211
|
});
|
|
3188
3212
|
if (isToggle) {
|
|
3189
3213
|
const toggleIcon = row[IS_EXPANDED3] ? "minus-box" : "plus-box";
|
|
3190
|
-
return /* @__PURE__ */ (0,
|
|
3191
|
-
/* @__PURE__ */ (0,
|
|
3192
|
-
/* @__PURE__ */ (0,
|
|
3214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className, children: [
|
|
3215
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: `${classBase12}-value`, children: value }),
|
|
3216
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: `${classBase12}-toggle`, "data-icon": toggleIcon })
|
|
3193
3217
|
] });
|
|
3194
3218
|
} else if (value) {
|
|
3195
|
-
return /* @__PURE__ */ (0,
|
|
3219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className, children: value });
|
|
3196
3220
|
} else {
|
|
3197
3221
|
return null;
|
|
3198
3222
|
}
|
|
3199
3223
|
};
|
|
3200
|
-
(0,
|
|
3224
|
+
(0, import_vuu_utils32.registerComponent)("json", JsonCell, "cell-renderer", {
|
|
3225
|
+
description: "JSON formatter",
|
|
3226
|
+
label: "JSON formatter",
|
|
3227
|
+
serverDataType: "json"
|
|
3228
|
+
});
|
|
3201
3229
|
|
|
3202
|
-
// ../vuu-table/src/table-next/
|
|
3203
|
-
var
|
|
3204
|
-
var
|
|
3230
|
+
// ../vuu-table/src/table-next/header-cell/GroupHeaderCell.tsx
|
|
3231
|
+
var import_classnames17 = __toESM(require("classnames"));
|
|
3232
|
+
var import_react37 = require("react");
|
|
3205
3233
|
|
|
3206
|
-
// ../vuu-table/src/table-next/
|
|
3207
|
-
var
|
|
3234
|
+
// ../vuu-table/src/table-next/column-resizing/ColumnResizer.tsx
|
|
3235
|
+
var import_react33 = require("react");
|
|
3236
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3208
3237
|
|
|
3209
|
-
// ../vuu-table/src/table-next/
|
|
3210
|
-
var import_vuu_utils26 = require("@vuu-ui/vuu-utils");
|
|
3211
|
-
var import_classnames16 = __toESM(require("classnames"));
|
|
3238
|
+
// ../vuu-table/src/table-next/column-resizing/useTableColumnResize.tsx
|
|
3212
3239
|
var import_react34 = require("react");
|
|
3213
|
-
|
|
3240
|
+
|
|
3241
|
+
// ../vuu-table/src/table-next/useCell.ts
|
|
3242
|
+
var import_vuu_utils33 = require("@vuu-ui/vuu-utils");
|
|
3243
|
+
var import_classnames15 = __toESM(require("classnames"));
|
|
3244
|
+
var import_react35 = require("react");
|
|
3245
|
+
var useCell = (column, classBase19, isHeader) => (
|
|
3214
3246
|
// TODO measure perf without the memo, might not be worth the cost
|
|
3215
|
-
(0,
|
|
3216
|
-
const className = (0,
|
|
3247
|
+
(0, import_react35.useMemo)(() => {
|
|
3248
|
+
const className = (0, import_classnames15.default)(classBase19, {
|
|
3217
3249
|
vuuPinFloating: column.pin === "floating",
|
|
3218
3250
|
vuuPinLeft: column.pin === "left",
|
|
3219
3251
|
vuuPinRight: column.pin === "right",
|
|
3220
3252
|
vuuEndPin: isHeader && column.endPin,
|
|
3221
|
-
[`${
|
|
3222
|
-
[`${
|
|
3253
|
+
// [`${classBase}-resizing`]: column.resizing,
|
|
3254
|
+
[`${classBase19}-editable`]: column.editable,
|
|
3255
|
+
[`${classBase19}-right`]: column.align === "right"
|
|
3223
3256
|
});
|
|
3224
|
-
const style = (0,
|
|
3257
|
+
const style = (0, import_vuu_utils33.getColumnStyle)(column);
|
|
3225
3258
|
return {
|
|
3226
3259
|
className,
|
|
3227
3260
|
style
|
|
3228
3261
|
};
|
|
3229
|
-
}, [column,
|
|
3262
|
+
}, [column, classBase19, isHeader])
|
|
3230
3263
|
);
|
|
3231
3264
|
|
|
3232
|
-
// ../vuu-table/src/table-next/
|
|
3233
|
-
var
|
|
3234
|
-
var
|
|
3235
|
-
var
|
|
3265
|
+
// ../vuu-table/src/table-next/column-header-pill/ColumnHeaderPill.tsx
|
|
3266
|
+
var import_classnames16 = __toESM(require("classnames"));
|
|
3267
|
+
var import_react36 = require("react");
|
|
3268
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3269
|
+
|
|
3270
|
+
// ../vuu-table/src/table-next/column-header-pill/GroupColumnPill.tsx
|
|
3236
3271
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3237
3272
|
|
|
3238
|
-
// ../vuu-table/src/table-next/column-
|
|
3239
|
-
var import_react36 = require("react");
|
|
3273
|
+
// ../vuu-table/src/table-next/column-header-pill/SortIndicator.tsx
|
|
3240
3274
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3241
3275
|
|
|
3242
|
-
// ../vuu-table/src/table-next/
|
|
3243
|
-
var import_react37 = require("react");
|
|
3244
|
-
|
|
3245
|
-
// ../vuu-table/src/table-next/HeaderCell.tsx
|
|
3276
|
+
// ../vuu-table/src/table-next/header-cell/GroupHeaderCell.tsx
|
|
3246
3277
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3278
|
+
var import_react38 = require("react");
|
|
3247
3279
|
|
|
3248
|
-
// ../vuu-table/src/table-next/
|
|
3249
|
-
var import_vuu_utils28 = require("@vuu-ui/vuu-utils");
|
|
3280
|
+
// ../vuu-table/src/table-next/header-cell/GroupHeaderCellNext.tsx
|
|
3250
3281
|
var import_classnames18 = __toESM(require("classnames"));
|
|
3282
|
+
var import_react39 = require("react");
|
|
3283
|
+
var import_vuu_layout = require("@vuu-ui/vuu-layout");
|
|
3284
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3251
3285
|
var import_react40 = require("react");
|
|
3252
3286
|
|
|
3253
|
-
// ../vuu-table/src/table-next/
|
|
3254
|
-
var
|
|
3255
|
-
var TableCell2 = ({ column, row }) => {
|
|
3256
|
-
const { className, style } = useCell(column, "vuuTableNextCell");
|
|
3257
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className, role: "cell", style, children: row[column.key] });
|
|
3258
|
-
};
|
|
3287
|
+
// ../vuu-table/src/table-next/header-cell/HeaderCell.tsx
|
|
3288
|
+
var import_react42 = require("react");
|
|
3259
3289
|
|
|
3260
|
-
// ../vuu-table/src/table-next/
|
|
3261
|
-
var
|
|
3262
|
-
var
|
|
3290
|
+
// ../vuu-table/src/table-next/column-menu/ColumnMenu.tsx
|
|
3291
|
+
var import_vuu_popups5 = require("@vuu-ui/vuu-popups");
|
|
3292
|
+
var import_classnames19 = __toESM(require("classnames"));
|
|
3293
|
+
var import_react41 = require("react");
|
|
3263
3294
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3264
|
-
|
|
3295
|
+
|
|
3296
|
+
// ../vuu-table/src/table-next/header-cell/HeaderCell.tsx
|
|
3297
|
+
var import_classnames20 = __toESM(require("classnames"));
|
|
3298
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3299
|
+
|
|
3300
|
+
// ../vuu-table/src/table-next/TableNext.tsx
|
|
3301
|
+
var import_vuu_popups7 = require("@vuu-ui/vuu-popups");
|
|
3302
|
+
var import_vuu_utils43 = require("@vuu-ui/vuu-utils");
|
|
3303
|
+
var import_classnames23 = __toESM(require("classnames"));
|
|
3304
|
+
var import_react56 = require("react");
|
|
3305
|
+
|
|
3306
|
+
// ../vuu-table/src/table-next/Row.tsx
|
|
3307
|
+
var import_vuu_utils36 = require("@vuu-ui/vuu-utils");
|
|
3308
|
+
var import_classnames22 = __toESM(require("classnames"));
|
|
3309
|
+
var import_react45 = require("react");
|
|
3310
|
+
|
|
3311
|
+
// ../vuu-table/src/table-next/table-cell/TableCell.tsx
|
|
3312
|
+
var import_vuu_utils34 = require("@vuu-ui/vuu-utils");
|
|
3313
|
+
var import_react43 = require("react");
|
|
3314
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3315
|
+
var { IDX: IDX3 } = import_vuu_utils34.metadataKeys;
|
|
3316
|
+
var classBase13 = "vuuTableNextCell";
|
|
3317
|
+
var TableCell2 = ({
|
|
3318
|
+
column,
|
|
3319
|
+
columnMap,
|
|
3320
|
+
onDataEdited,
|
|
3321
|
+
row
|
|
3322
|
+
}) => {
|
|
3323
|
+
const { className, style } = useCell(column, classBase13);
|
|
3324
|
+
const { CellRenderer, name: name2, valueFormatter } = column;
|
|
3325
|
+
const dataIdx = columnMap[name2];
|
|
3326
|
+
const handleDataItemEdited = (0, import_react43.useCallback)(
|
|
3327
|
+
(value) => {
|
|
3328
|
+
onDataEdited == null ? void 0 : onDataEdited(row[IDX3], name2, value);
|
|
3329
|
+
return true;
|
|
3330
|
+
},
|
|
3331
|
+
[name2, onDataEdited, row]
|
|
3332
|
+
);
|
|
3333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className, role: "cell", style, children: CellRenderer ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3334
|
+
CellRenderer,
|
|
3335
|
+
{
|
|
3336
|
+
column,
|
|
3337
|
+
columnMap,
|
|
3338
|
+
onCommit: handleDataItemEdited,
|
|
3339
|
+
row
|
|
3340
|
+
}
|
|
3341
|
+
) : valueFormatter(row[dataIdx]) });
|
|
3342
|
+
};
|
|
3343
|
+
|
|
3344
|
+
// ../vuu-table/src/table-next/table-cell/TableGroupCell.tsx
|
|
3345
|
+
var import_vuu_utils35 = require("@vuu-ui/vuu-utils");
|
|
3346
|
+
var import_react44 = require("react");
|
|
3347
|
+
var import_classnames21 = __toESM(require("classnames"));
|
|
3348
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3349
|
+
var { IS_LEAF: IS_LEAF3 } = import_vuu_utils35.metadataKeys;
|
|
3350
|
+
var classBase14 = "vuuTableNextGroupCell";
|
|
3265
3351
|
var TableGroupCell2 = ({ column, onClick, row }) => {
|
|
3266
3352
|
const { columns } = column;
|
|
3267
|
-
const [value, offset] = (0,
|
|
3268
|
-
const { className, style } = useCell(column,
|
|
3269
|
-
const handleClick = (0,
|
|
3353
|
+
const [value, offset] = (0, import_vuu_utils35.getGroupValueAndOffset)(columns, row);
|
|
3354
|
+
const { className, style } = useCell(column, classBase14);
|
|
3355
|
+
const handleClick = (0, import_react44.useCallback)(
|
|
3270
3356
|
(evt) => {
|
|
3271
3357
|
onClick == null ? void 0 : onClick(evt, column);
|
|
3272
3358
|
},
|
|
3273
3359
|
[column, onClick]
|
|
3274
3360
|
);
|
|
3275
3361
|
const isLeaf = row[IS_LEAF3];
|
|
3276
|
-
const spacers = Array(offset).fill(0).map((n, i) => /* @__PURE__ */ (0,
|
|
3277
|
-
return /* @__PURE__ */ (0,
|
|
3362
|
+
const spacers = Array(offset).fill(0).map((n, i) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: `${classBase14}-spacer` }, i));
|
|
3363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3278
3364
|
"div",
|
|
3279
3365
|
{
|
|
3280
|
-
className,
|
|
3366
|
+
className: (0, import_classnames21.default)(className, "vuuTableNextCell"),
|
|
3281
3367
|
role: "cell",
|
|
3282
3368
|
style,
|
|
3283
3369
|
onClick: isLeaf ? void 0 : handleClick,
|
|
3284
3370
|
children: [
|
|
3285
3371
|
spacers,
|
|
3286
|
-
isLeaf ? null : /* @__PURE__ */ (0,
|
|
3287
|
-
|
|
3288
|
-
{
|
|
3289
|
-
className: "vuuTable2-groupCell-toggle",
|
|
3290
|
-
"data-icon": "vuu-triangle-right"
|
|
3291
|
-
}
|
|
3292
|
-
),
|
|
3293
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: value })
|
|
3372
|
+
isLeaf ? null : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: `${classBase14}-toggle`, "data-icon": "triangle-right" }),
|
|
3373
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: value })
|
|
3294
3374
|
]
|
|
3295
3375
|
}
|
|
3296
3376
|
);
|
|
3297
3377
|
};
|
|
3298
3378
|
|
|
3299
3379
|
// ../vuu-table/src/table-next/Row.tsx
|
|
3300
|
-
var
|
|
3301
|
-
var
|
|
3302
|
-
var { IDX:
|
|
3303
|
-
var
|
|
3304
|
-
var Row2 = (0,
|
|
3380
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3381
|
+
var import_react46 = require("react");
|
|
3382
|
+
var { IDX: IDX4, IS_EXPANDED: IS_EXPANDED4, SELECTED: SELECTED3 } = import_vuu_utils36.metadataKeys;
|
|
3383
|
+
var classBase15 = "vuuTableNextRow";
|
|
3384
|
+
var Row2 = (0, import_react45.memo)(
|
|
3305
3385
|
({
|
|
3306
3386
|
className: classNameProp,
|
|
3307
3387
|
columnMap,
|
|
@@ -3309,15 +3389,17 @@ var Row2 = (0, import_react40.memo)(
|
|
|
3309
3389
|
row,
|
|
3310
3390
|
offset,
|
|
3311
3391
|
onClick,
|
|
3392
|
+
onDataEdited,
|
|
3312
3393
|
onToggleGroup,
|
|
3394
|
+
zebraStripes = false,
|
|
3313
3395
|
...htmlAttributes
|
|
3314
3396
|
}) => {
|
|
3315
3397
|
const {
|
|
3316
|
-
[
|
|
3398
|
+
[IDX4]: rowIndex,
|
|
3317
3399
|
[IS_EXPANDED4]: isExpanded,
|
|
3318
3400
|
[SELECTED3]: selectionStatus
|
|
3319
3401
|
} = row;
|
|
3320
|
-
const handleRowClick = (0,
|
|
3402
|
+
const handleRowClick = (0, import_react45.useCallback)(
|
|
3321
3403
|
(evt) => {
|
|
3322
3404
|
const rangeSelect = evt.shiftKey;
|
|
3323
3405
|
const keepExistingSelection = evt.ctrlKey || evt.metaKey;
|
|
@@ -3325,43 +3407,69 @@ var Row2 = (0, import_react40.memo)(
|
|
|
3325
3407
|
},
|
|
3326
3408
|
[onClick, row]
|
|
3327
3409
|
);
|
|
3328
|
-
const { True, First, Last } =
|
|
3329
|
-
const className = (0,
|
|
3330
|
-
[`${
|
|
3331
|
-
[`${
|
|
3332
|
-
[`${
|
|
3333
|
-
[`${
|
|
3334
|
-
[`${
|
|
3410
|
+
const { True: True2, First: First2, Last: Last2 } = import_vuu_utils36.RowSelected;
|
|
3411
|
+
const className = (0, import_classnames22.default)(classBase15, classNameProp, {
|
|
3412
|
+
[`${classBase15}-even`]: zebraStripes && rowIndex % 2 === 0,
|
|
3413
|
+
[`${classBase15}-expanded`]: isExpanded,
|
|
3414
|
+
[`${classBase15}-selected`]: selectionStatus & True2,
|
|
3415
|
+
[`${classBase15}-selectedStart`]: selectionStatus & First2,
|
|
3416
|
+
[`${classBase15}-selectedEnd`]: selectionStatus & Last2
|
|
3335
3417
|
});
|
|
3336
|
-
const style =
|
|
3337
|
-
|
|
3418
|
+
const style = { transform: `translate3d(0px, ${offset}px, 0px)` };
|
|
3419
|
+
const handleGroupCellClick = (0, import_react45.useCallback)(
|
|
3420
|
+
(evt, column) => {
|
|
3421
|
+
if ((0, import_vuu_utils36.isGroupColumn)(column) || (0, import_vuu_utils36.isJsonGroup)(column, row)) {
|
|
3422
|
+
evt.stopPropagation();
|
|
3423
|
+
onToggleGroup == null ? void 0 : onToggleGroup(row, column);
|
|
3424
|
+
}
|
|
3425
|
+
},
|
|
3426
|
+
[onToggleGroup, row]
|
|
3427
|
+
);
|
|
3428
|
+
return /* @__PURE__ */ (0, import_react46.createElement)(
|
|
3338
3429
|
"div",
|
|
3339
3430
|
{
|
|
3340
3431
|
...htmlAttributes,
|
|
3432
|
+
"aria-rowindex": row[0],
|
|
3341
3433
|
key: `row-${row[0]}`,
|
|
3342
3434
|
role: "row",
|
|
3343
3435
|
className,
|
|
3344
3436
|
onClick: handleRowClick,
|
|
3345
3437
|
style
|
|
3346
3438
|
},
|
|
3347
|
-
/* @__PURE__ */ (0,
|
|
3348
|
-
columns.filter(
|
|
3349
|
-
const isGroup = (0,
|
|
3439
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: `${classBase15}-selectionDecorator vuuStickyLeft` }),
|
|
3440
|
+
columns.filter(import_vuu_utils36.notHidden).map((column) => {
|
|
3441
|
+
const isGroup = (0, import_vuu_utils36.isGroupColumn)(column);
|
|
3442
|
+
const isJsonCell = (0, import_vuu_utils36.isJsonColumn)(column);
|
|
3350
3443
|
const Cell = isGroup ? TableGroupCell2 : TableCell2;
|
|
3351
|
-
return /* @__PURE__ */ (0,
|
|
3444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3445
|
+
Cell,
|
|
3446
|
+
{
|
|
3447
|
+
column,
|
|
3448
|
+
columnMap,
|
|
3449
|
+
onClick: isGroup || isJsonCell ? handleGroupCellClick : void 0,
|
|
3450
|
+
onDataEdited,
|
|
3451
|
+
row
|
|
3452
|
+
},
|
|
3453
|
+
column.key
|
|
3454
|
+
);
|
|
3352
3455
|
}),
|
|
3353
|
-
/* @__PURE__ */ (0,
|
|
3456
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: `${classBase15}-selectionDecorator vuuStickyRight` })
|
|
3354
3457
|
);
|
|
3355
3458
|
}
|
|
3356
3459
|
);
|
|
3357
3460
|
Row2.displayName = "Row";
|
|
3358
3461
|
|
|
3359
3462
|
// ../vuu-table/src/table-next/useTableNext.ts
|
|
3360
|
-
var
|
|
3361
|
-
var
|
|
3362
|
-
|
|
3463
|
+
var import_vuu_layout2 = require("@vuu-ui/vuu-layout");
|
|
3464
|
+
var import_vuu_ui_controls8 = require("@vuu-ui/vuu-ui-controls");
|
|
3465
|
+
|
|
3466
|
+
// ../vuu-table/src/table-next/useKeyboardNavigation.ts
|
|
3363
3467
|
var import_react47 = require("react");
|
|
3364
3468
|
|
|
3469
|
+
// ../vuu-table/src/table-next/useTableNext.ts
|
|
3470
|
+
var import_vuu_utils42 = require("@vuu-ui/vuu-utils");
|
|
3471
|
+
var import_react55 = require("react");
|
|
3472
|
+
|
|
3365
3473
|
// ../vuu-table/src/table-next/table-config.ts
|
|
3366
3474
|
var updateTableConfig = (config, action) => {
|
|
3367
3475
|
switch (action.type) {
|
|
@@ -3385,65 +3493,229 @@ var updateTableConfig = (config, action) => {
|
|
|
3385
3493
|
};
|
|
3386
3494
|
|
|
3387
3495
|
// ../vuu-table/src/table-next/useDataSource.ts
|
|
3388
|
-
var
|
|
3496
|
+
var import_src = require("@vuu-ui/vuu-data-react/src");
|
|
3497
|
+
var import_vuu_utils38 = require("@vuu-ui/vuu-utils");
|
|
3498
|
+
var import_react48 = require("react");
|
|
3499
|
+
|
|
3500
|
+
// ../vuu-table/src/table-next/moving-window.ts
|
|
3501
|
+
var import_vuu_utils37 = require("@vuu-ui/vuu-utils");
|
|
3502
|
+
var { SELECTED: SELECTED4 } = import_vuu_utils37.metadataKeys;
|
|
3389
3503
|
|
|
3390
3504
|
// ../vuu-table/src/table-next/useInitialValue.ts
|
|
3391
|
-
var
|
|
3505
|
+
var import_react49 = require("react");
|
|
3506
|
+
|
|
3507
|
+
// ../vuu-table/src/table-next/useTableContextMenu.ts
|
|
3508
|
+
var import_vuu_utils39 = require("@vuu-ui/vuu-utils");
|
|
3509
|
+
var import_react50 = require("react");
|
|
3510
|
+
var import_vuu_popups6 = require("@vuu-ui/vuu-popups");
|
|
3511
|
+
|
|
3512
|
+
// ../vuu-table/src/table-next/useCellEditing.ts
|
|
3513
|
+
var import_vuu_utils40 = require("@vuu-ui/vuu-utils");
|
|
3514
|
+
var import_react51 = require("react");
|
|
3392
3515
|
|
|
3393
3516
|
// ../vuu-table/src/table-next/useTableModel.ts
|
|
3394
|
-
var
|
|
3395
|
-
var
|
|
3396
|
-
var
|
|
3397
|
-
var { info } = (0,
|
|
3398
|
-
var KEY_OFFSET2 =
|
|
3517
|
+
var import_vuu_utils41 = require("@vuu-ui/vuu-utils");
|
|
3518
|
+
var import_vuu_ui_controls7 = require("@vuu-ui/vuu-ui-controls");
|
|
3519
|
+
var import_react52 = require("react");
|
|
3520
|
+
var { info } = (0, import_vuu_utils41.logger)("useTableModel");
|
|
3521
|
+
var KEY_OFFSET2 = import_vuu_utils41.metadataKeys.count;
|
|
3399
3522
|
|
|
3400
3523
|
// ../vuu-table/src/table-next/useTableScroll.ts
|
|
3401
|
-
var
|
|
3524
|
+
var import_react53 = require("react");
|
|
3402
3525
|
|
|
3403
3526
|
// ../vuu-table/src/table-next/useVirtualViewport.ts
|
|
3404
|
-
var
|
|
3527
|
+
var import_react54 = require("react");
|
|
3528
|
+
|
|
3529
|
+
// ../vuu-table/src/table-next/useTableNext.ts
|
|
3530
|
+
var { KEY: KEY6, IS_EXPANDED: IS_EXPANDED5, IS_LEAF: IS_LEAF4 } = import_vuu_utils42.metadataKeys;
|
|
3405
3531
|
|
|
3406
3532
|
// ../vuu-table/src/table-next/TableNext.tsx
|
|
3407
|
-
var
|
|
3408
|
-
var
|
|
3533
|
+
var import_vuu_layout3 = require("@vuu-ui/vuu-layout");
|
|
3534
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3535
|
+
var import_react57 = require("react");
|
|
3536
|
+
var { IDX: IDX5, RENDER_IDX: RENDER_IDX2 } = import_vuu_utils43.metadataKeys;
|
|
3537
|
+
|
|
3538
|
+
// ../vuu-table/src/table-next/cell-renderers/dropdown-cell/DropdownCell.tsx
|
|
3539
|
+
var import_vuu_ui_controls9 = require("@vuu-ui/vuu-ui-controls");
|
|
3540
|
+
var import_vuu_utils44 = require("@vuu-ui/vuu-utils");
|
|
3541
|
+
var import_react58 = require("react");
|
|
3542
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3543
|
+
var classBase16 = "vuuTableDropdownCell";
|
|
3544
|
+
var openKeys = ["Enter", " "];
|
|
3545
|
+
var DropdownCell = ({ column, columnMap, row }) => {
|
|
3546
|
+
var _a, _b, _c;
|
|
3547
|
+
const values = (0, import_vuu_utils44.isTypeDescriptor)(column.type) && (0, import_vuu_utils44.isColumnTypeRenderer)((_a = column.type) == null ? void 0 : _a.renderer) ? (_c = (_b = column.type) == null ? void 0 : _b.renderer) == null ? void 0 : _c.values : [];
|
|
3548
|
+
const dataIdx = columnMap[column.name];
|
|
3549
|
+
const [value, setValue] = (0, import_react58.useState)(row[dataIdx]);
|
|
3550
|
+
const handleSelectionChange = (0, import_react58.useCallback)(
|
|
3551
|
+
(evt, selectedItem) => {
|
|
3552
|
+
if (selectedItem) {
|
|
3553
|
+
setValue(selectedItem);
|
|
3554
|
+
}
|
|
3555
|
+
},
|
|
3556
|
+
[]
|
|
3557
|
+
);
|
|
3558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3559
|
+
import_vuu_ui_controls9.Dropdown,
|
|
3560
|
+
{
|
|
3561
|
+
className: classBase16,
|
|
3562
|
+
onSelectionChange: handleSelectionChange,
|
|
3563
|
+
openKeys,
|
|
3564
|
+
selected: value,
|
|
3565
|
+
source: values,
|
|
3566
|
+
width: column.width - 17
|
|
3567
|
+
}
|
|
3568
|
+
);
|
|
3569
|
+
};
|
|
3570
|
+
(0, import_vuu_utils44.registerComponent)("dropdown-cell", DropdownCell, "cell-renderer", {});
|
|
3571
|
+
|
|
3572
|
+
// ../vuu-table/src/table-next/cell-renderers/input-cell/InputCell.tsx
|
|
3573
|
+
var import_vuu_utils45 = require("@vuu-ui/vuu-utils");
|
|
3574
|
+
var import_core7 = require("@salt-ds/core");
|
|
3575
|
+
var import_vuu_ui_controls10 = require("@vuu-ui/vuu-ui-controls");
|
|
3576
|
+
var import_classnames24 = __toESM(require("classnames"));
|
|
3577
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3578
|
+
var classBase17 = "vuuTableInputCell";
|
|
3579
|
+
var WarnCommit = () => {
|
|
3580
|
+
console.warn(
|
|
3581
|
+
"onCommit handler has not been provided to InputCell cell renderer"
|
|
3582
|
+
);
|
|
3583
|
+
return true;
|
|
3584
|
+
};
|
|
3585
|
+
var InputCell = ({
|
|
3586
|
+
column,
|
|
3587
|
+
columnMap,
|
|
3588
|
+
onCommit = WarnCommit,
|
|
3589
|
+
row
|
|
3590
|
+
}) => {
|
|
3591
|
+
const dataIdx = columnMap[column.name];
|
|
3592
|
+
const {
|
|
3593
|
+
align = "left",
|
|
3594
|
+
clientSideEditValidationCheck,
|
|
3595
|
+
valueFormatter
|
|
3596
|
+
} = column;
|
|
3597
|
+
const { warningMessage, ...editProps } = (0, import_vuu_ui_controls10.useEditableText)({
|
|
3598
|
+
initialValue: valueFormatter(row[dataIdx]),
|
|
3599
|
+
onCommit,
|
|
3600
|
+
clientSideEditValidationCheck
|
|
3601
|
+
});
|
|
3602
|
+
const endAdornment = warningMessage && align === "left" ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: `${classBase17}-icon`, "data-icon": "error" }) : void 0;
|
|
3603
|
+
const startAdornment = warningMessage && align === "right" ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: `${classBase17}-icon`, "data-icon": "error" }) : void 0;
|
|
3604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3605
|
+
import_core7.Input,
|
|
3606
|
+
{
|
|
3607
|
+
...editProps,
|
|
3608
|
+
className: (0, import_classnames24.default)(classBase17, {
|
|
3609
|
+
[`${classBase17}-error`]: warningMessage !== void 0
|
|
3610
|
+
}),
|
|
3611
|
+
endAdornment,
|
|
3612
|
+
startAdornment
|
|
3613
|
+
}
|
|
3614
|
+
);
|
|
3615
|
+
};
|
|
3616
|
+
(0, import_vuu_utils45.registerComponent)("input-cell", InputCell, "cell-renderer", {});
|
|
3409
3617
|
|
|
3410
3618
|
// src/table-settings/useTableSettings.ts
|
|
3411
|
-
var
|
|
3619
|
+
var import_vuu_utils46 = require("@vuu-ui/vuu-utils");
|
|
3620
|
+
var import_react59 = require("react");
|
|
3621
|
+
var sortOrderFromAvailableColumns = (availableColumns, columns) => {
|
|
3622
|
+
const sortedColumns = [];
|
|
3623
|
+
for (const { name: name2 } of availableColumns) {
|
|
3624
|
+
const column = columns.find((col) => col.name === name2);
|
|
3625
|
+
if (column) {
|
|
3626
|
+
sortedColumns.push(column);
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
return sortedColumns;
|
|
3630
|
+
};
|
|
3412
3631
|
var buildColumnItems = (availableColumns, configuredColumns) => {
|
|
3413
|
-
return availableColumns.map(({ name, serverDataType }) => {
|
|
3414
|
-
const configuredColumn = configuredColumns.find((col) => col.name ===
|
|
3632
|
+
return availableColumns.map(({ name: name2, serverDataType }) => {
|
|
3633
|
+
const configuredColumn = configuredColumns.find((col) => col.name === name2);
|
|
3415
3634
|
return {
|
|
3416
3635
|
hidden: configuredColumn == null ? void 0 : configuredColumn.hidden,
|
|
3636
|
+
isCalculated: (0, import_vuu_utils46.isCalculatedColumn)(name2),
|
|
3417
3637
|
label: configuredColumn == null ? void 0 : configuredColumn.label,
|
|
3418
|
-
name,
|
|
3638
|
+
name: name2,
|
|
3419
3639
|
serverDataType,
|
|
3420
3640
|
subscribed: configuredColumn !== void 0
|
|
3421
3641
|
};
|
|
3422
3642
|
});
|
|
3423
3643
|
};
|
|
3424
3644
|
var useTableSettings = ({
|
|
3425
|
-
availableColumns,
|
|
3645
|
+
availableColumns: availableColumnsProp,
|
|
3426
3646
|
onConfigChange,
|
|
3647
|
+
onDataSourceConfigChange,
|
|
3427
3648
|
tableConfig: tableConfigProp
|
|
3428
3649
|
}) => {
|
|
3429
|
-
const [tableConfig,
|
|
3430
|
-
|
|
3650
|
+
const [{ availableColumns, tableConfig }, setColumnState] = (0, import_react59.useState)({
|
|
3651
|
+
availableColumns: availableColumnsProp,
|
|
3652
|
+
tableConfig: tableConfigProp
|
|
3653
|
+
});
|
|
3654
|
+
const columnItems = (0, import_react59.useMemo)(
|
|
3431
3655
|
() => buildColumnItems(availableColumns, tableConfig.columns),
|
|
3432
3656
|
[availableColumns, tableConfig.columns]
|
|
3433
3657
|
);
|
|
3434
|
-
const handleMoveListItem = (0,
|
|
3658
|
+
const handleMoveListItem = (0, import_react59.useCallback)(
|
|
3435
3659
|
(fromIndex, toIndex) => {
|
|
3436
|
-
|
|
3660
|
+
setColumnState((state) => {
|
|
3661
|
+
const newAvailableColumns = (0, import_vuu_utils46.moveItem)(
|
|
3662
|
+
state.availableColumns,
|
|
3663
|
+
fromIndex,
|
|
3664
|
+
toIndex
|
|
3665
|
+
);
|
|
3666
|
+
const newColumns = sortOrderFromAvailableColumns(
|
|
3667
|
+
newAvailableColumns,
|
|
3668
|
+
tableConfig.columns
|
|
3669
|
+
);
|
|
3670
|
+
return {
|
|
3671
|
+
availableColumns: newAvailableColumns,
|
|
3672
|
+
tableConfig: {
|
|
3673
|
+
...state.tableConfig,
|
|
3674
|
+
columns: newColumns
|
|
3675
|
+
}
|
|
3676
|
+
};
|
|
3677
|
+
});
|
|
3437
3678
|
},
|
|
3438
|
-
[]
|
|
3679
|
+
[tableConfig.columns]
|
|
3439
3680
|
);
|
|
3440
|
-
const handleColumnChange = (0,
|
|
3441
|
-
(
|
|
3442
|
-
const columnItem = columnItems.find((col) => col.name ===
|
|
3681
|
+
const handleColumnChange = (0, import_react59.useCallback)(
|
|
3682
|
+
(name2, property, value) => {
|
|
3683
|
+
const columnItem = columnItems.find((col) => col.name === name2);
|
|
3443
3684
|
if (property === "subscribed") {
|
|
3444
|
-
|
|
3685
|
+
if (columnItem == null ? void 0 : columnItem.subscribed) {
|
|
3686
|
+
const subscribedColumns = tableConfig.columns.filter((col) => col.name !== name2).map((col) => col.name);
|
|
3687
|
+
setColumnState((state) => ({
|
|
3688
|
+
...state,
|
|
3689
|
+
tableConfig: {
|
|
3690
|
+
...tableConfig,
|
|
3691
|
+
columns: tableConfig.columns.filter(
|
|
3692
|
+
(0, import_vuu_utils46.subscribedOnly)(subscribedColumns)
|
|
3693
|
+
)
|
|
3694
|
+
}
|
|
3695
|
+
}));
|
|
3696
|
+
onDataSourceConfigChange({
|
|
3697
|
+
columns: subscribedColumns
|
|
3698
|
+
});
|
|
3699
|
+
} else {
|
|
3700
|
+
const newConfig = {
|
|
3701
|
+
...tableConfig,
|
|
3702
|
+
columns: (0, import_vuu_utils46.addColumnToSubscribedColumns)(
|
|
3703
|
+
tableConfig.columns,
|
|
3704
|
+
availableColumns,
|
|
3705
|
+
name2
|
|
3706
|
+
)
|
|
3707
|
+
};
|
|
3708
|
+
setColumnState((state) => ({
|
|
3709
|
+
...state,
|
|
3710
|
+
tableConfig: newConfig
|
|
3711
|
+
}));
|
|
3712
|
+
const subscribedColumns = newConfig.columns.map((col) => col.name);
|
|
3713
|
+
onDataSourceConfigChange({
|
|
3714
|
+
columns: subscribedColumns
|
|
3715
|
+
});
|
|
3716
|
+
}
|
|
3445
3717
|
} else if (columnItem == null ? void 0 : columnItem.subscribed) {
|
|
3446
|
-
const column = tableConfig.columns.find((col) => col.name ===
|
|
3718
|
+
const column = tableConfig.columns.find((col) => col.name === name2);
|
|
3447
3719
|
if (column) {
|
|
3448
3720
|
const newConfig = updateTableConfig(tableConfig, {
|
|
3449
3721
|
type: "column-prop",
|
|
@@ -3451,20 +3723,39 @@ var useTableSettings = ({
|
|
|
3451
3723
|
column,
|
|
3452
3724
|
value
|
|
3453
3725
|
});
|
|
3454
|
-
|
|
3726
|
+
setColumnState((state) => ({
|
|
3727
|
+
...state,
|
|
3728
|
+
tableConfig: newConfig
|
|
3729
|
+
}));
|
|
3455
3730
|
}
|
|
3456
3731
|
}
|
|
3457
3732
|
},
|
|
3458
|
-
[columnItems, tableConfig]
|
|
3733
|
+
[availableColumns, columnItems, onDataSourceConfigChange, tableConfig]
|
|
3459
3734
|
);
|
|
3460
|
-
const handleChangeColumnLabels = (0,
|
|
3735
|
+
const handleChangeColumnLabels = (0, import_react59.useCallback)((evt) => {
|
|
3461
3736
|
const { value } = evt.target;
|
|
3462
3737
|
const columnFormatHeader = value === "0" ? void 0 : value === "1" ? "capitalize" : "uppercase";
|
|
3463
|
-
|
|
3464
|
-
...
|
|
3465
|
-
|
|
3738
|
+
setColumnState((state) => ({
|
|
3739
|
+
...state,
|
|
3740
|
+
tableConfig: {
|
|
3741
|
+
...state.tableConfig,
|
|
3742
|
+
columnFormatHeader
|
|
3743
|
+
}
|
|
3466
3744
|
}));
|
|
3467
3745
|
}, []);
|
|
3746
|
+
const handleChangeTableAttribute = (0, import_react59.useCallback)(
|
|
3747
|
+
(evt) => {
|
|
3748
|
+
const { ariaChecked, value } = evt.target;
|
|
3749
|
+
setColumnState((state) => ({
|
|
3750
|
+
...state,
|
|
3751
|
+
tableConfig: {
|
|
3752
|
+
...state.tableConfig,
|
|
3753
|
+
[value]: ariaChecked !== "true"
|
|
3754
|
+
}
|
|
3755
|
+
}));
|
|
3756
|
+
},
|
|
3757
|
+
[]
|
|
3758
|
+
);
|
|
3468
3759
|
(0, import_vuu_layout4.useLayoutEffectSkipFirst)(() => {
|
|
3469
3760
|
onConfigChange == null ? void 0 : onConfigChange(tableConfig);
|
|
3470
3761
|
}, [onConfigChange, tableConfig]);
|
|
@@ -3473,59 +3764,66 @@ var useTableSettings = ({
|
|
|
3473
3764
|
columnItems,
|
|
3474
3765
|
columnLabelsValue,
|
|
3475
3766
|
onChangeColumnLabels: handleChangeColumnLabels,
|
|
3767
|
+
onChangeTableAttribute: handleChangeTableAttribute,
|
|
3476
3768
|
onColumnChange: handleColumnChange,
|
|
3477
|
-
onMoveListItem: handleMoveListItem
|
|
3769
|
+
onMoveListItem: handleMoveListItem,
|
|
3770
|
+
tableConfig
|
|
3478
3771
|
};
|
|
3479
3772
|
};
|
|
3480
3773
|
|
|
3481
3774
|
// src/table-settings/TableSettingsPanel.tsx
|
|
3482
|
-
var
|
|
3483
|
-
var
|
|
3775
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3776
|
+
var classBase18 = "vuuTableSettingsPanel";
|
|
3484
3777
|
var TableSettingsPanel = ({
|
|
3485
3778
|
availableColumns,
|
|
3779
|
+
onAddCalculatedColumn,
|
|
3486
3780
|
onConfigChange,
|
|
3487
|
-
|
|
3781
|
+
onDataSourceConfigChange,
|
|
3782
|
+
tableConfig: tableConfigProp,
|
|
3488
3783
|
...htmlAttributes
|
|
3489
3784
|
}) => {
|
|
3490
3785
|
const {
|
|
3491
3786
|
columnItems,
|
|
3492
3787
|
columnLabelsValue,
|
|
3493
3788
|
onChangeColumnLabels,
|
|
3789
|
+
onChangeTableAttribute,
|
|
3494
3790
|
onColumnChange,
|
|
3495
|
-
onMoveListItem
|
|
3791
|
+
onMoveListItem,
|
|
3792
|
+
tableConfig
|
|
3496
3793
|
} = useTableSettings({
|
|
3497
3794
|
availableColumns,
|
|
3498
3795
|
onConfigChange,
|
|
3499
|
-
|
|
3796
|
+
onDataSourceConfigChange,
|
|
3797
|
+
tableConfig: tableConfigProp
|
|
3500
3798
|
});
|
|
3501
|
-
return /* @__PURE__ */ (0,
|
|
3502
|
-
/* @__PURE__ */ (0,
|
|
3503
|
-
/* @__PURE__ */ (0,
|
|
3504
|
-
/* @__PURE__ */ (0,
|
|
3505
|
-
|
|
3799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { ...htmlAttributes, className: classBase18, children: [
|
|
3800
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_core8.FormField, { children: [
|
|
3801
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_core8.FormFieldLabel, { children: "Column Labels" }),
|
|
3802
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
3803
|
+
import_core8.ToggleButtonGroup,
|
|
3506
3804
|
{
|
|
3507
3805
|
className: "vuuToggleButtonGroup",
|
|
3508
3806
|
onChange: onChangeColumnLabels,
|
|
3509
3807
|
value: columnLabelsValue,
|
|
3510
3808
|
children: [
|
|
3511
|
-
/* @__PURE__ */ (0,
|
|
3512
|
-
|
|
3809
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3810
|
+
import_core8.ToggleButton,
|
|
3513
3811
|
{
|
|
3514
3812
|
className: "vuuIconToggleButton",
|
|
3515
3813
|
"data-icon": "text-strikethrough",
|
|
3516
3814
|
value: 0
|
|
3517
3815
|
}
|
|
3518
3816
|
),
|
|
3519
|
-
/* @__PURE__ */ (0,
|
|
3520
|
-
|
|
3817
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3818
|
+
import_core8.ToggleButton,
|
|
3521
3819
|
{
|
|
3522
3820
|
className: "vuuIconToggleButton",
|
|
3523
3821
|
"data-icon": "text-Tt",
|
|
3524
3822
|
value: 1
|
|
3525
3823
|
}
|
|
3526
3824
|
),
|
|
3527
|
-
/* @__PURE__ */ (0,
|
|
3528
|
-
|
|
3825
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3826
|
+
import_core8.ToggleButton,
|
|
3529
3827
|
{
|
|
3530
3828
|
className: "vuuIconToggleButton",
|
|
3531
3829
|
"data-icon": "text-T",
|
|
@@ -3536,18 +3834,159 @@ var TableSettingsPanel = ({
|
|
|
3536
3834
|
}
|
|
3537
3835
|
)
|
|
3538
3836
|
] }),
|
|
3539
|
-
/* @__PURE__ */ (0,
|
|
3540
|
-
/* @__PURE__ */ (0,
|
|
3541
|
-
/* @__PURE__ */ (0,
|
|
3837
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_core8.FormField, { children: [
|
|
3838
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_core8.FormFieldLabel, { children: "Grid separators" }),
|
|
3839
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "saltToggleButtonGroup vuuToggleButtonGroup saltToggleButtonGroup-horizontal vuuGridSeparators", children: [
|
|
3840
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3841
|
+
import_core8.ToggleButton,
|
|
3842
|
+
{
|
|
3843
|
+
className: "vuuIconToggleButton",
|
|
3844
|
+
"data-icon": "row-striping",
|
|
3845
|
+
selected: tableConfig.zebraStripes,
|
|
3846
|
+
onChange: onChangeTableAttribute,
|
|
3847
|
+
value: "zebraStripes"
|
|
3848
|
+
}
|
|
3849
|
+
),
|
|
3850
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3851
|
+
import_core8.ToggleButton,
|
|
3852
|
+
{
|
|
3853
|
+
className: "vuuIconToggleButton",
|
|
3854
|
+
"data-icon": "row-lines",
|
|
3855
|
+
selected: tableConfig.rowSeparators,
|
|
3856
|
+
onChange: onChangeTableAttribute,
|
|
3857
|
+
value: "rowSeparators"
|
|
3858
|
+
}
|
|
3859
|
+
),
|
|
3860
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3861
|
+
import_core8.ToggleButton,
|
|
3862
|
+
{
|
|
3863
|
+
className: "vuuIconToggleButton",
|
|
3864
|
+
"data-icon": "col-lines",
|
|
3865
|
+
selected: tableConfig.columnSeparators,
|
|
3866
|
+
onChange: onChangeTableAttribute,
|
|
3867
|
+
value: "columnSeparators"
|
|
3868
|
+
}
|
|
3869
|
+
)
|
|
3870
|
+
] })
|
|
3871
|
+
] }),
|
|
3872
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_core8.FormField, { children: [
|
|
3873
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_core8.FormFieldLabel, { children: "Default Column Width" }),
|
|
3874
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_core8.Input, { className: "vuuInput" })
|
|
3542
3875
|
] }),
|
|
3543
|
-
/* @__PURE__ */ (0,
|
|
3876
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3544
3877
|
ColumnList,
|
|
3545
3878
|
{
|
|
3546
3879
|
columnItems,
|
|
3547
3880
|
onChange: onColumnChange,
|
|
3548
3881
|
onMoveListItem
|
|
3549
3882
|
}
|
|
3550
|
-
)
|
|
3883
|
+
),
|
|
3884
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: `${classBase18}-calculatedButtonbar`, children: [
|
|
3885
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_core8.Button, { "data-icon": "plus", onClick: onAddCalculatedColumn }),
|
|
3886
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: `${classBase18}-calculatedLabel`, children: "Add calculated column" })
|
|
3887
|
+
] })
|
|
3551
3888
|
] });
|
|
3552
3889
|
};
|
|
3890
|
+
|
|
3891
|
+
// src/useTableAndColumnSettings.ts
|
|
3892
|
+
var import_vuu_layout5 = require("@vuu-ui/vuu-layout");
|
|
3893
|
+
var import_vuu_utils47 = require("@vuu-ui/vuu-utils");
|
|
3894
|
+
var import_react60 = require("react");
|
|
3895
|
+
var useTableAndColumnSettings = ({
|
|
3896
|
+
availableColumns: availableColumnsProps,
|
|
3897
|
+
onAvailableColumnsChange,
|
|
3898
|
+
onConfigChange,
|
|
3899
|
+
onCreateCalculatedColumn,
|
|
3900
|
+
onDataSourceConfigChange,
|
|
3901
|
+
tableConfig
|
|
3902
|
+
}) => {
|
|
3903
|
+
const dispatchLayoutAction = (0, import_vuu_layout5.useLayoutProviderDispatch)();
|
|
3904
|
+
const showTableSettingsRef = (0, import_react60.useRef)();
|
|
3905
|
+
const [availableColumns, setAvailableColumns] = (0, import_react60.useState)(
|
|
3906
|
+
availableColumnsProps
|
|
3907
|
+
);
|
|
3908
|
+
const showContextPanel = (0, import_react60.useCallback)(
|
|
3909
|
+
(componentType, title, props) => {
|
|
3910
|
+
dispatchLayoutAction({
|
|
3911
|
+
type: "set-props",
|
|
3912
|
+
path: "#context-panel",
|
|
3913
|
+
props: {
|
|
3914
|
+
expanded: true,
|
|
3915
|
+
content: {
|
|
3916
|
+
type: componentType,
|
|
3917
|
+
props
|
|
3918
|
+
},
|
|
3919
|
+
title
|
|
3920
|
+
}
|
|
3921
|
+
});
|
|
3922
|
+
},
|
|
3923
|
+
[dispatchLayoutAction]
|
|
3924
|
+
);
|
|
3925
|
+
const handleCreateCalculatedColumn = (0, import_react60.useCallback)(
|
|
3926
|
+
(column) => {
|
|
3927
|
+
const newAvailableColumns = availableColumns.concat({
|
|
3928
|
+
name: column.name,
|
|
3929
|
+
serverDataType: (0, import_vuu_utils47.getCalculatedColumnType)(column)
|
|
3930
|
+
});
|
|
3931
|
+
setAvailableColumns(newAvailableColumns);
|
|
3932
|
+
onAvailableColumnsChange == null ? void 0 : onAvailableColumnsChange(newAvailableColumns);
|
|
3933
|
+
requestAnimationFrame(() => {
|
|
3934
|
+
var _a;
|
|
3935
|
+
(_a = showTableSettingsRef.current) == null ? void 0 : _a.call(showTableSettingsRef);
|
|
3936
|
+
});
|
|
3937
|
+
onCreateCalculatedColumn(column);
|
|
3938
|
+
},
|
|
3939
|
+
[availableColumns, onAvailableColumnsChange, onCreateCalculatedColumn]
|
|
3940
|
+
);
|
|
3941
|
+
const showColumnSettingsPanel = (0, import_react60.useCallback)(
|
|
3942
|
+
(action) => {
|
|
3943
|
+
showContextPanel("ColumnSettings", "Column Settings", {
|
|
3944
|
+
column: action.column,
|
|
3945
|
+
onConfigChange,
|
|
3946
|
+
onCreateCalculatedColumn: handleCreateCalculatedColumn,
|
|
3947
|
+
tableConfig,
|
|
3948
|
+
vuuTable: action.vuuTable
|
|
3949
|
+
});
|
|
3950
|
+
},
|
|
3951
|
+
[
|
|
3952
|
+
handleCreateCalculatedColumn,
|
|
3953
|
+
onConfigChange,
|
|
3954
|
+
showContextPanel,
|
|
3955
|
+
tableConfig
|
|
3956
|
+
]
|
|
3957
|
+
);
|
|
3958
|
+
const handleAddCalculatedColumn = (0, import_react60.useCallback)(() => {
|
|
3959
|
+
showColumnSettingsPanel({
|
|
3960
|
+
column: {
|
|
3961
|
+
name: "::",
|
|
3962
|
+
serverDataType: "string"
|
|
3963
|
+
},
|
|
3964
|
+
type: "columnSettings",
|
|
3965
|
+
vuuTable: { module: "SIMUL", table: "instruments" }
|
|
3966
|
+
});
|
|
3967
|
+
}, [showColumnSettingsPanel]);
|
|
3968
|
+
showTableSettingsRef.current = (0, import_react60.useCallback)(() => {
|
|
3969
|
+
showContextPanel("TableSettings", "DataGrid Settings", {
|
|
3970
|
+
availableColumns: availableColumns != null ? availableColumns : tableConfig.columns.map(({ name: name2, serverDataType }) => ({
|
|
3971
|
+
name: name2,
|
|
3972
|
+
serverDataType
|
|
3973
|
+
})),
|
|
3974
|
+
onAddCalculatedColumn: handleAddCalculatedColumn,
|
|
3975
|
+
onConfigChange,
|
|
3976
|
+
onDataSourceConfigChange,
|
|
3977
|
+
tableConfig
|
|
3978
|
+
});
|
|
3979
|
+
}, [
|
|
3980
|
+
availableColumns,
|
|
3981
|
+
handleAddCalculatedColumn,
|
|
3982
|
+
onConfigChange,
|
|
3983
|
+
onDataSourceConfigChange,
|
|
3984
|
+
showContextPanel,
|
|
3985
|
+
tableConfig
|
|
3986
|
+
]);
|
|
3987
|
+
return {
|
|
3988
|
+
showColumnSettingsPanel,
|
|
3989
|
+
showTableSettingsPanel: showTableSettingsRef.current
|
|
3990
|
+
};
|
|
3991
|
+
};
|
|
3553
3992
|
//# sourceMappingURL=index.js.map
|