@milaboratories/uikit 2.4.28 → 2.4.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +41 -42
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +14 -0
- package/dist/assets/images/required.svg.js +7 -0
- package/dist/assets/images/required.svg.js.map +1 -0
- package/dist/components/DataTable/TableComponent.vue.js +16 -19
- package/dist/components/DataTable/TableComponent.vue.js.map +1 -1
- package/dist/components/PlAccordion/{ExpandTransition.vue2.js → ExpandTransition.vue.js} +1 -1
- package/dist/components/PlAccordion/ExpandTransition.vue.js.map +1 -0
- package/dist/components/PlAccordion/ExpandTransition.vue3.js +1 -1
- package/dist/components/PlAccordion/PlAccordionSection.vue2.js +1 -1
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.js +67 -60
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.js.map +1 -1
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue.js +76 -72
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue.js.map +1 -1
- package/dist/components/PlDropdown/PlDropdown.vue.js +65 -61
- package/dist/components/PlDropdown/PlDropdown.vue.js.map +1 -1
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js +27 -23
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js.map +1 -1
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.js +65 -61
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.js.map +1 -1
- package/dist/components/PlFileInput/PlFileInput.vue.js +47 -43
- package/dist/components/PlFileInput/PlFileInput.vue.js.map +1 -1
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.js +3 -6
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.js.map +1 -1
- package/dist/components/PlTextArea/PlTextArea.vue.js +43 -39
- package/dist/components/PlTextArea/PlTextArea.vue.js.map +1 -1
- package/dist/components/PlTextField/PlTextField.vue.js +41 -37
- package/dist/components/PlTextField/PlTextField.vue.js.map +1 -1
- package/package.json +4 -4
- package/src/components/PlAutocomplete/PlAutocomplete.vue +4 -3
- package/src/components/PlAutocompleteMulti/PlAutocompleteMulti.vue +14 -11
- package/src/components/PlDropdown/PlDropdown.vue +10 -9
- package/src/components/PlDropdownLegacy/PlDropdownLegacy.vue +3 -2
- package/src/components/PlDropdownMulti/PlDropdownMulti.vue +11 -10
- package/src/components/PlFileInput/PlFileInput.vue +6 -3
- package/src/components/PlTextArea/PlTextArea.vue +3 -2
- package/src/components/PlTextField/PlTextField.vue +7 -6
- package/dist/components/PlAccordion/ExpandTransition.vue2.js.map +0 -1
- package/dist/generated/components/svg/images/SvgRequired.vue.d.ts +0 -2
- package/dist/generated/components/svg/images/SvgRequired.vue.js +0 -17
- package/dist/generated/components/svg/images/SvgRequired.vue.js.map +0 -1
- package/dist/generated/components/svg/images/SvgRequired.vue3.js +0 -6
- package/dist/generated/components/svg/images/SvgRequired.vue3.js.map +0 -1
- package/scripts/create-svg-components.js +0 -125
- package/src/generated/components/svg/images/Svg16Add.vue +0 -13
- package/src/generated/components/svg/images/Svg16Attention.vue +0 -13
- package/src/generated/components/svg/images/Svg16Checkmark.vue +0 -13
- package/src/generated/components/svg/images/Svg16CheckmarkDark.vue +0 -13
- package/src/generated/components/svg/images/Svg16ChevronDown.vue +0 -13
- package/src/generated/components/svg/images/Svg16ChevronLeft.vue +0 -13
- package/src/generated/components/svg/images/Svg16ChevronRight.vue +0 -13
- package/src/generated/components/svg/images/Svg16ChevronUp.vue +0 -13
- package/src/generated/components/svg/images/Svg16Clear.vue +0 -13
- package/src/generated/components/svg/images/Svg16Clipboard.vue +0 -13
- package/src/generated/components/svg/images/Svg16Close.vue +0 -13
- package/src/generated/components/svg/images/Svg16Compare.vue +0 -13
- package/src/generated/components/svg/images/Svg16Down.vue +0 -13
- package/src/generated/components/svg/images/Svg16Import.vue +0 -13
- package/src/generated/components/svg/images/Svg16Info.vue +0 -13
- package/src/generated/components/svg/images/Svg16InfoDark.vue +0 -13
- package/src/generated/components/svg/images/Svg16Link.vue +0 -13
- package/src/generated/components/svg/images/Svg16Loading.vue +0 -13
- package/src/generated/components/svg/images/Svg16Maximise.vue +0 -13
- package/src/generated/components/svg/images/Svg16Play.vue +0 -13
- package/src/generated/components/svg/images/Svg16Up.vue +0 -13
- package/src/generated/components/svg/images/Svg24ArrowRight.vue +0 -13
- package/src/generated/components/svg/images/Svg24CheckboxDarkDisabledChecked.vue +0 -13
- package/src/generated/components/svg/images/Svg24CheckboxDarkDisabledIndeterminate.vue +0 -13
- package/src/generated/components/svg/images/Svg24CheckboxDarkDisabledUnchecked.vue +0 -13
- package/src/generated/components/svg/images/Svg24CheckboxDarkEnabledChecked.vue +0 -13
- package/src/generated/components/svg/images/Svg24CheckboxDarkEnabledIndeterminate.vue +0 -13
- package/src/generated/components/svg/images/Svg24CheckboxDarkEnabledUnchecked.vue +0 -13
- package/src/generated/components/svg/images/Svg24CheckboxLightDisabledChecked.vue +0 -13
- package/src/generated/components/svg/images/Svg24CheckboxLightDisabledIndeterminate.vue +0 -13
- package/src/generated/components/svg/images/Svg24CheckboxLightDisabledUnchecked.vue +0 -13
- package/src/generated/components/svg/images/Svg24CheckboxLightEnabledChecked.vue +0 -13
- package/src/generated/components/svg/images/Svg24CheckboxLightEnabledIndeterminate.vue +0 -13
- package/src/generated/components/svg/images/Svg24CheckboxLightEnabledUnchecked.vue +0 -13
- package/src/generated/components/svg/images/Svg24Clips.vue +0 -13
- package/src/generated/components/svg/images/Svg24Close.vue +0 -13
- package/src/generated/components/svg/images/Svg24Code.vue +0 -13
- package/src/generated/components/svg/images/Svg24Columns.vue +0 -13
- package/src/generated/components/svg/images/Svg24DarkMode.vue +0 -13
- package/src/generated/components/svg/images/Svg24Filters.vue +0 -13
- package/src/generated/components/svg/images/Svg24LightMode.vue +0 -13
- package/src/generated/components/svg/images/Svg24Local.vue +0 -13
- package/src/generated/components/svg/images/Svg24PaperClip.vue +0 -13
- package/src/generated/components/svg/images/Svg24Search.vue +0 -13
- package/src/generated/components/svg/images/Svg24ServerOn.vue +0 -13
- package/src/generated/components/svg/images/Svg24Settings2.vue +0 -13
- package/src/generated/components/svg/images/SvgAddGraphBg.vue +0 -13
- package/src/generated/components/svg/images/SvgColorSliderThumbBig.vue +0 -13
- package/src/generated/components/svg/images/SvgColorSliderThumbSmall.vue +0 -13
- package/src/generated/components/svg/images/SvgEmptyCat.vue +0 -13
- package/src/generated/components/svg/images/SvgNoDataCat.vue +0 -13
- package/src/generated/components/svg/images/SvgRequired.vue +0 -13
- package/src/generated/components/svg/svg-styles.css +0 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(`.pl-autocomplete__options{--option-hover-bg: var(--btn-sec-hover-grey);z-index:var(--z-dropdown-options);border:1px solid var(--border-color-div-grey);position:absolute;background-color:var(--pl-dropdown-options-bg);border-radius:6px;max-height:244px;box-shadow:0 4px 12px -2px #0f244d14,0 6px 24px -2px #0f244d14;--thumb-color: var(--ic-02);overflow-y:auto}.pl-autocomplete__options::-webkit-scrollbar{width:var(--scrollbar-width, 6px);height:5px;background-color:transparent;display:block}.pl-autocomplete__options::-webkit-scrollbar-thumb{background:var(--thumb-color);border-radius:5px}.pl-autocomplete__options::-webkit-scrollbar-thumb:hover{--thumb-color: var(--border-color-focus)}.pl-autocomplete__options .nothing-found{padding:0 10px;height:var(--control-height);line-height:var(--control-height);background-color:#fff;opacity:.5;font-style:italic}.pl-autocomplete__options .option{position:relative;padding:0 30px 0 10px;height:var(--control-height);line-height:var(--control-height);cursor:pointer;-webkit-user-select:none;user-select:none}.pl-autocomplete__options .option .checkmark{position:absolute;display:none;right:10px;top:50%;transform:translateY(-50%)}.pl-autocomplete__options .option>span{display:block;overflow:hidden;white-space:nowrap;max-width:100%;text-overflow:ellipsis}.pl-autocomplete__options .option.selected{background-color:var(--color-active-select)}.pl-autocomplete__options .option.selected .checkmark{display:block}.pl-autocomplete__options .option.active:not(.selected){background-color:var(--option-hover-bg)}.pl-autocomplete__options .option:hover{background-color:var(--option-hover-bg)}.pl-autocomplete{--contour-color: var(--txt-01);--contour-border-width: 1px;--label-offset-left-x: 8px;--label-offset-right-x: 8px;--label-color: var(--txt-01);position:relative;outline:none;min-height:var(--control-height);border-radius:6px;font-family:var(--font-family-base);font-size:var(--font-size-base);font-weight:var(--font-weigh-base)}.pl-autocomplete__envelope{font-family:var(--control-font-family);min-width:160px}.pl-autocomplete label{display:flex;align-items:center;gap:4px;position:absolute;top:0;transform:translateY(-60%);left:var(--label-offset-left-x);padding:0 4px;max-width:calc(100% - 16px);overflow:hidden;white-space:pre;text-overflow:ellipsis;cursor:inherit;color:var(--label-color);font-size:12px;font-weight:500;border-bottom-right-radius:4px;border-bottom-left-radius:4px;background:var(--bg-elevated-01)}.pl-autocomplete label>span{overflow:hidden;white-space:pre;text-overflow:ellipsis}.pl-autocomplete__container{position:absolute;top:0;left:0;right:0;border-radius:6px;min-height:var(--control-height);color:var(--txt-01)}.pl-autocomplete__contour{border-radius:var(--border-radius-control);border:var(--contour-border-width) solid var(--contour-color);box-shadow:var(--contour-box-shadow);z-index:0;pointer-events:none}.pl-autocomplete__field{position:relative;border-radius:6px;overflow:hidden;background:transparent;padding-left:11px;min-height:var(--control-height);line-height:var(--control-height);display:flex;flex-direction:row;align-items:center;cursor:pointer}.pl-autocomplete__field .input-value{position:absolute;top:0;left:0;bottom:0;right:0;display:flex;flex-direction:row;align-items:center;padding:0 60px 0 11px;pointer-events:none;line-height:20px;color:var(--txt-01);overflow:hidden;white-space:pre;text-overflow:ellipsis;cursor:inherit}.pl-autocomplete__field input{min-height:calc(var(--control-height) - 2px);line-height:20px;font-family:inherit;font-size:inherit;background-color:transparent;border:none;padding:0;width:calc(100% - 40px);color:var(--txt-01);caret-color:var(--border-color-focus)}.pl-autocomplete__field input:focus{outline:none}.pl-autocomplete__field input:placeholder-shown{text-overflow:ellipsis}.pl-autocomplete__field input::placeholder{color:var(--color-placeholder)}.pl-autocomplete__helper{font-size:12px;color:var(--txt-03);padding:2px 0 0;white-space:pre-wrap;text-overflow:ellipsis;font-weight:500;line-height:16px;margin-top:6px}.pl-autocomplete__error{font-size:12px;color:var(--txt-error);padding:2px 0 0;white-space:pre-wrap;text-overflow:ellipsis;font-weight:500;line-height:16px;margin-top:6px}.pl-autocomplete__controls{display:flex;flex-direction:row;align-items:center;min-height:var(--control-height);gap:6px;margin-left:auto}.pl-autocomplete__controls .mask-16,.pl-autocomplete__controls .mask-24{--icon-color: var(--control-mask-fill);cursor:pointer}.pl-autocomplete__controls .clear{--icon-color: var(--ic-02)}.pl-autocomplete__controls .mask-loading{--icon-color: var(#07AD3E);animation:spin 2.5s linear infinite}.pl-autocomplete__arrow-wrapper{display:flex;align-items:center;min-height:var(--control-height);padding-right:11px}.pl-autocomplete .arrow-icon{cursor:pointer}.pl-autocomplete .arrow-icon.arrow-icon-default{transition:transform .2s;background-color:var(--control-mask-fill);mask-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M2.46967%206.53033L3.53033%205.46967L8%209.93934L12.4697%205.46967L13.5303%206.53033L8%2012.0607L2.46967%206.53033Z'%20fill='%23110529'/%3e%3c/svg%3e");-webkit-mask-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M2.46967%206.53033L3.53033%205.46967L8%209.93934L12.4697%205.46967L13.5303%206.53033L8%2012.0607L2.46967%206.53033Z'%20fill='%23110529'/%3e%3c/svg%3e");mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-position:center;-webkit-mask-position:center;mask-size:16px;-webkit-mask-size:16px;width:16px;height:16px}.pl-autocomplete.open,.pl-autocomplete:focus-within{z-index:1;--label-color: var(--txt-focus)}.pl-autocomplete.open .pl-autocomplete__container{z-index:1000}.pl-autocomplete.open .pl-autocomplete__field{border-radius:6px 6px 0 0}.pl-autocomplete.open .arrow-icon.arrow-icon-default{background-color:var(--control-mask-fill);transform:rotate(-180deg)}.pl-autocomplete:hover{--contour-color: var(--control-hover-color)}.pl-autocomplete:focus-within:not(.error){--label-color: var(--txt-focus);--contour-color: var(--border-color-focus);--contour-border-width: 2px;--contour-box-shadow: 0 0 0 4px var(--border-color-focus-shadow)}.pl-autocomplete:focus-within.error{--contour-border-width: 2px;--contour-box-shadow: 0 0 0 4px var(--color-error-shadow)}.pl-autocomplete.error{--contour-color: var(--txt-error);--label-color: var(--txt-error)}.pl-autocomplete.disabled{--contour-color: var(--color-dis-01);--control-mask-fill: var(--color-dis-01);--label-color: var(--color-dis-01);cursor:not-allowed;pointer-events:none;-webkit-user-select:none;user-select:none}.pl-autocomplete.disabled .input-value{color:var(--dis-01)}
|
|
2
2
|
.ui-lt-container{min-width:0;white-space:nowrap;overflow:hidden;position:relative;border-radius:5px}.ui-lt-container span{display:inline-block;overflow:hidden;text-overflow:ellipsis;width:100%;vertical-align:bottom;pointer-events:all!important}.ui-lt-container .ui-lt-animate{position:relative;animation:left-to-right var(--5deba9de) infinite alternate linear;overflow:unset!important;text-overflow:unset!important;width:fit-content!important}@keyframes left-to-right{0%{transform:translate(0);left:0%}to{transform:translate(-101%);left:101%}}`)),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
3
|
-
import { defineComponent as se, mergeModels as ie, useModel as ue, useSlots as ce, ref as
|
|
3
|
+
import { defineComponent as se, mergeModels as ie, useModel as ue, useSlots as ce, ref as m, useTemplateRef as de, reactive as pe, computed as v, unref as c, watch as h, watchPostEffect as ve, createElementBlock as s, openBlock as a, withModifiers as O, createElementVNode as _, createCommentVNode as d, normalizeClass as M, createBlock as k, createVNode as N, withDirectives as fe, vModelText as me, withCtx as R, createTextVNode as he, toDisplayString as w, renderSlot as P, Fragment as _e, renderList as ge } from "vue";
|
|
4
4
|
|
|
5
|
-
import { tap as
|
|
5
|
+
import { tap as ye } from "../../helpers/functions.js";
|
|
6
6
|
import ke from "../PlTooltip/PlTooltip.vue.js";
|
|
7
7
|
import we from "../../utils/DoubleContour.vue.js";
|
|
8
8
|
import { useLabelNotch as Ie } from "../../utils/useLabelNotch.js";
|
|
@@ -16,30 +16,31 @@ import xe from "../PlIcon24/PlIcon24.vue.js";
|
|
|
16
16
|
import Ee from "../../utils/DropdownOverlay/DropdownOverlay.vue.js";
|
|
17
17
|
import { refDebounced as Ve } from "@vueuse/core";
|
|
18
18
|
import { useWatchFetch as H } from "../../composition/useWatchFetch.js";
|
|
19
|
-
import Ae from "../../
|
|
20
|
-
import
|
|
21
|
-
|
|
19
|
+
import { getErrorMessage as Ae } from "../../helpers/error.js";
|
|
20
|
+
import Ce from "../PlSvg/PlSvg.vue.js";
|
|
21
|
+
import De from "../../assets/images/required.svg.js";
|
|
22
|
+
const Fe = ["tabindex"], Me = { class: "pl-autocomplete__container" }, Re = { class: "pl-autocomplete__field" }, $e = ["disabled", "placeholder"], Be = {
|
|
22
23
|
key: 0,
|
|
23
24
|
class: "input-value"
|
|
24
|
-
},
|
|
25
|
+
}, Le = { class: "pl-autocomplete__controls" }, qe = {
|
|
25
26
|
key: 2,
|
|
26
27
|
class: "arrow-icon arrow-icon-default"
|
|
27
|
-
},
|
|
28
|
+
}, ze = { key: 0 }, Ne = {
|
|
28
29
|
key: 0,
|
|
29
30
|
class: "nothing-found"
|
|
30
|
-
},
|
|
31
|
+
}, Pe = {
|
|
31
32
|
key: 0,
|
|
32
33
|
class: "pl-autocomplete__error"
|
|
33
|
-
},
|
|
34
|
+
}, Te = {
|
|
34
35
|
key: 1,
|
|
35
36
|
class: "pl-autocomplete__helper"
|
|
36
|
-
},
|
|
37
|
+
}, He = {
|
|
37
38
|
key: 2,
|
|
38
39
|
class: "pl-autocomplete__helper"
|
|
39
|
-
},
|
|
40
|
+
}, Ue = {
|
|
40
41
|
name: "PlAutocomplete"
|
|
41
|
-
},
|
|
42
|
-
...
|
|
42
|
+
}, co = /* @__PURE__ */ se({
|
|
43
|
+
...Ue,
|
|
43
44
|
props: /* @__PURE__ */ ie({
|
|
44
45
|
optionsSearch: {},
|
|
45
46
|
modelSearch: { type: Function, default: void 0 },
|
|
@@ -61,32 +62,32 @@ const De = ["tabindex"], Fe = { class: "pl-autocomplete__container" }, Me = { cl
|
|
|
61
62
|
}),
|
|
62
63
|
emits: ["update:modelValue"],
|
|
63
64
|
setup(b) {
|
|
64
|
-
const n = ue(b, "modelValue"), u = b, U = ce(),
|
|
65
|
+
const n = ue(b, "modelValue"), u = b, U = ce(), p = m(), x = m(), $ = de("overlay"), i = m(null), t = pe({
|
|
65
66
|
activeIndex: -1,
|
|
66
67
|
open: !1
|
|
67
|
-
}), K = () =>
|
|
68
|
-
|
|
68
|
+
}), K = () => ye(
|
|
69
|
+
y.value.findIndex((e) => I(e.value, n.value)),
|
|
69
70
|
(e) => e < 0 ? 0 : e
|
|
70
|
-
), W = () => t.activeIndex = K(), E =
|
|
71
|
+
), W = () => t.activeIndex = K(), E = m([]), g = m(), y = v(() => T(E.value).map((e, o) => ({
|
|
71
72
|
...e,
|
|
72
73
|
index: o,
|
|
73
74
|
isSelected: o === j.value,
|
|
74
75
|
isActive: o === t.activeIndex
|
|
75
|
-
}))), S =
|
|
76
|
+
}))), S = m(!0), V = m(!1), A = v(() => u.disabled), j = v(() => E.value.findIndex((e) => I(e.value, n.value))), C = v(() => {
|
|
76
77
|
if (!S.value) {
|
|
77
78
|
if (u.error)
|
|
78
|
-
return
|
|
79
|
+
return Ae(u.error);
|
|
79
80
|
if (V.value)
|
|
80
81
|
return "Data loading error";
|
|
81
82
|
}
|
|
82
|
-
}), B =
|
|
83
|
-
const e =
|
|
83
|
+
}), B = v(() => {
|
|
84
|
+
const e = c(g), o = c(y), l = e ?? o.find((r) => I(r.value, n.value)) ?? o.find((r) => I(r.value, n.value));
|
|
84
85
|
return (l == null ? void 0 : l.label) || (n.value ? u.formatValue(n.value) : "");
|
|
85
|
-
}), G =
|
|
86
|
+
}), G = v(() => !t.open && n.value ? "" : n.value ? String(B.value) : u.placeholder), J = v(() => n.value !== void 0 && n.value !== null), Q = v(() => A.value ? void 0 : "0"), L = (e) => {
|
|
86
87
|
var o;
|
|
87
|
-
n.value = e == null ? void 0 : e.value,
|
|
88
|
+
n.value = e == null ? void 0 : e.value, g.value = e, i.value = null, t.open = !1, (o = p == null ? void 0 : p.value) == null || o.focus();
|
|
88
89
|
}, X = () => {
|
|
89
|
-
n.value = void 0,
|
|
90
|
+
n.value = void 0, g.value = void 0;
|
|
90
91
|
}, Y = () => {
|
|
91
92
|
var e;
|
|
92
93
|
return (e = x.value) == null ? void 0 : e.focus();
|
|
@@ -99,9 +100,9 @@ const De = ["tabindex"], Fe = { class: "pl-autocomplete__container" }, Me = { cl
|
|
|
99
100
|
const ee = () => {
|
|
100
101
|
t.open = !0;
|
|
101
102
|
}, oe = (e) => {
|
|
102
|
-
var l, r,
|
|
103
|
+
var l, r, f;
|
|
103
104
|
const o = e.relatedTarget;
|
|
104
|
-
!((l =
|
|
105
|
+
!((l = p.value) != null && l.contains(o)) && !((f = (r = $.value) == null ? void 0 : r.listRef) != null && f.contains(o)) && (i.value = null, t.open = !1);
|
|
105
106
|
}, te = (e) => {
|
|
106
107
|
var z;
|
|
107
108
|
if (["ArrowDown", "ArrowUp", "Enter", "Escape"].includes(e.code))
|
|
@@ -113,15 +114,15 @@ const De = ["tabindex"], Fe = { class: "pl-autocomplete__container" }, Me = { cl
|
|
|
113
114
|
e.code === "Enter" && (t.open = !0, i.value = "");
|
|
114
115
|
return;
|
|
115
116
|
}
|
|
116
|
-
e.code === "Escape" && (t.open = !1, i.value = null, (z =
|
|
117
|
-
const r =
|
|
118
|
-
if (!
|
|
117
|
+
e.code === "Escape" && (t.open = !1, i.value = null, (z = p.value) == null || z.focus());
|
|
118
|
+
const r = c(y), { length: f } = r;
|
|
119
|
+
if (!f)
|
|
119
120
|
return;
|
|
120
121
|
e.code === "Enter" && L(r.find((F) => F.index === l));
|
|
121
|
-
const ae = r.findIndex((F) => F.index === l) ?? -1, ne = e.code === "ArrowDown" ? 1 : e.code === "ArrowUp" ? -1 : 0, re = Math.abs(ae + ne +
|
|
122
|
-
t.activeIndex =
|
|
122
|
+
const ae = r.findIndex((F) => F.index === l) ?? -1, ne = e.code === "ArrowDown" ? 1 : e.code === "ArrowUp" ? -1 : 0, re = Math.abs(ae + ne + f) % f;
|
|
123
|
+
t.activeIndex = y.value[re].index ?? -1;
|
|
123
124
|
};
|
|
124
|
-
Ie(
|
|
125
|
+
Ie(p), h(() => n.value, W, { immediate: !0 }), h(
|
|
125
126
|
() => t.open,
|
|
126
127
|
(e) => {
|
|
127
128
|
var o;
|
|
@@ -131,14 +132,17 @@ const De = ["tabindex"], Fe = { class: "pl-autocomplete__container" }, Me = { cl
|
|
|
131
132
|
var e;
|
|
132
133
|
i.value, t.activeIndex >= 0 && t.open && ((e = $.value) == null || e.scrollIntoActive());
|
|
133
134
|
});
|
|
134
|
-
const le = Ve(i, 300, { maxWait: 1e3 }), D = H(() => le.value, async (e) =>
|
|
135
|
+
const le = Ve(i, 300, { maxWait: 1e3 }), D = H(() => le.value, async (e) => {
|
|
136
|
+
if (e !== null)
|
|
137
|
+
return u.optionsSearch(e);
|
|
138
|
+
}), q = H(() => n.value, async (e) => {
|
|
135
139
|
var o, l;
|
|
136
|
-
return e && !I((o =
|
|
140
|
+
return e && !I((o = g.value) == null ? void 0 : o.value, e) ? u.modelSearch ? u.modelSearch(e) : (l = await u.optionsSearch(String(e))) == null ? void 0 : l[0] : g.value;
|
|
137
141
|
});
|
|
138
142
|
return h(() => D.value, (e) => {
|
|
139
143
|
e && (E.value = e, i.value !== null && (V.value = !1));
|
|
140
144
|
}), h(() => q.value, (e) => {
|
|
141
|
-
e && (
|
|
145
|
+
e && (g.value = T([e])[0]);
|
|
142
146
|
}), h(() => D.error, (e) => {
|
|
143
147
|
e && (V.value = !!e);
|
|
144
148
|
}), h(() => D.loading || q.loading, (e) => {
|
|
@@ -149,14 +153,14 @@ const De = ["tabindex"], Fe = { class: "pl-autocomplete__container" }, Me = { cl
|
|
|
149
153
|
}, [
|
|
150
154
|
_("div", {
|
|
151
155
|
ref_key: "rootRef",
|
|
152
|
-
ref:
|
|
156
|
+
ref: p,
|
|
153
157
|
tabindex: Q.value,
|
|
154
158
|
class: M(["pl-autocomplete", { open: t.open, error: !!C.value, disabled: A.value }]),
|
|
155
159
|
onKeydown: te,
|
|
156
160
|
onFocusout: oe
|
|
157
161
|
}, [
|
|
158
|
-
_("div",
|
|
159
|
-
_("div",
|
|
162
|
+
_("div", Me, [
|
|
163
|
+
_("div", Re, [
|
|
160
164
|
fe(_("input", {
|
|
161
165
|
ref_key: "input",
|
|
162
166
|
ref: x,
|
|
@@ -168,10 +172,10 @@ const De = ["tabindex"], Fe = { class: "pl-autocomplete__container" }, Me = { cl
|
|
|
168
172
|
spellcheck: "false",
|
|
169
173
|
autocomplete: "chrome-off",
|
|
170
174
|
onFocus: ee
|
|
171
|
-
}, null, 40,
|
|
175
|
+
}, null, 40, $e), [
|
|
172
176
|
[me, i.value]
|
|
173
177
|
]),
|
|
174
|
-
t.open ?
|
|
178
|
+
t.open ? d("", !0) : (a(), s("div", Be, [
|
|
175
179
|
N(Se, null, {
|
|
176
180
|
default: R(() => [
|
|
177
181
|
he(w(B.value), 1)
|
|
@@ -179,17 +183,17 @@ const De = ["tabindex"], Fe = { class: "pl-autocomplete__container" }, Me = { cl
|
|
|
179
183
|
_: 1
|
|
180
184
|
})
|
|
181
185
|
])),
|
|
182
|
-
_("div",
|
|
183
|
-
S.value ? (a(), k(
|
|
186
|
+
_("div", Le, [
|
|
187
|
+
S.value ? (a(), k(c(xe), {
|
|
184
188
|
key: 0,
|
|
185
189
|
name: "loading"
|
|
186
|
-
})) :
|
|
187
|
-
e.clearable && J.value ? (a(), k(
|
|
190
|
+
})) : d("", !0),
|
|
191
|
+
e.clearable && J.value ? (a(), k(c(Oe), {
|
|
188
192
|
key: 1,
|
|
189
193
|
class: "clear",
|
|
190
194
|
name: "delete-clear",
|
|
191
195
|
onClick: O(X, ["stop"])
|
|
192
|
-
})) :
|
|
196
|
+
})) : d("", !0),
|
|
193
197
|
P(e.$slots, "append"),
|
|
194
198
|
_("div", {
|
|
195
199
|
class: "pl-autocomplete__arrow-wrapper",
|
|
@@ -201,14 +205,17 @@ const De = ["tabindex"], Fe = { class: "pl-autocomplete__container" }, Me = { cl
|
|
|
201
205
|
}, null, 2)) : e.arrowIcon ? (a(), s("div", {
|
|
202
206
|
key: 1,
|
|
203
207
|
class: M(["arrow-icon", [`icon-16 ${e.arrowIcon}`]])
|
|
204
|
-
}, null, 2)) : (a(), s("div",
|
|
208
|
+
}, null, 2)) : (a(), s("div", qe))
|
|
205
209
|
])
|
|
206
210
|
])
|
|
207
211
|
]),
|
|
208
|
-
e.label ? (a(), s("label",
|
|
209
|
-
e.required ? (a(), k(
|
|
212
|
+
e.label ? (a(), s("label", ze, [
|
|
213
|
+
e.required ? (a(), k(c(Ce), {
|
|
214
|
+
key: 0,
|
|
215
|
+
uri: c(De)
|
|
216
|
+
}, null, 8, ["uri"])) : d("", !0),
|
|
210
217
|
_("span", null, w(e.label), 1),
|
|
211
|
-
U.tooltip ? (a(), k(
|
|
218
|
+
U.tooltip ? (a(), k(c(ke), {
|
|
212
219
|
key: 1,
|
|
213
220
|
class: "info",
|
|
214
221
|
position: "top"
|
|
@@ -217,37 +224,37 @@ const De = ["tabindex"], Fe = { class: "pl-autocomplete__container" }, Me = { cl
|
|
|
217
224
|
P(e.$slots, "tooltip")
|
|
218
225
|
]),
|
|
219
226
|
_: 3
|
|
220
|
-
})) :
|
|
221
|
-
])) :
|
|
222
|
-
t.open ? (a(), k(
|
|
227
|
+
})) : d("", !0)
|
|
228
|
+
])) : d("", !0),
|
|
229
|
+
t.open ? (a(), k(c(Ee), {
|
|
223
230
|
key: 1,
|
|
224
231
|
ref: "overlay",
|
|
225
|
-
root:
|
|
232
|
+
root: p.value,
|
|
226
233
|
class: "pl-autocomplete__options",
|
|
227
234
|
tabindex: "-1",
|
|
228
235
|
gap: 3
|
|
229
236
|
}, {
|
|
230
237
|
default: R(() => [
|
|
231
|
-
(a(!0), s(_e, null,
|
|
238
|
+
(a(!0), s(_e, null, ge(y.value, (l, r) => (a(), k(be, {
|
|
232
239
|
key: r,
|
|
233
240
|
option: l,
|
|
234
241
|
"is-selected": l.isSelected,
|
|
235
242
|
"is-hovered": l.isActive,
|
|
236
243
|
size: e.optionSize,
|
|
237
|
-
onClick: O((
|
|
244
|
+
onClick: O((f) => L(l), ["stop"])
|
|
238
245
|
}, null, 8, ["option", "is-selected", "is-hovered", "size", "onClick"]))), 128)),
|
|
239
|
-
|
|
246
|
+
y.value.length ? d("", !0) : (a(), s("div", Ne, "Nothing found"))
|
|
240
247
|
]),
|
|
241
248
|
_: 1
|
|
242
|
-
}, 8, ["root"])) :
|
|
249
|
+
}, 8, ["root"])) : d("", !0),
|
|
243
250
|
N(we, { class: "pl-autocomplete__contour" })
|
|
244
251
|
])
|
|
245
|
-
], 42,
|
|
246
|
-
C.value ? (a(), s("div",
|
|
252
|
+
], 42, Fe),
|
|
253
|
+
C.value ? (a(), s("div", Pe, w(C.value), 1)) : S.value && e.loadingOptionsHelper ? (a(), s("div", Te, w(e.loadingOptionsHelper), 1)) : e.helper ? (a(), s("div", He, w(e.helper), 1)) : d("", !0)
|
|
247
254
|
]));
|
|
248
255
|
}
|
|
249
256
|
});
|
|
250
257
|
export {
|
|
251
|
-
|
|
258
|
+
co as default
|
|
252
259
|
};
|
|
253
260
|
//# sourceMappingURL=PlAutocomplete.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlAutocomplete.vue.js","sources":["../../../src/components/PlAutocomplete/PlAutocomplete.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * A component for selecting one value from a big list of options using string search request\n */\nexport default {\n name: 'PlAutocomplete',\n};\n</script>\n\n<script lang=\"ts\" setup generic=\"M = unknown\">\nimport './pl-autocomplete.scss';\nimport { computed, reactive, ref, unref, useTemplateRef, watch, watchPostEffect } from 'vue';\nimport { tap } from '../../helpers/functions';\nimport { PlTooltip } from '../PlTooltip';\nimport DoubleContour from '../../utils/DoubleContour.vue';\nimport { useLabelNotch } from '../../utils/useLabelNotch';\nimport type { ListOption, ListOptionNormalized } from '../../types';\nimport { deepEqual } from '../../helpers/objects';\nimport DropdownListItem from '../DropdownListItem.vue';\nimport LongText from '../LongText.vue';\nimport { normalizeListOptions } from '../../helpers/utils';\nimport { PlIcon16 } from '../PlIcon16';\nimport { PlMaskIcon24 } from '../PlMaskIcon24';\nimport { DropdownOverlay } from '../../utils/DropdownOverlay';\nimport { refDebounced } from '@vueuse/core';\nimport { useWatchFetch } from '../../composition/useWatchFetch.ts';\nimport SvgRequired from '../../generated/components/svg/images/SvgRequired.vue';\nimport { getErrorMessage } from '../../helpers/error.ts';\nimport type { ListOptionBase } from '@platforma-sdk/model';\n\n/**\n * The current selected value.\n */\nconst model = defineModel<M>({ required: true });\n\nconst props = withDefaults(\n defineProps<{\n /**\n * Lambda for requesting of available options for the dropdown by search string.\n */\n optionsSearch: (s: string) => Promise<ListOption<M>[]>;\n /**\n * Lambda for requesting of corresponding option for current model value. If empty, optionsSearch is used for this.\n */\n modelSearch?: (v: M) => Promise<ListOption<M>>;\n /**\n * The label text for the dropdown field (optional)\n */\n label?: string;\n /**\n * A helper text displayed below the dropdown when there are no errors (optional).\n */\n helper?: string;\n /**\n * A helper text displayed below the dropdown when there are no options yet or options is undefined (optional).\n */\n loadingOptionsHelper?: string;\n /**\n * Error message displayed below the dropdown (optional)\n */\n error?: unknown;\n /**\n * Placeholder text shown when no value is selected.\n */\n placeholder?: string;\n /**\n * Enables a button to clear the selected value (default: false)\n */\n clearable?: boolean;\n /**\n * If `true`, the dropdown component is marked as required.\n */\n required?: boolean;\n /**\n * If `true`, the dropdown component is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n /**\n * Custom icon (16px) class for the dropdown arrow (optional)\n */\n arrowIcon?: string;\n /**\n * Custom icon (24px) class for the dropdown arrow (optional)\n */\n arrowIconLarge?: string;\n /**\n * Option list item size\n */\n optionSize?: 'small' | 'medium';\n /**\n * Formatter for the selected value if its label is absent\n */\n formatValue?: (value: M) => string;\n }>(),\n {\n modelSearch: undefined,\n label: '',\n helper: undefined,\n loadingOptionsHelper: undefined,\n error: undefined,\n placeholder: '...',\n clearable: false,\n required: false,\n disabled: false,\n arrowIcon: undefined,\n arrowIconLarge: undefined,\n optionSize: 'small',\n formatValue: (v: M) => String(v),\n },\n);\n\nconst slots = defineSlots<{\n [key: string]: unknown;\n}>();\n\nconst rootRef = ref<HTMLElement | undefined>();\nconst input = ref<HTMLInputElement | undefined>();\n\nconst overlayRef = useTemplateRef('overlay');\n\nconst search = ref<string | null>(null);\nconst data = reactive({\n activeIndex: -1,\n open: false,\n});\n\nconst findActiveIndex = () =>\n tap(\n renderedOptionsRef.value.findIndex((o) => deepEqual(o.value, model.value)),\n (v) => (v < 0 ? 0 : v),\n );\n\nconst updateActive = () => (data.activeIndex = findActiveIndex());\n\nconst loadedOptionsRef = ref<ListOption<M>[]>([]);\nconst modelOptionRef = ref<ListOptionNormalized<M> | undefined>(); // list of 1 option that is selected or empty, to keep selected label\n\nconst renderedOptionsRef = computed(() => {\n return normalizeListOptions(loadedOptionsRef.value).map((opt, index) => ({\n ...opt,\n index,\n isSelected: index === selectedIndex.value,\n isActive: index === data.activeIndex,\n })) as (ListOptionBase<M> & { index: number; isSelected: boolean; isActive: boolean })[];\n});\nconst isLoadingOptions = ref<boolean>(true);\nconst isLoadingError = ref<boolean>(false);\n\nconst isDisabled = computed(() => {\n return props.disabled;\n});\n\nconst selectedIndex = computed(() => {\n return loadedOptionsRef.value.findIndex((o) => deepEqual(o.value, model.value));\n});\n\nconst computedError = computed(() => {\n if (isLoadingOptions.value) {\n return undefined;\n }\n\n if (props.error) {\n return getErrorMessage(props.error);\n }\n\n if (isLoadingError.value) {\n return 'Data loading error';\n }\n\n return undefined;\n});\n\nconst textValue = computed(() => {\n const modelOption = unref(modelOptionRef);\n const options = unref(renderedOptionsRef);\n\n const item: ListOptionNormalized | undefined = modelOption ?? options.find((o) => deepEqual(o.value, model.value)) ?? options.find((o) => deepEqual(o.value, model.value));\n\n return item?.label || (model.value ? props.formatValue(model.value) : '');\n});\n\nconst computedPlaceholder = computed(() => {\n if (!data.open && model.value) {\n return '';\n }\n\n return model.value ? String(textValue.value) : props.placeholder;\n});\n\nconst hasValue = computed(() => {\n return model.value !== undefined && model.value !== null;\n});\n\nconst tabindex = computed(() => (isDisabled.value ? undefined : '0'));\n\nconst selectOption = (v: ListOptionBase<M> & { index: number } | undefined) => {\n model.value = v?.value as M;\n modelOptionRef.value = v;\n search.value = null;\n data.open = false;\n rootRef?.value?.focus();\n};\n\nconst clear = () => {\n model.value = undefined as M;\n modelOptionRef.value = undefined;\n};\n\nconst setFocusOnInput = () => input.value?.focus();\n\nconst toggleOpen = () => {\n data.open = !data.open;\n};\n\nwatch(() => data.open, (v) => {\n search.value = v ? '' : null;\n});\n\nconst onInputFocus = () => {\n data.open = true;\n};\n\nconst onFocusOut = (event: FocusEvent) => {\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (!rootRef.value?.contains(relatedTarget) && !overlayRef.value?.listRef?.contains(relatedTarget)) {\n search.value = null;\n data.open = false;\n }\n};\n\nconst handleKeydown = (e: { code: string; preventDefault(): void }) => {\n if (!['ArrowDown', 'ArrowUp', 'Enter', 'Escape'].includes(e.code)) {\n return;\n } else {\n e.preventDefault();\n }\n\n const { open, activeIndex } = data;\n\n if (!open) {\n if (e.code === 'Enter') {\n data.open = true;\n search.value = '';\n }\n return;\n }\n\n if (e.code === 'Escape') {\n data.open = false;\n search.value = null;\n rootRef.value?.focus();\n }\n\n const options = unref(renderedOptionsRef);\n\n const { length } = options;\n\n if (!length) {\n return;\n }\n\n if (e.code === 'Enter') {\n selectOption(options.find((it) => it.index === activeIndex));\n }\n\n const localIndex = options.findIndex((it) => it.index === activeIndex) ?? -1;\n\n const delta = e.code === 'ArrowDown' ? 1 : e.code === 'ArrowUp' ? -1 : 0;\n\n const newIndex = Math.abs(localIndex + delta + length) % length;\n\n data.activeIndex = renderedOptionsRef.value[newIndex].index ?? -1;\n};\n\nuseLabelNotch(rootRef);\n\nwatch(() => model.value, updateActive, { immediate: true });\n\nwatch(\n () => data.open,\n (open) => (open ? input.value?.focus() : ''),\n);\n\nwatchPostEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n search.value; // to watch\n\n if (data.activeIndex >= 0 && data.open) {\n overlayRef.value?.scrollIntoActive();\n }\n});\n\nconst searchDebounced = refDebounced(search, 300, { maxWait: 1000 });\n\nconst optionsRequest = useWatchFetch(() => searchDebounced.value, async (v) => {\n if (v !== null) { // search is null when dropdown is closed;\n return props.optionsSearch(v);\n }\n return [];\n});\n\nconst modelOptionRequest = useWatchFetch(() => model.value, async (v) => {\n if (v && !deepEqual(modelOptionRef.value?.value, v)) { // load label for selected value if it was updated from outside the component\n if (props.modelSearch) {\n return props.modelSearch(v);\n }\n return (await props.optionsSearch(String(v)))?.[0];\n }\n return modelOptionRef.value;\n});\n\nwatch(() => optionsRequest.value, (result) => {\n if (result) {\n loadedOptionsRef.value = result;\n if (search.value !== null) {\n isLoadingError.value = false;\n }\n }\n});\n\nwatch(() => modelOptionRequest.value, (result) => {\n if (result) {\n modelOptionRef.value = normalizeListOptions([result])[0];\n }\n});\n\nwatch(() => optionsRequest.error, (err) => {\n if (err) {\n isLoadingError.value = Boolean(err);\n }\n});\n\nwatch(() => optionsRequest.loading || modelOptionRequest.loading, (loading) => {\n isLoadingOptions.value = loading;\n});\n</script>\n\n<template>\n <div class=\"pl-autocomplete__envelope\" @click.stop=\"setFocusOnInput\">\n <div\n ref=\"rootRef\"\n :tabindex=\"tabindex\"\n class=\"pl-autocomplete\"\n :class=\"{ open: data.open, error: Boolean(computedError), disabled: isDisabled }\"\n @keydown=\"handleKeydown\"\n @focusout=\"onFocusOut\"\n >\n <div class=\"pl-autocomplete__container\">\n <div class=\"pl-autocomplete__field\">\n <input\n ref=\"input\"\n v-model=\"search\"\n type=\"text\"\n tabindex=\"-1\"\n :disabled=\"isDisabled\"\n :placeholder=\"computedPlaceholder\"\n spellcheck=\"false\"\n autocomplete=\"chrome-off\"\n @focus=\"onInputFocus\"\n />\n\n <div v-if=\"!data.open\" class=\"input-value\">\n <LongText> {{ textValue }} </LongText>\n </div>\n\n <div class=\"pl-autocomplete__controls\">\n <PlMaskIcon24 v-if=\"isLoadingOptions\" name=\"loading\" />\n <PlIcon16 v-if=\"clearable && hasValue\" class=\"clear\" name=\"delete-clear\" @click.stop=\"clear\" />\n <slot name=\"append\" />\n <div class=\"pl-autocomplete__arrow-wrapper\" @click.stop=\"toggleOpen\">\n <div v-if=\"arrowIconLarge\" class=\"arrow-icon\" :class=\"[`icon-24 ${arrowIconLarge}`]\" />\n <div v-else-if=\"arrowIcon\" class=\"arrow-icon\" :class=\"[`icon-16 ${arrowIcon}`]\" />\n <div v-else class=\"arrow-icon arrow-icon-default\" />\n </div>\n </div>\n </div>\n <label v-if=\"label\">\n <SvgRequired v-if=\"required\" />\n <span>{{ label }}</span>\n <PlTooltip v-if=\"slots.tooltip\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n </PlTooltip>\n </label>\n <DropdownOverlay v-if=\"data.open\" ref=\"overlay\" :root=\"rootRef\" class=\"pl-autocomplete__options\" tabindex=\"-1\" :gap=\"3\">\n <DropdownListItem\n v-for=\"(item, index) in renderedOptionsRef\"\n :key=\"index\"\n :option=\"item\"\n :is-selected=\"item.isSelected\"\n :is-hovered=\"item.isActive\"\n :size=\"optionSize\"\n @click.stop=\"selectOption(item)\"\n />\n <div v-if=\"!renderedOptionsRef.length\" class=\"nothing-found\">Nothing found</div>\n </DropdownOverlay>\n <DoubleContour class=\"pl-autocomplete__contour\" />\n </div>\n </div>\n <div v-if=\"computedError\" class=\"pl-autocomplete__error\">{{ computedError }}</div>\n <div v-else-if=\"isLoadingOptions && loadingOptionsHelper\" class=\"pl-autocomplete__helper\">{{ loadingOptionsHelper }}</div>\n <div v-else-if=\"helper\" class=\"pl-autocomplete__helper\">{{ helper }}</div>\n </div>\n</template>\n"],"names":["__default__","model","_useModel","props","__props","slots","_useSlots","rootRef","ref","input","overlayRef","useTemplateRef","search","data","reactive","findActiveIndex","tap","renderedOptionsRef","o","deepEqual","v","updateActive","loadedOptionsRef","modelOptionRef","computed","normalizeListOptions","opt","index","selectedIndex","isLoadingOptions","isLoadingError","isDisabled","computedError","getErrorMessage","textValue","modelOption","unref","options","item","computedPlaceholder","hasValue","tabindex","selectOption","_a","clear","setFocusOnInput","toggleOpen","watch","onInputFocus","onFocusOut","event","relatedTarget","_c","_b","handleKeydown","open","activeIndex","length","it","localIndex","delta","newIndex","useLabelNotch","watchPostEffect","searchDebounced","refDebounced","optionsRequest","useWatchFetch","modelOptionRequest","result","err","loading"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIAA,KAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;;;;;;;;;;;;;AA2BA,UAAMC,IAAQC,kBAAiC,GAEzCC,IAAQC,GA4ERC,IAAQC,GAAA,GAIRC,IAAUC,EAAA,GACVC,IAAQD,EAAA,GAERE,IAAaC,GAAe,SAAS,GAErCC,IAASJ,EAAmB,IAAI,GAChCK,IAAOC,GAAS;AAAA,MACpB,aAAa;AAAA,MACb,MAAM;AAAA,IAAA,CACP,GAEKC,IAAkB,MACtBC;AAAA,MACEC,EAAmB,MAAM,UAAU,CAACC,MAAMC,EAAUD,EAAE,OAAOjB,EAAM,KAAK,CAAC;AAAA,MAC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ACD,GAAUwB,IAAApB,EAAe,UAAf,gBAAAoB,EAAsB,OAAOvB,CAAC,IAC5CjB,EAAM,cACDA,EAAM,YAAYiB,CAAC,KAEpBiC,IAAA,MAAMlD,EAAM,cAAc,OAAOiB,CAAC,CAAC,MAAnC,gBAAAiC,EAAwC,KAE3C9B,EAAe;AAAA,IACxB,CAAC;AAED,WAAAwB,EAAM,MAAMmB,EAAe,OAAO,CAACG,MAAW;AAC5C,MAAIA,MACF/C,EAAiB,QAAQ+C,GACrBzD,EAAO,UAAU,SACnBkB,EAAe,QAAQ;AAAA,IAG7B,CAAC,GAEDiB,EAAM,MAAMqB,EAAmB,OAAO,CAACC,MAAW;AAChD,MAAIA,MACF9C,EAAe,QAAQE,EAAqB,CAAC4C,CAAM,CAAC,EAAE,CAAC;AAAA,IAE3D,CAAC,GAEDtB,EAAM,MAAMmB,EAAe,OAAO,CAACI,MAAQ;AACzC,MAAIA,MACFxC,EAAe,QAAQ,EAAQwC;AAAA,IAEnC,CAAC,GAEDvB,EAAM,MAAMmB,EAAe,WAAWE,EAAmB,SAAS,CAACG,MAAY;AAC7E,MAAA1C,EAAiB,QAAQ0C;AAAA,IAC3B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"PlAutocomplete.vue.js","sources":["../../../src/components/PlAutocomplete/PlAutocomplete.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * A component for selecting one value from a big list of options using string search request\n */\nexport default {\n name: 'PlAutocomplete',\n};\n</script>\n\n<script lang=\"ts\" setup generic=\"M = unknown\">\nimport './pl-autocomplete.scss';\nimport { computed, reactive, ref, unref, useTemplateRef, watch, watchPostEffect } from 'vue';\nimport { tap } from '../../helpers/functions';\nimport { PlTooltip } from '../PlTooltip';\nimport DoubleContour from '../../utils/DoubleContour.vue';\nimport { useLabelNotch } from '../../utils/useLabelNotch';\nimport type { ListOption, ListOptionNormalized } from '../../types';\nimport { deepEqual } from '../../helpers/objects';\nimport DropdownListItem from '../DropdownListItem.vue';\nimport LongText from '../LongText.vue';\nimport { normalizeListOptions } from '../../helpers/utils';\nimport { PlIcon16 } from '../PlIcon16';\nimport { PlMaskIcon24 } from '../PlMaskIcon24';\nimport { DropdownOverlay } from '../../utils/DropdownOverlay';\nimport { refDebounced } from '@vueuse/core';\nimport { useWatchFetch } from '../../composition/useWatchFetch.ts';\nimport { getErrorMessage } from '../../helpers/error.ts';\nimport type { ListOptionBase } from '@platforma-sdk/model';\nimport { PlSvg } from '../PlSvg';\nimport SvgRequired from '../../assets/images/required.svg?raw';\n\n/**\n * The current selected value.\n */\nconst model = defineModel<M>({ required: true });\n\nconst props = withDefaults(\n defineProps<{\n /**\n * Lambda for requesting of available options for the dropdown by search string.\n */\n optionsSearch: (s: string) => Promise<ListOption<M>[]>;\n /**\n * Lambda for requesting of corresponding option for current model value. If empty, optionsSearch is used for this.\n */\n modelSearch?: (v: M) => Promise<ListOption<M>>;\n /**\n * The label text for the dropdown field (optional)\n */\n label?: string;\n /**\n * A helper text displayed below the dropdown when there are no errors (optional).\n */\n helper?: string;\n /**\n * A helper text displayed below the dropdown when there are no options yet or options is undefined (optional).\n */\n loadingOptionsHelper?: string;\n /**\n * Error message displayed below the dropdown (optional)\n */\n error?: unknown;\n /**\n * Placeholder text shown when no value is selected.\n */\n placeholder?: string;\n /**\n * Enables a button to clear the selected value (default: false)\n */\n clearable?: boolean;\n /**\n * If `true`, the dropdown component is marked as required.\n */\n required?: boolean;\n /**\n * If `true`, the dropdown component is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n /**\n * Custom icon (16px) class for the dropdown arrow (optional)\n */\n arrowIcon?: string;\n /**\n * Custom icon (24px) class for the dropdown arrow (optional)\n */\n arrowIconLarge?: string;\n /**\n * Option list item size\n */\n optionSize?: 'small' | 'medium';\n /**\n * Formatter for the selected value if its label is absent\n */\n formatValue?: (value: M) => string;\n }>(),\n {\n modelSearch: undefined,\n label: '',\n helper: undefined,\n loadingOptionsHelper: undefined,\n error: undefined,\n placeholder: '...',\n clearable: false,\n required: false,\n disabled: false,\n arrowIcon: undefined,\n arrowIconLarge: undefined,\n optionSize: 'small',\n formatValue: (v: M) => String(v),\n },\n);\n\nconst slots = defineSlots<{\n [key: string]: unknown;\n}>();\n\nconst rootRef = ref<HTMLElement | undefined>();\nconst input = ref<HTMLInputElement | undefined>();\n\nconst overlayRef = useTemplateRef('overlay');\n\nconst search = ref<string | null>(null);\nconst data = reactive({\n activeIndex: -1,\n open: false,\n});\n\nconst findActiveIndex = () =>\n tap(\n renderedOptionsRef.value.findIndex((o) => deepEqual(o.value, model.value)),\n (v) => (v < 0 ? 0 : v),\n );\n\nconst updateActive = () => (data.activeIndex = findActiveIndex());\n\nconst loadedOptionsRef = ref<ListOption<M>[]>([]);\nconst modelOptionRef = ref<ListOptionNormalized<M> | undefined>(); // list of 1 option that is selected or empty, to keep selected label\n\nconst renderedOptionsRef = computed(() => {\n return normalizeListOptions(loadedOptionsRef.value).map((opt, index) => ({\n ...opt,\n index,\n isSelected: index === selectedIndex.value,\n isActive: index === data.activeIndex,\n })) as (ListOptionBase<M> & { index: number; isSelected: boolean; isActive: boolean })[];\n});\nconst isLoadingOptions = ref<boolean>(true);\nconst isLoadingError = ref<boolean>(false);\n\nconst isDisabled = computed(() => {\n return props.disabled;\n});\n\nconst selectedIndex = computed(() => {\n return loadedOptionsRef.value.findIndex((o) => deepEqual(o.value, model.value));\n});\n\nconst computedError = computed(() => {\n if (isLoadingOptions.value) {\n return undefined;\n }\n\n if (props.error) {\n return getErrorMessage(props.error);\n }\n\n if (isLoadingError.value) {\n return 'Data loading error';\n }\n\n return undefined;\n});\n\nconst textValue = computed(() => {\n const modelOption = unref(modelOptionRef);\n const options = unref(renderedOptionsRef);\n\n const item: ListOptionNormalized | undefined = modelOption ?? options.find((o) => deepEqual(o.value, model.value)) ?? options.find((o) => deepEqual(o.value, model.value));\n\n return item?.label || (model.value ? props.formatValue(model.value) : '');\n});\n\nconst computedPlaceholder = computed(() => {\n if (!data.open && model.value) {\n return '';\n }\n\n return model.value ? String(textValue.value) : props.placeholder;\n});\n\nconst hasValue = computed(() => {\n return model.value !== undefined && model.value !== null;\n});\n\nconst tabindex = computed(() => (isDisabled.value ? undefined : '0'));\n\nconst selectOption = (v: ListOptionBase<M> & { index: number } | undefined) => {\n model.value = v?.value as M;\n modelOptionRef.value = v;\n search.value = null;\n data.open = false;\n rootRef?.value?.focus();\n};\n\nconst clear = () => {\n model.value = undefined as M;\n modelOptionRef.value = undefined;\n};\n\nconst setFocusOnInput = () => input.value?.focus();\n\nconst toggleOpen = () => {\n data.open = !data.open;\n};\n\nwatch(() => data.open, (v) => {\n search.value = v ? '' : null;\n});\n\nconst onInputFocus = () => {\n data.open = true;\n};\n\nconst onFocusOut = (event: FocusEvent) => {\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (!rootRef.value?.contains(relatedTarget) && !overlayRef.value?.listRef?.contains(relatedTarget)) {\n search.value = null;\n data.open = false;\n }\n};\n\nconst handleKeydown = (e: { code: string; preventDefault(): void }) => {\n if (!['ArrowDown', 'ArrowUp', 'Enter', 'Escape'].includes(e.code)) {\n return;\n } else {\n e.preventDefault();\n }\n\n const { open, activeIndex } = data;\n\n if (!open) {\n if (e.code === 'Enter') {\n data.open = true;\n search.value = '';\n }\n return;\n }\n\n if (e.code === 'Escape') {\n data.open = false;\n search.value = null;\n rootRef.value?.focus();\n }\n\n const options = unref(renderedOptionsRef);\n\n const { length } = options;\n\n if (!length) {\n return;\n }\n\n if (e.code === 'Enter') {\n selectOption(options.find((it) => it.index === activeIndex));\n }\n\n const localIndex = options.findIndex((it) => it.index === activeIndex) ?? -1;\n\n const delta = e.code === 'ArrowDown' ? 1 : e.code === 'ArrowUp' ? -1 : 0;\n\n const newIndex = Math.abs(localIndex + delta + length) % length;\n\n data.activeIndex = renderedOptionsRef.value[newIndex].index ?? -1;\n};\n\nuseLabelNotch(rootRef);\n\nwatch(() => model.value, updateActive, { immediate: true });\n\nwatch(\n () => data.open,\n (open) => (open ? input.value?.focus() : ''),\n);\n\nwatchPostEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n search.value; // to watch\n\n if (data.activeIndex >= 0 && data.open) {\n overlayRef.value?.scrollIntoActive();\n }\n});\n\nconst searchDebounced = refDebounced(search, 300, { maxWait: 1000 });\n\nconst optionsRequest = useWatchFetch(() => searchDebounced.value, async (v) => {\n if (v !== null) { // search is null when dropdown is closed;\n return props.optionsSearch(v);\n }\n return undefined;\n});\n\nconst modelOptionRequest = useWatchFetch(() => model.value, async (v) => {\n if (v && !deepEqual(modelOptionRef.value?.value, v)) { // load label for selected value if it was updated from outside the component\n if (props.modelSearch) {\n return props.modelSearch(v);\n }\n return (await props.optionsSearch(String(v)))?.[0];\n }\n return modelOptionRef.value;\n});\n\nwatch(() => optionsRequest.value, (result) => {\n if (result) {\n loadedOptionsRef.value = result;\n if (search.value !== null) {\n isLoadingError.value = false;\n }\n }\n});\n\nwatch(() => modelOptionRequest.value, (result) => {\n if (result) {\n modelOptionRef.value = normalizeListOptions([result])[0];\n }\n});\n\nwatch(() => optionsRequest.error, (err) => {\n if (err) {\n isLoadingError.value = Boolean(err);\n }\n});\n\nwatch(() => optionsRequest.loading || modelOptionRequest.loading, (loading) => {\n isLoadingOptions.value = loading;\n});\n</script>\n\n<template>\n <div class=\"pl-autocomplete__envelope\" @click.stop=\"setFocusOnInput\">\n <div\n ref=\"rootRef\"\n :tabindex=\"tabindex\"\n class=\"pl-autocomplete\"\n :class=\"{ open: data.open, error: Boolean(computedError), disabled: isDisabled }\"\n @keydown=\"handleKeydown\"\n @focusout=\"onFocusOut\"\n >\n <div class=\"pl-autocomplete__container\">\n <div class=\"pl-autocomplete__field\">\n <input\n ref=\"input\"\n v-model=\"search\"\n type=\"text\"\n tabindex=\"-1\"\n :disabled=\"isDisabled\"\n :placeholder=\"computedPlaceholder\"\n spellcheck=\"false\"\n autocomplete=\"chrome-off\"\n @focus=\"onInputFocus\"\n />\n\n <div v-if=\"!data.open\" class=\"input-value\">\n <LongText> {{ textValue }} </LongText>\n </div>\n\n <div class=\"pl-autocomplete__controls\">\n <PlMaskIcon24 v-if=\"isLoadingOptions\" name=\"loading\" />\n <PlIcon16 v-if=\"clearable && hasValue\" class=\"clear\" name=\"delete-clear\" @click.stop=\"clear\" />\n <slot name=\"append\" />\n <div class=\"pl-autocomplete__arrow-wrapper\" @click.stop=\"toggleOpen\">\n <div v-if=\"arrowIconLarge\" class=\"arrow-icon\" :class=\"[`icon-24 ${arrowIconLarge}`]\" />\n <div v-else-if=\"arrowIcon\" class=\"arrow-icon\" :class=\"[`icon-16 ${arrowIcon}`]\" />\n <div v-else class=\"arrow-icon arrow-icon-default\" />\n </div>\n </div>\n </div>\n <label v-if=\"label\">\n <PlSvg v-if=\"required\" :uri=\"SvgRequired\" />\n <span>{{ label }}</span>\n <PlTooltip v-if=\"slots.tooltip\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n </PlTooltip>\n </label>\n <DropdownOverlay v-if=\"data.open\" ref=\"overlay\" :root=\"rootRef\" class=\"pl-autocomplete__options\" tabindex=\"-1\" :gap=\"3\">\n <DropdownListItem\n v-for=\"(item, index) in renderedOptionsRef\"\n :key=\"index\"\n :option=\"item\"\n :is-selected=\"item.isSelected\"\n :is-hovered=\"item.isActive\"\n :size=\"optionSize\"\n @click.stop=\"selectOption(item)\"\n />\n <div v-if=\"!renderedOptionsRef.length\" class=\"nothing-found\">Nothing found</div>\n </DropdownOverlay>\n <DoubleContour class=\"pl-autocomplete__contour\" />\n </div>\n </div>\n <div v-if=\"computedError\" class=\"pl-autocomplete__error\">{{ computedError }}</div>\n <div v-else-if=\"isLoadingOptions && loadingOptionsHelper\" class=\"pl-autocomplete__helper\">{{ loadingOptionsHelper }}</div>\n <div v-else-if=\"helper\" class=\"pl-autocomplete__helper\">{{ helper }}</div>\n </div>\n</template>\n"],"names":["__default__","model","_useModel","props","__props","slots","_useSlots","rootRef","ref","input","overlayRef","useTemplateRef","search","data","reactive","findActiveIndex","tap","renderedOptionsRef","o","deepEqual","v","updateActive","loadedOptionsRef","modelOptionRef","computed","normalizeListOptions","opt","index","selectedIndex","isLoadingOptions","isLoadingError","isDisabled","computedError","getErrorMessage","textValue","modelOption","unref","options","item","computedPlaceholder","hasValue","tabindex","selectOption","_a","clear","setFocusOnInput","toggleOpen","watch","onInputFocus","onFocusOut","event","relatedTarget","_c","_b","handleKeydown","open","activeIndex","length","it","localIndex","delta","newIndex","useLabelNotch","watchPostEffect","searchDebounced","refDebounced","optionsRequest","useWatchFetch","modelOptionRequest","result","err","loading"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIAA,KAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;;;;;;;;;;;;;AA4BA,UAAMC,IAAQC,kBAAiC,GAEzCC,IAAQC,GA4ERC,IAAQC,GAAA,GAIRC,IAAUC,EAAA,GACVC,IAAQD,EAAA,GAERE,IAAaC,GAAe,SAAS,GAErCC,IAASJ,EAAmB,IAAI,GAChCK,IAAOC,GAAS;AAAA,MACpB,aAAa;AAAA,MACb,MAAM;AAAA,IAAA,CACP,GAEKC,IAAkB,MACtBC;AAAA,MACEC,EAAmB,MAAM,UAAU,CAACC,MAAMC,EAAUD,EAAE,OAAOjB,EAAM,KAAK,CAAC;AAAA,MACzE,CAACmB,MAAOA,IAAI,IAAI,IAAIA;AAAA,IAAA,GAGlBC,IAAe,MAAOR,EAAK,cAAcE,EAAA,GAEzCO,IAAmBd,EAAqB,EAAE,GAC1Ce,IAAiBf,EAAA,GAEjBS,IAAqBO,EAAS,MAC3BC,EAAqBH,EAAiB,KAAK,EAAE,IAAI,CAACI,GAAKC,OAAW;AAAA,MACvE,GAAGD;AAAA,MACH,OAAAC;AAAA,MACA,YAAYA,MAAU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