@strands.gg/accui 2.10.7 → 2.10.9

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/dist/index.es.js CHANGED
@@ -28059,12 +28059,12 @@ const _hoisted_20$9 = {
28059
28059
  };
28060
28060
  const _hoisted_21$9 = ["cx", "fill"];
28061
28061
  const _hoisted_22$7 = { class: "ui-color-picker-inputs" };
28062
- const _hoisted_23$6 = {
28062
+ const _hoisted_23$5 = {
28063
28063
  key: 0,
28064
28064
  class: "ui-color-picker-input-row"
28065
28065
  };
28066
- const _hoisted_24$6 = { class: "ui-color-picker-input-group" };
28067
- const _hoisted_25$6 = { class: "ui-color-picker-button-wrapper" };
28066
+ const _hoisted_24$5 = { class: "ui-color-picker-input-group" };
28067
+ const _hoisted_25$5 = { class: "ui-color-picker-button-wrapper" };
28068
28068
  const _hoisted_26$5 = {
28069
28069
  key: 1,
28070
28070
  class: "ui-color-picker-input-row"
@@ -29918,8 +29918,8 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
29918
29918
  }, null, 4)
29919
29919
  ], 544)) : createCommentVNode("", true),
29920
29920
  createElementVNode("div", _hoisted_22$7, [
29921
- currentColorFormat.value === "hex" ? (openBlock(), createElementBlock("div", _hoisted_23$6, [
29922
- createElementVNode("div", _hoisted_24$6, [
29921
+ currentColorFormat.value === "hex" ? (openBlock(), createElementBlock("div", _hoisted_23$5, [
29922
+ createElementVNode("div", _hoisted_24$5, [
29923
29923
  _cache[24] || (_cache[24] = createElementVNode("label", { class: "ui-color-picker-label" }, "Hex", -1)),
29924
29924
  withDirectives(createElementVNode("input", {
29925
29925
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => hexInput.value = $event),
@@ -29933,7 +29933,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
29933
29933
  [vModelText, hexInput.value]
29934
29934
  ])
29935
29935
  ]),
29936
- createElementVNode("div", _hoisted_25$6, [
29936
+ createElementVNode("div", _hoisted_25$5, [
29937
29937
  createVNode(unref(CompoundUiButton), {
29938
29938
  color: "secondary",
29939
29939
  size: "xs",
@@ -30646,23 +30646,20 @@ const _hoisted_11$h = {
30646
30646
  key: 0,
30647
30647
  class: "ui-table-filter-input"
30648
30648
  };
30649
- const _hoisted_12$h = ["onUpdate:modelValue", "placeholder"];
30650
- const _hoisted_13$g = ["onUpdate:modelValue"];
30651
- const _hoisted_14$g = { value: "" };
30652
- const _hoisted_15$d = ["value"];
30653
- const _hoisted_16$d = { class: "ui-table-body" };
30654
- const _hoisted_17$c = { class: "ui-table-group-content" };
30655
- const _hoisted_18$b = { class: "ui-table-group-name" };
30656
- const _hoisted_19$a = { class: "ui-table-group-count" };
30657
- const _hoisted_20$8 = ["onClick"];
30658
- const _hoisted_21$8 = ["onClick"];
30659
- const _hoisted_22$6 = { class: "ui-table-subrow-content" };
30660
- const _hoisted_23$5 = { class: "ui-table-subrow-default" };
30661
- const _hoisted_24$5 = {
30649
+ const _hoisted_12$h = { class: "ui-table-body" };
30650
+ const _hoisted_13$g = { class: "ui-table-group-content" };
30651
+ const _hoisted_14$g = { class: "ui-table-group-name" };
30652
+ const _hoisted_15$d = { class: "ui-table-group-count" };
30653
+ const _hoisted_16$d = ["onClick"];
30654
+ const _hoisted_17$c = ["onClick"];
30655
+ const _hoisted_18$b = { key: 1 };
30656
+ const _hoisted_19$a = { class: "ui-table-subrow-content" };
30657
+ const _hoisted_20$8 = { class: "ui-table-subrow-default" };
30658
+ const _hoisted_21$8 = {
30662
30659
  key: 0,
30663
30660
  class: "ui-table-empty"
30664
30661
  };
30665
- const _hoisted_25$5 = {
30662
+ const _hoisted_22$6 = {
30666
30663
  key: 1,
30667
30664
  class: "ui-table-footer"
30668
30665
  };
@@ -30686,7 +30683,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
30686
30683
  stickyHeader: { type: Boolean, default: false },
30687
30684
  stickyColumns: { default: () => [] }
30688
30685
  },
30689
- emits: ["rowClick", "rowSelect", "sort", "columnReorder"],
30686
+ emits: ["rowClick", "rowSelect", "sort", "columnReorder", "cellUpdate"],
30690
30687
  setup(__props, { emit: __emit }) {
30691
30688
  const props = __props;
30692
30689
  const emit = __emit;
@@ -30753,7 +30750,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
30753
30750
  rows = rows.filter((row) => {
30754
30751
  return Object.entries(filters.value).every(([key, filterValue]) => {
30755
30752
  if (!filterValue || filterValue === "") return true;
30756
- const cellValue = getCellValue(row, key);
30753
+ const column = props.columns.find((col) => col.key === key);
30754
+ const cellValue = getCellValue(row, key, column);
30757
30755
  const cellStr = String(cellValue || "").toLowerCase();
30758
30756
  if (Array.isArray(filterValue)) {
30759
30757
  return filterValue.some((val) => cellStr.includes(String(val).toLowerCase()));
@@ -30763,17 +30761,19 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
30763
30761
  });
30764
30762
  }
30765
30763
  if (sortKey.value && (props.sortable || props.columns.find((col) => col.key === sortKey.value)?.sortable)) {
30764
+ const sortColumn = props.columns.find((col) => col.key === sortKey.value);
30766
30765
  rows.sort((a, b) => {
30767
- const aVal = getCellValue(a, sortKey.value);
30768
- const bVal = getCellValue(b, sortKey.value);
30766
+ const aVal = getCellValue(a, sortKey.value, sortColumn);
30767
+ const bVal = getCellValue(b, sortKey.value, sortColumn);
30769
30768
  if (aVal < bVal) return sortOrder.value === "asc" ? -1 : 1;
30770
30769
  if (aVal > bVal) return sortOrder.value === "asc" ? 1 : -1;
30771
30770
  return 0;
30772
30771
  });
30773
30772
  }
30774
30773
  if (groupBy.value && props.groupable) {
30774
+ const groupColumn = props.columns.find((col) => col.key === groupBy.value);
30775
30775
  const grouped = rows.reduce((groups, row) => {
30776
- const groupValue = getCellValue(row, groupBy.value);
30776
+ const groupValue = getCellValue(row, groupBy.value, groupColumn);
30777
30777
  const key = String(groupValue || "Ungrouped");
30778
30778
  if (!groups[key]) groups[key] = [];
30779
30779
  groups[key].push(row);
@@ -30786,13 +30786,23 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
30786
30786
  }
30787
30787
  return rows;
30788
30788
  });
30789
- const getCellValue = (row, key) => {
30789
+ const getCellValue = (row, key, column) => {
30790
30790
  if (!key) return void 0;
30791
30791
  const keys2 = key.split(".");
30792
30792
  let value = row;
30793
30793
  for (const k of keys2) {
30794
30794
  value = value?.[k];
30795
30795
  }
30796
+ if (column?.formatters && Array.isArray(column.formatters)) {
30797
+ value = column.formatters.reduce((acc, formatter) => {
30798
+ try {
30799
+ return formatter(acc);
30800
+ } catch (error) {
30801
+ console.warn(`Formatter error for column ${column.key}:`, error);
30802
+ return acc;
30803
+ }
30804
+ }, value);
30805
+ }
30796
30806
  return value;
30797
30807
  };
30798
30808
  const handleSort = (key) => {
@@ -30818,7 +30828,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
30818
30828
  if (column.filterOptions) return column.filterOptions;
30819
30829
  const uniqueValues = /* @__PURE__ */ new Set();
30820
30830
  props.data.forEach((row) => {
30821
- const value = getCellValue(row, column.key);
30831
+ const value = getCellValue(row, column.key, column);
30822
30832
  if (value != null) uniqueValues.add(String(value));
30823
30833
  });
30824
30834
  return Array.from(uniqueValues).sort();
@@ -30848,6 +30858,9 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
30848
30858
  }
30849
30859
  emit("rowClick", row, index);
30850
30860
  };
30861
+ const handleCellUpdate = (row, columnKey, newValue, rowIndex) => {
30862
+ emit("cellUpdate", row, columnKey, newValue, rowIndex);
30863
+ };
30851
30864
  const handleDragStart = (event, columnIndex) => {
30852
30865
  if (!props.reorderable) return;
30853
30866
  draggedColumnIndex.value = columnIndex;
@@ -30953,10 +30966,10 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
30953
30966
  "ui-table-cell--drag-target": isDragging.value && draggedColumnIndex.value !== index
30954
30967
  }
30955
30968
  ]),
30956
- onDragover: _cache[2] || (_cache[2] = withModifiers(() => {
30969
+ onDragover: _cache[1] || (_cache[1] = withModifiers(() => {
30957
30970
  }, ["prevent"])),
30958
30971
  onDragenter: ($event) => handleDragEnter(index),
30959
- onDragleave: _cache[3] || (_cache[3] = ($event) => handleDragLeave()),
30972
+ onDragleave: _cache[2] || (_cache[2] = ($event) => handleDragLeave()),
30960
30973
  onDrop: ($event) => handleDrop($event, index),
30961
30974
  style: normalizeStyle(getHeaderColumnTransform(index))
30962
30975
  }, [
@@ -31006,37 +31019,21 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
31006
31019
  ])
31007
31020
  ]),
31008
31021
  showFilters.value[column.key] ? (openBlock(), createElementBlock("div", _hoisted_11$h, [
31009
- (column.filterType || "text") === "text" ? withDirectives((openBlock(), createElementBlock("input", {
31010
- key: 0,
31022
+ createVNode(StrandsUiInput, {
31023
+ modelValue: filters.value[column.key],
31011
31024
  "onUpdate:modelValue": ($event) => filters.value[column.key] = $event,
31025
+ type: column.filterType,
31026
+ options: column.filterType === "select" ? getFilterOptions(column) : void 0,
31012
31027
  placeholder: `Filter ${column.label}...`,
31013
31028
  class: "ui-table-filter-field",
31014
31029
  onClick: _cache[0] || (_cache[0] = withModifiers(() => {
31015
31030
  }, ["stop"]))
31016
- }, null, 8, _hoisted_12$h)), [
31017
- [vModelText, filters.value[column.key]]
31018
- ]) : column.filterType === "select" ? withDirectives((openBlock(), createElementBlock("select", {
31019
- key: 1,
31020
- "onUpdate:modelValue": ($event) => filters.value[column.key] = $event,
31021
- class: "ui-table-filter-field",
31022
- onClick: _cache[1] || (_cache[1] = withModifiers(() => {
31023
- }, ["stop"]))
31024
- }, [
31025
- createElementVNode("option", _hoisted_14$g, "All " + toDisplayString(column.label), 1),
31026
- (openBlock(true), createElementBlock(Fragment$1, null, renderList(getFilterOptions(column), (option) => {
31027
- return openBlock(), createElementBlock("option", {
31028
- key: option,
31029
- value: option
31030
- }, toDisplayString(option), 9, _hoisted_15$d);
31031
- }), 128))
31032
- ], 8, _hoisted_13$g)), [
31033
- [vModelSelect, filters.value[column.key]]
31034
- ]) : createCommentVNode("", true)
31031
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "type", "options", "placeholder"])
31035
31032
  ])) : createCommentVNode("", true)
31036
31033
  ], 46, _hoisted_3$q);
31037
31034
  }), 128))
31038
31035
  ])) : createCommentVNode("", true),
31039
- createElementVNode("div", _hoisted_16$d, [
31036
+ createElementVNode("div", _hoisted_12$h, [
31040
31037
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(processedRows.value, (row, rowIndex) => {
31041
31038
  return openBlock(), createElementBlock(Fragment$1, {
31042
31039
  key: `row-${rowIndex}`
@@ -31046,10 +31043,10 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
31046
31043
  class: "ui-table-group-header",
31047
31044
  style: normalizeStyle({ "--group-index": getGroupIndex(rowIndex) })
31048
31045
  }, [
31049
- createElementVNode("div", _hoisted_17$c, [
31046
+ createElementVNode("div", _hoisted_13$g, [
31050
31047
  createVNode(unref(Users), { size: 16 }),
31051
- createElementVNode("span", _hoisted_18$b, toDisplayString(row._groupName), 1),
31052
- createElementVNode("span", _hoisted_19$a, "(" + toDisplayString(row._groupCount) + " items)", 1)
31048
+ createElementVNode("span", _hoisted_14$g, toDisplayString(row._groupName), 1),
31049
+ createElementVNode("span", _hoisted_15$d, "(" + toDisplayString(row._groupCount) + " items)", 1)
31053
31050
  ])
31054
31051
  ], 4)) : (openBlock(), createElementBlock("div", {
31055
31052
  key: 1,
@@ -31087,28 +31084,36 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
31087
31084
  colIndex
31088
31085
  }, void 0, true) : renderSlot(_ctx.$slots, `cell-${column.key}`, {
31089
31086
  key: 1,
31090
- value: getCellValue(row, column.key),
31087
+ value: getCellValue(row, column.key, column),
31091
31088
  row,
31092
31089
  column,
31093
31090
  rowIndex,
31094
31091
  colIndex
31095
31092
  }, () => [
31096
- createTextVNode(toDisplayString(getCellValue(row, column.key)), 1)
31093
+ column.editable ? (openBlock(), createBlock(StrandsUiInput, {
31094
+ key: 0,
31095
+ modelValue: getCellValue(row, column.key, column),
31096
+ type: column.filterType || "text",
31097
+ "onUpdate:modelValue": (newValue) => handleCellUpdate(row, column.key, newValue, rowIndex),
31098
+ onClick: _cache[3] || (_cache[3] = withModifiers(() => {
31099
+ }, ["stop"])),
31100
+ class: "ui-table-editable-input"
31101
+ }, null, 8, ["modelValue", "type", "onUpdate:modelValue"])) : (openBlock(), createElementBlock("span", _hoisted_18$b, toDisplayString(getCellValue(row, column.key, column)), 1))
31097
31102
  ], true)
31098
- ], 14, _hoisted_21$8);
31103
+ ], 14, _hoisted_17$c);
31099
31104
  }), 128))
31100
- ], 10, _hoisted_20$8)),
31105
+ ], 10, _hoisted_16$d)),
31101
31106
  expandedRows.value.has(rowIndex) ? (openBlock(), createElementBlock("div", {
31102
31107
  key: 2,
31103
31108
  class: "ui-table-subrow",
31104
31109
  style: normalizeStyle(subrowStyle.value)
31105
31110
  }, [
31106
- createElementVNode("div", _hoisted_22$6, [
31111
+ createElementVNode("div", _hoisted_19$a, [
31107
31112
  renderSlot(_ctx.$slots, "expanded-row", {
31108
31113
  row,
31109
31114
  rowIndex
31110
31115
  }, () => [
31111
- createElementVNode("div", _hoisted_23$5, [
31116
+ createElementVNode("div", _hoisted_20$8, [
31112
31117
  createElementVNode("pre", null, toDisplayString(JSON.stringify(row, null, 2)), 1)
31113
31118
  ])
31114
31119
  ], true)
@@ -31116,7 +31121,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
31116
31121
  ], 4)) : createCommentVNode("", true)
31117
31122
  ], 64);
31118
31123
  }), 128)),
31119
- processedRows.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_24$5, [
31124
+ processedRows.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_21$8, [
31120
31125
  renderSlot(_ctx.$slots, "empty", {}, () => [
31121
31126
  _cache[4] || (_cache[4] = createElementVNode("div", { class: "ui-table-empty-content" }, [
31122
31127
  createElementVNode("span", null, "No data available")
@@ -31124,7 +31129,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
31124
31129
  ], true)
31125
31130
  ])) : createCommentVNode("", true)
31126
31131
  ]),
31127
- hasFooterSlots.value ? (openBlock(), createElementBlock("div", _hoisted_25$5, [
31132
+ hasFooterSlots.value ? (openBlock(), createElementBlock("div", _hoisted_22$6, [
31128
31133
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.columns, (column, index) => {
31129
31134
  return openBlock(), createElementBlock("div", {
31130
31135
  key: `footer-${index}`,
@@ -31151,7 +31156,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
31151
31156
  };
31152
31157
  }
31153
31158
  });
31154
- const UiTable = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-c446db4e"]]);
31159
+ const UiTable = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-cafe623a"]]);
31155
31160
  const _hoisted_1$u = { class: "ui-hero-content" };
31156
31161
  const _hoisted_2$q = {
31157
31162
  key: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strands.gg/accui",
3
- "version": "2.10.7",
3
+ "version": "2.10.9",
4
4
  "description": "Strands Authentication UI Components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs.js",