vlite3 1.5.6 → 1.5.8

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.
Files changed (36) hide show
  1. package/README.md +2 -2
  2. package/components/ButtonGroup.vue.js +2 -2
  3. package/components/CategoryManager/CategoryManager.vue2.js +2 -2
  4. package/components/Chip/Chip.vue.d.ts +1 -0
  5. package/components/Chip/Chip.vue.js +67 -36
  6. package/components/Chip/types.d.ts +5 -1
  7. package/components/DataTable/DataTable.vue.d.ts +12 -3
  8. package/components/DataTable/DataTable.vue.js +5 -586
  9. package/components/DataTable/DataTable.vue2.js +711 -2
  10. package/components/DataTable/DataTableHeader.vue.d.ts +22 -0
  11. package/components/DataTable/DataTableHeader.vue.js +5 -58
  12. package/components/DataTable/DataTableHeader.vue2.js +106 -2
  13. package/components/DataTable/DataTableRow.vue.d.ts +13 -0
  14. package/components/DataTable/DataTableRow.vue.js +2 -2
  15. package/components/DataTable/DataTableRow.vue2.js +133 -123
  16. package/components/DataTable/dataTableColumnWidths.d.ts +91 -0
  17. package/components/DataTable/dataTableColumnWidths.js +82 -0
  18. package/components/DataTable/types.d.ts +48 -0
  19. package/components/DataTable/useDataTableColumnResize.d.ts +52 -0
  20. package/components/DataTable/useDataTableColumnResize.js +328 -0
  21. package/components/PanZoomViewport/PanZoomViewport.vue.d.ts +1 -1
  22. package/components/RichTextEditor/RichTextEditor.vue.js +4 -4
  23. package/components/RichTextEditor/RichTextLinkPopover.vue3.js +2 -2
  24. package/components/RichTextEditor/RichTextToolbar.vue3.js +2 -2
  25. package/components/Screen/ScreenFilter.vue.js +2 -2
  26. package/components/StatusChip/StatusChip.vue.d.ts +6 -0
  27. package/components/StatusChip/StatusChip.vue.js +12 -10
  28. package/components/Tabes/Tabes.vue.js +3 -3
  29. package/components/Tabes/Tabes.vue2.js +241 -220
  30. package/components/Tabes/types.d.ts +3 -1
  31. package/package.json +5 -6
  32. package/style.css +17 -3
  33. package/utils/usePersistentState.d.ts +4 -1
  34. package/utils/usePersistentState.js +4 -3
  35. /package/components/RichTextEditor/{RichTextLinkPopover.vue.js → RichTextLinkPopover.vue2.js} +0 -0
  36. /package/components/RichTextEditor/{RichTextToolbar.vue.js → RichTextToolbar.vue2.js} +0 -0
@@ -1,17 +1,17 @@
1
- import { defineComponent as q, computed as w, openBlock as i, createElementBlock as d, normalizeStyle as k, normalizeClass as m, createElementVNode as g, withModifiers as x, createVNode as B, createCommentVNode as c, createBlock as u, renderSlot as S, Fragment as C, renderList as $, toDisplayString as J, unref as H } from "vue";
2
- import j from "../CheckBox.vue.js";
3
- import L from "../Icon.vue.js";
4
- import z from "../Price/Price.vue.js";
5
- import D from "../DateTime/DateTime.vue.js";
6
- import K from "../TreeConnectors/TreeConnectors.vue.js";
7
- import { DEFAULT_TOGGLE_SIZE as Q, DEFAULT_TREE_CONTENT_GAP as A, DEFAULT_TREE_LEAF_INSET as R, DEFAULT_TREE_LEADING as X } from "../TreeConnectors/geometry.js";
8
- import { $t as Y } from "../../utils/i18n.js";
9
- import { useRtl as _ } from "../../composables/useRtl.js";
10
- import { splitStackedHeaders as ee } from "./dataTableHeaders.js";
11
- const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"], ne = {
1
+ import { defineComponent as J, computed as w, openBlock as i, createElementBlock as o, normalizeStyle as k, normalizeClass as f, createElementVNode as g, withModifiers as y, createVNode as z, createCommentVNode as c, createBlock as u, renderSlot as S, Fragment as C, renderList as B, toDisplayString as K, unref as H } from "vue";
2
+ import N from "../CheckBox.vue.js";
3
+ import M from "../Icon.vue.js";
4
+ import F from "../Price/Price.vue.js";
5
+ import I from "../DateTime/DateTime.vue.js";
6
+ import Q from "../TreeConnectors/TreeConnectors.vue.js";
7
+ import { DEFAULT_TOGGLE_SIZE as X, DEFAULT_TREE_CONTENT_GAP as j, DEFAULT_TREE_LEAF_INSET as A, DEFAULT_TREE_LEADING as Y } from "../TreeConnectors/geometry.js";
8
+ import { $t as _ } from "../../utils/i18n.js";
9
+ import { useRtl as ee } from "../../composables/useRtl.js";
10
+ import { splitStackedHeaders as te } from "./dataTableHeaders.js";
11
+ const le = ["data-state"], ie = ["aria-expanded"], ne = ["title", "innerHTML"], ae = {
12
12
  key: 0,
13
13
  class: "text-[11px] font-semibold uppercase tracking-wider text-muted-foreground shrink-0 pt-0.5 max-w-[40%]"
14
- }, ae = ["title", "innerHTML"], de = ["innerHTML"], oe = ["data-state"], se = { class: "flex items-center justify-center" }, re = ["onClick"], ue = ["aria-expanded"], ce = ["title", "innerHTML"], Ce = /* @__PURE__ */ q({
14
+ }, oe = ["title", "innerHTML"], de = ["innerHTML"], se = ["data-state"], re = { class: "flex items-center justify-center" }, ue = ["onClick"], ce = ["aria-expanded"], fe = ["title", "innerHTML"], He = /* @__PURE__ */ J({
15
15
  __name: "DataTableRow",
16
16
  props: {
17
17
  row: {},
@@ -35,24 +35,26 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
35
35
  treeLoading: { type: Boolean, default: !1 },
36
36
  isLastSibling: { type: Boolean, default: !1 },
37
37
  ancestorLastFlags: { default: () => [] },
38
- stacked: { type: Boolean, default: !1 }
38
+ stacked: { type: Boolean, default: !1 },
39
+ columnsFrozen: { type: Boolean, default: !1 },
40
+ columnResizing: { type: Boolean, default: !1 }
39
41
  },
40
42
  emits: ["select", "rowClick", "toggleExpand"],
41
43
  setup(e, { emit: U }) {
42
- const V = _(), r = e, M = U, n = (l, a) => {
44
+ const V = ee(), d = e, L = U, n = (l, a) => {
43
45
  if (!(!l || !a))
44
- return a.includes(".") ? a.split(".").reduce((t, s) => t?.[s], l) : l[a];
45
- }, y = (l, a, t) => l.format ? l.format(a, t) : a == null ? "-" : l.type === "number" ? new Intl.NumberFormat("en-US").format(Number(a)) : String(a), v = (l, a, t) => {
46
- const s = [];
47
- if (l.width && /(?:^|\s|:)w-/.test(l.width) && s.push(l.width), l.minWidth && /(?:^|\s|:)min-w-/.test(l.minWidth) && s.push(l.minWidth), l.capitalize && s.push("capitalize"), l.addStatusColor) {
48
- const f = W(a);
49
- f && s.push(f);
46
+ return a.includes(".") ? a.split(".").reduce((t, r) => t?.[r], l) : l[a];
47
+ }, v = (l, a, t) => l.format ? l.format(a, t) : a == null ? "-" : l.type === "number" ? new Intl.NumberFormat("en-US").format(Number(a)) : String(a), x = (l, a, t) => {
48
+ const r = [];
49
+ if (d.columnsFrozen || (l.width && /(?:^|\s|:)w-/.test(l.width) && r.push(l.width), l.minWidth && /(?:^|\s|:)min-w-/.test(l.minWidth) && r.push(l.minWidth)), l.capitalize && r.push("capitalize"), l.addStatusColor) {
50
+ const m = W(a);
51
+ m && r.push(m);
50
52
  }
51
53
  if (typeof l.class == "function") {
52
- const f = l.class(a, t);
53
- f && s.push(f);
54
- } else l.class && s.push(l.class);
55
- return s.join(" ");
54
+ const m = l.class(a, t);
55
+ m && r.push(m);
56
+ } else l.class && r.push(l.class);
57
+ return r.join(" ");
56
58
  }, W = (l) => {
57
59
  const a = {
58
60
  active: "text-success font-medium",
@@ -74,28 +76,34 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
74
76
  left: "text-left",
75
77
  center: "text-center",
76
78
  right: "text-right"
77
- })[l.align || "left"], P = w(() => n(r.row, r.keyField)), o = w(() => ee(r.headers)), T = (l) => l.titleI18n ? Y(l.titleI18n) : l.title, O = () => {
78
- const { size: l, compact: a, cellBordered: t } = r;
79
+ })[l.align || "left"], P = w(() => n(d.row, d.keyField)), s = w(() => te(d.headers)), T = (l) => l.titleI18n ? _(l.titleI18n) : l.title, O = () => {
80
+ const { size: l, compact: a, cellBordered: t } = d;
79
81
  return l === "xs" || a ? `py-1.5! -text-fs-1.5! ${t ? "px-3!" : "pr-4 max-sm:pr-10!"}` : l === "sm" ? `py-2! -text-fs-1.5! ${t ? "px-3!" : "pr-5 max-sm:pr-10!"}` : l === "lg" ? `py-4! text-base ${t ? "px-4!" : "pr-7 max-sm:pr-12!"}` : `py-3! -text-fs-1.5! ${t ? "px-3.5!" : "pr-6! max-sm:pr-10!"}`;
80
- }, E = X, Z = w(
81
- () => r.treeMode ? E + r.depth * r.treeIndent : 0
82
+ }, E = Y, Z = w(
83
+ () => d.treeMode ? E + d.depth * d.treeIndent : 0
82
84
  ), p = w(() => {
83
- const l = E + r.depth * r.treeIndent;
84
- return r.expandable ? l + Q + A : l + R;
85
- }), I = w(
86
- () => r.treeMode ? r.depth * Math.min(r.treeIndent, 16) : 0
85
+ const l = E + d.depth * d.treeIndent;
86
+ return d.expandable ? l + X + j : l + A;
87
+ }), $ = w(
88
+ () => d.treeMode ? d.depth * Math.min(d.treeIndent, 16) : 0
87
89
  ), b = () => {
88
- M("rowClick", { row: r.row, index: r.index });
89
- }, F = () => {
90
- r.selectionDisabled || M("select", P.value);
90
+ L("rowClick", { row: d.row, index: d.index });
91
+ }, D = () => {
92
+ d.selectionDisabled || L("select", P.value);
91
93
  }, h = (l) => {
92
- l?.stopPropagation(), l?.preventDefault(), M("toggleExpand");
93
- }, N = w(
94
+ l?.stopPropagation(), l?.preventDefault(), L("toggleExpand");
95
+ }, R = w(
94
96
  () => V.value ? "lucide:chevron-left" : "lucide:chevron-right"
95
- );
96
- return (l, a) => e.stacked ? (i(), d("div", {
97
+ ), q = (l) => {
98
+ if (d.columnResizing)
99
+ return d.treeMode && l === 0 ? { paddingInlineEnd: "0.875rem !important" } : {
100
+ paddingInlineStart: "0.875rem !important",
101
+ paddingInlineEnd: "0.875rem !important"
102
+ };
103
+ };
104
+ return (l, a) => e.stacked ? (i(), o("div", {
97
105
  key: 0,
98
- class: m(["data-table-row--stacked border rounded-lg overflow-hidden min-w-0 bg-background", [
106
+ class: f(["data-table-row--stacked border rounded-lg overflow-hidden min-w-0 bg-background", [
99
107
  e.hoverable && !e.isSelected ? "hover:bg-muted/30" : "",
100
108
  e.striped && e.index % 2 === 1 && !e.isSelected ? "bg-muted/20" : "",
101
109
  // Selected: primary outline (Design.md active state) + soft muted wash — no faint ring.
@@ -103,92 +111,92 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
103
111
  "group transition-colors"
104
112
  ]]),
105
113
  "data-state": e.isSelected ? "selected" : void 0,
106
- style: k(I.value ? { marginInlineStart: I.value + "px" } : void 0),
114
+ style: k($.value ? { marginInlineStart: $.value + "px" } : void 0),
107
115
  onClick: b
108
116
  }, [
109
117
  g("div", {
110
118
  class: "flex items-center gap-3 px-3 py-3 border-b min-w-0",
111
- onClick: a[1] || (a[1] = x(() => {
119
+ onClick: a[1] || (a[1] = y(() => {
112
120
  }, ["stop"]))
113
121
  }, [
114
- e.selectable ? (i(), d("div", {
122
+ e.selectable ? (i(), o("div", {
115
123
  key: 0,
116
124
  class: "shrink-0 self-center",
117
- onClick: a[0] || (a[0] = x(() => {
125
+ onClick: a[0] || (a[0] = y(() => {
118
126
  }, ["stop"]))
119
127
  }, [
120
- B(j, {
128
+ z(N, {
121
129
  "model-value": e.isSelected,
122
130
  indeterminate: e.isIndeterminate,
123
131
  disabled: e.selectionDisabled,
124
132
  size: "xs",
125
- "onUpdate:modelValue": F
133
+ "onUpdate:modelValue": D
126
134
  }, null, 8, ["model-value", "indeterminate", "disabled"])
127
135
  ])) : c("", !0),
128
- e.treeMode && e.expandable ? (i(), d("button", {
136
+ e.treeMode && e.expandable ? (i(), o("button", {
129
137
  key: 1,
130
138
  type: "button",
131
139
  class: "tree-expand-toggle shrink-0 flex h-7 w-7 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground transition-colors focus:outline-none",
132
140
  "aria-expanded": e.expanded,
133
141
  onClick: h
134
142
  }, [
135
- e.treeLoading ? (i(), u(L, {
143
+ e.treeLoading ? (i(), u(M, {
136
144
  key: 0,
137
145
  icon: "lucide:loader-2",
138
146
  class: "h-4 w-4 animate-spin"
139
- })) : (i(), u(L, {
147
+ })) : (i(), u(M, {
140
148
  key: 1,
141
- icon: e.expanded ? "lucide:chevron-down" : N.value,
149
+ icon: e.expanded ? "lucide:chevron-down" : R.value,
142
150
  class: "h-4 w-4"
143
151
  }, null, 8, ["icon"]))
144
- ], 8, le)) : c("", !0),
145
- o.value.primaryHeader ? (i(), d("div", {
152
+ ], 8, ie)) : c("", !0),
153
+ s.value.primaryHeader ? (i(), o("div", {
146
154
  key: 2,
147
- class: m(["min-w-0 flex-1", v(o.value.primaryHeader, n(e.row, o.value.primaryHeader.field), e.row)]),
155
+ class: f(["min-w-0 flex-1", x(s.value.primaryHeader, n(e.row, s.value.primaryHeader.field), e.row)]),
148
156
  onClick: b
149
157
  }, [
150
- S(l.$slots, o.value.primaryHeader.field, {
151
- value: n(e.row, o.value.primaryHeader.field),
158
+ S(l.$slots, s.value.primaryHeader.field, {
159
+ value: n(e.row, s.value.primaryHeader.field),
152
160
  row: e.row,
153
161
  index: e.index,
154
- field: o.value.primaryHeader.field
162
+ field: s.value.primaryHeader.field
155
163
  }, () => [
156
- o.value.primaryHeader.type === "price" ? (i(), u(z, {
164
+ s.value.primaryHeader.type === "price" ? (i(), u(F, {
157
165
  key: 0,
158
- value: n(e.row, o.value.primaryHeader.field),
166
+ value: n(e.row, s.value.primaryHeader.field),
159
167
  class: "block",
160
- title: String(n(e.row, o.value.primaryHeader.field))
161
- }, null, 8, ["value", "title"])) : o.value.primaryHeader.type === "date" ? (i(), u(D, {
168
+ title: String(n(e.row, s.value.primaryHeader.field))
169
+ }, null, 8, ["value", "title"])) : s.value.primaryHeader.type === "date" ? (i(), u(I, {
162
170
  key: 1,
163
- value: n(e.row, o.value.primaryHeader.field),
171
+ value: n(e.row, s.value.primaryHeader.field),
164
172
  class: "block",
165
- title: String(n(e.row, o.value.primaryHeader.field))
166
- }, null, 8, ["value", "title"])) : (i(), d("span", {
173
+ title: String(n(e.row, s.value.primaryHeader.field))
174
+ }, null, 8, ["value", "title"])) : (i(), o("span", {
167
175
  key: 2,
168
176
  class: "block text-sm font-semibold truncate",
169
- title: String(n(e.row, o.value.primaryHeader.field)),
170
- innerHTML: y(
171
- o.value.primaryHeader,
172
- n(e.row, o.value.primaryHeader.field),
177
+ title: String(n(e.row, s.value.primaryHeader.field)),
178
+ innerHTML: v(
179
+ s.value.primaryHeader,
180
+ n(e.row, s.value.primaryHeader.field),
173
181
  e.row
174
182
  )
175
- }, null, 8, ie))
183
+ }, null, 8, ne))
176
184
  ], !0)
177
185
  ], 2)) : c("", !0)
178
186
  ]),
179
- o.value.bodyHeaders.length ? (i(), d("div", {
187
+ s.value.bodyHeaders.length ? (i(), o("div", {
180
188
  key: 0,
181
189
  class: "flex flex-col gap-2.5 px-3 py-3 min-w-0",
182
190
  onClick: b
183
191
  }, [
184
- (i(!0), d(C, null, $(o.value.bodyHeaders, (t) => (i(), d("div", {
192
+ (i(!0), o(C, null, B(s.value.bodyHeaders, (t) => (i(), o("div", {
185
193
  key: t.field,
186
194
  class: "flex items-start justify-between gap-7 min-w-0"
187
195
  }, [
188
- T(t) ? (i(), d("span", ne, J(T(t)), 1)) : c("", !0),
196
+ T(t) ? (i(), o("span", ae, K(T(t)), 1)) : c("", !0),
189
197
  g("div", {
190
- class: m(["stacked-cell-value min-w-0 flex-1 text-sm text-right flex justify-end items-start", [
191
- v(t, n(e.row, t.field), e.row),
198
+ class: f(["stacked-cell-value min-w-0 flex-1 text-sm text-right flex justify-end items-start", [
199
+ x(t, n(e.row, t.field), e.row),
192
200
  T(t) ? "" : "w-full text-left justify-start"
193
201
  ]])
194
202
  }, [
@@ -198,35 +206,35 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
198
206
  index: e.index,
199
207
  field: t.field
200
208
  }, () => [
201
- t.type === "price" ? (i(), u(z, {
209
+ t.type === "price" ? (i(), u(F, {
202
210
  key: 0,
203
211
  value: n(e.row, t.field),
204
212
  class: "block",
205
213
  title: String(n(e.row, t.field))
206
- }, null, 8, ["value", "title"])) : t.type === "date" ? (i(), u(D, {
214
+ }, null, 8, ["value", "title"])) : t.type === "date" ? (i(), u(I, {
207
215
  key: 1,
208
216
  value: n(e.row, t.field),
209
217
  class: "block",
210
218
  title: String(n(e.row, t.field))
211
- }, null, 8, ["value", "title"])) : (i(), d("span", {
219
+ }, null, 8, ["value", "title"])) : (i(), o("span", {
212
220
  key: 2,
213
221
  class: "block",
214
222
  title: String(n(e.row, t.field)),
215
- innerHTML: y(t, n(e.row, t.field), e.row)
216
- }, null, 8, ae))
223
+ innerHTML: v(t, n(e.row, t.field), e.row)
224
+ }, null, 8, oe))
217
225
  ], !0)
218
226
  ], 2)
219
227
  ]))), 128))
220
228
  ])) : c("", !0),
221
- o.value.actionHeaders.length ? (i(), d("div", {
229
+ s.value.actionHeaders.length ? (i(), o("div", {
222
230
  key: 1,
223
231
  class: "flex items-center justify-end gap-1 flex-wrap px-2 py-2 border-t",
224
- onClick: a[2] || (a[2] = x(() => {
232
+ onClick: a[2] || (a[2] = y(() => {
225
233
  }, ["stop"]))
226
234
  }, [
227
- (i(!0), d(C, null, $(o.value.actionHeaders, (t) => (i(), d("div", {
235
+ (i(!0), o(C, null, B(s.value.actionHeaders, (t) => (i(), o("div", {
228
236
  key: t.field,
229
- class: m(["min-w-0 flex items-center justify-end gap-0.5", v(t, n(e.row, t.field), e.row)])
237
+ class: f(["min-w-0 flex items-center justify-end gap-0.5", x(t, n(e.row, t.field), e.row)])
230
238
  }, [
231
239
  S(l.$slots, t.field, {
232
240
  value: n(e.row, t.field),
@@ -236,14 +244,14 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
236
244
  }, () => [
237
245
  g("span", {
238
246
  class: "block",
239
- innerHTML: y(t, n(e.row, t.field), e.row)
247
+ innerHTML: v(t, n(e.row, t.field), e.row)
240
248
  }, null, 8, de)
241
249
  ], !0)
242
250
  ], 2))), 128))
243
251
  ])) : c("", !0)
244
- ], 14, te)) : (i(), d("tr", {
252
+ ], 14, le)) : (i(), o("tr", {
245
253
  key: 1,
246
- class: m(["border-b data-[state=selected]:bg-muted h-full", [
254
+ class: f(["border-b data-[state=selected]:bg-muted h-full", [
247
255
  e.hoverable ? "hover:bg-muted/20" : "",
248
256
  e.striped && e.index % 2 === 1 ? "bg-muted/20" : "bg-background",
249
257
  e.isSelected ? "bg-muted! hover:bg-muted/30" : "",
@@ -252,84 +260,86 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
252
260
  "data-state": e.isSelected ? "selected" : void 0,
253
261
  onClick: b
254
262
  }, [
255
- e.selectable ? (i(), d("td", {
263
+ e.selectable ? (i(), o("td", {
256
264
  key: 0,
257
265
  class: "px-0! py-1! align-middle text-center",
258
- onClick: a[3] || (a[3] = x(() => {
266
+ onClick: a[3] || (a[3] = y(() => {
259
267
  }, ["stop"]))
260
268
  }, [
261
- g("div", se, [
262
- B(j, {
269
+ g("div", re, [
270
+ z(N, {
263
271
  "model-value": e.isSelected,
264
272
  indeterminate: e.isIndeterminate,
265
273
  disabled: e.selectionDisabled,
266
274
  size: "xs",
267
- "onUpdate:modelValue": F
275
+ "onUpdate:modelValue": D
268
276
  }, null, 8, ["model-value", "indeterminate", "disabled"])
269
277
  ])
270
278
  ])) : c("", !0),
271
- (i(!0), d(C, null, $(e.headers, (t, s) => (i(), d("td", {
279
+ (i(!0), o(C, null, B(e.headers, (t, r) => (i(), o("td", {
272
280
  key: t.field,
273
- class: m(["align-middle whitespace-normal wrap-break-word", [
281
+ class: f(["align-middle", [
274
282
  O(),
275
283
  G(t),
284
+ e.columnResizing ? "whitespace-nowrap" : "whitespace-normal wrap-break-word",
276
285
  t.hideOnMobile ? "hidden md:table-cell" : "",
277
- e.treeMode ? "max-w-none min-w-0" : "max-w-[400px]",
286
+ e.treeMode || e.columnsFrozen ? "max-w-none min-w-0" : "max-w-[400px]",
278
287
  // Keep overflow clip on data cells; last column (actions) must stay visible
279
- s === e.headers.length - 1 ? "overflow-visible" : "overflow-hidden",
288
+ r === e.headers.length - 1 ? "overflow-visible" : "overflow-hidden",
280
289
  // Tree chrome overlays the whole first cell (incl. padding) so branch
281
290
  // lines join seamlessly across rows. overflow-visible lets the connector
282
291
  // overlay bleed across the collapsed row border for continuous trunks.
283
- e.treeMode && s === 0 ? "relative ps-0! overflow-visible!" : "",
284
- v(t, n(e.row, t.field), e.row)
292
+ e.treeMode && r === 0 ? "relative ps-0! overflow-visible!" : "",
293
+ x(t, n(e.row, t.field), e.row)
285
294
  ]]),
286
- style: k(
287
- e.treeMode ? void 0 : {
295
+ style: k([
296
+ e.treeMode || e.columnsFrozen ? void 0 : {
288
297
  ...t.width && !/(?:^|\s|:)w-/.test(t.width) ? { width: t.width } : {},
289
298
  ...t.minWidth && !/(?:^|\s|:)min-w-/.test(t.minWidth) ? { minWidth: t.minWidth } : {}
290
- }
291
- ),
292
- onClick: (f) => e.treeMode && s === 0 && e.expandable ? h(f) : void 0
299
+ },
300
+ q(r)
301
+ ]),
302
+ onClick: (m) => e.treeMode && r === 0 && e.expandable ? h(m) : void 0
293
303
  }, [
294
- e.treeMode && s === 0 ? (i(), d(C, { key: 0 }, [
295
- B(H(K), {
304
+ e.treeMode && r === 0 ? (i(), o(C, { key: 0 }, [
305
+ z(H(Q), {
296
306
  depth: e.depth,
297
307
  "is-last-sibling": e.isLastSibling,
298
308
  "ancestor-last-flags": e.ancestorLastFlags,
299
309
  "has-toggle": e.expandable,
300
310
  indent: e.treeIndent,
301
311
  "base-inset": H(E),
302
- "content-gap": H(A),
312
+ "content-gap": H(j),
303
313
  "leaf-has-spacer": !1,
304
- "leaf-inset": H(R),
314
+ "leaf-inset": H(A),
305
315
  "bleed-y": ""
306
316
  }, null, 8, ["depth", "is-last-sibling", "ancestor-last-flags", "has-toggle", "indent", "base-inset", "content-gap", "leaf-inset"]),
307
- e.expandable ? (i(), d("button", {
317
+ e.expandable ? (i(), o("button", {
308
318
  key: 0,
309
319
  type: "button",
310
320
  class: "tree-expand-toggle absolute z-20 top-1/2 -translate-y-1/2 flex h-7 w-7 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground transition-colors focus:outline-none",
311
321
  style: k({ insetInlineStart: Z.value + "px" }),
312
322
  "aria-expanded": e.expanded,
313
- onClick: x(h, ["stop"])
323
+ onClick: y(h, ["stop"])
314
324
  }, [
315
- e.treeLoading ? (i(), u(L, {
325
+ e.treeLoading ? (i(), u(M, {
316
326
  key: 0,
317
327
  icon: "lucide:loader-2",
318
328
  class: "h-4 w-4 animate-spin"
319
- })) : (i(), u(L, {
329
+ })) : (i(), u(M, {
320
330
  key: 1,
321
- icon: e.expanded ? "lucide:chevron-down" : N.value,
331
+ icon: e.expanded ? "lucide:chevron-down" : R.value,
322
332
  class: "h-4 w-4"
323
333
  }, null, 8, ["icon"]))
324
- ], 12, ue)) : c("", !0)
334
+ ], 12, ce)) : c("", !0)
325
335
  ], 64)) : c("", !0),
326
336
  g("div", {
327
- class: m([
337
+ class: f([
328
338
  "tree-row-content w-full min-w-0",
329
- e.treeMode && s === 0 ? "relative z-10 flex items-center min-h-[28px] max-h-[80px] overflow-y-auto scrollbar-hide" : s === e.headers.length - 1 ? "overflow-visible" : "max-h-[80px] overflow-y-auto scrollbar-hide"
339
+ e.treeMode && r === 0 ? "relative z-10 flex items-center min-h-[28px] max-h-[80px] overflow-y-auto scrollbar-hide" : r === e.headers.length - 1 ? "overflow-visible" : e.columnResizing ? "overflow-hidden" : "max-h-[80px] overflow-y-auto scrollbar-hide"
330
340
  ]),
331
341
  style: k(
332
- e.treeMode && s === 0 ? { paddingInlineStart: p.value + "px" } : void 0
342
+ e.treeMode && r === 0 ? { paddingInlineStart: p.value + "px" } : void 0
333
343
  )
334
344
  }, [
335
345
  S(l.$slots, t.field, {
@@ -338,28 +348,28 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
338
348
  index: e.index,
339
349
  field: t.field
340
350
  }, () => [
341
- t.type === "price" ? (i(), u(z, {
351
+ t.type === "price" ? (i(), u(F, {
342
352
  key: 0,
343
353
  value: n(e.row, t.field),
344
354
  class: "block",
345
355
  title: String(n(e.row, t.field))
346
- }, null, 8, ["value", "title"])) : t.type === "date" ? (i(), u(D, {
356
+ }, null, 8, ["value", "title"])) : t.type === "date" ? (i(), u(I, {
347
357
  key: 1,
348
358
  value: n(e.row, t.field),
349
359
  class: "block",
350
360
  title: String(n(e.row, t.field))
351
- }, null, 8, ["value", "title"])) : (i(), d("span", {
361
+ }, null, 8, ["value", "title"])) : (i(), o("span", {
352
362
  key: 2,
353
- class: "block",
363
+ class: f(["block", e.columnResizing ? "truncate" : ""]),
354
364
  title: String(n(e.row, t.field)),
355
- innerHTML: y(t, n(e.row, t.field), e.row)
356
- }, null, 8, ce))
365
+ innerHTML: v(t, n(e.row, t.field), e.row)
366
+ }, null, 10, fe))
357
367
  ], !0)
358
368
  ], 6)
359
- ], 14, re))), 128))
360
- ], 10, oe));
369
+ ], 14, ue))), 128))
370
+ ], 10, se));
361
371
  }
362
372
  });
363
373
  export {
364
- Ce as default
374
+ He as default
365
375
  };
@@ -0,0 +1,91 @@
1
+ import { TableHeader } from './types';
2
+ /**
3
+ * Pure column-width maths for DataTable resizing.
4
+ *
5
+ * Deliberately free of Vue, DOM and storage so the layout model can be unit
6
+ * tested on its own; `useDataTableColumnResize` supplies the reactivity, pointer
7
+ * handling and persistence around it.
8
+ *
9
+ * User widths resolve independently. A fixed final column may receive only the
10
+ * positive slack required to keep the table flush with its scroll viewport;
11
+ * required widths are never reduced and overflow still scrolls.
12
+ */
13
+ /** Smallest width a column may be dragged to when its header sets no `minWidth`. */
14
+ export declare const DEFAULT_MIN_COLUMN_WIDTH = 60;
15
+ /** Hard safety cap — also used to reject corrupted persisted values. */
16
+ export declare const MAX_COLUMN_WIDTH = 4000;
17
+ /** Schema version of the persisted payload. Bump to invalidate old state. */
18
+ export declare const COLUMN_WIDTHS_VERSION = 1;
19
+ /** Fixed width of the built-in selection checkbox column (never resizable). */
20
+ export declare const SELECTION_COLUMN_WIDTH = 40;
21
+ /** Header sizing fields this module cares about. */
22
+ export type ColumnWidthConfig = Pick<TableHeader, 'field' | 'width' | 'minWidth' | 'resizable'>;
23
+ /** A column opts out of resizing with `resizable: false`. */
24
+ export declare const isResizableColumn: (header: ColumnWidthConfig) => boolean;
25
+ export declare const isTailwindWidth: (value: string) => boolean;
26
+ export declare const isTailwindMinWidth: (value: string) => boolean;
27
+ /** Pixel value of a configured width. `%`, `rem` and Tailwind classes return null. */
28
+ export declare const parsePx: (value?: string) => number | null;
29
+ export declare const clampWidth: (value: number, min: number, max: number) => number;
30
+ /** Configured px width; `%` and Tailwind utilities are measured at runtime instead. */
31
+ export declare const configuredWidth: (header: ColumnWidthConfig) => number | null;
32
+ export declare const configuredMinWidth: (header: ColumnWidthConfig) => number | null;
33
+ /**
34
+ * Effective floor for a column: the global default, its configured `minWidth`,
35
+ * and any measured header-content minimum supplied by the DOM interaction layer.
36
+ */
37
+ export declare const minWidthFor: (header: ColumnWidthConfig, contentMinWidth?: number) => number;
38
+ /**
39
+ * Resolve one column's independent requested width.
40
+ *
41
+ * Precedence after the table freezes: persisted / user width → captured rendered
42
+ * width → configured `width` → configured `minWidth`.
43
+ *
44
+ * A user width is only honoured for columns that are still resizable: a column
45
+ * pinned with `resizable: false` always falls back to its developer-configured
46
+ * width, so a stale override saved while it was resizable can never take control
47
+ * of a column the user has no way to reset.
48
+ *
49
+ * User widths are clamped to the column's current minimum, so tightening
50
+ * `minWidth` invalidates a too-small saved value rather than breaking layout.
51
+ */
52
+ export declare const resolveColumnWidth: (header: ColumnWidthConfig, userWidths: Record<string, number>, baseWidths: Record<string, number>, contentMinWidth?: number) => number | undefined;
53
+ export interface ColumnLayoutInput {
54
+ headers: ColumnWidthConfig[];
55
+ userWidths: Record<string, number>;
56
+ baseWidths: Record<string, number>;
57
+ /** Runtime header-content floors keyed by `header.field`. */
58
+ minimumWidths?: Record<string, number>;
59
+ hasSelectionColumn: boolean;
60
+ /** Available scroll viewport width. */
61
+ containerWidth?: number | null;
62
+ /** Fixed final column that receives positive trailing slack. */
63
+ trailingFillField?: string | null;
64
+ }
65
+ export interface ColumnLayout {
66
+ /** Final rendered width per field. */
67
+ widths: Record<string, number>;
68
+ /** Sum of all rendered columns, or null while any column is unmeasured. */
69
+ totalWidth: number | null;
70
+ /** Every column resolved to a width (safe to drive a fixed layout). */
71
+ complete: boolean;
72
+ }
73
+ /**
74
+ * Resolve every column independently. When a fixed final column is designated,
75
+ * only that column receives positive viewport slack so its trailing edge stays
76
+ * pinned. Required widths are never reduced; overflow still scrolls.
77
+ */
78
+ export declare const computeColumnLayout: ({ headers, userWidths, baseWidths, minimumWidths, hasSelectionColumn, containerWidth, trailingFillField, }: ColumnLayoutInput) => ColumnLayout;
79
+ /**
80
+ * Keep only sane, finite, positive pixel widths from a persisted payload.
81
+ * A wrong version, NaN, negative, string junk, array or non-object is dropped so
82
+ * a corrupted or outdated entry can never break the table.
83
+ */
84
+ export declare const sanitizeColumnWidths: (raw: unknown) => Record<string, number>;
85
+ /**
86
+ * Drop overrides for columns that are present but no longer resizable, so a
87
+ * pinned column cannot keep a width the user has no way to reset. Fields that
88
+ * are not in `headers` are left alone — they belong to hidden columns whose
89
+ * widths must survive being toggled off and back on.
90
+ */
91
+ export declare const pruneUnusableWidths: (widths: Record<string, number>, headers: ColumnWidthConfig[]) => Record<string, number>;
@@ -0,0 +1,82 @@
1
+ const T = 60, L = 4e3, b = 1, a = 40, N = (t) => t.resizable !== !1, p = (t) => /(?:^|\s|:)w-/.test(t), C = (t) => /(?:^|\s|:)min-w-/.test(t), _ = (t) => {
2
+ if (!t) return null;
3
+ const n = /^(\d+(?:\.\d+)?)(px)?$/.exec(String(t).trim());
4
+ if (!n) return null;
5
+ const i = Number(n[1]);
6
+ return Number.isFinite(i) && i > 0 ? i : null;
7
+ }, d = (t, n, i) => Math.min(Math.max(t, n), i), I = (t) => t.width && !p(t.width) ? _(t.width) : null, W = (t) => t.minWidth && !C(t.minWidth) ? _(t.minWidth) : null, M = (t, n = 0) => Math.max(60, W(t) ?? 0, n), O = (t, n, i, o = 0) => {
8
+ if (N(t)) {
9
+ const e = n[t.field];
10
+ if (e != null && Number.isFinite(e))
11
+ return d(e, M(t, o), 4e3);
12
+ const s = i[t.field];
13
+ if (s != null && Number.isFinite(s))
14
+ return d(s, M(t, o), 4e3);
15
+ }
16
+ return i[t.field] ?? I(t) ?? W(t);
17
+ }, U = ({
18
+ headers: t,
19
+ userWidths: n,
20
+ baseWidths: i,
21
+ minimumWidths: o = {},
22
+ hasSelectionColumn: e,
23
+ containerWidth: s = null,
24
+ trailingFillField: u = null
25
+ }) => {
26
+ const r = {};
27
+ let l = e ? 40 : 0, c = !0;
28
+ for (const f of t) {
29
+ const m = O(
30
+ f,
31
+ n,
32
+ i,
33
+ o[f.field]
34
+ );
35
+ if (m == null) {
36
+ c = !1;
37
+ continue;
38
+ }
39
+ r[f.field] = Math.round(m), l += r[f.field];
40
+ }
41
+ return c && s != null && s > l && u && r[u] != null && (r[u] += s - l, l = s), { widths: r, totalWidth: c ? l : null, complete: c };
42
+ }, D = (t) => {
43
+ const n = {};
44
+ if (!t || typeof t != "object" || Array.isArray(t)) return n;
45
+ const i = t;
46
+ if (i.version !== 1) return n;
47
+ const o = i.widths;
48
+ if (!o || typeof o != "object" || Array.isArray(o)) return n;
49
+ for (const [e, s] of Object.entries(o)) {
50
+ if (!e || typeof s != "number" && typeof s != "string") continue;
51
+ const u = typeof s == "number" ? s : Number(s);
52
+ !Number.isFinite(u) || u <= 0 || u > 4e3 || (n[e] = Math.round(u));
53
+ }
54
+ return n;
55
+ }, h = (t, n) => {
56
+ const i = new Set(
57
+ n.filter((e) => !N(e)).map((e) => e.field)
58
+ );
59
+ if (!i.size) return { ...t };
60
+ const o = {};
61
+ for (const [e, s] of Object.entries(t))
62
+ i.has(e) || (o[e] = s);
63
+ return o;
64
+ };
65
+ export {
66
+ b as COLUMN_WIDTHS_VERSION,
67
+ T as DEFAULT_MIN_COLUMN_WIDTH,
68
+ L as MAX_COLUMN_WIDTH,
69
+ a as SELECTION_COLUMN_WIDTH,
70
+ d as clampWidth,
71
+ U as computeColumnLayout,
72
+ W as configuredMinWidth,
73
+ I as configuredWidth,
74
+ N as isResizableColumn,
75
+ C as isTailwindMinWidth,
76
+ p as isTailwindWidth,
77
+ M as minWidthFor,
78
+ _ as parsePx,
79
+ h as pruneUnusableWidths,
80
+ O as resolveColumnWidth,
81
+ D as sanitizeColumnWidths
82
+ };