@vtable-guild/vtable-guild 2.9.0-alpha.9 → 3.0.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.
- package/css/index.css +114 -9
- package/css/presets/antdv.css +3 -0
- package/css/presets/element-plus.css +3 -0
- package/css/style.css +363 -17
- package/css/tailwind3-utilities.css +190 -6
- package/css/tailwind3.css +173 -11
- package/css/tailwind4.css +173 -11
- package/css/transitions.css +53 -2
- package/dist/core/src/utils/types.d.ts +3 -0
- package/dist/core/src/utils/types.d.ts.map +1 -1
- package/dist/css/index.css +114 -9
- package/dist/css/presets/antdv.css +3 -0
- package/dist/css/presets/element-plus.css +3 -0
- package/dist/css/style.css +363 -17
- package/dist/css/tailwind3-utilities.css +190 -6
- package/dist/css/tailwind3.css +173 -11
- package/dist/css/tailwind4.css +173 -11
- package/dist/css/transitions.css +53 -2
- package/dist/icons/src/EditOutlinedIcon.d.ts +3 -0
- package/dist/icons/src/EditOutlinedIcon.d.ts.map +1 -0
- package/dist/icons/src/EditOutlinedIcon.mjs +9 -0
- package/dist/icons/src/index.d.ts +1 -0
- package/dist/icons/src/index.d.ts.map +1 -1
- package/dist/index.full.mjs +8812 -7126
- package/dist/index.mjs +112 -106
- package/dist/table/src/components/Table.d.ts +1 -1
- package/dist/table/src/components/TableCell.d.ts.map +1 -1
- package/dist/table/src/components/TableCell.mjs +118 -147
- package/dist/table/src/components/TableEditFrame.d.ts +58 -0
- package/dist/table/src/components/TableEditFrame.d.ts.map +1 -0
- package/dist/table/src/components/TableEditFrame.mjs +127 -0
- package/dist/table/src/components/TableEditLayout.test.d.ts +2 -0
- package/dist/table/src/components/TableEditLayout.test.d.ts.map +1 -0
- package/dist/table/src/components/TableEditableCell.d.ts +46 -9
- package/dist/table/src/components/TableEditableCell.d.ts.map +1 -1
- package/dist/table/src/components/TableEditableCell.mjs +99 -22
- package/dist/table/src/components/TableLightFilter.d.ts.map +1 -1
- package/dist/table/src/components/TableLightFilter.mjs +53 -51
- package/dist/table/src/components/TableQuery.d.ts +6 -0
- package/dist/table/src/components/TableQuery.d.ts.map +1 -1
- package/dist/table/src/components/TableQuery.mjs +396 -225
- package/dist/table/src/components/TableQueryNative.test.d.ts +2 -0
- package/dist/table/src/components/TableQueryNative.test.d.ts.map +1 -0
- package/dist/table/src/components/TableSelectionAlert.d.ts +1 -1
- package/dist/table/src/components/TableSelectionAlert.d.ts.map +1 -1
- package/dist/table/src/components/TableSelectionAlert.mjs +109 -55
- package/dist/table/src/components/VTableEditCell.test.d.ts +2 -0
- package/dist/table/src/components/VTableEditCell.test.d.ts.map +1 -0
- package/dist/table/src/components/VTableEditCell.vue.d.ts +18 -3
- package/dist/table/src/components/VTableEditCell.vue.d.ts.map +1 -1
- package/dist/table/src/components/VTableEditCell.vue.mjs +172 -10
- package/dist/table/src/components/VTableEditShell.vue.d.ts +38 -0
- package/dist/table/src/components/VTableEditShell.vue.d.ts.map +1 -0
- package/dist/table/src/components/VTableEditShell.vue.mjs +37 -0
- package/dist/table/src/components/VTableEditShell.vue2.mjs +4 -0
- package/dist/table/src/components/VTableQuery.vue.mjs +12 -9
- package/dist/table/src/components/VirtualTableBody.mjs +24 -23
- package/dist/table/src/components/renderCellDisplay.d.ts +6 -0
- package/dist/table/src/components/renderCellDisplay.d.ts.map +1 -0
- package/dist/table/src/components/renderCellDisplay.mjs +37 -0
- package/dist/table/src/composables/useQueryCollapseMotion.d.ts +4 -0
- package/dist/table/src/composables/useQueryCollapseMotion.d.ts.map +1 -0
- package/dist/table/src/composables/useQueryCollapseMotion.mjs +48 -0
- package/dist/table/src/composables/useQueryCollapseMotion.test.d.ts +2 -0
- package/dist/table/src/composables/useQueryCollapseMotion.test.d.ts.map +1 -0
- package/dist/table/src/composables/useSelection.d.ts.map +1 -1
- package/dist/table/src/composables/useSelection.mjs +157 -148
- package/dist/table/src/composables/useTableEdit.d.ts +17 -0
- package/dist/table/src/composables/useTableEdit.d.ts.map +1 -1
- package/dist/table/src/composables/useTableEdit.mjs +326 -266
- package/dist/table/src/composables/useTableEditable.d.ts.map +1 -1
- package/dist/table/src/composables/useTableEditable.mjs +321 -89
- package/dist/table/src/controls.d.ts.map +1 -1
- package/dist/table/src/controls.mjs +161 -69
- package/dist/table/src/index.d.ts +2 -0
- package/dist/table/src/index.d.ts.map +1 -1
- package/dist/table/src/types/controls.d.ts +45 -2
- package/dist/table/src/types/controls.d.ts.map +1 -1
- package/dist/table/src/types/controls.mjs +4 -0
- package/dist/table/src/types/editable.d.ts +78 -4
- package/dist/table/src/types/editable.d.ts.map +1 -1
- package/dist/table/src/types/editable.typecheck.d.ts.map +1 -1
- package/dist/table/src/types/editing.d.ts +5 -2
- package/dist/table/src/types/editing.d.ts.map +1 -1
- package/dist/table/src/types/query-form.d.ts +11 -3
- package/dist/table/src/types/query-form.d.ts.map +1 -1
- package/dist/table/src/types/query-form.typecheck.d.ts +4 -0
- package/dist/table/src/types/query-form.typecheck.d.ts.map +1 -1
- package/dist/table/src/types/table.d.ts +1 -0
- package/dist/table/src/types/table.d.ts.map +1 -1
- package/dist/table/src/utils/cell.d.ts +18 -12
- package/dist/table/src/utils/cell.d.ts.map +1 -1
- package/dist/table/src/utils/cell.mjs +95 -94
- package/dist/table/src/utils/draftEqual.d.ts +2 -0
- package/dist/table/src/utils/draftEqual.d.ts.map +1 -0
- package/dist/table/src/utils/draftEqual.mjs +22 -0
- package/dist/table/src/utils/queryInlineLayout.d.ts +22 -0
- package/dist/table/src/utils/queryInlineLayout.d.ts.map +1 -0
- package/dist/table/src/utils/queryInlineLayout.mjs +92 -0
- package/dist/table/src/utils/queryInlineLayout.test.d.ts +2 -0
- package/dist/table/src/utils/queryInlineLayout.test.d.ts.map +1 -0
- package/dist/table/src/utils/snapshot.d.ts +2 -0
- package/dist/table/src/utils/snapshot.d.ts.map +1 -1
- package/dist/table/src/utils/snapshot.mjs +18 -13
- package/dist/theme/src/presets/antdv/table-locale.d.ts +6 -0
- package/dist/theme/src/presets/antdv/table-locale.d.ts.map +1 -1
- package/dist/theme/src/presets/antdv/table-locale.mjs +16 -2
- package/dist/theme/src/presets/antdv/table.d.ts +18 -8
- package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
- package/dist/theme/src/presets/antdv/table.mjs +56 -12
- package/dist/theme/src/presets/element-plus/table-locale.d.ts +6 -0
- package/dist/theme/src/presets/element-plus/table-locale.d.ts.map +1 -1
- package/dist/theme/src/presets/element-plus/table-locale.mjs +16 -2
- package/dist/theme/src/presets/element-plus/table.d.ts +18 -8
- package/dist/theme/src/presets/element-plus/table.d.ts.map +1 -1
- package/dist/theme/src/presets/element-plus/table.mjs +57 -10
- package/dist/theme/src/query.d.ts +4 -4
- package/dist/theme/src/query.mjs +1 -1
- package/dist/theme/src/selection-alert.d.ts +8 -0
- package/dist/theme/src/selection-alert.d.ts.map +1 -1
- package/dist/theme/src/selection-alert.mjs +2 -0
- package/dist/vtable-guild/src/index.d.ts +1 -1
- package/dist/vtable-guild/src/index.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useTheme as
|
|
3
|
-
import
|
|
4
|
-
import { VTABLE_GUILD_INJECTION_KEY as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
1
|
+
import { defineComponent as je, inject as Ae, computed as d, useId as Le, ref as W, shallowRef as Ie, watch as Ee, onBeforeUnmount as Qe, createVNode as i, mergeProps as K, h as _, nextTick as We, toValue as $, Fragment as _e, isVNode as $e } from "vue";
|
|
2
|
+
import { useTheme as De } from "../../../core/src/composables/useTheme.mjs";
|
|
3
|
+
import he from "../../../core/src/components/Button.mjs";
|
|
4
|
+
import { VTABLE_GUILD_INJECTION_KEY as Me } from "../../../core/src/plugin/index.mjs";
|
|
5
|
+
import Ve from "../../../icons/src/DownOutlinedIcon.mjs";
|
|
6
|
+
import { resolveQueryThemePreset as Ge, queryEnUS as Ue, queryZhCN as He } from "../../../theme/src/query.mjs";
|
|
7
|
+
import { TABLE_QUERY_FORM_ADAPTER as ze } from "../types/controls.mjs";
|
|
8
|
+
import Ye from "./TableLightFilter.mjs";
|
|
9
|
+
import { useQueryFilterWidth as Je, getQueryFilterLayout as Ke } from "../utils/queryFilterLayout.mjs";
|
|
10
|
+
import { useQueryInlineLayout as Ze } from "../utils/queryInlineLayout.mjs";
|
|
11
|
+
import { useQueryCollapseMotion as Xe } from "../composables/useQueryCollapseMotion.mjs";
|
|
12
|
+
import { deriveTableQueryFields as et } from "../utils/queryFields.mjs";
|
|
13
|
+
import { snapshot as ue } from "../utils/snapshot.mjs";
|
|
14
|
+
import { stateEqual as re } from "../utils/stateEqual.mjs";
|
|
15
|
+
function tt(e) {
|
|
16
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !$e(e);
|
|
17
|
+
}
|
|
18
|
+
const bt = /* @__PURE__ */ je({
|
|
12
19
|
name: "TableQuery",
|
|
13
20
|
inheritAttrs: !1,
|
|
14
21
|
props: {
|
|
@@ -30,6 +37,9 @@ const _e = /* @__PURE__ */ ve({
|
|
|
30
37
|
type: String,
|
|
31
38
|
default: "QueryFilter"
|
|
32
39
|
},
|
|
40
|
+
formMode: String,
|
|
41
|
+
queryLayout: String,
|
|
42
|
+
formProps: Object,
|
|
33
43
|
layout: String,
|
|
34
44
|
span: [Number, Object],
|
|
35
45
|
defaultColsNumber: Number,
|
|
@@ -87,286 +97,447 @@ const _e = /* @__PURE__ */ ve({
|
|
|
87
97
|
},
|
|
88
98
|
slots: Object,
|
|
89
99
|
setup(e, {
|
|
90
|
-
attrs:
|
|
91
|
-
slots:
|
|
92
|
-
emit:
|
|
93
|
-
expose:
|
|
100
|
+
attrs: oe,
|
|
101
|
+
slots: h,
|
|
102
|
+
emit: Z,
|
|
103
|
+
expose: qe
|
|
94
104
|
}) {
|
|
95
|
-
const
|
|
96
|
-
slots:
|
|
97
|
-
} =
|
|
98
|
-
...
|
|
105
|
+
const ie = Ae(Me, null), {
|
|
106
|
+
slots: v
|
|
107
|
+
} = De("query", d(() => Ge(ie?.themePreset)), e), T = d(() => ({
|
|
108
|
+
...ie?.locale === "en-US" ? Ue : He,
|
|
99
109
|
...e.locale
|
|
100
|
-
})),
|
|
101
|
-
|
|
102
|
-
|
|
110
|
+
})), Fe = Le(), R = W(null), pe = Je(R), X = Ie(null), m = d(() => e.formMode !== "builtin" && e.rootTag === "form" && e.layoutType === "QueryFilter" ? e.controls[ze] : void 0), q = d(() => !!m.value && e.queryLayout !== "grid"), x = d(() => e.disabled || !!m.value && !!e.formProps?.disabled), Ce = d(() => {
|
|
111
|
+
const t = m.value;
|
|
112
|
+
if (t?.kind === "element-plus") {
|
|
113
|
+
if (e.formProps?.labelPosition === "top") return "vertical";
|
|
114
|
+
if (e.formProps?.inline === !0) return "inline";
|
|
115
|
+
}
|
|
116
|
+
const n = t?.kind === "antdv" ? e.formProps?.layout : void 0;
|
|
117
|
+
return n === "inline" || n === "horizontal" || n === "vertical" ? n : e.layout ?? (q.value ? "inline" : p.value.layout);
|
|
118
|
+
}), se = W(null), ee = Ze(se), I = W(!1), j = W();
|
|
119
|
+
let D, P = 0, N = !1, M, A, V, L;
|
|
120
|
+
const O = d(() => e.fields ? [...e.fields].sort((t, n) => (n.order ?? 0) - (t.order ?? 0)) : et(e.columns ?? [])), y = d(() => e.query.draft.value), G = (t, n = y.value) => ({
|
|
103
121
|
field: t,
|
|
104
|
-
values:
|
|
105
|
-
}),
|
|
106
|
-
|
|
122
|
+
values: n
|
|
123
|
+
}), de = (t) => typeof t.hidden == "function" ? t.hidden(G(t)) : !!t.hidden, w = d(() => O.value.filter((t) => !de(t))), Te = d(() => e.submitter || void 0), U = d(() => !!h.actions || e.optionRender !== !1 && e.submitter !== !1), te = W(e.defaultCollapsed), F = d(() => e.collapsed ?? (U.value && (te.value ?? e.query.collapsed.value)));
|
|
124
|
+
Xe(R, d(() => e.layoutType === "QueryFilter" ? F.value : void 0));
|
|
125
|
+
const p = d(() => Ke(w.value, {
|
|
126
|
+
width: pe.value,
|
|
107
127
|
layout: e.layout,
|
|
108
128
|
span: e.span,
|
|
109
129
|
defaultColsNumber: e.defaultColsNumber,
|
|
110
130
|
defaultFormItemsNumber: e.defaultFormItemsNumber,
|
|
111
|
-
collapsed:
|
|
131
|
+
collapsed: F.value,
|
|
112
132
|
submitterColSpanProps: e.submitterColSpanProps,
|
|
113
|
-
showActions:
|
|
114
|
-
})),
|
|
115
|
-
|
|
133
|
+
showActions: U.value
|
|
134
|
+
})), E = d(() => q.value ? F.value && ee.value?.canCollapse ? w.value.slice(0, ee.value.collapsedCount) : w.value : p.value.fields.map(({
|
|
135
|
+
field: t
|
|
136
|
+
}) => t)), Pe = d(() => q.value ? !!ee.value?.canCollapse : p.value.canCollapse), ce = d(() => w.value.length - E.value.length), fe = d(() => {
|
|
137
|
+
const [t, n] = Array.isArray(e.searchGutter) ? e.searchGutter : [e.searchGutter, void 0];
|
|
116
138
|
return {
|
|
117
139
|
"--vtg-query-label-width": typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth,
|
|
118
140
|
"--vtg-query-column-gap": t === void 0 ? void 0 : `${t}px`,
|
|
119
|
-
"--vtg-query-row-gap":
|
|
141
|
+
"--vtg-query-row-gap": n === void 0 ? void 0 : `${n}px`
|
|
120
142
|
};
|
|
121
|
-
}),
|
|
122
|
-
function
|
|
123
|
-
const t = !
|
|
124
|
-
e.collapsed === void 0 && (
|
|
143
|
+
}), H = d(() => x.value || I.value || e.query.submitting.value);
|
|
144
|
+
function ne() {
|
|
145
|
+
const t = !F.value;
|
|
146
|
+
e.collapsed === void 0 && (te.value === void 0 ? e.query.toggleCollapsed() : te.value = t), e.onCollapse?.(t), Z("update:collapsed", t);
|
|
125
147
|
}
|
|
126
|
-
|
|
148
|
+
Ee(() => [e.layoutType, x.value, e.query, m.value], Q, {
|
|
127
149
|
flush: "sync"
|
|
128
150
|
});
|
|
129
|
-
function
|
|
130
|
-
|
|
151
|
+
function Q() {
|
|
152
|
+
P++, D?.abort(), L?.(), L = void 0, V?.(!1), V = void 0, D = void 0, I.value = !1, M = void 0, A = void 0;
|
|
131
153
|
}
|
|
132
|
-
function
|
|
154
|
+
function we() {
|
|
133
155
|
if (e.preserve) return;
|
|
134
|
-
const t = new Set(e.layoutType === "LightFilter" ?
|
|
135
|
-
field: l
|
|
136
|
-
}) => l));
|
|
156
|
+
const t = new Set(e.layoutType === "LightFilter" ? w.value : E.value);
|
|
137
157
|
return {
|
|
138
|
-
omitFields:
|
|
139
|
-
name:
|
|
140
|
-
}) =>
|
|
158
|
+
omitFields: O.value.filter((n) => !t.has(n)).map(({
|
|
159
|
+
name: n
|
|
160
|
+
}) => n)
|
|
141
161
|
};
|
|
142
162
|
}
|
|
143
|
-
function
|
|
144
|
-
|
|
145
|
-
if (
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
163
|
+
async function Se(t) {
|
|
164
|
+
const n = m.value, a = X.value;
|
|
165
|
+
if (!n || !a) return !0;
|
|
166
|
+
if (t === "reset")
|
|
167
|
+
return a.clearValidate?.(), !0;
|
|
168
|
+
const u = (e.preserve ? w.value : E.value).map(({
|
|
169
|
+
name: r
|
|
170
|
+
}) => r);
|
|
171
|
+
if (!u.length) return !0;
|
|
172
|
+
try {
|
|
173
|
+
return await (n.kind === "antdv" ? a.validateFields?.(u) : a.validateField?.(u)) !== !1;
|
|
174
|
+
} catch {
|
|
175
|
+
return !1;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function B(t, n) {
|
|
179
|
+
if (N || x.value) return Promise.resolve(!1);
|
|
180
|
+
if (A && M === t) return A;
|
|
181
|
+
Q();
|
|
182
|
+
const a = P, u = new AbortController();
|
|
183
|
+
D = u, M = t, j.value = void 0;
|
|
184
|
+
const r = e.query.draft, c = r.value;
|
|
185
|
+
t === "reset" ? (X.value?.resetFields?.(), e.query.resetFields()) : n && (r.value = {
|
|
186
|
+
...y.value,
|
|
187
|
+
...ue(n)
|
|
153
188
|
});
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
189
|
+
const l = ue(y.value);
|
|
190
|
+
n && (L = () => {
|
|
191
|
+
re(l, r.value) && (r.value = c);
|
|
157
192
|
});
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
let
|
|
161
|
-
return
|
|
162
|
-
|
|
163
|
-
}),
|
|
164
|
-
let
|
|
193
|
+
const o = we();
|
|
194
|
+
I.value = !0;
|
|
195
|
+
let b;
|
|
196
|
+
return A = new Promise((f) => {
|
|
197
|
+
b = f;
|
|
198
|
+
}), V = b, (async () => {
|
|
199
|
+
let f = !1;
|
|
165
200
|
try {
|
|
166
|
-
if ((t === "reset" ||
|
|
167
|
-
const
|
|
168
|
-
fields:
|
|
201
|
+
if ((t === "reset" || n) && await We(), N || a !== P || u.signal.aborted || m.value && !await Se(t) || N || a !== P || u.signal.aborted) return !1;
|
|
202
|
+
const s = await e.validate?.(l, {
|
|
203
|
+
fields: w.value,
|
|
169
204
|
action: t,
|
|
170
|
-
signal:
|
|
205
|
+
signal: u.signal
|
|
171
206
|
});
|
|
172
|
-
return
|
|
173
|
-
} catch (
|
|
174
|
-
return !
|
|
207
|
+
return N || a !== P || u.signal.aborted ? !1 : s === !1 ? (j.value = T.value.validationFailed, !1) : !re(l, y.value) || (L = void 0, I.value = !1, f = await (t === "reset" ? e.query.reset(o) : e.query.submit(o)), N || a !== P) ? !1 : (Z(t === "reset" ? "reset" : "submitted", f), f);
|
|
208
|
+
} catch (s) {
|
|
209
|
+
return !N && a === P && (j.value = s instanceof Error ? s.message : String(s)), !1;
|
|
175
210
|
} finally {
|
|
176
|
-
|
|
211
|
+
a === P && (L?.(), L = void 0, I.value = !1, M = void 0, D = void 0, A = void 0, V = void 0);
|
|
177
212
|
}
|
|
178
|
-
})().then(
|
|
213
|
+
})().then(b), A;
|
|
179
214
|
}
|
|
180
|
-
function
|
|
181
|
-
const
|
|
182
|
-
return !
|
|
215
|
+
function Re(t) {
|
|
216
|
+
const n = G(t), a = typeof t.disabled == "function" ? t.disabled(n) : t.disabled, u = typeof t.readonly == "function" ? t.readonly(n) : t.readonly;
|
|
217
|
+
return !x.value && !e.query.submitting.value && !de(t) && !a && !u;
|
|
183
218
|
}
|
|
184
|
-
function
|
|
185
|
-
const
|
|
186
|
-
if (!
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
...
|
|
191
|
-
[t]:
|
|
219
|
+
function ve(t, n) {
|
|
220
|
+
const a = O.value.find((r) => r.name === t);
|
|
221
|
+
if (!a || !Re(a) || re(y.value[t], n)) return;
|
|
222
|
+
Q(), j.value = void 0;
|
|
223
|
+
const u = e.query.draft;
|
|
224
|
+
u.value = {
|
|
225
|
+
...y.value,
|
|
226
|
+
[t]: ue(n)
|
|
192
227
|
};
|
|
193
228
|
}
|
|
194
|
-
function
|
|
195
|
-
if (
|
|
196
|
-
const
|
|
197
|
-
name:
|
|
198
|
-
}) => [
|
|
199
|
-
return Object.keys(
|
|
229
|
+
function xe(t) {
|
|
230
|
+
if (H.value) return Promise.resolve(!1);
|
|
231
|
+
const n = Object.fromEntries(O.value.filter((a) => Object.hasOwn(t, a.name)).map(({
|
|
232
|
+
name: a
|
|
233
|
+
}) => [a, t[a]]));
|
|
234
|
+
return Object.keys(n).length ? B("submit", n) : Promise.resolve(!0);
|
|
200
235
|
}
|
|
201
|
-
|
|
202
|
-
|
|
236
|
+
Qe(() => {
|
|
237
|
+
N = !0, Q();
|
|
203
238
|
});
|
|
204
|
-
const
|
|
205
|
-
submit: () =>
|
|
206
|
-
reset: () =>
|
|
207
|
-
cancel:
|
|
239
|
+
const ye = {
|
|
240
|
+
submit: () => B("submit"),
|
|
241
|
+
reset: () => B("reset"),
|
|
242
|
+
cancel: Q
|
|
208
243
|
};
|
|
209
|
-
|
|
210
|
-
function
|
|
211
|
-
const
|
|
212
|
-
for (const
|
|
213
|
-
if (!t.dictionary || !["string", "number", "boolean"].includes(typeof
|
|
214
|
-
const
|
|
215
|
-
typeof
|
|
216
|
-
value:
|
|
217
|
-
label:
|
|
218
|
-
...typeof
|
|
219
|
-
status:
|
|
244
|
+
qe(ye);
|
|
245
|
+
function ae(t, n, a) {
|
|
246
|
+
const u = G(t, n), r = e.errors?.[t.name] ?? $(t.dictionary?.error)?.message, c = [...$(t.options) ?? $(t.dictionary?.options) ?? []], l = n[t.name];
|
|
247
|
+
for (const S of Array.isArray(l) ? l : [l]) {
|
|
248
|
+
if (!t.dictionary || !["string", "number", "boolean"].includes(typeof S) || c.some((Y) => Object.is(Y.value, S))) continue;
|
|
249
|
+
const z = S, g = $(t.dictionary.valueEnum).get(z), C = typeof g == "string" ? g : g?.text;
|
|
250
|
+
typeof C == "string" && c.push({
|
|
251
|
+
value: z,
|
|
252
|
+
label: C,
|
|
253
|
+
...typeof g == "object" ? {
|
|
254
|
+
status: g.status
|
|
220
255
|
} : {}
|
|
221
256
|
});
|
|
222
257
|
}
|
|
223
|
-
const
|
|
224
|
-
value:
|
|
225
|
-
onChange:
|
|
226
|
-
fieldProps: typeof t.fieldProps == "function" ? t.fieldProps(
|
|
227
|
-
options:
|
|
228
|
-
disabled:
|
|
229
|
-
readonly:
|
|
230
|
-
loading:
|
|
231
|
-
error:
|
|
232
|
-
id: `${
|
|
258
|
+
const o = typeof t.readonly == "function" ? t.readonly(u) : !!t.readonly, b = x.value || e.query.submitting.value || (typeof t.disabled == "function" ? t.disabled(u) : !!t.disabled), f = {
|
|
259
|
+
value: l,
|
|
260
|
+
onChange: a,
|
|
261
|
+
fieldProps: typeof t.fieldProps == "function" ? t.fieldProps(u) : t.fieldProps ?? {},
|
|
262
|
+
options: c,
|
|
263
|
+
disabled: b,
|
|
264
|
+
readonly: o,
|
|
265
|
+
loading: $(t.dictionary?.loading) ?? !1,
|
|
266
|
+
error: r,
|
|
267
|
+
id: `${Fe}-${t.name}`,
|
|
233
268
|
name: t.name,
|
|
234
269
|
mode: "query",
|
|
235
|
-
onSearch: t.dictionary ? (
|
|
236
|
-
t.dictionary.search(
|
|
270
|
+
onSearch: t.dictionary ? (S) => {
|
|
271
|
+
t.dictionary.search(S);
|
|
237
272
|
} : void 0
|
|
238
|
-
},
|
|
273
|
+
}, s = t.valueType ?? "text", k = Object.hasOwn(e.controls, s) ? e.controls[s] : void 0;
|
|
239
274
|
return {
|
|
240
|
-
control:
|
|
241
|
-
renderer:
|
|
242
|
-
valueType:
|
|
275
|
+
control: f,
|
|
276
|
+
renderer: k ?? e.controls.text,
|
|
277
|
+
valueType: k ? s : "text"
|
|
243
278
|
};
|
|
244
279
|
}
|
|
245
|
-
function
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
submitting: B.value,
|
|
249
|
-
collapsed: w.value,
|
|
250
|
-
toggleCollapsed: K,
|
|
251
|
-
showCollapseButton: t
|
|
280
|
+
function me(t, n, a, u, r) {
|
|
281
|
+
const c = m.value, l = (o) => {
|
|
282
|
+
o.defaultPrevented || (o.preventDefault(), B(r));
|
|
252
283
|
};
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
})), {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
284
|
+
return _(c?.Button ?? he, K({
|
|
285
|
+
key: t,
|
|
286
|
+
type: a
|
|
287
|
+
}, u, {
|
|
288
|
+
[c?.Button && c.kind === "element-plus" ? "nativeType" : "htmlType"]: r === "submit" && e.rootTag === "form" ? "submit" : "button",
|
|
289
|
+
disabled: H.value || !!u.disabled,
|
|
290
|
+
onClick: l
|
|
291
|
+
}), {
|
|
292
|
+
default: () => n
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
function le() {
|
|
296
|
+
let t;
|
|
297
|
+
const n = Pe.value && e.collapseRender !== !1, a = {
|
|
298
|
+
...ye,
|
|
299
|
+
submitting: H.value,
|
|
300
|
+
collapsed: F.value,
|
|
301
|
+
toggleCollapsed: ne,
|
|
302
|
+
showCollapseButton: n
|
|
303
|
+
};
|
|
304
|
+
if (h.actions) return h.actions(a);
|
|
305
|
+
const u = Te.value, {
|
|
306
|
+
resetButtonProps: r,
|
|
307
|
+
submitButtonProps: c
|
|
308
|
+
} = u ?? {}, l = [r !== !1 && me("reset", u?.searchConfig?.resetText ?? e.resetText ?? T.value.reset, "default", r ?? {}, "reset"), c !== !1 && me("submit", u?.searchConfig?.submitText ?? e.searchText ?? T.value.submit, "primary", c ?? {}, "submit")].filter(Boolean), o = u?.render ?? e.optionRender, b = o === !1 ? null : typeof o == "function" ? o(a, l) : l, f = (s, k) => typeof e.collapseRender == "function" ? e.collapseRender(s) : s ? `${T.value.expand}${e.showHiddenNum ? ` (${k})` : ""}` : T.value.collapse;
|
|
309
|
+
if (m.value) {
|
|
310
|
+
const s = q.value && e.collapseRender !== !1;
|
|
311
|
+
return i("div", {
|
|
312
|
+
class: v.actions(),
|
|
313
|
+
"data-query-inline-action-content": q.value ? "" : void 0
|
|
314
|
+
}, [i("div", {
|
|
315
|
+
"data-query-inline-buttons": q.value ? "" : void 0,
|
|
316
|
+
"data-query-native-buttons": ""
|
|
317
|
+
}, [b]), n || s ? i("button", {
|
|
318
|
+
type: "button",
|
|
319
|
+
disabled: x.value,
|
|
320
|
+
class: v.collapse(),
|
|
321
|
+
onClick: ne,
|
|
322
|
+
"aria-expanded": !F.value,
|
|
323
|
+
"aria-hidden": !n || void 0,
|
|
324
|
+
tabindex: n ? void 0 : -1,
|
|
325
|
+
"data-query-native-toggle": "",
|
|
326
|
+
"data-query-inline-toggle": q.value ? "" : void 0,
|
|
327
|
+
"data-query-inline-folded": n ? void 0 : ""
|
|
328
|
+
}, [f(F.value, ce.value), typeof e.collapseRender != "function" ? i(Ve, {
|
|
329
|
+
"aria-hidden": "true"
|
|
330
|
+
}, null) : null]) : null]);
|
|
331
|
+
}
|
|
332
|
+
return i(_e, null, [b, n ? i(he, {
|
|
281
333
|
type: "link",
|
|
282
334
|
htmlType: "button",
|
|
283
|
-
disabled:
|
|
284
|
-
class:
|
|
285
|
-
onClick:
|
|
286
|
-
"aria-expanded": !
|
|
287
|
-
}, {
|
|
288
|
-
default: () => [
|
|
335
|
+
disabled: x.value,
|
|
336
|
+
class: v.collapse(),
|
|
337
|
+
onClick: ne,
|
|
338
|
+
"aria-expanded": !F.value
|
|
339
|
+
}, tt(t = f(F.value, ce.value)) ? t : {
|
|
340
|
+
default: () => [t]
|
|
289
341
|
}) : null]);
|
|
290
342
|
}
|
|
291
|
-
function
|
|
292
|
-
const t = new Map(
|
|
293
|
-
|
|
294
|
-
}) =>
|
|
295
|
-
|
|
296
|
-
|
|
343
|
+
function Ne() {
|
|
344
|
+
const t = m.value, n = q.value, a = new Map(p.value.fields.map((l) => [l.field.name, l])), u = new Set(E.value.map(({
|
|
345
|
+
name: l
|
|
346
|
+
}) => l)), r = new Set(w.value.map(({
|
|
347
|
+
name: l
|
|
348
|
+
}) => l)), c = n || e.preserve ? O.value : E.value;
|
|
349
|
+
return i("div", {
|
|
350
|
+
ref: n ? se : void 0,
|
|
351
|
+
class: v.fields(),
|
|
352
|
+
"data-query-inline": n ? "" : void 0,
|
|
353
|
+
"data-query-grid": n ? void 0 : "",
|
|
354
|
+
style: fe.value
|
|
355
|
+
}, [c.map((l) => {
|
|
356
|
+
const {
|
|
357
|
+
control: o,
|
|
358
|
+
renderer: b
|
|
359
|
+
} = ae(l, y.value, (J) => {
|
|
360
|
+
ve(l.name, J);
|
|
361
|
+
}), f = u.has(l.name), s = n && r.has(l.name) && !f, k = a.get(l.name), S = typeof l.formItemProps == "function" ? l.formItemProps(G(l)) : l.formItemProps ?? {}, z = e.preserve || f, g = S.label ?? l.label ?? l.name, C = t.kind === "antdv", Y = {
|
|
362
|
+
key: l.name,
|
|
363
|
+
hidden: !f && !s,
|
|
364
|
+
inert: s || void 0,
|
|
365
|
+
"aria-hidden": s || void 0,
|
|
366
|
+
"data-query-field": l.name,
|
|
367
|
+
"data-query-inline-field": n && r.has(l.name) ? l.name : void 0,
|
|
368
|
+
"data-query-inline-folded": s ? "" : void 0
|
|
369
|
+
}, ge = _(t.FormItem, {
|
|
370
|
+
...S,
|
|
371
|
+
label: typeof g == "string" ? g : void 0,
|
|
372
|
+
[C ? "name" : "prop"]: z ? l.name : void 0,
|
|
373
|
+
[C ? "htmlFor" : "for"]: o.id,
|
|
374
|
+
...o.error && C ? {
|
|
375
|
+
validateStatus: "error",
|
|
376
|
+
help: o.error
|
|
377
|
+
} : {},
|
|
378
|
+
...o.error && !C ? {
|
|
379
|
+
error: o.error
|
|
380
|
+
} : {},
|
|
381
|
+
...n && !C ? Y : {}
|
|
382
|
+
}, {
|
|
383
|
+
...typeof g == "string" ? {} : {
|
|
384
|
+
label: () => g
|
|
385
|
+
},
|
|
386
|
+
default: () => {
|
|
387
|
+
const J = h.field ? h.field({
|
|
388
|
+
field: l,
|
|
389
|
+
values: y.value,
|
|
390
|
+
control: o,
|
|
391
|
+
layoutType: "QueryFilter"
|
|
392
|
+
}) : b?.(o);
|
|
393
|
+
return n ? J : i("div", {
|
|
394
|
+
"data-query-control-content": ""
|
|
395
|
+
}, [J]);
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
return n && !C ? ge : i("div", K(Y, {
|
|
399
|
+
style: n ? void 0 : k?.style,
|
|
400
|
+
"data-query-split": !n && e.split && k?.endsRow ? "" : void 0
|
|
401
|
+
}), [ge]);
|
|
402
|
+
}), U.value ? n && t.kind === "element-plus" ? _(t.FormItem, {
|
|
403
|
+
"data-query-actions": "",
|
|
404
|
+
"data-query-inline-actions": ""
|
|
405
|
+
}, {
|
|
406
|
+
default: le
|
|
407
|
+
}) : i("div", {
|
|
408
|
+
class: n ? void 0 : e.submitterColSpanProps?.class,
|
|
409
|
+
style: n ? void 0 : [p.value.actionStyle, e.submitterColSpanProps?.style],
|
|
410
|
+
"data-query-actions": "",
|
|
411
|
+
"data-query-inline-actions": n ? "" : void 0
|
|
412
|
+
}, [_(t.FormItem, null, {
|
|
413
|
+
default: le
|
|
414
|
+
})]) : null]);
|
|
415
|
+
}
|
|
416
|
+
function Oe(t) {
|
|
417
|
+
!(t.target instanceof HTMLFormElement) || t.target.parentElement !== R.value || (t.preventDefault(), t.stopPropagation(), B("submit"));
|
|
418
|
+
}
|
|
419
|
+
function Be(t) {
|
|
420
|
+
!(t.target instanceof HTMLFormElement) || t.target.parentElement !== R.value || (t.preventDefault(), t.stopPropagation(), B("reset"));
|
|
421
|
+
}
|
|
422
|
+
const be = () => j.value || e.query.error.value ? i("div", {
|
|
423
|
+
class: v.feedback(),
|
|
424
|
+
role: "alert"
|
|
425
|
+
}, [j.value ?? e.query.error.value?.message]) : null;
|
|
426
|
+
function ke() {
|
|
427
|
+
const t = new Map(p.value.fields.map((a) => [a.field.name, a])), n = e.preserve ? O.value : p.value.fields.map(({
|
|
428
|
+
field: a
|
|
429
|
+
}) => a);
|
|
430
|
+
return i("div", {
|
|
431
|
+
class: v.fields(),
|
|
297
432
|
"data-query-grid": "",
|
|
298
|
-
style:
|
|
299
|
-
}, [
|
|
300
|
-
const
|
|
301
|
-
control:
|
|
302
|
-
renderer:
|
|
303
|
-
valueType:
|
|
304
|
-
} =
|
|
305
|
-
|
|
433
|
+
style: fe.value
|
|
434
|
+
}, [n.map((a) => {
|
|
435
|
+
const u = t.get(a.name), {
|
|
436
|
+
control: r,
|
|
437
|
+
renderer: c,
|
|
438
|
+
valueType: l
|
|
439
|
+
} = ae(a, y.value, (o) => {
|
|
440
|
+
ve(a.name, o);
|
|
306
441
|
});
|
|
307
|
-
return
|
|
308
|
-
key:
|
|
309
|
-
class:
|
|
310
|
-
style:
|
|
311
|
-
hidden: !
|
|
312
|
-
"data-query-field":
|
|
313
|
-
"data-query-split": e.split &&
|
|
314
|
-
}, [
|
|
315
|
-
class:
|
|
316
|
-
for:
|
|
317
|
-
}, [
|
|
318
|
-
class:
|
|
319
|
-
"data-query-value-type":
|
|
320
|
-
}, [
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
442
|
+
return i("div", {
|
|
443
|
+
key: a.name,
|
|
444
|
+
class: v.field(),
|
|
445
|
+
style: u?.style,
|
|
446
|
+
hidden: !u,
|
|
447
|
+
"data-query-field": a.name,
|
|
448
|
+
"data-query-split": e.split && u?.endsRow ? "" : void 0
|
|
449
|
+
}, [i("label", {
|
|
450
|
+
class: v.label(),
|
|
451
|
+
for: r.id
|
|
452
|
+
}, [a.label ?? a.name]), i("div", {
|
|
453
|
+
class: v.control(),
|
|
454
|
+
"data-query-value-type": l
|
|
455
|
+
}, [i("div", {
|
|
456
|
+
"data-query-control-content": ""
|
|
457
|
+
}, [h.field ? h.field({
|
|
458
|
+
field: a,
|
|
459
|
+
values: y.value,
|
|
460
|
+
control: r,
|
|
324
461
|
layoutType: "QueryFilter"
|
|
325
|
-
}) :
|
|
326
|
-
class:
|
|
462
|
+
}) : c?.(r)]), r.error ? i("div", {
|
|
463
|
+
class: v.error(),
|
|
327
464
|
role: "alert",
|
|
328
|
-
id: `${
|
|
329
|
-
}, [
|
|
330
|
-
}),
|
|
331
|
-
class: [
|
|
332
|
-
style: [
|
|
465
|
+
id: `${r.id}-error`
|
|
466
|
+
}, [r.error]) : null])]);
|
|
467
|
+
}), U.value ? i("div", {
|
|
468
|
+
class: [v.actions(), e.submitterColSpanProps?.class],
|
|
469
|
+
style: [p.value.actionStyle, e.submitterColSpanProps?.style],
|
|
333
470
|
"data-query-actions": ""
|
|
334
|
-
}, [
|
|
471
|
+
}, [le()]) : null]);
|
|
335
472
|
}
|
|
336
473
|
return () => {
|
|
337
|
-
const t = e.rootTag,
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
474
|
+
const t = e.rootTag, n = e.layoutType === "LightFilter", a = m.value;
|
|
475
|
+
if (a) {
|
|
476
|
+
const u = a.kind === "antdv", r = Ce.value, c = r === "vertical" ? "top" : "right";
|
|
477
|
+
return i("div", K(oe, {
|
|
478
|
+
ref: R,
|
|
479
|
+
class: v.root(),
|
|
480
|
+
"data-query-form-mode": "native",
|
|
481
|
+
"data-query-form-preset": a.kind,
|
|
482
|
+
"data-query-layout-type": e.layoutType,
|
|
483
|
+
"data-query-layout": r
|
|
484
|
+
}, {
|
|
485
|
+
onSubmitCapture: Oe,
|
|
486
|
+
onResetCapture: Be
|
|
487
|
+
}), [_(a.Form, {
|
|
488
|
+
...u ? {
|
|
489
|
+
layout: r
|
|
490
|
+
} : {
|
|
491
|
+
inline: q.value,
|
|
492
|
+
labelPosition: c
|
|
493
|
+
},
|
|
494
|
+
...e.labelWidth === void 0 ? {} : u ? {
|
|
495
|
+
labelCol: {
|
|
496
|
+
style: {
|
|
497
|
+
width: typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
} : {
|
|
501
|
+
labelWidth: e.labelWidth
|
|
502
|
+
},
|
|
503
|
+
...e.formProps,
|
|
504
|
+
ref: X,
|
|
505
|
+
"aria-label": T.value.label,
|
|
506
|
+
model: y.value,
|
|
507
|
+
disabled: e.disabled || !!e.formProps?.disabled
|
|
508
|
+
}, {
|
|
509
|
+
default: Ne
|
|
510
|
+
}), be()]);
|
|
511
|
+
}
|
|
512
|
+
return i(t, K(oe, {
|
|
513
|
+
ref: R,
|
|
514
|
+
class: v.root(),
|
|
341
515
|
"data-query-layout-type": e.layoutType,
|
|
342
|
-
"data-query-layout":
|
|
343
|
-
"aria-label":
|
|
344
|
-
onSubmit: (
|
|
345
|
-
|
|
516
|
+
"data-query-layout": n ? void 0 : p.value.layout,
|
|
517
|
+
"aria-label": T.value.label,
|
|
518
|
+
onSubmit: (u) => {
|
|
519
|
+
u.target === R.value && (u.preventDefault(), n || B("submit"));
|
|
346
520
|
}
|
|
347
521
|
}), {
|
|
348
|
-
default: () => [
|
|
349
|
-
fields:
|
|
350
|
-
values:
|
|
522
|
+
default: () => [n ? i(Ye, {
|
|
523
|
+
fields: O.value,
|
|
524
|
+
values: y.value,
|
|
351
525
|
disabled: e.disabled,
|
|
352
|
-
submitting:
|
|
526
|
+
submitting: H.value,
|
|
353
527
|
collapse: e.collapse,
|
|
354
528
|
collapseLabel: e.collapseLabel,
|
|
355
529
|
footerRender: e.footerRender,
|
|
356
530
|
getPopupContainer: e.getPopupContainer,
|
|
357
|
-
locale:
|
|
358
|
-
resolveField:
|
|
359
|
-
submitValues:
|
|
360
|
-
},
|
|
361
|
-
field:
|
|
362
|
-
} : void 0) :
|
|
363
|
-
class: c.feedback(),
|
|
364
|
-
role: "alert"
|
|
365
|
-
}, [q.value ?? e.query.error.value?.message]) : null]
|
|
531
|
+
locale: T.value,
|
|
532
|
+
resolveField: ae,
|
|
533
|
+
submitValues: xe
|
|
534
|
+
}, h.field ? {
|
|
535
|
+
field: h.field
|
|
536
|
+
} : void 0) : ke(), be()]
|
|
366
537
|
});
|
|
367
538
|
};
|
|
368
539
|
}
|
|
369
540
|
});
|
|
370
541
|
export {
|
|
371
|
-
|
|
542
|
+
bt as default
|
|
372
543
|
};
|