@atscript/vue-form 0.1.176 → 0.1.177
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-array-DnxeuRPB.mjs → as-array-CGsGZFi8.mjs} +11 -16
- package/dist/{as-array-DjJ_GA65.cjs → as-array-DMN1xd4A.cjs} +10 -15
- package/dist/{as-array-clear-btn-DkmJoCjN.mjs → as-array-clear-btn-CKlJCXkv.mjs} +1 -1
- package/dist/{as-array-clear-btn-DSuk9U43.cjs → as-array-clear-btn-CMvSOc1R.cjs} +1 -1
- package/dist/as-array.cjs +1 -1
- package/dist/as-array.mjs +1 -1
- package/dist/{as-checkbox-BivClBCD.mjs → as-checkbox-B0OB5a9J.mjs} +2 -2
- package/dist/{as-checkbox-52v5CL8Z.cjs → as-checkbox-CIgpJSiD.cjs} +2 -2
- package/dist/as-checkbox.cjs +1 -1
- package/dist/as-checkbox.mjs +1 -1
- package/dist/{as-collapsible-B_YnV9V8.mjs → as-collapsible-B7pG3XLt.mjs} +1 -1
- package/dist/{as-collapsible-COchVoS0.cjs → as-collapsible-D3UhCddg.cjs} +1 -1
- package/dist/as-collapsible.cjs +1 -1
- package/dist/as-collapsible.mjs +1 -1
- package/dist/{as-date-Dsv_nimP.mjs → as-date-CLd_CV0y.mjs} +1 -1
- package/dist/{as-date-HUhD-kZ4.cjs → as-date-ClMkBzD6.cjs} +1 -1
- package/dist/as-date.cjs +1 -1
- package/dist/as-date.mjs +1 -1
- package/dist/{as-datetime-BxMIrM_M.mjs → as-datetime-D6DXx0j9.mjs} +1 -1
- package/dist/{as-datetime-CiL-vlD2.cjs → as-datetime-DdNS4GKj.cjs} +1 -1
- package/dist/as-datetime.cjs +1 -1
- package/dist/as-datetime.mjs +1 -1
- package/dist/{as-decimal-DA24-Wtp.cjs → as-decimal-BbE2SktW.cjs} +1 -1
- package/dist/{as-decimal-DegSeh2G.mjs → as-decimal-D8emq_SN.mjs} +1 -1
- package/dist/as-decimal.cjs +1 -1
- package/dist/as-decimal.mjs +1 -1
- package/dist/{as-field-D6clFBPR.mjs → as-field-CUIvj5hx.mjs} +7 -11
- package/dist/{as-field-CeJbqaGj.cjs → as-field-gBXYA3zZ.cjs} +6 -10
- package/dist/{as-field-shell-IaUBze1S.mjs → as-field-shell-DjYBbigs.mjs} +2 -2
- package/dist/{as-field-shell-rghztVd7.cjs → as-field-shell-R8DyS1tc.cjs} +2 -2
- package/dist/as-field-shell.cjs +1 -1
- package/dist/as-field-shell.mjs +1 -1
- package/dist/as-field.cjs +1 -1
- package/dist/as-field.mjs +1 -1
- package/dist/{as-form-Bo-QNGot.cjs → as-form-ChlZL6WP.cjs} +49 -23
- package/dist/{as-form-D-RQUPnK.mjs → as-form-DCxGV2-w.mjs} +50 -24
- 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-Bx1yZIBk.d.cts → as-form.vue-D2osFDt6.d.cts} +26 -9
- package/dist/{as-form.vue-Bxq1IR_f.d.mts → as-form.vue-DJAftKr2.d.mts} +26 -9
- package/dist/{as-input-DGvRZOy5.cjs → as-input-C1Iw2AkY.cjs} +1 -1
- package/dist/{as-input-CijlzZ8Q.mjs → as-input-MVamvBMv.mjs} +1 -1
- package/dist/as-input.cjs +1 -1
- package/dist/as-input.mjs +1 -1
- package/dist/{as-iterator-D643RugN.cjs → as-iterator-B7h3xaKQ.cjs} +2 -2
- package/dist/{as-iterator-CgGSiI_d.mjs → as-iterator-BTcoyKFq.mjs} +2 -2
- package/dist/as-iterator.cjs +1 -1
- package/dist/as-iterator.mjs +1 -1
- package/dist/{as-multi-select-BXnZLgjt.mjs → as-multi-select-BQZvt3Fr.mjs} +1 -1
- package/dist/{as-multi-select-JUB05J_p.cjs → as-multi-select-DDNIusOV.cjs} +1 -1
- package/dist/as-multi-select.cjs +1 -1
- package/dist/as-multi-select.mjs +1 -1
- package/dist/{as-number-TfNY5CgX.cjs → as-number-BUid7j2k.cjs} +1 -1
- package/dist/{as-number-DkeEBWva.mjs → as-number-CT3DSCBF.mjs} +1 -1
- package/dist/as-number.cjs +1 -1
- package/dist/as-number.mjs +1 -1
- package/dist/{as-object-lKSwKkt7.cjs → as-object-CB8Un-GN.cjs} +4 -4
- package/dist/{as-object-BAsjdh_N.mjs → as-object-DaUkalfF.mjs} +4 -4
- package/dist/as-object.cjs +1 -1
- package/dist/as-object.mjs +1 -1
- package/dist/{as-radio-DEHsBgwQ.cjs → as-radio-B9eRK1Sr.cjs} +1 -1
- package/dist/{as-radio-CHwzhcQE.mjs → as-radio-QqVLOzED.mjs} +1 -1
- package/dist/as-radio.cjs +1 -1
- package/dist/as-radio.mjs +1 -1
- package/dist/{as-ref-N0dohgyv.mjs → as-ref-BUxC1GPm.mjs} +34 -12
- package/dist/{as-ref-DgdRW4ST.cjs → as-ref-C4euogko.cjs} +33 -11
- package/dist/as-ref.cjs +1 -1
- package/dist/as-ref.mjs +1 -1
- package/dist/{as-select-bmYhMEV_.mjs → as-select-BNm4pgAW.mjs} +1 -1
- package/dist/{as-select-YPLFDuAQ.cjs → as-select-BvfuZLwz.cjs} +1 -1
- package/dist/as-select.cjs +1 -1
- package/dist/as-select.mjs +1 -1
- package/dist/{as-time-21ZSGDiq.cjs → as-time-B74WYv_l.cjs} +1 -1
- package/dist/{as-time-D107-bEJ.mjs → as-time-Cz_jvm6T.mjs} +1 -1
- package/dist/as-time.cjs +1 -1
- package/dist/as-time.mjs +1 -1
- package/dist/{as-tuple-5nsBvO-n.cjs → as-tuple-5EyboNQq.cjs} +7 -8
- package/dist/{as-tuple-gNyJxwi4.mjs → as-tuple-BtREHMCP.mjs} +8 -9
- package/dist/as-tuple.cjs +1 -1
- package/dist/as-tuple.mjs +1 -1
- package/dist/{as-union-BLTGJOyB.mjs → as-union-BF-YDJDs.mjs} +5 -8
- package/dist/{as-union-BuCn5dN6.cjs → as-union-CcZalTHx.cjs} +4 -7
- package/dist/as-union.cjs +1 -1
- package/dist/as-union.mjs +1 -1
- package/dist/{as-variant-picker-DJ_sqKD3.mjs → as-variant-picker-D6qxuUZA.mjs} +1 -1
- package/dist/{as-variant-picker-BxOP4dkG.cjs → as-variant-picker-LRFryLRJ.cjs} +1 -1
- package/dist/index.cjs +23 -23
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +23 -23
- package/dist/{use-as-model-texts-DJf4hBHf.mjs → use-as-model-texts-BfvRuqNS.mjs} +1 -1
- package/dist/{use-as-model-texts-x-ioNOC1.cjs → use-as-model-texts-C1El8R0H.cjs} +1 -1
- package/dist/{use-as-value-help-B2Ds6Iek.cjs → use-as-value-help-CV8z7cQ6.cjs} +3 -6
- package/dist/{use-as-value-help-C3-5RMoO.mjs → use-as-value-help-D-uxj0Zx.mjs} +3 -6
- package/dist/{use-form-context-D7fCP5H4.mjs → use-form-context-B1-J096b.mjs} +5 -1
- package/dist/{use-form-context-ClLGWXWa.cjs → use-form-context-DxcGtsex.cjs} +4 -0
- package/package.json +5 -5
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { a as CHANGE_HANDLER_KEY, n as useAsUnionVariant, r as useFormContext } from "./use-form-context-
|
|
1
|
+
import { a as CHANGE_HANDLER_KEY, n as useAsUnionVariant, r as useFormContext } from "./use-form-context-B1-J096b.mjs";
|
|
2
2
|
import { o as useAsTexts } from "./use-as-locale-BEzm7jbp.mjs";
|
|
3
|
-
import { t as as_field_default } from "./as-field-
|
|
4
|
-
import { t as useAsModelTexts } from "./use-as-model-texts-
|
|
5
|
-
import { t as as_collapsible_default } from "./as-collapsible-
|
|
6
|
-
import { t as as_variant_picker_default } from "./as-variant-picker-
|
|
3
|
+
import { t as as_field_default } from "./as-field-CUIvj5hx.mjs";
|
|
4
|
+
import { t as useAsModelTexts } from "./use-as-model-texts-BfvRuqNS.mjs";
|
|
5
|
+
import { t as as_collapsible_default } from "./as-collapsible-B7pG3XLt.mjs";
|
|
6
|
+
import { t as as_variant_picker_default } from "./as-variant-picker-D6qxuUZA.mjs";
|
|
7
7
|
import { n as useAsDropdown, t as variantLabel } from "./variant-label-zYWRiOjJ.mjs";
|
|
8
8
|
import { t as useAsOptionalAddFlow } from "./use-as-optional-add-flow-fOglspPV.mjs";
|
|
9
|
-
import { t as as_array_clear_btn_default } from "./as-array-clear-btn-
|
|
9
|
+
import { t as as_array_clear_btn_default } from "./as-array-clear-btn-CKlJCXkv.mjs";
|
|
10
10
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, normalizeClass, openBlock, reactive, ref, renderList, toDisplayString, unref, useTemplateRef, vShow, watch, withCtx, withDirectives } from "vue";
|
|
11
|
-
import {
|
|
11
|
+
import { getFieldMeta, isUnionField } from "@atscript/ui";
|
|
12
12
|
//#region src/composables/use-as-array.ts
|
|
13
13
|
/**
|
|
14
14
|
* Composable for managing array field state.
|
|
@@ -18,7 +18,7 @@ import { createFormData, createFormValueResolver, getFieldMeta, isUnionField } f
|
|
|
18
18
|
* Used by the default `AsArray` component and available for custom array components.
|
|
19
19
|
*/
|
|
20
20
|
function useAsArray(field, disabled) {
|
|
21
|
-
const {
|
|
21
|
+
const { pathPrefix, getByPath, setByPath, emptyValueOf } = useFormContext("useAsArray");
|
|
22
22
|
const handleChange = inject(CHANGE_HANDLER_KEY, () => {});
|
|
23
23
|
const arrayValue = computed(() => {
|
|
24
24
|
const v = getByPath(pathPrefix.value);
|
|
@@ -69,14 +69,9 @@ function useAsArray(field, disabled) {
|
|
|
69
69
|
}
|
|
70
70
|
function addItem(variantIndex = 0) {
|
|
71
71
|
if (!canAdd.value) return;
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const variant = unionVariants[variantIndex];
|
|
76
|
-
if (!variant) return;
|
|
77
|
-
newItem = createFormData(variant.type, resolver).value;
|
|
78
|
-
} else newItem = createFormData(field.itemType, resolver).value;
|
|
79
|
-
ensureArray().push(newItem);
|
|
72
|
+
const itemType = isUnion ? unionVariants[variantIndex]?.type : field.itemType;
|
|
73
|
+
if (!itemType) return;
|
|
74
|
+
ensureArray().push(emptyValueOf(itemType));
|
|
80
75
|
itemKeys.push(generateKey());
|
|
81
76
|
handleChange("array-add", pathPrefix.value, arrayValue.value);
|
|
82
77
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const require_use_form_context = require("./use-form-context-
|
|
1
|
+
const require_use_form_context = require("./use-form-context-DxcGtsex.cjs");
|
|
2
2
|
const require_use_as_locale = require("./use-as-locale-CnNyyqcF.cjs");
|
|
3
|
-
const require_as_field = require("./as-field-
|
|
4
|
-
const require_use_as_model_texts = require("./use-as-model-texts-
|
|
5
|
-
const require_as_collapsible = require("./as-collapsible-
|
|
6
|
-
const require_as_variant_picker = require("./as-variant-picker-
|
|
3
|
+
const require_as_field = require("./as-field-gBXYA3zZ.cjs");
|
|
4
|
+
const require_use_as_model_texts = require("./use-as-model-texts-C1El8R0H.cjs");
|
|
5
|
+
const require_as_collapsible = require("./as-collapsible-D3UhCddg.cjs");
|
|
6
|
+
const require_as_variant_picker = require("./as-variant-picker-LRFryLRJ.cjs");
|
|
7
7
|
const require_variant_label = require("./variant-label-CYIvHn4B.cjs");
|
|
8
8
|
const require_use_as_optional_add_flow = require("./use-as-optional-add-flow-C7f0blhC.cjs");
|
|
9
|
-
const require_as_array_clear_btn = require("./as-array-clear-btn-
|
|
9
|
+
const require_as_array_clear_btn = require("./as-array-clear-btn-CMvSOc1R.cjs");
|
|
10
10
|
let vue = require("vue");
|
|
11
11
|
let _atscript_ui = require("@atscript/ui");
|
|
12
12
|
//#region src/composables/use-as-array.ts
|
|
@@ -18,7 +18,7 @@ let _atscript_ui = require("@atscript/ui");
|
|
|
18
18
|
* Used by the default `AsArray` component and available for custom array components.
|
|
19
19
|
*/
|
|
20
20
|
function useAsArray(field, disabled) {
|
|
21
|
-
const {
|
|
21
|
+
const { pathPrefix, getByPath, setByPath, emptyValueOf } = require_use_form_context.useFormContext("useAsArray");
|
|
22
22
|
const handleChange = (0, vue.inject)(require_use_form_context.CHANGE_HANDLER_KEY, () => {});
|
|
23
23
|
const arrayValue = (0, vue.computed)(() => {
|
|
24
24
|
const v = getByPath(pathPrefix.value);
|
|
@@ -69,14 +69,9 @@ function useAsArray(field, disabled) {
|
|
|
69
69
|
}
|
|
70
70
|
function addItem(variantIndex = 0) {
|
|
71
71
|
if (!canAdd.value) return;
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const variant = unionVariants[variantIndex];
|
|
76
|
-
if (!variant) return;
|
|
77
|
-
newItem = (0, _atscript_ui.createFormData)(variant.type, resolver).value;
|
|
78
|
-
} else newItem = (0, _atscript_ui.createFormData)(field.itemType, resolver).value;
|
|
79
|
-
ensureArray().push(newItem);
|
|
72
|
+
const itemType = isUnion ? unionVariants[variantIndex]?.type : field.itemType;
|
|
73
|
+
if (!itemType) return;
|
|
74
|
+
ensureArray().push(emptyValueOf(itemType));
|
|
80
75
|
itemKeys.push(generateKey());
|
|
81
76
|
handleChange("array-add", pathPrefix.value, arrayValue.value);
|
|
82
77
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as useAsTexts } from "./use-as-locale-BEzm7jbp.mjs";
|
|
2
|
-
import { n as as_optional_clear_default } from "./as-variant-picker-
|
|
2
|
+
import { n as as_optional_clear_default } from "./as-variant-picker-D6qxuUZA.mjs";
|
|
3
3
|
import { createBlock, createElementBlock, defineComponent, openBlock, toDisplayString, unref, withModifiers } from "vue";
|
|
4
4
|
//#region src/components/internal/as-array-clear-btn.vue?vue&type=script&setup=true&lang.ts
|
|
5
5
|
const _hoisted_1 = ["disabled", "aria-label"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_use_as_locale = require("./use-as-locale-CnNyyqcF.cjs");
|
|
2
|
-
const require_as_variant_picker = require("./as-variant-picker-
|
|
2
|
+
const require_as_variant_picker = require("./as-variant-picker-LRFryLRJ.cjs");
|
|
3
3
|
let vue = require("vue");
|
|
4
4
|
//#region src/components/internal/as-array-clear-btn.vue?vue&type=script&setup=true&lang.ts
|
|
5
5
|
const _hoisted_1 = ["disabled", "aria-label"];
|
package/dist/as-array.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_as_array = require("./as-array-
|
|
1
|
+
const require_as_array = require("./as-array-DMN1xd4A.cjs");
|
|
2
2
|
module.exports = require_as_array.as_array_default;
|
package/dist/as-array.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_array_default } from "./as-array-
|
|
1
|
+
import { t as as_array_default } from "./as-array-CGsGZFi8.mjs";
|
|
2
2
|
export { as_array_default as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { o as useAsTexts } from "./use-as-locale-BEzm7jbp.mjs";
|
|
2
|
-
import { t as as_field_shell_default } from "./as-field-shell-
|
|
3
|
-
import { n as as_optional_clear_default } from "./as-variant-picker-
|
|
2
|
+
import { t as as_field_shell_default } from "./as-field-shell-DjYBbigs.mjs";
|
|
3
|
+
import { n as as_optional_clear_default } from "./as-variant-picker-D6qxuUZA.mjs";
|
|
4
4
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, mergeProps, normalizeClass, openBlock, ref, toDisplayString, unref, watchEffect, withCtx } from "vue";
|
|
5
5
|
import { optKey, optLabel } from "@atscript/ui";
|
|
6
6
|
//#region src/composables/use-as-tri-state-checkbox.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_use_as_locale = require("./use-as-locale-CnNyyqcF.cjs");
|
|
2
|
-
const require_as_field_shell = require("./as-field-shell-
|
|
3
|
-
const require_as_variant_picker = require("./as-variant-picker-
|
|
2
|
+
const require_as_field_shell = require("./as-field-shell-R8DyS1tc.cjs");
|
|
3
|
+
const require_as_variant_picker = require("./as-variant-picker-LRFryLRJ.cjs");
|
|
4
4
|
let vue = require("vue");
|
|
5
5
|
let _atscript_ui = require("@atscript/ui");
|
|
6
6
|
//#region src/composables/use-as-tri-state-checkbox.ts
|
package/dist/as-checkbox.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_as_checkbox = require("./as-checkbox-
|
|
1
|
+
const require_as_checkbox = require("./as-checkbox-CIgpJSiD.cjs");
|
|
2
2
|
module.exports = require_as_checkbox.as_checkbox_default;
|
package/dist/as-checkbox.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_checkbox_default } from "./as-checkbox-
|
|
1
|
+
import { t as as_checkbox_default } from "./as-checkbox-B0OB5a9J.mjs";
|
|
2
2
|
export { as_checkbox_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as formatIndexedLabelParts } from "./use-form-context-
|
|
1
|
+
import { t as formatIndexedLabelParts } from "./use-form-context-B1-J096b.mjs";
|
|
2
2
|
import { i as useAsNestedSectionsStore, t as DESCENDANT_ERROR_COUNTS_KEY } from "./use-as-nested-sections-store-Dfo971PK.mjs";
|
|
3
3
|
import { o as useAsTexts } from "./use-as-locale-BEzm7jbp.mjs";
|
|
4
4
|
import { r as useAsFocusFirstAfter } from "./focus-after-toggle-CXzXFIdA.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_use_form_context = require("./use-form-context-
|
|
1
|
+
const require_use_form_context = require("./use-form-context-DxcGtsex.cjs");
|
|
2
2
|
const require_use_as_nested_sections_store = require("./use-as-nested-sections-store-u1VgBJAP.cjs");
|
|
3
3
|
const require_use_as_locale = require("./use-as-locale-CnNyyqcF.cjs");
|
|
4
4
|
const require_focus_after_toggle = require("./focus-after-toggle-DRXAm5Xh.cjs");
|
package/dist/as-collapsible.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_as_collapsible = require("./as-collapsible-
|
|
1
|
+
const require_as_collapsible = require("./as-collapsible-D3UhCddg.cjs");
|
|
2
2
|
module.exports = require_as_collapsible.as_collapsible_default;
|
package/dist/as-collapsible.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_collapsible_default } from "./as-collapsible-
|
|
1
|
+
import { t as as_collapsible_default } from "./as-collapsible-B7pG3XLt.mjs";
|
|
2
2
|
export { as_collapsible_default as default };
|
|
@@ -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-DjYBbigs.mjs";
|
|
2
2
|
import { n as committedValue } from "./_shape-bdsPEB8P.mjs";
|
|
3
3
|
import { t as as_adornment_shell_default } from "./as-adornment-shell-CBaksXGT.mjs";
|
|
4
4
|
import { n as as_date_control_default, t as useAsDate } from "./use-as-date-DgPRL0O2.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_as_field_shell = require("./as-field-shell-
|
|
1
|
+
const require_as_field_shell = require("./as-field-shell-R8DyS1tc.cjs");
|
|
2
2
|
const require__shape = require("./_shape-C-TxQCFa.cjs");
|
|
3
3
|
const require_as_adornment_shell = require("./as-adornment-shell-CmS9BOFm.cjs");
|
|
4
4
|
const require_use_as_date = require("./use-as-date-DFcdIfyr.cjs");
|
package/dist/as-date.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_as_date = require("./as-date-
|
|
1
|
+
const require_as_date = require("./as-date-ClMkBzD6.cjs");
|
|
2
2
|
module.exports = require_as_date.as_date_default;
|
package/dist/as-date.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_date_default } from "./as-date-
|
|
1
|
+
import { t as as_date_default } from "./as-date-CLd_CV0y.mjs";
|
|
2
2
|
export { as_date_default as default };
|
|
@@ -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-DjYBbigs.mjs";
|
|
2
2
|
import { n as committedValue } from "./_shape-bdsPEB8P.mjs";
|
|
3
3
|
import { t as as_adornment_shell_default } from "./as-adornment-shell-CBaksXGT.mjs";
|
|
4
4
|
import { n as as_date_control_default, t as useAsDate } from "./use-as-date-DgPRL0O2.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_as_field_shell = require("./as-field-shell-
|
|
1
|
+
const require_as_field_shell = require("./as-field-shell-R8DyS1tc.cjs");
|
|
2
2
|
const require__shape = require("./_shape-C-TxQCFa.cjs");
|
|
3
3
|
const require_as_adornment_shell = require("./as-adornment-shell-CmS9BOFm.cjs");
|
|
4
4
|
const require_use_as_date = require("./use-as-date-DFcdIfyr.cjs");
|
package/dist/as-datetime.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_as_datetime = require("./as-datetime-
|
|
1
|
+
const require_as_datetime = require("./as-datetime-DdNS4GKj.cjs");
|
|
2
2
|
module.exports = require_as_datetime.as_datetime_default;
|
package/dist/as-datetime.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_datetime_default } from "./as-datetime-
|
|
1
|
+
import { t as as_datetime_default } from "./as-datetime-D6DXx0j9.mjs";
|
|
2
2
|
export { as_datetime_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_use_as_locale = require("./use-as-locale-CnNyyqcF.cjs");
|
|
2
|
-
const require_as_field_shell = require("./as-field-shell-
|
|
2
|
+
const require_as_field_shell = require("./as-field-shell-R8DyS1tc.cjs");
|
|
3
3
|
const require__shape = require("./_shape-C-TxQCFa.cjs");
|
|
4
4
|
let vue = require("vue");
|
|
5
5
|
let _atscript_ui = require("@atscript/ui");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as useAsLocale, o as useAsTexts } from "./use-as-locale-BEzm7jbp.mjs";
|
|
2
|
-
import { t as as_field_shell_default } from "./as-field-shell-
|
|
2
|
+
import { t as as_field_shell_default } from "./as-field-shell-DjYBbigs.mjs";
|
|
3
3
|
import { n as committedValue, r as preserveShape } from "./_shape-bdsPEB8P.mjs";
|
|
4
4
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, nextTick, normalizeClass, normalizeProps, openBlock, ref, toDisplayString, unref, watch, withCtx } from "vue";
|
|
5
5
|
import { enforceScale, formatDecimalForDisplay, getDecimalSeparator, getThousandsSeparator, groupInteger, joinDecimalString, parseDecimalInput, splitDecimalString } from "@atscript/ui";
|
package/dist/as-decimal.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_as_decimal = require("./as-decimal-
|
|
1
|
+
const require_as_decimal = require("./as-decimal-BbE2SktW.cjs");
|
|
2
2
|
module.exports = require_as_decimal.as_decimal_default;
|
package/dist/as-decimal.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_decimal_default } from "./as-decimal-
|
|
1
|
+
import { t as as_decimal_default } from "./as-decimal-D8emq_SN.mjs";
|
|
2
2
|
export { as_decimal_default as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { _ as PATH_PREFIX_KEY, a as CHANGE_HANDLER_KEY, c as ERRORS_KEY, d as FORM_NORMALIZED_DATA_KEY, f as FORM_PATCH_KEY, h as LEVEL_KEY, i as ACTION_HANDLER_KEY, l as FORM_CONTEXT_KEY, m as HIDE_ROOT_TITLE_KEY, o as COMPONENTS_KEY, p as FORM_STATE_KEY, r as useFormContext, s as DISMISS_EXTERNAL_AT_KEY, u as FORM_DATA_KEY, v as ROOT_DATA_KEY, y as TYPES_KEY } from "./use-form-context-
|
|
1
|
+
import { _ as PATH_PREFIX_KEY, a as CHANGE_HANDLER_KEY, c as ERRORS_KEY, d as FORM_NORMALIZED_DATA_KEY, f as FORM_PATCH_KEY, h as LEVEL_KEY, i as ACTION_HANDLER_KEY, l as FORM_CONTEXT_KEY, m as HIDE_ROOT_TITLE_KEY, o as COMPONENTS_KEY, p as FORM_STATE_KEY, r as useFormContext, s as DISMISS_EXTERNAL_AT_KEY, u as FORM_DATA_KEY, v as ROOT_DATA_KEY, y as TYPES_KEY } from "./use-form-context-B1-J096b.mjs";
|
|
2
2
|
import { a as useAsLocale, o as useAsTexts } from "./use-as-locale-BEzm7jbp.mjs";
|
|
3
|
-
import { t as useAsModelTexts } from "./use-as-model-texts-
|
|
3
|
+
import { t as useAsModelTexts } from "./use-as-model-texts-BfvRuqNS.mjs";
|
|
4
4
|
import { computed, createBlock, createElementBlock, defineComponent, inject, isRef, mergeProps, onUnmounted, openBlock, provide, ref, resolveDynamicComponent, toDisplayString, unref, useId, watch } from "vue";
|
|
5
|
-
import { DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_UNIT, DB_UNIT_REF, EXPECT_MAX_LENGTH, META_DEFAULT, META_DESCRIPTION, META_LABEL, META_READONLY, META_REQUIRED, UI_FORM_ACTION, UI_FORM_ATTR, UI_FORM_AUTOCOMPLETE, UI_FORM_CLASSES, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_CLASSES, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_DISABLED, UI_FORM_FN_HINT, UI_FORM_FN_LABEL, UI_FORM_FN_PLACEHOLDER, UI_FORM_FN_PREFIX, UI_FORM_FN_READONLY, UI_FORM_FN_STYLES, UI_FORM_FN_TITLE, UI_FORM_FN_VALUE, UI_FORM_GRID_COL_SPAN, UI_FORM_GRID_ROW_SPAN, UI_FORM_HIDDEN, UI_FORM_HINT, UI_FORM_LABEL_SINGULAR, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_STYLES, UI_FORM_SUFFIX, UI_FORM_SUFFIX_ICON, UI_FORM_SUFFIX_REF, UI_FORM_VALIDATE, WF_ACTION_WITH_DATA, buildGridClasses, createFieldValidator,
|
|
5
|
+
import { DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_UNIT, DB_UNIT_REF, EXPECT_MAX_LENGTH, META_DEFAULT, META_DESCRIPTION, META_LABEL, META_READONLY, META_REQUIRED, UI_FORM_ACTION, UI_FORM_ATTR, UI_FORM_AUTOCOMPLETE, UI_FORM_CLASSES, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_CLASSES, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_DISABLED, UI_FORM_FN_HINT, UI_FORM_FN_LABEL, UI_FORM_FN_PLACEHOLDER, UI_FORM_FN_PREFIX, UI_FORM_FN_READONLY, UI_FORM_FN_STYLES, UI_FORM_FN_TITLE, UI_FORM_FN_VALUE, UI_FORM_GRID_COL_SPAN, UI_FORM_GRID_ROW_SPAN, UI_FORM_HIDDEN, UI_FORM_HINT, UI_FORM_LABEL_SINGULAR, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_STYLES, UI_FORM_SUFFIX, UI_FORM_SUFFIX_ICON, UI_FORM_SUFFIX_REF, UI_FORM_VALIDATE, WF_ACTION_WITH_DATA, buildGridClasses, createFieldValidator, fieldText, getByPath, getCurrencyDecimals, getCurrencyDisplayParts, getFieldMeta, hasFieldMeta, isArrayField, isFieldHidden, isObjectField, isTupleField, isUnionField, joinPath, resolveAttrs, resolveFieldProp, resolveFormProp, resolveGridSpec, resolveOptions, resolveSingularLabel, setByPath, userText } from "@atscript/ui";
|
|
6
6
|
import { buildFieldEntry } from "@atscript/ui-fns";
|
|
7
7
|
//#region src/composables/use-as-field.ts
|
|
8
8
|
function useAsField(opts) {
|
|
@@ -67,7 +67,7 @@ function useAsField(opts) {
|
|
|
67
67
|
externalError.value = void 0;
|
|
68
68
|
},
|
|
69
69
|
reset: () => {
|
|
70
|
-
model.value = opts.resetValue
|
|
70
|
+
if ("resetValue" in opts) model.value = opts.resetValue;
|
|
71
71
|
},
|
|
72
72
|
setExternalError: (msg) => {
|
|
73
73
|
externalError.value = msg;
|
|
@@ -140,15 +140,12 @@ function useAsFieldScope() {
|
|
|
140
140
|
* `<AsField>` for the field.
|
|
141
141
|
*/
|
|
142
142
|
function useAsOptionalField(field) {
|
|
143
|
-
const {
|
|
143
|
+
const { buildPath, getByPath, setByPath, emptyValueOf } = useFormContext("useAsOptionalField");
|
|
144
144
|
const handleChange = inject(CHANGE_HANDLER_KEY, () => {});
|
|
145
145
|
const enabled = computed(() => getByPath(buildPath(field.path)) != null);
|
|
146
146
|
function toggle(on) {
|
|
147
147
|
const path = buildPath(field.path);
|
|
148
|
-
|
|
149
|
-
const resolver = createFormValueResolver(rootFormData().value, formContext.value);
|
|
150
|
-
setByPath(path, createFormData(field.prop, resolver).value);
|
|
151
|
-
} else setByPath(path, void 0);
|
|
148
|
+
setByPath(path, on ? emptyValueOf(field.prop) : void 0);
|
|
152
149
|
handleChange("update", path, getByPath(path));
|
|
153
150
|
}
|
|
154
151
|
return {
|
|
@@ -491,8 +488,7 @@ var as_field_default = /* @__PURE__ */ defineComponent({
|
|
|
491
488
|
getValue: getModel,
|
|
492
489
|
setValue: setModel,
|
|
493
490
|
rules: isDerived ? [] : [formRule],
|
|
494
|
-
path: () => absolutePath.value
|
|
495
|
-
...props.field.prop.optional ? { resetValue: void 0 } : isArrayField(props.field) || isTupleField(props.field) ? { resetValue: [] } : isObjectField(props.field) ? { resetValue: {} } : {}
|
|
491
|
+
path: () => absolutePath.value
|
|
496
492
|
});
|
|
497
493
|
let lastEmittedValue = model.value;
|
|
498
494
|
const onBlur = isStructured || isUnion ? _onBlur : () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_use_form_context = require("./use-form-context-
|
|
1
|
+
const require_use_form_context = require("./use-form-context-DxcGtsex.cjs");
|
|
2
2
|
const require_use_as_locale = require("./use-as-locale-CnNyyqcF.cjs");
|
|
3
|
-
const require_use_as_model_texts = require("./use-as-model-texts-
|
|
3
|
+
const require_use_as_model_texts = require("./use-as-model-texts-C1El8R0H.cjs");
|
|
4
4
|
let vue = require("vue");
|
|
5
5
|
let _atscript_ui = require("@atscript/ui");
|
|
6
6
|
let _atscript_ui_fns = require("@atscript/ui-fns");
|
|
@@ -67,7 +67,7 @@ function useAsField(opts) {
|
|
|
67
67
|
externalError.value = void 0;
|
|
68
68
|
},
|
|
69
69
|
reset: () => {
|
|
70
|
-
model.value = opts.resetValue
|
|
70
|
+
if ("resetValue" in opts) model.value = opts.resetValue;
|
|
71
71
|
},
|
|
72
72
|
setExternalError: (msg) => {
|
|
73
73
|
externalError.value = msg;
|
|
@@ -140,15 +140,12 @@ function useAsFieldScope() {
|
|
|
140
140
|
* `<AsField>` for the field.
|
|
141
141
|
*/
|
|
142
142
|
function useAsOptionalField(field) {
|
|
143
|
-
const {
|
|
143
|
+
const { buildPath, getByPath, setByPath, emptyValueOf } = require_use_form_context.useFormContext("useAsOptionalField");
|
|
144
144
|
const handleChange = (0, vue.inject)(require_use_form_context.CHANGE_HANDLER_KEY, () => {});
|
|
145
145
|
const enabled = (0, vue.computed)(() => getByPath(buildPath(field.path)) != null);
|
|
146
146
|
function toggle(on) {
|
|
147
147
|
const path = buildPath(field.path);
|
|
148
|
-
|
|
149
|
-
const resolver = (0, _atscript_ui.createFormValueResolver)(rootFormData().value, formContext.value);
|
|
150
|
-
setByPath(path, (0, _atscript_ui.createFormData)(field.prop, resolver).value);
|
|
151
|
-
} else setByPath(path, void 0);
|
|
148
|
+
setByPath(path, on ? emptyValueOf(field.prop) : void 0);
|
|
152
149
|
handleChange("update", path, getByPath(path));
|
|
153
150
|
}
|
|
154
151
|
return {
|
|
@@ -491,8 +488,7 @@ var as_field_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
491
488
|
getValue: getModel,
|
|
492
489
|
setValue: setModel,
|
|
493
490
|
rules: isDerived ? [] : [formRule],
|
|
494
|
-
path: () => absolutePath.value
|
|
495
|
-
...props.field.prop.optional ? { resetValue: void 0 } : (0, _atscript_ui.isArrayField)(props.field) || (0, _atscript_ui.isTupleField)(props.field) ? { resetValue: [] } : (0, _atscript_ui.isObjectField)(props.field) ? { resetValue: {} } : {}
|
|
491
|
+
path: () => absolutePath.value
|
|
496
492
|
});
|
|
497
493
|
let lastEmittedValue = model.value;
|
|
498
494
|
const onBlur = isStructured || isUnion ? _onBlur : () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as useAsUnionVariant, t as formatIndexedLabelParts } from "./use-form-context-
|
|
1
|
+
import { n as useAsUnionVariant, t as formatIndexedLabelParts } from "./use-form-context-B1-J096b.mjs";
|
|
2
2
|
import { o as useAsTexts } from "./use-as-locale-BEzm7jbp.mjs";
|
|
3
3
|
import { r as useAsFocusFirstAfter } from "./focus-after-toggle-CXzXFIdA.mjs";
|
|
4
|
-
import { n as as_optional_clear_default, t as as_variant_picker_default } from "./as-variant-picker-
|
|
4
|
+
import { n as as_optional_clear_default, t as as_variant_picker_default } from "./as-variant-picker-D6qxuUZA.mjs";
|
|
5
5
|
import { n as useEditingHold } from "./_editing-hold-DVfB2wc_.mjs";
|
|
6
6
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, ref, renderSlot, toDisplayString, unref, vShow, withDirectives, withKeys, withModifiers } from "vue";
|
|
7
7
|
//#region src/components/internal/as-no-data.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_use_form_context = require("./use-form-context-
|
|
1
|
+
const require_use_form_context = require("./use-form-context-DxcGtsex.cjs");
|
|
2
2
|
const require_use_as_locale = require("./use-as-locale-CnNyyqcF.cjs");
|
|
3
3
|
const require_focus_after_toggle = require("./focus-after-toggle-DRXAm5Xh.cjs");
|
|
4
|
-
const require_as_variant_picker = require("./as-variant-picker-
|
|
4
|
+
const require_as_variant_picker = require("./as-variant-picker-LRFryLRJ.cjs");
|
|
5
5
|
const require__editing_hold = require("./_editing-hold-ChPIf1ZC.cjs");
|
|
6
6
|
let vue = require("vue");
|
|
7
7
|
//#region src/components/internal/as-no-data.vue?vue&type=script&setup=true&lang.ts
|
package/dist/as-field-shell.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_as_field_shell = require("./as-field-shell-
|
|
1
|
+
const require_as_field_shell = require("./as-field-shell-R8DyS1tc.cjs");
|
|
2
2
|
module.exports = require_as_field_shell.as_field_shell_default;
|
package/dist/as-field-shell.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_field_shell_default } from "./as-field-shell-
|
|
1
|
+
import { t as as_field_shell_default } from "./as-field-shell-DjYBbigs.mjs";
|
|
2
2
|
export { as_field_shell_default as default };
|
package/dist/as-field.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_as_field = require("./as-field-
|
|
1
|
+
const require_as_field = require("./as-field-gBXYA3zZ.cjs");
|
|
2
2
|
module.exports = require_as_field.as_field_default;
|
package/dist/as-field.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_field_default } from "./as-field-
|
|
1
|
+
import { t as as_field_default } from "./as-field-CUIvj5hx.mjs";
|
|
2
2
|
export { as_field_default as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const require_use_form_context = require("./use-form-context-
|
|
1
|
+
const require_use_form_context = require("./use-form-context-DxcGtsex.cjs");
|
|
2
2
|
const require_use_as_nested_sections_store = require("./use-as-nested-sections-store-u1VgBJAP.cjs");
|
|
3
3
|
const require_use_as_locale = require("./use-as-locale-CnNyyqcF.cjs");
|
|
4
|
-
const require_use_as_value_help = require("./use-as-value-help-
|
|
5
|
-
const require_as_field = require("./as-field-
|
|
6
|
-
const require_as_iterator = require("./as-iterator-
|
|
4
|
+
const require_use_as_value_help = require("./use-as-value-help-CV8z7cQ6.cjs");
|
|
5
|
+
const require_as_field = require("./as-field-gBXYA3zZ.cjs");
|
|
6
|
+
const require_as_iterator = require("./as-iterator-B7h3xaKQ.cjs");
|
|
7
7
|
let vue = require("vue");
|
|
8
8
|
let _atscript_ui = require("@atscript/ui");
|
|
9
9
|
//#region src/composables/use-as-form-patch.ts
|
|
@@ -46,11 +46,12 @@ let _atscript_ui = require("@atscript/ui");
|
|
|
46
46
|
* container reference is also the write target for
|
|
47
47
|
* `rebaseOnto` — mutating its `.value` preserves the bound
|
|
48
48
|
* `:form-data` identity so the deep watch fires once.
|
|
49
|
-
* @param onRebased optional callback fired
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* detects its index once at setup and won't
|
|
53
|
-
* data swap. No-op for `rebase()` (which doesn't
|
|
49
|
+
* @param onRebased optional callback fired when `rebaseOnto` — or a swap of the
|
|
50
|
+
* container's `value` — lands a different union variant, so the
|
|
51
|
+
* host can force-remount the field subtree (e.g. bump a key):
|
|
52
|
+
* the variant picker detects its index once at setup and won't
|
|
53
|
+
* re-detect on a data swap. No-op for `rebase()` (which doesn't
|
|
54
|
+
* move data).
|
|
54
55
|
*/
|
|
55
56
|
function createAsFormPatch(def, getData, onRebased) {
|
|
56
57
|
let baseline;
|
|
@@ -73,8 +74,10 @@ function createAsFormPatch(def, getData, onRebased) {
|
|
|
73
74
|
baselineRev.value++;
|
|
74
75
|
}
|
|
75
76
|
capture();
|
|
77
|
+
let rebasing = false;
|
|
76
78
|
(0, vue.watch)(() => getData().value, (next, prev) => {
|
|
77
79
|
if (next === prev) return;
|
|
80
|
+
if (!rebasing && (0, _atscript_ui.unionVariantChanged)(def(), { value: prev }, { value: next })) onRebased?.();
|
|
78
81
|
if (baseline === void 0) {
|
|
79
82
|
capture();
|
|
80
83
|
return;
|
|
@@ -127,11 +130,19 @@ function createAsFormPatch(def, getData, onRebased) {
|
|
|
127
130
|
* {@link AsFormPatchHandle.rebaseOnto}). One reactive write, then an explicit
|
|
128
131
|
* re-baseline to the upstream snapshot.
|
|
129
132
|
*/
|
|
133
|
+
function write(value) {
|
|
134
|
+
rebasing = true;
|
|
135
|
+
try {
|
|
136
|
+
(0, _atscript_ui.setByPath)(getData(), "", value);
|
|
137
|
+
} finally {
|
|
138
|
+
rebasing = false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
130
141
|
function rebaseOnto(upstream, opts) {
|
|
131
142
|
const u = (0, _atscript_ui.deepClone)(upstream, vue.toRaw);
|
|
132
143
|
if (baseline === void 0) {
|
|
133
144
|
const before = (0, _atscript_ui.deepClone)(getData(), vue.toRaw);
|
|
134
|
-
(
|
|
145
|
+
write(u.value);
|
|
135
146
|
if ((0, _atscript_ui.unionVariantChanged)(def(), before, u)) onRebased?.();
|
|
136
147
|
capture();
|
|
137
148
|
return {
|
|
@@ -142,7 +153,7 @@ function createAsFormPatch(def, getData, onRebased) {
|
|
|
142
153
|
const current = (0, _atscript_ui.deepClone)(getData(), vue.toRaw);
|
|
143
154
|
const { next, conflicts, reapplied } = (0, _atscript_ui.buildFormRebase)(def(), baseline, current, u, opts);
|
|
144
155
|
const variantMoved = (0, _atscript_ui.unionVariantChanged)(def(), current, next);
|
|
145
|
-
(
|
|
156
|
+
write(next.value);
|
|
146
157
|
baseline = u;
|
|
147
158
|
baselineRev.value++;
|
|
148
159
|
if (variantMoved) onRebased?.();
|
|
@@ -427,12 +438,6 @@ function useAsForm(options) {
|
|
|
427
438
|
remountKey.value++;
|
|
428
439
|
}) : void 0;
|
|
429
440
|
if (patch) (0, vue.provide)(require_use_form_context.FORM_PATCH_KEY, patch);
|
|
430
|
-
const reset = async () => {
|
|
431
|
-
internalErrors.value = {};
|
|
432
|
-
rootErrorDismissed.value = false;
|
|
433
|
-
await resetState();
|
|
434
|
-
patch?.rebase();
|
|
435
|
-
};
|
|
436
441
|
(0, vue.provide)(require_use_form_context.ROOT_DATA_KEY, data);
|
|
437
442
|
(0, vue.provide)(require_use_form_context.PATH_PREFIX_KEY, (0, vue.computed)(() => ""));
|
|
438
443
|
(0, vue.provide)(require_use_form_context.TYPES_KEY, (0, vue.computed)(() => options.types()));
|
|
@@ -458,6 +463,28 @@ function useAsForm(options) {
|
|
|
458
463
|
rootErrorDismissed.value = true;
|
|
459
464
|
ext.dismissForm();
|
|
460
465
|
}
|
|
466
|
+
const reset = async () => {
|
|
467
|
+
internalErrors.value = {};
|
|
468
|
+
rootErrorDismissed.value = false;
|
|
469
|
+
const def = options.def();
|
|
470
|
+
const container = data.value;
|
|
471
|
+
const empty = (0, _atscript_ui.createFormData)(def.type, (0, _atscript_ui.createFormValueResolver)({}, formContext.value ?? {}));
|
|
472
|
+
const errorPaths = Object.keys(ext.effective.value ?? {});
|
|
473
|
+
const before = errorPaths.map((path) => (0, _atscript_ui.getByPath)(container, path));
|
|
474
|
+
if (typeof container.value === "object" && container.value !== null) for (const { path } of def.fields) {
|
|
475
|
+
const value = (0, _atscript_ui.getByPath)(empty, path);
|
|
476
|
+
if (value === void 0) (0, _atscript_ui.deleteByPath)(container, path);
|
|
477
|
+
else (0, _atscript_ui.setByPath)(container, path, value);
|
|
478
|
+
}
|
|
479
|
+
else container.value = empty.value;
|
|
480
|
+
errorPaths.forEach((path, i) => {
|
|
481
|
+
if ((0, _atscript_ui.getByPath)(container, path) !== before[i]) ext.dismissAt(path);
|
|
482
|
+
});
|
|
483
|
+
remountKey.value++;
|
|
484
|
+
await (0, vue.nextTick)();
|
|
485
|
+
await resetState();
|
|
486
|
+
patch?.rebase();
|
|
487
|
+
};
|
|
461
488
|
(0, vue.provide)(require_use_as_nested_sections_store.DESCENDANT_ERROR_COUNTS_KEY, (0, vue.computed)(() => (0, _atscript_ui.buildDescendantErrorCounts)(allErrors.value)));
|
|
462
489
|
(0, vue.watch)(allErrors, (errors) => {
|
|
463
490
|
for (const errPath of Object.keys(errors)) for (const ancestor of (0, _atscript_ui.iteratePathAncestors)(errPath)) sectionsStore.setOpen(ancestor, true);
|
|
@@ -568,10 +595,6 @@ const _hoisted_2 = {
|
|
|
568
595
|
const _hoisted_3 = { class: "as-form-error-message" };
|
|
569
596
|
const _hoisted_4 = ["disabled"];
|
|
570
597
|
const _hoisted_5 = {
|
|
571
|
-
key: 2,
|
|
572
|
-
class: "as-form-grid"
|
|
573
|
-
};
|
|
574
|
-
const _hoisted_6 = {
|
|
575
598
|
key: 3,
|
|
576
599
|
class: "as-form-overlay"
|
|
577
600
|
};
|
|
@@ -708,12 +731,15 @@ var as_form_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
708
731
|
disabled: (0, vue.unref)(form).submitDisabled.value
|
|
709
732
|
}, (0, vue.toDisplayString)((0, vue.unref)(form).submitText.value), 9, _hoisted_4)]) : (0, vue.createCommentVNode)("v-if", true),
|
|
710
733
|
(0, vue.createCommentVNode)(" `@ui.form.pushDown` fields render in their own grid below submit. "),
|
|
711
|
-
__props.def.pushDownFields.length ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div",
|
|
734
|
+
__props.def.pushDownFields.length ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
735
|
+
key: (0, vue.unref)(form).remountKey.value,
|
|
736
|
+
class: "as-form-grid"
|
|
737
|
+
}, [(0, vue.createVNode)(require_as_iterator.as_iterator_default, {
|
|
712
738
|
def: __props.def,
|
|
713
739
|
fields: __props.def.pushDownFields
|
|
714
740
|
}, null, 8, ["def", "fields"])])) : (0, vue.createCommentVNode)("v-if", true),
|
|
715
741
|
(0, vue.renderSlot)(_ctx.$slots, "form.footer", (0, vue.normalizeProps)((0, vue.guardReactiveProps)((0, vue.unref)(form).slotProps.value))),
|
|
716
|
-
__props.loading ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div",
|
|
742
|
+
__props.loading ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_5, [(0, vue.renderSlot)(_ctx.$slots, "form.loading", (0, vue.normalizeProps)((0, vue.guardReactiveProps)((0, vue.unref)(form).slotProps.value)), () => [_cache[2] || (_cache[2] = (0, vue.createElementVNode)("span", {
|
|
717
743
|
class: "as-form-overlay-icon",
|
|
718
744
|
"aria-hidden": "true"
|
|
719
745
|
}, null, -1))])])) : (0, vue.createCommentVNode)("v-if", true)
|