@vtable-guild/vtable-guild 2.9.0-alpha.8 → 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 +296 -9
- package/css/presets/antdv.css +3 -0
- package/css/presets/element-plus.css +3 -0
- package/css/style.css +544 -43
- package/css/tailwind3-utilities.css +189 -32
- package/css/tailwind3.css +355 -11
- package/css/tailwind4.css +355 -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 +296 -9
- package/dist/css/presets/antdv.css +3 -0
- package/dist/css/presets/element-plus.css +3 -0
- package/dist/css/style.css +544 -43
- package/dist/css/tailwind3-utilities.css +189 -32
- package/dist/css/tailwind3.css +355 -11
- package/dist/css/tailwind4.css +355 -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/ElFilterIcon.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 +9349 -7117
- 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 +76 -0
- package/dist/table/src/components/TableLightFilter.d.ts.map +1 -0
- package/dist/table/src/components/TableLightFilter.mjs +320 -0
- package/dist/table/src/components/TableLightFilter.test.d.ts +2 -0
- package/dist/table/src/components/TableLightFilter.test.d.ts.map +1 -0
- package/dist/table/src/components/TableQuery.d.ts +107 -46
- package/dist/table/src/components/TableQuery.d.ts.map +1 -1
- package/dist/table/src/components/TableQuery.mjs +481 -184
- 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.d.ts +4 -3
- package/dist/table/src/components/VTableQuery.vue.d.ts.map +1 -1
- package/dist/table/src/components/VTableQuery.vue.mjs +53 -31
- 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 +198 -79
- 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 +61 -3
- 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 +76 -15
- 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/queryFields.mjs +11 -11
- package/dist/table/src/utils/queryFilterLayout.d.ts +29 -0
- package/dist/table/src/utils/queryFilterLayout.d.ts.map +1 -0
- package/dist/table/src/utils/queryFilterLayout.mjs +74 -0
- package/dist/table/src/utils/queryFilterLayout.test.d.ts +2 -0
- package/dist/table/src/utils/queryFilterLayout.test.d.ts.map +1 -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 +34 -57
- package/dist/theme/src/query.d.ts.map +1 -1
- package/dist/theme/src/query.mjs +23 -24
- 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,11 +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
|
-
|
|
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({
|
|
9
19
|
name: "TableQuery",
|
|
10
20
|
inheritAttrs: !1,
|
|
11
21
|
props: {
|
|
@@ -17,35 +27,62 @@ const Se = /* @__PURE__ */ ae({
|
|
|
17
27
|
type: String,
|
|
18
28
|
default: "form"
|
|
19
29
|
},
|
|
20
|
-
fields:
|
|
21
|
-
|
|
22
|
-
required: !0
|
|
23
|
-
},
|
|
30
|
+
fields: Array,
|
|
31
|
+
columns: Array,
|
|
24
32
|
controls: {
|
|
25
33
|
type: Object,
|
|
26
34
|
required: !0
|
|
27
35
|
},
|
|
28
|
-
|
|
36
|
+
layoutType: {
|
|
29
37
|
type: String,
|
|
30
|
-
default: "
|
|
38
|
+
default: "QueryFilter"
|
|
31
39
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
formMode: String,
|
|
41
|
+
queryLayout: String,
|
|
42
|
+
formProps: Object,
|
|
43
|
+
layout: String,
|
|
44
|
+
span: [Number, Object],
|
|
45
|
+
defaultColsNumber: Number,
|
|
46
|
+
defaultFormItemsNumber: Number,
|
|
47
|
+
defaultCollapsed: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: void 0
|
|
36
50
|
},
|
|
37
|
-
|
|
38
|
-
type:
|
|
39
|
-
default:
|
|
51
|
+
collapsed: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: void 0
|
|
54
|
+
},
|
|
55
|
+
onCollapse: Function,
|
|
56
|
+
collapseRender: {
|
|
57
|
+
type: [Boolean, Function],
|
|
58
|
+
default: void 0
|
|
40
59
|
},
|
|
41
|
-
|
|
42
|
-
type:
|
|
43
|
-
default:
|
|
60
|
+
optionRender: {
|
|
61
|
+
type: [Boolean, Function],
|
|
62
|
+
default: void 0
|
|
44
63
|
},
|
|
45
|
-
|
|
64
|
+
searchText: String,
|
|
65
|
+
resetText: String,
|
|
66
|
+
labelWidth: [Number, String],
|
|
67
|
+
searchGutter: [Number, Array],
|
|
68
|
+
split: Boolean,
|
|
69
|
+
preserve: {
|
|
46
70
|
type: Boolean,
|
|
47
71
|
default: !0
|
|
48
72
|
},
|
|
73
|
+
showHiddenNum: Boolean,
|
|
74
|
+
submitter: {
|
|
75
|
+
type: [Boolean, Object],
|
|
76
|
+
default: void 0
|
|
77
|
+
},
|
|
78
|
+
submitterColSpanProps: Object,
|
|
79
|
+
collapse: Boolean,
|
|
80
|
+
collapseLabel: null,
|
|
81
|
+
footerRender: {
|
|
82
|
+
type: [Boolean, Function],
|
|
83
|
+
default: void 0
|
|
84
|
+
},
|
|
85
|
+
getPopupContainer: Function,
|
|
49
86
|
disabled: Boolean,
|
|
50
87
|
validate: Function,
|
|
51
88
|
errors: Object,
|
|
@@ -55,192 +92,452 @@ const Se = /* @__PURE__ */ ae({
|
|
|
55
92
|
},
|
|
56
93
|
emits: {
|
|
57
94
|
submitted: (e) => !0,
|
|
58
|
-
reset: (e) => !0
|
|
95
|
+
reset: (e) => !0,
|
|
96
|
+
"update:collapsed": (e) => !0
|
|
59
97
|
},
|
|
60
98
|
slots: Object,
|
|
61
99
|
setup(e, {
|
|
62
|
-
attrs:
|
|
63
|
-
slots:
|
|
64
|
-
emit:
|
|
65
|
-
expose:
|
|
100
|
+
attrs: oe,
|
|
101
|
+
slots: h,
|
|
102
|
+
emit: Z,
|
|
103
|
+
expose: qe
|
|
66
104
|
}) {
|
|
67
|
-
const
|
|
68
|
-
slots:
|
|
69
|
-
} =
|
|
70
|
-
...
|
|
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,
|
|
71
109
|
...e.locale
|
|
72
|
-
})),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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) => ({
|
|
121
|
+
field: t,
|
|
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,
|
|
127
|
+
layout: e.layout,
|
|
128
|
+
span: e.span,
|
|
129
|
+
defaultColsNumber: e.defaultColsNumber,
|
|
130
|
+
defaultFormItemsNumber: e.defaultFormItemsNumber,
|
|
131
|
+
collapsed: F.value,
|
|
132
|
+
submitterColSpanProps: e.submitterColSpanProps,
|
|
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];
|
|
138
|
+
return {
|
|
139
|
+
"--vtg-query-label-width": typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth,
|
|
140
|
+
"--vtg-query-column-gap": t === void 0 ? void 0 : `${t}px`,
|
|
141
|
+
"--vtg-query-row-gap": n === void 0 ? void 0 : `${n}px`
|
|
142
|
+
};
|
|
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);
|
|
80
147
|
}
|
|
81
|
-
|
|
148
|
+
Ee(() => [e.layoutType, x.value, e.query, m.value], Q, {
|
|
82
149
|
flush: "sync"
|
|
83
150
|
});
|
|
84
|
-
function
|
|
85
|
-
|
|
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;
|
|
86
153
|
}
|
|
87
|
-
function
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
154
|
+
function we() {
|
|
155
|
+
if (e.preserve) return;
|
|
156
|
+
const t = new Set(e.layoutType === "LightFilter" ? w.value : E.value);
|
|
157
|
+
return {
|
|
158
|
+
omitFields: O.value.filter((n) => !t.has(n)).map(({
|
|
159
|
+
name: n
|
|
160
|
+
}) => n)
|
|
161
|
+
};
|
|
91
162
|
}
|
|
92
|
-
function
|
|
93
|
-
|
|
94
|
-
if (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
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)
|
|
188
|
+
});
|
|
189
|
+
const l = ue(y.value);
|
|
190
|
+
n && (L = () => {
|
|
191
|
+
re(l, r.value) && (r.value = c);
|
|
192
|
+
});
|
|
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;
|
|
105
200
|
try {
|
|
106
|
-
if (
|
|
107
|
-
const
|
|
108
|
-
fields:
|
|
109
|
-
action:
|
|
110
|
-
signal:
|
|
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,
|
|
204
|
+
action: t,
|
|
205
|
+
signal: u.signal
|
|
111
206
|
});
|
|
112
|
-
return
|
|
113
|
-
} catch (
|
|
114
|
-
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;
|
|
115
210
|
} finally {
|
|
116
|
-
|
|
211
|
+
a === P && (L?.(), L = void 0, I.value = !1, M = void 0, D = void 0, A = void 0, V = void 0);
|
|
117
212
|
}
|
|
118
|
-
})().then(
|
|
213
|
+
})().then(b), A;
|
|
214
|
+
}
|
|
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;
|
|
119
218
|
}
|
|
120
|
-
function
|
|
121
|
-
a =
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}, e.layout === "light" && e.autoSubmit && (S = setTimeout(() => {
|
|
130
|
-
S = void 0, !m && e.layout === "light" && e.autoSubmit && !e.disabled && h("submit");
|
|
131
|
-
}, Math.max(0, e.debounceTime)));
|
|
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)
|
|
227
|
+
};
|
|
132
228
|
}
|
|
133
|
-
|
|
134
|
-
|
|
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);
|
|
235
|
+
}
|
|
236
|
+
Qe(() => {
|
|
237
|
+
N = !0, Q();
|
|
135
238
|
});
|
|
136
|
-
const
|
|
137
|
-
submit: () =>
|
|
138
|
-
reset: () =>
|
|
139
|
-
cancel:
|
|
239
|
+
const ye = {
|
|
240
|
+
submit: () => B("submit"),
|
|
241
|
+
reset: () => B("reset"),
|
|
242
|
+
cancel: Q
|
|
140
243
|
};
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
|
255
|
+
} : {}
|
|
256
|
+
});
|
|
257
|
+
}
|
|
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}`,
|
|
268
|
+
name: t.name,
|
|
269
|
+
mode: "query",
|
|
270
|
+
onSearch: t.dictionary ? (S) => {
|
|
271
|
+
t.dictionary.search(S);
|
|
272
|
+
} : void 0
|
|
273
|
+
}, s = t.valueType ?? "text", k = Object.hasOwn(e.controls, s) ? e.controls[s] : void 0;
|
|
274
|
+
return {
|
|
275
|
+
control: f,
|
|
276
|
+
renderer: k ?? e.controls.text,
|
|
277
|
+
valueType: k ? s : "text"
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
function me(t, n, a, u, r) {
|
|
281
|
+
const c = m.value, l = (o) => {
|
|
282
|
+
o.defaultPrevented || (o.preventDefault(), B(r));
|
|
283
|
+
};
|
|
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
|
|
150
291
|
}), {
|
|
151
|
-
default: () =>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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, {
|
|
333
|
+
type: "link",
|
|
334
|
+
htmlType: "button",
|
|
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]
|
|
341
|
+
}) : null]);
|
|
342
|
+
}
|
|
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 : {}
|
|
214
382
|
}, {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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]);
|
|
222
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(),
|
|
432
|
+
"data-query-grid": "",
|
|
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);
|
|
441
|
+
});
|
|
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,
|
|
461
|
+
layoutType: "QueryFilter"
|
|
462
|
+
}) : c?.(r)]), r.error ? i("div", {
|
|
463
|
+
class: v.error(),
|
|
464
|
+
role: "alert",
|
|
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],
|
|
470
|
+
"data-query-actions": ""
|
|
471
|
+
}, [le()]) : null]);
|
|
472
|
+
}
|
|
473
|
+
return () => {
|
|
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
|
|
223
484
|
}, {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
|
232
502
|
},
|
|
233
|
-
|
|
503
|
+
...e.formProps,
|
|
504
|
+
ref: X,
|
|
505
|
+
"aria-label": T.value.label,
|
|
506
|
+
model: y.value,
|
|
507
|
+
disabled: e.disabled || !!e.formProps?.disabled
|
|
234
508
|
}, {
|
|
235
|
-
default:
|
|
236
|
-
})
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
509
|
+
default: Ne
|
|
510
|
+
}), be()]);
|
|
511
|
+
}
|
|
512
|
+
return i(t, K(oe, {
|
|
513
|
+
ref: R,
|
|
514
|
+
class: v.root(),
|
|
515
|
+
"data-query-layout-type": e.layoutType,
|
|
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"));
|
|
520
|
+
}
|
|
521
|
+
}), {
|
|
522
|
+
default: () => [n ? i(Ye, {
|
|
523
|
+
fields: O.value,
|
|
524
|
+
values: y.value,
|
|
525
|
+
disabled: e.disabled,
|
|
526
|
+
submitting: H.value,
|
|
527
|
+
collapse: e.collapse,
|
|
528
|
+
collapseLabel: e.collapseLabel,
|
|
529
|
+
footerRender: e.footerRender,
|
|
530
|
+
getPopupContainer: e.getPopupContainer,
|
|
531
|
+
locale: T.value,
|
|
532
|
+
resolveField: ae,
|
|
533
|
+
submitValues: xe
|
|
534
|
+
}, h.field ? {
|
|
535
|
+
field: h.field
|
|
536
|
+
} : void 0) : ke(), be()]
|
|
240
537
|
});
|
|
241
538
|
};
|
|
242
539
|
}
|
|
243
540
|
});
|
|
244
541
|
export {
|
|
245
|
-
|
|
542
|
+
bt as default
|
|
246
543
|
};
|