@ithinkdt/ui 4.0.0-800 → 4.0.0-802

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,8 +1,8 @@
1
1
  import { n as useI18n } from "./use-i18n-D-AJ8KbA.js";
2
2
  import { g as useStyle, h as useMergedClsPrefix, i as cM, n as cB, r as cE, t as c } from "./use-style-BGq0HdRK.js";
3
- import { i as vTooltip } from "./directives-CBQhJ3zJ.js";
3
+ import { i as vTooltip } from "./directives-pc2Vi93X.js";
4
4
  import { Fragment, computed, createTextVNode, createVNode, defineComponent, h, inject, isVNode, markRaw, mergeProps, nextTick, reactive, ref, shallowRef, toRaw, toRef, toValue, unref, useTemplateRef, watch, withDirectives } from "vue";
5
- import { toReactive, unrefElement, until, useCurrentElement, useElementSize, watchDebounced } from "@vueuse/core";
5
+ import { toReactive, unrefElement, until } from "@vueuse/core";
6
6
  import { NAnchor, NAnchorLink, NAvatar, NAvatarGroup, NButton, NCard, NCheckbox, NCheckboxGroup, NDataTable, NDropdown, NEllipsis, NEmpty, NFlex, NForm, NFormItem, NGi, NGrid, NIcon, NInput, NList, NListItem, NPagination, NPopover, NRadio, NRadioButton, NRadioGroup, NSelect, NSpin, NTag, NText, NTooltip, NTransfer, NTree, NTreeSelect, dataTableProps, formProps, useDialog } from "ithinkdt-ui";
7
7
  import { nanoid } from "nanoid";
8
8
  import { VOverflow, VResizeObserver } from "vueuc";
@@ -790,22 +790,12 @@ const DataForm = /* @__PURE__ */ defineComponent({
790
790
  e?.preventDefault?.(), t("reset");
791
791
  }, a = (e) => {
792
792
  e?.preventDefault?.(), t("cancel");
793
- }, o = ref(), s = ref(), { width: u } = useElementSize(useCurrentElement());
794
- watchDebounced([o, u], () => {
795
- s.value = void 0, nextTick(() => {
796
- s.value = o.value?.responsiveCols || void 0;
797
- });
798
- }, {
799
- immediate: !0,
800
- debounce: 1e3 / 20
801
- });
802
- let f = 0, p = ({ overflow: t }) => {
793
+ }, o = ref(), s = ({ overflow: t }) => {
803
794
  if (n.action) return n.action({
804
- cols: s.value,
805
- spans: f,
806
- overflow: t
795
+ overflow: t,
796
+ grid: o.value
807
797
  });
808
- let { loading: r, showSubmitBtn: i, showResetBtn: o, showCancelBtn: l, actionAlign: u, actionJustify: d, actionGap: p, submitDisabled: m, submitText: g, resetText: _, cancelText: v, succeeded: y, successText: b, failureText: x } = e;
798
+ let { loading: r, showSubmitBtn: i, showResetBtn: s, showCancelBtn: l, actionAlign: u, actionJustify: d, actionGap: f, submitDisabled: p, submitText: m, resetText: g, cancelText: _, succeeded: v, successText: y, failureText: b } = e;
809
799
  return createVNode(NFormItem, {
810
800
  label: d === "start" ? " " : void 0,
811
801
  showLabel: e.labelPlacement !== "top",
@@ -813,42 +803,41 @@ const DataForm = /* @__PURE__ */ defineComponent({
813
803
  }, { default: () => [createVNode(DataFormActions, {
814
804
  align: u,
815
805
  justify: d,
816
- gap: p,
806
+ gap: f,
817
807
  showSubmitBtn: i,
818
- showResetBtn: o,
808
+ showResetBtn: s,
819
809
  showCancelBtn: l,
820
- submitText: g,
821
- resetText: _,
822
- cancelText: v,
823
- submitDisabled: m,
810
+ submitText: m,
811
+ resetText: g,
812
+ cancelText: _,
813
+ submitDisabled: p,
824
814
  submitLoading: r,
825
- succeeded: y,
826
- successText: b,
827
- failureText: x,
815
+ succeeded: v,
816
+ successText: y,
817
+ failureText: b,
828
818
  nativeButtonType: !0,
829
819
  onCancel: a
830
820
  }, {
831
821
  prefix: () => n.actionPrefix?.(),
832
822
  suffix: () => n.actionSuffix?.()
833
823
  })] });
834
- }, m = () => {
824
+ }, u = () => {
835
825
  let { items: t, validation: r, showAction: i } = e;
836
- return f = 0, createVNode(Fragment, null, [t.map(({ hidden: t, name: n, render: i, label: a, showColon: o, span: s = 6, rowSpan: l, offset: u = 0, tooltip: p, tooltipPlacement: m = e.tooltipPlacement, validationStatus: g = r[n]?.errors?.length ? "error" : r[n]?.warnings?.length ? "warnings" : r[n] ? "success" : void 0, readonly: _ = e.readonly, showRequireMark: y = !_, showTooltipWhenReadonly: b = !1, ...x }) => {
826
+ return createVNode(Fragment, null, [t.map(({ hidden: t, name: n, render: i, label: a, showColon: o, span: s = 6, rowSpan: l, offset: u = 0, tooltip: f, tooltipPlacement: p = e.tooltipPlacement, validationStatus: m = r[n]?.errors?.length ? "error" : r[n]?.warnings?.length ? "warnings" : r[n] ? "success" : void 0, readonly: g = e.readonly, showRequireMark: _ = !g, showTooltipWhenReadonly: y = !1, ...b }) => {
837
827
  if (t) return;
838
- f += s;
839
- let S;
840
- return S = n[0] === "$" ? i({}) : createVNode(NFormItem, mergeProps({
828
+ let x;
829
+ return x = n[0] === "$" ? i({}) : createVNode(NFormItem, mergeProps({
841
830
  path: n,
842
- validationStatus: g,
843
- showRequireMark: x.required && y
844
- }, x), {
831
+ validationStatus: m,
832
+ showRequireMark: b.required && _
833
+ }, b), {
845
834
  label: () => createVNode(NText, {
846
835
  depth: e.readonly ? 3 : 2,
847
836
  style: "display: inline-flex; align-items: flex-start; gap: 1px"
848
837
  }, { default: () => [
849
838
  createVNode("span", null, [toValue(a)]),
850
- m === "icon" ? createVNode(NTooltip, null, {
851
- default: () => toValue(p),
839
+ p === "icon" ? createVNode(NTooltip, null, {
840
+ default: () => toValue(f),
852
841
  trigger: () => createVNode(NButton, {
853
842
  text: !0,
854
843
  style: "font-size: 1.25em; opacity: 0.8"
@@ -862,35 +851,35 @@ const DataForm = /* @__PURE__ */ defineComponent({
862
851
  size: e.size,
863
852
  readonly: e.readonly
864
853
  })]);
865
- return p && m === "bottom" && (!e.readonly || b) ? createVNode("div", { style: "width: 100%; display: flex; flex-direction: column" }, [n, createVNode(NText, {
854
+ return f && p === "bottom" && (!e.readonly || y) ? createVNode("div", { style: "width: 100%; display: flex; flex-direction: column" }, [n, createVNode(NText, {
866
855
  depth: 3,
867
856
  style: "font-size: calc(1rem - 3px); margin-top: 6px"
868
- }, _isSlot$5(t = toValue(p)) ? t : { default: () => [t] })]) : n;
857
+ }, _isSlot$5(t = toValue(f)) ? t : { default: () => [t] })]) : n;
869
858
  },
870
859
  feedback: () => r[n]?.errors?.[0] ?? r[n]?.warnings?.[0]
871
- }), e.grid === !1 ? S : createVNode(NGi, {
860
+ }), e.grid === !1 ? x : createVNode(NGi, {
872
861
  key: n,
873
862
  offset: u,
874
863
  span: s,
875
864
  style: l ? { gridRowEnd: `span ${l}` } : void 0
876
- }, _isSlot$5(S) ? S : { default: () => [S] });
865
+ }, _isSlot$5(x) ? x : { default: () => [x] });
877
866
  }), i === !1 || e.readonly === !0 && !n.action ? void 0 : createVNode(NGi, mergeProps({
878
867
  key: "action",
879
868
  span: 2 ** 53 - 1
880
- }, typeof e.showAction == "object" ? e.showAction : {}), { default: p })]);
869
+ }, typeof e.showAction == "object" ? e.showAction : {}), { default: s })]);
881
870
  };
882
871
  return () => {
883
- let { items: t, loading: n, validation: a, showColon: s, tooltipPlacement: l, showFeedback: u, labelWidth: d = "7.2em", labelAlign: f = e.labelPlacement === "top" ? "left" : "right", grid: p, showAction: g, showSubmitBtn: _, showResetBtn: y, showCancelBtn: b, actionAlign: x, actionJustify: S, actionGap: C, submitDisabled: w, submitText: T, resetText: E, cancelText: D, succeeded: O, successText: k, failureText: A, ...j } = e, M = !e.readonly && u !== !1;
872
+ let { items: t, loading: n, validation: a, showColon: s, tooltipPlacement: l, showFeedback: d, labelWidth: f = "7.2em", labelAlign: p = e.labelPlacement === "top" ? "left" : "right", grid: m, showAction: g, showSubmitBtn: _, showResetBtn: y, showCancelBtn: b, actionAlign: x, actionJustify: S, actionGap: C, submitDisabled: w, submitText: T, resetText: E, cancelText: D, succeeded: O, successText: k, failureText: A, ...j } = e, M = !e.readonly && d !== !1;
884
873
  return createVNode(NForm, mergeProps({
885
- labelWidth: d,
886
- labelAlign: f,
874
+ labelWidth: f,
875
+ labelAlign: p,
887
876
  onReset: i,
888
877
  onSubmit: r,
889
878
  showFeedback: M
890
879
  }, j), { default: () => [createVNode(NGrid, mergeProps({
891
880
  ref: o,
892
881
  itemResponsive: !0
893
- }, p, { yGap: M ? 0 : p?.yGap ?? 24 }), { default: m })] });
882
+ }, m, { yGap: M ? 0 : m?.yGap ?? 24 }), { default: u })] });
894
883
  };
895
884
  }
896
885
  }), DataFilter = /* @__PURE__ */ defineComponent({
@@ -945,7 +934,8 @@ const DataForm = /* @__PURE__ */ defineComponent({
945
934
  type: Boolean,
946
935
  required: !1,
947
936
  default: !0
948
- }
937
+ },
938
+ collapsedRows: Number
949
939
  },
950
940
  emits: [
951
941
  "filter",
@@ -967,22 +957,23 @@ const DataForm = /* @__PURE__ */ defineComponent({
967
957
  suffix: !0
968
958
  });
969
959
  return () => {
970
- let { filterOnReset: e, filterText: n, resetText: f, customizable: p, defaultCollapsed: m, collapsible: g, grid: _, ...y } = t;
960
+ let { filterOnReset: e, filterText: n, resetText: f, customizable: p, defaultCollapsed: m, collapsible: g, grid: _, collapsedRows: b, ...x } = t;
971
961
  return createVNode(DataForm, mergeProps({ grid: {
972
962
  cols: "12 768:18 1280:24 1536:30",
973
963
  yGap: 20,
974
964
  xGap: 8,
975
965
  ..._,
976
- collapsed: s.value
977
- } }, y, {
966
+ collapsed: s.value,
967
+ collapsedRows: b
968
+ } }, x, {
978
969
  showFeedback: !1,
979
970
  showAction: u,
980
971
  onSubmit: a,
981
- onReset: o
982
- }), { action: ({ cols: e, spans: a }) => (u.suffix = e < a + u.span, createVNode(NFlex, {
983
- justify: u.suffix ? "end" : "start",
984
- align: "center"
985
- }, { default: () => [
972
+ onReset: o,
973
+ style: "position: relative"
974
+ }), { action: ({ grid: e }) => (nextTick(() => {
975
+ u.suffix = e?.collapsedOverflow || e?.contentEl.children.item(e?.contentEl.children.length - 1).offsetTop > 0;
976
+ }), createVNode("div", { style: "display: flex; gap: 12px; align-items: center; justify-content: " + (u.suffix ? "flex-end" : "flex-start") }, [
986
977
  u.suffix ? void 0 : createVNode("span", null, [createTextVNode("\xA0\xA0\xA0\xA0")]),
987
978
  createVNode(NButton, {
988
979
  attrType: "submit",
@@ -997,19 +988,19 @@ const DataForm = /* @__PURE__ */ defineComponent({
997
988
  p ? createVNode(DataCustom, {
998
989
  keyField: "name",
999
990
  showFixed: !1,
1000
- data: y.items,
991
+ data: x.items,
1001
992
  size: 18,
1002
993
  type: "primary",
1003
994
  onCustom: (e) => r("custom", e)
1004
995
  }, null) : void 0,
1005
- g && u.suffix ? createVNode(NButton, {
996
+ g && e?.collapsedOverflow ? createVNode(NButton, {
1006
997
  text: !0,
1007
998
  type: "primary",
1008
999
  iconPlacement: "right",
1009
1000
  renderIcon: s.value ? IDown : IUp,
1010
1001
  onClick: () => l(!s.value)
1011
1002
  }, { default: () => [s.value ? i("common.page.filter.expand") : i("common.page.filter.collapse")] }) : void 0
1012
- ] })) });
1003
+ ])) });
1013
1004
  };
1014
1005
  }
1015
1006
  });
@@ -1197,15 +1188,7 @@ const DataLocaleInput = /* @__PURE__ */ defineComponent({
1197
1188
  type: Boolean,
1198
1189
  default: !0
1199
1190
  },
1200
- pageSizes: {
1201
- type: Array,
1202
- default: () => [
1203
- 10,
1204
- 20,
1205
- 30,
1206
- 50
1207
- ]
1208
- }
1191
+ pageSizes: { type: Array }
1209
1192
  },
1210
1193
  emits: { change: () => !0 },
1211
1194
  setup(t, { emit: n }) {
@@ -1215,14 +1198,19 @@ const DataLocaleInput = /* @__PURE__ */ defineComponent({
1215
1198
  }), a = (e) => n("change", {
1216
1199
  pageSize: e,
1217
1200
  currentPage: t.resetPageOnSizeChange ? 1 : t.currentPage ?? t.page?.currentPage ?? 1
1218
- });
1201
+ }), o = inject(DataPagination.DEFAULT_PAGE_SIZES_INJECTION_KEY, () => [
1202
+ 10,
1203
+ 20,
1204
+ 30,
1205
+ 50
1206
+ ], !0);
1219
1207
  return () => createVNode(NPagination, {
1220
1208
  page: t.currentPage ?? t.page?.currentPage,
1221
1209
  itemCount: t.total,
1222
1210
  pageSize: t.pageSize ?? t.page?.pageSize,
1223
1211
  onUpdatePage: i,
1224
1212
  onUpdatePageSize: a,
1225
- pageSizes: t.pageSizes,
1213
+ pageSizes: t.pageSizes || o,
1226
1214
  showQuickJumper: !0,
1227
1215
  showSizePicker: !0,
1228
1216
  style: "justify-content: flex-end"
@@ -1232,6 +1220,7 @@ const DataLocaleInput = /* @__PURE__ */ defineComponent({
1232
1220
  });
1233
1221
  }
1234
1222
  });
1223
+ DataPagination.DEFAULT_PAGE_SIZES_INJECTION_KEY = Symbol();
1235
1224
  function _isSlot$3(e) {
1236
1225
  return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
1237
1226
  }
@@ -1893,12 +1882,14 @@ const DtUserDept = /* @__PURE__ */ defineComponent({
1893
1882
  });
1894
1883
  function renderUser(e, t, { placement: n = "left", size: r = 24, tooltip: i = !0, username: a = !1, renderInfo: o }) {
1895
1884
  let s = e.nickname.split(" ").at(-1), l = s;
1896
- /^[\u4E00-\u9FA5]+$/.test(s) ? l = s.length >= 3 ? s.slice(-2) : s : s.length > 4 && (l = createVNode(NIcon, null, { default: () => [createVNode(IAccount, null, null)] }));
1897
- let u = (e, t) => createVNode(NAvatar, {
1885
+ if (/^[\u4E00-\u9FA5]+$/.test(s)) {
1886
+ let e = s.length;
1887
+ l = e === 3 || e === 4 ? s.slice(-2) : e > 4 ? s.slice(0, 1) : s;
1888
+ } else s.length > 4 && (l = createVNode(NIcon, null, { default: () => [createVNode(IAccount, null, null)] }));
1889
+ let u = (e) => createVNode(NAvatar, {
1898
1890
  color: "var(--color-primary)",
1899
1891
  round: !0,
1900
- size: e,
1901
- style: t ? { position: "absolute" } : ""
1892
+ size: e
1902
1893
  }, _isSlot(l) ? l : { default: () => [l] });
1903
1894
  return createVNode(NPopover, {
1904
1895
  key: e.username,
@@ -1907,12 +1898,12 @@ function renderUser(e, t, { placement: n = "left", size: r = 24, tooltip: i = !0
1907
1898
  disabled: i === !1
1908
1899
  }, {
1909
1900
  default: () => createVNode(NCard, {
1910
- style: "width: 200px",
1901
+ style: "min-width: 200px",
1911
1902
  size: "small"
1912
1903
  }, { default: () => [createVNode("div", { style: "display: flex; align-items: center; gap: 12px" }, [u(48), createVNode("div", null, [createVNode("div", { style: "font-size: 16px; font-weight: 500;" }, [e.nickname]), createVNode("div", { style: "font-size: 14px; color: #999" }, [e.username])])]), o?.(e)] }),
1913
1904
  trigger: () => {
1914
- let n = u(r, t);
1915
- return t ? createVNode("span", null, [n, createVNode("div", { style: `overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: ${r}px` }, [createVNode("span", { style: `margin-left: ${r + 6}px` }, [e.nickname]), a ? createVNode("span", { style: "margin-left: 8px; opacity: 0.4" }, [e.username]) : void 0])]) : n;
1905
+ let n = u(r);
1906
+ return t ? createVNode("div", { style: "max-width: 100%; overflow: hidden; display: inline-flex; align-items: center; gap: 6px" }, [n, createVNode("div", { style: "overflow: hidden; white-space: nowrap; text-overflow: ellipsis" }, [createVNode("span", null, [e.nickname]), a ? createVNode("span", { style: "margin-left: 8px; opacity: 0.4" }, [e.username]) : void 0])]) : n;
1916
1907
  }
1917
1908
  });
1918
1909
  }
@@ -1,2 +1,2 @@
1
- import { _ as dataFormActionsProps, a as DtUserRender, b as DataActions, c as DataTable, d as DataPagination, f as DataLocaleInput, g as DataFormActions, h as DataForm, i as DtUserDept, l as useDataTableDrag, m as DataFilter, n as StateButtonProps, o as renderUsers, p as useLocaleEdit, r as DtDeptRender, s as NRadios, t as NStateButton, u as DataSelection, v as DataDescriptions, x as NCheckboxes, y as DataCustom } from "./components-DYFd5z-C.js";
1
+ import { _ as dataFormActionsProps, a as DtUserRender, b as DataActions, c as DataTable, d as DataPagination, f as DataLocaleInput, g as DataFormActions, h as DataForm, i as DtUserDept, l as useDataTableDrag, m as DataFilter, n as StateButtonProps, o as renderUsers, p as useLocaleEdit, r as DtDeptRender, s as NRadios, t as NStateButton, u as DataSelection, v as DataDescriptions, x as NCheckboxes, y as DataCustom } from "./components-BXQ9l7S9.js";
2
2
  export { DataActions, DataCustom, DataDescriptions, DataFilter, DataForm, DataFormActions, DataLocaleInput, DataPagination, DataSelection, DataTable, DtDeptRender, DtUserDept, DtUserRender, NCheckboxes, NRadios, NStateButton, StateButtonProps, dataFormActionsProps, renderUsers, useDataTableDrag, useLocaleEdit };
@@ -103,9 +103,12 @@ const TooltipDirectiveProvider = /* @__PURE__ */ defineComponent({
103
103
  }, { capture: !0 }), () => createVNode(NTooltip, {
104
104
  trigger: "manual",
105
105
  show: !!current.value && r.show,
106
+ scrollable: !0,
107
+ flip: !1,
106
108
  x: r.x,
107
109
  y: r.y,
108
- placement: r.placement
110
+ placement: r.placement,
111
+ style: "max-width: 61.8vw; max-height: 61.8vh"
109
112
  }, { default: () => [createVNode("div", { class: i }, [n.value?.()])] });
110
113
  }
111
114
  });
@@ -1,2 +1,2 @@
1
- import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-CBQhJ3zJ.js";
1
+ import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-pc2Vi93X.js";
2
2
  export { SpinDirectiveProvider, TooltipDirectiveProvider, vSpin, vTooltip };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { n as useI18n, t as UI_I18N_INJECTION } from "./use-i18n-D-AJ8KbA.js";
2
2
  import { g as useStyle, i as cM, n as cB, r as cE, t as c } from "./use-style-BGq0HdRK.js";
3
- import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-CBQhJ3zJ.js";
3
+ import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-pc2Vi93X.js";
4
4
  import { Fragment, computed, createVNode, defineComponent, inject, isVNode, mergeProps, provide, reactive, ref, renderSlot, shallowRef, toRef, toValue, unref, useTemplateRef, watch, withDirectives } from "vue";
5
5
  import { computedAsync, promiseTimeout, useElementHover, useElementSize, useEventListener, useFullscreen, watchDebounced } from "@vueuse/core";
6
6
  import { NAvatar, NBadge, NBreadcrumb, NBreadcrumbItem, NButton, NDrawer, NDrawerContent, NDropdown, NEmpty, NIcon, NList, NListItem, NMenu, NPagination, NPopover, NScrollbar, NText, NThing, useThemeVars } from "ithinkdt-ui";
package/dist/page.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import { n as useI18n } from "./use-i18n-D-AJ8KbA.js";
2
- import { a as DtUserRender, h as DataForm, i as DtUserDept, r as DtDeptRender, s as NRadios, x as NCheckboxes } from "./components-DYFd5z-C.js";
3
- import { computed, createVNode, defineComponent, h, isVNode, mergeProps, nextTick, ref, shallowRef, unref } from "vue";
4
- import { until } from "@vueuse/core";
5
- import { NButton, NCheckbox, NColorPicker, NDatePicker, NDrawer, NDrawerContent, NFlex, NInput, NInputNumber, NModal, NScrollbar, NSelect, NText, NUpload, useMessage } from "ithinkdt-ui";
2
+ import { a as DtUserRender, h as DataForm, i as DtUserDept, r as DtDeptRender, s as NRadios, x as NCheckboxes } from "./components-BXQ9l7S9.js";
3
+ import { computed, createVNode, defineComponent, h, isVNode, mergeProps, nextTick, ref, shallowRef, toValue, unref } from "vue";
4
+ import { until, useClipboard } from "@vueuse/core";
5
+ import { NButton, NCheckbox, NColorPicker, NDatePicker, NDrawer, NDrawerContent, NFlex, NIcon, NInput, NInputNumber, NModal, NScrollbar, NSelect, NText, NUpload, useMessage } from "ithinkdt-ui";
6
6
  import { nanoid } from "nanoid";
7
7
  import { format } from "date-fns";
8
8
  import { useFormItem } from "ithinkdt-ui/es/_mixins";
9
+ import { useModal } from "@ithinkdt/page";
9
10
  import { isNullish } from "@ithinkdt/common";
10
11
  import { useDict, useDictMap } from "@ithinkdt/common/dict";
11
12
  function _isSlot(e) {
@@ -88,7 +89,7 @@ var mapProps = (e) => Object.fromEntries(Object.entries(e || {}).map(([e, t]) =>
88
89
  }
89
90
  });
90
91
  function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsByCode: i, getUsersByDept: s, getUsersByUsername: c, uploadFile: u, getFileInfos: d }) {
91
- let f = (e) => e, p = (e) => isNullish(e) ? e : String(e), v = (e) => isNullish(e) ? e : Number(e);
92
+ let f = (e) => e, p = (e) => isNullish(e) ? e : String(e), g = (e) => isNullish(e) ? e : Number(e);
92
93
  return {
93
94
  input: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => a ? createVNode(NText, {
94
95
  depth: 2,
@@ -107,7 +108,7 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
107
108
  depth: 2,
108
109
  style: "line-height: 1.25"
109
110
  }, { default: () => [i ?? ""] });
110
- let { valueType: u = "number", ...d } = mapProps(r), f = u === "string" ? v(i) : i;
111
+ let { valueType: u = "number", ...d } = mapProps(r), f = u === "string" ? g(i) : i;
111
112
  return e = a, u === "string" && !t && (t = (t, ...n) => {
112
113
  e(p(t), ...n);
113
114
  }), h(NInputNumber, {
@@ -122,8 +123,8 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
122
123
  select: () => {
123
124
  let e, t, n, r, i;
124
125
  return ({ slots: a, props: o }, { modelValue: s, "onUpdate:modelValue": c, required: u, readonly: d, ...m }) => {
125
- let { dictType: _, options: y, valueType: b = "string", ...x } = mapProps(o), S = b === "number" ? p : f;
126
- y ? t = y : e !== _ && (e = _, !t && e && (t = useDict(e)));
126
+ let { dictType: v, options: y, valueType: b = "string", ...x } = mapProps(o), S = b === "number" ? p : f;
127
+ y ? t = y : e !== v && (e = v, !t && e && (t = useDict(e)));
127
128
  let C = x.multiple ? s?.map(S) : S(s);
128
129
  if (d) if (x.multiple) {
129
130
  let e;
@@ -142,7 +143,7 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
142
143
  }, { default: () => [e ? x.renderLabel ? x.renderLabel(e) ?? "" : e[x.labelField || "label"] ?? "" : C ?? ""] });
143
144
  }
144
145
  return r = x.multiple, n = c, b === "number" && !i && (i = (e, ...t) => {
145
- n(r ? e?.map(v) : v(e), ...t);
146
+ n(r ? e?.map(g) : g(e), ...t);
146
147
  }), h(NSelect, {
147
148
  clearable: !0,
148
149
  loading: t?.loading,
@@ -172,8 +173,8 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
172
173
  checkboxes: () => {
173
174
  let e, t, n, r;
174
175
  return ({ props: i }, { modelValue: a, "onUpdate:modelValue": s, required: c, readonly: u, ...d }) => {
175
- let { dictType: m, options: g, valueType: _ = "string", ...y } = mapProps(i), b = _ === "number" ? p : f;
176
- g ? t = g : e !== m && (e = m, !t && e && (t = useDict(e)));
176
+ let { dictType: m, options: _, valueType: v = "string", ...y } = mapProps(i), b = v === "number" ? p : f;
177
+ _ ? t = _ : e !== m && (e = m, !t && e && (t = useDict(e)));
177
178
  let x = a?.map(b) ?? [];
178
179
  if (u) {
179
180
  let e;
@@ -185,22 +186,22 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
185
186
  return createVNode("span", { key: e ? e[y.valueField ?? "value"] : x[t] ?? "" }, [r, t < n.length - 1 ? ", " : ""]);
186
187
  })) ? e : { default: () => [e] });
187
188
  }
188
- return n = s, _ === "number" && !r && (r = (e, ...t) => {
189
- n(e?.map(v), ...t);
189
+ return n = s, v === "number" && !r && (r = (e, ...t) => {
190
+ n(e?.map(g), ...t);
190
191
  }), h(NCheckboxes, {
191
192
  ...y,
192
193
  ...d,
193
194
  options: t,
194
195
  modelValue: x,
195
- "onUpdate:modelValue": _ === "number" ? r : n
196
+ "onUpdate:modelValue": v === "number" ? r : n
196
197
  });
197
198
  };
198
199
  },
199
200
  radios: () => {
200
201
  let e, t, n, r;
201
202
  return ({ props: i }, { modelValue: o, "onUpdate:modelValue": s, required: c, readonly: u, ...d }) => {
202
- let { dictType: m, options: g, valueType: _ = "string", ...y } = mapProps(i), b = _ === "number" ? p : f;
203
- g ? t = g : e !== m && (e = m, !t && e && (t = useDict(e)));
203
+ let { dictType: m, options: _, valueType: v = "string", ...y } = mapProps(i), b = v === "number" ? p : f;
204
+ _ ? t = _ : e !== m && (e = m, !t && e && (t = useDict(e)));
204
205
  let x = b(o);
205
206
  if (u) {
206
207
  let e = t?.find((e) => e[y.valueField ?? "value"] === x);
@@ -209,14 +210,14 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
209
210
  style: "line-height: 1.25"
210
211
  }, { default: () => [e ? e[y.labelField ?? "label"] ?? "" : x ?? ""] });
211
212
  }
212
- return n = s, _ === "number" && !r && (r = (e, ...t) => {
213
- n(v(e), ...t);
213
+ return n = s, v === "number" && !r && (r = (e, ...t) => {
214
+ n(g(e), ...t);
214
215
  }), h(NRadios, {
215
216
  ...y,
216
217
  ...d,
217
218
  options: t,
218
219
  modelValue: x,
219
- "onUpdate:modelValue": _ === "number" ? r : n
220
+ "onUpdate:modelValue": v === "number" ? r : n
220
221
  });
221
222
  };
222
223
  },
@@ -357,8 +358,67 @@ function createDescriptionHelper({ getDeptsByCode: e, getUsersByUsername: n, get
357
358
  cy: "16",
358
359
  r: "8",
359
360
  fill: "currentColor"
361
+ }, null)]), c = (e = {}) => createVNode("svg", mergeProps({
362
+ xmlns: "http://www.w3.org/2000/svg",
363
+ width: "1em",
364
+ height: "1em",
365
+ viewBox: "0 0 24 24"
366
+ }, e), [createVNode("path", {
367
+ fill: "currentColor",
368
+ 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"
369
+ }, null)]), l = (e) => createVNode("svg", mergeProps({
370
+ xmlns: "http://www.w3.org/2000/svg",
371
+ width: "1em",
372
+ height: "1em",
373
+ viewBox: "0 0 24 24"
374
+ }, e), [createVNode("path", {
375
+ fill: "currentColor",
376
+ 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"
377
+ }, null)]), u = (e) => createVNode("svg", mergeProps({
378
+ xmlns: "http://www.w3.org/2000/svg",
379
+ width: "1em",
380
+ height: "1em",
381
+ viewBox: "0 0 24 24"
382
+ }, e), [createVNode("path", {
383
+ fill: "currentColor",
384
+ d: "M20 12a8 8 0 0 1-8 8a8 8 0 0 1-8-8a8 8 0 0 1 8-8c.76 0 1.5.11 2.2.31l1.57-1.57A9.8 9.8 0 0 0 12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10M7.91 10.08L6.5 11.5L11 16L21 6l-1.41-1.42L11 13.17z"
360
385
  }, null)]);
361
386
  return {
387
+ longtext: () => {
388
+ let e = ref(), { open: t } = useModal({
389
+ type: "drawer",
390
+ resizable: !0,
391
+ content: () => createVNode("div", null, [createVNode("span", null, [e.value])]),
392
+ width: 600,
393
+ footer: null,
394
+ maskClosable: !0
395
+ }), { copy: n, copied: r } = useClipboard({ legacy: !0 }), i = (i, a, o) => {
396
+ if (!a) return t(i);
397
+ let s = () => {
398
+ o ? o(e.value) : n(e.value);
399
+ };
400
+ return t(() => createVNode("div", { style: "display: flex; align-items: center; justify-content: space-between; margin-right: 4px;" }, [toValue(i), r.value ? createVNode(NButton, {
401
+ quaternary: !0,
402
+ size: "tiny",
403
+ type: "success"
404
+ }, { icon: () => createVNode(NIcon, { size: 18 }, { default: () => [createVNode(u, null, null)] }) }) : createVNode(NButton, {
405
+ quaternary: !0,
406
+ size: "tiny",
407
+ onClick: s
408
+ }, { icon: () => createVNode(NIcon, { size: 16 }, { default: () => [createVNode(l, null, null)] }) })]));
409
+ };
410
+ return {
411
+ renderer: (t, n, { params: r = {} }, { label: a }) => createVNode("div", { style: "white-space: nowrap; overflow: hidden; display: flex; gap: 8px; align-items: center; justify-content: space-between" }, [createVNode("div", { style: "flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" }, [t]), createVNode(NButton, {
412
+ type: "info",
413
+ text: !0,
414
+ style: "position: sticky; right: 0; z-index: 2",
415
+ onClick: r.showText ? () => r.showText(t) : () => {
416
+ e.value = r.formatText ? r.formatText(t) : t, i(r.title || a, r.copyable !== !1, r.onCopy);
417
+ }
418
+ }, { default: () => [createVNode(NIcon, { size: 18 }, { default: () => [createVNode(c, null, null)] })] })]),
419
+ default: { table: { ellipsis: !1 } }
420
+ };
421
+ },
362
422
  date: () => ({
363
423
  renderer: o("yyyy-MM-dd"),
364
424
  default: { table: {
@@ -461,20 +521,24 @@ function createDescriptionHelper({ getDeptsByCode: e, getUsersByUsername: n, get
461
521
  getDeptsByCode: e
462
522
  }, null);
463
523
  },
464
- user: () => ({
465
- renderer: (e, r, { params: i = {} }) => {
466
- if (e) return createVNode(DtUserRender, {
467
- value: e,
468
- multiple: i?.multiple,
469
- getUsersByUsername: n
470
- }, null);
471
- },
472
- default: { table: {
473
- width: 150,
474
- ellipsis: !1,
475
- align: "center"
476
- } }
477
- })
524
+ user: () => {
525
+ let e = { style: "padding-block: 0" };
526
+ return {
527
+ renderer: (e, r, { params: i = {} }) => {
528
+ if (e) return createVNode(DtUserRender, {
529
+ value: e,
530
+ multiple: i?.multiple,
531
+ getUsersByUsername: n
532
+ }, null);
533
+ },
534
+ default: { table: {
535
+ width: 150,
536
+ ellipsis: !1,
537
+ align: "center",
538
+ cellProps: () => e
539
+ } }
540
+ };
541
+ }
478
542
  };
479
543
  }
480
544
  function createFormHelper() {
@@ -502,27 +566,27 @@ function createModalHelper() {
502
566
  display: "flex",
503
567
  flexDirection: "column"
504
568
  }, n = { content: !0 };
505
- return () => ({ type: r = "dialog", visible: i, title: a, content: o, footer: s, placement: c, resizable: l, draggable: u, closeOnEsc: f, closable: p, showMask: m, maskClosable: g, width: _, height: y, style: b, onClose: x, onCancel: w, onConfirm: T, onAfterClose: E, onAfterOpen: D, confirmText: O, confirmDisabled: k, confirmLoading: A, cancelText: j, cancelDisabled: M, cancelLoading: N, nativeScrollbar: P, ...F }) => {
506
- let I = s ? () => s : s === null ? null : () => createVNode(NFlex, {
569
+ return () => ({ type: r = "dialog", visible: i, title: a, content: o, footer: s, placement: c, resizable: l, draggable: u, closeOnEsc: f, closable: p, showMask: m, maskClosable: g, width: _, height: v, style: y, onClose: x, onCancel: S, onConfirm: C, onAfterClose: w, onAfterOpen: T, confirmText: E, confirmDisabled: D, confirmLoading: O, cancelText: k, cancelDisabled: A, cancelLoading: j, nativeScrollbar: M, ...N }) => {
570
+ let P = s ? () => s : s === null ? null : () => createVNode(NFlex, {
507
571
  justify: "end",
508
572
  gap: "16"
509
- }, { default: () => [j === null ? void 0 : createVNode(NButton, {
510
- onClick: w,
511
- disabled: M,
512
- loading: N,
573
+ }, { default: () => [k === null ? void 0 : createVNode(NButton, {
574
+ onClick: S,
575
+ disabled: A,
576
+ loading: j,
513
577
  style: "min-width: 60px"
514
- }, _isSlot(j) ? j : { default: () => [j] }), O === null ? void 0 : createVNode(NButton, {
578
+ }, _isSlot(k) ? k : { default: () => [k] }), E === null ? void 0 : createVNode(NButton, {
515
579
  type: "primary",
516
- onClick: T,
517
- disabled: k,
518
- loading: A,
580
+ onClick: C,
581
+ disabled: D,
582
+ loading: O,
519
583
  style: "min-width: 60px"
520
- }, _isSlot(O) ? O : { default: () => [O] })] });
584
+ }, _isSlot(E) ? E : { default: () => [E] })] });
521
585
  if (r === "dialog") {
522
586
  let { style: r } = mergeProps({ style: {
523
587
  width: e(_ ?? 520),
524
- height: e(y)
525
- } }, { style: b });
588
+ height: e(v)
589
+ } }, { style: y });
526
590
  return createVNode(NModal, mergeProps({
527
591
  show: i,
528
592
  preset: "card",
@@ -533,21 +597,21 @@ function createModalHelper() {
533
597
  onClose: x,
534
598
  segmented: n,
535
599
  size: "small",
536
- onAfterEnter: D,
537
- onAfterLeave: E,
600
+ onAfterEnter: T,
601
+ onAfterLeave: w,
538
602
  onUpdateShow: x,
539
603
  draggable: u ?? !0,
540
604
  style: r,
541
605
  contentStyle: t
542
- }, F), {
606
+ }, N), {
543
607
  default: () => createVNode(NScrollbar, {
544
608
  abstract: !0,
545
609
  style: "display: flex; flex-direction: column"
546
610
  }, _isSlot(o) ? o : { default: () => [o] }),
547
- action: I
611
+ action: P
548
612
  });
549
613
  }
550
- let { bodyContentClass: L, bodyContentStyle: R, ...z } = F;
614
+ let { bodyContentClass: F, bodyContentStyle: I, ...L } = N;
551
615
  return createVNode(NDrawer, mergeProps({
552
616
  show: i,
553
617
  trapFocus: !1,
@@ -556,21 +620,22 @@ function createModalHelper() {
556
620
  maskClosable: g,
557
621
  resizable: l,
558
622
  placement: c,
559
- width: _ ?? 440,
560
- height: y,
623
+ width: l ? void 0 : _ ?? 440,
624
+ defaultWidth: l ? _ ?? 440 : void 0,
625
+ height: v,
561
626
  onUpdateShow: x,
562
- onAfterEnter: D,
563
- onAfterLeave: E,
564
- style: b
565
- }, z), { default: () => [createVNode(NDrawerContent, {
627
+ onAfterEnter: T,
628
+ onAfterLeave: w,
629
+ style: y
630
+ }, L), { default: () => [createVNode(NDrawerContent, {
566
631
  closable: p,
567
- nativeScrollbar: P ?? !1,
568
- bodyContentClass: L,
569
- bodyContentStyle: R
632
+ nativeScrollbar: M ?? !1,
633
+ bodyContentClass: F,
634
+ bodyContentStyle: I
570
635
  }, {
571
636
  default: () => o,
572
637
  header: () => a,
573
- footer: I
638
+ footer: P
574
639
  })] });
575
640
  };
576
641
  }
@@ -3,9 +3,10 @@ import {
3
3
  FlexProps, FormItemGiProps as NFormItemGiProps, FormProps as NFormProps, GridItemProps as NGridItemProps, GridProps as NGridProps,
4
4
  PopoverProps, RadioGroupProps, TransferProps,
5
5
  } from 'ithinkdt-ui'
6
+ import { TableBaseColumn } from 'ithinkdt-ui/es/data-table/src/interface'
6
7
  import Sortable from 'sortablejs'
7
8
  import { AllowedComponentProps, MaybeRef, MaybeRefOrGetter, VNodeChild } from 'vue'
8
- import type { CSSProperties, HTMLAttributes, TemplateRef } from 'vue'
9
+ import type { CSSProperties, ComponentPublicInstance, HTMLAttributes, InjectionKey, TemplateRef } from 'vue'
9
10
 
10
11
  import { GenericCtx, GenericExposed, GenericReturn, MaybeArray, MaybePromise, PublicProps } from '@ithinkdt/common'
11
12
  import { DictItem } from '@ithinkdt/common/dict'
@@ -50,6 +51,20 @@ declare module '@ithinkdt/page' {
50
51
  interface FormItemRenderExtraParams {
51
52
  size?: 'small' | 'medium' | 'large' | undefined
52
53
  }
54
+
55
+ type TableColumnOptionKeys = 'cellProps' | 'className' | 'tree' | 'allowExport' | 'customNextSortOrder' | 'filter' | 'filterMode' | 'filterMultiple'
56
+ | 'defaultFilterOptionValue' | 'defaultFilterOptionValues' | 'filterOptionValue' | 'filterOptionValues' | 'filterOptions' | 'renderFilter' | 'renderFilterIcon' | 'renderFilterMenu'
57
+ type TableColumnOptionExtra = {
58
+ [K in TableColumnOptionKeys]?: MaybeRef<TableBaseColumn[K]>
59
+ }
60
+
61
+ // eslint-disable-next-line ts/no-unused-vars
62
+ interface TableColumnOptions<Model extends {}> extends TableColumnOptionExtra {
63
+ }
64
+
65
+ // eslint-disable-next-line ts/no-unused-vars
66
+ interface TableColumn<Model extends {}>extends Pick<TableBaseColumn, TableColumnOptionKeys> {
67
+ }
53
68
  }
54
69
 
55
70
  export type NStateButtonProps = ButtonProps & {
@@ -138,7 +153,7 @@ export type DataFormEmits<Data extends {}> = {
138
153
  }
139
154
 
140
155
  export type DataFormSlots<_Data extends {}> = {
141
- action?: (params: { cols: number, spans: number, overflow: boolean }) => VNodeChild
156
+ action?: (params: { overflow: boolean, grid: ComponentPublicInstance | undefined }) => VNodeChild
142
157
  actionPrefix?: () => VNodeChild
143
158
  actionSuffix?: () => VNodeChild
144
159
  }
@@ -264,12 +279,18 @@ export type DataPaginationEmits = {
264
279
  (e: 'change', value: PageParams): void
265
280
  }
266
281
 
267
- export declare function DataPagination(
268
- props: DataPaginationProps & PublicProps,
269
- ctx?: Pick<GenericCtx<DataPaginationProps, DataPaginationEmits, {}, {}>, 'attrs' | 'emit' | 'slots'>,
270
- expose?: (exposed?: GenericExposed<{}>) => void,
271
- setup?: GenericCtx<DataPaginationProps, DataPaginationEmits, {}, {}>,
272
- ): GenericReturn<DataPaginationProps, DataPaginationEmits, {}, {}>
282
+ export declare interface IDataPagination {
283
+ /** 注入默认的分页大小数组 */
284
+ DEFAULT_PAGE_SIZES_INJECTION_KEY: InjectionKey<number[] | { value: number, label: string }[]>
285
+ (
286
+ props: DataPaginationProps & PublicProps,
287
+ ctx?: Pick<GenericCtx<DataPaginationProps, DataPaginationEmits, {}, {}>, 'attrs' | 'emit' | 'slots'>,
288
+ expose?: (exposed?: GenericExposed<{}>) => void,
289
+ setup?: GenericCtx<DataPaginationProps, DataPaginationEmits, {}, {}>,
290
+ ): GenericReturn<DataPaginationProps, DataPaginationEmits, {}, {}>
291
+ }
292
+
293
+ declare const DataPagination: IDataPagination
273
294
 
274
295
  export type DataSelectionProps = {
275
296
  'count': number
package/esm/page.d.ts CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  ModalOptions, SelectGroupOption, SelectOption, SelectProps, SelectSlots,
5
5
  UploadFileInfo, UploadProps,
6
6
  } from 'ithinkdt-ui'
7
- import { MaybeRef, VNode } from 'vue'
7
+ import { MaybeRef, VNode, VNodeChild } from 'vue'
8
8
 
9
9
  import { PublicProps } from '@ithinkdt/common'
10
10
  import { DictItem, DictTypeKey } from '@ithinkdt/common/dict'
@@ -112,6 +112,15 @@ declare module '@ithinkdt/page' {
112
112
  }
113
113
 
114
114
  interface DescriptionTypePresets {
115
+ longtext: {
116
+ longtextParams: {
117
+ title?: VNodeChild
118
+ showText?: ((value: string) => void) | undefined
119
+ formatText?: ((value: string) => VNodeChild) | undefined
120
+ copyable?: boolean | undefined
121
+ onCopy?: (value: string) => void | undefined
122
+ }
123
+ }
115
124
  number: {
116
125
  numberParams: ShallowMaybeRef<{
117
126
  /** 保留 n 位小数(保留 0) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ithinkdt/ui",
3
- "version": "4.0.0-800",
3
+ "version": "4.0.0-802",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "iThinkDT UI",
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "sideEffects": false,
60
60
  "dependencies": {
61
- "@vueuse/core": "^14.1.0",
61
+ "@vueuse/core": "^14.2.0",
62
62
  "date-fns": "^4.1.0",
63
63
  "vueuc": "^0.4.65",
64
64
  "sortablejs": "^1.15.6",
@@ -83,13 +83,13 @@
83
83
  },
84
84
  "devDependencies": {
85
85
  "@vitejs/plugin-vue-jsx": "^5.1.3",
86
- "ithinkdt-ui": "^1.8.2",
86
+ "ithinkdt-ui": "^1.8.3",
87
87
  "typescript": "~5.9.3",
88
88
  "unocss": ">=66.6.0",
89
- "vite": "^8.0.0-beta.8",
89
+ "vite": "^8.0.0-beta.11",
90
90
  "vue": "^3.5.27",
91
- "vue-router": "^5.0.0-beta.0",
92
- "@ithinkdt/page": "^4.0.0-800"
91
+ "vue-router": "^5.0.1",
92
+ "@ithinkdt/page": "^4.0.0-801"
93
93
  },
94
94
  "scripts": {
95
95
  "dev": "vite build --watch",