@ithinkdt/ui 4.0.16 → 4.0.18
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/auto-imports.js +6 -3
- package/esm/{DataTable-DXZ3G4ZO.js → DataTable-CMFYAmRF.js} +88 -48
- package/esm/components-BHfgt7FW.js +2167 -0
- package/esm/components.d.ts +159 -67
- package/esm/components.js +2 -1629
- package/esm/design.d.ts +0 -6
- package/esm/directives.js +1 -1
- package/esm/index.js +109 -151
- package/esm/page.d.ts +2 -1
- package/esm/page.js +94 -85
- package/package.json +10 -10
- package/esm/assets-bJgPKDh1.js +0 -187
- /package/esm/{directives-g3YmS-dM.js → directives-Chz4DK1u.js} +0 -0
- /package/esm/{use-i18n-D1TTDOML.js → use-i18n-BUP_StIp.js} +0 -0
package/auto-imports.js
CHANGED
|
@@ -14,8 +14,8 @@ export const UIComponents = [
|
|
|
14
14
|
type: 'component',
|
|
15
15
|
resolve(name) {
|
|
16
16
|
return [
|
|
17
|
-
'DataTable', 'DataForm', 'DataFormActions', 'DataCustom', 'DataFilter', 'DataSelection', 'DataPagination',
|
|
18
|
-
'DataDescriptions', 'NCheckboxes', 'NRadios', 'NStateButton',
|
|
17
|
+
'DataTable', 'DataForm', 'DataFormActions', 'DataCustom', 'ViewProfile', 'DataFilter', 'DataSelection', 'DataPagination',
|
|
18
|
+
'DataDescriptions', 'NCheckboxes', 'NRadios', 'NStateButton', 'FullscreenButton', 'FullscreenWrapper',
|
|
19
19
|
].includes(name)
|
|
20
20
|
? { name, from: '@ithinkdt/ui/components' }
|
|
21
21
|
: undefined
|
|
@@ -30,7 +30,10 @@ export const UI = [
|
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
from: '@ithinkdt/ui/components',
|
|
33
|
-
imports: [
|
|
33
|
+
imports: [
|
|
34
|
+
'DataTable', 'DataForm', 'DataFormActions', 'DataCustom', 'ViewProfile', 'DataFilter', 'DataSelection', 'DataPagination',
|
|
35
|
+
'DataDescriptions', 'NCheckboxes', 'NRadios', 'NStateButton', 'FullscreenButton', 'FullscreenWrapper',
|
|
36
|
+
],
|
|
34
37
|
},
|
|
35
38
|
]
|
|
36
39
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import e, { c as t, cB as n, cE as r, cM as i, useClsPrefix as a } from "./use-style.js";
|
|
2
|
-
import { i as o } from "./directives-
|
|
3
|
-
import {
|
|
2
|
+
import { i as o } from "./directives-Chz4DK1u.js";
|
|
3
|
+
import { C as s } from "./components-BHfgt7FW.js";
|
|
4
4
|
import { computed as c, createVNode as l, defineComponent as u, inject as d, isVNode as f, ref as p, shallowRef as m, toValue as h, useTemplateRef as g, watch as _, withDirectives as v } from "vue";
|
|
5
5
|
import { toReactive as y, until as b } from "@vueuse/core";
|
|
6
6
|
import { NButton as x, NDataTable as S, NFlex as C, NIcon as w, NTooltip as T, dataTableProps as E } from "ithinkdt-ui";
|
|
7
|
-
import {
|
|
7
|
+
import { useTableRangeSelect as D } from "@ithinkdt/common/composables";
|
|
8
|
+
import { PAGE_INJECTION as O } from "@ithinkdt/page";
|
|
8
9
|
//#region src/components/DataTable.jsx
|
|
9
|
-
function
|
|
10
|
+
function k(e) {
|
|
10
11
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
+
function A(e, t) {
|
|
13
14
|
return (e ?? []).map((e) => {
|
|
14
15
|
let n = {
|
|
15
16
|
csvTitle: e.exportTitle,
|
|
@@ -35,7 +36,7 @@ function k(e, t) {
|
|
|
35
36
|
})] }) : n;
|
|
36
37
|
}
|
|
37
38
|
};
|
|
38
|
-
if (e.children?.length) n.children =
|
|
39
|
+
if (e.children?.length) n.children = A(e.children, t);
|
|
39
40
|
else {
|
|
40
41
|
e.hidden !== !0 && (n.width ??= 100, t.value += Number(n.width));
|
|
41
42
|
let r = e.render ?? ((e) => e);
|
|
@@ -63,7 +64,7 @@ function k(e, t) {
|
|
|
63
64
|
return n.key === "$actions" && (n.cellProps ??= () => ({ style: { padding: "0 2px" } })), n;
|
|
64
65
|
}).filter((e) => e?.hidden !== !0);
|
|
65
66
|
}
|
|
66
|
-
var
|
|
67
|
+
var j = /* @__PURE__ */ u({
|
|
67
68
|
name: "DataTable",
|
|
68
69
|
props: {
|
|
69
70
|
data: {
|
|
@@ -80,6 +81,10 @@ var A = /* @__PURE__ */ u({
|
|
|
80
81
|
default: () => ({})
|
|
81
82
|
},
|
|
82
83
|
selectedKeys: { type: Array },
|
|
84
|
+
rangeSelect: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: void 0
|
|
87
|
+
},
|
|
83
88
|
highlight: {
|
|
84
89
|
type: [
|
|
85
90
|
Boolean,
|
|
@@ -105,8 +110,8 @@ var A = /* @__PURE__ */ u({
|
|
|
105
110
|
"highlight"
|
|
106
111
|
],
|
|
107
112
|
setup(t, { slots: n, emit: r, expose: i }) {
|
|
108
|
-
let { keyField: o } = d(
|
|
109
|
-
e("-datatable",
|
|
113
|
+
let { keyField: o } = d(O), s = a(), u = `${s.value}-datatable`;
|
|
114
|
+
e("-datatable", M, s);
|
|
110
115
|
let f = g("table-ref"), h = ({ sortField: e, sortOrder: t } = {}, n) => {
|
|
111
116
|
e == n?.sortField && t == n?.sortOrder || f.value?.sort(e, t ? t + "end" : !1);
|
|
112
117
|
};
|
|
@@ -136,10 +141,10 @@ var A = /* @__PURE__ */ u({
|
|
|
136
141
|
}), i(y(x));
|
|
137
142
|
let C = p(0), w = m([]);
|
|
138
143
|
_(() => t.columns, () => {
|
|
139
|
-
C.value = 0, w.value =
|
|
144
|
+
C.value = 0, w.value = A(t.columns, C);
|
|
140
145
|
}, {
|
|
141
146
|
immediate: !0,
|
|
142
|
-
deep:
|
|
147
|
+
deep: 2
|
|
143
148
|
});
|
|
144
149
|
let T = p();
|
|
145
150
|
_(() => t.highlight, (e) => {
|
|
@@ -149,7 +154,7 @@ var A = /* @__PURE__ */ u({
|
|
|
149
154
|
t.rowClassName?.(e, n) || "",
|
|
150
155
|
`${u}__row-marker`,
|
|
151
156
|
T.value != null && v.value(e) === T.value ? `${u}__row-highlight` : ""
|
|
152
|
-
].join(" ")),
|
|
157
|
+
].join(" ")), j = c(() => (e, n) => {
|
|
153
158
|
let i = t.rowProps?.(e, n);
|
|
154
159
|
return {
|
|
155
160
|
...i,
|
|
@@ -159,7 +164,7 @@ var A = /* @__PURE__ */ u({
|
|
|
159
164
|
t.highlight === !0 && (T.value = a), r("highlight", a), i?.onClick?.(n);
|
|
160
165
|
}
|
|
161
166
|
};
|
|
162
|
-
}),
|
|
167
|
+
}), N = (e) => {
|
|
163
168
|
if (t.sorter) {
|
|
164
169
|
let { sortField: n, sortOrder: r } = t.sorter;
|
|
165
170
|
if (e?.columnKey == n && (e?.order ? e.order === r + "end" : !r)) return;
|
|
@@ -168,54 +173,89 @@ var A = /* @__PURE__ */ u({
|
|
|
168
173
|
sortField: e?.order ? e?.columnKey : void 0,
|
|
169
174
|
sortOrder: e?.order ? e.order.replace("end", "") : void 0
|
|
170
175
|
});
|
|
171
|
-
},
|
|
176
|
+
}, P = (e) => {
|
|
172
177
|
r("select", e);
|
|
173
|
-
},
|
|
178
|
+
}, F = (e, t, n) => {
|
|
174
179
|
r("custom", {
|
|
175
180
|
key: n.key,
|
|
176
181
|
width: e
|
|
177
182
|
});
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
183
|
+
}, { range: I, pause: L, resume: R } = D(f, {
|
|
184
|
+
immediate: t.rangeSelect,
|
|
185
|
+
clsPrefix: c(() => `${s.value}-`)
|
|
186
|
+
});
|
|
187
|
+
return _(() => t.rangeSelect, (e) => {
|
|
188
|
+
e ? R() : L();
|
|
189
|
+
}), () => l(S, {
|
|
190
|
+
ref: "table-ref",
|
|
191
|
+
class: [
|
|
192
|
+
u,
|
|
193
|
+
t.appear === "sticky" ? `${u}--sticky` : "",
|
|
194
|
+
I.value?.ing ? `${u}--cell-selecting` : ""
|
|
195
|
+
],
|
|
181
196
|
data: t.data,
|
|
182
197
|
columns: w.value,
|
|
183
198
|
rowKey: v.value,
|
|
184
199
|
tableLayout: "fixed",
|
|
185
|
-
ref: "table-ref",
|
|
186
200
|
scrollX: C.value,
|
|
187
201
|
rowClassName: E.value,
|
|
188
|
-
rowProps:
|
|
202
|
+
rowProps: j.value,
|
|
189
203
|
checkedRowKeys: t.selectedKeys,
|
|
190
204
|
style: { "--n-tr-highlight-color": t.highlightColor },
|
|
191
205
|
maxHeight: t.maxHeight ?? (t.appear === "sticky" ? "auto" : void 0),
|
|
192
|
-
onUpdateSorter:
|
|
193
|
-
onUpdateCheckedRowKeys:
|
|
194
|
-
onUnstableColumnResize:
|
|
195
|
-
},
|
|
206
|
+
onUpdateSorter: N,
|
|
207
|
+
onUpdateCheckedRowKeys: P,
|
|
208
|
+
onUnstableColumnResize: F
|
|
209
|
+
}, k(n) ? n : { default: () => [n] });
|
|
196
210
|
}
|
|
197
|
-
}),
|
|
198
|
-
t("
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
211
|
+
}), M = /* @__PURE__ */ n("datatable", [
|
|
212
|
+
r("row-highlight", [t("& > td", { backgroundColor: "var(--n-tr-highlight-color, var(--n-merged-border-color)) !important" })]),
|
|
213
|
+
i("cell-selecting", { userSelect: "none" }),
|
|
214
|
+
n("cell-selected", { position: "relative" }, [
|
|
215
|
+
t("&:not(.n-data-table-td--fixed-right)::before, &:is(.n-data-table-td--fixed-right)::after", {
|
|
216
|
+
content: "' '",
|
|
217
|
+
position: "absolute",
|
|
218
|
+
zIndex: 2,
|
|
219
|
+
top: 0,
|
|
220
|
+
left: 0,
|
|
221
|
+
width: "100%",
|
|
222
|
+
height: "100%",
|
|
223
|
+
background: "color-mix(in srgb, var(--color-primary) 30%, transparent)",
|
|
224
|
+
borderStyle: "solid",
|
|
225
|
+
borderWidth: "1px",
|
|
226
|
+
borderTopColor: "var(--n-cell-selected-border-top-color, transparent)",
|
|
227
|
+
borderBottomColor: "var(--n-cell-selected-border-bottom-color, transparent)",
|
|
228
|
+
borderLeftColor: "var(--n-cell-selected-border-left-color, transparent)",
|
|
229
|
+
borderRightColor: "var(--n-cell-selected-border-right-color, transparent)"
|
|
230
|
+
}),
|
|
231
|
+
i("first-row", { "--n-cell-selected-border-top-color": "var(--color-primary)" }),
|
|
232
|
+
i("first-col", { "--n-cell-selected-border-left-color": "var(--color-primary)" }),
|
|
233
|
+
i("last-row", { "--n-cell-selected-border-bottom-color": "var(--color-primary)" }),
|
|
234
|
+
i("last-col", { "--n-cell-selected-border-right-color": "var(--color-primary)" })
|
|
235
|
+
]),
|
|
236
|
+
i("sticky", [
|
|
237
|
+
t(".n-data-table-base-table-header", {
|
|
238
|
+
position: "sticky",
|
|
239
|
+
top: "-1px",
|
|
240
|
+
zIndex: 10,
|
|
241
|
+
overflowY: "hidden"
|
|
242
|
+
}),
|
|
243
|
+
t(".n-data-table-base-table-body", { overflow: "initial" }, [t("& > .n-scrollbar-container", {
|
|
244
|
+
overflow: "initial",
|
|
245
|
+
overflowX: "scroll"
|
|
246
|
+
}), t("& > .n-scrollbar-rail--horizontal", {
|
|
247
|
+
position: "sticky",
|
|
248
|
+
bottom: "0"
|
|
249
|
+
})]),
|
|
250
|
+
t(".n-data-table-base-table:has(.n-data-table-empty) .n-data-table-base-table-header", {
|
|
251
|
+
scrollbarWidth: "thin",
|
|
252
|
+
overflowX: "auto"
|
|
253
|
+
}),
|
|
254
|
+
t(".n-data-table-td > *", {
|
|
255
|
+
verticalAlign: "middle",
|
|
256
|
+
contentVisibility: "auto"
|
|
257
|
+
})
|
|
258
|
+
])
|
|
259
|
+
]);
|
|
220
260
|
//#endregion
|
|
221
|
-
export {
|
|
261
|
+
export { j as DataTable };
|