@ithinkdt/ui 4.0.17 → 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.
@@ -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
2
  import { i as o } from "./directives-Chz4DK1u.js";
3
- import { C as s } from "./components-DfV9ybsT.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,7 +141,7 @@ 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
147
  deep: 2
@@ -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 };
@@ -2162,6 +2162,6 @@ var Mt = /* @__PURE__ */ d({
2162
2162
  });
2163
2163
  };
2164
2164
  }
2165
- }), It = u(() => import("./DataTable-BvLINmq3.js").then((e) => e.DataTable));
2165
+ }), It = u(() => import("./DataTable-CMFYAmRF.js").then((e) => e.DataTable));
2166
2166
  //#endregion
2167
2167
  export { Re as C, ot as S, gt as _, jt as a, pt as b, At as c, Tt as d, Ct as f, _t as g, yt as h, Mt as i, Ot as l, bt as m, Ft as n, Nt as o, X as p, Pt as r, $ as s, It as t, Et as u, Y as v, Le as w, ct as x, J as y };
@@ -227,6 +227,7 @@ export interface DataTableProps<Data extends {}, KeyField extends keyof Data>
227
227
  data?: ArrayLike<Data> | undefined
228
228
  keyField?: KeyField | undefined
229
229
  selectedKeys?: ArrayLike<Data[KeyField]> | undefined
230
+ rangeSelect?: boolean | undefined
230
231
  highlight?: boolean | Data[KeyField] | undefined
231
232
  highlightColor?: string | undefined
232
233
  appear?: 'normal' | 'sticky' | undefined
package/esm/components.js CHANGED
@@ -1,2 +1,2 @@
1
- import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, s as g, t as _, u as v, v as y, w as b, x, y as S } from "./components-DfV9ybsT.js";
1
+ import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, s as g, t as _, u as v, v as y, w as b, x, y as S } from "./components-BHfgt7FW.js";
2
2
  export { e as DataActions, x as DataCustom, r as DataDescriptions, s as DataFilter, t as DataForm, y as DataFormActions, d as DataLocaleInput, m as DataPagination, a as DataSelection, _ as DataTable, l as DtDeptRender, n as DtUserDept, p as DtUserRender, v as FullscreenButton, u as FullscreenWrapper, b as NCheckboxes, i as NRadios, f as NStateButton, h as StateButtonProps, o as ViewProfile, S as dataFormActionsProps, g as renderUsers, c as useLocaleEdit };
package/esm/page.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as e } from "./use-i18n-BUP_StIp.js";
2
- import { _ as t, a as n, c as r, i, o as a, w as o } from "./components-DfV9ybsT.js";
2
+ import { _ as t, a as n, c as r, i, o as a, w as o } from "./components-BHfgt7FW.js";
3
3
  import { computed as s, createVNode as c, defineAsyncComponent as l, defineComponent as u, h as d, isVNode as f, mergeProps as p, nextTick as m, ref as h, renderSlot as g, shallowRef as _, toValue as v, unref as y } from "vue";
4
4
  import { until as b, useClipboard as x } from "@vueuse/core";
5
5
  import { NButton as S, NCheckbox as C, NColorPicker as w, NDrawer as T, NDrawerContent as E, NFlex as D, NIcon as O, NInput as k, NInputNumber as A, NModal as j, NScrollbar as M, NSelect as N, NText as P, NUpload as F, useMessage as I } from "ithinkdt-ui";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ithinkdt/ui",
3
- "version": "4.0.17",
3
+ "version": "4.0.18",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "iThinkDT UI",
@@ -62,12 +62,12 @@
62
62
  "sideEffects": false,
63
63
  "dependencies": {
64
64
  "@vueuse/core": "^14.3.0",
65
- "date-fns": "^4.3.0",
65
+ "date-fns": "^4.4.0",
66
66
  "vueuc": ">=0.4.65",
67
67
  "sortablejs": "^1.15.7",
68
68
  "@types/sortablejs": "^1.15.9",
69
69
  "nanoid": "^5.1.11",
70
- "@ithinkdt/common": "^4.0.9"
70
+ "@ithinkdt/common": "^4.0.10"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "@ithinkdt/page": ">=4.0",
@@ -89,11 +89,11 @@
89
89
  "ithinkdt-ui": "^1.9.4",
90
90
  "typescript": "~6.0.3",
91
91
  "unocss": "^66.7.0",
92
- "vite": "^8.0.14",
93
- "vue": "^3.5.34",
94
- "vue-router": "^5.0.7",
95
- "@vue/test-utils": "^2.4.10",
96
- "@ithinkdt/page": "^4.0.20"
92
+ "vite": "^8.0.16",
93
+ "vue": "^3.5.35",
94
+ "vue-router": "^5.1.0",
95
+ "@vue/test-utils": "^2.4.11",
96
+ "@ithinkdt/page": "^4.0.22"
97
97
  },
98
98
  "scripts": {
99
99
  "dev": "vite build --watch",