@atscript/vue-form 0.1.206 → 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-rT6WXLph.cjs → as-action-BGIbuTxh.cjs} +3 -3
- package/dist/{as-action-kBskX68v.mjs → as-action-CPQ64nNi.mjs} +3 -3
- package/dist/as-action.cjs +1 -1
- package/dist/as-action.d.cts +1 -1
- package/dist/as-action.d.mts +1 -1
- package/dist/as-action.mjs +1 -1
- package/dist/{as-action.vue-B7RrjGhF.d.cts → as-action.vue-D0twy1JK.d.cts} +1 -1
- package/dist/{as-action.vue-Dtez-EWu.d.mts → as-action.vue-Dse77iCr.d.mts} +1 -1
- package/dist/{as-array-Tt_4kl5r.mjs → as-array-CEtgj6nd.mjs} +13 -14
- package/dist/{as-array-C5lqDDLN.cjs → as-array-CKedVJIz.cjs} +13 -14
- package/dist/{as-array-clear-btn-DGUQY_7_.mjs → as-array-clear-btn-BFfll2RA.mjs} +1 -1
- package/dist/{as-array-clear-btn-Dk88CYmS.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-Ca_xan2n.d.mts → as-array.vue-BCB8mLx-.d.mts} +1 -1
- package/dist/{as-array.vue-Dp_zd3ZM.d.cts → as-array.vue-DJNzEE8-.d.cts} +1 -1
- package/dist/{as-checkbox-CCX9E19U.mjs → as-checkbox-B7C-CvhT.mjs} +9 -17
- package/dist/{as-checkbox-D7NywgIa.cjs → as-checkbox-DKaEfo7e.cjs} +9 -17
- 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-BClSBx1g.d.mts → as-checkbox.vue-CoCgt4vV.d.mts} +1 -1
- package/dist/{as-checkbox.vue-Bf3qqcKu.d.cts → as-checkbox.vue-fPeyQDp5.d.cts} +1 -1
- package/dist/{as-collapsible-CTOLQ3IK.cjs → as-collapsible-Bs0LOl1t.cjs} +1 -1
- package/dist/{as-collapsible-CvBoWb0D.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-BXdpM7_K.d.cts → as-collapsible.vue-CH3ez8zm.d.cts} +1 -1
- package/dist/{as-collapsible.vue-CUhn1EVX.d.mts → as-collapsible.vue-DewV2oaE.d.mts} +1 -1
- package/dist/{as-date-Ubw_1-Ai.cjs → as-date-BMKMiM_d.cjs} +6 -6
- package/dist/{as-date-3haOaiAG.mjs → as-date-CFQtrpZT.mjs} +6 -6
- 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-B5NWZ5ON.d.cts → as-date.vue-BSghCVx0.d.cts} +1 -1
- package/dist/{as-date.vue-CJQOrfj3.d.mts → as-date.vue-CPgqqKMB.d.mts} +1 -1
- package/dist/{as-datetime--7bl-yGW.cjs → as-datetime-Bl1K4U51.cjs} +6 -6
- package/dist/{as-datetime-BTekpasP.mjs → as-datetime-DqfSymmL.mjs} +6 -6
- 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-BvmFdGxe.d.cts → as-datetime.vue-B-KRC-0X.d.mts} +1 -1
- package/dist/{as-datetime.vue-CzMz_RUy.d.mts → as-datetime.vue-CjDTsMDw.d.cts} +1 -1
- package/dist/{as-decimal-DWPRXsYY.cjs → as-decimal-48M_h9Sl.cjs} +22 -28
- package/dist/{as-decimal-7CIE6UKX.mjs → as-decimal-CsAJlvie.mjs} +22 -28
- 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-DdVqHtMT.d.cts → as-decimal.vue-BZ2imea4.d.mts} +1 -1
- package/dist/{as-decimal.vue-DyDt1ds0.d.mts → as-decimal.vue-BvvG5aIL.d.cts} +1 -1
- package/dist/{as-field-jh5AWref.mjs → as-field-C6iquEB1.mjs} +123 -173
- package/dist/{as-field-DAClnYiP.cjs → as-field-CJMJJfXO.cjs} +122 -172
- package/dist/{as-field-shell-Cu8jxZYj.cjs → as-field-shell-CMq52Z6e.cjs} +7 -7
- package/dist/{as-field-shell-DPzfvPo0.mjs → as-field-shell-DXbAJupk.mjs} +7 -7
- 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-CPy2uA-b.d.mts → as-field-shell.vue-BbSIqZSY.d.cts} +1 -1
- package/dist/{as-field-shell.vue-D-8AWUGW.d.cts → as-field-shell.vue-D0NYcajH.d.mts} +1 -1
- package/dist/as-field.cjs +1 -1
- package/dist/as-field.d.mts +1 -1
- package/dist/as-field.mjs +1 -1
- package/dist/{as-form-r5pkXt5U.cjs → as-form-B4-StU3b.cjs} +41 -43
- package/dist/{as-form-B8d1MVTB.mjs → as-form-DQePBFwR.mjs} +42 -44
- 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-D1AS3Xf6.d.mts → as-form.vue-BMNZuvpb.d.mts} +66 -54
- package/dist/{as-form.vue-BvRHy6mu.d.cts → as-form.vue-DS5r3CWl.d.cts} +66 -54
- package/dist/{as-input-tKw19JnF.mjs → as-input-D1IO72Tn.mjs} +6 -6
- package/dist/{as-input-BTbu0eF-.cjs → as-input-Dy7v1AjV.cjs} +6 -6
- package/dist/{as-input-control-1igViaqC.mjs → as-input-control-CINIJm-h.mjs} +13 -5
- package/dist/{as-input-control-uJpmle-G.cjs → as-input-control-DXJBrgih.cjs} +13 -5
- 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-CuC3DYeR.d.cts → as-input.vue-DMxFk9uv.d.cts} +1 -1
- package/dist/{as-input.vue-DawR7pA-.d.mts → as-input.vue-DzG-WB4x.d.mts} +1 -1
- package/dist/{as-iterator-B1o83rKV.mjs → as-iterator-A9ozhHhf.mjs} +2 -2
- package/dist/{as-iterator-q_w9HBHt.cjs → as-iterator-C8aJ6SUs.cjs} +2 -2
- package/dist/as-iterator.cjs +1 -1
- package/dist/as-iterator.d.mts +1 -1
- package/dist/as-iterator.mjs +1 -1
- package/dist/{as-multi-select-DPQ9_Qf1.cjs → as-multi-select-BiOEQf1L.cjs} +7 -11
- package/dist/{as-multi-select-DhOlsgdq.mjs → as-multi-select-CoT5MJd_.mjs} +8 -12
- 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-CbVBJq8N.d.mts → as-multi-select.vue-CBtBFW6X.d.cts} +1 -1
- package/dist/{as-multi-select.vue-CXC47PBk.d.cts → as-multi-select.vue-CGjTCFGD.d.mts} +1 -1
- package/dist/{as-number-CVjNUjiS.mjs → as-number-Ck8nNMCB.mjs} +5 -5
- package/dist/{as-number-CJmX5rb1.cjs → as-number-DKW_PZcq.cjs} +5 -5
- 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-BdNvLZca.d.mts → as-number.vue-AKk1tllp.d.mts} +1 -1
- package/dist/{as-number.vue-hJuiJJ70.d.cts → as-number.vue-i5gytLQ2.d.cts} +1 -1
- package/dist/{as-object-DY5IEc94.mjs → as-object-6GgXdo_K.mjs} +8 -8
- package/dist/{as-object-Dq5CPM3i.cjs → as-object-DfHzCJcJ.cjs} +8 -8
- 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-DHFGLetx.d.cts → as-object.vue-Gor6cnwh.d.mts} +1 -1
- package/dist/{as-object.vue-DVK_BKOL.d.mts → as-object.vue-cwrRrJ2O.d.cts} +1 -1
- package/dist/{as-paragraph-CaytophZ.cjs → as-paragraph-DHtc4LrM.cjs} +3 -3
- package/dist/{as-paragraph-ChOqmJe2.mjs → as-paragraph-ScTsCm_J.mjs} +3 -3
- package/dist/as-paragraph.cjs +1 -1
- package/dist/as-paragraph.d.cts +1 -1
- package/dist/as-paragraph.d.mts +1 -1
- package/dist/as-paragraph.mjs +1 -1
- package/dist/{as-paragraph.vue-6mBonWFb.d.mts → as-paragraph.vue-DqHrI7WD.d.mts} +1 -1
- package/dist/{as-paragraph.vue-B_aPmK-B.d.cts → as-paragraph.vue-Ds64gwEP.d.cts} +1 -1
- package/dist/{as-radio-BW9K8h6V.mjs → as-radio-Cc3VOm3A.mjs} +4 -4
- package/dist/{as-radio-C6PnEdjD.cjs → as-radio-DLGMEC9o.cjs} +4 -4
- 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-BFxeAHfl.d.mts → as-radio.vue-CkooFq0m.d.cts} +1 -1
- package/dist/{as-radio.vue-B_tDoVl1.d.cts → as-radio.vue-T0Ejt0II.d.mts} +1 -1
- package/dist/{as-ref-CXtYo-UZ.mjs → as-ref-Cs4i9tpS.mjs} +14 -14
- package/dist/{as-ref-DTsWT_zU.cjs → as-ref-FknTPCae.cjs} +14 -14
- 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-CqFDKTYk.d.mts → as-ref.vue-CCzEnDNd.d.cts} +1 -1
- package/dist/{as-ref.vue-gCsaCDQx.d.cts → as-ref.vue-CvStQFs3.d.mts} +1 -1
- package/dist/{as-select-DOvo86Oc.cjs → as-select-DBxxq0jZ.cjs} +7 -16
- package/dist/{as-select-CbZNupL6.mjs → as-select-br9EmsoX.mjs} +8 -17
- 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-BN3zvSGs.d.mts → as-select.vue-CK4AWxmk.d.cts} +1 -1
- package/dist/{as-select.vue-Bh7ppdg9.d.cts → as-select.vue-LKjJASjX.d.mts} +1 -1
- package/dist/{as-time-CfnhY3Pf.cjs → as-time-BmTk1YfU.cjs} +6 -6
- package/dist/{as-time-BDpnkjy8.mjs → as-time-DTz7PrnB.mjs} +6 -6
- 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-C-ruJhmX.d.mts → as-time.vue-DTRJCO4G.d.cts} +1 -1
- package/dist/{as-time.vue-C_0z-HOS.d.cts → as-time.vue-q2i-2K0N.d.mts} +1 -1
- package/dist/{as-tuple-C5_dcvsH.cjs → as-tuple-BemXpNrJ.cjs} +22 -14
- package/dist/{as-tuple--wL64cCu.mjs → as-tuple-D3IoTMkI.mjs} +23 -15
- 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-BDiSN-np.d.cts → as-tuple.vue-BEY7sq9x.d.cts} +1 -1
- package/dist/{as-tuple.vue-CGWun6Iw.d.mts → as-tuple.vue-CNgBlckL.d.mts} +1 -1
- package/dist/{as-union-DAnpGBeK.mjs → as-union-CIEUE2Xd.mjs} +32 -11
- package/dist/{as-union-D3NoKN1H.cjs → as-union-DqRkSoIr.cjs} +31 -10
- 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-BpcREl7L.d.mts → as-union.vue-B3KVCUUI.d.mts} +1 -1
- package/dist/{as-union.vue-DuUeLY1X.d.cts → as-union.vue-CGk27JvO.d.cts} +1 -1
- package/dist/{as-variant-picker-CihlFH-c.mjs → as-variant-picker-O_6JNWLk.mjs} +2 -2
- package/dist/{as-variant-picker-CpCxKFtT.cjs → as-variant-picker-apxtW5rZ.cjs} +2 -2
- package/dist/index.cjs +48 -28
- package/dist/index.d.cts +23 -23
- package/dist/index.d.mts +25 -25
- package/dist/index.mjs +31 -30
- package/dist/locale.cjs +2 -0
- package/dist/locale.d.cts +2 -2
- package/dist/locale.d.mts +2 -2
- package/dist/locale.mjs +2 -1
- package/dist/{types-271BUWyf.d.mts → types-BXTpoOfM.d.cts} +112 -17
- package/dist/{types-DbjorSCn.d.cts → types-CXGcf7sO.d.mts} +112 -17
- package/dist/{use-as-date-BigwPKEs.cjs → use-as-date-CpkJjcyB.cjs} +21 -17
- package/dist/{use-as-date-iSu5NS79.mjs → use-as-date-FsgcnN9l.mjs} +21 -17
- package/dist/{use-as-model-texts-Cpx5bHJQ.mjs → use-as-model-texts-D26kn80o.mjs} +1 -1
- package/dist/{use-as-model-texts-C3V56UDt.cjs → use-as-model-texts-DR4s80Mb.cjs} +1 -1
- package/dist/{use-as-value-help-CQMUkP1r.cjs → use-as-value-help-CIvYUvdk.cjs} +57 -29
- package/dist/{use-as-value-help-DE8KCbqo.mjs → use-as-value-help-b4tk3NRF.mjs} +53 -31
- 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/dist/{use-as-locale-D4NDG8Vg.d.mts → use-value-help-texts-BL1qfGA2.d.cts} +26 -2
- package/dist/use-value-help-texts-LySFdZya.mjs +52 -0
- package/dist/{use-as-locale-CtvT6oO5.d.cts → use-value-help-texts-fzgKU4NG.d.mts} +26 -2
- package/dist/use-value-help-texts-ikiPKy-U.cjs +57 -0
- package/package.json +9 -9
- /package/dist/{_editing-hold-D2uqwszu.cjs → _editing-hold-DbM25sc_.cjs} +0 -0
- /package/dist/{_editing-hold-D_X5gXHh.mjs → _editing-hold-s65mkJu2.mjs} +0 -0
- /package/dist/{_shape-A661ZxnJ.mjs → _shape-CnW2sBRs.mjs} +0 -0
- /package/dist/{_shape-7OdPsQao.cjs → _shape-DPDZTV_T.cjs} +0 -0
- /package/dist/{as-adornment-shell-CBaksXGT.mjs → as-adornment-shell-C_z_q-mz.mjs} +0 -0
- /package/dist/{as-adornment-shell-CmS9BOFm.cjs → as-adornment-shell-CgwCACXA.cjs} +0 -0
- /package/dist/{as-field.vue-BWaTLJd6.d.mts → as-field.vue-BMg2Ep8h.d.mts} +0 -0
- /package/dist/{as-iterator.vue-BUCohjxw.d.mts → as-iterator.vue-BdUxcovH.d.mts} +0 -0
- /package/dist/{use-as-optional-add-flow-DMDd4Ms0.cjs → use-as-optional-add-flow-CsUjhfkc.cjs} +0 -0
- /package/dist/{use-as-optional-add-flow-C1Ol6KO2.mjs → use-as-optional-add-flow-WA-R6yXz.mjs} +0 -0
- /package/dist/{variant-label-_GLezszT.cjs → variant-label-CSzBE4T6.cjs} +0 -0
- /package/dist/{variant-label-CmzTQC2B.mjs → variant-label-Drm3s-28.mjs} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as TFormState, S as TFormRule, d as TAsFormSubmitResult, f as TAsFormValue, g as UseAsDataReturn, l as TAsTypeComponents, r as TAsChangeType, s as TAsComponentProps, t as AsFormExposed, u as TAsUnionContext, v as TAsFormError } from "./types-CXGcf7sO.mjs";
|
|
2
2
|
import * as vue from "vue";
|
|
3
3
|
import { Component, ComputedRef, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef, WritableComputedRef } from "vue";
|
|
4
4
|
import * as _atscript_ui0 from "@atscript/ui";
|
|
5
|
-
import { ClientFactory, ClientFactory as ClientFactory$1, CreateFormDefOptions, FormArrayFieldDef, FormDef, FormDiffOptions as FormDiffOptions$1, FormFieldChange, FormFieldChange as FormFieldChange$1, FormFieldDef, FormRebaseOptions as FormRebaseOptions$1, FormTupleFieldDef, FormUnionFieldDef, FormUnionVariant, ResolvedValueHelp, TOptionalMode, TOptionalMode as TOptionalMode$1, TResolveOptions, TypedClientFactory, UI_FORM_OPTIONAL_MODE, UiT, UserTextT, ValueHelpInfo, ValueHelpScope, emptiedValue as emptiedValue$1, getDefaultClientFactory, getDefaultOptionalMode, hasFieldMeta as hasFieldMeta$1, isFieldHidden as isFieldHidden$1, joinPath as joinPath$1, resetDefaultClientFactory, resolveOptionalMode as resolveOptionalMode$1, setDefaultClientFactory, setDefaultOptionalMode } from "@atscript/ui";
|
|
5
|
+
import { ClientFactory, ClientFactory as ClientFactory$1, CreateFormDefOptions, FormArrayFieldDef, FormDef, FormDiffOptions as FormDiffOptions$1, FormFieldChange, FormFieldChange as FormFieldChange$1, FormFieldDef, FormRebaseOptions as FormRebaseOptions$1, FormTupleFieldDef, FormUnionFieldDef, FormUnionVariant, ResolvedValueHelp, TOptionalMode, TOptionalMode as TOptionalMode$1, TResolveOptions, TypedClientFactory, UI_FORM_OPTIONAL_MODE, UiT, UserTextT, ValueHelpInfo, ValueHelpScope, emptiedValue as emptiedValue$1, getDefaultClientFactory, getDefaultOptionalMode, hasFieldMeta as hasFieldMeta$1, isFieldDisabled as isFieldDisabled$1, isFieldHidden as isFieldHidden$1, isFieldReadonly as isFieldReadonly$1, isFieldRequired as isFieldRequired$1, joinPath as joinPath$1, resetDefaultClientFactory, resolveOptionalMode as resolveOptionalMode$1, setDefaultClientFactory, setDefaultOptionalMode } from "@atscript/ui";
|
|
6
6
|
import { TFnScope } from "@atscript/ui-fns";
|
|
7
7
|
import * as _atscript_typescript_utils0 from "@atscript/typescript/utils";
|
|
8
8
|
import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
|
|
@@ -72,7 +72,11 @@ interface UseAsFieldReturn<TValue = any> {
|
|
|
72
72
|
declare function useAsField<TValue = any, TFormData = any, TContext = any>(opts: UseAsFieldOptions<TValue, TFormData, TContext>): UseAsFieldReturn<TValue>;
|
|
73
73
|
//#endregion
|
|
74
74
|
//#region src/composables/use-as-state.d.ts
|
|
75
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* The form's validator, run by a submit. Returns `Record<path, message>`
|
|
77
|
+
* (empty = passed). It judges the fields `<AsField>` renders; the rules a
|
|
78
|
+
* control registers through `useAsField` run beside it.
|
|
79
|
+
*/
|
|
76
80
|
type TFormSubmitValidator = () => Record<string, string>;
|
|
77
81
|
interface UseAsStateReturn {
|
|
78
82
|
formState: TFormState;
|
|
@@ -93,8 +97,19 @@ interface UseAsStateReturn {
|
|
|
93
97
|
declare function useAsState<TFormData, TContext>(opts: {
|
|
94
98
|
formData: MaybeRef<TFormData>;
|
|
95
99
|
formContext?: MaybeRef<TContext>;
|
|
96
|
-
firstValidation?: MaybeRef<TFormState["firstValidation"] | undefined>;
|
|
100
|
+
firstValidation?: MaybeRef<TFormState["firstValidation"] | undefined>;
|
|
101
|
+
/**
|
|
102
|
+
* The form's validator: a submit runs it, then the rules of every
|
|
103
|
+
* registered field it does not judge (a control's own `useAsField` rules).
|
|
104
|
+
* Without it, a submit runs every registered field's rules.
|
|
105
|
+
*/
|
|
97
106
|
submitValidator?: TFormSubmitValidator;
|
|
107
|
+
/**
|
|
108
|
+
* The client factory dictionary texts are read with (`formState.displayText`):
|
|
109
|
+
* the form's. Default: the one the form's pickers use — provided above it
|
|
110
|
+
* (`CLIENT_FACTORY_KEY`), else the app-wide one. Since 0.1.207.
|
|
111
|
+
*/
|
|
112
|
+
clientFactory?: ClientFactory;
|
|
98
113
|
}): UseAsStateReturn;
|
|
99
114
|
//#endregion
|
|
100
115
|
//#region src/composables/use-as-external-errors.d.ts
|
|
@@ -181,7 +196,12 @@ interface UseAsTupleReturn {
|
|
|
181
196
|
clear: () => void;
|
|
182
197
|
fillMissing: () => void;
|
|
183
198
|
}
|
|
184
|
-
/**
|
|
199
|
+
/**
|
|
200
|
+
* Composable for managing tuple field state. Fixed-length, position-typed; auto-fills missing
|
|
201
|
+
* positions on mount unless optional. A locked tuple — disabled or read-only, its own or a
|
|
202
|
+
* parent's (as `useAsArray`) — is neither filled nor cleared: `clear` / `fillMissing` do nothing;
|
|
203
|
+
* a required one is filled when its lock lifts.
|
|
204
|
+
*/
|
|
185
205
|
declare function useAsTuple(field: FormTupleFieldDef): UseAsTupleReturn;
|
|
186
206
|
//#endregion
|
|
187
207
|
//#region src/composables/use-as-union.d.ts
|
|
@@ -193,7 +213,11 @@ interface UseAsUnionReturn {
|
|
|
193
213
|
changeVariant: (newIndex: number) => void;
|
|
194
214
|
optionalEnabled: ComputedRef<boolean>;
|
|
195
215
|
}
|
|
196
|
-
/**
|
|
216
|
+
/**
|
|
217
|
+
* Composable for union field state. Switching variants stashes per-index data so toggling back
|
|
218
|
+
* restores user's work instead of fresh defaults. A locked union — disabled or read-only, its
|
|
219
|
+
* own or a parent's (as `useAsArray`) — keeps its variant: `changeVariant` does nothing.
|
|
220
|
+
*/
|
|
197
221
|
declare function useAsUnion(props: TAsComponentProps): UseAsUnionReturn;
|
|
198
222
|
//#endregion
|
|
199
223
|
//#region src/composables/use-form-context.d.ts
|
|
@@ -239,7 +263,6 @@ interface UseAsValueHelpReturn {
|
|
|
239
263
|
searchText: Ref<string>;
|
|
240
264
|
results: ShallowRef<Record<string, unknown>[]>;
|
|
241
265
|
searching: Ref<boolean>;
|
|
242
|
-
labelIsFkValue: ComputedRef<boolean>;
|
|
243
266
|
kickoff: () => Promise<void>;
|
|
244
267
|
/**
|
|
245
268
|
* The one pick path: commits `item[info.targetField]`, writes the binding's
|
|
@@ -402,7 +425,8 @@ interface UseAsOptionalFieldReturn {
|
|
|
402
425
|
/**
|
|
403
426
|
* Enable (initialize with annotated defaults, like AsField's optional
|
|
404
427
|
* toggle) or disable (clear to `undefined`) the field. Emits the
|
|
405
|
-
* blur-committed `update` change for the field's absolute path.
|
|
428
|
+
* blur-committed `update` change for the field's absolute path. Does
|
|
429
|
+
* nothing inside a disabled or read-only structured field (as `useAsArray`).
|
|
406
430
|
*/
|
|
407
431
|
toggle: (enabled: boolean) => void;
|
|
408
432
|
}
|
|
@@ -593,15 +617,16 @@ interface UseAsDecimalOptions {
|
|
|
593
617
|
/** Read the current value. Storage shape is preserved on commit. */
|
|
594
618
|
modelValue: () => string | number | null | undefined;
|
|
595
619
|
/**
|
|
596
|
-
*
|
|
597
|
-
* to
|
|
598
|
-
*
|
|
620
|
+
* The declared display + edit scale (`TAsComponentProps.scale`). The input
|
|
621
|
+
* widens it to the digits the value holds, up to `storageScale` when set; a typed
|
|
622
|
+
* value is cut to that (a paste of "10.99" into a JPY field holding a whole
|
|
623
|
+
* amount keeps "10").
|
|
599
624
|
*/
|
|
600
625
|
scale?: () => number | undefined;
|
|
601
626
|
/**
|
|
602
627
|
* Storage cap (DB column scale). Outgoing strings are padded to this
|
|
603
628
|
* regardless of `scale` — display can be tighter than storage. When
|
|
604
|
-
* absent,
|
|
629
|
+
* absent, nothing caps the value's digits.
|
|
605
630
|
*/
|
|
606
631
|
storageScale?: () => number | undefined;
|
|
607
632
|
/** Locale override; defaults to `useAsLocale()` then runtime locale. */
|
|
@@ -610,9 +635,13 @@ interface UseAsDecimalOptions {
|
|
|
610
635
|
onCommit: (value: string | number | null) => void;
|
|
611
636
|
}
|
|
612
637
|
interface UseAsDecimalReturn {
|
|
613
|
-
/**
|
|
638
|
+
/**
|
|
639
|
+
* Effective display + edit scale: the declared `scale` (else `storageScale`,
|
|
640
|
+
* else 2), widened to the digits the value holds, up to `storageScale` when set — a
|
|
641
|
+
* stored digit is never cut on display or edit.
|
|
642
|
+
*/
|
|
614
643
|
scale: ComputedRef<number>;
|
|
615
|
-
/** Storage cap (always populated; falls back to effective scale
|
|
644
|
+
/** Storage cap (always populated; falls back to the effective `scale`). */
|
|
616
645
|
storageScale: ComputedRef<number>;
|
|
617
646
|
decimalSeparator: ComputedRef<string>;
|
|
618
647
|
thousandsSeparator: ComputedRef<string>;
|
|
@@ -641,9 +670,11 @@ interface UseAsDecimalReturn {
|
|
|
641
670
|
*
|
|
642
671
|
* Storage shape is preserved on commit — string `modelValue` commits a
|
|
643
672
|
* string padded to `storageScale`; number `modelValue` commits a number.
|
|
644
|
-
* A
|
|
645
|
-
*
|
|
646
|
-
*
|
|
673
|
+
* A stored digit is never cut: a value with more digits than `scale` shows
|
|
674
|
+
* and edits with them, up to `storageScale` when one is set (as a table cell
|
|
675
|
+
* shows it). A `scale` that shrinks below the model's precision while the
|
|
676
|
+
* model stays (a switch to a currency with fewer digits) re-rounds +
|
|
677
|
+
* re-commits it; a new model arriving with it (a load) is kept.
|
|
647
678
|
*/
|
|
648
679
|
declare function useAsDecimal(opts: UseAsDecimalOptions): UseAsDecimalReturn;
|
|
649
680
|
//#endregion
|
|
@@ -776,8 +807,9 @@ interface UseAsDateReturn {
|
|
|
776
807
|
*
|
|
777
808
|
* - `'date'`: epoch-ms ↔ `YYYY-MM-DD` (local TZ).
|
|
778
809
|
* Empty input commits `null`. A string-stored field (`prop`) or one
|
|
779
|
-
* holding a `string` commits a string (`YYYY-MM-DD`); otherwise epoch-ms
|
|
780
|
-
* midnight
|
|
810
|
+
* holding a `string` commits a string (`YYYY-MM-DD`); otherwise epoch-ms
|
|
811
|
+
* (local midnight of the picked day, so it reads back as that day). A
|
|
812
|
+
* date-only value shows its calendar day in every zone (`toDate`).
|
|
781
813
|
* - `'datetime'`: epoch-ms ↔ `YYYY-MM-DDTHH:mm` (local TZ).
|
|
782
814
|
* - `'time'`: prev-string ↔ `HH:mm`. Numeric storage isn't meaningful
|
|
783
815
|
* for naked time-of-day, so we commit a string.
|
|
@@ -806,40 +838,6 @@ interface UseAsTypeMapReturn {
|
|
|
806
838
|
*/
|
|
807
839
|
declare function useAsTypeMap(): UseAsTypeMapReturn;
|
|
808
840
|
//#endregion
|
|
809
|
-
//#region src/composables/use-as-data.d.ts
|
|
810
|
-
interface UseAsDataReturn {
|
|
811
|
-
/** Domain data (the unwrapped inner value of the form's `{ value }` container). */
|
|
812
|
-
rootData: ComputedRef<unknown>;
|
|
813
|
-
/** Read the value at an absolute dotted path inside the form. */
|
|
814
|
-
getValueAt: (path: string) => ComputedRef<unknown>;
|
|
815
|
-
/** Read a sibling field's value relative to the current `useAsPath()` prefix. */
|
|
816
|
-
siblingValue: <T = unknown>(name: string) => ComputedRef<T | undefined>;
|
|
817
|
-
/**
|
|
818
|
-
* Write the value at an absolute dotted path inside the form (missing
|
|
819
|
-
* containers are created: an array where the next segment is an index,
|
|
820
|
-
* else an object; an empty form root too). The write is a committed edit:
|
|
821
|
-
* change tracking sees it, the field at that path re-validates like one the
|
|
822
|
-
* user changed, and `AsForm` emits `change` with type `"update"`. Outside a
|
|
823
|
-
* form, a no-op.
|
|
824
|
-
*/
|
|
825
|
-
setValueAt: (path: string, value: unknown) => void;
|
|
826
|
-
/**
|
|
827
|
-
* Write a sibling field's value, relative to the current `useAsPath()`
|
|
828
|
-
* prefix — e.g. a custom picker filling the fields next to it. Same rules
|
|
829
|
-
* as `setValueAt`.
|
|
830
|
-
*/
|
|
831
|
-
setSibling: (name: string, value: unknown) => void;
|
|
832
|
-
}
|
|
833
|
-
/**
|
|
834
|
-
* Reactive access to form data at any point in the `<AsForm>` tree: readers
|
|
835
|
-
* plus `setValueAt` / `setSibling` writers. Outside a form, all readers
|
|
836
|
-
* return `undefined` and the writers do nothing.
|
|
837
|
-
*
|
|
838
|
-
* Call sites get a `ComputedRef` so they can compose it directly with
|
|
839
|
-
* other reactive primitives without an extra `computed()` wrapper.
|
|
840
|
-
*/
|
|
841
|
-
declare function useAsData(): UseAsDataReturn;
|
|
842
|
-
//#endregion
|
|
843
841
|
//#region src/composables/use-as-error-dismiss.d.ts
|
|
844
842
|
/**
|
|
845
843
|
* Imperative dismissal of an external (server-supplied) error at a given
|
|
@@ -945,6 +943,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
945
943
|
loading: boolean;
|
|
946
944
|
submitText: string;
|
|
947
945
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
946
|
+
action: (name: string) => void;
|
|
948
947
|
clearErrors: () => void;
|
|
949
948
|
setErrors: (errors: Record<string, string>) => void;
|
|
950
949
|
dismissError: (path: string) => void;
|
|
@@ -955,6 +954,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
955
954
|
getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
|
|
956
955
|
getChanges: () => FormFieldChange[];
|
|
957
956
|
isDirtyPath: (path: string) => boolean;
|
|
957
|
+
displayText: UseAsDataReturn["displayText"];
|
|
958
958
|
}) => any;
|
|
959
959
|
} & {
|
|
960
960
|
'form.before'?: (props: {
|
|
@@ -969,6 +969,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
969
969
|
loading: boolean;
|
|
970
970
|
submitText: string;
|
|
971
971
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
972
|
+
action: (name: string) => void;
|
|
972
973
|
clearErrors: () => void;
|
|
973
974
|
setErrors: (errors: Record<string, string>) => void;
|
|
974
975
|
dismissError: (path: string) => void;
|
|
@@ -979,6 +980,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
979
980
|
getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
|
|
980
981
|
getChanges: () => FormFieldChange[];
|
|
981
982
|
isDirtyPath: (path: string) => boolean;
|
|
983
|
+
displayText: UseAsDataReturn["displayText"];
|
|
982
984
|
}) => any;
|
|
983
985
|
} & {
|
|
984
986
|
'form.after'?: (props: {
|
|
@@ -993,6 +995,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
993
995
|
loading: boolean;
|
|
994
996
|
submitText: string;
|
|
995
997
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
998
|
+
action: (name: string) => void;
|
|
996
999
|
clearErrors: () => void;
|
|
997
1000
|
setErrors: (errors: Record<string, string>) => void;
|
|
998
1001
|
dismissError: (path: string) => void;
|
|
@@ -1003,6 +1006,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1003
1006
|
getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
|
|
1004
1007
|
getChanges: () => FormFieldChange[];
|
|
1005
1008
|
isDirtyPath: (path: string) => boolean;
|
|
1009
|
+
displayText: UseAsDataReturn["displayText"];
|
|
1006
1010
|
}) => any;
|
|
1007
1011
|
} & {
|
|
1008
1012
|
'form.error'?: (props: {
|
|
@@ -1019,6 +1023,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1019
1023
|
loading: boolean;
|
|
1020
1024
|
submitText: string;
|
|
1021
1025
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
1026
|
+
action: (name: string) => void;
|
|
1022
1027
|
clearErrors: () => void;
|
|
1023
1028
|
setErrors: (errors: Record<string, string>) => void;
|
|
1024
1029
|
dismissError: (path: string) => void;
|
|
@@ -1029,6 +1034,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1029
1034
|
getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
|
|
1030
1035
|
getChanges: () => FormFieldChange[];
|
|
1031
1036
|
isDirtyPath: (path: string) => boolean;
|
|
1037
|
+
displayText: UseAsDataReturn["displayText"];
|
|
1032
1038
|
}) => any;
|
|
1033
1039
|
} & {
|
|
1034
1040
|
'form.submit'?: (props: {
|
|
@@ -1044,6 +1050,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1044
1050
|
loading: boolean;
|
|
1045
1051
|
submitText: string;
|
|
1046
1052
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
1053
|
+
action: (name: string) => void;
|
|
1047
1054
|
clearErrors: () => void;
|
|
1048
1055
|
setErrors: (errors: Record<string, string>) => void;
|
|
1049
1056
|
dismissError: (path: string) => void;
|
|
@@ -1054,6 +1061,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1054
1061
|
getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
|
|
1055
1062
|
getChanges: () => FormFieldChange[];
|
|
1056
1063
|
isDirtyPath: (path: string) => boolean;
|
|
1064
|
+
displayText: UseAsDataReturn["displayText"];
|
|
1057
1065
|
}) => any;
|
|
1058
1066
|
} & {
|
|
1059
1067
|
'form.footer'?: (props: {
|
|
@@ -1068,6 +1076,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1068
1076
|
loading: boolean;
|
|
1069
1077
|
submitText: string;
|
|
1070
1078
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
1079
|
+
action: (name: string) => void;
|
|
1071
1080
|
clearErrors: () => void;
|
|
1072
1081
|
setErrors: (errors: Record<string, string>) => void;
|
|
1073
1082
|
dismissError: (path: string) => void;
|
|
@@ -1078,6 +1087,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1078
1087
|
getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
|
|
1079
1088
|
getChanges: () => FormFieldChange[];
|
|
1080
1089
|
isDirtyPath: (path: string) => boolean;
|
|
1090
|
+
displayText: UseAsDataReturn["displayText"];
|
|
1081
1091
|
}) => any;
|
|
1082
1092
|
} & {
|
|
1083
1093
|
'form.loading'?: (props: {
|
|
@@ -1092,6 +1102,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1092
1102
|
loading: boolean;
|
|
1093
1103
|
submitText: string;
|
|
1094
1104
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
1105
|
+
action: (name: string) => void;
|
|
1095
1106
|
clearErrors: () => void;
|
|
1096
1107
|
setErrors: (errors: Record<string, string>) => void;
|
|
1097
1108
|
dismissError: (path: string) => void;
|
|
@@ -1102,6 +1113,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1102
1113
|
getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
|
|
1103
1114
|
getChanges: () => FormFieldChange[];
|
|
1104
1115
|
isDirtyPath: (path: string) => boolean;
|
|
1116
|
+
displayText: UseAsDataReturn["displayText"];
|
|
1105
1117
|
}) => any;
|
|
1106
1118
|
};
|
|
1107
1119
|
emit: {
|
|
@@ -1117,4 +1129,4 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1117
1129
|
declare const _default: typeof __VLS_export;
|
|
1118
1130
|
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K] } : { [K in keyof T as K]: T[K] }) & {};
|
|
1119
1131
|
//#endregion
|
|
1120
|
-
export {
|
|
1132
|
+
export { UseAsOptionalFieldReturn as $, UseAsDateReturn as A, useAsField as At, useAsDecimal as B, AsErrorDismiss as C, UseAsExternalErrorsReturn as Ct, UseAsPathReturn as D, useAsState as Dt, useAsTypeMap as E, UseAsStateReturn as Et, UseAsNumberOptions as F, useAsTriStateCheckbox as G, useAsModelTexts as H, UseAsNumberReturn as I, useAsOptionalAddFlow as J, UseAsOptionalAddFlowOptions as K, useAsNumber as L, UseAsDualInputOptions as M, createAsFormDef as Mt, UseAsDualInputReturn as N, useAsPath as O, UseAsFieldOptions as Ot, useAsDualInput as P, useAsVisibleFields as Q, UseAsDecimalOptions as R, setDefaultOptionalMode as S, UseAsExternalErrorsOptions as St, UseAsTypeMapReturn as T, TFormSubmitValidator as Tt, UseAsTriStateCheckboxOptions as U, variantLabel as V, UseAsTriStateCheckboxReturn as W, focusNewFocusableAfter as X, focusFirstAfter as Y, useAsFocusFirstAfter as Z, isFieldRequired$1 as _, useAsUnion as _t, FormFieldChange$1 as a, useAsLevel as at, resolveOptionalMode$1 as b, UseAsArrayReturn as bt, TypedClientFactory as c, useAsDescendantErrorCounts as ct, getDefaultClientFactory as d, UseAsValueHelpOptions as dt, useAsOptionalField as et, getDefaultOptionalMode as f, UseAsValueHelpReturn as ft, isFieldReadonly$1 as g, UseAsUnionReturn as gt, isFieldHidden$1 as h, useAsUnionVariant as ht, FormDiffOptions$1 as i, provideAsNestedLevel as it, useAsDate as j, createDefaultTypes as jt, UseAsDateOptions as k, UseAsFieldReturn as kt, UI_FORM_OPTIONAL_MODE as l, useAsNestedSectionsStore as lt, isFieldDisabled$1 as m, formatIndexedLabelParts as mt, _default as n, UseAsFieldScopeReturn as nt, FormRebaseOptions$1 as o, AsNestedSectionsStore as ot, hasFieldMeta$1 as p, useAsValueHelp as pt, UseAsOptionalAddFlowReturn as q, ClientFactory$1 as r, useAsFieldScope as rt, TOptionalMode$1 as s, provideAsNestedSectionsStore as st, Props as t, TResolveFieldPropOptions as tt, emptiedValue$1 as u, useAsDropdown as ut, joinPath$1 as v, UseAsTupleReturn as vt, useAsErrorDismiss as w, useAsExternalErrors as wt, setDefaultClientFactory as x, useAsArray as xt, resetDefaultClientFactory as y, useAsTuple as yt, UseAsDecimalReturn as z };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as TFormState, S as TFormRule, d as TAsFormSubmitResult, f as TAsFormValue, g as UseAsDataReturn, l as TAsTypeComponents, r as TAsChangeType, s as TAsComponentProps, t as AsFormExposed, u as TAsUnionContext, v as TAsFormError } from "./types-BXTpoOfM.cjs";
|
|
2
2
|
import * as vue from "vue";
|
|
3
3
|
import { Component, ComputedRef, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef, WritableComputedRef } from "vue";
|
|
4
4
|
import * as _atscript_ui0 from "@atscript/ui";
|
|
5
|
-
import { ClientFactory, ClientFactory as ClientFactory$1, CreateFormDefOptions, FormArrayFieldDef, FormDef, FormDiffOptions as FormDiffOptions$1, FormFieldChange, FormFieldChange as FormFieldChange$1, FormFieldDef, FormRebaseOptions as FormRebaseOptions$1, FormTupleFieldDef, FormUnionFieldDef, FormUnionVariant, ResolvedValueHelp, TOptionalMode, TOptionalMode as TOptionalMode$1, TResolveOptions, TypedClientFactory, UI_FORM_OPTIONAL_MODE, UiT, UserTextT, ValueHelpInfo, ValueHelpScope, emptiedValue, getDefaultClientFactory, getDefaultOptionalMode, hasFieldMeta, isFieldHidden, joinPath, resetDefaultClientFactory, resolveOptionalMode, setDefaultClientFactory, setDefaultOptionalMode } from "@atscript/ui";
|
|
5
|
+
import { ClientFactory, ClientFactory as ClientFactory$1, CreateFormDefOptions, FormArrayFieldDef, FormDef, FormDiffOptions as FormDiffOptions$1, FormFieldChange, FormFieldChange as FormFieldChange$1, FormFieldDef, FormRebaseOptions as FormRebaseOptions$1, FormTupleFieldDef, FormUnionFieldDef, FormUnionVariant, ResolvedValueHelp, TOptionalMode, TOptionalMode as TOptionalMode$1, TResolveOptions, TypedClientFactory, UI_FORM_OPTIONAL_MODE, UiT, UserTextT, ValueHelpInfo, ValueHelpScope, emptiedValue, getDefaultClientFactory, getDefaultOptionalMode, hasFieldMeta, isFieldDisabled, isFieldHidden, isFieldReadonly, isFieldRequired, joinPath, resetDefaultClientFactory, resolveOptionalMode, setDefaultClientFactory, setDefaultOptionalMode } from "@atscript/ui";
|
|
6
6
|
import * as _atscript_typescript_utils0 from "@atscript/typescript/utils";
|
|
7
7
|
import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
|
|
8
8
|
import { TFnScope } from "@atscript/ui-fns";
|
|
@@ -72,7 +72,11 @@ interface UseAsFieldReturn<TValue = any> {
|
|
|
72
72
|
declare function useAsField<TValue = any, TFormData = any, TContext = any>(opts: UseAsFieldOptions<TValue, TFormData, TContext>): UseAsFieldReturn<TValue>;
|
|
73
73
|
//#endregion
|
|
74
74
|
//#region src/composables/use-as-state.d.ts
|
|
75
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* The form's validator, run by a submit. Returns `Record<path, message>`
|
|
77
|
+
* (empty = passed). It judges the fields `<AsField>` renders; the rules a
|
|
78
|
+
* control registers through `useAsField` run beside it.
|
|
79
|
+
*/
|
|
76
80
|
type TFormSubmitValidator = () => Record<string, string>;
|
|
77
81
|
interface UseAsStateReturn {
|
|
78
82
|
formState: TFormState;
|
|
@@ -93,8 +97,19 @@ interface UseAsStateReturn {
|
|
|
93
97
|
declare function useAsState<TFormData, TContext>(opts: {
|
|
94
98
|
formData: MaybeRef<TFormData>;
|
|
95
99
|
formContext?: MaybeRef<TContext>;
|
|
96
|
-
firstValidation?: MaybeRef<TFormState["firstValidation"] | undefined>;
|
|
100
|
+
firstValidation?: MaybeRef<TFormState["firstValidation"] | undefined>;
|
|
101
|
+
/**
|
|
102
|
+
* The form's validator: a submit runs it, then the rules of every
|
|
103
|
+
* registered field it does not judge (a control's own `useAsField` rules).
|
|
104
|
+
* Without it, a submit runs every registered field's rules.
|
|
105
|
+
*/
|
|
97
106
|
submitValidator?: TFormSubmitValidator;
|
|
107
|
+
/**
|
|
108
|
+
* The client factory dictionary texts are read with (`formState.displayText`):
|
|
109
|
+
* the form's. Default: the one the form's pickers use — provided above it
|
|
110
|
+
* (`CLIENT_FACTORY_KEY`), else the app-wide one. Since 0.1.207.
|
|
111
|
+
*/
|
|
112
|
+
clientFactory?: ClientFactory;
|
|
98
113
|
}): UseAsStateReturn;
|
|
99
114
|
//#endregion
|
|
100
115
|
//#region src/composables/use-as-external-errors.d.ts
|
|
@@ -181,7 +196,12 @@ interface UseAsTupleReturn {
|
|
|
181
196
|
clear: () => void;
|
|
182
197
|
fillMissing: () => void;
|
|
183
198
|
}
|
|
184
|
-
/**
|
|
199
|
+
/**
|
|
200
|
+
* Composable for managing tuple field state. Fixed-length, position-typed; auto-fills missing
|
|
201
|
+
* positions on mount unless optional. A locked tuple — disabled or read-only, its own or a
|
|
202
|
+
* parent's (as `useAsArray`) — is neither filled nor cleared: `clear` / `fillMissing` do nothing;
|
|
203
|
+
* a required one is filled when its lock lifts.
|
|
204
|
+
*/
|
|
185
205
|
declare function useAsTuple(field: FormTupleFieldDef): UseAsTupleReturn;
|
|
186
206
|
//#endregion
|
|
187
207
|
//#region src/composables/use-as-union.d.ts
|
|
@@ -193,7 +213,11 @@ interface UseAsUnionReturn {
|
|
|
193
213
|
changeVariant: (newIndex: number) => void;
|
|
194
214
|
optionalEnabled: ComputedRef<boolean>;
|
|
195
215
|
}
|
|
196
|
-
/**
|
|
216
|
+
/**
|
|
217
|
+
* Composable for union field state. Switching variants stashes per-index data so toggling back
|
|
218
|
+
* restores user's work instead of fresh defaults. A locked union — disabled or read-only, its
|
|
219
|
+
* own or a parent's (as `useAsArray`) — keeps its variant: `changeVariant` does nothing.
|
|
220
|
+
*/
|
|
197
221
|
declare function useAsUnion(props: TAsComponentProps): UseAsUnionReturn;
|
|
198
222
|
//#endregion
|
|
199
223
|
//#region src/composables/use-form-context.d.ts
|
|
@@ -239,7 +263,6 @@ interface UseAsValueHelpReturn {
|
|
|
239
263
|
searchText: Ref<string>;
|
|
240
264
|
results: ShallowRef<Record<string, unknown>[]>;
|
|
241
265
|
searching: Ref<boolean>;
|
|
242
|
-
labelIsFkValue: ComputedRef<boolean>;
|
|
243
266
|
kickoff: () => Promise<void>;
|
|
244
267
|
/**
|
|
245
268
|
* The one pick path: commits `item[info.targetField]`, writes the binding's
|
|
@@ -402,7 +425,8 @@ interface UseAsOptionalFieldReturn {
|
|
|
402
425
|
/**
|
|
403
426
|
* Enable (initialize with annotated defaults, like AsField's optional
|
|
404
427
|
* toggle) or disable (clear to `undefined`) the field. Emits the
|
|
405
|
-
* blur-committed `update` change for the field's absolute path.
|
|
428
|
+
* blur-committed `update` change for the field's absolute path. Does
|
|
429
|
+
* nothing inside a disabled or read-only structured field (as `useAsArray`).
|
|
406
430
|
*/
|
|
407
431
|
toggle: (enabled: boolean) => void;
|
|
408
432
|
}
|
|
@@ -593,15 +617,16 @@ interface UseAsDecimalOptions {
|
|
|
593
617
|
/** Read the current value. Storage shape is preserved on commit. */
|
|
594
618
|
modelValue: () => string | number | null | undefined;
|
|
595
619
|
/**
|
|
596
|
-
*
|
|
597
|
-
* to
|
|
598
|
-
*
|
|
620
|
+
* The declared display + edit scale (`TAsComponentProps.scale`). The input
|
|
621
|
+
* widens it to the digits the value holds, up to `storageScale` when set; a typed
|
|
622
|
+
* value is cut to that (a paste of "10.99" into a JPY field holding a whole
|
|
623
|
+
* amount keeps "10").
|
|
599
624
|
*/
|
|
600
625
|
scale?: () => number | undefined;
|
|
601
626
|
/**
|
|
602
627
|
* Storage cap (DB column scale). Outgoing strings are padded to this
|
|
603
628
|
* regardless of `scale` — display can be tighter than storage. When
|
|
604
|
-
* absent,
|
|
629
|
+
* absent, nothing caps the value's digits.
|
|
605
630
|
*/
|
|
606
631
|
storageScale?: () => number | undefined;
|
|
607
632
|
/** Locale override; defaults to `useAsLocale()` then runtime locale. */
|
|
@@ -610,9 +635,13 @@ interface UseAsDecimalOptions {
|
|
|
610
635
|
onCommit: (value: string | number | null) => void;
|
|
611
636
|
}
|
|
612
637
|
interface UseAsDecimalReturn {
|
|
613
|
-
/**
|
|
638
|
+
/**
|
|
639
|
+
* Effective display + edit scale: the declared `scale` (else `storageScale`,
|
|
640
|
+
* else 2), widened to the digits the value holds, up to `storageScale` when set — a
|
|
641
|
+
* stored digit is never cut on display or edit.
|
|
642
|
+
*/
|
|
614
643
|
scale: ComputedRef<number>;
|
|
615
|
-
/** Storage cap (always populated; falls back to effective scale
|
|
644
|
+
/** Storage cap (always populated; falls back to the effective `scale`). */
|
|
616
645
|
storageScale: ComputedRef<number>;
|
|
617
646
|
decimalSeparator: ComputedRef<string>;
|
|
618
647
|
thousandsSeparator: ComputedRef<string>;
|
|
@@ -641,9 +670,11 @@ interface UseAsDecimalReturn {
|
|
|
641
670
|
*
|
|
642
671
|
* Storage shape is preserved on commit — string `modelValue` commits a
|
|
643
672
|
* string padded to `storageScale`; number `modelValue` commits a number.
|
|
644
|
-
* A
|
|
645
|
-
*
|
|
646
|
-
*
|
|
673
|
+
* A stored digit is never cut: a value with more digits than `scale` shows
|
|
674
|
+
* and edits with them, up to `storageScale` when one is set (as a table cell
|
|
675
|
+
* shows it). A `scale` that shrinks below the model's precision while the
|
|
676
|
+
* model stays (a switch to a currency with fewer digits) re-rounds +
|
|
677
|
+
* re-commits it; a new model arriving with it (a load) is kept.
|
|
647
678
|
*/
|
|
648
679
|
declare function useAsDecimal(opts: UseAsDecimalOptions): UseAsDecimalReturn;
|
|
649
680
|
//#endregion
|
|
@@ -776,8 +807,9 @@ interface UseAsDateReturn {
|
|
|
776
807
|
*
|
|
777
808
|
* - `'date'`: epoch-ms ↔ `YYYY-MM-DD` (local TZ).
|
|
778
809
|
* Empty input commits `null`. A string-stored field (`prop`) or one
|
|
779
|
-
* holding a `string` commits a string (`YYYY-MM-DD`); otherwise epoch-ms
|
|
780
|
-
* midnight
|
|
810
|
+
* holding a `string` commits a string (`YYYY-MM-DD`); otherwise epoch-ms
|
|
811
|
+
* (local midnight of the picked day, so it reads back as that day). A
|
|
812
|
+
* date-only value shows its calendar day in every zone (`toDate`).
|
|
781
813
|
* - `'datetime'`: epoch-ms ↔ `YYYY-MM-DDTHH:mm` (local TZ).
|
|
782
814
|
* - `'time'`: prev-string ↔ `HH:mm`. Numeric storage isn't meaningful
|
|
783
815
|
* for naked time-of-day, so we commit a string.
|
|
@@ -806,40 +838,6 @@ interface UseAsTypeMapReturn {
|
|
|
806
838
|
*/
|
|
807
839
|
declare function useAsTypeMap(): UseAsTypeMapReturn;
|
|
808
840
|
//#endregion
|
|
809
|
-
//#region src/composables/use-as-data.d.ts
|
|
810
|
-
interface UseAsDataReturn {
|
|
811
|
-
/** Domain data (the unwrapped inner value of the form's `{ value }` container). */
|
|
812
|
-
rootData: ComputedRef<unknown>;
|
|
813
|
-
/** Read the value at an absolute dotted path inside the form. */
|
|
814
|
-
getValueAt: (path: string) => ComputedRef<unknown>;
|
|
815
|
-
/** Read a sibling field's value relative to the current `useAsPath()` prefix. */
|
|
816
|
-
siblingValue: <T = unknown>(name: string) => ComputedRef<T | undefined>;
|
|
817
|
-
/**
|
|
818
|
-
* Write the value at an absolute dotted path inside the form (missing
|
|
819
|
-
* containers are created: an array where the next segment is an index,
|
|
820
|
-
* else an object; an empty form root too). The write is a committed edit:
|
|
821
|
-
* change tracking sees it, the field at that path re-validates like one the
|
|
822
|
-
* user changed, and `AsForm` emits `change` with type `"update"`. Outside a
|
|
823
|
-
* form, a no-op.
|
|
824
|
-
*/
|
|
825
|
-
setValueAt: (path: string, value: unknown) => void;
|
|
826
|
-
/**
|
|
827
|
-
* Write a sibling field's value, relative to the current `useAsPath()`
|
|
828
|
-
* prefix — e.g. a custom picker filling the fields next to it. Same rules
|
|
829
|
-
* as `setValueAt`.
|
|
830
|
-
*/
|
|
831
|
-
setSibling: (name: string, value: unknown) => void;
|
|
832
|
-
}
|
|
833
|
-
/**
|
|
834
|
-
* Reactive access to form data at any point in the `<AsForm>` tree: readers
|
|
835
|
-
* plus `setValueAt` / `setSibling` writers. Outside a form, all readers
|
|
836
|
-
* return `undefined` and the writers do nothing.
|
|
837
|
-
*
|
|
838
|
-
* Call sites get a `ComputedRef` so they can compose it directly with
|
|
839
|
-
* other reactive primitives without an extra `computed()` wrapper.
|
|
840
|
-
*/
|
|
841
|
-
declare function useAsData(): UseAsDataReturn;
|
|
842
|
-
//#endregion
|
|
843
841
|
//#region src/composables/use-as-error-dismiss.d.ts
|
|
844
842
|
/**
|
|
845
843
|
* Imperative dismissal of an external (server-supplied) error at a given
|
|
@@ -945,6 +943,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
945
943
|
loading: boolean;
|
|
946
944
|
submitText: string;
|
|
947
945
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
946
|
+
action: (name: string) => void;
|
|
948
947
|
clearErrors: () => void;
|
|
949
948
|
setErrors: (errors: Record<string, string>) => void;
|
|
950
949
|
dismissError: (path: string) => void;
|
|
@@ -955,6 +954,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
955
954
|
getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
|
|
956
955
|
getChanges: () => FormFieldChange[];
|
|
957
956
|
isDirtyPath: (path: string) => boolean;
|
|
957
|
+
displayText: UseAsDataReturn["displayText"];
|
|
958
958
|
}) => any;
|
|
959
959
|
} & {
|
|
960
960
|
'form.before'?: (props: {
|
|
@@ -969,6 +969,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
969
969
|
loading: boolean;
|
|
970
970
|
submitText: string;
|
|
971
971
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
972
|
+
action: (name: string) => void;
|
|
972
973
|
clearErrors: () => void;
|
|
973
974
|
setErrors: (errors: Record<string, string>) => void;
|
|
974
975
|
dismissError: (path: string) => void;
|
|
@@ -979,6 +980,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
979
980
|
getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
|
|
980
981
|
getChanges: () => FormFieldChange[];
|
|
981
982
|
isDirtyPath: (path: string) => boolean;
|
|
983
|
+
displayText: UseAsDataReturn["displayText"];
|
|
982
984
|
}) => any;
|
|
983
985
|
} & {
|
|
984
986
|
'form.after'?: (props: {
|
|
@@ -993,6 +995,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
993
995
|
loading: boolean;
|
|
994
996
|
submitText: string;
|
|
995
997
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
998
|
+
action: (name: string) => void;
|
|
996
999
|
clearErrors: () => void;
|
|
997
1000
|
setErrors: (errors: Record<string, string>) => void;
|
|
998
1001
|
dismissError: (path: string) => void;
|
|
@@ -1003,6 +1006,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1003
1006
|
getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
|
|
1004
1007
|
getChanges: () => FormFieldChange[];
|
|
1005
1008
|
isDirtyPath: (path: string) => boolean;
|
|
1009
|
+
displayText: UseAsDataReturn["displayText"];
|
|
1006
1010
|
}) => any;
|
|
1007
1011
|
} & {
|
|
1008
1012
|
'form.error'?: (props: {
|
|
@@ -1019,6 +1023,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1019
1023
|
loading: boolean;
|
|
1020
1024
|
submitText: string;
|
|
1021
1025
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
1026
|
+
action: (name: string) => void;
|
|
1022
1027
|
clearErrors: () => void;
|
|
1023
1028
|
setErrors: (errors: Record<string, string>) => void;
|
|
1024
1029
|
dismissError: (path: string) => void;
|
|
@@ -1029,6 +1034,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1029
1034
|
getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
|
|
1030
1035
|
getChanges: () => FormFieldChange[];
|
|
1031
1036
|
isDirtyPath: (path: string) => boolean;
|
|
1037
|
+
displayText: UseAsDataReturn["displayText"];
|
|
1032
1038
|
}) => any;
|
|
1033
1039
|
} & {
|
|
1034
1040
|
'form.submit'?: (props: {
|
|
@@ -1044,6 +1050,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1044
1050
|
loading: boolean;
|
|
1045
1051
|
submitText: string;
|
|
1046
1052
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
1053
|
+
action: (name: string) => void;
|
|
1047
1054
|
clearErrors: () => void;
|
|
1048
1055
|
setErrors: (errors: Record<string, string>) => void;
|
|
1049
1056
|
dismissError: (path: string) => void;
|
|
@@ -1054,6 +1061,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1054
1061
|
getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
|
|
1055
1062
|
getChanges: () => FormFieldChange[];
|
|
1056
1063
|
isDirtyPath: (path: string) => boolean;
|
|
1064
|
+
displayText: UseAsDataReturn["displayText"];
|
|
1057
1065
|
}) => any;
|
|
1058
1066
|
} & {
|
|
1059
1067
|
'form.footer'?: (props: {
|
|
@@ -1068,6 +1076,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1068
1076
|
loading: boolean;
|
|
1069
1077
|
submitText: string;
|
|
1070
1078
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
1079
|
+
action: (name: string) => void;
|
|
1071
1080
|
clearErrors: () => void;
|
|
1072
1081
|
setErrors: (errors: Record<string, string>) => void;
|
|
1073
1082
|
dismissError: (path: string) => void;
|
|
@@ -1078,6 +1087,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1078
1087
|
getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
|
|
1079
1088
|
getChanges: () => FormFieldChange[];
|
|
1080
1089
|
isDirtyPath: (path: string) => boolean;
|
|
1090
|
+
displayText: UseAsDataReturn["displayText"];
|
|
1081
1091
|
}) => any;
|
|
1082
1092
|
} & {
|
|
1083
1093
|
'form.loading'?: (props: {
|
|
@@ -1092,6 +1102,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1092
1102
|
loading: boolean;
|
|
1093
1103
|
submitText: string;
|
|
1094
1104
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
1105
|
+
action: (name: string) => void;
|
|
1095
1106
|
clearErrors: () => void;
|
|
1096
1107
|
setErrors: (errors: Record<string, string>) => void;
|
|
1097
1108
|
dismissError: (path: string) => void;
|
|
@@ -1102,6 +1113,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1102
1113
|
getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
|
|
1103
1114
|
getChanges: () => FormFieldChange[];
|
|
1104
1115
|
isDirtyPath: (path: string) => boolean;
|
|
1116
|
+
displayText: UseAsDataReturn["displayText"];
|
|
1105
1117
|
}) => any;
|
|
1106
1118
|
};
|
|
1107
1119
|
emit: {
|
|
@@ -1117,4 +1129,4 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1117
1129
|
declare const _default: typeof __VLS_export;
|
|
1118
1130
|
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K] } : { [K in keyof T as K]: T[K] }) & {};
|
|
1119
1131
|
//#endregion
|
|
1120
|
-
export {
|
|
1132
|
+
export { UseAsOptionalFieldReturn as $, UseAsDateReturn as A, useAsField as At, useAsDecimal as B, AsErrorDismiss as C, UseAsExternalErrorsReturn as Ct, UseAsPathReturn as D, useAsState as Dt, useAsTypeMap as E, UseAsStateReturn as Et, UseAsNumberOptions as F, useAsTriStateCheckbox as G, useAsModelTexts as H, UseAsNumberReturn as I, useAsOptionalAddFlow as J, UseAsOptionalAddFlowOptions as K, useAsNumber as L, UseAsDualInputOptions as M, createAsFormDef as Mt, UseAsDualInputReturn as N, useAsPath as O, UseAsFieldOptions as Ot, useAsDualInput as P, useAsVisibleFields as Q, UseAsDecimalOptions as R, setDefaultOptionalMode as S, UseAsExternalErrorsOptions as St, UseAsTypeMapReturn as T, TFormSubmitValidator as Tt, UseAsTriStateCheckboxOptions as U, variantLabel as V, UseAsTriStateCheckboxReturn as W, focusNewFocusableAfter as X, focusFirstAfter as Y, useAsFocusFirstAfter as Z, isFieldRequired as _, useAsUnion as _t, FormFieldChange$1 as a, useAsLevel as at, resolveOptionalMode as b, UseAsArrayReturn as bt, TypedClientFactory as c, useAsDescendantErrorCounts as ct, getDefaultClientFactory as d, UseAsValueHelpOptions as dt, useAsOptionalField as et, getDefaultOptionalMode as f, UseAsValueHelpReturn as ft, isFieldReadonly as g, UseAsUnionReturn as gt, isFieldHidden as h, useAsUnionVariant as ht, FormDiffOptions$1 as i, provideAsNestedLevel as it, useAsDate as j, createDefaultTypes as jt, UseAsDateOptions as k, UseAsFieldReturn as kt, UI_FORM_OPTIONAL_MODE as l, useAsNestedSectionsStore as lt, isFieldDisabled as m, formatIndexedLabelParts as mt, _default as n, UseAsFieldScopeReturn as nt, FormRebaseOptions$1 as o, AsNestedSectionsStore as ot, hasFieldMeta as p, useAsValueHelp as pt, UseAsOptionalAddFlowReturn as q, ClientFactory$1 as r, useAsFieldScope as rt, TOptionalMode$1 as s, provideAsNestedSectionsStore as st, Props as t, TResolveFieldPropOptions as tt, emptiedValue as u, useAsDropdown as ut, joinPath as v, UseAsTupleReturn as vt, useAsErrorDismiss as w, useAsExternalErrors as wt, setDefaultClientFactory as x, useAsArray as xt, resetDefaultClientFactory as y, useAsTuple as yt, UseAsDecimalReturn as z };
|