@atscript/vue-form 0.1.164 → 0.1.166
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-CqnBh3rv.mjs → as-array-B2axGw3v.mjs} +15 -12
- package/dist/{as-array-CxeMe9Dw.cjs → as-array-C97cLzdA.cjs} +16 -13
- package/dist/{as-array-clear-btn-COfRUzeb.cjs → as-array-clear-btn-BBFccQjO.cjs} +5 -3
- package/dist/{as-array-clear-btn-BY1IBwBP.mjs → as-array-clear-btn-DEH8a3_N.mjs} +6 -4
- package/dist/as-array.cjs +1 -1
- package/dist/as-array.mjs +1 -1
- package/dist/{as-checkbox-DosdhEuS.mjs → as-checkbox-BO8xW0OM.mjs} +36 -12
- package/dist/{as-checkbox-QO5Oh13K.cjs → as-checkbox-Wn-PmHi-.cjs} +35 -11
- package/dist/as-checkbox.cjs +1 -1
- package/dist/as-checkbox.mjs +1 -1
- package/dist/{as-collapsible-CQyuXwj9.cjs → as-collapsible-BGeuF2Bn.cjs} +4 -2
- package/dist/{as-collapsible-DHSlSMfY.mjs → as-collapsible-Cb9SgJh9.mjs} +5 -3
- package/dist/as-collapsible.cjs +1 -1
- package/dist/as-collapsible.mjs +1 -1
- package/dist/{as-date-DTUQP2Dc.cjs → as-date-B2dgUoau.cjs} +1 -1
- package/dist/{as-date-DyQsn7Mu.mjs → as-date-jQpwe6sr.mjs} +1 -1
- package/dist/as-date.cjs +1 -1
- package/dist/as-date.mjs +1 -1
- package/dist/{as-datetime-BDJtlZLz.cjs → as-datetime-CmBLyjgU.cjs} +1 -1
- package/dist/{as-datetime-CrstxtPJ.mjs → as-datetime-DYn9NndT.mjs} +1 -1
- package/dist/as-datetime.cjs +1 -1
- package/dist/as-datetime.mjs +1 -1
- package/dist/{as-decimal-Bimpnzo2.mjs → as-decimal-C-OJ8ygU.mjs} +4 -3
- package/dist/{as-decimal-BZWqiKXZ.cjs → as-decimal-C0Eqd9nM.cjs} +4 -3
- package/dist/as-decimal.cjs +1 -1
- package/dist/as-decimal.mjs +1 -1
- package/dist/{as-field-DQxlwJVM.mjs → as-field-BZpWLPcM.mjs} +16 -13
- package/dist/{as-field-8MDWK_jb.cjs → as-field-D0HgywQY.cjs} +15 -12
- package/dist/{as-field-shell-Bxqa_ZsU.mjs → as-field-shell-D7XovzgJ.mjs} +14 -7
- package/dist/{as-field-shell-BrJpCzIA.cjs → as-field-shell-DSj3CqN6.cjs} +14 -7
- 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-C-CV5ezE.mjs → as-form-0VCxVsGo.mjs} +18 -10
- package/dist/{as-form-DLSFfuLR.cjs → as-form-ChyW9bj2.cjs} +18 -10
- 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-BA70Ib2m.d.cts → as-form.vue-BuRFHSK-.d.cts} +6 -10
- package/dist/{as-form.vue-D2SQ5VeJ.d.mts → as-form.vue-CHEkgO3k.d.mts} +6 -10
- package/dist/{as-input-UkZxRSD4.cjs → as-input-Bf94SAOY.cjs} +1 -1
- package/dist/{as-input-65rtLZt3.mjs → as-input-DlLLiAYI.mjs} +1 -1
- package/dist/as-input.cjs +1 -1
- package/dist/as-input.mjs +1 -1
- package/dist/{as-iterator-Bbyxog8g.cjs → as-iterator-Bty6f5Bq.cjs} +2 -2
- package/dist/{as-iterator-CaQ1TkIR.mjs → as-iterator-Dp1OiwU7.mjs} +2 -2
- package/dist/as-iterator.cjs +1 -1
- package/dist/as-iterator.mjs +1 -1
- package/dist/{as-multi-select-B7Nc2brD.mjs → as-multi-select-DT0M_1_O.mjs} +20 -17
- package/dist/{as-multi-select-BiUexFnY.cjs → as-multi-select-ZGBYoI48.cjs} +19 -16
- package/dist/as-multi-select.cjs +1 -1
- package/dist/as-multi-select.mjs +1 -1
- package/dist/{as-number-BMsgxGQw.cjs → as-number-DXQCnc9d.cjs} +2 -2
- package/dist/{as-number-6DTZnVfg.mjs → as-number-DkG5GuGW.mjs} +2 -2
- package/dist/as-number.cjs +1 -1
- package/dist/as-number.mjs +1 -1
- package/dist/{as-object-BjOUiVDG.cjs → as-object-DLdKOhxb.cjs} +14 -8
- package/dist/{as-object-0Qo0bPi5.mjs → as-object-mpRxIKVB.mjs} +14 -8
- package/dist/as-object.cjs +1 -1
- package/dist/as-object.mjs +1 -1
- package/dist/{as-radio-Dg9c4dGh.mjs → as-radio-CW9YWBnC.mjs} +3 -3
- package/dist/{as-radio-C06SIAFY.cjs → as-radio-D9sctKpc.cjs} +2 -2
- package/dist/as-radio.cjs +1 -1
- package/dist/as-radio.mjs +1 -1
- package/dist/{as-ref-BEhS_vo9.cjs → as-ref-CpHMAAJu.cjs} +5 -3
- package/dist/{as-ref-BWJlIf5G.mjs → as-ref-DaCGfshO.mjs} +5 -3
- package/dist/as-ref.cjs +1 -1
- package/dist/as-ref.mjs +1 -1
- package/dist/{as-select-CrTKlmhd.mjs → as-select-CrjlxcgR.mjs} +3 -3
- package/dist/{as-select-DzEUs8Od.cjs → as-select-DAbNosmB.cjs} +2 -2
- package/dist/as-select.cjs +1 -1
- package/dist/as-select.mjs +1 -1
- package/dist/{as-time-BQ6KXMyV.mjs → as-time-BmXXgfCZ.mjs} +1 -1
- package/dist/{as-time-Cu-8mKpR.cjs → as-time-NaICaSIj.cjs} +1 -1
- package/dist/as-time.cjs +1 -1
- package/dist/as-time.mjs +1 -1
- package/dist/{as-tuple-fwxeV71M.mjs → as-tuple-BBx6P6xb.mjs} +8 -6
- package/dist/{as-tuple-DKBOLriy.cjs → as-tuple-DkI9fp4G.cjs} +8 -6
- package/dist/as-tuple.cjs +1 -1
- package/dist/as-tuple.mjs +1 -1
- package/dist/{as-union-DT8XDZSt.cjs → as-union-BjmrvD80.cjs} +8 -6
- package/dist/{as-union-Gz8gEjmn.mjs → as-union-C3QiGYlE.mjs} +7 -5
- package/dist/as-union.cjs +1 -1
- package/dist/as-union.mjs +1 -1
- package/dist/{as-variant-picker-B3GLhKyt.mjs → as-variant-picker-BUF7Am9t.mjs} +13 -8
- package/dist/{as-variant-picker-JlEhh7YO.cjs → as-variant-picker-BcJx7Zt7.cjs} +14 -9
- package/dist/index.cjs +25 -25
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +24 -24
- package/dist/locale.cjs +5 -0
- package/dist/locale.d.cts +2 -0
- package/dist/locale.d.mts +2 -0
- package/dist/locale.mjs +2 -0
- package/dist/use-as-locale-1k9NBn-G.mjs +56 -0
- package/dist/use-as-locale-BVcC0l75.d.mts +35 -0
- package/dist/use-as-locale-C2tFUenv.cjs +73 -0
- package/dist/use-as-locale-CnGzoVWd.d.cts +35 -0
- package/dist/{use-as-value-help-CDmkz6A7.cjs → use-as-value-help-BE-fAZRP.cjs} +4 -2
- package/dist/{use-as-value-help-CYMlEubv.mjs → use-as-value-help-nIpEFMqD.mjs} +4 -2
- package/dist/{use-form-context-cDW2GW4-.mjs → use-form-context-C3FxL3eF.mjs} +4 -1
- package/dist/{use-form-context-B6ZnzfxG.cjs → use-form-context-CXsLnG7l.cjs} +4 -1
- package/dist/{use-as-dropdown-B2Shb7wn.mjs → variant-label-B065kts3.mjs} +13 -1
- package/dist/{use-as-dropdown-Bj9toVdw.cjs → variant-label-C-rLK7Z3.cjs} +18 -0
- package/package.json +14 -9
- package/dist/use-as-locale-BrFdAgnU.mjs +0 -23
- package/dist/use-as-locale-C4z5stwD.cjs +0 -34
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_as_field_shell = require("./as-field-shell-
|
|
1
|
+
const require_as_field_shell = require("./as-field-shell-DSj3CqN6.cjs");
|
|
2
2
|
const require_as_adornment_shell = require("./as-adornment-shell-DptUMWNk.cjs");
|
|
3
3
|
const require__shape = require("./_shape-JEtANIMR.cjs");
|
|
4
4
|
const require_use_as_date = require("./use-as-date-U_aHShPD.cjs");
|
package/dist/as-time.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_as_time = require("./as-time-
|
|
1
|
+
const require_as_time = require("./as-time-NaICaSIj.cjs");
|
|
2
2
|
module.exports = require_as_time.as_time_default;
|
package/dist/as-time.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_time_default } from "./as-time-
|
|
1
|
+
import { t as as_time_default } from "./as-time-BmXXgfCZ.mjs";
|
|
2
2
|
export { as_time_default as default };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { a as CHANGE_HANDLER_KEY, n as useAsUnionVariant, r as useFormContext } from "./use-form-context-
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as
|
|
1
|
+
import { a as CHANGE_HANDLER_KEY, n as useAsUnionVariant, r as useFormContext } from "./use-form-context-C3FxL3eF.mjs";
|
|
2
|
+
import { r as useAsTexts } from "./use-as-locale-1k9NBn-G.mjs";
|
|
3
|
+
import { t as as_field_default } from "./as-field-BZpWLPcM.mjs";
|
|
4
|
+
import { t as as_collapsible_default } from "./as-collapsible-Cb9SgJh9.mjs";
|
|
5
|
+
import { t as as_variant_picker_default } from "./as-variant-picker-BUF7Am9t.mjs";
|
|
5
6
|
import { t as useAsOptionalAddFlow } from "./use-as-optional-add-flow-BdjKNx9P.mjs";
|
|
6
|
-
import { t as as_array_clear_btn_default } from "./as-array-clear-btn-
|
|
7
|
+
import { t as as_array_clear_btn_default } from "./as-array-clear-btn-DEH8a3_N.mjs";
|
|
7
8
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, inject, normalizeClass, onMounted, openBlock, renderList, toDisplayString, unref, useTemplateRef, vShow, withCtx, withDirectives } from "vue";
|
|
8
9
|
import { META_LABEL, createFormData, createFormValueResolver, getFieldMeta } from "@atscript/ui";
|
|
9
10
|
//#region src/composables/use-as-tuple.ts
|
|
@@ -279,6 +280,7 @@ var as_tuple_default = /* @__PURE__ */ defineComponent({
|
|
|
279
280
|
fillMissing();
|
|
280
281
|
}), 2);
|
|
281
282
|
}
|
|
283
|
+
const { t } = useAsTexts();
|
|
282
284
|
return (_ctx, _cache) => {
|
|
283
285
|
return openBlock(), createBlock(as_collapsible_default, {
|
|
284
286
|
ref_key: "collapsibleRef",
|
|
@@ -315,7 +317,7 @@ var as_tuple_default = /* @__PURE__ */ defineComponent({
|
|
|
315
317
|
}, [_cache[0] || (_cache[0] = createElementVNode("span", {
|
|
316
318
|
class: "i-as-field-fill as-object-empty-add-icon",
|
|
317
319
|
"aria-hidden": "true"
|
|
318
|
-
}, null, -1)), createTextVNode("
|
|
320
|
+
}, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("UI_FORM_ADD", { item: __props.title })), 1)]), __props.description ? (openBlock(), createElementBlock("p", _hoisted_1, toDisplayString(__props.description), 1)) : createCommentVNode("v-if", true)], 2), [[vShow, !__props.hidden]])]),
|
|
319
321
|
_: 2
|
|
320
322
|
}, [unref(isOptional) && optionalEnabled.value ? {
|
|
321
323
|
name: "actions",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
const require_use_form_context = require("./use-form-context-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
const require_use_form_context = require("./use-form-context-CXsLnG7l.cjs");
|
|
2
|
+
const require_use_as_locale = require("./use-as-locale-C2tFUenv.cjs");
|
|
3
|
+
const require_as_field = require("./as-field-D0HgywQY.cjs");
|
|
4
|
+
const require_as_collapsible = require("./as-collapsible-BGeuF2Bn.cjs");
|
|
5
|
+
const require_as_variant_picker = require("./as-variant-picker-BcJx7Zt7.cjs");
|
|
5
6
|
const require_use_as_optional_add_flow = require("./use-as-optional-add-flow-CD8seN3C.cjs");
|
|
6
|
-
const require_as_array_clear_btn = require("./as-array-clear-btn-
|
|
7
|
+
const require_as_array_clear_btn = require("./as-array-clear-btn-BBFccQjO.cjs");
|
|
7
8
|
let vue = require("vue");
|
|
8
9
|
let _atscript_ui = require("@atscript/ui");
|
|
9
10
|
//#region src/composables/use-as-tuple.ts
|
|
@@ -279,6 +280,7 @@ var as_tuple_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
279
280
|
fillMissing();
|
|
280
281
|
}), 2);
|
|
281
282
|
}
|
|
283
|
+
const { t } = require_use_as_locale.useAsTexts();
|
|
282
284
|
return (_ctx, _cache) => {
|
|
283
285
|
return (0, vue.openBlock)(), (0, vue.createBlock)(require_as_collapsible.as_collapsible_default, {
|
|
284
286
|
ref_key: "collapsibleRef",
|
|
@@ -315,7 +317,7 @@ var as_tuple_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
315
317
|
}, [_cache[0] || (_cache[0] = (0, vue.createElementVNode)("span", {
|
|
316
318
|
class: "i-as-field-fill as-object-empty-add-icon",
|
|
317
319
|
"aria-hidden": "true"
|
|
318
|
-
}, null, -1)), (0, vue.createTextVNode)("
|
|
320
|
+
}, null, -1)), (0, vue.createTextVNode)(" " + (0, vue.toDisplayString)((0, vue.unref)(t)("UI_FORM_ADD", { item: __props.title })), 1)]), __props.description ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_1, (0, vue.toDisplayString)(__props.description), 1)) : (0, vue.createCommentVNode)("v-if", true)], 2), [[vue.vShow, !__props.hidden]])]),
|
|
319
321
|
_: 2
|
|
320
322
|
}, [(0, vue.unref)(isOptional) && optionalEnabled.value ? {
|
|
321
323
|
name: "actions",
|
package/dist/as-tuple.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_as_tuple = require("./as-tuple-
|
|
1
|
+
const require_as_tuple = require("./as-tuple-DkI9fp4G.cjs");
|
|
2
2
|
module.exports = require_as_tuple.as_tuple_default;
|
package/dist/as-tuple.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_tuple_default } from "./as-tuple-
|
|
1
|
+
import { t as as_tuple_default } from "./as-tuple-BBx6P6xb.mjs";
|
|
2
2
|
export { as_tuple_default as default };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const require_use_form_context = require("./use-form-context-
|
|
2
|
-
const
|
|
1
|
+
const require_use_form_context = require("./use-form-context-CXsLnG7l.cjs");
|
|
2
|
+
const require_use_as_locale = require("./use-as-locale-C2tFUenv.cjs");
|
|
3
|
+
const require_variant_label = require("./variant-label-C-rLK7Z3.cjs");
|
|
3
4
|
const require_use_as_optional_add_flow = require("./use-as-optional-add-flow-CD8seN3C.cjs");
|
|
4
5
|
let vue = require("vue");
|
|
5
6
|
let _atscript_ui = require("@atscript/ui");
|
|
@@ -291,7 +292,7 @@ var as_union_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
291
292
|
return r.$el ?? null;
|
|
292
293
|
};
|
|
293
294
|
const pickerDropdownRef = (0, vue.ref)(null);
|
|
294
|
-
const { isOpen: pickerOpen, toggle: togglePicker, select: selectPicker } =
|
|
295
|
+
const { isOpen: pickerOpen, toggle: togglePicker, select: selectPicker } = require_variant_label.useAsDropdown(pickerDropdownRef);
|
|
295
296
|
const { runAndFocusNew } = require_use_as_optional_add_flow.useAsOptionalAddFlow({ path: () => props.path });
|
|
296
297
|
function pickAndFocus(vi) {
|
|
297
298
|
runAndFocusNew(rootEl, () => changeVariant(vi), 2);
|
|
@@ -306,6 +307,7 @@ var as_union_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
306
307
|
function handleVariantPick(vi) {
|
|
307
308
|
selectPicker(() => pickAndFocus(vi));
|
|
308
309
|
}
|
|
310
|
+
const { t } = require_use_as_locale.useAsTexts();
|
|
309
311
|
return (_ctx, _cache) => {
|
|
310
312
|
return __props.optional && !(0, vue.unref)(optionalEnabled) ? (0, vue.withDirectives)(((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
311
313
|
key: 0,
|
|
@@ -324,13 +326,13 @@ var as_union_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
324
326
|
}, [_cache[0] || (_cache[0] = (0, vue.createElementVNode)("span", {
|
|
325
327
|
class: "i-as-field-fill as-object-empty-add-icon",
|
|
326
328
|
"aria-hidden": "true"
|
|
327
|
-
}, null, -1)), (0, vue.createTextVNode)("
|
|
329
|
+
}, null, -1)), (0, vue.createTextVNode)(" " + (0, vue.toDisplayString)((0, vue.unref)(t)("UI_FORM_ADD", { item: fieldLabel.value })), 1)]), (0, vue.unref)(pickerOpen) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)((0, vue.unref)(unionField).unionVariants, (v, vi) => {
|
|
328
330
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
|
|
329
331
|
key: vi,
|
|
330
332
|
type: "button",
|
|
331
333
|
class: "as-dropdown-item",
|
|
332
334
|
onClick: ($event) => handleVariantPick(vi)
|
|
333
|
-
}, (0, vue.toDisplayString)(v.
|
|
335
|
+
}, (0, vue.toDisplayString)((0, vue.unref)(require_variant_label.variantLabel)(v, (0, vue.unref)(t))), 9, _hoisted_2);
|
|
334
336
|
}), 128))])) : (0, vue.createCommentVNode)("v-if", true)], 512)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
|
|
335
337
|
key: 1,
|
|
336
338
|
type: "button",
|
|
@@ -339,7 +341,7 @@ var as_union_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
339
341
|
}, [_cache[1] || (_cache[1] = (0, vue.createElementVNode)("span", {
|
|
340
342
|
class: "i-as-field-fill as-object-empty-add-icon",
|
|
341
343
|
"aria-hidden": "true"
|
|
342
|
-
}, null, -1)), (0, vue.createTextVNode)("
|
|
344
|
+
}, null, -1)), (0, vue.createTextVNode)(" " + (0, vue.toDisplayString)((0, vue.unref)(t)("UI_FORM_ADD", { item: fieldLabel.value })), 1)])), __props.description ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_3, (0, vue.toDisplayString)(__props.description), 1)) : (0, vue.createCommentVNode)("v-if", true)], 2)), [[vue.vShow, !__props.hidden]]) : variantComponent.value && (0, vue.unref)(innerField) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [(0, vue.createCommentVNode)(" Active: dispatch to variant's component, forwarding the field's @meta.label\n as title so the variant's chrome shows it (innerField.type overrides \"union\"). "), ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(variantComponent.value), (0, vue.mergeProps)({
|
|
343
345
|
ref_key: "rootRef",
|
|
344
346
|
ref: rootRef
|
|
345
347
|
}, _ctx.$props, {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { _ as TYPES_KEY, a as CHANGE_HANDLER_KEY, h as PATH_PREFIX_KEY, r as useFormContext, v as UNION_CONTEXT_KEY } from "./use-form-context-
|
|
2
|
-
import {
|
|
1
|
+
import { _ as TYPES_KEY, a as CHANGE_HANDLER_KEY, h as PATH_PREFIX_KEY, r as useFormContext, v as UNION_CONTEXT_KEY } from "./use-form-context-C3FxL3eF.mjs";
|
|
2
|
+
import { r as useAsTexts } from "./use-as-locale-1k9NBn-G.mjs";
|
|
3
|
+
import { n as useAsDropdown, t as variantLabel } from "./variant-label-B065kts3.mjs";
|
|
3
4
|
import { t as useAsOptionalAddFlow } from "./use-as-optional-add-flow-BdjKNx9P.mjs";
|
|
4
5
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, inject, mergeProps, normalizeClass, openBlock, provide, ref, renderList, resolveDynamicComponent, toDisplayString, unref, vShow, withDirectives } from "vue";
|
|
5
6
|
import { createFormData, createFormValueResolver, detectUnionVariant, isUnionField } from "@atscript/ui";
|
|
@@ -306,6 +307,7 @@ var as_union_default = /* @__PURE__ */ defineComponent({
|
|
|
306
307
|
function handleVariantPick(vi) {
|
|
307
308
|
selectPicker(() => pickAndFocus(vi));
|
|
308
309
|
}
|
|
310
|
+
const { t } = useAsTexts();
|
|
309
311
|
return (_ctx, _cache) => {
|
|
310
312
|
return __props.optional && !unref(optionalEnabled) ? withDirectives((openBlock(), createElementBlock("div", {
|
|
311
313
|
key: 0,
|
|
@@ -324,13 +326,13 @@ var as_union_default = /* @__PURE__ */ defineComponent({
|
|
|
324
326
|
}, [_cache[0] || (_cache[0] = createElementVNode("span", {
|
|
325
327
|
class: "i-as-field-fill as-object-empty-add-icon",
|
|
326
328
|
"aria-hidden": "true"
|
|
327
|
-
}, null, -1)), createTextVNode("
|
|
329
|
+
}, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("UI_FORM_ADD", { item: fieldLabel.value })), 1)]), unref(pickerOpen) ? (openBlock(), createElementBlock("div", _hoisted_1, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(unionField).unionVariants, (v, vi) => {
|
|
328
330
|
return openBlock(), createElementBlock("button", {
|
|
329
331
|
key: vi,
|
|
330
332
|
type: "button",
|
|
331
333
|
class: "as-dropdown-item",
|
|
332
334
|
onClick: ($event) => handleVariantPick(vi)
|
|
333
|
-
}, toDisplayString(v
|
|
335
|
+
}, toDisplayString(unref(variantLabel)(v, unref(t))), 9, _hoisted_2);
|
|
334
336
|
}), 128))])) : createCommentVNode("v-if", true)], 512)) : (openBlock(), createElementBlock("button", {
|
|
335
337
|
key: 1,
|
|
336
338
|
type: "button",
|
|
@@ -339,7 +341,7 @@ var as_union_default = /* @__PURE__ */ defineComponent({
|
|
|
339
341
|
}, [_cache[1] || (_cache[1] = createElementVNode("span", {
|
|
340
342
|
class: "i-as-field-fill as-object-empty-add-icon",
|
|
341
343
|
"aria-hidden": "true"
|
|
342
|
-
}, null, -1)), createTextVNode("
|
|
344
|
+
}, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("UI_FORM_ADD", { item: fieldLabel.value })), 1)])), __props.description ? (openBlock(), createElementBlock("p", _hoisted_3, toDisplayString(__props.description), 1)) : createCommentVNode("v-if", true)], 2)), [[vShow, !__props.hidden]]) : variantComponent.value && unref(innerField) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" Active: dispatch to variant's component, forwarding the field's @meta.label\n as title so the variant's chrome shows it (innerField.type overrides \"union\"). "), (openBlock(), createBlock(resolveDynamicComponent(variantComponent.value), mergeProps({
|
|
343
345
|
ref_key: "rootRef",
|
|
344
346
|
ref: rootRef
|
|
345
347
|
}, _ctx.$props, {
|
package/dist/as-union.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_as_union = require("./as-union-
|
|
1
|
+
const require_as_union = require("./as-union-BjmrvD80.cjs");
|
|
2
2
|
module.exports = require_as_union.as_union_default;
|
package/dist/as-union.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_union_default } from "./as-union-
|
|
1
|
+
import { t as as_union_default } from "./as-union-C3QiGYlE.mjs";
|
|
2
2
|
export { as_union_default as default };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as useAsTexts } from "./use-as-locale-1k9NBn-G.mjs";
|
|
2
|
+
import { n as useAsDropdown, t as variantLabel } from "./variant-label-B065kts3.mjs";
|
|
2
3
|
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, normalizeClass, openBlock, ref, renderList, toDisplayString, unref, withModifiers } from "vue";
|
|
3
4
|
//#region src/components/internal/as-optional-clear.vue?vue&type=script&setup=true&lang.ts
|
|
4
5
|
const _hoisted_1$1 = [
|
|
@@ -22,14 +23,16 @@ var as_optional_clear_default = /* @__PURE__ */ defineComponent({
|
|
|
22
23
|
},
|
|
23
24
|
emits: ["clear"],
|
|
24
25
|
setup(__props) {
|
|
25
|
-
|
|
26
|
+
const props = __props;
|
|
27
|
+
const { t } = useAsTexts();
|
|
28
|
+
const unsetField = computed(() => props.label && t("UI_FORM_UNSET_FIELD", { field: props.label }));
|
|
26
29
|
return (_ctx, _cache) => {
|
|
27
30
|
return openBlock(), createElementBlock("button", {
|
|
28
31
|
type: "button",
|
|
29
32
|
class: "as-field-remove-btn",
|
|
30
33
|
disabled: __props.disabled,
|
|
31
|
-
"aria-label":
|
|
32
|
-
title:
|
|
34
|
+
"aria-label": unsetField.value || unref(t)("UI_FORM_UNSET_VALUE"),
|
|
35
|
+
title: unsetField.value || unref(t)("UI_FORM_UNSET"),
|
|
33
36
|
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.$emit("clear"), ["stop", "prevent"]))
|
|
34
37
|
}, [..._cache[1] || (_cache[1] = [createElementVNode("span", {
|
|
35
38
|
class: "as-field-remove-btn-icon",
|
|
@@ -62,10 +65,12 @@ var as_variant_picker_default = /* @__PURE__ */ defineComponent({
|
|
|
62
65
|
},
|
|
63
66
|
setup(__props) {
|
|
64
67
|
const props = __props;
|
|
68
|
+
const { t } = useAsTexts();
|
|
65
69
|
const dropdownRef = ref(null);
|
|
66
70
|
const { isOpen, toggle, select } = useAsDropdown(dropdownRef);
|
|
67
71
|
const currentLabel = computed(() => {
|
|
68
|
-
|
|
72
|
+
const variant = props.unionContext.variants[props.unionContext.currentIndex.value];
|
|
73
|
+
return (variant ? variantLabel(variant, t) : "").replace(/^\d+\.\s+/, "");
|
|
69
74
|
});
|
|
70
75
|
function onSelectVariant(ctx, index) {
|
|
71
76
|
select(() => ctx.changeVariant(index));
|
|
@@ -79,15 +84,15 @@ var as_variant_picker_default = /* @__PURE__ */ defineComponent({
|
|
|
79
84
|
type: "button",
|
|
80
85
|
class: "as-variant-trigger",
|
|
81
86
|
disabled: __props.disabled,
|
|
82
|
-
title:
|
|
87
|
+
title: unref(t)("UI_FORM_SWITCH_TYPE", { type: currentLabel.value }),
|
|
83
88
|
onClick: _cache[0] || (_cache[0] = (...args) => unref(toggle) && unref(toggle)(...args))
|
|
84
|
-
}, toDisplayString(currentLabel.value || "
|
|
89
|
+
}, toDisplayString(currentLabel.value || unref(t)("UI_FORM_SWITCH")), 9, _hoisted_1), unref(isOpen) ? (openBlock(), createElementBlock("div", _hoisted_2, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.unionContext.variants, (v, vi) => {
|
|
85
90
|
return openBlock(), createElementBlock("button", {
|
|
86
91
|
key: vi,
|
|
87
92
|
type: "button",
|
|
88
93
|
class: normalizeClass(["as-dropdown-item", { "as-dropdown-item--active": __props.unionContext.currentIndex.value === vi }]),
|
|
89
94
|
onClick: ($event) => onSelectVariant(__props.unionContext, vi)
|
|
90
|
-
}, toDisplayString(v
|
|
95
|
+
}, toDisplayString(unref(variantLabel)(v, unref(t))), 11, _hoisted_3);
|
|
91
96
|
}), 128))])) : createCommentVNode("v-if", true)], 512);
|
|
92
97
|
};
|
|
93
98
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_use_as_locale = require("./use-as-locale-C2tFUenv.cjs");
|
|
2
|
+
const require_variant_label = require("./variant-label-C-rLK7Z3.cjs");
|
|
2
3
|
let vue = require("vue");
|
|
3
4
|
//#region src/components/internal/as-optional-clear.vue?vue&type=script&setup=true&lang.ts
|
|
4
5
|
const _hoisted_1$1 = [
|
|
@@ -22,14 +23,16 @@ var as_optional_clear_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
22
23
|
},
|
|
23
24
|
emits: ["clear"],
|
|
24
25
|
setup(__props) {
|
|
25
|
-
|
|
26
|
+
const props = __props;
|
|
27
|
+
const { t } = require_use_as_locale.useAsTexts();
|
|
28
|
+
const unsetField = (0, vue.computed)(() => props.label && t("UI_FORM_UNSET_FIELD", { field: props.label }));
|
|
26
29
|
return (_ctx, _cache) => {
|
|
27
30
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
|
|
28
31
|
type: "button",
|
|
29
32
|
class: "as-field-remove-btn",
|
|
30
33
|
disabled: __props.disabled,
|
|
31
|
-
"aria-label":
|
|
32
|
-
title:
|
|
34
|
+
"aria-label": unsetField.value || (0, vue.unref)(t)("UI_FORM_UNSET_VALUE"),
|
|
35
|
+
title: unsetField.value || (0, vue.unref)(t)("UI_FORM_UNSET"),
|
|
33
36
|
onClick: _cache[0] || (_cache[0] = (0, vue.withModifiers)(($event) => _ctx.$emit("clear"), ["stop", "prevent"]))
|
|
34
37
|
}, [..._cache[1] || (_cache[1] = [(0, vue.createElementVNode)("span", {
|
|
35
38
|
class: "as-field-remove-btn-icon",
|
|
@@ -62,10 +65,12 @@ var as_variant_picker_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
62
65
|
},
|
|
63
66
|
setup(__props) {
|
|
64
67
|
const props = __props;
|
|
68
|
+
const { t } = require_use_as_locale.useAsTexts();
|
|
65
69
|
const dropdownRef = (0, vue.ref)(null);
|
|
66
|
-
const { isOpen, toggle, select } =
|
|
70
|
+
const { isOpen, toggle, select } = require_variant_label.useAsDropdown(dropdownRef);
|
|
67
71
|
const currentLabel = (0, vue.computed)(() => {
|
|
68
|
-
|
|
72
|
+
const variant = props.unionContext.variants[props.unionContext.currentIndex.value];
|
|
73
|
+
return (variant ? require_variant_label.variantLabel(variant, t) : "").replace(/^\d+\.\s+/, "");
|
|
69
74
|
});
|
|
70
75
|
function onSelectVariant(ctx, index) {
|
|
71
76
|
select(() => ctx.changeVariant(index));
|
|
@@ -79,15 +84,15 @@ var as_variant_picker_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
79
84
|
type: "button",
|
|
80
85
|
class: "as-variant-trigger",
|
|
81
86
|
disabled: __props.disabled,
|
|
82
|
-
title:
|
|
87
|
+
title: (0, vue.unref)(t)("UI_FORM_SWITCH_TYPE", { type: currentLabel.value }),
|
|
83
88
|
onClick: _cache[0] || (_cache[0] = (...args) => (0, vue.unref)(toggle) && (0, vue.unref)(toggle)(...args))
|
|
84
|
-
}, (0, vue.toDisplayString)(currentLabel.value || "
|
|
89
|
+
}, (0, vue.toDisplayString)(currentLabel.value || (0, vue.unref)(t)("UI_FORM_SWITCH")), 9, _hoisted_1), (0, vue.unref)(isOpen) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_2, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.unionContext.variants, (v, vi) => {
|
|
85
90
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
|
|
86
91
|
key: vi,
|
|
87
92
|
type: "button",
|
|
88
93
|
class: (0, vue.normalizeClass)(["as-dropdown-item", { "as-dropdown-item--active": __props.unionContext.currentIndex.value === vi }]),
|
|
89
94
|
onClick: ($event) => onSelectVariant(__props.unionContext, vi)
|
|
90
|
-
}, (0, vue.toDisplayString)(v.
|
|
95
|
+
}, (0, vue.toDisplayString)((0, vue.unref)(require_variant_label.variantLabel)(v, (0, vue.unref)(t))), 11, _hoisted_3);
|
|
91
96
|
}), 128))])) : (0, vue.createCommentVNode)("v-if", true)], 512);
|
|
92
97
|
};
|
|
93
98
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_use_form_context = require("./use-form-context-
|
|
3
|
-
const require_as_form = require("./as-form-
|
|
2
|
+
const require_use_form_context = require("./use-form-context-CXsLnG7l.cjs");
|
|
3
|
+
const require_as_form = require("./as-form-ChyW9bj2.cjs");
|
|
4
4
|
const require_use_as_nested_sections_store = require("./use-as-nested-sections-store-u1VgBJAP.cjs");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const require_as_iterator = require("./as-iterator-
|
|
5
|
+
const require_use_as_locale = require("./use-as-locale-C2tFUenv.cjs");
|
|
6
|
+
const require_use_as_value_help = require("./use-as-value-help-BE-fAZRP.cjs");
|
|
7
|
+
const require_as_field = require("./as-field-D0HgywQY.cjs");
|
|
8
|
+
const require_as_iterator = require("./as-iterator-Bty6f5Bq.cjs");
|
|
9
9
|
const require_focus_after_toggle = require("./focus-after-toggle-CWxiPZWi.cjs");
|
|
10
|
-
const require_as_collapsible = require("./as-collapsible-
|
|
11
|
-
const require_as_field_shell = require("./as-field-shell-
|
|
12
|
-
const
|
|
13
|
-
const require_as_input = require("./as-input-
|
|
14
|
-
const require_as_select = require("./as-select-
|
|
15
|
-
const require_as_multi_select = require("./as-multi-select-
|
|
16
|
-
const require_as_radio = require("./as-radio-
|
|
17
|
-
const require_as_checkbox = require("./as-checkbox-
|
|
10
|
+
const require_as_collapsible = require("./as-collapsible-BGeuF2Bn.cjs");
|
|
11
|
+
const require_as_field_shell = require("./as-field-shell-DSj3CqN6.cjs");
|
|
12
|
+
const require_variant_label = require("./variant-label-C-rLK7Z3.cjs");
|
|
13
|
+
const require_as_input = require("./as-input-Bf94SAOY.cjs");
|
|
14
|
+
const require_as_select = require("./as-select-DAbNosmB.cjs");
|
|
15
|
+
const require_as_multi_select = require("./as-multi-select-ZGBYoI48.cjs");
|
|
16
|
+
const require_as_radio = require("./as-radio-D9sctKpc.cjs");
|
|
17
|
+
const require_as_checkbox = require("./as-checkbox-Wn-PmHi-.cjs");
|
|
18
18
|
const require_as_paragraph = require("./as-paragraph-kKM4T1Dq.cjs");
|
|
19
19
|
const require_as_action = require("./as-action-DNRackS9.cjs");
|
|
20
20
|
const require_use_as_optional_add_flow = require("./use-as-optional-add-flow-CD8seN3C.cjs");
|
|
21
|
-
const require_as_object = require("./as-object-
|
|
22
|
-
const require_as_array = require("./as-array-
|
|
23
|
-
const require_as_union = require("./as-union-
|
|
24
|
-
const require_as_tuple = require("./as-tuple-
|
|
25
|
-
const require_as_ref = require("./as-ref-
|
|
26
|
-
const require_as_decimal = require("./as-decimal-
|
|
27
|
-
const require_as_number = require("./as-number-
|
|
21
|
+
const require_as_object = require("./as-object-DLdKOhxb.cjs");
|
|
22
|
+
const require_as_array = require("./as-array-C97cLzdA.cjs");
|
|
23
|
+
const require_as_union = require("./as-union-BjmrvD80.cjs");
|
|
24
|
+
const require_as_tuple = require("./as-tuple-DkI9fp4G.cjs");
|
|
25
|
+
const require_as_ref = require("./as-ref-CpHMAAJu.cjs");
|
|
26
|
+
const require_as_decimal = require("./as-decimal-C0Eqd9nM.cjs");
|
|
27
|
+
const require_as_number = require("./as-number-DXQCnc9d.cjs");
|
|
28
28
|
const require_use_as_date = require("./use-as-date-U_aHShPD.cjs");
|
|
29
|
-
const require_as_date = require("./as-date-
|
|
30
|
-
const require_as_datetime = require("./as-datetime-
|
|
31
|
-
const require_as_time = require("./as-time-
|
|
29
|
+
const require_as_date = require("./as-date-B2dgUoau.cjs");
|
|
30
|
+
const require_as_datetime = require("./as-datetime-CmBLyjgU.cjs");
|
|
31
|
+
const require_as_time = require("./as-time-NaICaSIj.cjs");
|
|
32
32
|
let vue = require("vue");
|
|
33
33
|
let _atscript_ui = require("@atscript/ui");
|
|
34
34
|
//#region src/composables/create-as-form-def.ts
|
|
@@ -195,7 +195,7 @@ exports.useAsData = require_as_field.useAsData;
|
|
|
195
195
|
exports.useAsDate = require_use_as_date.useAsDate;
|
|
196
196
|
exports.useAsDecimal = require_as_decimal.useAsDecimal;
|
|
197
197
|
exports.useAsDescendantErrorCounts = require_use_as_nested_sections_store.useAsDescendantErrorCounts;
|
|
198
|
-
exports.useAsDropdown =
|
|
198
|
+
exports.useAsDropdown = require_variant_label.useAsDropdown;
|
|
199
199
|
exports.useAsDualInput = require_as_decimal.useAsDualInput;
|
|
200
200
|
exports.useAsErrorDismiss = useAsErrorDismiss;
|
|
201
201
|
exports.useAsExternalErrors = require_as_form.useAsExternalErrors;
|
package/dist/index.d.cts
CHANGED
|
@@ -20,5 +20,6 @@ import { t as _default$13 } from "./as-number.vue-BsJdJS36.cjs";
|
|
|
20
20
|
import { t as _default$4 } from "./as-date.vue-axahL_Zv.cjs";
|
|
21
21
|
import { t as _default$5 } from "./as-datetime.vue-C6ILTI-7.cjs";
|
|
22
22
|
import { t as _default$19 } from "./as-time.vue-CQhIKAs0.cjs";
|
|
23
|
-
import { $ as
|
|
23
|
+
import { $ as useAsDescendantErrorCounts, A as useAsNumber, At as TFormFieldRegistration, B as focusFirstAfter, C as UseAsDateReturn, Ct as TFormSubmitValidator, D as useAsDualInput, Dt as UseAsFieldReturn, E as UseAsDualInputReturn, Et as UseAsFieldOptions, F as UseAsTriStateCheckboxReturn, G as useAsOptionalField, H as useAsFocusFirstAfter, I as useAsTriStateCheckbox, J as useAsFieldScope, K as TResolveFieldPropOptions, L as UseAsOptionalAddFlowOptions, M as UseAsDecimalReturn, Mt as TFormState, N as useAsDecimal, Nt as createDefaultTypes, O as UseAsNumberOptions, Ot as useAsField, P as UseAsTriStateCheckboxOptions, Pt as createAsFormDef, Q as provideAsNestedSectionsStore, R as UseAsOptionalAddFlowReturn, S as UseAsDateOptions, St as useAsFormPatch, T as UseAsDualInputOptions, Tt as useAsState, U as useAsVisibleFields, V as focusNewFocusableAfter, W as UseAsOptionalFieldReturn, X as useAsLevel, Y as provideAsNestedLevel, Z as AsNestedSectionsStore, _ as useAsData, _t as UseAsFormOptions, a as FormFieldChange, at as formatIndexedLabelParts, b as UseAsPathReturn, bt as AsFormPatchHandle, c as getDefaultClientFactory, ct as useAsUnion, d as joinPath, dt as UseAsArrayReturn, et as useAsNestedSectionsStore, f as resetDefaultClientFactory, ft as useAsArray, g as UseAsDataReturn, gt as TAsFormValue, h as useAsErrorDismiss, ht as useAsExternalErrors, i as FormDiffOptions, it as useAsValueHelp, j as UseAsDecimalOptions, jt as TFormRule, k as UseAsNumberReturn, kt as TFormFieldCallbacks, l as hasFieldMeta, lt as UseAsTupleReturn, m as AsErrorDismiss, mt as UseAsExternalErrorsReturn, n as _default$9, nt as UseAsValueHelpOptions, o as FormRebaseOptions, ot as useAsUnionVariant, p as setDefaultClientFactory, pt as UseAsExternalErrorsOptions, q as UseAsFieldScopeReturn, r as ClientFactory, rt as UseAsValueHelpReturn, s as TypedClientFactory, st as UseAsUnionReturn, tt as useAsDropdown, u as isFieldHidden, ut as useAsTuple, v as UseAsTypeMapReturn, vt as UseAsFormReturn, w as useAsDate, wt as UseAsStateReturn, x as useAsPath, xt as RebaseOntoResult, y as useAsTypeMap, yt as useAsForm, z as useAsOptionalAddFlow } from "./as-form.vue-BuRFHSK-.cjs";
|
|
24
|
+
import { n as provideAsLocale, r as useAsLocale, t as UseAsLocaleReturn } from "./use-as-locale-CnGzoVWd.cjs";
|
|
24
25
|
export { _default as AsAction, _default$1 as AsArray, _default$2 as AsCheckbox, _default$3 as AsCollapsible, _default$4 as AsDate, _default$5 as AsDatetime, _default$6 as AsDecimal, AsErrorDismiss, _default$7 as AsField, _default$8 as AsFieldShell, _default$9 as AsForm, AsFormPatchHandle, _default$10 as AsInput, _default$11 as AsIterator, _default$12 as AsMultiSelect, AsNestedSectionsStore, _default$13 as AsNumber, _default$14 as AsObject, _default$15 as AsParagraph, _default$16 as AsRadio, _default$17 as AsRef, _default$18 as AsSelect, _default$19 as AsTime, _default$20 as AsTuple, _default$21 as AsUnion, ClientFactory, FormDiffOptions, FormFieldChange, FormRebaseOptions, RebaseOntoResult, TAsBaseComponentProps, TAsChangeType, TAsCollapsibleProps, TAsCollapsibleSlots, TAsComponentEmits, TAsComponentProps, TAsFormValue, TAsTypeComponents, TAsUnionContext, TFormFieldCallbacks, TFormFieldRegistration, TFormRule, TFormState, TFormSubmitValidator, TResolveFieldPropOptions, TypedClientFactory, UseAsArrayReturn, UseAsDataReturn, UseAsDateOptions, UseAsDateReturn, UseAsDecimalOptions, UseAsDecimalReturn, UseAsDualInputOptions, UseAsDualInputReturn, UseAsExternalErrorsOptions, UseAsExternalErrorsReturn, UseAsFieldOptions, UseAsFieldReturn, UseAsFieldScopeReturn, UseAsFormOptions, UseAsFormReturn, UseAsLocaleReturn, UseAsNumberOptions, UseAsNumberReturn, UseAsOptionalAddFlowOptions, UseAsOptionalAddFlowReturn, UseAsOptionalFieldReturn, UseAsPathReturn, UseAsStateReturn, UseAsTriStateCheckboxOptions, UseAsTriStateCheckboxReturn, UseAsTupleReturn, UseAsTypeMapReturn, UseAsUnionReturn, UseAsValueHelpOptions, UseAsValueHelpReturn, createAsFormDef, createDefaultTypes, focusFirstAfter, focusNewFocusableAfter, formatIndexedLabelParts, getDefaultClientFactory, hasFieldMeta, isFieldHidden, joinPath, provideAsLocale, provideAsNestedLevel, provideAsNestedSectionsStore, resetDefaultClientFactory, setDefaultClientFactory, useAsArray, useAsData, useAsDate, useAsDecimal, useAsDescendantErrorCounts, useAsDropdown, useAsDualInput, useAsErrorDismiss, useAsExternalErrors, useAsField, useAsFieldScope, useAsFocusFirstAfter, useAsForm, useAsFormPatch, useAsLevel, useAsLocale, useAsNestedSectionsStore, useAsNumber, useAsOptionalAddFlow, useAsOptionalField, useAsPath, useAsState, useAsTriStateCheckbox, useAsTuple, useAsTypeMap, useAsUnion, useAsUnionVariant, useAsValueHelp, useAsVisibleFields };
|
package/dist/index.d.mts
CHANGED
|
@@ -20,5 +20,6 @@ import { t as _default$13 } from "./as-number.vue-DSP2S_xP.mjs";
|
|
|
20
20
|
import { t as _default$4 } from "./as-date.vue-BTm9X4fW.mjs";
|
|
21
21
|
import { t as _default$5 } from "./as-datetime.vue-vysHc3Ug.mjs";
|
|
22
22
|
import { t as _default$19 } from "./as-time.vue-CjzRrsFg.mjs";
|
|
23
|
-
import { $ as
|
|
23
|
+
import { $ as useAsDescendantErrorCounts, A as useAsNumber, At as TFormFieldRegistration, B as focusFirstAfter, C as UseAsDateReturn, Ct as TFormSubmitValidator, D as useAsDualInput, Dt as UseAsFieldReturn, E as UseAsDualInputReturn, Et as UseAsFieldOptions, F as UseAsTriStateCheckboxReturn, G as useAsOptionalField, H as useAsFocusFirstAfter, I as useAsTriStateCheckbox, J as useAsFieldScope, K as TResolveFieldPropOptions, L as UseAsOptionalAddFlowOptions, M as UseAsDecimalReturn, Mt as TFormState, N as useAsDecimal, Nt as createDefaultTypes, O as UseAsNumberOptions, Ot as useAsField, P as UseAsTriStateCheckboxOptions, Pt as createAsFormDef, Q as provideAsNestedSectionsStore, R as UseAsOptionalAddFlowReturn, S as UseAsDateOptions, St as useAsFormPatch, T as UseAsDualInputOptions, Tt as useAsState, U as useAsVisibleFields, V as focusNewFocusableAfter, W as UseAsOptionalFieldReturn, X as useAsLevel, Y as provideAsNestedLevel, Z as AsNestedSectionsStore, _ as useAsData, _t as UseAsFormOptions, a as FormFieldChange, at as formatIndexedLabelParts, b as UseAsPathReturn, bt as AsFormPatchHandle, c as getDefaultClientFactory, ct as useAsUnion, d as joinPath, dt as UseAsArrayReturn, et as useAsNestedSectionsStore, f as resetDefaultClientFactory, ft as useAsArray, g as UseAsDataReturn, gt as TAsFormValue, h as useAsErrorDismiss, ht as useAsExternalErrors, i as FormDiffOptions, it as useAsValueHelp, j as UseAsDecimalOptions, jt as TFormRule, k as UseAsNumberReturn, kt as TFormFieldCallbacks, l as hasFieldMeta, lt as UseAsTupleReturn, m as AsErrorDismiss, mt as UseAsExternalErrorsReturn, n as _default$9, nt as UseAsValueHelpOptions, o as FormRebaseOptions, ot as useAsUnionVariant, p as setDefaultClientFactory, pt as UseAsExternalErrorsOptions, q as UseAsFieldScopeReturn, r as ClientFactory, rt as UseAsValueHelpReturn, s as TypedClientFactory, st as UseAsUnionReturn, tt as useAsDropdown, u as isFieldHidden, ut as useAsTuple, v as UseAsTypeMapReturn, vt as UseAsFormReturn, w as useAsDate, wt as UseAsStateReturn, x as useAsPath, xt as RebaseOntoResult, y as useAsTypeMap, yt as useAsForm, z as useAsOptionalAddFlow } from "./as-form.vue-CHEkgO3k.mjs";
|
|
24
|
+
import { n as provideAsLocale, r as useAsLocale, t as UseAsLocaleReturn } from "./use-as-locale-BVcC0l75.mjs";
|
|
24
25
|
export { _default as AsAction, _default$1 as AsArray, _default$2 as AsCheckbox, _default$3 as AsCollapsible, _default$4 as AsDate, _default$5 as AsDatetime, _default$6 as AsDecimal, AsErrorDismiss, _default$7 as AsField, _default$8 as AsFieldShell, _default$9 as AsForm, AsFormPatchHandle, _default$10 as AsInput, _default$11 as AsIterator, _default$12 as AsMultiSelect, AsNestedSectionsStore, _default$13 as AsNumber, _default$14 as AsObject, _default$15 as AsParagraph, _default$16 as AsRadio, _default$17 as AsRef, _default$18 as AsSelect, _default$19 as AsTime, _default$20 as AsTuple, _default$21 as AsUnion, ClientFactory, FormDiffOptions, FormFieldChange, FormRebaseOptions, RebaseOntoResult, TAsBaseComponentProps, TAsChangeType, TAsCollapsibleProps, TAsCollapsibleSlots, TAsComponentEmits, TAsComponentProps, TAsFormValue, TAsTypeComponents, TAsUnionContext, TFormFieldCallbacks, TFormFieldRegistration, TFormRule, TFormState, TFormSubmitValidator, TResolveFieldPropOptions, TypedClientFactory, UseAsArrayReturn, UseAsDataReturn, UseAsDateOptions, UseAsDateReturn, UseAsDecimalOptions, UseAsDecimalReturn, UseAsDualInputOptions, UseAsDualInputReturn, UseAsExternalErrorsOptions, UseAsExternalErrorsReturn, UseAsFieldOptions, UseAsFieldReturn, UseAsFieldScopeReturn, UseAsFormOptions, UseAsFormReturn, UseAsLocaleReturn, UseAsNumberOptions, UseAsNumberReturn, UseAsOptionalAddFlowOptions, UseAsOptionalAddFlowReturn, UseAsOptionalFieldReturn, UseAsPathReturn, UseAsStateReturn, UseAsTriStateCheckboxOptions, UseAsTriStateCheckboxReturn, UseAsTupleReturn, UseAsTypeMapReturn, UseAsUnionReturn, UseAsValueHelpOptions, UseAsValueHelpReturn, createAsFormDef, createDefaultTypes, focusFirstAfter, focusNewFocusableAfter, formatIndexedLabelParts, getDefaultClientFactory, hasFieldMeta, isFieldHidden, joinPath, provideAsLocale, provideAsNestedLevel, provideAsNestedSectionsStore, resetDefaultClientFactory, setDefaultClientFactory, useAsArray, useAsData, useAsDate, useAsDecimal, useAsDescendantErrorCounts, useAsDropdown, useAsDualInput, useAsErrorDismiss, useAsExternalErrors, useAsField, useAsFieldScope, useAsFocusFirstAfter, useAsForm, useAsFormPatch, useAsLevel, useAsLocale, useAsNestedSectionsStore, useAsNumber, useAsOptionalAddFlow, useAsOptionalField, useAsPath, useAsState, useAsTriStateCheckbox, useAsTuple, useAsTypeMap, useAsUnion, useAsUnionVariant, useAsValueHelp, useAsVisibleFields };
|
package/dist/index.mjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { h as PATH_PREFIX_KEY, n as useAsUnionVariant, s as DISMISS_EXTERNAL_AT_KEY, t as formatIndexedLabelParts } from "./use-form-context-
|
|
2
|
-
import { a as useAsFormPatch, i as useAsExternalErrors, n as useAsForm, r as useAsState, t as as_form_default } from "./as-form-
|
|
1
|
+
import { h as PATH_PREFIX_KEY, n as useAsUnionVariant, s as DISMISS_EXTERNAL_AT_KEY, t as formatIndexedLabelParts } from "./use-form-context-C3FxL3eF.mjs";
|
|
2
|
+
import { a as useAsFormPatch, i as useAsExternalErrors, n as useAsForm, r as useAsState, t as as_form_default } from "./as-form-0VCxVsGo.mjs";
|
|
3
3
|
import { i as useAsNestedSectionsStore, n as provideAsNestedSectionsStore, r as useAsDescendantErrorCounts } from "./use-as-nested-sections-store-Dfo971PK.mjs";
|
|
4
|
-
import { n as
|
|
5
|
-
import {
|
|
6
|
-
import { n as
|
|
7
|
-
import { n as provideAsNestedLevel, r as useAsLevel, t as as_iterator_default } from "./as-iterator-
|
|
4
|
+
import { n as useAsLocale, t as provideAsLocale } from "./use-as-locale-1k9NBn-G.mjs";
|
|
5
|
+
import { n as useAsValueHelp } from "./use-as-value-help-nIpEFMqD.mjs";
|
|
6
|
+
import { a as useAsField, i as useAsFieldScope, n as useAsData, r as useAsOptionalField, t as as_field_default } from "./as-field-BZpWLPcM.mjs";
|
|
7
|
+
import { n as provideAsNestedLevel, r as useAsLevel, t as as_iterator_default } from "./as-iterator-Dp1OiwU7.mjs";
|
|
8
8
|
import { n as focusNewFocusableAfter, r as useAsFocusFirstAfter, t as focusFirstAfter } from "./focus-after-toggle-Dtl3P6CS.mjs";
|
|
9
|
-
import { t as as_collapsible_default } from "./as-collapsible-
|
|
10
|
-
import { t as as_field_shell_default } from "./as-field-shell-
|
|
11
|
-
import {
|
|
12
|
-
import { t as as_input_default } from "./as-input-
|
|
13
|
-
import { t as as_select_default } from "./as-select-
|
|
14
|
-
import { t as as_multi_select_default } from "./as-multi-select-
|
|
15
|
-
import { t as as_radio_default } from "./as-radio-
|
|
16
|
-
import { n as useAsTriStateCheckbox, t as as_checkbox_default } from "./as-checkbox-
|
|
9
|
+
import { t as as_collapsible_default } from "./as-collapsible-Cb9SgJh9.mjs";
|
|
10
|
+
import { t as as_field_shell_default } from "./as-field-shell-D7XovzgJ.mjs";
|
|
11
|
+
import { n as useAsDropdown } from "./variant-label-B065kts3.mjs";
|
|
12
|
+
import { t as as_input_default } from "./as-input-DlLLiAYI.mjs";
|
|
13
|
+
import { t as as_select_default } from "./as-select-CrjlxcgR.mjs";
|
|
14
|
+
import { t as as_multi_select_default } from "./as-multi-select-DT0M_1_O.mjs";
|
|
15
|
+
import { t as as_radio_default } from "./as-radio-CW9YWBnC.mjs";
|
|
16
|
+
import { n as useAsTriStateCheckbox, t as as_checkbox_default } from "./as-checkbox-BO8xW0OM.mjs";
|
|
17
17
|
import { t as as_paragraph_default } from "./as-paragraph-ov2mvW2V.mjs";
|
|
18
18
|
import { t as as_action_default } from "./as-action-DqR9HlEa.mjs";
|
|
19
19
|
import { t as useAsOptionalAddFlow } from "./use-as-optional-add-flow-BdjKNx9P.mjs";
|
|
20
|
-
import { t as as_object_default } from "./as-object-
|
|
21
|
-
import { n as useAsArray, t as as_array_default } from "./as-array-
|
|
22
|
-
import { n as useAsTypeMap, r as useAsUnion, t as as_union_default } from "./as-union-
|
|
23
|
-
import { n as useAsTuple, t as as_tuple_default } from "./as-tuple-
|
|
24
|
-
import { t as as_ref_default } from "./as-ref-
|
|
25
|
-
import { n as useAsDualInput, r as useAsDecimal, t as as_decimal_default } from "./as-decimal-
|
|
26
|
-
import { n as useAsNumber, t as as_number_default } from "./as-number-
|
|
20
|
+
import { t as as_object_default } from "./as-object-mpRxIKVB.mjs";
|
|
21
|
+
import { n as useAsArray, t as as_array_default } from "./as-array-B2axGw3v.mjs";
|
|
22
|
+
import { n as useAsTypeMap, r as useAsUnion, t as as_union_default } from "./as-union-C3QiGYlE.mjs";
|
|
23
|
+
import { n as useAsTuple, t as as_tuple_default } from "./as-tuple-BBx6P6xb.mjs";
|
|
24
|
+
import { t as as_ref_default } from "./as-ref-DaCGfshO.mjs";
|
|
25
|
+
import { n as useAsDualInput, r as useAsDecimal, t as as_decimal_default } from "./as-decimal-C-OJ8ygU.mjs";
|
|
26
|
+
import { n as useAsNumber, t as as_number_default } from "./as-number-DkG5GuGW.mjs";
|
|
27
27
|
import { t as useAsDate } from "./use-as-date-pbhMXyU8.mjs";
|
|
28
|
-
import { t as as_date_default } from "./as-date-
|
|
29
|
-
import { t as as_datetime_default } from "./as-datetime-
|
|
30
|
-
import { t as as_time_default } from "./as-time-
|
|
28
|
+
import { t as as_date_default } from "./as-date-jQpwe6sr.mjs";
|
|
29
|
+
import { t as as_datetime_default } from "./as-datetime-DYn9NndT.mjs";
|
|
30
|
+
import { t as as_time_default } from "./as-time-BmXXgfCZ.mjs";
|
|
31
31
|
import { computed, inject, reactive, toValue } from "vue";
|
|
32
32
|
import { UI_FORM_FN_HIDDEN, UI_FORM_HIDDEN, createFormData, createFormDef, createFormValueResolver, getDefaultClientFactory, hasFieldMeta, isFieldHidden, joinPath, resetDefaultClientFactory, setDefaultClientFactory } from "@atscript/ui";
|
|
33
33
|
//#region src/composables/create-as-form-def.ts
|
package/dist/locale.cjs
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_use_as_locale = require("./use-as-locale-C2tFUenv.cjs");
|
|
3
|
+
exports.provideAsLocale = require_use_as_locale.provideAsLocale;
|
|
4
|
+
exports.useAsLocale = require_use_as_locale.useAsLocale;
|
|
5
|
+
exports.useAsTexts = require_use_as_locale.useAsTexts;
|
package/dist/locale.mjs
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { computed, hasInjectionContext, inject, onScopeDispose, provide, shallowRef } from "vue";
|
|
2
|
+
import { activateUiTexts, createUiTexts, getUiTexts } from "@atscript/ui";
|
|
3
|
+
//#region src/composables/use-as-locale.ts
|
|
4
|
+
/**
|
|
5
|
+
* The app's locale and UI texts: the BCP-47 locale for form-side `Intl`
|
|
6
|
+
* formatting (decimal separator, thousands, currency symbol) and the
|
|
7
|
+
* language of the built-in texts (buttons, labels, messages) of every
|
|
8
|
+
* `@atscript/vue-*` component. Parallels `provideCellLocale` in
|
|
9
|
+
* `@atscript/vue-table`, which owns the table's `Intl` locale and time zone —
|
|
10
|
+
* the host wires both from a single source (e.g. `useAppPrefs`).
|
|
11
|
+
*
|
|
12
|
+
* One per app, never module-global: a server rendering for many users keeps
|
|
13
|
+
* each app's locale. Interned (`Symbol.for`): one key across module copies.
|
|
14
|
+
*/
|
|
15
|
+
const AS_LOCALE_KEY = Symbol.for("atscript.ui.locale");
|
|
16
|
+
/**
|
|
17
|
+
* Provides the app's locale. `getter` returns a BCP-47 locale (or
|
|
18
|
+
* `undefined` for the runtime's); reactive sources work as they are
|
|
19
|
+
* (`() => prefs.value.language`). The built-in texts follow it: the texts the
|
|
20
|
+
* server served for the locale, else English — or your own `translate`
|
|
21
|
+
* first (return `undefined` to fall back).
|
|
22
|
+
*
|
|
23
|
+
* Call it once at the app root. To switch the language of an open page,
|
|
24
|
+
* remount the view (`<RouterView :key="locale" />`).
|
|
25
|
+
*/
|
|
26
|
+
function provideAsLocale(getter, translate) {
|
|
27
|
+
const texts = createUiTexts({
|
|
28
|
+
locale: getter,
|
|
29
|
+
translate: translate && (() => translate),
|
|
30
|
+
dicts: shallowRef({})
|
|
31
|
+
});
|
|
32
|
+
provide(AS_LOCALE_KEY, texts);
|
|
33
|
+
if (typeof window !== "undefined") onScopeDispose(activateUiTexts(texts));
|
|
34
|
+
}
|
|
35
|
+
function injectTexts() {
|
|
36
|
+
return hasInjectionContext() ? inject(AS_LOCALE_KEY, null) : null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The app's UI texts (`provideAsLocale`), else the global ones
|
|
40
|
+
* (`setUiLocale`). One `inject` — cheap enough for per-row components.
|
|
41
|
+
*
|
|
42
|
+
* @internal Shared with `@atscript/vue-table` and `@atscript/vue-wf`.
|
|
43
|
+
*/
|
|
44
|
+
function useAsTexts() {
|
|
45
|
+
return injectTexts() ?? getUiTexts();
|
|
46
|
+
}
|
|
47
|
+
function useAsLocale() {
|
|
48
|
+
const provided = injectTexts();
|
|
49
|
+
const texts = provided ?? getUiTexts();
|
|
50
|
+
return {
|
|
51
|
+
locale: computed(() => provided?.locale()),
|
|
52
|
+
t: texts.t
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { useAsLocale as n, useAsTexts as r, provideAsLocale as t };
|