@nmorph/nmorph-ui-kit 2.2.15 → 2.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -8
- package/dist/components/basic/nmorph-button/NmorphButton.css +1 -1
- package/dist/components/basic/nmorph-button/NmorphButton.vue.js +12 -12
- package/dist/components/basic/nmorph-button/NmorphButton.vue2.js +17 -14
- package/dist/components/data/nmorph-badge/NmorphBadge.css +1 -1
- package/dist/components/data/nmorph-calendar/NmorphCalendar.vue2.js +1 -1
- package/dist/components/data/nmorph-calendar/utils.js +65 -52
- package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue.js +39 -37
- package/dist/components/data/nmorph-table/NmorphTable.css +1 -1
- package/dist/components/data/nmorph-table/NmorphTable.vue.js +228 -225
- package/dist/components/data/nmorph-table/NmorphTable.vue2.js +57 -43
- package/dist/components/feedback/nmorph-dialog/NmorphDialog.vue.js +47 -47
- package/dist/components/feedback/nmorph-dialog/NmorphDialog.vue2.js +28 -25
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.css +1 -1
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.js +102 -92
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +67 -44
- package/dist/components/form/nmorph-date-picker/NmorphDatePicker.css +1 -1
- package/dist/components/form/nmorph-date-picker/NmorphDatePicker.vue2.js +45 -33
- package/dist/components/form/nmorph-date-picker/inner-components/nmorph-date-picker-content/NmorphDatePickerContent.vue2.js +1 -1
- package/dist/components/form/nmorph-form/use-form-item-input.js +7 -8
- package/dist/components/form/nmorph-select/NmorphSelect.css +1 -1
- package/dist/components/form/nmorph-select/NmorphSelect.vue.js +135 -125
- package/dist/components/form/nmorph-select/NmorphSelect.vue2.js +76 -65
- package/dist/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue.js +15 -12
- package/dist/components/form/nmorph-switch/NmorphSwitch.vue.js +15 -14
- package/dist/components/form/nmorph-text-input/NmorphTextInput.vue.js +22 -21
- package/dist/components/form/nmorph-text-input/NmorphTextInput.vue2.js +16 -16
- package/dist/components/navigation/nmorph-context-menu/NmorphContextMenu.css +1 -0
- package/dist/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.js +51 -0
- package/dist/components/navigation/nmorph-context-menu/NmorphContextMenu.vue2.js +72 -0
- package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.css +1 -1
- package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue.js +23 -23
- package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue2.js +31 -25
- package/dist/components/others/nmorph-overlay/NmorphOverlay.vue.js +42 -18
- package/dist/components/others/nmorph-overlay/NmorphOverlay.vue2.js +66 -19
- package/dist/hooks/use-common-styles.js +42 -33
- package/dist/hooks/use-virtual-list.js +65 -37
- package/dist/icons.d.ts +2 -0
- package/dist/icons.js +539 -0
- package/dist/index.es.js +656 -653
- package/dist/index.umd.js +63 -65
- package/dist/nuxt.mjs +10 -5
- package/dist/outside-hooks/use-nmorph-theme.js +97 -98
- package/dist/package.json.js +1 -1
- package/dist/plugin.js +43 -43
- package/dist/src/components/data/nmorph-calendar/types.d.ts +8 -1
- package/dist/src/components/data/nmorph-calendar/utils.d.ts +2 -1
- package/dist/src/components/data/nmorph-table/NmorphTable.vue.d.ts +2 -0
- package/dist/src/components/feedback/nmorph-dialog/NmorphDialog.vue.d.ts +2 -0
- package/dist/src/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.d.ts +2 -0
- package/dist/src/components/form/nmorph-date-picker/NmorphDatePicker.vue.d.ts +13 -1
- package/dist/src/components/form/nmorph-select/NmorphSelect.vue.d.ts +2 -0
- package/dist/src/components/form/nmorph-text-input/NmorphTextInput.vue.d.ts +2 -0
- package/dist/src/components/navigation/index.d.ts +1 -0
- package/dist/src/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.d.ts +64 -0
- package/dist/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue.d.ts +10 -0
- package/dist/src/components/others/nmorph-overlay/NmorphOverlay.vue.d.ts +12 -1
- package/dist/src/hooks/use-virtual-list.d.ts +3 -0
- package/dist/src/icons.d.ts +3 -0
- package/dist/src/styles.d.ts +2 -0
- package/dist/style.css +1 -1
- package/dist/styles.d.ts +2 -0
- package/dist/styles.js +7 -0
- package/dist/utils/theme-style.js +27 -38
- package/package.json +11 -1
|
@@ -1,60 +1,60 @@
|
|
|
1
1
|
import './NmorphDialog.css';
|
|
2
|
-
import
|
|
3
|
-
import { openBlock as
|
|
2
|
+
import s from "./NmorphDialog.vue2.js";
|
|
3
|
+
import { openBlock as l, createBlock as c, withCtx as i, createElementVNode as e, normalizeStyle as d, normalizeClass as t, renderSlot as a, toDisplayString as m, createElementBlock as p, createVNode as n, createCommentVNode as _ } from "vue";
|
|
4
4
|
/* empty css */
|
|
5
|
-
import
|
|
6
|
-
const f = { class: "nmorph-dialog__header" },
|
|
7
|
-
function
|
|
8
|
-
return
|
|
5
|
+
import h from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
6
|
+
const f = ["aria-label"], g = { class: "nmorph-dialog__header" }, v = { class: "nmorph-dialog__title" }, k = { class: "nmorph-dialog__content" };
|
|
7
|
+
function y(r, N, w, o, C, O) {
|
|
8
|
+
return l(), c(o.NmorphOverlay, {
|
|
9
9
|
show: o.isVisible,
|
|
10
10
|
"z-index": o.props.zIndex,
|
|
11
|
-
|
|
11
|
+
"close-on-escape": o.props.closeOnEscape,
|
|
12
|
+
"trap-focus": "",
|
|
13
|
+
onOnOutsideClick: o.clickOnOverlay,
|
|
14
|
+
onOnEscapeKeydown: o.closeHandler
|
|
12
15
|
}, {
|
|
13
|
-
default:
|
|
14
|
-
e(
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
])
|
|
44
|
-
]),
|
|
45
|
-
e("div", k, [
|
|
46
|
-
n(r.$slots, "default")
|
|
16
|
+
default: i(() => [
|
|
17
|
+
e("div", {
|
|
18
|
+
class: t(o.modifiers),
|
|
19
|
+
style: d({ "--nmorph-dialog-width": o.props.width }),
|
|
20
|
+
role: "dialog",
|
|
21
|
+
"aria-modal": "true",
|
|
22
|
+
"aria-label": o.props.title || void 0
|
|
23
|
+
}, [
|
|
24
|
+
e("div", g, [
|
|
25
|
+
a(r.$slots, "header", {}, () => [
|
|
26
|
+
e(
|
|
27
|
+
"div",
|
|
28
|
+
v,
|
|
29
|
+
m(o.props.title),
|
|
30
|
+
1
|
|
31
|
+
/* TEXT */
|
|
32
|
+
),
|
|
33
|
+
o.props.showClose ? (l(), p("div", {
|
|
34
|
+
key: 0,
|
|
35
|
+
class: "nmorph-dialog__close-icon",
|
|
36
|
+
onClick: o.closeHandler
|
|
37
|
+
}, [
|
|
38
|
+
n(o.NmorphIcon, null, {
|
|
39
|
+
default: i(() => [
|
|
40
|
+
n(o.NmorphIconCross)
|
|
41
|
+
]),
|
|
42
|
+
_: 1
|
|
43
|
+
/* STABLE */
|
|
44
|
+
})
|
|
45
|
+
])) : _("v-if", !0)
|
|
47
46
|
])
|
|
48
|
-
],
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
]),
|
|
48
|
+
e("div", k, [
|
|
49
|
+
a(r.$slots, "default")
|
|
50
|
+
])
|
|
51
|
+
], 14, f)
|
|
52
52
|
]),
|
|
53
53
|
_: 3
|
|
54
54
|
/* FORWARDED */
|
|
55
|
-
}, 8, ["show", "z-index"]);
|
|
55
|
+
}, 8, ["show", "z-index", "close-on-escape"]);
|
|
56
56
|
}
|
|
57
|
-
const V = /* @__PURE__ */
|
|
57
|
+
const V = /* @__PURE__ */ h(s, [["render", y], ["__file", "/builds/ketjo/nmorph/library/src/components/feedback/nmorph-dialog/NmorphDialog.vue"]]);
|
|
58
58
|
export {
|
|
59
59
|
V as default
|
|
60
60
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import './NmorphDialog.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import
|
|
2
|
+
import { defineComponent as f, computed as c, ref as d, watch as y } from "vue";
|
|
3
|
+
import { useModifiers as O } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import v from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
5
5
|
import T from "../../others/nmorph-overlay/NmorphOverlay.vue.js";
|
|
6
6
|
import h from "../../../assets/icons/cross.svg.js";
|
|
7
|
-
const C = /* @__PURE__ */
|
|
7
|
+
const C = /* @__PURE__ */ f({
|
|
8
8
|
__name: "NmorphDialog",
|
|
9
9
|
props: {
|
|
10
10
|
modelValue: { type: Boolean, required: !1, default: !1 },
|
|
@@ -15,50 +15,53 @@ const C = /* @__PURE__ */ d({
|
|
|
15
15
|
closeOnClickModal: { type: Boolean, required: !1, default: !0 },
|
|
16
16
|
showClose: { type: Boolean, required: !1, default: !0 },
|
|
17
17
|
zIndex: { type: Number, required: !1, default: void 0 },
|
|
18
|
-
closeOnOverlay: { type: Boolean, required: !1, default: !0 }
|
|
18
|
+
closeOnOverlay: { type: Boolean, required: !1, default: !0 },
|
|
19
|
+
closeOnEscape: { type: Boolean, required: !1, default: !0 }
|
|
19
20
|
},
|
|
20
21
|
emits: ["on-close", "update:model-value"],
|
|
21
|
-
setup(
|
|
22
|
+
setup(i, { expose: n, emit: m }) {
|
|
22
23
|
n();
|
|
23
|
-
const e =
|
|
24
|
-
() =>
|
|
24
|
+
const e = i, r = m, p = c(
|
|
25
|
+
() => O({
|
|
25
26
|
"nmorph-dialog": []
|
|
26
27
|
})
|
|
27
|
-
), u =
|
|
28
|
-
let
|
|
28
|
+
), u = d(e.modelValue);
|
|
29
|
+
let t = null, l = null;
|
|
29
30
|
y(
|
|
30
31
|
() => e.modelValue,
|
|
31
|
-
(
|
|
32
|
-
|
|
32
|
+
(o) => {
|
|
33
|
+
o ? (l && clearTimeout(l), t = setTimeout(() => {
|
|
33
34
|
u.value = !0;
|
|
34
|
-
}, e.openDelay)) : (
|
|
35
|
+
}, e.openDelay)) : (t && clearTimeout(t), l = setTimeout(() => {
|
|
35
36
|
u.value = !1;
|
|
36
37
|
}, e.closeDelay));
|
|
37
38
|
},
|
|
38
39
|
{ immediate: !0 }
|
|
39
40
|
);
|
|
40
41
|
const a = () => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
o = r;
|
|
48
|
-
}, get closeTimeout() {
|
|
42
|
+
r("on-close"), t && clearTimeout(t);
|
|
43
|
+
const o = () => {
|
|
44
|
+
r("update:model-value", !1);
|
|
45
|
+
};
|
|
46
|
+
e.closeDelay <= 0 ? o() : l = setTimeout(o, e.closeDelay);
|
|
47
|
+
}, s = { props: e, emit: r, modifiers: p, isVisible: u, get openTimeout() {
|
|
49
48
|
return t;
|
|
50
|
-
}, set
|
|
51
|
-
t =
|
|
49
|
+
}, set openTimeout(o) {
|
|
50
|
+
t = o;
|
|
51
|
+
}, get closeTimeout() {
|
|
52
|
+
return l;
|
|
53
|
+
}, set closeTimeout(o) {
|
|
54
|
+
l = o;
|
|
52
55
|
}, closeHandler: a, clickOnOverlay: () => {
|
|
53
56
|
e.closeOnOverlay && a();
|
|
54
57
|
}, get NmorphOverlay() {
|
|
55
58
|
return T;
|
|
56
59
|
}, get NmorphIcon() {
|
|
57
|
-
return
|
|
60
|
+
return v;
|
|
58
61
|
}, get NmorphIconCross() {
|
|
59
62
|
return h;
|
|
60
63
|
} };
|
|
61
|
-
return Object.defineProperty(
|
|
64
|
+
return Object.defineProperty(s, "__isScriptSetup", { enumerable: !1, value: !0 }), s;
|
|
62
65
|
}
|
|
63
66
|
});
|
|
64
67
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.nmorph-autocomplete .nmorph-autocomplete__list-item{padding:var(--indentation-02) var(--indentation-04);cursor:pointer}.nmorph-autocomplete .nmorph-autocomplete__list-item:last-child{border-bottom-right-radius:var(--indentation-02);border-bottom-left-radius:var(--indentation-02)}.nmorph-autocomplete .nmorph-autocomplete__loading{display:flex;justify-content:center;align-items:center;height:100px}.nmorph-autocomplete .nmorph-autocomplete__list-item:hover{color:var(--nmorph-white-color);background:var(--nmorph-accent-color)}.nmorph-autocomplete .nmorph-autocomplete__list--virtual{overflow-y:auto}.nmorph-autocomplete .nmorph-autocomplete__list--virtual .nmorph-autocomplete__list-item{height:var(--autocomplete-virtual-item-height);overflow:hidden}.nmorph-autocomplete .nmorph-autocomplete__virtual-spacer{position:relative}.nmorph-autocomplete .nmorph-autocomplete__virtual-content{position:absolute;top:0;right:0;left:0}
|
|
1
|
+
.nmorph-autocomplete .nmorph-autocomplete__list-item{padding:var(--indentation-02) var(--indentation-04);cursor:pointer}.nmorph-autocomplete .nmorph-autocomplete__list-item:last-child{border-bottom-right-radius:var(--indentation-02);border-bottom-left-radius:var(--indentation-02)}.nmorph-autocomplete .nmorph-autocomplete__loading{display:flex;justify-content:center;align-items:center;height:100px}.nmorph-autocomplete .nmorph-autocomplete__list-item:hover,.nmorph-autocomplete .nmorph-autocomplete__list-item--focused{color:var(--nmorph-white-color);background:var(--nmorph-accent-color)}.nmorph-autocomplete .nmorph-autocomplete__list--virtual{overflow-y:auto}.nmorph-autocomplete .nmorph-autocomplete__list--virtual .nmorph-autocomplete__list-item{height:var(--autocomplete-virtual-item-height);overflow:hidden}.nmorph-autocomplete .nmorph-autocomplete__list--dynamic .nmorph-autocomplete__list-item{height:auto}.nmorph-autocomplete .nmorph-autocomplete__virtual-spacer{position:relative}.nmorph-autocomplete .nmorph-autocomplete__virtual-content{position:absolute;top:0;right:0;left:0}
|
|
@@ -1,31 +1,28 @@
|
|
|
1
1
|
import './NmorphAutocomplete.css';
|
|
2
2
|
import v from "./NmorphAutocomplete.vue2.js";
|
|
3
|
-
import { openBlock as l, createElementBlock as t, normalizeClass as
|
|
3
|
+
import { openBlock as l, createElementBlock as t, normalizeClass as i, createElementVNode as n, createVNode as d, createBlock as y, withCtx as p, renderSlot as c, normalizeStyle as m, Fragment as _, renderList as h, createTextVNode as f, toDisplayString as u, createCommentVNode as x } from "vue";
|
|
4
4
|
/* empty css */
|
|
5
|
-
import
|
|
6
|
-
const
|
|
5
|
+
import k from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
6
|
+
const b = { class: "nmorph-autocomplete__input-content" }, g = {
|
|
7
7
|
ref: "nmorphAutocompleteDOMRef",
|
|
8
8
|
class: "nmorph-autocomplete__input"
|
|
9
|
-
},
|
|
9
|
+
}, H = {
|
|
10
10
|
key: 0,
|
|
11
11
|
class: "nmorph-autocomplete__loading"
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
class: "nmorph-autocomplete__list"
|
|
15
|
-
}, S = ["onClick"];
|
|
16
|
-
function V(a, m, z, e, L, A) {
|
|
12
|
+
}, N = ["id"], C = ["id", "aria-selected", "onClick"], I = ["id"], O = ["id", "aria-selected", "onClick"];
|
|
13
|
+
function V(a, s, S, e, z, A) {
|
|
17
14
|
return l(), t(
|
|
18
15
|
"div",
|
|
19
16
|
{
|
|
20
|
-
class:
|
|
17
|
+
class: i(e.modifiers)
|
|
21
18
|
},
|
|
22
19
|
[
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
n("div", b, [
|
|
21
|
+
n(
|
|
25
22
|
"div",
|
|
26
|
-
|
|
23
|
+
g,
|
|
27
24
|
[
|
|
28
|
-
|
|
25
|
+
d(e.NmorphTextInput, {
|
|
29
26
|
id: e.props.id,
|
|
30
27
|
name: e.props.name,
|
|
31
28
|
autocomplete: e.props.autocomplete,
|
|
@@ -34,120 +31,133 @@ function V(a, m, z, e, L, A) {
|
|
|
34
31
|
"model-value": e.initialValue,
|
|
35
32
|
placeholder: e.props.placeholder,
|
|
36
33
|
clearable: e.props.clearable,
|
|
34
|
+
"input-attrs": e.inputAttrs,
|
|
37
35
|
onFocus: e.focusHandler,
|
|
36
|
+
onKeydown: e.keydownHandler,
|
|
38
37
|
"onUpdate:modelValue": e.updateValueHandler
|
|
39
|
-
}, null, 8, ["id", "name", "autocomplete", "height", "disabled", "model-value", "placeholder", "clearable"])
|
|
38
|
+
}, null, 8, ["id", "name", "autocomplete", "height", "disabled", "model-value", "placeholder", "clearable", "input-attrs"])
|
|
40
39
|
],
|
|
41
40
|
512
|
|
42
41
|
/* NEED_PATCH */
|
|
43
42
|
)
|
|
44
43
|
]),
|
|
45
|
-
e.nmorphAutocompleteDOMRef ? (l(),
|
|
44
|
+
e.nmorphAutocompleteDOMRef ? (l(), y(e.NmorphDropdown, {
|
|
46
45
|
key: 0,
|
|
47
46
|
open: e.open,
|
|
48
47
|
"relative-element": e.nmorphAutocompleteDOMRef,
|
|
49
48
|
"y-offset": 1,
|
|
50
49
|
"z-index": e.props.zIndex,
|
|
51
|
-
|
|
50
|
+
"aria-label": e.props.name || e.props.id || "autocomplete",
|
|
51
|
+
onOnOutsideClick: e.closeHandler,
|
|
52
|
+
onOnEscapeKeydown: e.closeHandler
|
|
52
53
|
}, {
|
|
53
|
-
default:
|
|
54
|
-
e.loader ? (l(), t("div",
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
default:
|
|
58
|
-
|
|
54
|
+
default: p(() => [
|
|
55
|
+
e.loader ? (l(), t("div", H, [
|
|
56
|
+
c(a.$slots, "loader", {}, () => [
|
|
57
|
+
d(e.NmorphIcon, { size: "large" }, {
|
|
58
|
+
default: p(() => [
|
|
59
|
+
d(e.NmorphIconLoader)
|
|
59
60
|
]),
|
|
60
61
|
_: 1
|
|
61
62
|
/* STABLE */
|
|
62
63
|
})
|
|
63
64
|
])
|
|
64
|
-
])) : e.virtualEnabled ? (l(), t(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
65
|
+
])) : e.virtualEnabled ? (l(), t("div", {
|
|
66
|
+
key: 1,
|
|
67
|
+
ref: e.virtualList.containerRef,
|
|
68
|
+
id: e.listboxId,
|
|
69
|
+
class: i(["nmorph-autocomplete__list nmorph-autocomplete__list--virtual", { "nmorph-autocomplete__list--dynamic": e.virtualDynamicHeight }]),
|
|
70
|
+
style: m({ "--autocomplete-virtual-item-height": `${e.virtualItemHeight}px`, maxHeight: e.virtualMaxHeight }),
|
|
71
|
+
role: "listbox",
|
|
72
|
+
onScroll: s[0] || (s[0] = (...o) => e.virtualList.scrollHandler && e.virtualList.scrollHandler(...o))
|
|
73
|
+
}, [
|
|
74
|
+
n(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
class: "nmorph-autocomplete__virtual-spacer",
|
|
78
|
+
style: m(e.virtualSpacerStyle)
|
|
79
|
+
},
|
|
80
|
+
[
|
|
81
|
+
n(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
class: "nmorph-autocomplete__virtual-content",
|
|
85
|
+
style: m(e.virtualContentStyle)
|
|
86
|
+
},
|
|
87
|
+
[
|
|
88
|
+
(l(!0), t(
|
|
89
|
+
_,
|
|
90
|
+
null,
|
|
91
|
+
h(e.virtualItems, (o) => (l(), t("div", {
|
|
92
|
+
id: e.getOptionId(o.index),
|
|
93
|
+
ref_for: !0,
|
|
94
|
+
ref: (r) => e.setVirtualItemRef(r, o.index),
|
|
95
|
+
key: o.index,
|
|
96
|
+
class: i(["nmorph-autocomplete__list-item", { "nmorph-autocomplete__list-item--focused": o.index === e.currentIndex }]),
|
|
97
|
+
role: "option",
|
|
98
|
+
"aria-selected": o.index === e.currentIndex,
|
|
99
|
+
onClick: () => e.clickHandler(o.item)
|
|
100
|
+
}, [
|
|
101
|
+
c(a.$slots, "default", {
|
|
102
|
+
scope: o.item
|
|
103
|
+
}, () => [
|
|
104
|
+
f(
|
|
105
|
+
u(o.item.value),
|
|
106
|
+
1
|
|
107
|
+
/* TEXT */
|
|
108
|
+
)
|
|
109
|
+
])
|
|
110
|
+
], 10, C))),
|
|
111
|
+
128
|
|
112
|
+
/* KEYED_FRAGMENT */
|
|
113
|
+
))
|
|
114
|
+
],
|
|
115
|
+
4
|
|
116
|
+
/* STYLE */
|
|
117
|
+
)
|
|
118
|
+
],
|
|
119
|
+
4
|
|
120
|
+
/* STYLE */
|
|
121
|
+
)
|
|
122
|
+
], 46, N)) : (l(), t("div", {
|
|
123
|
+
key: 2,
|
|
124
|
+
id: e.listboxId,
|
|
125
|
+
class: "nmorph-autocomplete__list",
|
|
126
|
+
role: "listbox"
|
|
127
|
+
}, [
|
|
121
128
|
(l(!0), t(
|
|
122
|
-
|
|
129
|
+
_,
|
|
123
130
|
null,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
131
|
+
h(e.filteredList, (o, r) => (l(), t("div", {
|
|
132
|
+
id: e.getOptionId(r),
|
|
133
|
+
key: r,
|
|
134
|
+
class: i(["nmorph-autocomplete__list-item", { "nmorph-autocomplete__list-item--focused": r === e.currentIndex }]),
|
|
135
|
+
role: "option",
|
|
136
|
+
"aria-selected": r === e.currentIndex,
|
|
127
137
|
onClick: () => e.clickHandler(o)
|
|
128
138
|
}, [
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
139
|
+
c(a.$slots, "default", { scope: o }, () => [
|
|
140
|
+
f(
|
|
141
|
+
u(o.value),
|
|
132
142
|
1
|
|
133
143
|
/* TEXT */
|
|
134
144
|
)
|
|
135
145
|
])
|
|
136
|
-
],
|
|
146
|
+
], 10, O))),
|
|
137
147
|
128
|
|
138
148
|
/* KEYED_FRAGMENT */
|
|
139
149
|
))
|
|
140
|
-
]))
|
|
150
|
+
], 8, I))
|
|
141
151
|
]),
|
|
142
152
|
_: 3
|
|
143
153
|
/* FORWARDED */
|
|
144
|
-
}, 8, ["open", "relative-element", "z-index"])) :
|
|
154
|
+
}, 8, ["open", "relative-element", "z-index", "aria-label"])) : x("v-if", !0)
|
|
145
155
|
],
|
|
146
156
|
2
|
|
147
157
|
/* CLASS */
|
|
148
158
|
);
|
|
149
159
|
}
|
|
150
|
-
const
|
|
160
|
+
const M = /* @__PURE__ */ k(v, [["render", V], ["__file", "/builds/ketjo/nmorph/library/src/components/form/nmorph-autocomplete/NmorphAutocomplete.vue"]]);
|
|
151
161
|
export {
|
|
152
|
-
|
|
162
|
+
M as default
|
|
153
163
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import './NmorphAutocomplete.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { useVirtualList as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
const
|
|
2
|
+
import { defineComponent as z, ref as i, computed as t, watch as c, nextTick as U } from "vue";
|
|
3
|
+
import { useModifiers as F } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { useVirtualList as P } from "../../../hooks/use-virtual-list.js";
|
|
5
|
+
import Y from "../nmorph-text-input/NmorphTextInput.vue.js";
|
|
6
|
+
import G from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
|
|
7
|
+
import J from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
8
|
+
import K from "../../../assets/icons/loader.svg.js";
|
|
9
|
+
const le = /* @__PURE__ */ z({
|
|
10
10
|
__name: "NmorphAutocomplete",
|
|
11
11
|
props: {
|
|
12
12
|
modelValue: { type: String, required: !1, default: "" },
|
|
@@ -19,6 +19,7 @@ const E = /* @__PURE__ */ k({
|
|
|
19
19
|
virtualItemHeight: { type: Number, required: !1, default: 34 },
|
|
20
20
|
virtualMaxHeight: { type: [Number, String], required: !1, default: 240 },
|
|
21
21
|
virtualOverscan: { type: Number, required: !1, default: 5 },
|
|
22
|
+
virtualDynamicHeight: { type: Boolean, required: !1, default: !1 },
|
|
22
23
|
id: { type: String, required: !1 },
|
|
23
24
|
name: { type: String, required: !1 },
|
|
24
25
|
autocomplete: { type: String, required: !1 },
|
|
@@ -27,52 +28,74 @@ const E = /* @__PURE__ */ k({
|
|
|
27
28
|
tabindex: { type: Number, required: !1 }
|
|
28
29
|
},
|
|
29
30
|
emits: ["update:model-value", "select"],
|
|
30
|
-
setup(
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
() =>
|
|
31
|
+
setup(D, { expose: k, emit: _ }) {
|
|
32
|
+
k();
|
|
33
|
+
const a = D, n = i(a.modelValue), d = _, C = t(
|
|
34
|
+
() => F({
|
|
34
35
|
"nmorph-autocomplete": []
|
|
35
36
|
})
|
|
36
|
-
),
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
enabled:
|
|
42
|
-
itemHeight:
|
|
43
|
-
overscan:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
), L = (e) => {
|
|
38
|
+
n.value = e, d("update:model-value", n.value);
|
|
39
|
+
}, r = i(!1), O = i(null), g = () => {
|
|
40
|
+
r.value = !1;
|
|
41
|
+
}, l = t(() => a.list.filter((e) => Object.keys(e).some((h) => String(e[h]).toLowerCase().includes(n.value.toLowerCase())))), p = t(() => a.virtual && l.value.length > 0), y = t(() => a.virtualItemHeight), b = t(() => a.virtualOverscan), I = t(() => a.virtualDynamicHeight), u = P(l, {
|
|
42
|
+
enabled: p,
|
|
43
|
+
itemHeight: y,
|
|
44
|
+
overscan: b,
|
|
45
|
+
dynamic: I
|
|
46
|
+
}), T = t(() => u.virtualItems.value), V = t(() => ({
|
|
47
|
+
height: `${u.totalHeight.value}px`
|
|
48
|
+
})), $ = t(() => ({
|
|
49
|
+
transform: `translateY(${u.offsetTop.value}px)`
|
|
50
|
+
})), x = (e) => typeof e == "number" ? `${e}px` : e, A = t(() => x(a.virtualMaxHeight)), o = i(0), f = t(() => l.value[o.value]), m = t(() => `${a.id || a.name || "nmorph-autocomplete"}-listbox`), H = (e) => `${m.value}-option-${e}`;
|
|
51
|
+
c(l, async (e) => {
|
|
52
|
+
r.value = e.length > 0, o.value = 0, await U(), u.scrollToIndex(0), u.refresh();
|
|
51
53
|
});
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
const v = (e) => {
|
|
55
|
+
d("select", e), n.value = e.value, setTimeout(() => {
|
|
56
|
+
r.value = !1;
|
|
55
57
|
});
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
e && (
|
|
58
|
+
}, M = (e) => {
|
|
59
|
+
v(e);
|
|
60
|
+
}, B = () => {
|
|
61
|
+
r.value = l.value.length > 0;
|
|
62
|
+
}, s = i(!1);
|
|
63
|
+
c(n, async (e) => {
|
|
64
|
+
e !== "" && a.actionCallback && (s.value = !0, await a.actionCallback(), s.value = !1);
|
|
65
|
+
}), c(s, (e) => {
|
|
66
|
+
e && (r.value = !0);
|
|
67
|
+
}), c(o, (e) => {
|
|
68
|
+
p.value && u.scrollToIndex(e);
|
|
63
69
|
});
|
|
64
|
-
const
|
|
65
|
-
|
|
70
|
+
const q = () => {
|
|
71
|
+
l.value.length && (r.value = !0, o.value = (o.value + 1) % l.value.length);
|
|
72
|
+
}, w = () => {
|
|
73
|
+
l.value.length && (r.value = !0, o.value = (o.value - 1 + l.value.length) % l.value.length);
|
|
74
|
+
}, N = () => {
|
|
75
|
+
!r.value || !f.value || v(f.value);
|
|
76
|
+
}, E = (e) => {
|
|
77
|
+
e.key === "ArrowDown" ? (e.preventDefault(), q()) : e.key === "ArrowUp" ? (e.preventDefault(), w()) : e.key === "Enter" ? (e.preventDefault(), N()) : e.key === "Escape" && (e.preventDefault(), g());
|
|
78
|
+
}, R = t(() => ({
|
|
79
|
+
role: "combobox",
|
|
80
|
+
"aria-autocomplete": "list",
|
|
81
|
+
"aria-expanded": r.value,
|
|
82
|
+
"aria-controls": m.value,
|
|
83
|
+
"aria-activedescendant": r.value ? H(o.value) : void 0
|
|
84
|
+
})), S = { props: a, initialValue: n, emit: d, modifiers: C, updateValueHandler: L, open: r, nmorphAutocompleteDOMRef: O, closeHandler: g, filteredList: l, virtualEnabled: p, virtualItemHeight: y, virtualOverscan: b, virtualDynamicHeight: I, virtualList: u, virtualItems: T, virtualSpacerStyle: V, virtualContentStyle: $, getCssSize: x, virtualMaxHeight: A, currentIndex: o, activeItem: f, listboxId: m, getOptionId: H, selectItem: v, clickHandler: M, focusHandler: B, loader: s, arrowDownHandler: q, arrowUpHandler: w, enterHandler: N, keydownHandler: E, inputAttrs: R, setVirtualItemRef: (e, h) => {
|
|
85
|
+
const j = e instanceof Element ? e : e?.$el;
|
|
86
|
+
u.measureElement(h, j);
|
|
87
|
+
}, get NmorphIcon() {
|
|
88
|
+
return J;
|
|
66
89
|
}, get NmorphDropdown() {
|
|
67
|
-
return
|
|
90
|
+
return G;
|
|
68
91
|
}, get NmorphTextInput() {
|
|
69
|
-
return
|
|
92
|
+
return Y;
|
|
70
93
|
}, get NmorphIconLoader() {
|
|
71
|
-
return
|
|
94
|
+
return K;
|
|
72
95
|
} };
|
|
73
|
-
return Object.defineProperty(
|
|
96
|
+
return Object.defineProperty(S, "__isScriptSetup", { enumerable: !1, value: !0 }), S;
|
|
74
97
|
}
|
|
75
98
|
});
|
|
76
99
|
export {
|
|
77
|
-
|
|
100
|
+
le as default
|
|
78
101
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.nmorph-date-picker{--width: 200px;position:relative;width:var(--width)}.nmorph-date-picker .nmorph-date-picker__date-wrapper,.nmorph-date-picker .nmorph-date-picker__date-range-wrapper{height:100%}.nmorph-date-picker .nmorph-date-picker__input{display:flex;justify-content:space-between;align-items:center;height:100%;padding:0 var(--indentation-03);overflow:hidden;background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--
|
|
1
|
+
.nmorph-date-picker{--width: 200px;position:relative;width:var(--width)}.nmorph-date-picker .nmorph-date-picker__date-wrapper,.nmorph-date-picker .nmorph-date-picker__date-range-wrapper{height:100%}.nmorph-date-picker .nmorph-date-picker__input{display:flex;justify-content:space-between;align-items:center;height:100%;padding:0 var(--indentation-03);overflow:hidden;background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-outset);cursor:pointer}.nmorph-date-picker .nmorph-date-picker__selected-value{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.nmorph-date-picker .nmorph-date-picker__input--open{background:var(--nmorph-main-color);box-shadow:var(--nmorph-shadow-inset)}.nmorph-date-picker .nmorph-date-picker__calendar-icon{margin-right:2px}.nmorph-date-picker .nmorph-date-picker__clear-button-wrapper{width:14px;height:14px;margin-right:1px}.nmorph-date-picker .nmorph-dropdown{padding:var(--indentation-03)}.nmorph-date-picker input{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;pointer-events:none}.nmorph-date-picker .nmorph-calendar{--table-data-cell-height: 42px}.nmorph-date-picker.nmorph-date-picker--daterange{--width: 250px}.nmorph-date-picker.nmorph-date-picker--daterange .nmorph-dropdown{display:flex;justify-content:space-between}.nmorph-date-picker.nmorph-date-picker--daterange .nmorph-date-picker__value-separator{padding:0 var(--indentation-03)}.nmorph-date-picker.nmorph-date-picker--daterange .nmorph-date-picker__selected-value{display:flex}.nmorph-date-picker.nmorph-date-picker--focus{outline:2px solid var(--nmorph-accent-color)}.nmorph-date-picker.nmorph-date-picker--disabled{cursor:not-allowed;opacity:.6}.nmorph-date-picker.nmorph-date-picker--disabled .nmorph-date-picker__date-wrapper{pointer-events:none}
|