@atscript/vue-form 0.1.207 → 0.1.208
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/as-action.d.cts +1 -1
- package/dist/as-action.d.mts +1 -1
- package/dist/{as-action.vue-BjGc3z94.d.mts → as-action.vue-D0twy1JK.d.cts} +1 -1
- package/dist/{as-action.vue-wGCmd-ww.d.cts → as-action.vue-Dse77iCr.d.mts} +1 -1
- package/dist/{as-array-CHVronOS.mjs → as-array-CEtgj6nd.mjs} +8 -9
- package/dist/{as-array-BCmGCZul.cjs → as-array-CKedVJIz.cjs} +8 -9
- package/dist/{as-array-clear-btn-DOBKhLCy.mjs → as-array-clear-btn-BFfll2RA.mjs} +1 -1
- package/dist/{as-array-clear-btn-BolX7Wpe.cjs → as-array-clear-btn-nYR8rEeL.cjs} +1 -1
- package/dist/as-array.cjs +1 -1
- package/dist/as-array.d.cts +1 -1
- package/dist/as-array.d.mts +1 -1
- package/dist/as-array.mjs +1 -1
- package/dist/{as-array.vue-BB22gE0u.d.cts → as-array.vue-BCB8mLx-.d.mts} +1 -1
- package/dist/{as-array.vue-CgYp_DSb.d.mts → as-array.vue-DJNzEE8-.d.cts} +1 -1
- package/dist/{as-checkbox-BX5N5GHR.mjs → as-checkbox-B7C-CvhT.mjs} +4 -2
- package/dist/{as-checkbox-BKWtScvS.cjs → as-checkbox-DKaEfo7e.cjs} +4 -2
- package/dist/as-checkbox.cjs +1 -1
- package/dist/as-checkbox.d.cts +1 -1
- package/dist/as-checkbox.d.mts +1 -1
- package/dist/as-checkbox.mjs +1 -1
- package/dist/{as-checkbox.vue-CQzeu4IP.d.mts → as-checkbox.vue-CoCgt4vV.d.mts} +1 -1
- package/dist/{as-checkbox.vue-RTW5hwvE.d.cts → as-checkbox.vue-fPeyQDp5.d.cts} +1 -1
- package/dist/{as-collapsible-C37-3_Rp.cjs → as-collapsible-Bs0LOl1t.cjs} +1 -1
- package/dist/{as-collapsible-B9KPgJyo.mjs → as-collapsible-DOIWkQ0v.mjs} +1 -1
- package/dist/as-collapsible.cjs +1 -1
- package/dist/as-collapsible.d.cts +1 -1
- package/dist/as-collapsible.d.mts +1 -1
- package/dist/as-collapsible.mjs +1 -1
- package/dist/{as-collapsible.vue-BKN4DmSy.d.mts → as-collapsible.vue-CH3ez8zm.d.cts} +1 -1
- package/dist/{as-collapsible.vue-CPmozkkf.d.cts → as-collapsible.vue-DewV2oaE.d.mts} +1 -1
- package/dist/{as-date-C6tT9FPz.cjs → as-date-BMKMiM_d.cjs} +2 -2
- package/dist/{as-date-Bkrp2GY4.mjs → as-date-CFQtrpZT.mjs} +2 -2
- package/dist/as-date.cjs +1 -1
- package/dist/as-date.d.cts +1 -1
- package/dist/as-date.d.mts +1 -1
- package/dist/as-date.mjs +1 -1
- package/dist/{as-date.vue-BpfWumrA.d.cts → as-date.vue-BSghCVx0.d.cts} +1 -1
- package/dist/{as-date.vue-DJ125nVS.d.mts → as-date.vue-CPgqqKMB.d.mts} +1 -1
- package/dist/{as-datetime-DWLW4W7O.cjs → as-datetime-Bl1K4U51.cjs} +2 -2
- package/dist/{as-datetime-Dt_AWrCG.mjs → as-datetime-DqfSymmL.mjs} +2 -2
- package/dist/as-datetime.cjs +1 -1
- package/dist/as-datetime.d.cts +1 -1
- package/dist/as-datetime.d.mts +1 -1
- package/dist/as-datetime.mjs +1 -1
- package/dist/{as-datetime.vue-DO3tkof1.d.cts → as-datetime.vue-B-KRC-0X.d.mts} +1 -1
- package/dist/{as-datetime.vue-DfFAaVdS.d.mts → as-datetime.vue-CjDTsMDw.d.cts} +1 -1
- package/dist/{as-decimal-DuWZDjbg.cjs → as-decimal-48M_h9Sl.cjs} +18 -24
- package/dist/{as-decimal-BUr24VTI.mjs → as-decimal-CsAJlvie.mjs} +18 -24
- package/dist/as-decimal.cjs +1 -1
- package/dist/as-decimal.d.cts +1 -1
- package/dist/as-decimal.d.mts +1 -1
- package/dist/as-decimal.mjs +1 -1
- package/dist/{as-decimal.vue-BODauGXK.d.mts → as-decimal.vue-BZ2imea4.d.mts} +1 -1
- package/dist/{as-decimal.vue-C42_-oK9.d.cts → as-decimal.vue-BvvG5aIL.d.cts} +1 -1
- package/dist/{as-field-iQ2H3VGd.mjs → as-field-C6iquEB1.mjs} +99 -137
- package/dist/{as-field-lMMfms8d.cjs → as-field-CJMJJfXO.cjs} +98 -136
- package/dist/{as-field-shell-BPesuJKa.cjs → as-field-shell-CMq52Z6e.cjs} +2 -2
- package/dist/{as-field-shell-QMsYyJ8r.mjs → as-field-shell-DXbAJupk.mjs} +2 -2
- package/dist/as-field-shell.cjs +1 -1
- package/dist/as-field-shell.d.cts +1 -1
- package/dist/as-field-shell.d.mts +1 -1
- package/dist/as-field-shell.mjs +1 -1
- package/dist/{as-field-shell.vue-CQqwykWy.d.cts → as-field-shell.vue-BbSIqZSY.d.cts} +1 -1
- package/dist/{as-field-shell.vue-o7T2u4aw.d.mts → as-field-shell.vue-D0NYcajH.d.mts} +1 -1
- package/dist/as-field.cjs +1 -1
- package/dist/as-field.mjs +1 -1
- package/dist/{as-form-DE3TVGV-.cjs → as-form-B4-StU3b.cjs} +19 -38
- package/dist/{as-form-CuMRP5aZ.mjs → as-form-DQePBFwR.mjs} +20 -39
- package/dist/as-form.cjs +1 -1
- package/dist/as-form.d.cts +1 -1
- package/dist/as-form.d.mts +1 -1
- package/dist/as-form.mjs +1 -1
- package/dist/{as-form.vue-DwqofFJa.d.mts → as-form.vue-BMNZuvpb.d.mts} +54 -20
- package/dist/{as-form.vue-B9MZrw7V.d.cts → as-form.vue-DS5r3CWl.d.cts} +54 -20
- package/dist/{as-input-BEP6nX82.mjs → as-input-D1IO72Tn.mjs} +1 -1
- package/dist/{as-input-BrgRxZag.cjs → as-input-Dy7v1AjV.cjs} +1 -1
- package/dist/as-input.cjs +1 -1
- package/dist/as-input.d.cts +1 -1
- package/dist/as-input.d.mts +1 -1
- package/dist/as-input.mjs +1 -1
- package/dist/{as-input.vue-Cl8DTJqr.d.cts → as-input.vue-DMxFk9uv.d.cts} +1 -1
- package/dist/{as-input.vue-CqV91VOb.d.mts → as-input.vue-DzG-WB4x.d.mts} +1 -1
- package/dist/{as-iterator-DbCm61j1.mjs → as-iterator-A9ozhHhf.mjs} +2 -2
- package/dist/{as-iterator-DeLt7-BO.cjs → as-iterator-C8aJ6SUs.cjs} +2 -2
- package/dist/as-iterator.cjs +1 -1
- package/dist/as-iterator.mjs +1 -1
- package/dist/{as-multi-select-CJ3iRsiL.cjs → as-multi-select-BiOEQf1L.cjs} +4 -8
- package/dist/{as-multi-select-Ca2ULklw.mjs → as-multi-select-CoT5MJd_.mjs} +5 -9
- package/dist/as-multi-select.cjs +1 -1
- package/dist/as-multi-select.d.cts +1 -1
- package/dist/as-multi-select.d.mts +1 -1
- package/dist/as-multi-select.mjs +1 -1
- package/dist/{as-multi-select.vue-B6M_f7u-.d.cts → as-multi-select.vue-CBtBFW6X.d.cts} +1 -1
- package/dist/{as-multi-select.vue-Cvvy1kMm.d.mts → as-multi-select.vue-CGjTCFGD.d.mts} +1 -1
- package/dist/{as-number-CgHRTx6P.mjs → as-number-Ck8nNMCB.mjs} +1 -1
- package/dist/{as-number-CHXaKqtg.cjs → as-number-DKW_PZcq.cjs} +1 -1
- package/dist/as-number.cjs +1 -1
- package/dist/as-number.d.cts +1 -1
- package/dist/as-number.d.mts +1 -1
- package/dist/as-number.mjs +1 -1
- package/dist/{as-number.vue-5U6oFVJC.d.cts → as-number.vue-AKk1tllp.d.mts} +1 -1
- package/dist/{as-number.vue-BN6_1oQf.d.mts → as-number.vue-i5gytLQ2.d.cts} +1 -1
- package/dist/{as-object-BCeBkKCo.mjs → as-object-6GgXdo_K.mjs} +4 -4
- package/dist/{as-object-Babu0BIk.cjs → as-object-DfHzCJcJ.cjs} +4 -4
- package/dist/as-object.cjs +1 -1
- package/dist/as-object.d.cts +1 -1
- package/dist/as-object.d.mts +1 -1
- package/dist/as-object.mjs +1 -1
- package/dist/{as-object.vue-BNCOIwjS.d.mts → as-object.vue-Gor6cnwh.d.mts} +1 -1
- package/dist/{as-object.vue-BnUdIcLW.d.cts → as-object.vue-cwrRrJ2O.d.cts} +1 -1
- package/dist/as-paragraph.d.cts +1 -1
- package/dist/as-paragraph.d.mts +1 -1
- package/dist/{as-paragraph.vue-80Q1bZMd.d.cts → as-paragraph.vue-DqHrI7WD.d.mts} +1 -1
- package/dist/{as-paragraph.vue-Dhy9ke_Z.d.mts → as-paragraph.vue-Ds64gwEP.d.cts} +1 -1
- package/dist/{as-radio-CL6Np-X5.mjs → as-radio-Cc3VOm3A.mjs} +1 -1
- package/dist/{as-radio-BFM_CPvW.cjs → as-radio-DLGMEC9o.cjs} +1 -1
- package/dist/as-radio.cjs +1 -1
- package/dist/as-radio.d.cts +1 -1
- package/dist/as-radio.d.mts +1 -1
- package/dist/as-radio.mjs +1 -1
- package/dist/{as-radio.vue-ByorW-nk.d.cts → as-radio.vue-CkooFq0m.d.cts} +1 -1
- package/dist/{as-radio.vue-CLdvEAmZ.d.mts → as-radio.vue-T0Ejt0II.d.mts} +1 -1
- package/dist/{as-ref-D14yC6np.mjs → as-ref-Cs4i9tpS.mjs} +2 -2
- package/dist/{as-ref-CEj1RBnH.cjs → as-ref-FknTPCae.cjs} +2 -2
- package/dist/as-ref.cjs +1 -1
- package/dist/as-ref.d.cts +1 -1
- package/dist/as-ref.d.mts +1 -1
- package/dist/as-ref.mjs +1 -1
- package/dist/{as-ref.vue--ISeV6VM.d.cts → as-ref.vue-CCzEnDNd.d.cts} +1 -1
- package/dist/{as-ref.vue-DW7vsBE6.d.mts → as-ref.vue-CvStQFs3.d.mts} +1 -1
- package/dist/{as-select-B-ZeOCu5.cjs → as-select-DBxxq0jZ.cjs} +1 -1
- package/dist/{as-select-BME-vti2.mjs → as-select-br9EmsoX.mjs} +1 -1
- package/dist/as-select.cjs +1 -1
- package/dist/as-select.d.cts +1 -1
- package/dist/as-select.d.mts +1 -1
- package/dist/as-select.mjs +1 -1
- package/dist/{as-select.vue-BEfTkycX.d.cts → as-select.vue-CK4AWxmk.d.cts} +1 -1
- package/dist/{as-select.vue-C45NS5Rq.d.mts → as-select.vue-LKjJASjX.d.mts} +1 -1
- package/dist/{as-time-CnuojSkh.cjs → as-time-BmTk1YfU.cjs} +2 -2
- package/dist/{as-time-HRZh7pdx.mjs → as-time-DTz7PrnB.mjs} +2 -2
- package/dist/as-time.cjs +1 -1
- package/dist/as-time.d.cts +1 -1
- package/dist/as-time.d.mts +1 -1
- package/dist/as-time.mjs +1 -1
- package/dist/{as-time.vue--Qmcr-O0.d.cts → as-time.vue-DTRJCO4G.d.cts} +1 -1
- package/dist/{as-time.vue-0M0m0DXe.d.mts → as-time.vue-q2i-2K0N.d.mts} +1 -1
- package/dist/{as-tuple-XpcKK1LK.cjs → as-tuple-BemXpNrJ.cjs} +18 -10
- package/dist/{as-tuple-qHmf6fwJ.mjs → as-tuple-D3IoTMkI.mjs} +19 -11
- package/dist/as-tuple.cjs +1 -1
- package/dist/as-tuple.d.cts +1 -1
- package/dist/as-tuple.d.mts +1 -1
- package/dist/as-tuple.mjs +1 -1
- package/dist/{as-tuple.vue-CKbx_YFz.d.mts → as-tuple.vue-BEY7sq9x.d.cts} +1 -1
- package/dist/{as-tuple.vue-Di5D2HD4.d.cts → as-tuple.vue-CNgBlckL.d.mts} +1 -1
- package/dist/{as-union-Ca5o9xw2.mjs → as-union-CIEUE2Xd.mjs} +26 -5
- package/dist/{as-union-CwB0ACpI.cjs → as-union-DqRkSoIr.cjs} +25 -4
- package/dist/as-union.cjs +1 -1
- package/dist/as-union.d.cts +1 -1
- package/dist/as-union.d.mts +1 -1
- package/dist/as-union.mjs +1 -1
- package/dist/{as-union.vue-UnG0zG81.d.cts → as-union.vue-B3KVCUUI.d.mts} +1 -1
- package/dist/{as-union.vue-eGlHN_hp.d.mts → as-union.vue-CGk27JvO.d.cts} +1 -1
- package/dist/{as-variant-picker-CKSLKefM.mjs → as-variant-picker-O_6JNWLk.mjs} +1 -1
- package/dist/{as-variant-picker-CceIhZUk.cjs → as-variant-picker-apxtW5rZ.cjs} +1 -1
- package/dist/index.cjs +42 -24
- package/dist/index.d.cts +22 -22
- package/dist/index.d.mts +22 -22
- package/dist/index.mjs +26 -26
- package/dist/{types-C5Gx4ZuF.d.mts → types-BXTpoOfM.d.cts} +26 -9
- package/dist/{types-D23g9Vs-.d.cts → types-CXGcf7sO.d.mts} +26 -9
- package/dist/{use-as-date-BWJbi_j2.cjs → use-as-date-CpkJjcyB.cjs} +18 -14
- package/dist/{use-as-date-B2hKWXAl.mjs → use-as-date-FsgcnN9l.mjs} +18 -14
- package/dist/{use-as-model-texts-BXSEzUWJ.mjs → use-as-model-texts-D26kn80o.mjs} +1 -1
- package/dist/{use-as-model-texts-BSFCEwAa.cjs → use-as-model-texts-DR4s80Mb.cjs} +1 -1
- package/dist/{use-as-value-help-ZR_BvS0L.cjs → use-as-value-help-CIvYUvdk.cjs} +12 -7
- package/dist/{use-as-value-help-B5yNO1tE.mjs → use-as-value-help-b4tk3NRF.mjs} +12 -7
- package/dist/{use-form-context-U6vg1uqK.cjs → use-form-context-BPlkQwkM.cjs} +16 -0
- package/dist/{use-form-context-0FtVVTvf.mjs → use-form-context-D_ejQqCc.mjs} +12 -2
- package/package.json +9 -9
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { r as resetKeepingFocus } from "./focus-after-toggle-DAwak7c1.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { S as TYPES_KEY, a as ACTION_HANDLER_KEY, b as PATH_PREFIX_KEY, c as DISMISS_EXTERNAL_AT_KEY, d as FORM_DATA_KEY, f as FORM_NORMALIZED_DATA_KEY, g as HIDE_ROOT_TITLE_KEY, h as FORM_STATE_KEY, l as ERRORS_KEY, m as FORM_PATCH_KEY, o as CHANGE_HANDLER_KEY, p as FORM_OPTIONAL_KEY, s as COMPONENTS_KEY, u as FORM_CONTEXT_KEY, v as LOCK_KEY, x as ROOT_DATA_KEY, y as MODEL_TEXTS_KEY } from "./use-form-context-D_ejQqCc.mjs";
|
|
3
3
|
import { i as useAsNestedSectionsStore, n as provideAsNestedSectionsStore, t as DESCENDANT_ERROR_COUNTS_KEY } from "./use-as-nested-sections-store-CkrMJbnN.mjs";
|
|
4
|
-
import { r as fieldDisplayText, t as CLIENT_FACTORY_KEY } from "./use-as-value-help-
|
|
4
|
+
import { r as fieldDisplayText, t as CLIENT_FACTORY_KEY } from "./use-as-value-help-b4tk3NRF.mjs";
|
|
5
5
|
import { o as useAsTexts } from "./use-as-locale-CznDr-7i.mjs";
|
|
6
6
|
import { t as useValueHelpTexts } from "./use-value-help-texts-LySFdZya.mjs";
|
|
7
|
-
import { t as as_field_default } from "./as-field-
|
|
8
|
-
import { t as as_iterator_default } from "./as-iterator-
|
|
7
|
+
import { t as as_field_default } from "./as-field-C6iquEB1.mjs";
|
|
8
|
+
import { t as as_iterator_default } from "./as-iterator-A9ozhHhf.mjs";
|
|
9
9
|
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, inject, isProxy, isRef, mergeProps, nextTick, normalizeProps, openBlock, provide, reactive, ref, renderSlot, shallowRef, toDisplayString, toRaw, toValue, unref, watch, watchEffect, withModifiers } from "vue";
|
|
10
|
-
import { FORM_ERROR_KEY, META_DESCRIPTION, META_LABEL, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_SUBMIT_TEXT, buildDescendantErrorCounts, buildFormDiff, buildFormRebase, collectDirtyPaths, createFormData, createFormValueResolver, deepClone, deepEqual, deleteByPath, displayValue, getByPath,
|
|
10
|
+
import { FORM_ERROR_KEY, META_DESCRIPTION, META_LABEL, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_SUBMIT_TEXT, buildDescendantErrorCounts, buildFormDiff, buildFormRebase, collectDirtyPaths, createFormData, createFormValueResolver, deepClone, deepEqual, deleteByPath, displayValue, formPayload, getByPath, getDeclaredFormAction, getFormValidator, iteratePathAncestors, mergeErrorMaps, normalizeLoadedEmpty, omitPaths, resolveFormProp, setByPath, unionVariantChanged } from "@atscript/ui";
|
|
11
11
|
//#region src/composables/use-as-form-patch.ts
|
|
12
12
|
/**
|
|
13
13
|
* Internal factory invoked by `useAsForm` when `trackChanges` is enabled. Owns
|
|
@@ -354,28 +354,20 @@ function useAsState(opts) {
|
|
|
354
354
|
formState.firstSubmitHappened = true;
|
|
355
355
|
formState.freshFields.clear();
|
|
356
356
|
if (formState.firstValidation === "none") return true;
|
|
357
|
-
|
|
358
|
-
const errors = opts.submitValidator();
|
|
359
|
-
const entries = Object.entries(errors);
|
|
360
|
-
if (entries.length === 0) return true;
|
|
361
|
-
setErrors(errors);
|
|
362
|
-
return entries.map(([path, message]) => ({
|
|
363
|
-
path,
|
|
364
|
-
message
|
|
365
|
-
}));
|
|
366
|
-
}
|
|
367
|
-
const errors = [];
|
|
357
|
+
const errors = { ...opts.submitValidator?.() };
|
|
368
358
|
for (const reg of fieldsById.values()) {
|
|
359
|
+
if (opts.submitValidator && reg.validated) continue;
|
|
369
360
|
const result = reg.callbacks.validate();
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
errors.push({
|
|
373
|
-
path,
|
|
374
|
-
message: result
|
|
375
|
-
});
|
|
376
|
-
}
|
|
361
|
+
const path = reg.path();
|
|
362
|
+
if (result !== true && errors[path] === void 0) errors[path] = result;
|
|
377
363
|
}
|
|
378
|
-
|
|
364
|
+
const entries = Object.entries(errors);
|
|
365
|
+
if (entries.length === 0) return true;
|
|
366
|
+
setErrors(errors);
|
|
367
|
+
return entries.map(([path, message]) => ({
|
|
368
|
+
path,
|
|
369
|
+
message
|
|
370
|
+
}));
|
|
379
371
|
}
|
|
380
372
|
function setErrors(errors) {
|
|
381
373
|
for (const reg of fieldsById.values()) {
|
|
@@ -570,6 +562,7 @@ function useAsForm(options) {
|
|
|
570
562
|
loading: options.loading?.() === true,
|
|
571
563
|
submitText: submitText.value,
|
|
572
564
|
submit: onSubmit,
|
|
565
|
+
action: invokeAction,
|
|
573
566
|
reset,
|
|
574
567
|
revert,
|
|
575
568
|
clearErrors,
|
|
@@ -584,22 +577,10 @@ function useAsForm(options) {
|
|
|
584
577
|
isDirtyPath: patch ? patch.isDirtyPath : EMPTY_IS_DIRTY_PATH,
|
|
585
578
|
displayText
|
|
586
579
|
}));
|
|
587
|
-
function supportsAction(def, actionId) {
|
|
588
|
-
return getDeclaredFormActions(def).some((a) => a.id === actionId);
|
|
589
|
-
}
|
|
590
|
-
/**
|
|
591
|
-
* What the form sends — on submit and with an action: without the related rows of
|
|
592
|
-
* navigation fields the form leaves out (loaded with `$with`, never rendered or
|
|
593
|
-
* validated) and without the fields the server owns (`derived`: `/meta` `readOnly`,
|
|
594
|
-
* computed, …).
|
|
595
|
-
*/
|
|
596
|
-
function outgoing(def, data) {
|
|
597
|
-
return omitDerivedFields(def, omitSkippedNavFields(def, data));
|
|
598
|
-
}
|
|
599
580
|
function invokeAction(name) {
|
|
600
581
|
const def = options.def();
|
|
601
|
-
const data =
|
|
602
|
-
if (
|
|
582
|
+
const data = formPayload(def, formValidator.value.normalize(domainData()));
|
|
583
|
+
if (getDeclaredFormAction(def, name)) options.emits?.action?.(name, data);
|
|
603
584
|
else options.emits?.unsupportedAction?.(name, data);
|
|
604
585
|
}
|
|
605
586
|
provide(ACTION_HANDLER_KEY, invokeAction);
|
|
@@ -621,7 +602,7 @@ function useAsForm(options) {
|
|
|
621
602
|
const result = submit();
|
|
622
603
|
if (result === true) {
|
|
623
604
|
internalErrors.value = {};
|
|
624
|
-
const payload =
|
|
605
|
+
const payload = formPayload(options.def(), data);
|
|
625
606
|
options.emits?.submit?.(payload);
|
|
626
607
|
return {
|
|
627
608
|
ok: true,
|
package/dist/as-form.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_as_form = require("./as-form-
|
|
1
|
+
const require_as_form = require("./as-form-B4-StU3b.cjs");
|
|
2
2
|
module.exports = require_as_form.as_form_default;
|
package/dist/as-form.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as _default, t as Props } from "./as-form.vue-
|
|
1
|
+
import { n as _default, t as Props } from "./as-form.vue-DS5r3CWl.cjs";
|
|
2
2
|
export { Props, _default as default };
|
package/dist/as-form.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as _default, t as Props } from "./as-form.vue-
|
|
1
|
+
import { n as _default, t as Props } from "./as-form.vue-BMNZuvpb.mjs";
|
|
2
2
|
export { Props, _default as default };
|
package/dist/as-form.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_form_default } from "./as-form-
|
|
1
|
+
import { t as as_form_default } from "./as-form-DQePBFwR.mjs";
|
|
2
2
|
export { as_form_default as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
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-
|
|
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,7 +97,12 @@ 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;
|
|
98
107
|
/**
|
|
99
108
|
* The client factory dictionary texts are read with (`formState.displayText`):
|
|
@@ -187,7 +196,12 @@ interface UseAsTupleReturn {
|
|
|
187
196
|
clear: () => void;
|
|
188
197
|
fillMissing: () => void;
|
|
189
198
|
}
|
|
190
|
-
/**
|
|
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
|
+
*/
|
|
191
205
|
declare function useAsTuple(field: FormTupleFieldDef): UseAsTupleReturn;
|
|
192
206
|
//#endregion
|
|
193
207
|
//#region src/composables/use-as-union.d.ts
|
|
@@ -199,7 +213,11 @@ interface UseAsUnionReturn {
|
|
|
199
213
|
changeVariant: (newIndex: number) => void;
|
|
200
214
|
optionalEnabled: ComputedRef<boolean>;
|
|
201
215
|
}
|
|
202
|
-
/**
|
|
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
|
+
*/
|
|
203
221
|
declare function useAsUnion(props: TAsComponentProps): UseAsUnionReturn;
|
|
204
222
|
//#endregion
|
|
205
223
|
//#region src/composables/use-form-context.d.ts
|
|
@@ -407,7 +425,8 @@ interface UseAsOptionalFieldReturn {
|
|
|
407
425
|
/**
|
|
408
426
|
* Enable (initialize with annotated defaults, like AsField's optional
|
|
409
427
|
* toggle) or disable (clear to `undefined`) the field. Emits the
|
|
410
|
-
* 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`).
|
|
411
430
|
*/
|
|
412
431
|
toggle: (enabled: boolean) => void;
|
|
413
432
|
}
|
|
@@ -598,15 +617,16 @@ interface UseAsDecimalOptions {
|
|
|
598
617
|
/** Read the current value. Storage shape is preserved on commit. */
|
|
599
618
|
modelValue: () => string | number | null | undefined;
|
|
600
619
|
/**
|
|
601
|
-
*
|
|
602
|
-
* to
|
|
603
|
-
*
|
|
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").
|
|
604
624
|
*/
|
|
605
625
|
scale?: () => number | undefined;
|
|
606
626
|
/**
|
|
607
627
|
* Storage cap (DB column scale). Outgoing strings are padded to this
|
|
608
628
|
* regardless of `scale` — display can be tighter than storage. When
|
|
609
|
-
* absent,
|
|
629
|
+
* absent, nothing caps the value's digits.
|
|
610
630
|
*/
|
|
611
631
|
storageScale?: () => number | undefined;
|
|
612
632
|
/** Locale override; defaults to `useAsLocale()` then runtime locale. */
|
|
@@ -615,9 +635,13 @@ interface UseAsDecimalOptions {
|
|
|
615
635
|
onCommit: (value: string | number | null) => void;
|
|
616
636
|
}
|
|
617
637
|
interface UseAsDecimalReturn {
|
|
618
|
-
/**
|
|
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
|
+
*/
|
|
619
643
|
scale: ComputedRef<number>;
|
|
620
|
-
/** Storage cap (always populated; falls back to effective scale
|
|
644
|
+
/** Storage cap (always populated; falls back to the effective `scale`). */
|
|
621
645
|
storageScale: ComputedRef<number>;
|
|
622
646
|
decimalSeparator: ComputedRef<string>;
|
|
623
647
|
thousandsSeparator: ComputedRef<string>;
|
|
@@ -646,9 +670,11 @@ interface UseAsDecimalReturn {
|
|
|
646
670
|
*
|
|
647
671
|
* Storage shape is preserved on commit — string `modelValue` commits a
|
|
648
672
|
* string padded to `storageScale`; number `modelValue` commits a number.
|
|
649
|
-
* A
|
|
650
|
-
*
|
|
651
|
-
*
|
|
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.
|
|
652
678
|
*/
|
|
653
679
|
declare function useAsDecimal(opts: UseAsDecimalOptions): UseAsDecimalReturn;
|
|
654
680
|
//#endregion
|
|
@@ -781,8 +807,9 @@ interface UseAsDateReturn {
|
|
|
781
807
|
*
|
|
782
808
|
* - `'date'`: epoch-ms ↔ `YYYY-MM-DD` (local TZ).
|
|
783
809
|
* Empty input commits `null`. A string-stored field (`prop`) or one
|
|
784
|
-
* holding a `string` commits a string (`YYYY-MM-DD`); otherwise epoch-ms
|
|
785
|
-
* 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`).
|
|
786
813
|
* - `'datetime'`: epoch-ms ↔ `YYYY-MM-DDTHH:mm` (local TZ).
|
|
787
814
|
* - `'time'`: prev-string ↔ `HH:mm`. Numeric storage isn't meaningful
|
|
788
815
|
* for naked time-of-day, so we commit a string.
|
|
@@ -893,8 +920,8 @@ interface Props<TF, TC> {
|
|
|
893
920
|
}
|
|
894
921
|
declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
895
922
|
props: vue.PublicProps & __VLS_PrettifyLocal<Props<TFormData, TFormContext> & {
|
|
896
|
-
onSubmit?: ((data: TAsFormValue<TFormData>) => any) | undefined;
|
|
897
923
|
onError?: ((errors: TAsFormError[]) => any) | undefined;
|
|
924
|
+
onSubmit?: ((data: TAsFormValue<TFormData>) => any) | undefined;
|
|
898
925
|
onAction?: ((name: string, data: TAsFormValue<TFormData>) => any) | undefined;
|
|
899
926
|
"onUnsupported-action"?: ((name: string, data: TAsFormValue<TFormData>) => any) | undefined;
|
|
900
927
|
onChange?: ((type: TAsChangeType, path: string, value: unknown, formData: TAsFormValue<TFormData>) => any) | undefined;
|
|
@@ -916,6 +943,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
916
943
|
loading: boolean;
|
|
917
944
|
submitText: string;
|
|
918
945
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
946
|
+
action: (name: string) => void;
|
|
919
947
|
clearErrors: () => void;
|
|
920
948
|
setErrors: (errors: Record<string, string>) => void;
|
|
921
949
|
dismissError: (path: string) => void;
|
|
@@ -941,6 +969,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
941
969
|
loading: boolean;
|
|
942
970
|
submitText: string;
|
|
943
971
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
972
|
+
action: (name: string) => void;
|
|
944
973
|
clearErrors: () => void;
|
|
945
974
|
setErrors: (errors: Record<string, string>) => void;
|
|
946
975
|
dismissError: (path: string) => void;
|
|
@@ -966,6 +995,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
966
995
|
loading: boolean;
|
|
967
996
|
submitText: string;
|
|
968
997
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
998
|
+
action: (name: string) => void;
|
|
969
999
|
clearErrors: () => void;
|
|
970
1000
|
setErrors: (errors: Record<string, string>) => void;
|
|
971
1001
|
dismissError: (path: string) => void;
|
|
@@ -993,6 +1023,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
993
1023
|
loading: boolean;
|
|
994
1024
|
submitText: string;
|
|
995
1025
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
1026
|
+
action: (name: string) => void;
|
|
996
1027
|
clearErrors: () => void;
|
|
997
1028
|
setErrors: (errors: Record<string, string>) => void;
|
|
998
1029
|
dismissError: (path: string) => void;
|
|
@@ -1019,6 +1050,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1019
1050
|
loading: boolean;
|
|
1020
1051
|
submitText: string;
|
|
1021
1052
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
1053
|
+
action: (name: string) => void;
|
|
1022
1054
|
clearErrors: () => void;
|
|
1023
1055
|
setErrors: (errors: Record<string, string>) => void;
|
|
1024
1056
|
dismissError: (path: string) => void;
|
|
@@ -1044,6 +1076,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1044
1076
|
loading: boolean;
|
|
1045
1077
|
submitText: string;
|
|
1046
1078
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
1079
|
+
action: (name: string) => void;
|
|
1047
1080
|
clearErrors: () => void;
|
|
1048
1081
|
setErrors: (errors: Record<string, string>) => void;
|
|
1049
1082
|
dismissError: (path: string) => void;
|
|
@@ -1069,6 +1102,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1069
1102
|
loading: boolean;
|
|
1070
1103
|
submitText: string;
|
|
1071
1104
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
1105
|
+
action: (name: string) => void;
|
|
1072
1106
|
clearErrors: () => void;
|
|
1073
1107
|
setErrors: (errors: Record<string, string>) => void;
|
|
1074
1108
|
dismissError: (path: string) => void;
|
|
@@ -1095,4 +1129,4 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1095
1129
|
declare const _default: typeof __VLS_export;
|
|
1096
1130
|
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K] } : { [K in keyof T as K]: T[K] }) & {};
|
|
1097
1131
|
//#endregion
|
|
1098
|
-
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 { 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-
|
|
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,7 +97,12 @@ 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;
|
|
98
107
|
/**
|
|
99
108
|
* The client factory dictionary texts are read with (`formState.displayText`):
|
|
@@ -187,7 +196,12 @@ interface UseAsTupleReturn {
|
|
|
187
196
|
clear: () => void;
|
|
188
197
|
fillMissing: () => void;
|
|
189
198
|
}
|
|
190
|
-
/**
|
|
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
|
+
*/
|
|
191
205
|
declare function useAsTuple(field: FormTupleFieldDef): UseAsTupleReturn;
|
|
192
206
|
//#endregion
|
|
193
207
|
//#region src/composables/use-as-union.d.ts
|
|
@@ -199,7 +213,11 @@ interface UseAsUnionReturn {
|
|
|
199
213
|
changeVariant: (newIndex: number) => void;
|
|
200
214
|
optionalEnabled: ComputedRef<boolean>;
|
|
201
215
|
}
|
|
202
|
-
/**
|
|
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
|
+
*/
|
|
203
221
|
declare function useAsUnion(props: TAsComponentProps): UseAsUnionReturn;
|
|
204
222
|
//#endregion
|
|
205
223
|
//#region src/composables/use-form-context.d.ts
|
|
@@ -407,7 +425,8 @@ interface UseAsOptionalFieldReturn {
|
|
|
407
425
|
/**
|
|
408
426
|
* Enable (initialize with annotated defaults, like AsField's optional
|
|
409
427
|
* toggle) or disable (clear to `undefined`) the field. Emits the
|
|
410
|
-
* 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`).
|
|
411
430
|
*/
|
|
412
431
|
toggle: (enabled: boolean) => void;
|
|
413
432
|
}
|
|
@@ -598,15 +617,16 @@ interface UseAsDecimalOptions {
|
|
|
598
617
|
/** Read the current value. Storage shape is preserved on commit. */
|
|
599
618
|
modelValue: () => string | number | null | undefined;
|
|
600
619
|
/**
|
|
601
|
-
*
|
|
602
|
-
* to
|
|
603
|
-
*
|
|
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").
|
|
604
624
|
*/
|
|
605
625
|
scale?: () => number | undefined;
|
|
606
626
|
/**
|
|
607
627
|
* Storage cap (DB column scale). Outgoing strings are padded to this
|
|
608
628
|
* regardless of `scale` — display can be tighter than storage. When
|
|
609
|
-
* absent,
|
|
629
|
+
* absent, nothing caps the value's digits.
|
|
610
630
|
*/
|
|
611
631
|
storageScale?: () => number | undefined;
|
|
612
632
|
/** Locale override; defaults to `useAsLocale()` then runtime locale. */
|
|
@@ -615,9 +635,13 @@ interface UseAsDecimalOptions {
|
|
|
615
635
|
onCommit: (value: string | number | null) => void;
|
|
616
636
|
}
|
|
617
637
|
interface UseAsDecimalReturn {
|
|
618
|
-
/**
|
|
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
|
+
*/
|
|
619
643
|
scale: ComputedRef<number>;
|
|
620
|
-
/** Storage cap (always populated; falls back to effective scale
|
|
644
|
+
/** Storage cap (always populated; falls back to the effective `scale`). */
|
|
621
645
|
storageScale: ComputedRef<number>;
|
|
622
646
|
decimalSeparator: ComputedRef<string>;
|
|
623
647
|
thousandsSeparator: ComputedRef<string>;
|
|
@@ -646,9 +670,11 @@ interface UseAsDecimalReturn {
|
|
|
646
670
|
*
|
|
647
671
|
* Storage shape is preserved on commit — string `modelValue` commits a
|
|
648
672
|
* string padded to `storageScale`; number `modelValue` commits a number.
|
|
649
|
-
* A
|
|
650
|
-
*
|
|
651
|
-
*
|
|
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.
|
|
652
678
|
*/
|
|
653
679
|
declare function useAsDecimal(opts: UseAsDecimalOptions): UseAsDecimalReturn;
|
|
654
680
|
//#endregion
|
|
@@ -781,8 +807,9 @@ interface UseAsDateReturn {
|
|
|
781
807
|
*
|
|
782
808
|
* - `'date'`: epoch-ms ↔ `YYYY-MM-DD` (local TZ).
|
|
783
809
|
* Empty input commits `null`. A string-stored field (`prop`) or one
|
|
784
|
-
* holding a `string` commits a string (`YYYY-MM-DD`); otherwise epoch-ms
|
|
785
|
-
* 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`).
|
|
786
813
|
* - `'datetime'`: epoch-ms ↔ `YYYY-MM-DDTHH:mm` (local TZ).
|
|
787
814
|
* - `'time'`: prev-string ↔ `HH:mm`. Numeric storage isn't meaningful
|
|
788
815
|
* for naked time-of-day, so we commit a string.
|
|
@@ -893,8 +920,8 @@ interface Props<TF, TC> {
|
|
|
893
920
|
}
|
|
894
921
|
declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
895
922
|
props: vue.PublicProps & __VLS_PrettifyLocal<Props<TFormData, TFormContext> & {
|
|
896
|
-
onSubmit?: ((data: TAsFormValue<TFormData>) => any) | undefined;
|
|
897
923
|
onError?: ((errors: TAsFormError[]) => any) | undefined;
|
|
924
|
+
onSubmit?: ((data: TAsFormValue<TFormData>) => any) | undefined;
|
|
898
925
|
onAction?: ((name: string, data: TAsFormValue<TFormData>) => any) | undefined;
|
|
899
926
|
"onUnsupported-action"?: ((name: string, data: TAsFormValue<TFormData>) => any) | undefined;
|
|
900
927
|
onChange?: ((type: TAsChangeType, path: string, value: unknown, formData: TAsFormValue<TFormData>) => any) | undefined;
|
|
@@ -916,6 +943,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
916
943
|
loading: boolean;
|
|
917
944
|
submitText: string;
|
|
918
945
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
946
|
+
action: (name: string) => void;
|
|
919
947
|
clearErrors: () => void;
|
|
920
948
|
setErrors: (errors: Record<string, string>) => void;
|
|
921
949
|
dismissError: (path: string) => void;
|
|
@@ -941,6 +969,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
941
969
|
loading: boolean;
|
|
942
970
|
submitText: string;
|
|
943
971
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
972
|
+
action: (name: string) => void;
|
|
944
973
|
clearErrors: () => void;
|
|
945
974
|
setErrors: (errors: Record<string, string>) => void;
|
|
946
975
|
dismissError: (path: string) => void;
|
|
@@ -966,6 +995,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
966
995
|
loading: boolean;
|
|
967
996
|
submitText: string;
|
|
968
997
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
998
|
+
action: (name: string) => void;
|
|
969
999
|
clearErrors: () => void;
|
|
970
1000
|
setErrors: (errors: Record<string, string>) => void;
|
|
971
1001
|
dismissError: (path: string) => void;
|
|
@@ -993,6 +1023,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
993
1023
|
loading: boolean;
|
|
994
1024
|
submitText: string;
|
|
995
1025
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
1026
|
+
action: (name: string) => void;
|
|
996
1027
|
clearErrors: () => void;
|
|
997
1028
|
setErrors: (errors: Record<string, string>) => void;
|
|
998
1029
|
dismissError: (path: string) => void;
|
|
@@ -1019,6 +1050,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1019
1050
|
loading: boolean;
|
|
1020
1051
|
submitText: string;
|
|
1021
1052
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
1053
|
+
action: (name: string) => void;
|
|
1022
1054
|
clearErrors: () => void;
|
|
1023
1055
|
setErrors: (errors: Record<string, string>) => void;
|
|
1024
1056
|
dismissError: (path: string) => void;
|
|
@@ -1044,6 +1076,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1044
1076
|
loading: boolean;
|
|
1045
1077
|
submitText: string;
|
|
1046
1078
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
1079
|
+
action: (name: string) => void;
|
|
1047
1080
|
clearErrors: () => void;
|
|
1048
1081
|
setErrors: (errors: Record<string, string>) => void;
|
|
1049
1082
|
dismissError: (path: string) => void;
|
|
@@ -1069,6 +1102,7 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1069
1102
|
loading: boolean;
|
|
1070
1103
|
submitText: string;
|
|
1071
1104
|
submit: () => TAsFormSubmitResult<TFormData>;
|
|
1105
|
+
action: (name: string) => void;
|
|
1072
1106
|
clearErrors: () => void;
|
|
1073
1107
|
setErrors: (errors: Record<string, string>) => void;
|
|
1074
1108
|
dismissError: (path: string) => void;
|
|
@@ -1095,4 +1129,4 @@ declare const __VLS_export: <TFormData = any, TFormContext = any>(__VLS_props: N
|
|
|
1095
1129
|
declare const _default: typeof __VLS_export;
|
|
1096
1130
|
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K] } : { [K in keyof T as K]: T[K] }) & {};
|
|
1097
1131
|
//#endregion
|
|
1098
|
-
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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as as_field_shell_default } from "./as-field-shell-
|
|
1
|
+
import { t as as_field_shell_default } from "./as-field-shell-DXbAJupk.mjs";
|
|
2
2
|
import { t as as_input_control_default } from "./as-input-control-CINIJm-h.mjs";
|
|
3
3
|
import { t as as_adornment_shell_default } from "./as-adornment-shell-C_z_q-mz.mjs";
|
|
4
4
|
import { computed, createBlock, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, withCtx } from "vue";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_as_field_shell = require("./as-field-shell-
|
|
1
|
+
const require_as_field_shell = require("./as-field-shell-CMq52Z6e.cjs");
|
|
2
2
|
const require_as_input_control = require("./as-input-control-DXJBrgih.cjs");
|
|
3
3
|
const require_as_adornment_shell = require("./as-adornment-shell-CgwCACXA.cjs");
|
|
4
4
|
let vue = require("vue");
|
package/dist/as-input.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_as_input = require("./as-input-
|
|
1
|
+
const require_as_input = require("./as-input-Dy7v1AjV.cjs");
|
|
2
2
|
module.exports = require_as_input.as_input_default;
|
package/dist/as-input.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "./as-input.vue-
|
|
1
|
+
import { t as _default } from "./as-input.vue-DMxFk9uv.cjs";
|
|
2
2
|
export = _default;
|
package/dist/as-input.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "./as-input.vue-
|
|
1
|
+
import { t as _default } from "./as-input.vue-DzG-WB4x.mjs";
|
|
2
2
|
export { _default as default };
|
package/dist/as-input.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_input_default } from "./as-input-
|
|
1
|
+
import { t as as_input_default } from "./as-input-D1IO72Tn.mjs";
|
|
2
2
|
export { as_input_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as as_field_default } from "./as-field-
|
|
1
|
+
import { _ as LEVEL_KEY, b as PATH_PREFIX_KEY } from "./use-form-context-D_ejQqCc.mjs";
|
|
2
|
+
import { t as as_field_default } from "./as-field-C6iquEB1.mjs";
|
|
3
3
|
import { Fragment, computed, createBlock, createElementBlock, defineComponent, inject, openBlock, provide, renderList } from "vue";
|
|
4
4
|
import { joinPath } from "@atscript/ui";
|
|
5
5
|
//#region src/composables/use-as-level.ts
|