@ithinkdt/ui 4.0.9 → 4.0.11

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,5 +1,5 @@
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-pwYPe_53.js";
2
+ import { i as o } from "./directives-g3YmS-dM.js";
3
3
  import { l as s } from "./assets-bJgPKDh1.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";
@@ -1,6 +1,6 @@
1
1
  import { n as e } from "./use-i18n-D1TTDOML.js";
2
2
  import t, { cB as n, cE as r, useClsPrefix as i } from "./use-style.js";
3
- import { i as a } from "./directives-pwYPe_53.js";
3
+ import { i as a } from "./directives-g3YmS-dM.js";
4
4
  import { _ as o, a as s, c, d as l, f as u, g as d, h as f, i as p, l as m, m as h, n as g, o as _, p as v, r as y, s as b, t as x, u as S, v as C } from "./assets-bJgPKDh1.js";
5
5
  import { Fragment as w, computed as T, createTextVNode as E, createVNode as D, defineAsyncComponent as O, defineComponent as k, h as A, inject as ee, isVNode as j, markRaw as M, mergeProps as N, nextTick as te, reactive as P, ref as F, renderSlot as I, shallowRef as ne, toRaw as re, toRef as ie, toValue as L, unref as ae, watch as R, withDirectives as oe } from "vue";
6
6
  import { until as se } from "@vueuse/core";
@@ -1616,6 +1616,6 @@ var ht = /* @__PURE__ */ k({
1616
1616
  });
1617
1617
  };
1618
1618
  }
1619
- }), yt = O(() => import("./DataTable-DEb9CRCZ.js").then((e) => e.DataTable));
1619
+ }), yt = O(() => import("./DataTable-C5hx-Wo8.js").then((e) => e.DataTable));
1620
1620
  //#endregion
1621
1621
  export { Je as DataActions, Xe as DataCustom, tt as DataDescriptions, ot as DataFilter, at as DataForm, rt as DataFormActions, lt as DataLocaleInput, X as DataPagination, dt as DataSelection, yt as DataTable, ht as DtDeptRender, mt as DtUserDept, gt as DtUserRender, qe as NCheckboxes, pt as NRadios, vt as NStateButton, _t as StateButtonProps, Y as dataFormActionsProps, $ as renderUsers, ct as useLocaleEdit };
@@ -12,7 +12,11 @@ var C = [
12
12
  3,
13
13
  5
14
14
  ], w = /* @__PURE__ */ t([
15
- t(({ props: e }) => `:where(span${e.bPrefix}tooltip-host)`, { display: "inline-block" }),
15
+ ...[
16
+ "span",
17
+ "a",
18
+ "img"
19
+ ].map((e) => t(({ props: t }) => `:where(${e}${t.bPrefix}tooltip-host)`, { display: "inline-block" })),
16
20
  t(({ props: e }) => `:where(${e.bPrefix}tooltip-host)`, {
17
21
  maxWidth: "100%",
18
22
  whiteSpace: "nowrap",
@@ -1,2 +1,2 @@
1
- import { i as e, n as t, r as n, t as r } from "./directives-pwYPe_53.js";
1
+ import { i as e, n as t, r as n, t as r } from "./directives-g3YmS-dM.js";
2
2
  export { r as SpinDirectiveProvider, n as TooltipDirectiveProvider, t as vSpin, e as vTooltip };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { n as e, t } from "./use-i18n-D1TTDOML.js";
2
2
  import n, { c as r, cB as i, cE as a, cM as o } from "./use-style.js";
3
- import { i as s, n as c, r as l, t as u } from "./directives-pwYPe_53.js";
3
+ import { i as s, n as c, r as l, t as u } from "./directives-g3YmS-dM.js";
4
4
  import { Fragment as d, computed as f, createVNode as p, defineComponent as m, inject as h, isVNode as g, mergeProps as _, provide as v, reactive as y, ref as b, renderSlot as x, shallowRef as ee, toRef as S, toValue as C, unref as w, useTemplateRef as T, watch as E, withDirectives as D } from "vue";
5
5
  import { computedAsync as te, promiseTimeout as O, useElementHover as k, useElementSize as ne, useEventListener as re, useFullscreen as ie, watchDebounced as ae } from "@vueuse/core";
6
6
  import { NAvatar as A, NBadge as oe, NBreadcrumb as se, NBreadcrumbItem as ce, NButton as j, NDrawer as le, NDrawerContent as M, NDropdown as N, NEmpty as P, NIcon as F, NList as I, NListItem as L, NMenu as R, NPagination as z, NPopover as B, NScrollbar as V, NText as H, NThing as U, useThemeVars as W } from "ithinkdt-ui";
@@ -169,7 +169,7 @@ var ge = /* @__PURE__ */ m({
169
169
  { bottom: !0 }
170
170
  ]]);
171
171
  }
172
- }), q = "APP_SIDER_COLLAPSED", J = () => p("svg", {
172
+ }), q = "APP_SIDEBAR_COLLAPSED", J = () => p("svg", {
173
173
  xmlns: "http://www.w3.org/2000/svg",
174
174
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
175
175
  role: "img",
@@ -291,7 +291,7 @@ var ye = /* @__PURE__ */ m({
291
291
  }), Se = /* @__PURE__ */ r([
292
292
  i("layout", {
293
293
  display: "grid",
294
- gridTemplateAreas: "\n 'sider header'\n 'sider content'\n 'sider footer'\n ",
294
+ gridTemplateAreas: "\n 'sidebar header'\n 'sidebar content'\n 'sidebar footer'\n ",
295
295
  gridTemplateRows: "auto 1fr auto",
296
296
  gridTemplateColumns: "auto 1fr",
297
297
  position: "relative",
@@ -299,10 +299,10 @@ var ye = /* @__PURE__ */ m({
299
299
  left: "0",
300
300
  transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
301
301
  "--app-content-height": "calc(100vh - var(--app-header-height) - var(--app-footer-height))"
302
- }, [o("full-header", { gridTemplateAreas: "\n 'header header'\n 'sider content'\n 'sider footer'\n " }), o("full-content", {
303
- width: "calc(100% + var(--app-sider-width))",
302
+ }, [o("full-header", { gridTemplateAreas: "\n 'header header'\n 'sidebar content'\n 'sidebar footer'\n " }), o("full-content", {
303
+ width: "calc(100% + var(--app-sidebar-width))",
304
304
  height: "calc(100% + var(--app-header-height))",
305
- left: "calc(-1 * var(--app-sider-width))",
305
+ left: "calc(-1 * var(--app-sidebar-width))",
306
306
  top: "calc(-1 * var(--app-header-height))"
307
307
  })]),
308
308
  i("header", {
@@ -311,9 +311,9 @@ var ye = /* @__PURE__ */ m({
311
311
  zIndex: 2,
312
312
  height: "var(--app-header-height, 44px)"
313
313
  }),
314
- i("sider", {
315
- gridArea: "sider",
316
- width: "var(--app-sider-width, 220px)",
314
+ i("sidebar", {
315
+ gridArea: "sidebar",
316
+ width: "var(--app-sidebar-width, 220px)",
317
317
  display: "flex",
318
318
  flexDirection: "column",
319
319
  overflow: "auto",
@@ -377,7 +377,7 @@ var ye = /* @__PURE__ */ m({
377
377
  setup(e, { slots: t }) {
378
378
  n("-layout", Se, b("app"), !1);
379
379
  let r = y({
380
- siderWidth: "0px",
380
+ sidebarWidth: "0px",
381
381
  headerHeight: "0px",
382
382
  footerHeight: "0px",
383
383
  hasMultiTab: !1
@@ -391,7 +391,7 @@ var ye = /* @__PURE__ */ m({
391
391
  "app-layout--full-content": e.fullContent
392
392
  },
393
393
  style: {
394
- "--app-sider-width": r.siderWidth,
394
+ "--app-sidebar-width": r.sidebarWidth,
395
395
  "--app-header-height": r.headerHeight,
396
396
  "--app-footer-height": r.footerHeight
397
397
  }
@@ -429,13 +429,13 @@ var ye = /* @__PURE__ */ m({
429
429
  setup(t, { emit: n, slots: r }) {
430
430
  v(q, S(t, "collapsed"));
431
431
  let { t: i } = e(), a = X();
432
- return () => (a.siderWidth = (t.collapsed ? t.collapsedWidth : t.width) + "px", p("div", { class: "app-sider" }, [x(r, "default"), t.showCollapseBtn ? D(p(j, {
433
- class: "app-sider__collapse-btn",
432
+ return () => (a.sidebarWidth = (t.collapsed ? t.collapsedWidth : t.width) + "px", p("div", { class: "app-sidebar" }, [x(r, "default"), t.showCollapseBtn ? D(p(j, {
433
+ class: "app-sidebar__collapse-btn",
434
434
  quaternary: !0,
435
435
  onClick: () => {
436
436
  n("update:collapsed", !t.collapsed);
437
437
  }
438
- }, { default: () => [p(F, { size: "20" }, { default: () => [t.collapsed ? p(we, null, null) : p(Ce, null, null)] })] }), [[s, t.collapsed ? i("common.layout.sider.expand") : i("common.layout.sider.collapse")]]) : void 0]));
438
+ }, { default: () => [p(F, { size: "20" }, { default: () => [t.collapsed ? p(we, null, null) : p(Ce, null, null)] })] }), [[s, t.collapsed ? i("common.layout.sidebar.expand") : i("common.layout.sidebar.collapse")]]) : void 0]));
439
439
  }
440
440
  }), Oe = /* @__PURE__ */ m({
441
441
  name: "AppContent",
@@ -497,8 +497,8 @@ var je = /* @__PURE__ */ m({
497
497
  }, [x(t, "default", void 0, () => [p("div", {
498
498
  class: "app-logo__img",
499
499
  style: `
500
- width: ${a ? "var(--app-sider-width, 60px)" : "56px"};
501
- font-size: ${a ? "calc(var(--app-sider-width, 60px) - 24px)" : "32px"};
500
+ width: ${a ? "var(--app-sidebar-width, 60px)" : "56px"};
501
+ font-size: ${a ? "calc(var(--app-sidebar-width, 60px) - 24px)" : "32px"};
502
502
  transition: width 0.2s ease-in-out 0.1s;
503
503
  flex: 0 0 auto;
504
504
  display: flex;
package/dist/page.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { n as e } from "./use-i18n-D1TTDOML.js";
2
2
  import { DataForm as t, DtDeptRender as n, DtUserDept as r, DtUserRender as i, NCheckboxes as a, NRadios as o } from "./components.js";
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
- import { until as b, useClipboard as x } from "@vueuse/core";
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";
3
+ import { computed as s, createVNode as c, defineComponent as l, h as u, isVNode as d, mergeProps as f, nextTick as p, ref as m, renderSlot as h, shallowRef as g, toValue as _, unref as v } from "vue";
4
+ import { until as y, useClipboard as b } from "@vueuse/core";
5
+ import { NButton as x, NCheckbox as S, NColorPicker as C, NDatePicker 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";
6
6
  import { nanoid as L } from "nanoid";
7
7
  import { format as R } from "date-fns";
8
8
  import { useFormItem as z } from "ithinkdt-ui/es/_mixins";
@@ -10,16 +10,16 @@ import { useModal as B } from "@ithinkdt/page";
10
10
  import { isNullish as V } from "@ithinkdt/common";
11
11
  import { useDict as H, useDictMap as U } from "@ithinkdt/common/dict";
12
12
  //#region src/page-util.js
13
- var W = (e) => Object.fromEntries(Object.entries(e || {}).map(([e, t]) => [e, y(t)]));
13
+ var W = (e) => Object.fromEntries(Object.entries(e || {}).map(([e, t]) => [e, v(t)]));
14
14
  //#endregion
15
15
  //#region src/page-description.jsx
16
16
  function G(e) {
17
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
17
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !d(e);
18
18
  }
19
19
  function K({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewFileUrl: a }) {
20
20
  let o = (e) => (t, n, { params: r = {} }) => {
21
21
  if (t != null) return R(t, r.formatter ?? e);
22
- }, s = (e = {}) => c("svg", p({
22
+ }, s = (e = {}) => c("svg", f({
23
23
  xmlns: "http://www.w3.org/2000/svg",
24
24
  width: "1em",
25
25
  height: "1em",
@@ -29,7 +29,7 @@ function K({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewF
29
29
  cy: "16",
30
30
  r: "8",
31
31
  fill: "currentColor"
32
- }, null)]), l = (e = {}) => c("svg", p({
32
+ }, null)]), l = (e = {}) => c("svg", f({
33
33
  xmlns: "http://www.w3.org/2000/svg",
34
34
  width: "1em",
35
35
  height: "1em",
@@ -37,7 +37,7 @@ function K({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewF
37
37
  }, e), [c("path", {
38
38
  fill: "currentColor",
39
39
  d: "M12 9a3 3 0 0 1 3 3a3 3 0 0 1-3 3a3 3 0 0 1-3-3a3 3 0 0 1 3-3m0-4.5c5 0 9.27 3.11 11 7.5c-1.73 4.39-6 7.5-11 7.5S2.73 16.39 1 12c1.73-4.39 6-7.5 11-7.5M3.18 12a9.821 9.821 0 0 0 17.64 0a9.821 9.821 0 0 0-17.64 0"
40
- }, null)]), u = (e) => c("svg", p({
40
+ }, null)]), u = (e) => c("svg", f({
41
41
  xmlns: "http://www.w3.org/2000/svg",
42
42
  width: "1em",
43
43
  height: "1em",
@@ -45,7 +45,7 @@ function K({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewF
45
45
  }, e), [c("path", {
46
46
  fill: "currentColor",
47
47
  d: "M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12z"
48
- }, null)]), d = (e) => c("svg", p({
48
+ }, null)]), d = (e) => c("svg", f({
49
49
  xmlns: "http://www.w3.org/2000/svg",
50
50
  width: "1em",
51
51
  height: "1em",
@@ -56,30 +56,30 @@ function K({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewF
56
56
  }, null)]);
57
57
  return {
58
58
  longtext: () => {
59
- let e = h(), t = h(), n = h(), { open: r } = B({
59
+ let e = m(), t = m(), n = m(), { open: r } = B({
60
60
  type: "drawer",
61
61
  resizable: !0,
62
62
  content: () => c("div", null, [c("span", null, [e.value])]),
63
63
  width: t,
64
64
  footer: () => n.value?.() ?? null,
65
65
  maskClosable: !0
66
- }), { copy: i, copied: a } = x({ legacy: !0 }), o = (t, n, o) => {
66
+ }), { copy: i, copied: a } = b({ legacy: !0 }), o = (t, n, o) => {
67
67
  if (!n) return r(t);
68
68
  let s = () => {
69
69
  o ? o(e.value) : i(e.value);
70
70
  };
71
- return r(() => c("div", { style: "display: flex; align-items: center; justify-content: space-between; margin-right: 4px;" }, [v(t), a.value ? c(S, {
71
+ return r(() => c("div", { style: "display: flex; align-items: center; justify-content: space-between; margin-right: 4px;" }, [_(t), a.value ? c(x, {
72
72
  quaternary: !0,
73
73
  size: "tiny",
74
74
  type: "success"
75
- }, { icon: () => c(O, { size: 18 }, { default: () => [c(d, null, null)] }) }) : c(S, {
75
+ }, { icon: () => c(O, { size: 18 }, { default: () => [c(d, null, null)] }) }) : c(x, {
76
76
  quaternary: !0,
77
77
  size: "tiny",
78
78
  onClick: s
79
79
  }, { icon: () => c(O, { size: 16 }, { default: () => [c(u, null, null)] }) })]));
80
80
  };
81
81
  return {
82
- renderer: (r, i, { params: a = {} }, { label: s }) => c("div", { style: "white-space: nowrap; overflow: hidden; display: flex; gap: 8px; align-items: center; justify-content: space-between" }, [c("div", { style: "flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" }, [r]), c(S, {
82
+ renderer: (r, i, { params: a = {} }, { label: s }) => c("div", { style: "white-space: nowrap; overflow: hidden; display: flex; gap: 8px; align-items: center; justify-content: space-between" }, [c("div", { style: "flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" }, [r]), c(x, {
83
83
  type: "info",
84
84
  text: !0,
85
85
  style: "position: sticky; right: 0; z-index: 2",
@@ -151,7 +151,7 @@ function K({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewF
151
151
  }),
152
152
  email: () => (e) => c("a", { href: `mailto:${e}` }, [e]),
153
153
  url: () => (e) => c("a", { href: e }, [e]),
154
- color: () => (e) => c(w, {
154
+ color: () => (e) => c(C, {
155
155
  value: e,
156
156
  disabled: !0,
157
157
  size: "small"
@@ -215,9 +215,9 @@ function K({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewF
215
215
  //#endregion
216
216
  //#region src/page-form.jsx
217
217
  function q(e) {
218
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
218
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !d(e);
219
219
  }
220
- var J = /* @__PURE__ */ l(() => import("ithinkdt-ui/es/date-picker")), Y = /* @__PURE__ */ u({
220
+ var J = /* @__PURE__ */ l({
221
221
  name: "SimpleUpload",
222
222
  props: {
223
223
  type: {
@@ -257,24 +257,24 @@ var J = /* @__PURE__ */ l(() => import("ithinkdt-ui/es/date-picker")), Y = /* @_
257
257
  },
258
258
  setup(t, { slots: n, expose: r }) {
259
259
  let { t: i } = e();
260
- Y.t = i;
260
+ J.t = i;
261
261
  let a = z(t), o = I(), l = s(() => t.customRequest || (({ file: e, onProgress: n, onFinish: r, onError: i }) => {
262
262
  t.uploadFile(e.file, (e) => n({ percent: e })).then((t) => {
263
263
  e.file.fileId = t, r();
264
264
  }).catch((e) => {
265
265
  o.error(e.message), i(e);
266
266
  });
267
- })), u = h();
267
+ })), u = m();
268
268
  r({ submit() {
269
- return b(u).toBeTruthy().then((e) => e.submit());
269
+ return y(u).toBeTruthy().then((e) => e.submit());
270
270
  } });
271
271
  let d = (e) => {
272
272
  if (e) for (let n of e) n.size > t.maxSize * 1024 && (n.status = "error");
273
- t.onUpdateFileList?.(e), m(() => a.nTriggerFormChange());
273
+ t.onUpdateFileList?.(e), p(() => a.nTriggerFormChange());
274
274
  };
275
275
  return () => {
276
276
  let { type: e, onUpdateFileList: r, ...o } = t;
277
- return c(F, p(o, {
277
+ return c(F, f(o, {
278
278
  ref: u,
279
279
  customRequest: l.value,
280
280
  listType: e === "image" ? "image-card" : "text",
@@ -283,7 +283,7 @@ var J = /* @__PURE__ */ l(() => import("ithinkdt-ui/es/date-picker")), Y = /* @_
283
283
  }), {
284
284
  default: e === "image" ? void 0 : () => {
285
285
  let e;
286
- return c(S, {
286
+ return c(x, {
287
287
  disabled: a.mergedDisabledRef.value,
288
288
  size: a.mergedSizeRef.value
289
289
  }, q(e = i("common.page.form.selectFileText")) ? e : { default: () => [e] });
@@ -293,13 +293,13 @@ var J = /* @__PURE__ */ l(() => import("ithinkdt-ui/es/date-picker")), Y = /* @_
293
293
  };
294
294
  }
295
295
  });
296
- function X({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersByDept: s, getUsersByUsername: l, uploadFile: u, getFileInfos: f }) {
297
- let m = (e) => e, v = (e) => V(e) ? e : String(e), x = (e) => V(e) ? e : Number(e);
296
+ function Y({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersByDept: s, getUsersByUsername: l, uploadFile: d, getFileInfos: p }) {
297
+ let _ = (e) => e, b = (e) => V(e) ? e : String(e), x = (e) => V(e) ? e : Number(e);
298
298
  return {
299
299
  input: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => a ? c(P, {
300
300
  depth: 2,
301
301
  style: "line-height: 1.25"
302
- }, { default: () => [n ?? ""] }) : (t = W(t), d(k, p({ clearable: !0 }, t, o, {
302
+ }, { default: () => [n ?? ""] }) : (t = W(t), u(k, f({ clearable: !0 }, t, o, {
303
303
  value: n,
304
304
  "onUpdate:value": r
305
305
  }), e)),
@@ -310,20 +310,20 @@ function X({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersBy
310
310
  depth: 2,
311
311
  style: "line-height: 1.25"
312
312
  }, { default: () => [i ?? ""] });
313
- let { valueType: u = "number", ...f } = W(r), m = u === "string" ? x(i) : i;
314
- return e = a, u === "string" && !t && (t = (t, ...n) => {
315
- e(v(t), ...n);
316
- }), d(A, p({ clearable: !0 }, f, l, {
313
+ let { valueType: d = "number", ...p } = W(r), m = d === "string" ? x(i) : i;
314
+ return e = a, d === "string" && !t && (t = (t, ...n) => {
315
+ e(b(t), ...n);
316
+ }), u(A, f({ clearable: !0 }, p, l, {
317
317
  value: m,
318
- "onUpdate:value": u === "string" ? t : e
318
+ "onUpdate:value": d === "string" ? t : e
319
319
  }), n);
320
320
  };
321
321
  },
322
322
  select: () => {
323
323
  let e, t, n, r, i, a;
324
- return ({ slots: o, props: s }, { modelValue: l, "onUpdate:modelValue": u, required: f, readonly: g, ..._ }) => {
325
- let { dictType: b, options: S, valueType: C = "string", ...w } = W(s), T = C === "number" ? v : m, E, D, O;
326
- S ? typeof S == "function" ? (E = !0, n ??= h(!1), D = (e) => {
324
+ return ({ slots: o, props: s }, { modelValue: l, "onUpdate:modelValue": d, required: p, readonly: h, ...g }) => {
325
+ let { dictType: y, options: S, valueType: C = "string", ...w } = W(s), T = C === "number" ? b : _, E, D, O;
326
+ S ? typeof S == "function" ? (E = !0, n ??= m(!1), D = (e) => {
327
327
  n.value = !0, Promise.resolve(S(e.trim())).then((e) => {
328
328
  t = e;
329
329
  }).finally(() => {
@@ -331,35 +331,35 @@ function X({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersBy
331
331
  });
332
332
  }, O = () => {
333
333
  D("");
334
- }, O()) : (n = void 0, t = S) : (n = void 0, e !== b && (e = b, !t && e && (t = H(e))));
334
+ }, O()) : (n = void 0, t = S) : (n = void 0, e !== y && (e = y, !t && e && (t = H(e))));
335
335
  let k = w.multiple ? l?.map(T) : T(l);
336
- if (g) if (w.multiple) {
336
+ if (h) if (w.multiple) {
337
337
  let e;
338
338
  return c(P, {
339
339
  depth: 2,
340
340
  style: "line-height: 1.25"
341
- }, q(e = (k?.map((e) => y(t)?.find((t) => t[w.valueField || "value"] === e)) ?? []).map((e, t, n) => {
341
+ }, q(e = (k?.map((e) => v(t)?.find((t) => t[w.valueField || "value"] === e)) ?? []).map((e, t, n) => {
342
342
  let r = e ? w.renderLabel ? w.renderLabel(e) ?? "" : e[w.labelField || "label"] ?? "" : k[t] ?? "";
343
343
  return c("span", { key: e ? e[w.valueField || "value"] : k[t] ?? "" }, [r, t < n.length - 1 ? ", " : ""]);
344
344
  })) ? e : { default: () => [e] });
345
345
  } else {
346
- let e = y(t)?.find((e) => e[w.valueField || "value"] === k);
346
+ let e = v(t)?.find((e) => e[w.valueField || "value"] === k);
347
347
  return c(P, {
348
348
  depth: 2,
349
349
  style: "line-height: 1.25"
350
350
  }, { default: () => [e ? w.renderLabel ? w.renderLabel(e) ?? "" : e[w.labelField || "label"] ?? "" : k ?? ""] });
351
351
  }
352
- return r = w.multiple, i = u, C === "number" && !a && (a = (e, ...t) => {
352
+ return r = w.multiple, i = d, C === "number" && !a && (a = (e, ...t) => {
353
353
  i(r ? e?.map(x) : x(e), ...t);
354
- }), d(N, p({
354
+ }), u(N, f({
355
355
  clearable: !0,
356
- filterable: y(t)?.length > 9,
356
+ filterable: v(t)?.length > 9,
357
357
  loading: n?.value || t?.loading,
358
358
  remote: E,
359
359
  onSearch: D,
360
360
  onClear: O
361
- }, w, _, {
362
- options: y(t),
361
+ }, w, g, {
362
+ options: v(t),
363
363
  value: k,
364
364
  "onUpdate:value": C === "number" ? a : i
365
365
  }), o);
@@ -367,78 +367,78 @@ function X({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersBy
367
367
  },
368
368
  checkbox: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => {
369
369
  if (t = W(t), a) {
370
- let r = n === (t.checkedValue ?? !0) ? g(e, "checked", void 0, () => [c(C, { checked: !0 }, null)]) : g(e, "unchecked", void 0, () => [c(C, { disabled: !0 }, null)]);
370
+ let r = n === (t.checkedValue ?? !0) ? h(e, "checked", void 0, () => [c(S, { checked: !0 }, null)]) : h(e, "unchecked", void 0, () => [c(S, { disabled: !0 }, null)]);
371
371
  return c(P, {
372
372
  depth: 2,
373
373
  style: "line-height: 1.25"
374
374
  }, q(r) ? r : { default: () => [r] });
375
375
  }
376
- return d(C, p(t, o, {
376
+ return u(S, f(t, o, {
377
377
  checked: n,
378
378
  "onUpdate:checked": r
379
379
  }), e);
380
380
  },
381
381
  checkboxes: () => {
382
382
  let e, t, n, r;
383
- return ({ props: i }, { modelValue: o, "onUpdate:modelValue": s, required: l, readonly: u, ...f }) => {
384
- let { dictType: h, options: g, valueType: _ = "string", ...y } = W(i), b = _ === "number" ? v : m;
385
- g ? t = g : e !== h && (e = h, !t && e && (t = H(e)));
386
- let S = o?.map(b) ?? [];
387
- if (u) {
383
+ return ({ props: i }, { modelValue: o, "onUpdate:modelValue": s, required: l, readonly: d, ...p }) => {
384
+ let { dictType: m, options: h, valueType: g = "string", ...v } = W(i), y = g === "number" ? b : _;
385
+ h ? t = h : e !== m && (e = m, !t && e && (t = H(e)));
386
+ let S = o?.map(y) ?? [];
387
+ if (d) {
388
388
  let e;
389
389
  return c(P, {
390
390
  depth: 2,
391
391
  style: "line-height: 2.4"
392
- }, q(e = (S?.map((e) => t?.find((t) => t[y.valueField || "value"] === e)) ?? []).map((e, t, n) => {
393
- let r = e ? e[y.labelField ?? "label"] ?? "" : S[t] ?? "";
394
- return c("span", { key: e ? e[y.valueField ?? "value"] : S[t] ?? "" }, [r, t < n.length - 1 ? ", " : ""]);
392
+ }, q(e = (S?.map((e) => t?.find((t) => t[v.valueField || "value"] === e)) ?? []).map((e, t, n) => {
393
+ let r = e ? e[v.labelField ?? "label"] ?? "" : S[t] ?? "";
394
+ return c("span", { key: e ? e[v.valueField ?? "value"] : S[t] ?? "" }, [r, t < n.length - 1 ? ", " : ""]);
395
395
  })) ? e : { default: () => [e] });
396
396
  }
397
- return n = s, _ === "number" && !r && (r = (e, ...t) => {
397
+ return n = s, g === "number" && !r && (r = (e, ...t) => {
398
398
  n(e?.map(x), ...t);
399
- }), d(a, p(y, f, {
399
+ }), u(a, f(v, p, {
400
400
  options: t,
401
401
  modelValue: S,
402
- "onUpdate:modelValue": _ === "number" ? r : n
402
+ "onUpdate:modelValue": g === "number" ? r : n
403
403
  }));
404
404
  };
405
405
  },
406
406
  radios: () => {
407
407
  let e, t, n, r;
408
- return ({ props: i }, { modelValue: a, "onUpdate:modelValue": s, required: l, readonly: u, ...f }) => {
409
- let { dictType: h, options: g, valueType: _ = "string", ...y } = W(i), b = _ === "number" ? v : m;
410
- g ? t = g : e !== h && (e = h, !t && e && (t = H(e)));
411
- let S = b(a);
412
- if (u) {
413
- let e = t?.find((e) => e[y.valueField ?? "value"] === S);
408
+ return ({ props: i }, { modelValue: a, "onUpdate:modelValue": s, required: l, readonly: d, ...p }) => {
409
+ let { dictType: m, options: h, valueType: g = "string", ...v } = W(i), y = g === "number" ? b : _;
410
+ h ? t = h : e !== m && (e = m, !t && e && (t = H(e)));
411
+ let S = y(a);
412
+ if (d) {
413
+ let e = t?.find((e) => e[v.valueField ?? "value"] === S);
414
414
  return c(P, {
415
415
  depth: 2,
416
416
  style: "line-height: 1.25"
417
- }, { default: () => [e ? e[y.labelField ?? "label"] ?? "" : S ?? ""] });
417
+ }, { default: () => [e ? e[v.labelField ?? "label"] ?? "" : S ?? ""] });
418
418
  }
419
- return n = s, _ === "number" && !r && (r = (e, ...t) => {
419
+ return n = s, g === "number" && !r && (r = (e, ...t) => {
420
420
  n(x(e), ...t);
421
- }), d(o, p(y, f, {
421
+ }), u(o, f(v, p, {
422
422
  options: t,
423
423
  modelValue: S,
424
- "onUpdate:modelValue": _ === "number" ? r : n
424
+ "onUpdate:modelValue": g === "number" ? r : n
425
425
  }));
426
426
  };
427
427
  },
428
428
  datepicker: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => {
429
- let { type: s = "date", format: l = s.startsWith("datetime") ? "yyyy-MM-dd HH:mm:ss" : "yyyy-MM-dd", ...u } = W(t);
429
+ let { type: s = "date", format: l = s.startsWith("datetime") ? "yyyy-MM-dd HH:mm:ss" : "yyyy-MM-dd", ...d } = W(t);
430
430
  return a ? s.endsWith("range") ? c(P, {
431
431
  depth: 2,
432
432
  style: "line-height: 1.25"
433
433
  }, { default: () => [n ? `${n[0] ? R(n[0], l) : ""} ~ ${n[1] ? R(n[1], l) : ""}` : ""] }) : c(P, {
434
434
  depth: 2,
435
435
  style: "line-height: 1.25"
436
- }, { default: () => [n ? R(n, l) : ""] }) : d(J, p({
436
+ }, { default: () => [n ? R(n, l) : ""] }) : u(w, f({
437
437
  actions: null,
438
438
  updateValueOnClose: !0,
439
439
  closeOnSelect: !0,
440
440
  clearable: !0
441
- }, u, o, {
441
+ }, d, o, {
442
442
  type: s,
443
443
  format: l,
444
444
  value: n,
@@ -459,19 +459,19 @@ function X({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersBy
459
459
  style: "max-width: 100px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; display: inline-block"
460
460
  }, [e.name]))) ? e : { default: () => [e] }) : void 0;
461
461
  }
462
- return d(Y, p(t, o, {
462
+ return u(J, f(t, o, {
463
463
  defaultUpload: !1,
464
- uploadFile: u,
464
+ uploadFile: d,
465
465
  fileList: n,
466
466
  onUpdateFileList: r
467
467
  }), e);
468
468
  },
469
469
  upload: () => {
470
- let e = null, t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = _([]), i = 0, a = (e) => {
470
+ let e = null, t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = g([]), i = 0, a = (e) => {
471
471
  let t = ++i;
472
472
  r.value = e.map((e) => n.get(e)).filter(Boolean);
473
473
  let a = e.filter((e) => !n.has(e));
474
- Promise.resolve(a.length > 0 ? f(a) : []).then((a) => {
474
+ Promise.resolve(a.length > 0 ? p(a) : []).then((a) => {
475
475
  if (t === i) {
476
476
  r.value = e.map((e) => n.get(e) || a.find((t) => t.id === e)), n.clear();
477
477
  for (let e of r.value) n.set(e.id, e);
@@ -479,9 +479,9 @@ function X({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersBy
479
479
  });
480
480
  }, o, s;
481
481
  return {
482
- renderer: ({ slots: i, props: l }, { modelValue: f, "onUpdate:modelValue": m, required: h, readonly: g, ...v }) => {
482
+ renderer: ({ slots: i, props: l }, { modelValue: p, "onUpdate:modelValue": m, required: h, readonly: _, ...v }) => {
483
483
  let y = W(l);
484
- if (s = y.maxSize, o = y.ref ??= _(), e !== f && (e = f, a(f?.split(",") ?? [])), g) {
484
+ if (s = y.maxSize, o = y.ref ??= g(), e !== p && (e = p, a(p?.split(",") ?? [])), _) {
485
485
  let e;
486
486
  return r.value.length === 0 ? void 0 : c(D, {
487
487
  gap: "8",
@@ -497,8 +497,8 @@ function X({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersBy
497
497
  style: "max-width: 100%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; display: inline-block"
498
498
  }, [e.name]))) ? e : { default: () => [e] });
499
499
  }
500
- return d(Y, p(y, v, {
501
- uploadFile: u,
500
+ return u(J, f(y, v, {
501
+ uploadFile: d,
502
502
  fileList: r.value,
503
503
  onUpdateFileList: (e = []) => {
504
504
  n.clear();
@@ -508,99 +508,100 @@ function X({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersBy
508
508
  }), i);
509
509
  },
510
510
  beforeSubmit: async () => {
511
- if (await o?.value?.submit(), await b(r).toMatch((e) => e.every((e) => !["pending", "uploading"].includes(e.status))), r.value.some((e) => e.size > s * 1024)) return Y.t("common.page.form.validate.fileSizeExceeded", { maxSize: s });
512
- if (r.value.some((e) => e.status === "error")) return Y.t("common.page.form.validate.fileErrorMessage");
511
+ if (await o?.value?.submit(), await y(r).toMatch((e) => e.every((e) => !["pending", "uploading"].includes(e.status))), r.value.some((e) => e.size > s * 1024)) return J.t("common.page.form.validate.fileSizeExceeded", { maxSize: s });
512
+ if (r.value.some((e) => e.status === "error")) return J.t("common.page.form.validate.fileErrorMessage");
513
513
  }
514
514
  };
515
515
  },
516
516
  user: () => {
517
- let a, o, u;
518
- return ({ slots: f, props: m }, { modelValue: h, "onUpdate:modelValue": g, required: v, readonly: y, ...b }) => {
517
+ let a, o, d;
518
+ return ({ slots: p, props: m }, { modelValue: h, "onUpdate:modelValue": _, required: v, readonly: y, ...b }) => {
519
519
  let x = W(m);
520
- return a || (a = _([]), o = _([]), u = _([]), l().then((e) => {
520
+ return a || (a = g([]), o = g([]), d = g([]), l().then((e) => {
521
521
  a.value = e;
522
522
  }), e().then((e) => {
523
523
  o.value = e;
524
524
  }), n().then((e) => {
525
- u.value = e;
525
+ d.value = e;
526
526
  })), y ? c(i, {
527
527
  value: h,
528
528
  multiple: x.multiple,
529
529
  getUsersByUsername: l,
530
530
  renderInfo: x.renderInfo
531
- }, null) : d(r, p({
531
+ }, null) : u(r, f({
532
532
  type: "user",
533
533
  users: a.value,
534
- depts: u.value,
534
+ depts: d.value,
535
535
  groups: o.value,
536
536
  getUsersByDept: s,
537
537
  getUsersByGroup: t
538
538
  }, x, b, {
539
539
  renderUserInfo: x.renderInfo,
540
540
  modelValue: h,
541
- "onUpdate:modelValue": g
542
- }), f);
541
+ "onUpdate:modelValue": _
542
+ }), p);
543
543
  };
544
544
  }
545
545
  };
546
546
  }
547
547
  //#endregion
548
548
  //#region src/page.jsx
549
- function Z(e) {
550
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
549
+ function X(e) {
550
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !d(e);
551
551
  }
552
- function Q() {
553
- return () => ({ items: e, model: n, handleSubmit: r, reset: i, validation: a, readonly: o, inModal: s, showFeedback: l, showColon: u, labelWidth: d, labelAlign: f, labelPlacement: p, showRequireMark: m, requireMarkPlacement: h }) => c(t, {
552
+ function Z() {
553
+ return () => ({ items: e, model: n, handleSubmit: r, reset: i, validation: a, readonly: o, inModal: s, showFeedback: l, cols: u, showColon: d, labelWidth: f, labelAlign: p, labelPlacement: m, showRequireMark: h, requireMarkPlacement: g }) => c(t, {
554
554
  readonly: o,
555
555
  model: n,
556
556
  items: e,
557
557
  validation: a,
558
- showColon: y(u) ?? !0,
559
- labelWidth: y(d),
560
- labelAlign: y(f),
561
- labelPlacement: y(p),
562
- showRequireMark: y(m),
563
- requireMarkPlacement: y(h),
564
- showFeedback: y(l) ?? !0,
558
+ showColon: v(d) ?? !0,
559
+ labelWidth: v(f),
560
+ labelAlign: v(p),
561
+ labelPlacement: v(m),
562
+ showRequireMark: v(h),
563
+ requireMarkPlacement: v(g),
564
+ showFeedback: v(l) ?? !0,
565
565
  showAction: !1,
566
+ grid: { cols: v(u) },
566
567
  onSubmit: r,
567
568
  onReset: i,
568
569
  style: s ? "padding-right: 2rem; padding-top: 1rem" : void 0
569
570
  }, null);
570
571
  }
571
- function $() {
572
+ function Q() {
572
573
  let e = (e) => typeof e == "number" ? `${e}px` : e, t = {
573
574
  maxHeight: "calc(100vh - 130px)",
574
575
  display: "flex",
575
576
  flexDirection: "column"
576
577
  }, n = { content: !0 };
577
- return () => ({ type: r = "dialog", visible: i, title: a, content: o, footer: s, placement: l, resizable: u, draggable: d, closeOnEsc: f, closable: m, showMask: h, maskClosable: g, width: _, height: v, style: y, onClose: b, onCancel: x, onConfirm: C, onAfterClose: w, onAfterOpen: O, confirmText: k, confirmDisabled: A, confirmLoading: N, cancelText: P, cancelDisabled: F, cancelLoading: I, nativeScrollbar: L, ...R }) => {
578
+ return () => ({ type: r = "dialog", visible: i, title: a, content: o, footer: s, placement: l, resizable: u, draggable: d, closeOnEsc: p, closable: m, showMask: h, maskClosable: g, width: _, height: v, style: y, onClose: b, onCancel: S, onConfirm: C, onAfterClose: w, onAfterOpen: O, confirmText: k, confirmDisabled: A, confirmLoading: N, cancelText: P, cancelDisabled: F, cancelLoading: I, nativeScrollbar: L, ...R }) => {
578
579
  let z = s ? () => s : s === null ? null : () => c(D, {
579
580
  justify: "end",
580
581
  gap: "16"
581
- }, { default: () => [P === null ? void 0 : c(S, {
582
- onClick: x,
582
+ }, { default: () => [P === null ? void 0 : c(x, {
583
+ onClick: S,
583
584
  disabled: F,
584
585
  loading: I,
585
586
  style: "min-width: 60px"
586
- }, Z(P) ? P : { default: () => [P] }), k === null ? void 0 : c(S, {
587
+ }, X(P) ? P : { default: () => [P] }), k === null ? void 0 : c(x, {
587
588
  type: "primary",
588
589
  onClick: C,
589
590
  disabled: A,
590
591
  loading: N,
591
592
  style: "min-width: 60px"
592
- }, Z(k) ? k : { default: () => [k] })] });
593
+ }, X(k) ? k : { default: () => [k] })] });
593
594
  if (r === "dialog") {
594
- let { style: r } = p({ style: {
595
+ let { style: r } = f({ style: {
595
596
  width: e(_ ?? 520),
596
597
  height: e(v)
597
598
  } }, { style: y });
598
- return c(j, p({
599
+ return c(j, f({
599
600
  show: i,
600
601
  preset: "card",
601
602
  title: () => a,
602
603
  maskClosable: g ?? !1,
603
- closeOnEsc: f,
604
+ closeOnEsc: p,
604
605
  closable: m,
605
606
  onClose: b,
606
607
  segmented: n,
@@ -615,15 +616,15 @@ function $() {
615
616
  default: () => c(M, {
616
617
  abstract: !0,
617
618
  style: "display: flex; flex-direction: column"
618
- }, Z(o) ? o : { default: () => [o] }),
619
+ }, X(o) ? o : { default: () => [o] }),
619
620
  action: z
620
621
  });
621
622
  }
622
623
  let { bodyContentClass: B, bodyContentStyle: V, ...H } = R;
623
- return c(T, p({
624
+ return c(T, f({
624
625
  show: i,
625
626
  trapFocus: !1,
626
- closeOnEsc: f,
627
+ closeOnEsc: p,
627
628
  showMask: h,
628
629
  maskClosable: g,
629
630
  resizable: u,
@@ -648,4 +649,4 @@ function $() {
648
649
  };
649
650
  }
650
651
  //#endregion
651
- export { K as createDescriptionHelper, Q as createFormHelper, $ as createModalHelper, X as createPageFormHelper };
652
+ export { K as createDescriptionHelper, Z as createFormHelper, Y as createFormItemHelper, Q as createModalHelper };
@@ -21,6 +21,7 @@ declare module '@ithinkdt/page' {
21
21
  showRequireMark?: MaybeRef<boolean | undefined>
22
22
  requireMarkPlacement?: MaybeRef<'left' | 'right' | 'right-hanging' | undefined>
23
23
  showFeedback?: MaybeRef<boolean | undefined>
24
+ cols?: MaybeRef<number | string | undefined>
24
25
  }
25
26
 
26
27
  type FormItemOptionKeys = 'size' | 'showLabel' | 'labelWidth' | 'labelStyle' | 'labelAlign' | 'labelPlacement' | 'labelProps'
package/esm/page.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  import {
2
- CheckboxProps, DatePickerProps, DatePickerSlots, DrawerContentProps, DrawerProps,
3
- InputNumberProps, InputNumberSlots, InputProps, InputSlots,
4
- ModalOptions, SelectGroupOption, SelectOption, SelectProps, SelectSlots,
5
- UploadFileInfo, UploadProps,
2
+ CheckboxProps, DatePickerProps, DatePickerSlots, DrawerContentProps, DrawerProps, InputNumberProps, InputNumberSlots,
3
+ InputProps, InputSlots, ModalOptions, SelectGroupOption, SelectOption, SelectProps, SelectSlots, UploadFileInfo, UploadProps,
6
4
  } from 'ithinkdt-ui'
7
5
  import { MaybeRef, VNode, VNodeChild } from 'vue'
8
6
 
@@ -184,7 +182,7 @@ declare module '@ithinkdt/page' {
184
182
  interface ModalDialogOptions extends ShallowMaybeRef<Omit<ModalOptions, ModalOptionsKey>> {}
185
183
  }
186
184
 
187
- export declare function createPageFormHelper(options?: {
185
+ export declare function createFormItemHelper(options?: {
188
186
  getUserGroups?: (() => Promise<UserGroupOption[]>) | undefined
189
187
  getUsersByGroup?: ((code: string) => Promise<{ username: string, nickname: string }[]>) | undefined
190
188
  getUsersByDept?: ((code: string) => Promise<{ username: string, nickname: string }[]>) | undefined
package/locale.d.ts CHANGED
@@ -2,7 +2,7 @@ export interface UILocale {
2
2
  all: string
3
3
  back: string
4
4
  layout: {
5
- sider: {
5
+ sidebar: {
6
6
  collapse: string
7
7
  expand: string
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ithinkdt/ui",
3
- "version": "4.0.9",
3
+ "version": "4.0.11",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "iThinkDT UI",
@@ -94,7 +94,7 @@
94
94
  "vue": "^3.5.31",
95
95
  "vue-router": "^5.0.4",
96
96
  "@vue/test-utils": "^2.4.6",
97
- "@ithinkdt/page": "^4.0.10"
97
+ "@ithinkdt/page": "^4.0.12"
98
98
  },
99
99
  "scripts": {
100
100
  "dev": "vite build --watch",