@dazhicheng/ui 1.6.0 → 1.6.2

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.
Files changed (125) hide show
  1. package/dist/components/tt-api-component/index.js +4 -3
  2. package/dist/components/tt-api-component/index.vue2.js +4 -3
  3. package/dist/components/tt-area/TtArea.vue3.js +8 -7
  4. package/dist/components/tt-button/index.js +5 -4
  5. package/dist/components/tt-button/index.vue2.js +4 -3
  6. package/dist/components/tt-checkbox/index.js +4 -3
  7. package/dist/components/tt-checkbox/index.vue.js +4 -3
  8. package/dist/components/tt-drawer/index.js +4 -3
  9. package/dist/components/tt-drawer/src/RenderDrawer.vue.js +4 -3
  10. package/dist/components/tt-drawer/src/components/DrawerFooter.vue.js +8 -7
  11. package/dist/components/tt-drawer/src/components/DrawerHeader.vue2.js +3 -2
  12. package/dist/components/tt-drawer/src/props.js +3 -2
  13. package/dist/components/tt-drawer/src/utils/drawer-api.js +4 -2
  14. package/dist/components/tt-empty/index.js +9 -8
  15. package/dist/components/tt-form/index.js +10 -9
  16. package/dist/components/tt-form/src/components/ExpandableArrow.vue2.js +3 -2
  17. package/dist/components/tt-form/src/components/FormActions.vue2.js +4 -2
  18. package/dist/components/tt-form/src/form/FormDescription.vue.js +3 -2
  19. package/dist/components/tt-form/src/form/FormItem.vue.js +6 -5
  20. package/dist/components/tt-form/src/form/FormLabel.vue.js +8 -7
  21. package/dist/components/tt-form/src/form/RenderContent.vue.js +4 -3
  22. package/dist/components/tt-form/src/form-render/FormField.vue2.js +30 -28
  23. package/dist/components/tt-form/src/form-render/FormLabel.vue2.js +4 -2
  24. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +1 -0
  25. package/dist/components/tt-form/src/form-render/array-register/utils.js +6 -4
  26. package/dist/components/tt-form/src/form-render/dependencies.js +19 -18
  27. package/dist/components/tt-form/src/form-render/form.vue2.js +4 -2
  28. package/dist/components/tt-form/src/form-render/helper.js +15 -14
  29. package/dist/components/tt-form/src/form-render/rootWrapperClass.js +3 -2
  30. package/dist/components/tt-form/src/formApi.js +3 -2
  31. package/dist/components/tt-form/src/group-form/GroupForm.vue2.js +4 -3
  32. package/dist/components/tt-form/src/group-form/GroupSection.vue2.js +2 -0
  33. package/dist/components/tt-form/src/group-form/LazyFormField.vue.js +4 -2
  34. package/dist/components/tt-form/src/group-form/groupFormApi.js +4 -3
  35. package/dist/components/tt-form/src/hooks/useForwardPriorityValues.js +3 -2
  36. package/dist/components/tt-form/src/hooks/useSelectCollapse.js +28 -27
  37. package/dist/components/tt-form/src/index.vue2.js +3 -2
  38. package/dist/components/tt-form/src/useFormContext.js +11 -10
  39. package/dist/components/tt-form-item-error-tooltip/index.js +5 -4
  40. package/dist/components/tt-form-item-error-tooltip/index.vue.js +4 -3
  41. package/dist/components/tt-icon/index.js +6 -5
  42. package/dist/components/tt-image/index.js +6 -5
  43. package/dist/components/tt-image/src/components/ImageViewer.js +7 -6
  44. package/dist/components/tt-loading/index.js +4 -3
  45. package/dist/components/tt-loading/src/directive.js +24 -23
  46. package/dist/components/tt-log/index.js +4 -3
  47. package/dist/components/tt-log/index.vue.js +3 -2
  48. package/dist/components/tt-modal/index.js +3 -2
  49. package/dist/components/tt-modal/src/RenderModal.vue.js +3 -2
  50. package/dist/components/tt-modal/src/components/ModalFooter.vue2.js +3 -2
  51. package/dist/components/tt-modal/src/components/ModalHeader.vue2.js +3 -2
  52. package/dist/components/tt-modal/src/components/ModalWrapper.vue.js +15 -14
  53. package/dist/components/tt-modal/src/props.js +3 -2
  54. package/dist/components/tt-modal/src/utils/modal-api.js +4 -2
  55. package/dist/components/tt-modal-form/index.vue.js +4 -3
  56. package/dist/components/tt-nav-anchor/index.js +4 -3
  57. package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue.js +15 -14
  58. package/dist/components/tt-panel-select/index.js +4 -3
  59. package/dist/components/tt-panel-select/src/hooks/usePanelData.js +4 -3
  60. package/dist/components/tt-panel-select/src/index.vue.js +3 -2
  61. package/dist/components/tt-radio-group/index.js +4 -3
  62. package/dist/components/tt-radio-group/index.vue.js +7 -6
  63. package/dist/components/tt-select/index.js +4 -3
  64. package/dist/components/tt-select/src/Select.vue.d.ts +8 -8
  65. package/dist/components/tt-select/src/Select.vue.js +4 -3
  66. package/dist/components/tt-select/src/components/SelectTable.vue.d.ts +116 -7
  67. package/dist/components/tt-select/src/components/SelectTable.vue.js +3 -2
  68. package/dist/components/tt-select/src/components/Table.vue.d.ts +4 -4
  69. package/dist/components/tt-select/src/components/Table.vue.js +3 -2
  70. package/dist/components/tt-select/src/hooks/useDataSource.js +4 -3
  71. package/dist/components/tt-select/src/hooks/useKeyboard.d.ts +7 -1
  72. package/dist/components/tt-select/src/hooks/useSelect.js +3 -2
  73. package/dist/components/tt-select/src/hooks/useSelectTableEvent.d.ts +1 -1
  74. package/dist/components/tt-select/src/hooks/useSelectTableEvent.js +28 -27
  75. package/dist/components/tt-select/src/props.d.ts +2 -2
  76. package/dist/components/tt-table/index.d.ts +6 -6
  77. package/dist/components/tt-table/index.js +1 -1
  78. package/dist/components/tt-table/src/Table.vue.d.ts +4 -4
  79. package/dist/components/tt-table/src/Table.vue.js +178 -175
  80. package/dist/components/tt-table/src/TableForm.vue.d.ts +6 -6
  81. package/dist/components/tt-table/src/TableForm.vue.js +2 -2
  82. package/dist/components/tt-table/src/components/TableAction.vue.js +19 -17
  83. package/dist/components/tt-table/src/components/TableButtons.js +10 -9
  84. package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +4 -3
  85. package/dist/components/tt-table/src/components/TableToolbarTools.vue.js +18 -17
  86. package/dist/components/tt-table/src/emits.d.ts +10 -1
  87. package/dist/components/tt-table/src/hooks/useColumnPersistence.js +17 -16
  88. package/dist/components/tt-table/src/hooks/useColumns.js +4 -3
  89. package/dist/components/tt-table/src/hooks/useKeyboardNav.js +34 -33
  90. package/dist/components/tt-table/src/hooks/usePagination.js +12 -11
  91. package/dist/components/tt-table/src/hooks/useQuery.js +6 -5
  92. package/dist/components/tt-table/src/hooks/useRowIdentity.d.ts +1 -0
  93. package/dist/components/tt-table/src/hooks/useRowIdentity.js +68 -54
  94. package/dist/components/tt-table/src/hooks/useRowSelection.d.ts +5 -7
  95. package/dist/components/tt-table/src/hooks/useRowSelection.js +70 -68
  96. package/dist/components/tt-table/src/hooks/useSideSlot.js +4 -3
  97. package/dist/components/tt-table/src/hooks/useSyncProps.js +4 -3
  98. package/dist/components/tt-table/src/hooks/useTableData.js +6 -5
  99. package/dist/components/tt-table/src/hooks/useTableFooter.js +9 -8
  100. package/dist/components/tt-table/src/hooks/useTableForm.js +4 -3
  101. package/dist/components/tt-table/src/hooks/useTableRender.d.ts +37 -4
  102. package/dist/components/tt-table/src/props.d.ts +12 -6
  103. package/dist/components/tt-table/src/props.js +14 -7
  104. package/dist/components/tt-table/src/table-mutation-events.js +10 -9
  105. package/dist/components/tt-table/src/types/table.d.ts +16 -0
  106. package/dist/components/tt-table/src/utils/action-tab-index.js +15 -14
  107. package/dist/components/tt-table/src/utils/context.js +5 -4
  108. package/dist/components/tt-table/src/utils/table-api.js +4 -2
  109. package/dist/components/tt-table/src/utils/table-form-api.js +22 -20
  110. package/dist/components/tt-text/index.js +4 -3
  111. package/dist/components/tt-upload/index.js +6 -5
  112. package/dist/components/tt-upload/src/TtUpload.vue.js +4 -3
  113. package/dist/directives/disabled-tip/index.js +9 -8
  114. package/dist/hooks/useFormSchemasLink.js +4 -3
  115. package/dist/hooks/useFormat.d.ts +35 -71
  116. package/dist/hooks/useFormat.js +28 -39
  117. package/dist/hooks/usePanelSelectSchemas.js +4 -3
  118. package/dist/hooks/useScreenshotOss.js +16 -15
  119. package/dist/packages/hooks/src/useDebounce.js +5 -4
  120. package/dist/packages/hooks/src/useElementScreenshot.js +4 -3
  121. package/dist/packages/hooks/src/usePriorityValue.js +5 -4
  122. package/dist/packages/utils/src/format.js +48 -0
  123. package/dist/plugins/default/renderCellContent.js +4 -3
  124. package/dist/plugins/vxeTable/switchStatus.js +14 -13
  125. package/package.json +3 -3
@@ -71,10 +71,16 @@ export declare const tableProps: {
71
71
  type: PropType<TtTableProps["beforeFetch"]>;
72
72
  default: null;
73
73
  };
74
- /** data */
74
+ /**
75
+ * data
76
+ *
77
+ * `default` 显式标注返回类型:不标注时 `[]` 会被推断为 `never[]`,
78
+ * Vue 的 `ExtractPropTypes` 让 default 的返回类型参与推导,把 `PropType` 声明的类型收窄成
79
+ * `never[]`,业务传具体行类型的数组会直接报 TS2322。
80
+ */
75
81
  data: {
76
82
  type: PropType<TtTableProps["data"]>;
77
- default: () => never[];
83
+ default: () => TtTableProps["data"];
78
84
  };
79
85
  /** 是否滚动加载数据 */
80
86
  isScrollFetch: {
@@ -414,9 +420,9 @@ export declare const tableFormProps: {
414
420
  headerTooltipConfig?: VxeTablePropTypes.HeaderTooltipConfig<any> | undefined;
415
421
  tooltipConfig?: VxeTablePropTypes.TooltipConfig<any> | undefined;
416
422
  footerTooltipConfig?: VxeTablePropTypes.FooterTooltipConfig<any> | undefined;
417
- exportConfig?: VxeTablePropTypes.ExportConfig | undefined;
418
- importConfig?: VxeTablePropTypes.ImportConfig | undefined;
419
- printConfig?: VxeTablePropTypes.PrintConfig | undefined;
423
+ exportConfig?: VxeTablePropTypes.ExportConfig<any> | undefined;
424
+ importConfig?: VxeTablePropTypes.ImportConfig<any> | undefined;
425
+ printConfig?: VxeTablePropTypes.PrintConfig<any> | undefined;
420
426
  expandConfig?: VxeTablePropTypes.ExpandConfig<any> | undefined;
421
427
  treeConfig?: VxeTablePropTypes.TreeConfig<any> | undefined;
422
428
  mouseConfig?: VxeTablePropTypes.MouseConfig | undefined;
@@ -543,7 +549,7 @@ export declare const tableOtherProps: {
543
549
  /** 列配置 */
544
550
  columns: {
545
551
  type: PropType<TtTableProps["columns"]>;
546
- default: () => never[];
552
+ default: () => TtTableProps["columns"];
547
553
  };
548
554
  /**
549
555
  * 表格的高度;支持铺满父容器或者固定高度,如果设置 auto 为铺满父容器(如果设置为 auto,则必须确保存在父节点且不允许存在相邻元素)
@@ -3,6 +3,7 @@ import "axios";
3
3
  import "element-plus";
4
4
  import "dayjs";
5
5
  import "vue";
6
+ import "numeral";
6
7
  import "xe-utils";
7
8
  import "dayjs/plugin/utc";
8
9
  import "dayjs/plugin/timezone";
@@ -102,7 +103,13 @@ const r = {
102
103
  type: Function,
103
104
  default: null
104
105
  },
105
- /** data */
106
+ /**
107
+ * data
108
+ *
109
+ * `default` 显式标注返回类型:不标注时 `[]` 会被推断为 `never[]`,
110
+ * Vue 的 `ExtractPropTypes` 让 default 的返回类型参与推导,把 `PropType` 声明的类型收窄成
111
+ * `never[]`,业务传具体行类型的数组会直接报 TS2322。
112
+ */
106
113
  data: {
107
114
  type: Array,
108
115
  default: () => []
@@ -135,7 +142,7 @@ const r = {
135
142
  },
136
143
  /** 是否显示表格上方 alert */
137
144
  showTableAlert: { type: Boolean, default: () => e("showTableAlert") }
138
- }, T = {
145
+ }, j = {
139
146
  /**
140
147
  * 是否自适应高度
141
148
  *
@@ -224,7 +231,7 @@ const r = {
224
231
  type: Object,
225
232
  default: () => e("radioConfig")
226
233
  }
227
- }, j = {
234
+ }, I = {
228
235
  /**
229
236
  * table参数
230
237
  *
@@ -277,7 +284,7 @@ const r = {
277
284
  tableFormApi: {
278
285
  type: Object
279
286
  }
280
- }, I = {
287
+ }, A = {
281
288
  /** 列配置 */
282
289
  columns: {
283
290
  type: Array,
@@ -337,7 +344,7 @@ const r = {
337
344
  ...d
338
345
  };
339
346
  export {
340
- j as tableFormProps,
341
- I as tableOtherProps,
342
- T as tableProps
347
+ I as tableFormProps,
348
+ A as tableOtherProps,
349
+ j as tableProps
343
350
  };
@@ -2,8 +2,9 @@ import "axios";
2
2
  import "element-plus";
3
3
  import { isString as s, isArray as c } from "../../../packages/utils/src/is.js";
4
4
  import "vue";
5
- import u from "xe-utils";
6
5
  import "dayjs";
6
+ import "numeral";
7
+ import u from "xe-utils";
7
8
  import "dayjs/plugin/utc";
8
9
  import "dayjs/plugin/timezone";
9
10
  import "../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -39,7 +40,7 @@ const p = /* @__PURE__ */ new Set([
39
40
  "filter-change",
40
41
  "clear-filter",
41
42
  "clear-all-filter"
42
- ]), m = /* @__PURE__ */ new Set(["insert", "insert_edit", "insert_actived", "remove"]), w = /* @__PURE__ */ new Set(["undo", "redo"]), _ = d.map((t) => [t, u.camelCase(t)]);
43
+ ]), m = /* @__PURE__ */ new Set(["insert", "insert_edit", "insert_actived", "remove"]), w = /* @__PURE__ */ new Set(["undo", "redo"]), $ = d.map((t) => [t, u.camelCase(t)]);
43
44
  function b(t) {
44
45
  var r, o;
45
46
  const e = t[0];
@@ -53,18 +54,18 @@ function g(t, e) {
53
54
  const a = e();
54
55
  return (c(a) ? !a.length : !a) ? !1 : !((l = (n = (i = r == null ? void 0 : r.$grid) == null ? void 0 : i.getCheckboxRecords) == null ? void 0 : n.call(i)) != null && l.length);
55
56
  }
56
- function $(t, e, r) {
57
+ function B(t, e, r) {
57
58
  return p.has(t) ? !0 : t === "edit-activated" ? b(e) : t === "toolbar-button-click" ? g(e, r) : !1;
58
59
  }
59
- function B(t) {
60
+ function U(t) {
60
61
  return f.has(t);
61
62
  }
62
- function U(t) {
63
+ function X(t) {
63
64
  return w.has(t) ? "visible" : "full";
64
65
  }
65
66
  export {
66
- _ as forwardedEventEntries,
67
- U as getMutationCommitSource,
68
- B as isDisplayOnlyEvent,
69
- $ as isRowDataMutationEvent
67
+ $ as forwardedEventEntries,
68
+ X as getMutationCommitSource,
69
+ U as isDisplayOnlyEvent,
70
+ B as isRowDataMutationEvent
70
71
  };
@@ -413,6 +413,22 @@ export type VxeTableMethods<DT> = {
413
413
  };
414
414
  export type TtSelectRowKeysType = Array<string | number> | string | number | undefined | any;
415
415
  export type TtSelectRowsType = VxeTablePropTypes.Row | Array<VxeTablePropTypes.Row> | any;
416
+ /**
417
+ * 选中行变化事件(`selection-change`)的载荷。
418
+ *
419
+ * 由 `useRowSelection` 发出,同时作为 `onSelectionChange` prop 的参数类型:
420
+ * 声明成具名 prop 后,业务的回调匹配的是这个具体签名,而不是 emits 数组生成的
421
+ * `on${Capitalize<string>}` 索引签名 —— 后者的值类型是 `defineModel` 与数组 emits
422
+ * 交叉出的函数,在参数逆变位置上和任何具名参数的回调都不兼容。
423
+ */
424
+ export type TtTableSelectionPayload = {
425
+ /** 选中行的 key 集合 */
426
+ keys: TtSelectRowKeysType;
427
+ /** 选中的行数据 */
428
+ rows: TtSelectRowsType;
429
+ /** 触发本次变化的行,全选与清空时为空 */
430
+ data?: Recordable;
431
+ };
416
432
  /**
417
433
  * `useTableRender` 返回组件的插槽类型。
418
434
  *
@@ -2,8 +2,9 @@ import "axios";
2
2
  import "element-plus";
3
3
  import { isUndefined as d, isServer as f } from "../../../../packages/utils/src/is.js";
4
4
  import "vue";
5
- import "xe-utils";
6
5
  import "dayjs";
6
+ import "numeral";
7
+ import "xe-utils";
7
8
  import "dayjs/plugin/utc";
8
9
  import "dayjs/plugin/timezone";
9
10
  import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -16,25 +17,25 @@ let a;
16
17
  function p() {
17
18
  const u = Array.from(document.querySelectorAll('[class*="table-action"]')), r = /* @__PURE__ */ new Map();
18
19
  u.forEach((n) => {
19
- const o = n.closest(".vxe-table");
20
- if (!o) return;
21
- const s = n.getBoundingClientRect(), t = Math.round(s.top), e = r.get(o) || /* @__PURE__ */ new Map(), i = e.get(t) || [];
22
- i.push(n), e.set(t, i), r.set(o, e);
20
+ const e = n.closest(".vxe-table");
21
+ if (!e) return;
22
+ const s = n.getBoundingClientRect(), t = Math.round(s.top), o = r.get(e) || /* @__PURE__ */ new Map(), i = o.get(t) || [];
23
+ i.push(n), o.set(t, i), r.set(e, o);
23
24
  }), r.forEach((n) => {
24
- n.forEach((o) => {
25
- const s = o.sort((t, e) => {
26
- const i = t.closest(".vxe-table"), c = e.closest(".vxe-table"), l = i != null && i.classList.contains("is--fixed-right") ? 1 : 0, m = c != null && c.classList.contains("is--fixed-right") ? 1 : 0;
27
- return l !== m ? m - l : e.getBoundingClientRect().left - t.getBoundingClientRect().left;
25
+ n.forEach((e) => {
26
+ const s = e.sort((t, o) => {
27
+ const i = t.closest(".vxe-table"), c = o.closest(".vxe-table"), l = i != null && i.classList.contains("is--fixed-right") ? 1 : 0, m = c != null && c.classList.contains("is--fixed-right") ? 1 : 0;
28
+ return l !== m ? m - l : o.getBoundingClientRect().left - t.getBoundingClientRect().left;
28
29
  })[0];
29
- o.forEach((t) => {
30
- t.querySelectorAll("[data-table-action-button]").forEach((e) => {
31
- e.tabIndex = t === s ? 0 : -1;
30
+ e.forEach((t) => {
31
+ t.querySelectorAll("[data-table-action-button]").forEach((o) => {
32
+ o.tabIndex = t === s ? 0 : -1;
32
33
  });
33
34
  });
34
35
  });
35
36
  });
36
37
  }
37
- function B() {
38
+ function I() {
38
39
  if (d(a)) {
39
40
  if (f || !window.requestAnimationFrame) {
40
41
  p();
@@ -46,5 +47,5 @@ function B() {
46
47
  }
47
48
  }
48
49
  export {
49
- B as scheduleNormalizeActionTabIndex
50
+ I as scheduleNormalizeActionTabIndex
50
51
  };
@@ -2,8 +2,9 @@ import { inject as s, provide as c } from "vue";
2
2
  import "axios";
3
3
  import "element-plus";
4
4
  import { isString as m, isArray as p } from "../../../../packages/utils/src/is.js";
5
- import "xe-utils";
6
5
  import "dayjs";
6
+ import "numeral";
7
+ import "xe-utils";
7
8
  import "dayjs/plugin/utc";
8
9
  import "dayjs/plugin/timezone";
9
10
  import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -22,9 +23,9 @@ function f(t, r) {
22
23
  );
23
24
  }, (o) => (c(n, o), o)];
24
25
  }
25
- const [T, D] = f("FormActionTestIds");
26
+ const [D, E] = f("FormActionTestIds");
26
27
  export {
27
28
  f as createContext,
28
- T as injectFormActionTestIds,
29
- D as provideFormActionTestIds
29
+ D as injectFormActionTestIds,
30
+ E as provideFormActionTestIds
30
31
  };
@@ -5,6 +5,8 @@ import "axios";
5
5
  import "element-plus";
6
6
  import { isFunction as w } from "../../../../packages/utils/src/is.js";
7
7
  import { reactive as m, shallowRef as y, computed as n, toValue as d } from "vue";
8
+ import "dayjs";
9
+ import "numeral";
8
10
  import { bindMethods as p } from "../../../../packages/utils/src/tool.js";
9
11
  import { mergeWithArrayOverride as h } from "../../../../packages/utils/src/merge.js";
10
12
  import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -39,7 +41,7 @@ function C() {
39
41
  columnsKey: (l = o.table) == null ? void 0 : l.columnsKey
40
42
  };
41
43
  }
42
- class k {
44
+ class F {
43
45
  /**
44
46
  * 构造函数,初始化 store、状态等
45
47
  * @param options 表格配置项
@@ -425,6 +427,6 @@ class k {
425
427
  }
426
428
  }
427
429
  export {
428
- k as TableApi,
430
+ F as TableApi,
429
431
  C as getDefaultState
430
432
  };
@@ -1,10 +1,12 @@
1
- var m = Object.defineProperty;
2
- var b = (s, t, e) => t in s ? m(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var r = (s, t, e) => b(s, typeof t != "symbol" ? t + "" : t, e);
1
+ var h = Object.defineProperty;
2
+ var b = (r, t, e) => t in r ? h(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var s = (r, t, e) => b(r, typeof t != "symbol" ? t + "" : t, e);
4
4
  import "axios";
5
5
  import "element-plus";
6
6
  import { isFunction as c } from "../../../../packages/utils/src/is.js";
7
7
  import { reactive as i, computed as u, toValue as f } from "vue";
8
+ import "dayjs";
9
+ import "numeral";
8
10
  import { bindMethods as d } from "../../../../packages/utils/src/tool.js";
9
11
  import { mergeWithArrayOverride as a } from "../../../../packages/utils/src/merge.js";
10
12
  import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -16,37 +18,37 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pa
16
18
  import "lodash-es";
17
19
  import { Store as A, useStore as S } from "@tanstack/vue-store";
18
20
  import { getDefaultState as y, TableApi as j } from "./table-api.js";
19
- function g(s) {
20
- if (!s) return;
21
+ function g(r) {
22
+ if (!r) return;
21
23
  const t = {};
22
- return Object.keys(s).forEach((e) => {
23
- e !== "data" && Object.assign(t, { [e]: s[e] });
24
+ return Object.keys(r).forEach((e) => {
25
+ e !== "data" && Object.assign(t, { [e]: r[e] });
24
26
  }), t;
25
27
  }
26
- class V {
28
+ class q {
27
29
  /**
28
30
  * 构造函数,初始化 store、tableApi、状态等
29
31
  * @param options 表单+表格配置项
30
32
  */
31
33
  constructor(t = {}) {
32
34
  /** form 表单实例(FormApi) */
33
- r(this, "formApi", i({}));
35
+ s(this, "formApi", i({}));
34
36
  /** 表格 API 实例(TableApi) */
35
- r(this, "tableApi", i({}));
37
+ s(this, "tableApi", i({}));
36
38
  /** vxe-grid 表格实例 */
37
- r(this, "grid", i({}));
39
+ s(this, "grid", i({}));
38
40
  /** 当前表单+表格的 props 状态 */
39
- r(this, "state", null);
41
+ s(this, "state", null);
40
42
  /** 表单操作方法集合(TableFormActionType) */
41
- r(this, "tableForm", i({}));
43
+ s(this, "tableForm", i({}));
42
44
  /** 响应式 store,存储表单+表格的状态 */
43
- r(this, "store");
44
- r(this, "isMounted", !1);
45
- r(this, "stateHandler");
45
+ s(this, "store");
46
+ s(this, "isMounted", !1);
47
+ s(this, "stateHandler");
46
48
  /**
47
49
  * 当前选中的行 key 数组(响应式)
48
50
  */
49
- r(this, "selectedKeys", u(() => f(this.tableApi.selectedKeys) ?? []));
51
+ s(this, "selectedKeys", u(() => f(this.tableApi.selectedKeys) ?? []));
50
52
  const e = { ...t }, o = g(t.table);
51
53
  o && (e.table = o);
52
54
  const p = y();
@@ -65,8 +67,8 @@ class V {
65
67
  const n = new j({
66
68
  ...this.state.table,
67
69
  useSearchForm: this.state.useSearchForm || !1
68
- }), l = n;
69
- l.useStore = (h) => S(n.store, h), Object.setPrototypeOf(this.tableApi, l), d(this);
70
+ }), m = n;
71
+ m.useStore = (l) => S(n.store, l), Object.setPrototypeOf(this.tableApi, m), d(this);
70
72
  }
71
73
  /**
72
74
  * 组件挂载时调用,注入表单和表格实例
@@ -139,5 +141,5 @@ class V {
139
141
  }
140
142
  }
141
143
  export {
142
- V as TableFormApi
144
+ q as TableFormApi
143
145
  };
@@ -3,6 +3,7 @@ import "element-plus";
3
3
  import "dayjs";
4
4
  import "vue";
5
5
  import { withInstall as t } from "../../packages/utils/src/install.js";
6
+ import "numeral";
6
7
  import "xe-utils";
7
8
  import "dayjs/plugin/utc";
8
9
  import "dayjs/plugin/timezone";
@@ -13,8 +14,8 @@ import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb
13
14
  import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
14
15
  import "lodash-es";
15
16
  import o from "./index.vue.js";
16
- const h = t(o);
17
+ const w = t(o);
17
18
  export {
18
- h as TtText,
19
- h as default
19
+ w as TtText,
20
+ w as default
20
21
  };
@@ -3,6 +3,7 @@ import "element-plus";
3
3
  import "dayjs";
4
4
  import "vue";
5
5
  import { withInstall as o } from "../../packages/utils/src/install.js";
6
+ import "numeral";
6
7
  import "xe-utils";
7
8
  import "dayjs/plugin/utc";
8
9
  import "dayjs/plugin/timezone";
@@ -13,10 +14,10 @@ import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb
13
14
  import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
14
15
  import "lodash-es";
15
16
  import t from "./src/TtUpload.vue.js";
16
- import { ttUploadProps as I } from "./src/typing.js";
17
- const h = o(t);
17
+ import { ttUploadProps as P } from "./src/typing.js";
18
+ const u = o(t);
18
19
  export {
19
- h as TtUpload,
20
- h as default,
21
- I as ttUploadProps
20
+ u as TtUpload,
21
+ u as default,
22
+ P as ttUploadProps
22
23
  };
@@ -9,8 +9,9 @@ import { useDesign as ge } from "../../../packages/hooks/src/useDesign.js";
9
9
  import "axios";
10
10
  import { ElMessage as p, ElImageViewer as _e, ElUpload as he } from "element-plus";
11
11
  import { isString as ye, isNumber as Ue } from "../../../packages/utils/src/is.js";
12
- import "xe-utils";
13
12
  import "dayjs";
13
+ import "numeral";
14
+ import "xe-utils";
14
15
  import "dayjs/plugin/utc";
15
16
  import "dayjs/plugin/timezone";
16
17
  import "../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -25,7 +26,7 @@ import { TtText as V } from "../../tt-text/index.js";
25
26
  import { ttUploadProps as $e } from "./typing.js";
26
27
  import { GlobalConfig as F } from "../../../hooks/useSetup.js";
27
28
  import { useModalRender as Se } from "../../tt-modal/src/hooks/useModalRender.js";
28
- const Qe = /* @__PURE__ */ de({
29
+ const Ze = /* @__PURE__ */ de({
29
30
  name: "TtUpload",
30
31
  __name: "TtUpload",
31
32
  props: /* @__PURE__ */ z($e, {
@@ -314,5 +315,5 @@ const Qe = /* @__PURE__ */ de({
314
315
  }
315
316
  });
316
317
  export {
317
- Qe as default
318
+ Ze as default
318
319
  };
@@ -1,9 +1,10 @@
1
1
  import "axios";
2
2
  import { ElTooltip as b } from "element-plus";
3
3
  import { isArray as l, isObject as m } from "../../packages/utils/src/is.js";
4
- import { shallowRef as v, toValue as s, h as p, createVNode as g, render as h } from "vue";
5
- import "xe-utils";
4
+ import { shallowRef as v, toValue as p, h as s, createVNode as g, render as h } from "vue";
6
5
  import "dayjs";
6
+ import "numeral";
7
+ import "xe-utils";
7
8
  import "dayjs/plugin/utc";
8
9
  import "dayjs/plugin/timezone";
9
10
  import "../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -16,10 +17,10 @@ let n;
16
17
  const d = v();
17
18
  function V(e) {
18
19
  if (l(e) && e.length > 0)
19
- return e.filter((t) => s(t.condition) ?? !0).map((t) => t.message);
20
+ return e.filter((t) => p(t.condition) ?? !0).map((t) => t.message);
20
21
  if (m(e)) {
21
22
  const t = e;
22
- return !!s(t.condition) ? t.message : null;
23
+ return !!p(t.condition) ? t.message : null;
23
24
  }
24
25
  return typeof e == "string" ? e : null;
25
26
  }
@@ -27,7 +28,7 @@ function x(e) {
27
28
  return l(e) && e.length > 0 ? e[0].placement || "bottom" : m(e) && e.placement || "bottom";
28
29
  }
29
30
  function y(e, t, o = "bottom") {
30
- if (d.value = Array.isArray(t) ? t.map((r) => p("div", {}, r)) : t, n)
31
+ if (d.value = Array.isArray(t) ? t.map((r) => s("div", {}, r)) : t, n)
31
32
  n.props.trigger = "hover", n.props.virtualRef = e, n.props.placement = o, n.exposed.updatePopper(), n.exposed.onOpen();
32
33
  else {
33
34
  const r = g(
@@ -44,7 +45,7 @@ function y(e, t, o = "bottom") {
44
45
  popperClass: "!z-[9999]"
45
46
  },
46
47
  {
47
- content: () => p(
48
+ content: () => s(
48
49
  "div",
49
50
  {
50
51
  style: {
@@ -75,7 +76,7 @@ async function a(e, t) {
75
76
  const o = t.value, r = V(o), i = x(o);
76
77
  e.boundingValue = e.boundingValue || { listened: !1, messages: r, placement: i }, e.boundingValue.messages = r, e.boundingValue.placement = i, !((u = e.boundingValue) != null && u.listened) && (r != null && r.length) && (e.addEventListener("mouseenter", c), e.addEventListener("mouseleave", f), e.boundingValue.listened = !0);
77
78
  }
78
- const N = {
79
+ const q = {
79
80
  created: a,
80
81
  beforeMount: a,
81
82
  updated: a,
@@ -85,5 +86,5 @@ const N = {
85
86
  }
86
87
  };
87
88
  export {
88
- N as default
89
+ q as default
89
90
  };
@@ -3,8 +3,9 @@ import "axios";
3
3
  import { ElSelectV2 as Z } from "element-plus";
4
4
  import { isFunction as q } from "../packages/utils/src/is.js";
5
5
  import "vue";
6
- import "xe-utils";
7
6
  import "dayjs";
7
+ import "numeral";
8
+ import "xe-utils";
8
9
  import "dayjs/plugin/utc";
9
10
  import "dayjs/plugin/timezone";
10
11
  import "../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
@@ -286,7 +287,7 @@ function no(r = {}, u = z) {
286
287
  dataSource: I
287
288
  };
288
289
  }
289
- function Po() {
290
+ function So() {
290
291
  const r = {
291
292
  options: {},
292
293
  codes: [...z]
@@ -337,5 +338,5 @@ function Po() {
337
338
  return u;
338
339
  }
339
340
  export {
340
- Po as useFormSchemasLink
341
+ So as useFormSchemasLink
341
342
  };
@@ -1,73 +1,37 @@
1
- import { default as dayjs } from 'dayjs';
2
- type ILabelFormatType = "period" | "month";
3
- type FormatReturnType = {
4
- /**
5
- * 生成表单验证规则
6
- * @param message - 验证失败时的提示信息
7
- * @param trigger - 触发验证的时机,默认为'change'
8
- * @returns 验证规则数组
9
- */
10
- formatFormRole: (message: string, trigger?: string) => {
11
- required: boolean;
12
- message: string;
13
- trigger: string;
14
- }[];
15
- /**
16
- * 格式化日期时间
17
- * @param date - 要格式化的日期,可以是字符串、数字、Date对象或dayjs对象
18
- * @param format - 格式化模板,默认为'YYYY-MM-DD HH:mm:ss'
19
- * @returns 格式化后的日期时间字符串,无效日期返回'--'
20
- */
21
- formatToDateTime: (date: string | number | Date | dayjs.Dayjs | null | undefined, format?: string) => string;
22
- /**
23
- * 格式化日期
24
- * @param date - 要格式化的日期,可以是字符串、数字、Date对象或dayjs对象
25
- * @param format - 格式化模板,默认为'YYYY-MM-DD'
26
- * @param isTimeStamp - 是否为时间戳格式,默认为false
27
- * @returns 格式化后的日期字符串,无效日期返回'--'
28
- */
29
- formatToDate: (date: string | number | Date | dayjs.Dayjs | null | undefined, format?: string, isTimeStamp?: boolean) => string;
30
- /**
31
- * 格式化金额数据
32
- * @param val - 要格式化的金额,可以是数字或字符串
33
- * @param format - 格式化模板,默认为'0,0.00'
34
- * @returns 格式化后的金额字符串
35
- */
36
- formatAmount: (val: number | string, format?: string) => string;
37
- /**
38
- * 格式化金额为千分位并保留两位小数
39
- * @param val - 要格式化的数值
40
- * @param format - 格式化模板,默认为'0,0.00'
41
- * @returns 格式化后的金额字符串
42
- */
43
- formatAmountOfPlace: (val: number, format?: string) => string;
44
- /**
45
- * 将千分位格式的金额字符串转换为数值
46
- * @param val - 要转换的金额字符串或数值
47
- * @returns 转换后的数值
48
- */
49
- formatPlaceOfAmount: (val: string | number) => number;
50
- /**
51
- * 格式化金额但不四舍五入
52
- * @param str - 要格式化的金额字符串或数字
53
- * @param index - 要保留的小数位数
54
- * @returns 格式化后的金额字符串
55
- */
56
- formatDecimal: (str: string | number, index: number) => string;
57
- /**
58
- * 格式化文件大小
59
- * @param bytes - 文件大小(字节)
60
- * @param decimalPoint - 保留的小数位数,默认为2
61
- * @returns 格式化后的文件大小字符串(带单位)
62
- */
63
- formatFileSize: (bytes: number, decimalPoint?: number) => string;
64
- /**
65
- * 格式化期间(年月)
66
- * @param val - 要格式化的期间值,可以是数字或字符串
67
- * @param formatType - 格式化类型,'period'表示期间,'month'表示月份
68
- * @returns 格式化后的期间字符串
69
- */
70
- formatPeriod: (val: number | string, formatType?: ILabelFormatType) => string;
1
+ import { formatAmount, formatAmountOfPlace, formatDecimal, formatFileSize, formatPeriod, formatPlaceOfAmount, formatToDate, formatToDateTime } from '../../../utils/src';
2
+ /**
3
+ * 生成表单验证规则
4
+ *
5
+ * 留在 ui 包:它产出的是 element-plus 表单的校验规则,不属于数据格式化。
6
+ * @param message 验证失败时的提示信息
7
+ * @param trigger 触发验证的时机,默认 `change`
8
+ * @returns 校验规则数组
9
+ */
10
+ declare function formatFormRole(message: string, trigger?: string): {
11
+ required: boolean;
12
+ message: string;
13
+ trigger: string;
14
+ }[];
15
+ /**
16
+ * 格式化方法集合。
17
+ *
18
+ * `formatFormRole` 外的实现都在 `@dazhicheng/utils` 的 `format` 模块,这里只做转发,
19
+ * 保证 hook 与直接 `import { formatAmount } from "@dazhicheng/utils"` 拿到的是同一份实现。
20
+ * 返回类型交给推断,避免 hook 侧与 utils 侧维护两套签名。
21
+ * @returns 格式化方法集合
22
+ * @example
23
+ * const { formatAmount, formatToDate } = useFormat();
24
+ * formatAmount(1234.5); // "1,234.50"
25
+ */
26
+ export declare function useFormat(): {
27
+ formatFormRole: typeof formatFormRole;
28
+ formatToDateTime: typeof formatToDateTime;
29
+ formatToDate: typeof formatToDate;
30
+ formatAmount: typeof formatAmount;
31
+ formatAmountOfPlace: typeof formatAmountOfPlace;
32
+ formatPlaceOfAmount: typeof formatPlaceOfAmount;
33
+ formatDecimal: typeof formatDecimal;
34
+ formatFileSize: typeof formatFileSize;
35
+ formatPeriod: typeof formatPeriod;
71
36
  };
72
- export declare function useFormat(): FormatReturnType;
73
37
  export {};