@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 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: ['DataTable', 'DataForm', 'DataCustom', 'DataFilter', 'DataSelection', 'DataPagination', 'DataDescriptions'],
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-g3YmS-dM.js";
3
- import { l as s } from "./assets-bJgPKDh1.js";
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 { PAGE_INJECTION as D } from "@ithinkdt/page";
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 O(e) {
10
+ function k(e) {
10
11
  return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
11
12
  }
12
- function k(e, t) {
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 = k(e.children, t);
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 A = /* @__PURE__ */ u({
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(D), s = a(), u = `${s.value}-datatable`;
109
- e("-datatable", j, s);
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 = k(t.columns, C);
144
+ C.value = 0, w.value = A(t.columns, C);
140
145
  }, {
141
146
  immediate: !0,
142
- deep: 1
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(" ")), A = c(() => (e, n) => {
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
- }), M = (e) => {
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
- }, N = (e) => {
176
+ }, P = (e) => {
172
177
  r("select", e);
173
- }, P = (e, t, n) => {
178
+ }, F = (e, t, n) => {
174
179
  r("custom", {
175
180
  key: n.key,
176
181
  width: e
177
182
  });
178
- };
179
- return () => l(S, {
180
- class: [u, t.appear === "sticky" ? `${u}--sticky` : ""],
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: A.value,
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: M,
193
- onUpdateCheckedRowKeys: N,
194
- onUnstableColumnResize: P
195
- }, O(n) ? n : { default: () => [n] });
206
+ onUpdateSorter: N,
207
+ onUpdateCheckedRowKeys: P,
208
+ onUnstableColumnResize: F
209
+ }, k(n) ? n : { default: () => [n] });
196
210
  }
197
- }), j = /* @__PURE__ */ n("datatable", [r("row-highlight", [t("& > td", { backgroundColor: "var(--n-tr-highlight-color, var(--n-merged-border-color)) !important" })]), i("sticky", [
198
- t(".n-data-table-base-table-header", {
199
- position: "sticky",
200
- top: "-1px",
201
- zIndex: 10,
202
- overflowY: "hidden"
203
- }),
204
- t(".n-data-table-base-table-body", { overflow: "initial" }, [t("& > .n-scrollbar-container", {
205
- overflow: "initial",
206
- overflowX: "scroll"
207
- }), t("& > .n-scrollbar-rail--horizontal", {
208
- position: "sticky",
209
- bottom: "0"
210
- })]),
211
- t(".n-data-table-base-table:has(.n-data-table-empty) .n-data-table-base-table-header", {
212
- scrollbarWidth: "thin",
213
- overflowX: "auto"
214
- }),
215
- t(".n-data-table-td > *", {
216
- verticalAlign: "middle",
217
- contentVisibility: "auto"
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 { A as DataTable };
261
+ export { j as DataTable };