@nmorph/nmorph-ui-kit 2.2.34 → 2.2.35
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/pin.svg.js +21 -0
- package/dist/components/basic/nmorph-icon/NmorphIcons.js +209 -207
- package/dist/components/data/nmorph-empty/NmorphEmpty.css +1 -1
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.css +1 -1
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.js +20 -17
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +63 -54
- 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-select/NmorphSelect.vue2.js +52 -52
- package/dist/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue2.js +24 -21
- 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 +25 -21
- 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 +209 -207
- package/dist/index.es.js +331 -329
- package/dist/index.umd.js +31 -30
- package/dist/package.json.js +1 -1
- package/dist/src/components/basic/nmorph-icon/NmorphIcons.d.ts +1 -0
- package/dist/src/components/form/nmorph-file-upload/NmorphFileUpload.vue.d.ts +2 -2
- package/dist/src/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue.d.ts +0 -1
- package/dist/src/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.d.ts +2 -0
- package/dist/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue.d.ts +2 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -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
|
|
160
|
+
return me;
|
|
161
161
|
}, get NmorphIconLoader() {
|
|
162
|
-
return
|
|
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 +1 @@
|
|
|
1
|
-
.nmorph-time-picker{--width: 160px;position:relative;width:var(--width);height:var(--height)}.nmorph-time-picker .nmorph-time-picker__input{display:flex;align-items:center;height:100%;padding:0 var(--default-indentation-input);overflow:hidden;background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-outset);cursor:pointer}.nmorph-time-picker .nmorph-time-picker__native{position:absolute;width:0;height:0;padding:0;border:0;opacity:0;pointer-events:none}.nmorph-time-picker .nmorph-time-picker__clock-icon{flex:0 0 auto;margin-right:6px}.nmorph-time-picker .nmorph-time-picker__selected-value{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.nmorph-time-picker .nmorph-time-picker__clear{display:inline-flex;flex:0 0 auto;justify-content:center;align-items:center;width:18px;height:18px;padding:0;color:var(--nmorph-text-color);background:transparent;border:0;cursor:pointer}.nmorph-time-picker .nmorph-time-picker__panel{display:grid;grid-template-columns:minmax(48px,1fr) auto minmax(48px,1fr);gap:4px;padding:8px}.nmorph-time-picker .nmorph-time-picker__panel--with-seconds{grid-template-columns:minmax(48px,1fr) auto minmax(48px,1fr) auto minmax(48px,1fr)}.nmorph-time-picker .nmorph-time-picker__column{display:grid;max-height:220px;overflow-y:auto}.nmorph-time-picker .nmorph-time-picker__separator{display:flex;justify-content:center;align-items:center;color:var(--nmorph-semi-contrast-text-color);font-weight:700}.nmorph-time-picker .nmorph-time-picker__option{
|
|
1
|
+
.nmorph-time-picker{--width: 160px;position:relative;width:var(--width);height:var(--height)}.nmorph-time-picker .nmorph-time-picker__input{display:flex;align-items:center;height:100%;padding:0 var(--default-indentation-input);overflow:hidden;background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-outset);cursor:pointer}.nmorph-time-picker .nmorph-time-picker__native{position:absolute;width:0;height:0;padding:0;border:0;opacity:0;pointer-events:none}.nmorph-time-picker .nmorph-time-picker__clock-icon{flex:0 0 auto;margin-right:6px}.nmorph-time-picker .nmorph-time-picker__selected-value{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.nmorph-time-picker .nmorph-time-picker__clear{display:inline-flex;flex:0 0 auto;justify-content:center;align-items:center;width:18px;height:18px;padding:0;color:var(--nmorph-text-color);background:transparent;border:0;cursor:pointer}.nmorph-time-picker .nmorph-time-picker__panel{display:grid;grid-template-columns:minmax(48px,1fr) auto minmax(48px,1fr);gap:4px;padding:8px}.nmorph-time-picker .nmorph-time-picker__panel--with-seconds{grid-template-columns:minmax(48px,1fr) auto minmax(48px,1fr) auto minmax(48px,1fr)}.nmorph-time-picker .nmorph-time-picker__column{display:grid;max-height:220px;overflow-y:auto}.nmorph-time-picker .nmorph-time-picker__separator{display:flex;justify-content:center;align-items:center;color:var(--nmorph-semi-contrast-text-color);font-weight:700}.nmorph-time-picker .nmorph-time-picker__option{padding:0 8px;color:var(--nmorph-text-color);background:transparent;border:0;border-radius:4px;cursor:pointer}.nmorph-time-picker .nmorph-time-picker__option:hover,.nmorph-time-picker .nmorph-time-picker__option--active{color:var(--nmorph-focus-text-color);background:var(--nmorph-accent-color)}.nmorph-time-picker .nmorph-time-picker__option:disabled{cursor:not-allowed;opacity:.35}.nmorph-time-picker.nmorph-time-picker--open .nmorph-time-picker__input{box-shadow:var(--nmorph-shadow-inset)}.nmorph-time-picker.nmorph-time-picker--focus{outline:2px solid var(--nmorph-accent-color)}.nmorph-time-picker.nmorph-time-picker--placeholder .nmorph-time-picker__selected-value{color:var(--nmorph-placeholder-text-color)}.nmorph-time-picker.nmorph-time-picker--disabled{cursor:not-allowed;opacity:.6}.nmorph-time-picker.nmorph-time-picker--disabled .nmorph-time-picker__input{pointer-events:none}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import './NmorphTimePicker.css';
|
|
2
2
|
import b from "./NmorphTimePicker.vue2.js";
|
|
3
|
-
import { openBlock as i, createElementBlock as n, normalizeStyle as v, normalizeClass as
|
|
3
|
+
import { openBlock as i, createElementBlock as n, normalizeStyle as v, normalizeClass as l, createElementVNode as r, withKeys as m, withModifiers as t, createVNode as d, withCtx as p, toDisplayString as c, createCommentVNode as _, createBlock as f, Fragment as s, renderList as h } from "vue";
|
|
4
4
|
/* empty css */
|
|
5
|
-
import
|
|
6
|
-
const y = ["aria-expanded", "aria-controls", "tabindex", "onKeydown"], w = ["id", "name", "autocomplete", "step", "value", "disabled"], x = { class: "nmorph-time-picker__selected-value" }, C = ["id"],
|
|
5
|
+
import u from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
6
|
+
const y = ["aria-expanded", "aria-controls", "tabindex", "onKeydown"], w = ["id", "name", "autocomplete", "step", "value", "disabled"], x = { class: "nmorph-time-picker__selected-value" }, C = ["id"], g = {
|
|
7
7
|
class: "nmorph-time-picker__column",
|
|
8
8
|
role: "listbox",
|
|
9
9
|
"aria-label": "Hours"
|
|
10
|
-
},
|
|
10
|
+
}, O = ["disabled", "onClick"], H = {
|
|
11
11
|
class: "nmorph-time-picker__column",
|
|
12
12
|
role: "listbox",
|
|
13
13
|
"aria-label": "Minutes"
|
|
14
|
-
},
|
|
14
|
+
}, N = ["disabled", "onClick"], M = {
|
|
15
15
|
class: "nmorph-time-picker__column",
|
|
16
16
|
role: "listbox",
|
|
17
17
|
"aria-label": "Seconds"
|
|
18
|
-
},
|
|
19
|
-
function S
|
|
18
|
+
}, V = ["disabled", "onClick"];
|
|
19
|
+
function I(S, a, z, e, B, D) {
|
|
20
20
|
return i(), n(
|
|
21
21
|
"div",
|
|
22
22
|
{
|
|
23
|
-
class:
|
|
23
|
+
class: l(e.modifiers),
|
|
24
24
|
style: v(e.styles)
|
|
25
25
|
},
|
|
26
26
|
[
|
|
27
|
-
|
|
27
|
+
r("div", {
|
|
28
28
|
ref: "inputDOMRef",
|
|
29
29
|
class: "nmorph-time-picker__input",
|
|
30
30
|
role: "combobox",
|
|
@@ -40,7 +40,7 @@ function S(z, a, B, e, D, M) {
|
|
|
40
40
|
m(t(e.closeHandler, ["prevent"]), ["escape"])
|
|
41
41
|
]
|
|
42
42
|
}, [
|
|
43
|
-
|
|
43
|
+
r("input", {
|
|
44
44
|
id: e.id,
|
|
45
45
|
class: "nmorph-time-picker__native",
|
|
46
46
|
name: e.name,
|
|
@@ -51,17 +51,17 @@ function S(z, a, B, e, D, M) {
|
|
|
51
51
|
disabled: e.props.disabled,
|
|
52
52
|
onInput: e.nativeInputHandler
|
|
53
53
|
}, null, 40, w),
|
|
54
|
-
|
|
54
|
+
d(e.NmorphIcon, { class: "nmorph-time-picker__clock-icon" }, {
|
|
55
55
|
default: p(() => [
|
|
56
|
-
|
|
56
|
+
d(e.NmorphIconClock)
|
|
57
57
|
]),
|
|
58
58
|
_: 1
|
|
59
59
|
/* STABLE */
|
|
60
60
|
}),
|
|
61
|
-
|
|
61
|
+
r(
|
|
62
62
|
"div",
|
|
63
63
|
x,
|
|
64
|
-
|
|
64
|
+
c(e.displayValue),
|
|
65
65
|
1
|
|
66
66
|
/* TEXT */
|
|
67
67
|
),
|
|
@@ -72,19 +72,19 @@ function S(z, a, B, e, D, M) {
|
|
|
72
72
|
"aria-label": "Clear time",
|
|
73
73
|
onClick: t(e.clearHandler, ["stop"])
|
|
74
74
|
}, [
|
|
75
|
-
|
|
75
|
+
d(e.NmorphIcon, {
|
|
76
76
|
width: "14px",
|
|
77
77
|
height: "14px"
|
|
78
78
|
}, {
|
|
79
79
|
default: p(() => [
|
|
80
|
-
|
|
80
|
+
d(e.NmorphIconCircleClose)
|
|
81
81
|
]),
|
|
82
82
|
_: 1
|
|
83
83
|
/* STABLE */
|
|
84
84
|
})
|
|
85
85
|
])) : _("v-if", !0)
|
|
86
86
|
], 40, y),
|
|
87
|
-
e.inputDOMRef && !e.props.disabled ? (i(),
|
|
87
|
+
e.inputDOMRef && !e.props.disabled ? (i(), f(e.NmorphDropdown, {
|
|
88
88
|
key: 0,
|
|
89
89
|
open: e.open,
|
|
90
90
|
"relative-element": e.inputDOMRef,
|
|
@@ -96,43 +96,49 @@ function S(z, a, B, e, D, M) {
|
|
|
96
96
|
onOnEscapeKeydown: e.closeHandler
|
|
97
97
|
}, {
|
|
98
98
|
default: p(() => [
|
|
99
|
-
|
|
99
|
+
r("div", {
|
|
100
100
|
id: `${e.id}-dropdown`,
|
|
101
|
-
class:
|
|
101
|
+
class: l(["nmorph-time-picker__panel", { "nmorph-time-picker__panel--with-seconds": e.props.showSeconds }])
|
|
102
102
|
}, [
|
|
103
|
-
|
|
103
|
+
r("div", g, [
|
|
104
104
|
(i(!0), n(
|
|
105
105
|
s,
|
|
106
106
|
null,
|
|
107
107
|
h(e.hourOptions, (o) => (i(), n("button", {
|
|
108
108
|
key: o.value,
|
|
109
109
|
type: "button",
|
|
110
|
-
class:
|
|
110
|
+
class: l(["nmorph-time-picker__option", [
|
|
111
|
+
e.optionHeightModifiers,
|
|
112
|
+
{ "nmorph-time-picker__option--active": o.value === e.pickerValue.hour }
|
|
113
|
+
]]),
|
|
111
114
|
disabled: o.disabled,
|
|
112
115
|
onClick: (k) => e.selectUnit("hour", o.value)
|
|
113
|
-
},
|
|
116
|
+
}, c(o.label), 11, O))),
|
|
114
117
|
128
|
|
115
118
|
/* KEYED_FRAGMENT */
|
|
116
119
|
))
|
|
117
120
|
]),
|
|
118
|
-
a[1] || (a[1] =
|
|
121
|
+
a[1] || (a[1] = r(
|
|
119
122
|
"div",
|
|
120
123
|
{ class: "nmorph-time-picker__separator" },
|
|
121
124
|
":",
|
|
122
125
|
-1
|
|
123
126
|
/* CACHED */
|
|
124
127
|
)),
|
|
125
|
-
|
|
128
|
+
r("div", H, [
|
|
126
129
|
(i(!0), n(
|
|
127
130
|
s,
|
|
128
131
|
null,
|
|
129
132
|
h(e.minuteOptions, (o) => (i(), n("button", {
|
|
130
133
|
key: o.value,
|
|
131
134
|
type: "button",
|
|
132
|
-
class:
|
|
135
|
+
class: l(["nmorph-time-picker__option", [
|
|
136
|
+
e.optionHeightModifiers,
|
|
137
|
+
{ "nmorph-time-picker__option--active": o.value === e.pickerValue.minute }
|
|
138
|
+
]]),
|
|
133
139
|
disabled: o.disabled,
|
|
134
140
|
onClick: (k) => e.selectUnit("minute", o.value)
|
|
135
|
-
},
|
|
141
|
+
}, c(o.label), 11, N))),
|
|
136
142
|
128
|
|
137
143
|
/* KEYED_FRAGMENT */
|
|
138
144
|
))
|
|
@@ -141,24 +147,27 @@ function S(z, a, B, e, D, M) {
|
|
|
141
147
|
s,
|
|
142
148
|
{ key: 0 },
|
|
143
149
|
[
|
|
144
|
-
a[0] || (a[0] =
|
|
150
|
+
a[0] || (a[0] = r(
|
|
145
151
|
"div",
|
|
146
152
|
{ class: "nmorph-time-picker__separator" },
|
|
147
153
|
":",
|
|
148
154
|
-1
|
|
149
155
|
/* CACHED */
|
|
150
156
|
)),
|
|
151
|
-
|
|
157
|
+
r("div", M, [
|
|
152
158
|
(i(!0), n(
|
|
153
159
|
s,
|
|
154
160
|
null,
|
|
155
161
|
h(e.secondOptions, (o) => (i(), n("button", {
|
|
156
162
|
key: o.value,
|
|
157
163
|
type: "button",
|
|
158
|
-
class:
|
|
164
|
+
class: l(["nmorph-time-picker__option", [
|
|
165
|
+
e.optionHeightModifiers,
|
|
166
|
+
{ "nmorph-time-picker__option--active": o.value === e.pickerValue.second }
|
|
167
|
+
]]),
|
|
159
168
|
disabled: o.disabled,
|
|
160
169
|
onClick: (k) => e.selectUnit("second", o.value)
|
|
161
|
-
},
|
|
170
|
+
}, c(o.label), 11, V))),
|
|
162
171
|
128
|
|
163
172
|
/* KEYED_FRAGMENT */
|
|
164
173
|
))
|
|
@@ -177,7 +186,7 @@ function S(z, a, B, e, D, M) {
|
|
|
177
186
|
/* CLASS, STYLE */
|
|
178
187
|
);
|
|
179
188
|
}
|
|
180
|
-
const F = /* @__PURE__ */
|
|
189
|
+
const F = /* @__PURE__ */ u(b, [["render", I], ["__file", "/builds/ketjo/nmorph/library/src/components/form/nmorph-time-picker/NmorphTimePicker.vue"]]);
|
|
181
190
|
export {
|
|
182
191
|
F as default
|
|
183
192
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import './NmorphTimePicker.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { NmorphComponentHeight as
|
|
4
|
-
import { useI18n as
|
|
5
|
-
import { useModifiers as
|
|
6
|
-
import { useFormItemInput as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
const
|
|
2
|
+
import { defineComponent as ee, ref as g, computed as n, watch as te } from "vue";
|
|
3
|
+
import { NmorphComponentHeight as _ } from "../../../types/index.js";
|
|
4
|
+
import { useI18n as oe } from "vue-i18n";
|
|
5
|
+
import { useModifiers as $ } from "../../../utils/create-modifiers.js";
|
|
6
|
+
import { useFormItemInput as re } from "../nmorph-form/use-form-item-input.js";
|
|
7
|
+
import ne from "../../../assets/icons/clock.svg.js";
|
|
8
|
+
import le from "../../../assets/icons/circle-close.svg.js";
|
|
9
|
+
import ue from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
10
|
+
import se from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
|
|
11
|
+
const Se = /* @__PURE__ */ ee({
|
|
12
12
|
__name: "NmorphTimePicker",
|
|
13
13
|
props: {
|
|
14
14
|
modelValue: { type: [String, null], required: !1, default: null },
|
|
@@ -30,18 +30,18 @@ const be = /* @__PURE__ */ X({
|
|
|
30
30
|
tabindex: { type: Number, required: !1 }
|
|
31
31
|
},
|
|
32
32
|
emits: ["update:model-value", "focus", "blur"],
|
|
33
|
-
setup(
|
|
34
|
-
const t =
|
|
33
|
+
setup(O, { expose: H, emit: k }) {
|
|
34
|
+
const t = O, s = k, { t: T } = oe(), { id: B, name: M, autocomplete: P, tabindex: z } = re(t), a = g(!1), c = g(!1), w = g(null), m = (e) => String(e).padStart(2, "0"), p = (e) => Math.max(1, Math.floor(Number.isFinite(e) ? e : 1)), i = (e) => {
|
|
35
35
|
if (!e) return null;
|
|
36
36
|
const o = e.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/);
|
|
37
37
|
if (!o) return null;
|
|
38
38
|
const r = Number(o[1]), S = Number(o[2]), d = Number(o[3] || 0);
|
|
39
39
|
return r > 23 || S > 59 || d > 59 ? null : { hour: r, minute: S, second: d };
|
|
40
|
-
},
|
|
40
|
+
}, v = (e) => {
|
|
41
41
|
const o = `${m(e.hour)}:${m(e.minute)}`;
|
|
42
42
|
return t.showSeconds ? `${o}:${m(e.second)}` : o;
|
|
43
|
-
}, f = (e) => e.hour * 3600 + e.minute * 60 + e.second, y =
|
|
44
|
-
|
|
43
|
+
}, f = (e) => e.hour * 3600 + e.minute * 60 + e.second, y = n(() => i(t.minTime)), N = n(() => i(t.maxTime)), x = n(() => i(t.modelValue)), u = g(x.value || { hour: 0, minute: 0, second: 0 }), V = n(() => t.placeholder || T("pickATime"));
|
|
44
|
+
te(
|
|
45
45
|
() => t.modelValue,
|
|
46
46
|
(e) => {
|
|
47
47
|
const o = i(e);
|
|
@@ -53,36 +53,36 @@ const be = /* @__PURE__ */ X({
|
|
|
53
53
|
return !!(y.value && o < f(y.value) || N.value && o > f(N.value));
|
|
54
54
|
}, b = (e, o, r) => {
|
|
55
55
|
const S = p(r), d = /* @__PURE__ */ new Set();
|
|
56
|
-
for (let
|
|
57
|
-
return d.add(u.value[e]), Array.from(d).filter((
|
|
58
|
-
const q = { ...u.value, [e]:
|
|
56
|
+
for (let l = 0; l <= o; l += S) d.add(l);
|
|
57
|
+
return d.add(u.value[e]), Array.from(d).filter((l) => l >= 0 && l <= o).sort((l, q) => l - q).map((l) => {
|
|
58
|
+
const q = { ...u.value, [e]: l };
|
|
59
59
|
return {
|
|
60
|
-
label: m(
|
|
61
|
-
value:
|
|
60
|
+
label: m(l),
|
|
61
|
+
value: l,
|
|
62
62
|
disabled: h(q)
|
|
63
63
|
};
|
|
64
64
|
});
|
|
65
|
-
},
|
|
65
|
+
}, D = n(() => b("hour", 23, t.hourStep)), A = n(() => b("minute", 59, t.minuteStep)), F = n(() => b("second", 59, t.secondStep)), R = (e, o) => {
|
|
66
66
|
const r = { ...u.value, [e]: o };
|
|
67
|
-
h(r) || (u.value = r, s("update:model-value",
|
|
68
|
-
},
|
|
67
|
+
h(r) || (u.value = r, s("update:model-value", v(r)));
|
|
68
|
+
}, U = () => {
|
|
69
69
|
s("update:model-value", null), a.value = !1;
|
|
70
|
-
},
|
|
70
|
+
}, j = () => {
|
|
71
71
|
a.value = !1;
|
|
72
|
-
},
|
|
72
|
+
}, E = () => {
|
|
73
73
|
t.disabled || (a.value = !a.value);
|
|
74
|
-
},
|
|
74
|
+
}, G = () => {
|
|
75
75
|
c.value = !0, s("focus");
|
|
76
|
-
},
|
|
76
|
+
}, J = () => {
|
|
77
77
|
c.value = !1, s("blur");
|
|
78
|
-
},
|
|
78
|
+
}, K = (e) => {
|
|
79
79
|
const o = e.target, r = i(o.value);
|
|
80
|
-
!r || h(r) || (u.value = r, s("update:model-value",
|
|
81
|
-
},
|
|
80
|
+
!r || h(r) || (u.value = r, s("update:model-value", v(r)));
|
|
81
|
+
}, L = n(() => t.modelValue || V.value), Q = n(
|
|
82
82
|
() => t.showSeconds ? p(t.secondStep) : p(t.minuteStep) * 60
|
|
83
|
-
),
|
|
84
|
-
() =>
|
|
85
|
-
nmorph: [
|
|
83
|
+
), W = n(() => t.clearable && !!t.modelValue && !t.disabled), X = n(
|
|
84
|
+
() => $({
|
|
85
|
+
nmorph: [_[t.height]],
|
|
86
86
|
"nmorph-time-picker": [
|
|
87
87
|
`${t.disabled && "disabled"}`,
|
|
88
88
|
`${a.value && "open"}`,
|
|
@@ -90,22 +90,26 @@ const be = /* @__PURE__ */ X({
|
|
|
90
90
|
`${!t.modelValue && "placeholder"}`
|
|
91
91
|
]
|
|
92
92
|
})
|
|
93
|
-
),
|
|
93
|
+
), Y = n(
|
|
94
|
+
() => $({
|
|
95
|
+
nmorph: [_[t.height]]
|
|
96
|
+
})
|
|
97
|
+
), I = (e) => typeof e == "number" ? `${e}px` : e, Z = n(() => ({
|
|
94
98
|
...t.width !== void 0 && { "--width": I(t.width) }
|
|
95
99
|
}));
|
|
96
|
-
|
|
97
|
-
const C = { props: t, emit: s, t: T, id:
|
|
98
|
-
return
|
|
100
|
+
H({ inputDOMRef: w });
|
|
101
|
+
const C = { props: t, emit: s, t: T, id: B, name: M, autocomplete: P, tabindex: z, open: a, focused: c, inputDOMRef: w, pad: m, normalizeStep: p, parseTime: i, formatTime: v, timeToSeconds: f, minTimeParts: y, maxTimeParts: N, modelTimeParts: x, pickerValue: u, placeholderText: V, isOutsideRange: h, getUnitOptions: b, hourOptions: D, minuteOptions: A, secondOptions: F, selectUnit: R, clearHandler: U, closeHandler: j, toggleOpen: E, focusHandler: G, blurHandler: J, nativeInputHandler: K, displayValue: L, inputStep: Q, showClearButton: W, modifiers: X, optionHeightModifiers: Y, getCssSize: I, styles: Z, get NmorphDropdown() {
|
|
102
|
+
return se;
|
|
99
103
|
}, get NmorphIcon() {
|
|
100
|
-
return
|
|
104
|
+
return ue;
|
|
101
105
|
}, get NmorphIconCircleClose() {
|
|
102
|
-
return
|
|
106
|
+
return le;
|
|
103
107
|
}, get NmorphIconClock() {
|
|
104
|
-
return
|
|
108
|
+
return ne;
|
|
105
109
|
} };
|
|
106
110
|
return Object.defineProperty(C, "__isScriptSetup", { enumerable: !1, value: !0 }), C;
|
|
107
111
|
}
|
|
108
112
|
});
|
|
109
113
|
export {
|
|
110
|
-
|
|
114
|
+
Se as default
|
|
111
115
|
};
|