@dazhicheng/ui 1.5.265 → 1.6.0

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 (104) hide show
  1. package/dist/components/tt-area/TtArea.vue.js +1 -1
  2. package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +2 -2
  3. package/dist/components/tt-drawer/src/hooks/useResizable.js +2 -2
  4. package/dist/components/tt-form/src/components/FormElInput.vue.js +51 -38
  5. package/dist/components/tt-form/src/form-render/FormField.vue2.js +36 -36
  6. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.d.ts +3 -3
  7. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +3 -1
  8. package/dist/components/tt-icon/index.vue.js +2 -2
  9. package/dist/components/tt-loading/src/loading.vue.js +2 -2
  10. package/dist/components/tt-modal-form/index.vue.js +13 -12
  11. package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.d.ts +2 -2
  12. package/dist/components/tt-panel-select/src/hooks/usePanelData.js +93 -86
  13. package/dist/components/tt-panel-select/src/index.vue.js +1 -0
  14. package/dist/components/tt-select/src/Select.vue.d.ts +4 -4
  15. package/dist/components/tt-select/src/components/Table.vue.d.ts +4 -4
  16. package/dist/components/tt-table/index.d.ts +523 -358
  17. package/dist/components/tt-table/index.js +7 -4
  18. package/dist/components/tt-table/src/Table.vue.d.ts +306 -216
  19. package/dist/components/tt-table/src/Table.vue.js +405 -618
  20. package/dist/components/tt-table/src/TableForm.vue.d.ts +384 -19
  21. package/dist/components/tt-table/src/TableForm.vue.js +219 -228
  22. package/dist/components/tt-table/src/components/TableAction.vue.js +108 -131
  23. package/dist/components/tt-table/src/components/TableButtons.js +25 -25
  24. package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +88 -85
  25. package/dist/components/tt-table/src/components/TableToolbarTools.vue.d.ts +80 -0
  26. package/dist/components/tt-table/src/components/{TableToobalTools.vue.js → TableToolbarTools.vue.js} +29 -31
  27. package/dist/components/tt-table/src/components/TableToolbarTools.vue2.js +4 -0
  28. package/dist/components/tt-table/src/emits.js +2 -1
  29. package/dist/components/tt-table/src/hooks/useColumnPersistence.d.ts +19 -0
  30. package/dist/components/tt-table/src/hooks/useColumnPersistence.js +63 -0
  31. package/dist/components/tt-table/src/hooks/useColumns.d.ts +505 -21
  32. package/dist/components/tt-table/src/hooks/useColumns.js +100 -245
  33. package/dist/components/tt-table/src/hooks/useGridProps.d.ts +36 -0
  34. package/dist/components/tt-table/src/hooks/useGridProps.js +121 -0
  35. package/dist/components/tt-table/src/hooks/useKeyboardNav.d.ts +11 -0
  36. package/dist/components/tt-table/src/hooks/useKeyboardNav.js +97 -0
  37. package/dist/components/tt-table/src/hooks/usePagination.d.ts +14 -8
  38. package/dist/components/tt-table/src/hooks/usePagination.js +29 -33
  39. package/dist/components/tt-table/src/hooks/useQuery.d.ts +41 -0
  40. package/dist/components/tt-table/src/hooks/useQuery.js +147 -0
  41. package/dist/components/tt-table/src/hooks/useRowIdentity.d.ts +22 -0
  42. package/dist/components/tt-table/src/hooks/useRowIdentity.js +96 -0
  43. package/dist/components/tt-table/src/hooks/useRowSelection.d.ts +23 -7
  44. package/dist/components/tt-table/src/hooks/useRowSelection.js +95 -71
  45. package/dist/components/tt-table/src/hooks/{useLeftRightSlot.d.ts → useSideSlot.d.ts} +25 -17
  46. package/dist/components/tt-table/src/hooks/useSideSlot.js +77 -0
  47. package/dist/components/tt-table/src/hooks/useSyncProps.d.ts +12 -0
  48. package/dist/components/tt-table/src/hooks/useSyncProps.js +55 -0
  49. package/dist/components/tt-table/src/hooks/useTableData.d.ts +71 -0
  50. package/dist/components/tt-table/src/hooks/useTableData.js +307 -0
  51. package/dist/components/tt-table/src/hooks/useTableFooter.d.ts +15 -0
  52. package/dist/components/tt-table/src/hooks/useTableFooter.js +46 -0
  53. package/dist/components/tt-table/src/hooks/useTableForm.d.ts +10 -5
  54. package/dist/components/tt-table/src/hooks/useTableForm.js +55 -48
  55. package/dist/components/tt-table/src/hooks/useTableMethods.d.ts +165 -0
  56. package/dist/components/tt-table/src/hooks/useTableMethods.js +183 -0
  57. package/dist/components/tt-table/src/hooks/useTableRender.d.ts +24 -55
  58. package/dist/components/tt-table/src/props.d.ts +318 -151
  59. package/dist/components/tt-table/src/props.js +117 -270
  60. package/dist/components/tt-table/src/table-defaults.d.ts +25 -0
  61. package/dist/components/tt-table/src/table-defaults.js +71 -0
  62. package/dist/components/tt-table/src/table-mutation-events.d.ts +43 -0
  63. package/dist/components/tt-table/src/table-mutation-events.js +70 -0
  64. package/dist/components/tt-table/src/types/table.d.ts +207 -88
  65. package/dist/components/tt-table/src/types/tableAction.d.ts +23 -0
  66. package/dist/components/tt-table/src/types/tableForm.d.ts +15 -26
  67. package/dist/components/tt-table/src/utils/action-tab-index.d.ts +2 -0
  68. package/dist/components/tt-table/src/utils/action-tab-index.js +50 -0
  69. package/dist/components/tt-table/src/utils/context.js +25 -12
  70. package/dist/components/tt-table/src/utils/table-api.d.ts +136 -58
  71. package/dist/components/tt-table/src/utils/table-api.js +198 -165
  72. package/dist/components/tt-table/src/utils/table-form-api.d.ts +11 -11
  73. package/dist/components/tt-table/src/utils/table-form-api.js +41 -31
  74. package/dist/components/types.d.ts +0 -20
  75. package/dist/hooks/useSetup.js +0 -3
  76. package/dist/index.d.ts +1 -0
  77. package/dist/index.js +105 -101
  78. package/dist/packages/hooks/src/useDebounce.js +6 -6
  79. package/dist/packages/utils/src/is.js +20 -18
  80. package/dist/packages/utils/src/tool.js +76 -149
  81. package/dist/style.css +1 -1
  82. package/dist/utils/uppercaseInput.d.ts +29 -0
  83. package/dist/utils/uppercaseInput.js +16 -0
  84. package/package.json +3 -3
  85. package/dist/components/tt-table/src/components/TableToobalTools.vue.d.ts +0 -576
  86. package/dist/components/tt-table/src/components/TableToobalTools.vue2.js +0 -4
  87. package/dist/components/tt-table/src/enum.d.ts +0 -2
  88. package/dist/components/tt-table/src/hooks/useCellArea.d.ts +0 -15
  89. package/dist/components/tt-table/src/hooks/useCellArea.js +0 -15
  90. package/dist/components/tt-table/src/hooks/useCustomColumns.d.ts +0 -20
  91. package/dist/components/tt-table/src/hooks/useCustomColumns.js +0 -65
  92. package/dist/components/tt-table/src/hooks/useDataSource.d.ts +0 -29
  93. package/dist/components/tt-table/src/hooks/useDataSource.js +0 -232
  94. package/dist/components/tt-table/src/hooks/useLeftRightSlot.js +0 -64
  95. package/dist/components/tt-table/src/hooks/useTable.d.ts +0 -7
  96. package/dist/components/tt-table/src/hooks/useTableEvent.d.ts +0 -101
  97. package/dist/components/tt-table/src/hooks/useTableEvent.js +0 -197
  98. package/dist/components/tt-table/src/hooks/useTableFormEvent.d.ts +0 -10
  99. package/dist/components/tt-table/src/hooks/useTableHeight.d.ts +0 -15
  100. package/dist/components/tt-table/src/hooks/useTableSlot.d.ts +0 -11
  101. package/dist/components/tt-table/src/hooks/useTableSlot.js +0 -17
  102. package/dist/components/tt-table/src/utils/filters.d.ts +0 -109
  103. package/dist/components/tt-table/src/utils/vxeTable.d.ts +0 -28
  104. package/dist/packages/utils/src/check.js +0 -10
@@ -1,39 +1,39 @@
1
- import { defineComponent as $e, useSlots as ke, ref as Re, computed as c, toValue as v, getCurrentInstance as Ae, onMounted as J, watch as F, onUnmounted as Ee, createElementBlock as Q, openBlock as X, normalizeClass as A, unref as s, createCommentVNode as _e, createElementVNode as Be, createVNode as P, renderSlot as n, createSlots as E, renderList as Y, withCtx as b, normalizeProps as Z, guardReactiveProps as ee, mergeProps as te, toHandlers as Ve, nextTick as Le } from "vue";
1
+ import { defineComponent as Ee, useSlots as Ie, getCurrentInstance as _e, ref as De, shallowReactive as Ke, onScopeDispose as X, computed as u, unref as r, shallowRef as Ve, toRaw as P, watch as h, toValue as S, onMounted as ke, nextTick as Y, createElementBlock as Z, openBlock as ee, normalizeClass as D, createCommentVNode as Be, createElementVNode as Le, createVNode as A, renderSlot as n, createSlots as K, renderList as te, withCtx as b, normalizeProps as oe, guardReactiveProps as re, mergeProps as se, toHandlers as ze, isRef as je } from "vue";
2
2
  import "../../tt-button/index.js";
3
3
  import "../../tt-checkbox/index.js";
4
4
  import "../../tt-empty/index.js";
5
- import { kebabToCamelCase as Ke } from "../../../packages/utils/src/string.js";
6
5
  import "axios";
7
6
  import "element-plus";
8
- import { isFunction as je } from "../../../packages/utils/src/is.js";
9
- import { extractResourceFromApi as ze, generateTestId as I } from "../../../packages/utils/src/testid-helper.js";
10
- import De from "xe-utils";
7
+ import { isFunction as xe } from "../../../packages/utils/src/is.js";
8
+ import { extractResourceFromApi as Ne, generateTestId as M } from "../../../packages/utils/src/testid-helper.js";
9
+ import "xe-utils";
11
10
  import "dayjs";
12
11
  import "dayjs/plugin/utc";
13
12
  import "dayjs/plugin/timezone";
14
- import { mergeWithArrayOverride as xe } from "../../../packages/utils/src/merge.js";
13
+ import { mergeWithArrayOverride as He } from "../../../packages/utils/src/merge.js";
15
14
  import "../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
16
15
  import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
17
16
  import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
18
17
  import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
19
18
  import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
20
- import { omit as Ne } from "lodash-es";
19
+ import "lodash-es";
21
20
  import "../../tt-select/index.js";
22
21
  import "../../tt-radio-group/index.js";
23
22
  import "../../tt-panel-select/index.js";
24
23
  import "../../tt-upload/index.js";
25
24
  import "../../tt-api-component/index.js";
26
25
  import "vee-validate";
27
- import { useForm as He } from "../../tt-form/src/useForm.js";
26
+ import "../../../utils/uppercaseInput.js";
27
+ import { useForm as We } from "../../tt-form/src/useForm.js";
28
28
  import "zod";
29
29
  import "@vee-validate/zod";
30
- import { useStore as We } from "@tanstack/vue-store";
30
+ import { useStore as Je } from "@tanstack/vue-store";
31
31
  import "es-toolkit/compat";
32
32
  import "../../tt-form/src/shared/zod-defaults.js";
33
33
  import "../../tt-nav-anchor/index.js";
34
34
  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";
35
- import { useDesign as Ue } from "../../../packages/hooks/src/useDesign.js";
36
- import { useDebounceFn as _ } from "../../../packages/hooks/src/useDebounce.js";
35
+ import { useDesign as qe } from "../../../packages/hooks/src/useDesign.js";
36
+ import { useDebounceFn as O } from "../../../packages/hooks/src/useDebounce.js";
37
37
  import "vue-router";
38
38
  import "../../tt-icon/index.js";
39
39
  import "../../tt-form/src/components/Slot.js";
@@ -49,7 +49,7 @@ import "../../tt-drawer/index.js";
49
49
  import "../../tt-modal/index.js";
50
50
  import "../../tt-text/index.js";
51
51
  import "../../../directives/disabled-tip/index.js";
52
- import { GlobalConfig as qe } from "../../../hooks/useSetup.js";
52
+ import { GlobalConfig as Ge } from "../../../hooks/useSetup.js";
53
53
  import "../../tt-log/index.js";
54
54
  /* empty css */
55
55
  /* empty css */
@@ -60,282 +60,273 @@ import "../../tt-loading/index.js";
60
60
  import "../index.js";
61
61
  import "../../../hooks/basicDataCodes.js";
62
62
  import "numeral";
63
- import Ge from "./components/TableColumnModal.vue2.js";
63
+ import { useTemplateSlot as ae } from "../../../hooks/useTemplateSlot.js";
64
+ import Qe from "./components/TableColumnModal.vue2.js";
64
65
  /* empty css */
65
- import { provideFormActionTestIds as Je } from "./utils/context.js";
66
- import Qe from "./components/TableToobalTools.vue.js";
67
- import { basicTableEmits as oe } from "./emits.js";
68
- import Xe from "./Table.vue.js";
69
- /* empty css */
70
- import { createTableFormContext as Ye } from "./hooks/useTableContext.js";
71
- import { useTableForm as Ze } from "./hooks/useTableForm.js";
72
- import { useCustomColumns as et } from "./hooks/useCustomColumns.js";
73
- import { useTableSlot as tt } from "./hooks/useTableSlot.js";
66
+ import Ue from "./components/TableToolbarTools.vue.js";
67
+ import { basicTableEmits as Xe } from "./emits.js";
68
+ import { useColumnPersistence as Ye } from "./hooks/useColumnPersistence.js";
69
+ import { createTableFormContext as Ze } from "./hooks/useTableContext.js";
70
+ import { useTableForm as et } from "./hooks/useTableForm.js";
71
+ import { useSyncProps as tt } from "./hooks/useSyncProps.js";
74
72
  import { tableFormProps as ot } from "./props.js";
75
- import { getDefaultState as rt } from "./utils/table-api.js";
76
- import { TableFormApi as st } from "./utils/table-form-api.js";
77
- const at = ["data-testid"], it = ["data-testid"], ko = /* @__PURE__ */ $e({
73
+ import rt from "./Table.vue.js";
74
+ /* empty css */
75
+ import { forwardedEventEntries as st } from "./table-mutation-events.js";
76
+ import { TableFormApi as at } from "./utils/table-form-api.js";
77
+ import { provideFormActionTestIds as it } from "./utils/context.js";
78
+ const nt = ["data-testid"], lt = ["data-testid"], _o = /* @__PURE__ */ Ee({
78
79
  name: "TtTableForm",
79
80
  __name: "TableForm",
80
81
  props: ot,
81
82
  emits: [
82
83
  "register",
83
- "update:table-data",
84
84
  "columns-setting",
85
85
  "change-row-height",
86
86
  "export",
87
87
  "import",
88
88
  "set-columns",
89
- ...oe
89
+ ...Xe
90
90
  ],
91
- setup(re, { expose: se, emit: ae }) {
92
- var D, x, N;
93
- const m = re, C = ae, M = ke(), { prefixCls: O } = Ue("table-form"), $ = Re();
94
- let t = m.tableFormApi;
95
- if (!t) {
96
- t = new st(m);
97
- const e = t;
98
- e.useStore = (o) => We(t.store, o), t = e;
91
+ setup(ie, { expose: ne, emit: le }) {
92
+ var J, q, G;
93
+ const i = ie, y = le, R = Ie(), g = _e(), { prefixCls: $ } = qe("table-form");
94
+ function V() {
95
+ var e;
96
+ return Object.hasOwn(((e = g == null ? void 0 : g.vnode) == null ? void 0 : e.props) || {}, "table");
99
97
  }
100
- const k = (D = t == null ? void 0 : t.useStore) == null ? void 0 : D.call(t), g = c(() => {
98
+ const E = De();
99
+ let t = i.tableFormApi;
100
+ t || (t = new at(i), t.useStore = (e) => Je(t.store, e));
101
+ const k = Ke({});
102
+ function B() {
103
+ Object.assign(k, P(t.store.state) || {});
104
+ }
105
+ B(), X(t.store.subscribe(B));
106
+ const c = u(() => k), w = u(() => {
101
107
  var o;
102
- if (m.testId) return m.testId;
103
- const e = (o = v(k)) == null ? void 0 : o.table;
104
- return e != null && e.api ? ze(e.api) : "table";
105
- }), ie = c(() => I(g.value, "tableform")), ne = c(() => I(g.value, "search-form-header")), le = c(() => I(g.value, "search-btn-query")), me = c(() => I(g.value, "search-btn-reset")), pe = c(() => ({
106
- submit: le.value,
107
- reset: me.value
108
- }));
109
- Je(pe);
110
- const B = {}, p = Ae(), h = c(() => v(k)), { getFormSlotKeysFunc: ue, getTableSlotKeysFunc: ce, replaceTableSlotKey: de, replaceFormSlotKey: fe } = tt(), {
111
- tableData: be,
112
- getFormProps: R,
113
- getTableProps: d,
114
- getTableToolProps: ge,
115
- handleSearchInfoChange: V
116
- } = Ze(
117
- h,
108
+ if (i.testId) return i.testId;
109
+ const e = (o = r(c).table) == null ? void 0 : o.api;
110
+ return e ? Ne(e) : "table";
111
+ }), me = u(() => M(r(w), "tableform")), pe = u(() => M(r(w), "search-form-header"));
112
+ it(
113
+ u(() => ({
114
+ submit: M(r(w), "search-btn-query"),
115
+ reset: M(r(w), "search-btn-reset")
116
+ }))
117
+ );
118
+ const { getSlotKeys: ue, replaceSlotKey: ce } = ae("form-"), { getSlotKeys: de, replaceSlotKey: fe } = ae("t-"), { getFormProps: I, getTableProps: m, getTableToolProps: be, submitSearchQuery: L } = et(
119
+ c,
118
120
  t.tableApi.reload,
119
121
  t.tableApi.getLoading,
120
- t.tableApi.getPagination,
121
- C
122
- ), { run: he } = _(
122
+ t.tableApi.getPagination
123
+ ), z = Ve([]), ge = u(() => (i.table, !V() || !i.table ? !1 : (i.table.data, Object.hasOwn(P(i.table), "data"))));
124
+ let _ = () => {
125
+ };
126
+ function he(e) {
127
+ _(), _ = h(
128
+ () => S(e),
129
+ (o) => {
130
+ z.value = o || [];
131
+ },
132
+ { immediate: !0, deep: je(e) ? !1 : 1 }
133
+ );
134
+ }
135
+ function Se() {
136
+ if (i.table)
137
+ return i.table.data, P(i.table).data;
138
+ }
139
+ h(Se, (e) => he(e), { immediate: !0 });
140
+ const { run: we } = O(
123
141
  async () => {
124
- const e = await r.getValues();
125
- await r.resetForm(e, { force: !0 });
126
- const o = await r.getValues();
127
- r.setLatestSubmissionValues(o), (await (r == null ? void 0 : r.validate())).valid && V(o);
142
+ const e = await s.getValues();
143
+ await s.resetForm(e, { force: !0 });
144
+ const o = await s.getValues();
145
+ s.setLatestSubmissionValues(o), (await s.validate()).valid && L(o);
128
146
  },
129
147
  200,
130
148
  { leading: !0 }
131
- ), { run: Se } = _(
149
+ ), { run: Te } = O(
132
150
  async (e) => {
133
- await t.grid.clearFilter(), await V(e);
151
+ await t.grid.clearFilter(), await L(e);
134
152
  },
135
153
  200,
136
154
  { leading: !0 }
137
- ), [Ce, r] = He({
138
- ...v(R),
139
- handleSubmit: Se,
140
- handleReset: he,
155
+ ), [ye, s] = We({
156
+ ...S(I),
157
+ handleSubmit: Te,
158
+ handleReset: we,
141
159
  submitOnEnter: !0,
142
160
  submitButtonOptions: {
143
- content: (x = qe.form) == null ? void 0 : x.submitTitle
161
+ content: (J = Ge.form) == null ? void 0 : J.submitTitle
144
162
  },
145
163
  showCollapseButton: !0,
146
164
  collapsed: !0,
147
165
  collapseTriggerResize: !0,
148
166
  collapsedRows: 3
149
- }), { initCustomSetting: Te, saveColumns: ve } = et({
150
- getTableProps: d,
151
- tableMethods: t.tableApi,
152
- getProps: h
153
- }), L = async () => {
154
- await Le(), t.tableApi && t.tableApi.redoHeight();
155
- };
156
- oe.forEach((e) => {
157
- const o = De.camelCase(e);
158
- B[o] = (...a) => C(e, ...a);
167
+ }), { restoreColumns: ve, saveColumns: j } = Ye({
168
+ getTableProps: m,
169
+ getProps: c,
170
+ tableMethods: t.tableApi
159
171
  });
160
- const we = {
161
- ...B
162
- };
163
- function ye(e) {
164
- t.setState((o) => o.table ? (o.table.getSyncSlotComponent = m.table.getSyncSlotComponent, xe(
165
- {
166
- ...e,
167
- table: {
168
- ...rt(),
169
- ...e.table
170
- }
171
- },
172
- o
173
- )) : {}), e.table && t.tableApi.setState(e.table), e.form && (r == null || r.setState(e.form));
172
+ let d = !1;
173
+ const T = {};
174
+ st.forEach(([e, o]) => {
175
+ T[o] = (...a) => y(e, ...a);
176
+ });
177
+ const { run: Fe } = O(async () => {
178
+ if (d || !r(m).useHttpCache) return;
179
+ const e = (t.tableApi.getTableColumns() || []).map((o) => o.field).filter(Boolean);
180
+ e.length && await j(JSON.stringify(e));
181
+ }, 300);
182
+ function Ce(e) {
183
+ var o;
184
+ (o = T.columnDragend) == null || o.call(T, e), Fe();
185
+ }
186
+ const Pe = u(() => ({ ...T, columnDragend: Ce }));
187
+ function Ae(e) {
188
+ t.setState((o) => o.table ? He(e, o) : {}), e.table && t.tableApi.setState(e.table), e.form && (s == null || s.setState(e.form));
174
189
  }
175
- const { run: Fe } = _(
190
+ const { run: Me } = O(
176
191
  async (e) => {
177
- r.isMounted && s(h).useSearchForm ? r.validate().then(async (o) => {
178
- if (o.valid) {
179
- const a = await r.getValues();
180
- await t.tableApi.reload({
181
- ...e,
182
- searchInfo: {
183
- ...e == null ? void 0 : e.searchInfo,
184
- ...a
185
- }
186
- });
187
- }
188
- }) : t.tableApi.reload({
189
- ...e,
190
- searchInfo: {
191
- ...e == null ? void 0 : e.searchInfo
192
- }
193
- });
192
+ if (s.isMounted && r(c).useSearchForm) {
193
+ if (!(await s.validate()).valid) return;
194
+ const a = await s.getValues();
195
+ await t.tableApi.reload({ ...e, searchInfo: { ...e == null ? void 0 : e.searchInfo, ...a } });
196
+ return;
197
+ }
198
+ await t.tableApi.reload({ ...e, searchInfo: { ...e == null ? void 0 : e.searchInfo } });
194
199
  },
195
200
  200,
196
201
  { leading: !0 }
197
- ), w = {
202
+ ), v = {
198
203
  tableMethods: t.tableApi,
199
- formMethods: r,
204
+ formMethods: s,
200
205
  setTableProps: t.tableApi.setState,
201
- setFormProps: r.setState,
202
- setProps: ye,
203
- reload: Fe,
204
- selectedKeys: c(() => v(t.tableApi.selectedKeys))
206
+ setFormProps: s.setState,
207
+ setProps: Ae,
208
+ reload: Me,
209
+ selectedKeys: u(() => S(t.tableApi.selectedKeys))
205
210
  };
206
- async function Pe() {
207
- const { tableRefreshBefore: e } = h.value;
208
- e && je(e) && await e(), w.reload();
211
+ async function Oe() {
212
+ const { tableRefreshBefore: e } = r(c);
213
+ xe(e) && await e(), v.reload();
214
+ }
215
+ async function x() {
216
+ var e;
217
+ await Y(), !d && ((e = t.tableApi) == null || e.redoHeight());
209
218
  }
210
- async function Ie(e) {
211
- var S, f;
212
- const o = ((f = (S = h.value) == null ? void 0 : S.table) == null ? void 0 : f.columns) || [], a = new Map(o.map((l) => [l.field, l])), i = e.checkedModel.map((l) => a.get(l)).filter(Boolean);
219
+ async function Re(e) {
220
+ var F, C;
221
+ if (d) return;
222
+ const o = S((C = (F = r(c)) == null ? void 0 : F.table) == null ? void 0 : C.columns) || [], a = new Map(o.map((f) => [f.field, f])), l = e.checkedModel.map((f) => a.get(f)).filter(Boolean);
213
223
  if (e.isExport) {
214
- C("export", e.checkedModel, e.modalApi);
224
+ y("export", e.checkedModel, e.modalApi);
215
225
  return;
216
226
  }
217
- e.modalApi.setModalProps({
218
- confirmLoading: !0
219
- }), d.value.useHttpCache && await ve(JSON.stringify(e.checkedModel)), t.tableApi.setTableColumns(i), e.modalApi.setModalProps({
220
- confirmLoading: !1
221
- }), e.modalApi.closeModal(), C("set-columns", i);
227
+ e.modalApi.setModalProps({ confirmLoading: !0 });
228
+ try {
229
+ if (r(m).useHttpCache && await j(JSON.stringify(e.checkedModel)), d) return;
230
+ t.tableApi.setTableColumns(l), e.modalApi.closeModal(), y("set-columns", l);
231
+ } finally {
232
+ d || e.modalApi.setModalProps({ confirmLoading: !1 });
233
+ }
222
234
  }
223
- function K(e, o = !1) {
224
- var l, y, T, H, W, U, q, G;
225
- const { notSetColumnField: a, columns: i } = s(d), S = (H = (T = (y = ((l = t.tableApi.getTableInstance()) == null ? void 0 : l.getTableColumn()) || []) == null ? void 0 : y.visibleColumn) == null ? void 0 : T.map((u) => u.field)) == null ? void 0 : H.filter(Boolean), f = ((U = (W = s(i)) == null ? void 0 : W.filter((u) => u.visible === !0 || u.visible === void 0)) == null ? void 0 : U.map((u) => u.field)) || [];
226
- (q = $.value) == null || q.openModal({
227
- columns: (v(i) || []).filter((u) => u.visible !== !1),
228
- displayFields: o ? f : S,
235
+ function N(e, o = !1) {
236
+ var f, Q, U;
237
+ const { notSetColumnField: a, columns: l } = r(m), F = ((((f = t.tableApi.getTableInstance()) == null ? void 0 : f.getTableColumn()) || {}).visibleColumn || []).map((p) => p.field).filter(Boolean), C = (S(l) || []).filter((p) => p.visible === !0 || p.visible === void 0).map((p) => p.field);
238
+ (Q = E.value) == null || Q.openModal({
239
+ columns: (S(l) || []).filter((p) => p.visible !== !1),
240
+ displayFields: o ? C : F,
229
241
  disabledColumnField: a || [],
230
242
  isExport: e
231
- }), (G = $.value) == null || G.setModalProps({
232
- title: e ? "自定义导出" : "列设置"
233
- });
243
+ }), (U = E.value) == null || U.setModalProps({ title: e ? "自定义导出" : "列设置" });
234
244
  }
235
- function j(e = !1) {
236
- K(!1, e);
245
+ function H(e = !1) {
246
+ N(!1, e);
237
247
  }
238
- function z(e = !1) {
239
- K(!0, e);
248
+ function W(e = !1) {
249
+ N(!0, e);
240
250
  }
241
- Ye({ formInstance: r }), J(() => {
242
- p && C("register", w, p == null ? void 0 : p.uid), setTimeout(() => {
243
- Te();
244
- }, 16);
245
- }), F(
246
- () => t.tableApi.getLoading.value,
247
- () => {
248
- r && r.setState({
249
- submitButtonOptions: { loading: t.tableApi.getLoading.value }
250
- });
251
- },
252
- { immediate: (N = k.value.table) == null ? void 0 : N.immediate }
253
- ), F(
254
- () => R.value,
251
+ function $e() {
252
+ const e = i.table;
253
+ if (!V() || !e) return;
254
+ const o = {};
255
+ return Object.keys(P(e)).forEach((a) => {
256
+ a !== "data" && Object.assign(o, { [a]: e[a] });
257
+ }), o;
258
+ }
259
+ return tt(i, t.setState, ["tableFormApi", "table"]), h(
260
+ $e,
255
261
  (e) => {
256
- r && (r == null || r.setState(e));
262
+ e && t.setState({ table: e });
257
263
  },
258
- { deep: !0 }
259
- ), F(
260
- () => d.value,
264
+ { deep: !0, immediate: !0 }
265
+ ), Ze({ formInstance: s }), h(
266
+ () => t.tableApi.getLoading.value,
261
267
  (e) => {
262
- var o;
263
- t != null && t.tableApi && ((o = t == null ? void 0 : t.tableApi) == null || o.setState(e));
268
+ s == null || s.setState({ submitButtonOptions: { loading: e } });
264
269
  },
265
- { deep: !0 }
266
- ), window.addEventListener("resize", L), J(() => {
267
- t == null || t.mount(w, r), r == null || r.setState(R.value);
268
- });
269
- function Me(e) {
270
- return Object.fromEntries(Object.entries(e).filter(([o]) => !o.startsWith("on")));
271
- }
272
- function Oe(e, o) {
273
- return Object.fromEntries(Object.keys(e).map((a) => [a, o[a]]));
274
- }
275
- return F(
276
- () => Ne(m, ["tableFormApi"]),
277
- () => {
278
- var f;
279
- const e = {}, o = ((f = p == null ? void 0 : p.vnode) == null ? void 0 : f.props) || {}, a = new Set(Object.keys(m));
280
- for (const [l, y] of Object.entries(o)) {
281
- const T = Ke(l);
282
- a.has(T) && (e[T] = y);
283
- }
284
- const i = Me(e), S = Oe(i, m);
285
- t.setState(S);
286
- },
287
- { deep: !0 }
288
- ), Ee(() => {
289
- t == null || t.unmount(), window.removeEventListener("resize", L);
290
- }), se({ ...w, instance: p }), (e, o) => (X(), Q("div", {
291
- class: A(s(O)),
292
- "data-testid": ie.value
270
+ { immediate: (G = (q = t.store.state) == null ? void 0 : q.table) == null ? void 0 : G.immediate }
271
+ ), h(I, (e) => s == null ? void 0 : s.setState(e)), h(m, (e) => {
272
+ var o;
273
+ return (o = t.tableApi) == null ? void 0 : o.setState(e);
274
+ }), ke(() => {
275
+ g && y("register", v, g.uid), t.mount(v, s), s == null || s.setState(r(I)), Y(() => {
276
+ d || ve();
277
+ }), window.addEventListener("resize", x);
278
+ }), X(() => {
279
+ d = !0, _(), t == null || t.unmount(), window.removeEventListener("resize", x);
280
+ }), ne({ ...v, instance: g }), (e, o) => (ee(), Z("div", {
281
+ class: D(r($)),
282
+ "data-testid": me.value
293
283
  }, [
294
- h.value.useSearchForm ? (X(), Q("div", {
284
+ c.value.useSearchForm ? (ee(), Z("div", {
295
285
  key: 0,
296
- class: A(`${s(O)}-header`),
297
- "data-testid": ne.value
286
+ class: D(`${r($)}-header`),
287
+ "data-testid": pe.value
298
288
  }, [
299
- P(s(Ce), {
300
- "test-id": `${g.value}-search-form`
301
- }, E({ _: 2 }, [
302
- Y(s(ue)(s(M)), (a) => ({
303
- name: s(fe)(a),
304
- fn: b((i) => [
305
- n(e.$slots, a, Z(ee(i || {})))
289
+ A(r(ye), {
290
+ "test-id": `${w.value}-search-form`
291
+ }, K({ _: 2 }, [
292
+ te(r(ue)(r(R)), (a) => ({
293
+ name: r(ce)(a),
294
+ fn: b((l) => [
295
+ n(e.$slots, a, oe(re(l || {})))
306
296
  ])
307
297
  }))
308
298
  ]), 1032, ["test-id"]),
309
299
  n(e.$slots, "header-down")
310
- ], 10, it)) : _e("", !0),
311
- Be("div", {
312
- class: A({
313
- [`${s(O)}-wrapper`]: !0,
300
+ ], 10, lt)) : Be("", !0),
301
+ Le("div", {
302
+ class: D({
303
+ [`${r($)}-wrapper`]: !0,
314
304
  "pt-(--tt-base-padding)!": !0,
315
- "pb-(--tt-base-padding)!": !s(d).showPager
305
+ "pb-(--tt-base-padding)!": !r(m).showPager
316
306
  })
317
307
  }, [
318
308
  n(e.$slots, "table-top"),
319
- P(Xe, te(s(d), {
320
- data: s(be),
309
+ A(rt, se({
310
+ ...r(m),
311
+ ...ge.value ? { data: z.value } : {}
312
+ }, {
321
313
  "table-row-id": e.tableRowId,
322
- "table-id": g.value,
323
- "form-api": s(r),
324
- "table-api": s(t).tableApi
325
- }, Ve(we)), E({ _: 2 }, [
326
- Y(s(ce)(s(M)), (a) => ({
327
- name: s(de)(a),
328
- fn: b((i) => [
329
- n(e.$slots, a, Z(ee(i || {})))
314
+ "form-api": r(s),
315
+ "table-api": r(t).tableApi
316
+ }, ze(Pe.value)), K({ _: 2 }, [
317
+ te(r(de)(r(R)), (a) => ({
318
+ name: r(fe)(a),
319
+ fn: b((l) => [
320
+ n(e.$slots, a, oe(re(l || {})))
330
321
  ])
331
322
  })),
332
- s(d).showToolbar ? {
323
+ r(m).showToolbar ? {
333
324
  name: "toolbar_tools",
334
325
  fn: b(() => [
335
- P(Qe, te(s(ge), {
336
- onOnRefresh: Pe,
337
- onOnExport: z,
338
- onOnColumnsSetting: j
326
+ A(Ue, se(r(be), {
327
+ onOnRefresh: Oe,
328
+ onOnExport: W,
329
+ onOnColumnsSetting: H
339
330
  }), {
340
331
  "toolbar-left": b(() => [
341
332
  n(e.$slots, "t-toolbar_tools-left")
@@ -349,22 +340,22 @@ const at = ["data-testid"], it = ["data-testid"], ko = /* @__PURE__ */ $e({
349
340
  ]),
350
341
  key: "0"
351
342
  } : void 0
352
- ]), 1040, ["data", "table-row-id", "table-id", "form-api", "table-api"]),
343
+ ]), 1040, ["table-row-id", "form-api", "table-api"]),
353
344
  n(e.$slots, "table-bottom")
354
345
  ], 2),
355
- P(Ge, {
356
- ref_key: "tableColumnModalRef",
357
- ref: $,
358
- "open-export": z,
359
- "open-column": j,
360
- onOnSubmit: Ie
361
- }, E({
346
+ A(Qe, {
347
+ ref_key: "columnModalRef",
348
+ ref: E,
349
+ "open-export": W,
350
+ "open-column": H,
351
+ onOnSubmit: Re
352
+ }, K({
362
353
  beforeFooter: b(() => [
363
354
  n(e.$slots, "t-column-modal-before-footer")
364
355
  ]),
365
356
  _: 2
366
357
  }, [
367
- s(M)["t-column-modal-title"] ? {
358
+ r(R)["t-column-modal-title"] ? {
368
359
  name: "title",
369
360
  fn: b(() => [
370
361
  n(e.$slots, "t-column-modal-title")
@@ -372,9 +363,9 @@ const at = ["data-testid"], it = ["data-testid"], ko = /* @__PURE__ */ $e({
372
363
  key: "0"
373
364
  } : void 0
374
365
  ]), 1536)
375
- ], 10, at));
366
+ ], 10, nt));
376
367
  }
377
368
  });
378
369
  export {
379
- ko as default
370
+ _o as default
380
371
  };