@vuu-ui/vuu-table-extras 0.8.25-debug → 0.8.26-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/esm/index.js CHANGED
@@ -402,6 +402,7 @@ registerComponent7("vuu.progress", ProgressCell, "cell-renderer", {
402
402
 
403
403
  // src/column-list/ColumnList.tsx
404
404
  import {
405
+ Icon,
405
406
  List,
406
407
  ListItem
407
408
  } from "@vuu-ui/vuu-ui-controls";
@@ -410,7 +411,7 @@ import cx4 from "clsx";
410
411
  import {
411
412
  useCallback as useCallback3
412
413
  } from "react";
413
- import { getColumnLabel } from "@vuu-ui/vuu-utils";
414
+ import { getColumnLabel, queryClosest } from "@vuu-ui/vuu-utils";
414
415
  import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
415
416
  var classBase6 = "vuuColumnList";
416
417
  var classBaseListItem = "vuuColumnListItem";
@@ -426,13 +427,19 @@ var ColumnListItem = ({
426
427
  className: cx4(classNameProp, classBaseListItem),
427
428
  "data-name": item == null ? void 0 : item.name,
428
429
  children: [
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(
430
+ /* @__PURE__ */ jsx7(Icon, { name: "draggable", size: 16 }),
431
+ (item == null ? void 0 : item.isCalculated) ? /* @__PURE__ */ jsx7(Icon, { name: "function" }) : /* @__PURE__ */ jsx7(
433
432
  Checkbox,
434
433
  {
435
434
  className: `${classBase6}-checkBox`,
435
+ checked: item == null ? void 0 : item.subscribed
436
+ }
437
+ ),
438
+ /* @__PURE__ */ jsx7("span", { className: `${classBase6}-text`, children: getColumnLabel(item) }),
439
+ /* @__PURE__ */ jsx7(
440
+ Switch,
441
+ {
442
+ className: `${classBase6}-switch`,
436
443
  checked: (item == null ? void 0 : item.hidden) !== true,
437
444
  disabled: (item == null ? void 0 : item.subscribed) !== true
438
445
  }
@@ -449,20 +456,18 @@ var ColumnList = ({
449
456
  ...htmlAttributes
450
457
  }) => {
451
458
  const handleChange = useCallback3(
452
- (evt) => {
453
- const input = evt.target;
454
- const listItem = input.closest(`.${classBaseListItem}`);
459
+ ({ target }) => {
460
+ const input = target;
461
+ const listItem = queryClosest(target, `.${classBaseListItem}`);
455
462
  const {
456
463
  dataset: { name: name2 }
457
464
  } = listItem;
458
465
  if (name2) {
459
- const saltSwitch = input.closest(`.${classBase6}-switch`);
460
- const saltCheckbox = input.closest(
461
- `.${classBase6}-checkBox`
462
- );
463
- if (saltSwitch) {
466
+ const saltCheckbox = queryClosest(target, `.${classBase6}-checkBox`);
467
+ const saltSwitch = queryClosest(target, `.${classBase6}-switch`);
468
+ if (saltCheckbox) {
464
469
  onChange(name2, "subscribed", input.checked);
465
- } else if (saltCheckbox) {
470
+ } else if (saltSwitch) {
466
471
  onChange(name2, "hidden", input.checked === false);
467
472
  }
468
473
  }
@@ -502,7 +507,7 @@ var ColumnList = ({
502
507
  };
503
508
 
504
509
  // src/column-settings/ColumnSettingsPanel.tsx
505
- import { Icon, VuuInput } from "@vuu-ui/vuu-ui-controls";
510
+ import { Icon as Icon2, VuuInput } from "@vuu-ui/vuu-ui-controls";
506
511
  import {
507
512
  getCalculatedColumnName as getCalculatedColumnName2,
508
513
  getDefaultAlignment,
@@ -2793,7 +2798,7 @@ import {
2793
2798
  updateColumnRenderProps,
2794
2799
  updateColumnFormatting,
2795
2800
  updateColumnType,
2796
- queryClosest
2801
+ queryClosest as queryClosest2
2797
2802
  } from "@vuu-ui/vuu-utils";
2798
2803
  import {
2799
2804
  useCallback as useCallback13,
@@ -2896,7 +2901,7 @@ var useColumnSettings = ({
2896
2901
  }, [column, onConfigChange, tableConfig]);
2897
2902
  const handleChangeToggleButton = useCallback13(
2898
2903
  (evt) => {
2899
- const button = queryClosest(evt.target, "button");
2904
+ const button = queryClosest2(evt.target, "button");
2900
2905
  if (button) {
2901
2906
  const fieldName = getFieldName(button);
2902
2907
  const { value } = button;
@@ -3125,17 +3130,17 @@ var ColumnSettingsPanel = ({
3125
3130
  /* @__PURE__ */ jsxs12(FormField7, { "data-field": "column-alignment", children: [
3126
3131
  /* @__PURE__ */ jsx15(FormFieldLabel7, { children: "Alignment" }),
3127
3132
  /* @__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 }) })
3133
+ /* @__PURE__ */ jsx15(ToggleButton3, { value: "left", children: /* @__PURE__ */ jsx15(Icon2, { name: "align-left", size: 16 }) }),
3134
+ /* @__PURE__ */ jsx15(ToggleButton3, { value: "right", children: /* @__PURE__ */ jsx15(Icon2, { name: "align-right", size: 16 }) })
3130
3135
  ] })
3131
3136
  ] }),
3132
3137
  /* @__PURE__ */ jsxs12(FormField7, { "data-field": "column-pin", children: [
3133
3138
  /* @__PURE__ */ jsx15(FormFieldLabel7, { children: "Pin Column" }),
3134
3139
  /* @__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 }) })
3140
+ /* @__PURE__ */ jsx15(ToggleButton3, { value: "", children: /* @__PURE__ */ jsx15(Icon2, { name: "cross-circle", size: 16 }) }),
3141
+ /* @__PURE__ */ jsx15(ToggleButton3, { value: "left", children: /* @__PURE__ */ jsx15(Icon2, { name: "pin-left", size: 16 }) }),
3142
+ /* @__PURE__ */ jsx15(ToggleButton3, { value: "floating", children: /* @__PURE__ */ jsx15(Icon2, { name: "pin-float", size: 16 }) }),
3143
+ /* @__PURE__ */ jsx15(ToggleButton3, { value: "right", children: /* @__PURE__ */ jsx15(Icon2, { name: "pin-right", size: 16 }) })
3139
3144
  ] })
3140
3145
  ] }),
3141
3146
  /* @__PURE__ */ jsx15(
@@ -3249,7 +3254,7 @@ import {
3249
3254
  import { updateTableConfig } from "@vuu-ui/vuu-table";
3250
3255
  import {
3251
3256
  addColumnToSubscribedColumns,
3252
- queryClosest as queryClosest2,
3257
+ queryClosest as queryClosest3,
3253
3258
  isCalculatedColumn as isCalculatedColumn3,
3254
3259
  moveItem,
3255
3260
  subscribedOnly,
@@ -3375,7 +3380,7 @@ var useTableSettings = ({
3375
3380
  [availableColumns, columnItems, onDataSourceConfigChange, tableConfig]
3376
3381
  );
3377
3382
  const handleChangeColumnLabels = useCallback14((evt) => {
3378
- const button = queryClosest2(evt.target, "button");
3383
+ const button = queryClosest3(evt.target, "button");
3379
3384
  if (button) {
3380
3385
  const value = parseInt(button.value);
3381
3386
  const columnFormatHeader = value === 0 ? void 0 : value === 1 ? "capitalize" : "uppercase";
@@ -3390,7 +3395,7 @@ var useTableSettings = ({
3390
3395
  }, []);
3391
3396
  const handleChangeTableAttribute = useCallback14(
3392
3397
  (evt) => {
3393
- const button = queryClosest2(evt.target, "button");
3398
+ const button = queryClosest3(evt.target, "button");
3394
3399
  const { ariaPressed, value } = button;
3395
3400
  console.log({ ariaPressed, value, button });
3396
3401
  setColumnState((state) => ({
@@ -3433,11 +3438,14 @@ var useTableSettings = ({
3433
3438
  };
3434
3439
 
3435
3440
  // src/table-settings/TableSettingsPanel.tsx
3436
- import { Icon as Icon2 } from "@vuu-ui/vuu-ui-controls";
3441
+ import { Icon as Icon3 } from "@vuu-ui/vuu-ui-controls";
3437
3442
  import { VuuInput as VuuInput2 } from "@vuu-ui/vuu-ui-controls";
3438
3443
  import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
3439
3444
  var classBase15 = "vuuTableSettingsPanel";
3440
3445
  var TableSettingsPanel = ({
3446
+ allowColumnLabelCase = true,
3447
+ allowColumnDefaultWidth = true,
3448
+ allowGridRowStyling = true,
3441
3449
  availableColumns,
3442
3450
  onAddCalculatedColumn,
3443
3451
  onConfigChange,
@@ -3462,7 +3470,8 @@ var TableSettingsPanel = ({
3462
3470
  tableConfig: tableConfigProp
3463
3471
  });
3464
3472
  return /* @__PURE__ */ jsxs14("div", { className: classBase15, children: [
3465
- /* @__PURE__ */ jsxs14(FormField8, { children: [
3473
+ allowColumnLabelCase || allowColumnDefaultWidth || allowGridRowStyling ? /* @__PURE__ */ jsx17("div", { className: `${classBase15}-header`, children: /* @__PURE__ */ jsx17("span", { children: "Column Settings" }) }) : null,
3474
+ allowColumnLabelCase ? /* @__PURE__ */ jsxs14(FormField8, { children: [
3466
3475
  /* @__PURE__ */ jsx17(FormFieldLabel8, { children: "Column Labels" }),
3467
3476
  /* @__PURE__ */ jsxs14(
3468
3477
  ToggleButtonGroup4,
@@ -3471,14 +3480,14 @@ var TableSettingsPanel = ({
3471
3480
  onChange: onChangeColumnLabels,
3472
3481
  value: columnLabelsValue,
3473
3482
  children: [
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 }) })
3483
+ /* @__PURE__ */ jsx17(ToggleButton4, { className: "vuuIconToggleButton", value: 0, children: /* @__PURE__ */ jsx17(Icon3, { name: "text-strikethrough", size: 48 }) }),
3484
+ /* @__PURE__ */ jsx17(ToggleButton4, { className: "vuuIconToggleButton", value: 1, children: /* @__PURE__ */ jsx17(Icon3, { name: "text-Tt", size: 48 }) }),
3485
+ /* @__PURE__ */ jsx17(ToggleButton4, { className: "vuuIconToggleButton", value: 2, children: /* @__PURE__ */ jsx17(Icon3, { name: "text-T", size: 48 }) })
3477
3486
  ]
3478
3487
  }
3479
3488
  )
3480
- ] }),
3481
- /* @__PURE__ */ jsxs14(FormField8, { children: [
3489
+ ] }) : null,
3490
+ allowGridRowStyling ? /* @__PURE__ */ jsxs14(FormField8, { children: [
3482
3491
  /* @__PURE__ */ jsx17(FormFieldLabel8, { children: "Grid separators" }),
3483
3492
  /* @__PURE__ */ jsxs14("div", { className: "saltToggleButtonGroup vuuStateButtonGroup saltToggleButtonGroup-horizontal", children: [
3484
3493
  /* @__PURE__ */ jsx17(
@@ -3487,7 +3496,7 @@ var TableSettingsPanel = ({
3487
3496
  selected: (_a = tableConfig.zebraStripes) != null ? _a : false,
3488
3497
  onChange: onChangeTableAttribute,
3489
3498
  value: "zebraStripes",
3490
- children: /* @__PURE__ */ jsx17(Icon2, { name: "row-striping", size: 16 })
3499
+ children: /* @__PURE__ */ jsx17(Icon3, { name: "row-striping", size: 16 })
3491
3500
  }
3492
3501
  ),
3493
3502
  /* @__PURE__ */ jsx17(
@@ -3496,7 +3505,7 @@ var TableSettingsPanel = ({
3496
3505
  selected: (_b = tableConfig.rowSeparators) != null ? _b : false,
3497
3506
  onChange: onChangeTableAttribute,
3498
3507
  value: "rowSeparators",
3499
- children: /* @__PURE__ */ jsx17(Icon2, { name: "row-lines", size: 16 })
3508
+ children: /* @__PURE__ */ jsx17(Icon3, { name: "row-lines", size: 16 })
3500
3509
  }
3501
3510
  ),
3502
3511
  /* @__PURE__ */ jsx17(
@@ -3505,15 +3514,15 @@ var TableSettingsPanel = ({
3505
3514
  selected: (_c = tableConfig.columnSeparators) != null ? _c : false,
3506
3515
  onChange: onChangeTableAttribute,
3507
3516
  value: "columnSeparators",
3508
- children: /* @__PURE__ */ jsx17(Icon2, { name: "col-lines", size: 16 })
3517
+ children: /* @__PURE__ */ jsx17(Icon3, { name: "col-lines", size: 16 })
3509
3518
  }
3510
3519
  )
3511
3520
  ] })
3512
- ] }),
3513
- /* @__PURE__ */ jsxs14(FormField8, { children: [
3521
+ ] }) : null,
3522
+ allowColumnDefaultWidth ? /* @__PURE__ */ jsxs14(FormField8, { children: [
3514
3523
  /* @__PURE__ */ jsx17(FormFieldLabel8, { children: "Default Column Width" }),
3515
3524
  /* @__PURE__ */ jsx17(VuuInput2, { className: "vuuInput", onCommit: onCommitColumnWidth })
3516
- ] }),
3525
+ ] }) : null,
3517
3526
  /* @__PURE__ */ jsx17(
3518
3527
  ColumnList,
3519
3528
  {