@nmorph/nmorph-ui-kit 2.2.12 → 2.2.13
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 +11 -7
- package/dist/components/basic/nmorph-icon/NmorphIcon.css +1 -1
- package/dist/components/basic/nmorph-icon/NmorphIcon.vue2.js +11 -11
- package/dist/components/data/nmorph-pagination/NmorphPagination.css +1 -1
- package/dist/components/data/nmorph-pagination/NmorphPagination.vue.js +13 -12
- package/dist/components/data/nmorph-pagination/NmorphPagination.vue2.js +46 -40
- package/dist/components/data/nmorph-table/NmorphTable.css +1 -1
- package/dist/components/data/nmorph-table/NmorphTable.vue.js +228 -103
- package/dist/components/data/nmorph-table/NmorphTable.vue2.js +49 -30
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.css +1 -1
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.js +91 -35
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +48 -35
- package/dist/components/form/nmorph-checkbox/NmorphCheckbox.css +1 -1
- package/dist/components/form/nmorph-color-picker/NmorphColorPicker.vue2.js +11 -10
- package/dist/components/form/nmorph-radio/NmorphRadio.css +1 -1
- package/dist/components/form/nmorph-select/NmorphSelect.css +1 -1
- package/dist/components/form/nmorph-select/NmorphSelect.vue.js +115 -58
- package/dist/components/form/nmorph-select/NmorphSelect.vue2.js +104 -75
- package/dist/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue2.js +12 -10
- package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue.js +29 -42
- package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue2.js +39 -20
- package/dist/components/others/nmorph-overlay/NmorphOverlay.vue.js +29 -24
- package/dist/components/others/nmorph-overlay/NmorphOverlay.vue2.js +17 -15
- package/dist/hooks/use-common-styles.js +16 -12
- package/dist/hooks/use-placement.js +76 -44
- package/dist/hooks/use-virtual-list.js +46 -0
- package/dist/index.es.js +22 -19
- package/dist/index.umd.js +38 -29
- package/dist/nuxt.mjs +21 -37
- package/dist/outside-hooks/use-nmorph-browser.js +9 -9
- package/dist/outside-hooks/use-nmorph-theme.js +133 -87
- package/dist/package.json.js +1 -1
- package/dist/plugin.js +31 -27
- package/dist/src/components/data/nmorph-table/NmorphTable.vue.d.ts +9 -0
- package/dist/src/components/data/nmorph-table/types.d.ts +2 -2
- package/dist/src/components/feedback/nmorph-tooltip/NmorphTooltip.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.d.ts +11 -0
- package/dist/src/components/form/nmorph-select/NmorphSelect.vue.d.ts +8 -0
- package/dist/src/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue.d.ts +1 -0
- package/dist/src/components/form/nmorph-select/types.d.ts +1 -0
- package/dist/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue.d.ts +3 -1
- package/dist/src/components/others/nmorph-overlay/NmorphOverlay.vue.d.ts +4 -0
- package/dist/src/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.d.ts +1 -1
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/hooks/use-common-styles.d.ts +1 -0
- package/dist/src/hooks/use-placement.d.ts +8 -4
- package/dist/src/hooks/use-virtual-list.d.ts +21 -0
- package/dist/src/outside-hooks/use-nmorph-notification.d.ts +2 -2
- package/dist/src/outside-hooks/use-nmorph-theme.d.ts +1 -0
- package/dist/src/plugin.d.ts +2 -0
- package/dist/src/types/index.d.ts +3 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import './NmorphSelect.css';
|
|
2
|
-
import
|
|
3
|
-
import { openBlock as o, createElementBlock as r, normalizeClass as
|
|
2
|
+
import y from "./NmorphSelect.vue2.js";
|
|
3
|
+
import { openBlock as o, createElementBlock as r, normalizeClass as g, createElementVNode as t, withKeys as a, Fragment as i, renderList as c, withModifiers as u, toDisplayString as _, createBlock as n, mergeProps as d, createVNode as v, withCtx as h, normalizeStyle as s, renderSlot as w, createCommentVNode as k } from "vue";
|
|
4
4
|
/* empty css */
|
|
5
|
-
import
|
|
6
|
-
const N = { class: "nmorph-select__content" },
|
|
5
|
+
import x from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
6
|
+
const N = { class: "nmorph-select__content" }, S = ["id", "name", "autocomplete", "tabindex", "disabled"], b = ["value"], H = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "nmorph-select__selected-value"
|
|
9
|
-
},
|
|
9
|
+
}, O = {
|
|
10
10
|
key: 1,
|
|
11
11
|
class: "nmorph-select__selected-value"
|
|
12
|
-
},
|
|
12
|
+
}, C = {
|
|
13
13
|
key: 2,
|
|
14
14
|
class: "nmorph-select__selected-value"
|
|
15
|
-
},
|
|
15
|
+
}, D = {
|
|
16
16
|
ref: "optionsDOMRef",
|
|
17
17
|
class: "nmorph-select__options"
|
|
18
18
|
};
|
|
19
|
-
function
|
|
19
|
+
function I(f, m, p, e, M, z) {
|
|
20
20
|
return o(), r(
|
|
21
21
|
"div",
|
|
22
22
|
{
|
|
23
|
-
class:
|
|
23
|
+
class: g(e.modifiers)
|
|
24
24
|
},
|
|
25
25
|
[
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
t("div", N, [
|
|
27
|
+
t("select", {
|
|
28
28
|
id: e.id,
|
|
29
29
|
name: e.name,
|
|
30
30
|
autocomplete: e.autocomplete,
|
|
@@ -33,51 +33,51 @@ function C(_, I, f, e, S, M) {
|
|
|
33
33
|
onFocus: e.focusHandler,
|
|
34
34
|
onBlur: e.blurHandler,
|
|
35
35
|
onKeydown: [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
a(e.spaceHandler, ["space"]),
|
|
37
|
+
a(e.arrowDownHandler, ["arrow-down"]),
|
|
38
|
+
a(e.arrowUpHandler, ["arrow-up"]),
|
|
39
|
+
a(e.enterHandler, ["enter"])
|
|
40
40
|
]
|
|
41
41
|
}, [
|
|
42
42
|
(o(!0), r(
|
|
43
|
-
|
|
43
|
+
i,
|
|
44
44
|
null,
|
|
45
|
-
|
|
46
|
-
key:
|
|
47
|
-
value:
|
|
48
|
-
}, null, 8,
|
|
45
|
+
c(e.nativeOptions, (l) => (o(), r("option", {
|
|
46
|
+
key: l,
|
|
47
|
+
value: l
|
|
48
|
+
}, null, 8, b))),
|
|
49
49
|
128
|
|
50
50
|
/* KEYED_FRAGMENT */
|
|
51
51
|
))
|
|
52
|
-
], 40,
|
|
53
|
-
|
|
52
|
+
], 40, S),
|
|
53
|
+
t(
|
|
54
54
|
"div",
|
|
55
55
|
{
|
|
56
56
|
ref: "nmorphSelectDOMRef",
|
|
57
57
|
class: "nmorph-select__selected-values-line",
|
|
58
|
-
onClick:
|
|
58
|
+
onClick: u(e.clickHandler, ["stop"])
|
|
59
59
|
},
|
|
60
60
|
[
|
|
61
61
|
typeof e.initialValue == "string" ? (o(), r(
|
|
62
62
|
"div",
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
H,
|
|
64
|
+
_(e.selectedValueTitle),
|
|
65
65
|
1
|
|
66
66
|
/* TEXT */
|
|
67
67
|
)) : e.initialValue.length === 0 ? (o(), r(
|
|
68
68
|
"div",
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
O,
|
|
70
|
+
_(e.computedNoElementPlaceholder),
|
|
71
71
|
1
|
|
72
72
|
/* TEXT */
|
|
73
|
-
)) : (o(), r("div",
|
|
73
|
+
)) : (o(), r("div", C, [
|
|
74
74
|
(o(!0), r(
|
|
75
|
-
|
|
75
|
+
i,
|
|
76
76
|
null,
|
|
77
|
-
|
|
78
|
-
key:
|
|
77
|
+
c(e.tags, (l) => (o(), n(e.NmorphTagItem, d({
|
|
78
|
+
key: l.value,
|
|
79
79
|
ref_for: !0
|
|
80
|
-
},
|
|
80
|
+
}, l, {
|
|
81
81
|
transparent: "",
|
|
82
82
|
removable: e.tags.length > 1 || !e.props.valueRequired,
|
|
83
83
|
height: "thin",
|
|
@@ -87,9 +87,9 @@ function C(_, I, f, e, S, M) {
|
|
|
87
87
|
/* KEYED_FRAGMENT */
|
|
88
88
|
))
|
|
89
89
|
])),
|
|
90
|
-
|
|
91
|
-
default:
|
|
92
|
-
e.props.loading ? (o(),
|
|
90
|
+
v(e.NmorphIcon, { class: "nmorph-select__chevron" }, {
|
|
91
|
+
default: h(() => [
|
|
92
|
+
e.props.loading ? (o(), n(e.NmorphIconLoader, { key: 0 })) : (o(), n(e.NmorphIconChevronDown, { key: 1 }))
|
|
93
93
|
]),
|
|
94
94
|
_: 1
|
|
95
95
|
/* STABLE */
|
|
@@ -99,7 +99,7 @@ function C(_, I, f, e, S, M) {
|
|
|
99
99
|
/* NEED_PATCH */
|
|
100
100
|
)
|
|
101
101
|
]),
|
|
102
|
-
e.nmorphSelectDOMRef && !e.props.disabled ? (o(),
|
|
102
|
+
e.nmorphSelectDOMRef && !e.props.disabled ? (o(), n(e.NmorphDropdown, {
|
|
103
103
|
key: 0,
|
|
104
104
|
open: e.open && !e.props.loading,
|
|
105
105
|
"relative-element": e.nmorphSelectDOMRef,
|
|
@@ -110,34 +110,91 @@ function C(_, I, f, e, S, M) {
|
|
|
110
110
|
"z-index": e.props.zIndex,
|
|
111
111
|
onOnOutsideClick: e.closeHandler
|
|
112
112
|
}, {
|
|
113
|
-
default:
|
|
114
|
-
|
|
113
|
+
default: h(() => [
|
|
114
|
+
t(
|
|
115
115
|
"div",
|
|
116
|
-
|
|
116
|
+
D,
|
|
117
117
|
[
|
|
118
|
-
e.props.loading ? (o(),
|
|
118
|
+
e.props.loading ? (o(), n(e.NmorphIcon, {
|
|
119
119
|
key: 0,
|
|
120
120
|
class: "nmorph-select__chevron",
|
|
121
121
|
size: "medium"
|
|
122
122
|
}, {
|
|
123
|
-
default:
|
|
124
|
-
|
|
123
|
+
default: h(() => [
|
|
124
|
+
v(e.NmorphIconChevronDown)
|
|
125
125
|
]),
|
|
126
126
|
_: 1
|
|
127
127
|
/* STABLE */
|
|
128
|
-
})) : (o(
|
|
129
|
-
|
|
130
|
-
{
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
128
|
+
})) : e.virtualEnabled ? (o(), r(
|
|
129
|
+
"div",
|
|
130
|
+
{
|
|
131
|
+
key: 1,
|
|
132
|
+
ref: e.virtualList.containerRef,
|
|
133
|
+
class: "nmorph-select__virtual-list",
|
|
134
|
+
style: s({ maxHeight: e.virtualMaxHeight }),
|
|
135
|
+
onScroll: m[0] || (m[0] = (...l) => e.virtualList.scrollHandler && e.virtualList.scrollHandler(...l))
|
|
136
|
+
},
|
|
137
|
+
[
|
|
138
|
+
t(
|
|
139
|
+
"div",
|
|
140
|
+
{
|
|
141
|
+
class: "nmorph-select__virtual-spacer",
|
|
142
|
+
style: s(e.virtualSpacerStyle)
|
|
143
|
+
},
|
|
144
|
+
[
|
|
145
|
+
t(
|
|
146
|
+
"div",
|
|
147
|
+
{
|
|
148
|
+
class: "nmorph-select__virtual-content",
|
|
149
|
+
style: s(e.virtualContentStyle)
|
|
150
|
+
},
|
|
151
|
+
[
|
|
152
|
+
(o(!0), r(
|
|
153
|
+
i,
|
|
154
|
+
null,
|
|
155
|
+
c(e.virtualOptions, (l) => (o(), n(e.NmorphSelectOption, d({
|
|
156
|
+
key: l.index,
|
|
157
|
+
ref_for: !0
|
|
158
|
+
}, l.item, {
|
|
159
|
+
focused: l.item.value === e.currentFocusedEl,
|
|
160
|
+
height: e.props.height
|
|
161
|
+
}), null, 16, ["focused", "height"]))),
|
|
162
|
+
128
|
|
163
|
+
/* KEYED_FRAGMENT */
|
|
164
|
+
))
|
|
165
|
+
],
|
|
166
|
+
4
|
|
167
|
+
/* STYLE */
|
|
168
|
+
)
|
|
169
|
+
],
|
|
170
|
+
4
|
|
171
|
+
/* STYLE */
|
|
172
|
+
)
|
|
173
|
+
],
|
|
174
|
+
36
|
|
175
|
+
/* STYLE, NEED_HYDRATION */
|
|
176
|
+
)) : (o(), r(
|
|
177
|
+
i,
|
|
178
|
+
{ key: 2 },
|
|
179
|
+
[
|
|
180
|
+
(o(!0), r(
|
|
181
|
+
i,
|
|
182
|
+
null,
|
|
183
|
+
c(p.options, (l) => (o(), n(e.NmorphSelectOption, d({
|
|
184
|
+
key: l.value,
|
|
185
|
+
ref_for: !0
|
|
186
|
+
}, l, {
|
|
187
|
+
focused: l.value === e.currentFocusedEl,
|
|
188
|
+
height: e.props.height
|
|
189
|
+
}), null, 16, ["focused", "height"]))),
|
|
190
|
+
128
|
|
191
|
+
/* KEYED_FRAGMENT */
|
|
192
|
+
)),
|
|
193
|
+
w(f.$slots, "default")
|
|
194
|
+
],
|
|
195
|
+
64
|
|
196
|
+
/* STABLE_FRAGMENT */
|
|
197
|
+
))
|
|
141
198
|
],
|
|
142
199
|
512
|
|
143
200
|
/* NEED_PATCH */
|
|
@@ -145,13 +202,13 @@ function C(_, I, f, e, S, M) {
|
|
|
145
202
|
]),
|
|
146
203
|
_: 3
|
|
147
204
|
/* FORWARDED */
|
|
148
|
-
}, 8, ["open", "relative-element", "fill-width", "width", "min-width", "z-index"])) :
|
|
205
|
+
}, 8, ["open", "relative-element", "fill-width", "width", "min-width", "z-index"])) : k("v-if", !0)
|
|
149
206
|
],
|
|
150
207
|
2
|
|
151
208
|
/* CLASS */
|
|
152
209
|
);
|
|
153
210
|
}
|
|
154
|
-
const
|
|
211
|
+
const B = /* @__PURE__ */ x(y, [["render", I], ["__file", "/builds/ketjo/nmorph/library/src/components/form/nmorph-select/NmorphSelect.vue"]]);
|
|
155
212
|
export {
|
|
156
|
-
|
|
213
|
+
B as default
|
|
157
214
|
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import './NmorphSelect.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { NmorphComponentHeight as
|
|
4
|
-
import { useModifiers as
|
|
5
|
-
import { useI18n as
|
|
6
|
-
import { useFormItemInput as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
2
|
+
import { defineComponent as le, computed as a, ref as s, watch as f, nextTick as E, onMounted as ae, onUnmounted as re, provide as L } from "vue";
|
|
3
|
+
import { NmorphComponentHeight as ne } from "../../../types/index.js";
|
|
4
|
+
import { useModifiers as ue } from "../../../utils/create-modifiers.js";
|
|
5
|
+
import { useI18n as oe } from "vue-i18n";
|
|
6
|
+
import { useFormItemInput as ie } from "../nmorph-form/use-form-item-input.js";
|
|
7
|
+
import { useVirtualList as se } from "../../../hooks/use-virtual-list.js";
|
|
8
|
+
import de from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
|
|
9
|
+
import ve from "./components/nmorph-select-option/NmorphSelectOption.vue.js";
|
|
10
|
+
import ce from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
11
|
+
import fe from "../../data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.js";
|
|
12
|
+
import pe from "../../../assets/icons/chevron-down.svg.js";
|
|
13
|
+
import me from "../../../assets/icons/loader.svg.js";
|
|
14
|
+
const _e = /* @__PURE__ */ le({
|
|
14
15
|
__name: "NmorphSelect",
|
|
15
16
|
props: {
|
|
16
17
|
noElementPlaceholder: { type: String, required: !1, default: "" },
|
|
@@ -23,6 +24,10 @@ const ye = /* @__PURE__ */ U({
|
|
|
23
24
|
fill: { type: Boolean, required: !1, default: !1 },
|
|
24
25
|
optionsWidth: { type: String, required: !1, default: "truncate" },
|
|
25
26
|
zIndex: { type: Number, required: !1 },
|
|
27
|
+
virtual: { type: Boolean, required: !1, default: !1 },
|
|
28
|
+
virtualItemHeight: { type: Number, required: !1, default: 0 },
|
|
29
|
+
virtualMaxHeight: { type: [Number, String], required: !1, default: 240 },
|
|
30
|
+
virtualOverscan: { type: Number, required: !1, default: 5 },
|
|
26
31
|
id: { type: String, required: !1 },
|
|
27
32
|
name: { type: String, required: !1 },
|
|
28
33
|
autocomplete: { type: String, required: !1 },
|
|
@@ -31,98 +36,122 @@ const ye = /* @__PURE__ */ U({
|
|
|
31
36
|
tabindex: { type: Number, required: !1 }
|
|
32
37
|
},
|
|
33
38
|
emits: ["update:model-value"],
|
|
34
|
-
setup(
|
|
35
|
-
|
|
36
|
-
const { t:
|
|
37
|
-
() =>
|
|
38
|
-
),
|
|
39
|
-
if (!
|
|
40
|
-
if (r.value = !1, typeof
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
|
|
39
|
+
setup(V, { expose: B, emit: T }) {
|
|
40
|
+
B();
|
|
41
|
+
const { t: O } = oe(), l = V, S = a(
|
|
42
|
+
() => l.noElementPlaceholder ? l.noElementPlaceholder : O("noElementPlaceholder")
|
|
43
|
+
), m = T, t = s(l.modelValue), r = s(l.open), d = a(() => l.disabled || l.loading), h = a(() => l.optionsWidth === "auto"), g = s(!0), { id: C, name: P, autocomplete: k, tabindex: R } = ie(l), y = (e) => {
|
|
44
|
+
if (!d.value) {
|
|
45
|
+
if (r.value = !1, typeof t.value == "string" && (!l.valueRequired && t.value === e ? t.value = "" : t.value = e, m("update:model-value", t.value)), Array.isArray(t.value)) {
|
|
46
|
+
const n = t.value.includes(e), ee = t.value.length === 1 && n;
|
|
47
|
+
if (l.valueRequired && ee) return;
|
|
48
|
+
n ? t.value = t.value.filter((te) => te !== e) : t.value = [...t.value, e];
|
|
44
49
|
}
|
|
45
|
-
|
|
50
|
+
m("update:model-value", t.value);
|
|
46
51
|
}
|
|
47
|
-
}, p =
|
|
52
|
+
}, p = s(!1), W = () => {
|
|
48
53
|
p.value = !0;
|
|
49
|
-
},
|
|
54
|
+
}, U = () => {
|
|
50
55
|
p.value = !1;
|
|
51
|
-
},
|
|
52
|
-
() =>
|
|
53
|
-
nmorph: [
|
|
56
|
+
}, z = a(
|
|
57
|
+
() => ue({
|
|
58
|
+
nmorph: [ne[l.height]],
|
|
54
59
|
"nmorph-select": [
|
|
55
|
-
`${
|
|
56
|
-
`${
|
|
57
|
-
`${
|
|
58
|
-
`${r.value && !
|
|
59
|
-
`${
|
|
60
|
-
`${
|
|
61
|
-
`${
|
|
60
|
+
`${l.disabled && "disabled"}`,
|
|
61
|
+
`${l.modelValue ? "on" : "off"}`,
|
|
62
|
+
`${l.loading && "loading"}`,
|
|
63
|
+
`${r.value && !d.value && "open"}`,
|
|
64
|
+
`${l.fill && "fill"}`,
|
|
65
|
+
`${h.value && "options-auto-width"}`,
|
|
66
|
+
`${g.value ? "selected-line-outset" : "selected-line-inset"}`,
|
|
62
67
|
`${p.value && "focus"}`
|
|
63
68
|
]
|
|
64
69
|
})
|
|
65
|
-
),
|
|
66
|
-
|
|
70
|
+
), F = () => {
|
|
71
|
+
d.value || (r.value = !r.value);
|
|
67
72
|
};
|
|
68
|
-
|
|
73
|
+
f(
|
|
69
74
|
r,
|
|
70
|
-
(
|
|
71
|
-
|
|
75
|
+
(e) => {
|
|
76
|
+
e && (g.value = !1);
|
|
72
77
|
},
|
|
73
78
|
{ immediate: !0 }
|
|
74
79
|
);
|
|
75
|
-
const
|
|
80
|
+
const b = () => {
|
|
76
81
|
r.value = !1;
|
|
77
82
|
};
|
|
78
|
-
|
|
79
|
-
() =>
|
|
80
|
-
(
|
|
81
|
-
|
|
83
|
+
f(
|
|
84
|
+
() => l.loading,
|
|
85
|
+
(e) => {
|
|
86
|
+
e && (r.value = !1);
|
|
82
87
|
}
|
|
83
88
|
);
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
89
|
+
const i = a(() => l.options.length > 0 ? l.options : l.optionsMap), q = s(null), H = s([]), x = a(() => l.options), c = a(() => l.virtual && x.value.length > 0), M = a(() => ({
|
|
90
|
+
basic: 30,
|
|
91
|
+
thick: 38,
|
|
92
|
+
thin: 22
|
|
93
|
+
})[l.height || "basic"]), w = a(() => l.virtualItemHeight || M.value), A = a(() => l.virtualOverscan), v = se(x, {
|
|
94
|
+
enabled: c,
|
|
95
|
+
itemHeight: w,
|
|
96
|
+
overscan: A
|
|
97
|
+
}), j = a(() => v.virtualItems.value), Y = a(() => ({
|
|
98
|
+
height: `${v.totalHeight.value}px`
|
|
99
|
+
})), G = a(() => ({
|
|
100
|
+
transform: `translateY(${v.offsetTop.value}px)`
|
|
101
|
+
})), $ = (e) => typeof e == "number" ? `${e}px` : e, J = a(() => $(l.virtualMaxHeight)), I = () => {
|
|
102
|
+
i.value.length > 0 || !q.value || (H.value = Array.from(q.value.querySelectorAll(".nmorph-select-option")).map((e) => e.getAttribute("value")).filter((e) => !!e));
|
|
103
|
+
}, o = a(
|
|
104
|
+
() => i.value.length > 0 ? i.value.map((e) => e.value) : H.value
|
|
105
|
+
), K = a(() => c.value ? Array.isArray(t.value) ? t.value : t.value ? [t.value] : [] : o.value), u = s(0), N = a(() => o.value[u.value] || "");
|
|
106
|
+
f(u, (e) => {
|
|
107
|
+
r.value && c.value && v.scrollToIndex(e);
|
|
108
|
+
}), f(
|
|
109
|
+
o,
|
|
110
|
+
(e) => {
|
|
111
|
+
u.value >= e.length && (u.value = Math.max(e.length - 1, 0));
|
|
112
|
+
},
|
|
113
|
+
{ immediate: !0 }
|
|
114
|
+
), f(r, async (e) => {
|
|
115
|
+
if (e) {
|
|
116
|
+
if (await E(), I(), typeof t.value == "string") {
|
|
117
|
+
const n = o.value.indexOf(t.value);
|
|
118
|
+
n !== -1 && (u.value = n);
|
|
119
|
+
}
|
|
120
|
+
v.refresh(), c.value && v.scrollToIndex(u.value);
|
|
121
|
+
}
|
|
122
|
+
}), ae(async () => {
|
|
123
|
+
await E(), I(), document.addEventListener("click", b);
|
|
124
|
+
}), re(() => {
|
|
125
|
+
document.removeEventListener("click", b);
|
|
97
126
|
});
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
() =>
|
|
102
|
-
),
|
|
103
|
-
|
|
127
|
+
const Q = a(() => typeof t.value == "string" ? t.value === "" ? S.value : i.value.find((e) => e.value === t.value)?.label : i.value.find((e) => e.value === t.value)?.label), X = a(() => i.value.length > 0 ? i.value.filter((n) => t.value.includes(n.value)).map((n) => ({ text: n.label, value: n.value })) : Array.isArray(t.value) ? t.value.map((n) => ({ text: n, value: n })) : [{ text: t.value, value: t.value }]);
|
|
128
|
+
L("select-selected-value", t), L("select-change-selected-value", y);
|
|
129
|
+
const D = s(null), Z = a(
|
|
130
|
+
() => h.value ? `${D.value?.clientWidth || 0}px` : void 0
|
|
131
|
+
), _ = { t: O, props: l, computedNoElementPlaceholder: S, emit: m, initialValue: t, open: r, disabledInput: d, autoOptionsWidth: h, selectedLineOutset: g, id: C, name: P, autocomplete: k, tabindex: R, changeHandler: y, focus: p, focusHandler: W, blurHandler: U, modifiers: z, clickHandler: F, closeHandler: b, optionsMap: i, optionsDOMRef: q, slotDomOptions: H, renderedOptions: x, virtualEnabled: c, defaultOptionHeight: M, virtualItemHeight: w, virtualOverscan: A, virtualList: v, virtualOptions: j, virtualSpacerStyle: Y, virtualContentStyle: G, getCssSize: $, virtualMaxHeight: J, refreshDomOptions: I, domOptions: o, nativeOptions: K, currentIndex: u, currentFocusedEl: N, selectedValueTitle: Q, tags: X, nmorphSelectDOMRef: D, optionsMinWidth: Z, spaceHandler: () => {
|
|
132
|
+
d.value || (r.value = !r.value);
|
|
104
133
|
}, arrowDownHandler: () => {
|
|
105
|
-
|
|
134
|
+
d.value || o.value.length !== 0 && (u.value = (u.value + 1) % o.value.length);
|
|
106
135
|
}, arrowUpHandler: () => {
|
|
107
|
-
|
|
136
|
+
d.value || o.value.length !== 0 && (u.value = (u.value - 1 + o.value.length) % o.value.length);
|
|
108
137
|
}, enterHandler: () => {
|
|
109
|
-
r.value &&
|
|
138
|
+
r.value && N.value && y(N.value);
|
|
110
139
|
}, get NmorphTagItem() {
|
|
111
|
-
return
|
|
140
|
+
return fe;
|
|
112
141
|
}, get NmorphIcon() {
|
|
113
|
-
return
|
|
142
|
+
return ce;
|
|
114
143
|
}, get NmorphSelectOption() {
|
|
115
|
-
return
|
|
144
|
+
return ve;
|
|
116
145
|
}, get NmorphDropdown() {
|
|
117
|
-
return
|
|
146
|
+
return de;
|
|
118
147
|
}, get NmorphIconLoader() {
|
|
119
|
-
return
|
|
148
|
+
return me;
|
|
120
149
|
}, get NmorphIconChevronDown() {
|
|
121
|
-
return
|
|
150
|
+
return pe;
|
|
122
151
|
} };
|
|
123
|
-
return Object.defineProperty(
|
|
152
|
+
return Object.defineProperty(_, "__isScriptSetup", { enumerable: !1, value: !0 }), _;
|
|
124
153
|
}
|
|
125
154
|
});
|
|
126
155
|
export {
|
|
127
|
-
|
|
156
|
+
_e as default
|
|
128
157
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import './NmorphSelectOption.css';
|
|
2
|
-
import { defineComponent as
|
|
2
|
+
import { defineComponent as m, inject as u, computed as s } from "vue";
|
|
3
3
|
import { NmorphComponentHeight as h } from "../../../../../types/index.js";
|
|
4
4
|
import { useModifiers as g } from "../../../../../utils/create-modifiers.js";
|
|
5
5
|
import v from "../../../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
6
|
-
import
|
|
7
|
-
const I = /* @__PURE__ */
|
|
6
|
+
import y from "../../../../../assets/icons/success.svg.js";
|
|
7
|
+
const I = /* @__PURE__ */ m({
|
|
8
8
|
__name: "NmorphSelectOption",
|
|
9
9
|
props: {
|
|
10
10
|
value: { type: String, required: !0 },
|
|
11
11
|
label: { type: String, required: !0, default: "" },
|
|
12
|
+
focused: { type: Boolean, required: !1, default: !1 },
|
|
12
13
|
id: { type: String, required: !1 },
|
|
13
14
|
name: { type: String, required: !1 },
|
|
14
15
|
autocomplete: { type: String, required: !1 },
|
|
@@ -17,23 +18,24 @@ const I = /* @__PURE__ */ f({
|
|
|
17
18
|
tabindex: { type: Number, required: !1 }
|
|
18
19
|
},
|
|
19
20
|
emits: ["change-value"],
|
|
20
|
-
setup(
|
|
21
|
-
|
|
22
|
-
const t =
|
|
21
|
+
setup(i, { expose: n, emit: c }) {
|
|
22
|
+
n();
|
|
23
|
+
const t = u("select-selected-value"), r = u("select-change-selected-value"), e = i, l = c, d = () => {
|
|
23
24
|
e.disabled || (l("change-value", e.value), r && r(e.value));
|
|
24
|
-
}, a =
|
|
25
|
+
}, a = s(() => typeof t?.value == "string" ? t.value === e.value : Array.isArray(t?.value) ? t.value.some((f) => f === e.value) : !1), p = s(
|
|
25
26
|
() => g({
|
|
26
27
|
nmorph: [h[e.height]],
|
|
27
28
|
"nmorph-select-option": [
|
|
28
29
|
`${e.disabled && "disabled"}`,
|
|
29
30
|
`${e.label && "with-label"}`,
|
|
30
|
-
`${a.value && "checked"}
|
|
31
|
+
`${a.value && "checked"}`,
|
|
32
|
+
`${e.focused && "focused"}`
|
|
31
33
|
]
|
|
32
34
|
})
|
|
33
|
-
), o = { selectSelectedValue: t, selectChangeSelectedValue: r, props: e, emit: l, clickHandler:
|
|
35
|
+
), o = { selectSelectedValue: t, selectChangeSelectedValue: r, props: e, emit: l, clickHandler: d, checked: a, modifiers: p, get NmorphIcon() {
|
|
34
36
|
return v;
|
|
35
37
|
}, get NmorphIconSuccess() {
|
|
36
|
-
return
|
|
38
|
+
return y;
|
|
37
39
|
} };
|
|
38
40
|
return Object.defineProperty(o, "__isScriptSetup", { enumerable: !1, value: !0 }), o;
|
|
39
41
|
}
|
|
@@ -1,49 +1,36 @@
|
|
|
1
1
|
import './NmorphDropdown.css';
|
|
2
2
|
import n from "./NmorphDropdown.vue2.js";
|
|
3
|
-
import { openBlock as
|
|
3
|
+
import { openBlock as r, createBlock as t, withCtx as d, createElementBlock as i, normalizeStyle as p, normalizeClass as l, renderSlot as a, createCommentVNode as m } from "vue";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import s from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
6
|
-
function c(e,
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
l(e.$slots, "default")
|
|
33
|
-
],
|
|
34
|
-
6
|
|
35
|
-
/* CLASS, STYLE */
|
|
36
|
-
)
|
|
37
|
-
]),
|
|
38
|
-
_: 3
|
|
39
|
-
/* FORWARDED */
|
|
40
|
-
}, 8, ["show", "z-index"])
|
|
41
|
-
],
|
|
42
|
-
4
|
|
43
|
-
/* STYLE */
|
|
44
|
-
);
|
|
6
|
+
function c(e, f, _, o, h, w) {
|
|
7
|
+
return r(), t(o.NmorphOverlay, {
|
|
8
|
+
show: o.props.open,
|
|
9
|
+
transparent: "",
|
|
10
|
+
"z-index": o.props.zIndex,
|
|
11
|
+
onOnOutsideClick: o.outsideClickHandler
|
|
12
|
+
}, {
|
|
13
|
+
default: d(() => [
|
|
14
|
+
o.props.open ? (r(), i(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
key: 0,
|
|
18
|
+
ref: "dropdownDOMRef",
|
|
19
|
+
class: l(o.modifiers),
|
|
20
|
+
style: p(o.dropdownStyle)
|
|
21
|
+
},
|
|
22
|
+
[
|
|
23
|
+
a(e.$slots, "default")
|
|
24
|
+
],
|
|
25
|
+
6
|
|
26
|
+
/* CLASS, STYLE */
|
|
27
|
+
)) : m("v-if", !0)
|
|
28
|
+
]),
|
|
29
|
+
_: 3
|
|
30
|
+
/* FORWARDED */
|
|
31
|
+
}, 8, ["show", "z-index"]);
|
|
45
32
|
}
|
|
46
|
-
const
|
|
33
|
+
const z = /* @__PURE__ */ s(n, [["render", c], ["__file", "/builds/ketjo/nmorph/library/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue"]]);
|
|
47
34
|
export {
|
|
48
|
-
|
|
35
|
+
z as default
|
|
49
36
|
};
|