@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.
- package/dist/components/tt-form/src/group-form/groupFormApi.js +8 -8
- package/dist/components/tt-table/src/TableForm.vue.d.ts +9 -0
- package/dist/components/tt-table/src/TableForm.vue.js +190 -179
- package/dist/components/tt-table/src/props.d.ts +6 -1
- package/dist/components/tt-table/src/props.js +9 -4
- package/dist/components/tt-table/src/types/tableForm.d.ts +19 -0
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var l = (f, 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
|
|
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 =
|
|
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",
|
|
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 =
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
65
|
-
import
|
|
64
|
+
import { useTemplateSlot as ne } from "../../../hooks/useTemplateSlot.js";
|
|
65
|
+
import Ze from "./components/TableColumnModal.vue2.js";
|
|
66
66
|
/* empty css */
|
|
67
|
-
import
|
|
68
|
-
import { basicTableEmits as
|
|
69
|
-
import { useColumnPersistence as
|
|
70
|
-
import { createTableFormContext as
|
|
71
|
-
import { useTableForm as
|
|
72
|
-
import { useSyncProps as
|
|
73
|
-
import { tableFormProps as
|
|
74
|
-
import
|
|
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
|
|
77
|
-
import { TableFormApi as
|
|
78
|
-
import { provideFormActionTestIds as
|
|
79
|
-
const
|
|
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:
|
|
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
|
-
...
|
|
90
|
+
...tt
|
|
91
91
|
],
|
|
92
|
-
setup(
|
|
92
|
+
setup(le, { expose: me, emit: pe }) {
|
|
93
93
|
var q, G, Q;
|
|
94
|
-
const
|
|
95
|
-
function
|
|
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 =
|
|
97
|
+
return Object.hasOwn(((e = g == null ? void 0 : g.vnode) == null ? void 0 : e.props) || {}, "table");
|
|
98
98
|
}
|
|
99
|
-
const
|
|
100
|
-
let
|
|
101
|
-
|
|
102
|
-
const
|
|
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(
|
|
104
|
+
Object.assign(k, P(o.store.state) || {});
|
|
105
105
|
}
|
|
106
|
-
H(), Y(
|
|
107
|
-
const c =
|
|
108
|
-
var
|
|
109
|
-
if (
|
|
110
|
-
const e = (
|
|
111
|
-
return e ?
|
|
112
|
-
}),
|
|
113
|
-
|
|
114
|
-
|
|
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:
|
|
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
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
), z =
|
|
125
|
-
let
|
|
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
|
|
128
|
-
|
|
127
|
+
function Se(e) {
|
|
128
|
+
_(), _ = w(
|
|
129
129
|
() => S(e),
|
|
130
|
-
(
|
|
131
|
-
z.value =
|
|
130
|
+
(t) => {
|
|
131
|
+
z.value = t || [];
|
|
132
132
|
},
|
|
133
|
-
{ immediate: !0, deep:
|
|
133
|
+
{ immediate: !0, deep: We(e) ? !1 : 1 }
|
|
134
134
|
);
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
if (
|
|
138
|
-
return
|
|
136
|
+
function Te() {
|
|
137
|
+
if (n.table)
|
|
138
|
+
return n.table.data, P(n.table).data;
|
|
139
139
|
}
|
|
140
|
-
w(
|
|
141
|
-
const { run:
|
|
140
|
+
w(Te, (e) => Se(e), { immediate: !0 });
|
|
141
|
+
const { run: ye } = v(
|
|
142
142
|
async () => {
|
|
143
|
-
const e = await
|
|
144
|
-
await
|
|
145
|
-
const
|
|
146
|
-
|
|
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
|
-
)
|
|
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
|
-
|
|
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
|
-
), [
|
|
157
|
-
...S(
|
|
158
|
-
handleSubmit:
|
|
159
|
-
handleReset:
|
|
167
|
+
), [Ae, a] = Qe({
|
|
168
|
+
...S(R),
|
|
169
|
+
handleSubmit: Fe,
|
|
170
|
+
handleReset: ye,
|
|
160
171
|
submitOnEnter: !0,
|
|
161
172
|
submitButtonOptions: {
|
|
162
|
-
content: (q =
|
|
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:
|
|
179
|
+
}), { restoreColumns: Pe, saveColumns: j } = ot({
|
|
169
180
|
getTableProps: m,
|
|
170
181
|
getProps: c,
|
|
171
|
-
tableMethods:
|
|
182
|
+
tableMethods: o.tableApi
|
|
172
183
|
});
|
|
173
|
-
let
|
|
184
|
+
let f = !1;
|
|
174
185
|
const y = {};
|
|
175
|
-
|
|
176
|
-
y[
|
|
186
|
+
lt.forEach(([e, t]) => {
|
|
187
|
+
y[t] = (...i) => C(e, ...i);
|
|
177
188
|
});
|
|
178
|
-
const { run:
|
|
179
|
-
if (
|
|
180
|
-
const e = (
|
|
181
|
-
e.length && await
|
|
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
|
|
184
|
-
var
|
|
185
|
-
(
|
|
194
|
+
function Oe(e) {
|
|
195
|
+
var t;
|
|
196
|
+
(t = y.columnDragend) == null || t.call(y, e), Me();
|
|
186
197
|
}
|
|
187
|
-
const
|
|
188
|
-
function
|
|
189
|
-
|
|
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:
|
|
202
|
+
const { run: Ee } = v(
|
|
192
203
|
async (e) => {
|
|
193
|
-
if (
|
|
194
|
-
if (!(await
|
|
195
|
-
const
|
|
196
|
-
await
|
|
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
|
|
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:
|
|
205
|
-
formMethods:
|
|
206
|
-
setTableProps:
|
|
207
|
-
setFormProps:
|
|
208
|
-
setProps:
|
|
209
|
-
reload:
|
|
210
|
-
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
|
|
223
|
+
async function Re() {
|
|
213
224
|
const { tableRefreshBefore: e } = r(c);
|
|
214
|
-
|
|
225
|
+
se(e) && await e(), F.reload();
|
|
215
226
|
}
|
|
216
|
-
let
|
|
217
|
-
const { run:
|
|
218
|
-
var
|
|
219
|
-
if (await Z(),
|
|
220
|
-
const { innerWidth: e, innerHeight:
|
|
221
|
-
if (
|
|
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
|
-
(
|
|
234
|
+
(s = o.tableApi) == null || s.redoHeight(!1);
|
|
224
235
|
return;
|
|
225
236
|
}
|
|
226
|
-
(
|
|
237
|
+
(p = o.tableApi) == null || p.redoHeight();
|
|
227
238
|
}, 100);
|
|
228
|
-
async function
|
|
229
|
-
var
|
|
230
|
-
if (
|
|
231
|
-
const
|
|
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
|
|
239
|
-
|
|
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
|
-
|
|
252
|
+
f || e.modalApi.setModalProps({ confirmLoading: !1 });
|
|
242
253
|
}
|
|
243
254
|
}
|
|
244
|
-
function N(e,
|
|
255
|
+
function N(e, t = !1) {
|
|
245
256
|
var b, U, X;
|
|
246
|
-
const { notSetColumnField:
|
|
247
|
-
(U =
|
|
248
|
-
columns: (S(
|
|
249
|
-
displayFields:
|
|
250
|
-
disabledColumnField:
|
|
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 =
|
|
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
|
|
261
|
-
const e =
|
|
262
|
-
if (!
|
|
263
|
-
const
|
|
264
|
-
return Object.keys(P(e)).forEach((
|
|
265
|
-
|
|
266
|
-
}),
|
|
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
|
|
269
|
-
|
|
279
|
+
return it(n, o.setState, ["tableFormApi", "table"]), w(
|
|
280
|
+
Ie,
|
|
270
281
|
(e) => {
|
|
271
|
-
e &&
|
|
282
|
+
e && o.setState({ table: e });
|
|
272
283
|
},
|
|
273
284
|
{ deep: !0, immediate: !0 }
|
|
274
|
-
),
|
|
275
|
-
() =>
|
|
285
|
+
), rt({ formInstance: a }), w(
|
|
286
|
+
() => o.tableApi.getLoading.value,
|
|
276
287
|
(e) => {
|
|
277
|
-
|
|
288
|
+
a == null || a.setState({ submitButtonOptions: { loading: e } });
|
|
278
289
|
},
|
|
279
|
-
{ immediate: (Q = (G =
|
|
280
|
-
), w(
|
|
281
|
-
var
|
|
282
|
-
return (
|
|
283
|
-
}),
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}), window.addEventListener("resize",
|
|
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
|
-
|
|
289
|
-
}),
|
|
290
|
-
class: V(r(
|
|
291
|
-
"data-testid":
|
|
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(
|
|
306
|
+
class: V(`${r($)}-header`),
|
|
296
307
|
"data-testid": ue.value
|
|
297
308
|
}, [
|
|
298
|
-
M(r(
|
|
309
|
+
M(r(Ae), {
|
|
299
310
|
"test-id": `${T.value}-search-form`
|
|
300
|
-
},
|
|
301
|
-
oe(r(
|
|
302
|
-
name: r(
|
|
303
|
-
fn:
|
|
304
|
-
l(e.$slots,
|
|
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,
|
|
310
|
-
|
|
320
|
+
], 10, ut)) : je("", !0),
|
|
321
|
+
xe("div", {
|
|
311
322
|
class: V({
|
|
312
|
-
[`${r(
|
|
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(
|
|
329
|
+
M(nt, ie({
|
|
319
330
|
...r(m),
|
|
320
|
-
...
|
|
331
|
+
...we.value ? { data: z.value } : {}
|
|
321
332
|
}, {
|
|
322
|
-
"form-api": r(
|
|
323
|
-
"table-api": r(
|
|
324
|
-
},
|
|
325
|
-
oe(r(
|
|
326
|
-
name: r(
|
|
327
|
-
fn:
|
|
328
|
-
l(e.$slots,
|
|
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:
|
|
334
|
-
M(
|
|
335
|
-
onOnRefresh:
|
|
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":
|
|
350
|
+
"toolbar-left": h(() => [
|
|
340
351
|
l(e.$slots, "t-toolbar_tools-left")
|
|
341
352
|
]),
|
|
342
|
-
"toolbar-right":
|
|
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(
|
|
365
|
+
M(Ze, {
|
|
355
366
|
ref_key: "columnModalRef",
|
|
356
|
-
ref:
|
|
367
|
+
ref: E,
|
|
357
368
|
"open-export": J,
|
|
358
369
|
"open-column": W,
|
|
359
|
-
onOnSubmit:
|
|
360
|
-
},
|
|
361
|
-
beforeFooter:
|
|
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(
|
|
377
|
+
r(D)["t-column-modal-title"] ? {
|
|
367
378
|
name: "title",
|
|
368
|
-
fn:
|
|
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,
|
|
385
|
+
], 10, ct));
|
|
375
386
|
}
|
|
376
387
|
});
|
|
377
388
|
export {
|
|
378
|
-
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
...
|
|
211
|
-
...
|
|
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 路径自动提取
|