@nmorph/nmorph-ui-kit 2.2.34 → 2.2.36
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/dist/assets/icons/baseball.svg.js +28 -0
- package/dist/assets/icons/basketball.svg.js +21 -0
- package/dist/assets/icons/bowl.svg.js +21 -0
- package/dist/assets/icons/box.svg.js +35 -0
- package/dist/assets/icons/briefcase.svg.js +21 -0
- package/dist/assets/icons/brush-filled.svg.js +21 -0
- package/dist/assets/icons/brush.svg.js +21 -0
- package/dist/assets/icons/camera-filled.svg.js +21 -0
- package/dist/assets/icons/chevron-double-left.svg.js +28 -0
- package/dist/assets/icons/chevron-double-right.svg.js +28 -0
- package/dist/assets/icons/chevron-double-up.svg.js +28 -0
- package/dist/assets/icons/chevron-left.svg.js +21 -0
- package/dist/assets/icons/chevron-right.svg.js +21 -0
- package/dist/assets/icons/chevron-up.svg.js +21 -0
- package/dist/assets/icons/chicken.svg.js +21 -0
- package/dist/assets/icons/clipboard-check.svg.js +25 -0
- package/dist/assets/icons/clipboard.svg.js +25 -0
- package/dist/assets/icons/close-bold.svg.js +21 -0
- package/dist/assets/icons/cold-drink.svg.js +21 -0
- package/dist/assets/icons/comment.svg.js +21 -0
- package/dist/assets/icons/database.svg.js +25 -0
- package/dist/assets/icons/drag-handle.svg.js +21 -0
- package/dist/assets/icons/external-link.svg.js +28 -0
- package/dist/assets/icons/filter-off.svg.js +28 -0
- package/dist/assets/icons/fingerprint.svg.js +44 -0
- package/dist/assets/icons/folder-remove.svg.js +21 -0
- package/dist/assets/icons/goblet.svg.js +21 -0
- package/dist/assets/icons/ice-tea.svg.js +21 -0
- package/dist/assets/icons/inbox.svg.js +25 -0
- package/dist/assets/icons/mail.svg.js +25 -0
- package/dist/assets/icons/odometer.svg.js +35 -0
- package/dist/assets/icons/open.svg.js +28 -0
- package/dist/assets/icons/pagination.svg.js +8 -0
- package/dist/assets/icons/pin.svg.js +21 -0
- package/dist/assets/icons/redo.svg.js +21 -0
- package/dist/assets/icons/save.svg.js +25 -0
- package/dist/assets/icons/server.svg.js +32 -0
- package/dist/assets/icons/shield-check.svg.js +25 -0
- package/dist/assets/icons/shield.svg.js +25 -0
- package/dist/assets/icons/sliders.svg.js +31 -0
- package/dist/assets/icons/stopwatch.svg.js +28 -0
- package/dist/assets/icons/suitcase-line.svg.js +22 -0
- package/dist/assets/icons/undo.svg.js +21 -0
- package/dist/assets/icons/video-camera.svg.js +21 -0
- package/dist/components/basic/nmorph-button/NmorphButton.vue.js +10 -10
- package/dist/components/basic/nmorph-button/NmorphButton.vue2.js +5 -5
- package/dist/components/basic/nmorph-icon/NmorphIcons.js +617 -527
- package/dist/components/basic/nmorph-layout/NmorphLayout.css +1 -0
- package/dist/components/basic/nmorph-layout/NmorphLayout.vue.js +50 -0
- package/dist/components/basic/nmorph-layout/NmorphLayout.vue2.js +28 -0
- package/dist/components/basic/nmorph-space/NmorphSpace.css +1 -0
- package/dist/components/basic/nmorph-space/NmorphSpace.vue.js +21 -0
- package/dist/components/basic/nmorph-space/NmorphSpace.vue2.js +45 -0
- package/dist/components/data/nmorph-avatar/NmorphAvatar.vue.js +15 -15
- package/dist/components/data/nmorph-avatar/NmorphAvatar.vue2.js +1 -1
- package/dist/components/data/nmorph-empty/NmorphEmpty.css +1 -1
- package/dist/components/data/nmorph-pagination/NmorphPagination.vue.js +31 -31
- package/dist/components/data/nmorph-pagination/NmorphPagination.vue2.js +36 -38
- package/dist/components/data/nmorph-qr-code/NmorphQRCode.css +1 -0
- package/dist/components/data/nmorph-qr-code/NmorphQRCode.vue.js +59 -0
- package/dist/components/data/nmorph-qr-code/NmorphQRCode.vue2.js +50 -0
- package/dist/components/data/nmorph-qr-code/qr-code.js +568 -0
- package/dist/components/data/nmorph-virtual-list/NmorphVirtualList.css +1 -0
- package/dist/components/data/nmorph-virtual-list/NmorphVirtualList.vue.js +86 -0
- package/dist/components/data/nmorph-virtual-list/NmorphVirtualList.vue2.js +60 -0
- package/dist/components/feedback/nmorph-drawer/NmorphDrawer.css +1 -0
- package/dist/components/feedback/nmorph-drawer/NmorphDrawer.vue.js +81 -0
- package/dist/components/feedback/nmorph-drawer/NmorphDrawer.vue2.js +47 -0
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.css +1 -1
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.js +30 -27
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +75 -63
- package/dist/components/form/nmorph-date-picker/inner-components/nmorph-date-picker-content/NmorphDatePickerContent.vue.js +13 -13
- package/dist/components/form/nmorph-date-picker/inner-components/nmorph-date-picker-content/NmorphDatePickerContent.vue2.js +28 -27
- package/dist/components/form/nmorph-date-picker/inner-components/nmorph-year-month-picker/NmorphYearMonthPicker.vue.js +16 -16
- package/dist/components/form/nmorph-date-picker/inner-components/nmorph-year-month-picker/NmorphYearMonthPicker.vue2.js +20 -17
- package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue.js +34 -30
- package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue2.js +94 -62
- package/dist/components/form/nmorph-otp-input/NmorphOTPInput.vue.js +21 -21
- package/dist/components/form/nmorph-otp-input/NmorphOTPInput.vue2.js +92 -84
- package/dist/components/form/nmorph-select/NmorphSelect.vue.js +5 -5
- package/dist/components/form/nmorph-select/NmorphSelect.vue2.js +53 -53
- package/dist/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue2.js +24 -21
- package/dist/components/form/nmorph-switch/NmorphSwitch.vue.js +1 -1
- package/dist/components/form/nmorph-switch/NmorphSwitch.vue2.js +16 -16
- package/dist/components/form/nmorph-textarea/NmorphTextarea.css +1 -0
- package/dist/components/form/nmorph-textarea/NmorphTextarea.vue.js +41 -0
- package/dist/components/form/nmorph-textarea/NmorphTextarea.vue2.js +67 -0
- package/dist/components/form/nmorph-time-picker/NmorphTimePicker.css +1 -1
- package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue.js +40 -31
- package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue2.js +45 -41
- package/dist/components/navigation/nmorph-backtop/NmorphBacktop.vue.js +20 -25
- package/dist/components/navigation/nmorph-backtop/NmorphBacktop.vue2.js +41 -27
- package/dist/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.js +11 -10
- package/dist/components/navigation/nmorph-context-menu/NmorphContextMenu.vue2.js +10 -9
- package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.css +1 -1
- package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue2.js +13 -12
- package/dist/hooks/use-common-styles.js +2 -1
- package/dist/icons.js +621 -531
- package/dist/index.es.js +781 -677
- package/dist/index.umd.js +31 -30
- package/dist/package.json.js +1 -1
- package/dist/src/components/basic/index.d.ts +2 -0
- package/dist/src/components/basic/nmorph-icon/NmorphIcons.d.ts +49 -3
- package/dist/src/components/basic/nmorph-layout/NmorphLayout.vue.d.ts +22 -0
- package/dist/src/components/basic/nmorph-space/NmorphSpace.vue.d.ts +33 -0
- package/dist/src/components/data/index.d.ts +4 -0
- package/dist/src/components/data/nmorph-qr-code/NmorphQRCode.vue.d.ts +34 -0
- package/dist/src/components/data/nmorph-qr-code/qr-code.d.ts +12 -0
- package/dist/src/components/data/nmorph-virtual-list/NmorphVirtualList.vue.d.ts +46 -0
- package/dist/src/components/data/nmorph-virtual-list/types.d.ts +4 -0
- package/dist/src/components/feedback/index.d.ts +1 -0
- package/dist/src/components/feedback/nmorph-drawer/NmorphDrawer.vue.d.ts +40 -0
- package/dist/src/components/form/index.d.ts +1 -0
- package/dist/src/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-date-picker-content/NmorphDatePickerContent.vue.d.ts +2 -2
- package/dist/src/components/form/nmorph-file-upload/NmorphFileUpload.vue.d.ts +2 -2
- package/dist/src/components/form/nmorph-radio-group/NmorphRadioGroup.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue.d.ts +0 -1
- package/dist/src/components/form/nmorph-textarea/NmorphTextarea.vue.d.ts +48 -0
- package/dist/src/components/navigation/nmorph-backtop/NmorphBacktop.vue.d.ts +1 -1
- package/dist/src/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.d.ts +3 -1
- package/dist/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue.d.ts +3 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import './NmorphOTPInput.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { NmorphComponentHeight as
|
|
5
|
-
import { useFormItemInput as
|
|
6
|
-
import
|
|
7
|
-
const
|
|
2
|
+
import { defineComponent as te, ref as b, computed as c, watch as D, nextTick as O } from "vue";
|
|
3
|
+
import { useModifiers as ae } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { NmorphComponentHeight as le } from "../../../types/index.js";
|
|
5
|
+
import { useFormItemInput as ue } from "../nmorph-form/use-form-item-input.js";
|
|
6
|
+
import oe from "../nmorph-text-input/NmorphTextInput.vue.js";
|
|
7
|
+
const de = /* @__PURE__ */ te({
|
|
8
8
|
__name: "NmorphOTPInput",
|
|
9
9
|
props: {
|
|
10
10
|
modelValue: { type: String, required: !1, default: "" },
|
|
@@ -20,120 +20,128 @@ const ce = /* @__PURE__ */ Y({
|
|
|
20
20
|
tabindex: { type: Number, required: !1 }
|
|
21
21
|
},
|
|
22
22
|
emits: ["update:model-value", "focus", "blur", "complete"],
|
|
23
|
-
setup(
|
|
24
|
-
const
|
|
23
|
+
setup(I, { expose: R, emit: j }) {
|
|
24
|
+
const l = I, f = j, { id: V, name: w, autocomplete: q, tabindex: p } = ue(l), i = b([]), n = b([]), d = b(!1), o = b([]), u = c(() => Math.max(1, l.length)), v = (e = "") => {
|
|
25
25
|
const t = `${e ?? ""}`;
|
|
26
|
-
return
|
|
27
|
-
}, A = (e =
|
|
26
|
+
return l.mode === "numeric" ? Array.from(t.replace(/\D/g, "")) : l.mode === "alphanumeric" ? Array.from(t.replace(/[^a-zA-Z0-9]/g, "")) : Array.from(t);
|
|
27
|
+
}, A = (e = l.modelValue) => {
|
|
28
28
|
const t = v(e).slice(0, u.value);
|
|
29
|
-
return Array.from({ length: u.value }, (
|
|
30
|
-
},
|
|
31
|
-
if (
|
|
32
|
-
const
|
|
33
|
-
|
|
29
|
+
return Array.from({ length: u.value }, (a, s) => t[s] || "");
|
|
30
|
+
}, g = (e, t = !1) => {
|
|
31
|
+
if (o.value = Array.from({ length: u.value }, (s, y) => e[y] || ""), !t) return;
|
|
32
|
+
const a = o.value.join("");
|
|
33
|
+
f("update:model-value", a), o.value.includes("") || f("complete", a);
|
|
34
34
|
};
|
|
35
|
-
|
|
36
|
-
[() =>
|
|
35
|
+
D(
|
|
36
|
+
[() => l.modelValue, () => l.mode, u],
|
|
37
37
|
() => {
|
|
38
|
-
const e = A(
|
|
39
|
-
(e.join("") !==
|
|
38
|
+
const e = A(l.modelValue);
|
|
39
|
+
(e.join("") !== o.value.join("") || e.length !== o.value.length) && g(e);
|
|
40
40
|
},
|
|
41
41
|
{ immediate: !0 }
|
|
42
42
|
);
|
|
43
|
-
const
|
|
44
|
-
() =>
|
|
45
|
-
nmorph: [
|
|
46
|
-
"nmorph-otp-input": [`${
|
|
43
|
+
const N = c(
|
|
44
|
+
() => ae({
|
|
45
|
+
nmorph: [le[l.height], `${d.value && "focused"}`],
|
|
46
|
+
"nmorph-otp-input": [`${l.disabled && "disabled"}`]
|
|
47
47
|
})
|
|
48
|
-
),
|
|
48
|
+
), T = c(
|
|
49
49
|
() => Array.from({ length: u.value }, (e, t) => t === 0 ? V.value : `${V.value}-${t + 1}`)
|
|
50
|
-
),
|
|
51
|
-
if (
|
|
52
|
-
if (
|
|
53
|
-
}),
|
|
54
|
-
n.value[e] =
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
), $ = c(() => l.mode === "numeric" ? "numeric" : "text"), E = c(() => q.value || "one-time-code"), B = c(() => {
|
|
51
|
+
if (l.mode === "numeric") return "[0-9]*";
|
|
52
|
+
if (l.mode === "alphanumeric") return "[A-Za-z0-9]*";
|
|
53
|
+
}), h = (e) => {
|
|
54
|
+
n.value[e] = i.value[e]?.inputDOMRef ?? null;
|
|
55
|
+
}, C = (e, t) => {
|
|
56
|
+
i.value[t] = e, O(() => {
|
|
57
|
+
h(t);
|
|
58
58
|
});
|
|
59
59
|
}, _ = (e) => {
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
|
|
60
|
+
h(e), i.value[e]?.select?.(), n.value[e]?.select();
|
|
61
|
+
}, r = (e = 0) => {
|
|
62
|
+
O(() => {
|
|
63
63
|
const t = Math.min(Math.max(e, 0), u.value - 1);
|
|
64
|
-
|
|
64
|
+
h(t), i.value[t]?.focus?.(), n.value[t]?.focus(), _(t);
|
|
65
65
|
});
|
|
66
|
-
},
|
|
67
|
-
|
|
66
|
+
}, F = () => {
|
|
67
|
+
i.value.forEach((e, t) => {
|
|
68
68
|
e?.blur?.(), n.value[t]?.blur();
|
|
69
69
|
});
|
|
70
70
|
};
|
|
71
|
-
|
|
71
|
+
R({
|
|
72
72
|
inputDOMRefs: n,
|
|
73
|
-
focus:
|
|
74
|
-
blur:
|
|
73
|
+
focus: r,
|
|
74
|
+
blur: F
|
|
75
75
|
});
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
|
|
76
|
+
const m = (e, t = "") => {
|
|
77
|
+
const a = [...o.value];
|
|
78
|
+
a[e] = t, g(a, !0);
|
|
79
79
|
}, H = (e, t) => {
|
|
80
|
-
const
|
|
81
|
-
if (!
|
|
82
|
-
|
|
80
|
+
const a = v(e).slice(0, u.value - t);
|
|
81
|
+
if (!a.length) {
|
|
82
|
+
m(t, "");
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}),
|
|
89
|
-
const y = t +
|
|
90
|
-
y < u.value ?
|
|
91
|
-
},
|
|
85
|
+
const s = [...o.value];
|
|
86
|
+
a.forEach((Y, ee) => {
|
|
87
|
+
s[t + ee] = Y;
|
|
88
|
+
}), g(s, !0);
|
|
89
|
+
const y = t + a.length;
|
|
90
|
+
y < u.value ? r(y) : r(u.value - 1);
|
|
91
|
+
}, S = (e, t) => {
|
|
92
92
|
H(e, t);
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
}, M = /* @__PURE__ */ new Map(), P = (e) => {
|
|
94
|
+
const t = M.get(e);
|
|
95
|
+
if (t) return t;
|
|
96
|
+
const a = c({
|
|
97
|
+
get: () => o.value[e] || "",
|
|
98
|
+
set: (s) => S(s, e)
|
|
99
|
+
});
|
|
100
|
+
return M.set(e, a), a;
|
|
101
|
+
}, k = (e) => {
|
|
102
|
+
if (o.value[e]) {
|
|
103
|
+
m(e);
|
|
96
104
|
return;
|
|
97
105
|
}
|
|
98
|
-
e > 0 && (
|
|
99
|
-
},
|
|
106
|
+
e > 0 && (m(e - 1), r(e - 1));
|
|
107
|
+
}, x = (e, t) => {
|
|
100
108
|
if (e.key === "Backspace") {
|
|
101
|
-
|
|
109
|
+
k(t);
|
|
102
110
|
return;
|
|
103
111
|
}
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
}, K = (e) => {
|
|
114
|
-
e.key.length === 1 && !v(e.key).length && e.preventDefault();
|
|
115
|
-
}, G = (e, t) => {
|
|
116
|
-
const l = e.clipboardData?.getData("text") || "";
|
|
117
|
-
H(l, t);
|
|
112
|
+
m(t);
|
|
113
|
+
}, L = (e) => {
|
|
114
|
+
r(e - 1);
|
|
115
|
+
}, Z = (e) => {
|
|
116
|
+
r(e + 1);
|
|
117
|
+
}, K = () => {
|
|
118
|
+
r(0);
|
|
119
|
+
}, G = () => {
|
|
120
|
+
r(u.value - 1);
|
|
118
121
|
}, J = (e) => {
|
|
119
|
-
|
|
120
|
-
}, Q = () => {
|
|
122
|
+
e.key.length === 1 && !v(e.key).length && e.preventDefault();
|
|
123
|
+
}, Q = (e, t) => {
|
|
124
|
+
const a = e.clipboardData?.getData("text") || "";
|
|
125
|
+
H(a, t);
|
|
126
|
+
}, U = (e) => {
|
|
127
|
+
d.value || (d.value = !0, f("focus")), _(e);
|
|
128
|
+
}, W = () => {
|
|
121
129
|
setTimeout(() => {
|
|
122
130
|
const e = document.activeElement;
|
|
123
|
-
!n.value.some((
|
|
131
|
+
!n.value.some((a) => a === e) && d.value && (d.value = !1, f("blur"));
|
|
124
132
|
});
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
() =>
|
|
133
|
+
}, X = (e) => p.value > 0 ? p.value + e : p.value;
|
|
134
|
+
D(
|
|
135
|
+
() => l.autofocus,
|
|
128
136
|
(e) => {
|
|
129
|
-
e && !
|
|
137
|
+
e && !l.disabled && r(0);
|
|
130
138
|
},
|
|
131
139
|
{ immediate: !0 }
|
|
132
140
|
);
|
|
133
|
-
const
|
|
134
|
-
return Object.defineProperty(
|
|
141
|
+
const z = { props: l, emit: f, id: V, name: w, autocomplete: q, tabindex: p, inputRefs: i, inputDOMRefs: n, focused: d, otpValue: o, normalizedLength: u, sanitizeValue: v, normalizeOtpValue: A, syncOtpValue: g, modifiers: N, fieldIds: T, inputMode: $, resolvedAutocomplete: E, inputPattern: B, syncInputDOMRef: h, setInputRef: C, selectField: _, focusField: r, blurFields: F, updateCharAt: m, insertValue: H, inputHandler: S, fieldModels: M, getFieldModel: P, backspaceHandler: k, deleteKeyHandler: x, arrowLeftHandler: L, arrowRightHandler: Z, homeHandler: K, endHandler: G, keydownHandler: J, pasteHandler: Q, focusHandler: U, blurHandler: W, getFieldTabindex: X, NmorphTextInput: oe };
|
|
142
|
+
return Object.defineProperty(z, "__isScriptSetup", { enumerable: !1, value: !0 }), z;
|
|
135
143
|
}
|
|
136
144
|
});
|
|
137
145
|
export {
|
|
138
|
-
|
|
146
|
+
de as default
|
|
139
147
|
};
|
|
@@ -9,10 +9,10 @@ const N = { class: "nmorph-select__content" }, S = ["id", "name", "autocomplete"
|
|
|
9
9
|
}, u = {
|
|
10
10
|
key: 1,
|
|
11
11
|
class: "nmorph-select__selected-value"
|
|
12
|
-
},
|
|
12
|
+
}, D = {
|
|
13
13
|
key: 2,
|
|
14
14
|
class: "nmorph-select__selected-value"
|
|
15
|
-
},
|
|
15
|
+
}, C = ["id"];
|
|
16
16
|
function E(y, v, p, e, M, R) {
|
|
17
17
|
return r(), l(
|
|
18
18
|
"div",
|
|
@@ -76,7 +76,7 @@ function E(y, v, p, e, M, R) {
|
|
|
76
76
|
_(e.computedNoElementPlaceholder),
|
|
77
77
|
1
|
|
78
78
|
/* TEXT */
|
|
79
|
-
)) : (r(), l("div",
|
|
79
|
+
)) : (r(), l("div", D, [
|
|
80
80
|
(r(!0), l(
|
|
81
81
|
d,
|
|
82
82
|
null,
|
|
@@ -94,7 +94,7 @@ function E(y, v, p, e, M, R) {
|
|
|
94
94
|
])),
|
|
95
95
|
f(e.NmorphIcon, { class: "nmorph-select__chevron" }, {
|
|
96
96
|
default: s(() => [
|
|
97
|
-
e.props.loading ? (r(), i(e.
|
|
97
|
+
e.props.loading ? (r(), i(e.NmorphIconLoaderDots, { key: 0 })) : (r(), i(e.NmorphIconChevronDown, { key: 1 }))
|
|
98
98
|
]),
|
|
99
99
|
_: 1
|
|
100
100
|
/* STABLE */
|
|
@@ -206,7 +206,7 @@ function E(y, v, p, e, M, R) {
|
|
|
206
206
|
64
|
|
207
207
|
/* STABLE_FRAGMENT */
|
|
208
208
|
))
|
|
209
|
-
], 8,
|
|
209
|
+
], 8, C)
|
|
210
210
|
]),
|
|
211
211
|
_: 3
|
|
212
212
|
/* FORWARDED */
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import './NmorphSelect.css';
|
|
2
|
-
import { defineComponent as ue, computed as a, ref as d, watch as f, nextTick as
|
|
3
|
-
import { NmorphComponentHeight as
|
|
4
|
-
import { useModifiers as
|
|
5
|
-
import { useI18n as
|
|
6
|
-
import { useFormItemInput as
|
|
7
|
-
import { useVirtualList as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
const
|
|
2
|
+
import { defineComponent as ue, computed as a, ref as d, watch as f, nextTick as R, onMounted as oe, onUnmounted as ie, provide as M, toRef as se } from "vue";
|
|
3
|
+
import { NmorphComponentHeight as de } from "../../../types/index.js";
|
|
4
|
+
import { useModifiers as ve } from "../../../utils/create-modifiers.js";
|
|
5
|
+
import { useI18n as ce } from "vue-i18n";
|
|
6
|
+
import { useFormItemInput as fe } from "../nmorph-form/use-form-item-input.js";
|
|
7
|
+
import { useVirtualList as pe } from "../../../hooks/use-virtual-list.js";
|
|
8
|
+
import me from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
|
|
9
|
+
import he from "./components/nmorph-select-option/NmorphSelectOption.vue.js";
|
|
10
|
+
import ge from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
11
|
+
import ye from "../../data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.js";
|
|
12
|
+
import He from "../../../assets/icons/chevron-down.svg.js";
|
|
13
|
+
import be from "../../../assets/icons/loader.svg.js";
|
|
14
|
+
const ke = /* @__PURE__ */ ue({
|
|
15
15
|
__name: "NmorphSelect",
|
|
16
16
|
props: {
|
|
17
17
|
noElementPlaceholder: { type: String, required: !1, default: "" },
|
|
@@ -40,37 +40,37 @@ const Pe = /* @__PURE__ */ ue({
|
|
|
40
40
|
emits: ["update:model-value"],
|
|
41
41
|
setup(T, { expose: C, emit: P }) {
|
|
42
42
|
C();
|
|
43
|
-
const { t:
|
|
44
|
-
() =>
|
|
45
|
-
), m = P,
|
|
43
|
+
const { t: $ } = ce(), t = T, D = a(
|
|
44
|
+
() => t.noElementPlaceholder ? t.noElementPlaceholder : $("noElementPlaceholder")
|
|
45
|
+
), m = P, l = d(t.modelValue), r = d(t.open), v = a(() => t.disabled || t.loading), h = a(() => t.optionsWidth === "auto"), g = d(!0), { id: y, name: k, autocomplete: W, tabindex: U } = fe(t), H = (e) => {
|
|
46
46
|
if (!v.value) {
|
|
47
|
-
if (r.value = !1, typeof
|
|
48
|
-
const n =
|
|
49
|
-
if (
|
|
50
|
-
n ?
|
|
47
|
+
if (r.value = !1, typeof l.value == "string" && (!t.valueRequired && l.value === e ? l.value = "" : l.value = e, m("update:model-value", l.value)), Array.isArray(l.value)) {
|
|
48
|
+
const n = l.value.includes(e), w = l.value.length === 1 && n;
|
|
49
|
+
if (t.valueRequired && w) return;
|
|
50
|
+
n ? l.value = l.value.filter((ne) => ne !== e) : l.value = [...l.value, e];
|
|
51
51
|
}
|
|
52
|
-
m("update:model-value",
|
|
52
|
+
m("update:model-value", l.value);
|
|
53
53
|
}
|
|
54
54
|
}, p = d(!1), z = () => {
|
|
55
55
|
p.value = !0;
|
|
56
56
|
}, F = () => {
|
|
57
57
|
p.value = !1;
|
|
58
58
|
}, j = a(
|
|
59
|
-
() =>
|
|
60
|
-
nmorph: [
|
|
59
|
+
() => ve({
|
|
60
|
+
nmorph: [de[t.height]],
|
|
61
61
|
"nmorph-select": [
|
|
62
|
-
`${
|
|
63
|
-
`${
|
|
64
|
-
`${
|
|
62
|
+
`${t.disabled && "disabled"}`,
|
|
63
|
+
`${t.modelValue ? "on" : "off"}`,
|
|
64
|
+
`${t.loading && "loading"}`,
|
|
65
65
|
`${r.value && !v.value && "open"}`,
|
|
66
|
-
`${
|
|
66
|
+
`${t.fill && "fill"}`,
|
|
67
67
|
`${h.value && "options-auto-width"}`,
|
|
68
68
|
`${g.value ? "selected-line-outset" : "selected-line-inset"}`,
|
|
69
69
|
`${p.value && "focus"}`
|
|
70
70
|
]
|
|
71
71
|
})
|
|
72
72
|
), b = (e) => typeof e == "number" ? `${e}px` : e, Y = a(() => ({
|
|
73
|
-
...
|
|
73
|
+
...t.width !== void 0 && { "--base-width": b(t.width) }
|
|
74
74
|
})), G = () => {
|
|
75
75
|
v.value || (r.value = !r.value);
|
|
76
76
|
};
|
|
@@ -85,29 +85,29 @@ const Pe = /* @__PURE__ */ ue({
|
|
|
85
85
|
r.value = !1;
|
|
86
86
|
};
|
|
87
87
|
f(
|
|
88
|
-
() =>
|
|
88
|
+
() => t.loading,
|
|
89
89
|
(e) => {
|
|
90
90
|
e && (r.value = !1);
|
|
91
91
|
}
|
|
92
92
|
);
|
|
93
|
-
const i = a(() =>
|
|
93
|
+
const i = a(() => t.options.length > 0 ? t.options : t.optionsMap), x = d(null), I = d([]), N = a(() => t.options), c = a(() => t.virtual && N.value.length > 0), A = a(() => ({
|
|
94
94
|
basic: 30,
|
|
95
95
|
thick: 38,
|
|
96
96
|
thin: 22
|
|
97
|
-
})[
|
|
97
|
+
})[t.height || "basic"]), E = a(() => t.virtualItemHeight || A.value), V = a(() => t.virtualOverscan), _ = a(() => t.virtualDynamicHeight), s = pe(N, {
|
|
98
98
|
enabled: c,
|
|
99
|
-
itemHeight:
|
|
100
|
-
overscan:
|
|
101
|
-
dynamic:
|
|
99
|
+
itemHeight: E,
|
|
100
|
+
overscan: V,
|
|
101
|
+
dynamic: _
|
|
102
102
|
}), J = a(() => s.virtualItems.value), K = a(() => ({
|
|
103
103
|
height: `${s.totalHeight.value}px`
|
|
104
104
|
})), Q = a(() => ({
|
|
105
105
|
transform: `translateY(${s.offsetTop.value}px)`
|
|
106
|
-
})), X = a(() => b(
|
|
106
|
+
})), X = a(() => b(t.virtualMaxHeight)), O = () => {
|
|
107
107
|
i.value.length > 0 || !x.value || (I.value = Array.from(x.value.querySelectorAll(".nmorph-select-option")).map((e) => e.getAttribute("value")).filter((e) => !!e));
|
|
108
108
|
}, o = a(
|
|
109
109
|
() => i.value.length > 0 ? i.value.map((e) => e.value) : I.value
|
|
110
|
-
), Z = a(() => c.value ? Array.isArray(
|
|
110
|
+
), Z = a(() => c.value ? Array.isArray(l.value) ? l.value : l.value ? [l.value] : [] : o.value), u = d(0), S = a(() => o.value[u.value] || ""), ee = a(() => `${y.value}-listbox`), te = (e) => `${y.value}-option-${e.replace(/\s+/g, "-")}`;
|
|
111
111
|
f(u, (e) => {
|
|
112
112
|
r.value && c.value && s.scrollToIndex(e);
|
|
113
113
|
}), f(
|
|
@@ -118,22 +118,22 @@ const Pe = /* @__PURE__ */ ue({
|
|
|
118
118
|
{ immediate: !0 }
|
|
119
119
|
), f(r, async (e) => {
|
|
120
120
|
if (e) {
|
|
121
|
-
if (await
|
|
122
|
-
const n = o.value.indexOf(
|
|
121
|
+
if (await R(), O(), typeof l.value == "string") {
|
|
122
|
+
const n = o.value.indexOf(l.value);
|
|
123
123
|
n !== -1 && (u.value = n);
|
|
124
124
|
}
|
|
125
125
|
s.refresh(), c.value && s.scrollToIndex(u.value);
|
|
126
126
|
}
|
|
127
127
|
}), oe(async () => {
|
|
128
|
-
await
|
|
128
|
+
await R(), O(), document.addEventListener("click", q);
|
|
129
129
|
}), ie(() => {
|
|
130
130
|
document.removeEventListener("click", q);
|
|
131
131
|
});
|
|
132
|
-
const le = a(() => typeof
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
() => h.value ? `${
|
|
136
|
-
),
|
|
132
|
+
const le = a(() => typeof l.value == "string" ? l.value === "" ? D.value : i.value.find((e) => e.value === l.value)?.label : i.value.find((e) => e.value === l.value)?.label), ae = a(() => i.value.length > 0 ? i.value.filter((n) => l.value.includes(n.value)).map((n) => ({ text: n.label, value: n.value })) : Array.isArray(l.value) ? l.value.map((n) => ({ text: n, value: n })) : [{ text: l.value, value: l.value }]);
|
|
133
|
+
M("select-selected-value", l), M("select-change-selected-value", H), M("select-height", se(t, "height"));
|
|
134
|
+
const B = d(null), re = a(
|
|
135
|
+
() => h.value ? `${B.value?.clientWidth || 0}px` : void 0
|
|
136
|
+
), L = { t: $, props: t, computedNoElementPlaceholder: D, emit: m, initialValue: l, open: r, disabledInput: v, autoOptionsWidth: h, selectedLineOutset: g, id: y, name: k, autocomplete: W, tabindex: U, changeHandler: H, focus: p, focusHandler: z, blurHandler: F, modifiers: j, getCssSize: b, styles: Y, clickHandler: G, closeHandler: q, optionsMap: i, optionsDOMRef: x, slotDomOptions: I, renderedOptions: N, virtualEnabled: c, defaultOptionHeight: A, virtualItemHeight: E, virtualOverscan: V, virtualDynamicHeight: _, virtualList: s, virtualOptions: J, virtualSpacerStyle: K, virtualContentStyle: Q, virtualMaxHeight: X, refreshDomOptions: O, domOptions: o, nativeOptions: Z, currentIndex: u, currentFocusedEl: S, listboxId: ee, getOptionId: te, selectedValueTitle: le, tags: ae, nmorphSelectDOMRef: B, optionsMinWidth: re, spaceHandler: () => {
|
|
137
137
|
v.value || (r.value = !r.value);
|
|
138
138
|
}, arrowDownHandler: () => {
|
|
139
139
|
v.value || o.value.length !== 0 && (r.value || (r.value = !0), u.value = (u.value + 1) % o.value.length);
|
|
@@ -151,21 +151,21 @@ const Pe = /* @__PURE__ */ ue({
|
|
|
151
151
|
}, endHandler: () => {
|
|
152
152
|
u.value = Math.max(o.value.length - 1, 0);
|
|
153
153
|
}, get NmorphTagItem() {
|
|
154
|
-
return
|
|
154
|
+
return ye;
|
|
155
155
|
}, get NmorphIcon() {
|
|
156
|
-
return
|
|
156
|
+
return ge;
|
|
157
157
|
}, get NmorphSelectOption() {
|
|
158
|
-
return
|
|
158
|
+
return he;
|
|
159
159
|
}, get NmorphDropdown() {
|
|
160
|
-
return
|
|
161
|
-
}, get
|
|
162
|
-
return
|
|
160
|
+
return me;
|
|
161
|
+
}, get NmorphIconLoaderDots() {
|
|
162
|
+
return be;
|
|
163
163
|
}, get NmorphIconChevronDown() {
|
|
164
|
-
return
|
|
164
|
+
return He;
|
|
165
165
|
} };
|
|
166
|
-
return Object.defineProperty(
|
|
166
|
+
return Object.defineProperty(L, "__isScriptSetup", { enumerable: !1, value: !0 }), L;
|
|
167
167
|
}
|
|
168
168
|
});
|
|
169
169
|
export {
|
|
170
|
-
|
|
170
|
+
ke as default
|
|
171
171
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import './NmorphSelectOption.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { NmorphComponentHeight as
|
|
4
|
-
import { useModifiers as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const
|
|
2
|
+
import { defineComponent as g, inject as l, computed as t } from "vue";
|
|
3
|
+
import { NmorphComponentHeight as y } from "../../../../../types/index.js";
|
|
4
|
+
import { useModifiers as S } from "../../../../../utils/create-modifiers.js";
|
|
5
|
+
import b from "../../../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
6
|
+
import q from "../../../../../assets/icons/success.svg.js";
|
|
7
|
+
const I = /* @__PURE__ */ g({
|
|
8
8
|
__name: "NmorphSelectOption",
|
|
9
9
|
props: {
|
|
10
10
|
value: { type: String, required: !0 },
|
|
@@ -15,36 +15,39 @@ const C = /* @__PURE__ */ h({
|
|
|
15
15
|
id: { type: String, required: !1 },
|
|
16
16
|
name: { type: String, required: !1 },
|
|
17
17
|
autocomplete: { type: String, required: !1 },
|
|
18
|
-
height: { type: null, required: !1
|
|
18
|
+
height: { type: null, required: !1 },
|
|
19
19
|
disabled: { type: Boolean, required: !1, default: !1 },
|
|
20
20
|
tabindex: { type: Number, required: !1 }
|
|
21
21
|
},
|
|
22
22
|
emits: ["change-value"],
|
|
23
|
-
setup(
|
|
24
|
-
|
|
25
|
-
const r =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
setup(c, { expose: d, emit: p }) {
|
|
24
|
+
d();
|
|
25
|
+
const r = l("select-selected-value"), o = l("select-change-selected-value"), a = l(
|
|
26
|
+
"select-height",
|
|
27
|
+
void 0
|
|
28
|
+
), e = c, i = p, f = () => {
|
|
29
|
+
e.disabled || (i("change-value", e.value), o && o(e.value));
|
|
30
|
+
}, u = t(() => typeof r?.value == "string" ? r.value === e.value : Array.isArray(r?.value) ? r.value.some((v) => v === e.value) : !1), s = t(() => e.height || a?.value || "basic"), h = t(
|
|
31
|
+
() => S({
|
|
32
|
+
nmorph: [y[s.value]],
|
|
30
33
|
"nmorph-select-option": [
|
|
31
34
|
`${e.disabled && "disabled"}`,
|
|
32
35
|
`${e.label && "with-label"}`,
|
|
33
|
-
`${
|
|
36
|
+
`${u.value && "checked"}`,
|
|
34
37
|
`${e.focused && "focused"}`
|
|
35
38
|
]
|
|
36
39
|
})
|
|
37
|
-
),
|
|
40
|
+
), m = t(() => ({
|
|
38
41
|
...e.hoverBackground !== void 0 && { "--hover-bg": e.hoverBackground },
|
|
39
42
|
...e.hoverColor !== void 0 && { "--hover-color": e.hoverColor }
|
|
40
|
-
})),
|
|
41
|
-
return
|
|
43
|
+
})), n = { selectSelectedValue: r, selectChangeSelectedValue: o, selectHeight: a, props: e, emit: i, clickHandler: f, checked: u, height: s, modifiers: h, styles: m, get NmorphIcon() {
|
|
44
|
+
return b;
|
|
42
45
|
}, get NmorphIconSuccess() {
|
|
43
|
-
return
|
|
46
|
+
return q;
|
|
44
47
|
} };
|
|
45
|
-
return Object.defineProperty(
|
|
48
|
+
return Object.defineProperty(n, "__isScriptSetup", { enumerable: !1, value: !0 }), n;
|
|
46
49
|
}
|
|
47
50
|
});
|
|
48
51
|
export {
|
|
49
|
-
|
|
52
|
+
I as default
|
|
50
53
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import './NmorphSwitch.css';
|
|
2
|
-
import { defineComponent as q, ref as
|
|
2
|
+
import { defineComponent as q, ref as i, computed as n, watch as N } from "vue";
|
|
3
3
|
import { useModifiers as V } from "../../../utils/create-modifiers.js";
|
|
4
4
|
import { useFormItemInput as _ } from "../nmorph-form/use-form-item-input.js";
|
|
5
5
|
import w from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
6
6
|
import H from "../../../assets/icons/loader.svg.js";
|
|
7
|
-
const
|
|
7
|
+
const C = /* @__PURE__ */ q({
|
|
8
8
|
__name: "NmorphSwitch",
|
|
9
9
|
props: {
|
|
10
10
|
modelValue: { type: [Boolean, String, Number], required: !1, default: !1 },
|
|
@@ -23,31 +23,31 @@ const L = /* @__PURE__ */ q({
|
|
|
23
23
|
},
|
|
24
24
|
emits: ["update:model-value"],
|
|
25
25
|
setup(s, { expose: f, emit: m }) {
|
|
26
|
-
const e = s, { id: p, name: c, tabindex: h } = _(e), u = m,
|
|
27
|
-
|
|
26
|
+
const e = s, { id: p, name: c, tabindex: h } = _(e), u = m, a = i(!1), g = () => {
|
|
27
|
+
a.value = !0;
|
|
28
28
|
}, v = () => {
|
|
29
|
-
|
|
29
|
+
a.value = !1;
|
|
30
30
|
}, b = n(
|
|
31
31
|
() => V({
|
|
32
32
|
"nmorph-switch": [
|
|
33
33
|
`${e.disabled && "disabled"}`,
|
|
34
34
|
`${r.value ? "on" : "off"}`,
|
|
35
35
|
`${e.loading && "loading"}`,
|
|
36
|
-
`${
|
|
36
|
+
`${a.value && "focus"}`
|
|
37
37
|
]
|
|
38
38
|
})
|
|
39
|
-
), r =
|
|
39
|
+
), r = i(e.modelValue === e.activeValue), y = () => {
|
|
40
40
|
if (e.disabled) return;
|
|
41
41
|
r.value = !r.value;
|
|
42
42
|
const t = r.value ? e.activeValue : e.inactiveValue;
|
|
43
43
|
u("update:model-value", t);
|
|
44
|
-
}, l =
|
|
44
|
+
}, l = i(null);
|
|
45
45
|
f({ inputDOMRef: l });
|
|
46
|
-
const
|
|
47
|
-
...e.width !== void 0 && { "--width":
|
|
48
|
-
...e.height !== void 0 && { "--height":
|
|
49
|
-
...e.offset !== void 0 && { "--offset":
|
|
50
|
-
...e.thumbHeight !== void 0 && { "--thumb-height":
|
|
46
|
+
const o = (t) => typeof t == "number" ? `${t}px` : t, S = n(() => ({
|
|
47
|
+
...e.width !== void 0 && { "--width": o(e.width) },
|
|
48
|
+
...e.height !== void 0 && { "--height": o(e.height) },
|
|
49
|
+
...e.offset !== void 0 && { "--offset": o(e.offset) },
|
|
50
|
+
...e.thumbHeight !== void 0 && { "--thumb-height": o(e.thumbHeight) }
|
|
51
51
|
}));
|
|
52
52
|
N(
|
|
53
53
|
() => e.modelValue,
|
|
@@ -55,14 +55,14 @@ const L = /* @__PURE__ */ q({
|
|
|
55
55
|
r.value = t === e.activeValue;
|
|
56
56
|
}
|
|
57
57
|
);
|
|
58
|
-
const d = { props: e, id: p, name: c, tabindex: h, emit: u, focus:
|
|
58
|
+
const d = { props: e, id: p, name: c, tabindex: h, emit: u, focus: a, focusHandler: g, blurHandler: v, modifiers: b, initialValue: r, changeHandler: y, inputDOMRef: l, getCssSize: o, styles: S, get NmorphIcon() {
|
|
59
59
|
return w;
|
|
60
|
-
}, get
|
|
60
|
+
}, get NmorphIconLoaderDots() {
|
|
61
61
|
return H;
|
|
62
62
|
} };
|
|
63
63
|
return Object.defineProperty(d, "__isScriptSetup", { enumerable: !1, value: !0 }), d;
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
export {
|
|
67
|
-
|
|
67
|
+
C as default
|
|
68
68
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.nmorph-textarea{height:auto}.nmorph-textarea textarea{display:block;box-sizing:border-box;width:100%;min-width:0;padding:var(--indentation-03) var(--indentation-03) var(--indentation-03) var(--nmorph-textarea-indentation);color:var(--nmorph-text-color);font:inherit;line-height:var(--line-height-regular);background:var(--nmorph-main-color);border:none;border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-inset);transition:background var(--transition-02) ease,box-shadow var(--transition-02) ease,color var(--transition-02) ease;resize:var(--nmorph-textarea-resize)}.nmorph-textarea textarea:focus{color:var(--nmorph-focus-text-color);background:var(--nmorph-accent-color);outline:none;box-shadow:var(--nmorph-shadow-outset)}.nmorph-textarea textarea:disabled{cursor:not-allowed;opacity:.6;resize:none}.nmorph-textarea.nmorph-textarea--auto-size textarea{overflow-y:hidden}
|