@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.
- package/dist/as-action.d.cts +1 -1
- package/dist/as-action.d.mts +1 -1
- package/dist/{as-action.vue-BjGc3z94.d.mts → as-action.vue-D0twy1JK.d.cts} +1 -1
- package/dist/{as-action.vue-wGCmd-ww.d.cts → as-action.vue-Dse77iCr.d.mts} +1 -1
- package/dist/{as-array-CHVronOS.mjs → as-array-CEtgj6nd.mjs} +8 -9
- package/dist/{as-array-BCmGCZul.cjs → as-array-CKedVJIz.cjs} +8 -9
- package/dist/{as-array-clear-btn-DOBKhLCy.mjs → as-array-clear-btn-BFfll2RA.mjs} +1 -1
- package/dist/{as-array-clear-btn-BolX7Wpe.cjs → as-array-clear-btn-nYR8rEeL.cjs} +1 -1
- package/dist/as-array.cjs +1 -1
- package/dist/as-array.d.cts +1 -1
- package/dist/as-array.d.mts +1 -1
- package/dist/as-array.mjs +1 -1
- package/dist/{as-array.vue-BB22gE0u.d.cts → as-array.vue-BCB8mLx-.d.mts} +1 -1
- package/dist/{as-array.vue-CgYp_DSb.d.mts → as-array.vue-DJNzEE8-.d.cts} +1 -1
- package/dist/{as-checkbox-BX5N5GHR.mjs → as-checkbox-B7C-CvhT.mjs} +4 -2
- package/dist/{as-checkbox-BKWtScvS.cjs → as-checkbox-DKaEfo7e.cjs} +4 -2
- package/dist/as-checkbox.cjs +1 -1
- package/dist/as-checkbox.d.cts +1 -1
- package/dist/as-checkbox.d.mts +1 -1
- package/dist/as-checkbox.mjs +1 -1
- package/dist/{as-checkbox.vue-CQzeu4IP.d.mts → as-checkbox.vue-CoCgt4vV.d.mts} +1 -1
- package/dist/{as-checkbox.vue-RTW5hwvE.d.cts → as-checkbox.vue-fPeyQDp5.d.cts} +1 -1
- package/dist/{as-collapsible-C37-3_Rp.cjs → as-collapsible-Bs0LOl1t.cjs} +1 -1
- package/dist/{as-collapsible-B9KPgJyo.mjs → as-collapsible-DOIWkQ0v.mjs} +1 -1
- package/dist/as-collapsible.cjs +1 -1
- package/dist/as-collapsible.d.cts +1 -1
- package/dist/as-collapsible.d.mts +1 -1
- package/dist/as-collapsible.mjs +1 -1
- package/dist/{as-collapsible.vue-BKN4DmSy.d.mts → as-collapsible.vue-CH3ez8zm.d.cts} +1 -1
- package/dist/{as-collapsible.vue-CPmozkkf.d.cts → as-collapsible.vue-DewV2oaE.d.mts} +1 -1
- package/dist/{as-date-C6tT9FPz.cjs → as-date-BMKMiM_d.cjs} +2 -2
- package/dist/{as-date-Bkrp2GY4.mjs → as-date-CFQtrpZT.mjs} +2 -2
- package/dist/as-date.cjs +1 -1
- package/dist/as-date.d.cts +1 -1
- package/dist/as-date.d.mts +1 -1
- package/dist/as-date.mjs +1 -1
- package/dist/{as-date.vue-BpfWumrA.d.cts → as-date.vue-BSghCVx0.d.cts} +1 -1
- package/dist/{as-date.vue-DJ125nVS.d.mts → as-date.vue-CPgqqKMB.d.mts} +1 -1
- package/dist/{as-datetime-DWLW4W7O.cjs → as-datetime-Bl1K4U51.cjs} +2 -2
- package/dist/{as-datetime-Dt_AWrCG.mjs → as-datetime-DqfSymmL.mjs} +2 -2
- package/dist/as-datetime.cjs +1 -1
- package/dist/as-datetime.d.cts +1 -1
- package/dist/as-datetime.d.mts +1 -1
- package/dist/as-datetime.mjs +1 -1
- package/dist/{as-datetime.vue-DO3tkof1.d.cts → as-datetime.vue-B-KRC-0X.d.mts} +1 -1
- package/dist/{as-datetime.vue-DfFAaVdS.d.mts → as-datetime.vue-CjDTsMDw.d.cts} +1 -1
- package/dist/{as-decimal-DuWZDjbg.cjs → as-decimal-48M_h9Sl.cjs} +18 -24
- package/dist/{as-decimal-BUr24VTI.mjs → as-decimal-CsAJlvie.mjs} +18 -24
- package/dist/as-decimal.cjs +1 -1
- package/dist/as-decimal.d.cts +1 -1
- package/dist/as-decimal.d.mts +1 -1
- package/dist/as-decimal.mjs +1 -1
- package/dist/{as-decimal.vue-BODauGXK.d.mts → as-decimal.vue-BZ2imea4.d.mts} +1 -1
- package/dist/{as-decimal.vue-C42_-oK9.d.cts → as-decimal.vue-BvvG5aIL.d.cts} +1 -1
- package/dist/{as-field-iQ2H3VGd.mjs → as-field-C6iquEB1.mjs} +99 -137
- package/dist/{as-field-lMMfms8d.cjs → as-field-CJMJJfXO.cjs} +98 -136
- package/dist/{as-field-shell-BPesuJKa.cjs → as-field-shell-CMq52Z6e.cjs} +2 -2
- package/dist/{as-field-shell-QMsYyJ8r.mjs → as-field-shell-DXbAJupk.mjs} +2 -2
- package/dist/as-field-shell.cjs +1 -1
- package/dist/as-field-shell.d.cts +1 -1
- package/dist/as-field-shell.d.mts +1 -1
- package/dist/as-field-shell.mjs +1 -1
- package/dist/{as-field-shell.vue-CQqwykWy.d.cts → as-field-shell.vue-BbSIqZSY.d.cts} +1 -1
- package/dist/{as-field-shell.vue-o7T2u4aw.d.mts → as-field-shell.vue-D0NYcajH.d.mts} +1 -1
- package/dist/as-field.cjs +1 -1
- package/dist/as-field.mjs +1 -1
- package/dist/{as-form-DE3TVGV-.cjs → as-form-B4-StU3b.cjs} +19 -38
- package/dist/{as-form-CuMRP5aZ.mjs → as-form-DQePBFwR.mjs} +20 -39
- package/dist/as-form.cjs +1 -1
- package/dist/as-form.d.cts +1 -1
- package/dist/as-form.d.mts +1 -1
- package/dist/as-form.mjs +1 -1
- package/dist/{as-form.vue-DwqofFJa.d.mts → as-form.vue-BMNZuvpb.d.mts} +54 -20
- package/dist/{as-form.vue-B9MZrw7V.d.cts → as-form.vue-DS5r3CWl.d.cts} +54 -20
- package/dist/{as-input-BEP6nX82.mjs → as-input-D1IO72Tn.mjs} +1 -1
- package/dist/{as-input-BrgRxZag.cjs → as-input-Dy7v1AjV.cjs} +1 -1
- package/dist/as-input.cjs +1 -1
- package/dist/as-input.d.cts +1 -1
- package/dist/as-input.d.mts +1 -1
- package/dist/as-input.mjs +1 -1
- package/dist/{as-input.vue-Cl8DTJqr.d.cts → as-input.vue-DMxFk9uv.d.cts} +1 -1
- package/dist/{as-input.vue-CqV91VOb.d.mts → as-input.vue-DzG-WB4x.d.mts} +1 -1
- package/dist/{as-iterator-DbCm61j1.mjs → as-iterator-A9ozhHhf.mjs} +2 -2
- package/dist/{as-iterator-DeLt7-BO.cjs → as-iterator-C8aJ6SUs.cjs} +2 -2
- package/dist/as-iterator.cjs +1 -1
- package/dist/as-iterator.mjs +1 -1
- package/dist/{as-multi-select-CJ3iRsiL.cjs → as-multi-select-BiOEQf1L.cjs} +4 -8
- package/dist/{as-multi-select-Ca2ULklw.mjs → as-multi-select-CoT5MJd_.mjs} +5 -9
- package/dist/as-multi-select.cjs +1 -1
- package/dist/as-multi-select.d.cts +1 -1
- package/dist/as-multi-select.d.mts +1 -1
- package/dist/as-multi-select.mjs +1 -1
- package/dist/{as-multi-select.vue-B6M_f7u-.d.cts → as-multi-select.vue-CBtBFW6X.d.cts} +1 -1
- package/dist/{as-multi-select.vue-Cvvy1kMm.d.mts → as-multi-select.vue-CGjTCFGD.d.mts} +1 -1
- package/dist/{as-number-CgHRTx6P.mjs → as-number-Ck8nNMCB.mjs} +1 -1
- package/dist/{as-number-CHXaKqtg.cjs → as-number-DKW_PZcq.cjs} +1 -1
- package/dist/as-number.cjs +1 -1
- package/dist/as-number.d.cts +1 -1
- package/dist/as-number.d.mts +1 -1
- package/dist/as-number.mjs +1 -1
- package/dist/{as-number.vue-5U6oFVJC.d.cts → as-number.vue-AKk1tllp.d.mts} +1 -1
- package/dist/{as-number.vue-BN6_1oQf.d.mts → as-number.vue-i5gytLQ2.d.cts} +1 -1
- package/dist/{as-object-BCeBkKCo.mjs → as-object-6GgXdo_K.mjs} +4 -4
- package/dist/{as-object-Babu0BIk.cjs → as-object-DfHzCJcJ.cjs} +4 -4
- package/dist/as-object.cjs +1 -1
- package/dist/as-object.d.cts +1 -1
- package/dist/as-object.d.mts +1 -1
- package/dist/as-object.mjs +1 -1
- package/dist/{as-object.vue-BNCOIwjS.d.mts → as-object.vue-Gor6cnwh.d.mts} +1 -1
- package/dist/{as-object.vue-BnUdIcLW.d.cts → as-object.vue-cwrRrJ2O.d.cts} +1 -1
- package/dist/as-paragraph.d.cts +1 -1
- package/dist/as-paragraph.d.mts +1 -1
- package/dist/{as-paragraph.vue-80Q1bZMd.d.cts → as-paragraph.vue-DqHrI7WD.d.mts} +1 -1
- package/dist/{as-paragraph.vue-Dhy9ke_Z.d.mts → as-paragraph.vue-Ds64gwEP.d.cts} +1 -1
- package/dist/{as-radio-CL6Np-X5.mjs → as-radio-Cc3VOm3A.mjs} +1 -1
- package/dist/{as-radio-BFM_CPvW.cjs → as-radio-DLGMEC9o.cjs} +1 -1
- package/dist/as-radio.cjs +1 -1
- package/dist/as-radio.d.cts +1 -1
- package/dist/as-radio.d.mts +1 -1
- package/dist/as-radio.mjs +1 -1
- package/dist/{as-radio.vue-ByorW-nk.d.cts → as-radio.vue-CkooFq0m.d.cts} +1 -1
- package/dist/{as-radio.vue-CLdvEAmZ.d.mts → as-radio.vue-T0Ejt0II.d.mts} +1 -1
- package/dist/{as-ref-D14yC6np.mjs → as-ref-Cs4i9tpS.mjs} +2 -2
- package/dist/{as-ref-CEj1RBnH.cjs → as-ref-FknTPCae.cjs} +2 -2
- package/dist/as-ref.cjs +1 -1
- package/dist/as-ref.d.cts +1 -1
- package/dist/as-ref.d.mts +1 -1
- package/dist/as-ref.mjs +1 -1
- package/dist/{as-ref.vue--ISeV6VM.d.cts → as-ref.vue-CCzEnDNd.d.cts} +1 -1
- package/dist/{as-ref.vue-DW7vsBE6.d.mts → as-ref.vue-CvStQFs3.d.mts} +1 -1
- package/dist/{as-select-B-ZeOCu5.cjs → as-select-DBxxq0jZ.cjs} +1 -1
- package/dist/{as-select-BME-vti2.mjs → as-select-br9EmsoX.mjs} +1 -1
- package/dist/as-select.cjs +1 -1
- package/dist/as-select.d.cts +1 -1
- package/dist/as-select.d.mts +1 -1
- package/dist/as-select.mjs +1 -1
- package/dist/{as-select.vue-BEfTkycX.d.cts → as-select.vue-CK4AWxmk.d.cts} +1 -1
- package/dist/{as-select.vue-C45NS5Rq.d.mts → as-select.vue-LKjJASjX.d.mts} +1 -1
- package/dist/{as-time-CnuojSkh.cjs → as-time-BmTk1YfU.cjs} +2 -2
- package/dist/{as-time-HRZh7pdx.mjs → as-time-DTz7PrnB.mjs} +2 -2
- package/dist/as-time.cjs +1 -1
- package/dist/as-time.d.cts +1 -1
- package/dist/as-time.d.mts +1 -1
- package/dist/as-time.mjs +1 -1
- package/dist/{as-time.vue--Qmcr-O0.d.cts → as-time.vue-DTRJCO4G.d.cts} +1 -1
- package/dist/{as-time.vue-0M0m0DXe.d.mts → as-time.vue-q2i-2K0N.d.mts} +1 -1
- package/dist/{as-tuple-XpcKK1LK.cjs → as-tuple-BemXpNrJ.cjs} +18 -10
- package/dist/{as-tuple-qHmf6fwJ.mjs → as-tuple-D3IoTMkI.mjs} +19 -11
- package/dist/as-tuple.cjs +1 -1
- package/dist/as-tuple.d.cts +1 -1
- package/dist/as-tuple.d.mts +1 -1
- package/dist/as-tuple.mjs +1 -1
- package/dist/{as-tuple.vue-CKbx_YFz.d.mts → as-tuple.vue-BEY7sq9x.d.cts} +1 -1
- package/dist/{as-tuple.vue-Di5D2HD4.d.cts → as-tuple.vue-CNgBlckL.d.mts} +1 -1
- package/dist/{as-union-Ca5o9xw2.mjs → as-union-CIEUE2Xd.mjs} +26 -5
- package/dist/{as-union-CwB0ACpI.cjs → as-union-DqRkSoIr.cjs} +25 -4
- package/dist/as-union.cjs +1 -1
- package/dist/as-union.d.cts +1 -1
- package/dist/as-union.d.mts +1 -1
- package/dist/as-union.mjs +1 -1
- package/dist/{as-union.vue-UnG0zG81.d.cts → as-union.vue-B3KVCUUI.d.mts} +1 -1
- package/dist/{as-union.vue-eGlHN_hp.d.mts → as-union.vue-CGk27JvO.d.cts} +1 -1
- package/dist/{as-variant-picker-CKSLKefM.mjs → as-variant-picker-O_6JNWLk.mjs} +1 -1
- package/dist/{as-variant-picker-CceIhZUk.cjs → as-variant-picker-apxtW5rZ.cjs} +1 -1
- package/dist/index.cjs +42 -24
- package/dist/index.d.cts +22 -22
- package/dist/index.d.mts +22 -22
- package/dist/index.mjs +26 -26
- package/dist/{types-C5Gx4ZuF.d.mts → types-BXTpoOfM.d.cts} +26 -9
- package/dist/{types-D23g9Vs-.d.cts → types-CXGcf7sO.d.mts} +26 -9
- package/dist/{use-as-date-BWJbi_j2.cjs → use-as-date-CpkJjcyB.cjs} +18 -14
- package/dist/{use-as-date-B2hKWXAl.mjs → use-as-date-FsgcnN9l.mjs} +18 -14
- package/dist/{use-as-model-texts-BXSEzUWJ.mjs → use-as-model-texts-D26kn80o.mjs} +1 -1
- package/dist/{use-as-model-texts-BSFCEwAa.cjs → use-as-model-texts-DR4s80Mb.cjs} +1 -1
- package/dist/{use-as-value-help-ZR_BvS0L.cjs → use-as-value-help-CIvYUvdk.cjs} +12 -7
- package/dist/{use-as-value-help-B5yNO1tE.mjs → use-as-value-help-b4tk3NRF.mjs} +12 -7
- package/dist/{use-form-context-U6vg1uqK.cjs → use-form-context-BPlkQwkM.cjs} +16 -0
- package/dist/{use-form-context-0FtVVTvf.mjs → use-form-context-D_ejQqCc.mjs} +12 -2
- package/package.json +9 -9
package/dist/index.mjs
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { i as useAsFocusFirstAfter, n as focusNewFocusableAfter, t as focusFirstAfter } from "./focus-after-toggle-DAwak7c1.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { a as useAsFormPatch, i as useAsExternalErrors, n as useAsForm, r as useAsState, t as as_form_default } from "./as-form-
|
|
2
|
+
import { b as PATH_PREFIX_KEY, c as DISMISS_EXTERNAL_AT_KEY, n as useAsUnionVariant, t as formatIndexedLabelParts } from "./use-form-context-D_ejQqCc.mjs";
|
|
3
|
+
import { a as useAsFormPatch, i as useAsExternalErrors, n as useAsForm, r as useAsState, t as as_form_default } from "./as-form-DQePBFwR.mjs";
|
|
4
4
|
import { i as useAsNestedSectionsStore, n as provideAsNestedSectionsStore, r as useAsDescendantErrorCounts } from "./use-as-nested-sections-store-CkrMJbnN.mjs";
|
|
5
|
-
import { i as useAsData, n as useAsValueHelp } from "./use-as-value-help-
|
|
5
|
+
import { i as useAsData, n as useAsValueHelp } from "./use-as-value-help-b4tk3NRF.mjs";
|
|
6
6
|
import { a as useAsLocale, i as provideAsServedTexts, r as provideAsLocale, t as getAsServedTexts } from "./use-as-locale-CznDr-7i.mjs";
|
|
7
7
|
import { t as useValueHelpTexts } from "./use-value-help-texts-LySFdZya.mjs";
|
|
8
|
-
import { i as useAsField, n as useAsOptionalField, r as useAsFieldScope, t as as_field_default } from "./as-field-
|
|
9
|
-
import { t as useAsModelTexts } from "./use-as-model-texts-
|
|
10
|
-
import { n as provideAsNestedLevel, r as useAsLevel, t as as_iterator_default } from "./as-iterator-
|
|
11
|
-
import { t as as_collapsible_default } from "./as-collapsible-
|
|
12
|
-
import { t as as_field_shell_default } from "./as-field-shell-
|
|
8
|
+
import { i as useAsField, n as useAsOptionalField, r as useAsFieldScope, t as as_field_default } from "./as-field-C6iquEB1.mjs";
|
|
9
|
+
import { t as useAsModelTexts } from "./use-as-model-texts-D26kn80o.mjs";
|
|
10
|
+
import { n as provideAsNestedLevel, r as useAsLevel, t as as_iterator_default } from "./as-iterator-A9ozhHhf.mjs";
|
|
11
|
+
import { t as as_collapsible_default } from "./as-collapsible-DOIWkQ0v.mjs";
|
|
12
|
+
import { t as as_field_shell_default } from "./as-field-shell-DXbAJupk.mjs";
|
|
13
13
|
import { n as useAsDropdown, t as variantLabel } from "./variant-label-Drm3s-28.mjs";
|
|
14
|
-
import { t as as_input_default } from "./as-input-
|
|
15
|
-
import { t as as_select_default } from "./as-select-
|
|
16
|
-
import { t as as_multi_select_default } from "./as-multi-select-
|
|
17
|
-
import { t as as_radio_default } from "./as-radio-
|
|
18
|
-
import { n as useAsTriStateCheckbox, t as as_checkbox_default } from "./as-checkbox-
|
|
14
|
+
import { t as as_input_default } from "./as-input-D1IO72Tn.mjs";
|
|
15
|
+
import { t as as_select_default } from "./as-select-br9EmsoX.mjs";
|
|
16
|
+
import { t as as_multi_select_default } from "./as-multi-select-CoT5MJd_.mjs";
|
|
17
|
+
import { t as as_radio_default } from "./as-radio-Cc3VOm3A.mjs";
|
|
18
|
+
import { n as useAsTriStateCheckbox, t as as_checkbox_default } from "./as-checkbox-B7C-CvhT.mjs";
|
|
19
19
|
import { t as as_paragraph_default } from "./as-paragraph-ScTsCm_J.mjs";
|
|
20
20
|
import { t as as_action_default } from "./as-action-CPQ64nNi.mjs";
|
|
21
21
|
import { t as useAsOptionalAddFlow } from "./use-as-optional-add-flow-WA-R6yXz.mjs";
|
|
22
|
-
import { t as as_object_default } from "./as-object-
|
|
23
|
-
import { n as useAsArray, t as as_array_default } from "./as-array-
|
|
24
|
-
import { n as useAsTypeMap, r as useAsUnion, t as as_union_default } from "./as-union-
|
|
25
|
-
import { n as useAsTuple, t as as_tuple_default } from "./as-tuple-
|
|
26
|
-
import { t as as_ref_default } from "./as-ref-
|
|
27
|
-
import { n as useAsDualInput, r as useAsDecimal, t as as_decimal_default } from "./as-decimal-
|
|
28
|
-
import { n as useAsNumber, t as as_number_default } from "./as-number-
|
|
29
|
-
import { t as useAsDate } from "./use-as-date-
|
|
30
|
-
import { t as as_date_default } from "./as-date-
|
|
31
|
-
import { t as as_datetime_default } from "./as-datetime-
|
|
32
|
-
import { t as as_time_default } from "./as-time-
|
|
22
|
+
import { t as as_object_default } from "./as-object-6GgXdo_K.mjs";
|
|
23
|
+
import { n as useAsArray, t as as_array_default } from "./as-array-CEtgj6nd.mjs";
|
|
24
|
+
import { n as useAsTypeMap, r as useAsUnion, t as as_union_default } from "./as-union-CIEUE2Xd.mjs";
|
|
25
|
+
import { n as useAsTuple, t as as_tuple_default } from "./as-tuple-D3IoTMkI.mjs";
|
|
26
|
+
import { t as as_ref_default } from "./as-ref-Cs4i9tpS.mjs";
|
|
27
|
+
import { n as useAsDualInput, r as useAsDecimal, t as as_decimal_default } from "./as-decimal-CsAJlvie.mjs";
|
|
28
|
+
import { n as useAsNumber, t as as_number_default } from "./as-number-Ck8nNMCB.mjs";
|
|
29
|
+
import { t as useAsDate } from "./use-as-date-FsgcnN9l.mjs";
|
|
30
|
+
import { t as as_date_default } from "./as-date-CFQtrpZT.mjs";
|
|
31
|
+
import { t as as_datetime_default } from "./as-datetime-DqfSymmL.mjs";
|
|
32
|
+
import { t as as_time_default } from "./as-time-DTz7PrnB.mjs";
|
|
33
33
|
import { computed, inject, reactive, toValue } from "vue";
|
|
34
|
-
import { UI_FORM_FN_HIDDEN, UI_FORM_HIDDEN, UI_FORM_OPTIONAL_MODE, createFormData, createFormDef, createFormValueResolver, emptiedValue, getDefaultClientFactory, getDefaultOptionalMode, hasFieldMeta, isFieldHidden, joinPath, resetDefaultClientFactory, resolveOptionalMode, setDefaultClientFactory, setDefaultOptionalMode } from "@atscript/ui";
|
|
34
|
+
import { UI_FORM_FN_HIDDEN, UI_FORM_HIDDEN, UI_FORM_OPTIONAL_MODE, createFormData, createFormDef, createFormValueResolver, emptiedValue, getDefaultClientFactory, getDefaultOptionalMode, hasFieldMeta, isFieldDisabled, isFieldHidden, isFieldReadonly, isFieldRequired, joinPath, resetDefaultClientFactory, resolveOptionalMode, setDefaultClientFactory, setDefaultOptionalMode } from "@atscript/ui";
|
|
35
35
|
//#region src/composables/create-as-form-def.ts
|
|
36
36
|
/**
|
|
37
37
|
* Creates a reactive form definition and data object from an ATScript annotated type.
|
|
@@ -125,4 +125,4 @@ function useAsErrorDismiss() {
|
|
|
125
125
|
return inject(DISMISS_EXTERNAL_AT_KEY, null) ?? NOOP;
|
|
126
126
|
}
|
|
127
127
|
//#endregion
|
|
128
|
-
export { as_action_default as AsAction, as_array_default as AsArray, as_checkbox_default as AsCheckbox, as_collapsible_default as AsCollapsible, as_date_default as AsDate, as_datetime_default as AsDatetime, as_decimal_default as AsDecimal, as_field_default as AsField, as_field_shell_default as AsFieldShell, as_form_default as AsForm, as_input_default as AsInput, as_iterator_default as AsIterator, as_multi_select_default as AsMultiSelect, as_number_default as AsNumber, as_object_default as AsObject, as_paragraph_default as AsParagraph, as_radio_default as AsRadio, as_ref_default as AsRef, as_select_default as AsSelect, as_time_default as AsTime, as_tuple_default as AsTuple, as_union_default as AsUnion, UI_FORM_OPTIONAL_MODE, createAsFormDef, createDefaultTypes, emptiedValue, focusFirstAfter, focusNewFocusableAfter, formatIndexedLabelParts, getAsServedTexts, getDefaultClientFactory, getDefaultOptionalMode, hasFieldMeta, isFieldHidden, joinPath, provideAsLocale, provideAsNestedLevel, provideAsNestedSectionsStore, provideAsServedTexts, resetDefaultClientFactory, resolveOptionalMode, setDefaultClientFactory, setDefaultOptionalMode, useAsArray, useAsData, useAsDate, useAsDecimal, useAsDescendantErrorCounts, useAsDropdown, useAsDualInput, useAsErrorDismiss, useAsExternalErrors, useAsField, useAsFieldScope, useAsFocusFirstAfter, useAsForm, useAsFormPatch, useAsLevel, useAsLocale, useAsModelTexts, useAsNestedSectionsStore, useAsNumber, useAsOptionalAddFlow, useAsOptionalField, useAsPath, useAsState, useAsTriStateCheckbox, useAsTuple, useAsTypeMap, useAsUnion, useAsUnionVariant, useAsValueHelp, useAsVisibleFields, useValueHelpTexts, variantLabel };
|
|
128
|
+
export { as_action_default as AsAction, as_array_default as AsArray, as_checkbox_default as AsCheckbox, as_collapsible_default as AsCollapsible, as_date_default as AsDate, as_datetime_default as AsDatetime, as_decimal_default as AsDecimal, as_field_default as AsField, as_field_shell_default as AsFieldShell, as_form_default as AsForm, as_input_default as AsInput, as_iterator_default as AsIterator, as_multi_select_default as AsMultiSelect, as_number_default as AsNumber, as_object_default as AsObject, as_paragraph_default as AsParagraph, as_radio_default as AsRadio, as_ref_default as AsRef, as_select_default as AsSelect, as_time_default as AsTime, as_tuple_default as AsTuple, as_union_default as AsUnion, UI_FORM_OPTIONAL_MODE, createAsFormDef, createDefaultTypes, emptiedValue, focusFirstAfter, focusNewFocusableAfter, formatIndexedLabelParts, getAsServedTexts, getDefaultClientFactory, getDefaultOptionalMode, hasFieldMeta, isFieldDisabled, isFieldHidden, isFieldReadonly, isFieldRequired, joinPath, provideAsLocale, provideAsNestedLevel, provideAsNestedSectionsStore, provideAsServedTexts, resetDefaultClientFactory, resolveOptionalMode, setDefaultClientFactory, setDefaultOptionalMode, useAsArray, useAsData, useAsDate, useAsDecimal, useAsDescendantErrorCounts, useAsDropdown, useAsDualInput, useAsErrorDismiss, useAsExternalErrors, useAsField, useAsFieldScope, useAsFocusFirstAfter, useAsForm, useAsFormPatch, useAsLevel, useAsLocale, useAsModelTexts, useAsNestedSectionsStore, useAsNumber, useAsOptionalAddFlow, useAsOptionalField, useAsPath, useAsState, useAsTriStateCheckbox, useAsTuple, useAsTypeMap, useAsUnion, useAsUnionVariant, useAsValueHelp, useAsVisibleFields, useValueHelpTexts, variantLabel };
|
|
@@ -223,6 +223,16 @@ interface UseAsDataReturn {
|
|
|
223
223
|
* Outside a form, `""`.
|
|
224
224
|
*/
|
|
225
225
|
displayText: (field: Pick<FormFieldDef, "path" | "prop" | "valueHelpInfo">, value: unknown, options?: readonly TFormEntryOptions[]) => string;
|
|
226
|
+
/**
|
|
227
|
+
* The form's optional mode — `<AsForm optional-mode>` (`useAsForm({ optionalMode })`),
|
|
228
|
+
* `undefined` for the app-wide default — for a field you render without
|
|
229
|
+
* `AsField`: `resolveOptionalMode(field, optionalMode.value)`. With
|
|
230
|
+
* {@link edit}, what `emptiedValue` and `isFieldRequired` take. Outside a
|
|
231
|
+
* form, `undefined`. Since 0.1.208.
|
|
232
|
+
*/
|
|
233
|
+
optionalMode: ComputedRef<TOptionalMode | undefined>;
|
|
234
|
+
/** Whether the form edits a stored record (`FormDef.edit`); `false` outside a form. Since 0.1.208. */
|
|
235
|
+
edit: ComputedRef<boolean>;
|
|
226
236
|
}
|
|
227
237
|
/**
|
|
228
238
|
* Reactive access to form data at any point in the `<AsForm>` tree: readers
|
|
@@ -412,6 +422,12 @@ interface UseAsFormReturn<TFormData = unknown, TFormContext = unknown> {
|
|
|
412
422
|
loading: boolean;
|
|
413
423
|
submitText: string;
|
|
414
424
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
425
|
+
/**
|
|
426
|
+
* Fire a declared form action as its button does: emits `action` (or
|
|
427
|
+
* `unsupported-action`) with the data a submit would send — normalized, not
|
|
428
|
+
* validated. Since 0.1.208.
|
|
429
|
+
*/
|
|
430
|
+
action: (name: string) => void;
|
|
415
431
|
reset: () => Promise<void>; /** Fields back to the change-tracking baseline (a no-op when tracking is off). */
|
|
416
432
|
revert: () => Promise<void>;
|
|
417
433
|
clearErrors: () => void;
|
|
@@ -535,7 +551,12 @@ interface TAsComponentProps<V = unknown> extends TAsBaseComponentProps {
|
|
|
535
551
|
* this when emptied. Since 0.1.205.
|
|
536
552
|
*/
|
|
537
553
|
emptiedValue?: unknown;
|
|
538
|
-
/**
|
|
554
|
+
/**
|
|
555
|
+
* Whether the field shows as required — the `*`, `aria-required`
|
|
556
|
+
* (`isFieldRequired`, since 0.1.208): the value the field is left with once
|
|
557
|
+
* emptied is one the validator refuses (a union's variant: by the union's
|
|
558
|
+
* rules), and the field is not read-only.
|
|
559
|
+
*/
|
|
539
560
|
required?: boolean | undefined;
|
|
540
561
|
/** Whether the field is read-only. */
|
|
541
562
|
readonly?: boolean | undefined;
|
|
@@ -654,14 +675,10 @@ interface TAsComponentProps<V = unknown> extends TAsBaseComponentProps {
|
|
|
654
675
|
*/
|
|
655
676
|
suffix?: string;
|
|
656
677
|
/**
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
-
* resolved, else `currencyDecimals` (currency only), else
|
|
662
|
-
* `precisionScale` (DB only), else `undefined`. Smaller than
|
|
663
|
-
* `precisionScale` is fine — storage stays at the DB cap, display
|
|
664
|
-
* truncates to this.
|
|
678
|
+
* The fraction digits the number is written with — `resolveMeasurement`'s
|
|
679
|
+
* scale, the table cells' rule too; `undefined` when nothing declares one.
|
|
680
|
+
* `useAsDecimal` edits at it, widened to the digits the value holds (up to
|
|
681
|
+
* `precisionScale` when declared).
|
|
665
682
|
*/
|
|
666
683
|
scale?: number;
|
|
667
684
|
/**
|
|
@@ -223,6 +223,16 @@ interface UseAsDataReturn {
|
|
|
223
223
|
* Outside a form, `""`.
|
|
224
224
|
*/
|
|
225
225
|
displayText: (field: Pick<FormFieldDef, "path" | "prop" | "valueHelpInfo">, value: unknown, options?: readonly TFormEntryOptions[]) => string;
|
|
226
|
+
/**
|
|
227
|
+
* The form's optional mode — `<AsForm optional-mode>` (`useAsForm({ optionalMode })`),
|
|
228
|
+
* `undefined` for the app-wide default — for a field you render without
|
|
229
|
+
* `AsField`: `resolveOptionalMode(field, optionalMode.value)`. With
|
|
230
|
+
* {@link edit}, what `emptiedValue` and `isFieldRequired` take. Outside a
|
|
231
|
+
* form, `undefined`. Since 0.1.208.
|
|
232
|
+
*/
|
|
233
|
+
optionalMode: ComputedRef<TOptionalMode | undefined>;
|
|
234
|
+
/** Whether the form edits a stored record (`FormDef.edit`); `false` outside a form. Since 0.1.208. */
|
|
235
|
+
edit: ComputedRef<boolean>;
|
|
226
236
|
}
|
|
227
237
|
/**
|
|
228
238
|
* Reactive access to form data at any point in the `<AsForm>` tree: readers
|
|
@@ -412,6 +422,12 @@ interface UseAsFormReturn<TFormData = unknown, TFormContext = unknown> {
|
|
|
412
422
|
loading: boolean;
|
|
413
423
|
submitText: string;
|
|
414
424
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
425
|
+
/**
|
|
426
|
+
* Fire a declared form action as its button does: emits `action` (or
|
|
427
|
+
* `unsupported-action`) with the data a submit would send — normalized, not
|
|
428
|
+
* validated. Since 0.1.208.
|
|
429
|
+
*/
|
|
430
|
+
action: (name: string) => void;
|
|
415
431
|
reset: () => Promise<void>; /** Fields back to the change-tracking baseline (a no-op when tracking is off). */
|
|
416
432
|
revert: () => Promise<void>;
|
|
417
433
|
clearErrors: () => void;
|
|
@@ -535,7 +551,12 @@ interface TAsComponentProps<V = unknown> extends TAsBaseComponentProps {
|
|
|
535
551
|
* this when emptied. Since 0.1.205.
|
|
536
552
|
*/
|
|
537
553
|
emptiedValue?: unknown;
|
|
538
|
-
/**
|
|
554
|
+
/**
|
|
555
|
+
* Whether the field shows as required — the `*`, `aria-required`
|
|
556
|
+
* (`isFieldRequired`, since 0.1.208): the value the field is left with once
|
|
557
|
+
* emptied is one the validator refuses (a union's variant: by the union's
|
|
558
|
+
* rules), and the field is not read-only.
|
|
559
|
+
*/
|
|
539
560
|
required?: boolean | undefined;
|
|
540
561
|
/** Whether the field is read-only. */
|
|
541
562
|
readonly?: boolean | undefined;
|
|
@@ -654,14 +675,10 @@ interface TAsComponentProps<V = unknown> extends TAsBaseComponentProps {
|
|
|
654
675
|
*/
|
|
655
676
|
suffix?: string;
|
|
656
677
|
/**
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
-
* resolved, else `currencyDecimals` (currency only), else
|
|
662
|
-
* `precisionScale` (DB only), else `undefined`. Smaller than
|
|
663
|
-
* `precisionScale` is fine — storage stays at the DB cap, display
|
|
664
|
-
* truncates to this.
|
|
678
|
+
* The fraction digits the number is written with — `resolveMeasurement`'s
|
|
679
|
+
* scale, the table cells' rule too; `undefined` when nothing declares one.
|
|
680
|
+
* `useAsDecimal` edits at it, widened to the digits the value holds (up to
|
|
681
|
+
* `precisionScale` when declared).
|
|
665
682
|
*/
|
|
666
683
|
scale?: number;
|
|
667
684
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
let vue = require("vue");
|
|
2
|
+
let _atscript_ui = require("@atscript/ui");
|
|
2
3
|
//#region src/components/internal/as-date-control.vue?vue&type=script&setup=true&lang.ts
|
|
3
4
|
const _hoisted_1 = [
|
|
4
5
|
"id",
|
|
@@ -259,13 +260,16 @@ var as_date_control_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
259
260
|
function pad2(n) {
|
|
260
261
|
return n < 10 ? `0${n}` : String(n);
|
|
261
262
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
263
|
+
/**
|
|
264
|
+
* A value (read by core `toDate`) on the local clock — the clock a native date
|
|
265
|
+
* input edits: a value with a time as it reads there, a date-only one at local
|
|
266
|
+
* midnight of its calendar day, so every zone shows the same day.
|
|
267
|
+
*/
|
|
268
|
+
function onLocalClock(v) {
|
|
269
|
+
const read = (0, _atscript_ui.toDate)(v);
|
|
270
|
+
if (!read?.dateOnly) return read?.date;
|
|
271
|
+
const d = read.date;
|
|
272
|
+
return new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate());
|
|
269
273
|
}
|
|
270
274
|
/**
|
|
271
275
|
* Format a Date for `<input type="date|datetime-local">`. Renders in the
|
|
@@ -281,12 +285,11 @@ function formatLocal(d, kind) {
|
|
|
281
285
|
}
|
|
282
286
|
/** Extract HH:mm from an epoch-ms number / Date / ISO string. */
|
|
283
287
|
function formatTime(v) {
|
|
284
|
-
if (v === null || v === void 0 || v === "") return "";
|
|
285
288
|
if (typeof v === "string" && /^\d{1,2}:\d{2}(:\d{2})?$/.test(v)) {
|
|
286
289
|
const [hh, mm] = v.split(":");
|
|
287
290
|
return `${pad2(Number(hh))}:${mm}`;
|
|
288
291
|
}
|
|
289
|
-
const d =
|
|
292
|
+
const d = onLocalClock(v);
|
|
290
293
|
if (!d) return "";
|
|
291
294
|
return `${pad2(d.getHours())}:${pad2(d.getMinutes())}`;
|
|
292
295
|
}
|
|
@@ -296,8 +299,9 @@ function formatTime(v) {
|
|
|
296
299
|
*
|
|
297
300
|
* - `'date'`: epoch-ms ↔ `YYYY-MM-DD` (local TZ).
|
|
298
301
|
* Empty input commits `null`. A string-stored field (`prop`) or one
|
|
299
|
-
* holding a `string` commits a string (`YYYY-MM-DD`); otherwise epoch-ms
|
|
300
|
-
* midnight
|
|
302
|
+
* holding a `string` commits a string (`YYYY-MM-DD`); otherwise epoch-ms
|
|
303
|
+
* (local midnight of the picked day, so it reads back as that day). A
|
|
304
|
+
* date-only value shows its calendar day in every zone (`toDate`).
|
|
301
305
|
* - `'datetime'`: epoch-ms ↔ `YYYY-MM-DDTHH:mm` (local TZ).
|
|
302
306
|
* - `'time'`: prev-string ↔ `HH:mm`. Numeric storage isn't meaningful
|
|
303
307
|
* for naked time-of-day, so we commit a string.
|
|
@@ -309,7 +313,7 @@ function useAsDate(opts) {
|
|
|
309
313
|
const displayValue = (0, vue.computed)(() => {
|
|
310
314
|
const v = opts.modelValue();
|
|
311
315
|
if (opts.kind === "time") return formatTime(v);
|
|
312
|
-
const d =
|
|
316
|
+
const d = onLocalClock(v);
|
|
313
317
|
if (!d) return "";
|
|
314
318
|
return formatLocal(d, opts.kind === "datetime" ? "datetime" : "date");
|
|
315
319
|
});
|
|
@@ -326,8 +330,8 @@ function useAsDate(opts) {
|
|
|
326
330
|
opts.onCommit(raw);
|
|
327
331
|
return;
|
|
328
332
|
}
|
|
329
|
-
const d =
|
|
330
|
-
if (!
|
|
333
|
+
const d = onLocalClock(raw);
|
|
334
|
+
if (!d) return;
|
|
331
335
|
opts.onCommit(d.getTime());
|
|
332
336
|
}
|
|
333
337
|
return {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { computed, createElementBlock, defineComponent, openBlock } from "vue";
|
|
2
|
+
import { toDate } from "@atscript/ui";
|
|
2
3
|
//#region src/components/internal/as-date-control.vue?vue&type=script&setup=true&lang.ts
|
|
3
4
|
const _hoisted_1 = [
|
|
4
5
|
"id",
|
|
@@ -259,13 +260,16 @@ var as_date_control_default = /* @__PURE__ */ defineComponent({
|
|
|
259
260
|
function pad2(n) {
|
|
260
261
|
return n < 10 ? `0${n}` : String(n);
|
|
261
262
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
263
|
+
/**
|
|
264
|
+
* A value (read by core `toDate`) on the local clock — the clock a native date
|
|
265
|
+
* input edits: a value with a time as it reads there, a date-only one at local
|
|
266
|
+
* midnight of its calendar day, so every zone shows the same day.
|
|
267
|
+
*/
|
|
268
|
+
function onLocalClock(v) {
|
|
269
|
+
const read = toDate(v);
|
|
270
|
+
if (!read?.dateOnly) return read?.date;
|
|
271
|
+
const d = read.date;
|
|
272
|
+
return new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate());
|
|
269
273
|
}
|
|
270
274
|
/**
|
|
271
275
|
* Format a Date for `<input type="date|datetime-local">`. Renders in the
|
|
@@ -281,12 +285,11 @@ function formatLocal(d, kind) {
|
|
|
281
285
|
}
|
|
282
286
|
/** Extract HH:mm from an epoch-ms number / Date / ISO string. */
|
|
283
287
|
function formatTime(v) {
|
|
284
|
-
if (v === null || v === void 0 || v === "") return "";
|
|
285
288
|
if (typeof v === "string" && /^\d{1,2}:\d{2}(:\d{2})?$/.test(v)) {
|
|
286
289
|
const [hh, mm] = v.split(":");
|
|
287
290
|
return `${pad2(Number(hh))}:${mm}`;
|
|
288
291
|
}
|
|
289
|
-
const d =
|
|
292
|
+
const d = onLocalClock(v);
|
|
290
293
|
if (!d) return "";
|
|
291
294
|
return `${pad2(d.getHours())}:${pad2(d.getMinutes())}`;
|
|
292
295
|
}
|
|
@@ -296,8 +299,9 @@ function formatTime(v) {
|
|
|
296
299
|
*
|
|
297
300
|
* - `'date'`: epoch-ms ↔ `YYYY-MM-DD` (local TZ).
|
|
298
301
|
* Empty input commits `null`. A string-stored field (`prop`) or one
|
|
299
|
-
* holding a `string` commits a string (`YYYY-MM-DD`); otherwise epoch-ms
|
|
300
|
-
* midnight
|
|
302
|
+
* holding a `string` commits a string (`YYYY-MM-DD`); otherwise epoch-ms
|
|
303
|
+
* (local midnight of the picked day, so it reads back as that day). A
|
|
304
|
+
* date-only value shows its calendar day in every zone (`toDate`).
|
|
301
305
|
* - `'datetime'`: epoch-ms ↔ `YYYY-MM-DDTHH:mm` (local TZ).
|
|
302
306
|
* - `'time'`: prev-string ↔ `HH:mm`. Numeric storage isn't meaningful
|
|
303
307
|
* for naked time-of-day, so we commit a string.
|
|
@@ -309,7 +313,7 @@ function useAsDate(opts) {
|
|
|
309
313
|
const displayValue = computed(() => {
|
|
310
314
|
const v = opts.modelValue();
|
|
311
315
|
if (opts.kind === "time") return formatTime(v);
|
|
312
|
-
const d =
|
|
316
|
+
const d = onLocalClock(v);
|
|
313
317
|
if (!d) return "";
|
|
314
318
|
return formatLocal(d, opts.kind === "datetime" ? "datetime" : "date");
|
|
315
319
|
});
|
|
@@ -326,8 +330,8 @@ function useAsDate(opts) {
|
|
|
326
330
|
opts.onCommit(raw);
|
|
327
331
|
return;
|
|
328
332
|
}
|
|
329
|
-
const d =
|
|
330
|
-
if (!
|
|
333
|
+
const d = onLocalClock(raw);
|
|
334
|
+
if (!d) return;
|
|
331
335
|
opts.onCommit(d.getTime());
|
|
332
336
|
}
|
|
333
337
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { y as MODEL_TEXTS_KEY } from "./use-form-context-D_ejQqCc.mjs";
|
|
2
2
|
import { o as useAsTexts } from "./use-as-locale-CznDr-7i.mjs";
|
|
3
3
|
import { inject } from "vue";
|
|
4
4
|
//#region src/composables/use-as-model-texts.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_use_form_context = require("./use-form-context-
|
|
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
3
|
let vue = require("vue");
|
|
4
4
|
//#region src/composables/use-as-model-texts.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_use_form_context = require("./use-form-context-
|
|
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
3
|
let vue = require("vue");
|
|
4
4
|
let _atscript_ui = require("@atscript/ui");
|
|
@@ -6,8 +6,8 @@ let _atscript_ui = require("@atscript/ui");
|
|
|
6
6
|
/**
|
|
7
7
|
* {@link UseAsDataReturn.displayText} over `formState`: the field's
|
|
8
8
|
* `@ui.valueLabel` sibling is read through `read` (a data path below where the
|
|
9
|
-
* field's def is rendered) — the one sibling read of `useAsData` and
|
|
10
|
-
* slot (`useAsForm`).
|
|
9
|
+
* field's def is rendered) — the one sibling read of `useAsData`, `AsField` and
|
|
10
|
+
* the form's slot (`useAsForm`).
|
|
11
11
|
*/
|
|
12
12
|
function fieldDisplayText(formState, read) {
|
|
13
13
|
return (field, value, options) => {
|
|
@@ -24,6 +24,10 @@ function fieldDisplayText(formState, read) {
|
|
|
24
24
|
}
|
|
25
25
|
const EMPTY_PATH = (0, vue.computed)(() => "");
|
|
26
26
|
const EMPTY_DATA = (0, vue.computed)(() => void 0);
|
|
27
|
+
const NO_FORM_OPTIONAL = {
|
|
28
|
+
mode: (0, vue.computed)(() => void 0),
|
|
29
|
+
edit: (0, vue.computed)(() => false)
|
|
30
|
+
};
|
|
27
31
|
/**
|
|
28
32
|
* Reactive access to form data at any point in the `<AsForm>` tree: readers
|
|
29
33
|
* plus `setValueAt` / `setSibling` writers. Outside a form, all readers
|
|
@@ -37,6 +41,7 @@ function useAsData() {
|
|
|
37
41
|
const formState = (0, vue.inject)(require_use_form_context.FORM_STATE_KEY, void 0);
|
|
38
42
|
const pathPrefix = (0, vue.inject)(require_use_form_context.PATH_PREFIX_KEY, EMPTY_PATH);
|
|
39
43
|
const handleChange = (0, vue.inject)(require_use_form_context.CHANGE_HANDLER_KEY, void 0);
|
|
44
|
+
const formOptional = (0, vue.inject)(require_use_form_context.FORM_OPTIONAL_KEY, NO_FORM_OPTIONAL);
|
|
40
45
|
const rootData = (0, vue.computed)(() => {
|
|
41
46
|
return wrapped.value?.value;
|
|
42
47
|
});
|
|
@@ -70,7 +75,9 @@ function useAsData() {
|
|
|
70
75
|
siblingValue,
|
|
71
76
|
setValueAt,
|
|
72
77
|
setSibling,
|
|
73
|
-
displayText: formState ? fieldDisplayText(formState, readSibling) : () => ""
|
|
78
|
+
displayText: formState ? fieldDisplayText(formState, readSibling) : () => "",
|
|
79
|
+
optionalMode: formOptional.mode,
|
|
80
|
+
edit: formOptional.edit
|
|
74
81
|
};
|
|
75
82
|
}
|
|
76
83
|
//#endregion
|
|
@@ -93,8 +100,6 @@ function useAsValueHelp(options) {
|
|
|
93
100
|
const hostLocals = new Set(info.hostFilter?.map((h) => h.local));
|
|
94
101
|
/** What this field's last pick wrote into each fill target. */
|
|
95
102
|
const written = /* @__PURE__ */ new Map();
|
|
96
|
-
/** A cleared fill on an edit form holds `null`, so a whole-record update clears it too. */
|
|
97
|
-
const formOptional = (0, vue.inject)(require_use_form_context.FORM_OPTIONAL_KEY, void 0);
|
|
98
103
|
const injectedFactory = (0, vue.inject)(CLIENT_FACTORY_KEY, null) ?? void 0;
|
|
99
104
|
const texts = require_use_as_locale.useAsTexts();
|
|
100
105
|
const scoped = !!(0, vue.getCurrentScope)();
|
|
@@ -206,7 +211,7 @@ function useAsValueHelp(options) {
|
|
|
206
211
|
}
|
|
207
212
|
function commitValue(value) {
|
|
208
213
|
model.value = value;
|
|
209
|
-
for (const [local, wrote] of written) if (wrote !== void 0 && !hostLocals.has(local) && Object.is(readSibling(local), wrote)) data.setSibling(local,
|
|
214
|
+
for (const [local, wrote] of written) if (wrote !== void 0 && !hostLocals.has(local) && Object.is(readSibling(local), wrote)) data.setSibling(local, data.edit.value ? null : void 0);
|
|
210
215
|
written.clear();
|
|
211
216
|
}
|
|
212
217
|
function clear(value) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as PATH_PREFIX_KEY, h as FORM_STATE_KEY, o as CHANGE_HANDLER_KEY, p as FORM_OPTIONAL_KEY, x as ROOT_DATA_KEY } from "./use-form-context-D_ejQqCc.mjs";
|
|
2
2
|
import { o as useAsTexts, s as useUiLocaleKey } from "./use-as-locale-CznDr-7i.mjs";
|
|
3
3
|
import { computed, getCurrentScope, inject, onMounted, onScopeDispose, onUnmounted, ref, shallowRef, watch } from "vue";
|
|
4
4
|
import { getByPath, joinPath, parentPrefix, retainMetaEntry, setByPath, valueHelpFills, valueHelpScope, valueHelpSource, valueLabelOf } from "@atscript/ui";
|
|
@@ -6,8 +6,8 @@ import { getByPath, joinPath, parentPrefix, retainMetaEntry, setByPath, valueHel
|
|
|
6
6
|
/**
|
|
7
7
|
* {@link UseAsDataReturn.displayText} over `formState`: the field's
|
|
8
8
|
* `@ui.valueLabel` sibling is read through `read` (a data path below where the
|
|
9
|
-
* field's def is rendered) — the one sibling read of `useAsData` and
|
|
10
|
-
* slot (`useAsForm`).
|
|
9
|
+
* field's def is rendered) — the one sibling read of `useAsData`, `AsField` and
|
|
10
|
+
* the form's slot (`useAsForm`).
|
|
11
11
|
*/
|
|
12
12
|
function fieldDisplayText(formState, read) {
|
|
13
13
|
return (field, value, options) => {
|
|
@@ -24,6 +24,10 @@ function fieldDisplayText(formState, read) {
|
|
|
24
24
|
}
|
|
25
25
|
const EMPTY_PATH = computed(() => "");
|
|
26
26
|
const EMPTY_DATA = computed(() => void 0);
|
|
27
|
+
const NO_FORM_OPTIONAL = {
|
|
28
|
+
mode: computed(() => void 0),
|
|
29
|
+
edit: computed(() => false)
|
|
30
|
+
};
|
|
27
31
|
/**
|
|
28
32
|
* Reactive access to form data at any point in the `<AsForm>` tree: readers
|
|
29
33
|
* plus `setValueAt` / `setSibling` writers. Outside a form, all readers
|
|
@@ -37,6 +41,7 @@ function useAsData() {
|
|
|
37
41
|
const formState = inject(FORM_STATE_KEY, void 0);
|
|
38
42
|
const pathPrefix = inject(PATH_PREFIX_KEY, EMPTY_PATH);
|
|
39
43
|
const handleChange = inject(CHANGE_HANDLER_KEY, void 0);
|
|
44
|
+
const formOptional = inject(FORM_OPTIONAL_KEY, NO_FORM_OPTIONAL);
|
|
40
45
|
const rootData = computed(() => {
|
|
41
46
|
return wrapped.value?.value;
|
|
42
47
|
});
|
|
@@ -70,7 +75,9 @@ function useAsData() {
|
|
|
70
75
|
siblingValue,
|
|
71
76
|
setValueAt,
|
|
72
77
|
setSibling,
|
|
73
|
-
displayText: formState ? fieldDisplayText(formState, readSibling) : () => ""
|
|
78
|
+
displayText: formState ? fieldDisplayText(formState, readSibling) : () => "",
|
|
79
|
+
optionalMode: formOptional.mode,
|
|
80
|
+
edit: formOptional.edit
|
|
74
81
|
};
|
|
75
82
|
}
|
|
76
83
|
//#endregion
|
|
@@ -93,8 +100,6 @@ function useAsValueHelp(options) {
|
|
|
93
100
|
const hostLocals = new Set(info.hostFilter?.map((h) => h.local));
|
|
94
101
|
/** What this field's last pick wrote into each fill target. */
|
|
95
102
|
const written = /* @__PURE__ */ new Map();
|
|
96
|
-
/** A cleared fill on an edit form holds `null`, so a whole-record update clears it too. */
|
|
97
|
-
const formOptional = inject(FORM_OPTIONAL_KEY, void 0);
|
|
98
103
|
const injectedFactory = inject(CLIENT_FACTORY_KEY, null) ?? void 0;
|
|
99
104
|
const texts = useAsTexts();
|
|
100
105
|
const scoped = !!getCurrentScope();
|
|
@@ -206,7 +211,7 @@ function useAsValueHelp(options) {
|
|
|
206
211
|
}
|
|
207
212
|
function commitValue(value) {
|
|
208
213
|
model.value = value;
|
|
209
|
-
for (const [local, wrote] of written) if (wrote !== void 0 && !hostLocals.has(local) && Object.is(readSibling(local), wrote)) data.setSibling(local,
|
|
214
|
+
for (const [local, wrote] of written) if (wrote !== void 0 && !hostLocals.has(local) && Object.is(readSibling(local), wrote)) data.setSibling(local, data.edit.value ? null : void 0);
|
|
210
215
|
written.clear();
|
|
211
216
|
}
|
|
212
217
|
function clear(value) {
|
|
@@ -109,6 +109,16 @@ function formatIndexedLabelParts(label, arrayIndex) {
|
|
|
109
109
|
suffix: `#${arrayIndex + 1}`
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Whether the structured field being rendered is locked — disabled or read-only,
|
|
114
|
+
* its own or an ancestor's: the state `<AsField>` hands to the fields inside a
|
|
115
|
+
* structured field. Its value cannot change through it: the one lock reader of
|
|
116
|
+
* `useAsArray`, `useAsTuple`, `useAsUnion` and `useAsOptionalField`.
|
|
117
|
+
*/
|
|
118
|
+
function useInheritedLock() {
|
|
119
|
+
const lock = (0, vue.inject)(LOCK_KEY, void 0);
|
|
120
|
+
return (0, vue.computed)(() => !!lock && ((0, vue.unref)(lock.disabled) || (0, vue.unref)(lock.readonly)));
|
|
121
|
+
}
|
|
112
122
|
//#endregion
|
|
113
123
|
Object.defineProperty(exports, "ACTION_HANDLER_KEY", {
|
|
114
124
|
enumerable: true,
|
|
@@ -242,3 +252,9 @@ Object.defineProperty(exports, "useFormContext", {
|
|
|
242
252
|
return useFormContext;
|
|
243
253
|
}
|
|
244
254
|
});
|
|
255
|
+
Object.defineProperty(exports, "useInheritedLock", {
|
|
256
|
+
enumerable: true,
|
|
257
|
+
get: function() {
|
|
258
|
+
return useInheritedLock;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as useAsTexts } from "./use-as-locale-CznDr-7i.mjs";
|
|
2
|
-
import { computed, inject, provide } from "vue";
|
|
2
|
+
import { computed, inject, provide, unref } from "vue";
|
|
3
3
|
import { createFormData, createFormValueResolver, getByPath, joinPath, setByPath } from "@atscript/ui";
|
|
4
4
|
//#region src/composables/internal-keys.ts
|
|
5
5
|
/**
|
|
@@ -109,5 +109,15 @@ function formatIndexedLabelParts(label, arrayIndex) {
|
|
|
109
109
|
suffix: `#${arrayIndex + 1}`
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Whether the structured field being rendered is locked — disabled or read-only,
|
|
114
|
+
* its own or an ancestor's: the state `<AsField>` hands to the fields inside a
|
|
115
|
+
* structured field. Its value cannot change through it: the one lock reader of
|
|
116
|
+
* `useAsArray`, `useAsTuple`, `useAsUnion` and `useAsOptionalField`.
|
|
117
|
+
*/
|
|
118
|
+
function useInheritedLock() {
|
|
119
|
+
const lock = inject(LOCK_KEY, void 0);
|
|
120
|
+
return computed(() => !!lock && (unref(lock.disabled) || unref(lock.readonly)));
|
|
121
|
+
}
|
|
112
122
|
//#endregion
|
|
113
|
-
export { UNION_CONTEXT_KEY as S,
|
|
123
|
+
export { UNION_CONTEXT_KEY as C, TYPES_KEY as S, LEVEL_KEY as _, ACTION_HANDLER_KEY as a, PATH_PREFIX_KEY as b, DISMISS_EXTERNAL_AT_KEY as c, FORM_DATA_KEY as d, FORM_NORMALIZED_DATA_KEY as f, HIDE_ROOT_TITLE_KEY as g, FORM_STATE_KEY as h, useInheritedLock as i, ERRORS_KEY as l, FORM_PATCH_KEY as m, useAsUnionVariant as n, CHANGE_HANDLER_KEY as o, FORM_OPTIONAL_KEY as p, useFormContext as r, COMPONENTS_KEY as s, formatIndexedLabelParts as t, FORM_CONTEXT_KEY as u, LOCK_KEY as v, ROOT_DATA_KEY as x, MODEL_TEXTS_KEY as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/vue-form",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.208",
|
|
4
4
|
"description": "Type-driven form rendering for Atscript with Vue 3",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"atscript",
|
|
@@ -165,27 +165,27 @@
|
|
|
165
165
|
"access": "public"
|
|
166
166
|
},
|
|
167
167
|
"dependencies": {
|
|
168
|
-
"@atscript/ui": "^0.1.
|
|
169
|
-
"@atscript/ui-fns": "^0.1.
|
|
168
|
+
"@atscript/ui": "^0.1.208",
|
|
169
|
+
"@atscript/ui-fns": "^0.1.208"
|
|
170
170
|
},
|
|
171
171
|
"devDependencies": {
|
|
172
|
-
"@atscript/core": "^0.2.
|
|
173
|
-
"@atscript/db-client": "^0.1.
|
|
174
|
-
"@atscript/typescript": "^0.2.
|
|
172
|
+
"@atscript/core": "^0.2.34",
|
|
173
|
+
"@atscript/db-client": "^0.1.212",
|
|
174
|
+
"@atscript/typescript": "^0.2.34",
|
|
175
175
|
"@tsdown/css": "^0.21.4",
|
|
176
176
|
"@vitejs/plugin-vue": "^6",
|
|
177
177
|
"@vue/test-utils": "^2",
|
|
178
178
|
"happy-dom": "^18",
|
|
179
179
|
"reka-ui": "^2.9.8",
|
|
180
|
-
"unplugin-atscript": "^0.2.
|
|
180
|
+
"unplugin-atscript": "^0.2.34",
|
|
181
181
|
"vitest": "npm:@voidzero-dev/vite-plus-test@0.1.14",
|
|
182
182
|
"vue": "^3",
|
|
183
183
|
"vue-tsc": "~3.2.9",
|
|
184
184
|
"vunor": "^0.5.4"
|
|
185
185
|
},
|
|
186
186
|
"peerDependencies": {
|
|
187
|
-
"@atscript/db-client": "^0.1.
|
|
188
|
-
"@atscript/typescript": "^0.2.
|
|
187
|
+
"@atscript/db-client": "^0.1.212",
|
|
188
|
+
"@atscript/typescript": "^0.2.34",
|
|
189
189
|
"reka-ui": "^2.9.8",
|
|
190
190
|
"vue": "^3"
|
|
191
191
|
},
|