@atscript/vue-form 0.1.201 → 0.1.203

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 (103) hide show
  1. package/dist/{as-array-BZ_nxqTz.cjs → as-array-CWuMR-2P.cjs} +26 -16
  2. package/dist/{as-array-clear-btn-CzojQsEk.cjs → as-array-clear-btn-BX3HSWel.cjs} +1 -1
  3. package/dist/{as-array-clear-btn-Bi4wDHOv.mjs → as-array-clear-btn-CRfCFJ73.mjs} +1 -1
  4. package/dist/{as-array-ChUcZDS7.mjs → as-array-dttDB3Rg.mjs} +26 -16
  5. package/dist/as-array.cjs +1 -1
  6. package/dist/as-array.mjs +1 -1
  7. package/dist/{as-checkbox-Dcl1hwmW.mjs → as-checkbox-BS0fjlQC.mjs} +3 -3
  8. package/dist/{as-checkbox-DHe7ow33.cjs → as-checkbox-DyA1ncSp.cjs} +3 -3
  9. package/dist/as-checkbox.cjs +1 -1
  10. package/dist/as-checkbox.mjs +1 -1
  11. package/dist/{as-collapsible-DBVrSPb1.cjs → as-collapsible-B0im1dAa.cjs} +1 -1
  12. package/dist/{as-collapsible-Cq4JQZo8.mjs → as-collapsible-B4Vb0XIR.mjs} +1 -1
  13. package/dist/as-collapsible.cjs +1 -1
  14. package/dist/as-collapsible.mjs +1 -1
  15. package/dist/{as-date-DJC3ll7B.mjs → as-date-Wk0mReg2.mjs} +1 -1
  16. package/dist/{as-date-CzpK7FFU.cjs → as-date-bI28vJja.cjs} +1 -1
  17. package/dist/as-date.cjs +1 -1
  18. package/dist/as-date.mjs +1 -1
  19. package/dist/{as-datetime-CU2pYPsb.cjs → as-datetime-Ca-23Nrq.cjs} +1 -1
  20. package/dist/{as-datetime-Bk__Ct69.mjs → as-datetime-F2PdaCh1.mjs} +1 -1
  21. package/dist/as-datetime.cjs +1 -1
  22. package/dist/as-datetime.mjs +1 -1
  23. package/dist/{as-decimal-BAiy9Cjz.mjs → as-decimal-4zD1qPmT.mjs} +1 -1
  24. package/dist/{as-decimal-B6MeEFmb.cjs → as-decimal-CYIBnc-k.cjs} +1 -1
  25. package/dist/as-decimal.cjs +1 -1
  26. package/dist/as-decimal.mjs +1 -1
  27. package/dist/{as-field-B5y4YbI1.cjs → as-field-BdFUGqKv.cjs} +22 -9
  28. package/dist/{as-field-D3EMcOTS.mjs → as-field-U_EtrpNj.mjs} +22 -9
  29. package/dist/{as-field-shell-DfPH23qM.mjs → as-field-shell-DQ30etIq.mjs} +29 -17
  30. package/dist/{as-field-shell-DoVSv3X2.cjs → as-field-shell-ha1iaJnK.cjs} +29 -17
  31. package/dist/as-field-shell.cjs +1 -1
  32. package/dist/as-field-shell.d.cts +1 -1
  33. package/dist/as-field-shell.d.mts +1 -1
  34. package/dist/as-field-shell.mjs +1 -1
  35. package/dist/{as-field-shell.vue-DHIauZOI.d.cts → as-field-shell.vue-CVDPz5RX.d.cts} +2 -1
  36. package/dist/{as-field-shell.vue-Cypm-sNO.d.mts → as-field-shell.vue-Dj34leHW.d.mts} +2 -1
  37. package/dist/as-field.cjs +1 -1
  38. package/dist/as-field.mjs +1 -1
  39. package/dist/{as-form-BICthTGO.cjs → as-form-Dfrq97Tv.cjs} +8 -4
  40. package/dist/{as-form-DCefxLEt.mjs → as-form-WhZH4ozr.mjs} +8 -4
  41. package/dist/as-form.cjs +1 -1
  42. package/dist/as-form.d.cts +1 -1
  43. package/dist/as-form.d.mts +1 -1
  44. package/dist/as-form.mjs +1 -1
  45. package/dist/{as-form.vue-Bu3zHKf_.d.mts → as-form.vue-D7J9Mm_V.d.mts} +6 -1
  46. package/dist/{as-form.vue-BkfghUp3.d.cts → as-form.vue-DEGb6oP3.d.cts} +6 -1
  47. package/dist/{as-input-Wf71dw3g.cjs → as-input-Cr2zcWgm.cjs} +1 -1
  48. package/dist/{as-input-Dl7R32s4.mjs → as-input-Du26WjkP.mjs} +1 -1
  49. package/dist/as-input.cjs +1 -1
  50. package/dist/as-input.mjs +1 -1
  51. package/dist/{as-iterator-D_47pazg.cjs → as-iterator-BgYp1qj4.cjs} +2 -2
  52. package/dist/{as-iterator-DTNgife_.mjs → as-iterator-BvL2pCKj.mjs} +2 -2
  53. package/dist/as-iterator.cjs +1 -1
  54. package/dist/as-iterator.mjs +1 -1
  55. package/dist/{as-multi-select-CaBpEOU2.mjs → as-multi-select-C9yGmtWR.mjs} +1 -1
  56. package/dist/{as-multi-select-BoWBD88H.cjs → as-multi-select-CNRqlh1o.cjs} +1 -1
  57. package/dist/as-multi-select.cjs +1 -1
  58. package/dist/as-multi-select.mjs +1 -1
  59. package/dist/{as-number-CQ6W7cEP.mjs → as-number-CsoSsIJ8.mjs} +1 -1
  60. package/dist/{as-number-BxcjlrtO.cjs → as-number-DEkR-Oud.cjs} +1 -1
  61. package/dist/as-number.cjs +1 -1
  62. package/dist/as-number.mjs +1 -1
  63. package/dist/{as-object-CWqrZQZ1.mjs → as-object-DIEi_L2T.mjs} +12 -9
  64. package/dist/{as-object-BPb5NTBo.cjs → as-object-DZHwEfd8.cjs} +12 -9
  65. package/dist/as-object.cjs +1 -1
  66. package/dist/as-object.mjs +1 -1
  67. package/dist/{as-radio-gmYSDmA0.mjs → as-radio-Bn14VyaN.mjs} +12 -5
  68. package/dist/{as-radio-CjZST1ug.cjs → as-radio-CvIgHH9G.cjs} +12 -5
  69. package/dist/as-radio.cjs +1 -1
  70. package/dist/as-radio.mjs +1 -1
  71. package/dist/{as-ref-DemuzDv8.cjs → as-ref-BNESufCy.cjs} +7 -5
  72. package/dist/{as-ref-BBfZbvOd.mjs → as-ref-DhWEKsYJ.mjs} +7 -5
  73. package/dist/as-ref.cjs +1 -1
  74. package/dist/as-ref.mjs +1 -1
  75. package/dist/{as-select-BhJDP5e1.cjs → as-select-COxfMWYf.cjs} +57 -15
  76. package/dist/{as-select-Dvhdd605.mjs → as-select-Csr2229O.mjs} +57 -15
  77. package/dist/as-select.cjs +1 -1
  78. package/dist/as-select.mjs +1 -1
  79. package/dist/{as-time-CNJj5Jja.mjs → as-time-YMnd789f.mjs} +1 -1
  80. package/dist/{as-time-DLWM1tBe.cjs → as-time-e40w14c7.cjs} +1 -1
  81. package/dist/as-time.cjs +1 -1
  82. package/dist/as-time.mjs +1 -1
  83. package/dist/{as-tuple-0VjDpPCh.cjs → as-tuple-Bb-sQh6T.cjs} +13 -16
  84. package/dist/{as-tuple-C3D1r8nT.mjs → as-tuple-BjMI93bC.mjs} +13 -16
  85. package/dist/as-tuple.cjs +1 -1
  86. package/dist/as-tuple.mjs +1 -1
  87. package/dist/{as-union-Br5-t5Co.cjs → as-union-D6JPYyYf.cjs} +13 -8
  88. package/dist/{as-union-5oOye2iv.mjs → as-union-D7FONvHe.mjs} +13 -8
  89. package/dist/as-union.cjs +1 -1
  90. package/dist/as-union.mjs +1 -1
  91. package/dist/{as-variant-picker-BYrf1YUe.cjs → as-variant-picker-13N8TxuF.cjs} +1 -1
  92. package/dist/{as-variant-picker-3P9wXCUf.mjs → as-variant-picker-VixxxnXA.mjs} +1 -1
  93. package/dist/index.cjs +23 -23
  94. package/dist/index.d.cts +2 -2
  95. package/dist/index.d.mts +2 -2
  96. package/dist/index.mjs +23 -23
  97. package/dist/{use-as-model-texts-DtqNcugR.cjs → use-as-model-texts-BNO2SFQF.cjs} +1 -1
  98. package/dist/{use-as-model-texts-Duq04LpS.mjs → use-as-model-texts-BTFyHNqS.mjs} +1 -1
  99. package/dist/{use-as-value-help-XPeNhfJY.cjs → use-as-value-help-LDhcfxFi.cjs} +1 -1
  100. package/dist/{use-as-value-help-D16evDGm.mjs → use-as-value-help-LQWMkS5m.mjs} +1 -1
  101. package/dist/{use-form-context-7CK50mTi.cjs → use-form-context-d0IcFey0.cjs} +7 -0
  102. package/dist/{use-form-context-ba0N--m6.mjs → use-form-context-p2PucQHk.mjs} +2 -1
  103. package/package.json +10 -10
@@ -1,12 +1,12 @@
1
- const require_use_form_context = require("./use-form-context-7CK50mTi.cjs");
1
+ const require_use_form_context = require("./use-form-context-d0IcFey0.cjs");
2
2
  const require_use_as_locale = require("./use-as-locale-eo7FyfaZ.cjs");
3
- const require_as_field = require("./as-field-B5y4YbI1.cjs");
4
- const require_use_as_model_texts = require("./use-as-model-texts-DtqNcugR.cjs");
5
- const require_as_collapsible = require("./as-collapsible-DBVrSPb1.cjs");
6
- const require_as_variant_picker = require("./as-variant-picker-BYrf1YUe.cjs");
3
+ const require_as_field = require("./as-field-BdFUGqKv.cjs");
4
+ const require_use_as_model_texts = require("./use-as-model-texts-BNO2SFQF.cjs");
5
+ const require_as_collapsible = require("./as-collapsible-B0im1dAa.cjs");
6
+ const require_as_variant_picker = require("./as-variant-picker-13N8TxuF.cjs");
7
7
  const require_variant_label = require("./variant-label-_GLezszT.cjs");
8
8
  const require_use_as_optional_add_flow = require("./use-as-optional-add-flow-DMDd4Ms0.cjs");
9
- const require_as_array_clear_btn = require("./as-array-clear-btn-CzojQsEk.cjs");
9
+ const require_as_array_clear_btn = require("./as-array-clear-btn-BX3HSWel.cjs");
10
10
  let vue = require("vue");
11
11
  let _atscript_ui = require("@atscript/ui");
12
12
  //#region src/composables/use-as-array.ts
@@ -16,10 +16,17 @@ let _atscript_ui = require("@atscript/ui");
16
16
  * Manages stable keys, add/remove with constraints, and item field resolution.
17
17
  * Union item types are handled transparently — AsUnion manages variant state locally.
18
18
  * Used by the default `AsArray` component and available for custom array components.
19
+ *
20
+ * A locked array — disabled or read-only, its own or a parent's (the state
21
+ * `<AsField>` hands to the fields inside it) — has `canAdd` / `canRemove`
22
+ * `false`, and `addItem` / `removeItem` / `clear` do nothing. `locked`
23
+ * overrides that state.
19
24
  */
20
- function useAsArray(field, disabled) {
25
+ function useAsArray(field, locked) {
21
26
  const { pathPrefix, getByPath, setByPath, emptyValueOf } = require_use_form_context.useFormContext("useAsArray");
22
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)));
23
30
  const arrayValue = (0, vue.computed)(() => {
24
31
  const v = getByPath(pathPrefix.value);
25
32
  return Array.isArray(v) ? v : [];
@@ -57,8 +64,8 @@ function useAsArray(field, disabled) {
57
64
  }
58
65
  const minLength = (0, _atscript_ui.getFieldMeta)(field.prop, "expect.minLength")?.length ?? 0;
59
66
  const maxLength = (0, _atscript_ui.getFieldMeta)(field.prop, "expect.maxLength")?.length ?? Infinity;
60
- const canAdd = (0, vue.computed)(() => !disabled?.value && arrayValue.value.length < maxLength);
61
- const canRemove = (0, vue.computed)(() => !disabled?.value && arrayValue.value.length > minLength);
67
+ const canAdd = (0, vue.computed)(() => !disabled.value && arrayValue.value.length < maxLength);
68
+ const canRemove = (0, vue.computed)(() => !disabled.value && arrayValue.value.length > minLength);
62
69
  function ensureArray() {
63
70
  let arr = getByPath(pathPrefix.value);
64
71
  if (!Array.isArray(arr)) {
@@ -83,6 +90,7 @@ function useAsArray(field, disabled) {
83
90
  handleChange("array-remove", pathPrefix.value, arrayValue.value);
84
91
  }
85
92
  function clear() {
93
+ if (disabled.value) return;
86
94
  if (isOptional) setByPath(pathPrefix.value, void 0);
87
95
  else {
88
96
  const arr = getByPath(pathPrefix.value);
@@ -134,7 +142,8 @@ const _hoisted_4 = {
134
142
  class: "as-dropdown-menu"
135
143
  };
136
144
  const _hoisted_5 = ["onClick"];
137
- const _hoisted_6 = {
145
+ const _hoisted_6 = ["disabled"];
146
+ const _hoisted_7 = {
138
147
  key: 0,
139
148
  class: "as-collapsible-description"
140
149
  };
@@ -345,8 +354,8 @@ var as_array_default = /* @__PURE__ */ (0, vue.defineComponent)({
345
354
  const unionCtx = require_use_form_context.useAsUnionVariant();
346
355
  const hasVariantPicker = (0, vue.computed)(() => unionCtx !== void 0 && unionCtx.variants.length > 1);
347
356
  const optionalEnabled = (0, vue.computed)(() => Array.isArray(props.model?.value));
348
- const disabled = (0, vue.computed)(() => props.disabled ?? false);
349
- const { arrayValue, itemKeys, isUnion, unionVariants, isOptional, isEmpty, getItemField, addItem, removeItem, clear, canAdd, canRemove } = useAsArray(arrayField, disabled);
357
+ const locked = (0, vue.computed)(() => !!props.disabled || !!props.readonly);
358
+ const { arrayValue, itemKeys, isUnion, unionVariants, isOptional, isEmpty, getItemField, addItem, removeItem, clear, canAdd, canRemove } = useAsArray(arrayField, locked);
350
359
  const level = (0, vue.computed)(() => props.level ?? 0);
351
360
  const { t } = require_use_as_locale.useAsTexts();
352
361
  const modelT = require_use_as_model_texts.useAsModelTexts();
@@ -392,14 +401,14 @@ var as_array_default = /* @__PURE__ */ (0, vue.defineComponent)({
392
401
  "title-extras": (0, vue.withCtx)(() => [hasVariantPicker.value ? ((0, vue.openBlock)(), (0, vue.createBlock)(require_as_variant_picker.as_variant_picker_default, {
393
402
  key: 0,
394
403
  "union-context": (0, vue.unref)(unionCtx),
395
- disabled: disabled.value
404
+ disabled: locked.value
396
405
  }, null, 8, ["union-context", "disabled"])) : (0, vue.createCommentVNode)("v-if", true)]),
397
406
  badges: (0, vue.withCtx)(() => [(0, vue.createVNode)(as_items_chip_default, { count: (0, vue.unref)(arrayValue).length }, null, 8, ["count"])]),
398
- actions: (0, vue.withCtx)(() => [(0, vue.createCommentVNode)(" Hide Clear only when required+empty: optional arrays keep it\n so the user can collapse back to undefined. "), (0, vue.unref)(isOptional) || !(0, vue.unref)(isEmpty) ? ((0, vue.openBlock)(), (0, vue.createBlock)(require_as_array_clear_btn.as_array_clear_btn_default, {
407
+ actions: (0, vue.withCtx)(() => [(0, vue.createCommentVNode)(" Hide Clear only when required+empty: optional arrays keep it\n so the user can collapse back to undefined. "), ((0, vue.unref)(isOptional) ? !locked.value : !(0, vue.unref)(isEmpty)) ? ((0, vue.openBlock)(), (0, vue.createBlock)(require_as_array_clear_btn.as_array_clear_btn_default, {
399
408
  key: 0,
400
409
  label: __props.title,
401
410
  optional: (0, vue.unref)(isOptional),
402
- disabled: disabled.value,
411
+ disabled: locked.value,
403
412
  onClear: (0, vue.unref)(clear)
404
413
  }, null, 8, [
405
414
  "label",
@@ -447,11 +456,12 @@ var as_array_default = /* @__PURE__ */ (0, vue.defineComponent)({
447
456
  empty: (0, vue.withCtx)(() => [(0, vue.withDirectives)((0, vue.createElementVNode)("div", { class: (0, vue.normalizeClass)(["as-object-empty as-grid-item", _ctx.$props.class]) }, [(0, vue.createElementVNode)("button", {
448
457
  type: "button",
449
458
  class: "as-object-empty-add",
459
+ disabled: locked.value,
450
460
  onClick: handleEnableOptional
451
461
  }, [_cache[2] || (_cache[2] = (0, vue.createElementVNode)("span", {
452
462
  class: "i-as-field-fill as-object-empty-add-icon",
453
463
  "aria-hidden": "true"
454
- }, null, -1)), (0, vue.createTextVNode)(" " + (0, vue.toDisplayString)((0, vue.unref)(t)("UI_FORM_ADD", { item: __props.title })), 1)]), __props.description ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_6, (0, vue.toDisplayString)(__props.description), 1)) : (0, vue.createCommentVNode)("v-if", true)], 2), [[vue.vShow, !__props.hidden]])]),
464
+ }, null, -1)), (0, vue.createTextVNode)(" " + (0, vue.toDisplayString)((0, vue.unref)(t)("UI_FORM_ADD", { item: __props.title })), 1)], 8, _hoisted_6), __props.description ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_7, (0, vue.toDisplayString)(__props.description), 1)) : (0, vue.createCommentVNode)("v-if", true)], 2), [[vue.vShow, !__props.hidden]])]),
455
465
  _: 1
456
466
  }, 8, [
457
467
  "class",
@@ -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-BYrf1YUe.cjs");
2
+ const require_as_variant_picker = require("./as-variant-picker-13N8TxuF.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"];
@@ -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-3P9wXCUf.mjs";
2
+ import { n as as_optional_clear_default } from "./as-variant-picker-VixxxnXA.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,12 +1,12 @@
1
- import { a as CHANGE_HANDLER_KEY, n as useAsUnionVariant, r as useFormContext } from "./use-form-context-ba0N--m6.mjs";
1
+ import { a as CHANGE_HANDLER_KEY, g as LOCK_KEY, n as useAsUnionVariant, r as useFormContext } from "./use-form-context-p2PucQHk.mjs";
2
2
  import { o as useAsTexts } from "./use-as-locale-CznDr-7i.mjs";
3
- import { t as as_field_default } from "./as-field-D3EMcOTS.mjs";
4
- import { t as useAsModelTexts } from "./use-as-model-texts-Duq04LpS.mjs";
5
- import { t as as_collapsible_default } from "./as-collapsible-Cq4JQZo8.mjs";
6
- import { t as as_variant_picker_default } from "./as-variant-picker-3P9wXCUf.mjs";
3
+ import { t as as_field_default } from "./as-field-U_EtrpNj.mjs";
4
+ import { t as useAsModelTexts } from "./use-as-model-texts-BTFyHNqS.mjs";
5
+ import { t as as_collapsible_default } from "./as-collapsible-B4Vb0XIR.mjs";
6
+ import { t as as_variant_picker_default } from "./as-variant-picker-VixxxnXA.mjs";
7
7
  import { n as useAsDropdown, t as variantLabel } from "./variant-label-CmzTQC2B.mjs";
8
8
  import { t as useAsOptionalAddFlow } from "./use-as-optional-add-flow-C1Ol6KO2.mjs";
9
- import { t as as_array_clear_btn_default } from "./as-array-clear-btn-Bi4wDHOv.mjs";
9
+ import { t as as_array_clear_btn_default } from "./as-array-clear-btn-CRfCFJ73.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
@@ -16,10 +16,17 @@ import { getFieldMeta, isUnionField } from "@atscript/ui";
16
16
  * Manages stable keys, add/remove with constraints, and item field resolution.
17
17
  * Union item types are handled transparently — AsUnion manages variant state locally.
18
18
  * Used by the default `AsArray` component and available for custom array components.
19
+ *
20
+ * A locked array — disabled or read-only, its own or a parent's (the state
21
+ * `<AsField>` hands to the fields inside it) — has `canAdd` / `canRemove`
22
+ * `false`, and `addItem` / `removeItem` / `clear` do nothing. `locked`
23
+ * overrides that state.
19
24
  */
20
- function useAsArray(field, disabled) {
25
+ function useAsArray(field, locked) {
21
26
  const { pathPrefix, getByPath, setByPath, emptyValueOf } = useFormContext("useAsArray");
22
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)));
23
30
  const arrayValue = computed(() => {
24
31
  const v = getByPath(pathPrefix.value);
25
32
  return Array.isArray(v) ? v : [];
@@ -57,8 +64,8 @@ function useAsArray(field, disabled) {
57
64
  }
58
65
  const minLength = getFieldMeta(field.prop, "expect.minLength")?.length ?? 0;
59
66
  const maxLength = getFieldMeta(field.prop, "expect.maxLength")?.length ?? Infinity;
60
- const canAdd = computed(() => !disabled?.value && arrayValue.value.length < maxLength);
61
- const canRemove = computed(() => !disabled?.value && arrayValue.value.length > minLength);
67
+ const canAdd = computed(() => !disabled.value && arrayValue.value.length < maxLength);
68
+ const canRemove = computed(() => !disabled.value && arrayValue.value.length > minLength);
62
69
  function ensureArray() {
63
70
  let arr = getByPath(pathPrefix.value);
64
71
  if (!Array.isArray(arr)) {
@@ -83,6 +90,7 @@ function useAsArray(field, disabled) {
83
90
  handleChange("array-remove", pathPrefix.value, arrayValue.value);
84
91
  }
85
92
  function clear() {
93
+ if (disabled.value) return;
86
94
  if (isOptional) setByPath(pathPrefix.value, void 0);
87
95
  else {
88
96
  const arr = getByPath(pathPrefix.value);
@@ -134,7 +142,8 @@ const _hoisted_4 = {
134
142
  class: "as-dropdown-menu"
135
143
  };
136
144
  const _hoisted_5 = ["onClick"];
137
- const _hoisted_6 = {
145
+ const _hoisted_6 = ["disabled"];
146
+ const _hoisted_7 = {
138
147
  key: 0,
139
148
  class: "as-collapsible-description"
140
149
  };
@@ -345,8 +354,8 @@ var as_array_default = /* @__PURE__ */ defineComponent({
345
354
  const unionCtx = useAsUnionVariant();
346
355
  const hasVariantPicker = computed(() => unionCtx !== void 0 && unionCtx.variants.length > 1);
347
356
  const optionalEnabled = computed(() => Array.isArray(props.model?.value));
348
- const disabled = computed(() => props.disabled ?? false);
349
- const { arrayValue, itemKeys, isUnion, unionVariants, isOptional, isEmpty, getItemField, addItem, removeItem, clear, canAdd, canRemove } = useAsArray(arrayField, disabled);
357
+ const locked = computed(() => !!props.disabled || !!props.readonly);
358
+ const { arrayValue, itemKeys, isUnion, unionVariants, isOptional, isEmpty, getItemField, addItem, removeItem, clear, canAdd, canRemove } = useAsArray(arrayField, locked);
350
359
  const level = computed(() => props.level ?? 0);
351
360
  const { t } = useAsTexts();
352
361
  const modelT = useAsModelTexts();
@@ -392,14 +401,14 @@ var as_array_default = /* @__PURE__ */ defineComponent({
392
401
  "title-extras": withCtx(() => [hasVariantPicker.value ? (openBlock(), createBlock(as_variant_picker_default, {
393
402
  key: 0,
394
403
  "union-context": unref(unionCtx),
395
- disabled: disabled.value
404
+ disabled: locked.value
396
405
  }, null, 8, ["union-context", "disabled"])) : createCommentVNode("v-if", true)]),
397
406
  badges: withCtx(() => [createVNode(as_items_chip_default, { count: unref(arrayValue).length }, null, 8, ["count"])]),
398
- actions: withCtx(() => [createCommentVNode(" Hide Clear only when required+empty: optional arrays keep it\n so the user can collapse back to undefined. "), unref(isOptional) || !unref(isEmpty) ? (openBlock(), createBlock(as_array_clear_btn_default, {
407
+ actions: withCtx(() => [createCommentVNode(" Hide Clear only when required+empty: optional arrays keep it\n so the user can collapse back to undefined. "), (unref(isOptional) ? !locked.value : !unref(isEmpty)) ? (openBlock(), createBlock(as_array_clear_btn_default, {
399
408
  key: 0,
400
409
  label: __props.title,
401
410
  optional: unref(isOptional),
402
- disabled: disabled.value,
411
+ disabled: locked.value,
403
412
  onClear: unref(clear)
404
413
  }, null, 8, [
405
414
  "label",
@@ -447,11 +456,12 @@ var as_array_default = /* @__PURE__ */ defineComponent({
447
456
  empty: withCtx(() => [withDirectives(createElementVNode("div", { class: normalizeClass(["as-object-empty as-grid-item", _ctx.$props.class]) }, [createElementVNode("button", {
448
457
  type: "button",
449
458
  class: "as-object-empty-add",
459
+ disabled: locked.value,
450
460
  onClick: handleEnableOptional
451
461
  }, [_cache[2] || (_cache[2] = createElementVNode("span", {
452
462
  class: "i-as-field-fill as-object-empty-add-icon",
453
463
  "aria-hidden": "true"
454
- }, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("UI_FORM_ADD", { item: __props.title })), 1)]), __props.description ? (openBlock(), createElementBlock("p", _hoisted_6, toDisplayString(__props.description), 1)) : createCommentVNode("v-if", true)], 2), [[vShow, !__props.hidden]])]),
464
+ }, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("UI_FORM_ADD", { item: __props.title })), 1)], 8, _hoisted_6), __props.description ? (openBlock(), createElementBlock("p", _hoisted_7, toDisplayString(__props.description), 1)) : createCommentVNode("v-if", true)], 2), [[vShow, !__props.hidden]])]),
455
465
  _: 1
456
466
  }, 8, [
457
467
  "class",
package/dist/as-array.cjs CHANGED
@@ -1,2 +1,2 @@
1
- const require_as_array = require("./as-array-BZ_nxqTz.cjs");
1
+ const require_as_array = require("./as-array-CWuMR-2P.cjs");
2
2
  module.exports = require_as_array.as_array_default;
package/dist/as-array.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as as_array_default } from "./as-array-ChUcZDS7.mjs";
1
+ import { t as as_array_default } from "./as-array-dttDB3Rg.mjs";
2
2
  export { as_array_default as default };
@@ -1,6 +1,6 @@
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-DfPH23qM.mjs";
3
- import { n as as_optional_clear_default } from "./as-variant-picker-3P9wXCUf.mjs";
2
+ import { t as as_field_shell_default } from "./as-field-shell-DQ30etIq.mjs";
3
+ import { n as as_optional_clear_default } from "./as-variant-picker-VixxxnXA.mjs";
4
4
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, mergeProps, normalizeClass, openBlock, ref, toDisplayString, unref, watchEffect, withCtx } from "vue";
5
5
  import { optKey, optLabel } from "@atscript/ui";
6
6
  //#region src/composables/use-as-tri-state-checkbox.ts
@@ -302,7 +302,7 @@ var as_checkbox_default = /* @__PURE__ */ defineComponent({
302
302
  "aria-describedby": __props.ariaDescribedBy
303
303
  }, null, 40, _hoisted_5), createTextVNode(" " + toDisplayString(__props.label), 1)], 10, _hoisted_4)),
304
304
  createCommentVNode(" Treat both undefined and null as 'unset' — DB-roundtripped null otherwise renders as \"set\". "),
305
- __props.optional && !__props.readonly && __props.model.value != null ? (openBlock(), createBlock(as_optional_clear_default, {
305
+ __props.optional && !__props.readonly && !__props.disabled && __props.model.value != null ? (openBlock(), createBlock(as_optional_clear_default, {
306
306
  key: 2,
307
307
  onClear: _cache[2] || (_cache[2] = ($event) => __props.onToggleOptional?.(false))
308
308
  })) : createCommentVNode("v-if", true)
@@ -1,6 +1,6 @@
1
1
  const require_use_as_locale = require("./use-as-locale-eo7FyfaZ.cjs");
2
- const require_as_field_shell = require("./as-field-shell-DoVSv3X2.cjs");
3
- const require_as_variant_picker = require("./as-variant-picker-BYrf1YUe.cjs");
2
+ const require_as_field_shell = require("./as-field-shell-ha1iaJnK.cjs");
3
+ const require_as_variant_picker = require("./as-variant-picker-13N8TxuF.cjs");
4
4
  let vue = require("vue");
5
5
  let _atscript_ui = require("@atscript/ui");
6
6
  //#region src/composables/use-as-tri-state-checkbox.ts
@@ -302,7 +302,7 @@ var as_checkbox_default = /* @__PURE__ */ (0, vue.defineComponent)({
302
302
  "aria-describedby": __props.ariaDescribedBy
303
303
  }, null, 40, _hoisted_5), (0, vue.createTextVNode)(" " + (0, vue.toDisplayString)(__props.label), 1)], 10, _hoisted_4)),
304
304
  (0, vue.createCommentVNode)(" Treat both undefined and null as 'unset' — DB-roundtripped null otherwise renders as \"set\". "),
305
- __props.optional && !__props.readonly && __props.model.value != null ? ((0, vue.openBlock)(), (0, vue.createBlock)(require_as_variant_picker.as_optional_clear_default, {
305
+ __props.optional && !__props.readonly && !__props.disabled && __props.model.value != null ? ((0, vue.openBlock)(), (0, vue.createBlock)(require_as_variant_picker.as_optional_clear_default, {
306
306
  key: 2,
307
307
  onClear: _cache[2] || (_cache[2] = ($event) => __props.onToggleOptional?.(false))
308
308
  })) : (0, vue.createCommentVNode)("v-if", true)
@@ -1,2 +1,2 @@
1
- const require_as_checkbox = require("./as-checkbox-DHe7ow33.cjs");
1
+ const require_as_checkbox = require("./as-checkbox-DyA1ncSp.cjs");
2
2
  module.exports = require_as_checkbox.as_checkbox_default;
@@ -1,2 +1,2 @@
1
- import { t as as_checkbox_default } from "./as-checkbox-Dcl1hwmW.mjs";
1
+ import { t as as_checkbox_default } from "./as-checkbox-BS0fjlQC.mjs";
2
2
  export { as_checkbox_default as default };
@@ -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-7CK50mTi.cjs");
2
+ const require_use_form_context = require("./use-form-context-d0IcFey0.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-ba0N--m6.mjs";
2
+ import { t as formatIndexedLabelParts } from "./use-form-context-p2PucQHk.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-DBVrSPb1.cjs");
1
+ const require_as_collapsible = require("./as-collapsible-B0im1dAa.cjs");
2
2
  module.exports = require_as_collapsible.as_collapsible_default;
@@ -1,2 +1,2 @@
1
- import { t as as_collapsible_default } from "./as-collapsible-Cq4JQZo8.mjs";
1
+ import { t as as_collapsible_default } from "./as-collapsible-B4Vb0XIR.mjs";
2
2
  export { as_collapsible_default as default };
@@ -1,5 +1,5 @@
1
1
  import { n as committedValue } from "./_shape-DhwW2SvD.mjs";
2
- import { t as as_field_shell_default } from "./as-field-shell-DfPH23qM.mjs";
2
+ import { t as as_field_shell_default } from "./as-field-shell-DQ30etIq.mjs";
3
3
  import { t as as_adornment_shell_default } from "./as-adornment-shell-CBaksXGT.mjs";
4
4
  import { n as as_date_control_default, t as useAsDate } from "./use-as-date-CpXG9klN.mjs";
5
5
  import { computed, createBlock, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, unref, withCtx } from "vue";
@@ -1,5 +1,5 @@
1
1
  const require__shape = require("./_shape-BDO-1MzF.cjs");
2
- const require_as_field_shell = require("./as-field-shell-DoVSv3X2.cjs");
2
+ const require_as_field_shell = require("./as-field-shell-ha1iaJnK.cjs");
3
3
  const require_as_adornment_shell = require("./as-adornment-shell-CmS9BOFm.cjs");
4
4
  const require_use_as_date = require("./use-as-date-CAmqx1O7.cjs");
5
5
  let vue = require("vue");
package/dist/as-date.cjs CHANGED
@@ -1,2 +1,2 @@
1
- const require_as_date = require("./as-date-CzpK7FFU.cjs");
1
+ const require_as_date = require("./as-date-bI28vJja.cjs");
2
2
  module.exports = require_as_date.as_date_default;
package/dist/as-date.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as as_date_default } from "./as-date-DJC3ll7B.mjs";
1
+ import { t as as_date_default } from "./as-date-Wk0mReg2.mjs";
2
2
  export { as_date_default as default };
@@ -1,5 +1,5 @@
1
1
  const require__shape = require("./_shape-BDO-1MzF.cjs");
2
- const require_as_field_shell = require("./as-field-shell-DoVSv3X2.cjs");
2
+ const require_as_field_shell = require("./as-field-shell-ha1iaJnK.cjs");
3
3
  const require_as_adornment_shell = require("./as-adornment-shell-CmS9BOFm.cjs");
4
4
  const require_use_as_date = require("./use-as-date-CAmqx1O7.cjs");
5
5
  let vue = require("vue");
@@ -1,5 +1,5 @@
1
1
  import { n as committedValue } from "./_shape-DhwW2SvD.mjs";
2
- import { t as as_field_shell_default } from "./as-field-shell-DfPH23qM.mjs";
2
+ import { t as as_field_shell_default } from "./as-field-shell-DQ30etIq.mjs";
3
3
  import { t as as_adornment_shell_default } from "./as-adornment-shell-CBaksXGT.mjs";
4
4
  import { n as as_date_control_default, t as useAsDate } from "./use-as-date-CpXG9klN.mjs";
5
5
  import { computed, createBlock, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, unref, withCtx } from "vue";
@@ -1,2 +1,2 @@
1
- const require_as_datetime = require("./as-datetime-CU2pYPsb.cjs");
1
+ const require_as_datetime = require("./as-datetime-Ca-23Nrq.cjs");
2
2
  module.exports = require_as_datetime.as_datetime_default;
@@ -1,2 +1,2 @@
1
- import { t as as_datetime_default } from "./as-datetime-Bk__Ct69.mjs";
1
+ import { t as as_datetime_default } from "./as-datetime-F2PdaCh1.mjs";
2
2
  export { as_datetime_default as default };
@@ -1,6 +1,6 @@
1
1
  import { a as useAsLocale, o as useAsTexts } from "./use-as-locale-CznDr-7i.mjs";
2
2
  import { i as preserveShape, n as committedValue } from "./_shape-DhwW2SvD.mjs";
3
- import { t as as_field_shell_default } from "./as-field-shell-DfPH23qM.mjs";
3
+ import { t as as_field_shell_default } from "./as-field-shell-DQ30etIq.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
@@ -1,6 +1,6 @@
1
1
  const require_use_as_locale = require("./use-as-locale-eo7FyfaZ.cjs");
2
2
  const require__shape = require("./_shape-BDO-1MzF.cjs");
3
- const require_as_field_shell = require("./as-field-shell-DoVSv3X2.cjs");
3
+ const require_as_field_shell = require("./as-field-shell-ha1iaJnK.cjs");
4
4
  let vue = require("vue");
5
5
  let _atscript_ui = require("@atscript/ui");
6
6
  //#region src/composables/use-as-decimal.ts
@@ -1,2 +1,2 @@
1
- const require_as_decimal = require("./as-decimal-B6MeEFmb.cjs");
1
+ const require_as_decimal = require("./as-decimal-CYIBnc-k.cjs");
2
2
  module.exports = require_as_decimal.as_decimal_default;
@@ -1,2 +1,2 @@
1
- import { t as as_decimal_default } from "./as-decimal-BAiy9Cjz.mjs";
1
+ import { t as as_decimal_default } from "./as-decimal-4zD1qPmT.mjs";
2
2
  export { as_decimal_default as default };
@@ -1,7 +1,7 @@
1
- const require_use_form_context = require("./use-form-context-7CK50mTi.cjs");
2
- const require_use_as_value_help = require("./use-as-value-help-XPeNhfJY.cjs");
1
+ const require_use_form_context = require("./use-form-context-d0IcFey0.cjs");
2
+ const require_use_as_value_help = require("./use-as-value-help-LDhcfxFi.cjs");
3
3
  const require_use_as_locale = require("./use-as-locale-eo7FyfaZ.cjs");
4
- const require_use_as_model_texts = require("./use-as-model-texts-DtqNcugR.cjs");
4
+ const require_use_as_model_texts = require("./use-as-model-texts-BNO2SFQF.cjs");
5
5
  const require__shape = require("./_shape-BDO-1MzF.cjs");
6
6
  let vue = require("vue");
7
7
  let _atscript_ui = require("@atscript/ui");
@@ -289,6 +289,11 @@ var as_field_default = /* @__PURE__ */ (0, vue.defineComponent)({
289
289
  function maybeComputed(isDynamic, dynamicFn, staticVal) {
290
290
  return isDynamic ? (0, vue.computed)(dynamicFn) : staticVal;
291
291
  }
292
+ function orFlag(own, inherited) {
293
+ if (own === true || !inherited) return own;
294
+ if (own === false || inherited === true) return inherited;
295
+ return (0, vue.computed)(() => own.value || inherited.value);
296
+ }
292
297
  function buildFieldClasses(classValue, isDisabled, isRequired, isOptional) {
293
298
  return {
294
299
  ...typeof classValue === "string" ? { [classValue]: true } : Array.isArray(classValue) ? Object.fromEntries(classValue.filter((c) => typeof c === "string").map((c) => [c, true])) : classValue,
@@ -424,7 +429,7 @@ var as_field_default = /* @__PURE__ */ (0, vue.defineComponent)({
424
429
  let styles;
425
430
  let options;
426
431
  let attrs;
427
- let classesBase;
432
+ let fnClasses;
428
433
  let phantomValue;
429
434
  let hasCustomValidators;
430
435
  let fallbackPlaceholder;
@@ -452,7 +457,6 @@ var as_field_default = /* @__PURE__ */ (0, vue.defineComponent)({
452
457
  options = staticOptions();
453
458
  attrs = (0, _atscript_ui.getFieldMeta)(prop, _atscript_ui.UI_FORM_ATTR) !== void 0 ? (0, _atscript_ui.resolveAttrs)(prop, emptyScope) : void 0;
454
459
  title = (0, _atscript_ui.getFieldMeta)(prop, _atscript_ui.META_LABEL);
455
- classesBase = buildFieldClasses((0, _atscript_ui.getFieldMeta)(prop, _atscript_ui.UI_FORM_CLASSES), disabled, hasMetaRequired, optional);
456
460
  phantomValue = props.field.phantom ? (0, _atscript_ui.getFieldMeta)(prop, _atscript_ui.META_DEFAULT) : void 0;
457
461
  } else {
458
462
  const hasFn = /* @__PURE__ */ new Set();
@@ -490,8 +494,7 @@ var as_field_default = /* @__PURE__ */ (0, vue.defineComponent)({
490
494
  options = hasFn.has("options") ? (0, vue.computed)(() => optionsOf(fs.value)) : staticOptions();
491
495
  attrs = hasFn.has("attr") ? (0, vue.computed)(() => (0, _atscript_ui.resolveAttrs)(prop, fs.value)) : (0, _atscript_ui.getFieldMeta)(prop, _atscript_ui.UI_FORM_ATTR) !== void 0 ? (0, _atscript_ui.resolveAttrs)(prop, emptyScope) : void 0;
492
496
  title = isStructured || isUnion ? maybeComputed(hasFn.has("title"), () => resolveHeaderProp(_atscript_ui.UI_FORM_FN_TITLE, _atscript_ui.META_LABEL) ?? props.field.name, (0, _atscript_ui.getFieldMeta)(prop, _atscript_ui.META_LABEL)) : void 0;
493
- const hasFnClasses = hasFn.has("classes");
494
- classesBase = hasFnClasses || typeof disabled !== "boolean" ? (0, vue.computed)(() => buildFieldClasses(hasFnClasses ? (0, _atscript_ui.resolveFieldProp)(prop, _atscript_ui.UI_FORM_FN_CLASSES, void 0, fs.value) : (0, _atscript_ui.getFieldMeta)(prop, _atscript_ui.UI_FORM_CLASSES), unwrap(disabled), hasMetaRequired, optional)) : buildFieldClasses((0, _atscript_ui.getFieldMeta)(prop, _atscript_ui.UI_FORM_CLASSES), disabled, hasMetaRequired, optional);
497
+ if (hasFn.has("classes")) fnClasses = () => (0, _atscript_ui.resolveFieldProp)(prop, _atscript_ui.UI_FORM_FN_CLASSES, void 0, fs.value);
495
498
  phantomValue = props.field.phantom ? maybeComputed(hasFn.has("value"), () => (0, _atscript_ui.resolveFieldProp)(prop, _atscript_ui.UI_FORM_FN_VALUE, _atscript_ui.META_DEFAULT, fs.value), (0, _atscript_ui.getFieldMeta)(prop, _atscript_ui.META_DEFAULT)) : void 0;
496
499
  if (hasFn.has("value") && !props.field.phantom) (0, vue.watch)((0, vue.computed)(() => {
497
500
  if (unwrap(readonly)) return (0, _atscript_ui.resolveFieldProp)(prop, _atscript_ui.UI_FORM_FN_VALUE, _atscript_ui.META_DEFAULT, fs.value);
@@ -499,6 +502,16 @@ var as_field_default = /* @__PURE__ */ (0, vue.defineComponent)({
499
502
  if (newVal !== void 0) setByPath(absolutePath.value, newVal);
500
503
  }, { immediate: true });
501
504
  }
505
+ const parentLock = (0, vue.inject)(require_use_form_context.LOCK_KEY, void 0);
506
+ const shownDisabled = orFlag(disabled, parentLock?.disabled);
507
+ const shownReadonly = orFlag(readonly, parentLock?.readonly);
508
+ if (isStructured || isUnion) (0, vue.provide)(require_use_form_context.LOCK_KEY, {
509
+ disabled: shownDisabled,
510
+ readonly: shownReadonly
511
+ });
512
+ const staticClasses = (0, _atscript_ui.getFieldMeta)(prop, _atscript_ui.UI_FORM_CLASSES);
513
+ const classesOf = (isDisabled) => buildFieldClasses(fnClasses ? fnClasses() : staticClasses, isDisabled, hasMetaRequired, optional);
514
+ const classesBase = fnClasses || typeof shownDisabled !== "boolean" ? (0, vue.computed)(() => classesOf(unwrap(shownDisabled))) : classesOf(shownDisabled);
502
515
  function formRule(v) {
503
516
  return formValidate(v, {
504
517
  get data() {
@@ -590,9 +603,9 @@ var as_field_default = /* @__PURE__ */ (0, vue.defineComponent)({
590
603
  optional: unwrap(optional),
591
604
  onToggleOptional: unwrap(optional) ? toggleOptional : void 0,
592
605
  required: required !== void 0 ? unwrap(required) : void 0,
593
- disabled: unwrap(disabled),
606
+ disabled: unwrap(shownDisabled),
594
607
  hidden: unwrap(hidden),
595
- readonly: unwrap(readonly),
608
+ readonly: unwrap(shownReadonly),
596
609
  options: unwrap(options),
597
610
  title: titleValue,
598
611
  onRemove: props.onRemove,
@@ -1,7 +1,7 @@
1
- import { _ as PATH_PREFIX_KEY, a as CHANGE_HANDLER_KEY, c as ERRORS_KEY, d as FORM_NORMALIZED_DATA_KEY, f as FORM_PATCH_KEY, h as LEVEL_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, r as useFormContext, s as DISMISS_EXTERNAL_AT_KEY, u as FORM_DATA_KEY, y as TYPES_KEY } from "./use-form-context-ba0N--m6.mjs";
2
- import { n as useAsValueHelp, r as useAsData } from "./use-as-value-help-D16evDGm.mjs";
1
+ import { 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, h as LEVEL_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, r as useFormContext, s as DISMISS_EXTERNAL_AT_KEY, u as FORM_DATA_KEY, v as PATH_PREFIX_KEY } from "./use-form-context-p2PucQHk.mjs";
2
+ import { n as useAsValueHelp, r as useAsData } from "./use-as-value-help-LQWMkS5m.mjs";
3
3
  import { a as useAsLocale, o as useAsTexts } from "./use-as-locale-CznDr-7i.mjs";
4
- import { t as useAsModelTexts } from "./use-as-model-texts-Duq04LpS.mjs";
4
+ import { t as useAsModelTexts } from "./use-as-model-texts-BTFyHNqS.mjs";
5
5
  import { a as soleRow } from "./_shape-DhwW2SvD.mjs";
6
6
  import { computed, createBlock, createElementBlock, defineComponent, inject, isRef, mergeProps, onUnmounted, openBlock, provide, ref, resolveDynamicComponent, toDisplayString, unref, useId, watch } from "vue";
7
7
  import { DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_UNIT, DB_UNIT_REF, EXPECT_MAX_LENGTH, META_DEFAULT, META_DESCRIPTION, META_LABEL, META_READONLY, META_REQUIRED, UI_FORM_ACTION, UI_FORM_ATTR, UI_FORM_AUTOCOMPLETE, UI_FORM_CLASSES, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_CLASSES, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_DISABLED, UI_FORM_FN_HINT, UI_FORM_FN_LABEL, UI_FORM_FN_PLACEHOLDER, UI_FORM_FN_PREFIX, UI_FORM_FN_READONLY, UI_FORM_FN_STYLES, UI_FORM_FN_TITLE, UI_FORM_FN_VALUE, UI_FORM_GRID_COL_SPAN, UI_FORM_GRID_ROW_SPAN, UI_FORM_HIDDEN, UI_FORM_HINT, UI_FORM_LABEL_SINGULAR, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_STYLES, UI_FORM_SUFFIX, UI_FORM_SUFFIX_ICON, UI_FORM_SUFFIX_REF, UI_FORM_VALIDATE, VALUE_HELP_OPTIONS_CAP, WF_ACTION_WITH_DATA, arrangeText, buildGridClasses, createFieldValidator, fieldText, getCurrencyDecimals, getCurrencyDisplayParts, getFieldMeta, hasFieldMeta, isArrayField, isFieldHidden, isObjectField, isTupleField, isUnionField, resolveAttrs, resolveFieldProp, resolveFormProp, resolveGridSpec, resolveOptions, resolveSingularLabel, userText, valueHelpOptions, valueLabelOf } from "@atscript/ui";
@@ -289,6 +289,11 @@ var as_field_default = /* @__PURE__ */ defineComponent({
289
289
  function maybeComputed(isDynamic, dynamicFn, staticVal) {
290
290
  return isDynamic ? computed(dynamicFn) : staticVal;
291
291
  }
292
+ function orFlag(own, inherited) {
293
+ if (own === true || !inherited) return own;
294
+ if (own === false || inherited === true) return inherited;
295
+ return computed(() => own.value || inherited.value);
296
+ }
292
297
  function buildFieldClasses(classValue, isDisabled, isRequired, isOptional) {
293
298
  return {
294
299
  ...typeof classValue === "string" ? { [classValue]: true } : Array.isArray(classValue) ? Object.fromEntries(classValue.filter((c) => typeof c === "string").map((c) => [c, true])) : classValue,
@@ -424,7 +429,7 @@ var as_field_default = /* @__PURE__ */ defineComponent({
424
429
  let styles;
425
430
  let options;
426
431
  let attrs;
427
- let classesBase;
432
+ let fnClasses;
428
433
  let phantomValue;
429
434
  let hasCustomValidators;
430
435
  let fallbackPlaceholder;
@@ -452,7 +457,6 @@ var as_field_default = /* @__PURE__ */ defineComponent({
452
457
  options = staticOptions();
453
458
  attrs = getFieldMeta(prop, UI_FORM_ATTR) !== void 0 ? resolveAttrs(prop, emptyScope) : void 0;
454
459
  title = getFieldMeta(prop, META_LABEL);
455
- classesBase = buildFieldClasses(getFieldMeta(prop, UI_FORM_CLASSES), disabled, hasMetaRequired, optional);
456
460
  phantomValue = props.field.phantom ? getFieldMeta(prop, META_DEFAULT) : void 0;
457
461
  } else {
458
462
  const hasFn = /* @__PURE__ */ new Set();
@@ -490,8 +494,7 @@ var as_field_default = /* @__PURE__ */ defineComponent({
490
494
  options = hasFn.has("options") ? computed(() => optionsOf(fs.value)) : staticOptions();
491
495
  attrs = hasFn.has("attr") ? computed(() => resolveAttrs(prop, fs.value)) : getFieldMeta(prop, UI_FORM_ATTR) !== void 0 ? resolveAttrs(prop, emptyScope) : void 0;
492
496
  title = isStructured || isUnion ? maybeComputed(hasFn.has("title"), () => resolveHeaderProp(UI_FORM_FN_TITLE, META_LABEL) ?? props.field.name, getFieldMeta(prop, META_LABEL)) : void 0;
493
- const hasFnClasses = hasFn.has("classes");
494
- classesBase = hasFnClasses || typeof disabled !== "boolean" ? computed(() => buildFieldClasses(hasFnClasses ? resolveFieldProp(prop, UI_FORM_FN_CLASSES, void 0, fs.value) : getFieldMeta(prop, UI_FORM_CLASSES), unwrap(disabled), hasMetaRequired, optional)) : buildFieldClasses(getFieldMeta(prop, UI_FORM_CLASSES), disabled, hasMetaRequired, optional);
497
+ if (hasFn.has("classes")) fnClasses = () => resolveFieldProp(prop, UI_FORM_FN_CLASSES, void 0, fs.value);
495
498
  phantomValue = props.field.phantom ? maybeComputed(hasFn.has("value"), () => resolveFieldProp(prop, UI_FORM_FN_VALUE, META_DEFAULT, fs.value), getFieldMeta(prop, META_DEFAULT)) : void 0;
496
499
  if (hasFn.has("value") && !props.field.phantom) watch(computed(() => {
497
500
  if (unwrap(readonly)) return resolveFieldProp(prop, UI_FORM_FN_VALUE, META_DEFAULT, fs.value);
@@ -499,6 +502,16 @@ var as_field_default = /* @__PURE__ */ defineComponent({
499
502
  if (newVal !== void 0) setByPath(absolutePath.value, newVal);
500
503
  }, { immediate: true });
501
504
  }
505
+ const parentLock = inject(LOCK_KEY, void 0);
506
+ const shownDisabled = orFlag(disabled, parentLock?.disabled);
507
+ const shownReadonly = orFlag(readonly, parentLock?.readonly);
508
+ if (isStructured || isUnion) provide(LOCK_KEY, {
509
+ disabled: shownDisabled,
510
+ readonly: shownReadonly
511
+ });
512
+ const staticClasses = getFieldMeta(prop, UI_FORM_CLASSES);
513
+ const classesOf = (isDisabled) => buildFieldClasses(fnClasses ? fnClasses() : staticClasses, isDisabled, hasMetaRequired, optional);
514
+ const classesBase = fnClasses || typeof shownDisabled !== "boolean" ? computed(() => classesOf(unwrap(shownDisabled))) : classesOf(shownDisabled);
502
515
  function formRule(v) {
503
516
  return formValidate(v, {
504
517
  get data() {
@@ -590,9 +603,9 @@ var as_field_default = /* @__PURE__ */ defineComponent({
590
603
  optional: unwrap(optional),
591
604
  onToggleOptional: unwrap(optional) ? toggleOptional : void 0,
592
605
  required: required !== void 0 ? unwrap(required) : void 0,
593
- disabled: unwrap(disabled),
606
+ disabled: unwrap(shownDisabled),
594
607
  hidden: unwrap(hidden),
595
- readonly: unwrap(readonly),
608
+ readonly: unwrap(shownReadonly),
596
609
  options: unwrap(options),
597
610
  title: titleValue,
598
611
  onRemove: props.onRemove,