@atscript/vue-form 0.1.203 → 0.1.205

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 (195) hide show
  1. package/dist/{_editing-hold-Bj0kZjCr.cjs → _editing-hold-D2uqwszu.cjs} +3 -3
  2. package/dist/{_editing-hold-C6emgUTM.mjs → _editing-hold-D_X5gXHh.mjs} +3 -3
  3. package/dist/_shape-7OdPsQao.cjs +56 -0
  4. package/dist/_shape-A661ZxnJ.mjs +39 -0
  5. package/dist/{as-action-B69WsGIB.mjs → as-action-kBskX68v.mjs} +8 -0
  6. package/dist/{as-action-B3NIgGTV.cjs → as-action-rT6WXLph.cjs} +8 -0
  7. package/dist/as-action.cjs +1 -1
  8. package/dist/as-action.d.cts +1 -1
  9. package/dist/as-action.d.mts +1 -1
  10. package/dist/as-action.mjs +1 -1
  11. package/dist/{as-action.vue-Cz7I0w6k.d.mts → as-action.vue-B7RrjGhF.d.cts} +1 -1
  12. package/dist/{as-action.vue-CzG-4mHk.d.cts → as-action.vue-Dtez-EWu.d.mts} +1 -1
  13. package/dist/{as-array-CWuMR-2P.cjs → as-array-C5lqDDLN.cjs} +14 -6
  14. package/dist/{as-array-dttDB3Rg.mjs → as-array-Tt_4kl5r.mjs} +14 -6
  15. package/dist/{as-array-clear-btn-CRfCFJ73.mjs → as-array-clear-btn-DGUQY_7_.mjs} +1 -1
  16. package/dist/{as-array-clear-btn-BX3HSWel.cjs → as-array-clear-btn-Dk88CYmS.cjs} +1 -1
  17. package/dist/as-array.cjs +1 -1
  18. package/dist/as-array.d.cts +1 -1
  19. package/dist/as-array.d.mts +1 -1
  20. package/dist/as-array.mjs +1 -1
  21. package/dist/{as-array.vue-BspRfMHl.d.cts → as-array.vue-Ca_xan2n.d.mts} +1 -1
  22. package/dist/{as-array.vue-DTrR21eK.d.mts → as-array.vue-Dp_zd3ZM.d.cts} +1 -1
  23. package/dist/{as-checkbox-BS0fjlQC.mjs → as-checkbox-CCX9E19U.mjs} +14 -4
  24. package/dist/{as-checkbox-DyA1ncSp.cjs → as-checkbox-D7NywgIa.cjs} +14 -4
  25. package/dist/as-checkbox.cjs +1 -1
  26. package/dist/as-checkbox.d.cts +1 -1
  27. package/dist/as-checkbox.d.mts +1 -1
  28. package/dist/as-checkbox.mjs +1 -1
  29. package/dist/{as-checkbox.vue-CcifJWeG.d.mts → as-checkbox.vue-BClSBx1g.d.mts} +1 -1
  30. package/dist/{as-checkbox.vue-CliEtXzy.d.cts → as-checkbox.vue-Bf3qqcKu.d.cts} +1 -1
  31. package/dist/{as-collapsible-B0im1dAa.cjs → as-collapsible-CTOLQ3IK.cjs} +1 -1
  32. package/dist/{as-collapsible-B4Vb0XIR.mjs → as-collapsible-CvBoWb0D.mjs} +1 -1
  33. package/dist/as-collapsible.cjs +1 -1
  34. package/dist/as-collapsible.d.cts +1 -1
  35. package/dist/as-collapsible.d.mts +1 -1
  36. package/dist/as-collapsible.mjs +1 -1
  37. package/dist/{as-collapsible.vue-DmfY2xZi.d.mts → as-collapsible.vue-BXdpM7_K.d.cts} +1 -1
  38. package/dist/{as-collapsible.vue-c4kJaqr8.d.cts → as-collapsible.vue-CUhn1EVX.d.mts} +1 -1
  39. package/dist/{as-date-Wk0mReg2.mjs → as-date-3haOaiAG.mjs} +12 -4
  40. package/dist/{as-date-bI28vJja.cjs → as-date-Ubw_1-Ai.cjs} +12 -4
  41. package/dist/as-date.cjs +1 -1
  42. package/dist/as-date.d.cts +1 -1
  43. package/dist/as-date.d.mts +1 -1
  44. package/dist/as-date.mjs +1 -1
  45. package/dist/{as-date.vue-DlZIPl1M.d.cts → as-date.vue-B5NWZ5ON.d.cts} +1 -1
  46. package/dist/{as-date.vue-HBqgKpbV.d.mts → as-date.vue-CJQOrfj3.d.mts} +1 -1
  47. package/dist/{as-datetime-Ca-23Nrq.cjs → as-datetime--7bl-yGW.cjs} +12 -4
  48. package/dist/{as-datetime-F2PdaCh1.mjs → as-datetime-BTekpasP.mjs} +12 -4
  49. package/dist/as-datetime.cjs +1 -1
  50. package/dist/as-datetime.d.cts +1 -1
  51. package/dist/as-datetime.d.mts +1 -1
  52. package/dist/as-datetime.mjs +1 -1
  53. package/dist/{as-datetime.vue-BOewNSCq.d.mts → as-datetime.vue-BvmFdGxe.d.cts} +1 -1
  54. package/dist/{as-datetime.vue-CTkKY2Cc.d.cts → as-datetime.vue-CzMz_RUy.d.mts} +1 -1
  55. package/dist/{as-decimal-4zD1qPmT.mjs → as-decimal-7CIE6UKX.mjs} +21 -4
  56. package/dist/{as-decimal-CYIBnc-k.cjs → as-decimal-DWPRXsYY.cjs} +21 -4
  57. package/dist/as-decimal.cjs +1 -1
  58. package/dist/as-decimal.d.cts +1 -1
  59. package/dist/as-decimal.d.mts +1 -1
  60. package/dist/as-decimal.mjs +1 -1
  61. package/dist/{as-decimal.vue-C6SpdtjD.d.cts → as-decimal.vue-DdVqHtMT.d.cts} +1 -1
  62. package/dist/{as-decimal.vue-DmjoBpWm.d.mts → as-decimal.vue-DyDt1ds0.d.mts} +1 -1
  63. package/dist/{as-field-BdFUGqKv.cjs → as-field-DAClnYiP.cjs} +13 -5
  64. package/dist/{as-field-U_EtrpNj.mjs → as-field-jh5AWref.mjs} +14 -6
  65. package/dist/{as-field-shell-ha1iaJnK.cjs → as-field-shell-Cu8jxZYj.cjs} +17 -7
  66. package/dist/{as-field-shell-DQ30etIq.mjs → as-field-shell-DPzfvPo0.mjs} +17 -7
  67. package/dist/as-field-shell.cjs +1 -1
  68. package/dist/as-field-shell.d.cts +1 -1
  69. package/dist/as-field-shell.d.mts +1 -1
  70. package/dist/as-field-shell.mjs +1 -1
  71. package/dist/{as-field-shell.vue-CVDPz5RX.d.cts → as-field-shell.vue-CPy2uA-b.d.mts} +1 -1
  72. package/dist/{as-field-shell.vue-Dj34leHW.d.mts → as-field-shell.vue-D-8AWUGW.d.cts} +1 -1
  73. package/dist/as-field.cjs +1 -1
  74. package/dist/as-field.mjs +1 -1
  75. package/dist/{as-form-WhZH4ozr.mjs → as-form-B8d1MVTB.mjs} +35 -7
  76. package/dist/{as-form-Dfrq97Tv.cjs → as-form-r5pkXt5U.cjs} +34 -6
  77. package/dist/as-form.cjs +1 -1
  78. package/dist/as-form.d.cts +1 -1
  79. package/dist/as-form.d.mts +1 -1
  80. package/dist/as-form.mjs +1 -1
  81. package/dist/{as-form.vue-DEGb6oP3.d.cts → as-form.vue-BSY6AhPz.d.mts} +27 -9
  82. package/dist/{as-form.vue-D7J9Mm_V.d.mts → as-form.vue-bt-v037w.d.cts} +27 -9
  83. package/dist/{as-input-Cr2zcWgm.cjs → as-input-BTbu0eF-.cjs} +10 -2
  84. package/dist/{as-input-control-Wygcey6h.mjs → as-input-control-1igViaqC.mjs} +12 -5
  85. package/dist/{as-input-control-D8xoJfr7.cjs → as-input-control-uJpmle-G.cjs} +12 -5
  86. package/dist/{as-input-Du26WjkP.mjs → as-input-tKw19JnF.mjs} +10 -2
  87. package/dist/as-input.cjs +1 -1
  88. package/dist/as-input.d.cts +1 -1
  89. package/dist/as-input.d.mts +1 -1
  90. package/dist/as-input.mjs +1 -1
  91. package/dist/{as-input.vue-CTeXkWxQ.d.mts → as-input.vue-CuC3DYeR.d.cts} +1 -1
  92. package/dist/{as-input.vue-D-cM4wBe.d.cts → as-input.vue-DawR7pA-.d.mts} +1 -1
  93. package/dist/{as-iterator-BvL2pCKj.mjs → as-iterator-B1o83rKV.mjs} +2 -2
  94. package/dist/{as-iterator-BgYp1qj4.cjs → as-iterator-q_w9HBHt.cjs} +2 -2
  95. package/dist/as-iterator.cjs +1 -1
  96. package/dist/as-iterator.mjs +1 -1
  97. package/dist/{as-multi-select-CNRqlh1o.cjs → as-multi-select-DPQ9_Qf1.cjs} +9 -1
  98. package/dist/{as-multi-select-C9yGmtWR.mjs → as-multi-select-DhOlsgdq.mjs} +9 -1
  99. package/dist/as-multi-select.cjs +1 -1
  100. package/dist/as-multi-select.d.cts +1 -1
  101. package/dist/as-multi-select.d.mts +1 -1
  102. package/dist/as-multi-select.mjs +1 -1
  103. package/dist/{as-multi-select.vue-CvZHtvck.d.cts → as-multi-select.vue-CXC47PBk.d.cts} +1 -1
  104. package/dist/{as-multi-select.vue-DVSSEboS.d.mts → as-multi-select.vue-CbVBJq8N.d.mts} +1 -1
  105. package/dist/{as-number-DEkR-Oud.cjs → as-number-CJmX5rb1.cjs} +11 -4
  106. package/dist/{as-number-CsoSsIJ8.mjs → as-number-CVjNUjiS.mjs} +11 -4
  107. package/dist/as-number.cjs +1 -1
  108. package/dist/as-number.d.cts +1 -1
  109. package/dist/as-number.d.mts +1 -1
  110. package/dist/as-number.mjs +1 -1
  111. package/dist/{as-number.vue-7XSQA1oV.d.cts → as-number.vue-BdNvLZca.d.mts} +1 -1
  112. package/dist/{as-number.vue-CEcDCyhs.d.mts → as-number.vue-hJuiJJ70.d.cts} +1 -1
  113. package/dist/{as-object-DIEi_L2T.mjs → as-object-DY5IEc94.mjs} +12 -4
  114. package/dist/{as-object-DZHwEfd8.cjs → as-object-Dq5CPM3i.cjs} +12 -4
  115. package/dist/as-object.cjs +1 -1
  116. package/dist/as-object.d.cts +1 -1
  117. package/dist/as-object.d.mts +1 -1
  118. package/dist/as-object.mjs +1 -1
  119. package/dist/{as-object.vue-eoznJfgx.d.mts → as-object.vue-DHFGLetx.d.cts} +1 -1
  120. package/dist/{as-object.vue-l5nTngPG.d.cts → as-object.vue-DVK_BKOL.d.mts} +1 -1
  121. package/dist/{as-paragraph-wAHRsd_e.cjs → as-paragraph-CaytophZ.cjs} +8 -0
  122. package/dist/{as-paragraph-B49pXlhP.mjs → as-paragraph-ChOqmJe2.mjs} +8 -0
  123. package/dist/as-paragraph.cjs +1 -1
  124. package/dist/as-paragraph.d.cts +1 -1
  125. package/dist/as-paragraph.d.mts +1 -1
  126. package/dist/as-paragraph.mjs +1 -1
  127. package/dist/{as-paragraph.vue-BRByQ1K4.d.cts → as-paragraph.vue-6mBonWFb.d.mts} +1 -1
  128. package/dist/{as-paragraph.vue-CwNr9kox.d.mts → as-paragraph.vue-B_aPmK-B.d.cts} +1 -1
  129. package/dist/{as-radio-Bn14VyaN.mjs → as-radio-BW9K8h6V.mjs} +9 -1
  130. package/dist/{as-radio-CvIgHH9G.cjs → as-radio-C6PnEdjD.cjs} +9 -1
  131. package/dist/as-radio.cjs +1 -1
  132. package/dist/as-radio.d.cts +1 -1
  133. package/dist/as-radio.d.mts +1 -1
  134. package/dist/as-radio.mjs +1 -1
  135. package/dist/{as-radio.vue-CmOKjYGn.d.cts → as-radio.vue-BFxeAHfl.d.mts} +1 -1
  136. package/dist/{as-radio.vue-rTZDD-Um.d.mts → as-radio.vue-B_tDoVl1.d.cts} +1 -1
  137. package/dist/{as-ref-DhWEKsYJ.mjs → as-ref-CXtYo-UZ.mjs} +14 -7
  138. package/dist/{as-ref-BNESufCy.cjs → as-ref-DTsWT_zU.cjs} +14 -7
  139. package/dist/as-ref.cjs +1 -1
  140. package/dist/as-ref.d.cts +1 -1
  141. package/dist/as-ref.d.mts +1 -1
  142. package/dist/as-ref.mjs +1 -1
  143. package/dist/{as-ref.vue-C1Qg56oh.d.cts → as-ref.vue-CqFDKTYk.d.mts} +1 -1
  144. package/dist/{as-ref.vue-CRUzXTRQ.d.mts → as-ref.vue-gCsaCDQx.d.cts} +1 -1
  145. package/dist/{as-select-Csr2229O.mjs → as-select-CbZNupL6.mjs} +22 -9
  146. package/dist/{as-select-COxfMWYf.cjs → as-select-DOvo86Oc.cjs} +21 -8
  147. package/dist/as-select.cjs +1 -1
  148. package/dist/as-select.d.cts +1 -1
  149. package/dist/as-select.d.mts +1 -1
  150. package/dist/as-select.mjs +1 -1
  151. package/dist/{as-select.vue-DlQ93_AO.d.cts → as-select.vue-BN3zvSGs.d.mts} +1 -1
  152. package/dist/{as-select.vue-DnfV-12W.d.mts → as-select.vue-Bh7ppdg9.d.cts} +1 -1
  153. package/dist/{as-time-YMnd789f.mjs → as-time-BDpnkjy8.mjs} +11 -4
  154. package/dist/{as-time-e40w14c7.cjs → as-time-CfnhY3Pf.cjs} +11 -4
  155. package/dist/as-time.cjs +1 -1
  156. package/dist/as-time.d.cts +1 -1
  157. package/dist/as-time.d.mts +1 -1
  158. package/dist/as-time.mjs +1 -1
  159. package/dist/{as-time.vue-DAuXlrGs.d.cts → as-time.vue-C-ruJhmX.d.mts} +1 -1
  160. package/dist/{as-time.vue-PRLKRy84.d.mts → as-time.vue-C_0z-HOS.d.cts} +1 -1
  161. package/dist/{as-tuple-BjMI93bC.mjs → as-tuple--wL64cCu.mjs} +13 -5
  162. package/dist/{as-tuple-Bb-sQh6T.cjs → as-tuple-C5_dcvsH.cjs} +13 -5
  163. package/dist/as-tuple.cjs +1 -1
  164. package/dist/as-tuple.d.cts +1 -1
  165. package/dist/as-tuple.d.mts +1 -1
  166. package/dist/as-tuple.mjs +1 -1
  167. package/dist/{as-tuple.vue-Chqi1IO6.d.mts → as-tuple.vue-BDiSN-np.d.cts} +1 -1
  168. package/dist/{as-tuple.vue-DEL4sOwq.d.cts → as-tuple.vue-CGWun6Iw.d.mts} +1 -1
  169. package/dist/{as-union-D6JPYyYf.cjs → as-union-D3NoKN1H.cjs} +14 -3
  170. package/dist/{as-union-D7FONvHe.mjs → as-union-DAnpGBeK.mjs} +15 -4
  171. package/dist/as-union.cjs +1 -1
  172. package/dist/as-union.d.cts +1 -1
  173. package/dist/as-union.d.mts +1 -1
  174. package/dist/as-union.mjs +1 -1
  175. package/dist/{as-union.vue-BCdmqdYk.d.mts → as-union.vue-BpcREl7L.d.mts} +1 -1
  176. package/dist/{as-union.vue-CKGLn4ni.d.cts → as-union.vue-DuUeLY1X.d.cts} +1 -1
  177. package/dist/{as-variant-picker-VixxxnXA.mjs → as-variant-picker-CihlFH-c.mjs} +1 -1
  178. package/dist/{as-variant-picker-13N8TxuF.cjs → as-variant-picker-CpCxKFtT.cjs} +1 -1
  179. package/dist/index.cjs +56 -26
  180. package/dist/index.d.cts +22 -22
  181. package/dist/index.d.mts +22 -22
  182. package/dist/index.mjs +28 -28
  183. package/dist/{types-ChQuWLmd.d.mts → types-271BUWyf.d.mts} +29 -3
  184. package/dist/{types-BmF8iDTN.d.cts → types-DbjorSCn.d.cts} +29 -3
  185. package/dist/{use-as-date-CAmqx1O7.cjs → use-as-date-BigwPKEs.cjs} +13 -3
  186. package/dist/{use-as-date-CpXG9klN.mjs → use-as-date-iSu5NS79.mjs} +13 -3
  187. package/dist/{use-as-model-texts-BNO2SFQF.cjs → use-as-model-texts-C3V56UDt.cjs} +1 -1
  188. package/dist/{use-as-model-texts-BTFyHNqS.mjs → use-as-model-texts-Cpx5bHJQ.mjs} +1 -1
  189. package/dist/{use-as-value-help-LDhcfxFi.cjs → use-as-value-help-CQMUkP1r.cjs} +4 -2
  190. package/dist/{use-as-value-help-LQWMkS5m.mjs → use-as-value-help-DE8KCbqo.mjs} +4 -2
  191. package/dist/{use-form-context-p2PucQHk.mjs → use-form-context-0FtVVTvf.mjs} +2 -1
  192. package/dist/{use-form-context-d0IcFey0.cjs → use-form-context-U6vg1uqK.cjs} +7 -0
  193. package/package.json +10 -10
  194. package/dist/_shape-BDO-1MzF.cjs +0 -87
  195. package/dist/_shape-DhwW2SvD.mjs +0 -58
@@ -1,12 +1,12 @@
1
1
  import { r as resetKeepingFocus } from "./focus-after-toggle-DAwak7c1.mjs";
2
- import { _ as MODEL_TEXTS_KEY, a as CHANGE_HANDLER_KEY, b as TYPES_KEY, c as ERRORS_KEY, d as FORM_NORMALIZED_DATA_KEY, f as FORM_PATCH_KEY, g as LOCK_KEY, i as ACTION_HANDLER_KEY, l as FORM_CONTEXT_KEY, m as HIDE_ROOT_TITLE_KEY, o as COMPONENTS_KEY, p as FORM_STATE_KEY, s as DISMISS_EXTERNAL_AT_KEY, u as FORM_DATA_KEY, v as PATH_PREFIX_KEY, y as ROOT_DATA_KEY } from "./use-form-context-p2PucQHk.mjs";
2
+ import { _ as LOCK_KEY, a as CHANGE_HANDLER_KEY, b as ROOT_DATA_KEY, c as ERRORS_KEY, d as FORM_NORMALIZED_DATA_KEY, f as FORM_OPTIONAL_KEY, h as HIDE_ROOT_TITLE_KEY, i as ACTION_HANDLER_KEY, l as FORM_CONTEXT_KEY, m as FORM_STATE_KEY, o as COMPONENTS_KEY, p as FORM_PATCH_KEY, s as DISMISS_EXTERNAL_AT_KEY, u as FORM_DATA_KEY, v as MODEL_TEXTS_KEY, x as TYPES_KEY, y as PATH_PREFIX_KEY } from "./use-form-context-0FtVVTvf.mjs";
3
3
  import { i as useAsNestedSectionsStore, n as provideAsNestedSectionsStore, t as DESCENDANT_ERROR_COUNTS_KEY } from "./use-as-nested-sections-store-CkrMJbnN.mjs";
4
- import { t as CLIENT_FACTORY_KEY } from "./use-as-value-help-LQWMkS5m.mjs";
4
+ import { t as CLIENT_FACTORY_KEY } from "./use-as-value-help-DE8KCbqo.mjs";
5
5
  import { o as useAsTexts } from "./use-as-locale-CznDr-7i.mjs";
6
- import { t as as_field_default } from "./as-field-U_EtrpNj.mjs";
7
- import { t as as_iterator_default } from "./as-iterator-BvL2pCKj.mjs";
6
+ import { t as as_field_default } from "./as-field-jh5AWref.mjs";
7
+ import { t as as_iterator_default } from "./as-iterator-B1o83rKV.mjs";
8
8
  import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, inject, isProxy, isRef, mergeProps, nextTick, normalizeProps, openBlock, provide, reactive, ref, renderSlot, shallowRef, toDisplayString, toRaw, toValue, unref, watch, watchEffect, withModifiers } from "vue";
9
- import { FORM_ERROR_KEY, META_DESCRIPTION, META_LABEL, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_SUBMIT_TEXT, buildDescendantErrorCounts, buildFormDiff, buildFormRebase, collectDirtyPaths, createFormData, createFormValueResolver, deepClone, deepEqual, deleteByPath, getByPath, getDeclaredFormActions, getFormValidator, iteratePathAncestors, mergeErrorMaps, omitPaths, omitSkippedNavFields, resolveFormProp, setByPath, unionVariantChanged } from "@atscript/ui";
9
+ import { FORM_ERROR_KEY, META_DESCRIPTION, META_LABEL, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_SUBMIT_TEXT, buildDescendantErrorCounts, buildFormDiff, buildFormRebase, collectDirtyPaths, createFormData, createFormValueResolver, deepClone, deepEqual, deleteByPath, getByPath, getDeclaredFormActions, getFormValidator, iteratePathAncestors, mergeErrorMaps, normalizeLoadedEmpty, omitDerivedFields, omitPaths, omitSkippedNavFields, resolveFormProp, setByPath, unionVariantChanged } from "@atscript/ui";
10
10
  //#region src/composables/use-as-form-patch.ts
11
11
  /**
12
12
  * Internal factory invoked by `useAsForm` when `trackChanges` is enabled. Owns
@@ -440,6 +440,16 @@ function useAsForm(options) {
440
440
  })
441
441
  });
442
442
  const remountKey = ref(0);
443
+ watch(() => data.value.value, (value) => {
444
+ const def = options.def();
445
+ normalizeLoadedEmpty(def, value, {
446
+ mode: options.optionalMode?.(),
447
+ edit: def.edit === true
448
+ });
449
+ }, {
450
+ flush: "sync",
451
+ immediate: true
452
+ });
443
453
  const tracker = options.trackChanges?.() ? createAsFormPatch(() => options.def(), () => data.value, () => {
444
454
  remountKey.value++;
445
455
  }) : void 0;
@@ -454,6 +464,10 @@ function useAsForm(options) {
454
464
  provide(TYPES_KEY, computed(() => options.types?.() ?? {}));
455
465
  provide(COMPONENTS_KEY, computed(() => options.components?.()));
456
466
  provide(HIDE_ROOT_TITLE_KEY, options.hideRootTitle?.() === true);
467
+ provide(FORM_OPTIONAL_KEY, {
468
+ mode: computed(() => options.optionalMode?.()),
469
+ edit: computed(() => options.def().edit === true)
470
+ });
457
471
  const ext = useAsExternalErrors({ source: () => options.errors?.() });
458
472
  provide(ERRORS_KEY, ext.effective);
459
473
  provide(DISMISS_EXTERNAL_AT_KEY, ext.dismissAt);
@@ -556,9 +570,18 @@ function useAsForm(options) {
556
570
  function supportsAction(def, actionId) {
557
571
  return getDeclaredFormActions(def).some((a) => a.id === actionId);
558
572
  }
573
+ /**
574
+ * What the form sends — on submit and with an action: without the related rows of
575
+ * navigation fields the form leaves out (loaded with `$with`, never rendered or
576
+ * validated) and without the fields the server owns (`derived`: `/meta` `readOnly`,
577
+ * computed, …).
578
+ */
579
+ function outgoing(def, data) {
580
+ return omitDerivedFields(def, omitSkippedNavFields(def, data));
581
+ }
559
582
  function invokeAction(name) {
560
583
  const def = options.def();
561
- const data = omitSkippedNavFields(def, formValidator.value.normalize(domainData()));
584
+ const data = outgoing(def, formValidator.value.normalize(domainData()));
562
585
  if (supportsAction(def, name)) options.emits?.action?.(name, data);
563
586
  else options.emits?.unsupportedAction?.(name, data);
564
587
  }
@@ -581,7 +604,7 @@ function useAsForm(options) {
581
604
  const result = submit();
582
605
  if (result === true) {
583
606
  internalErrors.value = {};
584
- const payload = omitSkippedNavFields(options.def(), data);
607
+ const payload = outgoing(options.def(), data);
585
608
  options.emits?.submit?.(payload);
586
609
  return {
587
610
  ok: true,
@@ -679,6 +702,10 @@ var as_form_default = /* @__PURE__ */ defineComponent({
679
702
  type: Boolean,
680
703
  required: false
681
704
  },
705
+ optionalMode: {
706
+ type: String,
707
+ required: false
708
+ },
682
709
  hideSubmit: {
683
710
  type: Boolean,
684
711
  required: false
@@ -712,6 +739,7 @@ var as_form_default = /* @__PURE__ */ defineComponent({
712
739
  errors: () => props.errors,
713
740
  clientFactory: () => props.clientFactory,
714
741
  hideRootTitle: () => props.hideRootTitle,
742
+ optionalMode: () => props.optionalMode,
715
743
  loading: () => props.loading,
716
744
  trackChanges: () => props.trackChanges,
717
745
  emits: {
@@ -1,10 +1,10 @@
1
1
  const require_focus_after_toggle = require("./focus-after-toggle-BhZGqrUK.cjs");
2
- const require_use_form_context = require("./use-form-context-d0IcFey0.cjs");
2
+ const require_use_form_context = require("./use-form-context-U6vg1uqK.cjs");
3
3
  const require_use_as_nested_sections_store = require("./use-as-nested-sections-store-ApstV9NL.cjs");
4
- const require_use_as_value_help = require("./use-as-value-help-LDhcfxFi.cjs");
4
+ const require_use_as_value_help = require("./use-as-value-help-CQMUkP1r.cjs");
5
5
  const require_use_as_locale = require("./use-as-locale-eo7FyfaZ.cjs");
6
- const require_as_field = require("./as-field-BdFUGqKv.cjs");
7
- const require_as_iterator = require("./as-iterator-BgYp1qj4.cjs");
6
+ const require_as_field = require("./as-field-DAClnYiP.cjs");
7
+ const require_as_iterator = require("./as-iterator-q_w9HBHt.cjs");
8
8
  let vue = require("vue");
9
9
  let _atscript_ui = require("@atscript/ui");
10
10
  //#region src/composables/use-as-form-patch.ts
@@ -440,6 +440,16 @@ function useAsForm(options) {
440
440
  })
441
441
  });
442
442
  const remountKey = (0, vue.ref)(0);
443
+ (0, vue.watch)(() => data.value.value, (value) => {
444
+ const def = options.def();
445
+ (0, _atscript_ui.normalizeLoadedEmpty)(def, value, {
446
+ mode: options.optionalMode?.(),
447
+ edit: def.edit === true
448
+ });
449
+ }, {
450
+ flush: "sync",
451
+ immediate: true
452
+ });
443
453
  const tracker = options.trackChanges?.() ? createAsFormPatch(() => options.def(), () => data.value, () => {
444
454
  remountKey.value++;
445
455
  }) : void 0;
@@ -454,6 +464,10 @@ function useAsForm(options) {
454
464
  (0, vue.provide)(require_use_form_context.TYPES_KEY, (0, vue.computed)(() => options.types?.() ?? {}));
455
465
  (0, vue.provide)(require_use_form_context.COMPONENTS_KEY, (0, vue.computed)(() => options.components?.()));
456
466
  (0, vue.provide)(require_use_form_context.HIDE_ROOT_TITLE_KEY, options.hideRootTitle?.() === true);
467
+ (0, vue.provide)(require_use_form_context.FORM_OPTIONAL_KEY, {
468
+ mode: (0, vue.computed)(() => options.optionalMode?.()),
469
+ edit: (0, vue.computed)(() => options.def().edit === true)
470
+ });
457
471
  const ext = useAsExternalErrors({ source: () => options.errors?.() });
458
472
  (0, vue.provide)(require_use_form_context.ERRORS_KEY, ext.effective);
459
473
  (0, vue.provide)(require_use_form_context.DISMISS_EXTERNAL_AT_KEY, ext.dismissAt);
@@ -556,9 +570,18 @@ function useAsForm(options) {
556
570
  function supportsAction(def, actionId) {
557
571
  return (0, _atscript_ui.getDeclaredFormActions)(def).some((a) => a.id === actionId);
558
572
  }
573
+ /**
574
+ * What the form sends — on submit and with an action: without the related rows of
575
+ * navigation fields the form leaves out (loaded with `$with`, never rendered or
576
+ * validated) and without the fields the server owns (`derived`: `/meta` `readOnly`,
577
+ * computed, …).
578
+ */
579
+ function outgoing(def, data) {
580
+ return (0, _atscript_ui.omitDerivedFields)(def, (0, _atscript_ui.omitSkippedNavFields)(def, data));
581
+ }
559
582
  function invokeAction(name) {
560
583
  const def = options.def();
561
- const data = (0, _atscript_ui.omitSkippedNavFields)(def, formValidator.value.normalize(domainData()));
584
+ const data = outgoing(def, formValidator.value.normalize(domainData()));
562
585
  if (supportsAction(def, name)) options.emits?.action?.(name, data);
563
586
  else options.emits?.unsupportedAction?.(name, data);
564
587
  }
@@ -581,7 +604,7 @@ function useAsForm(options) {
581
604
  const result = submit();
582
605
  if (result === true) {
583
606
  internalErrors.value = {};
584
- const payload = (0, _atscript_ui.omitSkippedNavFields)(options.def(), data);
607
+ const payload = outgoing(options.def(), data);
585
608
  options.emits?.submit?.(payload);
586
609
  return {
587
610
  ok: true,
@@ -679,6 +702,10 @@ var as_form_default = /* @__PURE__ */ (0, vue.defineComponent)({
679
702
  type: Boolean,
680
703
  required: false
681
704
  },
705
+ optionalMode: {
706
+ type: String,
707
+ required: false
708
+ },
682
709
  hideSubmit: {
683
710
  type: Boolean,
684
711
  required: false
@@ -712,6 +739,7 @@ var as_form_default = /* @__PURE__ */ (0, vue.defineComponent)({
712
739
  errors: () => props.errors,
713
740
  clientFactory: () => props.clientFactory,
714
741
  hideRootTitle: () => props.hideRootTitle,
742
+ optionalMode: () => props.optionalMode,
715
743
  loading: () => props.loading,
716
744
  trackChanges: () => props.trackChanges,
717
745
  emits: {
package/dist/as-form.cjs CHANGED
@@ -1,2 +1,2 @@
1
- const require_as_form = require("./as-form-Dfrq97Tv.cjs");
1
+ const require_as_form = require("./as-form-r5pkXt5U.cjs");
2
2
  module.exports = require_as_form.as_form_default;
@@ -1,2 +1,2 @@
1
- import { n as _default, t as Props } from "./as-form.vue-DEGb6oP3.cjs";
1
+ import { n as _default, t as Props } from "./as-form.vue-bt-v037w.cjs";
2
2
  export { Props, _default as default };
@@ -1,2 +1,2 @@
1
- import { n as _default, t as Props } from "./as-form.vue-D7J9Mm_V.mjs";
1
+ import { n as _default, t as Props } from "./as-form.vue-BSY6AhPz.mjs";
2
2
  export { Props, _default as default };
package/dist/as-form.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as as_form_default } from "./as-form-WhZH4ozr.mjs";
1
+ import { t as as_form_default } from "./as-form-B8d1MVTB.mjs";
2
2
  export { as_form_default as default };
@@ -1,11 +1,11 @@
1
- import { b as TFormState, d as TAsFormSubmitResult, f as TAsFormValue, g as TAsFormError, l as TAsTypeComponents, r as TAsChangeType, s as TAsComponentProps, t as AsFormExposed, u as TAsUnionContext, y as TFormRule } from "./types-BmF8iDTN.cjs";
1
+ import { b as TFormState, d as TAsFormSubmitResult, f as TAsFormValue, g as TAsFormError, l as TAsTypeComponents, r as TAsChangeType, s as TAsComponentProps, t as AsFormExposed, u as TAsUnionContext, y as TFormRule } from "./types-271BUWyf.mjs";
2
2
  import * as vue from "vue";
3
3
  import { Component, ComputedRef, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef, WritableComputedRef } from "vue";
4
4
  import * as _atscript_ui0 from "@atscript/ui";
5
- import { ClientFactory, ClientFactory as ClientFactory$1, CreateFormDefOptions, FormArrayFieldDef, FormDef, FormDiffOptions as FormDiffOptions$1, FormFieldChange, FormFieldChange as FormFieldChange$1, FormFieldDef, FormRebaseOptions as FormRebaseOptions$1, FormTupleFieldDef, FormUnionFieldDef, FormUnionVariant, ResolvedValueHelp, TResolveOptions, TypedClientFactory, UiT, UserTextT, ValueHelpInfo, ValueHelpScope, getDefaultClientFactory, hasFieldMeta, isFieldHidden, joinPath, resetDefaultClientFactory, setDefaultClientFactory } from "@atscript/ui";
5
+ import { ClientFactory, ClientFactory as ClientFactory$1, CreateFormDefOptions, FormArrayFieldDef, FormDef, FormDiffOptions as FormDiffOptions$1, FormFieldChange, FormFieldChange as FormFieldChange$1, FormFieldDef, FormRebaseOptions as FormRebaseOptions$1, FormTupleFieldDef, FormUnionFieldDef, FormUnionVariant, ResolvedValueHelp, TOptionalMode, TOptionalMode as TOptionalMode$1, TResolveOptions, TypedClientFactory, UI_FORM_OPTIONAL_MODE, UiT, UserTextT, ValueHelpInfo, ValueHelpScope, emptiedValue as emptiedValue$1, getDefaultClientFactory, getDefaultOptionalMode, hasFieldMeta as hasFieldMeta$1, isFieldHidden as isFieldHidden$1, joinPath as joinPath$1, resetDefaultClientFactory, resolveOptionalMode as resolveOptionalMode$1, setDefaultClientFactory, setDefaultOptionalMode } from "@atscript/ui";
6
+ import { TFnScope } from "@atscript/ui-fns";
6
7
  import * as _atscript_typescript_utils0 from "@atscript/typescript/utils";
7
8
  import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
8
- import { TFnScope } from "@atscript/ui-fns";
9
9
 
10
10
  //#region src/composables/create-as-form-def.d.ts
11
11
  /**
@@ -250,8 +250,10 @@ interface UseAsValueHelpReturn {
250
250
  /**
251
251
  * Clear the picker: set the model to `value` (`undefined` — unset — when
252
252
  * omitted) and empty the search text. A field this field's last pick filled
253
- * is cleared too (`undefined`) while it still holds what the pick wrote —
254
- * unless the binding also reads it as a host value (since 0.1.190).
253
+ * is cleared too while it still holds what the pick wrote — unless the
254
+ * binding also reads it as a host value (since 0.1.190): to `null` on an
255
+ * edit form (`FormDef.edit`; a whole-record update clears it too), else
256
+ * `undefined` (since 0.1.205).
255
257
  */
256
258
  clear: (value?: unknown) => void;
257
259
  /**
@@ -751,7 +753,13 @@ interface UseAsDateOptions {
751
753
  modelValue: () => ModelValue;
752
754
  /** Variant: `'date'` (default), `'datetime'`, `'time'`. Drives both parse and serialize. */
753
755
  kind: "date" | "datetime" | "time";
754
- /** Commit the parsed value. Numeric epoch-ms when the previous value was numeric, ISO string otherwise. `null` clears. */
756
+ /**
757
+ * The field's type: a `string`-stored date (`string.date`, `string.isoDate`)
758
+ * commits text even while it is unset. Without it — or for a field of another
759
+ * type — the value it holds decides. Since 0.1.205.
760
+ */
761
+ prop?: TAtscriptAnnotatedType;
762
+ /** Commit the parsed value. ISO string when the field stores text (see `prop`) or holds a string, numeric epoch-ms otherwise. `null` clears. */
755
763
  onCommit: (value: number | string | null) => void;
756
764
  }
757
765
  interface UseAsDateReturn {
@@ -767,8 +775,8 @@ interface UseAsDateReturn {
767
775
  * via `kind`. Conversion direction:
768
776
  *
769
777
  * - `'date'`: epoch-ms ↔ `YYYY-MM-DD` (local TZ).
770
- * Empty input commits `null`. If previous value was a `string`,
771
- * commits a string (`YYYY-MM-DD`); otherwise commits epoch-ms (UTC
778
+ * Empty input commits `null`. A string-stored field (`prop`) or one
779
+ * holding a `string` commits a string (`YYYY-MM-DD`); otherwise epoch-ms (UTC
772
780
  * midnight on the picked date in local TZ — same as `new Date(str)`).
773
781
  * - `'datetime'`: epoch-ms ↔ `YYYY-MM-DDTHH:mm` (local TZ).
774
782
  * - `'time'`: prev-string ↔ `HH:mm`. Numeric storage isn't meaningful
@@ -875,6 +883,16 @@ interface Props<TF, TC> {
875
883
  * dialog header). Nested fields keep their own headings.
876
884
  */
877
885
  hideRootTitle?: boolean;
886
+ /**
887
+ * How the form offers its optional scalar fields (`name?: T`): `"business"`
888
+ * — a plain input, as for a required field (no unset ×, no "Not set"
889
+ * placeholder); `"technical"` — the tri-state. Unset: the app-wide default
890
+ * (`setDefaultOptionalMode`, else `"business"`). A field's
891
+ * `@ui.form.optionalMode` wins; optional objects, arrays, tuples and unions
892
+ * always keep their Add / remove controls. Read when the fields mount.
893
+ * Since 0.1.205.
894
+ */
895
+ optionalMode?: TOptionalMode;
878
896
  /**
879
897
  * Suppress the default submit button. Use when the host chrome owns the
880
898
  * submit affordance (e.g. a dialog footer with its own submit button
@@ -1099,4 +1117,4 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
1099
1117
  declare const _default: typeof __VLS_export;
1100
1118
  type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K] } : { [K in keyof T as K]: T[K] }) & {};
1101
1119
  //#endregion
1102
- export { AsNestedSectionsStore as $, useAsNumber as A, UseAsOptionalAddFlowReturn as B, UseAsDateReturn as C, useAsField as Ct, useAsDualInput as D, UseAsDualInputReturn as E, useAsModelTexts as F, useAsVisibleFields as G, focusFirstAfter as H, UseAsTriStateCheckboxOptions as I, TResolveFieldPropOptions as J, UseAsOptionalFieldReturn as K, UseAsTriStateCheckboxReturn as L, UseAsDecimalReturn as M, useAsDecimal as N, UseAsNumberOptions as O, variantLabel as P, useAsLevel as Q, useAsTriStateCheckbox as R, UseAsDateOptions as S, UseAsFieldReturn as St, UseAsDualInputOptions as T, createAsFormDef as Tt, focusNewFocusableAfter as U, useAsOptionalAddFlow as V, useAsFocusFirstAfter as W, useAsFieldScope as X, UseAsFieldScopeReturn as Y, provideAsNestedLevel as Z, useAsData as _, useAsExternalErrors as _t, FormFieldChange$1 as a, UseAsValueHelpReturn as at, UseAsPathReturn as b, useAsState as bt, getDefaultClientFactory as c, useAsUnionVariant as ct, joinPath as d, UseAsTupleReturn as dt, provideAsNestedSectionsStore as et, resetDefaultClientFactory as f, useAsTuple as ft, UseAsDataReturn as g, UseAsExternalErrorsReturn as gt, useAsErrorDismiss as h, UseAsExternalErrorsOptions as ht, FormDiffOptions$1 as i, UseAsValueHelpOptions as it, UseAsDecimalOptions as j, UseAsNumberReturn as k, hasFieldMeta as l, UseAsUnionReturn as lt, AsErrorDismiss as m, useAsArray as mt, _default as n, useAsNestedSectionsStore as nt, FormRebaseOptions$1 as o, useAsValueHelp as ot, setDefaultClientFactory as p, UseAsArrayReturn as pt, useAsOptionalField as q, ClientFactory$1 as r, useAsDropdown as rt, TypedClientFactory as s, formatIndexedLabelParts as st, Props as t, useAsDescendantErrorCounts as tt, isFieldHidden as u, useAsUnion as ut, UseAsTypeMapReturn as v, TFormSubmitValidator as vt, useAsDate as w, createDefaultTypes as wt, useAsPath as x, UseAsFieldOptions as xt, useAsTypeMap as y, UseAsStateReturn as yt, UseAsOptionalAddFlowOptions as z };
1120
+ export { useAsOptionalField as $, useAsDate as A, createDefaultTypes as At, variantLabel as B, useAsData as C, useAsExternalErrors as Ct, useAsPath as D, UseAsFieldOptions as Dt, UseAsPathReturn as E, useAsState as Et, UseAsNumberReturn as F, UseAsOptionalAddFlowOptions as G, UseAsTriStateCheckboxOptions as H, useAsNumber as I, focusFirstAfter as J, UseAsOptionalAddFlowReturn as K, UseAsDecimalOptions as L, UseAsDualInputReturn as M, useAsDualInput as N, UseAsDateOptions as O, UseAsFieldReturn as Ot, UseAsNumberOptions as P, UseAsOptionalFieldReturn as Q, UseAsDecimalReturn as R, UseAsDataReturn as S, UseAsExternalErrorsReturn as St, useAsTypeMap as T, UseAsStateReturn as Tt, UseAsTriStateCheckboxReturn as U, useAsModelTexts as V, useAsTriStateCheckbox as W, useAsFocusFirstAfter as X, focusNewFocusableAfter as Y, useAsVisibleFields as Z, resolveOptionalMode$1 as _, UseAsTupleReturn as _t, FormFieldChange$1 as a, AsNestedSectionsStore as at, AsErrorDismiss as b, useAsArray as bt, TypedClientFactory as c, useAsNestedSectionsStore as ct, getDefaultClientFactory as d, UseAsValueHelpReturn as dt, TResolveFieldPropOptions as et, getDefaultOptionalMode as f, useAsValueHelp as ft, resetDefaultClientFactory as g, useAsUnion as gt, joinPath$1 as h, UseAsUnionReturn as ht, FormDiffOptions$1 as i, useAsLevel as it, UseAsDualInputOptions as j, createAsFormDef as jt, UseAsDateReturn as k, useAsField as kt, UI_FORM_OPTIONAL_MODE as l, useAsDropdown as lt, isFieldHidden$1 as m, useAsUnionVariant as mt, _default as n, useAsFieldScope as nt, FormRebaseOptions$1 as o, provideAsNestedSectionsStore as ot, hasFieldMeta$1 as p, formatIndexedLabelParts as pt, useAsOptionalAddFlow as q, ClientFactory$1 as r, provideAsNestedLevel as rt, TOptionalMode$1 as s, useAsDescendantErrorCounts as st, Props as t, UseAsFieldScopeReturn as tt, emptiedValue$1 as u, UseAsValueHelpOptions as ut, setDefaultClientFactory as v, useAsTuple as vt, UseAsTypeMapReturn as w, TFormSubmitValidator as wt, useAsErrorDismiss as x, UseAsExternalErrorsOptions as xt, setDefaultOptionalMode as y, UseAsArrayReturn as yt, useAsDecimal as z };
@@ -1,11 +1,11 @@
1
- import { b as TFormState, d as TAsFormSubmitResult, f as TAsFormValue, g as TAsFormError, l as TAsTypeComponents, r as TAsChangeType, s as TAsComponentProps, t as AsFormExposed, u as TAsUnionContext, y as TFormRule } from "./types-ChQuWLmd.mjs";
1
+ import { b as TFormState, d as TAsFormSubmitResult, f as TAsFormValue, g as TAsFormError, l as TAsTypeComponents, r as TAsChangeType, s as TAsComponentProps, t as AsFormExposed, u as TAsUnionContext, y as TFormRule } from "./types-DbjorSCn.cjs";
2
2
  import * as vue from "vue";
3
3
  import { Component, ComputedRef, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef, WritableComputedRef } from "vue";
4
4
  import * as _atscript_ui0 from "@atscript/ui";
5
- import { ClientFactory, ClientFactory as ClientFactory$1, CreateFormDefOptions, FormArrayFieldDef, FormDef, FormDiffOptions as FormDiffOptions$1, FormFieldChange, FormFieldChange as FormFieldChange$1, FormFieldDef, FormRebaseOptions as FormRebaseOptions$1, FormTupleFieldDef, FormUnionFieldDef, FormUnionVariant, ResolvedValueHelp, TResolveOptions, TypedClientFactory, UiT, UserTextT, ValueHelpInfo, ValueHelpScope, getDefaultClientFactory, hasFieldMeta as hasFieldMeta$1, isFieldHidden as isFieldHidden$1, joinPath as joinPath$1, resetDefaultClientFactory, setDefaultClientFactory } from "@atscript/ui";
6
- import { TFnScope } from "@atscript/ui-fns";
5
+ import { ClientFactory, ClientFactory as ClientFactory$1, CreateFormDefOptions, FormArrayFieldDef, FormDef, FormDiffOptions as FormDiffOptions$1, FormFieldChange, FormFieldChange as FormFieldChange$1, FormFieldDef, FormRebaseOptions as FormRebaseOptions$1, FormTupleFieldDef, FormUnionFieldDef, FormUnionVariant, ResolvedValueHelp, TOptionalMode, TOptionalMode as TOptionalMode$1, TResolveOptions, TypedClientFactory, UI_FORM_OPTIONAL_MODE, UiT, UserTextT, ValueHelpInfo, ValueHelpScope, emptiedValue, getDefaultClientFactory, getDefaultOptionalMode, hasFieldMeta, isFieldHidden, joinPath, resetDefaultClientFactory, resolveOptionalMode, setDefaultClientFactory, setDefaultOptionalMode } from "@atscript/ui";
7
6
  import * as _atscript_typescript_utils0 from "@atscript/typescript/utils";
8
7
  import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
8
+ import { TFnScope } from "@atscript/ui-fns";
9
9
 
10
10
  //#region src/composables/create-as-form-def.d.ts
11
11
  /**
@@ -250,8 +250,10 @@ interface UseAsValueHelpReturn {
250
250
  /**
251
251
  * Clear the picker: set the model to `value` (`undefined` — unset — when
252
252
  * omitted) and empty the search text. A field this field's last pick filled
253
- * is cleared too (`undefined`) while it still holds what the pick wrote —
254
- * unless the binding also reads it as a host value (since 0.1.190).
253
+ * is cleared too while it still holds what the pick wrote — unless the
254
+ * binding also reads it as a host value (since 0.1.190): to `null` on an
255
+ * edit form (`FormDef.edit`; a whole-record update clears it too), else
256
+ * `undefined` (since 0.1.205).
255
257
  */
256
258
  clear: (value?: unknown) => void;
257
259
  /**
@@ -751,7 +753,13 @@ interface UseAsDateOptions {
751
753
  modelValue: () => ModelValue;
752
754
  /** Variant: `'date'` (default), `'datetime'`, `'time'`. Drives both parse and serialize. */
753
755
  kind: "date" | "datetime" | "time";
754
- /** Commit the parsed value. Numeric epoch-ms when the previous value was numeric, ISO string otherwise. `null` clears. */
756
+ /**
757
+ * The field's type: a `string`-stored date (`string.date`, `string.isoDate`)
758
+ * commits text even while it is unset. Without it — or for a field of another
759
+ * type — the value it holds decides. Since 0.1.205.
760
+ */
761
+ prop?: TAtscriptAnnotatedType;
762
+ /** Commit the parsed value. ISO string when the field stores text (see `prop`) or holds a string, numeric epoch-ms otherwise. `null` clears. */
755
763
  onCommit: (value: number | string | null) => void;
756
764
  }
757
765
  interface UseAsDateReturn {
@@ -767,8 +775,8 @@ interface UseAsDateReturn {
767
775
  * via `kind`. Conversion direction:
768
776
  *
769
777
  * - `'date'`: epoch-ms ↔ `YYYY-MM-DD` (local TZ).
770
- * Empty input commits `null`. If previous value was a `string`,
771
- * commits a string (`YYYY-MM-DD`); otherwise commits epoch-ms (UTC
778
+ * Empty input commits `null`. A string-stored field (`prop`) or one
779
+ * holding a `string` commits a string (`YYYY-MM-DD`); otherwise epoch-ms (UTC
772
780
  * midnight on the picked date in local TZ — same as `new Date(str)`).
773
781
  * - `'datetime'`: epoch-ms ↔ `YYYY-MM-DDTHH:mm` (local TZ).
774
782
  * - `'time'`: prev-string ↔ `HH:mm`. Numeric storage isn't meaningful
@@ -875,6 +883,16 @@ interface Props<TF, TC> {
875
883
  * dialog header). Nested fields keep their own headings.
876
884
  */
877
885
  hideRootTitle?: boolean;
886
+ /**
887
+ * How the form offers its optional scalar fields (`name?: T`): `"business"`
888
+ * — a plain input, as for a required field (no unset ×, no "Not set"
889
+ * placeholder); `"technical"` — the tri-state. Unset: the app-wide default
890
+ * (`setDefaultOptionalMode`, else `"business"`). A field's
891
+ * `@ui.form.optionalMode` wins; optional objects, arrays, tuples and unions
892
+ * always keep their Add / remove controls. Read when the fields mount.
893
+ * Since 0.1.205.
894
+ */
895
+ optionalMode?: TOptionalMode;
878
896
  /**
879
897
  * Suppress the default submit button. Use when the host chrome owns the
880
898
  * submit affordance (e.g. a dialog footer with its own submit button
@@ -1099,4 +1117,4 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
1099
1117
  declare const _default: typeof __VLS_export;
1100
1118
  type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K] } : { [K in keyof T as K]: T[K] }) & {};
1101
1119
  //#endregion
1102
- export { AsNestedSectionsStore as $, useAsNumber as A, UseAsOptionalAddFlowReturn as B, UseAsDateReturn as C, useAsField as Ct, useAsDualInput as D, UseAsDualInputReturn as E, useAsModelTexts as F, useAsVisibleFields as G, focusFirstAfter as H, UseAsTriStateCheckboxOptions as I, TResolveFieldPropOptions as J, UseAsOptionalFieldReturn as K, UseAsTriStateCheckboxReturn as L, UseAsDecimalReturn as M, useAsDecimal as N, UseAsNumberOptions as O, variantLabel as P, useAsLevel as Q, useAsTriStateCheckbox as R, UseAsDateOptions as S, UseAsFieldReturn as St, UseAsDualInputOptions as T, createAsFormDef as Tt, focusNewFocusableAfter as U, useAsOptionalAddFlow as V, useAsFocusFirstAfter as W, useAsFieldScope as X, UseAsFieldScopeReturn as Y, provideAsNestedLevel as Z, useAsData as _, useAsExternalErrors as _t, FormFieldChange$1 as a, UseAsValueHelpReturn as at, UseAsPathReturn as b, useAsState as bt, getDefaultClientFactory as c, useAsUnionVariant as ct, joinPath$1 as d, UseAsTupleReturn as dt, provideAsNestedSectionsStore as et, resetDefaultClientFactory as f, useAsTuple as ft, UseAsDataReturn as g, UseAsExternalErrorsReturn as gt, useAsErrorDismiss as h, UseAsExternalErrorsOptions as ht, FormDiffOptions$1 as i, UseAsValueHelpOptions as it, UseAsDecimalOptions as j, UseAsNumberReturn as k, hasFieldMeta$1 as l, UseAsUnionReturn as lt, AsErrorDismiss as m, useAsArray as mt, _default as n, useAsNestedSectionsStore as nt, FormRebaseOptions$1 as o, useAsValueHelp as ot, setDefaultClientFactory as p, UseAsArrayReturn as pt, useAsOptionalField as q, ClientFactory$1 as r, useAsDropdown as rt, TypedClientFactory as s, formatIndexedLabelParts as st, Props as t, useAsDescendantErrorCounts as tt, isFieldHidden$1 as u, useAsUnion as ut, UseAsTypeMapReturn as v, TFormSubmitValidator as vt, useAsDate as w, createDefaultTypes as wt, useAsPath as x, UseAsFieldOptions as xt, useAsTypeMap as y, UseAsStateReturn as yt, UseAsOptionalAddFlowOptions as z };
1120
+ export { useAsOptionalField as $, useAsDate as A, createDefaultTypes as At, variantLabel as B, useAsData as C, useAsExternalErrors as Ct, useAsPath as D, UseAsFieldOptions as Dt, UseAsPathReturn as E, useAsState as Et, UseAsNumberReturn as F, UseAsOptionalAddFlowOptions as G, UseAsTriStateCheckboxOptions as H, useAsNumber as I, focusFirstAfter as J, UseAsOptionalAddFlowReturn as K, UseAsDecimalOptions as L, UseAsDualInputReturn as M, useAsDualInput as N, UseAsDateOptions as O, UseAsFieldReturn as Ot, UseAsNumberOptions as P, UseAsOptionalFieldReturn as Q, UseAsDecimalReturn as R, UseAsDataReturn as S, UseAsExternalErrorsReturn as St, useAsTypeMap as T, UseAsStateReturn as Tt, UseAsTriStateCheckboxReturn as U, useAsModelTexts as V, useAsTriStateCheckbox as W, useAsFocusFirstAfter as X, focusNewFocusableAfter as Y, useAsVisibleFields as Z, resolveOptionalMode as _, UseAsTupleReturn as _t, FormFieldChange$1 as a, AsNestedSectionsStore as at, AsErrorDismiss as b, useAsArray as bt, TypedClientFactory as c, useAsNestedSectionsStore as ct, getDefaultClientFactory as d, UseAsValueHelpReturn as dt, TResolveFieldPropOptions as et, getDefaultOptionalMode as f, useAsValueHelp as ft, resetDefaultClientFactory as g, useAsUnion as gt, joinPath as h, UseAsUnionReturn as ht, FormDiffOptions$1 as i, useAsLevel as it, UseAsDualInputOptions as j, createAsFormDef as jt, UseAsDateReturn as k, useAsField as kt, UI_FORM_OPTIONAL_MODE as l, useAsDropdown as lt, isFieldHidden as m, useAsUnionVariant as mt, _default as n, useAsFieldScope as nt, FormRebaseOptions$1 as o, provideAsNestedSectionsStore as ot, hasFieldMeta as p, formatIndexedLabelParts as pt, useAsOptionalAddFlow as q, ClientFactory$1 as r, provideAsNestedLevel as rt, TOptionalMode$1 as s, useAsDescendantErrorCounts as st, Props as t, UseAsFieldScopeReturn as tt, emptiedValue as u, UseAsValueHelpOptions as ut, setDefaultClientFactory as v, useAsTuple as vt, UseAsTypeMapReturn as w, TFormSubmitValidator as wt, useAsErrorDismiss as x, UseAsExternalErrorsOptions as xt, setDefaultOptionalMode as y, UseAsArrayReturn as yt, useAsDecimal as z };
@@ -1,5 +1,5 @@
1
- const require_as_field_shell = require("./as-field-shell-ha1iaJnK.cjs");
2
- const require_as_input_control = require("./as-input-control-D8xoJfr7.cjs");
1
+ const require_as_field_shell = require("./as-field-shell-Cu8jxZYj.cjs");
2
+ const require_as_input_control = require("./as-input-control-uJpmle-G.cjs");
3
3
  const require_as_adornment_shell = require("./as-adornment-shell-CmS9BOFm.cjs");
4
4
  let vue = require("vue");
5
5
  //#endregion
@@ -64,6 +64,14 @@ var as_input_default = /* @__PURE__ */ (0, vue.defineComponent)({
64
64
  type: Function,
65
65
  required: false
66
66
  },
67
+ optionalMode: {
68
+ type: String,
69
+ required: false
70
+ },
71
+ emptiedValue: {
72
+ type: null,
73
+ required: false
74
+ },
67
75
  required: {
68
76
  type: Boolean,
69
77
  required: false,
@@ -1,4 +1,3 @@
1
- import { n as committedValue, t as committedText } from "./_shape-DhwW2SvD.mjs";
2
1
  import { computed, createElementBlock, defineComponent, openBlock, vModelDynamic, vModelText, withDirectives } from "vue";
3
2
  //#region src/components/internal/as-input-control.vue?vue&type=script&setup=true&lang.ts
4
3
  const _hoisted_1 = [
@@ -88,6 +87,14 @@ var as_input_control_default = /* @__PURE__ */ defineComponent({
88
87
  type: Function,
89
88
  required: false
90
89
  },
90
+ optionalMode: {
91
+ type: String,
92
+ required: false
93
+ },
94
+ emptiedValue: {
95
+ type: null,
96
+ required: false
97
+ },
91
98
  required: {
92
99
  type: Boolean,
93
100
  required: false,
@@ -230,14 +237,14 @@ var as_input_control_default = /* @__PURE__ */ defineComponent({
230
237
  setup(__props) {
231
238
  const props = __props;
232
239
  /**
233
- * The model as the input edits it. Emptied, the input commits `undefined` on
234
- * an optional field; on a required one `""`, or `null` for the native number
235
- * input (AsNumber without adornments) — the rule of the other number inputs.
240
+ * The model as the input edits it. Emptied (text, or the native number input),
241
+ * the input commits the field's `emptiedValue` (AsField resolves it: unset,
242
+ * `""` or `null`).
236
243
  */
237
244
  const inputModel = computed({
238
245
  get: () => props.readonly && props.valueLabel !== void 0 ? props.valueLabel : props.model.value,
239
246
  set: (v) => {
240
- props.model.value = v === "" && props.type === "number" ? committedValue(null, props.optional) : committedText(v, props.optional);
247
+ props.model.value = v === "" ? props.emptiedValue : v;
241
248
  }
242
249
  });
243
250
  /**
@@ -1,4 +1,3 @@
1
- const require__shape = require("./_shape-BDO-1MzF.cjs");
2
1
  let vue = require("vue");
3
2
  //#region src/components/internal/as-input-control.vue?vue&type=script&setup=true&lang.ts
4
3
  const _hoisted_1 = [
@@ -88,6 +87,14 @@ var as_input_control_default = /* @__PURE__ */ (0, vue.defineComponent)({
88
87
  type: Function,
89
88
  required: false
90
89
  },
90
+ optionalMode: {
91
+ type: String,
92
+ required: false
93
+ },
94
+ emptiedValue: {
95
+ type: null,
96
+ required: false
97
+ },
91
98
  required: {
92
99
  type: Boolean,
93
100
  required: false,
@@ -230,14 +237,14 @@ var as_input_control_default = /* @__PURE__ */ (0, vue.defineComponent)({
230
237
  setup(__props) {
231
238
  const props = __props;
232
239
  /**
233
- * The model as the input edits it. Emptied, the input commits `undefined` on
234
- * an optional field; on a required one `""`, or `null` for the native number
235
- * input (AsNumber without adornments) — the rule of the other number inputs.
240
+ * The model as the input edits it. Emptied (text, or the native number input),
241
+ * the input commits the field's `emptiedValue` (AsField resolves it: unset,
242
+ * `""` or `null`).
236
243
  */
237
244
  const inputModel = (0, vue.computed)({
238
245
  get: () => props.readonly && props.valueLabel !== void 0 ? props.valueLabel : props.model.value,
239
246
  set: (v) => {
240
- props.model.value = v === "" && props.type === "number" ? require__shape.committedValue(null, props.optional) : require__shape.committedText(v, props.optional);
247
+ props.model.value = v === "" ? props.emptiedValue : v;
241
248
  }
242
249
  });
243
250
  /**
@@ -1,5 +1,5 @@
1
- import { t as as_field_shell_default } from "./as-field-shell-DQ30etIq.mjs";
2
- import { t as as_input_control_default } from "./as-input-control-Wygcey6h.mjs";
1
+ import { t as as_field_shell_default } from "./as-field-shell-DPzfvPo0.mjs";
2
+ import { t as as_input_control_default } from "./as-input-control-1igViaqC.mjs";
3
3
  import { t as as_adornment_shell_default } from "./as-adornment-shell-CBaksXGT.mjs";
4
4
  import { computed, createBlock, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, withCtx } from "vue";
5
5
  //#endregion
@@ -64,6 +64,14 @@ var as_input_default = /* @__PURE__ */ defineComponent({
64
64
  type: Function,
65
65
  required: false
66
66
  },
67
+ optionalMode: {
68
+ type: String,
69
+ required: false
70
+ },
71
+ emptiedValue: {
72
+ type: null,
73
+ required: false
74
+ },
67
75
  required: {
68
76
  type: Boolean,
69
77
  required: false,
package/dist/as-input.cjs CHANGED
@@ -1,2 +1,2 @@
1
- const require_as_input = require("./as-input-Cr2zcWgm.cjs");
1
+ const require_as_input = require("./as-input-BTbu0eF-.cjs");
2
2
  module.exports = require_as_input.as_input_default;
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-input.vue-D-cM4wBe.cjs";
1
+ import { t as _default } from "./as-input.vue-CuC3DYeR.cjs";
2
2
  export = _default;
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-input.vue-CTeXkWxQ.mjs";
1
+ import { t as _default } from "./as-input.vue-DawR7pA-.mjs";
2
2
  export { _default as default };
package/dist/as-input.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as as_input_default } from "./as-input-Du26WjkP.mjs";
1
+ import { t as as_input_default } from "./as-input-tKw19JnF.mjs";
2
2
  export { as_input_default as default };
@@ -1,4 +1,4 @@
1
- import { s as TAsComponentProps } from "./types-ChQuWLmd.mjs";
1
+ import { s as TAsComponentProps } from "./types-DbjorSCn.cjs";
2
2
  import * as vue from "vue";
3
3
 
4
4
  //#region src/components/defaults/as-input.vue.d.ts
@@ -1,4 +1,4 @@
1
- import { s as TAsComponentProps } from "./types-BmF8iDTN.cjs";
1
+ import { s as TAsComponentProps } from "./types-271BUWyf.mjs";
2
2
  import * as vue from "vue";
3
3
 
4
4
  //#region src/components/defaults/as-input.vue.d.ts
@@ -1,5 +1,5 @@
1
- import { h as LEVEL_KEY, v as PATH_PREFIX_KEY } from "./use-form-context-p2PucQHk.mjs";
2
- import { t as as_field_default } from "./as-field-U_EtrpNj.mjs";
1
+ import { g as LEVEL_KEY, y as PATH_PREFIX_KEY } from "./use-form-context-0FtVVTvf.mjs";
2
+ import { t as as_field_default } from "./as-field-jh5AWref.mjs";
3
3
  import { Fragment, computed, createBlock, createElementBlock, defineComponent, inject, openBlock, provide, renderList } from "vue";
4
4
  import { joinPath } from "@atscript/ui";
5
5
  //#region src/composables/use-as-level.ts
@@ -1,5 +1,5 @@
1
- const require_use_form_context = require("./use-form-context-d0IcFey0.cjs");
2
- const require_as_field = require("./as-field-BdFUGqKv.cjs");
1
+ const require_use_form_context = require("./use-form-context-U6vg1uqK.cjs");
2
+ const require_as_field = require("./as-field-DAClnYiP.cjs");
3
3
  let vue = require("vue");
4
4
  let _atscript_ui = require("@atscript/ui");
5
5
  //#region src/composables/use-as-level.ts
@@ -1,2 +1,2 @@
1
- const require_as_iterator = require("./as-iterator-BgYp1qj4.cjs");
1
+ const require_as_iterator = require("./as-iterator-q_w9HBHt.cjs");
2
2
  module.exports = require_as_iterator.as_iterator_default;
@@ -1,2 +1,2 @@
1
- import { t as as_iterator_default } from "./as-iterator-BvL2pCKj.mjs";
1
+ import { t as as_iterator_default } from "./as-iterator-B1o83rKV.mjs";
2
2
  export { as_iterator_default as default };
@@ -1,5 +1,5 @@
1
1
  const require_use_as_locale = require("./use-as-locale-eo7FyfaZ.cjs");
2
- const require_as_field_shell = require("./as-field-shell-ha1iaJnK.cjs");
2
+ const require_as_field_shell = require("./as-field-shell-Cu8jxZYj.cjs");
3
3
  let vue = require("vue");
4
4
  let _atscript_ui = require("@atscript/ui");
5
5
  let reka_ui = require("reka-ui");
@@ -81,6 +81,14 @@ var as_multi_select_default = /* @__PURE__ */ (0, vue.defineComponent)({
81
81
  type: Function,
82
82
  required: false
83
83
  },
84
+ optionalMode: {
85
+ type: String,
86
+ required: false
87
+ },
88
+ emptiedValue: {
89
+ type: null,
90
+ required: false
91
+ },
84
92
  required: {
85
93
  type: Boolean,
86
94
  required: false,
@@ -1,5 +1,5 @@
1
1
  import { o as useAsTexts } from "./use-as-locale-CznDr-7i.mjs";
2
- import { t as as_field_shell_default } from "./as-field-shell-DQ30etIq.mjs";
2
+ import { t as as_field_shell_default } from "./as-field-shell-DPzfvPo0.mjs";
3
3
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, openBlock, ref, renderList, toDisplayString, unref, withCtx, withModifiers } from "vue";
4
4
  import { hasFieldMeta, optKey, optLabel, optionValue } from "@atscript/ui";
5
5
  import { ComboboxAnchor, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxPortal, ComboboxRoot, ComboboxViewport, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText, TagsInputRoot } from "reka-ui";
@@ -81,6 +81,14 @@ var as_multi_select_default = /* @__PURE__ */ defineComponent({
81
81
  type: Function,
82
82
  required: false
83
83
  },
84
+ optionalMode: {
85
+ type: String,
86
+ required: false
87
+ },
88
+ emptiedValue: {
89
+ type: null,
90
+ required: false
91
+ },
84
92
  required: {
85
93
  type: Boolean,
86
94
  required: false,
@@ -1,2 +1,2 @@
1
- const require_as_multi_select = require("./as-multi-select-CNRqlh1o.cjs");
1
+ const require_as_multi_select = require("./as-multi-select-DPQ9_Qf1.cjs");
2
2
  module.exports = require_as_multi_select.as_multi_select_default;
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-multi-select.vue-CvZHtvck.cjs";
1
+ import { t as _default } from "./as-multi-select.vue-CXC47PBk.cjs";
2
2
  export = _default;
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-multi-select.vue-DVSSEboS.mjs";
1
+ import { t as _default } from "./as-multi-select.vue-CbVBJq8N.mjs";
2
2
  export { _default as default };