@vtable-guild/vtable-guild 2.9.0-alpha.6 → 2.9.0-alpha.8
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 +15 -0
- package/css/style.css +32 -2
- package/css/tailwind3-utilities.css +17 -2
- package/css/tailwind3.css +15 -0
- package/css/tailwind4.css +15 -0
- package/dist/core/src/components/Tooltip.d.ts.map +1 -1
- package/dist/core/src/components/Tooltip.mjs +111 -94
- package/dist/core/src/index.d.ts +1 -0
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/utils/fullscreen.d.ts +8 -0
- package/dist/core/src/utils/fullscreen.d.ts.map +1 -0
- package/dist/core/src/utils/fullscreen.mjs +8 -0
- package/dist/css/index.css +15 -0
- package/dist/css/style.css +32 -2
- package/dist/css/tailwind3-utilities.css +17 -2
- package/dist/css/tailwind3.css +15 -0
- package/dist/css/tailwind4.css +15 -0
- package/dist/index.full.mjs +4666 -4623
- package/dist/index.mjs +155 -153
- package/dist/table/src/components/Table.d.ts.map +1 -1
- package/dist/table/src/components/Table.mjs +14 -13
- package/dist/table/src/components/TablePopup.d.ts.map +1 -1
- package/dist/table/src/components/TablePopup.mjs +34 -30
- package/dist/table/src/components/TableQuery.d.ts.map +1 -1
- package/dist/table/src/components/TableQuery.mjs +60 -58
- package/dist/table/src/components/TableToolbar.d.ts +2 -2
- package/dist/table/src/components/TableToolbar.d.ts.map +1 -1
- package/dist/table/src/components/TableToolbar.mjs +95 -92
- package/dist/table/src/context.d.ts +2 -0
- package/dist/table/src/context.d.ts.map +1 -1
- package/dist/table/src/controls.d.ts.map +1 -1
- package/dist/table/src/types/controls.d.ts +4 -0
- 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 +4 -2
- 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/types/toolbar.d.ts +6 -1
- package/dist/table/src/types/toolbar.d.ts.map +1 -1
- package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
- package/dist/theme/src/presets/antdv/table.mjs +4 -1
- package/dist/theme/src/presets/element-plus/table.d.ts.map +1 -1
- package/dist/theme/src/presets/element-plus/table.mjs +4 -1
- package/dist/theme/src/query.d.ts +61 -33
- package/dist/theme/src/query.d.ts.map +1 -1
- package/dist/theme/src/query.mjs +20 -13
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useTheme as
|
|
3
|
-
import
|
|
4
|
-
import { VTABLE_GUILD_INJECTION_KEY as
|
|
5
|
-
import { resolveQueryThemePreset as
|
|
6
|
-
import { snapshot as
|
|
7
|
-
import { stateEqual as
|
|
8
|
-
const
|
|
1
|
+
import { defineComponent as ae, inject as ne, computed as y, useId as le, ref as K, watch as ue, onBeforeUnmount as re, createVNode as n, mergeProps as oe, toValue as C, Fragment as se, nextTick as ie } from "vue";
|
|
2
|
+
import { useTheme as de } from "../../../core/src/composables/useTheme.mjs";
|
|
3
|
+
import F from "../../../core/src/components/Button.mjs";
|
|
4
|
+
import { VTABLE_GUILD_INJECTION_KEY as ce } from "../../../core/src/plugin/index.mjs";
|
|
5
|
+
import { resolveQueryThemePreset as ye, queryEnUS as fe, queryZhCN as me } from "../../../theme/src/query.mjs";
|
|
6
|
+
import { snapshot as R } from "../utils/snapshot.mjs";
|
|
7
|
+
import { stateEqual as Y } from "../utils/stateEqual.mjs";
|
|
8
|
+
const Se = /* @__PURE__ */ ae({
|
|
9
9
|
name: "TableQuery",
|
|
10
10
|
inheritAttrs: !1,
|
|
11
11
|
props: {
|
|
@@ -27,7 +27,7 @@ const Te = /* @__PURE__ */ ee({
|
|
|
27
27
|
},
|
|
28
28
|
layout: {
|
|
29
29
|
type: String,
|
|
30
|
-
default: "
|
|
30
|
+
default: "light"
|
|
31
31
|
},
|
|
32
32
|
autoSubmit: Boolean,
|
|
33
33
|
debounceTime: {
|
|
@@ -59,89 +59,90 @@ const Te = /* @__PURE__ */ ee({
|
|
|
59
59
|
},
|
|
60
60
|
slots: Object,
|
|
61
61
|
setup(e, {
|
|
62
|
-
attrs:
|
|
63
|
-
slots:
|
|
64
|
-
emit:
|
|
65
|
-
expose:
|
|
62
|
+
attrs: Z,
|
|
63
|
+
slots: I,
|
|
64
|
+
emit: _,
|
|
65
|
+
expose: z
|
|
66
66
|
}) {
|
|
67
|
-
const
|
|
67
|
+
const U = ne(ce, null), {
|
|
68
68
|
slots: r
|
|
69
|
-
} =
|
|
70
|
-
...
|
|
69
|
+
} = de("query", y(() => ye(U?.themePreset)), e), v = y(() => ({
|
|
70
|
+
...U?.locale === "en-US" ? fe : me,
|
|
71
71
|
...e.locale
|
|
72
|
-
})),
|
|
73
|
-
let S, x,
|
|
74
|
-
const A =
|
|
72
|
+
})), H = le(), q = K(!1), b = K();
|
|
73
|
+
let S, x, f = 0, m = !1, P, g, O;
|
|
74
|
+
const A = y(() => [...e.fields].sort((a, t) => (a.order ?? 0) - (t.order ?? 0))), E = (a) => ({
|
|
75
75
|
field: a,
|
|
76
76
|
values: e.query.draft.value
|
|
77
|
-
}),
|
|
77
|
+
}), M = (a) => typeof a.hidden == "function" ? a.hidden(E(a)) : !!a.hidden, j = y(() => A.value.filter((a) => !M(a))), Q = y(() => Math.max(1, Math.floor(e.collapsedCount || 1))), V = y(() => e.collapsible && j.value.length > Q.value), W = y(() => V.value && e.query.collapsed.value ? j.value.slice(0, Q.value) : j.value), B = y(() => e.disabled || q.value || e.query.submitting.value);
|
|
78
78
|
function N() {
|
|
79
79
|
clearTimeout(S), S = void 0;
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
ue(() => [e.layout, e.autoSubmit, e.disabled], N, {
|
|
82
82
|
flush: "sync"
|
|
83
83
|
});
|
|
84
84
|
function k() {
|
|
85
|
-
N(),
|
|
85
|
+
N(), f++, x?.abort(), O?.(!1), O = void 0, x = void 0, q.value = !1, P = void 0, g = void 0;
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function X() {
|
|
88
88
|
return e.hiddenPolicy === "omit" ? {
|
|
89
|
-
omitFields: A.value.filter(
|
|
89
|
+
omitFields: A.value.filter(M).map((a) => a.name)
|
|
90
90
|
} : void 0;
|
|
91
91
|
}
|
|
92
92
|
function h(a) {
|
|
93
93
|
if (m || e.disabled) return Promise.resolve(!1);
|
|
94
94
|
if (N(), g && P === a) return g;
|
|
95
95
|
k();
|
|
96
|
-
const t =
|
|
96
|
+
const t = f, l = new AbortController();
|
|
97
97
|
x = l, P = a, b.value = void 0, a === "reset" && e.query.resetFields();
|
|
98
|
-
const s =
|
|
98
|
+
const s = R(e.query.draft.value), i = X();
|
|
99
99
|
q.value = !0;
|
|
100
100
|
let d;
|
|
101
101
|
return g = new Promise((u) => {
|
|
102
102
|
d = u;
|
|
103
|
-
}),
|
|
103
|
+
}), O = d, (async () => {
|
|
104
104
|
let u = !1;
|
|
105
105
|
try {
|
|
106
|
-
if (a === "reset" && await
|
|
106
|
+
if (a === "reset" && await ie(), m || t !== f || l.signal.aborted) return !1;
|
|
107
107
|
const o = await e.validate?.(s, {
|
|
108
|
-
fields:
|
|
108
|
+
fields: j.value,
|
|
109
109
|
action: a,
|
|
110
110
|
signal: l.signal
|
|
111
111
|
});
|
|
112
|
-
return m || t !==
|
|
112
|
+
return m || t !== f || l.signal.aborted ? !1 : o === !1 ? (b.value = v.value.validationFailed, !1) : !Y(s, e.query.draft.value) || (q.value = !1, u = await (a === "reset" ? e.query.reset(i) : e.query.submit(i)), m || t !== f) ? !1 : (_(a === "reset" ? "reset" : "submitted", u), u);
|
|
113
113
|
} catch (o) {
|
|
114
|
-
return !m && t ===
|
|
114
|
+
return !m && t === f && (b.value = o instanceof Error ? o.message : String(o)), !1;
|
|
115
115
|
} finally {
|
|
116
|
-
t ===
|
|
116
|
+
t === f && (q.value = !1, P = void 0, x = void 0, g = void 0, O = void 0);
|
|
117
117
|
}
|
|
118
118
|
})().then(d), g;
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function p(a, t) {
|
|
121
121
|
a = A.value.find((u) => u.name === a.name) ?? a;
|
|
122
122
|
const l = E(a), s = typeof a.disabled == "function" ? a.disabled(l) : a.disabled, i = typeof a.readonly == "function" ? a.readonly(l) : a.readonly;
|
|
123
|
-
if (e.disabled || e.query.submitting.value || s || i ||
|
|
123
|
+
if (e.disabled || e.query.submitting.value || s || i || Y(e.query.draft.value[a.name], t)) return;
|
|
124
124
|
k(), b.value = void 0;
|
|
125
125
|
const d = e.query.draft;
|
|
126
126
|
d.value = {
|
|
127
127
|
...d.value,
|
|
128
|
-
[a.name]:
|
|
128
|
+
[a.name]: R(t)
|
|
129
129
|
}, e.layout === "light" && e.autoSubmit && (S = setTimeout(() => {
|
|
130
130
|
S = void 0, !m && e.layout === "light" && e.autoSubmit && !e.disabled && h("submit");
|
|
131
131
|
}, Math.max(0, e.debounceTime)));
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
re(() => {
|
|
134
134
|
m = !0, k();
|
|
135
135
|
});
|
|
136
|
-
const
|
|
136
|
+
const $ = {
|
|
137
137
|
submit: () => h("submit"),
|
|
138
138
|
reset: () => h("reset"),
|
|
139
139
|
cancel: k
|
|
140
140
|
};
|
|
141
|
-
return
|
|
141
|
+
return z($), () => {
|
|
142
142
|
const a = e.rootTag;
|
|
143
|
-
return n(a,
|
|
143
|
+
return n(a, oe(Z, {
|
|
144
144
|
class: r.root(),
|
|
145
|
+
"data-query-layout": e.layout,
|
|
145
146
|
"aria-label": v.value.label,
|
|
146
147
|
onSubmit: (t) => {
|
|
147
148
|
t.preventDefault(), h("submit");
|
|
@@ -149,22 +150,22 @@ const Te = /* @__PURE__ */ ee({
|
|
|
149
150
|
}), {
|
|
150
151
|
default: () => [n("div", {
|
|
151
152
|
class: r.fields()
|
|
152
|
-
}, [
|
|
153
|
-
const l = E(t), s = `${
|
|
153
|
+
}, [W.value.map((t) => {
|
|
154
|
+
const l = E(t), s = `${H}-${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
155
|
for (const c of Array.isArray(w) ? w : [w]) {
|
|
155
|
-
if (!t.dictionary || !["string", "number", "boolean"].includes(typeof c) || o.some((
|
|
156
|
-
const T = C(t.dictionary.valueEnum).get(c),
|
|
157
|
-
typeof
|
|
156
|
+
if (!t.dictionary || !["string", "number", "boolean"].includes(typeof c) || o.some((te) => Object.is(te.value, c))) continue;
|
|
157
|
+
const T = C(t.dictionary.valueEnum).get(c), J = typeof T == "string" ? T : T?.text;
|
|
158
|
+
typeof J == "string" && o.push({
|
|
158
159
|
value: c,
|
|
159
|
-
label:
|
|
160
|
+
label: J,
|
|
160
161
|
...typeof T == "object" ? {
|
|
161
162
|
status: T.status
|
|
162
163
|
} : {}
|
|
163
164
|
});
|
|
164
165
|
}
|
|
165
|
-
const
|
|
166
|
+
const L = {
|
|
166
167
|
value: w,
|
|
167
|
-
onChange: (c) =>
|
|
168
|
+
onChange: (c) => p(t, c),
|
|
168
169
|
fieldProps: typeof t.fieldProps == "function" ? t.fieldProps(l) : t.fieldProps ?? {},
|
|
169
170
|
options: o,
|
|
170
171
|
disabled: u,
|
|
@@ -177,7 +178,7 @@ const Te = /* @__PURE__ */ ee({
|
|
|
177
178
|
onSearch: t.dictionary ? (c) => {
|
|
178
179
|
t.dictionary.search(c);
|
|
179
180
|
} : void 0
|
|
180
|
-
},
|
|
181
|
+
}, D = t.valueType ?? "text", G = Object.prototype.hasOwnProperty.call(e.controls, D) ? e.controls[D] : void 0, ee = G ?? e.controls.text;
|
|
181
182
|
return n("div", {
|
|
182
183
|
key: t.name,
|
|
183
184
|
class: r.field(),
|
|
@@ -186,24 +187,25 @@ const Te = /* @__PURE__ */ ee({
|
|
|
186
187
|
class: r.label(),
|
|
187
188
|
for: s
|
|
188
189
|
}, [t.label ?? t.name]), n("div", {
|
|
189
|
-
class: r.control()
|
|
190
|
-
|
|
190
|
+
class: r.control(),
|
|
191
|
+
"data-query-value-type": G ? D : "text"
|
|
192
|
+
}, [I.field?.({
|
|
191
193
|
field: t,
|
|
192
194
|
values: e.query.draft.value,
|
|
193
|
-
control:
|
|
194
|
-
}) ??
|
|
195
|
+
control: L
|
|
196
|
+
}) ?? ee?.(L), i ? n("div", {
|
|
195
197
|
class: r.error(),
|
|
196
198
|
role: "alert",
|
|
197
199
|
id: `${s}-error`
|
|
198
200
|
}, [i]) : null])]);
|
|
199
201
|
})]), n("div", {
|
|
200
202
|
class: r.actions()
|
|
201
|
-
}, [
|
|
202
|
-
|
|
203
|
+
}, [I.actions?.({
|
|
204
|
+
...$,
|
|
203
205
|
submitting: B.value,
|
|
204
206
|
collapsed: e.query.collapsed.value,
|
|
205
207
|
toggleCollapsed: e.query.toggleCollapsed
|
|
206
|
-
}) ?? n(
|
|
208
|
+
}) ?? n(se, null, [n(F, {
|
|
207
209
|
htmlType: "button",
|
|
208
210
|
disabled: B.value,
|
|
209
211
|
onClick: (t) => {
|
|
@@ -211,7 +213,7 @@ const Te = /* @__PURE__ */ ee({
|
|
|
211
213
|
}
|
|
212
214
|
}, {
|
|
213
215
|
default: () => [v.value.reset]
|
|
214
|
-
}), n(
|
|
216
|
+
}), n(F, {
|
|
215
217
|
type: "primary",
|
|
216
218
|
htmlType: e.rootTag === "form" ? "submit" : "button",
|
|
217
219
|
disabled: B.value,
|
|
@@ -220,7 +222,7 @@ const Te = /* @__PURE__ */ ee({
|
|
|
220
222
|
}
|
|
221
223
|
}, {
|
|
222
224
|
default: () => [v.value.submit]
|
|
223
|
-
}),
|
|
225
|
+
}), V.value ? n(F, {
|
|
224
226
|
type: "link",
|
|
225
227
|
htmlType: "button",
|
|
226
228
|
disabled: e.disabled,
|
|
@@ -240,5 +242,5 @@ const Te = /* @__PURE__ */ ee({
|
|
|
240
242
|
}
|
|
241
243
|
});
|
|
242
244
|
export {
|
|
243
|
-
|
|
245
|
+
Se as default
|
|
244
246
|
};
|
|
@@ -20,7 +20,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
20
20
|
};
|
|
21
21
|
searchValue: {
|
|
22
22
|
type: StringConstructor;
|
|
23
|
-
default:
|
|
23
|
+
default: undefined;
|
|
24
24
|
};
|
|
25
25
|
multipleLine: BooleanConstructor;
|
|
26
26
|
disabled: BooleanConstructor;
|
|
@@ -56,7 +56,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
56
56
|
};
|
|
57
57
|
searchValue: {
|
|
58
58
|
type: StringConstructor;
|
|
59
|
-
default:
|
|
59
|
+
default: undefined;
|
|
60
60
|
};
|
|
61
61
|
multipleLine: BooleanConstructor;
|
|
62
62
|
disabled: BooleanConstructor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableToolbar.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/TableToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,QAAQ,EACb,KAAK,SAAS,EACf,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"TableToolbar.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/TableToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,QAAQ,EACb,KAAK,SAAS,EACf,MAAM,KAAK,CAAA;AAgBZ,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAyB,MAAM,kBAAkB,CAAA;AAEnG,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;;;cAKI,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;;aACpD,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;UAC5B,QAAQ,CAAC,uBAAuB,CAAC;;cAEpB,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;;;;;cAI9B,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;;;;;;;;;sBAI5C,QAAQ,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;oBACnD,QAAQ,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;YACrD,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACzC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;;;iCAIlB,WAAW,CAAC,GAAG,CAAC;2BACtB,uBAAuB;;;mCAGf,MAAM;qBACpB,MAAM;;gCAEK,OAAO;8BACT,OAAO;;;cA3BC,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;;aACpD,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;UAC5B,QAAQ,CAAC,uBAAuB,CAAC;;cAEpB,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;;;;;cAI9B,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;;;;;;;;;sBAI5C,QAAQ,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;oBACnD,QAAQ,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;YACrD,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACzC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;AAlBnD,wBAwUE"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useTheme as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { VTABLE_GUILD_INJECTION_KEY as
|
|
6
|
-
import
|
|
1
|
+
import { defineComponent as A, inject as B, computed as s, ref as L, shallowRef as N, onMounted as U, watch as V, onBeforeUnmount as k, createVNode as a, Fragment as D, mergeProps as R } from "vue";
|
|
2
|
+
import { useTheme as Z } from "../../../core/src/composables/useTheme.mjs";
|
|
3
|
+
import j from "../../../core/src/components/Tooltip.mjs";
|
|
4
|
+
import q from "../../../core/src/components/Input.mjs";
|
|
5
|
+
import { VTABLE_GUILD_INJECTION_KEY as G } from "../../../core/src/plugin/index.mjs";
|
|
6
|
+
import K from "../../../icons/src/SearchIcon.mjs";
|
|
7
7
|
import M from "../../../icons/src/ReloadOutlinedIcon.mjs";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { resolveToolbarThemePreset as
|
|
8
|
+
import Y from "../../../icons/src/FullscreenOutlinedIcon.mjs";
|
|
9
|
+
import J from "../../../icons/src/FullscreenExitOutlinedIcon.mjs";
|
|
10
|
+
import { resolveToolbarThemePreset as X, toolbarZhCN as H } from "../../../theme/src/toolbar.mjs";
|
|
11
11
|
import { resolveTableThemePreset as Q, resolveBuiltInLocale as W } from "../../../theme/src/presets/index.mjs";
|
|
12
|
-
import
|
|
13
|
-
|
|
12
|
+
import $ from "./TableColumnSettings.mjs";
|
|
13
|
+
import { TABLE_CONTEXT_KEY as p } from "../context.mjs";
|
|
14
|
+
const ve = /* @__PURE__ */ A({
|
|
14
15
|
name: "TableToolbar",
|
|
15
16
|
props: {
|
|
16
17
|
title: {
|
|
@@ -29,7 +30,7 @@ const se = /* @__PURE__ */ _({
|
|
|
29
30
|
},
|
|
30
31
|
searchValue: {
|
|
31
32
|
type: String,
|
|
32
|
-
default:
|
|
33
|
+
default: void 0
|
|
33
34
|
},
|
|
34
35
|
multipleLine: Boolean,
|
|
35
36
|
disabled: Boolean,
|
|
@@ -52,22 +53,22 @@ const se = /* @__PURE__ */ _({
|
|
|
52
53
|
},
|
|
53
54
|
slots: Object,
|
|
54
55
|
setup(e, {
|
|
55
|
-
emit:
|
|
56
|
+
emit: i,
|
|
56
57
|
slots: t
|
|
57
58
|
}) {
|
|
58
|
-
const
|
|
59
|
+
const o = B(G, null), F = B(p, null), v = s(() => o?.themePreset ?? "antdv"), {
|
|
59
60
|
slots: n
|
|
60
|
-
} =
|
|
61
|
+
} = Z("toolbar", s(() => X(v.value)), e), I = s(() => {
|
|
61
62
|
if (e.size) return e.size;
|
|
62
|
-
const l =
|
|
63
|
+
const l = o?.theme.table?.defaultVariants?.size;
|
|
63
64
|
return l === "large" || l === "middle" || l === "small" ? l : Q(v.value).defaultVariants.size;
|
|
64
|
-
}), r =
|
|
65
|
+
}), r = s(() => ({
|
|
65
66
|
...H,
|
|
66
|
-
...W(v.value,
|
|
67
|
-
...
|
|
68
|
-
...
|
|
67
|
+
...W(v.value, o?.locale)?.toolbar,
|
|
68
|
+
...o?.locales[o.locale]?.toolbar,
|
|
69
|
+
...o?.localeOverrides.toolbar,
|
|
69
70
|
...e.locale
|
|
70
|
-
})),
|
|
71
|
+
})), c = s(() => {
|
|
71
72
|
const l = e.options !== !1, u = e.options === !1 ? void 0 : e.options;
|
|
72
73
|
return {
|
|
73
74
|
reload: l && u?.reload !== !1,
|
|
@@ -77,35 +78,38 @@ const se = /* @__PURE__ */ _({
|
|
|
77
78
|
draggable: l && u?.draggable !== !1,
|
|
78
79
|
fullScreen: l && u?.fullScreen === !0
|
|
79
80
|
};
|
|
80
|
-
}),
|
|
81
|
-
function
|
|
82
|
-
return
|
|
81
|
+
}), b = L(!1), S = N(null), m = L(!1);
|
|
82
|
+
function y() {
|
|
83
|
+
return e.fullscreenTarget ? e.fullscreenTarget() : F?.rootElement?.();
|
|
83
84
|
}
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
const d = s(() => !!S.value && S.value === y()), T = s(() => b.value && typeof y()?.requestFullscreen == "function" && typeof document.exitFullscreen == "function");
|
|
86
|
+
function h() {
|
|
87
|
+
S.value = document.fullscreenElement;
|
|
86
88
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}), k(s, (l) => c("fullscreenChange", l));
|
|
96
|
-
function T() {
|
|
97
|
-
!e.disabled && !e.loading && c("reload");
|
|
89
|
+
U(() => {
|
|
90
|
+
b.value = !0, h(), document.addEventListener("fullscreenchange", h);
|
|
91
|
+
}), V(() => b.value && c.value.fullScreen && !e.fullscreenTarget && !F?.rootElement, (l) => {
|
|
92
|
+
}), k(() => {
|
|
93
|
+
b.value && document.removeEventListener("fullscreenchange", h);
|
|
94
|
+
}), V(d, (l) => i("fullscreenChange", l));
|
|
95
|
+
function z() {
|
|
96
|
+
!e.disabled && !e.loading && i("reload");
|
|
98
97
|
}
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
const x = L(e.searchValue ?? "");
|
|
99
|
+
V(() => e.searchValue, (l) => {
|
|
100
|
+
l !== void 0 && (x.value = l);
|
|
101
|
+
});
|
|
102
|
+
const g = s(() => e.searchValue ?? x.value);
|
|
103
|
+
function E(l) {
|
|
104
|
+
e.disabled || (x.value = l, i("update:searchValue", l));
|
|
101
105
|
}
|
|
102
|
-
function
|
|
103
|
-
!e.disabled && !e.loading &&
|
|
106
|
+
function C(l = g.value) {
|
|
107
|
+
!e.disabled && !e.loading && i("search", l);
|
|
104
108
|
}
|
|
105
|
-
function
|
|
106
|
-
e.disabled || e.loading || (
|
|
109
|
+
function O() {
|
|
110
|
+
e.disabled || e.loading || (E(""), i("clearSearch"), i("search", ""));
|
|
107
111
|
}
|
|
108
|
-
function
|
|
112
|
+
function w(l) {
|
|
109
113
|
if (t.search) return t.search(l);
|
|
110
114
|
if (!e.search) return null;
|
|
111
115
|
const u = typeof e.search == "object" ? e.search : void 0;
|
|
@@ -115,26 +119,26 @@ const se = /* @__PURE__ */ _({
|
|
|
115
119
|
}, [a("span", {
|
|
116
120
|
class: n.searchField(),
|
|
117
121
|
"data-disabled": e.disabled ? "" : void 0
|
|
118
|
-
}, [a(
|
|
122
|
+
}, [a(q, {
|
|
119
123
|
bare: !0,
|
|
120
|
-
value:
|
|
124
|
+
value: g.value,
|
|
121
125
|
placeholder: u?.placeholder ?? r.value.searchPlaceholder,
|
|
122
126
|
"aria-label": u?.placeholder ?? r.value.searchPlaceholder,
|
|
123
127
|
disabled: e.disabled,
|
|
124
128
|
ui: {
|
|
125
129
|
root: n.searchInput()
|
|
126
130
|
},
|
|
127
|
-
"onUpdate:value":
|
|
131
|
+
"onUpdate:value": E,
|
|
128
132
|
onPressEnter: (f) => {
|
|
129
|
-
f.isComposing || (f.preventDefault(),
|
|
133
|
+
f.isComposing || (f.preventDefault(), C());
|
|
130
134
|
}
|
|
131
|
-
}, null), u?.clearable !== !1 &&
|
|
135
|
+
}, null), u?.clearable !== !1 && g.value && a("button", {
|
|
132
136
|
type: "button",
|
|
133
137
|
class: n.searchClear(),
|
|
134
138
|
"aria-label": r.value.clearSearch,
|
|
135
139
|
title: r.value.clearSearch,
|
|
136
140
|
disabled: e.disabled || e.loading,
|
|
137
|
-
onClick:
|
|
141
|
+
onClick: O
|
|
138
142
|
}, [a("svg", {
|
|
139
143
|
class: n.searchIcon(),
|
|
140
144
|
viewBox: "0 0 16 16",
|
|
@@ -150,29 +154,29 @@ const se = /* @__PURE__ */ _({
|
|
|
150
154
|
"aria-label": r.value.search,
|
|
151
155
|
title: r.value.search,
|
|
152
156
|
disabled: e.disabled || e.loading,
|
|
153
|
-
onClick: () =>
|
|
154
|
-
}, [a(
|
|
157
|
+
onClick: () => C()
|
|
158
|
+
}, [a(K, {
|
|
155
159
|
class: n.searchIcon(),
|
|
156
160
|
"aria-hidden": "true"
|
|
157
161
|
}, null)])]);
|
|
158
162
|
}
|
|
159
|
-
async function
|
|
160
|
-
if (e.disabled ||
|
|
161
|
-
const l =
|
|
163
|
+
async function _() {
|
|
164
|
+
if (e.disabled || m.value || !T.value) return;
|
|
165
|
+
const l = y();
|
|
162
166
|
if (l) {
|
|
163
|
-
|
|
167
|
+
m.value = !0;
|
|
164
168
|
try {
|
|
165
|
-
document.fullscreenElement === l ? await document.exitFullscreen() : await l.requestFullscreen(),
|
|
169
|
+
document.fullscreenElement === l ? await document.exitFullscreen() : await l.requestFullscreen(), h();
|
|
166
170
|
} catch (u) {
|
|
167
|
-
|
|
171
|
+
i("fullscreenError", u);
|
|
168
172
|
} finally {
|
|
169
|
-
|
|
173
|
+
m.value = !1;
|
|
170
174
|
}
|
|
171
175
|
}
|
|
172
176
|
}
|
|
173
|
-
function
|
|
174
|
-
const l =
|
|
175
|
-
return a(
|
|
177
|
+
function P() {
|
|
178
|
+
const l = c.value.setting && e.columns !== void 0, u = c.value.density;
|
|
179
|
+
return a(D, null, [c.value.reload && a(j, {
|
|
176
180
|
title: r.value.reload
|
|
177
181
|
}, {
|
|
178
182
|
default: () => [a("button", {
|
|
@@ -181,41 +185,40 @@ const se = /* @__PURE__ */ _({
|
|
|
181
185
|
disabled: e.disabled || e.loading,
|
|
182
186
|
"aria-label": r.value.reload,
|
|
183
187
|
"aria-busy": e.loading,
|
|
184
|
-
onClick:
|
|
188
|
+
onClick: z
|
|
185
189
|
}, [a(M, {
|
|
186
190
|
class: e.loading ? n.loadingIcon() : n.icon()
|
|
187
191
|
}, null)])]
|
|
188
|
-
}), (l || u) && a(
|
|
189
|
-
getPopupContainer: P.value,
|
|
192
|
+
}), (l || u) && a($, R(e.columnSettings, {
|
|
190
193
|
columns: e.columns ?? [],
|
|
191
|
-
size:
|
|
194
|
+
size: I.value,
|
|
192
195
|
options: {
|
|
193
196
|
density: u,
|
|
194
197
|
setting: l,
|
|
195
|
-
fixed:
|
|
196
|
-
draggable:
|
|
198
|
+
fixed: c.value.fixed,
|
|
199
|
+
draggable: c.value.draggable
|
|
197
200
|
},
|
|
198
201
|
disabled: e.disabled,
|
|
199
|
-
"onUpdate:columns": (f) =>
|
|
200
|
-
"onUpdate:size": (f) =>
|
|
201
|
-
onReset: () =>
|
|
202
|
+
"onUpdate:columns": (f) => i("update:columns", f),
|
|
203
|
+
"onUpdate:size": (f) => i("update:size", f),
|
|
204
|
+
onReset: () => i("reset")
|
|
202
205
|
}), {
|
|
203
206
|
columnLabel: t.columnLabel
|
|
204
|
-
}),
|
|
205
|
-
title:
|
|
207
|
+
}), c.value.fullScreen && a(j, {
|
|
208
|
+
title: d.value ? r.value.exitFullScreen : r.value.fullScreen
|
|
206
209
|
}, {
|
|
207
210
|
default: () => [a("button", {
|
|
208
211
|
type: "button",
|
|
209
212
|
class: n.action(),
|
|
210
|
-
disabled: e.disabled || !
|
|
211
|
-
"aria-label":
|
|
212
|
-
"aria-pressed":
|
|
213
|
+
disabled: e.disabled || !T.value || m.value,
|
|
214
|
+
"aria-label": d.value ? r.value.exitFullScreen : r.value.fullScreen,
|
|
215
|
+
"aria-pressed": d.value,
|
|
213
216
|
onClick: () => {
|
|
214
|
-
|
|
217
|
+
_();
|
|
215
218
|
}
|
|
216
|
-
}, [
|
|
219
|
+
}, [d.value ? a(J, {
|
|
217
220
|
class: n.icon()
|
|
218
|
-
}, null) : a(
|
|
221
|
+
}, null) : a(Y, {
|
|
219
222
|
class: n.icon()
|
|
220
223
|
}, null)])]
|
|
221
224
|
})]);
|
|
@@ -223,18 +226,18 @@ const se = /* @__PURE__ */ _({
|
|
|
223
226
|
return () => {
|
|
224
227
|
const l = {
|
|
225
228
|
columns: e.columns ?? [],
|
|
226
|
-
size:
|
|
229
|
+
size: I.value,
|
|
227
230
|
loading: e.loading,
|
|
228
231
|
disabled: e.disabled,
|
|
229
|
-
fullscreen:
|
|
230
|
-
fullscreenAvailable:
|
|
231
|
-
reload:
|
|
232
|
-
toggleFullscreen:
|
|
233
|
-
searchValue:
|
|
234
|
-
updateSearchValue:
|
|
235
|
-
submitSearch:
|
|
236
|
-
clearSearch:
|
|
237
|
-
}, u = t.settings ||
|
|
232
|
+
fullscreen: d.value,
|
|
233
|
+
fullscreenAvailable: T.value,
|
|
234
|
+
reload: z,
|
|
235
|
+
toggleFullscreen: _,
|
|
236
|
+
searchValue: g.value,
|
|
237
|
+
updateSearchValue: E,
|
|
238
|
+
submitSearch: C,
|
|
239
|
+
clearSearch: O
|
|
240
|
+
}, u = t.settings || c.value.reload || c.value.density || c.value.setting && e.columns !== void 0 || c.value.fullScreen;
|
|
238
241
|
return a("div", {
|
|
239
242
|
role: "group",
|
|
240
243
|
"aria-label": r.value.label,
|
|
@@ -246,13 +249,13 @@ const se = /* @__PURE__ */ _({
|
|
|
246
249
|
class: n.right()
|
|
247
250
|
}, [(t.search || e.search) && a("div", {
|
|
248
251
|
class: n.search()
|
|
249
|
-
}, [
|
|
252
|
+
}, [w(l)]), t.filter && !e.multipleLine && a("div", {
|
|
250
253
|
class: n.filter()
|
|
251
254
|
}, [t.filter(l)]), t.actions && a("div", {
|
|
252
255
|
class: n.actions()
|
|
253
256
|
}, [t.actions(l)]), u && a("div", {
|
|
254
257
|
class: n.settings()
|
|
255
|
-
}, [t.settings ? t.settings(l) :
|
|
258
|
+
}, [t.settings ? t.settings(l) : P()])]), t.filter && e.multipleLine && a("div", {
|
|
256
259
|
class: n.extra()
|
|
257
260
|
}, [t.filter(l)]), t.extra && a("div", {
|
|
258
261
|
class: n.extra()
|
|
@@ -261,5 +264,5 @@ const se = /* @__PURE__ */ _({
|
|
|
261
264
|
}
|
|
262
265
|
});
|
|
263
266
|
export {
|
|
264
|
-
|
|
267
|
+
ve as default
|
|
265
268
|
};
|
|
@@ -123,6 +123,8 @@ export interface SubThemeSlots {
|
|
|
123
123
|
* 所有后代组件(TableCell、TableHeaderCell 等)通过 inject 获取。
|
|
124
124
|
*/
|
|
125
125
|
export interface TableContext {
|
|
126
|
+
/** 表格根元素(含 title、footer 与分页),供 title / footer 内的工具栏作为默认全屏目标。 */
|
|
127
|
+
rootElement?: () => HTMLElement | null;
|
|
126
128
|
renderers?: ComputedRef<TableFieldRenderers<Record<string, unknown>> | undefined>;
|
|
127
129
|
isTreeLoading?: (key: Key) => boolean;
|
|
128
130
|
getTreeLoadError?: (key: Key) => Error | undefined;
|