@stonecrop/aform 0.38.1 → 0.39.0
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/README.md +1 -1
- package/dist/aform.js +147 -49
- package/dist/aform.js.map +1 -1
- package/dist/assets/index.css +97 -71
- package/dist/src/components/AForm.vue.d.ts.map +1 -1
- package/dist/src/components/form/ACurrencyInput.vue.d.ts.map +1 -1
- package/dist/src/components/form/ADropdown.vue.d.ts.map +1 -1
- package/dist/src/components/form/AFieldset.vue.d.ts +13 -3
- package/dist/src/components/form/AFieldset.vue.d.ts.map +1 -1
- package/dist/src/components/form/AFormLink.vue.d.ts.map +1 -1
- package/dist/src/components/form/AQuantityInput.vue.d.ts.map +1 -1
- package/dist/src/composables/dropdownList.d.ts +15 -0
- package/dist/src/composables/dropdownList.d.ts.map +1 -0
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ key on the schema field is ignored, and a table whose `fieldname` has no matchin
|
|
|
80
80
|
const data = ref({ line_items: [{ item_code: 'LAPTOP-PRO-15', quantity: 2 }] })
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
A table inside a fieldset reads its rows from `data[tableFieldname]` too: a fieldset is layout, so every field inside one is a key of the record itself.
|
|
84
84
|
|
|
85
85
|
### Field width
|
|
86
86
|
|
package/dist/aform.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { hasBadgeOptions, isBadgeDescriptor, lookupBadge, selectChoices } from "@stonecrop/schema";
|
|
2
2
|
import { install as install$1 } from "@stonecrop/atable";
|
|
3
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, inject, mergeModels, mergeProps, nextTick, normalizeClass, normalizeStyle, onMounted, openBlock, provide, reactive, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, toDisplayString, unref, useId, useModel, useTemplateRef, vModelCheckbox, vModelRadio, vModelSelect, vModelText, vShow, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
3
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, inject, mergeModels, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, provide, reactive, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, toDisplayString, unref, useId, useModel, useTemplateRef, vModelCheckbox, vModelRadio, vModelSelect, vModelText, vShow, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
4
4
|
import { vOnClickOutside } from "@vueuse/components";
|
|
5
5
|
import { fromISODate } from "@stonecrop/utilities";
|
|
6
6
|
import { Temporal } from "temporal-polyfill";
|
|
@@ -133,7 +133,7 @@ function fieldErrorA11y(uuid, errorText) {
|
|
|
133
133
|
var _hoisted_1$20 = { class: "aform_form-element" };
|
|
134
134
|
var _hoisted_2$19 = { class: "aform_field-label" };
|
|
135
135
|
var _hoisted_3$17 = { class: "aform_display-value" };
|
|
136
|
-
var _hoisted_4$
|
|
136
|
+
var _hoisted_4$17 = ["for"];
|
|
137
137
|
var _hoisted_5$16 = { class: "aform_checkbox-container aform_input-field" };
|
|
138
138
|
var _hoisted_6$13 = [
|
|
139
139
|
"id",
|
|
@@ -174,7 +174,7 @@ var ACheckbox_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
174
174
|
createElementVNode("label", {
|
|
175
175
|
class: "aform_field-label",
|
|
176
176
|
for: __props.uuid
|
|
177
|
-
}, toDisplayString(__props.label), 9, _hoisted_4$
|
|
177
|
+
}, toDisplayString(__props.label), 9, _hoisted_4$17),
|
|
178
178
|
createElementVNode("span", _hoisted_5$16, [withDirectives(createElementVNode("input", {
|
|
179
179
|
id: __props.uuid,
|
|
180
180
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => checkbox.value = $event),
|
|
@@ -221,6 +221,49 @@ function numberFromBox(value) {
|
|
|
221
221
|
return value === "" ? null : value;
|
|
222
222
|
}
|
|
223
223
|
//#endregion
|
|
224
|
+
//#region src/composables/dropdownList.ts
|
|
225
|
+
var WINDOW_MARGIN = 8;
|
|
226
|
+
var MIN_ROWS = 4;
|
|
227
|
+
/**
|
|
228
|
+
* Keeps an open dropdown list in the window: its height is the smaller of `--sc-dropdown-max-height`
|
|
229
|
+
* (the stylesheet's `max-height`) and the room left below it, never under about four rows, and the
|
|
230
|
+
* option the arrow keys highlight is scrolled into sight.
|
|
231
|
+
*/
|
|
232
|
+
function fitDropdownList(list, state) {
|
|
233
|
+
const fit = (event) => {
|
|
234
|
+
const element = list.value;
|
|
235
|
+
if (!element || !state.isOpen() || event?.target === element) return;
|
|
236
|
+
element.style.maxHeight = "";
|
|
237
|
+
const cap = Number.parseFloat(getComputedStyle(element).maxHeight);
|
|
238
|
+
const row = element.querySelector("[role=\"option\"]")?.getBoundingClientRect().height ?? 0;
|
|
239
|
+
const room = window.innerHeight - element.getBoundingClientRect().top - WINDOW_MARGIN;
|
|
240
|
+
const height = Math.max(room, MIN_ROWS * row);
|
|
241
|
+
if (Number.isNaN(cap) || height < cap) element.style.maxHeight = `${Math.floor(height)}px`;
|
|
242
|
+
};
|
|
243
|
+
const listen = () => {
|
|
244
|
+
window.addEventListener("scroll", fit, {
|
|
245
|
+
capture: true,
|
|
246
|
+
passive: true
|
|
247
|
+
});
|
|
248
|
+
window.addEventListener("resize", fit, { passive: true });
|
|
249
|
+
};
|
|
250
|
+
const stopListening = () => {
|
|
251
|
+
window.removeEventListener("scroll", fit, { capture: true });
|
|
252
|
+
window.removeEventListener("resize", fit);
|
|
253
|
+
};
|
|
254
|
+
watch(state.isOpen, (open) => {
|
|
255
|
+
if (open) return listen();
|
|
256
|
+
stopListening();
|
|
257
|
+
if (list.value) list.value.style.maxHeight = "";
|
|
258
|
+
});
|
|
259
|
+
watch(() => state.isOpen() && state.optionCount(), () => void nextTick(() => fit()));
|
|
260
|
+
watch(state.activeIndex, (index) => {
|
|
261
|
+
if (index === null || index < 0) return;
|
|
262
|
+
nextTick(() => list.value?.querySelectorAll("[role=\"option\"]")[index]?.scrollIntoView?.({ block: "nearest" }));
|
|
263
|
+
}, { flush: "post" });
|
|
264
|
+
onBeforeUnmount(stopListening);
|
|
265
|
+
}
|
|
266
|
+
//#endregion
|
|
224
267
|
//#region src/components/form/AFormLink.vue?vue&type=script&setup=true&lang.ts
|
|
225
268
|
var _hoisted_1$19 = { class: "aform_display-value" };
|
|
226
269
|
var _hoisted_2$18 = {
|
|
@@ -228,7 +271,7 @@ var _hoisted_2$18 = {
|
|
|
228
271
|
class: "aform_field-label"
|
|
229
272
|
};
|
|
230
273
|
var _hoisted_3$16 = { class: "aform_form-link-wrapper" };
|
|
231
|
-
var _hoisted_4$
|
|
274
|
+
var _hoisted_4$16 = { class: "input-group" };
|
|
232
275
|
var _hoisted_5$15 = [
|
|
233
276
|
"placeholder",
|
|
234
277
|
"size",
|
|
@@ -327,6 +370,11 @@ var AFormLink_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
|
|
|
327
370
|
const loading = ref(false);
|
|
328
371
|
const dropdownResults = ref([]);
|
|
329
372
|
const activeIndex = ref(null);
|
|
373
|
+
fitDropdownList(useTemplateRef("results"), {
|
|
374
|
+
isOpen: () => dropdownOpen.value,
|
|
375
|
+
optionCount: () => dropdownResults.value.length,
|
|
376
|
+
activeIndex: () => activeIndex.value
|
|
377
|
+
});
|
|
330
378
|
const navigator = inject("aformLinkNavigator", null);
|
|
331
379
|
const resolver = inject("aformLinkResolver", null);
|
|
332
380
|
function linkId(value) {
|
|
@@ -422,7 +470,7 @@ var AFormLink_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
|
|
|
422
470
|
if (activeIndex.value !== null && dropdownResults.value[activeIndex.value]) selectOption(dropdownResults.value[activeIndex.value]);
|
|
423
471
|
};
|
|
424
472
|
return (_ctx, _cache) => {
|
|
425
|
-
return openBlock(), createElementBlock("div", { class: normalizeClass(["aform_form-element", { "aform_form-element--embedded": __props.embedded }]) }, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_1$19, toDisplayString(displayedText.value), 1), __props.label && !__props.embedded ? (openBlock(), createElementBlock("label", _hoisted_2$18, toDisplayString(__props.label), 1)) : createCommentVNode("", true)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [withDirectives((openBlock(), createElementBlock("div", _hoisted_3$16, [createElementVNode("div", _hoisted_4$
|
|
473
|
+
return openBlock(), createElementBlock("div", { class: normalizeClass(["aform_form-element", { "aform_form-element--embedded": __props.embedded }]) }, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_1$19, toDisplayString(displayedText.value), 1), __props.label && !__props.embedded ? (openBlock(), createElementBlock("label", _hoisted_2$18, toDisplayString(__props.label), 1)) : createCommentVNode("", true)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [withDirectives((openBlock(), createElementBlock("div", _hoisted_3$16, [createElementVNode("div", _hoisted_4$16, [withDirectives(createElementVNode("input", {
|
|
426
474
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchText.value = $event),
|
|
427
475
|
type: "text",
|
|
428
476
|
role: "combobox",
|
|
@@ -461,6 +509,7 @@ var AFormLink_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
|
|
|
461
509
|
}, [__props.icon === "chevron-right" ? (openBlock(), createElementBlock("path", _hoisted_8$6)) : (openBlock(), createElementBlock("path", _hoisted_9$5))], 8, _hoisted_7$6)), createElementVNode("span", _hoisted_10$4, toDisplayString(__props.icon === "chevron-right" ? "›" : "→"), 1)], 40, _hoisted_6$12)) : createCommentVNode("", true)]), dropdownOpen.value ? (openBlock(), createElementBlock("ul", {
|
|
462
510
|
key: 0,
|
|
463
511
|
id: listboxId,
|
|
512
|
+
ref: "results",
|
|
464
513
|
class: "autocomplete-results",
|
|
465
514
|
role: "listbox",
|
|
466
515
|
"aria-label": __props.ariaLabel
|
|
@@ -476,13 +525,13 @@ var AFormLink_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
|
|
|
476
525
|
}), 128))], 8, _hoisted_11$4)) : createCommentVNode("", true)])), [[unref(vOnClickOutside), onClickOutside]]), __props.label && !__props.embedded ? (openBlock(), createElementBlock("label", _hoisted_14$3, toDisplayString(__props.label), 1)) : createCommentVNode("", true)], 64))], 2);
|
|
477
526
|
};
|
|
478
527
|
}
|
|
479
|
-
}), [["__scopeId", "data-v-
|
|
528
|
+
}), [["__scopeId", "data-v-a42cba74"]]);
|
|
480
529
|
//#endregion
|
|
481
530
|
//#region src/components/form/ACurrencyInput.vue?vue&type=script&setup=true&lang.ts
|
|
482
531
|
var _hoisted_1$18 = { class: "aform_form-element acurrency" };
|
|
483
532
|
var _hoisted_2$17 = { class: "aform_display-value" };
|
|
484
533
|
var _hoisted_3$15 = { class: "aform_field-label" };
|
|
485
|
-
var _hoisted_4$
|
|
534
|
+
var _hoisted_4$15 = { class: "acurrency__row" };
|
|
486
535
|
var _hoisted_5$14 = { class: "acurrency__field acurrency__field--amount" };
|
|
487
536
|
var _hoisted_6$11 = { class: "acurrency__group" };
|
|
488
537
|
var _hoisted_7$5 = { class: "acurrency__currency" };
|
|
@@ -640,7 +689,7 @@ var ACurrencyInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
640
689
|
});
|
|
641
690
|
return (_ctx, _cache) => {
|
|
642
691
|
return openBlock(), createElementBlock("div", _hoisted_1$18, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_2$17, toDisplayString(displayText.value), 1), createElementVNode("label", _hoisted_3$15, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
643
|
-
createElementVNode("div", _hoisted_4$
|
|
692
|
+
createElementVNode("div", _hoisted_4$15, [createElementVNode("div", _hoisted_5$14, [createElementVNode("div", _hoisted_6$11, [createElementVNode("div", _hoisted_7$5, [createVNode(AFormLink_default, {
|
|
644
693
|
modelValue: currency.value,
|
|
645
694
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => currency.value = $event),
|
|
646
695
|
mode: __props.mode,
|
|
@@ -712,7 +761,7 @@ var ACurrencyInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
712
761
|
], 64))]);
|
|
713
762
|
};
|
|
714
763
|
}
|
|
715
|
-
}), [["__scopeId", "data-v-
|
|
764
|
+
}), [["__scopeId", "data-v-140c66a7"]]);
|
|
716
765
|
//#endregion
|
|
717
766
|
//#region src/utils/typedDay.ts
|
|
718
767
|
var TYPED_DAY_FORMAT = {
|
|
@@ -755,7 +804,7 @@ function readTypedDay(text, locale) {
|
|
|
755
804
|
var _hoisted_1$17 = { class: "aform_display-value" };
|
|
756
805
|
var _hoisted_2$16 = { key: 0 };
|
|
757
806
|
var _hoisted_3$14 = ["id"];
|
|
758
|
-
var _hoisted_4$
|
|
807
|
+
var _hoisted_4$14 = { class: "adatepicker" };
|
|
759
808
|
var _hoisted_5$13 = ["aria-label"];
|
|
760
809
|
var _hoisted_6$10 = {
|
|
761
810
|
colspan: "5",
|
|
@@ -1017,7 +1066,7 @@ var ADatePicker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
|
|
|
1017
1066
|
class: "aform_error",
|
|
1018
1067
|
role: "alert"
|
|
1019
1068
|
}, toDisplayString(errorText.value), 9, _hoisted_3$14), [[vShow, errorText.value]])
|
|
1020
|
-
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createElementVNode("div", _hoisted_4$
|
|
1069
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createElementVNode("div", _hoisted_4$14, [createElementVNode("table", {
|
|
1021
1070
|
ref_key: "grid",
|
|
1022
1071
|
ref: grid,
|
|
1023
1072
|
role: "grid",
|
|
@@ -1099,7 +1148,7 @@ var ADatePicker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
|
|
|
1099
1148
|
var _hoisted_1$16 = { class: "adate_time" };
|
|
1100
1149
|
var _hoisted_2$15 = { class: "adate_time_fields" };
|
|
1101
1150
|
var _hoisted_3$13 = ["onKeydown"];
|
|
1102
|
-
var _hoisted_4$
|
|
1151
|
+
var _hoisted_4$13 = ["onKeydown"];
|
|
1103
1152
|
var _hoisted_5$12 = {
|
|
1104
1153
|
key: 0,
|
|
1105
1154
|
class: "colon"
|
|
@@ -1263,7 +1312,7 @@ var ADateTimeInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
1263
1312
|
_cache[5] || (_cache[5] = withKeys(withModifiers(($event) => tick("minutes"), ["prevent"]), ["up"])),
|
|
1264
1313
|
_cache[6] || (_cache[6] = withKeys(withModifiers(($event) => tick("minutes", -1), ["prevent"]), ["down"]))
|
|
1265
1314
|
]
|
|
1266
|
-
}, null, 40, _hoisted_4$
|
|
1315
|
+
}, null, 40, _hoisted_4$13), [[vModelText, timeData.minutes]]),
|
|
1267
1316
|
__props.useSeconds ? (openBlock(), createElementBlock("span", _hoisted_5$12, ":")) : createCommentVNode("", true),
|
|
1268
1317
|
__props.useSeconds ? withDirectives((openBlock(), createElementBlock("input", {
|
|
1269
1318
|
key: 1,
|
|
@@ -1487,7 +1536,7 @@ var _hoisted_3$12 = [
|
|
|
1487
1536
|
"aria-invalid",
|
|
1488
1537
|
"aria-describedby"
|
|
1489
1538
|
];
|
|
1490
|
-
var _hoisted_4$
|
|
1539
|
+
var _hoisted_4$12 = ["for"];
|
|
1491
1540
|
var _hoisted_5$11 = ["id"];
|
|
1492
1541
|
//#endregion
|
|
1493
1542
|
//#region src/components/form/ADate.vue
|
|
@@ -1549,7 +1598,7 @@ var ADate_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
1549
1598
|
createElementVNode("label", {
|
|
1550
1599
|
class: "aform_field-label",
|
|
1551
1600
|
for: __props.uuid
|
|
1552
|
-
}, toDisplayString(__props.label), 9, _hoisted_4$
|
|
1601
|
+
}, toDisplayString(__props.label), 9, _hoisted_4$12),
|
|
1553
1602
|
withDirectives(createElementVNode("p", {
|
|
1554
1603
|
id: unref(errorId),
|
|
1555
1604
|
class: "aform_error",
|
|
@@ -1583,7 +1632,7 @@ var _hoisted_2$12 = {
|
|
|
1583
1632
|
class: "aform_display-value"
|
|
1584
1633
|
};
|
|
1585
1634
|
var _hoisted_3$11 = { class: "aform_field-label" };
|
|
1586
|
-
var _hoisted_4$
|
|
1635
|
+
var _hoisted_4$11 = [
|
|
1587
1636
|
"id",
|
|
1588
1637
|
"disabled",
|
|
1589
1638
|
"aria-expanded",
|
|
@@ -1651,6 +1700,11 @@ var ADropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
|
|
|
1651
1700
|
loading: false,
|
|
1652
1701
|
results: []
|
|
1653
1702
|
});
|
|
1703
|
+
fitDropdownList(useTemplateRef("results"), {
|
|
1704
|
+
isOpen: () => dropdown.open,
|
|
1705
|
+
optionCount: () => dropdown.results.length,
|
|
1706
|
+
activeIndex: () => dropdown.activeItemIndex
|
|
1707
|
+
});
|
|
1654
1708
|
watch(choiceList, (choices) => {
|
|
1655
1709
|
dropdown.results = choices;
|
|
1656
1710
|
}, { immediate: true });
|
|
@@ -1743,9 +1797,10 @@ var ADropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
|
|
|
1743
1797
|
withKeys(onClickOutside, ["esc"]),
|
|
1744
1798
|
withKeys(onClickOutside, ["tab"])
|
|
1745
1799
|
]
|
|
1746
|
-
}, null, 44, _hoisted_4$
|
|
1800
|
+
}, null, 44, _hoisted_4$11), [[vModelText, search.value]]),
|
|
1747
1801
|
withDirectives(createElementVNode("ul", {
|
|
1748
1802
|
id: unref(listboxId),
|
|
1803
|
+
ref: "results",
|
|
1749
1804
|
class: "autocomplete-results",
|
|
1750
1805
|
role: "listbox",
|
|
1751
1806
|
"aria-label": __props.label
|
|
@@ -1770,7 +1825,7 @@ var ADropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
|
|
|
1770
1825
|
}, toDisplayString(errorText.value), 9, _hoisted_9$2), [[vShow, errorText.value]])], 64))]);
|
|
1771
1826
|
};
|
|
1772
1827
|
}
|
|
1773
|
-
}), [["__scopeId", "data-v-
|
|
1828
|
+
}), [["__scopeId", "data-v-f395a95f"]]);
|
|
1774
1829
|
//#endregion
|
|
1775
1830
|
//#region src/components/form/ABadge.vue
|
|
1776
1831
|
var ABadge_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
@@ -1836,7 +1891,7 @@ var _hoisted_3$10 = [
|
|
|
1836
1891
|
"aria-invalid",
|
|
1837
1892
|
"aria-describedby"
|
|
1838
1893
|
];
|
|
1839
|
-
var _hoisted_4$
|
|
1894
|
+
var _hoisted_4$10 = ["data-segment-value"];
|
|
1840
1895
|
var _hoisted_5$9 = [
|
|
1841
1896
|
"name",
|
|
1842
1897
|
"value",
|
|
@@ -1990,7 +2045,7 @@ var ASegmentedControl_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
|
|
|
1990
2045
|
name: groupName.value,
|
|
1991
2046
|
value: choice,
|
|
1992
2047
|
disabled: __props.mode === "read"
|
|
1993
|
-
}, null, 8, _hoisted_6$7)), [[vModelRadio, selected.value]]), createElementVNode("span", _hoisted_7$2, toDisplayString(segmentLabel(choice)), 1)], 14, _hoisted_4$
|
|
2048
|
+
}, null, 8, _hoisted_6$7)), [[vModelRadio, selected.value]]), createElementVNode("span", _hoisted_7$2, toDisplayString(segmentLabel(choice)), 1)], 14, _hoisted_4$10);
|
|
1994
2049
|
}), 128))], 8, _hoisted_3$10),
|
|
1995
2050
|
withDirectives(createElementVNode("p", {
|
|
1996
2051
|
id: unref(errorId),
|
|
@@ -2014,7 +2069,7 @@ var _hoisted_3$9 = [
|
|
|
2014
2069
|
"aria-invalid",
|
|
2015
2070
|
"aria-describedby"
|
|
2016
2071
|
];
|
|
2017
|
-
var _hoisted_4$
|
|
2072
|
+
var _hoisted_4$9 = ["for"];
|
|
2018
2073
|
var _hoisted_5$8 = ["id"];
|
|
2019
2074
|
//#endregion
|
|
2020
2075
|
//#region src/components/form/ADateTime.vue
|
|
@@ -2143,7 +2198,7 @@ var ADateTime_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
|
|
|
2143
2198
|
createElementVNode("label", {
|
|
2144
2199
|
class: "aform_field-label",
|
|
2145
2200
|
for: __props.uuid
|
|
2146
|
-
}, toDisplayString(__props.label), 9, _hoisted_4$
|
|
2201
|
+
}, toDisplayString(__props.label), 9, _hoisted_4$9),
|
|
2147
2202
|
withDirectives(createElementVNode("p", {
|
|
2148
2203
|
id: unref(errorId),
|
|
2149
2204
|
class: "aform_error",
|
|
@@ -2188,7 +2243,7 @@ var ADateTime_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
|
|
|
2188
2243
|
var _hoisted_1$10 = { class: "aduration" };
|
|
2189
2244
|
var _hoisted_2$9 = { class: "aform_display-value" };
|
|
2190
2245
|
var _hoisted_3$8 = { class: "aduration__footer" };
|
|
2191
|
-
var _hoisted_4$
|
|
2246
|
+
var _hoisted_4$8 = {
|
|
2192
2247
|
key: 0,
|
|
2193
2248
|
class: "aduration__summary"
|
|
2194
2249
|
};
|
|
@@ -2262,7 +2317,7 @@ var ADuration_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
|
|
|
2262
2317
|
"allow-military-time": __props.allowMilitaryTime,
|
|
2263
2318
|
"use-seconds": __props.useSeconds,
|
|
2264
2319
|
onGetRange: handleRange
|
|
2265
|
-
}, null, 8, ["allow-military-time", "use-seconds"]), createElementVNode("div", _hoisted_3$8, [createElementVNode("label", null, toDisplayString(__props.label), 1), startDatetime.value && endDatetime.value ? (openBlock(), createElementBlock("div", _hoisted_4$
|
|
2320
|
+
}, null, 8, ["allow-military-time", "use-seconds"]), createElementVNode("div", _hoisted_3$8, [createElementVNode("label", null, toDisplayString(__props.label), 1), startDatetime.value && endDatetime.value ? (openBlock(), createElementBlock("div", _hoisted_4$8, [
|
|
2266
2321
|
_cache[0] || (_cache[0] = createElementVNode("span", { class: "aduration__label" }, "Duration:", -1)),
|
|
2267
2322
|
createElementVNode("span", _hoisted_5$7, toDisplayString(humanDuration.value), 1),
|
|
2268
2323
|
createElementVNode("span", _hoisted_6$6, "(" + toDisplayString(modelValue.value) + ")", 1)
|
|
@@ -2283,7 +2338,7 @@ var _hoisted_3$7 = [
|
|
|
2283
2338
|
"aria-invalid",
|
|
2284
2339
|
"aria-describedby"
|
|
2285
2340
|
];
|
|
2286
|
-
var _hoisted_4$
|
|
2341
|
+
var _hoisted_4$7 = ["for"];
|
|
2287
2342
|
var _hoisted_5$6 = ["id"];
|
|
2288
2343
|
//#endregion
|
|
2289
2344
|
//#region src/components/form/ADateRange.vue
|
|
@@ -2386,7 +2441,7 @@ var ADateRange_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
2386
2441
|
createElementVNode("label", {
|
|
2387
2442
|
class: "aform_field-label",
|
|
2388
2443
|
for: __props.uuid
|
|
2389
|
-
}, toDisplayString(__props.label), 9, _hoisted_4$
|
|
2444
|
+
}, toDisplayString(__props.label), 9, _hoisted_4$7),
|
|
2390
2445
|
withDirectives(createElementVNode("p", {
|
|
2391
2446
|
id: unref(errorId),
|
|
2392
2447
|
class: "aform_error",
|
|
@@ -2418,6 +2473,10 @@ var _hoisted_3$6 = {
|
|
|
2418
2473
|
key: 0,
|
|
2419
2474
|
class: "aform-nested-label"
|
|
2420
2475
|
};
|
|
2476
|
+
var _hoisted_4$6 = {
|
|
2477
|
+
key: 1,
|
|
2478
|
+
class: "aform-nested-section"
|
|
2479
|
+
};
|
|
2421
2480
|
//#endregion
|
|
2422
2481
|
//#region src/components/AForm.vue
|
|
2423
2482
|
var AForm_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
@@ -2434,12 +2493,14 @@ var AForm_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
2434
2493
|
setup(__props, { emit: __emit }) {
|
|
2435
2494
|
const emit = __emit;
|
|
2436
2495
|
const dataModel = useModel(__props, "data");
|
|
2437
|
-
const
|
|
2496
|
+
const hasChildSchema = (componentObj) => "schema" in componentObj && Array.isArray(componentObj.schema) && componentObj.schema.length > 0;
|
|
2497
|
+
const isLinkSection = (componentObj) => componentObj.kind === "link" && hasChildSchema(componentObj);
|
|
2498
|
+
const isFieldsetSection = (componentObj) => componentObj.kind === "fieldset" && hasChildSchema(componentObj);
|
|
2438
2499
|
const nestedData = ref({});
|
|
2439
2500
|
watch(() => dataModel.value, (newData) => {
|
|
2440
2501
|
if (!__props.schema || !newData) return;
|
|
2441
2502
|
__props.schema.forEach((field) => {
|
|
2442
|
-
if (
|
|
2503
|
+
if (isLinkSection(field)) nestedData.value[field.fieldname] = newData[field.fieldname] ?? {};
|
|
2443
2504
|
});
|
|
2444
2505
|
}, { immediate: true });
|
|
2445
2506
|
const updateNestedData = (fieldname, val) => {
|
|
@@ -2449,22 +2510,31 @@ var AForm_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
2449
2510
|
emit("update:data", { ...dataModel.value });
|
|
2450
2511
|
}
|
|
2451
2512
|
};
|
|
2513
|
+
const updateFieldsetData = (val) => {
|
|
2514
|
+
if (dataModel.value) {
|
|
2515
|
+
Object.assign(dataModel.value, val);
|
|
2516
|
+
emit("update:data", { ...dataModel.value });
|
|
2517
|
+
}
|
|
2518
|
+
};
|
|
2452
2519
|
const isListExpansionTable = (componentObj) => componentObj.kind === "table" && componentObj.config?.view === "list-expansion";
|
|
2453
2520
|
const tableExpansionSchema = (table) => table.schema.filter((col) => Boolean(col.component)).map(({ fieldname, component, ...rest }) => Object.assign(rest, {
|
|
2454
2521
|
kind: "field",
|
|
2455
2522
|
fieldname,
|
|
2456
2523
|
component
|
|
2457
2524
|
}));
|
|
2525
|
+
const updateTableRows = (fieldname, rows) => {
|
|
2526
|
+
if (dataModel.value) {
|
|
2527
|
+
dataModel.value[fieldname] = rows;
|
|
2528
|
+
emit("update:data", { ...dataModel.value });
|
|
2529
|
+
}
|
|
2530
|
+
};
|
|
2458
2531
|
const updateTableRow = (fieldname, rowIndex, val) => {
|
|
2459
2532
|
const rows = Array.isArray(dataModel.value?.[fieldname]) ? [...dataModel.value[fieldname]] : [];
|
|
2460
2533
|
rows[rowIndex] = {
|
|
2461
2534
|
...rows[rowIndex],
|
|
2462
2535
|
...val
|
|
2463
2536
|
};
|
|
2464
|
-
|
|
2465
|
-
dataModel.value[fieldname] = rows;
|
|
2466
|
-
emit("update:data", { ...dataModel.value });
|
|
2467
|
-
}
|
|
2537
|
+
updateTableRows(fieldname, rows);
|
|
2468
2538
|
};
|
|
2469
2539
|
const componentProps = (componentObj) => {
|
|
2470
2540
|
const propsToPass = {};
|
|
@@ -2478,7 +2548,10 @@ var AForm_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
2478
2548
|
"width",
|
|
2479
2549
|
"height"
|
|
2480
2550
|
].includes(key)) propsToPass[key] = value;
|
|
2481
|
-
if (componentObj.kind === "table")
|
|
2551
|
+
if (componentObj.kind === "table") {
|
|
2552
|
+
propsToPass["rows"] = dataModel.value[componentObj.fieldname] || [];
|
|
2553
|
+
propsToPass["onUpdate:rows"] = (rows) => updateTableRows(componentObj.fieldname, rows);
|
|
2554
|
+
}
|
|
2482
2555
|
return propsToPass;
|
|
2483
2556
|
};
|
|
2484
2557
|
const fieldStyle = (componentObj) => {
|
|
@@ -2525,12 +2598,11 @@ var AForm_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
2525
2598
|
return (_ctx, _cache) => {
|
|
2526
2599
|
const _component_AForm = resolveComponent("AForm", true);
|
|
2527
2600
|
return openBlock(), createElementBlock("form", _hoisted_1$8, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.schema, (componentObj, key) => {
|
|
2528
|
-
return openBlock(), createElementBlock(Fragment, { key }, [
|
|
2601
|
+
return openBlock(), createElementBlock(Fragment, { key }, [isLinkSection(componentObj) ? (openBlock(), createElementBlock("div", _hoisted_2$7, [componentObj.label ? (openBlock(), createElementBlock("h4", _hoisted_3$6, toDisplayString(componentObj.label), 1)) : createCommentVNode("", true), (openBlock(), createBlock(resolveDynamicComponent(componentObj.component ?? "AForm"), {
|
|
2529
2602
|
data: nestedData.value[componentObj.fieldname],
|
|
2530
2603
|
mode: resolvedMode(componentObj),
|
|
2531
2604
|
schema: componentObj.schema,
|
|
2532
2605
|
label: componentObj.label,
|
|
2533
|
-
collapsible: componentObj.kind === "fieldset" ? componentObj.collapsible : void 0,
|
|
2534
2606
|
errors: __props.errors,
|
|
2535
2607
|
"onUpdate:data": (val) => updateNestedData(componentObj.fieldname, val)
|
|
2536
2608
|
}, null, 40, [
|
|
@@ -2538,11 +2610,25 @@ var AForm_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
2538
2610
|
"mode",
|
|
2539
2611
|
"schema",
|
|
2540
2612
|
"label",
|
|
2541
|
-
"collapsible",
|
|
2542
2613
|
"errors",
|
|
2543
2614
|
"onUpdate:data"
|
|
2615
|
+
]))])) : isFieldsetSection(componentObj) ? (openBlock(), createElementBlock("div", _hoisted_4$6, [(openBlock(), createBlock(resolveDynamicComponent(componentObj.component ?? "AFieldset"), {
|
|
2616
|
+
data: dataModel.value,
|
|
2617
|
+
mode: resolvedMode(componentObj),
|
|
2618
|
+
schema: componentObj.schema,
|
|
2619
|
+
label: componentObj.label,
|
|
2620
|
+
collapsible: componentObj.collapsible,
|
|
2621
|
+
errors: __props.errors,
|
|
2622
|
+
"onUpdate:data": updateFieldsetData
|
|
2623
|
+
}, null, 40, [
|
|
2624
|
+
"data",
|
|
2625
|
+
"mode",
|
|
2626
|
+
"schema",
|
|
2627
|
+
"label",
|
|
2628
|
+
"collapsible",
|
|
2629
|
+
"errors"
|
|
2544
2630
|
]))])) : !componentObj.hidden ? (openBlock(), createBlock(resolveDynamicComponent(componentObj.component), mergeProps({
|
|
2545
|
-
key:
|
|
2631
|
+
key: 2,
|
|
2546
2632
|
modelValue: childModels.value[key].value,
|
|
2547
2633
|
"onUpdate:modelValue": ($event) => childModels.value[key].value = $event,
|
|
2548
2634
|
style: fieldStyle(componentObj),
|
|
@@ -2577,7 +2663,7 @@ var AForm_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
2577
2663
|
}), 128))]);
|
|
2578
2664
|
};
|
|
2579
2665
|
}
|
|
2580
|
-
}), [["__scopeId", "data-v-
|
|
2666
|
+
}), [["__scopeId", "data-v-5055dffc"]]);
|
|
2581
2667
|
//#endregion
|
|
2582
2668
|
//#region src/components/base/CollapseButton.vue
|
|
2583
2669
|
var CollapseButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
@@ -2593,17 +2679,21 @@ var CollapseButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
2593
2679
|
//#region src/components/form/AFieldset.vue
|
|
2594
2680
|
var AFieldset_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
2595
2681
|
__name: "AFieldset",
|
|
2596
|
-
props: {
|
|
2682
|
+
props: /*@__PURE__*/ mergeModels({
|
|
2597
2683
|
schema: {},
|
|
2598
2684
|
label: { default: () => void 0 },
|
|
2599
2685
|
collapsible: { type: Boolean },
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
},
|
|
2686
|
+
mode: { default: "edit" },
|
|
2687
|
+
errors: { default: () => void 0 }
|
|
2688
|
+
}, {
|
|
2689
|
+
"data": { default: () => ({}) },
|
|
2690
|
+
"dataModifiers": {}
|
|
2691
|
+
}),
|
|
2692
|
+
emits: ["update:data"],
|
|
2603
2693
|
setup(__props, { expose: __expose }) {
|
|
2694
|
+
/** The record the fieldset's fields belong to: a fieldset is layout, so they are its own keys. */
|
|
2695
|
+
const formData = useModel(__props, "data");
|
|
2604
2696
|
const collapsed = ref(false);
|
|
2605
|
-
const formData = ref(__props.data || []);
|
|
2606
|
-
const formSchema = ref(__props.schema);
|
|
2607
2697
|
const toggleCollapse = (event) => {
|
|
2608
2698
|
event.preventDefault();
|
|
2609
2699
|
if (__props.collapsible) collapsed.value = !collapsed.value;
|
|
@@ -2620,16 +2710,18 @@ var AFieldset_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
|
|
|
2620
2710
|
}, null, 8, ["collapsed"])) : createCommentVNode("", true)], 32)) : createCommentVNode("", true), renderSlot(_ctx.$slots, "default", { collapsed: collapsed.value }, () => [withDirectives(createVNode(AForm_default, {
|
|
2621
2711
|
data: formData.value,
|
|
2622
2712
|
"onUpdate:data": _cache[0] || (_cache[0] = ($event) => formData.value = $event),
|
|
2623
|
-
schema:
|
|
2624
|
-
mode: __props.mode
|
|
2713
|
+
schema: __props.schema,
|
|
2714
|
+
mode: __props.mode,
|
|
2715
|
+
errors: __props.errors
|
|
2625
2716
|
}, null, 8, [
|
|
2626
2717
|
"data",
|
|
2627
2718
|
"schema",
|
|
2628
|
-
"mode"
|
|
2719
|
+
"mode",
|
|
2720
|
+
"errors"
|
|
2629
2721
|
]), [[vShow, !collapsed.value]])], true)]);
|
|
2630
2722
|
};
|
|
2631
2723
|
}
|
|
2632
|
-
}), [["__scopeId", "data-v-
|
|
2724
|
+
}), [["__scopeId", "data-v-8215ff87"]]);
|
|
2633
2725
|
//#endregion
|
|
2634
2726
|
//#region src/components/form/AFileAttach.vue?vue&type=script&setup=true&lang.ts
|
|
2635
2727
|
var _hoisted_1$7 = { class: "aform_form-element aform_file-attach aform__grid--full" };
|
|
@@ -2892,6 +2984,11 @@ var AQuantityInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
2892
2984
|
open: false,
|
|
2893
2985
|
activeIndex: -1
|
|
2894
2986
|
});
|
|
2987
|
+
fitDropdownList(useTemplateRef("uomMenu"), {
|
|
2988
|
+
isOpen: () => dropdown.open,
|
|
2989
|
+
optionCount: () => uoms.value.length,
|
|
2990
|
+
activeIndex: () => dropdown.activeIndex
|
|
2991
|
+
});
|
|
2895
2992
|
const openDropdown = () => {
|
|
2896
2993
|
dropdown.activeIndex = Math.max(uoms.value.indexOf(uom.value), 0);
|
|
2897
2994
|
dropdown.open = true;
|
|
@@ -2973,6 +3070,7 @@ var AQuantityInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
2973
3070
|
class: "aquantity__caret",
|
|
2974
3071
|
"aria-hidden": "true"
|
|
2975
3072
|
}, null, -1))], 40, _hoisted_9$1), withDirectives(createElementVNode("ul", {
|
|
3073
|
+
ref: "uomMenu",
|
|
2976
3074
|
class: "aquantity__uom-menu",
|
|
2977
3075
|
role: "listbox",
|
|
2978
3076
|
"aria-label": __props.uomLabel
|
|
@@ -3020,7 +3118,7 @@ var AQuantityInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
3020
3118
|
], 64))]);
|
|
3021
3119
|
};
|
|
3022
3120
|
}
|
|
3023
|
-
}), [["__scopeId", "data-v-
|
|
3121
|
+
}), [["__scopeId", "data-v-05d1da97"]]);
|
|
3024
3122
|
//#endregion
|
|
3025
3123
|
//#region src/directives/mask.ts
|
|
3026
3124
|
/**
|