@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
package/dist/locale.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { type AsServedTexts, type UseAsLocaleReturn, getAsServedTexts, injectAsTexts, provideAsLocale, provideAsServedTexts, useAsLocale, useAsTexts, useUiLocaleKey };
|
|
1
|
+
import { a as getAsServedTexts, c as provideAsServedTexts, d as useUiLocaleKey, i as UseAsLocaleReturn, l as useAsLocale, n as useValueHelpTexts, o as injectAsTexts, r as AsServedTexts, s as provideAsLocale, t as UseValueHelpTextsReturn, u as useAsTexts } from "./use-value-help-texts-BL1qfGA2.cjs";
|
|
2
|
+
export { type AsServedTexts, type UseAsLocaleReturn, type UseValueHelpTextsReturn, getAsServedTexts, injectAsTexts, provideAsLocale, provideAsServedTexts, useAsLocale, useAsTexts, useUiLocaleKey, useValueHelpTexts };
|
package/dist/locale.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { type AsServedTexts, type UseAsLocaleReturn, getAsServedTexts, injectAsTexts, provideAsLocale, provideAsServedTexts, useAsLocale, useAsTexts, useUiLocaleKey };
|
|
1
|
+
import { a as getAsServedTexts, c as provideAsServedTexts, d as useUiLocaleKey, i as UseAsLocaleReturn, l as useAsLocale, n as useValueHelpTexts, o as injectAsTexts, r as AsServedTexts, s as provideAsLocale, t as UseValueHelpTextsReturn, u as useAsTexts } from "./use-value-help-texts-fzgKU4NG.mjs";
|
|
2
|
+
export { type AsServedTexts, type UseAsLocaleReturn, type UseValueHelpTextsReturn, getAsServedTexts, injectAsTexts, provideAsLocale, provideAsServedTexts, useAsLocale, useAsTexts, useUiLocaleKey, useValueHelpTexts };
|
package/dist/locale.mjs
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { a as useAsLocale, i as provideAsServedTexts, n as injectAsTexts, o as useAsTexts, r as provideAsLocale, s as useUiLocaleKey, t as getAsServedTexts } from "./use-as-locale-CznDr-7i.mjs";
|
|
2
|
-
|
|
2
|
+
import { t as useValueHelpTexts } from "./use-value-help-texts-LySFdZya.mjs";
|
|
3
|
+
export { getAsServedTexts, injectAsTexts, provideAsLocale, provideAsServedTexts, useAsLocale, useAsTexts, useUiLocaleKey, useValueHelpTexts };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, ComputedRef, Ref } from "vue";
|
|
2
|
-
import { ClientFactory, FormDef, FormDiffOptions, FormFieldChange, FormFieldDef, FormRebaseOptions, FormUnionVariant, TFormAction, TFormEntryOptions, TOptionalMode, ValueHelpInfo, ValueHelpScope } from "@atscript/ui";
|
|
2
|
+
import { ClientFactory, DisplayValueOptions, FormDef, FormDiffOptions, FormFieldChange, FormFieldDef, FormRebaseOptions, FormUnionVariant, TFormAction, TFormEntryOptions, TOptionalMode, ValueHelpInfo, ValueHelpScope } from "@atscript/ui";
|
|
3
3
|
|
|
4
4
|
//#region src/composables/use-as-form-patch.d.ts
|
|
5
5
|
/**
|
|
@@ -162,7 +162,87 @@ interface TFormState {
|
|
|
162
162
|
freshFields: Set<symbol>;
|
|
163
163
|
register: (id: symbol, registration: TFormFieldRegistration) => void;
|
|
164
164
|
unregister: (id: symbol) => void;
|
|
165
|
+
/**
|
|
166
|
+
* The text `value` of `field` shows as where a field shows it as text — a
|
|
167
|
+
* read-only field, the reference field while not focused (since 0.1.207):
|
|
168
|
+
* `displayValue` with the field's own options (`opts.options`), its
|
|
169
|
+
* `@ui.valueLabel` sibling's text (`opts.siblingText`) and, on a field bound
|
|
170
|
+
* to a dictionary (`field.valueHelpInfo`: `@db.rel.FK` or `@ui.valueHelp`)
|
|
171
|
+
* whose binding declares a label, the dictionary row's text — read by key
|
|
172
|
+
* through the form's client factory, the code alone until it arrives; else
|
|
173
|
+
* the value as text, `""` for none. Reactive. Call it where the text shows:
|
|
174
|
+
* the dictionary is read only then. `useAsData().displayText` — also the
|
|
175
|
+
* `<AsForm>` slot's and `useAsForm`'s — reads the sibling for you; `AsField`
|
|
176
|
+
* hands its result to every control as `displayText`.
|
|
177
|
+
*/
|
|
178
|
+
displayText: (field: {
|
|
179
|
+
valueHelpInfo?: ValueHelpInfo;
|
|
180
|
+
}, value: unknown, opts?: TFormDisplayTextOptions) => string;
|
|
181
|
+
}
|
|
182
|
+
/** What `TFormState.displayText` reads besides the field and the value. Since 0.1.207. */
|
|
183
|
+
interface TFormDisplayTextOptions {
|
|
184
|
+
/**
|
|
185
|
+
* The field's own options (`@ui.form.options`, `@ui.form.fn.options`, a
|
|
186
|
+
* literal union's) — not the dictionary rows a dropdown lists: a code shows
|
|
187
|
+
* with its dictionary text, as in a table.
|
|
188
|
+
*/
|
|
189
|
+
options?: readonly TFormEntryOptions[];
|
|
190
|
+
/** The field's `@ui.valueLabel` sibling: its text and arrangement. */
|
|
191
|
+
siblingText?: DisplayValueOptions["siblingText"];
|
|
192
|
+
}
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/composables/use-as-data.d.ts
|
|
195
|
+
interface UseAsDataReturn {
|
|
196
|
+
/** Domain data (the unwrapped inner value of the form's `{ value }` container). */
|
|
197
|
+
rootData: ComputedRef<unknown>;
|
|
198
|
+
/** Read the value at an absolute dotted path inside the form. */
|
|
199
|
+
getValueAt: (path: string) => ComputedRef<unknown>;
|
|
200
|
+
/** Read a sibling field's value relative to the current `useAsPath()` prefix. */
|
|
201
|
+
siblingValue: <T = unknown>(name: string) => ComputedRef<T | undefined>;
|
|
202
|
+
/**
|
|
203
|
+
* Write the value at an absolute dotted path inside the form (missing
|
|
204
|
+
* containers are created: an array where the next segment is an index,
|
|
205
|
+
* else an object; an empty form root too). The write is a committed edit:
|
|
206
|
+
* change tracking sees it, the field at that path re-validates like one the
|
|
207
|
+
* user changed, and `AsForm` emits `change` with type `"update"`. Outside a
|
|
208
|
+
* form, a no-op.
|
|
209
|
+
*/
|
|
210
|
+
setValueAt: (path: string, value: unknown) => void;
|
|
211
|
+
/**
|
|
212
|
+
* Write a sibling field's value, relative to the current `useAsPath()`
|
|
213
|
+
* prefix — e.g. a custom picker filling the fields next to it. Same rules
|
|
214
|
+
* as `setValueAt`.
|
|
215
|
+
*/
|
|
216
|
+
setSibling: (name: string, value: unknown) => void;
|
|
217
|
+
/**
|
|
218
|
+
* The text `value` of `field` shows as (`TFormState.displayText`, since
|
|
219
|
+
* 0.1.207), with the field's own `options` and its `@ui.valueLabel` sibling
|
|
220
|
+
* read next to it — what `AsField` hands a control as `displayText`, for a
|
|
221
|
+
* custom control; the `<AsForm>` slot's and `useAsForm`'s are the same.
|
|
222
|
+
* Call it where the text shows: a dictionary text is read only then.
|
|
223
|
+
* Outside a form, `""`.
|
|
224
|
+
*/
|
|
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>;
|
|
165
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Reactive access to form data at any point in the `<AsForm>` tree: readers
|
|
239
|
+
* plus `setValueAt` / `setSibling` writers. Outside a form, all readers
|
|
240
|
+
* return `undefined` and the writers do nothing.
|
|
241
|
+
*
|
|
242
|
+
* Call sites get a `ComputedRef` so they can compose it directly with
|
|
243
|
+
* other reactive primitives without an extra `computed()` wrapper.
|
|
244
|
+
*/
|
|
245
|
+
declare function useAsData(): UseAsDataReturn;
|
|
166
246
|
//#endregion
|
|
167
247
|
//#region src/composables/use-as-form.d.ts
|
|
168
248
|
/**
|
|
@@ -342,6 +422,12 @@ interface UseAsFormReturn<TFormData = unknown, TFormContext = unknown> {
|
|
|
342
422
|
loading: boolean;
|
|
343
423
|
submitText: string;
|
|
344
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;
|
|
345
431
|
reset: () => Promise<void>; /** Fields back to the change-tracking baseline (a no-op when tracking is off). */
|
|
346
432
|
revert: () => Promise<void>;
|
|
347
433
|
clearErrors: () => void;
|
|
@@ -354,6 +440,11 @@ interface UseAsFormReturn<TFormData = unknown, TFormContext = unknown> {
|
|
|
354
440
|
getPatch: (opts?: FormDiffOptions) => Record<string, unknown>; /** Build the per-field change list on demand (`[]` when tracking is off). */
|
|
355
441
|
getChanges: () => FormFieldChange[]; /** Per-field dirty predicate (`false` for every path when tracking is off). */
|
|
356
442
|
isDirtyPath: (path: string) => boolean;
|
|
443
|
+
/**
|
|
444
|
+
* The text a field's value shows as, its `@ui.valueLabel` sibling read
|
|
445
|
+
* from the form's data — `useAsData().displayText`. Since 0.1.207.
|
|
446
|
+
*/
|
|
447
|
+
displayText: UseAsDataReturn["displayText"];
|
|
357
448
|
}>;
|
|
358
449
|
/**
|
|
359
450
|
* Change-tracking handle — present ONLY when `trackChanges` is enabled.
|
|
@@ -460,7 +551,12 @@ interface TAsComponentProps<V = unknown> extends TAsBaseComponentProps {
|
|
|
460
551
|
* this when emptied. Since 0.1.205.
|
|
461
552
|
*/
|
|
462
553
|
emptiedValue?: unknown;
|
|
463
|
-
/**
|
|
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
|
+
*/
|
|
464
560
|
required?: boolean | undefined;
|
|
465
561
|
/** Whether the field is read-only. */
|
|
466
562
|
readonly?: boolean | undefined;
|
|
@@ -495,13 +591,16 @@ interface TAsComponentProps<V = unknown> extends TAsBaseComponentProps {
|
|
|
495
591
|
/** Resolved value-help descriptor for FK ref fields (`@db.rel.FK` → `@db.http.path`). */
|
|
496
592
|
valueHelp?: ValueHelpInfo;
|
|
497
593
|
/**
|
|
498
|
-
* The value as
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
*
|
|
594
|
+
* The field's value as text, as a read-only field shows it
|
|
595
|
+
* (`TFormState.displayText`, since 0.1.207; it replaces `valueLabel`): its
|
|
596
|
+
* option's label, `Yes` / `No`, a code with its text, arranged
|
|
597
|
+
* (`Berlin (BER)`) — its `@ui.valueLabel` sibling's, else its dictionary
|
|
598
|
+
* row's (the code alone until it arrives) — else the value as text; `""`
|
|
599
|
+
* for none. Call it where the text shows — a read-only field, the
|
|
600
|
+
* reference field while it is not focused: the dictionary is read only
|
|
601
|
+
* then, never while the field is edited. Reactive.
|
|
503
602
|
*/
|
|
504
|
-
|
|
603
|
+
displayText: () => string;
|
|
505
604
|
/** Singular label for array fields (`@ui.form.label.singular`) — used in "Add <singular>" affordances. */
|
|
506
605
|
singularLabel?: string;
|
|
507
606
|
/** Stable input element id, suitable for `<label :for>`. Co-resolved with `errorId` / `descId` so a11y wiring is consistent. Always populated by AsField. */
|
|
@@ -576,14 +675,10 @@ interface TAsComponentProps<V = unknown> extends TAsBaseComponentProps {
|
|
|
576
675
|
*/
|
|
577
676
|
suffix?: string;
|
|
578
677
|
/**
|
|
579
|
-
*
|
|
580
|
-
*
|
|
581
|
-
*
|
|
582
|
-
*
|
|
583
|
-
* resolved, else `currencyDecimals` (currency only), else
|
|
584
|
-
* `precisionScale` (DB only), else `undefined`. Smaller than
|
|
585
|
-
* `precisionScale` is fine — storage stays at the DB cap, display
|
|
586
|
-
* 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).
|
|
587
682
|
*/
|
|
588
683
|
scale?: number;
|
|
589
684
|
/**
|
|
@@ -779,4 +874,4 @@ interface AsFormExposed<TFormData = any> extends Pick<AsFormPatchHandle, "getPat
|
|
|
779
874
|
readonly changes: readonly FormFieldChange[];
|
|
780
875
|
}
|
|
781
876
|
//#endregion
|
|
782
|
-
export {
|
|
877
|
+
export { TFormState as C, useAsFormPatch as E, TFormRule as S, RebaseOntoResult as T, useAsData as _, TAsCollapsibleSlots as a, TFormFieldCallbacks as b, TAsRefSlotProps as c, TAsFormSubmitResult as d, TAsFormValue as f, UseAsDataReturn as g, useAsForm as h, TAsCollapsibleProps as i, TAsTypeComponents as l, UseAsFormReturn as m, TAsBaseComponentProps as n, TAsComponentEmits as o, UseAsFormOptions as p, TAsChangeType as r, TAsComponentProps as s, AsFormExposed as t, TAsUnionContext as u, TAsFormError as v, AsFormPatchHandle as w, TFormFieldRegistration as x, TFormDisplayTextOptions as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, ComputedRef, Ref } from "vue";
|
|
2
|
-
import { ClientFactory, FormDef, FormDiffOptions, FormFieldChange, FormFieldDef, FormRebaseOptions, FormUnionVariant, TFormAction, TFormEntryOptions, TOptionalMode, ValueHelpInfo, ValueHelpScope } from "@atscript/ui";
|
|
2
|
+
import { ClientFactory, DisplayValueOptions, FormDef, FormDiffOptions, FormFieldChange, FormFieldDef, FormRebaseOptions, FormUnionVariant, TFormAction, TFormEntryOptions, TOptionalMode, ValueHelpInfo, ValueHelpScope } from "@atscript/ui";
|
|
3
3
|
|
|
4
4
|
//#region src/composables/use-as-form-patch.d.ts
|
|
5
5
|
/**
|
|
@@ -162,7 +162,87 @@ interface TFormState {
|
|
|
162
162
|
freshFields: Set<symbol>;
|
|
163
163
|
register: (id: symbol, registration: TFormFieldRegistration) => void;
|
|
164
164
|
unregister: (id: symbol) => void;
|
|
165
|
+
/**
|
|
166
|
+
* The text `value` of `field` shows as where a field shows it as text — a
|
|
167
|
+
* read-only field, the reference field while not focused (since 0.1.207):
|
|
168
|
+
* `displayValue` with the field's own options (`opts.options`), its
|
|
169
|
+
* `@ui.valueLabel` sibling's text (`opts.siblingText`) and, on a field bound
|
|
170
|
+
* to a dictionary (`field.valueHelpInfo`: `@db.rel.FK` or `@ui.valueHelp`)
|
|
171
|
+
* whose binding declares a label, the dictionary row's text — read by key
|
|
172
|
+
* through the form's client factory, the code alone until it arrives; else
|
|
173
|
+
* the value as text, `""` for none. Reactive. Call it where the text shows:
|
|
174
|
+
* the dictionary is read only then. `useAsData().displayText` — also the
|
|
175
|
+
* `<AsForm>` slot's and `useAsForm`'s — reads the sibling for you; `AsField`
|
|
176
|
+
* hands its result to every control as `displayText`.
|
|
177
|
+
*/
|
|
178
|
+
displayText: (field: {
|
|
179
|
+
valueHelpInfo?: ValueHelpInfo;
|
|
180
|
+
}, value: unknown, opts?: TFormDisplayTextOptions) => string;
|
|
181
|
+
}
|
|
182
|
+
/** What `TFormState.displayText` reads besides the field and the value. Since 0.1.207. */
|
|
183
|
+
interface TFormDisplayTextOptions {
|
|
184
|
+
/**
|
|
185
|
+
* The field's own options (`@ui.form.options`, `@ui.form.fn.options`, a
|
|
186
|
+
* literal union's) — not the dictionary rows a dropdown lists: a code shows
|
|
187
|
+
* with its dictionary text, as in a table.
|
|
188
|
+
*/
|
|
189
|
+
options?: readonly TFormEntryOptions[];
|
|
190
|
+
/** The field's `@ui.valueLabel` sibling: its text and arrangement. */
|
|
191
|
+
siblingText?: DisplayValueOptions["siblingText"];
|
|
192
|
+
}
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/composables/use-as-data.d.ts
|
|
195
|
+
interface UseAsDataReturn {
|
|
196
|
+
/** Domain data (the unwrapped inner value of the form's `{ value }` container). */
|
|
197
|
+
rootData: ComputedRef<unknown>;
|
|
198
|
+
/** Read the value at an absolute dotted path inside the form. */
|
|
199
|
+
getValueAt: (path: string) => ComputedRef<unknown>;
|
|
200
|
+
/** Read a sibling field's value relative to the current `useAsPath()` prefix. */
|
|
201
|
+
siblingValue: <T = unknown>(name: string) => ComputedRef<T | undefined>;
|
|
202
|
+
/**
|
|
203
|
+
* Write the value at an absolute dotted path inside the form (missing
|
|
204
|
+
* containers are created: an array where the next segment is an index,
|
|
205
|
+
* else an object; an empty form root too). The write is a committed edit:
|
|
206
|
+
* change tracking sees it, the field at that path re-validates like one the
|
|
207
|
+
* user changed, and `AsForm` emits `change` with type `"update"`. Outside a
|
|
208
|
+
* form, a no-op.
|
|
209
|
+
*/
|
|
210
|
+
setValueAt: (path: string, value: unknown) => void;
|
|
211
|
+
/**
|
|
212
|
+
* Write a sibling field's value, relative to the current `useAsPath()`
|
|
213
|
+
* prefix — e.g. a custom picker filling the fields next to it. Same rules
|
|
214
|
+
* as `setValueAt`.
|
|
215
|
+
*/
|
|
216
|
+
setSibling: (name: string, value: unknown) => void;
|
|
217
|
+
/**
|
|
218
|
+
* The text `value` of `field` shows as (`TFormState.displayText`, since
|
|
219
|
+
* 0.1.207), with the field's own `options` and its `@ui.valueLabel` sibling
|
|
220
|
+
* read next to it — what `AsField` hands a control as `displayText`, for a
|
|
221
|
+
* custom control; the `<AsForm>` slot's and `useAsForm`'s are the same.
|
|
222
|
+
* Call it where the text shows: a dictionary text is read only then.
|
|
223
|
+
* Outside a form, `""`.
|
|
224
|
+
*/
|
|
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>;
|
|
165
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Reactive access to form data at any point in the `<AsForm>` tree: readers
|
|
239
|
+
* plus `setValueAt` / `setSibling` writers. Outside a form, all readers
|
|
240
|
+
* return `undefined` and the writers do nothing.
|
|
241
|
+
*
|
|
242
|
+
* Call sites get a `ComputedRef` so they can compose it directly with
|
|
243
|
+
* other reactive primitives without an extra `computed()` wrapper.
|
|
244
|
+
*/
|
|
245
|
+
declare function useAsData(): UseAsDataReturn;
|
|
166
246
|
//#endregion
|
|
167
247
|
//#region src/composables/use-as-form.d.ts
|
|
168
248
|
/**
|
|
@@ -342,6 +422,12 @@ interface UseAsFormReturn<TFormData = unknown, TFormContext = unknown> {
|
|
|
342
422
|
loading: boolean;
|
|
343
423
|
submitText: string;
|
|
344
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;
|
|
345
431
|
reset: () => Promise<void>; /** Fields back to the change-tracking baseline (a no-op when tracking is off). */
|
|
346
432
|
revert: () => Promise<void>;
|
|
347
433
|
clearErrors: () => void;
|
|
@@ -354,6 +440,11 @@ interface UseAsFormReturn<TFormData = unknown, TFormContext = unknown> {
|
|
|
354
440
|
getPatch: (opts?: FormDiffOptions) => Record<string, unknown>; /** Build the per-field change list on demand (`[]` when tracking is off). */
|
|
355
441
|
getChanges: () => FormFieldChange[]; /** Per-field dirty predicate (`false` for every path when tracking is off). */
|
|
356
442
|
isDirtyPath: (path: string) => boolean;
|
|
443
|
+
/**
|
|
444
|
+
* The text a field's value shows as, its `@ui.valueLabel` sibling read
|
|
445
|
+
* from the form's data — `useAsData().displayText`. Since 0.1.207.
|
|
446
|
+
*/
|
|
447
|
+
displayText: UseAsDataReturn["displayText"];
|
|
357
448
|
}>;
|
|
358
449
|
/**
|
|
359
450
|
* Change-tracking handle — present ONLY when `trackChanges` is enabled.
|
|
@@ -460,7 +551,12 @@ interface TAsComponentProps<V = unknown> extends TAsBaseComponentProps {
|
|
|
460
551
|
* this when emptied. Since 0.1.205.
|
|
461
552
|
*/
|
|
462
553
|
emptiedValue?: unknown;
|
|
463
|
-
/**
|
|
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
|
+
*/
|
|
464
560
|
required?: boolean | undefined;
|
|
465
561
|
/** Whether the field is read-only. */
|
|
466
562
|
readonly?: boolean | undefined;
|
|
@@ -495,13 +591,16 @@ interface TAsComponentProps<V = unknown> extends TAsBaseComponentProps {
|
|
|
495
591
|
/** Resolved value-help descriptor for FK ref fields (`@db.rel.FK` → `@db.http.path`). */
|
|
496
592
|
valueHelp?: ValueHelpInfo;
|
|
497
593
|
/**
|
|
498
|
-
* The value as
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
*
|
|
594
|
+
* The field's value as text, as a read-only field shows it
|
|
595
|
+
* (`TFormState.displayText`, since 0.1.207; it replaces `valueLabel`): its
|
|
596
|
+
* option's label, `Yes` / `No`, a code with its text, arranged
|
|
597
|
+
* (`Berlin (BER)`) — its `@ui.valueLabel` sibling's, else its dictionary
|
|
598
|
+
* row's (the code alone until it arrives) — else the value as text; `""`
|
|
599
|
+
* for none. Call it where the text shows — a read-only field, the
|
|
600
|
+
* reference field while it is not focused: the dictionary is read only
|
|
601
|
+
* then, never while the field is edited. Reactive.
|
|
503
602
|
*/
|
|
504
|
-
|
|
603
|
+
displayText: () => string;
|
|
505
604
|
/** Singular label for array fields (`@ui.form.label.singular`) — used in "Add <singular>" affordances. */
|
|
506
605
|
singularLabel?: string;
|
|
507
606
|
/** Stable input element id, suitable for `<label :for>`. Co-resolved with `errorId` / `descId` so a11y wiring is consistent. Always populated by AsField. */
|
|
@@ -576,14 +675,10 @@ interface TAsComponentProps<V = unknown> extends TAsBaseComponentProps {
|
|
|
576
675
|
*/
|
|
577
676
|
suffix?: string;
|
|
578
677
|
/**
|
|
579
|
-
*
|
|
580
|
-
*
|
|
581
|
-
*
|
|
582
|
-
*
|
|
583
|
-
* resolved, else `currencyDecimals` (currency only), else
|
|
584
|
-
* `precisionScale` (DB only), else `undefined`. Smaller than
|
|
585
|
-
* `precisionScale` is fine — storage stays at the DB cap, display
|
|
586
|
-
* 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).
|
|
587
682
|
*/
|
|
588
683
|
scale?: number;
|
|
589
684
|
/**
|
|
@@ -779,4 +874,4 @@ interface AsFormExposed<TFormData = any> extends Pick<AsFormPatchHandle, "getPat
|
|
|
779
874
|
readonly changes: readonly FormFieldChange[];
|
|
780
875
|
}
|
|
781
876
|
//#endregion
|
|
782
|
-
export {
|
|
877
|
+
export { TFormState as C, useAsFormPatch as E, TFormRule as S, RebaseOntoResult as T, useAsData as _, TAsCollapsibleSlots as a, TFormFieldCallbacks as b, TAsRefSlotProps as c, TAsFormSubmitResult as d, TAsFormValue as f, UseAsDataReturn as g, useAsForm as h, TAsCollapsibleProps as i, TAsTypeComponents as l, UseAsFormReturn as m, TAsBaseComponentProps as n, TAsComponentEmits as o, UseAsFormOptions as p, TAsChangeType as r, TAsComponentProps as s, AsFormExposed as t, TAsUnionContext as u, TAsFormError as v, AsFormPatchHandle as w, TFormFieldRegistration as x, TFormDisplayTextOptions as y };
|
|
@@ -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",
|
|
@@ -153,9 +154,9 @@ var as_date_control_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
153
154
|
type: Object,
|
|
154
155
|
required: false
|
|
155
156
|
},
|
|
156
|
-
|
|
157
|
-
type:
|
|
158
|
-
required:
|
|
157
|
+
displayText: {
|
|
158
|
+
type: Function,
|
|
159
|
+
required: true
|
|
159
160
|
},
|
|
160
161
|
singularLabel: {
|
|
161
162
|
type: String,
|
|
@@ -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",
|
|
@@ -153,9 +154,9 @@ var as_date_control_default = /* @__PURE__ */ defineComponent({
|
|
|
153
154
|
type: Object,
|
|
154
155
|
required: false
|
|
155
156
|
},
|
|
156
|
-
|
|
157
|
-
type:
|
|
158
|
-
required:
|
|
157
|
+
displayText: {
|
|
158
|
+
type: Function,
|
|
159
|
+
required: true
|
|
159
160
|
},
|
|
160
161
|
singularLabel: {
|
|
161
162
|
type: String,
|
|
@@ -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
|