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