@stonecrop/aform 0.43.0 → 0.45.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.
Files changed (38) hide show
  1. package/dist/aform.js +1712 -829
  2. package/dist/aform.js.map +1 -1
  3. package/dist/assets/index.css +396 -258
  4. package/dist/src/components/AForm.vue.d.ts.map +1 -1
  5. package/dist/src/components/form/ACurrencyInput.vue.d.ts +0 -3
  6. package/dist/src/components/form/ACurrencyInput.vue.d.ts.map +1 -1
  7. package/dist/src/components/form/ADropdown.vue.d.ts +36 -2
  8. package/dist/src/components/form/ADropdown.vue.d.ts.map +1 -1
  9. package/dist/src/components/form/ADropdownList.vue.d.ts +26 -0
  10. package/dist/src/components/form/ADropdownList.vue.d.ts.map +1 -0
  11. package/dist/src/components/form/AFormLink.vue.d.ts +2 -2
  12. package/dist/src/components/form/AFormLink.vue.d.ts.map +1 -1
  13. package/dist/src/components/form/AQuantityInput.vue.d.ts +0 -3
  14. package/dist/src/components/form/AQuantityInput.vue.d.ts.map +1 -1
  15. package/dist/src/components/table/ATableTupleCurrencyPicker.vue.d.ts +8 -0
  16. package/dist/src/components/table/ATableTupleCurrencyPicker.vue.d.ts.map +1 -0
  17. package/dist/src/components/table/ATableTupleQuantityPicker.vue.d.ts +8 -0
  18. package/dist/src/components/table/ATableTupleQuantityPicker.vue.d.ts.map +1 -0
  19. package/dist/src/components/table/ATupleCellEditor.vue.d.ts +22 -0
  20. package/dist/src/components/table/ATupleCellEditor.vue.d.ts.map +1 -0
  21. package/dist/src/components/table/ATupleCellShell.vue.d.ts +24 -0
  22. package/dist/src/components/table/ATupleCellShell.vue.d.ts.map +1 -0
  23. package/dist/src/composables/dropdownList.d.ts.map +1 -1
  24. package/dist/src/composables/fieldErrorA11y.d.ts +1 -1
  25. package/dist/src/composables/fieldErrorA11y.d.ts.map +1 -1
  26. package/dist/src/composables/useTableModalDropdownList.d.ts +18 -0
  27. package/dist/src/composables/useTableModalDropdownList.d.ts.map +1 -0
  28. package/dist/src/index.d.ts +5 -1
  29. package/dist/src/index.d.ts.map +1 -1
  30. package/dist/src/types/index.d.ts +6 -0
  31. package/dist/src/types/index.d.ts.map +1 -1
  32. package/dist/src/utils/currencyValue.d.ts +10 -0
  33. package/dist/src/utils/currencyValue.d.ts.map +1 -0
  34. package/dist/src/utils/linkValue.d.ts +5 -0
  35. package/dist/src/utils/linkValue.d.ts.map +1 -0
  36. package/dist/src/utils/quantityValue.d.ts +8 -0
  37. package/dist/src/utils/quantityValue.d.ts.map +1 -0
  38. package/package.json +5 -5
package/dist/aform.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { hasBadgeOptions, isBadgeDescriptor, lookupBadge, selectChoices } from "@stonecrop/schema";
2
- import { install as install$1 } from "@stonecrop/atable";
2
+ import { TABLE_TUPLE_CURRENCY_PICKER, TABLE_TUPLE_QUANTITY_PICKER, install as install$1, isTableTuplePickerModal } from "@stonecrop/atable";
3
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
+ import { currencyAmountEntryPattern, currencyInputFractionDigits, formatCurrencyAmount, formatCurrencyAmountInput, fromISODate, isSemver, isSemverPrefix, parseCurrencyAmountInput } from "@stonecrop/utilities";
4
5
  import { vOnClickOutside } from "@vueuse/components";
5
- import { fromISODate, isSemver, isSemverPrefix } from "@stonecrop/utilities";
6
6
  import { Temporal } from "temporal-polyfill";
7
- import { onClickOutside, useFileDialog } from "@vueuse/core";
7
+ import { onClickOutside, useElementBounding, useFileDialog } from "@vueuse/core";
8
8
  import './assets/index.css';//#region src/utils/deserialize.ts
9
9
  /**
10
10
  * Deserializes a stringified function expression into a typed callable.
@@ -118,20 +118,23 @@ function resolvedFieldsToColumns(fields) {
118
118
  }
119
119
  //#endregion
120
120
  //#region src/composables/fieldErrorA11y.ts
121
- function fieldErrorA11y(uuid, errorText) {
121
+ function fieldErrorA11y(uuid, errorText, extraDescribedBy) {
122
122
  const errorId = computed(() => uuid ? `${uuid}-error` : void 0);
123
123
  const hasError = computed(() => Boolean(errorText.value));
124
124
  return {
125
125
  errorId,
126
126
  hasError,
127
- describedBy: computed(() => hasError.value && errorId.value ? errorId.value : void 0),
127
+ describedBy: computed(() => {
128
+ if (hasError.value && errorId.value) return errorId.value;
129
+ return extraDescribedBy?.value;
130
+ }),
128
131
  invalid: computed(() => hasError.value ? true : void 0)
129
132
  };
130
133
  }
131
134
  //#endregion
132
135
  //#region src/components/form/ACheckbox.vue?vue&type=script&setup=true&lang.ts
133
- var _hoisted_1$21 = { class: "aform_form-element" };
134
- var _hoisted_2$20 = { class: "aform_field-label" };
136
+ var _hoisted_1$26 = { class: "aform_form-element" };
137
+ var _hoisted_2$21 = { class: "aform_field-label" };
135
138
  var _hoisted_3$18 = { class: "aform_display-value" };
136
139
  var _hoisted_4$18 = ["for"];
137
140
  var _hoisted_5$17 = { class: "aform_checkbox-container aform_input-field" };
@@ -170,7 +173,7 @@ var ACheckbox_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
170
173
  const { errorId, describedBy, invalid } = fieldErrorA11y(__props.uuid, errorText);
171
174
  const checkbox = useModel(__props, "modelValue");
172
175
  return (_ctx, _cache) => {
173
- return openBlock(), createElementBlock("div", _hoisted_1$21, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("label", _hoisted_2$20, toDisplayString(__props.label), 1), createElementVNode("span", _hoisted_3$18, toDisplayString(checkbox.value ? "✓" : "✗"), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
176
+ return openBlock(), createElementBlock("div", _hoisted_1$26, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("label", _hoisted_2$21, toDisplayString(__props.label), 1), createElementVNode("span", _hoisted_3$18, toDisplayString(checkbox.value ? "✓" : "✗"), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
174
177
  createElementVNode("label", {
175
178
  class: "aform_field-label",
176
179
  for: __props.uuid
@@ -205,6 +208,66 @@ var _plugin_vue_export_helper_default = (sfc, props) => {
205
208
  //#region src/components/form/ACheckbox.vue
206
209
  var ACheckbox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(ACheckbox_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-f28e7db6"]]);
207
210
  //#endregion
211
+ //#region src/utils/currencyValue.ts
212
+ var FLOAT_NOISE_DECIMALS = 6;
213
+ function normalizeBaseCurrency(options, current) {
214
+ const base = options.baseCurrency ?? current?.baseCurrency;
215
+ if (!base) return { id: "" };
216
+ return typeof base === "string" ? { id: base } : base;
217
+ }
218
+ function baseAmountDecimals(options) {
219
+ const { precision } = options;
220
+ if (precision === void 0) return FLOAT_NOISE_DECIMALS;
221
+ return Number.isInteger(precision) && precision >= 0 && precision <= 100 ? precision : FLOAT_NOISE_DECIMALS;
222
+ }
223
+ function resolveCurrencyExchangeRate(currencyId, options, baseCurrency, current) {
224
+ const baseId = baseCurrency.id;
225
+ if (!currencyId || String(currencyId) === String(baseId)) return 1;
226
+ if (String(currencyId) === String(current?.currency?.id)) return current?.exchangeRate ?? options.exchangeRates?.[String(currencyId)] ?? 1;
227
+ return options.exchangeRates?.[String(currencyId)] ?? 1;
228
+ }
229
+ var roundAmount = (value, decimals) => Number(value.toFixed(decimals));
230
+ function recomputeCurrencyValue(amount, currencyValue, options, baseCurrency, current) {
231
+ const exchangeRate = resolveCurrencyExchangeRate(currencyValue.id, options, baseCurrency, current);
232
+ const decimals = baseAmountDecimals(options);
233
+ return {
234
+ amount,
235
+ currency: currencyValue,
236
+ exchangeRate,
237
+ baseCurrency,
238
+ baseAmount: amount === null ? null : roundAmount(amount * exchangeRate, decimals)
239
+ };
240
+ }
241
+ function patchCurrencyAmount(current, amount, options, baseCurrency) {
242
+ return recomputeCurrencyValue(amount, current?.currency ?? { id: "" }, options, baseCurrency, current);
243
+ }
244
+ function patchCurrencyCurrency(current, currencyValue, options, baseCurrency) {
245
+ return recomputeCurrencyValue(current?.amount ?? null, currencyValue, options, baseCurrency, current);
246
+ }
247
+ /** Static currency choices when no async filterFunction is configured (base + exchangeRates keys). */
248
+ function staticCurrencyChoices(options, current) {
249
+ const base = normalizeBaseCurrency(options, current);
250
+ const seen = /* @__PURE__ */ new Set();
251
+ const choices = [];
252
+ if (base.id) {
253
+ choices.push(base);
254
+ seen.add(String(base.id));
255
+ }
256
+ const currentCur = current?.currency;
257
+ if (currentCur?.id && !seen.has(String(currentCur.id))) {
258
+ choices.push(currentCur);
259
+ seen.add(String(currentCur.id));
260
+ }
261
+ for (const id of Object.keys(options.exchangeRates ?? {})) if (!seen.has(id)) {
262
+ choices.push({
263
+ id,
264
+ displayText: id
265
+ });
266
+ seen.add(id);
267
+ }
268
+ return choices;
269
+ }
270
+ //#endregion
208
271
  //#region src/utils/emptiedBox.ts
209
272
  /**
210
273
  * A date box's day as `v-model` hands it back, or null once any part of the box is empty, which the
@@ -221,6 +284,27 @@ function numberFromBox(value) {
221
284
  return value === "" ? null : value;
222
285
  }
223
286
  //#endregion
287
+ //#region src/utils/linkValue.ts
288
+ function linkId(value) {
289
+ if (value == null) return void 0;
290
+ if (typeof value === "string") return value === "" ? void 0 : value;
291
+ if (typeof value === "number") return String(value);
292
+ const id = value.id;
293
+ if (id === null || id === void 0 || id === "") return void 0;
294
+ return String(id);
295
+ }
296
+ function linkDisplayText(value) {
297
+ if (value == null || typeof value !== "object") return void 0;
298
+ const text = value.displayText;
299
+ if (typeof text === "string") return text;
300
+ if (typeof text === "number") return String(text);
301
+ }
302
+ function asLinkValue(value) {
303
+ if (value != null && typeof value === "object") return value;
304
+ const id = linkId(value);
305
+ return id !== void 0 ? { id } : { id: "" };
306
+ }
307
+ //#endregion
224
308
  //#region src/composables/dropdownList.ts
225
309
  var WINDOW_MARGIN = 8;
226
310
  var MIN_ROWS = 4;
@@ -251,67 +335,118 @@ function fitDropdownList(list, state) {
251
335
  window.removeEventListener("scroll", fit, { capture: true });
252
336
  window.removeEventListener("resize", fit);
253
337
  };
254
- watch(state.isOpen, (open) => {
338
+ watch(() => state.isOpen(), (open) => {
255
339
  if (open) return listen();
256
340
  stopListening();
257
341
  if (list.value) list.value.style.maxHeight = "";
258
342
  });
259
343
  watch(() => state.isOpen() && state.optionCount(), () => void nextTick(() => fit()));
260
- watch(state.activeIndex, (index) => {
344
+ watch(() => state.activeIndex(), (index) => {
261
345
  if (index === null || index < 0) return;
262
346
  nextTick(() => list.value?.querySelectorAll("[role=\"option\"]")[index]?.scrollIntoView?.({ block: "nearest" }));
263
347
  }, { flush: "post" });
264
348
  onBeforeUnmount(stopListening);
265
349
  }
266
350
  //#endregion
267
- //#region src/components/form/AFormLink.vue?vue&type=script&setup=true&lang.ts
268
- var _hoisted_1$20 = { class: "aform_display-value" };
269
- var _hoisted_2$19 = {
270
- key: 0,
351
+ //#region src/components/form/ADropdownList.vue?vue&type=script&setup=true&lang.ts
352
+ var _hoisted_1$25 = ["id", "aria-label"];
353
+ //#endregion
354
+ //#region src/components/form/ADropdownList.vue
355
+ var ADropdownList_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
356
+ __name: "ADropdownList",
357
+ props: {
358
+ listboxId: {},
359
+ ariaLabel: {},
360
+ open: { type: Boolean },
361
+ listAnchor: { default: "field" },
362
+ surface: { default: "field" },
363
+ optionCount: { type: Function },
364
+ activeIndex: { type: Function }
365
+ },
366
+ setup(__props, { expose: __expose }) {
367
+ const root = useTemplateRef("root");
368
+ fitDropdownList(root, {
369
+ isOpen: () => __props.open,
370
+ optionCount: __props.optionCount,
371
+ activeIndex: __props.activeIndex
372
+ });
373
+ __expose({ root });
374
+ return (_ctx, _cache) => {
375
+ return withDirectives((openBlock(), createElementBlock("ul", {
376
+ id: __props.listboxId,
377
+ ref_key: "root",
378
+ ref: root,
379
+ class: normalizeClass(["autocomplete-results", {
380
+ "autocomplete-results--anchor-group": __props.listAnchor === "group",
381
+ "autocomplete-results--cell-modal": __props.surface === "cell-modal"
382
+ }]),
383
+ role: "listbox",
384
+ "aria-label": __props.ariaLabel
385
+ }, [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 10, _hoisted_1$25)), [[vShow, __props.open]]);
386
+ };
387
+ }
388
+ }), [["__scopeId", "data-v-6939f0bf"]]);
389
+ //#endregion
390
+ //#region src/components/form/ADropdown.vue?vue&type=script&setup=true&lang.ts
391
+ var _hoisted_1$24 = {
392
+ key: 1,
393
+ class: "aform_display-value"
394
+ };
395
+ var _hoisted_2$20 = {
396
+ key: 2,
397
+ class: "aform_display-value"
398
+ };
399
+ var _hoisted_3$17 = {
400
+ key: 3,
271
401
  class: "aform_field-label"
272
402
  };
273
- var _hoisted_3$17 = { class: "aform_form-link-wrapper" };
274
- var _hoisted_4$17 = { class: "input-group" };
275
- var _hoisted_5$16 = [
403
+ var _hoisted_4$17 = [
404
+ "id",
405
+ "disabled",
406
+ "required",
407
+ "aria-label",
408
+ "aria-expanded",
409
+ "aria-controls",
410
+ "aria-activedescendant",
411
+ "onKeydown"
412
+ ];
413
+ var _hoisted_5$16 = { class: "aform_dropdown-button-value" };
414
+ var _hoisted_6$13 = [
415
+ "id",
416
+ "disabled",
417
+ "required",
276
418
  "placeholder",
277
419
  "size",
278
420
  "aria-label",
279
- "required",
280
421
  "aria-expanded",
281
422
  "aria-controls",
282
423
  "aria-activedescendant",
283
- "disabled",
424
+ "aria-invalid",
425
+ "aria-describedby",
284
426
  "onKeydown"
285
427
  ];
286
- var _hoisted_6$13 = ["onKeydown"];
287
- var _hoisted_7$6 = ["data-icon"];
288
- var _hoisted_8$6 = {
289
- key: 0,
290
- d: "M6 3.5 10.5 8 6 12.5"
291
- };
292
- var _hoisted_9$5 = {
293
- key: 1,
294
- d: "M2.5 8h11M9 3.5 13.5 8 9 12.5"
295
- };
296
- var _hoisted_10$4 = { class: "aform_form-btn-name" };
297
- var _hoisted_11$4 = ["aria-label"];
298
- var _hoisted_12$4 = {
428
+ var _hoisted_7$6 = {
299
429
  key: 0,
300
- class: "autocomplete-result loading"
430
+ class: "loading autocomplete-result"
301
431
  };
302
- var _hoisted_13$3 = [
432
+ var _hoisted_8$6 = [
303
433
  "id",
304
434
  "aria-selected",
305
- "onMousedown"
435
+ "onMousedown",
436
+ "onMouseenter"
306
437
  ];
307
- var _hoisted_14$3 = {
308
- key: 0,
309
- class: "aform_field-label"
310
- };
438
+ var _hoisted_9$5 = [
439
+ "id",
440
+ "aria-selected",
441
+ "onMousedown",
442
+ "onMouseenter"
443
+ ];
444
+ var _hoisted_10$5 = ["for"];
445
+ var _hoisted_11$5 = ["id"];
311
446
  //#endregion
312
- //#region src/components/form/AFormLink.vue
313
- var AFormLink_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
314
- __name: "AFormLink",
447
+ //#region src/components/form/ADropdown.vue
448
+ var ADropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
449
+ __name: "ADropdown",
315
450
  props: /*@__PURE__*/ mergeModels({
316
451
  schema: {},
317
452
  label: {},
@@ -320,222 +455,414 @@ var AFormLink_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
320
455
  required: { type: Boolean },
321
456
  mode: {},
322
457
  uuid: {},
323
- validation: {},
458
+ validation: { default: () => ({ errorMessage: "" }) },
324
459
  errors: {},
325
- doctype: { default: () => void 0 },
326
- formatter: {
460
+ options: { default: () => [] },
461
+ format: {},
462
+ isAsync: {
463
+ type: Boolean,
464
+ default: false
465
+ },
466
+ filterFunction: {
327
467
  type: Function,
328
468
  default: void 0
329
469
  },
330
- icon: { default: "arrow-right" },
331
- disabled: {
470
+ link: {
332
471
  type: Boolean,
333
472
  default: false
334
473
  },
335
- filterFunction: {
474
+ linkFilterFunction: {
336
475
  type: [String, Function],
337
476
  default: void 0
338
477
  },
339
- isAsync: {
340
- type: Boolean,
341
- default: false
478
+ formatter: {
479
+ type: Function,
480
+ default: void 0
342
481
  },
482
+ doctype: { default: () => void 0 },
343
483
  embedded: {
344
484
  type: Boolean,
345
485
  default: false
346
486
  },
487
+ trigger: { default: "combobox" },
488
+ listAnchor: { default: "field" },
347
489
  placeholder: { default: () => void 0 },
348
490
  ariaLabel: { default: () => void 0 }
349
491
  }, {
350
- "modelValue": { default: () => ({
351
- id: "",
352
- displayText: ""
353
- }) },
354
- "modelModifiers": {}
492
+ "modelValue": {},
493
+ "modelModifiers": {},
494
+ "linkValue": {},
495
+ "linkValueModifiers": {}
355
496
  }),
356
- emits: ["update:modelValue"],
357
- setup(__props) {
358
- const listboxId = `${__props.uuid ?? `aform-link-${useId()}`}-listbox`;
497
+ emits: /*@__PURE__*/ mergeModels(["update:open"], ["update:modelValue", "update:linkValue"]),
498
+ setup(__props, { expose: __expose, emit: __emit }) {
499
+ const emit = __emit;
500
+ const linkPicker = computed(() => __props.link);
501
+ const listboxId = `${__props.uuid ?? `aform-dropdown-${useId()}`}-listbox`;
502
+ const choiceList = computed(() => selectChoices(__props.options));
503
+ const formatFn = computed(() => __props.format ? deserializeFunction(__props.format) : void 0);
504
+ const badgeDescriptor = computed(() => linkPicker.value ? null : resolveFieldBadge(search.value, __props.options, formatFn.value));
505
+ const inputAccentStyle = computed(() => badgeInputAccentStyle(badgeDescriptor.value ?? void 0));
506
+ const displayAccentStyle = computed(() => badgeInputAccentStyle(badgeDescriptor.value ?? void 0));
507
+ const errorText = computed(() => __props.errors?.length ? __props.errors.join("; ") : __props.validation.errorMessage ?? "");
508
+ const { errorId, describedBy, invalid } = fieldErrorA11y(__props.uuid, errorText);
359
509
  const modelValue = useModel(__props, "modelValue");
360
- const hasValidId = computed(() => linkId(modelValue.value) !== void 0);
361
- const displayedText = computed(() => {
362
- const id = linkId(modelValue.value);
363
- if (id === void 0) return "—";
364
- if (__props.formatter) return __props.formatter(asLinkValue(modelValue.value));
365
- return linkDisplayText(modelValue.value) ?? id;
366
- });
367
- const searchText = ref(hasValidId.value ? displayedText.value : "");
368
- const embeddedSize = computed(() => __props.embedded ? Math.max((searchText.value || __props.placeholder || "").length, 1) : void 0);
369
- const dropdownOpen = ref(false);
370
- const loading = ref(false);
371
- const dropdownResults = ref([]);
372
- const activeIndex = ref(null);
373
- fitDropdownList(useTemplateRef("results"), {
374
- isOpen: () => dropdownOpen.value,
375
- optionCount: () => dropdownResults.value.length,
376
- activeIndex: () => activeIndex.value
377
- });
378
- const navigator = inject("aformLinkNavigator", null);
510
+ const linkModel = useModel(__props, "linkValue");
379
511
  const resolver = inject("aformLinkResolver", null);
380
- function linkId(value) {
381
- if (value == null) return void 0;
382
- if (typeof value === "string") return value === "" ? void 0 : value;
383
- if (typeof value === "number") return String(value);
384
- const id = value.id;
385
- if (id === null || id === void 0 || id === "") return void 0;
386
- return String(id);
387
- }
388
- function linkDisplayText(value) {
389
- if (value == null || typeof value !== "object") return void 0;
390
- const text = value.displayText;
391
- return typeof text === "string" || typeof text === "number" ? String(text) : void 0;
392
- }
393
- function asLinkValue(value) {
394
- if (value != null && typeof value === "object") return value;
395
- const id = linkId(value);
396
- return id !== void 0 ? { id } : { id: "" };
397
- }
398
- watch(() => linkId(modelValue.value), async (id) => {
399
- if (id && linkDisplayText(modelValue.value)) {
400
- searchText.value = displayedText.value;
512
+ const dropdown = reactive({
513
+ activeItemIndex: null,
514
+ open: false,
515
+ loading: false,
516
+ results: []
517
+ });
518
+ watch(() => dropdown.open, (open) => emit("update:open", open));
519
+ const linkResults = ref([]);
520
+ const optionCount = () => linkPicker.value ? linkResults.value.length : dropdown.results.length;
521
+ const committedValue = ref(modelValue.value ?? "");
522
+ const linkText = (value) => {
523
+ const record = asLinkValue(value);
524
+ return __props.formatter ? __props.formatter(record) : linkDisplayText(record) ?? String(record.id);
525
+ };
526
+ const linkDisplayedText = computed(() => linkId(linkModel.value) === void 0 ? "—" : linkText(linkModel.value));
527
+ const search = ref("");
528
+ watch(modelValue, (value) => {
529
+ if (linkPicker.value) return;
530
+ const next = value ?? "";
531
+ search.value = next;
532
+ if (next === "" || choiceList.value.includes(next)) committedValue.value = next;
533
+ }, { immediate: true });
534
+ watch(() => linkModel.value, (value) => {
535
+ if (!linkPicker.value) return;
536
+ search.value = linkId(value) ? linkText(value) : "";
537
+ }, { immediate: true });
538
+ watch(() => linkPicker.value ? linkId(linkModel.value) : void 0, async (id) => {
539
+ if (!linkPicker.value || !id) return;
540
+ if (linkDisplayText(linkModel.value)) {
541
+ search.value = linkText(linkModel.value);
401
542
  return;
402
543
  }
403
- if (!id) return;
404
544
  try {
405
545
  let match;
406
546
  let displayText;
407
- if (__props.filterFunction) {
408
- match = (await (typeof __props.filterFunction === "string" ? deserializeFunction(__props.filterFunction) : __props.filterFunction)(String(id))).find((r) => String(r.id) === String(id));
547
+ if (__props.linkFilterFunction) {
548
+ match = (await (typeof __props.linkFilterFunction === "string" ? deserializeFunction(__props.linkFilterFunction) : __props.linkFilterFunction)(String(id))).find((r) => String(r.id) === String(id));
409
549
  displayText = match?.displayText;
410
- if (displayText === void 0) console.warn(`[AFormLink] filterFunction returned no matching result for id "${id}". The function must return an item whose \`id\` exactly matches the search string.`);
411
550
  } else if (resolver && __props.doctype) displayText = await resolver(__props.doctype, id.toString()) ?? void 0;
412
551
  if (displayText) {
413
552
  const resolved = {
414
- ...asLinkValue(modelValue.value),
553
+ ...asLinkValue(linkModel.value),
415
554
  ...match,
416
555
  id,
417
556
  displayText
418
557
  };
419
- searchText.value = __props.formatter ? __props.formatter(resolved) : displayText;
420
- modelValue.value = resolved;
558
+ search.value = linkText(resolved);
559
+ linkModel.value = resolved;
421
560
  }
422
561
  } catch {}
423
562
  }, { immediate: true });
424
- const handleNavigate = () => {
425
- const id = linkId(modelValue.value);
426
- if (navigator && __props.doctype && id !== void 0) navigator.navigate(__props.doctype, id);
427
- else if (navigator && !__props.doctype) console.warn("[AFormLink] Navigation requested but `doctype` prop is missing. Add `options` (or `doctype`) to the Link field definition to enable navigation.");
563
+ const onClickOutside = () => closeDropdown();
564
+ const isChoiceSelected = (result) => !!result && result === (modelValue.value ?? "");
565
+ const isLinkOptionSelected = (option) => {
566
+ const id = linkId(linkModel.value);
567
+ return id !== void 0 && String(option.id) === String(id);
428
568
  };
429
- const openDropdown = async (text) => {
430
- if (!__props.filterFunction || __props.mode === "read") return;
431
- activeIndex.value = null;
432
- dropdownOpen.value = true;
433
- if (__props.isAsync) loading.value = true;
569
+ const embeddedLinkDisplayText = computed(() => linkId(linkModel.value) ? linkText(linkModel.value) : __props.placeholder ?? "");
570
+ const embeddedLinkInputSize = computed(() => {
571
+ if (!__props.embedded || !linkPicker.value) return void 0;
572
+ const text = embeddedLinkDisplayText.value;
573
+ const length = text.length > 0 ? text.length : (__props.placeholder ?? "").length;
574
+ return length > 0 ? length : void 0;
575
+ });
576
+ const filterResults = () => {
577
+ if (!search.value) dropdown.results = choiceList.value;
578
+ else dropdown.results = choiceList.value.filter((item) => item.toLowerCase().includes(search.value.toLowerCase()));
579
+ };
580
+ const openLinkDropdown = async (text) => {
581
+ if (!__props.linkFilterFunction || __props.mode === "read") return;
582
+ dropdown.activeItemIndex = null;
583
+ dropdown.open = true;
584
+ if (__props.isAsync) dropdown.loading = true;
434
585
  try {
435
- const fn = typeof __props.filterFunction === "string" ? deserializeFunction(__props.filterFunction) : __props.filterFunction;
436
- dropdownResults.value = await fn(text) ?? [];
586
+ const fn = typeof __props.linkFilterFunction === "string" ? deserializeFunction(__props.linkFilterFunction) : __props.linkFilterFunction;
587
+ linkResults.value = await fn(text) ?? [];
437
588
  } catch {
438
- dropdownResults.value = [];
589
+ linkResults.value = [];
439
590
  } finally {
440
- loading.value = false;
591
+ dropdown.loading = false;
441
592
  }
442
593
  };
443
- const closeDropdown = () => {
444
- dropdownOpen.value = false;
445
- activeIndex.value = null;
446
- searchText.value = hasValidId.value ? displayedText.value : "";
594
+ const embeddedLinkFilterQuery = () => {
595
+ if (!__props.embedded || !linkPicker.value) return search.value;
596
+ if (linkId(linkModel.value) && __props.formatter) {
597
+ const formatted = __props.formatter(asLinkValue(linkModel.value));
598
+ if (search.value === formatted) return "";
599
+ }
600
+ return search.value;
447
601
  };
448
- const onClickOutside = () => {
449
- if (dropdownOpen.value) closeDropdown();
602
+ const openEmbeddedList = () => {
603
+ if (linkPicker.value && !dropdown.open) openLinkDropdown(embeddedLinkFilterQuery());
450
604
  };
451
- const onFocus = () => openDropdown(searchText.value);
452
- const onInput = () => openDropdown(searchText.value);
453
- const selectOption = (option) => {
454
- modelValue.value = option;
455
- searchText.value = __props.formatter ? __props.formatter(option) : option.displayText ?? String(option.id);
456
- dropdownOpen.value = false;
457
- activeIndex.value = null;
605
+ __expose({ openCurrencyList: openEmbeddedList });
606
+ const filter = async () => {
607
+ dropdown.open = true;
608
+ dropdown.activeItemIndex = null;
609
+ if (__props.filterFunction) {
610
+ if (__props.isAsync) dropdown.loading = true;
611
+ try {
612
+ const filteredResults = await __props.filterFunction(search.value || "");
613
+ dropdown.results = filteredResults || [];
614
+ } catch {
615
+ dropdown.results = [];
616
+ } finally {
617
+ if (__props.isAsync) dropdown.loading = false;
618
+ }
619
+ } else filterResults();
458
620
  };
459
- const selectNext = () => {
460
- const len = dropdownResults.value.length;
461
- if (!len) return;
462
- activeIndex.value = activeIndex.value === null ? 0 : (activeIndex.value + 1) % len;
621
+ const setChoiceResult = (result) => {
622
+ modelValue.value = result;
623
+ search.value = result;
624
+ committedValue.value = result;
625
+ closeDropdown(result);
463
626
  };
464
- const selectPrev = () => {
465
- if (!dropdownResults.value.length) return;
466
- if (activeIndex.value === null || activeIndex.value === 0) activeIndex.value = null;
467
- else activeIndex.value -= 1;
627
+ const selectLinkOption = (option) => {
628
+ linkModel.value = option;
629
+ search.value = linkText(option);
630
+ dropdown.open = false;
631
+ dropdown.activeItemIndex = null;
468
632
  };
469
- const selectCurrent = () => {
470
- if (activeIndex.value !== null && dropdownResults.value[activeIndex.value]) selectOption(dropdownResults.value[activeIndex.value]);
633
+ const openChoiceDropdown = () => {
634
+ const idx = choiceList.value.indexOf(search.value);
635
+ dropdown.activeItemIndex = __props.isAsync ? null : idx >= 0 ? idx : null;
636
+ dropdown.open = true;
637
+ dropdown.results = __props.isAsync ? [] : choiceList.value;
638
+ };
639
+ const closeDropdown = (result) => {
640
+ dropdown.activeItemIndex = null;
641
+ dropdown.open = false;
642
+ if (linkPicker.value) {
643
+ search.value = linkId(linkModel.value) ? linkText(linkModel.value) : "";
644
+ return;
645
+ }
646
+ const typed = result || search.value || "";
647
+ if (choiceList.value.includes(typed)) {
648
+ if (typed !== committedValue.value) {
649
+ modelValue.value = typed;
650
+ committedValue.value = typed;
651
+ }
652
+ } else {
653
+ search.value = committedValue.value;
654
+ modelValue.value = committedValue.value;
655
+ }
656
+ };
657
+ const toggleButtonDropdown = () => {
658
+ if (dropdown.open) closeDropdown();
659
+ else openChoiceDropdown();
660
+ };
661
+ const onComboboxInput = () => {
662
+ if (linkPicker.value) openLinkDropdown(__props.embedded ? embeddedLinkFilterQuery() : search.value);
663
+ else {
664
+ if (search.value === "") {
665
+ modelValue.value = "";
666
+ committedValue.value = "";
667
+ }
668
+ filter();
669
+ }
670
+ };
671
+ const onComboboxFocus = (event) => {
672
+ if (linkPicker.value && __props.embedded) {
673
+ openEmbeddedList();
674
+ const input = event.target;
675
+ if (input) requestAnimationFrame(() => input.select());
676
+ return;
677
+ }
678
+ if (linkPicker.value) openLinkDropdown(search.value);
679
+ else openChoiceDropdown();
680
+ };
681
+ const onEmbeddedComboboxClick = () => {
682
+ if (__props.embedded && linkPicker.value) openEmbeddedList();
683
+ };
684
+ const onEmbeddedComboboxPointerDown = () => {
685
+ if (__props.embedded && linkPicker.value) openEmbeddedList();
686
+ };
687
+ watch(choiceList, (choices) => {
688
+ if (!linkPicker.value) dropdown.results = choices;
689
+ }, { immediate: true });
690
+ const ensureDropdownOpen = () => {
691
+ if (dropdown.open) return;
692
+ if (linkPicker.value) {
693
+ if (__props.embedded) openEmbeddedList();
694
+ else openLinkDropdown(search.value);
695
+ } else openChoiceDropdown();
696
+ };
697
+ const selectNextResult = () => {
698
+ const resultsLength = optionCount();
699
+ if (!resultsLength) return;
700
+ const wasOpen = dropdown.open;
701
+ ensureDropdownOpen();
702
+ if (!wasOpen) {
703
+ if (dropdown.activeItemIndex === null && !__props.isAsync) dropdown.activeItemIndex = 0;
704
+ return;
705
+ }
706
+ if (dropdown.activeItemIndex != null) dropdown.activeItemIndex = (dropdown.activeItemIndex + 1) % resultsLength;
707
+ else dropdown.activeItemIndex = 0;
708
+ };
709
+ const selectPrevResult = () => {
710
+ const resultsLength = optionCount();
711
+ if (!resultsLength) return;
712
+ ensureDropdownOpen();
713
+ if (dropdown.activeItemIndex != null) {
714
+ if (dropdown.activeItemIndex === 0) dropdown.activeItemIndex = __props.trigger === "button" ? resultsLength - 1 : null;
715
+ else dropdown.activeItemIndex = dropdown.activeItemIndex - 1;
716
+ } else dropdown.activeItemIndex = resultsLength - 1;
717
+ };
718
+ const setCurrentResult = () => {
719
+ if (!dropdown.open) {
720
+ ensureDropdownOpen();
721
+ return;
722
+ }
723
+ if (linkPicker.value) {
724
+ if (dropdown.activeItemIndex !== null && linkResults.value[dropdown.activeItemIndex]) selectLinkOption(linkResults.value[dropdown.activeItemIndex]);
725
+ return;
726
+ }
727
+ const result = dropdown.results[dropdown.activeItemIndex ?? 0];
728
+ if (result !== void 0) setChoiceResult(result);
471
729
  };
472
730
  return (_ctx, _cache) => {
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$20, toDisplayString(displayedText.value), 1), __props.label && !__props.embedded ? (openBlock(), createElementBlock("label", _hoisted_2$19, toDisplayString(__props.label), 1)) : createCommentVNode("", true)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [withDirectives((openBlock(), createElementBlock("div", _hoisted_3$17, [createElementVNode("div", _hoisted_4$17, [withDirectives(createElementVNode("input", {
474
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchText.value = $event),
475
- type: "text",
476
- role: "combobox",
477
- autocomplete: "off",
478
- "aria-autocomplete": "list",
479
- class: normalizeClass(["aform_input-field", { "aform_input-field--embedded": __props.embedded }]),
480
- placeholder: __props.placeholder,
481
- size: embeddedSize.value,
482
- "aria-label": __props.ariaLabel,
483
- required: __props.required,
484
- "aria-expanded": dropdownOpen.value,
485
- "aria-controls": dropdownOpen.value ? listboxId : void 0,
486
- "aria-activedescendant": activeIndex.value === null ? void 0 : `${listboxId}-opt-${activeIndex.value}`,
487
- disabled: __props.disabled || __props.mode === "read",
488
- onInput,
489
- onFocus,
490
- onKeydown: [
491
- withKeys(withModifiers(selectNext, ["prevent"]), ["down"]),
492
- withKeys(withModifiers(selectPrev, ["prevent"]), ["up"]),
493
- withKeys(withModifiers(selectCurrent, ["prevent"]), ["enter"]),
494
- withKeys(closeDropdown, ["esc"]),
495
- withKeys(closeDropdown, ["tab"])
496
- ]
497
- }, null, 42, _hoisted_5$16), [[vModelText, searchText.value]]), hasValidId.value && !__props.disabled && !__props.embedded ? (openBlock(), createElementBlock("button", {
731
+ return openBlock(), createElementBlock("div", { class: normalizeClass(["aform_form-element", {
732
+ "aform_form-element--embedded": __props.embedded,
733
+ "aform_dropdown--anchor-group": __props.listAnchor === "group"
734
+ }]) }, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [!linkPicker.value && badgeDescriptor.value ? (openBlock(), createElementBlock("span", {
498
735
  key: 0,
499
- type: "button",
500
- class: "aform_form-btn",
501
- onClick: handleNavigate,
502
- onKeydown: withKeys(withModifiers(handleNavigate, ["prevent"]), ["enter"])
503
- }, [(openBlock(), createElementBlock("svg", {
504
- class: "aform_form-btn-icon",
505
- "data-icon": __props.icon,
506
- viewBox: "1.75 2.75 12.5 10.5",
507
- "aria-hidden": "true",
508
- focusable: "false"
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$13)) : createCommentVNode("", true)]), dropdownOpen.value ? (openBlock(), createElementBlock("ul", {
736
+ class: "aform_display-value",
737
+ style: normalizeStyle(displayAccentStyle.value)
738
+ }, toDisplayString(badgeDescriptor.value.label), 5)) : !linkPicker.value ? (openBlock(), createElementBlock("span", _hoisted_1$24, toDisplayString(search.value), 1)) : (openBlock(), createElementBlock("span", _hoisted_2$20, toDisplayString(linkDisplayedText.value), 1)), __props.label && !__props.embedded ? (openBlock(), createElementBlock("label", _hoisted_3$17, toDisplayString(__props.label), 1)) : createCommentVNode("", true)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [withDirectives((openBlock(), createElementBlock("div", { class: normalizeClass(["autocomplete", { isOpen: dropdown.open }]) }, [
739
+ __props.trigger === "button" ? (openBlock(), createElementBlock("button", {
740
+ key: 0,
741
+ id: __props.uuid,
742
+ type: "button",
743
+ class: "aform_dropdown-button",
744
+ disabled: __props.mode === "read",
745
+ required: __props.required,
746
+ "aria-label": __props.ariaLabel ?? __props.label,
747
+ "aria-haspopup": "listbox",
748
+ "aria-expanded": dropdown.open,
749
+ "aria-controls": dropdown.open ? listboxId : void 0,
750
+ "aria-activedescendant": dropdown.open && dropdown.activeItemIndex !== null ? `${listboxId}-opt-${dropdown.activeItemIndex}` : void 0,
751
+ onClick: toggleButtonDropdown,
752
+ onKeydown: [
753
+ withKeys(withModifiers(selectNextResult, ["prevent"]), ["down"]),
754
+ withKeys(withModifiers(selectPrevResult, ["prevent"]), ["up"]),
755
+ withKeys(withModifiers(setCurrentResult, ["prevent"]), ["enter"]),
756
+ withKeys(onClickOutside, ["esc"])
757
+ ]
758
+ }, [createElementVNode("span", _hoisted_5$16, toDisplayString(search.value || __props.placeholder || ""), 1), _cache[1] || (_cache[1] = createElementVNode("span", {
759
+ class: "aform_dropdown-button-caret",
760
+ "aria-hidden": "true"
761
+ }, null, -1))], 40, _hoisted_4$17)) : withDirectives((openBlock(), createElementBlock("input", {
762
+ key: 1,
763
+ id: __props.uuid,
764
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => search.value = $event),
765
+ type: "text",
766
+ role: "combobox",
767
+ autocomplete: "off",
768
+ "aria-autocomplete": "list",
769
+ class: normalizeClass(["aform_input-field", { "aform_input-field--embedded": __props.embedded }]),
770
+ disabled: __props.mode === "read",
771
+ required: __props.required,
772
+ placeholder: __props.placeholder,
773
+ size: embeddedLinkInputSize.value,
774
+ "aria-label": __props.ariaLabel,
775
+ style: normalizeStyle(inputAccentStyle.value),
776
+ "aria-expanded": dropdown.open,
777
+ "aria-controls": dropdown.open ? listboxId : void 0,
778
+ "aria-activedescendant": dropdown.activeItemIndex === null ? void 0 : `${listboxId}-opt-${dropdown.activeItemIndex}`,
779
+ "aria-invalid": unref(invalid),
780
+ "aria-describedby": unref(describedBy),
781
+ onInput: onComboboxInput,
782
+ onFocus: onComboboxFocus,
783
+ onClick: onEmbeddedComboboxClick,
784
+ onPointerdown: onEmbeddedComboboxPointerDown,
785
+ onKeydown: [
786
+ withKeys(withModifiers(selectNextResult, ["prevent"]), ["down"]),
787
+ withKeys(withModifiers(selectPrevResult, ["prevent"]), ["up"]),
788
+ withKeys(withModifiers(setCurrentResult, ["prevent"]), ["enter"]),
789
+ withKeys(onClickOutside, ["esc"]),
790
+ withKeys(onClickOutside, ["tab"])
791
+ ]
792
+ }, null, 46, _hoisted_6$13)), [[vModelText, search.value]]),
793
+ createVNode(ADropdownList_default, {
794
+ "listbox-id": listboxId,
795
+ ariaLabel: __props.ariaLabel ?? __props.label ?? "",
796
+ open: dropdown.open,
797
+ "list-anchor": __props.listAnchor,
798
+ "option-count": optionCount,
799
+ "active-index": () => dropdown.activeItemIndex
800
+ }, {
801
+ default: withCtx(() => [dropdown.loading ? (openBlock(), createElementBlock("li", _hoisted_7$6, "Loading results...")) : linkPicker.value ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(linkResults.value, (option, i) => {
802
+ return openBlock(), createElementBlock("li", {
803
+ id: `${listboxId}-opt-${i}`,
804
+ key: String(option.id),
805
+ role: "option",
806
+ "aria-selected": isLinkOptionSelected(option),
807
+ class: normalizeClass(["autocomplete-result", {
808
+ "is-active": i === dropdown.activeItemIndex,
809
+ "is-selected": isLinkOptionSelected(option)
810
+ }]),
811
+ onMousedown: withModifiers(($event) => selectLinkOption(option), ["prevent"]),
812
+ onMouseenter: ($event) => dropdown.activeItemIndex = i
813
+ }, [renderSlot(_ctx.$slots, "option", { option }, () => [createTextVNode(toDisplayString(option.displayText ?? String(option.id)), 1)], true)], 42, _hoisted_8$6);
814
+ }), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(dropdown.results, (result, i) => {
815
+ return openBlock(), createElementBlock("li", {
816
+ id: `${listboxId}-opt-${i}`,
817
+ key: result,
818
+ role: "option",
819
+ "aria-selected": isChoiceSelected(result),
820
+ class: normalizeClass(["autocomplete-result", {
821
+ "is-active": i === dropdown.activeItemIndex,
822
+ "is-selected": isChoiceSelected(result)
823
+ }]),
824
+ onMousedown: withModifiers(($event) => setChoiceResult(result), ["prevent"]),
825
+ onMouseenter: ($event) => dropdown.activeItemIndex = i
826
+ }, toDisplayString(result), 43, _hoisted_9$5);
827
+ }), 128))]),
828
+ _: 3
829
+ }, 8, [
830
+ "ariaLabel",
831
+ "open",
832
+ "list-anchor",
833
+ "active-index"
834
+ ]),
835
+ __props.label && !__props.embedded ? (openBlock(), createElementBlock("label", {
836
+ key: 2,
837
+ class: "aform_field-label",
838
+ for: __props.uuid
839
+ }, toDisplayString(__props.label), 9, _hoisted_10$5)) : createCommentVNode("", true)
840
+ ], 2)), [[unref(vOnClickOutside), onClickOutside]]), !__props.embedded ? withDirectives((openBlock(), createElementBlock("p", {
510
841
  key: 0,
511
- id: listboxId,
512
- ref: "results",
513
- class: "autocomplete-results",
514
- role: "listbox",
515
- "aria-label": __props.ariaLabel
516
- }, [loading.value ? (openBlock(), createElementBlock("li", _hoisted_12$4, "Loading…")) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(dropdownResults.value, (option, i) => {
517
- return openBlock(), createElementBlock("li", {
518
- id: `${listboxId}-opt-${i}`,
519
- key: String(option.id),
520
- role: "option",
521
- "aria-selected": i === activeIndex.value,
522
- class: normalizeClass(["autocomplete-result", { "is-active": i === activeIndex.value }]),
523
- onMousedown: withModifiers(($event) => selectOption(option), ["prevent"])
524
- }, [renderSlot(_ctx.$slots, "option", { option }, () => [createTextVNode(toDisplayString(option.displayText ?? String(option.id)), 1)], true)], 42, _hoisted_13$3);
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);
842
+ id: unref(errorId),
843
+ class: "aform_error",
844
+ role: "alert"
845
+ }, toDisplayString(errorText.value), 9, _hoisted_11$5)), [[vShow, errorText.value]]) : createCommentVNode("", true)], 64))], 2);
526
846
  };
527
847
  }
528
- }), [["__scopeId", "data-v-a42cba74"]]);
848
+ }), [["__scopeId", "data-v-32a34889"]]);
529
849
  //#endregion
530
850
  //#region src/components/form/ACurrencyInput.vue?vue&type=script&setup=true&lang.ts
531
- var _hoisted_1$19 = { class: "aform_form-element acurrency" };
532
- var _hoisted_2$18 = { class: "aform_display-value" };
851
+ var _hoisted_1$23 = { class: "aform_form-element acurrency" };
852
+ var _hoisted_2$19 = { class: "aform_display-value" };
533
853
  var _hoisted_3$16 = { class: "aform_field-label" };
534
854
  var _hoisted_4$16 = { class: "acurrency__row" };
535
855
  var _hoisted_5$15 = { class: "acurrency__field acurrency__field--amount" };
536
856
  var _hoisted_6$12 = { class: "acurrency__group" };
537
- var _hoisted_7$5 = { class: "acurrency__currency" };
538
- var _hoisted_8$5 = { class: "acurrency__amount-wrap" };
857
+ var _hoisted_7$5 = { class: "acurrency__amount-wrap" };
858
+ var _hoisted_8$5 = [
859
+ "id",
860
+ "value",
861
+ "disabled",
862
+ "required",
863
+ "aria-invalid",
864
+ "aria-describedby"
865
+ ];
539
866
  var _hoisted_9$4 = [
540
867
  "id",
541
868
  "disabled",
@@ -543,19 +870,14 @@ var _hoisted_9$4 = [
543
870
  "aria-invalid",
544
871
  "aria-describedby"
545
872
  ];
546
- var _hoisted_10$3 = ["for"];
547
- var _hoisted_11$3 = { class: "acurrency__row acurrency__row--base" };
548
- var _hoisted_12$3 = { class: "acurrency__field acurrency__field--base-currency" };
549
- var _hoisted_13$2 = ["value"];
550
- var _hoisted_14$2 = { class: "aform_field-label" };
551
- var _hoisted_15$1 = { class: "acurrency__field acurrency__field--base-amount" };
552
- var _hoisted_16$1 = ["value"];
553
- var _hoisted_17$1 = { class: "aform_field-label" };
554
- var _hoisted_18$1 = { class: "acurrency__field acurrency__field--exchange-rate" };
555
- var _hoisted_19$1 = ["value"];
556
- var _hoisted_20$1 = { class: "aform_field-label" };
557
- var _hoisted_21$1 = ["id"];
558
- var FLOAT_NOISE_DECIMALS = 6;
873
+ var _hoisted_10$4 = ["for"];
874
+ var _hoisted_11$4 = {
875
+ class: "acurrency__field acurrency__field--base-currency",
876
+ "aria-hidden": "true"
877
+ };
878
+ var _hoisted_12$3 = ["value"];
879
+ var _hoisted_13$2 = ["id"];
880
+ var _hoisted_14$1 = ["id"];
559
881
  //#endregion
560
882
  //#region src/components/form/ACurrencyInput.vue
561
883
  var ACurrencyInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -571,10 +893,7 @@ var ACurrencyInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
571
893
  validation: { default: () => ({ errorMessage: "" }) },
572
894
  errors: {},
573
895
  options: { default: () => ({}) },
574
- currencyLabel: { default: "Currency" },
575
- baseCurrencyLabel: { default: "Base Currency" },
576
- baseAmountLabel: { default: "Base Amount" },
577
- exchangeRateLabel: { default: "Exchange Rate" }
896
+ currencyLabel: { default: "Currency" }
578
897
  }, {
579
898
  "modelValue": {},
580
899
  "modelModifiers": {}
@@ -582,14 +901,42 @@ var ACurrencyInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
582
901
  emits: ["update:modelValue"],
583
902
  setup(__props) {
584
903
  const errorText = computed(() => __props.errors?.length ? __props.errors.join("; ") : __props.validation.errorMessage ?? "");
585
- const { errorId, describedBy, invalid } = fieldErrorA11y(__props.uuid, errorText);
586
- const currencySymbol = (value) => value.symbol ?? value.displayText ?? String(value.id);
904
+ const helperId = computed(() => __props.uuid ? `${__props.uuid}-helper` : void 0);
587
905
  const modelValue = useModel(__props, "modelValue");
588
- const normalizedBaseCurrency = computed(() => {
589
- const base = __props.options.baseCurrency ?? modelValue.value?.baseCurrency;
590
- if (!base) return { id: "" };
591
- return typeof base === "string" ? { id: base } : base;
906
+ const showBase = computed(() => {
907
+ const v = modelValue.value;
908
+ return !!v?.baseCurrency?.id && (v.currency?.id !== v.baseCurrency?.id || v.amount !== v.baseAmount);
592
909
  });
910
+ const helperDescribedBy = computed(() => showBase.value && !errorText.value ? helperId.value : void 0);
911
+ const { errorId, describedBy, invalid } = fieldErrorA11y(__props.uuid, errorText, helperDescribedBy);
912
+ const currencySymbol = (value) => value.symbol ?? value.displayText ?? String(value.id);
913
+ const currencyDropdownRef = useTemplateRef("currencyDropdownRef");
914
+ const openCurrencyList = () => {
915
+ currencyDropdownRef.value?.openCurrencyList?.();
916
+ };
917
+ const focusCurrencyPicker = (event) => {
918
+ const root = event.currentTarget;
919
+ if (event.target.closest("input")) {
920
+ openCurrencyList();
921
+ return;
922
+ }
923
+ root.querySelector("input[role=\"combobox\"]")?.focus();
924
+ openCurrencyList();
925
+ };
926
+ const amountMaskEnabled = computed(() => __props.options.amountMask !== false);
927
+ const amountFocused = ref(false);
928
+ const amountText = ref("");
929
+ const selectedCurrencyId = computed(() => String(modelValue.value?.currency?.id ?? ""));
930
+ const syncAmountTextFromModel = () => {
931
+ amountText.value = formatCurrencyAmountInput(modelValue.value?.amount ?? null, selectedCurrencyId.value);
932
+ };
933
+ watch(selectedCurrencyId, () => {
934
+ if (!amountFocused.value) syncAmountTextFromModel();
935
+ });
936
+ watch(() => modelValue.value?.amount, () => {
937
+ if (!amountFocused.value) syncAmountTextFromModel();
938
+ }, { immediate: true });
939
+ const normalizedBaseCurrency = computed(() => normalizeBaseCurrency(__props.options, modelValue.value));
593
940
  const resolver = inject("aformLinkResolver", null);
594
941
  const resolvedBaseCurrency = ref(normalizedBaseCurrency.value);
595
942
  watch(normalizedBaseCurrency, async (base) => {
@@ -612,35 +959,13 @@ var ACurrencyInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
612
959
  if (!base?.id) return "";
613
960
  return base.displayText ?? String(base.id);
614
961
  });
615
- const resolveExchangeRate = (currencyId) => {
616
- const baseId = resolvedBaseCurrency.value.id;
617
- if (!currencyId || String(currencyId) === String(baseId)) return 1;
618
- if (String(currencyId) === String(modelValue.value?.currency?.id)) return modelValue.value?.exchangeRate ?? __props.options.exchangeRates?.[String(currencyId)] ?? 1;
619
- return __props.options.exchangeRates?.[String(currencyId)] ?? 1;
620
- };
621
- const baseDecimals = computed(() => {
622
- const { precision } = __props.options;
623
- if (precision === void 0) return FLOAT_NOISE_DECIMALS;
624
- return Number.isInteger(precision) && precision >= 0 && precision <= 100 ? precision : FLOAT_NOISE_DECIMALS;
625
- });
626
- const roundAmount = (value) => Number(value.toFixed(baseDecimals.value));
627
- const recompute = (amount, currencyValue) => {
628
- const exchangeRate = resolveExchangeRate(currencyValue.id);
629
- modelValue.value = {
630
- amount,
631
- currency: currencyValue,
632
- exchangeRate,
633
- baseCurrency: resolvedBaseCurrency.value,
634
- baseAmount: amount === null ? null : roundAmount(amount * exchangeRate)
635
- };
636
- };
637
962
  const amount = computed({
638
963
  get: () => modelValue.value?.amount ?? null,
639
- set: (value) => recompute(numberFromBox(value), modelValue.value?.currency ?? { id: "" })
964
+ set: (value) => modelValue.value = patchCurrencyAmount(modelValue.value, numberFromBox(value), __props.options, resolvedBaseCurrency.value)
640
965
  });
641
966
  const currency = computed({
642
967
  get: () => modelValue.value?.currency ?? { id: "" },
643
- set: (value) => recompute(modelValue.value?.amount ?? null, value)
968
+ set: (value) => modelValue.value = patchCurrencyCurrency(modelValue.value, value, __props.options, resolvedBaseCurrency.value)
644
969
  });
645
970
  const amountNavigationKeys = /* @__PURE__ */ new Set([
646
971
  "Backspace",
@@ -668,94 +993,163 @@ var ACurrencyInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
668
993
  const pasted = event.clipboardData?.getData("text") ?? "";
669
994
  if (!/^-?\d*\.?\d*$/.test(pasted)) event.preventDefault();
670
995
  };
671
- const showBase = computed(() => {
996
+ const onAmountFocus = (event) => {
997
+ amountFocused.value = true;
998
+ const input = event.target;
999
+ if (input) requestAnimationFrame(() => input.select());
1000
+ };
1001
+ const onAmountBlur = () => {
1002
+ amountFocused.value = false;
1003
+ const parsed = parseCurrencyAmountInput(amountText.value);
1004
+ modelValue.value = patchCurrencyAmount(modelValue.value, parsed, __props.options, resolvedBaseCurrency.value);
1005
+ syncAmountTextFromModel();
1006
+ };
1007
+ const onAmountInput = (event) => {
1008
+ const input = event.target;
1009
+ amountText.value = input.value;
1010
+ const parsed = parseCurrencyAmountInput(amountText.value);
1011
+ if (amountText.value.trim() === "" || amountText.value.trim() === "-" || parsed !== null) modelValue.value = patchCurrencyAmount(modelValue.value, parsed, __props.options, resolvedBaseCurrency.value);
1012
+ };
1013
+ const onAmountKeydownMasked = (event) => {
1014
+ if (event.ctrlKey || event.metaKey || event.altKey) return;
1015
+ if (amountNavigationKeys.has(event.key)) return;
1016
+ if (/^[0-9]$/.test(event.key)) return;
1017
+ if (event.key === "-") {
1018
+ const input = event.target;
1019
+ if (!input.value.includes("-") && input.selectionStart === 0) return;
1020
+ }
1021
+ if (event.key === "." || event.key === ",") {
1022
+ if (currencyInputFractionDigits(selectedCurrencyId.value) === 0) {
1023
+ event.preventDefault();
1024
+ return;
1025
+ }
1026
+ const input = event.target;
1027
+ if (!input.value.includes(".") && !input.value.includes(",")) return;
1028
+ }
1029
+ const pattern = currencyAmountEntryPattern(selectedCurrencyId.value);
1030
+ const { selectionStart, selectionEnd, value } = event.target;
1031
+ if (selectionStart === null || selectionEnd === null) {
1032
+ event.preventDefault();
1033
+ return;
1034
+ }
1035
+ const next = value.slice(0, selectionStart) + event.key + value.slice(selectionEnd);
1036
+ if (event.key.length === 1 && !pattern.test(next)) event.preventDefault();
1037
+ };
1038
+ const onAmountPasteMasked = (event) => {
1039
+ const input = event.target;
1040
+ const pasted = (event.clipboardData?.getData("text") ?? "").trim();
1041
+ const text = input.value.slice(0, input.selectionStart ?? 0) + pasted + input.value.slice(input.selectionEnd ?? 0);
1042
+ if (!currencyAmountEntryPattern(selectedCurrencyId.value).test(text)) event.preventDefault();
1043
+ };
1044
+ const conversionHelperText = computed(() => {
672
1045
  const v = modelValue.value;
673
- return !!v?.baseCurrency?.id && (v.currency?.id !== v.baseCurrency?.id || v.amount !== v.baseAmount);
1046
+ if (!v || v.baseAmount === null || v.amount === null) return "";
1047
+ const baseLabel = baseCurrencyText.value || String(v.baseCurrency?.id ?? "");
1048
+ const enteredId = String(v.currency?.id ?? "");
1049
+ const rate = v.exchangeRate;
1050
+ return `≈ ${formatCurrencyAmount(v.baseAmount, v.baseCurrency)} · 1 ${enteredId} = ${rate} ${baseLabel}`;
674
1051
  });
675
1052
  const displayText = computed(() => {
676
1053
  const v = modelValue.value;
677
1054
  if (!v || !v.currency?.id || v.amount === null) return "—";
678
- const currencyText = v.currency.displayText ?? String(v.currency.id);
679
- const base = `${v.amount} ${currencyText}`;
1055
+ const base = formatCurrencyAmount(v.amount, v.currency);
680
1056
  if (!showBase.value) return base;
681
- const baseText = v.baseCurrency.displayText ?? String(v.baseCurrency.id);
682
- return `${base} (${v.baseAmount} ${baseText})`;
1057
+ return `${base} (≈ ${formatCurrencyAmount(v.baseAmount, v.baseCurrency)})`;
683
1058
  });
684
1059
  return (_ctx, _cache) => {
685
- return openBlock(), createElementBlock("div", _hoisted_1$19, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_2$18, toDisplayString(displayText.value), 1), createElementVNode("label", _hoisted_3$16, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
686
- createElementVNode("div", _hoisted_4$16, [createElementVNode("div", _hoisted_5$15, [createElementVNode("div", _hoisted_6$12, [createElementVNode("div", _hoisted_7$5, [createVNode(AFormLink_default, {
687
- modelValue: currency.value,
688
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => currency.value = $event),
689
- mode: __props.mode,
690
- embedded: "",
691
- placeholder: __props.currencyLabel,
692
- "aria-label": __props.currencyLabel,
693
- required: __props.required,
694
- formatter: currencySymbol,
695
- doctype: __props.options.doctype,
696
- "filter-function": __props.options.filterFunction,
697
- "is-async": __props.options.isAsync
698
- }, {
699
- option: withCtx(({ option }) => [createTextVNode(toDisplayString(option.symbol ? `${option.symbol} — ` : "") + toDisplayString(option.displayText ?? option.id), 1)]),
700
- _: 1
701
- }, 8, [
702
- "modelValue",
703
- "mode",
704
- "placeholder",
705
- "aria-label",
706
- "required",
707
- "doctype",
708
- "filter-function",
709
- "is-async"
710
- ])]), createElementVNode("div", _hoisted_8$5, [withDirectives(createElementVNode("input", {
711
- id: __props.uuid,
712
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => amount.value = $event),
713
- class: "acurrency__amount",
714
- type: "number",
715
- disabled: __props.mode === "read",
716
- required: __props.required,
717
- "aria-invalid": unref(invalid),
718
- "aria-describedby": unref(describedBy),
719
- onKeydown: onAmountKeydown,
720
- onPaste: onAmountPaste
721
- }, null, 40, _hoisted_9$4), [[
722
- vModelText,
723
- amount.value,
724
- void 0,
725
- { number: true }
726
- ]]), createElementVNode("label", {
727
- class: "aform_field-label",
728
- for: __props.uuid
729
- }, toDisplayString(__props.label), 9, _hoisted_10$3)])])])]),
730
- createElementVNode("div", _hoisted_11$3, [
731
- createElementVNode("div", _hoisted_12$3, [createElementVNode("input", {
732
- value: baseCurrencyText.value,
733
- class: "aform_input-field acurrency__base-field",
1060
+ return openBlock(), createElementBlock("div", _hoisted_1$23, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_2$19, toDisplayString(displayText.value), 1), createElementVNode("label", _hoisted_3$16, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1061
+ createElementVNode("div", _hoisted_4$16, [createElementVNode("div", _hoisted_5$15, [createElementVNode("div", _hoisted_6$12, [
1062
+ createElementVNode("div", {
1063
+ class: "acurrency__currency",
1064
+ onClick: focusCurrencyPicker
1065
+ }, [createVNode(ADropdown_default, {
1066
+ ref_key: "currencyDropdownRef",
1067
+ ref: currencyDropdownRef,
1068
+ "link-value": currency.value,
1069
+ "onUpdate:linkValue": _cache[0] || (_cache[0] = ($event) => currency.value = $event),
1070
+ link: "",
1071
+ embedded: "",
1072
+ "list-anchor": "group",
1073
+ mode: __props.mode,
1074
+ required: __props.required,
1075
+ placeholder: __props.currencyLabel,
1076
+ "aria-label": __props.currencyLabel,
1077
+ formatter: currencySymbol,
1078
+ doctype: __props.options.doctype,
1079
+ "link-filter-function": __props.options.filterFunction,
1080
+ "is-async": __props.options.isAsync
1081
+ }, {
1082
+ option: withCtx(({ option }) => [createTextVNode(toDisplayString(option.symbol ? `${option.symbol} — ` : "") + toDisplayString(option.displayText ?? option.id), 1)]),
1083
+ _: 1
1084
+ }, 8, [
1085
+ "link-value",
1086
+ "mode",
1087
+ "required",
1088
+ "placeholder",
1089
+ "aria-label",
1090
+ "doctype",
1091
+ "link-filter-function",
1092
+ "is-async"
1093
+ ])]),
1094
+ createElementVNode("div", _hoisted_7$5, [amountMaskEnabled.value ? (openBlock(), createElementBlock("input", {
1095
+ key: 0,
1096
+ id: __props.uuid,
1097
+ value: amountText.value,
1098
+ class: "acurrency__amount",
734
1099
  type: "text",
735
- disabled: ""
736
- }, null, 8, _hoisted_13$2), createElementVNode("label", _hoisted_14$2, toDisplayString(__props.baseCurrencyLabel), 1)]),
737
- createElementVNode("div", _hoisted_15$1, [createElementVNode("input", {
738
- value: modelValue.value?.baseAmount,
739
- class: "aform_input-field acurrency__base-field",
740
- type: "number",
741
- disabled: ""
742
- }, null, 8, _hoisted_16$1), createElementVNode("label", _hoisted_17$1, toDisplayString(__props.baseAmountLabel), 1)]),
743
- createElementVNode("div", _hoisted_18$1, [createElementVNode("input", {
744
- value: modelValue.value?.exchangeRate,
745
- class: "aform_input-field acurrency__base-field",
1100
+ inputmode: "decimal",
1101
+ autocomplete: "off",
1102
+ disabled: __props.mode === "read",
1103
+ required: __props.required,
1104
+ "aria-invalid": unref(invalid),
1105
+ "aria-describedby": unref(describedBy),
1106
+ onFocus: onAmountFocus,
1107
+ onBlur: onAmountBlur,
1108
+ onInput: onAmountInput,
1109
+ onKeydown: onAmountKeydownMasked,
1110
+ onPaste: onAmountPasteMasked
1111
+ }, null, 40, _hoisted_8$5)) : withDirectives((openBlock(), createElementBlock("input", {
1112
+ key: 1,
1113
+ id: __props.uuid,
1114
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => amount.value = $event),
1115
+ class: "acurrency__amount",
746
1116
  type: "number",
747
- disabled: ""
748
- }, null, 8, _hoisted_19$1), createElementVNode("label", _hoisted_20$1, toDisplayString(__props.exchangeRateLabel), 1)])
749
- ]),
1117
+ disabled: __props.mode === "read",
1118
+ required: __props.required,
1119
+ "aria-invalid": unref(invalid),
1120
+ "aria-describedby": unref(describedBy),
1121
+ onKeydown: onAmountKeydown,
1122
+ onPaste: onAmountPaste
1123
+ }, null, 40, _hoisted_9$4)), [[
1124
+ vModelText,
1125
+ amount.value,
1126
+ void 0,
1127
+ { number: true }
1128
+ ]])]),
1129
+ createElementVNode("label", {
1130
+ class: "aform_field-label",
1131
+ for: __props.uuid
1132
+ }, toDisplayString(__props.label), 9, _hoisted_10$4)
1133
+ ])]), createElementVNode("div", _hoisted_11$4, [createElementVNode("input", {
1134
+ type: "text",
1135
+ readonly: "",
1136
+ tabindex: "-1",
1137
+ value: baseCurrencyText.value
1138
+ }, null, 8, _hoisted_12$3)])]),
1139
+ showBase.value && !errorText.value ? (openBlock(), createElementBlock("p", {
1140
+ key: 0,
1141
+ id: helperId.value,
1142
+ class: "acurrency__helper"
1143
+ }, toDisplayString(conversionHelperText.value), 9, _hoisted_13$2)) : createCommentVNode("", true),
750
1144
  withDirectives(createElementVNode("p", {
751
1145
  id: unref(errorId),
752
1146
  class: "aform_error",
753
1147
  role: "alert"
754
- }, toDisplayString(errorText.value), 9, _hoisted_21$1), [[vShow, errorText.value]])
1148
+ }, toDisplayString(errorText.value), 9, _hoisted_14$1), [[vShow, errorText.value]])
755
1149
  ], 64))]);
756
1150
  };
757
1151
  }
758
- }), [["__scopeId", "data-v-4f9b4e42"]]);
1152
+ }), [["__scopeId", "data-v-7de4a96e"]]);
759
1153
  //#endregion
760
1154
  //#region src/utils/typedDay.ts
761
1155
  var TYPED_DAY_FORMAT = {
@@ -795,8 +1189,8 @@ function readTypedDay(text, locale) {
795
1189
  }
796
1190
  //#endregion
797
1191
  //#region src/components/form/ADatePicker.vue?vue&type=script&setup=true&lang.ts
798
- var _hoisted_1$18 = { class: "aform_display-value" };
799
- var _hoisted_2$17 = { key: 0 };
1192
+ var _hoisted_1$22 = { class: "aform_display-value" };
1193
+ var _hoisted_2$18 = { key: 0 };
800
1194
  var _hoisted_3$15 = ["id"];
801
1195
  var _hoisted_4$15 = { class: "adatepicker" };
802
1196
  var _hoisted_5$14 = ["aria-label"];
@@ -810,8 +1204,8 @@ var _hoisted_8$4 = {
810
1204
  class: "range-inputs"
811
1205
  };
812
1206
  var _hoisted_9$3 = { class: "date-input" };
813
- var _hoisted_10$2 = ["value"];
814
- var _hoisted_11$2 = ["value"];
1207
+ var _hoisted_10$3 = ["value"];
1208
+ var _hoisted_11$3 = ["value"];
815
1209
  var _hoisted_12$2 = { class: "days-header" };
816
1210
  var _hoisted_13$1 = [
817
1211
  "tabindex",
@@ -822,7 +1216,7 @@ var _hoisted_13$1 = [
822
1216
  "onKeydown",
823
1217
  "onMouseover"
824
1218
  ];
825
- var _hoisted_14$1 = ["id"];
1219
+ var _hoisted_14 = ["id"];
826
1220
  var numberOfRows = 6;
827
1221
  var numberOfColumns = 7;
828
1222
  //#endregion
@@ -1053,8 +1447,8 @@ var ADatePicker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
1053
1447
  });
1054
1448
  return (_ctx, _cache) => {
1055
1449
  return __props.mode === "display" || __props.mode === "read" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1056
- createElementVNode("span", _hoisted_1$18, toDisplayString(displayValue.value), 1),
1057
- __props.label ? (openBlock(), createElementBlock("label", _hoisted_2$17, toDisplayString(__props.label), 1)) : createCommentVNode("", true),
1450
+ createElementVNode("span", _hoisted_1$22, toDisplayString(displayValue.value), 1),
1451
+ __props.label ? (openBlock(), createElementBlock("label", _hoisted_2$18, toDisplayString(__props.label), 1)) : createCommentVNode("", true),
1058
1452
  withDirectives(createElementVNode("p", {
1059
1453
  id: unref(errorId),
1060
1454
  class: "aform_error",
@@ -1089,7 +1483,7 @@ var ADatePicker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
1089
1483
  placeholder: "start date",
1090
1484
  onBlur: _cache[0] || (_cache[0] = ($event) => enterInputDate()),
1091
1485
  onKeydown: enterDate
1092
- }, null, 40, _hoisted_10$2),
1486
+ }, null, 40, _hoisted_10$3),
1093
1487
  _cache[2] || (_cache[2] = createElementVNode("div", null, "-", -1)),
1094
1488
  createElementVNode("input", {
1095
1489
  ref: "end-date-input",
@@ -1099,7 +1493,7 @@ var ADatePicker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
1099
1493
  placeholder: "end date",
1100
1494
  onBlur: _cache[1] || (_cache[1] = ($event) => enterInputDate()),
1101
1495
  onKeydown: enterDate
1102
- }, null, 40, _hoisted_11$2)
1496
+ }, null, 40, _hoisted_11$3)
1103
1497
  ])])])) : createCommentVNode("", true),
1104
1498
  createElementVNode("tr", _hoisted_12$2, [(openBlock(true), createElementBlock(Fragment, null, renderList(weekdayLetters.value, (letter, weekdayIndex) => {
1105
1499
  return openBlock(), createElementBlock("td", { key: weekdayIndex }, toDisplayString(letter), 1);
@@ -1133,14 +1527,14 @@ var ADatePicker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
1133
1527
  id: unref(errorId),
1134
1528
  class: "aform_error",
1135
1529
  role: "alert"
1136
- }, toDisplayString(errorText.value), 9, _hoisted_14$1), [[vShow, errorText.value]])], 64));
1530
+ }, toDisplayString(errorText.value), 9, _hoisted_14), [[vShow, errorText.value]])], 64));
1137
1531
  };
1138
1532
  }
1139
1533
  }), [["__scopeId", "data-v-d0133599"]]);
1140
1534
  //#endregion
1141
1535
  //#region src/components/form/ADateTimeInput.vue?vue&type=script&setup=true&lang.ts
1142
- var _hoisted_1$17 = { class: "adate_time" };
1143
- var _hoisted_2$16 = { class: "adate_time_fields" };
1536
+ var _hoisted_1$21 = { class: "adate_time" };
1537
+ var _hoisted_2$17 = { class: "adate_time_fields" };
1144
1538
  var _hoisted_3$14 = ["onKeydown"];
1145
1539
  var _hoisted_4$14 = ["onKeydown"];
1146
1540
  var _hoisted_5$13 = {
@@ -1279,7 +1673,7 @@ var ADateTimeInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
1279
1673
  }
1280
1674
  };
1281
1675
  return (_ctx, _cache) => {
1282
- return openBlock(), createElementBlock("div", _hoisted_1$17, [createElementVNode("div", _hoisted_2$16, [
1676
+ return openBlock(), createElementBlock("div", _hoisted_1$21, [createElementVNode("div", _hoisted_2$17, [
1283
1677
  withDirectives(createElementVNode("input", {
1284
1678
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => timeData.hours = $event),
1285
1679
  type: "text",
@@ -1335,8 +1729,8 @@ var ADateTimeInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
1335
1729
  }), [["__scopeId", "data-v-3a6e48db"]]);
1336
1730
  //#endregion
1337
1731
  //#region src/components/form/ADateSelection.vue?vue&type=script&setup=true&lang.ts
1338
- var _hoisted_1$16 = { class: "adate-selection" };
1339
- var _hoisted_2$15 = {
1732
+ var _hoisted_1$20 = { class: "adate-selection" };
1733
+ var _hoisted_2$16 = {
1340
1734
  key: 3,
1341
1735
  class: "empty"
1342
1736
  };
@@ -1427,7 +1821,7 @@ var ADateSelection_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
1427
1821
  tryEmitRange(data.source ?? "user");
1428
1822
  };
1429
1823
  return (_ctx, _cache) => {
1430
- return openBlock(), createElementBlock("div", _hoisted_1$16, [
1824
+ return openBlock(), createElementBlock("div", _hoisted_1$20, [
1431
1825
  __props.showDate ? (openBlock(), createBlock(ADatePicker_default, {
1432
1826
  key: 0,
1433
1827
  "model-value": __props.defaultDate,
@@ -1467,7 +1861,7 @@ var ADateSelection_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
1467
1861
  "default-meridiem",
1468
1862
  "use-seconds"
1469
1863
  ])], 64)) : createCommentVNode("", true),
1470
- !__props.showTime && !__props.showDate ? (openBlock(), createElementBlock("p", _hoisted_2$15, "empty")) : createCommentVNode("", true)
1864
+ !__props.showTime && !__props.showDate ? (openBlock(), createElementBlock("p", _hoisted_2$16, "empty")) : createCommentVNode("", true)
1471
1865
  ]);
1472
1866
  };
1473
1867
  }
@@ -1520,8 +1914,8 @@ function useFieldCalendar(box, calendar, uuid) {
1520
1914
  }
1521
1915
  //#endregion
1522
1916
  //#region src/components/form/ADate.vue?vue&type=script&setup=true&lang.ts
1523
- var _hoisted_1$15 = { class: "aform_display-value" };
1524
- var _hoisted_2$14 = { class: "aform_field-label" };
1917
+ var _hoisted_1$19 = { class: "aform_display-value" };
1918
+ var _hoisted_2$15 = { class: "aform_field-label" };
1525
1919
  var _hoisted_3$13 = [
1526
1920
  "id",
1527
1921
  "aria-controls",
@@ -1567,259 +1961,57 @@ var ADate_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
1567
1961
  const handleDate = (data) => {
1568
1962
  modelValue.value = data.selected;
1569
1963
  closePicker();
1570
- };
1571
- return (_ctx, _cache) => {
1572
- return openBlock(), createElementBlock("div", {
1573
- class: "aform_form-element",
1574
- onFocusout: _cache[2] || (_cache[2] = (...args) => unref(closeWhenFocusLeaves) && unref(closeWhenFocusLeaves)(...args)),
1575
- onKeydown: _cache[3] || (_cache[3] = (...args) => unref(closeOnEscape) && unref(closeOnEscape)(...args))
1576
- }, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_1$15, toDisplayString(displayValue.value), 1), createElementVNode("label", _hoisted_2$14, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1577
- withDirectives(createElementVNode("input", {
1578
- id: __props.uuid,
1579
- ref: "date",
1580
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => boxDay.value = $event),
1581
- class: "aform_input-field",
1582
- type: "date",
1583
- "aria-haspopup": "dialog",
1584
- "aria-controls": unref(showPicker) ? unref(calendarId) : void 0,
1585
- disabled: __props.mode === "read",
1586
- required: __props.required,
1587
- "aria-invalid": unref(invalid),
1588
- "aria-describedby": unref(describedBy),
1589
- onClick: withModifiers(openPicker, ["prevent"]),
1590
- onKeydown: _cache[1] || (_cache[1] = (...args) => unref(openFromKey) && unref(openFromKey)(...args))
1591
- }, null, 40, _hoisted_3$13), [[vModelText, boxDay.value]]),
1592
- createElementVNode("label", {
1593
- class: "aform_field-label",
1594
- for: __props.uuid
1595
- }, toDisplayString(__props.label), 9, _hoisted_4$13),
1596
- withDirectives(createElementVNode("p", {
1597
- id: unref(errorId),
1598
- class: "aform_error",
1599
- role: "alert"
1600
- }, toDisplayString(errorText.value), 9, _hoisted_5$12), [[vShow, errorText.value]]),
1601
- unref(showPicker) ? (openBlock(), createBlock(ADateSelection_default, {
1602
- key: 0,
1603
- id: unref(calendarId),
1604
- ref: "picker",
1605
- class: "adate-picker",
1606
- role: "dialog",
1607
- "aria-label": __props.label,
1608
- "default-date": modelValue.value || void 0,
1609
- "select-range": false,
1610
- "show-time": false,
1611
- onGetDate: handleDate
1612
- }, null, 8, [
1613
- "id",
1614
- "aria-label",
1615
- "default-date"
1616
- ])) : createCommentVNode("", true)
1617
- ], 64))], 32);
1618
- };
1619
- }
1620
- }), [["__scopeId", "data-v-16f8f8f2"]]);
1621
- //#endregion
1622
- //#region src/components/form/ADropdown.vue?vue&type=script&setup=true&lang.ts
1623
- var _hoisted_1$14 = { class: "aform_form-element" };
1624
- var _hoisted_2$13 = {
1625
- key: 1,
1626
- class: "aform_display-value"
1627
- };
1628
- var _hoisted_3$12 = { class: "aform_field-label" };
1629
- var _hoisted_4$12 = [
1630
- "id",
1631
- "disabled",
1632
- "aria-expanded",
1633
- "aria-controls",
1634
- "aria-activedescendant",
1635
- "aria-invalid",
1636
- "aria-describedby",
1637
- "onKeydown"
1638
- ];
1639
- var _hoisted_5$11 = ["id", "aria-label"];
1640
- var _hoisted_6$9 = {
1641
- key: 0,
1642
- class: "loading autocomplete-result"
1643
- };
1644
- var _hoisted_7$3 = [
1645
- "id",
1646
- "aria-selected",
1647
- "onMousedown"
1648
- ];
1649
- var _hoisted_8$3 = ["for"];
1650
- var _hoisted_9$2 = ["id"];
1651
- //#endregion
1652
- //#region src/components/form/ADropdown.vue
1653
- var ADropdown_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
1654
- __name: "ADropdown",
1655
- props: /*@__PURE__*/ mergeModels({
1656
- schema: {},
1657
- label: {},
1658
- selectRange: { type: Boolean },
1659
- mask: {},
1660
- required: { type: Boolean },
1661
- mode: {},
1662
- uuid: {},
1663
- validation: { default: () => ({ errorMessage: "" }) },
1664
- errors: {},
1665
- options: { default: () => [] },
1666
- format: {},
1667
- isAsync: {
1668
- type: Boolean,
1669
- default: false
1670
- },
1671
- filterFunction: {
1672
- type: Function,
1673
- default: void 0
1674
- }
1675
- }, {
1676
- "modelValue": {},
1677
- "modelModifiers": {}
1678
- }),
1679
- emits: ["update:modelValue"],
1680
- setup(__props) {
1681
- const listboxId = useId();
1682
- const choiceList = computed(() => selectChoices(__props.options));
1683
- const formatFn = computed(() => __props.format ? deserializeFunction(__props.format) : void 0);
1684
- const badgeDescriptor = computed(() => resolveFieldBadge(search.value, __props.options, formatFn.value));
1685
- const inputAccentStyle = computed(() => badgeInputAccentStyle(badgeDescriptor.value));
1686
- const displayAccentStyle = computed(() => badgeInputAccentStyle(badgeDescriptor.value));
1687
- const errorText = computed(() => __props.errors?.length ? __props.errors.join("; ") : __props.validation.errorMessage ?? "");
1688
- const { errorId, describedBy, invalid } = fieldErrorA11y(__props.uuid, errorText);
1689
- const search = useModel(__props, "modelValue");
1690
- const committedValue = ref(search.value ?? "");
1691
- const dropdown = reactive({
1692
- activeItemIndex: null,
1693
- open: false,
1694
- loading: false,
1695
- results: []
1696
- });
1697
- fitDropdownList(useTemplateRef("results"), {
1698
- isOpen: () => dropdown.open,
1699
- optionCount: () => dropdown.results.length,
1700
- activeIndex: () => dropdown.activeItemIndex
1701
- });
1702
- watch(choiceList, (choices) => {
1703
- dropdown.results = choices;
1704
- }, { immediate: true });
1705
- const onClickOutside = () => closeDropdown();
1706
- const filter = async () => {
1707
- dropdown.open = true;
1708
- dropdown.activeItemIndex = null;
1709
- if (__props.filterFunction) {
1710
- if (__props.isAsync) dropdown.loading = true;
1711
- try {
1712
- const filteredResults = await __props.filterFunction(search.value || "");
1713
- dropdown.results = filteredResults || [];
1714
- } catch {
1715
- dropdown.results = [];
1716
- } finally {
1717
- if (__props.isAsync) dropdown.loading = false;
1718
- }
1719
- } else filterResults();
1720
- };
1721
- const setResult = (result) => {
1722
- search.value = result;
1723
- committedValue.value = result;
1724
- closeDropdown(result);
1725
- };
1726
- const openDropdown = () => {
1727
- const idx = choiceList.value.indexOf(search.value ?? "");
1728
- dropdown.activeItemIndex = __props.isAsync ? null : idx >= 0 ? idx : null;
1729
- dropdown.open = true;
1730
- dropdown.results = __props.isAsync ? [] : choiceList.value;
1731
- };
1732
- const closeDropdown = (result) => {
1733
- dropdown.activeItemIndex = null;
1734
- dropdown.open = false;
1735
- if (!choiceList.value.includes(result || search.value || "")) search.value = committedValue.value;
1736
- };
1737
- const filterResults = () => {
1738
- if (!search.value) dropdown.results = choiceList.value;
1739
- else dropdown.results = choiceList.value.filter((item) => item.toLowerCase().includes((search.value ?? "").toLowerCase()));
1740
- };
1741
- const selectNextResult = () => {
1742
- const resultsLength = dropdown.results?.length || 0;
1743
- if (dropdown.activeItemIndex != null) {
1744
- const currentIndex = isNaN(dropdown.activeItemIndex) ? 0 : dropdown.activeItemIndex;
1745
- dropdown.activeItemIndex = (currentIndex + 1) % resultsLength;
1746
- } else dropdown.activeItemIndex = 0;
1747
- };
1748
- const selectPrevResult = () => {
1749
- const resultsLength = dropdown.results?.length || 0;
1750
- if (dropdown.activeItemIndex != null) {
1751
- const currentIndex = isNaN(dropdown.activeItemIndex) ? 0 : dropdown.activeItemIndex;
1752
- if (currentIndex === 0) dropdown.activeItemIndex = null;
1753
- else dropdown.activeItemIndex = currentIndex - 1;
1754
- } else dropdown.activeItemIndex = resultsLength - 1;
1755
- };
1756
- const setCurrentResult = () => {
1757
- if (dropdown.results) {
1758
- const currentIndex = dropdown.activeItemIndex || 0;
1759
- const result = dropdown.results[currentIndex];
1760
- setResult(result);
1761
- }
1762
- dropdown.activeItemIndex = 0;
1763
- };
1764
- return (_ctx, _cache) => {
1765
- return openBlock(), createElementBlock("div", _hoisted_1$14, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [badgeDescriptor.value ? (openBlock(), createElementBlock("span", {
1766
- key: 0,
1767
- class: "aform_display-value",
1768
- style: normalizeStyle(displayAccentStyle.value)
1769
- }, toDisplayString(badgeDescriptor.value.label), 5)) : (openBlock(), createElementBlock("span", _hoisted_2$13, toDisplayString(search.value ?? ""), 1)), createElementVNode("label", _hoisted_3$12, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [withDirectives((openBlock(), createElementBlock("div", { class: normalizeClass(["autocomplete", { isOpen: dropdown.open }]) }, [
1964
+ };
1965
+ return (_ctx, _cache) => {
1966
+ return openBlock(), createElementBlock("div", {
1967
+ class: "aform_form-element",
1968
+ onFocusout: _cache[2] || (_cache[2] = (...args) => unref(closeWhenFocusLeaves) && unref(closeWhenFocusLeaves)(...args)),
1969
+ onKeydown: _cache[3] || (_cache[3] = (...args) => unref(closeOnEscape) && unref(closeOnEscape)(...args))
1970
+ }, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_1$19, toDisplayString(displayValue.value), 1), createElementVNode("label", _hoisted_2$15, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1770
1971
  withDirectives(createElementVNode("input", {
1771
1972
  id: __props.uuid,
1772
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => search.value = $event),
1773
- type: "text",
1774
- role: "combobox",
1775
- autocomplete: "off",
1776
- "aria-autocomplete": "list",
1973
+ ref: "date",
1974
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => boxDay.value = $event),
1777
1975
  class: "aform_input-field",
1976
+ type: "date",
1977
+ "aria-haspopup": "dialog",
1978
+ "aria-controls": unref(showPicker) ? unref(calendarId) : void 0,
1778
1979
  disabled: __props.mode === "read",
1779
- style: normalizeStyle(inputAccentStyle.value),
1780
- "aria-expanded": dropdown.open,
1781
- "aria-controls": dropdown.open ? unref(listboxId) : void 0,
1782
- "aria-activedescendant": dropdown.activeItemIndex === null ? void 0 : `${unref(listboxId)}-opt-${dropdown.activeItemIndex}`,
1980
+ required: __props.required,
1783
1981
  "aria-invalid": unref(invalid),
1784
1982
  "aria-describedby": unref(describedBy),
1785
- onInput: filter,
1786
- onFocus: openDropdown,
1787
- onKeydown: [
1788
- withKeys(withModifiers(selectNextResult, ["prevent"]), ["down"]),
1789
- withKeys(withModifiers(selectPrevResult, ["prevent"]), ["up"]),
1790
- withKeys(withModifiers(setCurrentResult, ["prevent"]), ["enter"]),
1791
- withKeys(onClickOutside, ["esc"]),
1792
- withKeys(onClickOutside, ["tab"])
1793
- ]
1794
- }, null, 44, _hoisted_4$12), [[vModelText, search.value]]),
1795
- withDirectives(createElementVNode("ul", {
1796
- id: unref(listboxId),
1797
- ref: "results",
1798
- class: "autocomplete-results",
1799
- role: "listbox",
1800
- "aria-label": __props.label
1801
- }, [dropdown.loading ? (openBlock(), createElementBlock("li", _hoisted_6$9, "Loading results...")) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(dropdown.results, (result, i) => {
1802
- return openBlock(), createElementBlock("li", {
1803
- id: `${unref(listboxId)}-opt-${i}`,
1804
- key: result,
1805
- role: "option",
1806
- "aria-selected": i === dropdown.activeItemIndex,
1807
- class: normalizeClass(["autocomplete-result", { "is-active": i === dropdown.activeItemIndex }]),
1808
- onMousedown: withModifiers(($event) => setResult(result), ["prevent"])
1809
- }, toDisplayString(result), 43, _hoisted_7$3);
1810
- }), 128))], 8, _hoisted_5$11), [[vShow, dropdown.open]]),
1983
+ onClick: withModifiers(openPicker, ["prevent"]),
1984
+ onKeydown: _cache[1] || (_cache[1] = (...args) => unref(openFromKey) && unref(openFromKey)(...args))
1985
+ }, null, 40, _hoisted_3$13), [[vModelText, boxDay.value]]),
1811
1986
  createElementVNode("label", {
1812
1987
  class: "aform_field-label",
1813
1988
  for: __props.uuid
1814
- }, toDisplayString(__props.label), 9, _hoisted_8$3)
1815
- ], 2)), [[unref(vOnClickOutside), onClickOutside]]), withDirectives(createElementVNode("p", {
1816
- id: unref(errorId),
1817
- class: "aform_error",
1818
- role: "alert"
1819
- }, toDisplayString(errorText.value), 9, _hoisted_9$2), [[vShow, errorText.value]])], 64))]);
1989
+ }, toDisplayString(__props.label), 9, _hoisted_4$13),
1990
+ withDirectives(createElementVNode("p", {
1991
+ id: unref(errorId),
1992
+ class: "aform_error",
1993
+ role: "alert"
1994
+ }, toDisplayString(errorText.value), 9, _hoisted_5$12), [[vShow, errorText.value]]),
1995
+ unref(showPicker) ? (openBlock(), createBlock(ADateSelection_default, {
1996
+ key: 0,
1997
+ id: unref(calendarId),
1998
+ ref: "picker",
1999
+ class: "adate-picker",
2000
+ role: "dialog",
2001
+ "aria-label": __props.label,
2002
+ "default-date": modelValue.value || void 0,
2003
+ "select-range": false,
2004
+ "show-time": false,
2005
+ onGetDate: handleDate
2006
+ }, null, 8, [
2007
+ "id",
2008
+ "aria-label",
2009
+ "default-date"
2010
+ ])) : createCommentVNode("", true)
2011
+ ], 64))], 32);
1820
2012
  };
1821
2013
  }
1822
- }), [["__scopeId", "data-v-f395a95f"]]);
2014
+ }), [["__scopeId", "data-v-16f8f8f2"]]);
1823
2015
  //#endregion
1824
2016
  //#region src/components/form/ABadge.vue
1825
2017
  var ABadge_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -1872,12 +2064,12 @@ var ABadge_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
1872
2064
  }), [["__scopeId", "data-v-f99dd564"]]);
1873
2065
  //#endregion
1874
2066
  //#region src/components/form/ASegmentedControl.vue?vue&type=script&setup=true&lang.ts
1875
- var _hoisted_1$13 = {
2067
+ var _hoisted_1$18 = {
1876
2068
  key: 1,
1877
2069
  class: "aform_display-value"
1878
2070
  };
1879
- var _hoisted_2$12 = ["id"];
1880
- var _hoisted_3$11 = [
2071
+ var _hoisted_2$14 = ["id"];
2072
+ var _hoisted_3$12 = [
1881
2073
  "role",
1882
2074
  "aria-labelledby",
1883
2075
  "aria-label",
@@ -1885,19 +2077,19 @@ var _hoisted_3$11 = [
1885
2077
  "aria-invalid",
1886
2078
  "aria-describedby"
1887
2079
  ];
1888
- var _hoisted_4$11 = ["data-segment-value"];
1889
- var _hoisted_5$10 = [
2080
+ var _hoisted_4$12 = ["data-segment-value"];
2081
+ var _hoisted_5$11 = [
1890
2082
  "name",
1891
2083
  "value",
1892
2084
  "disabled"
1893
2085
  ];
1894
- var _hoisted_6$8 = [
2086
+ var _hoisted_6$9 = [
1895
2087
  "name",
1896
2088
  "value",
1897
2089
  "disabled"
1898
2090
  ];
1899
- var _hoisted_7$2 = { class: "aform_segmented-label" };
1900
- var _hoisted_8$2 = ["id"];
2091
+ var _hoisted_7$3 = { class: "aform_segmented-label" };
2092
+ var _hoisted_8$3 = ["id"];
1901
2093
  //#endregion
1902
2094
  //#region src/components/form/ASegmentedControl.vue
1903
2095
  var ASegmentedControl_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -2004,11 +2196,11 @@ var ASegmentedControl_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
2004
2196
  value: displayBadgeValue.value,
2005
2197
  options: __props.options,
2006
2198
  presentation: "input-accent"
2007
- }, null, 8, ["value", "options"])) : (openBlock(), createElementBlock("span", _hoisted_1$13, toDisplayString(displayText.value), 1))], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2199
+ }, null, 8, ["value", "options"])) : (openBlock(), createElementBlock("span", _hoisted_1$18, toDisplayString(displayText.value), 1))], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2008
2200
  createElementVNode("label", {
2009
2201
  id: labelId.value,
2010
2202
  class: normalizeClass(["aform_field-label", { "aform_segmented-sr-label": __props.hideLabel }])
2011
- }, toDisplayString(__props.label), 11, _hoisted_2$12),
2203
+ }, toDisplayString(__props.label), 11, _hoisted_2$14),
2012
2204
  createElementVNode("div", {
2013
2205
  role: __props.multiple ? "group" : "radiogroup",
2014
2206
  class: "aform_segmented-track",
@@ -2031,7 +2223,7 @@ var ASegmentedControl_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
2031
2223
  name: groupName.value,
2032
2224
  value: choice,
2033
2225
  disabled: __props.mode === "read"
2034
- }, null, 8, _hoisted_5$10)), [[vModelCheckbox, selectedMany.value]]) : withDirectives((openBlock(), createElementBlock("input", {
2226
+ }, null, 8, _hoisted_5$11)), [[vModelCheckbox, selectedMany.value]]) : withDirectives((openBlock(), createElementBlock("input", {
2035
2227
  key: 1,
2036
2228
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => selected.value = $event),
2037
2229
  type: "radio",
@@ -2039,22 +2231,22 @@ var ASegmentedControl_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
2039
2231
  name: groupName.value,
2040
2232
  value: choice,
2041
2233
  disabled: __props.mode === "read"
2042
- }, null, 8, _hoisted_6$8)), [[vModelRadio, selected.value]]), createElementVNode("span", _hoisted_7$2, toDisplayString(segmentLabel(choice)), 1)], 14, _hoisted_4$11);
2043
- }), 128))], 8, _hoisted_3$11),
2234
+ }, null, 8, _hoisted_6$9)), [[vModelRadio, selected.value]]), createElementVNode("span", _hoisted_7$3, toDisplayString(segmentLabel(choice)), 1)], 14, _hoisted_4$12);
2235
+ }), 128))], 8, _hoisted_3$12),
2044
2236
  withDirectives(createElementVNode("p", {
2045
2237
  id: unref(errorId),
2046
2238
  class: "aform_error",
2047
2239
  role: "alert"
2048
- }, toDisplayString(errorText.value), 9, _hoisted_8$2), [[vShow, errorText.value]])
2240
+ }, toDisplayString(errorText.value), 9, _hoisted_8$3), [[vShow, errorText.value]])
2049
2241
  ], 64))], 2);
2050
2242
  };
2051
2243
  }
2052
2244
  }), [["__scopeId", "data-v-8b740fd8"]]);
2053
2245
  //#endregion
2054
2246
  //#region src/components/form/ADateTime.vue?vue&type=script&setup=true&lang.ts
2055
- var _hoisted_1$12 = { class: "aform_display-value" };
2056
- var _hoisted_2$11 = { class: "aform_field-label" };
2057
- var _hoisted_3$10 = [
2247
+ var _hoisted_1$17 = { class: "aform_display-value" };
2248
+ var _hoisted_2$13 = { class: "aform_field-label" };
2249
+ var _hoisted_3$11 = [
2058
2250
  "id",
2059
2251
  "aria-expanded",
2060
2252
  "aria-controls",
@@ -2063,8 +2255,8 @@ var _hoisted_3$10 = [
2063
2255
  "aria-invalid",
2064
2256
  "aria-describedby"
2065
2257
  ];
2066
- var _hoisted_4$10 = ["for"];
2067
- var _hoisted_5$9 = ["id"];
2258
+ var _hoisted_4$11 = ["for"];
2259
+ var _hoisted_5$10 = ["id"];
2068
2260
  //#endregion
2069
2261
  //#region src/components/form/ADateTime.vue
2070
2262
  var ADateTime_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -2170,7 +2362,7 @@ var ADateTime_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
2170
2362
  class: "aform_form-element",
2171
2363
  onFocusout: _cache[1] || (_cache[1] = (...args) => unref(closeWhenFocusLeaves) && unref(closeWhenFocusLeaves)(...args)),
2172
2364
  onKeydown: _cache[2] || (_cache[2] = (...args) => unref(closeOnEscape) && unref(closeOnEscape)(...args))
2173
- }, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_1$12, toDisplayString(displayValue.value), 1), createElementVNode("label", _hoisted_2$11, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2365
+ }, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_1$17, toDisplayString(displayValue.value), 1), createElementVNode("label", _hoisted_2$13, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2174
2366
  createElementVNode("input", {
2175
2367
  id: __props.uuid,
2176
2368
  ref: "box",
@@ -2188,16 +2380,16 @@ var ADateTime_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
2188
2380
  "aria-describedby": unref(describedBy),
2189
2381
  onClick: openPicker,
2190
2382
  onKeydown: _cache[0] || (_cache[0] = (...args) => unref(openFromKey) && unref(openFromKey)(...args))
2191
- }, null, 40, _hoisted_3$10),
2383
+ }, null, 40, _hoisted_3$11),
2192
2384
  createElementVNode("label", {
2193
2385
  class: "aform_field-label",
2194
2386
  for: __props.uuid
2195
- }, toDisplayString(__props.label), 9, _hoisted_4$10),
2387
+ }, toDisplayString(__props.label), 9, _hoisted_4$11),
2196
2388
  withDirectives(createElementVNode("p", {
2197
2389
  id: unref(errorId),
2198
2390
  class: "aform_error",
2199
2391
  role: "alert"
2200
- }, toDisplayString(errorText.value), 9, _hoisted_5$9), [[vShow, errorText.value]]),
2392
+ }, toDisplayString(errorText.value), 9, _hoisted_5$10), [[vShow, errorText.value]]),
2201
2393
  unref(showPicker) ? (openBlock(), createBlock(ADateSelection_default, {
2202
2394
  key: 0,
2203
2395
  id: unref(calendarId),
@@ -2234,15 +2426,15 @@ var ADateTime_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
2234
2426
  }), [["__scopeId", "data-v-05cbbabe"]]);
2235
2427
  //#endregion
2236
2428
  //#region src/components/form/ADuration.vue?vue&type=script&setup=true&lang.ts
2237
- var _hoisted_1$11 = { class: "aduration" };
2238
- var _hoisted_2$10 = { class: "aform_display-value" };
2239
- var _hoisted_3$9 = { class: "aduration__footer" };
2240
- var _hoisted_4$9 = {
2429
+ var _hoisted_1$16 = { class: "aduration" };
2430
+ var _hoisted_2$12 = { class: "aform_display-value" };
2431
+ var _hoisted_3$10 = { class: "aduration__footer" };
2432
+ var _hoisted_4$10 = {
2241
2433
  key: 0,
2242
2434
  class: "aduration__summary"
2243
2435
  };
2244
- var _hoisted_5$8 = { class: "aduration__value" };
2245
- var _hoisted_6$7 = { class: "aduration__held" };
2436
+ var _hoisted_5$9 = { class: "aduration__value" };
2437
+ var _hoisted_6$8 = { class: "aduration__held" };
2246
2438
  //#endregion
2247
2439
  //#region src/components/form/ADuration.vue
2248
2440
  var ADuration_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -2303,7 +2495,7 @@ var ADuration_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
2303
2495
  return heldDuration.value.blank ? "—" : describeDuration(heldDuration.value);
2304
2496
  });
2305
2497
  return (_ctx, _cache) => {
2306
- return openBlock(), createElementBlock("div", _hoisted_1$11, [__props.mode === "display" || __props.mode === "read" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_2$10, toDisplayString(displayValue.value), 1), createElementVNode("label", null, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createVNode(ADateSelection_default, {
2498
+ return openBlock(), createElementBlock("div", _hoisted_1$16, [__props.mode === "display" || __props.mode === "read" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_2$12, toDisplayString(displayValue.value), 1), createElementVNode("label", null, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createVNode(ADateSelection_default, {
2307
2499
  ref: "selectionRef",
2308
2500
  "select-range": true,
2309
2501
  "show-time": true,
@@ -2311,19 +2503,19 @@ var ADuration_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
2311
2503
  "allow-military-time": __props.allowMilitaryTime,
2312
2504
  "use-seconds": __props.useSeconds,
2313
2505
  onGetRange: handleRange
2314
- }, null, 8, ["allow-military-time", "use-seconds"]), createElementVNode("div", _hoisted_3$9, [createElementVNode("label", null, toDisplayString(__props.label), 1), startDatetime.value && endDatetime.value ? (openBlock(), createElementBlock("div", _hoisted_4$9, [
2506
+ }, null, 8, ["allow-military-time", "use-seconds"]), createElementVNode("div", _hoisted_3$10, [createElementVNode("label", null, toDisplayString(__props.label), 1), startDatetime.value && endDatetime.value ? (openBlock(), createElementBlock("div", _hoisted_4$10, [
2315
2507
  _cache[0] || (_cache[0] = createElementVNode("span", { class: "aduration__label" }, "Duration:", -1)),
2316
- createElementVNode("span", _hoisted_5$8, toDisplayString(humanDuration.value), 1),
2317
- createElementVNode("span", _hoisted_6$7, "(" + toDisplayString(modelValue.value) + ")", 1)
2508
+ createElementVNode("span", _hoisted_5$9, toDisplayString(humanDuration.value), 1),
2509
+ createElementVNode("span", _hoisted_6$8, "(" + toDisplayString(modelValue.value) + ")", 1)
2318
2510
  ])) : createCommentVNode("", true)])], 64))]);
2319
2511
  };
2320
2512
  }
2321
2513
  }), [["__scopeId", "data-v-133162a6"]]);
2322
2514
  //#endregion
2323
2515
  //#region src/components/form/ADateRange.vue?vue&type=script&setup=true&lang.ts
2324
- var _hoisted_1$10 = { class: "aform_display-value" };
2325
- var _hoisted_2$9 = { class: "aform_field-label" };
2326
- var _hoisted_3$8 = [
2516
+ var _hoisted_1$15 = { class: "aform_display-value" };
2517
+ var _hoisted_2$11 = { class: "aform_field-label" };
2518
+ var _hoisted_3$9 = [
2327
2519
  "id",
2328
2520
  "aria-expanded",
2329
2521
  "aria-controls",
@@ -2332,8 +2524,8 @@ var _hoisted_3$8 = [
2332
2524
  "aria-invalid",
2333
2525
  "aria-describedby"
2334
2526
  ];
2335
- var _hoisted_4$8 = ["for"];
2336
- var _hoisted_5$7 = ["id"];
2527
+ var _hoisted_4$9 = ["for"];
2528
+ var _hoisted_5$8 = ["id"];
2337
2529
  //#endregion
2338
2530
  //#region src/components/form/ADateRange.vue
2339
2531
  var ADateRange_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -2413,7 +2605,7 @@ var ADateRange_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
2413
2605
  class: "aform_form-element",
2414
2606
  onFocusout: _cache[1] || (_cache[1] = (...args) => unref(closeWhenFocusLeaves) && unref(closeWhenFocusLeaves)(...args)),
2415
2607
  onKeydown: _cache[2] || (_cache[2] = (...args) => unref(closeOnEscape) && unref(closeOnEscape)(...args))
2416
- }, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_1$10, toDisplayString(displayValue.value), 1), createElementVNode("label", _hoisted_2$9, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2608
+ }, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_1$15, toDisplayString(displayValue.value), 1), createElementVNode("label", _hoisted_2$11, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2417
2609
  createElementVNode("input", {
2418
2610
  id: __props.uuid,
2419
2611
  ref: "box",
@@ -2431,16 +2623,16 @@ var ADateRange_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
2431
2623
  "aria-describedby": unref(describedBy),
2432
2624
  onClick: openPicker,
2433
2625
  onKeydown: _cache[0] || (_cache[0] = (...args) => unref(openFromKey) && unref(openFromKey)(...args))
2434
- }, null, 40, _hoisted_3$8),
2626
+ }, null, 40, _hoisted_3$9),
2435
2627
  createElementVNode("label", {
2436
2628
  class: "aform_field-label",
2437
2629
  for: __props.uuid
2438
- }, toDisplayString(__props.label), 9, _hoisted_4$8),
2630
+ }, toDisplayString(__props.label), 9, _hoisted_4$9),
2439
2631
  withDirectives(createElementVNode("p", {
2440
2632
  id: unref(errorId),
2441
2633
  class: "aform_error",
2442
2634
  role: "alert"
2443
- }, toDisplayString(errorText.value), 9, _hoisted_5$7), [[vShow, errorText.value]]),
2635
+ }, toDisplayString(errorText.value), 9, _hoisted_5$8), [[vShow, errorText.value]]),
2444
2636
  unref(showPicker) ? (openBlock(), createBlock(ADateSelection_default, {
2445
2637
  key: 0,
2446
2638
  id: unref(calendarId),
@@ -2458,16 +2650,16 @@ var ADateRange_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
2458
2650
  }), [["__scopeId", "data-v-ac2c160b"]]);
2459
2651
  //#endregion
2460
2652
  //#region src/components/AForm.vue?vue&type=script&setup=true&lang.ts
2461
- var _hoisted_1$9 = { class: "aform" };
2462
- var _hoisted_2$8 = {
2653
+ var _hoisted_1$14 = { class: "aform" };
2654
+ var _hoisted_2$10 = {
2463
2655
  key: 0,
2464
2656
  class: "aform-nested-section"
2465
2657
  };
2466
- var _hoisted_3$7 = {
2658
+ var _hoisted_3$8 = {
2467
2659
  key: 0,
2468
2660
  class: "aform-nested-label"
2469
2661
  };
2470
- var _hoisted_4$7 = {
2662
+ var _hoisted_4$8 = {
2471
2663
  key: 1,
2472
2664
  class: "aform-nested-section"
2473
2665
  };
@@ -2591,8 +2783,8 @@ var AForm_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
2591
2783
  const childModels = computed(() => childModelsCache.value);
2592
2784
  return (_ctx, _cache) => {
2593
2785
  const _component_AForm = resolveComponent("AForm", true);
2594
- return openBlock(), createElementBlock("form", _hoisted_1$9, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.schema, (componentObj, key) => {
2595
- return openBlock(), createElementBlock(Fragment, { key }, [isLinkSection(componentObj) ? (openBlock(), createElementBlock("div", _hoisted_2$8, [componentObj.label ? (openBlock(), createElementBlock("h4", _hoisted_3$7, toDisplayString(componentObj.label), 1)) : createCommentVNode("", true), (openBlock(), createBlock(resolveDynamicComponent(componentObj.component ?? "AForm"), {
2786
+ return openBlock(), createElementBlock("form", _hoisted_1$14, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.schema, (componentObj, key) => {
2787
+ return openBlock(), createElementBlock(Fragment, { key }, [isLinkSection(componentObj) ? (openBlock(), createElementBlock("div", _hoisted_2$10, [componentObj.label ? (openBlock(), createElementBlock("h4", _hoisted_3$8, toDisplayString(componentObj.label), 1)) : createCommentVNode("", true), (openBlock(), createBlock(resolveDynamicComponent(componentObj.component ?? "AForm"), {
2596
2788
  data: nestedData.value[componentObj.fieldname],
2597
2789
  mode: resolvedMode(componentObj),
2598
2790
  schema: componentObj.schema,
@@ -2606,7 +2798,7 @@ var AForm_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
2606
2798
  "label",
2607
2799
  "errors",
2608
2800
  "onUpdate:data"
2609
- ]))])) : isFieldsetSection(componentObj) ? (openBlock(), createElementBlock("div", _hoisted_4$7, [(openBlock(), createBlock(resolveDynamicComponent(componentObj.component ?? "AFieldset"), {
2801
+ ]))])) : isFieldsetSection(componentObj) ? (openBlock(), createElementBlock("div", _hoisted_4$8, [(openBlock(), createBlock(resolveDynamicComponent(componentObj.component ?? "AFieldset"), {
2610
2802
  data: dataModel.value,
2611
2803
  mode: resolvedMode(componentObj),
2612
2804
  schema: componentObj.schema,
@@ -2657,7 +2849,7 @@ var AForm_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
2657
2849
  }), 128))]);
2658
2850
  };
2659
2851
  }
2660
- }), [["__scopeId", "data-v-5055dffc"]]);
2852
+ }), [["__scopeId", "data-v-d4179fed"]]);
2661
2853
  //#endregion
2662
2854
  //#region src/components/base/CollapseButton.vue
2663
2855
  var CollapseButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -2718,21 +2910,21 @@ var AFieldset_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
2718
2910
  }), [["__scopeId", "data-v-8215ff87"]]);
2719
2911
  //#endregion
2720
2912
  //#region src/components/form/AFileAttach.vue?vue&type=script&setup=true&lang.ts
2721
- var _hoisted_1$8 = { class: "aform_form-element aform_file-attach aform__grid--full" };
2722
- var _hoisted_2$7 = {
2913
+ var _hoisted_1$13 = { class: "aform_form-element aform_file-attach aform__grid--full" };
2914
+ var _hoisted_2$9 = {
2723
2915
  key: 0,
2724
2916
  class: "aform_file-attach-feedback"
2725
2917
  };
2726
- var _hoisted_3$6 = {
2918
+ var _hoisted_3$7 = {
2727
2919
  key: 1,
2728
2920
  class: "aform_display-value"
2729
2921
  };
2730
- var _hoisted_4$6 = {
2922
+ var _hoisted_4$7 = {
2731
2923
  key: 0,
2732
2924
  class: "aform_file-attach-feedback"
2733
2925
  };
2734
- var _hoisted_5$6 = ["disabled"];
2735
- var _hoisted_6$6 = ["disabled"];
2926
+ var _hoisted_5$7 = ["disabled"];
2927
+ var _hoisted_6$7 = ["disabled"];
2736
2928
  //#endregion
2737
2929
  //#region src/components/form/AFileAttach.vue
2738
2930
  var AFileAttach_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -2756,32 +2948,285 @@ var AFileAttach_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
2756
2948
  });
2757
2949
  onChange((changedFiles) => changedFiles);
2758
2950
  return (_ctx, _cache) => {
2759
- return openBlock(), createElementBlock("div", _hoisted_1$8, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [unref(files) ? (openBlock(), createElementBlock("div", _hoisted_2$7, [createElementVNode("p", null, [createElementVNode("b", null, toDisplayString(fileLengthText.value), 1)]), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(files), (file) => {
2760
- return openBlock(), createElementBlock("li", { key: file.name }, toDisplayString(file.name), 1);
2761
- }), 128))])) : (openBlock(), createElementBlock("span", _hoisted_3$6, "No file selected"))], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2762
- unref(files) ? (openBlock(), createElementBlock("div", _hoisted_4$6, [createElementVNode("p", null, [_cache[2] || (_cache[2] = createTextVNode(" You have selected: ", -1)), createElementVNode("b", null, toDisplayString(fileLengthText.value), 1)]), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(files), (file) => {
2763
- return openBlock(), createElementBlock("li", { key: file.name }, toDisplayString(file.name), 1);
2764
- }), 128))])) : createCommentVNode("", true),
2765
- createElementVNode("button", {
2766
- type: "button",
2767
- class: "aform_form-btn",
2768
- disabled: __props.mode === "read",
2769
- onClick: _cache[0] || (_cache[0] = ($event) => unref(open)())
2770
- }, toDisplayString(__props.label), 9, _hoisted_5$6),
2771
- createElementVNode("button", {
2772
- type: "button",
2773
- disabled: !unref(files) || __props.mode === "read",
2774
- class: "aform_form-btn",
2775
- onClick: _cache[1] || (_cache[1] = ($event) => unref(reset)())
2776
- }, "Reset", 8, _hoisted_6$6)
2777
- ], 64))]);
2951
+ return openBlock(), createElementBlock("div", _hoisted_1$13, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [unref(files) ? (openBlock(), createElementBlock("div", _hoisted_2$9, [createElementVNode("p", null, [createElementVNode("b", null, toDisplayString(fileLengthText.value), 1)]), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(files), (file) => {
2952
+ return openBlock(), createElementBlock("li", { key: file.name }, toDisplayString(file.name), 1);
2953
+ }), 128))])) : (openBlock(), createElementBlock("span", _hoisted_3$7, "No file selected"))], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2954
+ unref(files) ? (openBlock(), createElementBlock("div", _hoisted_4$7, [createElementVNode("p", null, [_cache[2] || (_cache[2] = createTextVNode(" You have selected: ", -1)), createElementVNode("b", null, toDisplayString(fileLengthText.value), 1)]), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(files), (file) => {
2955
+ return openBlock(), createElementBlock("li", { key: file.name }, toDisplayString(file.name), 1);
2956
+ }), 128))])) : createCommentVNode("", true),
2957
+ createElementVNode("button", {
2958
+ type: "button",
2959
+ class: "aform_form-btn",
2960
+ disabled: __props.mode === "read",
2961
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(open)())
2962
+ }, toDisplayString(__props.label), 9, _hoisted_5$7),
2963
+ createElementVNode("button", {
2964
+ type: "button",
2965
+ disabled: !unref(files) || __props.mode === "read",
2966
+ class: "aform_form-btn",
2967
+ onClick: _cache[1] || (_cache[1] = ($event) => unref(reset)())
2968
+ }, "Reset", 8, _hoisted_6$7)
2969
+ ], 64))]);
2970
+ };
2971
+ }
2972
+ }), [["__scopeId", "data-v-79ce33a7"]]);
2973
+ //#endregion
2974
+ //#region src/components/form/AFormLink.vue?vue&type=script&setup=true&lang.ts
2975
+ var _hoisted_1$12 = { class: "aform_display-value" };
2976
+ var _hoisted_2$8 = {
2977
+ key: 0,
2978
+ class: "aform_field-label"
2979
+ };
2980
+ var _hoisted_3$6 = { class: "aform_form-link-wrapper" };
2981
+ var _hoisted_4$6 = { class: "input-group" };
2982
+ var _hoisted_5$6 = [
2983
+ "placeholder",
2984
+ "aria-label",
2985
+ "required",
2986
+ "aria-expanded",
2987
+ "aria-controls",
2988
+ "aria-activedescendant",
2989
+ "disabled",
2990
+ "onKeydown"
2991
+ ];
2992
+ var _hoisted_6$6 = ["onKeydown"];
2993
+ var _hoisted_7$2 = ["data-icon"];
2994
+ var _hoisted_8$2 = {
2995
+ key: 0,
2996
+ d: "M6 3.5 10.5 8 6 12.5"
2997
+ };
2998
+ var _hoisted_9$2 = {
2999
+ key: 1,
3000
+ d: "M2.5 8h11M9 3.5 13.5 8 9 12.5"
3001
+ };
3002
+ var _hoisted_10$2 = { class: "aform_form-btn-name" };
3003
+ var _hoisted_11$2 = {
3004
+ key: 0,
3005
+ class: "loading autocomplete-result"
3006
+ };
3007
+ var _hoisted_12$1 = [
3008
+ "id",
3009
+ "aria-selected",
3010
+ "onMousedown",
3011
+ "onMouseenter"
3012
+ ];
3013
+ var _hoisted_13 = {
3014
+ key: 0,
3015
+ class: "aform_field-label"
3016
+ };
3017
+ //#endregion
3018
+ //#region src/components/form/AFormLink.vue
3019
+ var AFormLink_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
3020
+ __name: "AFormLink",
3021
+ props: /*@__PURE__*/ mergeModels({
3022
+ schema: {},
3023
+ label: {},
3024
+ selectRange: { type: Boolean },
3025
+ mask: {},
3026
+ required: { type: Boolean },
3027
+ mode: {},
3028
+ uuid: {},
3029
+ validation: {},
3030
+ errors: {},
3031
+ doctype: { default: () => void 0 },
3032
+ formatter: {
3033
+ type: Function,
3034
+ default: void 0
3035
+ },
3036
+ icon: { default: "arrow-right" },
3037
+ disabled: {
3038
+ type: Boolean,
3039
+ default: false
3040
+ },
3041
+ filterFunction: {
3042
+ type: [String, Function],
3043
+ default: void 0
3044
+ },
3045
+ isAsync: {
3046
+ type: Boolean,
3047
+ default: false
3048
+ },
3049
+ embedded: {
3050
+ type: Boolean,
3051
+ default: false
3052
+ },
3053
+ placeholder: { default: () => void 0 },
3054
+ ariaLabel: { default: () => void 0 }
3055
+ }, {
3056
+ "modelValue": { default: () => ({
3057
+ id: "",
3058
+ displayText: ""
3059
+ }) },
3060
+ "modelModifiers": {}
3061
+ }),
3062
+ emits: ["update:modelValue"],
3063
+ setup(__props) {
3064
+ const listboxId = `${__props.uuid ?? `aform-link-${useId()}`}-listbox`;
3065
+ const modelValue = useModel(__props, "modelValue");
3066
+ const hasValidId = computed(() => linkId(modelValue.value) !== void 0);
3067
+ const displayedText = computed(() => {
3068
+ const id = linkId(modelValue.value);
3069
+ if (id === void 0) return "—";
3070
+ if (__props.formatter) return __props.formatter(asLinkValue(modelValue.value));
3071
+ return linkDisplayText(modelValue.value) ?? id;
3072
+ });
3073
+ const searchText = ref(hasValidId.value ? displayedText.value : "");
3074
+ const dropdownOpen = ref(false);
3075
+ const loading = ref(false);
3076
+ const dropdownResults = ref([]);
3077
+ const activeIndex = ref(null);
3078
+ const navigator = inject("aformLinkNavigator", null);
3079
+ const resolver = inject("aformLinkResolver", null);
3080
+ watch(() => linkId(modelValue.value), async (id) => {
3081
+ if (id && linkDisplayText(modelValue.value)) {
3082
+ searchText.value = displayedText.value;
3083
+ return;
3084
+ }
3085
+ if (!id) return;
3086
+ try {
3087
+ let match;
3088
+ let displayText;
3089
+ if (__props.filterFunction) {
3090
+ match = (await (typeof __props.filterFunction === "string" ? deserializeFunction(__props.filterFunction) : __props.filterFunction)(String(id))).find((r) => String(r.id) === String(id));
3091
+ displayText = match?.displayText;
3092
+ if (displayText === void 0) console.warn(`[AFormLink] filterFunction returned no matching result for id "${id}". The function must return an item whose \`id\` exactly matches the search string.`);
3093
+ } else if (resolver && __props.doctype) displayText = await resolver(__props.doctype, id.toString()) ?? void 0;
3094
+ if (displayText) {
3095
+ const resolved = {
3096
+ ...asLinkValue(modelValue.value),
3097
+ ...match,
3098
+ id,
3099
+ displayText
3100
+ };
3101
+ searchText.value = __props.formatter ? __props.formatter(resolved) : displayText;
3102
+ modelValue.value = resolved;
3103
+ }
3104
+ } catch {}
3105
+ }, { immediate: true });
3106
+ const handleNavigate = () => {
3107
+ const id = linkId(modelValue.value);
3108
+ if (navigator && __props.doctype && id !== void 0) navigator.navigate(__props.doctype, id);
3109
+ else if (navigator && !__props.doctype) console.warn("[AFormLink] Navigation requested but `doctype` prop is missing. Add `options` (or `doctype`) to the Link field definition to enable navigation.");
3110
+ };
3111
+ const isResultSelected = (option) => {
3112
+ const id = linkId(modelValue.value);
3113
+ return id !== void 0 && String(option.id) === String(id);
3114
+ };
3115
+ const openDropdown = async (text) => {
3116
+ if (!__props.filterFunction || __props.mode === "read") return;
3117
+ activeIndex.value = null;
3118
+ dropdownOpen.value = true;
3119
+ if (__props.isAsync) loading.value = true;
3120
+ try {
3121
+ const fn = typeof __props.filterFunction === "string" ? deserializeFunction(__props.filterFunction) : __props.filterFunction;
3122
+ dropdownResults.value = await fn(text) ?? [];
3123
+ } catch {
3124
+ dropdownResults.value = [];
3125
+ } finally {
3126
+ loading.value = false;
3127
+ }
3128
+ };
3129
+ const closeDropdown = () => {
3130
+ dropdownOpen.value = false;
3131
+ activeIndex.value = null;
3132
+ searchText.value = hasValidId.value ? displayedText.value : "";
3133
+ };
3134
+ const onClickOutside = () => {
3135
+ if (dropdownOpen.value) closeDropdown();
3136
+ };
3137
+ const onFocus = () => openDropdown(searchText.value);
3138
+ const onInput = () => openDropdown(searchText.value);
3139
+ const selectOption = (option) => {
3140
+ modelValue.value = option;
3141
+ searchText.value = __props.formatter ? __props.formatter(option) : option.displayText ?? String(option.id);
3142
+ dropdownOpen.value = false;
3143
+ activeIndex.value = null;
3144
+ };
3145
+ const selectNext = () => {
3146
+ const len = dropdownResults.value.length;
3147
+ if (!len) return;
3148
+ activeIndex.value = activeIndex.value === null ? 0 : (activeIndex.value + 1) % len;
3149
+ };
3150
+ const selectPrev = () => {
3151
+ if (!dropdownResults.value.length) return;
3152
+ if (activeIndex.value === null || activeIndex.value === 0) activeIndex.value = null;
3153
+ else activeIndex.value -= 1;
3154
+ };
3155
+ const selectCurrent = () => {
3156
+ if (activeIndex.value !== null && dropdownResults.value[activeIndex.value]) selectOption(dropdownResults.value[activeIndex.value]);
3157
+ };
3158
+ return (_ctx, _cache) => {
3159
+ 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$12, toDisplayString(displayedText.value), 1), __props.label && !__props.embedded ? (openBlock(), createElementBlock("label", _hoisted_2$8, toDisplayString(__props.label), 1)) : createCommentVNode("", true)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [withDirectives((openBlock(), createElementBlock("div", _hoisted_3$6, [createElementVNode("div", _hoisted_4$6, [withDirectives(createElementVNode("input", {
3160
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchText.value = $event),
3161
+ type: "text",
3162
+ role: "combobox",
3163
+ autocomplete: "off",
3164
+ "aria-autocomplete": "list",
3165
+ class: normalizeClass(["aform_input-field", { "aform_input-field--embedded": __props.embedded }]),
3166
+ placeholder: __props.placeholder,
3167
+ "aria-label": __props.ariaLabel,
3168
+ required: __props.required,
3169
+ "aria-expanded": dropdownOpen.value,
3170
+ "aria-controls": dropdownOpen.value ? listboxId : void 0,
3171
+ "aria-activedescendant": activeIndex.value === null ? void 0 : `${listboxId}-opt-${activeIndex.value}`,
3172
+ disabled: __props.disabled || __props.mode === "read",
3173
+ onInput,
3174
+ onFocus,
3175
+ onKeydown: [
3176
+ withKeys(withModifiers(selectNext, ["prevent"]), ["down"]),
3177
+ withKeys(withModifiers(selectPrev, ["prevent"]), ["up"]),
3178
+ withKeys(withModifiers(selectCurrent, ["prevent"]), ["enter"]),
3179
+ withKeys(closeDropdown, ["esc"]),
3180
+ withKeys(closeDropdown, ["tab"])
3181
+ ]
3182
+ }, null, 42, _hoisted_5$6), [[vModelText, searchText.value]]), hasValidId.value && !__props.disabled && !__props.embedded ? (openBlock(), createElementBlock("button", {
3183
+ key: 0,
3184
+ type: "button",
3185
+ class: "aform_form-btn",
3186
+ onClick: handleNavigate,
3187
+ onKeydown: withKeys(withModifiers(handleNavigate, ["prevent"]), ["enter"])
3188
+ }, [(openBlock(), createElementBlock("svg", {
3189
+ class: "aform_form-btn-icon",
3190
+ "data-icon": __props.icon,
3191
+ viewBox: "1.75 2.75 12.5 10.5",
3192
+ "aria-hidden": "true",
3193
+ focusable: "false"
3194
+ }, [__props.icon === "chevron-right" ? (openBlock(), createElementBlock("path", _hoisted_8$2)) : (openBlock(), createElementBlock("path", _hoisted_9$2))], 8, _hoisted_7$2)), createElementVNode("span", _hoisted_10$2, toDisplayString(__props.icon === "chevron-right" ? "›" : "→"), 1)], 40, _hoisted_6$6)) : createCommentVNode("", true)]), __props.mode !== "read" ? (openBlock(), createBlock(ADropdownList_default, {
3195
+ key: 0,
3196
+ "listbox-id": listboxId,
3197
+ ariaLabel: __props.ariaLabel ?? __props.label ?? "",
3198
+ open: dropdownOpen.value,
3199
+ "option-count": () => dropdownResults.value.length,
3200
+ "active-index": () => activeIndex.value
3201
+ }, {
3202
+ default: withCtx(() => [loading.value ? (openBlock(), createElementBlock("li", _hoisted_11$2, "Loading…")) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(dropdownResults.value, (option, i) => {
3203
+ return openBlock(), createElementBlock("li", {
3204
+ id: `${listboxId}-opt-${i}`,
3205
+ key: String(option.id),
3206
+ role: "option",
3207
+ "aria-selected": isResultSelected(option),
3208
+ class: normalizeClass(["autocomplete-result", {
3209
+ "is-active": i === activeIndex.value,
3210
+ "is-selected": isResultSelected(option)
3211
+ }]),
3212
+ onMousedown: withModifiers(($event) => selectOption(option), ["prevent"]),
3213
+ onMouseenter: ($event) => activeIndex.value = i
3214
+ }, [renderSlot(_ctx.$slots, "option", { option }, () => [createTextVNode(toDisplayString(option.displayText ?? String(option.id)), 1)], true)], 42, _hoisted_12$1);
3215
+ }), 128))]),
3216
+ _: 3
3217
+ }, 8, [
3218
+ "ariaLabel",
3219
+ "open",
3220
+ "option-count",
3221
+ "active-index"
3222
+ ])) : createCommentVNode("", true)])), [[unref(vOnClickOutside), onClickOutside]]), __props.label && !__props.embedded ? (openBlock(), createElementBlock("label", _hoisted_13, toDisplayString(__props.label), 1)) : createCommentVNode("", true)], 64))], 2);
2778
3223
  };
2779
3224
  }
2780
- }), [["__scopeId", "data-v-79ce33a7"]]);
3225
+ }), [["__scopeId", "data-v-e784f691"]]);
2781
3226
  //#endregion
2782
3227
  //#region src/components/form/ANumericInput.vue?vue&type=script&setup=true&lang.ts
2783
- var _hoisted_1$7 = { class: "aform_form-element" };
2784
- var _hoisted_2$6 = { class: "aform_display-value" };
3228
+ var _hoisted_1$11 = { class: "aform_form-element" };
3229
+ var _hoisted_2$7 = { class: "aform_display-value" };
2785
3230
  var _hoisted_3$5 = { class: "aform_field-label" };
2786
3231
  var _hoisted_4$5 = [
2787
3232
  "id",
@@ -2820,7 +3265,7 @@ var ANumericInput_default = /* @__PURE__ */ defineComponent({
2820
3265
  set: (value) => inputNumber.value = numberFromBox(value)
2821
3266
  });
2822
3267
  return (_ctx, _cache) => {
2823
- return openBlock(), createElementBlock("div", _hoisted_1$7, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_2$6, toDisplayString(inputNumber.value ?? ""), 1), createElementVNode("label", _hoisted_3$5, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
3268
+ return openBlock(), createElementBlock("div", _hoisted_1$11, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_2$7, toDisplayString(inputNumber.value ?? ""), 1), createElementVNode("label", _hoisted_3$5, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2824
3269
  withDirectives(createElementVNode("input", {
2825
3270
  id: __props.uuid,
2826
3271
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => boxNumber.value = $event),
@@ -2845,9 +3290,38 @@ var ANumericInput_default = /* @__PURE__ */ defineComponent({
2845
3290
  }
2846
3291
  });
2847
3292
  //#endregion
3293
+ //#region src/utils/quantityValue.ts
3294
+ /** What a quantity box may hold, typed or pasted: digits, one decimal point and a leading minus sign. */
3295
+ var quantityEntryPattern = /^-?\d*\.?\d*$/;
3296
+ var roundQty = (value) => Number(value.toFixed(6));
3297
+ function resolveQuantityConversionFactor(uom, options, current) {
3298
+ const stockUom = options.stockUom ?? current?.stockUom;
3299
+ if (!uom || uom === stockUom) return 1;
3300
+ const mapped = options.conversionFactors?.[uom];
3301
+ if (mapped !== void 0) return mapped;
3302
+ if (uom === current?.uom) return current.conversionFactor ?? 1;
3303
+ return 1;
3304
+ }
3305
+ function recomputeQuantityValue(qty, uom, options, current) {
3306
+ const conversionFactor = resolveQuantityConversionFactor(uom, options, current);
3307
+ return {
3308
+ qty,
3309
+ uom,
3310
+ conversionFactor,
3311
+ stockUom: options.stockUom ?? current?.stockUom ?? "",
3312
+ stockQty: qty === null ? null : roundQty(qty * conversionFactor)
3313
+ };
3314
+ }
3315
+ function patchQuantityQty(current, qty, options) {
3316
+ return recomputeQuantityValue(qty, current?.uom ?? "", options, current);
3317
+ }
3318
+ function patchQuantityUom(current, uom, options) {
3319
+ return recomputeQuantityValue(current?.qty ?? null, uom, options, current);
3320
+ }
3321
+ //#endregion
2848
3322
  //#region src/components/form/AQuantityInput.vue?vue&type=script&setup=true&lang.ts
2849
- var _hoisted_1$6 = { class: "aform_form-element aquantity" };
2850
- var _hoisted_2$5 = { class: "aform_display-value" };
3323
+ var _hoisted_1$10 = { class: "aform_form-element aquantity" };
3324
+ var _hoisted_2$6 = { class: "aform_display-value" };
2851
3325
  var _hoisted_3$4 = { class: "aform_field-label" };
2852
3326
  var _hoisted_4$4 = { class: "aquantity__row" };
2853
3327
  var _hoisted_5$4 = { class: "aquantity__field aquantity__field--qty" };
@@ -2860,33 +3334,9 @@ var _hoisted_7$1 = [
2860
3334
  "aria-describedby"
2861
3335
  ];
2862
3336
  var _hoisted_8$1 = { class: "aquantity__uom" };
2863
- var _hoisted_9$1 = [
2864
- "id",
2865
- "disabled",
2866
- "aria-expanded",
2867
- "aria-activedescendant",
2868
- "onKeydown"
2869
- ];
2870
- var _hoisted_10$1 = { class: "aquantity__uom-value" };
2871
- var _hoisted_11$1 = ["aria-label"];
2872
- var _hoisted_12$1 = [
2873
- "id",
2874
- "aria-selected",
2875
- "onMouseenter",
2876
- "onClick"
2877
- ];
2878
- var _hoisted_13 = ["for"];
2879
- var _hoisted_14 = { class: "aquantity__row aquantity__row--stock" };
2880
- var _hoisted_15 = { class: "aquantity__field aquantity__field--stock-uom" };
2881
- var _hoisted_16 = ["value"];
2882
- var _hoisted_17 = { class: "aform_field-label" };
2883
- var _hoisted_18 = { class: "aquantity__field aquantity__field--stock-qty" };
2884
- var _hoisted_19 = ["value"];
2885
- var _hoisted_20 = { class: "aform_field-label" };
2886
- var _hoisted_21 = { class: "aquantity__field aquantity__field--conversion" };
2887
- var _hoisted_22 = ["value"];
2888
- var _hoisted_23 = { class: "aform_field-label" };
2889
- var _hoisted_24 = ["id"];
3337
+ var _hoisted_9$1 = ["for"];
3338
+ var _hoisted_10$1 = ["id"];
3339
+ var _hoisted_11$1 = ["id"];
2890
3340
  //#endregion
2891
3341
  //#region src/components/form/AQuantityInput.vue
2892
3342
  var AQuantityInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -2902,10 +3352,7 @@ var AQuantityInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
2902
3352
  validation: { default: () => ({ errorMessage: "" }) },
2903
3353
  errors: {},
2904
3354
  options: { default: () => ({}) },
2905
- uomLabel: { default: "UOM" },
2906
- stockUomLabel: { default: "Stock UOM" },
2907
- stockQtyLabel: { default: "Stock Qty" },
2908
- conversionFactorLabel: { default: "Conversion Factor" }
3355
+ uomLabel: { default: "UOM" }
2909
3356
  }, {
2910
3357
  "modelValue": {},
2911
3358
  "modelModifiers": {}
@@ -2913,35 +3360,18 @@ var AQuantityInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
2913
3360
  emits: ["update:modelValue"],
2914
3361
  setup(__props) {
2915
3362
  const errorText = computed(() => __props.errors?.length ? __props.errors.join("; ") : __props.validation.errorMessage ?? "");
2916
- const { errorId, describedBy, invalid } = fieldErrorA11y(__props.uuid, errorText);
3363
+ const helperId = computed(() => __props.uuid ? `${__props.uuid}-helper` : void 0);
3364
+ const helperDescribedBy = computed(() => showStock.value && !errorText.value ? helperId.value : void 0);
3365
+ const { errorId, describedBy, invalid } = fieldErrorA11y(__props.uuid, errorText, helperDescribedBy);
2917
3366
  const modelValue = useModel(__props, "modelValue");
2918
3367
  const uoms = computed(() => __props.options.uoms ?? []);
2919
- const roundQty = (value) => Number(value.toFixed(6));
2920
- const resolveConversionFactor = (uom) => {
2921
- const stockUom = __props.options.stockUom ?? modelValue.value?.stockUom;
2922
- if (!uom || uom === stockUom) return 1;
2923
- const mapped = __props.options.conversionFactors?.[uom];
2924
- if (mapped !== void 0) return mapped;
2925
- if (uom === modelValue.value?.uom) return modelValue.value.conversionFactor ?? 1;
2926
- return 1;
2927
- };
2928
- const recompute = (qty, uom) => {
2929
- const conversionFactor = resolveConversionFactor(uom);
2930
- modelValue.value = {
2931
- qty,
2932
- uom,
2933
- conversionFactor,
2934
- stockUom: __props.options.stockUom ?? modelValue.value?.stockUom ?? "",
2935
- stockQty: qty === null ? null : roundQty(qty * conversionFactor)
2936
- };
2937
- };
2938
3368
  const qty = computed({
2939
3369
  get: () => modelValue.value?.qty ?? null,
2940
- set: (value) => recompute(numberFromBox(value), modelValue.value?.uom ?? "")
3370
+ set: (value) => modelValue.value = patchQuantityQty(modelValue.value, numberFromBox(value), __props.options)
2941
3371
  });
2942
3372
  const uom = computed({
2943
3373
  get: () => modelValue.value?.uom ?? "",
2944
- set: (value) => recompute(modelValue.value?.qty ?? null, value)
3374
+ set: (value) => modelValue.value = patchQuantityUom(modelValue.value, value, __props.options)
2945
3375
  });
2946
3376
  const qtyNavigationKeys = /* @__PURE__ */ new Set([
2947
3377
  "Backspace",
@@ -2962,57 +3392,23 @@ var AQuantityInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
2962
3392
  if (/^[0-9]$/.test(event.key)) return;
2963
3393
  const input = event.target;
2964
3394
  if (event.key === "." && !input.value.includes(".")) return;
3395
+ if (event.key === "-" && !input.value.includes("-")) return;
2965
3396
  event.preventDefault();
2966
3397
  };
2967
3398
  const onQtyPaste = (event) => {
2968
3399
  const pasted = event.clipboardData?.getData("text") ?? "";
2969
- if (!/^\d*\.?\d*$/.test(pasted)) event.preventDefault();
2970
- };
2971
- const dropdown = reactive({
2972
- open: false,
2973
- activeIndex: -1
2974
- });
2975
- fitDropdownList(useTemplateRef("uomMenu"), {
2976
- isOpen: () => dropdown.open,
2977
- optionCount: () => uoms.value.length,
2978
- activeIndex: () => dropdown.activeIndex
2979
- });
2980
- const openDropdown = () => {
2981
- dropdown.activeIndex = Math.max(uoms.value.indexOf(uom.value), 0);
2982
- dropdown.open = true;
2983
- };
2984
- const closeDropdown = () => {
2985
- dropdown.open = false;
2986
- };
2987
- const toggleDropdown = () => {
2988
- if (dropdown.open) closeDropdown();
2989
- else openDropdown();
2990
- };
2991
- const selectUom = (value) => {
2992
- uom.value = value;
2993
- closeDropdown();
2994
- };
2995
- const moveActive = (delta) => {
2996
- if (!dropdown.open) {
2997
- openDropdown();
2998
- return;
2999
- }
3000
- const length = uoms.value.length;
3001
- if (!length) return;
3002
- dropdown.activeIndex = (dropdown.activeIndex + delta + length) % length;
3003
- };
3004
- const selectActive = () => {
3005
- if (!dropdown.open) {
3006
- openDropdown();
3007
- return;
3008
- }
3009
- const option = uoms.value[dropdown.activeIndex];
3010
- if (option !== void 0) selectUom(option);
3400
+ if (!quantityEntryPattern.test(pasted)) event.preventDefault();
3011
3401
  };
3012
3402
  const showStock = computed(() => {
3013
3403
  const v = modelValue.value;
3014
3404
  return !!v?.stockUom && (v.uom !== v.stockUom || v.qty !== v.stockQty);
3015
3405
  });
3406
+ const conversionHelperText = computed(() => {
3407
+ const v = modelValue.value;
3408
+ if (!v || v.stockQty === null || v.qty === null) return "";
3409
+ const factor = v.conversionFactor;
3410
+ return `= ${v.stockQty} ${v.stockUom} · 1 ${v.uom} = ${factor} ${v.stockUom}`;
3411
+ });
3016
3412
  const displayText = computed(() => {
3017
3413
  const v = modelValue.value;
3018
3414
  if (!v || !v.uom || v.qty === null) return "—";
@@ -3020,7 +3416,7 @@ var AQuantityInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
3020
3416
  return showStock.value ? `${base} (${v.stockQty} ${v.stockUom})` : base;
3021
3417
  });
3022
3418
  return (_ctx, _cache) => {
3023
- return openBlock(), createElementBlock("div", _hoisted_1$6, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_2$5, toDisplayString(displayText.value), 1), createElementVNode("label", _hoisted_3$4, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
3419
+ return openBlock(), createElementBlock("div", _hoisted_1$10, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_2$6, toDisplayString(displayText.value), 1), createElementVNode("label", _hoisted_3$4, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
3024
3420
  createElementVNode("div", _hoisted_4$4, [createElementVNode("div", _hoisted_5$4, [createElementVNode("div", _hoisted_6$4, [
3025
3421
  withDirectives(createElementVNode("input", {
3026
3422
  id: __props.uuid,
@@ -3039,78 +3435,48 @@ var AQuantityInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
3039
3435
  void 0,
3040
3436
  { number: true }
3041
3437
  ]]),
3042
- withDirectives((openBlock(), createElementBlock("div", _hoisted_8$1, [createElementVNode("button", {
3043
- id: `${__props.uuid}-uom`,
3044
- type: "button",
3045
- class: "aquantity__uom-toggle",
3046
- disabled: __props.mode === "read",
3047
- "aria-haspopup": "listbox",
3048
- "aria-expanded": dropdown.open,
3049
- "aria-activedescendant": dropdown.open && dropdown.activeIndex >= 0 ? `${__props.uuid}-uom-opt-${dropdown.activeIndex}` : void 0,
3050
- onClick: toggleDropdown,
3051
- onKeydown: [
3052
- _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => moveActive(1), ["prevent"]), ["down"])),
3053
- _cache[2] || (_cache[2] = withKeys(withModifiers(($event) => moveActive(-1), ["prevent"]), ["up"])),
3054
- withKeys(withModifiers(selectActive, ["prevent"]), ["enter"]),
3055
- withKeys(closeDropdown, ["esc"])
3056
- ]
3057
- }, [createElementVNode("span", _hoisted_10$1, toDisplayString(uom.value || __props.uomLabel), 1), _cache[3] || (_cache[3] = createElementVNode("span", {
3058
- class: "aquantity__caret",
3059
- "aria-hidden": "true"
3060
- }, null, -1))], 40, _hoisted_9$1), withDirectives(createElementVNode("ul", {
3061
- ref: "uomMenu",
3062
- class: "aquantity__uom-menu",
3063
- role: "listbox",
3064
- "aria-label": __props.uomLabel
3065
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(uoms.value, (option, i) => {
3066
- return openBlock(), createElementBlock("li", {
3067
- id: `${__props.uuid}-uom-opt-${i}`,
3068
- key: option,
3069
- role: "option",
3070
- "aria-selected": option === uom.value,
3071
- class: normalizeClass(["aquantity__uom-option", { "is-active": i === dropdown.activeIndex }]),
3072
- onMouseenter: ($event) => dropdown.activeIndex = i,
3073
- onClick: ($event) => selectUom(option)
3074
- }, toDisplayString(option), 43, _hoisted_12$1);
3075
- }), 128))], 8, _hoisted_11$1), [[vShow, dropdown.open]])])), [[unref(vOnClickOutside), closeDropdown]]),
3438
+ createElementVNode("div", _hoisted_8$1, [createVNode(ADropdown_default, {
3439
+ modelValue: uom.value,
3440
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => uom.value = $event),
3441
+ embedded: "",
3442
+ trigger: "button",
3443
+ "list-anchor": "group",
3444
+ options: uoms.value,
3445
+ mode: __props.mode,
3446
+ uuid: __props.uuid ? `${__props.uuid}-uom` : void 0,
3447
+ "aria-label": __props.uomLabel,
3448
+ placeholder: __props.uomLabel
3449
+ }, null, 8, [
3450
+ "modelValue",
3451
+ "options",
3452
+ "mode",
3453
+ "uuid",
3454
+ "aria-label",
3455
+ "placeholder"
3456
+ ])]),
3076
3457
  createElementVNode("label", {
3077
3458
  class: "aform_field-label",
3078
3459
  for: __props.uuid
3079
- }, toDisplayString(__props.label), 9, _hoisted_13)
3460
+ }, toDisplayString(__props.label), 9, _hoisted_9$1)
3080
3461
  ])])]),
3081
- createElementVNode("div", _hoisted_14, [
3082
- createElementVNode("div", _hoisted_15, [createElementVNode("input", {
3083
- value: modelValue.value?.stockUom,
3084
- class: "aform_input-field aquantity__stock-field",
3085
- type: "text",
3086
- disabled: ""
3087
- }, null, 8, _hoisted_16), createElementVNode("label", _hoisted_17, toDisplayString(__props.stockUomLabel), 1)]),
3088
- createElementVNode("div", _hoisted_18, [createElementVNode("input", {
3089
- value: modelValue.value?.stockQty,
3090
- class: "aform_input-field aquantity__stock-field",
3091
- type: "number",
3092
- disabled: ""
3093
- }, null, 8, _hoisted_19), createElementVNode("label", _hoisted_20, toDisplayString(__props.stockQtyLabel), 1)]),
3094
- createElementVNode("div", _hoisted_21, [createElementVNode("input", {
3095
- value: modelValue.value?.conversionFactor,
3096
- class: "aform_input-field aquantity__stock-field",
3097
- type: "number",
3098
- disabled: ""
3099
- }, null, 8, _hoisted_22), createElementVNode("label", _hoisted_23, toDisplayString(__props.conversionFactorLabel), 1)])
3100
- ]),
3462
+ showStock.value && !errorText.value ? (openBlock(), createElementBlock("p", {
3463
+ key: 0,
3464
+ id: helperId.value,
3465
+ class: "aquantity__helper"
3466
+ }, toDisplayString(conversionHelperText.value), 9, _hoisted_10$1)) : createCommentVNode("", true),
3101
3467
  withDirectives(createElementVNode("p", {
3102
3468
  id: unref(errorId),
3103
3469
  class: "aform_error",
3104
3470
  role: "alert"
3105
- }, toDisplayString(errorText.value), 9, _hoisted_24), [[vShow, errorText.value]])
3471
+ }, toDisplayString(errorText.value), 9, _hoisted_11$1), [[vShow, errorText.value]])
3106
3472
  ], 64))]);
3107
3473
  };
3108
3474
  }
3109
- }), [["__scopeId", "data-v-88f44f99"]]);
3475
+ }), [["__scopeId", "data-v-3d289084"]]);
3110
3476
  //#endregion
3111
3477
  //#region src/components/form/ASemverInput.vue?vue&type=script&setup=true&lang.ts
3112
- var _hoisted_1$5 = { class: "aform_form-element" };
3113
- var _hoisted_2$4 = { class: "aform_display-value" };
3478
+ var _hoisted_1$9 = { class: "aform_form-element" };
3479
+ var _hoisted_2$5 = { class: "aform_display-value" };
3114
3480
  var _hoisted_3$3 = { class: "aform_field-label" };
3115
3481
  var _hoisted_4$3 = [
3116
3482
  "id",
@@ -3163,7 +3529,7 @@ var ASemverInput_default = /* @__PURE__ */ defineComponent({
3163
3529
  if (next !== (version.value ?? null)) version.value = next;
3164
3530
  };
3165
3531
  return (_ctx, _cache) => {
3166
- return openBlock(), createElementBlock("div", _hoisted_1$5, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_2$4, toDisplayString(version.value ?? ""), 1), createElementVNode("label", _hoisted_3$3, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
3532
+ return openBlock(), createElementBlock("div", _hoisted_1$9, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_2$5, toDisplayString(version.value ?? ""), 1), createElementVNode("label", _hoisted_3$3, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
3167
3533
  createElementVNode("input", {
3168
3534
  id: __props.uuid,
3169
3535
  value: text.value,
@@ -3280,8 +3646,8 @@ function useStringMask(el, binding) {
3280
3646
  }
3281
3647
  //#endregion
3282
3648
  //#region src/components/form/ATextInput.vue?vue&type=script&setup=true&lang.ts
3283
- var _hoisted_1$4 = { class: "aform_form-element" };
3284
- var _hoisted_2$3 = { class: "aform_display-value" };
3649
+ var _hoisted_1$8 = { class: "aform_form-element" };
3650
+ var _hoisted_2$4 = { class: "aform_display-value" };
3285
3651
  var _hoisted_3$2 = { class: "aform_field-label" };
3286
3652
  var _hoisted_4$2 = [
3287
3653
  "id",
@@ -3318,7 +3684,7 @@ var ATextInput_default = /* @__PURE__ */ defineComponent({
3318
3684
  const maskFilled = ref(true);
3319
3685
  const inputText = useModel(__props, "modelValue");
3320
3686
  return (_ctx, _cache) => {
3321
- return openBlock(), createElementBlock("div", _hoisted_1$4, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_2$3, toDisplayString(inputText.value ?? ""), 1), createElementVNode("label", _hoisted_3$2, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
3687
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_2$4, toDisplayString(inputText.value ?? ""), 1), createElementVNode("label", _hoisted_3$2, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
3322
3688
  withDirectives(createElementVNode("input", {
3323
3689
  id: __props.uuid,
3324
3690
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputText.value = $event),
@@ -3344,8 +3710,8 @@ var ATextInput_default = /* @__PURE__ */ defineComponent({
3344
3710
  });
3345
3711
  //#endregion
3346
3712
  //#region src/components/form/ATextboxInput.vue?vue&type=script&setup=true&lang.ts
3347
- var _hoisted_1$3 = { class: "aform_form-element" };
3348
- var _hoisted_2$2 = { class: "aform_display-value aform_textbox-display" };
3713
+ var _hoisted_1$7 = { class: "aform_form-element" };
3714
+ var _hoisted_2$3 = { class: "aform_display-value aform_textbox-display" };
3349
3715
  var _hoisted_3$1 = { class: "aform_field-label" };
3350
3716
  var _hoisted_4$1 = [
3351
3717
  "id",
@@ -3386,7 +3752,7 @@ var ATextboxInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @
3386
3752
  const { errorId, describedBy, invalid } = fieldErrorA11y(__props.uuid, errorText);
3387
3753
  const inputText = useModel(__props, "modelValue");
3388
3754
  return (_ctx, _cache) => {
3389
- return openBlock(), createElementBlock("div", _hoisted_1$3, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_2$2, toDisplayString(inputText.value ?? ""), 1), createElementVNode("label", _hoisted_3$1, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
3755
+ return openBlock(), createElementBlock("div", _hoisted_1$7, [__props.mode === "display" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_2$3, toDisplayString(inputText.value ?? ""), 1), createElementVNode("label", _hoisted_3$1, toDisplayString(__props.label), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
3390
3756
  withDirectives(createElementVNode("textarea", {
3391
3757
  id: __props.uuid,
3392
3758
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputText.value = $event),
@@ -3414,8 +3780,8 @@ var ATextboxInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @
3414
3780
  }), [["__scopeId", "data-v-19e611fa"]]);
3415
3781
  //#endregion
3416
3782
  //#region src/components/utilities/Login.vue?vue&type=script&setup=true&lang.ts
3417
- var _hoisted_1$2 = { class: "login-container" };
3418
- var _hoisted_2$1 = { class: "account-container" };
3783
+ var _hoisted_1$6 = { class: "login-container" };
3784
+ var _hoisted_2$2 = { class: "account-container" };
3419
3785
  var _hoisted_3 = { class: "account-header" };
3420
3786
  var _hoisted_4 = { id: "account-title" };
3421
3787
  var _hoisted_5 = { id: "account-subtitle" };
@@ -3456,7 +3822,7 @@ var Login_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
3456
3822
  emit("loginSuccess");
3457
3823
  }
3458
3824
  return (_ctx, _cache) => {
3459
- return openBlock(), createElementBlock("div", _hoisted_1$2, [createElementVNode("div", null, [createElementVNode("div", _hoisted_2$1, [
3825
+ return openBlock(), createElementBlock("div", _hoisted_1$6, [createElementVNode("div", null, [createElementVNode("div", _hoisted_2$2, [
3460
3826
  createElementVNode("div", _hoisted_3, [createElementVNode("h1", _hoisted_4, toDisplayString(__props.headerTitle), 1), createElementVNode("p", _hoisted_5, toDisplayString(__props.headerSubtitle), 1)]),
3461
3827
  createElementVNode("form", { onSubmit }, [createElementVNode("div", _hoisted_6, [
3462
3828
  createElementVNode("div", _hoisted_7, [_cache[2] || (_cache[2] = createElementVNode("label", {
@@ -3505,15 +3871,15 @@ var Login_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
3505
3871
  //#endregion
3506
3872
  //#region src/components/AFormLoading.vue
3507
3873
  var _sfc_main = {};
3508
- var _hoisted_1$1 = { class: "aform-loading" };
3509
- var _hoisted_2 = { class: "aform-loading__label" };
3874
+ var _hoisted_1$5 = { class: "aform-loading" };
3875
+ var _hoisted_2$1 = { class: "aform-loading__label" };
3510
3876
  function _sfc_render(_ctx, _cache) {
3511
- return openBlock(), createElementBlock("div", _hoisted_1$1, [createElementVNode("div", _hoisted_2, [renderSlot(_ctx.$slots, "default", {}, void 0, true)]), _cache[0] || (_cache[0] = createElementVNode("div", { class: "aform-loading__bar" }, null, -1))]);
3877
+ return openBlock(), createElementBlock("div", _hoisted_1$5, [createElementVNode("div", _hoisted_2$1, [renderSlot(_ctx.$slots, "default", {}, void 0, true)]), _cache[0] || (_cache[0] = createElementVNode("div", { class: "aform-loading__bar" }, null, -1))]);
3512
3878
  }
3513
3879
  var AFormLoading_default = /*#__PURE__*/ _plugin_vue_export_helper_default(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-a8ae13b2"]]);
3514
3880
  //#endregion
3515
3881
  //#region src/components/base/ExpandButton.vue?vue&type=script&setup=true&lang.ts
3516
- var _hoisted_1 = ["aria-expanded", "aria-label"];
3882
+ var _hoisted_1$4 = ["aria-expanded", "aria-label"];
3517
3883
  //#endregion
3518
3884
  //#region src/components/base/ExpandButton.vue
3519
3885
  var ExpandButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -3526,11 +3892,524 @@ var ExpandButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
3526
3892
  class: "expansion-index",
3527
3893
  "aria-expanded": __props.expanded,
3528
3894
  "aria-label": __props.expanded ? "Collapse" : "Expand"
3529
- }, toDisplayString(__props.expanded ? "▼" : "►"), 9, _hoisted_1);
3895
+ }, toDisplayString(__props.expanded ? "▼" : "►"), 9, _hoisted_1$4);
3530
3896
  };
3531
3897
  }
3532
3898
  }), [["__scopeId", "data-v-5ed76a08"]]);
3533
3899
  //#endregion
3900
+ //#region src/composables/useTableModalDropdownList.ts
3901
+ /** Keyboard nav + focus for {@link ADropdownList} hosted in {@link ATableModal}. */
3902
+ function useTableModalDropdownList(options) {
3903
+ const activeIndex = ref(null);
3904
+ const focusPanel = () => {
3905
+ nextTick(() => options.panelRef.value?.focus());
3906
+ };
3907
+ watch(() => options.isOpen(), (open) => {
3908
+ if (open) {
3909
+ activeIndex.value = null;
3910
+ focusPanel();
3911
+ }
3912
+ });
3913
+ onMounted(() => {
3914
+ if (options.isOpen()) focusPanel();
3915
+ });
3916
+ const onKeydown = (event) => {
3917
+ if (event.key === "Escape") {
3918
+ event.preventDefault();
3919
+ event.stopPropagation();
3920
+ options.onClose();
3921
+ return;
3922
+ }
3923
+ const count = options.optionCount();
3924
+ if (!count) return;
3925
+ if (event.key === "ArrowDown") {
3926
+ event.preventDefault();
3927
+ event.stopPropagation();
3928
+ if (activeIndex.value != null) activeIndex.value = (activeIndex.value + 1) % count;
3929
+ else activeIndex.value = 0;
3930
+ return;
3931
+ }
3932
+ if (event.key === "ArrowUp") {
3933
+ event.preventDefault();
3934
+ event.stopPropagation();
3935
+ if (activeIndex.value != null) activeIndex.value = activeIndex.value === 0 ? Math.max(count - 1, 0) : activeIndex.value - 1;
3936
+ else activeIndex.value = Math.max(count - 1, 0);
3937
+ return;
3938
+ }
3939
+ if (event.key === "Enter") {
3940
+ event.preventDefault();
3941
+ event.stopPropagation();
3942
+ const index = activeIndex.value ?? 0;
3943
+ if (index >= 0 && index < count) options.selectAt(index);
3944
+ return;
3945
+ }
3946
+ };
3947
+ const onClickOutside = () => {
3948
+ options.onClose();
3949
+ };
3950
+ const onFocusOut = (event) => {
3951
+ if (event.relatedTarget instanceof Node && options.panelRef.value?.contains(event.relatedTarget)) return;
3952
+ options.onClose();
3953
+ };
3954
+ return {
3955
+ activeIndex,
3956
+ onKeydown,
3957
+ onClickOutside,
3958
+ onFocusOut,
3959
+ focusPanel
3960
+ };
3961
+ }
3962
+ //#endregion
3963
+ //#region src/components/table/ATableTupleCurrencyPicker.vue?vue&type=script&setup=true&lang.ts
3964
+ var _hoisted_1$3 = {
3965
+ key: 0,
3966
+ class: "loading autocomplete-result"
3967
+ };
3968
+ var _hoisted_2 = [
3969
+ "id",
3970
+ "aria-selected",
3971
+ "onMousedown"
3972
+ ];
3973
+ //#endregion
3974
+ //#region src/components/table/ATableTupleCurrencyPicker.vue
3975
+ var ATableTupleCurrencyPicker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
3976
+ __name: "ATableTupleCurrencyPicker",
3977
+ props: { store: {} },
3978
+ setup(__props) {
3979
+ const panelRef = useTemplateRef("panelRef");
3980
+ const loading = ref(false);
3981
+ const currencyOptions = ref([]);
3982
+ const open = computed(() => !!__props.store.modal.visible && __props.store.modal.component === TABLE_TUPLE_CURRENCY_PICKER);
3983
+ const colIndex = computed(() => __props.store.modal.colIndex ?? 0);
3984
+ const rowIndex = computed(() => __props.store.modal.rowIndex ?? 0);
3985
+ const column = computed(() => __props.store.columns[colIndex.value]);
3986
+ const currencyFieldOptions = computed(() => column.value?.options ?? {});
3987
+ const cellValue = computed(() => __props.store.getCellData(colIndex.value, rowIndex.value));
3988
+ const listboxId = computed(() => `atable-tuple-cur-${rowIndex.value}-${colIndex.value}`);
3989
+ const isSelected = (option) => String(option.id) === String(cellValue.value?.currency?.id);
3990
+ const loadCurrencyOptions = async () => {
3991
+ const opts = currencyFieldOptions.value;
3992
+ const filterFunction = opts.filterFunction;
3993
+ if (filterFunction) {
3994
+ loading.value = true;
3995
+ try {
3996
+ const fn = typeof filterFunction === "string" ? deserializeFunction(filterFunction) : filterFunction;
3997
+ currencyOptions.value = await fn("") ?? [];
3998
+ } catch {
3999
+ currencyOptions.value = [];
4000
+ } finally {
4001
+ loading.value = false;
4002
+ }
4003
+ return;
4004
+ }
4005
+ currencyOptions.value = staticCurrencyChoices(opts, cellValue.value);
4006
+ };
4007
+ watch(open, (visible) => {
4008
+ if (visible) loadCurrencyOptions();
4009
+ });
4010
+ onMounted(() => {
4011
+ if (open.value) loadCurrencyOptions();
4012
+ });
4013
+ const optionCount = () => loading.value ? 0 : currencyOptions.value.length;
4014
+ const closePicker = () => __props.store.closeTuplePicker();
4015
+ const selectCurrency = (option) => {
4016
+ const opts = currencyFieldOptions.value;
4017
+ const base = normalizeBaseCurrency(opts, cellValue.value);
4018
+ __props.store.setCellData(colIndex.value, rowIndex.value, patchCurrencyCurrency(cellValue.value, option, opts, base));
4019
+ closePicker();
4020
+ };
4021
+ const { activeIndex, onKeydown, onClickOutside, onFocusOut } = useTableModalDropdownList({
4022
+ panelRef,
4023
+ isOpen: () => open.value,
4024
+ optionCount,
4025
+ selectAt: (index) => {
4026
+ const option = currencyOptions.value[index];
4027
+ if (option !== void 0) selectCurrency(option);
4028
+ },
4029
+ onClose: closePicker
4030
+ });
4031
+ return (_ctx, _cache) => {
4032
+ return open.value ? withDirectives((openBlock(), createElementBlock("div", {
4033
+ key: 0,
4034
+ ref_key: "panelRef",
4035
+ ref: panelRef,
4036
+ class: "atable-tuple-picker-modal",
4037
+ tabindex: "-1",
4038
+ onKeydown: _cache[0] || (_cache[0] = (...args) => unref(onKeydown) && unref(onKeydown)(...args)),
4039
+ onFocusout: _cache[1] || (_cache[1] = (...args) => unref(onFocusOut) && unref(onFocusOut)(...args))
4040
+ }, [createVNode(ADropdownList_default, {
4041
+ "listbox-id": listboxId.value,
4042
+ ariaLabel: "Currency",
4043
+ open: true,
4044
+ surface: "cell-modal",
4045
+ "option-count": optionCount,
4046
+ "active-index": () => unref(activeIndex)
4047
+ }, {
4048
+ default: withCtx(() => [loading.value ? (openBlock(), createElementBlock("li", _hoisted_1$3, "Loading…")) : !loading.value ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(currencyOptions.value, (option, i) => {
4049
+ return openBlock(), createElementBlock("li", {
4050
+ id: `${listboxId.value}-opt-${i}`,
4051
+ key: String(option.id),
4052
+ role: "option",
4053
+ "aria-selected": isSelected(option),
4054
+ class: normalizeClass(["autocomplete-result", {
4055
+ "is-active": i === unref(activeIndex),
4056
+ "is-selected": isSelected(option)
4057
+ }]),
4058
+ onMousedown: withModifiers(($event) => selectCurrency(option), ["prevent"])
4059
+ }, toDisplayString(option.symbol ? `${option.symbol} — ` : "") + toDisplayString(option.displayText ?? option.id), 43, _hoisted_2);
4060
+ }), 128)) : createCommentVNode("", true)]),
4061
+ _: 1
4062
+ }, 8, ["listbox-id", "active-index"])], 32)), [[unref(vOnClickOutside), unref(onClickOutside)]]) : createCommentVNode("", true);
4063
+ };
4064
+ }
4065
+ }), [["__scopeId", "data-v-e17b3eb6"]]);
4066
+ //#endregion
4067
+ //#region src/components/table/ATableTupleQuantityPicker.vue?vue&type=script&setup=true&lang.ts
4068
+ var _hoisted_1$2 = [
4069
+ "id",
4070
+ "aria-selected",
4071
+ "onMousedown"
4072
+ ];
4073
+ //#endregion
4074
+ //#region src/components/table/ATableTupleQuantityPicker.vue
4075
+ var ATableTupleQuantityPicker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
4076
+ __name: "ATableTupleQuantityPicker",
4077
+ props: { store: {} },
4078
+ setup(__props) {
4079
+ const panelRef = useTemplateRef("panelRef");
4080
+ const open = computed(() => !!__props.store.modal.visible && __props.store.modal.component === TABLE_TUPLE_QUANTITY_PICKER);
4081
+ const colIndex = computed(() => __props.store.modal.colIndex ?? 0);
4082
+ const rowIndex = computed(() => __props.store.modal.rowIndex ?? 0);
4083
+ const column = computed(() => __props.store.columns[colIndex.value]);
4084
+ const uomOptions = computed(() => (column.value?.options)?.uoms ?? []);
4085
+ const cellValue = computed(() => __props.store.getCellData(colIndex.value, rowIndex.value));
4086
+ const selectedUom = computed(() => cellValue.value?.uom ?? "");
4087
+ const listboxId = computed(() => `atable-tuple-qty-${rowIndex.value}-${colIndex.value}`);
4088
+ const optionCount = () => uomOptions.value.length;
4089
+ const closePicker = () => __props.store.closeTuplePicker();
4090
+ const selectUom = (uom) => {
4091
+ const options = column.value?.options ?? {};
4092
+ __props.store.setCellData(colIndex.value, rowIndex.value, patchQuantityUom(cellValue.value, uom, options));
4093
+ closePicker();
4094
+ };
4095
+ const { activeIndex, onKeydown, onClickOutside, onFocusOut } = useTableModalDropdownList({
4096
+ panelRef,
4097
+ isOpen: () => open.value,
4098
+ optionCount,
4099
+ selectAt: (index) => {
4100
+ const uom = uomOptions.value[index];
4101
+ if (uom !== void 0) selectUom(uom);
4102
+ },
4103
+ onClose: closePicker
4104
+ });
4105
+ return (_ctx, _cache) => {
4106
+ return open.value ? withDirectives((openBlock(), createElementBlock("div", {
4107
+ key: 0,
4108
+ ref_key: "panelRef",
4109
+ ref: panelRef,
4110
+ class: "atable-tuple-picker-modal",
4111
+ tabindex: "-1",
4112
+ onKeydown: _cache[0] || (_cache[0] = (...args) => unref(onKeydown) && unref(onKeydown)(...args)),
4113
+ onFocusout: _cache[1] || (_cache[1] = (...args) => unref(onFocusOut) && unref(onFocusOut)(...args))
4114
+ }, [createVNode(ADropdownList_default, {
4115
+ "listbox-id": listboxId.value,
4116
+ ariaLabel: "Unit of measure",
4117
+ open: true,
4118
+ surface: "cell-modal",
4119
+ "option-count": optionCount,
4120
+ "active-index": () => unref(activeIndex)
4121
+ }, {
4122
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(uomOptions.value, (uom, i) => {
4123
+ return openBlock(), createElementBlock("li", {
4124
+ id: `${listboxId.value}-opt-${i}`,
4125
+ key: uom,
4126
+ role: "option",
4127
+ "aria-selected": uom === selectedUom.value,
4128
+ class: normalizeClass(["autocomplete-result", {
4129
+ "is-active": i === unref(activeIndex),
4130
+ "is-selected": uom === selectedUom.value
4131
+ }]),
4132
+ onMousedown: withModifiers(($event) => selectUom(uom), ["prevent"])
4133
+ }, toDisplayString(uom), 43, _hoisted_1$2);
4134
+ }), 128))]),
4135
+ _: 1
4136
+ }, 8, ["listbox-id", "active-index"])], 32)), [[unref(vOnClickOutside), unref(onClickOutside)]]) : createCommentVNode("", true);
4137
+ };
4138
+ }
4139
+ }), [["__scopeId", "data-v-f573d68f"]]);
4140
+ //#endregion
4141
+ //#region src/components/table/ATupleCellShell.vue?vue&type=script&setup=true&lang.ts
4142
+ var _hoisted_1$1 = [
4143
+ "aria-label",
4144
+ "aria-expanded",
4145
+ "aria-hidden"
4146
+ ];
4147
+ //#endregion
4148
+ //#region src/components/table/ATupleCellShell.vue
4149
+ var ATupleCellShell_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
4150
+ __name: "ATupleCellShell",
4151
+ props: {
4152
+ active: { type: Boolean },
4153
+ displayText: {},
4154
+ pickerLabel: {},
4155
+ pickerOpen: { type: Boolean }
4156
+ },
4157
+ emits: ["open-picker"],
4158
+ setup(__props, { emit: __emit }) {
4159
+ const emit = __emit;
4160
+ return (_ctx, _cache) => {
4161
+ return openBlock(), createElementBlock("div", { class: normalizeClass(["atable-tuple-shell", { "atable-tuple-shell--active": __props.active }]) }, [
4162
+ createElementVNode("button", {
4163
+ type: "button",
4164
+ class: normalizeClass(["atable-tuple-shell__handle", { "atable-tuple-shell__handle--visible": __props.active }]),
4165
+ tabindex: "-1",
4166
+ "aria-label": __props.pickerLabel,
4167
+ "aria-haspopup": "listbox",
4168
+ "aria-expanded": __props.pickerOpen,
4169
+ "aria-hidden": !__props.active,
4170
+ onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"])),
4171
+ onClick: _cache[1] || (_cache[1] = withModifiers(($event) => emit("open-picker"), ["stop"]))
4172
+ }, [..._cache[2] || (_cache[2] = [createElementVNode("span", {
4173
+ class: "atable-tuple-shell__caret",
4174
+ "aria-hidden": "true"
4175
+ }, null, -1)])], 42, _hoisted_1$1),
4176
+ withDirectives(createElementVNode("span", { class: "atable-tuple-shell__display" }, toDisplayString(__props.displayText), 513), [[vShow, !__props.active]]),
4177
+ __props.active ? renderSlot(_ctx.$slots, "default", {}, void 0, true, 0) : createCommentVNode("", true)
4178
+ ], 2);
4179
+ };
4180
+ }
4181
+ }), [["__scopeId", "data-v-2746f028"]]);
4182
+ //#endregion
4183
+ //#region src/components/table/ATupleCellEditor.vue?vue&type=script&setup=true&lang.ts
4184
+ var _hoisted_1 = ["id", "aria-label"];
4185
+ //#endregion
4186
+ //#region src/components/table/ATupleCellEditor.vue
4187
+ var ATupleCellEditor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
4188
+ __name: "ATupleCellEditor",
4189
+ props: {
4190
+ category: {},
4191
+ colIndex: {},
4192
+ rowIndex: {},
4193
+ store: {},
4194
+ active: { type: Boolean },
4195
+ displayText: {},
4196
+ inputId: {}
4197
+ },
4198
+ emits: ["deactivate"],
4199
+ setup(__props, { expose: __expose, emit: __emit }) {
4200
+ const emit = __emit;
4201
+ const inputRef = useTemplateRef("inputRef");
4202
+ const draftText = ref("");
4203
+ const selectOnFocus = ref(true);
4204
+ const amountMaskEnabled = computed(() => __props.category === "currency" && options.value.amountMask !== false);
4205
+ const column = computed(() => __props.store.columns[__props.colIndex]);
4206
+ const options = computed(() => column.value?.options ?? {});
4207
+ const cellValue = computed(() => __props.store.getCellData(__props.colIndex, __props.rowIndex));
4208
+ const pickerLabel = computed(() => __props.category === "currency" ? "Choose currency" : "Choose unit");
4209
+ const amountLabel = computed(() => __props.category === "currency" ? "Amount" : "Quantity");
4210
+ const selectedCurrencyId = computed(() => String(cellValue.value?.currency?.id ?? ""));
4211
+ const cellElement = computed(() => {
4212
+ const el = inputRef.value?.closest("td");
4213
+ return el instanceof HTMLTableCellElement ? el : null;
4214
+ });
4215
+ const { left, bottom, width, height } = useElementBounding(cellElement);
4216
+ const pickerOpenForCell = computed(() => isTableTuplePickerModal(__props.store.modal) && __props.store.modal.colIndex === __props.colIndex && __props.store.modal.rowIndex === __props.rowIndex);
4217
+ watch(pickerOpenForCell, (open, wasOpen) => {
4218
+ if (!wasOpen || open) return;
4219
+ setTimeout(() => {
4220
+ if (pickerOpenForCell.value) return;
4221
+ const focused = document.activeElement;
4222
+ if (focused && cellElement.value?.contains(focused)) return;
4223
+ if (!focused || focused === document.body) inputRef.value?.focus();
4224
+ else emit("deactivate");
4225
+ });
4226
+ });
4227
+ const syncDraftFromModel = () => {
4228
+ const v = cellValue.value;
4229
+ if (__props.category === "quantity") {
4230
+ const q = v;
4231
+ draftText.value = q?.qty === null || q?.qty === void 0 ? "" : String(q.qty);
4232
+ return;
4233
+ }
4234
+ const c = v;
4235
+ if (amountMaskEnabled.value) {
4236
+ draftText.value = formatCurrencyAmountInput(c?.amount ?? null, selectedCurrencyId.value);
4237
+ return;
4238
+ }
4239
+ draftText.value = c?.amount === null || c?.amount === void 0 ? "" : String(c.amount);
4240
+ };
4241
+ watch(cellValue, () => {
4242
+ if (document.activeElement !== inputRef.value) syncDraftFromModel();
4243
+ }, { deep: true });
4244
+ watch(() => __props.active, (isActive) => {
4245
+ if (isActive) syncDraftFromModel();
4246
+ });
4247
+ const parseDraftAmount = () => {
4248
+ if (__props.category === "currency" && amountMaskEnabled.value) return parseCurrencyAmountInput(draftText.value);
4249
+ const text = draftText.value.trim();
4250
+ if (text === "" || text === "-") return null;
4251
+ const n = Number(text);
4252
+ return Number.isFinite(n) ? n : null;
4253
+ };
4254
+ const commitNumber = () => {
4255
+ const parsed = parseDraftAmount();
4256
+ if (__props.category === "quantity") {
4257
+ __props.store.setCellData(__props.colIndex, __props.rowIndex, patchQuantityQty(cellValue.value, parsed, options.value));
4258
+ return;
4259
+ }
4260
+ const base = normalizeBaseCurrency(options.value, cellValue.value);
4261
+ __props.store.setCellData(__props.colIndex, __props.rowIndex, patchCurrencyAmount(cellValue.value, parsed, options.value, base));
4262
+ };
4263
+ const onInput = () => {
4264
+ if (__props.category === "currency" && amountMaskEnabled.value) {
4265
+ const parsed = parseCurrencyAmountInput(draftText.value);
4266
+ if (draftText.value.trim() === "" || draftText.value.trim() === "-" || parsed !== null) commitNumber();
4267
+ return;
4268
+ }
4269
+ commitNumber();
4270
+ };
4271
+ const shouldStayActiveAfterBlur = (related) => {
4272
+ if (!(related instanceof Node)) return false;
4273
+ if (document.querySelector(".amodal")?.contains(related)) return true;
4274
+ if (pickerOpenForCell.value) return true;
4275
+ if (!(inputRef.value?.closest("td"))?.contains(related)) return false;
4276
+ if (related instanceof Element && related.closest(".atable-tuple-shell__handle")) return true;
4277
+ if (related === inputRef.value) return true;
4278
+ return false;
4279
+ };
4280
+ const onInputBlur = (event) => {
4281
+ commitNumber();
4282
+ if (__props.category === "currency" && amountMaskEnabled.value) syncDraftFromModel();
4283
+ if (!shouldStayActiveAfterBlur(event.relatedTarget)) emit("deactivate");
4284
+ };
4285
+ const openPicker = () => {
4286
+ const cell = cellElement.value;
4287
+ if (!cell) return;
4288
+ __props.store.openTuplePicker(__props.colIndex, __props.rowIndex, cell, {
4289
+ left: left.value,
4290
+ bottom: bottom.value,
4291
+ width: width.value,
4292
+ height: height.value
4293
+ });
4294
+ };
4295
+ const onKeydown = (event) => {
4296
+ if (event.shiftKey && event.key === "ArrowDown") {
4297
+ event.preventDefault();
4298
+ event.stopPropagation();
4299
+ openPicker();
4300
+ return;
4301
+ }
4302
+ if (__props.category === "currency" && amountMaskEnabled.value && !pickerOpenForCell.value) {
4303
+ if (onCurrencyKeydownMasked(event)) return;
4304
+ }
4305
+ if (__props.category === "quantity" && event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) refuseUnlessQuantity(event, event.key);
4306
+ };
4307
+ const textWith = (input, inserted) => input.value.slice(0, input.selectionStart ?? 0) + inserted + input.value.slice(input.selectionEnd ?? 0);
4308
+ const refuseUnlessQuantity = (event, inserted) => {
4309
+ if (!quantityEntryPattern.test(textWith(event.target, inserted))) event.preventDefault();
4310
+ };
4311
+ const entryPattern = computed(() => {
4312
+ if (__props.category === "quantity") return quantityEntryPattern;
4313
+ return amountMaskEnabled.value ? currencyAmountEntryPattern(selectedCurrencyId.value) : void 0;
4314
+ });
4315
+ const onPaste = (event) => {
4316
+ const pattern = entryPattern.value;
4317
+ if (!pattern) return;
4318
+ event.preventDefault();
4319
+ const input = event.target;
4320
+ const pasted = (event.clipboardData?.getData("text") ?? "").trim();
4321
+ if (!pattern.test(textWith(input, pasted))) return;
4322
+ input.setRangeText(pasted, input.selectionStart ?? 0, input.selectionEnd ?? 0, "end");
4323
+ input.dispatchEvent(new Event("input", { bubbles: true }));
4324
+ };
4325
+ const onCurrencyKeydownMasked = (event) => {
4326
+ if (event.ctrlKey || event.metaKey || event.altKey) return false;
4327
+ if ((/* @__PURE__ */ new Set([
4328
+ "Backspace",
4329
+ "Delete",
4330
+ "Tab",
4331
+ "Escape",
4332
+ "Enter",
4333
+ "ArrowLeft",
4334
+ "ArrowRight",
4335
+ "ArrowUp",
4336
+ "ArrowDown",
4337
+ "Home",
4338
+ "End"
4339
+ ])).has(event.key)) return false;
4340
+ if (/^[0-9]$/.test(event.key)) return false;
4341
+ if (event.key === "-") {
4342
+ const input = event.target;
4343
+ if (!input.value.includes("-") && input.selectionStart === 0) return false;
4344
+ }
4345
+ if (event.key === "." || event.key === ",") {
4346
+ if (currencyInputFractionDigits(selectedCurrencyId.value) === 0) {
4347
+ event.preventDefault();
4348
+ return true;
4349
+ }
4350
+ const input = event.target;
4351
+ if (!input.value.includes(".") && !input.value.includes(",")) return false;
4352
+ }
4353
+ const pattern = currencyAmountEntryPattern(selectedCurrencyId.value);
4354
+ const { selectionStart, selectionEnd, value } = event.target;
4355
+ if (selectionStart === null || selectionEnd === null) {
4356
+ event.preventDefault();
4357
+ return true;
4358
+ }
4359
+ const next = value.slice(0, selectionStart) + event.key + value.slice(selectionEnd);
4360
+ if (event.key.length === 1 && !pattern.test(next)) event.preventDefault();
4361
+ return true;
4362
+ };
4363
+ const onInputFocus = () => {
4364
+ if (selectOnFocus.value) nextTick(() => {
4365
+ inputRef.value?.select();
4366
+ selectOnFocus.value = false;
4367
+ });
4368
+ };
4369
+ const focusInput = () => {
4370
+ selectOnFocus.value = true;
4371
+ nextTick(() => inputRef.value?.focus());
4372
+ };
4373
+ __expose({
4374
+ focusInput,
4375
+ openPicker,
4376
+ commitNumber
4377
+ });
4378
+ return (_ctx, _cache) => {
4379
+ return openBlock(), createBlock(ATupleCellShell_default, {
4380
+ active: __props.active,
4381
+ "display-text": __props.displayText,
4382
+ "picker-label": pickerLabel.value,
4383
+ "picker-open": pickerOpenForCell.value,
4384
+ onOpenPicker: openPicker
4385
+ }, {
4386
+ default: withCtx(() => [withDirectives(createElementVNode("input", {
4387
+ ref_key: "inputRef",
4388
+ ref: inputRef,
4389
+ id: __props.inputId,
4390
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => draftText.value = $event),
4391
+ class: "atable-tuple-shell__input",
4392
+ type: "text",
4393
+ tabindex: "-1",
4394
+ inputmode: "decimal",
4395
+ "aria-label": amountLabel.value,
4396
+ onInput,
4397
+ onKeydown,
4398
+ onPaste,
4399
+ onFocus: onInputFocus,
4400
+ onBlur: onInputBlur
4401
+ }, null, 40, _hoisted_1), [[vModelText, draftText.value]])]),
4402
+ _: 1
4403
+ }, 8, [
4404
+ "active",
4405
+ "display-text",
4406
+ "picker-label",
4407
+ "picker-open"
4408
+ ]);
4409
+ };
4410
+ }
4411
+ }), [["__scopeId", "data-v-ad79f2bc"]]);
4412
+ //#endregion
3534
4413
  //#region src/index.ts
3535
4414
  /**
3536
4415
  * Install all AForm components
@@ -3562,8 +4441,12 @@ function install(app) {
3562
4441
  app.component("ADuration", ADuration_default);
3563
4442
  app.component("AFormLoading", AFormLoading_default);
3564
4443
  app.component("ExpandButton", ExpandButton_default);
4444
+ app.component("ATableTupleQuantityPicker", ATableTupleQuantityPicker_default);
4445
+ app.component("ATableTupleCurrencyPicker", ATableTupleCurrencyPicker_default);
4446
+ app.component("ATupleCellEditor", ATupleCellEditor_default);
4447
+ app.component("ATupleCellShell", ATupleCellShell_default);
3565
4448
  }
3566
4449
  //#endregion
3567
- export { ABadge_default as ABadge, ACheckbox_default as ACheckbox, ACurrencyInput_default as ACurrencyInput, ADate_default as ADate, ADatePicker_default as ADatePicker, ADateRange_default as ADateRange, ADateSelection_default as ADateSelection, ADateTime_default as ADateTime, ADateTimeInput_default as ADateTimeInput, ADropdown_default as ADropdown, ADuration_default as ADuration, AFieldset_default as AFieldset, AFileAttach_default as AFileAttach, AForm_default as AForm, AFormLink_default as AFormLink, AFormLoading_default as AFormLoading, ANumericInput_default as ANumericInput, AQuantityInput_default as AQuantityInput, ASegmentedControl_default as ASegmentedControl, ASemverInput_default as ASemverInput, ATextInput_default as ATextInput, ATextboxInput_default as ATextboxInput, ExpandButton_default as ExpandButton, Login_default as Login, badgeInputAccentStyle, deserializeFunction, install, resolveFieldBadge, resolvedFieldsToColumns };
4450
+ export { ABadge_default as ABadge, ACheckbox_default as ACheckbox, ACurrencyInput_default as ACurrencyInput, ADate_default as ADate, ADatePicker_default as ADatePicker, ADateRange_default as ADateRange, ADateSelection_default as ADateSelection, ADateTime_default as ADateTime, ADateTimeInput_default as ADateTimeInput, ADropdown_default as ADropdown, ADuration_default as ADuration, AFieldset_default as AFieldset, AFileAttach_default as AFileAttach, AForm_default as AForm, AFormLink_default as AFormLink, AFormLoading_default as AFormLoading, ANumericInput_default as ANumericInput, AQuantityInput_default as AQuantityInput, ASegmentedControl_default as ASegmentedControl, ASemverInput_default as ASemverInput, ATableTupleCurrencyPicker_default as ATableTupleCurrencyPicker, ATableTupleQuantityPicker_default as ATableTupleQuantityPicker, ATextInput_default as ATextInput, ATextboxInput_default as ATextboxInput, ATupleCellEditor_default as ATupleCellEditor, ATupleCellShell_default as ATupleCellShell, ExpandButton_default as ExpandButton, Login_default as Login, badgeInputAccentStyle, deserializeFunction, install, resolveFieldBadge, resolvedFieldsToColumns };
3568
4451
 
3569
4452
  //# sourceMappingURL=aform.js.map