@dazhicheng/ui 1.6.18 → 1.6.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- var C = Object.defineProperty;
2
- var V = (f, h, e) => h in f ? C(f, h, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[h] = e;
3
- var l = (f, h, e) => V(f, typeof h != "symbol" ? h + "" : h, e);
1
+ var V = Object.defineProperty;
2
+ var b = (f, h, e) => h in f ? V(f, h, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[h] = e;
3
+ var l = (f, h, e) => b(f, typeof h != "symbol" ? h + "" : h, e);
4
4
  import "axios";
5
5
  import "element-plus";
6
6
  import { isString as F, isFunction as v, isBoolean as R } from "../../../../packages/utils/src/is.js";
7
- import { ref as b, reactive as A, computed as T, nextTick as E, toRaw as K } from "vue";
7
+ import { ref as T, reactive as A, computed as K, nextTick as E, toRaw as C } from "vue";
8
8
  import "dayjs";
9
9
  import "numeral";
10
10
  import "xe-utils";
@@ -26,7 +26,7 @@ import { extractFlatSchemas as g, collectDefaultCollapseStates as M, getGroupVal
26
26
  function J(f) {
27
27
  if (!f)
28
28
  return;
29
- const h = K(f);
29
+ const h = C(f);
30
30
  if (F(h))
31
31
  return h;
32
32
  if (v(h.safeParse))
@@ -95,7 +95,7 @@ class ye extends j {
95
95
  /** 本轮回环告警是否已输出,避免刷屏 */
96
96
  l(this, "_navSyncLoopWarned", !1);
97
97
  /** VirtualGroupForm 组件实例引用,由 useGroupForm 的 h() 渲染时赋值 */
98
- l(this, "groupFormRef", b(null));
98
+ l(this, "groupFormRef", T(null));
99
99
  /**
100
100
  * @description 响应式读取 store 状态,由 useGroupForm 在运行时注入实现
101
101
  * @param {Function} [selector] - 可选的状态选择器
@@ -113,7 +113,7 @@ class ye extends j {
113
113
  estimateFieldHeight: c = 52,
114
114
  scrollOffset: p = 0
115
115
  } = t;
116
- this.progressive = i, this.virtual = i ? !1 : r, this._defaultNavAnchorProps = { show: !0, ...o }, this._scrollToFirstError = a, this._containerHeight = n, this._rootMargin = u, this._estimateFieldHeight = c, this._scrollOffset = p, this._initialGroupSchema = s, this._initialFlatSchema = g(s), this.collapseStates = A({}), M(s, this.collapseStates), this.hiddenGroupKeys = A(/* @__PURE__ */ new Set()), this.hiddenFieldNames = A(/* @__PURE__ */ new Set()), this._navErrorCountsRef = T(() => this._computeNavErrorCounts()), this.navErrorCounts = new Proxy({}, {
116
+ this.progressive = i, this.virtual = i ? !1 : r, this._defaultNavAnchorProps = { show: !0, ...o }, this._scrollToFirstError = a, this._containerHeight = n, this._rootMargin = u, this._estimateFieldHeight = c, this._scrollOffset = p, this._initialGroupSchema = s, this._initialFlatSchema = g(s), this.collapseStates = A({}), M(s, this.collapseStates), this.hiddenGroupKeys = A(/* @__PURE__ */ new Set()), this.hiddenFieldNames = A(/* @__PURE__ */ new Set()), this._navErrorCountsRef = K(() => this._computeNavErrorCounts()), this.navErrorCounts = new Proxy({}, {
117
117
  get: (m, d) => {
118
118
  if (F(d))
119
119
  return this._navErrorCountsRef.value[d] ?? 0;
@@ -564,7 +564,7 @@ class ye extends j {
564
564
  void 0,
565
565
  `${e.fieldName}.dependencies.rules`
566
566
  ));
567
- const i = r || e.rules;
567
+ const i = C(r || e.rules);
568
568
  let o = !1;
569
569
  return s && v(s.required) && (o = !!await this._safeInvoke(
570
570
  () => s.required(t, this),
@@ -352,6 +352,10 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
352
352
  type: import('vue').PropType<Fn>;
353
353
  default: null;
354
354
  };
355
+ tableSearchBefore: {
356
+ type: import('vue').PropType<NonNullable<TtTableFormProps["tableSearchBefore"]>>;
357
+ default: null;
358
+ };
355
359
  toolConfig: {
356
360
  type: import('vue').PropType<import('../../../index').TtTableToolsProps>;
357
361
  default: null;
@@ -575,6 +579,10 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
575
579
  type: import('vue').PropType<Fn>;
576
580
  default: null;
577
581
  };
582
+ tableSearchBefore: {
583
+ type: import('vue').PropType<NonNullable<TtTableFormProps["tableSearchBefore"]>>;
584
+ default: null;
585
+ };
578
586
  toolConfig: {
579
587
  type: import('vue').PropType<import('../../../index').TtTableToolsProps>;
580
588
  default: null;
@@ -594,6 +602,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
594
602
  handleSearchInfoFn: Fn<any, any>;
595
603
  toolConfig: import('../../../index').TtTableToolsProps;
596
604
  tableRefreshBefore: Fn<any, any>;
605
+ tableSearchBefore: (values: Recordable) => import('../../../index').TtTableSearchBeforeResult | Promise<import('../../../index').TtTableSearchBeforeResult>;
597
606
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
598
607
  columnModalRef: ({
599
608
  $: import('vue').ComponentInternalInstance;
@@ -1,17 +1,17 @@
1
- import { defineComponent as _e, useSlots as Ie, getCurrentInstance as De, ref as Ve, shallowReactive as Ke, onScopeDispose as Y, computed as u, unref as r, shallowRef as ke, toRaw as P, watch as w, toValue as S, onMounted as Be, nextTick as Z, createElementBlock as ee, openBlock as te, normalizeClass as V, createCommentVNode as He, createElementVNode as Le, createVNode as M, renderSlot as l, createSlots as K, renderList as oe, withCtx as g, normalizeProps as re, guardReactiveProps as ie, mergeProps as se, toHandlers as ze, isRef as xe } from "vue";
1
+ import { defineComponent as Ve, useSlots as Be, getCurrentInstance as Ke, ref as ke, shallowReactive as He, onScopeDispose as Y, computed as d, unref as r, shallowRef as Le, toRaw as P, watch as w, toValue as S, onMounted as ze, nextTick as Z, createElementBlock as ee, openBlock as te, normalizeClass as V, createCommentVNode as je, createElementVNode as xe, createVNode as M, renderSlot as l, createSlots as B, renderList as oe, withCtx as h, normalizeProps as re, guardReactiveProps as ae, mergeProps as ie, toHandlers as Ne, isRef as We } from "vue";
2
2
  import "../../tt-button/index.js";
3
3
  import "../../tt-checkbox/index.js";
4
4
  import "../../tt-empty/index.js";
5
5
  import "axios";
6
6
  import "element-plus";
7
- import { isFunction as je } from "../../../packages/utils/src/is.js";
7
+ import { isFunction as se, isObject as Je } from "../../../packages/utils/src/is.js";
8
8
  import "dayjs";
9
9
  import "numeral";
10
- import { extractResourceFromApi as Ne, generateTestId as O } from "../../../packages/utils/src/testid-helper.js";
10
+ import { extractResourceFromApi as qe, generateTestId as O } from "../../../packages/utils/src/testid-helper.js";
11
11
  import "xe-utils";
12
12
  import "dayjs/plugin/utc";
13
13
  import "dayjs/plugin/timezone";
14
- import { mergeWithArrayOverride as We } from "../../../packages/utils/src/merge.js";
14
+ import { mergeWithArrayOverride as Ge } from "../../../packages/utils/src/merge.js";
15
15
  import "../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
16
16
  import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
17
17
  import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
@@ -25,15 +25,15 @@ import "../../tt-upload/index.js";
25
25
  import "../../tt-api-component/index.js";
26
26
  import "vee-validate";
27
27
  import "../../../utils/uppercaseInput.js";
28
- import { useForm as Je } from "../../tt-form/src/useForm.js";
28
+ import { useForm as Qe } from "../../tt-form/src/useForm.js";
29
29
  import "zod";
30
30
  import "@vee-validate/zod";
31
- import { useStore as qe } from "@tanstack/vue-store";
31
+ import { useStore as Ue } from "@tanstack/vue-store";
32
32
  import "es-toolkit/compat";
33
33
  import "../../tt-form/src/shared/zod-defaults.js";
34
34
  import "../../tt-nav-anchor/index.js";
35
35
  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 Ge } from "../../../packages/hooks/src/useDesign.js";
36
+ import { useDesign as Xe } from "../../../packages/hooks/src/useDesign.js";
37
37
  import { useDebounceFn as v } from "../../../packages/hooks/src/useDebounce.js";
38
38
  import "vue-router";
39
39
  import "../../tt-icon/index.js";
@@ -50,7 +50,7 @@ import "../../tt-drawer/index.js";
50
50
  import "../../tt-modal/index.js";
51
51
  import "../../tt-text/index.js";
52
52
  import "../../../directives/disabled-tip/index.js";
53
- import { GlobalConfig as Qe } from "../../../hooks/useSetup.js";
53
+ import { GlobalConfig as Ye } from "../../../hooks/useSetup.js";
54
54
  import "../../tt-log/index.js";
55
55
  /* empty css */
56
56
  /* empty css */
@@ -61,25 +61,25 @@ import "../../tt-log/index.js";
61
61
  import "../../tt-loading/index.js";
62
62
  import "../index.js";
63
63
  import "../../../hooks/basicDataCodes.js";
64
- import { useTemplateSlot as ae } from "../../../hooks/useTemplateSlot.js";
65
- import Ue from "./components/TableColumnModal.vue2.js";
64
+ import { useTemplateSlot as ne } from "../../../hooks/useTemplateSlot.js";
65
+ import Ze from "./components/TableColumnModal.vue2.js";
66
66
  /* empty css */
67
- import Xe from "./components/TableToolbarTools.vue.js";
68
- import { basicTableEmits as Ye } from "./emits.js";
69
- import { useColumnPersistence as Ze } from "./hooks/useColumnPersistence.js";
70
- import { createTableFormContext as et } from "./hooks/useTableContext.js";
71
- import { useTableForm as tt } from "./hooks/useTableForm.js";
72
- import { useSyncProps as ot } from "./hooks/useSyncProps.js";
73
- import { tableFormProps as rt } from "./props.js";
74
- import it from "./Table.vue.js";
67
+ import et from "./components/TableToolbarTools.vue.js";
68
+ import { basicTableEmits as tt } from "./emits.js";
69
+ import { useColumnPersistence as ot } from "./hooks/useColumnPersistence.js";
70
+ import { createTableFormContext as rt } from "./hooks/useTableContext.js";
71
+ import { useTableForm as at } from "./hooks/useTableForm.js";
72
+ import { useSyncProps as it } from "./hooks/useSyncProps.js";
73
+ import { tableFormProps as st } from "./props.js";
74
+ import nt from "./Table.vue.js";
75
75
  /* empty css */
76
- import { forwardedEventEntries as st } from "./table-mutation-events.js";
77
- import { TableFormApi as at } from "./utils/table-form-api.js";
78
- import { provideFormActionTestIds as nt } from "./utils/context.js";
79
- const lt = ["data-testid"], mt = ["data-testid"], Vo = /* @__PURE__ */ _e({
76
+ import { forwardedEventEntries as lt } from "./table-mutation-events.js";
77
+ import { TableFormApi as mt } from "./utils/table-form-api.js";
78
+ import { provideFormActionTestIds as pt } from "./utils/context.js";
79
+ const ct = ["data-testid"], ut = ["data-testid"], ko = /* @__PURE__ */ Ve({
80
80
  name: "TtTableForm",
81
81
  __name: "TableForm",
82
- props: rt,
82
+ props: st,
83
83
  emits: [
84
84
  "register",
85
85
  "columns-setting",
@@ -87,169 +87,180 @@ const lt = ["data-testid"], mt = ["data-testid"], Vo = /* @__PURE__ */ _e({
87
87
  "export",
88
88
  "import",
89
89
  "set-columns",
90
- ...Ye
90
+ ...tt
91
91
  ],
92
- setup(ne, { expose: le, emit: me }) {
92
+ setup(le, { expose: me, emit: pe }) {
93
93
  var q, G, Q;
94
- const a = ne, C = me, $ = Ie(), h = De(), { prefixCls: E } = Ge("table-form");
95
- function k() {
94
+ const n = le, C = pe, D = Be(), g = Ke(), { prefixCls: $ } = Xe("table-form");
95
+ function K() {
96
96
  var e;
97
- return Object.hasOwn(((e = h == null ? void 0 : h.vnode) == null ? void 0 : e.props) || {}, "table");
97
+ return Object.hasOwn(((e = g == null ? void 0 : g.vnode) == null ? void 0 : e.props) || {}, "table");
98
98
  }
99
- const R = Ve();
100
- let t = a.tableFormApi;
101
- t || (t = new at(a), t.useStore = (e) => qe(t.store, e));
102
- const B = Ke({});
99
+ const E = ke();
100
+ let o = n.tableFormApi;
101
+ o || (o = new mt(n), o.useStore = (e) => Ue(o.store, e));
102
+ const k = He({});
103
103
  function H() {
104
- Object.assign(B, P(t.store.state) || {});
104
+ Object.assign(k, P(o.store.state) || {});
105
105
  }
106
- H(), Y(t.store.subscribe(H));
107
- const c = u(() => B), T = u(() => {
108
- var o;
109
- if (a.testId) return a.testId;
110
- const e = (o = r(c).table) == null ? void 0 : o.api;
111
- return e ? Ne(e) : "table";
112
- }), pe = u(() => O(r(T), "tableform")), ue = u(() => O(r(T), "search-form-header"));
113
- nt(
114
- u(() => ({
106
+ H(), Y(o.store.subscribe(H));
107
+ const c = d(() => k), T = d(() => {
108
+ var t;
109
+ if (n.testId) return n.testId;
110
+ const e = (t = r(c).table) == null ? void 0 : t.api;
111
+ return e ? qe(e) : "table";
112
+ }), ce = d(() => O(r(T), "tableform")), ue = d(() => O(r(T), "search-form-header"));
113
+ pt(
114
+ d(() => ({
115
115
  submit: O(r(T), "search-btn-query"),
116
116
  reset: O(r(T), "search-btn-reset")
117
117
  }))
118
118
  );
119
- const { getSlotKeys: ce, replaceSlotKey: de } = ae("form-"), { getSlotKeys: fe, replaceSlotKey: be } = ae("t-"), { getFormProps: _, getTableProps: m, getTableToolProps: ge, submitSearchQuery: L } = tt(
119
+ const { getSlotKeys: de, replaceSlotKey: fe } = ne("form-"), { getSlotKeys: be, replaceSlotKey: he } = ne("t-"), { getFormProps: R, getTableProps: m, getTableToolProps: ge, submitSearchQuery: L } = at(
120
120
  c,
121
- t.tableApi.reload,
122
- t.tableApi.getLoading,
123
- t.tableApi.getPagination
124
- ), z = ke([]), he = u(() => (a.table, !k() || !a.table ? !1 : (a.table.data, Object.hasOwn(P(a.table), "data"))));
125
- let I = () => {
121
+ o.tableApi.reload,
122
+ o.tableApi.getLoading,
123
+ o.tableApi.getPagination
124
+ ), z = Le([]), we = d(() => (n.table, !K() || !n.table ? !1 : (n.table.data, Object.hasOwn(P(n.table), "data"))));
125
+ let _ = () => {
126
126
  };
127
- function we(e) {
128
- I(), I = w(
127
+ function Se(e) {
128
+ _(), _ = w(
129
129
  () => S(e),
130
- (o) => {
131
- z.value = o || [];
130
+ (t) => {
131
+ z.value = t || [];
132
132
  },
133
- { immediate: !0, deep: xe(e) ? !1 : 1 }
133
+ { immediate: !0, deep: We(e) ? !1 : 1 }
134
134
  );
135
135
  }
136
- function Se() {
137
- if (a.table)
138
- return a.table.data, P(a.table).data;
136
+ function Te() {
137
+ if (n.table)
138
+ return n.table.data, P(n.table).data;
139
139
  }
140
- w(Se, (e) => we(e), { immediate: !0 });
141
- const { run: Te } = v(
140
+ w(Te, (e) => Se(e), { immediate: !0 });
141
+ const { run: ye } = v(
142
142
  async () => {
143
- const e = await i.getValues();
144
- await i.resetForm(e, { force: !0 });
145
- const o = await i.getValues();
146
- i.setLatestSubmissionValues(o), (await i.validate()).valid && L(o);
143
+ const e = await a.getValues();
144
+ await a.resetForm(e, { force: !0 });
145
+ const t = await a.getValues();
146
+ a.setLatestSubmissionValues(t), (await a.validate()).valid && L(t);
147
147
  },
148
148
  200,
149
149
  { leading: !0 }
150
- ), { run: ye } = v(
150
+ );
151
+ async function ve() {
152
+ await o.tableApi.reloadData([]), o.tableApi.setPagination({ currentPage: 1, total: 0 });
153
+ }
154
+ async function Ce(e) {
155
+ const { tableSearchBefore: t } = r(c);
156
+ if (!se(t)) return !0;
157
+ const i = await t(e), { canSearch: s, clearData: p } = Je(i) ? i : { canSearch: i, clearData: !1 };
158
+ return p && await ve(), s !== !1;
159
+ }
160
+ const { run: Fe } = v(
151
161
  async (e) => {
152
- await t.grid.clearFilter(), await L(e);
162
+ const t = e;
163
+ await Ce(t) && (await o.grid.clearFilter(), await L(t));
153
164
  },
154
165
  200,
155
166
  { leading: !0 }
156
- ), [ve, i] = Je({
157
- ...S(_),
158
- handleSubmit: ye,
159
- handleReset: Te,
167
+ ), [Ae, a] = Qe({
168
+ ...S(R),
169
+ handleSubmit: Fe,
170
+ handleReset: ye,
160
171
  submitOnEnter: !0,
161
172
  submitButtonOptions: {
162
- content: (q = Qe.form) == null ? void 0 : q.submitTitle
173
+ content: (q = Ye.form) == null ? void 0 : q.submitTitle
163
174
  },
164
175
  showCollapseButton: !0,
165
176
  collapsed: !0,
166
177
  collapseTriggerResize: !0,
167
178
  collapsedRows: 3
168
- }), { restoreColumns: Ce, saveColumns: x } = Ze({
179
+ }), { restoreColumns: Pe, saveColumns: j } = ot({
169
180
  getTableProps: m,
170
181
  getProps: c,
171
- tableMethods: t.tableApi
182
+ tableMethods: o.tableApi
172
183
  });
173
- let d = !1;
184
+ let f = !1;
174
185
  const y = {};
175
- st.forEach(([e, o]) => {
176
- y[o] = (...s) => C(e, ...s);
186
+ lt.forEach(([e, t]) => {
187
+ y[t] = (...i) => C(e, ...i);
177
188
  });
178
- const { run: Fe } = v(async () => {
179
- if (d || !r(m).useHttpCache) return;
180
- const e = (t.tableApi.getTableColumns() || []).map((o) => o.field).filter(Boolean);
181
- e.length && await x(JSON.stringify(e));
189
+ const { run: Me } = v(async () => {
190
+ if (f || !r(m).useHttpCache) return;
191
+ const e = (o.tableApi.getTableColumns() || []).map((t) => t.field).filter(Boolean);
192
+ e.length && await j(JSON.stringify(e));
182
193
  }, 300);
183
- function Ae(e) {
184
- var o;
185
- (o = y.columnDragend) == null || o.call(y, e), Fe();
194
+ function Oe(e) {
195
+ var t;
196
+ (t = y.columnDragend) == null || t.call(y, e), Me();
186
197
  }
187
- const Pe = u(() => ({ ...y, columnDragend: Ae }));
188
- function Me(e) {
189
- t.setState((o) => o.table ? We(e, o) : {}), e.table && t.tableApi.setState(e.table), e.form && (i == null || i.setState(e.form));
198
+ const De = d(() => ({ ...y, columnDragend: Oe }));
199
+ function $e(e) {
200
+ o.setState((t) => t.table ? Ge(e, t) : {}), e.table && o.tableApi.setState(e.table), e.form && (a == null || a.setState(e.form));
190
201
  }
191
- const { run: Oe } = v(
202
+ const { run: Ee } = v(
192
203
  async (e) => {
193
- if (i.isMounted && r(c).useSearchForm) {
194
- if (!(await i.validate()).valid) return;
195
- const s = await i.getValues();
196
- await t.tableApi.reload({ ...e, searchInfo: { ...e == null ? void 0 : e.searchInfo, ...s } });
204
+ if (a.isMounted && r(c).useSearchForm) {
205
+ if (!(await a.validate()).valid) return;
206
+ const i = await a.getValues();
207
+ await o.tableApi.reload({ ...e, searchInfo: { ...e == null ? void 0 : e.searchInfo, ...i } });
197
208
  return;
198
209
  }
199
- await t.tableApi.reload({ ...e, searchInfo: { ...e == null ? void 0 : e.searchInfo } });
210
+ await o.tableApi.reload({ ...e, searchInfo: { ...e == null ? void 0 : e.searchInfo } });
200
211
  },
201
212
  200,
202
213
  { leading: !0 }
203
214
  ), F = {
204
- tableMethods: t.tableApi,
205
- formMethods: i,
206
- setTableProps: t.tableApi.setState,
207
- setFormProps: i.setState,
208
- setProps: Me,
209
- reload: Oe,
210
- selectedKeys: u(() => S(t.tableApi.selectedKeys))
215
+ tableMethods: o.tableApi,
216
+ formMethods: a,
217
+ setTableProps: o.tableApi.setState,
218
+ setFormProps: a.setState,
219
+ setProps: $e,
220
+ reload: Ee,
221
+ selectedKeys: d(() => S(o.tableApi.selectedKeys))
211
222
  };
212
- async function $e() {
223
+ async function Re() {
213
224
  const { tableRefreshBefore: e } = r(c);
214
- je(e) && await e(), F.reload();
225
+ se(e) && await e(), F.reload();
215
226
  }
216
- let D = { width: window.innerWidth, height: window.innerHeight };
217
- const { run: j } = v(async () => {
218
- var n, f;
219
- if (await Z(), d) return;
220
- const { innerWidth: e, innerHeight: o } = window, s = e !== D.width || o !== D.height;
221
- if (D = { width: e, height: o }, !s) {
227
+ let I = { width: window.innerWidth, height: window.innerHeight };
228
+ const { run: x } = v(async () => {
229
+ var s, p;
230
+ if (await Z(), f) return;
231
+ const { innerWidth: e, innerHeight: t } = window, i = e !== I.width || t !== I.height;
232
+ if (I = { width: e, height: t }, !i) {
222
233
  if (!r(m).autoHeight) return;
223
- (n = t.tableApi) == null || n.redoHeight(!1);
234
+ (s = o.tableApi) == null || s.redoHeight(!1);
224
235
  return;
225
236
  }
226
- (f = t.tableApi) == null || f.redoHeight();
237
+ (p = o.tableApi) == null || p.redoHeight();
227
238
  }, 100);
228
- async function Ee(e) {
229
- var f, A;
230
- if (d) return;
231
- const o = S((A = (f = r(c)) == null ? void 0 : f.table) == null ? void 0 : A.columns) || [], s = new Map(o.map((b) => [b.field, b])), n = e.checkedModel.map((b) => s.get(b)).filter(Boolean);
239
+ async function _e(e) {
240
+ var p, A;
241
+ if (f) return;
242
+ const t = S((A = (p = r(c)) == null ? void 0 : p.table) == null ? void 0 : A.columns) || [], i = new Map(t.map((b) => [b.field, b])), s = e.checkedModel.map((b) => i.get(b)).filter(Boolean);
232
243
  if (e.isExport) {
233
244
  C("export", e.checkedModel, e.modalApi);
234
245
  return;
235
246
  }
236
247
  e.modalApi.setModalProps({ confirmLoading: !0 });
237
248
  try {
238
- if (r(m).useHttpCache && await x(JSON.stringify(e.checkedModel)), d) return;
239
- t.tableApi.setTableColumns(n), e.modalApi.closeModal(), C("set-columns", n);
249
+ if (r(m).useHttpCache && await j(JSON.stringify(e.checkedModel)), f) return;
250
+ o.tableApi.setTableColumns(s), e.modalApi.closeModal(), C("set-columns", s);
240
251
  } finally {
241
- d || e.modalApi.setModalProps({ confirmLoading: !1 });
252
+ f || e.modalApi.setModalProps({ confirmLoading: !1 });
242
253
  }
243
254
  }
244
- function N(e, o = !1) {
255
+ function N(e, t = !1) {
245
256
  var b, U, X;
246
- const { notSetColumnField: s, columns: n } = r(m), f = ((((b = t.tableApi.getTableInstance()) == null ? void 0 : b.getTableColumn()) || {}).visibleColumn || []).map((p) => p.field).filter(Boolean), A = (S(n) || []).filter((p) => p.visible === !0 || p.visible === void 0).map((p) => p.field);
247
- (U = R.value) == null || U.openModal({
248
- columns: (S(n) || []).filter((p) => p.visible !== !1),
249
- displayFields: o ? A : f,
250
- disabledColumnField: s || [],
257
+ const { notSetColumnField: i, columns: s } = r(m), p = ((((b = o.tableApi.getTableInstance()) == null ? void 0 : b.getTableColumn()) || {}).visibleColumn || []).map((u) => u.field).filter(Boolean), A = (S(s) || []).filter((u) => u.visible === !0 || u.visible === void 0).map((u) => u.field);
258
+ (U = E.value) == null || U.openModal({
259
+ columns: (S(s) || []).filter((u) => u.visible !== !1),
260
+ displayFields: t ? A : p,
261
+ disabledColumnField: i || [],
251
262
  isExport: e
252
- }), (X = R.value) == null || X.setModalProps({ title: e ? "自定义导出" : "列设置" });
263
+ }), (X = E.value) == null || X.setModalProps({ title: e ? "自定义导出" : "列设置" });
253
264
  }
254
265
  function W(e = !1) {
255
266
  N(!1, e);
@@ -257,89 +268,89 @@ const lt = ["data-testid"], mt = ["data-testid"], Vo = /* @__PURE__ */ _e({
257
268
  function J(e = !1) {
258
269
  N(!0, e);
259
270
  }
260
- function Re() {
261
- const e = a.table;
262
- if (!k() || !e) return;
263
- const o = {};
264
- return Object.keys(P(e)).forEach((s) => {
265
- s !== "data" && Object.assign(o, { [s]: e[s] });
266
- }), o;
271
+ function Ie() {
272
+ const e = n.table;
273
+ if (!K() || !e) return;
274
+ const t = {};
275
+ return Object.keys(P(e)).forEach((i) => {
276
+ i !== "data" && Object.assign(t, { [i]: e[i] });
277
+ }), t;
267
278
  }
268
- return ot(a, t.setState, ["tableFormApi", "table"]), w(
269
- Re,
279
+ return it(n, o.setState, ["tableFormApi", "table"]), w(
280
+ Ie,
270
281
  (e) => {
271
- e && t.setState({ table: e });
282
+ e && o.setState({ table: e });
272
283
  },
273
284
  { deep: !0, immediate: !0 }
274
- ), et({ formInstance: i }), w(
275
- () => t.tableApi.getLoading.value,
285
+ ), rt({ formInstance: a }), w(
286
+ () => o.tableApi.getLoading.value,
276
287
  (e) => {
277
- i == null || i.setState({ submitButtonOptions: { loading: e } });
288
+ a == null || a.setState({ submitButtonOptions: { loading: e } });
278
289
  },
279
- { immediate: (Q = (G = t.store.state) == null ? void 0 : G.table) == null ? void 0 : Q.immediate }
280
- ), w(_, (e) => i == null ? void 0 : i.setState(e)), w(m, (e) => {
281
- var o;
282
- return (o = t.tableApi) == null ? void 0 : o.setState(e);
283
- }), Be(() => {
284
- h && C("register", F, h.uid), t.mount(F, i), i == null || i.setState(r(_)), Z(() => {
285
- d || Ce();
286
- }), window.addEventListener("resize", j);
290
+ { immediate: (Q = (G = o.store.state) == null ? void 0 : G.table) == null ? void 0 : Q.immediate }
291
+ ), w(R, (e) => a == null ? void 0 : a.setState(e)), w(m, (e) => {
292
+ var t;
293
+ return (t = o.tableApi) == null ? void 0 : t.setState(e);
294
+ }), ze(() => {
295
+ g && C("register", F, g.uid), o.mount(F, a), a == null || a.setState(r(R)), Z(() => {
296
+ f || Pe();
297
+ }), window.addEventListener("resize", x);
287
298
  }), Y(() => {
288
- d = !0, I(), t == null || t.unmount(), window.removeEventListener("resize", j);
289
- }), le({ ...F, instance: h }), (e, o) => (te(), ee("div", {
290
- class: V(r(E)),
291
- "data-testid": pe.value
299
+ f = !0, _(), o == null || o.unmount(), window.removeEventListener("resize", x);
300
+ }), me({ ...F, instance: g }), (e, t) => (te(), ee("div", {
301
+ class: V(r($)),
302
+ "data-testid": ce.value
292
303
  }, [
293
304
  c.value.useSearchForm ? (te(), ee("div", {
294
305
  key: 0,
295
- class: V(`${r(E)}-header`),
306
+ class: V(`${r($)}-header`),
296
307
  "data-testid": ue.value
297
308
  }, [
298
- M(r(ve), {
309
+ M(r(Ae), {
299
310
  "test-id": `${T.value}-search-form`
300
- }, K({ _: 2 }, [
301
- oe(r(ce)(r($)), (s) => ({
302
- name: r(de)(s),
303
- fn: g((n) => [
304
- l(e.$slots, s, re(ie(n || {})))
311
+ }, B({ _: 2 }, [
312
+ oe(r(de)(r(D)), (i) => ({
313
+ name: r(fe)(i),
314
+ fn: h((s) => [
315
+ l(e.$slots, i, re(ae(s || {})))
305
316
  ])
306
317
  }))
307
318
  ]), 1032, ["test-id"]),
308
319
  l(e.$slots, "header-down")
309
- ], 10, mt)) : He("", !0),
310
- Le("div", {
320
+ ], 10, ut)) : je("", !0),
321
+ xe("div", {
311
322
  class: V({
312
- [`${r(E)}-wrapper`]: !0,
323
+ [`${r($)}-wrapper`]: !0,
313
324
  "pt-(--tt-base-padding)!": !0,
314
325
  "pb-(--tt-base-padding)!": !r(m).showPager
315
326
  })
316
327
  }, [
317
328
  l(e.$slots, "table-top"),
318
- M(it, se({
329
+ M(nt, ie({
319
330
  ...r(m),
320
- ...he.value ? { data: z.value } : {}
331
+ ...we.value ? { data: z.value } : {}
321
332
  }, {
322
- "form-api": r(i),
323
- "table-api": r(t).tableApi
324
- }, ze(Pe.value)), K({ _: 2 }, [
325
- oe(r(fe)(r($)), (s) => ({
326
- name: r(be)(s),
327
- fn: g((n) => [
328
- l(e.$slots, s, re(ie(n || {})))
333
+ "form-api": r(a),
334
+ "table-api": r(o).tableApi
335
+ }, Ne(De.value)), B({ _: 2 }, [
336
+ oe(r(be)(r(D)), (i) => ({
337
+ name: r(he)(i),
338
+ fn: h((s) => [
339
+ l(e.$slots, i, re(ae(s || {})))
329
340
  ])
330
341
  })),
331
342
  r(m).showToolbar ? {
332
343
  name: "toolbar_tools",
333
- fn: g(() => [
334
- M(Xe, se(r(ge), {
335
- onOnRefresh: $e,
344
+ fn: h(() => [
345
+ M(et, ie(r(ge), {
346
+ onOnRefresh: Re,
336
347
  onOnExport: J,
337
348
  onOnColumnsSetting: W
338
349
  }), {
339
- "toolbar-left": g(() => [
350
+ "toolbar-left": h(() => [
340
351
  l(e.$slots, "t-toolbar_tools-left")
341
352
  ]),
342
- "toolbar-right": g(() => [
353
+ "toolbar-right": h(() => [
343
354
  l(e.$slots, "t-toolbar_tools-right")
344
355
  ]),
345
356
  _: 3
@@ -351,29 +362,29 @@ const lt = ["data-testid"], mt = ["data-testid"], Vo = /* @__PURE__ */ _e({
351
362
  ]), 1040, ["form-api", "table-api"]),
352
363
  l(e.$slots, "table-bottom")
353
364
  ], 2),
354
- M(Ue, {
365
+ M(Ze, {
355
366
  ref_key: "columnModalRef",
356
- ref: R,
367
+ ref: E,
357
368
  "open-export": J,
358
369
  "open-column": W,
359
- onOnSubmit: Ee
360
- }, K({
361
- beforeFooter: g(() => [
370
+ onOnSubmit: _e
371
+ }, B({
372
+ beforeFooter: h(() => [
362
373
  l(e.$slots, "t-column-modal-before-footer")
363
374
  ]),
364
375
  _: 2
365
376
  }, [
366
- r($)["t-column-modal-title"] ? {
377
+ r(D)["t-column-modal-title"] ? {
367
378
  name: "title",
368
- fn: g(() => [
379
+ fn: h(() => [
369
380
  l(e.$slots, "t-column-modal-title")
370
381
  ]),
371
382
  key: "0"
372
383
  } : void 0
373
384
  ]), 1536)
374
- ], 10, lt));
385
+ ], 10, ct));
375
386
  }
376
387
  });
377
388
  export {
378
- Vo as default
389
+ ko as default
379
390
  };
@@ -2,7 +2,7 @@ import { PropType } from 'vue';
2
2
  import { TtExtendedFormApi, TtFormProps } from '../../tt-form';
3
3
  import { VxeTableDefines, VxeTablePropTypes } from 'vxe-table';
4
4
  import { TtTableExtendedTableApi, TtTableProps } from './types/table';
5
- import { TtTableExtendedTableFormApi } from './types/tableForm';
5
+ import { TtTableExtendedTableFormApi, TtTableFormProps } from './types/tableForm';
6
6
  import { TtTableToolsProps } from './types/tableTools';
7
7
  /** 表格参数 */
8
8
  export declare const tableProps: {
@@ -504,6 +504,11 @@ export declare const tableFormProps: {
504
504
  type: PropType<Fn>;
505
505
  default: null;
506
506
  };
507
+ /** 查询发起请求前的调用方法,返回 false 拦截本次查询 */
508
+ tableSearchBefore: {
509
+ type: PropType<NonNullable<TtTableFormProps["tableSearchBefore"]>>;
510
+ default: null;
511
+ };
507
512
  /** TtTableTools的props */
508
513
  toolConfig: {
509
514
  type: PropType<TtTableToolsProps>;
@@ -82,7 +82,7 @@ const a = {
82
82
  type: Function
83
83
  // default: () => GlobalConfig.table?.customizeColumn,
84
84
  }
85
- }, p = {
85
+ }, n = {
86
86
  /** api请求方法 */
87
87
  api: {
88
88
  type: Function,
@@ -115,7 +115,7 @@ const a = {
115
115
  },
116
116
  /** 是否滚动加载数据 */
117
117
  isScrollFetch: { type: Boolean, default: () => e("isScrollFetch") }
118
- }, n = {
118
+ }, p = {
119
119
  /** 是否显示toolbar */
120
120
  showToolbar: { type: Boolean, default: () => e("showToolbar") },
121
121
  /** 具体某些列排序 field数组 */
@@ -207,8 +207,8 @@ const a = {
207
207
  },
208
208
  ...a,
209
209
  ...r,
210
- ...p,
211
- ...n
210
+ ...n,
211
+ ...p
212
212
  }, i = {
213
213
  /** 按键配置项 */
214
214
  keyboardConfig: {
@@ -261,6 +261,11 @@ const a = {
261
261
  type: Function,
262
262
  default: null
263
263
  },
264
+ /** 查询发起请求前的调用方法,返回 false 拦截本次查询 */
265
+ tableSearchBefore: {
266
+ type: Function,
267
+ default: null
268
+ },
264
269
  /** TtTableTools的props */
265
270
  toolConfig: {
266
271
  type: Object,
@@ -1,10 +1,22 @@
1
1
  import { MaybeRef, Ref } from 'vue';
2
+ import { Recordable } from '../../../../../../utils/src';
2
3
  import { TtSelectRowKeysType, TtTableMethods, TtTableProps } from '../types/table';
3
4
  import { TableFormApi } from '../utils/table-form-api';
4
5
  import { TtTableToolsProps } from './tableTools';
5
6
  import { TtExtendedFormApi, TtFormProps } from '../../../tt-form';
6
7
  export type TtTableFormRenderFormProps = Partial<TtFormProps>;
7
8
  export type TtTableRenderFormInstance = TtExtendedFormApi;
9
+ /**
10
+ * 查询前拦截的返回结果。
11
+ *
12
+ * 直接返回布尔值表示是否发起查询;需要在拦截的同时清掉列表时返回对象形式。
13
+ */
14
+ export type TtTableSearchBeforeResult = boolean | {
15
+ /** 是否继续发起查询请求 */
16
+ canSearch: boolean;
17
+ /** 是否清空表格数据与分页总数,默认 false */
18
+ clearData?: boolean;
19
+ };
8
20
  /**
9
21
  * 表单 + 表格的组合配置。
10
22
  *
@@ -23,6 +35,13 @@ export type TtTableFormProps<Row = any> = {
23
35
  toolConfig?: TtTableToolsProps;
24
36
  /** 刷新前的调用方法 */
25
37
  tableRefreshBefore?: (...arg: any[]) => Promise<any>;
38
+ /**
39
+ * 点击查询(含回车提交)发起请求前的调用方法。
40
+ *
41
+ * 返回 `false` 拦截本次查询;返回 `{ canSearch, clearData }` 可以在拦截的同时清空表格数据。
42
+ * @param values 通过校验后的当前表单值
43
+ */
44
+ tableSearchBefore?: (values: Recordable) => TtTableSearchBeforeResult | Promise<TtTableSearchBeforeResult>;
26
45
  /**
27
46
  * 表格 testId,用于生成测试标识
28
47
  * 如果不指定,将从 table.api 路径自动提取
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazhicheng/ui",
3
- "version": "1.6.18",
3
+ "version": "1.6.19",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",