@vtable-guild/vtable-guild 2.9.0-alpha.9 → 3.0.0

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