@atscript/vue-form 0.1.207 → 0.1.208

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 (179) hide show
  1. package/dist/as-action.d.cts +1 -1
  2. package/dist/as-action.d.mts +1 -1
  3. package/dist/{as-action.vue-BjGc3z94.d.mts → as-action.vue-D0twy1JK.d.cts} +1 -1
  4. package/dist/{as-action.vue-wGCmd-ww.d.cts → as-action.vue-Dse77iCr.d.mts} +1 -1
  5. package/dist/{as-array-CHVronOS.mjs → as-array-CEtgj6nd.mjs} +8 -9
  6. package/dist/{as-array-BCmGCZul.cjs → as-array-CKedVJIz.cjs} +8 -9
  7. package/dist/{as-array-clear-btn-DOBKhLCy.mjs → as-array-clear-btn-BFfll2RA.mjs} +1 -1
  8. package/dist/{as-array-clear-btn-BolX7Wpe.cjs → as-array-clear-btn-nYR8rEeL.cjs} +1 -1
  9. package/dist/as-array.cjs +1 -1
  10. package/dist/as-array.d.cts +1 -1
  11. package/dist/as-array.d.mts +1 -1
  12. package/dist/as-array.mjs +1 -1
  13. package/dist/{as-array.vue-BB22gE0u.d.cts → as-array.vue-BCB8mLx-.d.mts} +1 -1
  14. package/dist/{as-array.vue-CgYp_DSb.d.mts → as-array.vue-DJNzEE8-.d.cts} +1 -1
  15. package/dist/{as-checkbox-BX5N5GHR.mjs → as-checkbox-B7C-CvhT.mjs} +4 -2
  16. package/dist/{as-checkbox-BKWtScvS.cjs → as-checkbox-DKaEfo7e.cjs} +4 -2
  17. package/dist/as-checkbox.cjs +1 -1
  18. package/dist/as-checkbox.d.cts +1 -1
  19. package/dist/as-checkbox.d.mts +1 -1
  20. package/dist/as-checkbox.mjs +1 -1
  21. package/dist/{as-checkbox.vue-CQzeu4IP.d.mts → as-checkbox.vue-CoCgt4vV.d.mts} +1 -1
  22. package/dist/{as-checkbox.vue-RTW5hwvE.d.cts → as-checkbox.vue-fPeyQDp5.d.cts} +1 -1
  23. package/dist/{as-collapsible-C37-3_Rp.cjs → as-collapsible-Bs0LOl1t.cjs} +1 -1
  24. package/dist/{as-collapsible-B9KPgJyo.mjs → as-collapsible-DOIWkQ0v.mjs} +1 -1
  25. package/dist/as-collapsible.cjs +1 -1
  26. package/dist/as-collapsible.d.cts +1 -1
  27. package/dist/as-collapsible.d.mts +1 -1
  28. package/dist/as-collapsible.mjs +1 -1
  29. package/dist/{as-collapsible.vue-BKN4DmSy.d.mts → as-collapsible.vue-CH3ez8zm.d.cts} +1 -1
  30. package/dist/{as-collapsible.vue-CPmozkkf.d.cts → as-collapsible.vue-DewV2oaE.d.mts} +1 -1
  31. package/dist/{as-date-C6tT9FPz.cjs → as-date-BMKMiM_d.cjs} +2 -2
  32. package/dist/{as-date-Bkrp2GY4.mjs → as-date-CFQtrpZT.mjs} +2 -2
  33. package/dist/as-date.cjs +1 -1
  34. package/dist/as-date.d.cts +1 -1
  35. package/dist/as-date.d.mts +1 -1
  36. package/dist/as-date.mjs +1 -1
  37. package/dist/{as-date.vue-BpfWumrA.d.cts → as-date.vue-BSghCVx0.d.cts} +1 -1
  38. package/dist/{as-date.vue-DJ125nVS.d.mts → as-date.vue-CPgqqKMB.d.mts} +1 -1
  39. package/dist/{as-datetime-DWLW4W7O.cjs → as-datetime-Bl1K4U51.cjs} +2 -2
  40. package/dist/{as-datetime-Dt_AWrCG.mjs → as-datetime-DqfSymmL.mjs} +2 -2
  41. package/dist/as-datetime.cjs +1 -1
  42. package/dist/as-datetime.d.cts +1 -1
  43. package/dist/as-datetime.d.mts +1 -1
  44. package/dist/as-datetime.mjs +1 -1
  45. package/dist/{as-datetime.vue-DO3tkof1.d.cts → as-datetime.vue-B-KRC-0X.d.mts} +1 -1
  46. package/dist/{as-datetime.vue-DfFAaVdS.d.mts → as-datetime.vue-CjDTsMDw.d.cts} +1 -1
  47. package/dist/{as-decimal-DuWZDjbg.cjs → as-decimal-48M_h9Sl.cjs} +18 -24
  48. package/dist/{as-decimal-BUr24VTI.mjs → as-decimal-CsAJlvie.mjs} +18 -24
  49. package/dist/as-decimal.cjs +1 -1
  50. package/dist/as-decimal.d.cts +1 -1
  51. package/dist/as-decimal.d.mts +1 -1
  52. package/dist/as-decimal.mjs +1 -1
  53. package/dist/{as-decimal.vue-BODauGXK.d.mts → as-decimal.vue-BZ2imea4.d.mts} +1 -1
  54. package/dist/{as-decimal.vue-C42_-oK9.d.cts → as-decimal.vue-BvvG5aIL.d.cts} +1 -1
  55. package/dist/{as-field-iQ2H3VGd.mjs → as-field-C6iquEB1.mjs} +99 -137
  56. package/dist/{as-field-lMMfms8d.cjs → as-field-CJMJJfXO.cjs} +98 -136
  57. package/dist/{as-field-shell-BPesuJKa.cjs → as-field-shell-CMq52Z6e.cjs} +2 -2
  58. package/dist/{as-field-shell-QMsYyJ8r.mjs → as-field-shell-DXbAJupk.mjs} +2 -2
  59. package/dist/as-field-shell.cjs +1 -1
  60. package/dist/as-field-shell.d.cts +1 -1
  61. package/dist/as-field-shell.d.mts +1 -1
  62. package/dist/as-field-shell.mjs +1 -1
  63. package/dist/{as-field-shell.vue-CQqwykWy.d.cts → as-field-shell.vue-BbSIqZSY.d.cts} +1 -1
  64. package/dist/{as-field-shell.vue-o7T2u4aw.d.mts → as-field-shell.vue-D0NYcajH.d.mts} +1 -1
  65. package/dist/as-field.cjs +1 -1
  66. package/dist/as-field.mjs +1 -1
  67. package/dist/{as-form-DE3TVGV-.cjs → as-form-B4-StU3b.cjs} +19 -38
  68. package/dist/{as-form-CuMRP5aZ.mjs → as-form-DQePBFwR.mjs} +20 -39
  69. package/dist/as-form.cjs +1 -1
  70. package/dist/as-form.d.cts +1 -1
  71. package/dist/as-form.d.mts +1 -1
  72. package/dist/as-form.mjs +1 -1
  73. package/dist/{as-form.vue-DwqofFJa.d.mts → as-form.vue-BMNZuvpb.d.mts} +54 -20
  74. package/dist/{as-form.vue-B9MZrw7V.d.cts → as-form.vue-DS5r3CWl.d.cts} +54 -20
  75. package/dist/{as-input-BEP6nX82.mjs → as-input-D1IO72Tn.mjs} +1 -1
  76. package/dist/{as-input-BrgRxZag.cjs → as-input-Dy7v1AjV.cjs} +1 -1
  77. package/dist/as-input.cjs +1 -1
  78. package/dist/as-input.d.cts +1 -1
  79. package/dist/as-input.d.mts +1 -1
  80. package/dist/as-input.mjs +1 -1
  81. package/dist/{as-input.vue-Cl8DTJqr.d.cts → as-input.vue-DMxFk9uv.d.cts} +1 -1
  82. package/dist/{as-input.vue-CqV91VOb.d.mts → as-input.vue-DzG-WB4x.d.mts} +1 -1
  83. package/dist/{as-iterator-DbCm61j1.mjs → as-iterator-A9ozhHhf.mjs} +2 -2
  84. package/dist/{as-iterator-DeLt7-BO.cjs → as-iterator-C8aJ6SUs.cjs} +2 -2
  85. package/dist/as-iterator.cjs +1 -1
  86. package/dist/as-iterator.mjs +1 -1
  87. package/dist/{as-multi-select-CJ3iRsiL.cjs → as-multi-select-BiOEQf1L.cjs} +4 -8
  88. package/dist/{as-multi-select-Ca2ULklw.mjs → as-multi-select-CoT5MJd_.mjs} +5 -9
  89. package/dist/as-multi-select.cjs +1 -1
  90. package/dist/as-multi-select.d.cts +1 -1
  91. package/dist/as-multi-select.d.mts +1 -1
  92. package/dist/as-multi-select.mjs +1 -1
  93. package/dist/{as-multi-select.vue-B6M_f7u-.d.cts → as-multi-select.vue-CBtBFW6X.d.cts} +1 -1
  94. package/dist/{as-multi-select.vue-Cvvy1kMm.d.mts → as-multi-select.vue-CGjTCFGD.d.mts} +1 -1
  95. package/dist/{as-number-CgHRTx6P.mjs → as-number-Ck8nNMCB.mjs} +1 -1
  96. package/dist/{as-number-CHXaKqtg.cjs → as-number-DKW_PZcq.cjs} +1 -1
  97. package/dist/as-number.cjs +1 -1
  98. package/dist/as-number.d.cts +1 -1
  99. package/dist/as-number.d.mts +1 -1
  100. package/dist/as-number.mjs +1 -1
  101. package/dist/{as-number.vue-5U6oFVJC.d.cts → as-number.vue-AKk1tllp.d.mts} +1 -1
  102. package/dist/{as-number.vue-BN6_1oQf.d.mts → as-number.vue-i5gytLQ2.d.cts} +1 -1
  103. package/dist/{as-object-BCeBkKCo.mjs → as-object-6GgXdo_K.mjs} +4 -4
  104. package/dist/{as-object-Babu0BIk.cjs → as-object-DfHzCJcJ.cjs} +4 -4
  105. package/dist/as-object.cjs +1 -1
  106. package/dist/as-object.d.cts +1 -1
  107. package/dist/as-object.d.mts +1 -1
  108. package/dist/as-object.mjs +1 -1
  109. package/dist/{as-object.vue-BNCOIwjS.d.mts → as-object.vue-Gor6cnwh.d.mts} +1 -1
  110. package/dist/{as-object.vue-BnUdIcLW.d.cts → as-object.vue-cwrRrJ2O.d.cts} +1 -1
  111. package/dist/as-paragraph.d.cts +1 -1
  112. package/dist/as-paragraph.d.mts +1 -1
  113. package/dist/{as-paragraph.vue-80Q1bZMd.d.cts → as-paragraph.vue-DqHrI7WD.d.mts} +1 -1
  114. package/dist/{as-paragraph.vue-Dhy9ke_Z.d.mts → as-paragraph.vue-Ds64gwEP.d.cts} +1 -1
  115. package/dist/{as-radio-CL6Np-X5.mjs → as-radio-Cc3VOm3A.mjs} +1 -1
  116. package/dist/{as-radio-BFM_CPvW.cjs → as-radio-DLGMEC9o.cjs} +1 -1
  117. package/dist/as-radio.cjs +1 -1
  118. package/dist/as-radio.d.cts +1 -1
  119. package/dist/as-radio.d.mts +1 -1
  120. package/dist/as-radio.mjs +1 -1
  121. package/dist/{as-radio.vue-ByorW-nk.d.cts → as-radio.vue-CkooFq0m.d.cts} +1 -1
  122. package/dist/{as-radio.vue-CLdvEAmZ.d.mts → as-radio.vue-T0Ejt0II.d.mts} +1 -1
  123. package/dist/{as-ref-D14yC6np.mjs → as-ref-Cs4i9tpS.mjs} +2 -2
  124. package/dist/{as-ref-CEj1RBnH.cjs → as-ref-FknTPCae.cjs} +2 -2
  125. package/dist/as-ref.cjs +1 -1
  126. package/dist/as-ref.d.cts +1 -1
  127. package/dist/as-ref.d.mts +1 -1
  128. package/dist/as-ref.mjs +1 -1
  129. package/dist/{as-ref.vue--ISeV6VM.d.cts → as-ref.vue-CCzEnDNd.d.cts} +1 -1
  130. package/dist/{as-ref.vue-DW7vsBE6.d.mts → as-ref.vue-CvStQFs3.d.mts} +1 -1
  131. package/dist/{as-select-B-ZeOCu5.cjs → as-select-DBxxq0jZ.cjs} +1 -1
  132. package/dist/{as-select-BME-vti2.mjs → as-select-br9EmsoX.mjs} +1 -1
  133. package/dist/as-select.cjs +1 -1
  134. package/dist/as-select.d.cts +1 -1
  135. package/dist/as-select.d.mts +1 -1
  136. package/dist/as-select.mjs +1 -1
  137. package/dist/{as-select.vue-BEfTkycX.d.cts → as-select.vue-CK4AWxmk.d.cts} +1 -1
  138. package/dist/{as-select.vue-C45NS5Rq.d.mts → as-select.vue-LKjJASjX.d.mts} +1 -1
  139. package/dist/{as-time-CnuojSkh.cjs → as-time-BmTk1YfU.cjs} +2 -2
  140. package/dist/{as-time-HRZh7pdx.mjs → as-time-DTz7PrnB.mjs} +2 -2
  141. package/dist/as-time.cjs +1 -1
  142. package/dist/as-time.d.cts +1 -1
  143. package/dist/as-time.d.mts +1 -1
  144. package/dist/as-time.mjs +1 -1
  145. package/dist/{as-time.vue--Qmcr-O0.d.cts → as-time.vue-DTRJCO4G.d.cts} +1 -1
  146. package/dist/{as-time.vue-0M0m0DXe.d.mts → as-time.vue-q2i-2K0N.d.mts} +1 -1
  147. package/dist/{as-tuple-XpcKK1LK.cjs → as-tuple-BemXpNrJ.cjs} +18 -10
  148. package/dist/{as-tuple-qHmf6fwJ.mjs → as-tuple-D3IoTMkI.mjs} +19 -11
  149. package/dist/as-tuple.cjs +1 -1
  150. package/dist/as-tuple.d.cts +1 -1
  151. package/dist/as-tuple.d.mts +1 -1
  152. package/dist/as-tuple.mjs +1 -1
  153. package/dist/{as-tuple.vue-CKbx_YFz.d.mts → as-tuple.vue-BEY7sq9x.d.cts} +1 -1
  154. package/dist/{as-tuple.vue-Di5D2HD4.d.cts → as-tuple.vue-CNgBlckL.d.mts} +1 -1
  155. package/dist/{as-union-Ca5o9xw2.mjs → as-union-CIEUE2Xd.mjs} +26 -5
  156. package/dist/{as-union-CwB0ACpI.cjs → as-union-DqRkSoIr.cjs} +25 -4
  157. package/dist/as-union.cjs +1 -1
  158. package/dist/as-union.d.cts +1 -1
  159. package/dist/as-union.d.mts +1 -1
  160. package/dist/as-union.mjs +1 -1
  161. package/dist/{as-union.vue-UnG0zG81.d.cts → as-union.vue-B3KVCUUI.d.mts} +1 -1
  162. package/dist/{as-union.vue-eGlHN_hp.d.mts → as-union.vue-CGk27JvO.d.cts} +1 -1
  163. package/dist/{as-variant-picker-CKSLKefM.mjs → as-variant-picker-O_6JNWLk.mjs} +1 -1
  164. package/dist/{as-variant-picker-CceIhZUk.cjs → as-variant-picker-apxtW5rZ.cjs} +1 -1
  165. package/dist/index.cjs +42 -24
  166. package/dist/index.d.cts +22 -22
  167. package/dist/index.d.mts +22 -22
  168. package/dist/index.mjs +26 -26
  169. package/dist/{types-C5Gx4ZuF.d.mts → types-BXTpoOfM.d.cts} +26 -9
  170. package/dist/{types-D23g9Vs-.d.cts → types-CXGcf7sO.d.mts} +26 -9
  171. package/dist/{use-as-date-BWJbi_j2.cjs → use-as-date-CpkJjcyB.cjs} +18 -14
  172. package/dist/{use-as-date-B2hKWXAl.mjs → use-as-date-FsgcnN9l.mjs} +18 -14
  173. package/dist/{use-as-model-texts-BXSEzUWJ.mjs → use-as-model-texts-D26kn80o.mjs} +1 -1
  174. package/dist/{use-as-model-texts-BSFCEwAa.cjs → use-as-model-texts-DR4s80Mb.cjs} +1 -1
  175. package/dist/{use-as-value-help-ZR_BvS0L.cjs → use-as-value-help-CIvYUvdk.cjs} +12 -7
  176. package/dist/{use-as-value-help-B5yNO1tE.mjs → use-as-value-help-b4tk3NRF.mjs} +12 -7
  177. package/dist/{use-form-context-U6vg1uqK.cjs → use-form-context-BPlkQwkM.cjs} +16 -0
  178. package/dist/{use-form-context-0FtVVTvf.mjs → use-form-context-D_ejQqCc.mjs} +12 -2
  179. package/package.json +9 -9
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-action.vue-wGCmd-ww.cjs";
1
+ import { t as _default } from "./as-action.vue-D0twy1JK.cjs";
2
2
  export = _default;
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-action.vue-BjGc3z94.mjs";
1
+ import { t as _default } from "./as-action.vue-Dse77iCr.mjs";
2
2
  export { _default as default };
@@ -1,4 +1,4 @@
1
- import { s as TAsComponentProps } from "./types-C5Gx4ZuF.mjs";
1
+ import { s as TAsComponentProps } from "./types-BXTpoOfM.cjs";
2
2
  import * as vue from "vue";
3
3
 
4
4
  //#region src/components/defaults/as-action.vue.d.ts
@@ -1,4 +1,4 @@
1
- import { s as TAsComponentProps } from "./types-D23g9Vs-.cjs";
1
+ import { s as TAsComponentProps } from "./types-CXGcf7sO.mjs";
2
2
  import * as vue from "vue";
3
3
 
4
4
  //#region src/components/defaults/as-action.vue.d.ts
@@ -1,12 +1,12 @@
1
- import { _ as LOCK_KEY, a as CHANGE_HANDLER_KEY, n as useAsUnionVariant, r as useFormContext } from "./use-form-context-0FtVVTvf.mjs";
1
+ import { i as useInheritedLock, n as useAsUnionVariant, o as CHANGE_HANDLER_KEY, r as useFormContext } from "./use-form-context-D_ejQqCc.mjs";
2
2
  import { o as useAsTexts } from "./use-as-locale-CznDr-7i.mjs";
3
- import { t as as_field_default } from "./as-field-iQ2H3VGd.mjs";
4
- import { t as useAsModelTexts } from "./use-as-model-texts-BXSEzUWJ.mjs";
5
- import { t as as_collapsible_default } from "./as-collapsible-B9KPgJyo.mjs";
6
- import { t as as_variant_picker_default } from "./as-variant-picker-CKSLKefM.mjs";
3
+ import { t as as_field_default } from "./as-field-C6iquEB1.mjs";
4
+ import { t as useAsModelTexts } from "./use-as-model-texts-D26kn80o.mjs";
5
+ import { t as as_collapsible_default } from "./as-collapsible-DOIWkQ0v.mjs";
6
+ import { t as as_variant_picker_default } from "./as-variant-picker-O_6JNWLk.mjs";
7
7
  import { n as useAsDropdown, t as variantLabel } from "./variant-label-Drm3s-28.mjs";
8
8
  import { t as useAsOptionalAddFlow } from "./use-as-optional-add-flow-WA-R6yXz.mjs";
9
- import { t as as_array_clear_btn_default } from "./as-array-clear-btn-DOBKhLCy.mjs";
9
+ import { t as as_array_clear_btn_default } from "./as-array-clear-btn-BFfll2RA.mjs";
10
10
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, normalizeClass, openBlock, reactive, ref, renderList, toDisplayString, unref, useTemplateRef, vShow, watch, withCtx, withDirectives } from "vue";
11
11
  import { getFieldMeta, isUnionField } from "@atscript/ui";
12
12
  //#region src/composables/use-as-array.ts
@@ -25,8 +25,7 @@ import { getFieldMeta, isUnionField } from "@atscript/ui";
25
25
  function useAsArray(field, locked) {
26
26
  const { pathPrefix, getByPath, setByPath, emptyValueOf } = useFormContext("useAsArray");
27
27
  const handleChange = inject(CHANGE_HANDLER_KEY, () => {});
28
- const lock = inject(LOCK_KEY, void 0);
29
- const disabled = locked ?? computed(() => !!lock && (unref(lock.disabled) || unref(lock.readonly)));
28
+ const disabled = locked ?? useInheritedLock();
30
29
  const arrayValue = computed(() => {
31
30
  const v = getByPath(pathPrefix.value);
32
31
  return Array.isArray(v) ? v : [];
@@ -363,7 +362,7 @@ var as_array_default = /* @__PURE__ */ defineComponent({
363
362
  const hasVariantPicker = computed(() => unionCtx !== void 0 && unionCtx.variants.length > 1);
364
363
  const optionalEnabled = computed(() => Array.isArray(props.model?.value));
365
364
  const locked = computed(() => !!props.disabled || !!props.readonly);
366
- const { arrayValue, itemKeys, isUnion, unionVariants, isOptional, isEmpty, getItemField, addItem, removeItem, clear, canAdd, canRemove } = useAsArray(arrayField, locked);
365
+ const { arrayValue, itemKeys, isUnion, unionVariants, isOptional, isEmpty, getItemField, addItem, removeItem, clear, canAdd, canRemove } = useAsArray(arrayField);
367
366
  const level = computed(() => props.level ?? 0);
368
367
  const { t } = useAsTexts();
369
368
  const modelT = useAsModelTexts();
@@ -1,12 +1,12 @@
1
- const require_use_form_context = require("./use-form-context-U6vg1uqK.cjs");
1
+ const require_use_form_context = require("./use-form-context-BPlkQwkM.cjs");
2
2
  const require_use_as_locale = require("./use-as-locale-eo7FyfaZ.cjs");
3
- const require_as_field = require("./as-field-lMMfms8d.cjs");
4
- const require_use_as_model_texts = require("./use-as-model-texts-BSFCEwAa.cjs");
5
- const require_as_collapsible = require("./as-collapsible-C37-3_Rp.cjs");
6
- const require_as_variant_picker = require("./as-variant-picker-CceIhZUk.cjs");
3
+ const require_as_field = require("./as-field-CJMJJfXO.cjs");
4
+ const require_use_as_model_texts = require("./use-as-model-texts-DR4s80Mb.cjs");
5
+ const require_as_collapsible = require("./as-collapsible-Bs0LOl1t.cjs");
6
+ const require_as_variant_picker = require("./as-variant-picker-apxtW5rZ.cjs");
7
7
  const require_variant_label = require("./variant-label-CSzBE4T6.cjs");
8
8
  const require_use_as_optional_add_flow = require("./use-as-optional-add-flow-CsUjhfkc.cjs");
9
- const require_as_array_clear_btn = require("./as-array-clear-btn-BolX7Wpe.cjs");
9
+ const require_as_array_clear_btn = require("./as-array-clear-btn-nYR8rEeL.cjs");
10
10
  let vue = require("vue");
11
11
  let _atscript_ui = require("@atscript/ui");
12
12
  //#region src/composables/use-as-array.ts
@@ -25,8 +25,7 @@ let _atscript_ui = require("@atscript/ui");
25
25
  function useAsArray(field, locked) {
26
26
  const { pathPrefix, getByPath, setByPath, emptyValueOf } = require_use_form_context.useFormContext("useAsArray");
27
27
  const handleChange = (0, vue.inject)(require_use_form_context.CHANGE_HANDLER_KEY, () => {});
28
- const lock = (0, vue.inject)(require_use_form_context.LOCK_KEY, void 0);
29
- const disabled = locked ?? (0, vue.computed)(() => !!lock && ((0, vue.unref)(lock.disabled) || (0, vue.unref)(lock.readonly)));
28
+ const disabled = locked ?? require_use_form_context.useInheritedLock();
30
29
  const arrayValue = (0, vue.computed)(() => {
31
30
  const v = getByPath(pathPrefix.value);
32
31
  return Array.isArray(v) ? v : [];
@@ -363,7 +362,7 @@ var as_array_default = /* @__PURE__ */ (0, vue.defineComponent)({
363
362
  const hasVariantPicker = (0, vue.computed)(() => unionCtx !== void 0 && unionCtx.variants.length > 1);
364
363
  const optionalEnabled = (0, vue.computed)(() => Array.isArray(props.model?.value));
365
364
  const locked = (0, vue.computed)(() => !!props.disabled || !!props.readonly);
366
- const { arrayValue, itemKeys, isUnion, unionVariants, isOptional, isEmpty, getItemField, addItem, removeItem, clear, canAdd, canRemove } = useAsArray(arrayField, locked);
365
+ const { arrayValue, itemKeys, isUnion, unionVariants, isOptional, isEmpty, getItemField, addItem, removeItem, clear, canAdd, canRemove } = useAsArray(arrayField);
367
366
  const level = (0, vue.computed)(() => props.level ?? 0);
368
367
  const { t } = require_use_as_locale.useAsTexts();
369
368
  const modelT = require_use_as_model_texts.useAsModelTexts();
@@ -1,5 +1,5 @@
1
1
  import { o as useAsTexts } from "./use-as-locale-CznDr-7i.mjs";
2
- import { n as as_optional_clear_default } from "./as-variant-picker-CKSLKefM.mjs";
2
+ import { n as as_optional_clear_default } from "./as-variant-picker-O_6JNWLk.mjs";
3
3
  import { createBlock, createElementBlock, defineComponent, openBlock, toDisplayString, unref, withModifiers } from "vue";
4
4
  //#region src/components/internal/as-array-clear-btn.vue?vue&type=script&setup=true&lang.ts
5
5
  const _hoisted_1 = ["disabled", "aria-label"];
@@ -1,5 +1,5 @@
1
1
  const require_use_as_locale = require("./use-as-locale-eo7FyfaZ.cjs");
2
- const require_as_variant_picker = require("./as-variant-picker-CceIhZUk.cjs");
2
+ const require_as_variant_picker = require("./as-variant-picker-apxtW5rZ.cjs");
3
3
  let vue = require("vue");
4
4
  //#region src/components/internal/as-array-clear-btn.vue?vue&type=script&setup=true&lang.ts
5
5
  const _hoisted_1 = ["disabled", "aria-label"];
package/dist/as-array.cjs CHANGED
@@ -1,2 +1,2 @@
1
- const require_as_array = require("./as-array-BCmGCZul.cjs");
1
+ const require_as_array = require("./as-array-CKedVJIz.cjs");
2
2
  module.exports = require_as_array.as_array_default;
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-array.vue-BB22gE0u.cjs";
1
+ import { t as _default } from "./as-array.vue-DJNzEE8-.cjs";
2
2
  export = _default;
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-array.vue-CgYp_DSb.mjs";
1
+ import { t as _default } from "./as-array.vue-BCB8mLx-.mjs";
2
2
  export { _default as default };
package/dist/as-array.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as as_array_default } from "./as-array-CHVronOS.mjs";
1
+ import { t as as_array_default } from "./as-array-CEtgj6nd.mjs";
2
2
  export { as_array_default as default };
@@ -1,4 +1,4 @@
1
- import { s as TAsComponentProps } from "./types-D23g9Vs-.cjs";
1
+ import { s as TAsComponentProps } from "./types-CXGcf7sO.mjs";
2
2
  import * as vue from "vue";
3
3
 
4
4
  //#region src/components/defaults/as-array.vue.d.ts
@@ -1,4 +1,4 @@
1
- import { s as TAsComponentProps } from "./types-C5Gx4ZuF.mjs";
1
+ import { s as TAsComponentProps } from "./types-BXTpoOfM.cjs";
2
2
  import * as vue from "vue";
3
3
 
4
4
  //#region src/components/defaults/as-array.vue.d.ts
@@ -1,6 +1,6 @@
1
1
  import { t as isTriState } from "./_shape-CnW2sBRs.mjs";
2
- import { t as as_field_shell_default } from "./as-field-shell-QMsYyJ8r.mjs";
3
- import { n as as_optional_clear_default } from "./as-variant-picker-CKSLKefM.mjs";
2
+ import { t as as_field_shell_default } from "./as-field-shell-DXbAJupk.mjs";
3
+ import { n as as_optional_clear_default } from "./as-variant-picker-O_6JNWLk.mjs";
4
4
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, mergeProps, normalizeClass, openBlock, ref, toDisplayString, unref, watchEffect, withCtx } from "vue";
5
5
  //#region src/composables/use-as-tri-state-checkbox.ts
6
6
  /**
@@ -47,6 +47,7 @@ const _hoisted_5 = [
47
47
  "checked",
48
48
  "name",
49
49
  "disabled",
50
+ "aria-required",
50
51
  "aria-invalid",
51
52
  "aria-describedby"
52
53
  ];
@@ -298,6 +299,7 @@ var as_checkbox_default = /* @__PURE__ */ defineComponent({
298
299
  onBlur: _cache[1] || (_cache[1] = (...args) => __props.onBlur && __props.onBlur(...args)),
299
300
  name: __props.name,
300
301
  disabled: __props.disabled,
302
+ "aria-required": __props.required || void 0,
301
303
  "aria-invalid": !!__props.error || void 0,
302
304
  "aria-describedby": __props.ariaDescribedBy
303
305
  }, null, 40, _hoisted_5), createTextVNode(" " + toDisplayString(__props.label), 1)], 10, _hoisted_4)),
@@ -1,6 +1,6 @@
1
1
  const require__shape = require("./_shape-DPDZTV_T.cjs");
2
- const require_as_field_shell = require("./as-field-shell-BPesuJKa.cjs");
3
- const require_as_variant_picker = require("./as-variant-picker-CceIhZUk.cjs");
2
+ const require_as_field_shell = require("./as-field-shell-CMq52Z6e.cjs");
3
+ const require_as_variant_picker = require("./as-variant-picker-apxtW5rZ.cjs");
4
4
  let vue = require("vue");
5
5
  //#region src/composables/use-as-tri-state-checkbox.ts
6
6
  /**
@@ -47,6 +47,7 @@ const _hoisted_5 = [
47
47
  "checked",
48
48
  "name",
49
49
  "disabled",
50
+ "aria-required",
50
51
  "aria-invalid",
51
52
  "aria-describedby"
52
53
  ];
@@ -298,6 +299,7 @@ var as_checkbox_default = /* @__PURE__ */ (0, vue.defineComponent)({
298
299
  onBlur: _cache[1] || (_cache[1] = (...args) => __props.onBlur && __props.onBlur(...args)),
299
300
  name: __props.name,
300
301
  disabled: __props.disabled,
302
+ "aria-required": __props.required || void 0,
301
303
  "aria-invalid": !!__props.error || void 0,
302
304
  "aria-describedby": __props.ariaDescribedBy
303
305
  }, null, 40, _hoisted_5), (0, vue.createTextVNode)(" " + (0, vue.toDisplayString)(__props.label), 1)], 10, _hoisted_4)),
@@ -1,2 +1,2 @@
1
- const require_as_checkbox = require("./as-checkbox-BKWtScvS.cjs");
1
+ const require_as_checkbox = require("./as-checkbox-DKaEfo7e.cjs");
2
2
  module.exports = require_as_checkbox.as_checkbox_default;
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-checkbox.vue-RTW5hwvE.cjs";
1
+ import { t as _default } from "./as-checkbox.vue-fPeyQDp5.cjs";
2
2
  export = _default;
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-checkbox.vue-CQzeu4IP.mjs";
1
+ import { t as _default } from "./as-checkbox.vue-CoCgt4vV.mjs";
2
2
  export { _default as default };
@@ -1,2 +1,2 @@
1
- import { t as as_checkbox_default } from "./as-checkbox-BX5N5GHR.mjs";
1
+ import { t as as_checkbox_default } from "./as-checkbox-B7C-CvhT.mjs";
2
2
  export { as_checkbox_default as default };
@@ -1,4 +1,4 @@
1
- import { s as TAsComponentProps } from "./types-C5Gx4ZuF.mjs";
1
+ import { s as TAsComponentProps } from "./types-CXGcf7sO.mjs";
2
2
  import * as vue from "vue";
3
3
 
4
4
  //#region src/components/defaults/as-checkbox.vue.d.ts
@@ -1,4 +1,4 @@
1
- import { s as TAsComponentProps } from "./types-D23g9Vs-.cjs";
1
+ import { s as TAsComponentProps } from "./types-BXTpoOfM.cjs";
2
2
  import * as vue from "vue";
3
3
 
4
4
  //#region src/components/defaults/as-checkbox.vue.d.ts
@@ -1,5 +1,5 @@
1
1
  const require_focus_after_toggle = require("./focus-after-toggle-BhZGqrUK.cjs");
2
- const require_use_form_context = require("./use-form-context-U6vg1uqK.cjs");
2
+ const require_use_form_context = require("./use-form-context-BPlkQwkM.cjs");
3
3
  const require_use_as_nested_sections_store = require("./use-as-nested-sections-store-ApstV9NL.cjs");
4
4
  const require_use_as_locale = require("./use-as-locale-eo7FyfaZ.cjs");
5
5
  let vue = require("vue");
@@ -1,5 +1,5 @@
1
1
  import { i as useAsFocusFirstAfter } from "./focus-after-toggle-DAwak7c1.mjs";
2
- import { t as formatIndexedLabelParts } from "./use-form-context-0FtVVTvf.mjs";
2
+ import { t as formatIndexedLabelParts } from "./use-form-context-D_ejQqCc.mjs";
3
3
  import { i as useAsNestedSectionsStore, t as DESCENDANT_ERROR_COUNTS_KEY } from "./use-as-nested-sections-store-CkrMJbnN.mjs";
4
4
  import { o as useAsTexts } from "./use-as-locale-CznDr-7i.mjs";
5
5
  import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, inject, normalizeClass, onBeforeUnmount, onMounted, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, unref, vShow, withCtx, withDirectives } from "vue";
@@ -1,2 +1,2 @@
1
- const require_as_collapsible = require("./as-collapsible-C37-3_Rp.cjs");
1
+ const require_as_collapsible = require("./as-collapsible-Bs0LOl1t.cjs");
2
2
  module.exports = require_as_collapsible.as_collapsible_default;
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-collapsible.vue-CPmozkkf.cjs";
1
+ import { t as _default } from "./as-collapsible.vue-CH3ez8zm.cjs";
2
2
  export = _default;
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-collapsible.vue-BKN4DmSy.mjs";
1
+ import { t as _default } from "./as-collapsible.vue-DewV2oaE.mjs";
2
2
  export { _default as default };
@@ -1,2 +1,2 @@
1
- import { t as as_collapsible_default } from "./as-collapsible-B9KPgJyo.mjs";
1
+ import { t as as_collapsible_default } from "./as-collapsible-DOIWkQ0v.mjs";
2
2
  export { as_collapsible_default as default };
@@ -1,4 +1,4 @@
1
- import { a as TAsCollapsibleSlots, i as TAsCollapsibleProps } from "./types-C5Gx4ZuF.mjs";
1
+ import { a as TAsCollapsibleSlots, i as TAsCollapsibleProps } from "./types-BXTpoOfM.cjs";
2
2
  import * as vue from "vue";
3
3
 
4
4
  //#region src/components/as-collapsible.vue.d.ts
@@ -1,4 +1,4 @@
1
- import { a as TAsCollapsibleSlots, i as TAsCollapsibleProps } from "./types-D23g9Vs-.cjs";
1
+ import { a as TAsCollapsibleSlots, i as TAsCollapsibleProps } from "./types-CXGcf7sO.mjs";
2
2
  import * as vue from "vue";
3
3
 
4
4
  //#region src/components/as-collapsible.vue.d.ts
@@ -1,6 +1,6 @@
1
- const require_as_field_shell = require("./as-field-shell-BPesuJKa.cjs");
1
+ const require_as_field_shell = require("./as-field-shell-CMq52Z6e.cjs");
2
2
  const require_as_adornment_shell = require("./as-adornment-shell-CgwCACXA.cjs");
3
- const require_use_as_date = require("./use-as-date-BWJbi_j2.cjs");
3
+ const require_use_as_date = require("./use-as-date-CpkJjcyB.cjs");
4
4
  let vue = require("vue");
5
5
  //#endregion
6
6
  //#region src/components/defaults/as-date.vue
@@ -1,6 +1,6 @@
1
- import { t as as_field_shell_default } from "./as-field-shell-QMsYyJ8r.mjs";
1
+ import { t as as_field_shell_default } from "./as-field-shell-DXbAJupk.mjs";
2
2
  import { t as as_adornment_shell_default } from "./as-adornment-shell-C_z_q-mz.mjs";
3
- import { n as as_date_control_default, t as useAsDate } from "./use-as-date-B2hKWXAl.mjs";
3
+ import { n as as_date_control_default, t as useAsDate } from "./use-as-date-FsgcnN9l.mjs";
4
4
  import { computed, createBlock, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, unref, withCtx } from "vue";
5
5
  //#endregion
6
6
  //#region src/components/defaults/as-date.vue
package/dist/as-date.cjs CHANGED
@@ -1,2 +1,2 @@
1
- const require_as_date = require("./as-date-C6tT9FPz.cjs");
1
+ const require_as_date = require("./as-date-BMKMiM_d.cjs");
2
2
  module.exports = require_as_date.as_date_default;
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-date.vue-BpfWumrA.cjs";
1
+ import { t as _default } from "./as-date.vue-BSghCVx0.cjs";
2
2
  export = _default;
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-date.vue-DJ125nVS.mjs";
1
+ import { t as _default } from "./as-date.vue-CPgqqKMB.mjs";
2
2
  export { _default as default };
package/dist/as-date.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as as_date_default } from "./as-date-Bkrp2GY4.mjs";
1
+ import { t as as_date_default } from "./as-date-CFQtrpZT.mjs";
2
2
  export { as_date_default as default };
@@ -1,4 +1,4 @@
1
- import { s as TAsComponentProps } from "./types-D23g9Vs-.cjs";
1
+ import { s as TAsComponentProps } from "./types-BXTpoOfM.cjs";
2
2
  import * as vue from "vue";
3
3
 
4
4
  //#region src/components/defaults/as-date.vue.d.ts
@@ -1,4 +1,4 @@
1
- import { s as TAsComponentProps } from "./types-C5Gx4ZuF.mjs";
1
+ import { s as TAsComponentProps } from "./types-CXGcf7sO.mjs";
2
2
  import * as vue from "vue";
3
3
 
4
4
  //#region src/components/defaults/as-date.vue.d.ts
@@ -1,6 +1,6 @@
1
- const require_as_field_shell = require("./as-field-shell-BPesuJKa.cjs");
1
+ const require_as_field_shell = require("./as-field-shell-CMq52Z6e.cjs");
2
2
  const require_as_adornment_shell = require("./as-adornment-shell-CgwCACXA.cjs");
3
- const require_use_as_date = require("./use-as-date-BWJbi_j2.cjs");
3
+ const require_use_as_date = require("./use-as-date-CpkJjcyB.cjs");
4
4
  let vue = require("vue");
5
5
  //#endregion
6
6
  //#region src/components/defaults/as-datetime.vue
@@ -1,6 +1,6 @@
1
- import { t as as_field_shell_default } from "./as-field-shell-QMsYyJ8r.mjs";
1
+ import { t as as_field_shell_default } from "./as-field-shell-DXbAJupk.mjs";
2
2
  import { t as as_adornment_shell_default } from "./as-adornment-shell-C_z_q-mz.mjs";
3
- import { n as as_date_control_default, t as useAsDate } from "./use-as-date-B2hKWXAl.mjs";
3
+ import { n as as_date_control_default, t as useAsDate } from "./use-as-date-FsgcnN9l.mjs";
4
4
  import { computed, createBlock, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, unref, withCtx } from "vue";
5
5
  //#endregion
6
6
  //#region src/components/defaults/as-datetime.vue
@@ -1,2 +1,2 @@
1
- const require_as_datetime = require("./as-datetime-DWLW4W7O.cjs");
1
+ const require_as_datetime = require("./as-datetime-Bl1K4U51.cjs");
2
2
  module.exports = require_as_datetime.as_datetime_default;
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-datetime.vue-DO3tkof1.cjs";
1
+ import { t as _default } from "./as-datetime.vue-CjDTsMDw.cjs";
2
2
  export = _default;
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-datetime.vue-DfFAaVdS.mjs";
1
+ import { t as _default } from "./as-datetime.vue-B-KRC-0X.mjs";
2
2
  export { _default as default };
@@ -1,2 +1,2 @@
1
- import { t as as_datetime_default } from "./as-datetime-Dt_AWrCG.mjs";
1
+ import { t as as_datetime_default } from "./as-datetime-DqfSymmL.mjs";
2
2
  export { as_datetime_default as default };
@@ -1,4 +1,4 @@
1
- import { s as TAsComponentProps } from "./types-D23g9Vs-.cjs";
1
+ import { s as TAsComponentProps } from "./types-CXGcf7sO.mjs";
2
2
  import * as vue from "vue";
3
3
 
4
4
  //#region src/components/defaults/as-datetime.vue.d.ts
@@ -1,4 +1,4 @@
1
- import { s as TAsComponentProps } from "./types-C5Gx4ZuF.mjs";
1
+ import { s as TAsComponentProps } from "./types-BXTpoOfM.cjs";
2
2
  import * as vue from "vue";
3
3
 
4
4
  //#region src/components/defaults/as-datetime.vue.d.ts
@@ -1,9 +1,14 @@
1
1
  const require_use_as_locale = require("./use-as-locale-eo7FyfaZ.cjs");
2
2
  const require__shape = require("./_shape-DPDZTV_T.cjs");
3
- const require_as_field_shell = require("./as-field-shell-BPesuJKa.cjs");
3
+ const require_as_field_shell = require("./as-field-shell-CMq52Z6e.cjs");
4
4
  let vue = require("vue");
5
5
  let _atscript_ui = require("@atscript/ui");
6
6
  //#region src/composables/use-as-decimal.ts
7
+ /** The fraction digits `v` holds, trailing zeros aside (`"0.1230"` → 3). */
8
+ function heldDigits(v) {
9
+ const text = typeof v === "number" ? String(v) : v ?? "";
10
+ return /\.(\d*?)0*$/.exec(text)?.[1].length ?? 0;
11
+ }
7
12
  /**
8
13
  * Reactive composable for decimal-typed inputs (the `AsDecimal` SFC and
9
14
  * customer swaps built against `TAsComponentProps`).
@@ -14,9 +19,11 @@ let _atscript_ui = require("@atscript/ui");
14
19
  *
15
20
  * Storage shape is preserved on commit — string `modelValue` commits a
16
21
  * string padded to `storageScale`; number `modelValue` commits a number.
17
- * A change to the effective `scale` getter that shrinks it below the
18
- * model's actual precision triggers a re-round + re-commit (the same
19
- * "currency-change" behaviour as before).
22
+ * A stored digit is never cut: a value with more digits than `scale` shows
23
+ * and edits with them, up to `storageScale` when one is set (as a table cell
24
+ * shows it). A `scale` that shrinks below the model's precision while the
25
+ * model stays (a switch to a currency with fewer digits) re-rounds +
26
+ * re-commits it; a new model arriving with it (a load) is kept.
20
27
  */
21
28
  function useAsDecimal(opts) {
22
29
  const localeCtx = require_use_as_locale.useAsLocale();
@@ -25,20 +32,9 @@ function useAsDecimal(opts) {
25
32
  if (explicit) return explicit;
26
33
  return localeCtx.locale.value;
27
34
  });
28
- const scale = (0, vue.computed)(() => {
29
- const s = opts.scale?.();
30
- if (s !== void 0) return s;
31
- const storage = opts.storageScale?.();
32
- if (storage !== void 0) return storage;
33
- return 2;
34
- });
35
- const storageScale = (0, vue.computed)(() => {
36
- const storage = opts.storageScale?.();
37
- if (storage !== void 0) return storage;
38
- const s = opts.scale?.();
39
- if (s !== void 0) return s;
40
- return 2;
41
- });
35
+ const declaredScale = (0, vue.computed)(() => opts.scale?.() ?? opts.storageScale?.() ?? 2);
36
+ const scale = (0, vue.computed)(() => Math.max(declaredScale.value, Math.min(heldDigits(opts.modelValue()), opts.storageScale?.() ?? 100)));
37
+ const storageScale = (0, vue.computed)(() => opts.storageScale?.() ?? scale.value);
42
38
  const decimalSeparator = (0, vue.computed)(() => (0, _atscript_ui.getDecimalSeparator)(locale.value));
43
39
  const thousandsSeparator = (0, vue.computed)(() => (0, _atscript_ui.getThousandsSeparator)(locale.value));
44
40
  const rawValue = (0, vue.computed)(() => {
@@ -98,17 +94,15 @@ function useAsDecimal(opts) {
98
94
  decimal: decDigits
99
95
  }), scale.value));
100
96
  }
101
- (0, vue.watch)(scale, (newScale, oldScale) => {
102
- if (oldScale === void 0) return;
103
- if (newScale >= oldScale) return;
104
- const v = opts.modelValue();
97
+ (0, vue.watch)([declaredScale, () => opts.modelValue()], ([newScale, v], [oldScale, oldV]) => {
98
+ if (v !== oldV || newScale >= oldScale) return;
105
99
  if (v === null || v === void 0) return;
106
100
  const s = typeof v === "number" ? Number.isFinite(v) ? String(v) : "" : v;
107
101
  if (s === "") return;
108
102
  if ((0, _atscript_ui.splitDecimalString)(s).decimal.length <= newScale) return;
109
- const shaped = require__shape.preserveShape(v, (0, _atscript_ui.enforceScale)((0, _atscript_ui.enforceScale)(s, newScale), storageScale.value));
103
+ const shaped = require__shape.preserveShape(v, (0, _atscript_ui.enforceScale)((0, _atscript_ui.enforceScale)(s, newScale), opts.storageScale?.() ?? newScale));
110
104
  opts.onCommit(shaped);
111
- }, { flush: "sync" });
105
+ });
112
106
  return {
113
107
  scale,
114
108
  storageScale,
@@ -1,9 +1,14 @@
1
1
  import { a as useAsLocale, o as useAsTexts } from "./use-as-locale-CznDr-7i.mjs";
2
2
  import { n as preserveShape } from "./_shape-CnW2sBRs.mjs";
3
- import { t as as_field_shell_default } from "./as-field-shell-QMsYyJ8r.mjs";
3
+ import { t as as_field_shell_default } from "./as-field-shell-DXbAJupk.mjs";
4
4
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, nextTick, normalizeClass, normalizeProps, openBlock, ref, toDisplayString, unref, watch, withCtx } from "vue";
5
5
  import { enforceScale, formatDecimalForDisplay, getDecimalSeparator, getThousandsSeparator, groupInteger, joinDecimalString, parseDecimalInput, splitDecimalString } from "@atscript/ui";
6
6
  //#region src/composables/use-as-decimal.ts
7
+ /** The fraction digits `v` holds, trailing zeros aside (`"0.1230"` → 3). */
8
+ function heldDigits(v) {
9
+ const text = typeof v === "number" ? String(v) : v ?? "";
10
+ return /\.(\d*?)0*$/.exec(text)?.[1].length ?? 0;
11
+ }
7
12
  /**
8
13
  * Reactive composable for decimal-typed inputs (the `AsDecimal` SFC and
9
14
  * customer swaps built against `TAsComponentProps`).
@@ -14,9 +19,11 @@ import { enforceScale, formatDecimalForDisplay, getDecimalSeparator, getThousand
14
19
  *
15
20
  * Storage shape is preserved on commit — string `modelValue` commits a
16
21
  * string padded to `storageScale`; number `modelValue` commits a number.
17
- * A change to the effective `scale` getter that shrinks it below the
18
- * model's actual precision triggers a re-round + re-commit (the same
19
- * "currency-change" behaviour as before).
22
+ * A stored digit is never cut: a value with more digits than `scale` shows
23
+ * and edits with them, up to `storageScale` when one is set (as a table cell
24
+ * shows it). A `scale` that shrinks below the model's precision while the
25
+ * model stays (a switch to a currency with fewer digits) re-rounds +
26
+ * re-commits it; a new model arriving with it (a load) is kept.
20
27
  */
21
28
  function useAsDecimal(opts) {
22
29
  const localeCtx = useAsLocale();
@@ -25,20 +32,9 @@ function useAsDecimal(opts) {
25
32
  if (explicit) return explicit;
26
33
  return localeCtx.locale.value;
27
34
  });
28
- const scale = computed(() => {
29
- const s = opts.scale?.();
30
- if (s !== void 0) return s;
31
- const storage = opts.storageScale?.();
32
- if (storage !== void 0) return storage;
33
- return 2;
34
- });
35
- const storageScale = computed(() => {
36
- const storage = opts.storageScale?.();
37
- if (storage !== void 0) return storage;
38
- const s = opts.scale?.();
39
- if (s !== void 0) return s;
40
- return 2;
41
- });
35
+ const declaredScale = computed(() => opts.scale?.() ?? opts.storageScale?.() ?? 2);
36
+ const scale = computed(() => Math.max(declaredScale.value, Math.min(heldDigits(opts.modelValue()), opts.storageScale?.() ?? 100)));
37
+ const storageScale = computed(() => opts.storageScale?.() ?? scale.value);
42
38
  const decimalSeparator = computed(() => getDecimalSeparator(locale.value));
43
39
  const thousandsSeparator = computed(() => getThousandsSeparator(locale.value));
44
40
  const rawValue = computed(() => {
@@ -98,17 +94,15 @@ function useAsDecimal(opts) {
98
94
  decimal: decDigits
99
95
  }), scale.value));
100
96
  }
101
- watch(scale, (newScale, oldScale) => {
102
- if (oldScale === void 0) return;
103
- if (newScale >= oldScale) return;
104
- const v = opts.modelValue();
97
+ watch([declaredScale, () => opts.modelValue()], ([newScale, v], [oldScale, oldV]) => {
98
+ if (v !== oldV || newScale >= oldScale) return;
105
99
  if (v === null || v === void 0) return;
106
100
  const s = typeof v === "number" ? Number.isFinite(v) ? String(v) : "" : v;
107
101
  if (s === "") return;
108
102
  if (splitDecimalString(s).decimal.length <= newScale) return;
109
- const shaped = preserveShape(v, enforceScale(enforceScale(s, newScale), storageScale.value));
103
+ const shaped = preserveShape(v, enforceScale(enforceScale(s, newScale), opts.storageScale?.() ?? newScale));
110
104
  opts.onCommit(shaped);
111
- }, { flush: "sync" });
105
+ });
112
106
  return {
113
107
  scale,
114
108
  storageScale,
@@ -1,2 +1,2 @@
1
- const require_as_decimal = require("./as-decimal-DuWZDjbg.cjs");
1
+ const require_as_decimal = require("./as-decimal-48M_h9Sl.cjs");
2
2
  module.exports = require_as_decimal.as_decimal_default;
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-decimal.vue-C42_-oK9.cjs";
1
+ import { t as _default } from "./as-decimal.vue-BvvG5aIL.cjs";
2
2
  export = _default;
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-decimal.vue-BODauGXK.mjs";
1
+ import { t as _default } from "./as-decimal.vue-BZ2imea4.mjs";
2
2
  export { _default as default };
@@ -1,2 +1,2 @@
1
- import { t as as_decimal_default } from "./as-decimal-BUr24VTI.mjs";
1
+ import { t as as_decimal_default } from "./as-decimal-CsAJlvie.mjs";
2
2
  export { as_decimal_default as default };
@@ -1,4 +1,4 @@
1
- import { s as TAsComponentProps } from "./types-C5Gx4ZuF.mjs";
1
+ import { s as TAsComponentProps } from "./types-CXGcf7sO.mjs";
2
2
  import * as vue from "vue";
3
3
 
4
4
  //#region src/components/defaults/as-decimal.vue.d.ts
@@ -1,4 +1,4 @@
1
- import { s as TAsComponentProps } from "./types-D23g9Vs-.cjs";
1
+ import { s as TAsComponentProps } from "./types-BXTpoOfM.cjs";
2
2
  import * as vue from "vue";
3
3
 
4
4
  //#region src/components/defaults/as-decimal.vue.d.ts