@atscript/vue-table 0.1.58

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 (202) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +24 -0
  3. package/dist/as-action-form-dialog.cjs +221 -0
  4. package/dist/as-action-form-dialog.d.cts +6 -0
  5. package/dist/as-action-form-dialog.d.mts +7 -0
  6. package/dist/as-action-form-dialog.mjs +221 -0
  7. package/dist/as-action-menu-content-CXsdPn42.mjs +104 -0
  8. package/dist/as-action-menu-content-CyUfBrWH.cjs +109 -0
  9. package/dist/as-cell-array-CXeZzZqt.cjs +69 -0
  10. package/dist/as-cell-array-DOQKR6t5.mjs +64 -0
  11. package/dist/as-cell-array.cjs +3 -0
  12. package/dist/as-cell-array.d.cts +2 -0
  13. package/dist/as-cell-array.d.mts +2 -0
  14. package/dist/as-cell-array.mjs +3 -0
  15. package/dist/as-cell-array.vue-DZGM2VHh.d.mts +12 -0
  16. package/dist/as-cell-array.vue-pFs5GcCR.d.cts +12 -0
  17. package/dist/as-cell-date-CTrvxS1h.cjs +78 -0
  18. package/dist/as-cell-date-Cq49RHmL.mjs +73 -0
  19. package/dist/as-cell-date.cjs +3 -0
  20. package/dist/as-cell-date.d.cts +2 -0
  21. package/dist/as-cell-date.d.mts +2 -0
  22. package/dist/as-cell-date.mjs +3 -0
  23. package/dist/as-cell-date.vue-BBSps2B2.d.cts +12 -0
  24. package/dist/as-cell-date.vue-Zlt4mHWb.d.mts +12 -0
  25. package/dist/as-cell-json-BynWIs1d.mjs +37 -0
  26. package/dist/as-cell-json-DvHvQ6IL.cjs +42 -0
  27. package/dist/as-cell-json-popover-BWdNs1YU.cjs +70 -0
  28. package/dist/as-cell-json-popover-DUq25I0L.mjs +65 -0
  29. package/dist/as-cell-json.cjs +3 -0
  30. package/dist/as-cell-json.d.cts +2 -0
  31. package/dist/as-cell-json.d.mts +2 -0
  32. package/dist/as-cell-json.mjs +3 -0
  33. package/dist/as-cell-json.vue-C6wg4ARZ.d.cts +12 -0
  34. package/dist/as-cell-json.vue-CESWuCer.d.mts +12 -0
  35. package/dist/as-cell-number-0_WrSCzu.cjs +76 -0
  36. package/dist/as-cell-number-Bc1C97Vg.mjs +71 -0
  37. package/dist/as-cell-number.cjs +3 -0
  38. package/dist/as-cell-number.d.cts +2 -0
  39. package/dist/as-cell-number.d.mts +2 -0
  40. package/dist/as-cell-number.mjs +3 -0
  41. package/dist/as-cell-number.vue-1Oq7nVI3.d.mts +12 -0
  42. package/dist/as-cell-number.vue-CJ2K5zeM.d.cts +12 -0
  43. package/dist/as-cell-union-C1w3B38J.mjs +88 -0
  44. package/dist/as-cell-union-CFAI0utz.cjs +93 -0
  45. package/dist/as-cell-union.cjs +4 -0
  46. package/dist/as-cell-union.d.cts +2 -0
  47. package/dist/as-cell-union.d.mts +2 -0
  48. package/dist/as-cell-union.mjs +4 -0
  49. package/dist/as-cell-union.vue-CslPM_c2.d.cts +12 -0
  50. package/dist/as-cell-union.vue-NnDmQZOA.d.mts +12 -0
  51. package/dist/as-column-menu-CH9Htz0Q.cjs +220 -0
  52. package/dist/as-column-menu-DCfhorMP.mjs +215 -0
  53. package/dist/as-column-menu.cjs +2 -0
  54. package/dist/as-column-menu.d.cts +2 -0
  55. package/dist/as-column-menu.d.mts +2 -0
  56. package/dist/as-column-menu.mjs +2 -0
  57. package/dist/as-column-menu.vue-C9e6wJ3z.d.mts +47 -0
  58. package/dist/as-column-menu.vue-o0qFdzoL.d.cts +47 -0
  59. package/dist/as-config-dialog-d2k7_l0U.cjs +699 -0
  60. package/dist/as-config-dialog-vRklaKbi.mjs +688 -0
  61. package/dist/as-config-dialog.cjs +3 -0
  62. package/dist/as-config-dialog.d.cts +2 -0
  63. package/dist/as-config-dialog.d.mts +2 -0
  64. package/dist/as-config-dialog.mjs +3 -0
  65. package/dist/as-config-dialog.vue-C6Q62xF5.d.mts +7 -0
  66. package/dist/as-config-dialog.vue-DvvJi3xx.d.cts +7 -0
  67. package/dist/as-confirm-dialog-BLh3Ju4-.mjs +52 -0
  68. package/dist/as-confirm-dialog-BgpIEE2z.cjs +57 -0
  69. package/dist/as-confirm-dialog.cjs +3 -0
  70. package/dist/as-confirm-dialog.d.cts +2 -0
  71. package/dist/as-confirm-dialog.d.mts +2 -0
  72. package/dist/as-confirm-dialog.mjs +3 -0
  73. package/dist/as-confirm-dialog.vue-CXxLpzbu.d.cts +7 -0
  74. package/dist/as-confirm-dialog.vue-pas8jGhv.d.mts +7 -0
  75. package/dist/as-filter-dialog-C0HMpUPT.mjs +610 -0
  76. package/dist/as-filter-dialog-DcGvIV3h.cjs +621 -0
  77. package/dist/as-filter-dialog.cjs +15 -0
  78. package/dist/as-filter-dialog.d.cts +2 -0
  79. package/dist/as-filter-dialog.d.mts +2 -0
  80. package/dist/as-filter-dialog.mjs +15 -0
  81. package/dist/as-filter-dialog.vue-BV2J8PgZ.d.cts +7 -0
  82. package/dist/as-filter-dialog.vue-RDZjp4gJ.d.mts +7 -0
  83. package/dist/as-filter-field-B_tYzvvl.cjs +984 -0
  84. package/dist/as-filter-field-Bqvu2ASN.mjs +943 -0
  85. package/dist/as-filter-field.cjs +9 -0
  86. package/dist/as-filter-field.d.cts +2 -0
  87. package/dist/as-filter-field.d.mts +2 -0
  88. package/dist/as-filter-field.mjs +9 -0
  89. package/dist/as-filter-field.vue-ByQ8xIGq.d.cts +11 -0
  90. package/dist/as-filter-field.vue-QY8wi5S5.d.mts +11 -0
  91. package/dist/as-filter-input--nr72iwX.cjs +106 -0
  92. package/dist/as-filter-input-P1i0CW2-.mjs +101 -0
  93. package/dist/as-filter-input.cjs +2 -0
  94. package/dist/as-filter-input.d.cts +2 -0
  95. package/dist/as-filter-input.d.mts +2 -0
  96. package/dist/as-filter-input.mjs +2 -0
  97. package/dist/as-filter-input.vue-CBQ71eNg.d.mts +18 -0
  98. package/dist/as-filter-input.vue-CS4nOk_Q.d.cts +18 -0
  99. package/dist/as-filters-Bxa9ZEMm.mjs +44 -0
  100. package/dist/as-filters-xRT2qv56.cjs +49 -0
  101. package/dist/as-filters.cjs +10 -0
  102. package/dist/as-filters.d.cts +2 -0
  103. package/dist/as-filters.d.mts +2 -0
  104. package/dist/as-filters.mjs +10 -0
  105. package/dist/as-filters.vue-BsMgYUcX.d.mts +10 -0
  106. package/dist/as-filters.vue-fv-tRL2H.d.cts +10 -0
  107. package/dist/as-preset-dialog-BaTfwMnh.cjs +569 -0
  108. package/dist/as-preset-dialog-BdDRgwf_.mjs +564 -0
  109. package/dist/as-preset-dialog.cjs +4 -0
  110. package/dist/as-preset-dialog.d.cts +2 -0
  111. package/dist/as-preset-dialog.d.mts +2 -0
  112. package/dist/as-preset-dialog.mjs +4 -0
  113. package/dist/as-preset-dialog.vue-Bzv-ON9W.d.mts +7 -0
  114. package/dist/as-preset-dialog.vue-DP9fy00Y.d.cts +7 -0
  115. package/dist/as-preset-picker-BQbNEiy9.mjs +427 -0
  116. package/dist/as-preset-picker-Ce3crTQy.cjs +432 -0
  117. package/dist/as-preset-picker.cjs +4 -0
  118. package/dist/as-preset-picker.d.cts +2 -0
  119. package/dist/as-preset-picker.d.mts +2 -0
  120. package/dist/as-preset-picker.mjs +4 -0
  121. package/dist/as-preset-picker.vue-CTBk6leV.d.mts +7 -0
  122. package/dist/as-preset-picker.vue-DfXS3pGl.d.cts +7 -0
  123. package/dist/as-row-actions-B6Kob6gt.cjs +120 -0
  124. package/dist/as-row-actions-CeWBBGqh.mjs +115 -0
  125. package/dist/as-row-actions.cjs +4 -0
  126. package/dist/as-row-actions.d.cts +2 -0
  127. package/dist/as-row-actions.d.mts +2 -0
  128. package/dist/as-row-actions.mjs +4 -0
  129. package/dist/as-row-actions.vue-BPaQfGev.d.mts +11 -0
  130. package/dist/as-row-actions.vue-Bvcc2tUN.d.cts +11 -0
  131. package/dist/as-table-Cnw2fOqZ.mjs +204 -0
  132. package/dist/as-table-DlDFxdXI.cjs +209 -0
  133. package/dist/as-table-actions-BK1Thy2G.cjs +142 -0
  134. package/dist/as-table-actions-BpMiNFni.mjs +137 -0
  135. package/dist/as-table-actions.cjs +4 -0
  136. package/dist/as-table-actions.d.cts +2 -0
  137. package/dist/as-table-actions.d.mts +2 -0
  138. package/dist/as-table-actions.mjs +4 -0
  139. package/dist/as-table-actions.vue-B7Q-JA3z.d.cts +47 -0
  140. package/dist/as-table-actions.vue-Bs1Jl1ep.d.mts +47 -0
  141. package/dist/as-table-base-D0k4k7k_.mjs +646 -0
  142. package/dist/as-table-base-VIz-B_6_.cjs +651 -0
  143. package/dist/as-table-cell-value-B1CiJYFn.mjs +26 -0
  144. package/dist/as-table-cell-value-CuxRtFn9.cjs +31 -0
  145. package/dist/as-table-cell-value.cjs +3 -0
  146. package/dist/as-table-cell-value.d.cts +2 -0
  147. package/dist/as-table-cell-value.d.mts +2 -0
  148. package/dist/as-table-cell-value.mjs +3 -0
  149. package/dist/as-table-cell-value.vue-BgFDv2JQ.d.cts +12 -0
  150. package/dist/as-table-cell-value.vue-BuPCQ8YA.d.mts +12 -0
  151. package/dist/as-table-header-cell-C3zeZUZo.cjs +117 -0
  152. package/dist/as-table-header-cell-CBn_ioCe.mjs +112 -0
  153. package/dist/as-table-header-cell.cjs +3 -0
  154. package/dist/as-table-header-cell.d.cts +2 -0
  155. package/dist/as-table-header-cell.d.mts +2 -0
  156. package/dist/as-table-header-cell.mjs +3 -0
  157. package/dist/as-table-header-cell.vue-Bc_DSsGY.d.cts +31 -0
  158. package/dist/as-table-header-cell.vue-DNMOHfek.d.mts +31 -0
  159. package/dist/as-table-root-Br6WcGRo.cjs +263 -0
  160. package/dist/as-table-root-gG7pTIdD.mjs +258 -0
  161. package/dist/as-table-root.cjs +28 -0
  162. package/dist/as-table-root.d.cts +2 -0
  163. package/dist/as-table-root.d.mts +2 -0
  164. package/dist/as-table-root.mjs +28 -0
  165. package/dist/as-table-root.vue-5_OhVwse.d.mts +2258 -0
  166. package/dist/as-table-root.vue-CSqEtIll.d.cts +2258 -0
  167. package/dist/as-table-status-BjRGGuhC.mjs +683 -0
  168. package/dist/as-table-status-DWYoJIMC.cjs +724 -0
  169. package/dist/as-table.cjs +10 -0
  170. package/dist/as-table.d.cts +2 -0
  171. package/dist/as-table.d.mts +2 -0
  172. package/dist/as-table.mjs +10 -0
  173. package/dist/as-table.vue-BTYg-e3Z.d.mts +81 -0
  174. package/dist/as-table.vue-wdRARLIe.d.cts +81 -0
  175. package/dist/as-window-table-CKIfo3M_.mjs +709 -0
  176. package/dist/as-window-table-DE7_NyEP.cjs +714 -0
  177. package/dist/as-window-table.cjs +9 -0
  178. package/dist/as-window-table.d.cts +2 -0
  179. package/dist/as-window-table.d.mts +2 -0
  180. package/dist/as-window-table.mjs +9 -0
  181. package/dist/as-window-table.vue-Bf8xGC9M.d.mts +86 -0
  182. package/dist/as-window-table.vue-CA8qsrz4.d.cts +86 -0
  183. package/dist/format-cell-B2xMDYO9.mjs +27 -0
  184. package/dist/format-cell-D4mqaN0E.cjs +32 -0
  185. package/dist/get-cell-value-CZSVfDLg.cjs +19 -0
  186. package/dist/get-cell-value-DiH84HKL.mjs +14 -0
  187. package/dist/index.cjs +598 -0
  188. package/dist/index.d.cts +21 -0
  189. package/dist/index.d.mts +21 -0
  190. package/dist/index.mjs +505 -0
  191. package/dist/preset-aspect-display-BYeiSgcc.mjs +43 -0
  192. package/dist/preset-aspect-display-y8aal_EF.cjs +72 -0
  193. package/dist/types-BvvXN72P.d.mts +531 -0
  194. package/dist/types-CNMmF6W2.d.cts +531 -0
  195. package/dist/use-cell-locale-1uQaFTLQ.mjs +23 -0
  196. package/dist/use-cell-locale-B480_QYK.cjs +34 -0
  197. package/dist/use-table-column-handlers-CGYAY2xH.cjs +65 -0
  198. package/dist/use-table-column-handlers-t6xi1yCE.mjs +54 -0
  199. package/dist/use-table-state-C4JbonEZ.mjs +1822 -0
  200. package/dist/use-table-state-MU-vuzui.cjs +1917 -0
  201. package/package.json +195 -0
  202. package/styles.d.ts +2 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Artem Maltsev <artem@maltsev.nl>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # @atscript/vue-table
2
+
3
+ Type-driven table components for Vue 3 — virtualized tables, filter dialogs, column config, preset persistence, all wired from an atscript-annotated `.as` type.
4
+
5
+ Part of the [atscript-ui](https://github.com/moostjs/atscript-ui) monorepo. Built on [`@atscript/ui`](../ui) and [`@atscript/ui-table`](../ui-table).
6
+
7
+ ## What it provides
8
+
9
+ - `<AsTable>`, `<AsTableRoot>`, `<AsFilters>` — tier-1 components users tag in templates
10
+ - Default cell renderers (`AsCellDate`, `AsCellNumber`, `AsCellArray`, …) and dialogs (`AsFilterDialog`, `AsConfigDialog`, `AsPresetDialog`) under `@atscript/vue-table/as-*` subpaths
11
+ - Window-virtualized variant (`<AsWindowTable>`) backed by `@tanstack/vue-virtual`
12
+ - Composable: `useAsTable` — provides the model-driven state contract documented in the root CLAUDE.md
13
+
14
+ ## Install
15
+
16
+ ```sh
17
+ pnpm add @atscript/vue-table
18
+ ```
19
+
20
+ Peer requirements: `vue@^3`, `reka-ui@^2`, `@tanstack/vue-virtual@^3`, `@vueuse/core`, `@atscript/db-client`.
21
+
22
+ ## License
23
+
24
+ MIT © Artem Maltsev
@@ -0,0 +1,221 @@
1
+ const require_use_table_state = require("./use-table-state-MU-vuzui.cjs");
2
+ let _atscript_ui = require("@atscript/ui");
3
+ let vue = require("vue");
4
+ let _atscript_db_client = require("@atscript/db-client");
5
+ let _vueuse_core = require("@vueuse/core");
6
+ let reka_ui = require("reka-ui");
7
+ let _atscript_vue_form = require("@atscript/vue-form");
8
+ //#region src/components/defaults/as-action-form-dialog.vue?vue&type=script&setup=true&lang.ts
9
+ const _hoisted_1 = { class: "as-action-form-header" };
10
+ const _hoisted_2 = {
11
+ key: 0,
12
+ class: "as-action-form-id-more"
13
+ };
14
+ const _hoisted_3 = {
15
+ "data-id-more": "",
16
+ class: "as-action-form-id-more"
17
+ };
18
+ const _hoisted_4 = { class: "as-action-form-body" };
19
+ const _hoisted_5 = {
20
+ key: 1,
21
+ class: "as-action-form-status"
22
+ };
23
+ const _hoisted_6 = {
24
+ key: 2,
25
+ class: "as-action-form-error"
26
+ };
27
+ const _hoisted_7 = {
28
+ key: 0,
29
+ class: "as-action-form-footer"
30
+ };
31
+ const MEASURE_CAP = 50;
32
+ //#endregion
33
+ //#region src/components/defaults/as-action-form-dialog.vue
34
+ var as_action_form_dialog_default = /* @__PURE__ */ (0, vue.defineComponent)({
35
+ __name: "as-action-form-dialog",
36
+ setup(__props) {
37
+ const { state, client, formTypes, formComponents } = require_use_table_state.useTableContext();
38
+ const req = state.actionFormRequest;
39
+ const open = (0, vue.computed)({
40
+ get: () => req.value !== null,
41
+ set: (v) => {
42
+ if (!v) state.dismissActionForm();
43
+ }
44
+ });
45
+ const def = (0, vue.ref)(null);
46
+ const formData = (0, vue.ref)(null);
47
+ const loading = (0, vue.ref)(false);
48
+ const error = (0, vue.ref)(null);
49
+ const resolvedTypes = formTypes ?? (0, _atscript_vue_form.createDefaultTypes)();
50
+ (0, vue.watch)(req, async (next) => {
51
+ def.value = null;
52
+ formData.value = null;
53
+ error.value = null;
54
+ loading.value = false;
55
+ if (next === null) return;
56
+ if (!next.action.inputForm) {
57
+ error.value = "Action does not declare an input form.";
58
+ return;
59
+ }
60
+ loading.value = true;
61
+ const stale = () => req.value !== next;
62
+ try {
63
+ const annotated = await client.getActionForm(next.action.name);
64
+ if (stale()) return;
65
+ if (annotated === null) {
66
+ error.value = `Form schema "${next.action.inputForm}" not registered on server.`;
67
+ return;
68
+ }
69
+ def.value = (0, _atscript_ui.createFormDef)(annotated);
70
+ formData.value = (0, _atscript_ui.createFormData)(annotated);
71
+ } catch (err) {
72
+ if (stale()) return;
73
+ error.value = err instanceof Error ? err.message : String(err);
74
+ } finally {
75
+ if (!stale()) loading.value = false;
76
+ }
77
+ });
78
+ const formId = `as-action-form-${(0, vue.useId)()}`;
79
+ const view = (0, vue.computed)(() => {
80
+ const r = req.value;
81
+ if (!r) return null;
82
+ const d = def.value;
83
+ const ids = r.identifiers;
84
+ const idTotal = ids.length;
85
+ const allIds = (idTotal > MEASURE_CAP ? ids.slice(0, MEASURE_CAP) : ids).map((id) => (0, _atscript_db_client.formatIdentifier)(id, r.preferredId));
86
+ const intent = r.action.intent;
87
+ const scope = intent ? require_use_table_state.intentToScope(intent) : void 0;
88
+ return {
89
+ title: (d ? (0, _atscript_ui.getFieldMeta)(d.type, _atscript_ui.META_LABEL) : void 0) ?? r.action.label ?? r.action.name,
90
+ submitText: d && (0, _atscript_ui.getFieldMeta)(d.type, _atscript_ui.UI_FORM_SUBMIT_TEXT) || "Proceed",
91
+ submitClass: scope ? `as-action-form-submit-${scope}` : void 0,
92
+ description: r.action.description ?? "",
93
+ allIds,
94
+ idTotal,
95
+ needsMeasure: allIds.length > 1
96
+ };
97
+ });
98
+ const idsRef = (0, vue.ref)(null);
99
+ const measureRef = (0, vue.ref)(null);
100
+ const visibleIdsCount = (0, vue.ref)(0);
101
+ function recomputeFit() {
102
+ const len = view.value?.allIds.length ?? 0;
103
+ if (len <= 1) {
104
+ if (visibleIdsCount.value !== len) visibleIdsCount.value = len;
105
+ return;
106
+ }
107
+ const container = idsRef.value;
108
+ const measure = measureRef.value;
109
+ if (!container || !measure) return;
110
+ const containerWidth = container.clientWidth;
111
+ const chipEls = measure.querySelectorAll("[data-id-chip]");
112
+ const moreWidth = measure.querySelector("[data-id-more]")?.offsetWidth ?? 0;
113
+ const styles = window.getComputedStyle(measure);
114
+ const gap = Number.parseFloat(styles.columnGap || styles.gap || "0") || 0;
115
+ let used = 0;
116
+ let count = 0;
117
+ for (let i = 0; i < chipEls.length; i++) {
118
+ const chipWidth = chipEls[i].offsetWidth;
119
+ const next = used + (i === 0 ? 0 : gap) + chipWidth;
120
+ if (next + (i === chipEls.length - 1 ? 0 : gap + moreWidth) > containerWidth) break;
121
+ used = next;
122
+ count++;
123
+ }
124
+ if (count !== visibleIdsCount.value) visibleIdsCount.value = count;
125
+ }
126
+ (0, _vueuse_core.useResizeObserver)(idsRef, recomputeFit);
127
+ (0, vue.watch)(() => view.value?.allIds, recomputeFit, { flush: "post" });
128
+ function onSubmit(payload) {
129
+ state.acceptActionForm(payload);
130
+ }
131
+ return (_ctx, _cache) => {
132
+ return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(reka_ui.DialogRoot), {
133
+ open: open.value,
134
+ "onUpdate:open": _cache[1] || (_cache[1] = ($event) => open.value = $event)
135
+ }, {
136
+ default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(reka_ui.DialogPortal), null, {
137
+ default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(reka_ui.DialogOverlay), { class: "as-action-form-overlay" }), (0, vue.createVNode)((0, vue.unref)(reka_ui.DialogContent), { class: "as-action-form-content" }, {
138
+ default: (0, vue.withCtx)(() => [view.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [
139
+ (0, vue.createElementVNode)("header", _hoisted_1, [
140
+ (0, vue.createVNode)((0, vue.unref)(reka_ui.DialogTitle), { class: "as-action-form-title" }, {
141
+ default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)(view.value.title), 1)]),
142
+ _: 1
143
+ }),
144
+ (0, vue.createElementVNode)("div", {
145
+ ref_key: "idsRef",
146
+ ref: idsRef,
147
+ class: "as-action-form-ids"
148
+ }, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(view.value.allIds.slice(0, visibleIdsCount.value), (id, idx) => {
149
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
150
+ key: idx,
151
+ class: "as-action-form-id"
152
+ }, (0, vue.toDisplayString)(id), 1);
153
+ }), 128)), view.value.idTotal - visibleIdsCount.value > 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_2, (0, vue.toDisplayString)(view.value.idTotal - visibleIdsCount.value) + " more…", 1)) : (0, vue.createCommentVNode)("v-if", true)], 512),
154
+ view.value.needsMeasure ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
155
+ key: 0,
156
+ ref_key: "measureRef",
157
+ ref: measureRef,
158
+ class: "as-action-form-ids-measure",
159
+ "aria-hidden": "true"
160
+ }, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(view.value.allIds, (id, idx) => {
161
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
162
+ key: idx,
163
+ "data-id-chip": "",
164
+ class: "as-action-form-id"
165
+ }, (0, vue.toDisplayString)(id), 1);
166
+ }), 128)), (0, vue.createElementVNode)("span", _hoisted_3, (0, vue.toDisplayString)(view.value.idTotal) + " more…", 1)], 512)) : (0, vue.createCommentVNode)("v-if", true),
167
+ (0, vue.createVNode)((0, vue.unref)(reka_ui.DialogClose), {
168
+ type: "button",
169
+ class: "as-action-form-close",
170
+ "aria-label": "Close"
171
+ }, {
172
+ default: (0, vue.withCtx)(() => [..._cache[2] || (_cache[2] = [(0, vue.createElementVNode)("span", {
173
+ class: "i-as-close",
174
+ "aria-hidden": "true"
175
+ }, null, -1)])]),
176
+ _: 1
177
+ })
178
+ ]),
179
+ (0, vue.createElementVNode)("div", _hoisted_4, [view.value.description ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(reka_ui.DialogDescription), {
180
+ key: 0,
181
+ class: "as-action-form-description"
182
+ }, {
183
+ default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)(view.value.description), 1)]),
184
+ _: 1
185
+ })) : (0, vue.createCommentVNode)("v-if", true), loading.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_5, "Loading form…")) : error.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_6, (0, vue.toDisplayString)(error.value), 1)) : def.value && formData.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_atscript_vue_form.AsForm), {
186
+ key: 3,
187
+ id: formId,
188
+ def: def.value,
189
+ "form-data": formData.value,
190
+ types: (0, vue.unref)(resolvedTypes),
191
+ components: (0, vue.unref)(formComponents),
192
+ "hide-root-title": "",
193
+ "hide-submit": "",
194
+ onSubmit
195
+ }, null, 8, [
196
+ "def",
197
+ "form-data",
198
+ "types",
199
+ "components"
200
+ ])) : (0, vue.createCommentVNode)("v-if", true)]),
201
+ def.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("footer", _hoisted_7, [(0, vue.createElementVNode)("button", {
202
+ type: "button",
203
+ class: "as-action-form-cancel",
204
+ onClick: _cache[0] || (_cache[0] = ($event) => (0, vue.unref)(state).dismissActionForm())
205
+ }, " Cancel "), (0, vue.createElementVNode)("button", {
206
+ type: "submit",
207
+ form: formId,
208
+ class: (0, vue.normalizeClass)(["as-action-form-submit", view.value.submitClass])
209
+ }, (0, vue.toDisplayString)(view.value.submitText), 3)])) : (0, vue.createCommentVNode)("v-if", true)
210
+ ], 64)) : (0, vue.createCommentVNode)("v-if", true)]),
211
+ _: 1
212
+ })]),
213
+ _: 1
214
+ })]),
215
+ _: 1
216
+ }, 8, ["open"]);
217
+ };
218
+ }
219
+ });
220
+ //#endregion
221
+ module.exports = as_action_form_dialog_default;
@@ -0,0 +1,6 @@
1
+ import * as vue from "vue";
2
+
3
+ //#region src/components/defaults/as-action-form-dialog.vue.d.ts
4
+ declare const __VLS_export: vue.DefineComponent<{}, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
5
+ declare const _default: typeof __VLS_export;
6
+ export = _default;
@@ -0,0 +1,7 @@
1
+ import * as vue from "vue";
2
+
3
+ //#region src/components/defaults/as-action-form-dialog.vue.d.ts
4
+ declare const __VLS_export: vue.DefineComponent<{}, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
5
+ declare const _default: typeof __VLS_export;
6
+ //#endregion
7
+ export { _default as default };
@@ -0,0 +1,221 @@
1
+ import { a as useTableContext, p as intentToScope } from "./use-table-state-C4JbonEZ.mjs";
2
+ import { META_LABEL, UI_FORM_SUBMIT_TEXT, createFormData, createFormDef, getFieldMeta } from "@atscript/ui";
3
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, renderList, toDisplayString, unref, useId, watch, withCtx } from "vue";
4
+ import { formatIdentifier } from "@atscript/db-client";
5
+ import { useResizeObserver } from "@vueuse/core";
6
+ import { DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle } from "reka-ui";
7
+ import { AsForm, createDefaultTypes } from "@atscript/vue-form";
8
+ //#region src/components/defaults/as-action-form-dialog.vue?vue&type=script&setup=true&lang.ts
9
+ const _hoisted_1 = { class: "as-action-form-header" };
10
+ const _hoisted_2 = {
11
+ key: 0,
12
+ class: "as-action-form-id-more"
13
+ };
14
+ const _hoisted_3 = {
15
+ "data-id-more": "",
16
+ class: "as-action-form-id-more"
17
+ };
18
+ const _hoisted_4 = { class: "as-action-form-body" };
19
+ const _hoisted_5 = {
20
+ key: 1,
21
+ class: "as-action-form-status"
22
+ };
23
+ const _hoisted_6 = {
24
+ key: 2,
25
+ class: "as-action-form-error"
26
+ };
27
+ const _hoisted_7 = {
28
+ key: 0,
29
+ class: "as-action-form-footer"
30
+ };
31
+ const MEASURE_CAP = 50;
32
+ //#endregion
33
+ //#region src/components/defaults/as-action-form-dialog.vue
34
+ var as_action_form_dialog_default = /* @__PURE__ */ defineComponent({
35
+ __name: "as-action-form-dialog",
36
+ setup(__props) {
37
+ const { state, client, formTypes, formComponents } = useTableContext();
38
+ const req = state.actionFormRequest;
39
+ const open = computed({
40
+ get: () => req.value !== null,
41
+ set: (v) => {
42
+ if (!v) state.dismissActionForm();
43
+ }
44
+ });
45
+ const def = ref(null);
46
+ const formData = ref(null);
47
+ const loading = ref(false);
48
+ const error = ref(null);
49
+ const resolvedTypes = formTypes ?? createDefaultTypes();
50
+ watch(req, async (next) => {
51
+ def.value = null;
52
+ formData.value = null;
53
+ error.value = null;
54
+ loading.value = false;
55
+ if (next === null) return;
56
+ if (!next.action.inputForm) {
57
+ error.value = "Action does not declare an input form.";
58
+ return;
59
+ }
60
+ loading.value = true;
61
+ const stale = () => req.value !== next;
62
+ try {
63
+ const annotated = await client.getActionForm(next.action.name);
64
+ if (stale()) return;
65
+ if (annotated === null) {
66
+ error.value = `Form schema "${next.action.inputForm}" not registered on server.`;
67
+ return;
68
+ }
69
+ def.value = createFormDef(annotated);
70
+ formData.value = createFormData(annotated);
71
+ } catch (err) {
72
+ if (stale()) return;
73
+ error.value = err instanceof Error ? err.message : String(err);
74
+ } finally {
75
+ if (!stale()) loading.value = false;
76
+ }
77
+ });
78
+ const formId = `as-action-form-${useId()}`;
79
+ const view = computed(() => {
80
+ const r = req.value;
81
+ if (!r) return null;
82
+ const d = def.value;
83
+ const ids = r.identifiers;
84
+ const idTotal = ids.length;
85
+ const allIds = (idTotal > MEASURE_CAP ? ids.slice(0, MEASURE_CAP) : ids).map((id) => formatIdentifier(id, r.preferredId));
86
+ const intent = r.action.intent;
87
+ const scope = intent ? intentToScope(intent) : void 0;
88
+ return {
89
+ title: (d ? getFieldMeta(d.type, META_LABEL) : void 0) ?? r.action.label ?? r.action.name,
90
+ submitText: d && getFieldMeta(d.type, UI_FORM_SUBMIT_TEXT) || "Proceed",
91
+ submitClass: scope ? `as-action-form-submit-${scope}` : void 0,
92
+ description: r.action.description ?? "",
93
+ allIds,
94
+ idTotal,
95
+ needsMeasure: allIds.length > 1
96
+ };
97
+ });
98
+ const idsRef = ref(null);
99
+ const measureRef = ref(null);
100
+ const visibleIdsCount = ref(0);
101
+ function recomputeFit() {
102
+ const len = view.value?.allIds.length ?? 0;
103
+ if (len <= 1) {
104
+ if (visibleIdsCount.value !== len) visibleIdsCount.value = len;
105
+ return;
106
+ }
107
+ const container = idsRef.value;
108
+ const measure = measureRef.value;
109
+ if (!container || !measure) return;
110
+ const containerWidth = container.clientWidth;
111
+ const chipEls = measure.querySelectorAll("[data-id-chip]");
112
+ const moreWidth = measure.querySelector("[data-id-more]")?.offsetWidth ?? 0;
113
+ const styles = window.getComputedStyle(measure);
114
+ const gap = Number.parseFloat(styles.columnGap || styles.gap || "0") || 0;
115
+ let used = 0;
116
+ let count = 0;
117
+ for (let i = 0; i < chipEls.length; i++) {
118
+ const chipWidth = chipEls[i].offsetWidth;
119
+ const next = used + (i === 0 ? 0 : gap) + chipWidth;
120
+ if (next + (i === chipEls.length - 1 ? 0 : gap + moreWidth) > containerWidth) break;
121
+ used = next;
122
+ count++;
123
+ }
124
+ if (count !== visibleIdsCount.value) visibleIdsCount.value = count;
125
+ }
126
+ useResizeObserver(idsRef, recomputeFit);
127
+ watch(() => view.value?.allIds, recomputeFit, { flush: "post" });
128
+ function onSubmit(payload) {
129
+ state.acceptActionForm(payload);
130
+ }
131
+ return (_ctx, _cache) => {
132
+ return openBlock(), createBlock(unref(DialogRoot), {
133
+ open: open.value,
134
+ "onUpdate:open": _cache[1] || (_cache[1] = ($event) => open.value = $event)
135
+ }, {
136
+ default: withCtx(() => [createVNode(unref(DialogPortal), null, {
137
+ default: withCtx(() => [createVNode(unref(DialogOverlay), { class: "as-action-form-overlay" }), createVNode(unref(DialogContent), { class: "as-action-form-content" }, {
138
+ default: withCtx(() => [view.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
139
+ createElementVNode("header", _hoisted_1, [
140
+ createVNode(unref(DialogTitle), { class: "as-action-form-title" }, {
141
+ default: withCtx(() => [createTextVNode(toDisplayString(view.value.title), 1)]),
142
+ _: 1
143
+ }),
144
+ createElementVNode("div", {
145
+ ref_key: "idsRef",
146
+ ref: idsRef,
147
+ class: "as-action-form-ids"
148
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(view.value.allIds.slice(0, visibleIdsCount.value), (id, idx) => {
149
+ return openBlock(), createElementBlock("span", {
150
+ key: idx,
151
+ class: "as-action-form-id"
152
+ }, toDisplayString(id), 1);
153
+ }), 128)), view.value.idTotal - visibleIdsCount.value > 0 ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(view.value.idTotal - visibleIdsCount.value) + " more…", 1)) : createCommentVNode("v-if", true)], 512),
154
+ view.value.needsMeasure ? (openBlock(), createElementBlock("div", {
155
+ key: 0,
156
+ ref_key: "measureRef",
157
+ ref: measureRef,
158
+ class: "as-action-form-ids-measure",
159
+ "aria-hidden": "true"
160
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(view.value.allIds, (id, idx) => {
161
+ return openBlock(), createElementBlock("span", {
162
+ key: idx,
163
+ "data-id-chip": "",
164
+ class: "as-action-form-id"
165
+ }, toDisplayString(id), 1);
166
+ }), 128)), createElementVNode("span", _hoisted_3, toDisplayString(view.value.idTotal) + " more…", 1)], 512)) : createCommentVNode("v-if", true),
167
+ createVNode(unref(DialogClose), {
168
+ type: "button",
169
+ class: "as-action-form-close",
170
+ "aria-label": "Close"
171
+ }, {
172
+ default: withCtx(() => [..._cache[2] || (_cache[2] = [createElementVNode("span", {
173
+ class: "i-as-close",
174
+ "aria-hidden": "true"
175
+ }, null, -1)])]),
176
+ _: 1
177
+ })
178
+ ]),
179
+ createElementVNode("div", _hoisted_4, [view.value.description ? (openBlock(), createBlock(unref(DialogDescription), {
180
+ key: 0,
181
+ class: "as-action-form-description"
182
+ }, {
183
+ default: withCtx(() => [createTextVNode(toDisplayString(view.value.description), 1)]),
184
+ _: 1
185
+ })) : createCommentVNode("v-if", true), loading.value ? (openBlock(), createElementBlock("p", _hoisted_5, "Loading form…")) : error.value ? (openBlock(), createElementBlock("p", _hoisted_6, toDisplayString(error.value), 1)) : def.value && formData.value ? (openBlock(), createBlock(unref(AsForm), {
186
+ key: 3,
187
+ id: formId,
188
+ def: def.value,
189
+ "form-data": formData.value,
190
+ types: unref(resolvedTypes),
191
+ components: unref(formComponents),
192
+ "hide-root-title": "",
193
+ "hide-submit": "",
194
+ onSubmit
195
+ }, null, 8, [
196
+ "def",
197
+ "form-data",
198
+ "types",
199
+ "components"
200
+ ])) : createCommentVNode("v-if", true)]),
201
+ def.value ? (openBlock(), createElementBlock("footer", _hoisted_7, [createElementVNode("button", {
202
+ type: "button",
203
+ class: "as-action-form-cancel",
204
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(state).dismissActionForm())
205
+ }, " Cancel "), createElementVNode("button", {
206
+ type: "submit",
207
+ form: formId,
208
+ class: normalizeClass(["as-action-form-submit", view.value.submitClass])
209
+ }, toDisplayString(view.value.submitText), 3)])) : createCommentVNode("v-if", true)
210
+ ], 64)) : createCommentVNode("v-if", true)]),
211
+ _: 1
212
+ })]),
213
+ _: 1
214
+ })]),
215
+ _: 1
216
+ }, 8, ["open"]);
217
+ };
218
+ }
219
+ });
220
+ //#endregion
221
+ export { as_action_form_dialog_default as default };
@@ -0,0 +1,104 @@
1
+ import { f as intentClass, l as ariaLabelFor } from "./use-table-state-C4JbonEZ.mjs";
2
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, defineComponent, normalizeClass, openBlock, renderList, renderSlot, toDisplayString, unref, useSlots, withCtx } from "vue";
3
+ import { DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from "reka-ui";
4
+ //#endregion
5
+ //#region src/components/internal/as-action-menu-item.vue
6
+ var as_action_menu_item_default = /* @__PURE__ */ defineComponent({
7
+ __name: "as-action-menu-item",
8
+ props: {
9
+ action: {
10
+ type: Object,
11
+ required: true
12
+ },
13
+ prefix: {
14
+ type: String,
15
+ required: true
16
+ },
17
+ default: {
18
+ type: Boolean,
19
+ required: false
20
+ }
21
+ },
22
+ emits: ["select"],
23
+ setup(__props) {
24
+ const props = __props;
25
+ return (_ctx, _cache) => {
26
+ return openBlock(), createBlock(unref(DropdownMenuItem), {
27
+ class: normalizeClass([`${__props.prefix}-menu-item`, unref(intentClass)(__props.prefix, __props.action)]),
28
+ "data-default": props.default || void 0,
29
+ "aria-label": unref(ariaLabelFor)(__props.action),
30
+ onSelect: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("select", $event))
31
+ }, {
32
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default", { action: __props.action }, () => [__props.action.icon ? (openBlock(), createElementBlock("span", {
33
+ key: 0,
34
+ class: normalizeClass([`${__props.prefix}-menu-item-icon`, __props.action.icon]),
35
+ "aria-hidden": "true"
36
+ }, null, 2)) : createCommentVNode("v-if", true), createElementVNode("span", { class: normalizeClass(`${__props.prefix}-menu-item-label`) }, toDisplayString(__props.action.label || __props.action.name), 3)])]),
37
+ _: 3
38
+ }, 8, [
39
+ "class",
40
+ "data-default",
41
+ "aria-label"
42
+ ]);
43
+ };
44
+ }
45
+ });
46
+ //#endregion
47
+ //#region src/components/internal/as-action-menu-content.vue
48
+ var as_action_menu_content_default = /* @__PURE__ */ defineComponent({
49
+ __name: "as-action-menu-content",
50
+ props: {
51
+ groups: {
52
+ type: Array,
53
+ required: true
54
+ },
55
+ defaultMarker: {
56
+ type: Object,
57
+ required: false
58
+ },
59
+ prefix: {
60
+ type: String,
61
+ required: true
62
+ }
63
+ },
64
+ emits: ["select"],
65
+ setup(__props) {
66
+ const props = __props;
67
+ const slots = useSlots();
68
+ const visibleGroups = computed(() => props.groups.filter((g) => g.length > 0));
69
+ return (_ctx, _cache) => {
70
+ return openBlock(), createBlock(unref(DropdownMenuContent), {
71
+ class: normalizeClass(`${__props.prefix}-menu`),
72
+ "side-offset": 4,
73
+ align: "end"
74
+ }, {
75
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(visibleGroups.value, (group, gIdx) => {
76
+ return openBlock(), createElementBlock(Fragment, { key: gIdx }, [gIdx > 0 ? (openBlock(), createBlock(unref(DropdownMenuSeparator), {
77
+ key: 0,
78
+ class: normalizeClass(`${__props.prefix}-menu-separator`)
79
+ }, null, 8, ["class"])) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(group, (action, aIdx) => {
80
+ return openBlock(), createBlock(as_action_menu_item_default, {
81
+ key: `${gIdx}-${action.name}-${aIdx}`,
82
+ action,
83
+ prefix: __props.prefix,
84
+ default: action === __props.defaultMarker,
85
+ onSelect: ($event) => _ctx.$emit("select", action, $event)
86
+ }, createSlots({ _: 2 }, [unref(slots)["menu-item"] ? {
87
+ name: "default",
88
+ fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "menu-item", { action: slotProps.action })]),
89
+ key: "0"
90
+ } : void 0]), 1032, [
91
+ "action",
92
+ "prefix",
93
+ "default",
94
+ "onSelect"
95
+ ]);
96
+ }), 128))], 64);
97
+ }), 128))]),
98
+ _: 3
99
+ }, 8, ["class"]);
100
+ };
101
+ }
102
+ });
103
+ //#endregion
104
+ export { as_action_menu_content_default as t };