@atscript/vue-form 0.1.175 → 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/_editing-hold-ChPIf1ZC.cjs +65 -0
- package/dist/_editing-hold-DVfB2wc_.mjs +54 -0
- package/dist/{_shape-BAim7zm2.cjs → _shape-C-TxQCFa.cjs} +17 -1
- package/dist/{_shape-CLX3JSFZ.mjs → _shape-bdsPEB8P.mjs} +12 -2
- package/dist/as-action.cjs +1 -1
- package/dist/as-action.d.mts +1 -1
- package/dist/as-action.mjs +1 -1
- package/dist/{as-action.vue-CPFAPJbB.d.mts → as-action.vue-CQbDa3g4.d.mts} +1 -1
- package/dist/{as-array-ha4DpqUM.mjs → as-array-CGsGZFi8.mjs} +12 -17
- package/dist/{as-array-B1s5sXYV.cjs → as-array-DMN1xd4A.cjs} +11 -16
- package/dist/{as-array-clear-btn-bUM9vztK.mjs → as-array-clear-btn-CKlJCXkv.mjs} +1 -1
- package/dist/{as-array-clear-btn-CNSn7HrC.cjs → as-array-clear-btn-CMvSOc1R.cjs} +1 -1
- package/dist/as-array.cjs +1 -1
- package/dist/as-array.d.mts +1 -1
- package/dist/as-array.mjs +1 -1
- package/dist/{as-array.vue-CPAuKOJp.d.mts → as-array.vue-DpKFsuRS.d.mts} +1 -1
- package/dist/{as-checkbox-Baz513zf.mjs → as-checkbox-B0OB5a9J.mjs} +2 -2
- package/dist/{as-checkbox-OKhewGzL.cjs → as-checkbox-CIgpJSiD.cjs} +2 -2
- package/dist/as-checkbox.cjs +1 -1
- package/dist/as-checkbox.d.mts +1 -1
- package/dist/as-checkbox.mjs +1 -1
- package/dist/{as-checkbox.vue-DTwhk8as.d.mts → as-checkbox.vue-Db6OT_lL.d.mts} +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.d.mts +1 -1
- package/dist/as-collapsible.mjs +1 -1
- package/dist/{as-collapsible.vue-D-C-9GqT.d.mts → as-collapsible.vue-By-ZBZt3.d.mts} +1 -1
- package/dist/{as-date-VN6VPCZ-.mjs → as-date-CLd_CV0y.mjs} +4 -4
- package/dist/{as-date-4GYZJ-NC.cjs → as-date-ClMkBzD6.cjs} +4 -4
- package/dist/as-date.cjs +1 -1
- package/dist/as-date.d.mts +1 -1
- package/dist/as-date.mjs +1 -1
- package/dist/{as-date.vue-Orrtd1W8.d.mts → as-date.vue-BUaHHI42.d.mts} +1 -1
- package/dist/{as-datetime-CWzURHq_.mjs → as-datetime-D6DXx0j9.mjs} +4 -4
- package/dist/{as-datetime-CCN03o-l.cjs → as-datetime-DdNS4GKj.cjs} +4 -4
- package/dist/as-datetime.cjs +1 -1
- package/dist/as-datetime.d.mts +1 -1
- package/dist/as-datetime.mjs +1 -1
- package/dist/{as-datetime.vue-Cj3rQjQT.d.mts → as-datetime.vue-D3WJpAVe.d.mts} +1 -1
- package/dist/{as-decimal-BC09yeEc.cjs → as-decimal-BbE2SktW.cjs} +2 -2
- package/dist/{as-decimal-C8ZbnZ-W.mjs → as-decimal-D8emq_SN.mjs} +2 -2
- package/dist/as-decimal.cjs +1 -1
- package/dist/as-decimal.d.mts +1 -1
- package/dist/as-decimal.mjs +1 -1
- package/dist/{as-decimal.vue-BUoGa9Ni.d.mts → as-decimal.vue-BVDyP4LN.d.mts} +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-nSZx4aV0.mjs → as-field-shell-DjYBbigs.mjs} +36 -23
- package/dist/{as-field-shell-DviDLKgc.cjs → as-field-shell-R8DyS1tc.cjs} +36 -23
- package/dist/as-field-shell.cjs +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-BLF9cYdM.d.mts → as-field-shell.vue-DBufTHVO.d.mts} +1 -1
- package/dist/as-field.cjs +1 -1
- package/dist/as-field.d.mts +1 -1
- package/dist/as-field.mjs +1 -1
- package/dist/{as-form-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-Cl036Br1.d.cts → as-form.vue-D2osFDt6.d.cts} +26 -9
- package/dist/{as-form.vue-9rtEZqEU.d.mts → as-form.vue-DJAftKr2.d.mts} +27 -10
- package/dist/{as-input-GVFsgqbJ.cjs → as-input-C1Iw2AkY.cjs} +3 -3
- package/dist/{as-input-B5eBOvaM.mjs → as-input-MVamvBMv.mjs} +3 -3
- package/dist/{as-input-control-Dc9TPspz.mjs → as-input-control-B3h--Qe0.mjs} +17 -5
- package/dist/{as-input-control-B04eAMwA.cjs → as-input-control-DAbaW7GG.cjs} +16 -4
- package/dist/as-input.cjs +1 -1
- package/dist/as-input.d.mts +1 -1
- package/dist/as-input.mjs +1 -1
- package/dist/{as-input.vue-C7EKOcQU.d.mts → as-input.vue-BiPsULeF.d.mts} +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.d.mts +1 -1
- package/dist/as-iterator.mjs +1 -1
- package/dist/{as-multi-select-BhPKb69b.mjs → as-multi-select-BQZvt3Fr.mjs} +1 -1
- package/dist/{as-multi-select-BygHZ0wu.cjs → as-multi-select-DDNIusOV.cjs} +1 -1
- package/dist/as-multi-select.cjs +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-BS9X_0fY.d.mts → as-multi-select.vue-Bmngkww7.d.mts} +1 -1
- package/dist/{as-number-bFJlxd6T.cjs → as-number-BUid7j2k.cjs} +3 -3
- package/dist/{as-number-BCZD5zX6.mjs → as-number-CT3DSCBF.mjs} +3 -3
- package/dist/as-number.cjs +1 -1
- package/dist/as-number.d.mts +1 -1
- package/dist/as-number.mjs +1 -1
- package/dist/{as-number.vue-CJSPy4zg.d.mts → as-number.vue-C2QSKpVL.d.mts} +1 -1
- package/dist/{as-object-aItYU-IN.cjs → as-object-CB8Un-GN.cjs} +5 -5
- package/dist/{as-object-sly2aTBc.mjs → as-object-DaUkalfF.mjs} +5 -5
- package/dist/as-object.cjs +1 -1
- package/dist/as-object.d.mts +1 -1
- package/dist/as-object.mjs +1 -1
- package/dist/{as-object.vue-DKEhwHCH.d.mts → as-object.vue-DFo_5DXv.d.mts} +1 -1
- package/dist/as-paragraph.cjs +1 -1
- package/dist/as-paragraph.d.mts +1 -1
- package/dist/as-paragraph.mjs +1 -1
- package/dist/{as-paragraph.vue-Cu4woZ9u.d.mts → as-paragraph.vue-DiHaNFSX.d.mts} +1 -1
- package/dist/{as-radio-Bxw-nuBQ.cjs → as-radio-B9eRK1Sr.cjs} +1 -1
- package/dist/{as-radio-DszOJUnp.mjs → as-radio-QqVLOzED.mjs} +1 -1
- package/dist/as-radio.cjs +1 -1
- package/dist/as-radio.d.mts +1 -1
- package/dist/as-radio.mjs +1 -1
- package/dist/{as-radio.vue-dro8-E3x.d.mts → as-radio.vue-C_ZjbI4s.d.mts} +1 -1
- package/dist/{as-ref-Dsd81GCS.mjs → as-ref-BUxC1GPm.mjs} +43 -42
- package/dist/{as-ref-DCYYySDN.cjs → as-ref-C4euogko.cjs} +42 -41
- package/dist/as-ref.cjs +1 -1
- package/dist/as-ref.d.mts +1 -1
- package/dist/as-ref.mjs +1 -1
- package/dist/{as-ref.vue-B7wixo40.d.mts → as-ref.vue-DaXQsjsX.d.mts} +1 -1
- package/dist/{as-select-CER1fT_R.mjs → as-select-BNm4pgAW.mjs} +1 -1
- package/dist/{as-select-ClWgJvtq.cjs → as-select-BvfuZLwz.cjs} +1 -1
- package/dist/as-select.cjs +1 -1
- package/dist/as-select.d.mts +1 -1
- package/dist/as-select.mjs +1 -1
- package/dist/{as-select.vue-DKBV1tqr.d.mts → as-select.vue-IGtjEyQD.d.mts} +1 -1
- package/dist/{as-time-C91Kljns.cjs → as-time-B74WYv_l.cjs} +4 -4
- package/dist/{as-time--hMNPNqj.mjs → as-time-Cz_jvm6T.mjs} +4 -4
- package/dist/as-time.cjs +1 -1
- package/dist/as-time.d.mts +1 -1
- package/dist/as-time.mjs +1 -1
- package/dist/{as-time.vue-DTUPfGLQ.d.mts → as-time.vue-CKVgGb-m.d.mts} +1 -1
- package/dist/{as-tuple-wuPJs4H-.cjs → as-tuple-5EyboNQq.cjs} +8 -9
- package/dist/{as-tuple-57xADF_i.mjs → as-tuple-BtREHMCP.mjs} +9 -10
- package/dist/as-tuple.cjs +1 -1
- package/dist/as-tuple.d.mts +1 -1
- package/dist/as-tuple.mjs +1 -1
- package/dist/{as-tuple.vue-CF5tHv89.d.mts → as-tuple.vue-CDOHXKBr.d.mts} +1 -1
- package/dist/{as-union-DXzqX-M1.mjs → as-union-BF-YDJDs.mjs} +9 -10
- package/dist/{as-union-BDC13rY3.cjs → as-union-CcZalTHx.cjs} +8 -9
- package/dist/as-union.cjs +1 -1
- package/dist/as-union.d.mts +1 -1
- package/dist/as-union.mjs +1 -1
- package/dist/{as-union.vue-DJGnj0xV.d.mts → as-union.vue-BcaUH5bH.d.mts} +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 +27 -27
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +24 -24
- package/dist/index.mjs +27 -27
- package/dist/locale.d.mts +1 -1
- 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 +9 -9
- /package/dist/{as-action-C0gSyG19.cjs → as-action-B_vPR2YE.cjs} +0 -0
- /package/dist/{as-action-BOalk1GL.mjs → as-action-BzdLJvyy.mjs} +0 -0
- /package/dist/{as-adornment-shell-grq1H0D-.mjs → as-adornment-shell-CBaksXGT.mjs} +0 -0
- /package/dist/{as-adornment-shell-COhqCppW.cjs → as-adornment-shell-CmS9BOFm.cjs} +0 -0
- /package/dist/{as-field.vue-jAOaV9zg.d.mts → as-field.vue-BWaTLJd6.d.mts} +0 -0
- /package/dist/{as-iterator.vue-DisW8puF.d.mts → as-iterator.vue-BUCohjxw.d.mts} +0 -0
- /package/dist/{as-paragraph-DfX1uEE_.cjs → as-paragraph-0opsr433.cjs} +0 -0
- /package/dist/{as-paragraph-BALTsswa.mjs → as-paragraph-CQCdz9FR.mjs} +0 -0
- /package/dist/{types-DitKqqD_.d.mts → types-B0Ey_eD-.d.mts} +0 -0
- /package/dist/{use-as-date-Dp3IDhLj.cjs → use-as-date-DFcdIfyr.cjs} +0 -0
- /package/dist/{use-as-date-B3sBae9e.mjs → use-as-date-DgPRL0O2.mjs} +0 -0
- /package/dist/{use-as-locale-TRSJHpw-.d.mts → use-as-locale-D4NDG8Vg.d.mts} +0 -0
- /package/dist/{use-as-optional-add-flow-nwBB3Mdk.cjs → use-as-optional-add-flow-C7f0blhC.cjs} +0 -0
- /package/dist/{use-as-optional-add-flow-DRZT-aIT.mjs → use-as-optional-add-flow-fOglspPV.mjs} +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
let vue = require("vue");
|
|
2
|
+
//#region src/composables/_editing-hold.ts
|
|
3
|
+
/**
|
|
4
|
+
* Holding an editor in place while the user is in it. An emptied input of an
|
|
5
|
+
* optional field commits `undefined`, and the chrome around it swaps an unset
|
|
6
|
+
* field for its placeholder (AsFieldShell's "Not set", AsUnion's "Add") — so
|
|
7
|
+
* while focus is in the input the editor must stay, and the placeholder shows
|
|
8
|
+
* once focus leaves.
|
|
9
|
+
*
|
|
10
|
+
* Internal — not exported from the package barrel. The key is private to this
|
|
11
|
+
* module.
|
|
12
|
+
*/
|
|
13
|
+
const EDITING_HOLD_KEY = Symbol("atui.editing-hold");
|
|
14
|
+
/**
|
|
15
|
+
* For a container that swaps its editor for a placeholder (AsUnion): whether
|
|
16
|
+
* an input row below it has focus, fed by the {@link useEditingHold} rows.
|
|
17
|
+
*/
|
|
18
|
+
function provideEditingHold() {
|
|
19
|
+
const editing = (0, vue.ref)(false);
|
|
20
|
+
(0, vue.provide)(EDITING_HOLD_KEY, editing);
|
|
21
|
+
return editing;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Focus tracking for an input row (bind `onFocusin` / `onFocusout` on it),
|
|
25
|
+
* mirrored into the closest {@link provideEditingHold}. Consumed: a row inside
|
|
26
|
+
* another row's subtree does not report to the container.
|
|
27
|
+
*
|
|
28
|
+
* Focus moving between two elements of the row keeps `editing`, and so does
|
|
29
|
+
* the window losing focus: the browser then fires `focusout` with no
|
|
30
|
+
* `relatedTarget`, but the input stays the document's active element (on a
|
|
31
|
+
* move to another element of the page it is `<body>` during `focusout`).
|
|
32
|
+
*/
|
|
33
|
+
function useEditingHold() {
|
|
34
|
+
const container = (0, vue.inject)(EDITING_HOLD_KEY, void 0);
|
|
35
|
+
(0, vue.provide)(EDITING_HOLD_KEY, void 0);
|
|
36
|
+
const editing = (0, vue.ref)(false);
|
|
37
|
+
function set(value) {
|
|
38
|
+
editing.value = value;
|
|
39
|
+
if (container) container.value = value;
|
|
40
|
+
}
|
|
41
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
42
|
+
if (editing.value && container) container.value = false;
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
editing,
|
|
46
|
+
onFocusin: () => set(true),
|
|
47
|
+
onFocusout: (e) => {
|
|
48
|
+
const row = e.currentTarget;
|
|
49
|
+
set(row.contains(e.relatedTarget) || row.contains(document.activeElement));
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
Object.defineProperty(exports, "provideEditingHold", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function() {
|
|
57
|
+
return provideEditingHold;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "useEditingHold", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function() {
|
|
63
|
+
return useEditingHold;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { inject, onBeforeUnmount, provide, ref } from "vue";
|
|
2
|
+
//#region src/composables/_editing-hold.ts
|
|
3
|
+
/**
|
|
4
|
+
* Holding an editor in place while the user is in it. An emptied input of an
|
|
5
|
+
* optional field commits `undefined`, and the chrome around it swaps an unset
|
|
6
|
+
* field for its placeholder (AsFieldShell's "Not set", AsUnion's "Add") — so
|
|
7
|
+
* while focus is in the input the editor must stay, and the placeholder shows
|
|
8
|
+
* once focus leaves.
|
|
9
|
+
*
|
|
10
|
+
* Internal — not exported from the package barrel. The key is private to this
|
|
11
|
+
* module.
|
|
12
|
+
*/
|
|
13
|
+
const EDITING_HOLD_KEY = Symbol("atui.editing-hold");
|
|
14
|
+
/**
|
|
15
|
+
* For a container that swaps its editor for a placeholder (AsUnion): whether
|
|
16
|
+
* an input row below it has focus, fed by the {@link useEditingHold} rows.
|
|
17
|
+
*/
|
|
18
|
+
function provideEditingHold() {
|
|
19
|
+
const editing = ref(false);
|
|
20
|
+
provide(EDITING_HOLD_KEY, editing);
|
|
21
|
+
return editing;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Focus tracking for an input row (bind `onFocusin` / `onFocusout` on it),
|
|
25
|
+
* mirrored into the closest {@link provideEditingHold}. Consumed: a row inside
|
|
26
|
+
* another row's subtree does not report to the container.
|
|
27
|
+
*
|
|
28
|
+
* Focus moving between two elements of the row keeps `editing`, and so does
|
|
29
|
+
* the window losing focus: the browser then fires `focusout` with no
|
|
30
|
+
* `relatedTarget`, but the input stays the document's active element (on a
|
|
31
|
+
* move to another element of the page it is `<body>` during `focusout`).
|
|
32
|
+
*/
|
|
33
|
+
function useEditingHold() {
|
|
34
|
+
const container = inject(EDITING_HOLD_KEY, void 0);
|
|
35
|
+
provide(EDITING_HOLD_KEY, void 0);
|
|
36
|
+
const editing = ref(false);
|
|
37
|
+
function set(value) {
|
|
38
|
+
editing.value = value;
|
|
39
|
+
if (container) container.value = value;
|
|
40
|
+
}
|
|
41
|
+
onBeforeUnmount(() => {
|
|
42
|
+
if (editing.value && container) container.value = false;
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
editing,
|
|
46
|
+
onFocusin: () => set(true),
|
|
47
|
+
onFocusout: (e) => {
|
|
48
|
+
const row = e.currentTarget;
|
|
49
|
+
set(row.contains(e.relatedTarget) || row.contains(document.activeElement));
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { useEditingHold as n, provideEditingHold as t };
|
|
@@ -17,12 +17,28 @@ function preserveShape(original, normalized) {
|
|
|
17
17
|
* The value an emptied input commits: `undefined` (omitted) on an optional
|
|
18
18
|
* field — `null` is not a value of `name?: T`, and atscript >= 0.1.103
|
|
19
19
|
* rejects it there when the field also carries `@meta.required` — else
|
|
20
|
-
* `null`. Shared by the number / decimal / date / datetime / time inputs
|
|
20
|
+
* `null`. Shared by the number / decimal / date / datetime / time inputs and
|
|
21
|
+
* the native number input of the text control.
|
|
21
22
|
*/
|
|
22
23
|
function committedValue(value, optional) {
|
|
23
24
|
return value === null && optional ? void 0 : value;
|
|
24
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* The value an emptied text input commits: `undefined` (omitted) on an
|
|
28
|
+
* optional field, like {@link committedValue}; `""` on a required one. Used by
|
|
29
|
+
* the text control (which also renders the reference input's plain-text
|
|
30
|
+
* fallback).
|
|
31
|
+
*/
|
|
32
|
+
function committedText(value, optional) {
|
|
33
|
+
return value === "" && optional ? void 0 : value;
|
|
34
|
+
}
|
|
25
35
|
//#endregion
|
|
36
|
+
Object.defineProperty(exports, "committedText", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function() {
|
|
39
|
+
return committedText;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
26
42
|
Object.defineProperty(exports, "committedValue", {
|
|
27
43
|
enumerable: true,
|
|
28
44
|
get: function() {
|
|
@@ -17,10 +17,20 @@ function preserveShape(original, normalized) {
|
|
|
17
17
|
* The value an emptied input commits: `undefined` (omitted) on an optional
|
|
18
18
|
* field — `null` is not a value of `name?: T`, and atscript >= 0.1.103
|
|
19
19
|
* rejects it there when the field also carries `@meta.required` — else
|
|
20
|
-
* `null`. Shared by the number / decimal / date / datetime / time inputs
|
|
20
|
+
* `null`. Shared by the number / decimal / date / datetime / time inputs and
|
|
21
|
+
* the native number input of the text control.
|
|
21
22
|
*/
|
|
22
23
|
function committedValue(value, optional) {
|
|
23
24
|
return value === null && optional ? void 0 : value;
|
|
24
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* The value an emptied text input commits: `undefined` (omitted) on an
|
|
28
|
+
* optional field, like {@link committedValue}; `""` on a required one. Used by
|
|
29
|
+
* the text control (which also renders the reference input's plain-text
|
|
30
|
+
* fallback).
|
|
31
|
+
*/
|
|
32
|
+
function committedText(value, optional) {
|
|
33
|
+
return value === "" && optional ? void 0 : value;
|
|
34
|
+
}
|
|
25
35
|
//#endregion
|
|
26
|
-
export {
|
|
36
|
+
export { committedValue as n, preserveShape as r, committedText as t };
|
package/dist/as-action.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_as_action = require("./as-action-
|
|
1
|
+
const require_as_action = require("./as-action-B_vPR2YE.cjs");
|
|
2
2
|
module.exports = require_as_action.as_action_default;
|
package/dist/as-action.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "./as-action.vue-
|
|
1
|
+
import { t as _default } from "./as-action.vue-CQbDa3g4.mjs";
|
|
2
2
|
export { _default as default };
|
package/dist/as-action.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_action_default } from "./as-action-
|
|
1
|
+
import { t as as_action_default } from "./as-action-BzdLJvyy.mjs";
|
|
2
2
|
export { as_action_default as default };
|
|
@@ -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
|
-
import { t as useAsOptionalAddFlow } from "./use-as-optional-add-flow-
|
|
9
|
-
import { t as as_array_clear_btn_default } from "./as-array-clear-btn-
|
|
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-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
|
-
const require_use_as_optional_add_flow = require("./use-as-optional-add-flow-
|
|
9
|
-
const require_as_array_clear_btn = require("./as-array-clear-btn-
|
|
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-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.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "./as-array.vue-
|
|
1
|
+
import { t as _default } from "./as-array.vue-DpKFsuRS.mjs";
|
|
2
2
|
export { _default as 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.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "./as-checkbox.vue-
|
|
1
|
+
import { t as _default } from "./as-checkbox.vue-Db6OT_lL.mjs";
|
|
2
2
|
export { _default as 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;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "./as-collapsible.vue-
|
|
1
|
+
import { t as _default } from "./as-collapsible.vue-By-ZBZt3.mjs";
|
|
2
2
|
export { _default as 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,7 +1,7 @@
|
|
|
1
|
-
import { t as as_field_shell_default } from "./as-field-shell-
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import { n as as_date_control_default, t as useAsDate } from "./use-as-date-
|
|
1
|
+
import { t as as_field_shell_default } from "./as-field-shell-DjYBbigs.mjs";
|
|
2
|
+
import { n as committedValue } from "./_shape-bdsPEB8P.mjs";
|
|
3
|
+
import { t as as_adornment_shell_default } from "./as-adornment-shell-CBaksXGT.mjs";
|
|
4
|
+
import { n as as_date_control_default, t as useAsDate } from "./use-as-date-DgPRL0O2.mjs";
|
|
5
5
|
import { computed, createBlock, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, unref, withCtx } from "vue";
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/components/defaults/as-date.vue
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_as_field_shell = require("./as-field-shell-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const require_use_as_date = require("./use-as-date-
|
|
1
|
+
const require_as_field_shell = require("./as-field-shell-R8DyS1tc.cjs");
|
|
2
|
+
const require__shape = require("./_shape-C-TxQCFa.cjs");
|
|
3
|
+
const require_as_adornment_shell = require("./as-adornment-shell-CmS9BOFm.cjs");
|
|
4
|
+
const require_use_as_date = require("./use-as-date-DFcdIfyr.cjs");
|
|
5
5
|
let vue = require("vue");
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/components/defaults/as-date.vue
|
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.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "./as-date.vue-
|
|
1
|
+
import { t as _default } from "./as-date.vue-BUaHHI42.mjs";
|
|
2
2
|
export { _default as 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,7 +1,7 @@
|
|
|
1
|
-
import { t as as_field_shell_default } from "./as-field-shell-
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import { n as as_date_control_default, t as useAsDate } from "./use-as-date-
|
|
1
|
+
import { t as as_field_shell_default } from "./as-field-shell-DjYBbigs.mjs";
|
|
2
|
+
import { n as committedValue } from "./_shape-bdsPEB8P.mjs";
|
|
3
|
+
import { t as as_adornment_shell_default } from "./as-adornment-shell-CBaksXGT.mjs";
|
|
4
|
+
import { n as as_date_control_default, t as useAsDate } from "./use-as-date-DgPRL0O2.mjs";
|
|
5
5
|
import { computed, createBlock, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, unref, withCtx } from "vue";
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/components/defaults/as-datetime.vue
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_as_field_shell = require("./as-field-shell-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const require_use_as_date = require("./use-as-date-
|
|
1
|
+
const require_as_field_shell = require("./as-field-shell-R8DyS1tc.cjs");
|
|
2
|
+
const require__shape = require("./_shape-C-TxQCFa.cjs");
|
|
3
|
+
const require_as_adornment_shell = require("./as-adornment-shell-CmS9BOFm.cjs");
|
|
4
|
+
const require_use_as_date = require("./use-as-date-DFcdIfyr.cjs");
|
|
5
5
|
let vue = require("vue");
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/components/defaults/as-datetime.vue
|
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.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "./as-datetime.vue-
|
|
1
|
+
import { t as _default } from "./as-datetime.vue-D3WJpAVe.mjs";
|
|
2
2
|
export { _default as 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,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__shape = require("./_shape-
|
|
2
|
+
const require_as_field_shell = require("./as-field-shell-R8DyS1tc.cjs");
|
|
3
|
+
const require__shape = require("./_shape-C-TxQCFa.cjs");
|
|
4
4
|
let vue = require("vue");
|
|
5
5
|
let _atscript_ui = require("@atscript/ui");
|
|
6
6
|
//#region src/composables/use-as-decimal.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
3
|
-
import { n as
|
|
2
|
+
import { t as as_field_shell_default } from "./as-field-shell-DjYBbigs.mjs";
|
|
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";
|
|
6
6
|
//#region src/composables/use-as-decimal.ts
|
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.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "./as-decimal.vue-
|
|
1
|
+
import { t as _default } from "./as-decimal.vue-BVDyP4LN.mjs";
|
|
2
2
|
export { _default as 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 : () => {
|