@vtable-guild/vtable-guild 2.9.0-alpha.7 → 2.9.0-alpha.9
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 +197 -0
- package/css/style.css +197 -18
- package/css/tailwind3-utilities.css +0 -18
- package/css/tailwind3.css +197 -0
- package/css/tailwind4.css +197 -0
- package/dist/css/index.css +197 -0
- package/dist/css/style.css +197 -18
- package/dist/css/tailwind3-utilities.css +0 -18
- package/dist/css/tailwind3.css +197 -0
- package/dist/css/tailwind4.css +197 -0
- package/dist/icons/src/ElFilterIcon.mjs +9 -0
- package/dist/index.full.mjs +6059 -5504
- 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 +318 -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 +101 -46
- package/dist/table/src/components/TableQuery.d.ts.map +1 -1
- package/dist/table/src/components/TableQuery.mjs +312 -184
- 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 +49 -30
- package/dist/table/src/controls.d.ts.map +1 -1
- package/dist/table/src/controls.mjs +95 -68
- package/dist/table/src/types/controls.d.ts +20 -1
- package/dist/table/src/types/controls.d.ts.map +1 -1
- package/dist/table/src/types/editable.d.ts +4 -3
- package/dist/table/src/types/editable.d.ts.map +1 -1
- package/dist/table/src/types/query-form.d.ts +71 -16
- package/dist/table/src/types/query-form.d.ts.map +1 -1
- package/dist/table/src/types/query-form.typecheck.d.ts +15 -0
- package/dist/table/src/types/query-form.typecheck.d.ts.map +1 -1
- 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/theme/src/query.d.ts +54 -49
- package/dist/theme/src/query.d.ts.map +1 -1
- package/dist/theme/src/query.mjs +25 -19
- package/package.json +1 -1
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useTheme as
|
|
3
|
-
import
|
|
4
|
-
import { VTABLE_GUILD_INJECTION_KEY as
|
|
5
|
-
import { resolveQueryThemePreset as
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import { defineComponent as ve, inject as me, computed as s, useId as be, ref as $, watch as ge, onBeforeUnmount as he, createVNode as o, mergeProps as R, nextTick as qe, toValue as k, Fragment as Ce } from "vue";
|
|
2
|
+
import { useTheme as Te } from "../../../core/src/composables/useTheme.mjs";
|
|
3
|
+
import U from "../../../core/src/components/Button.mjs";
|
|
4
|
+
import { VTABLE_GUILD_INJECTION_KEY as Fe } from "../../../core/src/plugin/index.mjs";
|
|
5
|
+
import { resolveQueryThemePreset as Pe, queryEnUS as we, queryZhCN as xe } from "../../../theme/src/query.mjs";
|
|
6
|
+
import Se from "./TableLightFilter.mjs";
|
|
7
|
+
import { useQueryFilterWidth as Be, getQueryFilterLayout as Oe } from "../utils/queryFilterLayout.mjs";
|
|
8
|
+
import { deriveTableQueryFields as Ne } from "../utils/queryFields.mjs";
|
|
9
|
+
import { snapshot as D } from "../utils/snapshot.mjs";
|
|
10
|
+
import { stateEqual as H } from "../utils/stateEqual.mjs";
|
|
11
|
+
const _e = /* @__PURE__ */ ve({
|
|
9
12
|
name: "TableQuery",
|
|
10
13
|
inheritAttrs: !1,
|
|
11
14
|
props: {
|
|
@@ -17,35 +20,59 @@ const Te = /* @__PURE__ */ ee({
|
|
|
17
20
|
type: String,
|
|
18
21
|
default: "form"
|
|
19
22
|
},
|
|
20
|
-
fields:
|
|
21
|
-
|
|
22
|
-
required: !0
|
|
23
|
-
},
|
|
23
|
+
fields: Array,
|
|
24
|
+
columns: Array,
|
|
24
25
|
controls: {
|
|
25
26
|
type: Object,
|
|
26
27
|
required: !0
|
|
27
28
|
},
|
|
28
|
-
|
|
29
|
+
layoutType: {
|
|
29
30
|
type: String,
|
|
30
|
-
default: "
|
|
31
|
+
default: "QueryFilter"
|
|
31
32
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
layout: String,
|
|
34
|
+
span: [Number, Object],
|
|
35
|
+
defaultColsNumber: Number,
|
|
36
|
+
defaultFormItemsNumber: Number,
|
|
37
|
+
defaultCollapsed: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: void 0
|
|
36
40
|
},
|
|
37
|
-
|
|
38
|
-
type:
|
|
39
|
-
default:
|
|
41
|
+
collapsed: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: void 0
|
|
44
|
+
},
|
|
45
|
+
onCollapse: Function,
|
|
46
|
+
collapseRender: {
|
|
47
|
+
type: [Boolean, Function],
|
|
48
|
+
default: void 0
|
|
40
49
|
},
|
|
41
|
-
|
|
42
|
-
type:
|
|
43
|
-
default:
|
|
50
|
+
optionRender: {
|
|
51
|
+
type: [Boolean, Function],
|
|
52
|
+
default: void 0
|
|
44
53
|
},
|
|
45
|
-
|
|
54
|
+
searchText: String,
|
|
55
|
+
resetText: String,
|
|
56
|
+
labelWidth: [Number, String],
|
|
57
|
+
searchGutter: [Number, Array],
|
|
58
|
+
split: Boolean,
|
|
59
|
+
preserve: {
|
|
46
60
|
type: Boolean,
|
|
47
61
|
default: !0
|
|
48
62
|
},
|
|
63
|
+
showHiddenNum: Boolean,
|
|
64
|
+
submitter: {
|
|
65
|
+
type: [Boolean, Object],
|
|
66
|
+
default: void 0
|
|
67
|
+
},
|
|
68
|
+
submitterColSpanProps: Object,
|
|
69
|
+
collapse: Boolean,
|
|
70
|
+
collapseLabel: null,
|
|
71
|
+
footerRender: {
|
|
72
|
+
type: [Boolean, Function],
|
|
73
|
+
default: void 0
|
|
74
|
+
},
|
|
75
|
+
getPopupContainer: Function,
|
|
49
76
|
disabled: Boolean,
|
|
50
77
|
validate: Function,
|
|
51
78
|
errors: Object,
|
|
@@ -55,190 +82,291 @@ const Te = /* @__PURE__ */ ee({
|
|
|
55
82
|
},
|
|
56
83
|
emits: {
|
|
57
84
|
submitted: (e) => !0,
|
|
58
|
-
reset: (e) => !0
|
|
85
|
+
reset: (e) => !0,
|
|
86
|
+
"update:collapsed": (e) => !0
|
|
59
87
|
},
|
|
60
88
|
slots: Object,
|
|
61
89
|
setup(e, {
|
|
62
|
-
attrs:
|
|
63
|
-
slots:
|
|
64
|
-
emit:
|
|
65
|
-
expose:
|
|
90
|
+
attrs: te,
|
|
91
|
+
slots: m,
|
|
92
|
+
emit: E,
|
|
93
|
+
expose: ne
|
|
66
94
|
}) {
|
|
67
|
-
const
|
|
68
|
-
slots:
|
|
69
|
-
} =
|
|
70
|
-
...
|
|
95
|
+
const z = me(Fe, null), {
|
|
96
|
+
slots: c
|
|
97
|
+
} = Te("query", s(() => Pe(z?.themePreset)), e), b = s(() => ({
|
|
98
|
+
...z?.locale === "en-US" ? we : xe,
|
|
71
99
|
...e.locale
|
|
72
|
-
})),
|
|
73
|
-
let
|
|
74
|
-
const
|
|
75
|
-
field:
|
|
76
|
-
values:
|
|
77
|
-
}),
|
|
78
|
-
|
|
79
|
-
|
|
100
|
+
})), le = be(), I = $(null), ae = Be(I), S = $(!1), q = $();
|
|
101
|
+
let p, g = 0, C = !1, L, T, Q, F;
|
|
102
|
+
const P = s(() => e.fields ? [...e.fields].sort((t, l) => (l.order ?? 0) - (t.order ?? 0)) : Ne(e.columns ?? [])), f = s(() => e.query.draft.value), _ = (t, l = f.value) => ({
|
|
103
|
+
field: t,
|
|
104
|
+
values: l
|
|
105
|
+
}), J = (t) => typeof t.hidden == "function" ? t.hidden(_(t)) : !!t.hidden, G = s(() => P.value.filter((t) => !J(t))), ue = s(() => e.submitter || void 0), V = s(() => !!m.actions || e.optionRender !== !1 && e.submitter !== !1), W = $(e.defaultCollapsed), w = s(() => e.collapsed ?? (V.value && (W.value ?? e.query.collapsed.value))), h = s(() => Oe(G.value, {
|
|
106
|
+
width: ae.value,
|
|
107
|
+
layout: e.layout,
|
|
108
|
+
span: e.span,
|
|
109
|
+
defaultColsNumber: e.defaultColsNumber,
|
|
110
|
+
defaultFormItemsNumber: e.defaultFormItemsNumber,
|
|
111
|
+
collapsed: w.value,
|
|
112
|
+
submitterColSpanProps: e.submitterColSpanProps,
|
|
113
|
+
showActions: V.value
|
|
114
|
+
})), re = s(() => {
|
|
115
|
+
const [t, l] = Array.isArray(e.searchGutter) ? e.searchGutter : [e.searchGutter, void 0];
|
|
116
|
+
return {
|
|
117
|
+
"--vtg-query-label-width": typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth,
|
|
118
|
+
"--vtg-query-column-gap": t === void 0 ? void 0 : `${t}px`,
|
|
119
|
+
"--vtg-query-row-gap": l === void 0 ? void 0 : `${l}px`
|
|
120
|
+
};
|
|
121
|
+
}), B = s(() => e.disabled || S.value || e.query.submitting.value);
|
|
122
|
+
function K() {
|
|
123
|
+
const t = !w.value;
|
|
124
|
+
e.collapsed === void 0 && (W.value === void 0 ? e.query.toggleCollapsed() : W.value = t), e.onCollapse?.(t), E("update:collapsed", t);
|
|
80
125
|
}
|
|
81
|
-
|
|
126
|
+
ge(() => [e.layoutType, e.disabled, e.query], O, {
|
|
82
127
|
flush: "sync"
|
|
83
128
|
});
|
|
84
|
-
function
|
|
85
|
-
|
|
129
|
+
function O() {
|
|
130
|
+
g++, p?.abort(), F?.(), F = void 0, Q?.(!1), Q = void 0, p = void 0, S.value = !1, L = void 0, T = void 0;
|
|
86
131
|
}
|
|
87
|
-
function
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
132
|
+
function oe() {
|
|
133
|
+
if (e.preserve) return;
|
|
134
|
+
const t = new Set(e.layoutType === "LightFilter" ? G.value : h.value.fields.map(({
|
|
135
|
+
field: l
|
|
136
|
+
}) => l));
|
|
137
|
+
return {
|
|
138
|
+
omitFields: P.value.filter((l) => !t.has(l)).map(({
|
|
139
|
+
name: l
|
|
140
|
+
}) => l)
|
|
141
|
+
};
|
|
91
142
|
}
|
|
92
|
-
function
|
|
93
|
-
if (
|
|
94
|
-
if (
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
143
|
+
function x(t, l) {
|
|
144
|
+
if (C || e.disabled) return Promise.resolve(!1);
|
|
145
|
+
if (T && L === t) return T;
|
|
146
|
+
O();
|
|
147
|
+
const n = g, a = new AbortController();
|
|
148
|
+
p = a, L = t, q.value = void 0;
|
|
149
|
+
const u = e.query.draft, d = u.value;
|
|
150
|
+
t === "reset" ? e.query.resetFields() : l && (u.value = {
|
|
151
|
+
...f.value,
|
|
152
|
+
...D(l)
|
|
153
|
+
});
|
|
154
|
+
const r = D(f.value);
|
|
155
|
+
l && (F = () => {
|
|
156
|
+
H(r, u.value) && (u.value = d);
|
|
157
|
+
});
|
|
158
|
+
const i = oe();
|
|
159
|
+
S.value = !0;
|
|
160
|
+
let N;
|
|
161
|
+
return T = new Promise((v) => {
|
|
162
|
+
N = v;
|
|
163
|
+
}), Q = N, (async () => {
|
|
164
|
+
let v = !1;
|
|
105
165
|
try {
|
|
106
|
-
if (
|
|
107
|
-
const
|
|
108
|
-
fields:
|
|
109
|
-
action:
|
|
110
|
-
signal:
|
|
166
|
+
if ((t === "reset" || l) && await qe(), C || n !== g || a.signal.aborted) return !1;
|
|
167
|
+
const y = await e.validate?.(r, {
|
|
168
|
+
fields: G.value,
|
|
169
|
+
action: t,
|
|
170
|
+
signal: a.signal
|
|
111
171
|
});
|
|
112
|
-
return
|
|
113
|
-
} catch (
|
|
114
|
-
return !
|
|
172
|
+
return C || n !== g || a.signal.aborted ? !1 : y === !1 ? (q.value = b.value.validationFailed, !1) : !H(r, f.value) || (F = void 0, S.value = !1, v = await (t === "reset" ? e.query.reset(i) : e.query.submit(i)), C || n !== g) ? !1 : (E(t === "reset" ? "reset" : "submitted", v), v);
|
|
173
|
+
} catch (y) {
|
|
174
|
+
return !C && n === g && (q.value = y instanceof Error ? y.message : String(y)), !1;
|
|
115
175
|
} finally {
|
|
116
|
-
|
|
176
|
+
n === g && (F?.(), F = void 0, S.value = !1, L = void 0, p = void 0, T = void 0, Q = void 0);
|
|
117
177
|
}
|
|
118
|
-
})().then(
|
|
178
|
+
})().then(N), T;
|
|
179
|
+
}
|
|
180
|
+
function ie(t) {
|
|
181
|
+
const l = _(t), n = typeof t.disabled == "function" ? t.disabled(l) : t.disabled, a = typeof t.readonly == "function" ? t.readonly(l) : t.readonly;
|
|
182
|
+
return !e.disabled && !e.query.submitting.value && !J(t) && !n && !a;
|
|
183
|
+
}
|
|
184
|
+
function se(t, l) {
|
|
185
|
+
const n = P.value.find((u) => u.name === t);
|
|
186
|
+
if (!n || !ie(n) || H(f.value[t], l)) return;
|
|
187
|
+
O(), q.value = void 0;
|
|
188
|
+
const a = e.query.draft;
|
|
189
|
+
a.value = {
|
|
190
|
+
...f.value,
|
|
191
|
+
[t]: D(l)
|
|
192
|
+
};
|
|
119
193
|
}
|
|
120
|
-
function
|
|
121
|
-
|
|
122
|
-
const l =
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
d.value = {
|
|
127
|
-
...d.value,
|
|
128
|
-
[a.name]: J(t)
|
|
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)));
|
|
194
|
+
function de(t) {
|
|
195
|
+
if (B.value) return Promise.resolve(!1);
|
|
196
|
+
const l = Object.fromEntries(P.value.filter((n) => Object.hasOwn(t, n.name)).map(({
|
|
197
|
+
name: n
|
|
198
|
+
}) => [n, t[n]]));
|
|
199
|
+
return Object.keys(l).length ? x("submit", l) : Promise.resolve(!0);
|
|
132
200
|
}
|
|
133
|
-
|
|
134
|
-
|
|
201
|
+
he(() => {
|
|
202
|
+
C = !0, O();
|
|
135
203
|
});
|
|
136
|
-
const
|
|
137
|
-
submit: () =>
|
|
138
|
-
reset: () =>
|
|
139
|
-
cancel:
|
|
204
|
+
const M = {
|
|
205
|
+
submit: () => x("submit"),
|
|
206
|
+
reset: () => x("reset"),
|
|
207
|
+
cancel: O
|
|
140
208
|
};
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
"
|
|
146
|
-
|
|
147
|
-
|
|
209
|
+
ne(M);
|
|
210
|
+
function Y(t, l, n) {
|
|
211
|
+
const a = _(t, l), u = e.errors?.[t.name] ?? k(t.dictionary?.error)?.message, d = [...k(t.options) ?? k(t.dictionary?.options) ?? []], r = l[t.name];
|
|
212
|
+
for (const j of Array.isArray(r) ? r : [r]) {
|
|
213
|
+
if (!t.dictionary || !["string", "number", "boolean"].includes(typeof j) || d.some((ye) => Object.is(ye.value, j))) continue;
|
|
214
|
+
const X = j, A = k(t.dictionary.valueEnum).get(X), ee = typeof A == "string" ? A : A?.text;
|
|
215
|
+
typeof ee == "string" && d.push({
|
|
216
|
+
value: X,
|
|
217
|
+
label: ee,
|
|
218
|
+
...typeof A == "object" ? {
|
|
219
|
+
status: A.status
|
|
220
|
+
} : {}
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
const i = typeof t.readonly == "function" ? t.readonly(a) : !!t.readonly, N = e.disabled || e.query.submitting.value || (typeof t.disabled == "function" ? t.disabled(a) : !!t.disabled), v = {
|
|
224
|
+
value: r,
|
|
225
|
+
onChange: n,
|
|
226
|
+
fieldProps: typeof t.fieldProps == "function" ? t.fieldProps(a) : t.fieldProps ?? {},
|
|
227
|
+
options: d,
|
|
228
|
+
disabled: N,
|
|
229
|
+
readonly: i,
|
|
230
|
+
loading: k(t.dictionary?.loading) ?? !1,
|
|
231
|
+
error: u,
|
|
232
|
+
id: `${le}-${t.name}`,
|
|
233
|
+
name: t.name,
|
|
234
|
+
mode: "query",
|
|
235
|
+
onSearch: t.dictionary ? (j) => {
|
|
236
|
+
t.dictionary.search(j);
|
|
237
|
+
} : void 0
|
|
238
|
+
}, y = t.valueType ?? "text", Z = Object.hasOwn(e.controls, y) ? e.controls[y] : void 0;
|
|
239
|
+
return {
|
|
240
|
+
control: v,
|
|
241
|
+
renderer: Z ?? e.controls.text,
|
|
242
|
+
valueType: Z ? y : "text"
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function ce() {
|
|
246
|
+
const t = h.value.canCollapse && e.collapseRender !== !1, l = {
|
|
247
|
+
...M,
|
|
248
|
+
submitting: B.value,
|
|
249
|
+
collapsed: w.value,
|
|
250
|
+
toggleCollapsed: K,
|
|
251
|
+
showCollapseButton: t
|
|
252
|
+
};
|
|
253
|
+
if (m.actions) return m.actions(l);
|
|
254
|
+
const n = ue.value, {
|
|
255
|
+
resetButtonProps: a,
|
|
256
|
+
submitButtonProps: u
|
|
257
|
+
} = n ?? {}, d = [a !== !1 && o(U, R({
|
|
258
|
+
key: "reset"
|
|
259
|
+
}, R(a ?? {}, {
|
|
260
|
+
htmlType: "button",
|
|
261
|
+
disabled: B.value || !!a?.disabled,
|
|
262
|
+
onClick: (i) => {
|
|
263
|
+
i.defaultPrevented || x("reset");
|
|
264
|
+
}
|
|
265
|
+
})), {
|
|
266
|
+
default: () => [n?.searchConfig?.resetText ?? e.resetText ?? b.value.reset]
|
|
267
|
+
}), u !== !1 && o(U, R({
|
|
268
|
+
key: "submit"
|
|
269
|
+
}, R({
|
|
270
|
+
type: "primary"
|
|
271
|
+
}, u ?? {}, {
|
|
272
|
+
htmlType: e.rootTag === "form" ? "submit" : "button",
|
|
273
|
+
disabled: B.value || !!u?.disabled,
|
|
274
|
+
onClick: (i) => {
|
|
275
|
+
i.defaultPrevented || (i.preventDefault(), x("submit"));
|
|
276
|
+
}
|
|
277
|
+
})), {
|
|
278
|
+
default: () => [n?.searchConfig?.submitText ?? e.searchText ?? b.value.submit]
|
|
279
|
+
})].filter(Boolean), r = n?.render ?? e.optionRender;
|
|
280
|
+
return o(Ce, null, [r === !1 ? null : typeof r == "function" ? r(l, d) : d, t ? o(U, {
|
|
281
|
+
type: "link",
|
|
282
|
+
htmlType: "button",
|
|
283
|
+
disabled: e.disabled,
|
|
284
|
+
class: c.collapse(),
|
|
285
|
+
onClick: K,
|
|
286
|
+
"aria-expanded": !w.value
|
|
287
|
+
}, {
|
|
288
|
+
default: () => [typeof e.collapseRender == "function" ? e.collapseRender(w.value) : w.value ? `${b.value.expand}${e.showHiddenNum ? ` (${h.value.hiddenCount})` : ""}` : b.value.collapse]
|
|
289
|
+
}) : null]);
|
|
290
|
+
}
|
|
291
|
+
function fe() {
|
|
292
|
+
const t = new Map(h.value.fields.map((n) => [n.field.name, n])), l = e.preserve ? P.value : h.value.fields.map(({
|
|
293
|
+
field: n
|
|
294
|
+
}) => n);
|
|
295
|
+
return o("div", {
|
|
296
|
+
class: c.fields(),
|
|
297
|
+
"data-query-grid": "",
|
|
298
|
+
style: re.value
|
|
299
|
+
}, [l.map((n) => {
|
|
300
|
+
const a = t.get(n.name), {
|
|
301
|
+
control: u,
|
|
302
|
+
renderer: d,
|
|
303
|
+
valueType: r
|
|
304
|
+
} = Y(n, f.value, (i) => {
|
|
305
|
+
se(n.name, i);
|
|
306
|
+
});
|
|
307
|
+
return o("div", {
|
|
308
|
+
key: n.name,
|
|
309
|
+
class: c.field(),
|
|
310
|
+
style: a?.style,
|
|
311
|
+
hidden: !a,
|
|
312
|
+
"data-query-field": n.name,
|
|
313
|
+
"data-query-split": e.split && a?.endsRow ? "" : void 0
|
|
314
|
+
}, [o("label", {
|
|
315
|
+
class: c.label(),
|
|
316
|
+
for: u.id
|
|
317
|
+
}, [n.label ?? n.name]), o("div", {
|
|
318
|
+
class: c.control(),
|
|
319
|
+
"data-query-value-type": r
|
|
320
|
+
}, [m.field ? m.field({
|
|
321
|
+
field: n,
|
|
322
|
+
values: f.value,
|
|
323
|
+
control: u,
|
|
324
|
+
layoutType: "QueryFilter"
|
|
325
|
+
}) : d?.(u), u.error ? o("div", {
|
|
326
|
+
class: c.error(),
|
|
327
|
+
role: "alert",
|
|
328
|
+
id: `${u.id}-error`
|
|
329
|
+
}, [u.error]) : null])]);
|
|
330
|
+
}), V.value ? o("div", {
|
|
331
|
+
class: [c.actions(), e.submitterColSpanProps?.class],
|
|
332
|
+
style: [h.value.actionStyle, e.submitterColSpanProps?.style],
|
|
333
|
+
"data-query-actions": ""
|
|
334
|
+
}, [ce()]) : null]);
|
|
335
|
+
}
|
|
336
|
+
return () => {
|
|
337
|
+
const t = e.rootTag, l = e.layoutType === "LightFilter";
|
|
338
|
+
return o(t, R(te, {
|
|
339
|
+
ref: I,
|
|
340
|
+
class: c.root(),
|
|
341
|
+
"data-query-layout-type": e.layoutType,
|
|
342
|
+
"data-query-layout": l ? void 0 : h.value.layout,
|
|
343
|
+
"aria-label": b.value.label,
|
|
344
|
+
onSubmit: (n) => {
|
|
345
|
+
n.target === I.value && (n.preventDefault(), l || x("submit"));
|
|
148
346
|
}
|
|
149
347
|
}), {
|
|
150
|
-
default: () => [
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const l = E(t), s = `${Z}-${t.name}`, i = e.errors?.[t.name] ?? C(t.dictionary?.error)?.message, d = typeof t.readonly == "function" ? t.readonly(l) : !!t.readonly, u = e.disabled || e.query.submitting.value || (typeof t.disabled == "function" ? t.disabled(l) : !!t.disabled), o = [...C(t.options) ?? C(t.dictionary?.options) ?? []], w = e.query.draft.value[t.name];
|
|
154
|
-
for (const c of Array.isArray(w) ? w : [w]) {
|
|
155
|
-
if (!t.dictionary || !["string", "number", "boolean"].includes(typeof c) || o.some((p) => Object.is(p.value, c))) continue;
|
|
156
|
-
const T = C(t.dictionary.valueEnum).get(c), L = typeof T == "string" ? T : T?.text;
|
|
157
|
-
typeof L == "string" && o.push({
|
|
158
|
-
value: c,
|
|
159
|
-
label: L,
|
|
160
|
-
...typeof T == "object" ? {
|
|
161
|
-
status: T.status
|
|
162
|
-
} : {}
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
const $ = {
|
|
166
|
-
value: w,
|
|
167
|
-
onChange: (c) => W(t, c),
|
|
168
|
-
fieldProps: typeof t.fieldProps == "function" ? t.fieldProps(l) : t.fieldProps ?? {},
|
|
169
|
-
options: o,
|
|
170
|
-
disabled: u,
|
|
171
|
-
readonly: d,
|
|
172
|
-
loading: C(t.dictionary?.loading) ?? !1,
|
|
173
|
-
error: i,
|
|
174
|
-
id: s,
|
|
175
|
-
name: t.name,
|
|
176
|
-
mode: "query",
|
|
177
|
-
onSearch: t.dictionary ? (c) => {
|
|
178
|
-
t.dictionary.search(c);
|
|
179
|
-
} : void 0
|
|
180
|
-
}, X = e.controls[t.valueType ?? "text"] ?? e.controls.text;
|
|
181
|
-
return n("div", {
|
|
182
|
-
key: t.name,
|
|
183
|
-
class: r.field(),
|
|
184
|
-
"data-query-field": t.name
|
|
185
|
-
}, [n("label", {
|
|
186
|
-
class: r.label(),
|
|
187
|
-
for: s
|
|
188
|
-
}, [t.label ?? t.name]), n("div", {
|
|
189
|
-
class: r.control()
|
|
190
|
-
}, [F.field?.({
|
|
191
|
-
field: t,
|
|
192
|
-
values: e.query.draft.value,
|
|
193
|
-
control: $
|
|
194
|
-
}) ?? X?.($), i ? n("div", {
|
|
195
|
-
class: r.error(),
|
|
196
|
-
role: "alert",
|
|
197
|
-
id: `${s}-error`
|
|
198
|
-
}, [i]) : null])]);
|
|
199
|
-
})]), n("div", {
|
|
200
|
-
class: r.actions()
|
|
201
|
-
}, [F.actions?.({
|
|
202
|
-
...V,
|
|
203
|
-
submitting: B.value,
|
|
204
|
-
collapsed: e.query.collapsed.value,
|
|
205
|
-
toggleCollapsed: e.query.toggleCollapsed
|
|
206
|
-
}) ?? n(re, null, [n(D, {
|
|
207
|
-
htmlType: "button",
|
|
208
|
-
disabled: B.value,
|
|
209
|
-
onClick: (t) => {
|
|
210
|
-
t.preventDefault(), h("reset");
|
|
211
|
-
}
|
|
212
|
-
}, {
|
|
213
|
-
default: () => [v.value.reset]
|
|
214
|
-
}), n(D, {
|
|
215
|
-
type: "primary",
|
|
216
|
-
htmlType: e.rootTag === "form" ? "submit" : "button",
|
|
217
|
-
disabled: B.value,
|
|
218
|
-
onClick: (t) => {
|
|
219
|
-
t.preventDefault(), h("submit");
|
|
220
|
-
}
|
|
221
|
-
}, {
|
|
222
|
-
default: () => [v.value.submit]
|
|
223
|
-
}), Q.value ? n(D, {
|
|
224
|
-
type: "link",
|
|
225
|
-
htmlType: "button",
|
|
348
|
+
default: () => [l ? o(Se, {
|
|
349
|
+
fields: P.value,
|
|
350
|
+
values: f.value,
|
|
226
351
|
disabled: e.disabled,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
352
|
+
submitting: B.value,
|
|
353
|
+
collapse: e.collapse,
|
|
354
|
+
collapseLabel: e.collapseLabel,
|
|
355
|
+
footerRender: e.footerRender,
|
|
356
|
+
getPopupContainer: e.getPopupContainer,
|
|
357
|
+
locale: b.value,
|
|
358
|
+
resolveField: Y,
|
|
359
|
+
submitValues: de
|
|
360
|
+
}, m.field ? {
|
|
361
|
+
field: m.field
|
|
362
|
+
} : void 0) : fe(), q.value || e.query.error.value ? o("div", {
|
|
363
|
+
class: c.feedback(),
|
|
236
364
|
role: "alert"
|
|
237
|
-
}, [
|
|
365
|
+
}, [q.value ?? e.query.error.value?.message]) : null]
|
|
238
366
|
});
|
|
239
367
|
};
|
|
240
368
|
}
|
|
241
369
|
});
|
|
242
370
|
export {
|
|
243
|
-
|
|
371
|
+
_e as default
|
|
244
372
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { TableQueryInstance, TableQueryProps, TableQuerySlots } from '../types/query-form';
|
|
2
|
-
declare const _default: <TValues extends object = Record<string, unknown>, TParams extends object = TValues>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
2
|
+
declare const _default: <TValues extends object = Record<string, unknown>, TParams extends object = TValues, TRecord extends object = TValues>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
4
4
|
readonly onReset?: ((success: boolean) => any) | undefined;
|
|
5
5
|
readonly onSubmitted?: ((success: boolean) => any) | undefined;
|
|
6
|
-
|
|
6
|
+
readonly "onUpdate:collapsed"?: ((collapsed: boolean) => any) | undefined;
|
|
7
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onReset" | "onSubmitted" | "onUpdate:collapsed"> & TableQueryProps<TValues, TParams, TRecord> & Partial<{}>> & import('vue').PublicProps;
|
|
7
8
|
expose(exposed: import('vue').ShallowUnwrapRef<TableQueryInstance>): void;
|
|
8
9
|
attrs: any;
|
|
9
10
|
slots: Readonly<TableQuerySlots<TValues>> & TableQuerySlots<TValues>;
|
|
10
|
-
emit: ((evt: "reset", success: boolean) => void) & ((evt: "submitted", success: boolean) => void);
|
|
11
|
+
emit: ((evt: "reset", success: boolean) => void) & ((evt: "submitted", success: boolean) => void) & ((evt: "update:collapsed", collapsed: boolean) => void);
|
|
11
12
|
}>) => import('vue').VNode & {
|
|
12
13
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
13
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VTableQuery.vue.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/VTableQuery.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VTableQuery.vue.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/VTableQuery.vue"],"names":[],"mappings":"AAiEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;yBAG3F,OAAO,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChD,OAAO,SAAS,MAAM,GAAG,OAAO,EAChC,OAAO,SAAS,MAAM,GAAG,OAAO,EAEnC,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,eAAe,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EACjE;WAiJO,mBAAmB,CAAC;;;;iOAAkE,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,oBAAsB,GAAG,IAAI;WACpE,GAAG;;;EAIP,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AAhKzE,wBAgK4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|