@dazhicheng/ui 1.6.7 → 1.6.8

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 (93) hide show
  1. package/dist/components/tt-form/src/form-render/expandable.js +31 -32
  2. package/dist/components/tt-form/src/useFormContext.js +1 -1
  3. package/dist/components/tt-table/index.d.ts +3 -15
  4. package/dist/components/tt-table/index.js +5 -4
  5. package/dist/components/tt-table/src/Table.vue.d.ts +1 -1
  6. package/dist/components/tt-table/src/Table.vue.js +3 -3
  7. package/dist/components/tt-table/src/TableForm.vue.js +168 -159
  8. package/dist/components/tt-table/src/components/TableAction.vue.d.ts +2 -12
  9. package/dist/components/tt-table/src/components/TableAction.vue.js +78 -175
  10. package/dist/components/tt-table/src/hooks/useGridProps.js +64 -60
  11. package/dist/components/tt-table/src/hooks/useTableData.js +77 -74
  12. package/dist/components/tt-table/src/types/table.d.ts +2 -1
  13. package/dist/components/tt-table/src/utils/table-api.d.ts +2 -1
  14. package/dist/components/tt-table/src/utils/table-api.js +3 -2
  15. package/dist/components/tt-vtable/index.js +54 -0
  16. package/dist/components/tt-vtable/src/components/TtVTable.vue.d.ts +188 -0
  17. package/dist/components/tt-vtable/src/components/TtVTable.vue.js +227 -0
  18. package/dist/components/tt-vtable/src/components/TtVTable.vue2.js +4 -0
  19. package/dist/components/tt-vtable/src/components/TtVTableForm.vue.d.ts +32 -0
  20. package/dist/components/tt-vtable/src/components/TtVTableForm.vue.js +121 -0
  21. package/dist/components/tt-vtable/src/components/TtVTableForm.vue2.js +4 -0
  22. package/dist/components/tt-vtable/src/components/VTableEmpty.vue.d.ts +64 -0
  23. package/dist/components/tt-vtable/src/components/VTableEmpty.vue.js +97 -0
  24. package/dist/components/tt-vtable/src/components/VTableEmpty.vue2.js +4 -0
  25. package/dist/components/tt-vtable/src/components/VTablePagination.vue.d.ts +53 -0
  26. package/dist/components/tt-vtable/src/components/VTablePagination.vue.js +52 -0
  27. package/dist/components/tt-vtable/src/components/VTablePagination.vue2.js +4 -0
  28. package/dist/components/tt-vtable/src/components/VTableSelectionAlert.vue.d.ts +35 -0
  29. package/dist/components/tt-vtable/src/components/VTableSelectionAlert.vue.js +50 -0
  30. package/dist/components/tt-vtable/src/components/VTableSelectionAlert.vue2.js +4 -0
  31. package/dist/components/tt-vtable/src/components/VTableToolbar.vue.d.ts +63 -0
  32. package/dist/components/tt-vtable/src/components/VTableToolbar.vue.js +126 -0
  33. package/dist/components/tt-vtable/src/components/VTableToolbar.vue2.js +4 -0
  34. package/dist/components/tt-vtable/src/components/VTableViewport.vue.js +133 -0
  35. package/dist/components/tt-vtable/src/components/VTableViewport.vue2.js +4 -0
  36. package/dist/components/tt-vtable/src/composables/useVTable.d.ts +41 -0
  37. package/dist/components/tt-vtable/src/composables/useVTable.js +25 -0
  38. package/dist/components/tt-vtable/src/composables/useVTableFormRender.d.ts +13 -0
  39. package/dist/components/tt-vtable/src/composables/useVTableFormRender.js +92 -0
  40. package/dist/components/tt-vtable/src/composables/useVTableRender.d.ts +13 -0
  41. package/dist/components/tt-vtable/src/composables/useVTableRender.js +13 -0
  42. package/dist/components/tt-vtable/src/engine/visactor/createListTable.d.ts +10 -0
  43. package/dist/components/tt-vtable/src/engine/visactor/createListTable.js +63 -0
  44. package/dist/components/tt-vtable/src/engine/visactor/createVueCellLayout.d.ts +37 -0
  45. package/dist/components/tt-vtable/src/engine/visactor/createVueCellLayout.js +133 -0
  46. package/dist/components/tt-vtable/src/engine/visactor/index.d.ts +8 -0
  47. package/dist/components/tt-vtable/src/engine/visactor/native-boundaries.d.ts +23 -0
  48. package/dist/components/tt-vtable/src/engine/visactor/native-boundaries.js +70 -0
  49. package/dist/components/tt-vtable/src/engine/visactor/record-adapter.d.ts +38 -0
  50. package/dist/components/tt-vtable/src/engine/visactor/record-adapter.js +41 -0
  51. package/dist/components/tt-vtable/src/engine/visactor/toColumnDefinitions.d.ts +45 -0
  52. package/dist/components/tt-vtable/src/engine/visactor/toColumnDefinitions.js +73 -0
  53. package/dist/components/tt-vtable/src/engine/visactor/toListTableOptions.d.ts +25 -0
  54. package/dist/components/tt-vtable/src/engine/visactor/toListTableOptions.js +25 -0
  55. package/dist/components/tt-vtable/src/engine/visactor/types.d.ts +29 -0
  56. package/dist/components/tt-vtable/src/features/column-preferences/column-preference-storage.d.ts +36 -0
  57. package/dist/components/tt-vtable/src/features/column-preferences/column-preference-storage.js +52 -0
  58. package/dist/components/tt-vtable/src/features/column-preferences/useColumnPreferences.d.ts +74 -0
  59. package/dist/components/tt-vtable/src/features/column-preferences/useColumnPreferences.js +232 -0
  60. package/dist/components/tt-vtable/src/features/editing/useCellEditing.d.ts +48 -0
  61. package/dist/components/tt-vtable/src/features/editing/useCellEditing.js +102 -0
  62. package/dist/components/tt-vtable/src/features/form-integration/useVTableForm.d.ts +51 -0
  63. package/dist/components/tt-vtable/src/features/pagination/useTablePagination.d.ts +40 -0
  64. package/dist/components/tt-vtable/src/features/pagination/useTablePagination.js +51 -0
  65. package/dist/components/tt-vtable/src/features/querying/useRecordQuery.d.ts +38 -0
  66. package/dist/components/tt-vtable/src/features/querying/useRecordQuery.js +57 -0
  67. package/dist/components/tt-vtable/src/features/records/index.d.ts +3 -0
  68. package/dist/components/tt-vtable/src/features/records/record-index.d.ts +122 -0
  69. package/dist/components/tt-vtable/src/features/records/record-index.js +209 -0
  70. package/dist/components/tt-vtable/src/features/records/useRecordSource.d.ts +41 -0
  71. package/dist/components/tt-vtable/src/features/records/useRecordSource.js +249 -0
  72. package/dist/components/tt-vtable/src/features/selection/useRowSelection.d.ts +65 -0
  73. package/dist/components/tt-vtable/src/features/selection/useRowSelection.js +129 -0
  74. package/dist/components/tt-vtable/src/features/tree/useTreeRecords.d.ts +60 -0
  75. package/dist/components/tt-vtable/src/features/tree/useTreeRecords.js +125 -0
  76. package/dist/components/tt-vtable/src/public/index.d.ts +7 -0
  77. package/dist/components/tt-vtable/src/public/table-api.d.ts +215 -0
  78. package/dist/components/tt-vtable/src/public/table-column.d.ts +123 -0
  79. package/dist/components/tt-vtable/src/public/table-errors.d.ts +26 -0
  80. package/dist/components/tt-vtable/src/public/table-errors.js +26 -0
  81. package/dist/components/tt-vtable/src/public/table-events.d.ts +69 -0
  82. package/dist/components/tt-vtable/src/public/table-props.d.ts +216 -0
  83. package/dist/components/tt-vtable/src/public/table-slots.d.ts +37 -0
  84. package/dist/components/tt-vtable/src/runtime/createVTableController.d.ts +12 -0
  85. package/dist/components/tt-vtable/src/runtime/createVTableController.js +238 -0
  86. package/dist/components/tt-vtable/src/runtime/createVTableRuntime.d.ts +79 -0
  87. package/dist/components/tt-vtable/src/runtime/createVTableRuntime.js +380 -0
  88. package/dist/index.d.ts +1 -0
  89. package/dist/index.js +129 -115
  90. package/dist/packages/utils/src/is.js +46 -37
  91. package/dist/style.css +1 -1
  92. package/package.json +3 -1
  93. package/dist/assets/svg/action_more.svg.js +0 -4
@@ -0,0 +1,35 @@
1
+ import { VNodeChild } from 'vue';
2
+ /** VTable 选择提示属性。 */
3
+ interface VTableSelectionAlertProps {
4
+ /** 已选主键总数。 */
5
+ selectedCount: number;
6
+ /** 当前已加载的已选记录数。 */
7
+ loadedCount: number;
8
+ /** 当前未加载的已选主键数。 */
9
+ missingCount: number;
10
+ }
11
+ declare function __VLS_template(): {
12
+ attrs: Partial<{}>;
13
+ slots: Readonly<{
14
+ /** 自定义选择摘要。 */
15
+ default?: (scope: VTableSelectionAlertProps) => VNodeChild;
16
+ }> & {
17
+ /** 自定义选择摘要。 */
18
+ default?: (scope: VTableSelectionAlertProps) => VNodeChild;
19
+ };
20
+ refs: {};
21
+ rootEl: any;
22
+ };
23
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
24
+ declare const __VLS_component: import('vue').DefineComponent<VTableSelectionAlertProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
25
+ clear: () => any;
26
+ }, string, import('vue').PublicProps, Readonly<VTableSelectionAlertProps> & Readonly<{
27
+ onClear?: (() => any) | undefined;
28
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
29
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
30
+ export default _default;
31
+ type __VLS_WithTemplateSlots<T, S> = T & {
32
+ new (): {
33
+ $slots: S;
34
+ };
35
+ };
@@ -0,0 +1,50 @@
1
+ import { defineComponent as p, createElementBlock as n, createCommentVNode as l, openBlock as r, createVNode as a, renderSlot as C, unref as s, normalizeProps as f, guardReactiveProps as _, createElementVNode as k, toDisplayString as t, withCtx as v, createTextVNode as V } from "vue";
2
+ import { TtButton as b } from "../../../tt-button/index.js";
3
+ import { TtIcon as g } from "../../../tt-icon/index.js";
4
+ const y = {
5
+ key: 0,
6
+ class: "tt-vtable-selection-alert",
7
+ role: "status",
8
+ "aria-live": "polite"
9
+ }, T = {
10
+ key: 0,
11
+ class: "tt-vtable-selection-alert__secondary"
12
+ }, h = /* @__PURE__ */ p({
13
+ name: "VTableSelectionAlert",
14
+ __name: "VTableSelectionAlert",
15
+ props: {
16
+ selectedCount: {},
17
+ loadedCount: {},
18
+ missingCount: {}
19
+ },
20
+ emits: ["clear"],
21
+ setup(i, { emit: c }) {
22
+ const e = i, m = c;
23
+ function u() {
24
+ m("clear");
25
+ }
26
+ return (d, o) => e.selectedCount > 0 ? (r(), n("div", y, [
27
+ a(s(g), {
28
+ icon: "mdi:check-circle-outline",
29
+ color: "var(--el-color-primary)"
30
+ }),
31
+ C(d.$slots, "default", f(_(e)), () => [
32
+ k("span", null, "已选择 " + t(e.selectedCount) + " 项", 1),
33
+ e.missingCount > 0 ? (r(), n("span", T, " 当前加载 " + t(e.loadedCount) + " 项,跨页保留 " + t(e.missingCount) + " 项 ", 1)) : l("", !0)
34
+ ]),
35
+ a(s(b), {
36
+ text: "",
37
+ "aria-label": "清空表格选择",
38
+ onClick: u
39
+ }, {
40
+ default: v(() => [...o[0] || (o[0] = [
41
+ V("清空", -1)
42
+ ])]),
43
+ _: 1
44
+ })
45
+ ])) : l("", !0);
46
+ }
47
+ });
48
+ export {
49
+ h as default
50
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./VTableSelectionAlert.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,63 @@
1
+ import { VNodeChild } from 'vue';
2
+ /** 工具栏展示的一列设置。 */
3
+ interface VTableToolbarColumn {
4
+ /** 稳定语义列主键。 */
5
+ key: string;
6
+ /** 工具栏展示标题。 */
7
+ title: string;
8
+ /** 当前是否可见。 */
9
+ visible: boolean;
10
+ /** 列树嵌套深度。 */
11
+ depth?: number;
12
+ /** 是否禁止修改可见性。 */
13
+ disabled?: boolean;
14
+ }
15
+ /** VTable 工具栏属性。 */
16
+ interface VTableToolbarProps {
17
+ /** 是否显示刷新命令。 */
18
+ showRefresh?: boolean;
19
+ /** 是否显示列设置命令。 */
20
+ showColumnPreferences?: boolean;
21
+ /** 是否正在刷新。 */
22
+ refreshing?: boolean;
23
+ /** 可配置列集合。 */
24
+ columns?: readonly VTableToolbarColumn[];
25
+ }
26
+ declare function __VLS_template(): {
27
+ attrs: Partial<{}>;
28
+ slots: Readonly<{
29
+ /** 工具栏左侧业务内容。 */
30
+ left?: () => VNodeChild;
31
+ /** 工具栏右侧业务内容。 */
32
+ right?: () => VNodeChild;
33
+ }> & {
34
+ /** 工具栏左侧业务内容。 */
35
+ left?: () => VNodeChild;
36
+ /** 工具栏右侧业务内容。 */
37
+ right?: () => VNodeChild;
38
+ };
39
+ refs: {};
40
+ rootEl: HTMLDivElement;
41
+ };
42
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
43
+ declare const __VLS_component: import('vue').DefineComponent<VTableToolbarProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
44
+ refresh: () => any;
45
+ "column-visibility-change": (key: string, visible: boolean) => any;
46
+ "reset-columns": () => any;
47
+ }, string, import('vue').PublicProps, Readonly<VTableToolbarProps> & Readonly<{
48
+ onRefresh?: (() => any) | undefined;
49
+ "onColumn-visibility-change"?: ((key: string, visible: boolean) => any) | undefined;
50
+ "onReset-columns"?: (() => any) | undefined;
51
+ }>, {
52
+ columns: readonly VTableToolbarColumn[];
53
+ showRefresh: boolean;
54
+ showColumnPreferences: boolean;
55
+ refreshing: boolean;
56
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
57
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
58
+ export default _default;
59
+ type __VLS_WithTemplateSlots<T, S> = T & {
60
+ new (): {
61
+ $slots: S;
62
+ };
63
+ };
@@ -0,0 +1,126 @@
1
+ import { defineComponent as k, createElementBlock as d, openBlock as n, createElementVNode as o, renderSlot as f, createBlock as p, createCommentVNode as b, unref as t, withCtx as l, createVNode as r, Fragment as x, renderList as w, normalizeStyle as B, createTextVNode as T, toDisplayString as V } from "vue";
2
+ import { TtButton as u } from "../../../tt-button/index.js";
3
+ import { TtIcon as c } from "../../../tt-icon/index.js";
4
+ import "axios";
5
+ import { ElPopover as E, ElScrollbar as N, ElCheckbox as R } from "element-plus";
6
+ import { isBoolean as S } from "../../../../packages/utils/src/is.js";
7
+ import "dayjs";
8
+ import "numeral";
9
+ import "xe-utils";
10
+ import "dayjs/plugin/utc";
11
+ import "dayjs/plugin/timezone";
12
+ import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
13
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
14
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
15
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
16
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
17
+ import "lodash-es";
18
+ const P = {
19
+ class: "tt-vtable-toolbar",
20
+ role: "toolbar",
21
+ "aria-label": "表格工具栏"
22
+ }, $ = { class: "tt-vtable-toolbar__section tt-vtable-toolbar__section--left" }, L = { class: "tt-vtable-toolbar__section tt-vtable-toolbar__section--right" }, z = { class: "tt-vtable-column-menu" }, D = { class: "tt-vtable-column-menu__footer" }, ee = /* @__PURE__ */ k({
23
+ name: "VTableToolbar",
24
+ __name: "VTableToolbar",
25
+ props: {
26
+ showRefresh: { type: Boolean, default: !0 },
27
+ showColumnPreferences: { type: Boolean, default: !1 },
28
+ refreshing: { type: Boolean, default: !1 },
29
+ columns: { default: () => [] }
30
+ },
31
+ emits: ["refresh", "column-visibility-change", "reset-columns"],
32
+ setup(_, { emit: h }) {
33
+ const a = _, m = h;
34
+ function v() {
35
+ m("refresh");
36
+ }
37
+ function g(s, e) {
38
+ S(e) && m("column-visibility-change", s, e);
39
+ }
40
+ function y() {
41
+ m("reset-columns");
42
+ }
43
+ return (s, e) => (n(), d("div", P, [
44
+ o("div", $, [
45
+ f(s.$slots, "left")
46
+ ]),
47
+ o("div", L, [
48
+ f(s.$slots, "right"),
49
+ a.showRefresh ? (n(), p(t(u), {
50
+ key: 0,
51
+ text: "",
52
+ loading: a.refreshing,
53
+ "aria-label": "刷新表格",
54
+ onClick: v
55
+ }, {
56
+ default: l(() => [
57
+ r(t(c), { icon: "mdi:refresh" }),
58
+ e[0] || (e[0] = o("span", null, "刷新", -1))
59
+ ]),
60
+ _: 1
61
+ }, 8, ["loading"])) : b("", !0),
62
+ a.showColumnPreferences ? (n(), p(t(E), {
63
+ key: 1,
64
+ placement: "bottom-end",
65
+ width: 280,
66
+ trigger: "click"
67
+ }, {
68
+ reference: l(() => [
69
+ r(t(u), {
70
+ text: "",
71
+ "aria-label": "打开列设置"
72
+ }, {
73
+ default: l(() => [
74
+ r(t(c), { icon: "mdi:view-column-outline" }),
75
+ e[1] || (e[1] = o("span", null, "列设置", -1))
76
+ ]),
77
+ _: 1
78
+ })
79
+ ]),
80
+ default: l(() => [
81
+ o("div", z, [
82
+ r(t(N), { "max-height": "320px" }, {
83
+ default: l(() => [
84
+ (n(!0), d(x, null, w(a.columns, (i) => (n(), d("div", {
85
+ key: i.key,
86
+ class: "tt-vtable-column-menu__row",
87
+ style: B({ paddingLeft: `${12 + (i.depth ?? 0) * 16}px` })
88
+ }, [
89
+ r(t(R), {
90
+ disabled: i.disabled,
91
+ "model-value": i.visible,
92
+ onChange: (C) => g(i.key, C)
93
+ }, {
94
+ default: l(() => [
95
+ T(V(i.title), 1)
96
+ ]),
97
+ _: 2
98
+ }, 1032, ["disabled", "model-value", "onChange"])
99
+ ], 4))), 128))
100
+ ]),
101
+ _: 1
102
+ }),
103
+ o("div", D, [
104
+ r(t(u), {
105
+ text: "",
106
+ "aria-label": "恢复默认列设置",
107
+ onClick: y
108
+ }, {
109
+ default: l(() => [
110
+ r(t(c), { icon: "mdi:restore" }),
111
+ e[2] || (e[2] = o("span", null, "恢复默认", -1))
112
+ ]),
113
+ _: 1
114
+ })
115
+ ])
116
+ ])
117
+ ]),
118
+ _: 1
119
+ })) : b("", !0)
120
+ ])
121
+ ]));
122
+ }
123
+ });
124
+ export {
125
+ ee as default
126
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./VTableToolbar.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,133 @@
1
+ import { defineComponent as F, getCurrentInstance as I, shallowRef as l, computed as B, watch as f, nextTick as b, onMounted as k, onBeforeUnmount as L, createElementBlock as K, openBlock as y, normalizeStyle as D, createBlock as M, createCommentVNode as U, unref as Z } from "vue";
2
+ import "axios";
3
+ import "element-plus";
4
+ import { isNumber as m, isClient as $, isError as q } from "../../../../packages/utils/src/is.js";
5
+ import "dayjs";
6
+ import "numeral";
7
+ import "xe-utils";
8
+ import "dayjs/plugin/utc";
9
+ import "dayjs/plugin/timezone";
10
+ import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
11
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
12
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
13
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
14
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
15
+ import "lodash-es";
16
+ import { ListTable as H } from "@visactor/vue-vtable";
17
+ import "../engine/visactor/createVueCellLayout.js";
18
+ import { createTtVTableError as T } from "../public/table-errors.js";
19
+ import { toFrozenColumnOrder as W, toColumnDefinitions as j, getFrozenColumnCounts as G } from "../engine/visactor/toColumnDefinitions.js";
20
+ import { toListTableOptions as J } from "../engine/visactor/toListTableOptions.js";
21
+ const ve = /* @__PURE__ */ F({
22
+ name: "VTableViewport",
23
+ __name: "VTableViewport",
24
+ props: {
25
+ columns: {},
26
+ tableApi: {},
27
+ rendererSlots: {},
28
+ getRowKey: {},
29
+ nativeOptions: {},
30
+ rendering: {},
31
+ width: { default: "100%" },
32
+ height: { default: "auto" }
33
+ },
34
+ emits: ["ready", "release", "resize", "error"],
35
+ setup(_, { emit: E }) {
36
+ const e = _, s = E, c = I(), u = l(), i = l(), A = l(0), z = l(0), v = l(!1);
37
+ let a, n = 0;
38
+ const O = B(() => ({
39
+ width: m(e.width) ? `${e.width}px` : e.width,
40
+ height: m(e.height) ? `${e.height}px` : e.height
41
+ }));
42
+ function h() {
43
+ return J({
44
+ columns: e.columns,
45
+ tableApi: e.tableApi,
46
+ rendererSlots: e.rendererSlots,
47
+ getRowKey: e.getRowKey,
48
+ nativeOptions: e.nativeOptions,
49
+ rendering: e.rendering,
50
+ getVueUserAppContext: () => c == null ? void 0 : c.appContext
51
+ });
52
+ }
53
+ const d = l(h());
54
+ function w(t) {
55
+ const o = q(t) ? t : new Error(String(t));
56
+ s("error", o);
57
+ }
58
+ function g() {
59
+ if (m(e.width) && e.width <= 0)
60
+ throw T("TT_VTABLE_CONTAINER_SIZE_INVALID", "表格 width 必须大于 0。", {
61
+ width: e.width
62
+ });
63
+ if (m(e.height) && e.height <= 0)
64
+ throw T("TT_VTABLE_CONTAINER_SIZE_INVALID", "表格 height 必须大于 0。", {
65
+ height: e.height
66
+ });
67
+ }
68
+ function p() {
69
+ const t = u.value;
70
+ if (!t) return;
71
+ const o = t.getBoundingClientRect();
72
+ A.value = o.width, z.value = o.height, s("resize", o.width, o.height), o.width > 0 && o.height > 0 && (v.value = !0), !(!i.value || o.width <= 0 || o.height <= 0) && (n && cancelAnimationFrame(n), n = requestAnimationFrame(() => {
73
+ var r;
74
+ n = 0, (r = i.value) == null || r.resize();
75
+ }));
76
+ }
77
+ function V(t) {
78
+ i.value = t, s("ready", t), b(p);
79
+ }
80
+ function R(t) {
81
+ w(t);
82
+ }
83
+ function S(t) {
84
+ const o = W(t), r = i.value;
85
+ if (!r) {
86
+ d.value = h();
87
+ return;
88
+ }
89
+ const x = j(o, {
90
+ tableApi: e.tableApi,
91
+ rendererSlots: e.rendererSlots,
92
+ getRowKey: e.getRowKey
93
+ }), C = G(o);
94
+ r.updateColumns(x), r.setFrozenColCount(C.frozenColCount), r.rightFrozenColCount = C.rightFrozenColCount;
95
+ }
96
+ async function N() {
97
+ const t = h(), o = i.value;
98
+ if (!o) {
99
+ d.value = t;
100
+ return;
101
+ }
102
+ try {
103
+ await o.updateOption(t);
104
+ } catch (r) {
105
+ w(r);
106
+ }
107
+ }
108
+ return f(() => e.columns, S), f([() => e.nativeOptions, () => e.rendering], () => void N()), f([() => e.width, () => e.height], () => {
109
+ g(), b(p);
110
+ }), k(() => {
111
+ g(), $ && (a = new ResizeObserver(p), u.value && a.observe(u.value), p());
112
+ }), L(() => {
113
+ a == null || a.disconnect(), a = void 0, n && cancelAnimationFrame(n), n = 0, i.value && s("release", i.value), i.value = void 0;
114
+ }), (t, o) => (y(), K("div", {
115
+ ref_key: "viewportElement",
116
+ ref: u,
117
+ class: "tt-vtable__viewport",
118
+ style: D(O.value)
119
+ }, [
120
+ v.value ? (y(), M(Z(H), {
121
+ key: 0,
122
+ options: d.value,
123
+ width: "100%",
124
+ height: "100%",
125
+ "on-ready": V,
126
+ "on-error": R
127
+ }, null, 8, ["options"])) : U("", !0)
128
+ ], 4));
129
+ }
130
+ });
131
+ export {
132
+ ve as default
133
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./VTableViewport.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,41 @@
1
+ import { MaybeRefOrGetter, Ref } from 'vue';
2
+ import { TtVTableColumn, TtVTableFeatureOptions, TtVTableFetchRecords, TtVTableMutationMode, TtVTableNativeEvents, TtVTableNativeOptions, TtVTableRenderingOptions, TtVTableRowKey, TtVTableRowKeySource } from '../public';
3
+ import { createVTableController } from '../runtime/createVTableController';
4
+ /** useVTable 接受的 maybe-reactive 配置。 */
5
+ export interface UseVTableOptions<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey, QueryParams extends Record<string, unknown> = Record<string, unknown>> {
6
+ /** maybe-reactive 本地记录根快照。 */
7
+ records?: MaybeRefOrGetter<readonly Row[]>;
8
+ /** 远程记录请求函数,作为回调保持普通函数语义。 */
9
+ fetchRecords?: TtVTableFetchRecords<Row, QueryParams>;
10
+ /** maybe-reactive 语义列根。 */
11
+ columns: MaybeRefOrGetter<readonly TtVTableColumn<Row, Key>[]>;
12
+ /** 业务主键读取配置,函数值不会被 toValue 执行。 */
13
+ rowKey: TtVTableRowKeySource<Row, Key>;
14
+ /** maybe-reactive 查询参数根。 */
15
+ queryParams?: MaybeRefOrGetter<QueryParams>;
16
+ /** 可写选择主键 ref。 */
17
+ selectedRowKeys?: Ref<Key[]>;
18
+ /** maybe-reactive feature 配置根。 */
19
+ features?: MaybeRefOrGetter<TtVTableFeatureOptions<Row, Key> | undefined>;
20
+ /** 记录所有权策略。 */
21
+ mutationMode?: TtVTableMutationMode;
22
+ /** maybe-reactive Vue DOM 渲染配置。 */
23
+ rendering?: MaybeRefOrGetter<TtVTableRenderingOptions | undefined>;
24
+ /** maybe-reactive 原生 options 根。 */
25
+ nativeOptions?: MaybeRefOrGetter<TtVTableNativeOptions | undefined>;
26
+ /** maybe-reactive原生事件根。 */
27
+ nativeEvents?: MaybeRefOrGetter<TtVTableNativeEvents | undefined>;
28
+ /** maybe-reactive 表格宽度。 */
29
+ width?: MaybeRefOrGetter<number | string | undefined>;
30
+ /** maybe-reactive 表格高度。 */
31
+ height?: MaybeRefOrGetter<number | string | undefined>;
32
+ }
33
+ /** useVTable 返回的标准绑定结果。 */
34
+ export interface UseVTableResult<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey> {
35
+ /** 可直接传给 TtVTable 的响应式绑定。 */
36
+ tableBindings: Record<string, unknown>;
37
+ /** 从 setup 开始保持引用稳定的公共 API。 */
38
+ tableApi: ReturnType<typeof createVTableController<Row, Key>>["tableApi"];
39
+ }
40
+ /** 创建 maybe-reactive 表格绑定和稳定 tableApi。 */
41
+ export declare function useVTable<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey, QueryParams extends Record<string, unknown> = Record<string, unknown>>(options: UseVTableOptions<Row, Key, QueryParams>): UseVTableResult<Row, Key>;
@@ -0,0 +1,25 @@
1
+ import { markRaw as d, shallowRef as n, computed as r, toValue as t, reactive as i, isRef as u } from "vue";
2
+ import { createVTableController as f } from "../runtime/createVTableController.js";
3
+ function w(e) {
4
+ const l = d(f()), a = e.selectedRowKeys ?? n([]), c = {
5
+ rowKey: e.rowKey,
6
+ mutationMode: e.mutationMode,
7
+ controller: l,
8
+ columns: r(() => t(e.columns)),
9
+ queryParams: r(() => t(e.queryParams) ?? {}),
10
+ features: r(() => t(e.features)),
11
+ rendering: r(() => t(e.rendering)),
12
+ nativeOptions: r(() => t(e.nativeOptions)),
13
+ nativeEvents: r(() => t(e.nativeEvents)),
14
+ width: r(() => t(e.width)),
15
+ height: r(() => t(e.height)),
16
+ selectedRowKeys: a,
17
+ "onUpdate:selectedRowKeys": (s) => {
18
+ u(a) && (a.value = s);
19
+ }
20
+ };
21
+ return e.fetchRecords ? c.fetchRecords = e.fetchRecords : c.records = r(() => t(e.records) ?? []), { tableBindings: i(c), tableApi: l.tableApi };
22
+ }
23
+ export {
24
+ w as useVTable
25
+ };
@@ -0,0 +1,13 @@
1
+ import { DefineSetupFnComponent, SlotsType } from 'vue';
2
+ import { TtVTableFormApi, TtVTableFormProps } from '../features/form-integration/useVTableForm';
3
+ import { TtVTableRowKey } from '../public';
4
+ /** 表单表格渲染组件允许的插槽集合。 */
5
+ type VTableFormRenderSlots = Record<string, (slotScope: Record<string, unknown>) => unknown>;
6
+ /** useVTableFormRender 返回值。 */
7
+ export type UseVTableFormRenderResult<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey, FormValues extends Record<string, unknown> = Record<string, unknown>> = [
8
+ DefineSetupFnComponent<Partial<TtVTableFormProps<Row, Key, FormValues>>, Record<string, (...eventArguments: unknown[]) => unknown>, SlotsType<VTableFormRenderSlots>>,
9
+ TtVTableFormApi<Row, Key>
10
+ ];
11
+ /** 创建带查询表单的动态表格组件与稳定组合 API。 */
12
+ export declare function useVTableFormRender<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey, FormValues extends Record<string, unknown> = Record<string, unknown>>(options: TtVTableFormProps<Row, Key, FormValues>): UseVTableFormRenderResult<Row, Key, FormValues>;
13
+ export {};
@@ -0,0 +1,92 @@
1
+ import "axios";
2
+ import "element-plus";
3
+ import { isFunction as T } from "../../../../packages/utils/src/is.js";
4
+ import { shallowRef as f, defineComponent as g, h as c } from "vue";
5
+ import "dayjs";
6
+ import "numeral";
7
+ import "xe-utils";
8
+ import "dayjs/plugin/utc";
9
+ import "dayjs/plugin/timezone";
10
+ import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
11
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
12
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
13
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
14
+ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
15
+ import "lodash-es";
16
+ import "../../../tt-select/index.js";
17
+ import "../../../tt-checkbox/index.js";
18
+ import "../../../tt-radio-group/index.js";
19
+ import "../../../tt-panel-select/index.js";
20
+ import "../../../tt-upload/index.js";
21
+ import "../../../tt-api-component/index.js";
22
+ import "vee-validate";
23
+ import "../../../../utils/uppercaseInput.js";
24
+ import { useForm as v } from "../../../tt-form/src/useForm.js";
25
+ import "zod";
26
+ import "@vee-validate/zod";
27
+ import "@tanstack/vue-store";
28
+ import "es-toolkit/compat";
29
+ import "../../../tt-form/src/shared/zod-defaults.js";
30
+ import "../../../tt-nav-anchor/index.js";
31
+ import "../../../../node_modules/.pnpm/vue-types@5.1.3_vue@3.5.21_typescript@5.9.3_/node_modules/vue-types/shim/index.modern.js";
32
+ import "vue-router";
33
+ import "../../../tt-icon/index.js";
34
+ import "../../../tt-form/src/components/Slot.js";
35
+ import "../../../tt-form-item-error-tooltip/index.js";
36
+ import "@vueuse/core";
37
+ /* empty css */
38
+ import "../../../tt-form/src/form/RenderContent.vue.js";
39
+ import "../../../tt-form/src/form-render/FormFieldContact.js";
40
+ /* empty css */
41
+ /* empty css */
42
+ import { useVTableRender as y } from "./useVTableRender.js";
43
+ function dt(t) {
44
+ const i = f({ ...t.table.queryParams ?? {} }), b = f([...t.table.selectedRowKeys ?? []]), a = t.form.handleSubmit, n = t.form.handleReset, l = {
45
+ columns: t.table.columns,
46
+ rowKey: t.table.rowKey,
47
+ queryParams: i,
48
+ selectedRowKeys: b,
49
+ features: t.table.features,
50
+ mutationMode: t.table.mutationMode,
51
+ rendering: t.table.rendering,
52
+ nativeOptions: t.table.nativeOptions,
53
+ nativeEvents: t.table.nativeEvents,
54
+ width: t.table.width,
55
+ height: t.table.height
56
+ };
57
+ T(t.table.fetchRecords) ? l.fetchRecords = t.table.fetchRecords : l.records = t.table.records ?? [];
58
+ const [d, p] = y(l);
59
+ async function h(e) {
60
+ await (a == null ? void 0 : a(e)), i.value = { ...e }, p.pagination.reset();
61
+ }
62
+ async function u(e) {
63
+ await (n == null ? void 0 : n(e)), i.value = { ...e }, p.pagination.reset();
64
+ }
65
+ const [R, w] = v({
66
+ ...t.form,
67
+ handleSubmit: h,
68
+ handleReset: u
69
+ });
70
+ function F(e) {
71
+ const o = {}, m = {};
72
+ return Object.entries(e).forEach(([r, s]) => {
73
+ r.startsWith("form-") ? o[r.slice(5)] = s : m[r] = s;
74
+ }), { formSlots: o, tableSlots: m };
75
+ }
76
+ return [g(
77
+ (e, { attrs: o, slots: m }) => () => {
78
+ const r = F(m);
79
+ return c("div", { class: "tt-vtable-form" }, [
80
+ c(R, {}, r.formSlots),
81
+ c(d, o, r.tableSlots)
82
+ ]);
83
+ },
84
+ { name: "TtVTableFormRender", inheritAttrs: !1 }
85
+ ), {
86
+ form: w,
87
+ table: p
88
+ }];
89
+ }
90
+ export {
91
+ dt as useVTableFormRender
92
+ };
@@ -0,0 +1,13 @@
1
+ import { DefineSetupFnComponent, SlotsType } from 'vue';
2
+ import { TtVTableProps, TtVTableRowKey, TtVTableSlots } from '../public';
3
+ import { useVTable, UseVTableOptions } from './useVTable';
4
+ /** 动态渲染组件允许的宽松事件签名。 */
5
+ type VTableRenderEmits = Record<string, (...eventArguments: unknown[]) => unknown>;
6
+ /** useVTableRender 返回值。 */
7
+ export type UseVTableRenderResult<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey, QueryParams extends Record<string, unknown> = Record<string, unknown>> = [
8
+ DefineSetupFnComponent<Partial<TtVTableProps<Row, Key, QueryParams>>, VTableRenderEmits, SlotsType<TtVTableSlots<Row, Key>>>,
9
+ ReturnType<typeof useVTable<Row, Key, QueryParams>>["tableApi"]
10
+ ];
11
+ /** 创建可直接渲染的 TtVTable 组件和稳定 tableApi。 */
12
+ export declare function useVTableRender<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey, QueryParams extends Record<string, unknown> = Record<string, unknown>>(options: UseVTableOptions<Row, Key, QueryParams>): UseVTableRenderResult<Row, Key, QueryParams>;
13
+ export {};
@@ -0,0 +1,13 @@
1
+ import { defineComponent as a, h as m } from "vue";
2
+ import l from "../components/TtVTable.vue.js";
3
+ import { useVTable as s } from "./useVTable.js";
4
+ function T(e) {
5
+ const { tableBindings: n, tableApi: r } = s(e);
6
+ return [a(
7
+ (t, { attrs: o, slots: i }) => () => m(l, { ...n, ...t, ...o }, i),
8
+ { name: "TtVTableRender", inheritAttrs: !1 }
9
+ ), r];
10
+ }
11
+ export {
12
+ T as useVTableRender
13
+ };
@@ -0,0 +1,10 @@
1
+ import { ListTable } from '@visactor/vtable';
2
+ import { VisactorTableEngine } from './types';
3
+ /**
4
+ * 创建只持有浅层原生实例引用的 VisActor 适配器。
5
+ * @param initialInstance 已经由官方 Vue ListTable 创建的实例
6
+ * @returns 可供 runtime 使用的稳定适配器
7
+ */
8
+ export declare function createVisactorTableEngine<Row extends Record<string, unknown>>(initialInstance?: ListTable): VisactorTableEngine<Row> & {
9
+ setInstance: (instance?: ListTable) => void;
10
+ };