@vtable-guild/vtable-guild 2.9.0-alpha.1 → 2.9.0-alpha.2

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 (135) hide show
  1. package/css/presets/antdv.css +10 -0
  2. package/css/presets/element-plus.css +10 -0
  3. package/css/style.css +138 -0
  4. package/css/tailwind3-utilities.css +118 -0
  5. package/css/tailwind3.css +20 -0
  6. package/css/tailwind4.css +20 -0
  7. package/dist/core/src/components/Button.d.ts +9 -0
  8. package/dist/core/src/components/Button.d.ts.map +1 -1
  9. package/dist/core/src/components/Button.mjs +11 -6
  10. package/dist/css/presets/antdv.css +10 -0
  11. package/dist/css/presets/element-plus.css +10 -0
  12. package/dist/css/style.css +138 -0
  13. package/dist/css/tailwind3-utilities.css +118 -0
  14. package/dist/css/tailwind3.css +20 -0
  15. package/dist/css/tailwind4.css +20 -0
  16. package/dist/icons/src/CheckCircleFilledIcon.d.ts +3 -0
  17. package/dist/icons/src/CheckCircleFilledIcon.d.ts.map +1 -0
  18. package/dist/icons/src/CheckCircleFilledIcon.mjs +9 -0
  19. package/dist/icons/src/CloseCircleFilledIcon.d.ts +3 -0
  20. package/dist/icons/src/CloseCircleFilledIcon.d.ts.map +1 -0
  21. package/dist/icons/src/CloseCircleFilledIcon.mjs +9 -0
  22. package/dist/icons/src/index.d.ts +2 -0
  23. package/dist/icons/src/index.d.ts.map +1 -1
  24. package/dist/index.full.mjs +6479 -5272
  25. package/dist/index.mjs +118 -98
  26. package/dist/table/src/components/Table.d.ts +3 -3
  27. package/dist/table/src/components/Table.d.ts.map +1 -1
  28. package/dist/table/src/components/Table.mjs +153 -149
  29. package/dist/table/src/components/TableCell.d.ts.map +1 -1
  30. package/dist/table/src/components/TableCell.mjs +109 -86
  31. package/dist/table/src/components/TableEditableCell.d.ts +29 -0
  32. package/dist/table/src/components/TableEditableCell.d.ts.map +1 -0
  33. package/dist/table/src/components/TableEditableCell.mjs +39 -0
  34. package/dist/table/src/components/TableEditableCell.test.d.ts +2 -0
  35. package/dist/table/src/components/TableEditableCell.test.d.ts.map +1 -0
  36. package/dist/table/src/components/TableQuery.d.ts +108 -0
  37. package/dist/table/src/components/TableQuery.d.ts.map +1 -0
  38. package/dist/table/src/components/TableQuery.mjs +244 -0
  39. package/dist/table/src/components/TableQuery.test.d.ts +2 -0
  40. package/dist/table/src/components/TableQuery.test.d.ts.map +1 -0
  41. package/dist/table/src/components/VTableEditCell.vue.d.ts +19 -0
  42. package/dist/table/src/components/VTableEditCell.vue.d.ts.map +1 -0
  43. package/dist/table/src/components/VTableEditCell.vue.mjs +21 -0
  44. package/dist/table/src/components/VTableEditCell.vue2.mjs +4 -0
  45. package/dist/table/src/components/VTableQuery.vue.d.ts +18 -0
  46. package/dist/table/src/components/VTableQuery.vue.d.ts.map +1 -0
  47. package/dist/table/src/components/VTableQuery.vue.mjs +64 -0
  48. package/dist/table/src/components/VTableQuery.vue2.mjs +4 -0
  49. package/dist/table/src/composables/useTableDictionary.d.ts +5 -0
  50. package/dist/table/src/composables/useTableDictionary.d.ts.map +1 -0
  51. package/dist/table/src/composables/useTableDictionary.mjs +168 -0
  52. package/dist/table/src/composables/useTableDictionary.test.d.ts +2 -0
  53. package/dist/table/src/composables/useTableDictionary.test.d.ts.map +1 -0
  54. package/dist/table/src/composables/useTableEdit.d.ts.map +1 -1
  55. package/dist/table/src/composables/useTableEdit.mjs +352 -135
  56. package/dist/table/src/composables/useTableEditable.d.ts +4 -0
  57. package/dist/table/src/composables/useTableEditable.d.ts.map +1 -0
  58. package/dist/table/src/composables/useTableEditable.mjs +125 -0
  59. package/dist/table/src/composables/useTableEditable.test.d.ts +2 -0
  60. package/dist/table/src/composables/useTableEditable.test.d.ts.map +1 -0
  61. package/dist/table/src/composables/useTableQuery.d.ts.map +1 -1
  62. package/dist/table/src/composables/useTableQuery.mjs +33 -33
  63. package/dist/table/src/composables/useTableRequest.d.ts.map +1 -1
  64. package/dist/table/src/composables/useTableRequest.mjs +138 -97
  65. package/dist/table/src/composables/useTableRequest.polling.test.d.ts +2 -0
  66. package/dist/table/src/composables/useTableRequest.polling.test.d.ts.map +1 -0
  67. package/dist/table/src/context.d.ts +4 -0
  68. package/dist/table/src/context.d.ts.map +1 -1
  69. package/dist/table/src/controls.d.ts +4 -0
  70. package/dist/table/src/controls.d.ts.map +1 -0
  71. package/dist/table/src/controls.mjs +97 -0
  72. package/dist/table/src/controls.test.d.ts +2 -0
  73. package/dist/table/src/controls.test.d.ts.map +1 -0
  74. package/dist/table/src/index.d.ts +10 -0
  75. package/dist/table/src/index.d.ts.map +1 -1
  76. package/dist/table/src/renderers.d.ts.map +1 -1
  77. package/dist/table/src/renderers.mjs +88 -23
  78. package/dist/table/src/review-current.repro.test.d.ts +2 -0
  79. package/dist/table/src/review-current.repro.test.d.ts.map +1 -0
  80. package/dist/table/src/types/column.d.ts +4 -1
  81. package/dist/table/src/types/column.d.ts.map +1 -1
  82. package/dist/table/src/types/controls.d.ts +31 -0
  83. package/dist/table/src/types/controls.d.ts.map +1 -0
  84. package/dist/table/src/types/dictionary.d.ts +71 -0
  85. package/dist/table/src/types/dictionary.d.ts.map +1 -0
  86. package/dist/table/src/types/dictionary.typecheck.d.ts +6 -0
  87. package/dist/table/src/types/dictionary.typecheck.d.ts.map +1 -0
  88. package/dist/table/src/types/editable.d.ts +49 -0
  89. package/dist/table/src/types/editable.d.ts.map +1 -0
  90. package/dist/table/src/types/editable.typecheck.d.ts +15 -0
  91. package/dist/table/src/types/editable.typecheck.d.ts.map +1 -0
  92. package/dist/table/src/types/editing.d.ts +41 -4
  93. package/dist/table/src/types/editing.d.ts.map +1 -1
  94. package/dist/table/src/types/editing.typecheck.d.ts.map +1 -1
  95. package/dist/table/src/types/index.d.ts +4 -0
  96. package/dist/table/src/types/index.d.ts.map +1 -1
  97. package/dist/table/src/types/query-form.d.ts +90 -0
  98. package/dist/table/src/types/query-form.d.ts.map +1 -0
  99. package/dist/table/src/types/query-form.typecheck.d.ts +10 -0
  100. package/dist/table/src/types/query-form.typecheck.d.ts.map +1 -0
  101. package/dist/table/src/types/query.d.ts +6 -2
  102. package/dist/table/src/types/query.d.ts.map +1 -1
  103. package/dist/table/src/types/renderers.d.ts +15 -3
  104. package/dist/table/src/types/renderers.d.ts.map +1 -1
  105. package/dist/table/src/types/request.d.ts +20 -2
  106. package/dist/table/src/types/request.d.ts.map +1 -1
  107. package/dist/table/src/types/request.typecheck.d.ts.map +1 -1
  108. package/dist/table/src/utils/cell.d.ts +3 -2
  109. package/dist/table/src/utils/cell.d.ts.map +1 -1
  110. package/dist/table/src/utils/cell.mjs +45 -44
  111. package/dist/table/src/utils/fieldPath.d.ts +6 -0
  112. package/dist/table/src/utils/fieldPath.d.ts.map +1 -0
  113. package/dist/table/src/utils/fieldPath.mjs +29 -0
  114. package/dist/table/src/utils/queryFields.d.ts +4 -0
  115. package/dist/table/src/utils/queryFields.d.ts.map +1 -0
  116. package/dist/table/src/utils/queryFields.mjs +31 -0
  117. package/dist/table/src/utils/queryFields.test.d.ts +2 -0
  118. package/dist/table/src/utils/queryFields.test.d.ts.map +1 -0
  119. package/dist/table/src/utils/stateEqual.d.ts +3 -0
  120. package/dist/table/src/utils/stateEqual.d.ts.map +1 -0
  121. package/dist/table/src/utils/stateEqual.mjs +15 -0
  122. package/dist/theme/src/index.d.ts +4 -0
  123. package/dist/theme/src/index.d.ts.map +1 -1
  124. package/dist/theme/src/presets/antdv/table.d.ts +7 -0
  125. package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
  126. package/dist/theme/src/presets/antdv/table.mjs +7 -0
  127. package/dist/theme/src/presets/element-plus/table.d.ts +7 -0
  128. package/dist/theme/src/presets/element-plus/table.d.ts.map +1 -1
  129. package/dist/theme/src/presets/element-plus/table.mjs +7 -0
  130. package/dist/theme/src/query.d.ts +128 -0
  131. package/dist/theme/src/query.d.ts.map +1 -0
  132. package/dist/theme/src/query.mjs +56 -0
  133. package/dist/vtable-guild/src/augment.d.ts +2 -1
  134. package/dist/vtable-guild/src/augment.d.ts.map +1 -1
  135. package/package.json +1 -1
@@ -0,0 +1,244 @@
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({
9
+ name: "TableQuery",
10
+ inheritAttrs: !1,
11
+ props: {
12
+ query: {
13
+ type: Object,
14
+ required: !0
15
+ },
16
+ rootTag: {
17
+ type: String,
18
+ default: "form"
19
+ },
20
+ fields: {
21
+ type: Array,
22
+ required: !0
23
+ },
24
+ controls: {
25
+ type: Object,
26
+ required: !0
27
+ },
28
+ layout: {
29
+ type: String,
30
+ default: "form"
31
+ },
32
+ autoSubmit: Boolean,
33
+ debounceTime: {
34
+ type: Number,
35
+ default: 0
36
+ },
37
+ hiddenPolicy: {
38
+ type: String,
39
+ default: "preserve"
40
+ },
41
+ collapsedCount: {
42
+ type: Number,
43
+ default: 3
44
+ },
45
+ collapsible: {
46
+ type: Boolean,
47
+ default: !0
48
+ },
49
+ disabled: Boolean,
50
+ validate: Function,
51
+ errors: Object,
52
+ locale: Object,
53
+ ui: Object,
54
+ class: String
55
+ },
56
+ emits: {
57
+ submitted: (e) => !0,
58
+ reset: (e) => !0
59
+ },
60
+ slots: Object,
61
+ setup(e, {
62
+ attrs: R,
63
+ slots: F,
64
+ emit: I,
65
+ expose: Y
66
+ }) {
67
+ const _ = te(ie, null), {
68
+ slots: r
69
+ } = se("query", f(() => de(_?.themePreset)), e), v = f(() => ({
70
+ ..._?.locale === "en-US" ? ce : fe,
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) => ({
75
+ field: a,
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);
78
+ function N() {
79
+ clearTimeout(S), S = void 0;
80
+ }
81
+ ne(() => [e.layout, e.autoSubmit, e.disabled], N, {
82
+ flush: "sync"
83
+ });
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;
86
+ }
87
+ function H() {
88
+ return e.hiddenPolicy === "omit" ? {
89
+ omitFields: A.value.filter(U).map((a) => a.name)
90
+ } : void 0;
91
+ }
92
+ function h(a) {
93
+ if (m || e.disabled) return Promise.resolve(!1);
94
+ if (N(), g && P === a) return g;
95
+ k();
96
+ const t = y, l = new AbortController();
97
+ x = l, P = a, b.value = void 0, a === "reset" && e.query.resetFields();
98
+ const s = J(e.query.draft.value), i = H();
99
+ q.value = !0;
100
+ let d;
101
+ return g = new Promise((u) => {
102
+ d = u;
103
+ }), j = d, (async () => {
104
+ let u = !1;
105
+ try {
106
+ if (a === "reset" && await oe(), m || t !== y || l.signal.aborted) return !1;
107
+ const o = await e.validate?.(s, {
108
+ fields: O.value,
109
+ action: a,
110
+ signal: l.signal
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);
113
+ } catch (o) {
114
+ return !m && t === y && (b.value = o instanceof Error ? o.message : String(o)), !1;
115
+ } finally {
116
+ t === y && (q.value = !1, P = void 0, x = void 0, g = void 0, j = void 0);
117
+ }
118
+ })().then(d), g;
119
+ }
120
+ function W(a, t) {
121
+ a = A.value.find((u) => u.name === a.name) ?? a;
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;
124
+ k(), b.value = void 0;
125
+ const d = e.query.draft;
126
+ d.value = {
127
+ ...d.value,
128
+ [a.name]: J(t)
129
+ }, e.layout === "light" && e.autoSubmit && (S = setTimeout(() => {
130
+ S = void 0, !m && e.layout === "light" && e.autoSubmit && !e.disabled && h("submit");
131
+ }, Math.max(0, e.debounceTime)));
132
+ }
133
+ le(() => {
134
+ m = !0, k();
135
+ });
136
+ const V = {
137
+ submit: () => h("submit"),
138
+ reset: () => h("reset"),
139
+ cancel: k
140
+ };
141
+ return Y(V), () => {
142
+ const a = e.rootTag;
143
+ return n(a, ue(R, {
144
+ class: r.root(),
145
+ "aria-label": v.value.label,
146
+ onSubmit: (t) => {
147
+ t.preventDefault(), h("submit");
148
+ }
149
+ }), {
150
+ default: () => [n("div", {
151
+ 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];
154
+ for (const c of Array.isArray(w) ? w : [w]) {
155
+ if (!t.dictionary || !["string", "number", "boolean"].includes(typeof c) || o.some((p) => Object.is(p.value, c))) continue;
156
+ const T = C(t.dictionary.valueEnum).get(c), L = typeof T == "string" ? T : T?.text;
157
+ typeof L == "string" && o.push({
158
+ value: c,
159
+ label: L,
160
+ ...typeof T == "object" ? {
161
+ status: T.status
162
+ } : {}
163
+ });
164
+ }
165
+ const $ = {
166
+ value: w,
167
+ onChange: (c) => W(t, c),
168
+ fieldProps: typeof t.fieldProps == "function" ? t.fieldProps(l) : t.fieldProps ?? {},
169
+ options: o,
170
+ disabled: u,
171
+ readonly: d,
172
+ loading: C(t.dictionary?.loading) ?? !1,
173
+ error: i,
174
+ id: s,
175
+ name: t.name,
176
+ mode: "query",
177
+ onSearch: t.dictionary ? (c) => {
178
+ t.dictionary.search(c);
179
+ } : void 0
180
+ }, X = e.controls[t.valueType ?? "text"] ?? e.controls.text;
181
+ return n("div", {
182
+ key: t.name,
183
+ class: r.field(),
184
+ "data-query-field": t.name
185
+ }, [n("label", {
186
+ class: r.label(),
187
+ for: s
188
+ }, [t.label ?? t.name]), n("div", {
189
+ class: r.control()
190
+ }, [F.field?.({
191
+ field: t,
192
+ values: e.query.draft.value,
193
+ control: $
194
+ }) ?? X?.($), i ? n("div", {
195
+ class: r.error(),
196
+ role: "alert",
197
+ id: `${s}-error`
198
+ }, [i]) : null])]);
199
+ })]), n("div", {
200
+ class: r.actions()
201
+ }, [F.actions?.({
202
+ ...V,
203
+ submitting: B.value,
204
+ collapsed: e.query.collapsed.value,
205
+ toggleCollapsed: e.query.toggleCollapsed
206
+ }) ?? n(re, null, [n(D, {
207
+ htmlType: "button",
208
+ disabled: B.value,
209
+ onClick: (t) => {
210
+ t.preventDefault(), h("reset");
211
+ }
212
+ }, {
213
+ default: () => [v.value.reset]
214
+ }), n(D, {
215
+ type: "primary",
216
+ htmlType: e.rootTag === "form" ? "submit" : "button",
217
+ disabled: B.value,
218
+ onClick: (t) => {
219
+ t.preventDefault(), h("submit");
220
+ }
221
+ }, {
222
+ default: () => [v.value.submit]
223
+ }), Q.value ? n(D, {
224
+ type: "link",
225
+ htmlType: "button",
226
+ disabled: e.disabled,
227
+ class: r.collapse(),
228
+ onClick: (t) => {
229
+ t.preventDefault(), e.query.toggleCollapsed();
230
+ },
231
+ "aria-expanded": !e.query.collapsed.value
232
+ }, {
233
+ default: () => [e.query.collapsed.value ? v.value.expand : v.value.collapse]
234
+ }) : null])]), b.value || e.query.error.value ? n("div", {
235
+ class: r.feedback(),
236
+ role: "alert"
237
+ }, [b.value ?? e.query.error.value?.message]) : null]
238
+ });
239
+ };
240
+ }
241
+ });
242
+ export {
243
+ Te as default
244
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TableQuery.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableQuery.test.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/TableQuery.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import { UseTableEditableReturn } from '../types/editable';
2
+ import { TableBodyCellSlotProps } from '../types/table';
3
+ declare const _default: <TRecord extends object = Record<string, unknown>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & {
5
+ edit: Pick<UseTableEditableReturn<TRecord>, "renderEditor">;
6
+ cell: TableBodyCellSlotProps<TRecord>;
7
+ } & Partial<{}>> & import('vue').PublicProps;
8
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
9
+ attrs: any;
10
+ slots: {};
11
+ emit: {};
12
+ }>) => import('vue').VNode & {
13
+ __ctx?: Awaited<typeof __VLS_setup>;
14
+ };
15
+ export default _default;
16
+ type __VLS_PrettifyLocal<T> = {
17
+ [K in keyof T]: T[K];
18
+ } & {};
19
+ //# sourceMappingURL=VTableEditCell.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VTableEditCell.vue.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/VTableEditCell.vue"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;yBAE3C,OAAO,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChE,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,eAAe,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EACjE;WA6DO,mBAAmB,CAAC;cA1DpB,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC;cACrD,sBAAsB,CAAC,OAAO,CAAC;mBAyDuD,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;UAEJ,EAAE;EAEL,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AAxEzE,wBAwE4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { defineComponent as n, createBlock as r, openBlock as c } from "vue";
2
+ const i = /* @__PURE__ */ n({
3
+ name: "VTableEditCell",
4
+ inheritAttrs: !1,
5
+ __name: "VTableEditCell",
6
+ props: {
7
+ edit: {},
8
+ cell: {}
9
+ },
10
+ setup(t) {
11
+ const e = t, l = () => e.edit.renderEditor({
12
+ ...e.cell,
13
+ value: e.cell.text,
14
+ renderIndex: e.cell.index
15
+ });
16
+ return (o, d) => (c(), r(l));
17
+ }
18
+ });
19
+ export {
20
+ i as default
21
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./VTableEditCell.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,18 @@
1
+ import { TableQueryInstance, TableQueryProps, TableQuerySlots } from '../types/query-form';
2
+ declare const _default: <TValues extends object = Record<string, unknown>, TParams extends object = TValues>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
4
+ readonly onReset?: ((success: boolean) => any) | undefined;
5
+ readonly onSubmitted?: ((success: boolean) => any) | undefined;
6
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onReset" | "onSubmitted"> & TableQueryProps<TValues, TParams> & Partial<{}>> & import('vue').PublicProps;
7
+ expose(exposed: import('vue').ShallowUnwrapRef<TableQueryInstance>): void;
8
+ attrs: any;
9
+ slots: Readonly<TableQuerySlots<TValues>> & TableQuerySlots<TValues>;
10
+ emit: ((evt: "reset", success: boolean) => void) & ((evt: "submitted", success: boolean) => void);
11
+ }>) => import('vue').VNode & {
12
+ __ctx?: Awaited<typeof __VLS_setup>;
13
+ };
14
+ export default _default;
15
+ type __VLS_PrettifyLocal<T> = {
16
+ [K in keyof T]: T[K];
17
+ } & {};
18
+ //# sourceMappingURL=VTableQuery.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VTableQuery.vue.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/VTableQuery.vue"],"names":[],"mappings":"AA+CA,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;yBAE9E,OAAO,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,SAAS,MAAM,GAAG,OAAO,EAClG,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,eAAe,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EACjE;WAqHO,mBAAmB,CAAC;;;iMAAkE,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,oBAAsB,GAAG,IAAI;WACpE,GAAG;;;EAIP,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AAhIzE,wBAgI4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { defineComponent as p, ref as c, createBlock as y, openBlock as b, unref as v, mergeProps as P, createSlots as T, withCtx as l, renderSlot as n, normalizeProps as i, guardReactiveProps as a } from "vue";
2
+ import k from "./TableQuery.mjs";
3
+ const g = /* @__PURE__ */ p({
4
+ name: "VTableQuery",
5
+ inheritAttrs: !1,
6
+ __name: "VTableQuery",
7
+ props: {
8
+ query: {},
9
+ rootTag: {},
10
+ fields: {},
11
+ controls: {},
12
+ layout: {},
13
+ autoSubmit: { type: Boolean },
14
+ debounceTime: {},
15
+ hiddenPolicy: {},
16
+ collapsedCount: {},
17
+ collapsible: { type: Boolean, default: !0 },
18
+ disabled: { type: Boolean },
19
+ validate: {},
20
+ errors: {},
21
+ locale: {},
22
+ ui: {},
23
+ class: {}
24
+ },
25
+ emits: ["submitted", "reset"],
26
+ setup(u, { expose: m, emit: d }) {
27
+ const f = u, r = d, t = c();
28
+ m({
29
+ submit: () => t.value?.submit() ?? Promise.resolve(!1),
30
+ reset: () => t.value?.reset() ?? Promise.resolve(!1),
31
+ cancel: () => t.value?.cancel()
32
+ });
33
+ function B(e) {
34
+ return e;
35
+ }
36
+ return (e, s) => (b(), y(v(k), P({
37
+ ref_key: "inner",
38
+ ref: t
39
+ }, { ...e.$attrs, ...f }, {
40
+ onSubmitted: s[0] || (s[0] = (o) => r("submitted", o)),
41
+ onReset: s[1] || (s[1] = (o) => r("reset", o))
42
+ }), T({ _: 2 }, [
43
+ e.$slots.field ? {
44
+ name: "field",
45
+ fn: l((o) => [
46
+ n(e.$slots, "field", i(a(
47
+ o
48
+ )))
49
+ ]),
50
+ key: "0"
51
+ } : void 0,
52
+ e.$slots.actions ? {
53
+ name: "actions",
54
+ fn: l((o) => [
55
+ n(e.$slots, "actions", i(a(o)))
56
+ ]),
57
+ key: "1"
58
+ } : void 0
59
+ ]), 1040));
60
+ }
61
+ });
62
+ export {
63
+ g as default
64
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./VTableQuery.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,5 @@
1
+ import { CreateTableDictionaryOptions, TableDictionary, UseTableDictionaryOptions, UseTableDictionaryReturn } from '../types/dictionary';
2
+ /** A cache is owned by this instance, never by a process-wide registry or a cell renderer. */
3
+ export declare function createTableDictionary<TParams extends object = Record<string, unknown>>(options: CreateTableDictionaryOptions<TParams>): TableDictionary<TParams>;
4
+ export declare function useTableDictionary<TParams extends object = Record<string, unknown>>(options: UseTableDictionaryOptions<TParams>): UseTableDictionaryReturn;
5
+ //# sourceMappingURL=useTableDictionary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTableDictionary.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableDictionary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,4BAA4B,EAC5B,eAAe,EAGf,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,qBAAqB,CAAA;AA+B5B,8FAA8F;AAC9F,wBAAgB,qBAAqB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpF,OAAO,EAAE,4BAA4B,CAAC,OAAO,CAAC,GAC7C,eAAe,CAAC,OAAO,CAAC,CAyG1B;AAED,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjF,OAAO,EAAE,yBAAyB,CAAC,OAAO,CAAC,GAC1C,wBAAwB,CAoI1B"}
@@ -0,0 +1,168 @@
1
+ import { ref as q, shallowRef as A, toValue as S, watch as K, getCurrentScope as L, onScopeDispose as Q, computed as E } from "vue";
2
+ import { snapshot as x } from "../utils/snapshot.mjs";
3
+ import { stateEqual as z } from "../utils/stateEqual.mjs";
4
+ function M() {
5
+ const e = new Error("Dictionary request cancelled");
6
+ return e.name = "AbortError", e;
7
+ }
8
+ function V(e, r) {
9
+ if (!e || !Array.isArray(e.options) || typeof e.complete != "boolean")
10
+ throw new Error("Dictionary request must return { options, complete }");
11
+ const d = /* @__PURE__ */ new Map();
12
+ for (const a of e.options) {
13
+ if (!a || !["string", "number", "boolean"].includes(typeof a.value) || typeof a.value == "number" && !Number.isFinite(a.value) || typeof a.label != "string")
14
+ throw new Error("Dictionary options require a primitive value and a string label");
15
+ d.set(a.value, { ...a });
16
+ }
17
+ return { options: [...d.values()], complete: e.complete && r === "" };
18
+ }
19
+ function H(e) {
20
+ if (!e.key.trim()) throw new Error("A stable dictionary key is required");
21
+ const r = [], d = Math.max(0, Number.isFinite(e.cacheTime) ? e.cacheTime : 3e5), a = Math.max(
22
+ 1,
23
+ Number.isFinite(e.maxEntries) ? Math.floor(e.maxEntries) : 50
24
+ ), m = (n) => {
25
+ const i = r.indexOf(n);
26
+ i >= 0 && r.splice(i, 1);
27
+ };
28
+ function b() {
29
+ for (const n of [...r])
30
+ !n.pending && (n.expires <= Date.now() || r.length > a) && m(n);
31
+ }
32
+ return Object.freeze({
33
+ key: e.key,
34
+ invalidate() {
35
+ r.splice(0);
36
+ },
37
+ load(n, { signal: i, keyword: v, force: y = !1 }) {
38
+ if (i.aborted) return Promise.reject(M());
39
+ b();
40
+ let s = r.find(
41
+ (t) => t.keyword === v && z(t.params, n)
42
+ );
43
+ if (s?.result && !y) return Promise.resolve(x(s.result));
44
+ if (!s?.pending) {
45
+ s && m(s);
46
+ const t = new AbortController(), f = x(n), o = {
47
+ params: f,
48
+ keyword: v,
49
+ expires: 0,
50
+ controller: t,
51
+ pending: !0,
52
+ users: /* @__PURE__ */ new Set(),
53
+ task: Promise.resolve().then(() => {
54
+ if (t.signal.aborted) throw M();
55
+ return e.request(x(f), { signal: t.signal, keyword: v });
56
+ }).then((u) => {
57
+ if (t.signal.aborted) throw M();
58
+ const p = V(u, v);
59
+ return o.pending = !1, o.result = p, o.expires = Date.now() + d, b(), p;
60
+ }).catch((u) => {
61
+ throw o.pending = !1, m(o), u;
62
+ })
63
+ };
64
+ r.push(o), s = o;
65
+ }
66
+ const l = s, h = /* @__PURE__ */ Symbol();
67
+ return l.users.add(h), new Promise((t, f) => {
68
+ function o() {
69
+ i.removeEventListener("abort", u), l.users.delete(h), !l.users.size && l.pending && (l.controller.abort(), m(l));
70
+ }
71
+ function u() {
72
+ o(), f(M());
73
+ }
74
+ i.addEventListener("abort", u, { once: !0 }), l.task.then(
75
+ (p) => {
76
+ o(), i.aborted ? f(M()) : t(x(p));
77
+ },
78
+ (p) => {
79
+ o(), f(p);
80
+ }
81
+ );
82
+ });
83
+ }
84
+ });
85
+ }
86
+ function I(e) {
87
+ const r = q(e.defaultKeyword ?? ""), d = A([]), a = A(/* @__PURE__ */ new Map()), m = q(!1), b = q(!1), n = A(null);
88
+ let i = x(S(e.params) ?? {}), v = !1, y = 0, s, l, h, t, f = Promise.resolve(!1);
89
+ function o() {
90
+ y++, clearTimeout(l), l = void 0, s?.abort(), s = void 0, t = void 0, h?.(!1), h = void 0, b.value = !1;
91
+ }
92
+ function u(c = !1, g = !1) {
93
+ if (v) return Promise.resolve(!1);
94
+ if (s && l === void 0 && t && t.keyword === r.value && z(t.params, i))
95
+ return f;
96
+ o();
97
+ const P = y, D = new AbortController();
98
+ s = D;
99
+ const C = x(i), F = r.value;
100
+ return t = { params: C, keyword: F }, b.value = !0, m.value = !1, n.value = null, f = new Promise((T) => {
101
+ h = T;
102
+ const N = async () => {
103
+ l = void 0;
104
+ try {
105
+ const w = await e.dictionary.load(C, {
106
+ keyword: F,
107
+ signal: D.signal,
108
+ force: g
109
+ });
110
+ if (v || P !== y) return;
111
+ d.value = w.options, m.value = w.complete;
112
+ const k = w.complete ? /* @__PURE__ */ new Map() : new Map(a.value);
113
+ for (const R of w.options) k.set(R.value, R);
114
+ a.value = k, T(!0);
115
+ } catch (w) {
116
+ if (!v && P === y && !D.signal.aborted) {
117
+ n.value = w instanceof Error ? w : new Error(String(w));
118
+ try {
119
+ e.onError?.(n.value);
120
+ } catch (k) {
121
+ n.value = k instanceof Error ? k : new Error(String(k));
122
+ }
123
+ }
124
+ T(!1);
125
+ } finally {
126
+ P === y && (b.value = !1, s = void 0, h = void 0);
127
+ }
128
+ }, O = c ? 0 : Math.max(0, e.debounceTime ?? 0);
129
+ O ? l = setTimeout(() => {
130
+ N();
131
+ }, O) : N();
132
+ }), f;
133
+ }
134
+ const p = K(
135
+ () => S(e.params),
136
+ (c) => {
137
+ z(i, c ?? {}) || (i = x(c ?? {}), r.value = "", a.value = /* @__PURE__ */ new Map(), d.value = [], u());
138
+ },
139
+ { deep: !0 }
140
+ );
141
+ return L() && Q(() => {
142
+ v = !0, p(), o();
143
+ }), e.manualRequest || u(), {
144
+ options: E(() => d.value),
145
+ valueEnum: E(() => {
146
+ const c = /* @__PURE__ */ new Map();
147
+ for (const g of [...S(e.selectedOptions) ?? [], ...a.value.values()])
148
+ c.set(g.value, { text: g.label, status: g.status });
149
+ return c;
150
+ }),
151
+ filters: E(
152
+ () => m.value ? d.value.map(({ value: c, label: g }) => ({ value: c, text: g })) : []
153
+ ),
154
+ complete: E(() => m.value),
155
+ loading: E(() => b.value),
156
+ error: E(() => n.value),
157
+ keyword: E(() => r.value),
158
+ search(c) {
159
+ return r.value = c, u();
160
+ },
161
+ reload: () => u(!0, !0),
162
+ cancel: o
163
+ };
164
+ }
165
+ export {
166
+ H as createTableDictionary,
167
+ I as useTableDictionary
168
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useTableDictionary.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTableDictionary.test.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableDictionary.test.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"useTableEdit.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableEdit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kBAAkB,CAAA;AAezB,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,OAAO,SAAS,MAAM,EACjD,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,GACpC,kBAAkB,CAAC,OAAO,CAAC,CA8O7B"}
1
+ {"version":3,"file":"useTableEdit.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useTableEdit.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAKV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kBAAkB,CAAA;AAiBzB,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,OAAO,SAAS,MAAM,EACjD,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,GACpC,kBAAkB,CAAC,OAAO,CAAC,CAwiB7B"}