@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.
Files changed (49) hide show
  1. package/css/index.css +15 -0
  2. package/css/style.css +32 -2
  3. package/css/tailwind3-utilities.css +17 -2
  4. package/css/tailwind3.css +15 -0
  5. package/css/tailwind4.css +15 -0
  6. package/dist/core/src/components/Tooltip.d.ts.map +1 -1
  7. package/dist/core/src/components/Tooltip.mjs +111 -94
  8. package/dist/core/src/index.d.ts +1 -0
  9. package/dist/core/src/index.d.ts.map +1 -1
  10. package/dist/core/src/utils/fullscreen.d.ts +8 -0
  11. package/dist/core/src/utils/fullscreen.d.ts.map +1 -0
  12. package/dist/core/src/utils/fullscreen.mjs +8 -0
  13. package/dist/css/index.css +15 -0
  14. package/dist/css/style.css +32 -2
  15. package/dist/css/tailwind3-utilities.css +17 -2
  16. package/dist/css/tailwind3.css +15 -0
  17. package/dist/css/tailwind4.css +15 -0
  18. package/dist/index.full.mjs +4666 -4623
  19. package/dist/index.mjs +155 -153
  20. package/dist/table/src/components/Table.d.ts.map +1 -1
  21. package/dist/table/src/components/Table.mjs +14 -13
  22. package/dist/table/src/components/TablePopup.d.ts.map +1 -1
  23. package/dist/table/src/components/TablePopup.mjs +34 -30
  24. package/dist/table/src/components/TableQuery.d.ts.map +1 -1
  25. package/dist/table/src/components/TableQuery.mjs +60 -58
  26. package/dist/table/src/components/TableToolbar.d.ts +2 -2
  27. package/dist/table/src/components/TableToolbar.d.ts.map +1 -1
  28. package/dist/table/src/components/TableToolbar.mjs +95 -92
  29. package/dist/table/src/context.d.ts +2 -0
  30. package/dist/table/src/context.d.ts.map +1 -1
  31. package/dist/table/src/controls.d.ts.map +1 -1
  32. package/dist/table/src/types/controls.d.ts +4 -0
  33. package/dist/table/src/types/controls.d.ts.map +1 -1
  34. package/dist/table/src/types/editable.d.ts +4 -3
  35. package/dist/table/src/types/editable.d.ts.map +1 -1
  36. package/dist/table/src/types/query-form.d.ts +4 -2
  37. package/dist/table/src/types/query-form.d.ts.map +1 -1
  38. package/dist/table/src/types/query-form.typecheck.d.ts +15 -0
  39. package/dist/table/src/types/query-form.typecheck.d.ts.map +1 -1
  40. package/dist/table/src/types/toolbar.d.ts +6 -1
  41. package/dist/table/src/types/toolbar.d.ts.map +1 -1
  42. package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
  43. package/dist/theme/src/presets/antdv/table.mjs +4 -1
  44. package/dist/theme/src/presets/element-plus/table.d.ts.map +1 -1
  45. package/dist/theme/src/presets/element-plus/table.mjs +4 -1
  46. package/dist/theme/src/query.d.ts +61 -33
  47. package/dist/theme/src/query.d.ts.map +1 -1
  48. package/dist/theme/src/query.mjs +20 -13
  49. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
- import { defineComponent as ee, inject as te, computed as f, useId as ae, ref as G, watch as ne, onBeforeUnmount as le, createVNode as n, mergeProps as ue, toValue as C, Fragment as re, nextTick as oe } from "vue";
2
- import { useTheme as se } from "../../../core/src/composables/useTheme.mjs";
3
- import D from "../../../core/src/components/Button.mjs";
4
- import { VTABLE_GUILD_INJECTION_KEY as ie } from "../../../core/src/plugin/index.mjs";
5
- import { resolveQueryThemePreset as de, queryEnUS as ce, queryZhCN as fe } from "../../../theme/src/query.mjs";
6
- import { snapshot as J } from "../utils/snapshot.mjs";
7
- import { stateEqual as K } from "../utils/stateEqual.mjs";
8
- const Te = /* @__PURE__ */ ee({
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: "form"
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: R,
63
- slots: F,
64
- emit: I,
65
- expose: Y
62
+ attrs: Z,
63
+ slots: I,
64
+ emit: _,
65
+ expose: z
66
66
  }) {
67
- const _ = te(ie, null), {
67
+ const U = ne(ce, null), {
68
68
  slots: r
69
- } = se("query", f(() => de(_?.themePreset)), e), v = f(() => ({
70
- ..._?.locale === "en-US" ? ce : fe,
69
+ } = de("query", y(() => ye(U?.themePreset)), e), v = y(() => ({
70
+ ...U?.locale === "en-US" ? fe : me,
71
71
  ...e.locale
72
- })), Z = ae(), q = G(!1), b = G();
73
- let S, x, y = 0, m = !1, P, g, j;
74
- const A = f(() => [...e.fields].sort((a, t) => (a.order ?? 0) - (t.order ?? 0))), E = (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
- }), U = (a) => typeof a.hidden == "function" ? a.hidden(E(a)) : !!a.hidden, O = f(() => A.value.filter((a) => !U(a))), M = f(() => Math.max(1, Math.floor(e.collapsedCount || 1))), Q = f(() => e.collapsible && O.value.length > M.value), z = f(() => Q.value && e.query.collapsed.value ? O.value.slice(0, M.value) : O.value), B = f(() => e.disabled || q.value || e.query.submitting.value);
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
- ne(() => [e.layout, e.autoSubmit, e.disabled], N, {
81
+ ue(() => [e.layout, e.autoSubmit, e.disabled], N, {
82
82
  flush: "sync"
83
83
  });
84
84
  function k() {
85
- N(), y++, x?.abort(), j?.(!1), j = void 0, x = void 0, q.value = !1, P = void 0, g = void 0;
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 H() {
87
+ function X() {
88
88
  return e.hiddenPolicy === "omit" ? {
89
- omitFields: A.value.filter(U).map((a) => a.name)
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 = y, l = new AbortController();
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 = J(e.query.draft.value), i = H();
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
- }), j = d, (async () => {
103
+ }), O = d, (async () => {
104
104
  let u = !1;
105
105
  try {
106
- if (a === "reset" && await oe(), m || t !== y || l.signal.aborted) return !1;
106
+ if (a === "reset" && await ie(), m || t !== f || l.signal.aborted) return !1;
107
107
  const o = await e.validate?.(s, {
108
- fields: O.value,
108
+ fields: j.value,
109
109
  action: a,
110
110
  signal: l.signal
111
111
  });
112
- return m || t !== y || l.signal.aborted ? !1 : o === !1 ? (b.value = v.value.validationFailed, !1) : !K(s, e.query.draft.value) || (q.value = !1, u = await (a === "reset" ? e.query.reset(i) : e.query.submit(i)), m || t !== y) ? !1 : (I(a === "reset" ? "reset" : "submitted", u), u);
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 === y && (b.value = o instanceof Error ? o.message : String(o)), !1;
114
+ return !m && t === f && (b.value = o instanceof Error ? o.message : String(o)), !1;
115
115
  } finally {
116
- t === y && (q.value = !1, P = void 0, x = void 0, g = void 0, j = void 0);
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 W(a, t) {
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 || K(e.query.draft.value[a.name], t)) return;
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]: J(t)
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
- le(() => {
133
+ re(() => {
134
134
  m = !0, k();
135
135
  });
136
- const V = {
136
+ const $ = {
137
137
  submit: () => h("submit"),
138
138
  reset: () => h("reset"),
139
139
  cancel: k
140
140
  };
141
- return Y(V), () => {
141
+ return z($), () => {
142
142
  const a = e.rootTag;
143
- return n(a, ue(R, {
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
- }, [z.value.map((t) => {
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];
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((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({
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: L,
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) => W(t, 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
- }, X = e.controls[t.valueType ?? "text"] ?? e.controls.text;
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
- }, [F.field?.({
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
- }) ?? X?.($), i ? n("div", {
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
- }, [F.actions?.({
202
- ...V,
203
+ }, [I.actions?.({
204
+ ...$,
203
205
  submitting: B.value,
204
206
  collapsed: e.query.collapsed.value,
205
207
  toggleCollapsed: e.query.toggleCollapsed
206
- }) ?? n(re, null, [n(D, {
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(D, {
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
- }), Q.value ? n(D, {
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
- Te as default
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: string;
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: string;
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;AAeZ,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,iBAAi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as w, onMounted as A, onBeforeUnmount as U, watch as k, createVNode as a, Fragment as N, mergeProps as D } from "vue";
2
- import { useTheme as R } from "../../../core/src/composables/useTheme.mjs";
3
- import I from "../../../core/src/components/Tooltip.mjs";
4
- import Z from "../../../core/src/components/Input.mjs";
5
- import { VTABLE_GUILD_INJECTION_KEY as q } from "../../../core/src/plugin/index.mjs";
6
- import G from "../../../icons/src/SearchIcon.mjs";
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 J from "../../../icons/src/FullscreenOutlinedIcon.mjs";
9
- import K from "../../../icons/src/FullscreenExitOutlinedIcon.mjs";
10
- import { resolveToolbarThemePreset as Y, toolbarZhCN as H } from "../../../theme/src/toolbar.mjs";
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 X from "./TableColumnSettings.mjs";
13
- const se = /* @__PURE__ */ _({
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: c,
56
+ emit: i,
56
57
  slots: t
57
58
  }) {
58
- const d = j(q, null), v = o(() => d?.themePreset ?? "antdv"), {
59
+ const o = B(G, null), F = B(p, null), v = s(() => o?.themePreset ?? "antdv"), {
59
60
  slots: n
60
- } = R("toolbar", o(() => Y(v.value)), e), C = o(() => {
61
+ } = Z("toolbar", s(() => X(v.value)), e), I = s(() => {
61
62
  if (e.size) return e.size;
62
- const l = d?.theme.table?.defaultVariants?.size;
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 = o(() => ({
65
+ }), r = s(() => ({
65
66
  ...H,
66
- ...W(v.value, d?.locale)?.toolbar,
67
- ...d?.locales[d.locale]?.toolbar,
68
- ...d?.localeOverrides.toolbar,
67
+ ...W(v.value, o?.locale)?.toolbar,
68
+ ...o?.locales[o.locale]?.toolbar,
69
+ ...o?.localeOverrides.toolbar,
69
70
  ...e.locale
70
- })), i = o(() => {
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
- }), g = F(!1), h = w(null), b = F(!1), s = o(() => !!h.value && h.value === e.fullscreenTarget?.()), y = o(() => g.value && typeof e.fullscreenTarget?.()?.requestFullscreen == "function" && typeof document.exitFullscreen == "function");
81
- function z() {
82
- return document.body;
81
+ }), b = L(!1), S = N(null), m = L(!1);
82
+ function y() {
83
+ return e.fullscreenTarget ? e.fullscreenTarget() : F?.rootElement?.();
83
84
  }
84
- function E() {
85
- return e.fullscreenTarget?.() ?? document.body;
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
- const P = o(() => e.columnSettings?.getPopupContainer ?? (s.value ? E : z));
88
- function m() {
89
- h.value = document.fullscreenElement;
90
- }
91
- A(() => {
92
- g.value = !0, m(), document.addEventListener("fullscreenchange", m);
93
- }), U(() => {
94
- g.value && document.removeEventListener("fullscreenchange", m);
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
- function x(l) {
100
- e.disabled || c("update:searchValue", l);
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 S(l = e.searchValue) {
103
- !e.disabled && !e.loading && c("search", l);
106
+ function C(l = g.value) {
107
+ !e.disabled && !e.loading && i("search", l);
104
108
  }
105
- function L() {
106
- e.disabled || e.loading || (c("update:searchValue", ""), c("clearSearch"));
109
+ function O() {
110
+ e.disabled || e.loading || (E(""), i("clearSearch"), i("search", ""));
107
111
  }
108
- function O(l) {
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(Z, {
122
+ }, [a(q, {
119
123
  bare: !0,
120
- value: e.searchValue,
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": x,
131
+ "onUpdate:value": E,
128
132
  onPressEnter: (f) => {
129
- f.isComposing || (f.preventDefault(), S());
133
+ f.isComposing || (f.preventDefault(), C());
130
134
  }
131
- }, null), u?.clearable !== !1 && e.searchValue && a("button", {
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: L
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: () => S()
154
- }, [a(G, {
157
+ onClick: () => C()
158
+ }, [a(K, {
155
159
  class: n.searchIcon(),
156
160
  "aria-hidden": "true"
157
161
  }, null)])]);
158
162
  }
159
- async function V() {
160
- if (e.disabled || b.value || !y.value) return;
161
- const l = e.fullscreenTarget?.();
163
+ async function _() {
164
+ if (e.disabled || m.value || !T.value) return;
165
+ const l = y();
162
166
  if (l) {
163
- b.value = !0;
167
+ m.value = !0;
164
168
  try {
165
- document.fullscreenElement === l ? await document.exitFullscreen() : await l.requestFullscreen(), m();
169
+ document.fullscreenElement === l ? await document.exitFullscreen() : await l.requestFullscreen(), h();
166
170
  } catch (u) {
167
- c("fullscreenError", u);
171
+ i("fullscreenError", u);
168
172
  } finally {
169
- b.value = !1;
173
+ m.value = !1;
170
174
  }
171
175
  }
172
176
  }
173
- function B() {
174
- const l = i.value.setting && e.columns !== void 0, u = i.value.density;
175
- return a(N, null, [i.value.reload && a(I, {
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: T
188
+ onClick: z
185
189
  }, [a(M, {
186
190
  class: e.loading ? n.loadingIcon() : n.icon()
187
191
  }, null)])]
188
- }), (l || u) && a(X, D(e.columnSettings, {
189
- getPopupContainer: P.value,
192
+ }), (l || u) && a($, R(e.columnSettings, {
190
193
  columns: e.columns ?? [],
191
- size: C.value,
194
+ size: I.value,
192
195
  options: {
193
196
  density: u,
194
197
  setting: l,
195
- fixed: i.value.fixed,
196
- draggable: i.value.draggable
198
+ fixed: c.value.fixed,
199
+ draggable: c.value.draggable
197
200
  },
198
201
  disabled: e.disabled,
199
- "onUpdate:columns": (f) => c("update:columns", f),
200
- "onUpdate:size": (f) => c("update:size", f),
201
- onReset: () => c("reset")
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
- }), i.value.fullScreen && a(I, {
205
- title: s.value ? r.value.exitFullScreen : r.value.fullScreen
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 || !y.value || b.value,
211
- "aria-label": s.value ? r.value.exitFullScreen : r.value.fullScreen,
212
- "aria-pressed": s.value,
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
- V();
217
+ _();
215
218
  }
216
- }, [s.value ? a(K, {
219
+ }, [d.value ? a(J, {
217
220
  class: n.icon()
218
- }, null) : a(J, {
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: C.value,
229
+ size: I.value,
227
230
  loading: e.loading,
228
231
  disabled: e.disabled,
229
- fullscreen: s.value,
230
- fullscreenAvailable: y.value,
231
- reload: T,
232
- toggleFullscreen: V,
233
- searchValue: e.searchValue,
234
- updateSearchValue: x,
235
- submitSearch: S,
236
- clearSearch: L
237
- }, u = t.settings || i.value.reload || i.value.density || i.value.setting && e.columns !== void 0 || i.value.fullScreen;
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
- }, [O(l)]), t.filter && !e.multipleLine && a("div", {
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) : B()])]), t.filter && e.multipleLine && a("div", {
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
- se as default
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;