@vuu-ui/vuu-table-extras 0.8.23-debug → 0.8.24-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 +437 -408
- package/cjs/index.js.map +4 -4
- package/esm/index.js +424 -393
- package/esm/index.js.map +4 -4
- package/index.css +31 -7
- package/index.css.map +3 -3
- package/package.json +13 -13
- package/types/cell-renderers/index.d.ts +1 -0
- package/types/cell-renderers/pct-progress-cell/PctProgressCell.d.ts +4 -0
- package/types/cell-renderers/pct-progress-cell/index.d.ts +1 -0
- package/types/column-expression-panel/ColumnExpressionPanel.d.ts +3 -1
- package/types/column-expression-panel/useColumnExpression.d.ts +3 -3
- package/types/column-formatting-settings/BaseNumericFormattingSettings.d.ts +1 -1
- package/types/column-formatting-settings/ColumnFormattingPanel.d.ts +2 -3
- package/types/column-formatting-settings/DateTimeFormattingSettings.d.ts +1 -2
- package/types/column-formatting-settings/LongTypeFormattingSettings.d.ts +3 -3
- package/types/column-settings/useColumnSettings.d.ts +3 -0
- package/types/table-settings/useTableSettings.d.ts +2 -0
- package/types/column-formatting-settings/types.d.ts +0 -6
package/esm/index.js
CHANGED
|
@@ -208,17 +208,17 @@ registerConfigurationEditor(
|
|
|
208
208
|
);
|
|
209
209
|
|
|
210
210
|
// src/cell-renderers/dropdown-cell/DropdownCell.tsx
|
|
211
|
-
import { useLookupValues } from "@vuu-ui/vuu-data-react";
|
|
211
|
+
import { getSelectedOption, useLookupValues } from "@vuu-ui/vuu-data-react";
|
|
212
212
|
import {
|
|
213
213
|
Dropdown as Dropdown2,
|
|
214
214
|
WarnCommit
|
|
215
215
|
} from "@vuu-ui/vuu-ui-controls";
|
|
216
216
|
import {
|
|
217
|
-
|
|
217
|
+
dataColumnAndKeyUnchanged,
|
|
218
218
|
dispatchCustomEvent,
|
|
219
219
|
registerComponent as registerComponent4
|
|
220
220
|
} from "@vuu-ui/vuu-utils";
|
|
221
|
-
import { memo as memo2, useCallback as useCallback2,
|
|
221
|
+
import { memo as memo2, useCallback as useCallback2, useMemo, useRef as useRef2 } from "react";
|
|
222
222
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
223
223
|
var classBase3 = "vuuTableDropdownCell";
|
|
224
224
|
var openKeys = ["Enter", " "];
|
|
@@ -230,12 +230,15 @@ var DropdownCell = memo2(
|
|
|
230
230
|
row
|
|
231
231
|
}) {
|
|
232
232
|
const dataIdx = columnMap[column.name];
|
|
233
|
-
const
|
|
234
|
-
const
|
|
233
|
+
const dataValue = row[dataIdx];
|
|
234
|
+
const { values } = useLookupValues(column, dataValue);
|
|
235
|
+
const valueRef = useRef2(null);
|
|
236
|
+
useMemo(() => {
|
|
237
|
+
valueRef.current = getSelectedOption(values, dataValue);
|
|
238
|
+
}, [dataValue, values]);
|
|
235
239
|
const handleSelectionChange = useCallback2(
|
|
236
240
|
(evt, selectedOption) => {
|
|
237
241
|
if (selectedOption) {
|
|
238
|
-
setValue(selectedOption);
|
|
239
242
|
onCommit(selectedOption.value).then((response) => {
|
|
240
243
|
if (response === true && evt) {
|
|
241
244
|
dispatchCustomEvent(evt.target, "vuu-commit");
|
|
@@ -251,19 +254,21 @@ var DropdownCell = memo2(
|
|
|
251
254
|
className: classBase3,
|
|
252
255
|
onSelectionChange: handleSelectionChange,
|
|
253
256
|
openKeys,
|
|
254
|
-
selected:
|
|
257
|
+
selected: valueRef.current,
|
|
255
258
|
source: values,
|
|
256
259
|
width: column.width - 17
|
|
257
260
|
}
|
|
258
261
|
);
|
|
259
262
|
},
|
|
260
|
-
|
|
263
|
+
dataColumnAndKeyUnchanged
|
|
261
264
|
);
|
|
262
|
-
registerComponent4("dropdown-cell", DropdownCell, "cell-renderer", {
|
|
265
|
+
registerComponent4("dropdown-cell", DropdownCell, "cell-renderer", {
|
|
266
|
+
userCanAssign: false
|
|
267
|
+
});
|
|
263
268
|
|
|
264
269
|
// src/cell-renderers/lookup-cell/LookupCell.tsx
|
|
265
270
|
import { useLookupValues as useLookupValues2 } from "@vuu-ui/vuu-data-react";
|
|
266
|
-
import { dataAndColumnUnchanged as
|
|
271
|
+
import { dataAndColumnUnchanged as dataAndColumnUnchanged2, registerComponent as registerComponent5 } from "@vuu-ui/vuu-utils";
|
|
267
272
|
import { memo as memo3 } from "react";
|
|
268
273
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
269
274
|
var LookupCell = memo3(
|
|
@@ -273,23 +278,75 @@ var LookupCell = memo3(
|
|
|
273
278
|
row
|
|
274
279
|
}) {
|
|
275
280
|
const dataIdx = columnMap[column.name];
|
|
276
|
-
const
|
|
281
|
+
const dataValue = row[dataIdx];
|
|
282
|
+
const { initialValue: value } = useLookupValues2(column, dataValue);
|
|
277
283
|
return /* @__PURE__ */ jsx4("span", { children: value == null ? void 0 : value.label });
|
|
278
284
|
},
|
|
279
|
-
|
|
285
|
+
dataAndColumnUnchanged2
|
|
280
286
|
);
|
|
281
|
-
registerComponent5("lookup-cell", LookupCell, "cell-renderer", {
|
|
287
|
+
registerComponent5("lookup-cell", LookupCell, "cell-renderer", {
|
|
288
|
+
userCanAssign: false
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
// src/cell-renderers/pct-progress-cell/PctProgressCell.tsx
|
|
292
|
+
import { registerComponent as registerComponent6 } from "@vuu-ui/vuu-utils";
|
|
293
|
+
import cx2 from "clsx";
|
|
294
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
295
|
+
var classBase4 = "vuuPctProgressCell";
|
|
296
|
+
var getPercentageValue = (value) => {
|
|
297
|
+
if (value >= 0 && value <= 1) {
|
|
298
|
+
return value * 100;
|
|
299
|
+
} else if (value > 2) {
|
|
300
|
+
return 0;
|
|
301
|
+
} else if (value > 1) {
|
|
302
|
+
return 100;
|
|
303
|
+
} else {
|
|
304
|
+
return 0;
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
var PctProgressCell = ({ column, columnMap, row }) => {
|
|
308
|
+
const value = row[columnMap[column.name]];
|
|
309
|
+
const percentageValue = getPercentageValue(value);
|
|
310
|
+
const className = cx2(classBase4, {});
|
|
311
|
+
return /* @__PURE__ */ jsxs3(
|
|
312
|
+
"div",
|
|
313
|
+
{
|
|
314
|
+
className: cx2(className, {
|
|
315
|
+
[`${classBase4}-zero`]: percentageValue === 0,
|
|
316
|
+
[`${classBase4}-complete`]: percentageValue >= 100
|
|
317
|
+
}),
|
|
318
|
+
tabIndex: -1,
|
|
319
|
+
children: [
|
|
320
|
+
/* @__PURE__ */ jsx5(
|
|
321
|
+
"span",
|
|
322
|
+
{
|
|
323
|
+
className: `${classBase4}-progressBar`,
|
|
324
|
+
style: { "--progress-bar-pct": `${percentageValue}%` }
|
|
325
|
+
}
|
|
326
|
+
),
|
|
327
|
+
/* @__PURE__ */ jsx5("span", { className: `${classBase4}-text`, children: `${percentageValue.toFixed(
|
|
328
|
+
2
|
|
329
|
+
)} %` })
|
|
330
|
+
]
|
|
331
|
+
}
|
|
332
|
+
);
|
|
333
|
+
};
|
|
334
|
+
registerComponent6("vuu.pct-progress", PctProgressCell, "cell-renderer", {
|
|
335
|
+
description: "Percentage formatter",
|
|
336
|
+
label: "Percentage formatter",
|
|
337
|
+
serverDataType: "double"
|
|
338
|
+
});
|
|
282
339
|
|
|
283
340
|
// src/cell-renderers/progress-cell/ProgressCell.tsx
|
|
284
341
|
import {
|
|
285
342
|
isColumnTypeRenderer,
|
|
286
343
|
isTypeDescriptor as isTypeDescriptor3,
|
|
287
344
|
isValidNumber as isValidNumber2,
|
|
288
|
-
registerComponent as
|
|
345
|
+
registerComponent as registerComponent7
|
|
289
346
|
} from "@vuu-ui/vuu-utils";
|
|
290
|
-
import
|
|
291
|
-
import { jsx as
|
|
292
|
-
var
|
|
347
|
+
import cx3 from "clsx";
|
|
348
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
349
|
+
var classBase5 = "vuuProgressCell";
|
|
293
350
|
var ProgressCell = ({ column, columnMap, row }) => {
|
|
294
351
|
const { name: name2, type } = column;
|
|
295
352
|
const value = row[columnMap[name2]];
|
|
@@ -299,7 +356,7 @@ var ProgressCell = ({ column, columnMap, row }) => {
|
|
|
299
356
|
const { associatedField } = type.renderer;
|
|
300
357
|
if (associatedField) {
|
|
301
358
|
const associatedValue = row[columnMap[associatedField]];
|
|
302
|
-
if (
|
|
359
|
+
if (isValidNumber2(value) && isValidNumber2(associatedValue)) {
|
|
303
360
|
percentage = Math.min(Math.round(value / associatedValue * 100), 100);
|
|
304
361
|
percentage = Math.min(Math.round(value / associatedValue * 100), 100);
|
|
305
362
|
showProgress = isFinite(percentage);
|
|
@@ -320,25 +377,27 @@ var ProgressCell = ({ column, columnMap, row }) => {
|
|
|
320
377
|
throw Error("ProgressCell associatedField is required to render");
|
|
321
378
|
}
|
|
322
379
|
}
|
|
323
|
-
const className =
|
|
324
|
-
return /* @__PURE__ */
|
|
325
|
-
showProgress ? /* @__PURE__ */
|
|
326
|
-
/* @__PURE__ */
|
|
327
|
-
/* @__PURE__ */
|
|
380
|
+
const className = cx3(classBase5, {});
|
|
381
|
+
return /* @__PURE__ */ jsxs4("div", { className, tabIndex: -1, children: [
|
|
382
|
+
showProgress ? /* @__PURE__ */ jsxs4("span", { className: `${classBase5}-track`, children: [
|
|
383
|
+
/* @__PURE__ */ jsx6("span", { className: `${classBase5}-bg` }),
|
|
384
|
+
/* @__PURE__ */ jsx6(
|
|
328
385
|
"span",
|
|
329
386
|
{
|
|
330
|
-
className: `${
|
|
387
|
+
className: `${classBase5}-bar`,
|
|
331
388
|
style: { "--progress-bar-pct": `-${100 - percentage}%` }
|
|
332
389
|
}
|
|
333
390
|
)
|
|
334
391
|
] }) : null,
|
|
335
|
-
/* @__PURE__ */
|
|
392
|
+
/* @__PURE__ */ jsx6("span", { className: `${classBase5}-text`, children: `${percentage} %` })
|
|
336
393
|
] });
|
|
337
394
|
};
|
|
338
|
-
|
|
395
|
+
registerComponent7("vuu.progress", ProgressCell, "cell-renderer", {
|
|
339
396
|
description: "Progress formatter",
|
|
340
397
|
label: "Progress formatter",
|
|
341
|
-
serverDataType: ["long", "int", "double"]
|
|
398
|
+
serverDataType: ["long", "int", "double"],
|
|
399
|
+
// Not until we provide settings for associaetd field
|
|
400
|
+
userCanAssign: false
|
|
342
401
|
});
|
|
343
402
|
|
|
344
403
|
// src/column-list/ColumnList.tsx
|
|
@@ -347,33 +406,33 @@ import {
|
|
|
347
406
|
ListItem
|
|
348
407
|
} from "@vuu-ui/vuu-ui-controls";
|
|
349
408
|
import { Checkbox, Switch } from "@salt-ds/core";
|
|
350
|
-
import
|
|
409
|
+
import cx4 from "clsx";
|
|
351
410
|
import {
|
|
352
411
|
useCallback as useCallback3
|
|
353
412
|
} from "react";
|
|
354
413
|
import { getColumnLabel } from "@vuu-ui/vuu-utils";
|
|
355
|
-
import { jsx as
|
|
356
|
-
var
|
|
414
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
415
|
+
var classBase6 = "vuuColumnList";
|
|
357
416
|
var classBaseListItem = "vuuColumnListItem";
|
|
358
417
|
var ColumnListItem = ({
|
|
359
418
|
className: classNameProp,
|
|
360
419
|
item,
|
|
361
420
|
...listItemProps
|
|
362
421
|
}) => {
|
|
363
|
-
return /* @__PURE__ */
|
|
422
|
+
return /* @__PURE__ */ jsxs5(
|
|
364
423
|
ListItem,
|
|
365
424
|
{
|
|
366
425
|
...listItemProps,
|
|
367
|
-
className:
|
|
426
|
+
className: cx4(classNameProp, classBaseListItem),
|
|
368
427
|
"data-name": item == null ? void 0 : item.name,
|
|
369
428
|
children: [
|
|
370
|
-
/* @__PURE__ */
|
|
371
|
-
(item == null ? void 0 : item.isCalculated) ? /* @__PURE__ */
|
|
372
|
-
/* @__PURE__ */
|
|
373
|
-
/* @__PURE__ */
|
|
429
|
+
/* @__PURE__ */ jsx7("span", { className: `${classBase6}-icon`, "data-icon": "draggable" }),
|
|
430
|
+
(item == null ? void 0 : item.isCalculated) ? /* @__PURE__ */ jsx7("span", { className: `${classBase6}-icon`, "data-icon": "function" }) : /* @__PURE__ */ jsx7(Switch, { className: `${classBase6}-switch`, checked: item == null ? void 0 : item.subscribed }),
|
|
431
|
+
/* @__PURE__ */ jsx7("span", { className: `${classBase6}-text`, children: getColumnLabel(item) }),
|
|
432
|
+
/* @__PURE__ */ jsx7(
|
|
374
433
|
Checkbox,
|
|
375
434
|
{
|
|
376
|
-
className: `${
|
|
435
|
+
className: `${classBase6}-checkBox`,
|
|
377
436
|
checked: (item == null ? void 0 : item.hidden) !== true,
|
|
378
437
|
disabled: (item == null ? void 0 : item.subscribed) !== true
|
|
379
438
|
}
|
|
@@ -397,9 +456,9 @@ var ColumnList = ({
|
|
|
397
456
|
dataset: { name: name2 }
|
|
398
457
|
} = listItem;
|
|
399
458
|
if (name2) {
|
|
400
|
-
const saltSwitch = input.closest(`.${
|
|
459
|
+
const saltSwitch = input.closest(`.${classBase6}-switch`);
|
|
401
460
|
const saltCheckbox = input.closest(
|
|
402
|
-
`.${
|
|
461
|
+
`.${classBase6}-checkBox`
|
|
403
462
|
);
|
|
404
463
|
if (saltSwitch) {
|
|
405
464
|
onChange(name2, "subscribed", input.checked);
|
|
@@ -419,13 +478,13 @@ var ColumnList = ({
|
|
|
419
478
|
}
|
|
420
479
|
}
|
|
421
480
|
}, []);
|
|
422
|
-
return /* @__PURE__ */
|
|
423
|
-
/* @__PURE__ */
|
|
424
|
-
/* @__PURE__ */
|
|
425
|
-
/* @__PURE__ */
|
|
426
|
-
/* @__PURE__ */
|
|
481
|
+
return /* @__PURE__ */ jsxs5("div", { ...htmlAttributes, className: classBase6, children: [
|
|
482
|
+
/* @__PURE__ */ jsx7("div", { className: `${classBase6}-header`, children: /* @__PURE__ */ jsx7("span", { children: "Column Selection" }) }),
|
|
483
|
+
/* @__PURE__ */ jsxs5("div", { className: `${classBase6}-colHeadings`, children: [
|
|
484
|
+
/* @__PURE__ */ jsx7("span", { children: "Column subscription" }),
|
|
485
|
+
/* @__PURE__ */ jsx7("span", { children: "Visibility" })
|
|
427
486
|
] }),
|
|
428
|
-
/* @__PURE__ */
|
|
487
|
+
/* @__PURE__ */ jsx7(
|
|
429
488
|
List,
|
|
430
489
|
{
|
|
431
490
|
ListItem: ColumnListItem,
|
|
@@ -443,7 +502,7 @@ var ColumnList = ({
|
|
|
443
502
|
};
|
|
444
503
|
|
|
445
504
|
// src/column-settings/ColumnSettingsPanel.tsx
|
|
446
|
-
import { VuuInput } from "@vuu-ui/vuu-ui-controls";
|
|
505
|
+
import { Icon, VuuInput } from "@vuu-ui/vuu-ui-controls";
|
|
447
506
|
import {
|
|
448
507
|
getCalculatedColumnName as getCalculatedColumnName2,
|
|
449
508
|
getDefaultAlignment,
|
|
@@ -456,7 +515,7 @@ import {
|
|
|
456
515
|
ToggleButton as ToggleButton3,
|
|
457
516
|
ToggleButtonGroup as ToggleButtonGroup3
|
|
458
517
|
} from "@salt-ds/core";
|
|
459
|
-
import
|
|
518
|
+
import cx7 from "clsx";
|
|
460
519
|
|
|
461
520
|
// src/column-expression-panel/ColumnExpressionPanel.tsx
|
|
462
521
|
import { Dropdown as Dropdown3 } from "@vuu-ui/vuu-ui-controls";
|
|
@@ -466,7 +525,7 @@ import {
|
|
|
466
525
|
getCalculatedColumnType
|
|
467
526
|
} from "@vuu-ui/vuu-utils";
|
|
468
527
|
import { FormField as FormField2, FormFieldLabel as FormFieldLabel2, Input } from "@salt-ds/core";
|
|
469
|
-
import { useCallback as useCallback8, useRef as
|
|
528
|
+
import { useCallback as useCallback8, useRef as useRef6 } from "react";
|
|
470
529
|
|
|
471
530
|
// src/column-expression-input/ColumnExpressionInput.tsx
|
|
472
531
|
import { memo as memo4 } from "react";
|
|
@@ -486,8 +545,8 @@ import { createEl } from "@vuu-ui/vuu-utils";
|
|
|
486
545
|
import {
|
|
487
546
|
useCallback as useCallback5,
|
|
488
547
|
useEffect as useEffect2,
|
|
489
|
-
useMemo,
|
|
490
|
-
useRef as
|
|
548
|
+
useMemo as useMemo2,
|
|
549
|
+
useRef as useRef3
|
|
491
550
|
} from "react";
|
|
492
551
|
|
|
493
552
|
// src/column-expression-input/column-language-parser/ColumnExpressionLanguage.ts
|
|
@@ -1522,11 +1581,11 @@ var useColumnExpressionEditor = ({
|
|
|
1522
1581
|
source,
|
|
1523
1582
|
suggestionProvider
|
|
1524
1583
|
}) => {
|
|
1525
|
-
const editorRef =
|
|
1526
|
-
const onSubmitRef =
|
|
1527
|
-
const viewRef =
|
|
1584
|
+
const editorRef = useRef3(null);
|
|
1585
|
+
const onSubmitRef = useRef3(noop);
|
|
1586
|
+
const viewRef = useRef3();
|
|
1528
1587
|
const completionFn = useColumnAutoComplete(suggestionProvider, onSubmitRef);
|
|
1529
|
-
const [createState, clearInput, submit] =
|
|
1588
|
+
const [createState, clearInput, submit] = useMemo2(() => {
|
|
1530
1589
|
const parseExpression = () => {
|
|
1531
1590
|
const view = getView(viewRef);
|
|
1532
1591
|
const source2 = view.state.doc.toString();
|
|
@@ -1614,8 +1673,8 @@ var useColumnExpressionEditor = ({
|
|
|
1614
1673
|
};
|
|
1615
1674
|
|
|
1616
1675
|
// src/column-expression-input/ColumnExpressionInput.tsx
|
|
1617
|
-
import { jsx as
|
|
1618
|
-
var
|
|
1676
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1677
|
+
var classBase7 = "vuuColumnExpressionInput";
|
|
1619
1678
|
var ColumnExpressionInput = memo4(
|
|
1620
1679
|
({
|
|
1621
1680
|
onChange,
|
|
@@ -1629,7 +1688,7 @@ var ColumnExpressionInput = memo4(
|
|
|
1629
1688
|
source,
|
|
1630
1689
|
suggestionProvider
|
|
1631
1690
|
});
|
|
1632
|
-
return /* @__PURE__ */
|
|
1691
|
+
return /* @__PURE__ */ jsx8("div", { className: `${classBase7}`, onBlur, ref: editorRef });
|
|
1633
1692
|
},
|
|
1634
1693
|
(prevProps, newProps) => {
|
|
1635
1694
|
return prevProps.source === newProps.source;
|
|
@@ -1650,7 +1709,7 @@ import {
|
|
|
1650
1709
|
useTypeaheadSuggestions
|
|
1651
1710
|
} from "@vuu-ui/vuu-data-react";
|
|
1652
1711
|
import { isNumericColumn, isTextColumn } from "@vuu-ui/vuu-utils";
|
|
1653
|
-
import { useCallback as useCallback6, useRef as
|
|
1712
|
+
import { useCallback as useCallback6, useRef as useRef4 } from "react";
|
|
1654
1713
|
|
|
1655
1714
|
// src/column-expression-input/column-function-descriptors.ts
|
|
1656
1715
|
var columnFunctionDescriptors = [
|
|
@@ -2107,7 +2166,7 @@ var useColumnExpressionSuggestionProvider = ({
|
|
|
2107
2166
|
(name2) => name2 ? columns.find((col) => col.name === name2) : void 0,
|
|
2108
2167
|
[columns]
|
|
2109
2168
|
);
|
|
2110
|
-
const latestSuggestionsRef =
|
|
2169
|
+
const latestSuggestionsRef = useRef4();
|
|
2111
2170
|
const getTypeaheadSuggestions = useTypeaheadSuggestions();
|
|
2112
2171
|
const getSuggestions = useCallback6(
|
|
2113
2172
|
async (suggestionType, options = NONE) => {
|
|
@@ -2201,11 +2260,12 @@ var useColumnExpressionSuggestionProvider = ({
|
|
|
2201
2260
|
// src/column-expression-panel/useColumnExpression.ts
|
|
2202
2261
|
import {
|
|
2203
2262
|
getCalculatedColumnDetails,
|
|
2263
|
+
isVuuColumnDataType,
|
|
2204
2264
|
setCalculatedColumnExpression,
|
|
2205
2265
|
setCalculatedColumnName,
|
|
2206
2266
|
setCalculatedColumnType
|
|
2207
2267
|
} from "@vuu-ui/vuu-utils";
|
|
2208
|
-
import { useCallback as useCallback7, useRef as
|
|
2268
|
+
import { useCallback as useCallback7, useRef as useRef5, useState as useState2 } from "react";
|
|
2209
2269
|
var applyDefaults = (column) => {
|
|
2210
2270
|
const [name2, expression, type] = getCalculatedColumnDetails(column);
|
|
2211
2271
|
if (type === "") {
|
|
@@ -2219,12 +2279,13 @@ var applyDefaults = (column) => {
|
|
|
2219
2279
|
};
|
|
2220
2280
|
var useColumnExpression = ({
|
|
2221
2281
|
column: columnProp,
|
|
2222
|
-
onChangeName: onChangeNameProp
|
|
2282
|
+
onChangeName: onChangeNameProp,
|
|
2283
|
+
onChangeServerDataType: onChangeServerDataTypeProp
|
|
2223
2284
|
}) => {
|
|
2224
|
-
const [column, _setColumn] =
|
|
2285
|
+
const [column, _setColumn] = useState2(
|
|
2225
2286
|
applyDefaults(columnProp)
|
|
2226
2287
|
);
|
|
2227
|
-
const columnRef =
|
|
2288
|
+
const columnRef = useRef5(columnProp);
|
|
2228
2289
|
const setColumn = useCallback7((column2) => {
|
|
2229
2290
|
columnRef.current = column2;
|
|
2230
2291
|
_setColumn(column2);
|
|
@@ -2248,39 +2309,42 @@ var useColumnExpression = ({
|
|
|
2248
2309
|
},
|
|
2249
2310
|
[onChangeNameProp, setColumn]
|
|
2250
2311
|
);
|
|
2251
|
-
const
|
|
2312
|
+
const onChangeServerDataType = useCallback7(
|
|
2252
2313
|
(evt, value) => {
|
|
2253
|
-
if (
|
|
2314
|
+
if (isVuuColumnDataType(value)) {
|
|
2254
2315
|
const newColumn = setCalculatedColumnType(column, value);
|
|
2255
2316
|
setColumn(newColumn);
|
|
2256
2317
|
onChangeNameProp == null ? void 0 : onChangeNameProp(newColumn.name);
|
|
2318
|
+
onChangeServerDataTypeProp == null ? void 0 : onChangeServerDataTypeProp(value);
|
|
2257
2319
|
}
|
|
2258
2320
|
},
|
|
2259
|
-
[column, onChangeNameProp, setColumn]
|
|
2321
|
+
[column, onChangeNameProp, onChangeServerDataTypeProp, setColumn]
|
|
2260
2322
|
);
|
|
2261
2323
|
return {
|
|
2262
2324
|
column,
|
|
2263
2325
|
onChangeExpression,
|
|
2264
2326
|
onChangeName,
|
|
2265
|
-
|
|
2327
|
+
onChangeServerDataType
|
|
2266
2328
|
};
|
|
2267
2329
|
};
|
|
2268
2330
|
|
|
2269
2331
|
// src/column-expression-panel/ColumnExpressionPanel.tsx
|
|
2270
|
-
import { jsx as
|
|
2271
|
-
var
|
|
2332
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2333
|
+
var classBase8 = "vuuColumnExpressionPanel";
|
|
2272
2334
|
var ColumnExpressionPanel = ({
|
|
2273
2335
|
column: columnProp,
|
|
2274
2336
|
onChangeName: onChangeNameProp,
|
|
2337
|
+
onChangeServerDataType: onChangeServerDataTypeProp,
|
|
2275
2338
|
tableConfig,
|
|
2276
2339
|
vuuTable
|
|
2277
2340
|
}) => {
|
|
2278
|
-
const typeRef =
|
|
2279
|
-
const { column, onChangeExpression, onChangeName,
|
|
2341
|
+
const typeRef = useRef6(null);
|
|
2342
|
+
const { column, onChangeExpression, onChangeName, onChangeServerDataType } = useColumnExpression({
|
|
2280
2343
|
column: columnProp,
|
|
2281
|
-
onChangeName: onChangeNameProp
|
|
2344
|
+
onChangeName: onChangeNameProp,
|
|
2345
|
+
onChangeServerDataType: onChangeServerDataTypeProp
|
|
2282
2346
|
});
|
|
2283
|
-
const initialExpressionRef =
|
|
2347
|
+
const initialExpressionRef = useRef6(
|
|
2284
2348
|
getCalculatedColumnExpression(column)
|
|
2285
2349
|
);
|
|
2286
2350
|
const suggestionProvider = useColumnExpressionSuggestionProvider({
|
|
@@ -2293,11 +2357,11 @@ var ColumnExpressionPanel = ({
|
|
|
2293
2357
|
(_b = (_a = typeRef.current) == null ? void 0 : _a.querySelector("button")) == null ? void 0 : _b.focus();
|
|
2294
2358
|
}
|
|
2295
2359
|
}, []);
|
|
2296
|
-
return /* @__PURE__ */
|
|
2297
|
-
/* @__PURE__ */
|
|
2298
|
-
/* @__PURE__ */
|
|
2299
|
-
/* @__PURE__ */
|
|
2300
|
-
/* @__PURE__ */
|
|
2360
|
+
return /* @__PURE__ */ jsxs6("div", { className: classBase8, children: [
|
|
2361
|
+
/* @__PURE__ */ jsx9("div", { className: "vuuColumnSettingsPanel-header", children: /* @__PURE__ */ jsx9("span", { children: "Calculation" }) }),
|
|
2362
|
+
/* @__PURE__ */ jsxs6(FormField2, { "data-field": "column-name", children: [
|
|
2363
|
+
/* @__PURE__ */ jsx9(FormFieldLabel2, { children: "Column Name" }),
|
|
2364
|
+
/* @__PURE__ */ jsx9(
|
|
2301
2365
|
Input,
|
|
2302
2366
|
{
|
|
2303
2367
|
className: "vuuInput",
|
|
@@ -2306,9 +2370,9 @@ var ColumnExpressionPanel = ({
|
|
|
2306
2370
|
}
|
|
2307
2371
|
)
|
|
2308
2372
|
] }),
|
|
2309
|
-
/* @__PURE__ */
|
|
2310
|
-
/* @__PURE__ */
|
|
2311
|
-
/* @__PURE__ */
|
|
2373
|
+
/* @__PURE__ */ jsxs6(FormField2, { "data-field": "column-expression", children: [
|
|
2374
|
+
/* @__PURE__ */ jsx9(FormFieldLabel2, { children: "Expression" }),
|
|
2375
|
+
/* @__PURE__ */ jsx9(
|
|
2312
2376
|
ColumnExpressionInput,
|
|
2313
2377
|
{
|
|
2314
2378
|
onChange: onChangeExpression,
|
|
@@ -2318,16 +2382,16 @@ var ColumnExpressionPanel = ({
|
|
|
2318
2382
|
}
|
|
2319
2383
|
)
|
|
2320
2384
|
] }),
|
|
2321
|
-
/* @__PURE__ */
|
|
2322
|
-
/* @__PURE__ */
|
|
2323
|
-
/* @__PURE__ */
|
|
2385
|
+
/* @__PURE__ */ jsxs6(FormField2, { "data-field": "type", children: [
|
|
2386
|
+
/* @__PURE__ */ jsx9(FormFieldLabel2, { children: "Column type" }),
|
|
2387
|
+
/* @__PURE__ */ jsx9(
|
|
2324
2388
|
Dropdown3,
|
|
2325
2389
|
{
|
|
2326
|
-
className: `${
|
|
2327
|
-
onSelectionChange:
|
|
2390
|
+
className: `${classBase8}-type`,
|
|
2391
|
+
onSelectionChange: onChangeServerDataType,
|
|
2328
2392
|
ref: typeRef,
|
|
2329
2393
|
selected: getCalculatedColumnType(column) || null,
|
|
2330
|
-
source: ["double", "long", "string"],
|
|
2394
|
+
source: ["double", "long", "string", "boolean"],
|
|
2331
2395
|
width: "100%"
|
|
2332
2396
|
}
|
|
2333
2397
|
)
|
|
@@ -2344,24 +2408,24 @@ import {
|
|
|
2344
2408
|
isTypeDescriptor as isTypeDescriptor5
|
|
2345
2409
|
} from "@vuu-ui/vuu-utils";
|
|
2346
2410
|
import { FormField as FormField6, FormFieldLabel as FormFieldLabel6 } from "@salt-ds/core";
|
|
2347
|
-
import
|
|
2348
|
-
import { useCallback as useCallback12, useMemo as
|
|
2411
|
+
import cx5 from "clsx";
|
|
2412
|
+
import { useCallback as useCallback12, useMemo as useMemo4 } from "react";
|
|
2349
2413
|
|
|
2350
2414
|
// src/column-formatting-settings/BaseNumericFormattingSettings.tsx
|
|
2351
2415
|
import { FormField as FormField3, FormFieldLabel as FormFieldLabel3, Input as Input2, Switch as Switch2 } from "@salt-ds/core";
|
|
2352
2416
|
import { getTypeFormattingFromColumn } from "@vuu-ui/vuu-utils";
|
|
2353
2417
|
import {
|
|
2354
2418
|
useCallback as useCallback9,
|
|
2355
|
-
useState as
|
|
2419
|
+
useState as useState3
|
|
2356
2420
|
} from "react";
|
|
2357
|
-
import { jsx as
|
|
2358
|
-
var
|
|
2421
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2422
|
+
var classBase9 = "vuuFormattingSettings";
|
|
2359
2423
|
var BaseNumericFormattingSettings = ({
|
|
2360
2424
|
column,
|
|
2361
2425
|
onChangeFormatting: onChange
|
|
2362
2426
|
}) => {
|
|
2363
2427
|
var _a, _b, _c;
|
|
2364
|
-
const [formattingSettings, setFormattingSettings] =
|
|
2428
|
+
const [formattingSettings, setFormattingSettings] = useState3(getTypeFormattingFromColumn(column));
|
|
2365
2429
|
const handleInputKeyDown = useCallback9(
|
|
2366
2430
|
(evt) => {
|
|
2367
2431
|
if (evt.key === "Enter" || evt.key === "Tab") {
|
|
@@ -2406,10 +2470,10 @@ var BaseNumericFormattingSettings = ({
|
|
|
2406
2470
|
},
|
|
2407
2471
|
[formattingSettings, onChange]
|
|
2408
2472
|
);
|
|
2409
|
-
return /* @__PURE__ */
|
|
2410
|
-
/* @__PURE__ */
|
|
2411
|
-
/* @__PURE__ */
|
|
2412
|
-
/* @__PURE__ */
|
|
2473
|
+
return /* @__PURE__ */ jsxs7("div", { className: classBase9, children: [
|
|
2474
|
+
/* @__PURE__ */ jsxs7(FormField3, { "data-field": "decimals", children: [
|
|
2475
|
+
/* @__PURE__ */ jsx10(FormFieldLabel3, { children: "Number of decimals" }),
|
|
2476
|
+
/* @__PURE__ */ jsx10(
|
|
2413
2477
|
Input2,
|
|
2414
2478
|
{
|
|
2415
2479
|
className: "vuuInput",
|
|
@@ -2419,9 +2483,9 @@ var BaseNumericFormattingSettings = ({
|
|
|
2419
2483
|
}
|
|
2420
2484
|
)
|
|
2421
2485
|
] }),
|
|
2422
|
-
/* @__PURE__ */
|
|
2423
|
-
/* @__PURE__ */
|
|
2424
|
-
/* @__PURE__ */
|
|
2486
|
+
/* @__PURE__ */ jsxs7(FormField3, { labelPlacement: "left", children: [
|
|
2487
|
+
/* @__PURE__ */ jsx10(FormFieldLabel3, { children: "Align on decimals" }),
|
|
2488
|
+
/* @__PURE__ */ jsx10(
|
|
2425
2489
|
Switch2,
|
|
2426
2490
|
{
|
|
2427
2491
|
checked: (_b = formattingSettings.alignOnDecimals) != null ? _b : false,
|
|
@@ -2430,9 +2494,9 @@ var BaseNumericFormattingSettings = ({
|
|
|
2430
2494
|
}
|
|
2431
2495
|
)
|
|
2432
2496
|
] }),
|
|
2433
|
-
/* @__PURE__ */
|
|
2434
|
-
/* @__PURE__ */
|
|
2435
|
-
/* @__PURE__ */
|
|
2497
|
+
/* @__PURE__ */ jsxs7(FormField3, { labelPlacement: "left", children: [
|
|
2498
|
+
/* @__PURE__ */ jsx10(FormFieldLabel3, { children: "Zero pad decimals" }),
|
|
2499
|
+
/* @__PURE__ */ jsx10(
|
|
2436
2500
|
Switch2,
|
|
2437
2501
|
{
|
|
2438
2502
|
checked: (_c = formattingSettings.zeroPad) != null ? _c : false,
|
|
@@ -2455,7 +2519,7 @@ import {
|
|
|
2455
2519
|
import { isDateTimeColumn, isTypeDescriptor as isTypeDescriptor4 } from "@vuu-ui/vuu-utils";
|
|
2456
2520
|
|
|
2457
2521
|
// src/column-formatting-settings/DateTimeFormattingSettings.tsx
|
|
2458
|
-
import { useCallback as useCallback10, useMemo as
|
|
2522
|
+
import { useCallback as useCallback10, useMemo as useMemo3, useState as useState4 } from "react";
|
|
2459
2523
|
import { Dropdown as Dropdown4 } from "@vuu-ui/vuu-ui-controls";
|
|
2460
2524
|
import {
|
|
2461
2525
|
defaultPatternsByType,
|
|
@@ -2469,13 +2533,13 @@ import {
|
|
|
2469
2533
|
ToggleButton,
|
|
2470
2534
|
ToggleButtonGroup
|
|
2471
2535
|
} from "@salt-ds/core";
|
|
2472
|
-
import { Fragment, jsx as
|
|
2536
|
+
import { Fragment, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2473
2537
|
var DateTimeFormattingSettings = ({ column, onChangeFormatting: onChange }) => {
|
|
2474
2538
|
var _a, _b;
|
|
2475
2539
|
const formatting = getTypeFormattingFromColumn2(column);
|
|
2476
2540
|
const { pattern = fallbackDateTimePattern } = formatting;
|
|
2477
|
-
const toggleValue =
|
|
2478
|
-
const [fallbackState, setFallbackState] =
|
|
2541
|
+
const toggleValue = useMemo3(() => getToggleValue(pattern), [pattern]);
|
|
2542
|
+
const [fallbackState, setFallbackState] = useState4(
|
|
2479
2543
|
{
|
|
2480
2544
|
time: (_a = pattern.time) != null ? _a : defaultPatternsByType.time,
|
|
2481
2545
|
date: (_b = pattern.date) != null ? _b : defaultPatternsByType.date
|
|
@@ -2521,22 +2585,23 @@ var DateTimeFormattingSettings = ({ column, onChangeFormatting: onChange }) => {
|
|
|
2521
2585
|
},
|
|
2522
2586
|
[onPatternChange, pattern, fallbackState]
|
|
2523
2587
|
);
|
|
2524
|
-
return /* @__PURE__ */
|
|
2525
|
-
/* @__PURE__ */
|
|
2526
|
-
/* @__PURE__ */
|
|
2527
|
-
/* @__PURE__ */
|
|
2588
|
+
return /* @__PURE__ */ jsxs8(Fragment, { children: [
|
|
2589
|
+
/* @__PURE__ */ jsxs8(FormField4, { labelPlacement: "top", children: [
|
|
2590
|
+
/* @__PURE__ */ jsx11(FormFieldLabel4, { children: "Display" }),
|
|
2591
|
+
/* @__PURE__ */ jsx11(
|
|
2528
2592
|
ToggleButtonGroup,
|
|
2529
2593
|
{
|
|
2530
2594
|
className: "vuuToggleButtonGroup",
|
|
2531
2595
|
onChange: onToggleChange,
|
|
2532
2596
|
value: toggleValue,
|
|
2533
|
-
|
|
2597
|
+
"data-variant": "primary",
|
|
2598
|
+
children: toggleValues.map((v) => /* @__PURE__ */ jsx11(ToggleButton, { value: v, children: v.toUpperCase() }, v))
|
|
2534
2599
|
}
|
|
2535
2600
|
)
|
|
2536
2601
|
] }),
|
|
2537
|
-
["date", "time"].filter((v) => !!pattern[v]).map((v) => /* @__PURE__ */
|
|
2538
|
-
/* @__PURE__ */
|
|
2539
|
-
/* @__PURE__ */
|
|
2602
|
+
["date", "time"].filter((v) => !!pattern[v]).map((v) => /* @__PURE__ */ jsxs8(FormField4, { labelPlacement: "top", children: [
|
|
2603
|
+
/* @__PURE__ */ jsx11(FormFieldLabel4, { children: `${labelByType[v]} pattern` }),
|
|
2604
|
+
/* @__PURE__ */ jsx11(
|
|
2540
2605
|
Dropdown4,
|
|
2541
2606
|
{
|
|
2542
2607
|
onSelectionChange: onDropdownChange(v),
|
|
@@ -2555,10 +2620,10 @@ function getToggleValue(pattern) {
|
|
|
2555
2620
|
}
|
|
2556
2621
|
|
|
2557
2622
|
// src/column-formatting-settings/LongTypeFormattingSettings.tsx
|
|
2558
|
-
import { jsx as
|
|
2559
|
-
var
|
|
2623
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2624
|
+
var classBase10 = "vuuLongColumnFormattingSettings";
|
|
2560
2625
|
var LongTypeFormattingSettings = (props) => {
|
|
2561
|
-
const { column, onChangeType } = props;
|
|
2626
|
+
const { column, onChangeColumnType: onChangeType } = props;
|
|
2562
2627
|
const type = isTypeDescriptor4(column.type) ? column.type.name : column.type;
|
|
2563
2628
|
const handleToggleChange = useCallback11(
|
|
2564
2629
|
(event) => {
|
|
@@ -2567,27 +2632,27 @@ var LongTypeFormattingSettings = (props) => {
|
|
|
2567
2632
|
},
|
|
2568
2633
|
[onChangeType]
|
|
2569
2634
|
);
|
|
2570
|
-
return /* @__PURE__ */
|
|
2571
|
-
/* @__PURE__ */
|
|
2572
|
-
/* @__PURE__ */
|
|
2573
|
-
/* @__PURE__ */
|
|
2635
|
+
return /* @__PURE__ */ jsxs9("div", { className: classBase10, children: [
|
|
2636
|
+
/* @__PURE__ */ jsxs9(FormField5, { children: [
|
|
2637
|
+
/* @__PURE__ */ jsx12(FormFieldLabel5, { children: "Type inferred as" }),
|
|
2638
|
+
/* @__PURE__ */ jsx12(
|
|
2574
2639
|
ToggleButtonGroup2,
|
|
2575
2640
|
{
|
|
2576
2641
|
className: "vuuToggleButtonGroup",
|
|
2577
2642
|
onChange: handleToggleChange,
|
|
2578
2643
|
value: type != null ? type : "number",
|
|
2579
|
-
children: toggleValues2.map((v) => /* @__PURE__ */
|
|
2644
|
+
children: toggleValues2.map((v) => /* @__PURE__ */ jsx12(ToggleButton2, { value: v, children: v.toUpperCase() }, v))
|
|
2580
2645
|
}
|
|
2581
2646
|
)
|
|
2582
2647
|
] }),
|
|
2583
|
-
isDateTimeColumn(column) ? /* @__PURE__ */
|
|
2648
|
+
isDateTimeColumn(column) ? /* @__PURE__ */ jsx12(DateTimeFormattingSettings, { ...props, column }) : /* @__PURE__ */ jsx12(BaseNumericFormattingSettings, { ...props })
|
|
2584
2649
|
] });
|
|
2585
2650
|
};
|
|
2586
2651
|
var toggleValues2 = ["number", "date/time"];
|
|
2587
2652
|
|
|
2588
2653
|
// src/column-formatting-settings/ColumnFormattingPanel.tsx
|
|
2589
|
-
import { jsx as
|
|
2590
|
-
var
|
|
2654
|
+
import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2655
|
+
var classBase11 = "vuuColumnFormattingPanel";
|
|
2591
2656
|
var itemToString = (item) => {
|
|
2592
2657
|
var _a;
|
|
2593
2658
|
return (_a = item.label) != null ? _a : item.name;
|
|
@@ -2597,15 +2662,20 @@ var ColumnFormattingPanel = ({
|
|
|
2597
2662
|
className,
|
|
2598
2663
|
column,
|
|
2599
2664
|
onChangeFormatting,
|
|
2600
|
-
|
|
2665
|
+
onChangeColumnType,
|
|
2601
2666
|
onChangeRendering,
|
|
2602
2667
|
...htmlAttributes
|
|
2603
2668
|
}) => {
|
|
2604
|
-
const
|
|
2605
|
-
() =>
|
|
2606
|
-
|
|
2669
|
+
const formattingSettingsComponent = useMemo4(
|
|
2670
|
+
() => getFormattingSettingsComponent({
|
|
2671
|
+
column,
|
|
2672
|
+
onChangeFormatting,
|
|
2673
|
+
onChangeColumnType
|
|
2674
|
+
}),
|
|
2675
|
+
[column, onChangeColumnType, onChangeFormatting]
|
|
2607
2676
|
);
|
|
2608
|
-
|
|
2677
|
+
console.log({ formattingSettingsComponent });
|
|
2678
|
+
const ConfigEditor = useMemo4(() => {
|
|
2609
2679
|
const { type } = column;
|
|
2610
2680
|
if (isTypeDescriptor5(type) && isColumnTypeRenderer2(type.renderer)) {
|
|
2611
2681
|
const cellRendererOptions = getCellRendererOptions(type.renderer.name);
|
|
@@ -2613,7 +2683,7 @@ var ColumnFormattingPanel = ({
|
|
|
2613
2683
|
}
|
|
2614
2684
|
return void 0;
|
|
2615
2685
|
}, [column]);
|
|
2616
|
-
const selectedCellRenderer =
|
|
2686
|
+
const selectedCellRenderer = useMemo4(() => {
|
|
2617
2687
|
const { type } = column;
|
|
2618
2688
|
const [defaultRenderer] = availableRenderers;
|
|
2619
2689
|
const rendererName = isTypeDescriptor5(type) && isColumnTypeRenderer2(type.renderer) ? type.renderer.name : void 0;
|
|
@@ -2632,14 +2702,14 @@ var ColumnFormattingPanel = ({
|
|
|
2632
2702
|
[onChangeRendering]
|
|
2633
2703
|
);
|
|
2634
2704
|
const { serverDataType = "string" } = column;
|
|
2635
|
-
return /* @__PURE__ */
|
|
2636
|
-
/* @__PURE__ */
|
|
2637
|
-
/* @__PURE__ */
|
|
2638
|
-
/* @__PURE__ */
|
|
2639
|
-
/* @__PURE__ */
|
|
2705
|
+
return /* @__PURE__ */ jsxs10("div", { ...htmlAttributes, className: `vuuColumnSettingsPanel-header`, children: [
|
|
2706
|
+
/* @__PURE__ */ jsx13("div", { children: "Formatting" }),
|
|
2707
|
+
/* @__PURE__ */ jsxs10(FormField6, { children: [
|
|
2708
|
+
/* @__PURE__ */ jsx13(FormFieldLabel6, { children: `Renderer (data type ${column.serverDataType})` }),
|
|
2709
|
+
/* @__PURE__ */ jsx13(
|
|
2640
2710
|
Dropdown5,
|
|
2641
2711
|
{
|
|
2642
|
-
className:
|
|
2712
|
+
className: cx5(`${classBase11}-renderer`),
|
|
2643
2713
|
itemToString,
|
|
2644
2714
|
onSelectionChange: handleChangeRenderer,
|
|
2645
2715
|
selected: selectedCellRenderer,
|
|
@@ -2648,13 +2718,13 @@ var ColumnFormattingPanel = ({
|
|
|
2648
2718
|
}
|
|
2649
2719
|
)
|
|
2650
2720
|
] }),
|
|
2651
|
-
/* @__PURE__ */
|
|
2721
|
+
/* @__PURE__ */ jsxs10(
|
|
2652
2722
|
"div",
|
|
2653
2723
|
{
|
|
2654
|
-
className:
|
|
2724
|
+
className: cx5(classBase11, className, `${classBase11}-${serverDataType}`),
|
|
2655
2725
|
children: [
|
|
2656
|
-
|
|
2657
|
-
ConfigEditor ? /* @__PURE__ */
|
|
2726
|
+
formattingSettingsComponent,
|
|
2727
|
+
ConfigEditor ? /* @__PURE__ */ jsx13(
|
|
2658
2728
|
ConfigEditor,
|
|
2659
2729
|
{
|
|
2660
2730
|
column,
|
|
@@ -2666,51 +2736,51 @@ var ColumnFormattingPanel = ({
|
|
|
2666
2736
|
)
|
|
2667
2737
|
] });
|
|
2668
2738
|
};
|
|
2669
|
-
function
|
|
2739
|
+
function getFormattingSettingsComponent(props) {
|
|
2670
2740
|
const { column } = props;
|
|
2671
2741
|
switch (column.serverDataType) {
|
|
2672
2742
|
case "double":
|
|
2673
2743
|
case "int":
|
|
2674
|
-
return /* @__PURE__ */
|
|
2744
|
+
return /* @__PURE__ */ jsx13(BaseNumericFormattingSettings, { ...props });
|
|
2675
2745
|
case "long":
|
|
2676
|
-
return /* @__PURE__ */
|
|
2746
|
+
return /* @__PURE__ */ jsx13(LongTypeFormattingSettings, { ...props });
|
|
2677
2747
|
default:
|
|
2678
2748
|
return null;
|
|
2679
2749
|
}
|
|
2680
2750
|
}
|
|
2681
2751
|
|
|
2682
2752
|
// src/column-settings/ColumnNameLabel.tsx
|
|
2683
|
-
import
|
|
2753
|
+
import cx6 from "clsx";
|
|
2684
2754
|
import {
|
|
2685
2755
|
getCalculatedColumnDetails as getCalculatedColumnDetails2,
|
|
2686
2756
|
isCalculatedColumn
|
|
2687
2757
|
} from "@vuu-ui/vuu-utils";
|
|
2688
|
-
import { jsx as
|
|
2689
|
-
var
|
|
2758
|
+
import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2759
|
+
var classBase12 = "vuuColumnNameLabel";
|
|
2690
2760
|
var ColumnNameLabel = ({ column, onClick }) => {
|
|
2691
2761
|
if (isCalculatedColumn(column.name)) {
|
|
2692
2762
|
const [name2, type, expression] = getCalculatedColumnDetails2(column);
|
|
2693
2763
|
const displayName = name2 || "name";
|
|
2694
2764
|
const displayExpression = "=expression";
|
|
2695
|
-
const nameClass = displayName === "name" ? `${
|
|
2696
|
-
const expressionClass = expression === "" ? `${
|
|
2697
|
-
return /* @__PURE__ */
|
|
2765
|
+
const nameClass = displayName === "name" ? `${classBase12}-placeholder` : void 0;
|
|
2766
|
+
const expressionClass = expression === "" ? `${classBase12}-placeholder` : void 0;
|
|
2767
|
+
return /* @__PURE__ */ jsxs11(
|
|
2698
2768
|
"div",
|
|
2699
2769
|
{
|
|
2700
|
-
className:
|
|
2770
|
+
className: cx6(classBase12, `${classBase12}-calculated`),
|
|
2701
2771
|
onClick,
|
|
2702
2772
|
children: [
|
|
2703
|
-
/* @__PURE__ */
|
|
2704
|
-
/* @__PURE__ */
|
|
2705
|
-
/* @__PURE__ */
|
|
2706
|
-
/* @__PURE__ */
|
|
2707
|
-
/* @__PURE__ */
|
|
2708
|
-
/* @__PURE__ */
|
|
2773
|
+
/* @__PURE__ */ jsx14("span", { className: nameClass, children: displayName }),
|
|
2774
|
+
/* @__PURE__ */ jsx14("span", { children: ":" }),
|
|
2775
|
+
/* @__PURE__ */ jsx14("span", { children: type || "string" }),
|
|
2776
|
+
/* @__PURE__ */ jsx14("span", { children: ":" }),
|
|
2777
|
+
/* @__PURE__ */ jsx14("span", { className: expressionClass, children: displayExpression }),
|
|
2778
|
+
/* @__PURE__ */ jsx14("span", { className: `${classBase12}-edit`, "data-icon": "edit" })
|
|
2709
2779
|
]
|
|
2710
2780
|
}
|
|
2711
2781
|
);
|
|
2712
2782
|
} else {
|
|
2713
|
-
return /* @__PURE__ */
|
|
2783
|
+
return /* @__PURE__ */ jsx14("div", { className: classBase12, children: column.name });
|
|
2714
2784
|
}
|
|
2715
2785
|
};
|
|
2716
2786
|
|
|
@@ -2722,54 +2792,50 @@ import {
|
|
|
2722
2792
|
setCalculatedColumnName as setCalculatedColumnName2,
|
|
2723
2793
|
updateColumnRenderProps,
|
|
2724
2794
|
updateColumnFormatting,
|
|
2725
|
-
updateColumnType
|
|
2795
|
+
updateColumnType,
|
|
2796
|
+
queryClosest
|
|
2726
2797
|
} from "@vuu-ui/vuu-utils";
|
|
2727
2798
|
import {
|
|
2728
2799
|
useCallback as useCallback13,
|
|
2729
2800
|
useEffect as useEffect3,
|
|
2730
|
-
useMemo as
|
|
2731
|
-
useRef as
|
|
2732
|
-
useState as
|
|
2801
|
+
useMemo as useMemo5,
|
|
2802
|
+
useRef as useRef7,
|
|
2803
|
+
useState as useState5
|
|
2733
2804
|
} from "react";
|
|
2734
2805
|
var integerCellRenderers = [
|
|
2735
2806
|
{
|
|
2736
2807
|
description: "Default formatter for columns with data type integer",
|
|
2737
2808
|
label: "Default Renderer (int, long)",
|
|
2738
2809
|
name: "default-int"
|
|
2739
|
-
}
|
|
2740
|
-
...getRegisteredCellRenderers("int")
|
|
2810
|
+
}
|
|
2741
2811
|
];
|
|
2742
2812
|
var doubleCellRenderers = [
|
|
2743
2813
|
{
|
|
2744
2814
|
description: "Default formatter for columns with data type double",
|
|
2745
2815
|
label: "Default Renderer (double)",
|
|
2746
2816
|
name: "default-double"
|
|
2747
|
-
}
|
|
2748
|
-
...getRegisteredCellRenderers("double")
|
|
2817
|
+
}
|
|
2749
2818
|
];
|
|
2750
2819
|
var stringCellRenderers = [
|
|
2751
2820
|
{
|
|
2752
2821
|
description: "Default formatter for columns with data type string",
|
|
2753
2822
|
label: "Default Renderer (string)",
|
|
2754
2823
|
name: "default-string"
|
|
2755
|
-
}
|
|
2756
|
-
...getRegisteredCellRenderers("string")
|
|
2757
|
-
];
|
|
2758
|
-
var booleanCellRenderers = [
|
|
2759
|
-
...getRegisteredCellRenderers("boolean")
|
|
2824
|
+
}
|
|
2760
2825
|
];
|
|
2826
|
+
var booleanCellRenderers = [];
|
|
2761
2827
|
var getAvailableCellRenderers = (column) => {
|
|
2762
2828
|
switch (column.serverDataType) {
|
|
2763
2829
|
case "char":
|
|
2764
2830
|
case "string":
|
|
2765
|
-
return stringCellRenderers;
|
|
2831
|
+
return stringCellRenderers.concat(getRegisteredCellRenderers("string"));
|
|
2766
2832
|
case "int":
|
|
2767
2833
|
case "long":
|
|
2768
|
-
return integerCellRenderers;
|
|
2834
|
+
return integerCellRenderers.concat(getRegisteredCellRenderers("int"));
|
|
2769
2835
|
case "double":
|
|
2770
|
-
return doubleCellRenderers;
|
|
2836
|
+
return doubleCellRenderers.concat(getRegisteredCellRenderers("double"));
|
|
2771
2837
|
case "boolean":
|
|
2772
|
-
return booleanCellRenderers;
|
|
2838
|
+
return booleanCellRenderers.concat(getRegisteredCellRenderers("boolean"));
|
|
2773
2839
|
default:
|
|
2774
2840
|
return stringCellRenderers;
|
|
2775
2841
|
}
|
|
@@ -2809,11 +2875,11 @@ var useColumnSettings = ({
|
|
|
2809
2875
|
onCreateCalculatedColumn,
|
|
2810
2876
|
tableConfig
|
|
2811
2877
|
}) => {
|
|
2812
|
-
const [column, setColumn] =
|
|
2878
|
+
const [column, setColumn] = useState5(
|
|
2813
2879
|
getColumn(tableConfig.columns, columnProp)
|
|
2814
2880
|
);
|
|
2815
|
-
const columnRef =
|
|
2816
|
-
const [inEditMode, setEditMode] =
|
|
2881
|
+
const columnRef = useRef7(column);
|
|
2882
|
+
const [inEditMode, setEditMode] = useState5(column.name === "::");
|
|
2817
2883
|
const handleEditCalculatedcolumn = useCallback13(() => {
|
|
2818
2884
|
columnRef.current = column;
|
|
2819
2885
|
setEditMode(true);
|
|
@@ -2822,51 +2888,60 @@ var useColumnSettings = ({
|
|
|
2822
2888
|
setColumn(columnProp);
|
|
2823
2889
|
setEditMode(columnProp.name === "::");
|
|
2824
2890
|
}, [columnProp]);
|
|
2825
|
-
const availableRenderers =
|
|
2891
|
+
const availableRenderers = useMemo5(() => {
|
|
2826
2892
|
return getAvailableCellRenderers(column);
|
|
2827
2893
|
}, [column]);
|
|
2828
2894
|
const handleInputCommit = useCallback13(() => {
|
|
2829
2895
|
onConfigChange(replaceColumn(tableConfig, column));
|
|
2830
2896
|
}, [column, onConfigChange, tableConfig]);
|
|
2831
|
-
const
|
|
2897
|
+
const handleChangeToggleButton = useCallback13(
|
|
2832
2898
|
(evt) => {
|
|
2833
|
-
const
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
if (isValidColumnAlignment(value)) {
|
|
2848
|
-
const newColumn = {
|
|
2849
|
-
...column,
|
|
2850
|
-
align: value || void 0
|
|
2851
|
-
};
|
|
2852
|
-
setColumn(newColumn);
|
|
2853
|
-
onConfigChange(replaceColumn(tableConfig, newColumn));
|
|
2854
|
-
}
|
|
2855
|
-
break;
|
|
2856
|
-
case "column-pin":
|
|
2857
|
-
if (isValidPinLocation(value)) {
|
|
2858
|
-
const newColumn = {
|
|
2859
|
-
...column,
|
|
2860
|
-
pin: value || void 0
|
|
2861
|
-
};
|
|
2862
|
-
setColumn(newColumn);
|
|
2863
|
-
onConfigChange(replaceColumn(tableConfig, newColumn));
|
|
2899
|
+
const button = queryClosest(evt.target, "button");
|
|
2900
|
+
if (button) {
|
|
2901
|
+
const fieldName = getFieldName(button);
|
|
2902
|
+
const { value } = button;
|
|
2903
|
+
switch (fieldName) {
|
|
2904
|
+
case "column-alignment":
|
|
2905
|
+
if (isValidColumnAlignment(value)) {
|
|
2906
|
+
const newColumn = {
|
|
2907
|
+
...column,
|
|
2908
|
+
align: value || void 0
|
|
2909
|
+
};
|
|
2910
|
+
setColumn(newColumn);
|
|
2911
|
+
onConfigChange(replaceColumn(tableConfig, newColumn));
|
|
2912
|
+
}
|
|
2864
2913
|
break;
|
|
2865
|
-
|
|
2914
|
+
case "column-pin":
|
|
2915
|
+
if (isValidPinLocation(value)) {
|
|
2916
|
+
const newColumn = {
|
|
2917
|
+
...column,
|
|
2918
|
+
pin: value || void 0
|
|
2919
|
+
};
|
|
2920
|
+
setColumn(newColumn);
|
|
2921
|
+
onConfigChange(replaceColumn(tableConfig, newColumn));
|
|
2922
|
+
break;
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2866
2925
|
}
|
|
2867
2926
|
},
|
|
2868
2927
|
[column, onConfigChange, tableConfig]
|
|
2869
2928
|
);
|
|
2929
|
+
const handleChange = useCallback13((evt) => {
|
|
2930
|
+
const input = evt.target;
|
|
2931
|
+
const fieldName = getFieldName(input);
|
|
2932
|
+
const { value } = input;
|
|
2933
|
+
switch (fieldName) {
|
|
2934
|
+
case "column-label":
|
|
2935
|
+
setColumn((state) => ({ ...state, label: value }));
|
|
2936
|
+
break;
|
|
2937
|
+
case "column-name":
|
|
2938
|
+
setColumn((state) => setCalculatedColumnName2(state, value));
|
|
2939
|
+
break;
|
|
2940
|
+
case "column-width":
|
|
2941
|
+
setColumn((state) => ({ ...state, width: parseInt(value) }));
|
|
2942
|
+
break;
|
|
2943
|
+
}
|
|
2944
|
+
}, []);
|
|
2870
2945
|
const handleChangeCalculatedColumnName = useCallback13((name2) => {
|
|
2871
2946
|
setColumn((state) => ({ ...state, name: name2 }));
|
|
2872
2947
|
}, []);
|
|
@@ -2886,6 +2961,12 @@ var useColumnSettings = ({
|
|
|
2886
2961
|
},
|
|
2887
2962
|
[column, onConfigChange, tableConfig]
|
|
2888
2963
|
);
|
|
2964
|
+
const handleChangeServerDataType = useCallback13(
|
|
2965
|
+
(serverDataType) => {
|
|
2966
|
+
setColumn((col) => ({ ...col, serverDataType }));
|
|
2967
|
+
},
|
|
2968
|
+
[]
|
|
2969
|
+
);
|
|
2889
2970
|
const handleChangeRendering = useCallback13(
|
|
2890
2971
|
(renderProps) => {
|
|
2891
2972
|
if (renderProps) {
|
|
@@ -2940,6 +3021,8 @@ var useColumnSettings = ({
|
|
|
2940
3021
|
onChangeCalculatedColumnName: handleChangeCalculatedColumnName,
|
|
2941
3022
|
onChangeFormatting: handleChangeFormatting,
|
|
2942
3023
|
onChangeRendering: handleChangeRendering,
|
|
3024
|
+
onChangeServerDataType: handleChangeServerDataType,
|
|
3025
|
+
onChangeToggleButton: handleChangeToggleButton,
|
|
2943
3026
|
onChangeType: handleChangeType,
|
|
2944
3027
|
onEditCalculatedColumn: handleEditCalculatedcolumn,
|
|
2945
3028
|
onInputCommit: handleInputCommit,
|
|
@@ -2948,8 +3031,8 @@ var useColumnSettings = ({
|
|
|
2948
3031
|
};
|
|
2949
3032
|
|
|
2950
3033
|
// src/column-settings/ColumnSettingsPanel.tsx
|
|
2951
|
-
import { jsx as
|
|
2952
|
-
var
|
|
3034
|
+
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3035
|
+
var classBase13 = "vuuColumnSettingsPanel";
|
|
2953
3036
|
var getColumnLabel2 = (column) => {
|
|
2954
3037
|
const { name: name2, label } = column;
|
|
2955
3038
|
if (isCalculatedColumn2(name2)) {
|
|
@@ -2978,6 +3061,8 @@ var ColumnSettingsPanel = ({
|
|
|
2978
3061
|
onChangeCalculatedColumnName,
|
|
2979
3062
|
onChangeFormatting,
|
|
2980
3063
|
onChangeRendering,
|
|
3064
|
+
onChangeServerDataType,
|
|
3065
|
+
onChangeToggleButton,
|
|
2981
3066
|
onChangeType,
|
|
2982
3067
|
onEditCalculatedColumn,
|
|
2983
3068
|
onInputCommit,
|
|
@@ -2995,26 +3080,27 @@ var ColumnSettingsPanel = ({
|
|
|
2995
3080
|
pin,
|
|
2996
3081
|
width
|
|
2997
3082
|
} = column;
|
|
2998
|
-
return /* @__PURE__ */
|
|
3083
|
+
return /* @__PURE__ */ jsxs12(
|
|
2999
3084
|
"div",
|
|
3000
3085
|
{
|
|
3001
|
-
className:
|
|
3002
|
-
[`${
|
|
3086
|
+
className: cx7(classBase13, {
|
|
3087
|
+
[`${classBase13}-editing`]: editCalculatedColumn
|
|
3003
3088
|
}),
|
|
3004
3089
|
children: [
|
|
3005
|
-
/* @__PURE__ */
|
|
3006
|
-
editCalculatedColumn ? /* @__PURE__ */
|
|
3090
|
+
/* @__PURE__ */ jsx15("div", { className: `${classBase13}-header`, children: /* @__PURE__ */ jsx15(ColumnNameLabel, { column, onClick: onEditCalculatedColumn }) }),
|
|
3091
|
+
editCalculatedColumn ? /* @__PURE__ */ jsx15(
|
|
3007
3092
|
ColumnExpressionPanel,
|
|
3008
3093
|
{
|
|
3009
3094
|
column,
|
|
3010
3095
|
onChangeName: onChangeCalculatedColumnName,
|
|
3096
|
+
onChangeServerDataType,
|
|
3011
3097
|
tableConfig,
|
|
3012
3098
|
vuuTable
|
|
3013
3099
|
}
|
|
3014
3100
|
) : null,
|
|
3015
|
-
/* @__PURE__ */
|
|
3016
|
-
/* @__PURE__ */
|
|
3017
|
-
/* @__PURE__ */
|
|
3101
|
+
/* @__PURE__ */ jsxs12(FormField7, { "data-field": "column-label", children: [
|
|
3102
|
+
/* @__PURE__ */ jsx15(FormFieldLabel7, { children: "Column Label" }),
|
|
3103
|
+
/* @__PURE__ */ jsx15(
|
|
3018
3104
|
VuuInput,
|
|
3019
3105
|
{
|
|
3020
3106
|
className: "vuuInput",
|
|
@@ -3024,9 +3110,9 @@ var ColumnSettingsPanel = ({
|
|
|
3024
3110
|
}
|
|
3025
3111
|
)
|
|
3026
3112
|
] }),
|
|
3027
|
-
/* @__PURE__ */
|
|
3028
|
-
/* @__PURE__ */
|
|
3029
|
-
/* @__PURE__ */
|
|
3113
|
+
/* @__PURE__ */ jsxs12(FormField7, { "data-field": "column-width", children: [
|
|
3114
|
+
/* @__PURE__ */ jsx15(FormFieldLabel7, { children: "Column Width" }),
|
|
3115
|
+
/* @__PURE__ */ jsx15(
|
|
3030
3116
|
VuuInput,
|
|
3031
3117
|
{
|
|
3032
3118
|
className: "vuuInput",
|
|
@@ -3036,129 +3122,71 @@ var ColumnSettingsPanel = ({
|
|
|
3036
3122
|
}
|
|
3037
3123
|
)
|
|
3038
3124
|
] }),
|
|
3039
|
-
/* @__PURE__ */
|
|
3040
|
-
/* @__PURE__ */
|
|
3041
|
-
/* @__PURE__ */
|
|
3042
|
-
|
|
3043
|
-
{
|
|
3044
|
-
|
|
3045
|
-
onChange,
|
|
3046
|
-
value: align,
|
|
3047
|
-
children: [
|
|
3048
|
-
/* @__PURE__ */ jsx14(
|
|
3049
|
-
ToggleButton3,
|
|
3050
|
-
{
|
|
3051
|
-
"data-icon": "align-left",
|
|
3052
|
-
className: "vuuIconToggleButton",
|
|
3053
|
-
value: "left"
|
|
3054
|
-
}
|
|
3055
|
-
),
|
|
3056
|
-
/* @__PURE__ */ jsx14(
|
|
3057
|
-
ToggleButton3,
|
|
3058
|
-
{
|
|
3059
|
-
"data-icon": "align-right",
|
|
3060
|
-
className: "vuuIconToggleButton",
|
|
3061
|
-
value: "right"
|
|
3062
|
-
}
|
|
3063
|
-
)
|
|
3064
|
-
]
|
|
3065
|
-
}
|
|
3066
|
-
)
|
|
3125
|
+
/* @__PURE__ */ jsxs12(FormField7, { "data-field": "column-alignment", children: [
|
|
3126
|
+
/* @__PURE__ */ jsx15(FormFieldLabel7, { children: "Alignment" }),
|
|
3127
|
+
/* @__PURE__ */ jsxs12(ToggleButtonGroup3, { onChange: onChangeToggleButton, value: align, children: [
|
|
3128
|
+
/* @__PURE__ */ jsx15(ToggleButton3, { value: "left", children: /* @__PURE__ */ jsx15(Icon, { name: "align-left", size: 16 }) }),
|
|
3129
|
+
/* @__PURE__ */ jsx15(ToggleButton3, { value: "right", children: /* @__PURE__ */ jsx15(Icon, { name: "align-right", size: 16 }) })
|
|
3130
|
+
] })
|
|
3067
3131
|
] }),
|
|
3068
|
-
/* @__PURE__ */
|
|
3069
|
-
/* @__PURE__ */
|
|
3070
|
-
/* @__PURE__ */
|
|
3071
|
-
|
|
3072
|
-
{
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
children: [
|
|
3077
|
-
/* @__PURE__ */ jsx14(
|
|
3078
|
-
ToggleButton3,
|
|
3079
|
-
{
|
|
3080
|
-
className: "vuuIconToggleButton",
|
|
3081
|
-
"data-icon": "cross-circle",
|
|
3082
|
-
value: ""
|
|
3083
|
-
}
|
|
3084
|
-
),
|
|
3085
|
-
/* @__PURE__ */ jsx14(
|
|
3086
|
-
ToggleButton3,
|
|
3087
|
-
{
|
|
3088
|
-
className: "vuuIconToggleButton",
|
|
3089
|
-
"data-icon": "pin-left",
|
|
3090
|
-
value: "left"
|
|
3091
|
-
}
|
|
3092
|
-
),
|
|
3093
|
-
/* @__PURE__ */ jsx14(
|
|
3094
|
-
ToggleButton3,
|
|
3095
|
-
{
|
|
3096
|
-
className: "vuuIconToggleButton",
|
|
3097
|
-
"data-icon": "pin-float",
|
|
3098
|
-
value: "floating"
|
|
3099
|
-
}
|
|
3100
|
-
),
|
|
3101
|
-
/* @__PURE__ */ jsx14(
|
|
3102
|
-
ToggleButton3,
|
|
3103
|
-
{
|
|
3104
|
-
className: "vuuIconToggleButton",
|
|
3105
|
-
"data-icon": "pin-right",
|
|
3106
|
-
value: "right"
|
|
3107
|
-
}
|
|
3108
|
-
)
|
|
3109
|
-
]
|
|
3110
|
-
}
|
|
3111
|
-
)
|
|
3132
|
+
/* @__PURE__ */ jsxs12(FormField7, { "data-field": "column-pin", children: [
|
|
3133
|
+
/* @__PURE__ */ jsx15(FormFieldLabel7, { children: "Pin Column" }),
|
|
3134
|
+
/* @__PURE__ */ jsxs12(ToggleButtonGroup3, { onChange: onChangeToggleButton, value: pin != null ? pin : "", children: [
|
|
3135
|
+
/* @__PURE__ */ jsx15(ToggleButton3, { value: "", children: /* @__PURE__ */ jsx15(Icon, { name: "cross-circle", size: 16 }) }),
|
|
3136
|
+
/* @__PURE__ */ jsx15(ToggleButton3, { value: "left", children: /* @__PURE__ */ jsx15(Icon, { name: "pin-left", size: 16 }) }),
|
|
3137
|
+
/* @__PURE__ */ jsx15(ToggleButton3, { value: "floating", children: /* @__PURE__ */ jsx15(Icon, { name: "pin-float", size: 16 }) }),
|
|
3138
|
+
/* @__PURE__ */ jsx15(ToggleButton3, { value: "right", children: /* @__PURE__ */ jsx15(Icon, { name: "pin-right", size: 16 }) })
|
|
3139
|
+
] })
|
|
3112
3140
|
] }),
|
|
3113
|
-
/* @__PURE__ */
|
|
3141
|
+
/* @__PURE__ */ jsx15(
|
|
3114
3142
|
ColumnFormattingPanel,
|
|
3115
3143
|
{
|
|
3116
3144
|
availableRenderers,
|
|
3117
3145
|
column,
|
|
3118
3146
|
onChangeFormatting,
|
|
3119
3147
|
onChangeRendering,
|
|
3120
|
-
onChangeType
|
|
3148
|
+
onChangeColumnType: onChangeType
|
|
3121
3149
|
}
|
|
3122
3150
|
),
|
|
3123
|
-
editCalculatedColumn ? /* @__PURE__ */
|
|
3124
|
-
/* @__PURE__ */
|
|
3151
|
+
editCalculatedColumn ? /* @__PURE__ */ jsxs12("div", { className: "vuuColumnSettingsPanel-buttonBar", "data-align": "right", children: [
|
|
3152
|
+
/* @__PURE__ */ jsx15(
|
|
3125
3153
|
Button,
|
|
3126
3154
|
{
|
|
3127
|
-
className: `${
|
|
3155
|
+
className: `${classBase13}-buttonCancel`,
|
|
3128
3156
|
onClick: onCancel,
|
|
3129
3157
|
tabIndex: -1,
|
|
3130
3158
|
children: "cancel"
|
|
3131
3159
|
}
|
|
3132
3160
|
),
|
|
3133
|
-
/* @__PURE__ */
|
|
3161
|
+
/* @__PURE__ */ jsx15(
|
|
3134
3162
|
Button,
|
|
3135
3163
|
{
|
|
3136
|
-
className: `${
|
|
3164
|
+
className: `${classBase13}-buttonSave`,
|
|
3137
3165
|
onClick: onSave,
|
|
3138
3166
|
variant: "cta",
|
|
3139
3167
|
children: "save"
|
|
3140
3168
|
}
|
|
3141
3169
|
)
|
|
3142
|
-
] }) : /* @__PURE__ */
|
|
3170
|
+
] }) : /* @__PURE__ */ jsxs12(
|
|
3143
3171
|
"div",
|
|
3144
3172
|
{
|
|
3145
|
-
className: `${
|
|
3173
|
+
className: `${classBase13}-buttonBar`,
|
|
3146
3174
|
"data-align": isNewCalculatedColumn ? "right" : void 0,
|
|
3147
3175
|
children: [
|
|
3148
|
-
/* @__PURE__ */
|
|
3176
|
+
/* @__PURE__ */ jsx15(
|
|
3149
3177
|
Button,
|
|
3150
3178
|
{
|
|
3151
|
-
className: `${
|
|
3179
|
+
className: `${classBase13}-buttonNavPrev`,
|
|
3152
3180
|
variant: "secondary",
|
|
3153
3181
|
"data-icon": "arrow-left",
|
|
3154
3182
|
onClick: navigatePrevColumn,
|
|
3155
3183
|
children: "PREVIOUS"
|
|
3156
3184
|
}
|
|
3157
3185
|
),
|
|
3158
|
-
/* @__PURE__ */
|
|
3186
|
+
/* @__PURE__ */ jsx15(
|
|
3159
3187
|
Button,
|
|
3160
3188
|
{
|
|
3161
|
-
className: `${
|
|
3189
|
+
className: `${classBase13}-buttonNavNext`,
|
|
3162
3190
|
variant: "secondary",
|
|
3163
3191
|
"data-icon": "arrow-right",
|
|
3164
3192
|
onClick: navigateNextColumn,
|
|
@@ -3174,33 +3202,37 @@ var ColumnSettingsPanel = ({
|
|
|
3174
3202
|
};
|
|
3175
3203
|
|
|
3176
3204
|
// src/datasource-stats/DatasourceStats.tsx
|
|
3177
|
-
import
|
|
3178
|
-
import { useEffect as useEffect4, useState as
|
|
3179
|
-
import { jsx as
|
|
3180
|
-
var
|
|
3205
|
+
import cx8 from "clsx";
|
|
3206
|
+
import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
3207
|
+
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3208
|
+
var classBase14 = "vuuDatasourceStats";
|
|
3181
3209
|
var numberFormatter = new Intl.NumberFormat();
|
|
3182
3210
|
var DataSourceStats = ({
|
|
3183
3211
|
className: classNameProp,
|
|
3184
3212
|
dataSource
|
|
3185
3213
|
}) => {
|
|
3186
|
-
const [range, setRange] =
|
|
3187
|
-
const [size, setSize] =
|
|
3214
|
+
const [range, setRange] = useState6(dataSource.range);
|
|
3215
|
+
const [size, setSize] = useState6(dataSource.size);
|
|
3188
3216
|
useEffect4(() => {
|
|
3189
3217
|
setSize(dataSource.size);
|
|
3190
3218
|
dataSource.on("resize", setSize);
|
|
3191
3219
|
dataSource.on("range", setRange);
|
|
3220
|
+
return () => {
|
|
3221
|
+
dataSource.removeListener("resize", setSize);
|
|
3222
|
+
dataSource.removeListener("range", setRange);
|
|
3223
|
+
};
|
|
3192
3224
|
}, [dataSource]);
|
|
3193
|
-
const className =
|
|
3225
|
+
const className = cx8(classBase14, classNameProp);
|
|
3194
3226
|
const from = numberFormatter.format(range.from + 1);
|
|
3195
3227
|
const to = numberFormatter.format(Math.min(range.to, size));
|
|
3196
3228
|
const value = numberFormatter.format(size);
|
|
3197
|
-
return /* @__PURE__ */
|
|
3198
|
-
/* @__PURE__ */
|
|
3199
|
-
/* @__PURE__ */
|
|
3200
|
-
/* @__PURE__ */
|
|
3201
|
-
/* @__PURE__ */
|
|
3202
|
-
/* @__PURE__ */
|
|
3203
|
-
/* @__PURE__ */
|
|
3229
|
+
return /* @__PURE__ */ jsxs13("div", { className, children: [
|
|
3230
|
+
/* @__PURE__ */ jsx16("span", { className: `${classBase14}-label`, children: "Row count" }),
|
|
3231
|
+
/* @__PURE__ */ jsx16("span", { className: `${classBase14}-range`, children: from }),
|
|
3232
|
+
/* @__PURE__ */ jsx16("span", { children: "-" }),
|
|
3233
|
+
/* @__PURE__ */ jsx16("span", { className: `${classBase14}-range`, children: to }),
|
|
3234
|
+
/* @__PURE__ */ jsx16("span", { children: "of" }),
|
|
3235
|
+
/* @__PURE__ */ jsx16("span", { className: `${classBase14}-size`, children: value })
|
|
3204
3236
|
] });
|
|
3205
3237
|
};
|
|
3206
3238
|
|
|
@@ -3209,7 +3241,6 @@ import {
|
|
|
3209
3241
|
Button as Button2,
|
|
3210
3242
|
FormField as FormField8,
|
|
3211
3243
|
FormFieldLabel as FormFieldLabel8,
|
|
3212
|
-
Input as Input3,
|
|
3213
3244
|
ToggleButton as ToggleButton4,
|
|
3214
3245
|
ToggleButtonGroup as ToggleButtonGroup4
|
|
3215
3246
|
} from "@salt-ds/core";
|
|
@@ -3218,6 +3249,7 @@ import {
|
|
|
3218
3249
|
import { updateTableConfig } from "@vuu-ui/vuu-table";
|
|
3219
3250
|
import {
|
|
3220
3251
|
addColumnToSubscribedColumns,
|
|
3252
|
+
queryClosest as queryClosest2,
|
|
3221
3253
|
isCalculatedColumn as isCalculatedColumn3,
|
|
3222
3254
|
moveItem,
|
|
3223
3255
|
subscribedOnly,
|
|
@@ -3225,8 +3257,8 @@ import {
|
|
|
3225
3257
|
} from "@vuu-ui/vuu-utils";
|
|
3226
3258
|
import {
|
|
3227
3259
|
useCallback as useCallback14,
|
|
3228
|
-
useMemo as
|
|
3229
|
-
useState as
|
|
3260
|
+
useMemo as useMemo6,
|
|
3261
|
+
useState as useState7
|
|
3230
3262
|
} from "react";
|
|
3231
3263
|
var sortOrderFromAvailableColumns = (availableColumns, columns) => {
|
|
3232
3264
|
const sortedColumns = [];
|
|
@@ -3257,11 +3289,11 @@ var useTableSettings = ({
|
|
|
3257
3289
|
onDataSourceConfigChange,
|
|
3258
3290
|
tableConfig: tableConfigProp
|
|
3259
3291
|
}) => {
|
|
3260
|
-
const [{ availableColumns, tableConfig }, setColumnState] =
|
|
3292
|
+
const [{ availableColumns, tableConfig }, setColumnState] = useState7({
|
|
3261
3293
|
availableColumns: availableColumnsProp,
|
|
3262
3294
|
tableConfig: tableConfigProp
|
|
3263
3295
|
});
|
|
3264
|
-
const columnItems =
|
|
3296
|
+
const columnItems = useMemo6(
|
|
3265
3297
|
() => buildColumnItems(availableColumns, tableConfig.columns),
|
|
3266
3298
|
[availableColumns, tableConfig.columns]
|
|
3267
3299
|
);
|
|
@@ -3343,29 +3375,47 @@ var useTableSettings = ({
|
|
|
3343
3375
|
[availableColumns, columnItems, onDataSourceConfigChange, tableConfig]
|
|
3344
3376
|
);
|
|
3345
3377
|
const handleChangeColumnLabels = useCallback14((evt) => {
|
|
3346
|
-
const
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
...state
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3378
|
+
const button = queryClosest2(evt.target, "button");
|
|
3379
|
+
if (button) {
|
|
3380
|
+
const value = parseInt(button.value);
|
|
3381
|
+
const columnFormatHeader = value === 0 ? void 0 : value === 1 ? "capitalize" : "uppercase";
|
|
3382
|
+
setColumnState((state) => ({
|
|
3383
|
+
...state,
|
|
3384
|
+
tableConfig: {
|
|
3385
|
+
...state.tableConfig,
|
|
3386
|
+
columnFormatHeader
|
|
3387
|
+
}
|
|
3388
|
+
}));
|
|
3389
|
+
}
|
|
3355
3390
|
}, []);
|
|
3356
3391
|
const handleChangeTableAttribute = useCallback14(
|
|
3357
3392
|
(evt) => {
|
|
3358
|
-
const
|
|
3393
|
+
const button = queryClosest2(evt.target, "button");
|
|
3394
|
+
const { ariaPressed, value } = button;
|
|
3395
|
+
console.log({ ariaPressed, value, button });
|
|
3359
3396
|
setColumnState((state) => ({
|
|
3360
3397
|
...state,
|
|
3361
3398
|
tableConfig: {
|
|
3362
3399
|
...state.tableConfig,
|
|
3363
|
-
[value]:
|
|
3400
|
+
[value]: ariaPressed !== "true"
|
|
3364
3401
|
}
|
|
3365
3402
|
}));
|
|
3366
3403
|
},
|
|
3367
3404
|
[]
|
|
3368
3405
|
);
|
|
3406
|
+
const handleCommitColumnWidth = useCallback14((_, value) => {
|
|
3407
|
+
const columnDefaultWidth = parseInt(value);
|
|
3408
|
+
if (!isNaN(columnDefaultWidth)) {
|
|
3409
|
+
setColumnState((state) => ({
|
|
3410
|
+
...state,
|
|
3411
|
+
tableConfig: {
|
|
3412
|
+
...state.tableConfig,
|
|
3413
|
+
columnDefaultWidth
|
|
3414
|
+
}
|
|
3415
|
+
}));
|
|
3416
|
+
}
|
|
3417
|
+
console.log({ value });
|
|
3418
|
+
}, []);
|
|
3369
3419
|
useLayoutEffectSkipFirst(() => {
|
|
3370
3420
|
onConfigChange == null ? void 0 : onConfigChange(tableConfig);
|
|
3371
3421
|
}, [onConfigChange, tableConfig]);
|
|
@@ -3376,14 +3426,17 @@ var useTableSettings = ({
|
|
|
3376
3426
|
onChangeColumnLabels: handleChangeColumnLabels,
|
|
3377
3427
|
onChangeTableAttribute: handleChangeTableAttribute,
|
|
3378
3428
|
onColumnChange: handleColumnChange,
|
|
3429
|
+
onCommitColumnWidth: handleCommitColumnWidth,
|
|
3379
3430
|
onMoveListItem: handleMoveListItem,
|
|
3380
3431
|
tableConfig
|
|
3381
3432
|
};
|
|
3382
3433
|
};
|
|
3383
3434
|
|
|
3384
3435
|
// src/table-settings/TableSettingsPanel.tsx
|
|
3385
|
-
import {
|
|
3386
|
-
|
|
3436
|
+
import { Icon as Icon2 } from "@vuu-ui/vuu-ui-controls";
|
|
3437
|
+
import { VuuInput as VuuInput2 } from "@vuu-ui/vuu-ui-controls";
|
|
3438
|
+
import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3439
|
+
var classBase15 = "vuuTableSettingsPanel";
|
|
3387
3440
|
var TableSettingsPanel = ({
|
|
3388
3441
|
availableColumns,
|
|
3389
3442
|
onAddCalculatedColumn,
|
|
@@ -3399,6 +3452,7 @@ var TableSettingsPanel = ({
|
|
|
3399
3452
|
onChangeColumnLabels,
|
|
3400
3453
|
onChangeTableAttribute,
|
|
3401
3454
|
onColumnChange,
|
|
3455
|
+
onCommitColumnWidth,
|
|
3402
3456
|
onMoveListItem,
|
|
3403
3457
|
tableConfig
|
|
3404
3458
|
} = useTableSettings({
|
|
@@ -3407,84 +3461,60 @@ var TableSettingsPanel = ({
|
|
|
3407
3461
|
onDataSourceConfigChange,
|
|
3408
3462
|
tableConfig: tableConfigProp
|
|
3409
3463
|
});
|
|
3410
|
-
return /* @__PURE__ */
|
|
3411
|
-
/* @__PURE__ */
|
|
3412
|
-
/* @__PURE__ */
|
|
3413
|
-
/* @__PURE__ */
|
|
3464
|
+
return /* @__PURE__ */ jsxs14("div", { className: classBase15, children: [
|
|
3465
|
+
/* @__PURE__ */ jsxs14(FormField8, { children: [
|
|
3466
|
+
/* @__PURE__ */ jsx17(FormFieldLabel8, { children: "Column Labels" }),
|
|
3467
|
+
/* @__PURE__ */ jsxs14(
|
|
3414
3468
|
ToggleButtonGroup4,
|
|
3415
3469
|
{
|
|
3416
3470
|
className: "vuuToggleButtonGroup",
|
|
3417
3471
|
onChange: onChangeColumnLabels,
|
|
3418
3472
|
value: columnLabelsValue,
|
|
3419
3473
|
children: [
|
|
3420
|
-
/* @__PURE__ */
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
className: "vuuIconToggleButton",
|
|
3424
|
-
"data-icon": "text-strikethrough",
|
|
3425
|
-
value: 0
|
|
3426
|
-
}
|
|
3427
|
-
),
|
|
3428
|
-
/* @__PURE__ */ jsx16(
|
|
3429
|
-
ToggleButton4,
|
|
3430
|
-
{
|
|
3431
|
-
className: "vuuIconToggleButton",
|
|
3432
|
-
"data-icon": "text-Tt",
|
|
3433
|
-
value: 1
|
|
3434
|
-
}
|
|
3435
|
-
),
|
|
3436
|
-
/* @__PURE__ */ jsx16(
|
|
3437
|
-
ToggleButton4,
|
|
3438
|
-
{
|
|
3439
|
-
className: "vuuIconToggleButton",
|
|
3440
|
-
"data-icon": "text-T",
|
|
3441
|
-
value: 2
|
|
3442
|
-
}
|
|
3443
|
-
)
|
|
3474
|
+
/* @__PURE__ */ jsx17(ToggleButton4, { className: "vuuIconToggleButton", value: 0, children: /* @__PURE__ */ jsx17(Icon2, { name: "text-strikethrough", size: 48 }) }),
|
|
3475
|
+
/* @__PURE__ */ jsx17(ToggleButton4, { className: "vuuIconToggleButton", value: 1, children: /* @__PURE__ */ jsx17(Icon2, { name: "text-Tt", size: 48 }) }),
|
|
3476
|
+
/* @__PURE__ */ jsx17(ToggleButton4, { className: "vuuIconToggleButton", value: 2, children: /* @__PURE__ */ jsx17(Icon2, { name: "text-T", size: 48 }) })
|
|
3444
3477
|
]
|
|
3445
3478
|
}
|
|
3446
3479
|
)
|
|
3447
3480
|
] }),
|
|
3448
|
-
/* @__PURE__ */
|
|
3449
|
-
/* @__PURE__ */
|
|
3450
|
-
/* @__PURE__ */
|
|
3451
|
-
/* @__PURE__ */
|
|
3481
|
+
/* @__PURE__ */ jsxs14(FormField8, { children: [
|
|
3482
|
+
/* @__PURE__ */ jsx17(FormFieldLabel8, { children: "Grid separators" }),
|
|
3483
|
+
/* @__PURE__ */ jsxs14("div", { className: "saltToggleButtonGroup vuuStateButtonGroup saltToggleButtonGroup-horizontal", children: [
|
|
3484
|
+
/* @__PURE__ */ jsx17(
|
|
3452
3485
|
ToggleButton4,
|
|
3453
3486
|
{
|
|
3454
|
-
className: "vuuIconToggleButton",
|
|
3455
|
-
"data-icon": "row-striping",
|
|
3456
3487
|
selected: (_a = tableConfig.zebraStripes) != null ? _a : false,
|
|
3457
3488
|
onChange: onChangeTableAttribute,
|
|
3458
|
-
value: "zebraStripes"
|
|
3489
|
+
value: "zebraStripes",
|
|
3490
|
+
children: /* @__PURE__ */ jsx17(Icon2, { name: "row-striping", size: 16 })
|
|
3459
3491
|
}
|
|
3460
3492
|
),
|
|
3461
|
-
/* @__PURE__ */
|
|
3493
|
+
/* @__PURE__ */ jsx17(
|
|
3462
3494
|
ToggleButton4,
|
|
3463
3495
|
{
|
|
3464
|
-
className: "vuuIconToggleButton",
|
|
3465
|
-
"data-icon": "row-lines",
|
|
3466
3496
|
selected: (_b = tableConfig.rowSeparators) != null ? _b : false,
|
|
3467
3497
|
onChange: onChangeTableAttribute,
|
|
3468
|
-
value: "rowSeparators"
|
|
3498
|
+
value: "rowSeparators",
|
|
3499
|
+
children: /* @__PURE__ */ jsx17(Icon2, { name: "row-lines", size: 16 })
|
|
3469
3500
|
}
|
|
3470
3501
|
),
|
|
3471
|
-
/* @__PURE__ */
|
|
3502
|
+
/* @__PURE__ */ jsx17(
|
|
3472
3503
|
ToggleButton4,
|
|
3473
3504
|
{
|
|
3474
|
-
className: "vuuIconToggleButton",
|
|
3475
|
-
"data-icon": "col-lines",
|
|
3476
3505
|
selected: (_c = tableConfig.columnSeparators) != null ? _c : false,
|
|
3477
3506
|
onChange: onChangeTableAttribute,
|
|
3478
|
-
value: "columnSeparators"
|
|
3507
|
+
value: "columnSeparators",
|
|
3508
|
+
children: /* @__PURE__ */ jsx17(Icon2, { name: "col-lines", size: 16 })
|
|
3479
3509
|
}
|
|
3480
3510
|
)
|
|
3481
3511
|
] })
|
|
3482
3512
|
] }),
|
|
3483
|
-
/* @__PURE__ */
|
|
3484
|
-
/* @__PURE__ */
|
|
3485
|
-
/* @__PURE__ */
|
|
3513
|
+
/* @__PURE__ */ jsxs14(FormField8, { children: [
|
|
3514
|
+
/* @__PURE__ */ jsx17(FormFieldLabel8, { children: "Default Column Width" }),
|
|
3515
|
+
/* @__PURE__ */ jsx17(VuuInput2, { className: "vuuInput", onCommit: onCommitColumnWidth })
|
|
3486
3516
|
] }),
|
|
3487
|
-
/* @__PURE__ */
|
|
3517
|
+
/* @__PURE__ */ jsx17(
|
|
3488
3518
|
ColumnList,
|
|
3489
3519
|
{
|
|
3490
3520
|
columnItems,
|
|
@@ -3493,9 +3523,9 @@ var TableSettingsPanel = ({
|
|
|
3493
3523
|
onNavigateToColumn
|
|
3494
3524
|
}
|
|
3495
3525
|
),
|
|
3496
|
-
/* @__PURE__ */
|
|
3497
|
-
/* @__PURE__ */
|
|
3498
|
-
/* @__PURE__ */
|
|
3526
|
+
/* @__PURE__ */ jsxs14("div", { className: `${classBase15}-calculatedButtonbar`, children: [
|
|
3527
|
+
/* @__PURE__ */ jsx17(Button2, { "data-icon": "plus", onClick: onAddCalculatedColumn }),
|
|
3528
|
+
/* @__PURE__ */ jsx17("span", { className: `${classBase15}-calculatedLabel`, children: "Add calculated column" })
|
|
3499
3529
|
] })
|
|
3500
3530
|
] });
|
|
3501
3531
|
};
|
|
@@ -3515,6 +3545,7 @@ export {
|
|
|
3515
3545
|
DropdownCell,
|
|
3516
3546
|
LookupCell,
|
|
3517
3547
|
PatternValidator,
|
|
3548
|
+
PctProgressCell,
|
|
3518
3549
|
TableSettingsPanel,
|
|
3519
3550
|
columnExpressionLanguageSupport,
|
|
3520
3551
|
isCompleteExpression,
|