@atscript/vue-form 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 (190) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +35 -0
  3. package/dist/as-action-71f9E_bL.cjs +208 -0
  4. package/dist/as-action-DU17rykn.mjs +203 -0
  5. package/dist/as-action.cjs +2 -0
  6. package/dist/as-action.d.cts +2 -0
  7. package/dist/as-action.d.mts +2 -0
  8. package/dist/as-action.mjs +2 -0
  9. package/dist/as-action.vue-BdbAOZCL.d.cts +13 -0
  10. package/dist/as-action.vue-CmY3eil1.d.mts +13 -0
  11. package/dist/as-adornment-shell-9UmdNIPR.cjs +97 -0
  12. package/dist/as-adornment-shell-knFiB7Ct.mjs +92 -0
  13. package/dist/as-array-Bn27x9cq.cjs +466 -0
  14. package/dist/as-array-DwarTaKP.mjs +455 -0
  15. package/dist/as-array-clear-btn-DAGervXL.cjs +48 -0
  16. package/dist/as-array-clear-btn-DIhzCKC9.mjs +43 -0
  17. package/dist/as-array.cjs +11 -0
  18. package/dist/as-array.d.cts +2 -0
  19. package/dist/as-array.d.mts +2 -0
  20. package/dist/as-array.mjs +11 -0
  21. package/dist/as-array.vue-C5r_ycIa.d.mts +9 -0
  22. package/dist/as-array.vue-CeBZRVm7.d.cts +9 -0
  23. package/dist/as-checkbox-B_9mwla6.mjs +285 -0
  24. package/dist/as-checkbox-DXGTVHPE.cjs +296 -0
  25. package/dist/as-checkbox.cjs +6 -0
  26. package/dist/as-checkbox.d.cts +2 -0
  27. package/dist/as-checkbox.d.mts +2 -0
  28. package/dist/as-checkbox.mjs +6 -0
  29. package/dist/as-checkbox.vue-BL53Xjmi.d.mts +9 -0
  30. package/dist/as-checkbox.vue-Da1KVG5J.d.cts +9 -0
  31. package/dist/as-collapsible-CqxeJut7.cjs +148 -0
  32. package/dist/as-collapsible-DtNCofNT.mjs +143 -0
  33. package/dist/as-date-C7tFQDkh.mjs +253 -0
  34. package/dist/as-date-k3MW3dmA.cjs +258 -0
  35. package/dist/as-date.cjs +8 -0
  36. package/dist/as-date.d.cts +2 -0
  37. package/dist/as-date.d.mts +2 -0
  38. package/dist/as-date.mjs +8 -0
  39. package/dist/as-date.vue-C5JaS3Sd.d.mts +9 -0
  40. package/dist/as-date.vue-e2ewS_V4.d.cts +9 -0
  41. package/dist/as-datetime-C030mzI5.cjs +258 -0
  42. package/dist/as-datetime-elcOoDT5.mjs +253 -0
  43. package/dist/as-datetime.cjs +8 -0
  44. package/dist/as-datetime.d.cts +2 -0
  45. package/dist/as-datetime.d.mts +2 -0
  46. package/dist/as-datetime.mjs +8 -0
  47. package/dist/as-datetime.vue-ClsSnJSV.d.mts +9 -0
  48. package/dist/as-datetime.vue-vfHFsby6.d.cts +9 -0
  49. package/dist/as-decimal-BJIGgPXU.cjs +711 -0
  50. package/dist/as-decimal-DtXjFPhe.mjs +694 -0
  51. package/dist/as-decimal.cjs +7 -0
  52. package/dist/as-decimal.d.cts +2 -0
  53. package/dist/as-decimal.d.mts +2 -0
  54. package/dist/as-decimal.mjs +7 -0
  55. package/dist/as-decimal.vue-B1pEKdjM.d.cts +25 -0
  56. package/dist/as-decimal.vue-CSCtYRRa.d.mts +25 -0
  57. package/dist/as-field-CXVjrEPQ.mjs +481 -0
  58. package/dist/as-field-shell-B2iTn-iM.cjs +346 -0
  59. package/dist/as-field-shell-Pdy3sAvr.mjs +341 -0
  60. package/dist/as-field-shell.cjs +5 -0
  61. package/dist/as-field-shell.d.cts +2 -0
  62. package/dist/as-field-shell.d.mts +2 -0
  63. package/dist/as-field-shell.mjs +5 -0
  64. package/dist/as-field-shell.vue-Ddnp8KxY.d.mts +37 -0
  65. package/dist/as-field-shell.vue-Dmt05vGD.d.cts +37 -0
  66. package/dist/as-field-wLYoaZnT.cjs +498 -0
  67. package/dist/as-field.cjs +4 -0
  68. package/dist/as-field.d.cts +25 -0
  69. package/dist/as-field.d.mts +26 -0
  70. package/dist/as-field.mjs +4 -0
  71. package/dist/as-form-CWwgyvfw.mjs +425 -0
  72. package/dist/as-form-DAIkyt7H.cjs +448 -0
  73. package/dist/as-form.cjs +7 -0
  74. package/dist/as-form.d.cts +2 -0
  75. package/dist/as-form.d.mts +2 -0
  76. package/dist/as-form.mjs +7 -0
  77. package/dist/as-form.vue-B4Bn0pbC.d.cts +158 -0
  78. package/dist/as-form.vue-DRrb_yoj.d.mts +158 -0
  79. package/dist/as-input-CpbV2k3s.cjs +231 -0
  80. package/dist/as-input-DIa8BzLv.mjs +226 -0
  81. package/dist/as-input-control-BzELjheN.mjs +266 -0
  82. package/dist/as-input-control-C5-DelZT.cjs +271 -0
  83. package/dist/as-input.cjs +8 -0
  84. package/dist/as-input.d.cts +2 -0
  85. package/dist/as-input.d.mts +2 -0
  86. package/dist/as-input.mjs +8 -0
  87. package/dist/as-input.vue-11ldp9uT.d.cts +17 -0
  88. package/dist/as-input.vue-fUhcvfv2.d.mts +17 -0
  89. package/dist/as-iterator-BYMNe6UJ.cjs +61 -0
  90. package/dist/as-iterator-CT5y1jyn.mjs +56 -0
  91. package/dist/as-iterator.cjs +5 -0
  92. package/dist/as-iterator.d.cts +14 -0
  93. package/dist/as-iterator.d.mts +15 -0
  94. package/dist/as-iterator.mjs +5 -0
  95. package/dist/as-number-BA55JIq1.cjs +387 -0
  96. package/dist/as-number-JPEwPK8Q.mjs +376 -0
  97. package/dist/as-number.cjs +8 -0
  98. package/dist/as-number.d.cts +2 -0
  99. package/dist/as-number.d.mts +2 -0
  100. package/dist/as-number.mjs +8 -0
  101. package/dist/as-number.vue-Bk-W7Vwv.d.mts +26 -0
  102. package/dist/as-number.vue-C2Aih98s.d.cts +26 -0
  103. package/dist/as-object-CT6lNEqt.mjs +300 -0
  104. package/dist/as-object-qUL7l8V1.cjs +305 -0
  105. package/dist/as-object.cjs +11 -0
  106. package/dist/as-object.d.cts +2 -0
  107. package/dist/as-object.d.mts +2 -0
  108. package/dist/as-object.mjs +11 -0
  109. package/dist/as-object.vue-CKwMyM_F.d.cts +13 -0
  110. package/dist/as-object.vue-Cg52b61-.d.mts +13 -0
  111. package/dist/as-paragraph-BGO-j4US.cjs +203 -0
  112. package/dist/as-paragraph-jIG_dg7_.mjs +198 -0
  113. package/dist/as-paragraph.cjs +2 -0
  114. package/dist/as-paragraph.d.cts +2 -0
  115. package/dist/as-paragraph.d.mts +2 -0
  116. package/dist/as-paragraph.mjs +2 -0
  117. package/dist/as-paragraph.vue-BDt0pBG-.d.cts +9 -0
  118. package/dist/as-paragraph.vue-C3FgTEt5.d.mts +9 -0
  119. package/dist/as-radio-B1N-gmoI.mjs +242 -0
  120. package/dist/as-radio-U3OK7bTg.cjs +247 -0
  121. package/dist/as-radio.cjs +6 -0
  122. package/dist/as-radio.d.cts +2 -0
  123. package/dist/as-radio.d.mts +2 -0
  124. package/dist/as-radio.mjs +6 -0
  125. package/dist/as-radio.vue-D_fweoN1.d.mts +9 -0
  126. package/dist/as-radio.vue-ZC4kLBnT.d.cts +9 -0
  127. package/dist/as-ref-CIifSSCQ.mjs +337 -0
  128. package/dist/as-ref-SImaIrwK.cjs +342 -0
  129. package/dist/as-ref.cjs +7 -0
  130. package/dist/as-ref.d.cts +2 -0
  131. package/dist/as-ref.d.mts +2 -0
  132. package/dist/as-ref.mjs +7 -0
  133. package/dist/as-ref.vue-BNeQeQpO.d.cts +9 -0
  134. package/dist/as-ref.vue-Cr5jeNDn.d.mts +9 -0
  135. package/dist/as-select-BB3uxACS.cjs +246 -0
  136. package/dist/as-select-UBGCVhku.mjs +241 -0
  137. package/dist/as-select.cjs +6 -0
  138. package/dist/as-select.d.cts +2 -0
  139. package/dist/as-select.d.mts +2 -0
  140. package/dist/as-select.mjs +6 -0
  141. package/dist/as-select.vue-Dd7huPq2.d.cts +9 -0
  142. package/dist/as-select.vue-RYpbZbKt.d.mts +9 -0
  143. package/dist/as-time-C24rvslH.cjs +258 -0
  144. package/dist/as-time-CQsxUs8P.mjs +253 -0
  145. package/dist/as-time.cjs +8 -0
  146. package/dist/as-time.d.cts +2 -0
  147. package/dist/as-time.d.mts +2 -0
  148. package/dist/as-time.mjs +8 -0
  149. package/dist/as-time.vue-huLx2B4l.d.mts +9 -0
  150. package/dist/as-time.vue-nMEHLXke.d.cts +9 -0
  151. package/dist/as-tuple-BU--cuuI.cjs +351 -0
  152. package/dist/as-tuple-DkI9swlW.mjs +340 -0
  153. package/dist/as-tuple.cjs +11 -0
  154. package/dist/as-tuple.d.cts +2 -0
  155. package/dist/as-tuple.d.mts +2 -0
  156. package/dist/as-tuple.mjs +11 -0
  157. package/dist/as-tuple.vue-CQhzOJsn.d.mts +9 -0
  158. package/dist/as-tuple.vue-DyskCkf-.d.cts +9 -0
  159. package/dist/as-union-BGvdxr3G.mjs +351 -0
  160. package/dist/as-union-C0btoJn3.cjs +368 -0
  161. package/dist/as-union.cjs +6 -0
  162. package/dist/as-union.d.cts +2 -0
  163. package/dist/as-union.d.mts +2 -0
  164. package/dist/as-union.mjs +6 -0
  165. package/dist/as-union.vue-BjlDPZn0.d.mts +9 -0
  166. package/dist/as-union.vue-CqjU3O10.d.cts +9 -0
  167. package/dist/as-variant-picker-BVs0AvjK.mjs +96 -0
  168. package/dist/as-variant-picker-DObQZHmm.cjs +107 -0
  169. package/dist/index.cjs +173 -0
  170. package/dist/index.d.cts +966 -0
  171. package/dist/index.d.mts +966 -0
  172. package/dist/index.mjs +105 -0
  173. package/dist/types-C4HRSxgV.d.cts +233 -0
  174. package/dist/types-Czm-Gtud.d.mts +233 -0
  175. package/dist/use-as-date-B7CtcRQd.cjs +329 -0
  176. package/dist/use-as-date-C39i9mzE.mjs +318 -0
  177. package/dist/use-as-dropdown-BMnEm6jF.mjs +82 -0
  178. package/dist/use-as-dropdown-C-Qy7Vt0.cjs +105 -0
  179. package/dist/use-as-locale-BrFdAgnU.mjs +23 -0
  180. package/dist/use-as-locale-C4z5stwD.cjs +34 -0
  181. package/dist/use-as-nested-sections-store-jdMRxjBE.cjs +80 -0
  182. package/dist/use-as-nested-sections-store-lhi0z5z1.mjs +63 -0
  183. package/dist/use-as-optional-add-flow-CuXEir_i.mjs +43 -0
  184. package/dist/use-as-optional-add-flow-STOaQWo9.cjs +48 -0
  185. package/dist/use-as-value-help-CBykDEjZ.mjs +89 -0
  186. package/dist/use-as-value-help-uANI3zWa.cjs +100 -0
  187. package/dist/use-form-context-Dwr8Ai1v.cjs +207 -0
  188. package/dist/use-form-context-bAj7UoSe.mjs +106 -0
  189. package/package.json +180 -0
  190. package/styles.d.ts +2 -0
@@ -0,0 +1,253 @@
1
+ import { t as as_field_shell_default } from "./as-field-shell-Pdy3sAvr.mjs";
2
+ import { t as as_adornment_shell_default } from "./as-adornment-shell-knFiB7Ct.mjs";
3
+ import { n as as_date_control_default, t as useAsDate } from "./use-as-date-C39i9mzE.mjs";
4
+ import { computed, createBlock, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, unref, withCtx } from "vue";
5
+ //#endregion
6
+ //#region src/components/defaults/as-time.vue
7
+ var as_time_default = /* @__PURE__ */ defineComponent({
8
+ __name: "as-time",
9
+ props: {
10
+ onBlur: {
11
+ type: Function,
12
+ required: true
13
+ },
14
+ error: {
15
+ type: String,
16
+ required: false
17
+ },
18
+ model: {
19
+ type: Object,
20
+ required: true
21
+ },
22
+ value: {
23
+ type: null,
24
+ required: false
25
+ },
26
+ label: {
27
+ type: String,
28
+ required: false
29
+ },
30
+ description: {
31
+ type: String,
32
+ required: false
33
+ },
34
+ hint: {
35
+ type: String,
36
+ required: false
37
+ },
38
+ placeholder: {
39
+ type: String,
40
+ required: false
41
+ },
42
+ prefixIcon: {
43
+ type: String,
44
+ required: false
45
+ },
46
+ suffixIcon: {
47
+ type: String,
48
+ required: false
49
+ },
50
+ class: {
51
+ type: [Object, String],
52
+ required: false
53
+ },
54
+ style: {
55
+ type: [Object, String],
56
+ required: false
57
+ },
58
+ optional: {
59
+ type: Boolean,
60
+ required: false,
61
+ skipCheck: true
62
+ },
63
+ onToggleOptional: {
64
+ type: Function,
65
+ required: false
66
+ },
67
+ required: {
68
+ type: Boolean,
69
+ required: false,
70
+ skipCheck: true
71
+ },
72
+ readonly: {
73
+ type: Boolean,
74
+ required: false,
75
+ skipCheck: true
76
+ },
77
+ type: {
78
+ type: String,
79
+ required: true
80
+ },
81
+ formAction: {
82
+ type: Object,
83
+ required: false
84
+ },
85
+ name: {
86
+ type: String,
87
+ required: false
88
+ },
89
+ field: {
90
+ type: Object,
91
+ required: false
92
+ },
93
+ options: {
94
+ type: Array,
95
+ required: false
96
+ },
97
+ maxLength: {
98
+ type: Number,
99
+ required: false
100
+ },
101
+ autocomplete: {
102
+ type: String,
103
+ required: false
104
+ },
105
+ title: {
106
+ type: String,
107
+ required: false
108
+ },
109
+ level: {
110
+ type: Number,
111
+ required: false
112
+ },
113
+ onRemove: {
114
+ type: Function,
115
+ required: false
116
+ },
117
+ canRemove: {
118
+ type: Boolean,
119
+ required: false
120
+ },
121
+ removeLabel: {
122
+ type: String,
123
+ required: false
124
+ },
125
+ arrayIndex: {
126
+ type: Number,
127
+ required: false
128
+ },
129
+ path: {
130
+ type: String,
131
+ required: true
132
+ },
133
+ valueHelp: {
134
+ type: Object,
135
+ required: false
136
+ },
137
+ singularLabel: {
138
+ type: String,
139
+ required: false
140
+ },
141
+ inputId: {
142
+ type: String,
143
+ required: true
144
+ },
145
+ errorId: {
146
+ type: String,
147
+ required: true
148
+ },
149
+ descId: {
150
+ type: String,
151
+ required: true
152
+ },
153
+ ariaDescribedBy: {
154
+ type: String,
155
+ required: false
156
+ },
157
+ currencyCode: {
158
+ type: String,
159
+ required: false
160
+ },
161
+ unitCode: {
162
+ type: String,
163
+ required: false
164
+ },
165
+ precisionScale: {
166
+ type: Number,
167
+ required: false
168
+ },
169
+ prefix: {
170
+ type: String,
171
+ required: false
172
+ },
173
+ suffix: {
174
+ type: String,
175
+ required: false
176
+ },
177
+ scale: {
178
+ type: Number,
179
+ required: false
180
+ },
181
+ hasAdornment: {
182
+ type: Boolean,
183
+ required: false
184
+ },
185
+ disabled: {
186
+ type: Boolean,
187
+ required: false
188
+ },
189
+ hidden: {
190
+ type: Boolean,
191
+ required: false
192
+ }
193
+ },
194
+ setup(__props) {
195
+ const props = __props;
196
+ const { inputType, displayValue, setFromInput } = useAsDate({
197
+ modelValue: () => props.model.value,
198
+ kind: "time",
199
+ onCommit: (v) => {
200
+ props.model.value = v;
201
+ }
202
+ });
203
+ const shellTitle = computed(() => props.currencyCode ?? props.unitCode ?? void 0);
204
+ return (_ctx, _cache) => {
205
+ return openBlock(), createBlock(as_field_shell_default, normalizeProps(guardReactiveProps(_ctx.$props)), {
206
+ default: withCtx(({ inputId }) => [__props.hasAdornment ? (openBlock(), createBlock(as_adornment_shell_default, {
207
+ key: 0,
208
+ "prefix-icon": __props.prefixIcon,
209
+ prefix: __props.prefix,
210
+ suffix: __props.suffix,
211
+ "suffix-icon": __props.suffixIcon,
212
+ error: __props.error,
213
+ required: __props.required,
214
+ title: shellTitle.value
215
+ }, {
216
+ default: withCtx(() => [createVNode(as_date_control_default, mergeProps(_ctx.$props, {
217
+ "input-id": inputId,
218
+ "input-type": unref(inputType),
219
+ "display-value": unref(displayValue),
220
+ "set-from-input": unref(setFromInput)
221
+ }), null, 16, [
222
+ "input-id",
223
+ "input-type",
224
+ "display-value",
225
+ "set-from-input"
226
+ ])]),
227
+ _: 2
228
+ }, 1032, [
229
+ "prefix-icon",
230
+ "prefix",
231
+ "suffix",
232
+ "suffix-icon",
233
+ "error",
234
+ "required",
235
+ "title"
236
+ ])) : (openBlock(), createBlock(as_date_control_default, mergeProps({ key: 1 }, _ctx.$props, {
237
+ "input-id": inputId,
238
+ "input-type": unref(inputType),
239
+ "display-value": unref(displayValue),
240
+ "set-from-input": unref(setFromInput)
241
+ }), null, 16, [
242
+ "input-id",
243
+ "input-type",
244
+ "display-value",
245
+ "set-from-input"
246
+ ]))]),
247
+ _: 1
248
+ }, 16);
249
+ };
250
+ }
251
+ });
252
+ //#endregion
253
+ export { as_time_default as t };
@@ -0,0 +1,8 @@
1
+ require("./use-form-context-Dwr8Ai1v.cjs");
2
+ require("./use-as-dropdown-C-Qy7Vt0.cjs");
3
+ require("./as-field-shell-B2iTn-iM.cjs");
4
+ require("./as-variant-picker-DObQZHmm.cjs");
5
+ require("./as-adornment-shell-9UmdNIPR.cjs");
6
+ require("./use-as-date-B7CtcRQd.cjs");
7
+ const require_as_time = require("./as-time-C24rvslH.cjs");
8
+ module.exports = require_as_time.as_time_default;
@@ -0,0 +1,2 @@
1
+ import { t as _default } from "./as-time.vue-nMEHLXke.cjs";
2
+ export = _default;
@@ -0,0 +1,2 @@
1
+ import { t as _default } from "./as-time.vue-huLx2B4l.mjs";
2
+ export { _default as default };
@@ -0,0 +1,8 @@
1
+ import "./use-form-context-bAj7UoSe.mjs";
2
+ import "./use-as-dropdown-BMnEm6jF.mjs";
3
+ import "./as-field-shell-Pdy3sAvr.mjs";
4
+ import "./as-variant-picker-BVs0AvjK.mjs";
5
+ import "./as-adornment-shell-knFiB7Ct.mjs";
6
+ import "./use-as-date-C39i9mzE.mjs";
7
+ import { t as as_time_default } from "./as-time-CQsxUs8P.mjs";
8
+ export { as_time_default as default };
@@ -0,0 +1,9 @@
1
+ import { i as TAsComponentProps } from "./types-Czm-Gtud.mjs";
2
+ import * as vue from "vue";
3
+
4
+ //#region src/components/defaults/as-time.vue.d.ts
5
+ type __VLS_Props = TAsComponentProps<number | string | null | undefined>;
6
+ declare const __VLS_export: vue.DefineComponent<__VLS_Props, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
7
+ declare const _default: typeof __VLS_export;
8
+ //#endregion
9
+ export { _default as t };
@@ -0,0 +1,9 @@
1
+ import { i as TAsComponentProps } from "./types-C4HRSxgV.cjs";
2
+ import * as vue from "vue";
3
+
4
+ //#region src/components/defaults/as-time.vue.d.ts
5
+ type __VLS_Props = TAsComponentProps<number | string | null | undefined>;
6
+ declare const __VLS_export: vue.DefineComponent<__VLS_Props, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
7
+ declare const _default: typeof __VLS_export;
8
+ //#endregion
9
+ export { _default as t };
@@ -0,0 +1,351 @@
1
+ const require_use_form_context = require("./use-form-context-Dwr8Ai1v.cjs");
2
+ const require_as_field = require("./as-field-wLYoaZnT.cjs");
3
+ const require_as_variant_picker = require("./as-variant-picker-DObQZHmm.cjs");
4
+ const require_use_as_optional_add_flow = require("./use-as-optional-add-flow-STOaQWo9.cjs");
5
+ const require_as_collapsible = require("./as-collapsible-CqxeJut7.cjs");
6
+ const require_as_array_clear_btn = require("./as-array-clear-btn-DAGervXL.cjs");
7
+ let vue = require("vue");
8
+ let _atscript_ui = require("@atscript/ui");
9
+ //#region src/composables/use-as-tuple.ts
10
+ /** Composable for managing tuple field state. Fixed-length, position-typed; auto-fills missing positions on mount unless optional. */
11
+ function useAsTuple(field) {
12
+ const { rootFormData, formContext, pathPrefix, getByPath, setByPath } = require_use_form_context.useFormContext("useAsTuple");
13
+ const handleChange = (0, vue.inject)(require_use_form_context.CHANGE_HANDLER_KEY, () => {});
14
+ const isOptional = field.prop.optional ?? false;
15
+ const itemFields = [];
16
+ const positionLabeled = [];
17
+ for (let i = 0; i < field.itemFields.length; i++) {
18
+ const itemField = field.itemFields[i];
19
+ const labeled = (0, _atscript_ui.getFieldMeta)(itemField.prop, _atscript_ui.META_LABEL) !== void 0;
20
+ const fallbackName = labeled ? "" : itemField.type;
21
+ itemFields.push({
22
+ ...itemField,
23
+ path: String(i),
24
+ name: fallbackName
25
+ });
26
+ positionLabeled.push(labeled);
27
+ }
28
+ const isEmpty = (0, vue.computed)(() => {
29
+ const v = getByPath(pathPrefix.value);
30
+ return !Array.isArray(v) || v.length === 0;
31
+ });
32
+ function fillMissing() {
33
+ let arr = getByPath(pathPrefix.value);
34
+ if (!Array.isArray(arr)) {
35
+ arr = [];
36
+ setByPath(pathPrefix.value, arr);
37
+ }
38
+ const tail = arr;
39
+ if (tail.length >= itemFields.length) return;
40
+ const resolver = (0, _atscript_ui.createFormValueResolver)(rootFormData().value, formContext.value);
41
+ for (let i = tail.length; i < itemFields.length; i++) tail.push((0, _atscript_ui.createFormData)(field.itemFields[i].prop, resolver).value);
42
+ handleChange("array-add", pathPrefix.value, tail);
43
+ }
44
+ function clear() {
45
+ if (!isOptional) return;
46
+ setByPath(pathPrefix.value, void 0);
47
+ handleChange("array-remove", pathPrefix.value, void 0);
48
+ }
49
+ (0, vue.onMounted)(() => {
50
+ if (!isOptional) fillMissing();
51
+ });
52
+ return {
53
+ itemFields,
54
+ positionLabeled,
55
+ isOptional,
56
+ isEmpty,
57
+ clear,
58
+ fillMissing
59
+ };
60
+ }
61
+ //#endregion
62
+ //#region src/components/defaults/as-tuple.vue?vue&type=script&setup=true&lang.ts
63
+ const _hoisted_1 = {
64
+ key: 0,
65
+ class: "as-collapsible-description"
66
+ };
67
+ //#endregion
68
+ //#region src/components/defaults/as-tuple.vue
69
+ var as_tuple_default = /* @__PURE__ */ (0, vue.defineComponent)({
70
+ __name: "as-tuple",
71
+ props: {
72
+ onBlur: {
73
+ type: Function,
74
+ required: true
75
+ },
76
+ error: {
77
+ type: String,
78
+ required: false
79
+ },
80
+ model: {
81
+ type: Object,
82
+ required: true
83
+ },
84
+ value: {
85
+ type: null,
86
+ required: false
87
+ },
88
+ label: {
89
+ type: String,
90
+ required: false
91
+ },
92
+ description: {
93
+ type: String,
94
+ required: false
95
+ },
96
+ hint: {
97
+ type: String,
98
+ required: false
99
+ },
100
+ placeholder: {
101
+ type: String,
102
+ required: false
103
+ },
104
+ prefixIcon: {
105
+ type: String,
106
+ required: false
107
+ },
108
+ suffixIcon: {
109
+ type: String,
110
+ required: false
111
+ },
112
+ class: {
113
+ type: [Object, String],
114
+ required: false
115
+ },
116
+ style: {
117
+ type: [Object, String],
118
+ required: false
119
+ },
120
+ optional: {
121
+ type: Boolean,
122
+ required: false,
123
+ skipCheck: true
124
+ },
125
+ onToggleOptional: {
126
+ type: Function,
127
+ required: false
128
+ },
129
+ required: {
130
+ type: Boolean,
131
+ required: false,
132
+ skipCheck: true
133
+ },
134
+ readonly: {
135
+ type: Boolean,
136
+ required: false,
137
+ skipCheck: true
138
+ },
139
+ type: {
140
+ type: String,
141
+ required: true
142
+ },
143
+ formAction: {
144
+ type: Object,
145
+ required: false
146
+ },
147
+ name: {
148
+ type: String,
149
+ required: false
150
+ },
151
+ field: {
152
+ type: Object,
153
+ required: false
154
+ },
155
+ options: {
156
+ type: Array,
157
+ required: false
158
+ },
159
+ maxLength: {
160
+ type: Number,
161
+ required: false
162
+ },
163
+ autocomplete: {
164
+ type: String,
165
+ required: false
166
+ },
167
+ title: {
168
+ type: String,
169
+ required: false
170
+ },
171
+ level: {
172
+ type: Number,
173
+ required: false
174
+ },
175
+ onRemove: {
176
+ type: Function,
177
+ required: false
178
+ },
179
+ canRemove: {
180
+ type: Boolean,
181
+ required: false
182
+ },
183
+ removeLabel: {
184
+ type: String,
185
+ required: false
186
+ },
187
+ arrayIndex: {
188
+ type: Number,
189
+ required: false
190
+ },
191
+ path: {
192
+ type: String,
193
+ required: true
194
+ },
195
+ valueHelp: {
196
+ type: Object,
197
+ required: false
198
+ },
199
+ singularLabel: {
200
+ type: String,
201
+ required: false
202
+ },
203
+ inputId: {
204
+ type: String,
205
+ required: true
206
+ },
207
+ errorId: {
208
+ type: String,
209
+ required: true
210
+ },
211
+ descId: {
212
+ type: String,
213
+ required: true
214
+ },
215
+ ariaDescribedBy: {
216
+ type: String,
217
+ required: false
218
+ },
219
+ currencyCode: {
220
+ type: String,
221
+ required: false
222
+ },
223
+ unitCode: {
224
+ type: String,
225
+ required: false
226
+ },
227
+ precisionScale: {
228
+ type: Number,
229
+ required: false
230
+ },
231
+ prefix: {
232
+ type: String,
233
+ required: false
234
+ },
235
+ suffix: {
236
+ type: String,
237
+ required: false
238
+ },
239
+ scale: {
240
+ type: Number,
241
+ required: false
242
+ },
243
+ hasAdornment: {
244
+ type: Boolean,
245
+ required: false
246
+ },
247
+ disabled: {
248
+ type: Boolean,
249
+ required: false
250
+ },
251
+ hidden: {
252
+ type: Boolean,
253
+ required: false
254
+ }
255
+ },
256
+ setup(__props) {
257
+ const props = __props;
258
+ const tupleField = props.field;
259
+ const unionCtx = require_use_form_context.useAsUnionVariant();
260
+ const hasVariantPicker = (0, vue.computed)(() => unionCtx !== void 0 && unionCtx.variants.length > 1);
261
+ const optionalEnabled = (0, vue.computed)(() => Array.isArray(props.model?.value));
262
+ const disabled = (0, vue.computed)(() => props.disabled ?? false);
263
+ const { itemFields, positionLabeled, isOptional, clear, fillMissing } = useAsTuple(tupleField);
264
+ const level = (0, vue.computed)(() => props.level ?? 0);
265
+ const defaultOpen = !isOptional;
266
+ const collapsibleRef = (0, vue.useTemplateRef)("collapsibleRef");
267
+ const { composeAction } = require_use_as_optional_add_flow.useAsOptionalAddFlow({ path: () => props.path });
268
+ function handleEnableOptional() {
269
+ collapsibleRef.value?.runAndFocusNew(composeAction(() => {
270
+ props.onToggleOptional?.(true);
271
+ fillMissing();
272
+ }), 2);
273
+ }
274
+ return (_ctx, _cache) => {
275
+ return (0, vue.openBlock)(), (0, vue.createBlock)(require_as_collapsible.as_collapsible_default, {
276
+ ref_key: "collapsibleRef",
277
+ ref: collapsibleRef,
278
+ class: (0, vue.normalizeClass)(_ctx.$props.class),
279
+ title: __props.title,
280
+ "array-index": __props.arrayIndex,
281
+ description: __props.description,
282
+ level: level.value,
283
+ optional: !!__props.optional,
284
+ "optional-enabled": optionalEnabled.value,
285
+ path: __props.path,
286
+ error: __props.error,
287
+ hidden: __props.hidden,
288
+ "default-open": defaultOpen
289
+ }, (0, vue.createSlots)({
290
+ "title-extras": (0, vue.withCtx)(() => [hasVariantPicker.value ? ((0, vue.openBlock)(), (0, vue.createBlock)(require_as_variant_picker.as_variant_picker_default, {
291
+ key: 0,
292
+ "union-context": (0, vue.unref)(unionCtx),
293
+ disabled: disabled.value
294
+ }, null, 8, ["union-context", "disabled"])) : (0, vue.createCommentVNode)("v-if", true)]),
295
+ body: (0, vue.withCtx)(() => [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)((0, vue.unref)(itemFields), (itemField, i) => {
296
+ return (0, vue.openBlock)(), (0, vue.createBlock)(require_as_field.as_field_default, {
297
+ key: i,
298
+ field: itemField,
299
+ "array-index": (0, vue.unref)(positionLabeled)[i] ? void 0 : i
300
+ }, null, 8, ["field", "array-index"]);
301
+ }), 128))]),
302
+ empty: (0, vue.withCtx)(() => [(0, vue.withDirectives)((0, vue.createElementVNode)("div", { class: (0, vue.normalizeClass)(["as-object-empty as-grid-item", _ctx.$props.class]) }, [(0, vue.createElementVNode)("button", {
303
+ type: "button",
304
+ class: "as-object-empty-add",
305
+ onClick: handleEnableOptional
306
+ }, [_cache[0] || (_cache[0] = (0, vue.createElementVNode)("span", {
307
+ class: "i-as-field-fill as-object-empty-add-icon",
308
+ "aria-hidden": "true"
309
+ }, null, -1)), (0, vue.createTextVNode)(" Add " + (0, vue.toDisplayString)(__props.title), 1)]), __props.description ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_1, (0, vue.toDisplayString)(__props.description), 1)) : (0, vue.createCommentVNode)("v-if", true)], 2), [[vue.vShow, !__props.hidden]])]),
310
+ _: 2
311
+ }, [(0, vue.unref)(isOptional) && optionalEnabled.value ? {
312
+ name: "actions",
313
+ fn: (0, vue.withCtx)(() => [(0, vue.createVNode)(require_as_array_clear_btn.as_array_clear_btn_default, {
314
+ optional: true,
315
+ label: __props.title,
316
+ disabled: disabled.value,
317
+ onClear: (0, vue.unref)(clear)
318
+ }, null, 8, [
319
+ "label",
320
+ "disabled",
321
+ "onClear"
322
+ ])]),
323
+ key: "0"
324
+ } : void 0]), 1032, [
325
+ "class",
326
+ "title",
327
+ "array-index",
328
+ "description",
329
+ "level",
330
+ "optional",
331
+ "optional-enabled",
332
+ "path",
333
+ "error",
334
+ "hidden"
335
+ ]);
336
+ };
337
+ }
338
+ });
339
+ //#endregion
340
+ Object.defineProperty(exports, "as_tuple_default", {
341
+ enumerable: true,
342
+ get: function() {
343
+ return as_tuple_default;
344
+ }
345
+ });
346
+ Object.defineProperty(exports, "useAsTuple", {
347
+ enumerable: true,
348
+ get: function() {
349
+ return useAsTuple;
350
+ }
351
+ });