vlite3 1.5.5 → 1.5.7
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/README.md +34 -0
- package/VLiteIconsVite.d.ts +36 -0
- package/components/AppShell/AppShell.vue.d.ts +1 -1
- package/components/AppShell/AppShellLayoutDashboard.vue.js +3 -2
- package/components/AppShell/AppShellLayoutDock.vue.js +3 -2
- package/components/AppShell/AppShellLayoutHeaderShell.vue.js +28 -27
- package/components/AppShell/AppShellLayoutSidebarFirst.vue.js +3 -2
- package/components/AsyncSelect/createAsyncSelect.d.ts +4 -4
- package/components/AsyncSelect/createAsyncSelect.js +3 -2
- package/components/BackButton.vue.d.ts +1 -1
- package/components/ButtonGroup.vue.js +2 -2
- package/components/CategoryManager/CategoryManager.vue2.js +15 -15
- package/components/CategoryManager/CategoryNode.vue.js +16 -16
- package/components/CategoryMenu/CategoryMenu.vue.js +9 -8
- package/components/Chart/BarChart.vue.d.ts +1 -1
- package/components/Chart/GanttChart.vue.d.ts +1 -1
- package/components/Chart/LineChart.vue.d.ts +1 -1
- package/components/Chart/TimelineChart.vue.d.ts +1 -1
- package/components/Chip/Chip.vue.d.ts +1 -0
- package/components/Chip/Chip.vue.js +67 -36
- package/components/Chip/types.d.ts +5 -1
- package/components/ColorPicker/ColorIro.vue3.js +2 -2
- package/components/ColorPicker/ColorPicker.vue.js +2 -2
- package/components/CommandPalette/CommandPaletteContent.vue2.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem.vue2.js → CommandPaletteItem.vue.js} +1 -1
- package/components/ConfirmationModal.vue.d.ts +4 -0
- package/components/ConfirmationModal.vue.js +47 -39
- package/components/DataTable/DataTable.vue.d.ts +12 -3
- package/components/DataTable/DataTable.vue.js +5 -561
- package/components/DataTable/DataTable.vue2.js +711 -2
- package/components/DataTable/DataTableHeader.vue.d.ts +22 -0
- package/components/DataTable/DataTableHeader.vue.js +5 -58
- package/components/DataTable/DataTableHeader.vue2.js +106 -2
- package/components/DataTable/DataTableRow.vue.d.ts +15 -0
- package/components/DataTable/DataTableRow.vue.js +3 -3
- package/components/DataTable/DataTableRow.vue2.js +131 -118
- package/components/DataTable/dataTableColumnWidths.d.ts +91 -0
- package/components/DataTable/dataTableColumnWidths.js +82 -0
- package/components/DataTable/types.d.ts +50 -0
- package/components/DataTable/useDataTableColumnResize.d.ts +52 -0
- package/components/DataTable/useDataTableColumnResize.js +328 -0
- package/components/DatePicker.vue.js +5 -4
- package/components/Empty/Empty.vue.js +3 -2
- package/components/ExportData/ExportData.vue.d.ts +1 -1
- package/components/Form/{AccordionView.vue.js → AccordionView.vue2.js} +1 -1
- package/components/Form/Form.vue2.js +44 -43
- package/components/Form/FormField.vue.js +24 -24
- package/components/Form/index.vue2.js +1 -1
- package/components/Heatmap/Heatmap.vue2.js +3 -2
- package/components/Icon.vue.d.ts +3 -2
- package/components/Icon.vue.js +22 -12
- package/components/IconPicker.vue.js +5 -133
- package/components/IconPicker.vue2.js +218 -2
- package/components/ImportData/ImportData.vue.js +3 -2
- package/components/ImportData/ImportStep2.vue.js +3 -2
- package/components/Kanban/KanbanBoard.vue2.js +4 -2
- package/components/List/utils.js +5 -4
- package/components/Masonry/Masonry.vue2.js +14 -13
- package/components/Navbar/Navbar.vue.d.ts +1 -1
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/PanZoomViewport/PanZoomViewport.vue.d.ts +1 -1
- package/components/Price/Price.vue.js +13 -12
- package/components/Rating/Rating.vue.js +2 -2
- package/components/Rating/Rating.vue2.js +41 -41
- package/components/Rating/ReviewSummary.vue.js +20 -20
- package/components/Screen/ScreenFilter.vue.js +6 -4
- package/components/Screen/components/ScreenExportModal.vue.d.ts +2 -2
- package/components/Stats/StatItem.vue.js +3 -2
- package/components/StatusChip/StatusChip.vue.d.ts +6 -0
- package/components/StatusChip/StatusChip.vue.js +14 -11
- package/components/Tabes/Tabes.vue.js +3 -3
- package/components/Tabes/Tabes.vue2.js +241 -220
- package/components/Tabes/types.d.ts +3 -1
- package/components/Workbook/Sheet.vue.js +11 -11
- package/core/config.d.ts +28 -0
- package/core/config.js +23 -21
- package/core/index.js +18 -17
- package/icons/IconRegistry.d.ts +38 -0
- package/icons/IconRegistry.js +166 -0
- package/icons/IconTypes.d.ts +37 -0
- package/index.d.ts +2 -0
- package/index.js +473 -457
- package/package.json +15 -3
- package/style.css +17 -3
- package/types/config.type.d.ts +8 -1
- package/utils/functions.js +44 -43
- package/utils/index.d.ts +1 -0
- package/utils/usePersistentState.d.ts +4 -1
- package/utils/usePersistentState.js +4 -3
- package/vite.d.ts +6 -0
- package/vite.js +223 -0
- /package/components/ColorPicker/{ColorIro.vue.js → ColorIro.vue2.js} +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
5
|
import I from "../DateTime/DateTime.vue.js";
|
|
6
|
-
import
|
|
7
|
-
import { DEFAULT_TOGGLE_SIZE as
|
|
8
|
-
import { $t as
|
|
9
|
-
import { useRtl as
|
|
10
|
-
import { splitStackedHeaders as
|
|
11
|
-
const
|
|
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
|
-
},
|
|
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: {},
|
|
@@ -19,6 +19,7 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
|
|
|
19
19
|
index: {},
|
|
20
20
|
keyField: { default: "_id" },
|
|
21
21
|
selectable: { type: Boolean, default: !1 },
|
|
22
|
+
selectionDisabled: { type: Boolean, default: !1 },
|
|
22
23
|
isSelected: { type: Boolean, default: !1 },
|
|
23
24
|
isIndeterminate: { type: Boolean, default: !1 },
|
|
24
25
|
hoverable: { type: Boolean, default: !0 },
|
|
@@ -34,24 +35,26 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
|
|
|
34
35
|
treeLoading: { type: Boolean, default: !1 },
|
|
35
36
|
isLastSibling: { type: Boolean, default: !1 },
|
|
36
37
|
ancestorLastFlags: { default: () => [] },
|
|
37
|
-
stacked: { type: Boolean, default: !1 }
|
|
38
|
+
stacked: { type: Boolean, default: !1 },
|
|
39
|
+
columnsFrozen: { type: Boolean, default: !1 },
|
|
40
|
+
columnResizing: { type: Boolean, default: !1 }
|
|
38
41
|
},
|
|
39
42
|
emits: ["select", "rowClick", "toggleExpand"],
|
|
40
43
|
setup(e, { emit: U }) {
|
|
41
|
-
const V =
|
|
44
|
+
const V = ee(), d = e, L = U, n = (l, a) => {
|
|
42
45
|
if (!(!l || !a))
|
|
43
|
-
return a.includes(".") ? a.split(".").reduce((t,
|
|
44
|
-
},
|
|
45
|
-
const
|
|
46
|
-
if (l.width && /(?:^|\s|:)w-/.test(l.width) &&
|
|
47
|
-
const
|
|
48
|
-
|
|
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);
|
|
49
52
|
}
|
|
50
53
|
if (typeof l.class == "function") {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
} else l.class &&
|
|
54
|
-
return
|
|
54
|
+
const m = l.class(a, t);
|
|
55
|
+
m && r.push(m);
|
|
56
|
+
} else l.class && r.push(l.class);
|
|
57
|
+
return r.join(" ");
|
|
55
58
|
}, W = (l) => {
|
|
56
59
|
const a = {
|
|
57
60
|
active: "text-success font-medium",
|
|
@@ -73,28 +76,34 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
|
|
|
73
76
|
left: "text-left",
|
|
74
77
|
center: "text-center",
|
|
75
78
|
right: "text-right"
|
|
76
|
-
})[l.align || "left"], P = w(() => n(
|
|
77
|
-
const { size: l, compact: a, cellBordered: t } =
|
|
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;
|
|
78
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!"}`;
|
|
79
|
-
}, E =
|
|
80
|
-
() =>
|
|
81
|
-
),
|
|
82
|
-
const l = E +
|
|
83
|
-
return
|
|
84
|
-
}),
|
|
85
|
-
() =>
|
|
82
|
+
}, E = Y, Z = w(
|
|
83
|
+
() => d.treeMode ? E + d.depth * d.treeIndent : 0
|
|
84
|
+
), p = w(() => {
|
|
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
|
|
86
89
|
), b = () => {
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
+
L("rowClick", { row: d.row, index: d.index });
|
|
91
|
+
}, D = () => {
|
|
92
|
+
d.selectionDisabled || L("select", P.value);
|
|
90
93
|
}, h = (l) => {
|
|
91
|
-
l?.stopPropagation(), l?.preventDefault(),
|
|
92
|
-
},
|
|
94
|
+
l?.stopPropagation(), l?.preventDefault(), L("toggleExpand");
|
|
95
|
+
}, R = w(
|
|
93
96
|
() => V.value ? "lucide:chevron-left" : "lucide:chevron-right"
|
|
94
|
-
)
|
|
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
|
+
};
|
|
95
104
|
return (l, a) => e.stacked ? (i(), o("div", {
|
|
96
105
|
key: 0,
|
|
97
|
-
class:
|
|
106
|
+
class: f(["data-table-row--stacked border rounded-lg overflow-hidden min-w-0 bg-background", [
|
|
98
107
|
e.hoverable && !e.isSelected ? "hover:bg-muted/30" : "",
|
|
99
108
|
e.striped && e.index % 2 === 1 && !e.isSelected ? "bg-muted/20" : "",
|
|
100
109
|
// Selected: primary outline (Design.md active state) + soft muted wash — no faint ring.
|
|
@@ -102,26 +111,27 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
|
|
|
102
111
|
"group transition-colors"
|
|
103
112
|
]]),
|
|
104
113
|
"data-state": e.isSelected ? "selected" : void 0,
|
|
105
|
-
style: k(
|
|
114
|
+
style: k($.value ? { marginInlineStart: $.value + "px" } : void 0),
|
|
106
115
|
onClick: b
|
|
107
116
|
}, [
|
|
108
117
|
g("div", {
|
|
109
118
|
class: "flex items-center gap-3 px-3 py-3 border-b min-w-0",
|
|
110
|
-
onClick: a[1] || (a[1] =
|
|
119
|
+
onClick: a[1] || (a[1] = y(() => {
|
|
111
120
|
}, ["stop"]))
|
|
112
121
|
}, [
|
|
113
122
|
e.selectable ? (i(), o("div", {
|
|
114
123
|
key: 0,
|
|
115
124
|
class: "shrink-0 self-center",
|
|
116
|
-
onClick: a[0] || (a[0] =
|
|
125
|
+
onClick: a[0] || (a[0] = y(() => {
|
|
117
126
|
}, ["stop"]))
|
|
118
127
|
}, [
|
|
119
|
-
|
|
128
|
+
z(N, {
|
|
120
129
|
"model-value": e.isSelected,
|
|
121
130
|
indeterminate: e.isIndeterminate,
|
|
131
|
+
disabled: e.selectionDisabled,
|
|
122
132
|
size: "xs",
|
|
123
|
-
"onUpdate:modelValue":
|
|
124
|
-
}, null, 8, ["model-value", "indeterminate"])
|
|
133
|
+
"onUpdate:modelValue": D
|
|
134
|
+
}, null, 8, ["model-value", "indeterminate", "disabled"])
|
|
125
135
|
])) : c("", !0),
|
|
126
136
|
e.treeMode && e.expandable ? (i(), o("button", {
|
|
127
137
|
key: 1,
|
|
@@ -130,63 +140,63 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
|
|
|
130
140
|
"aria-expanded": e.expanded,
|
|
131
141
|
onClick: h
|
|
132
142
|
}, [
|
|
133
|
-
e.treeLoading ? (i(), u(
|
|
143
|
+
e.treeLoading ? (i(), u(M, {
|
|
134
144
|
key: 0,
|
|
135
145
|
icon: "lucide:loader-2",
|
|
136
146
|
class: "h-4 w-4 animate-spin"
|
|
137
|
-
})) : (i(), u(
|
|
147
|
+
})) : (i(), u(M, {
|
|
138
148
|
key: 1,
|
|
139
|
-
icon: e.expanded ? "lucide:chevron-down" :
|
|
149
|
+
icon: e.expanded ? "lucide:chevron-down" : R.value,
|
|
140
150
|
class: "h-4 w-4"
|
|
141
151
|
}, null, 8, ["icon"]))
|
|
142
|
-
], 8,
|
|
143
|
-
|
|
152
|
+
], 8, ie)) : c("", !0),
|
|
153
|
+
s.value.primaryHeader ? (i(), o("div", {
|
|
144
154
|
key: 2,
|
|
145
|
-
class:
|
|
155
|
+
class: f(["min-w-0 flex-1", x(s.value.primaryHeader, n(e.row, s.value.primaryHeader.field), e.row)]),
|
|
146
156
|
onClick: b
|
|
147
157
|
}, [
|
|
148
|
-
S(l.$slots,
|
|
149
|
-
value: n(e.row,
|
|
158
|
+
S(l.$slots, s.value.primaryHeader.field, {
|
|
159
|
+
value: n(e.row, s.value.primaryHeader.field),
|
|
150
160
|
row: e.row,
|
|
151
161
|
index: e.index,
|
|
152
|
-
field:
|
|
162
|
+
field: s.value.primaryHeader.field
|
|
153
163
|
}, () => [
|
|
154
|
-
|
|
164
|
+
s.value.primaryHeader.type === "price" ? (i(), u(F, {
|
|
155
165
|
key: 0,
|
|
156
|
-
value: n(e.row,
|
|
166
|
+
value: n(e.row, s.value.primaryHeader.field),
|
|
157
167
|
class: "block",
|
|
158
|
-
title: String(n(e.row,
|
|
159
|
-
}, null, 8, ["value", "title"])) :
|
|
168
|
+
title: String(n(e.row, s.value.primaryHeader.field))
|
|
169
|
+
}, null, 8, ["value", "title"])) : s.value.primaryHeader.type === "date" ? (i(), u(I, {
|
|
160
170
|
key: 1,
|
|
161
|
-
value: n(e.row,
|
|
171
|
+
value: n(e.row, s.value.primaryHeader.field),
|
|
162
172
|
class: "block",
|
|
163
|
-
title: String(n(e.row,
|
|
173
|
+
title: String(n(e.row, s.value.primaryHeader.field))
|
|
164
174
|
}, null, 8, ["value", "title"])) : (i(), o("span", {
|
|
165
175
|
key: 2,
|
|
166
176
|
class: "block text-sm font-semibold truncate",
|
|
167
|
-
title: String(n(e.row,
|
|
168
|
-
innerHTML:
|
|
169
|
-
|
|
170
|
-
n(e.row,
|
|
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),
|
|
171
181
|
e.row
|
|
172
182
|
)
|
|
173
|
-
}, null, 8,
|
|
183
|
+
}, null, 8, ne))
|
|
174
184
|
], !0)
|
|
175
185
|
], 2)) : c("", !0)
|
|
176
186
|
]),
|
|
177
|
-
|
|
187
|
+
s.value.bodyHeaders.length ? (i(), o("div", {
|
|
178
188
|
key: 0,
|
|
179
189
|
class: "flex flex-col gap-2.5 px-3 py-3 min-w-0",
|
|
180
190
|
onClick: b
|
|
181
191
|
}, [
|
|
182
|
-
(i(!0), o(C, null,
|
|
192
|
+
(i(!0), o(C, null, B(s.value.bodyHeaders, (t) => (i(), o("div", {
|
|
183
193
|
key: t.field,
|
|
184
194
|
class: "flex items-start justify-between gap-7 min-w-0"
|
|
185
195
|
}, [
|
|
186
|
-
T(t) ? (i(), o("span",
|
|
196
|
+
T(t) ? (i(), o("span", ae, K(T(t)), 1)) : c("", !0),
|
|
187
197
|
g("div", {
|
|
188
|
-
class:
|
|
189
|
-
|
|
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),
|
|
190
200
|
T(t) ? "" : "w-full text-left justify-start"
|
|
191
201
|
]])
|
|
192
202
|
}, [
|
|
@@ -196,7 +206,7 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
|
|
|
196
206
|
index: e.index,
|
|
197
207
|
field: t.field
|
|
198
208
|
}, () => [
|
|
199
|
-
t.type === "price" ? (i(), u(
|
|
209
|
+
t.type === "price" ? (i(), u(F, {
|
|
200
210
|
key: 0,
|
|
201
211
|
value: n(e.row, t.field),
|
|
202
212
|
class: "block",
|
|
@@ -210,21 +220,21 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
|
|
|
210
220
|
key: 2,
|
|
211
221
|
class: "block",
|
|
212
222
|
title: String(n(e.row, t.field)),
|
|
213
|
-
innerHTML:
|
|
214
|
-
}, null, 8,
|
|
223
|
+
innerHTML: v(t, n(e.row, t.field), e.row)
|
|
224
|
+
}, null, 8, oe))
|
|
215
225
|
], !0)
|
|
216
226
|
], 2)
|
|
217
227
|
]))), 128))
|
|
218
228
|
])) : c("", !0),
|
|
219
|
-
|
|
229
|
+
s.value.actionHeaders.length ? (i(), o("div", {
|
|
220
230
|
key: 1,
|
|
221
231
|
class: "flex items-center justify-end gap-1 flex-wrap px-2 py-2 border-t",
|
|
222
|
-
onClick: a[2] || (a[2] =
|
|
232
|
+
onClick: a[2] || (a[2] = y(() => {
|
|
223
233
|
}, ["stop"]))
|
|
224
234
|
}, [
|
|
225
|
-
(i(!0), o(C, null,
|
|
235
|
+
(i(!0), o(C, null, B(s.value.actionHeaders, (t) => (i(), o("div", {
|
|
226
236
|
key: t.field,
|
|
227
|
-
class:
|
|
237
|
+
class: f(["min-w-0 flex items-center justify-end gap-0.5", x(t, n(e.row, t.field), e.row)])
|
|
228
238
|
}, [
|
|
229
239
|
S(l.$slots, t.field, {
|
|
230
240
|
value: n(e.row, t.field),
|
|
@@ -234,14 +244,14 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
|
|
|
234
244
|
}, () => [
|
|
235
245
|
g("span", {
|
|
236
246
|
class: "block",
|
|
237
|
-
innerHTML:
|
|
238
|
-
}, null, 8,
|
|
247
|
+
innerHTML: v(t, n(e.row, t.field), e.row)
|
|
248
|
+
}, null, 8, de)
|
|
239
249
|
], !0)
|
|
240
250
|
], 2))), 128))
|
|
241
251
|
])) : c("", !0)
|
|
242
|
-
], 14,
|
|
252
|
+
], 14, le)) : (i(), o("tr", {
|
|
243
253
|
key: 1,
|
|
244
|
-
class:
|
|
254
|
+
class: f(["border-b data-[state=selected]:bg-muted h-full", [
|
|
245
255
|
e.hoverable ? "hover:bg-muted/20" : "",
|
|
246
256
|
e.striped && e.index % 2 === 1 ? "bg-muted/20" : "bg-background",
|
|
247
257
|
e.isSelected ? "bg-muted! hover:bg-muted/30" : "",
|
|
@@ -253,80 +263,83 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
|
|
|
253
263
|
e.selectable ? (i(), o("td", {
|
|
254
264
|
key: 0,
|
|
255
265
|
class: "px-0! py-1! align-middle text-center",
|
|
256
|
-
onClick: a[3] || (a[3] =
|
|
266
|
+
onClick: a[3] || (a[3] = y(() => {
|
|
257
267
|
}, ["stop"]))
|
|
258
268
|
}, [
|
|
259
|
-
g("div",
|
|
260
|
-
|
|
269
|
+
g("div", re, [
|
|
270
|
+
z(N, {
|
|
261
271
|
"model-value": e.isSelected,
|
|
262
272
|
indeterminate: e.isIndeterminate,
|
|
273
|
+
disabled: e.selectionDisabled,
|
|
263
274
|
size: "xs",
|
|
264
|
-
"onUpdate:modelValue":
|
|
265
|
-
}, null, 8, ["model-value", "indeterminate"])
|
|
275
|
+
"onUpdate:modelValue": D
|
|
276
|
+
}, null, 8, ["model-value", "indeterminate", "disabled"])
|
|
266
277
|
])
|
|
267
278
|
])) : c("", !0),
|
|
268
|
-
(i(!0), o(C, null,
|
|
279
|
+
(i(!0), o(C, null, B(e.headers, (t, r) => (i(), o("td", {
|
|
269
280
|
key: t.field,
|
|
270
|
-
class:
|
|
271
|
-
|
|
281
|
+
class: f(["align-middle", [
|
|
282
|
+
O(),
|
|
272
283
|
G(t),
|
|
284
|
+
e.columnResizing ? "whitespace-nowrap" : "whitespace-normal wrap-break-word",
|
|
273
285
|
t.hideOnMobile ? "hidden md:table-cell" : "",
|
|
274
|
-
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]",
|
|
275
287
|
// Keep overflow clip on data cells; last column (actions) must stay visible
|
|
276
|
-
|
|
288
|
+
r === e.headers.length - 1 ? "overflow-visible" : "overflow-hidden",
|
|
277
289
|
// Tree chrome overlays the whole first cell (incl. padding) so branch
|
|
278
290
|
// lines join seamlessly across rows. overflow-visible lets the connector
|
|
279
291
|
// overlay bleed across the collapsed row border for continuous trunks.
|
|
280
|
-
e.treeMode &&
|
|
281
|
-
|
|
292
|
+
e.treeMode && r === 0 ? "relative ps-0! overflow-visible!" : "",
|
|
293
|
+
x(t, n(e.row, t.field), e.row)
|
|
282
294
|
]]),
|
|
283
|
-
style: k(
|
|
284
|
-
e.treeMode ? void 0 : {
|
|
295
|
+
style: k([
|
|
296
|
+
e.treeMode || e.columnsFrozen ? void 0 : {
|
|
285
297
|
...t.width && !/(?:^|\s|:)w-/.test(t.width) ? { width: t.width } : {},
|
|
286
298
|
...t.minWidth && !/(?:^|\s|:)min-w-/.test(t.minWidth) ? { minWidth: t.minWidth } : {}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
|
|
299
|
+
},
|
|
300
|
+
q(r)
|
|
301
|
+
]),
|
|
302
|
+
onClick: (m) => e.treeMode && r === 0 && e.expandable ? h(m) : void 0
|
|
290
303
|
}, [
|
|
291
|
-
e.treeMode &&
|
|
292
|
-
|
|
304
|
+
e.treeMode && r === 0 ? (i(), o(C, { key: 0 }, [
|
|
305
|
+
z(H(Q), {
|
|
293
306
|
depth: e.depth,
|
|
294
307
|
"is-last-sibling": e.isLastSibling,
|
|
295
308
|
"ancestor-last-flags": e.ancestorLastFlags,
|
|
296
309
|
"has-toggle": e.expandable,
|
|
297
310
|
indent: e.treeIndent,
|
|
298
311
|
"base-inset": H(E),
|
|
299
|
-
"content-gap": H(
|
|
312
|
+
"content-gap": H(j),
|
|
300
313
|
"leaf-has-spacer": !1,
|
|
301
|
-
"leaf-inset": H(
|
|
314
|
+
"leaf-inset": H(A),
|
|
302
315
|
"bleed-y": ""
|
|
303
316
|
}, null, 8, ["depth", "is-last-sibling", "ancestor-last-flags", "has-toggle", "indent", "base-inset", "content-gap", "leaf-inset"]),
|
|
304
317
|
e.expandable ? (i(), o("button", {
|
|
305
318
|
key: 0,
|
|
306
319
|
type: "button",
|
|
307
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",
|
|
308
|
-
style: k({ insetInlineStart:
|
|
321
|
+
style: k({ insetInlineStart: Z.value + "px" }),
|
|
309
322
|
"aria-expanded": e.expanded,
|
|
310
|
-
onClick:
|
|
323
|
+
onClick: y(h, ["stop"])
|
|
311
324
|
}, [
|
|
312
|
-
e.treeLoading ? (i(), u(
|
|
325
|
+
e.treeLoading ? (i(), u(M, {
|
|
313
326
|
key: 0,
|
|
314
327
|
icon: "lucide:loader-2",
|
|
315
328
|
class: "h-4 w-4 animate-spin"
|
|
316
|
-
})) : (i(), u(
|
|
329
|
+
})) : (i(), u(M, {
|
|
317
330
|
key: 1,
|
|
318
|
-
icon: e.expanded ? "lucide:chevron-down" :
|
|
331
|
+
icon: e.expanded ? "lucide:chevron-down" : R.value,
|
|
319
332
|
class: "h-4 w-4"
|
|
320
333
|
}, null, 8, ["icon"]))
|
|
321
|
-
], 12,
|
|
334
|
+
], 12, ce)) : c("", !0)
|
|
322
335
|
], 64)) : c("", !0),
|
|
323
336
|
g("div", {
|
|
324
|
-
class:
|
|
337
|
+
class: f([
|
|
325
338
|
"tree-row-content w-full min-w-0",
|
|
326
|
-
e.treeMode &&
|
|
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"
|
|
327
340
|
]),
|
|
328
341
|
style: k(
|
|
329
|
-
e.treeMode &&
|
|
342
|
+
e.treeMode && r === 0 ? { paddingInlineStart: p.value + "px" } : void 0
|
|
330
343
|
)
|
|
331
344
|
}, [
|
|
332
345
|
S(l.$slots, t.field, {
|
|
@@ -335,7 +348,7 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
|
|
|
335
348
|
index: e.index,
|
|
336
349
|
field: t.field
|
|
337
350
|
}, () => [
|
|
338
|
-
t.type === "price" ? (i(), u(
|
|
351
|
+
t.type === "price" ? (i(), u(F, {
|
|
339
352
|
key: 0,
|
|
340
353
|
value: n(e.row, t.field),
|
|
341
354
|
class: "block",
|
|
@@ -347,16 +360,16 @@ const te = ["data-state"], le = ["aria-expanded"], ie = ["title", "innerHTML"],
|
|
|
347
360
|
title: String(n(e.row, t.field))
|
|
348
361
|
}, null, 8, ["value", "title"])) : (i(), o("span", {
|
|
349
362
|
key: 2,
|
|
350
|
-
class: "block",
|
|
363
|
+
class: f(["block", e.columnResizing ? "truncate" : ""]),
|
|
351
364
|
title: String(n(e.row, t.field)),
|
|
352
|
-
innerHTML:
|
|
353
|
-
}, null,
|
|
365
|
+
innerHTML: v(t, n(e.row, t.field), e.row)
|
|
366
|
+
}, null, 10, fe))
|
|
354
367
|
], !0)
|
|
355
368
|
], 6)
|
|
356
|
-
], 14,
|
|
357
|
-
], 10,
|
|
369
|
+
], 14, ue))), 128))
|
|
370
|
+
], 10, se));
|
|
358
371
|
}
|
|
359
372
|
});
|
|
360
373
|
export {
|
|
361
|
-
|
|
374
|
+
He as default
|
|
362
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
|
+
};
|