@nmorph/nmorph-ui-kit 2.2.36 → 2.2.37
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/components/basic/nmorph-button/NmorphButton.vue2.js +8 -8
- package/dist/components/basic/nmorph-icon/NmorphIcon.vue2.js +3 -3
- package/dist/components/basic/nmorph-layout/NmorphLayout.vue2.js +14 -13
- package/dist/components/basic/nmorph-link/NmorphLink.vue2.js +1 -1
- package/dist/components/basic/nmorph-scroll/NmorphScroll.css +1 -0
- package/dist/components/basic/nmorph-scroll/NmorphScroll.vue.js +6 -4
- package/dist/components/basic/nmorph-scroll/NmorphScroll.vue2.js +1 -0
- package/dist/components/basic/nmorph-space/NmorphSpace.vue2.js +15 -19
- package/dist/components/data/nmorph-avatar/NmorphAvatar.css +1 -1
- package/dist/components/data/nmorph-avatar/NmorphAvatar.vue2.js +5 -5
- package/dist/components/data/nmorph-badge/NmorphBadge.vue2.js +37 -36
- package/dist/components/data/nmorph-calendar/NmorphCalendar.vue2.js +41 -40
- package/dist/components/data/nmorph-card/NmorphCard.vue2.js +15 -14
- package/dist/components/data/nmorph-collapse/components/nmorph-collapse-item/NmorphCollapseItem.vue2.js +5 -9
- package/dist/components/data/nmorph-empty/NmorphEmpty.vue.js +3 -3
- package/dist/components/data/nmorph-empty/NmorphEmpty.vue2.js +17 -14
- package/dist/components/data/nmorph-image/NmorphImage.css +1 -0
- package/dist/components/data/nmorph-image/NmorphImage.vue.js +14 -12
- package/dist/components/data/nmorph-image/NmorphImage.vue2.js +3 -2
- package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue2.js +36 -35
- package/dist/components/data/nmorph-pagination/NmorphPagination.vue2.js +1 -1
- package/dist/components/data/nmorph-progress/NmorphProgress.vue2.js +19 -18
- package/dist/components/data/nmorph-qr-code/NmorphQRCode.vue2.js +20 -19
- package/dist/components/data/nmorph-skeleton/NmorphSkeleton.vue2.js +1 -1
- package/dist/components/data/nmorph-table/NmorphTable.vue2.js +39 -43
- package/dist/components/data/nmorph-virtual-list/NmorphVirtualList.vue2.js +34 -33
- package/dist/components/feedback/nmorph-alert/NmorphAlert.vue2.js +1 -1
- package/dist/components/feedback/nmorph-callout/NmorphCallout.vue2.js +7 -6
- package/dist/components/feedback/nmorph-dialog/NmorphDialog.css +1 -1
- package/dist/components/feedback/nmorph-dialog/NmorphDialog.vue.js +25 -20
- package/dist/components/feedback/nmorph-dialog/NmorphDialog.vue2.js +37 -37
- package/dist/components/feedback/nmorph-drawer/NmorphDrawer.vue2.js +22 -21
- package/dist/components/feedback/nmorph-tooltip/NmorphTooltip.vue2.js +26 -25
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +54 -62
- package/dist/components/form/nmorph-checkbox/NmorphCheckbox.vue2.js +5 -5
- package/dist/components/form/nmorph-color-picker/NmorphColorPicker.vue2.js +5 -5
- package/dist/components/form/nmorph-date-picker/NmorphDatePicker.vue2.js +20 -19
- package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue2.js +7 -7
- package/dist/components/form/nmorph-form/components/nmorph-form-item/NmorphFormItem.vue2.js +2 -2
- package/dist/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-error-box/NmorphErrorBox.vue2.js +1 -1
- package/dist/components/form/nmorph-number-input/NmorphNumberInput.vue2.js +3 -6
- package/dist/components/form/nmorph-otp-input/NmorphOTPInput.vue2.js +6 -6
- package/dist/components/form/nmorph-radio/NmorphRadio.vue2.js +1 -1
- package/dist/components/form/nmorph-select/NmorphSelect.vue2.js +65 -73
- package/dist/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue2.js +4 -4
- package/dist/components/form/nmorph-select-button/NmorphSelectButton.vue2.js +18 -17
- package/dist/components/form/nmorph-select-button/components/nmorph-select-button-item/NmorphSelectButtonItem.vue2.js +1 -1
- package/dist/components/form/nmorph-slider/NmorphSlider.vue2.js +25 -24
- package/dist/components/form/nmorph-switch/NmorphSwitch.vue2.js +23 -22
- package/dist/components/form/nmorph-text-input/NmorphTextInput.css +1 -0
- package/dist/components/form/nmorph-text-input/NmorphTextInput.vue.js +4 -2
- package/dist/components/form/nmorph-text-input/NmorphTextInput.vue2.js +17 -19
- package/dist/components/form/nmorph-textarea/NmorphTextarea.vue2.js +9 -9
- package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue2.js +43 -42
- package/dist/components/navigation/nmorph-backtop/NmorphBacktop.vue2.js +1 -1
- package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue2.js +32 -31
- package/dist/components/navigation/nmorph-tabs/NmorphTabs.vue2.js +1 -1
- package/dist/components/others/nmorph-overlay/NmorphOverlay.vue2.js +1 -1
- package/dist/hooks/use-common-styles.js +18 -278
- package/dist/hooks/use-virtual-list.js +38 -32
- package/dist/index.umd.js +21 -281
- package/dist/package.json.js +1 -1
- package/dist/src/components/basic/nmorph-button/NmorphButton.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-collapse/components/nmorph-collapse-item/NmorphCollapseItem.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-pagination/NmorphPagination.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.d.ts +1 -1
- package/dist/src/components/feedback/nmorph-dialog/NmorphDialog.vue.d.ts +4 -4
- package/dist/src/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-color-picker/NmorphColorPicker.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-date-picker/NmorphDatePicker.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-form/components/nmorph-form-item/NmorphFormItem.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-error-box/NmorphErrorBox.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-number-input/NmorphNumberInput.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-otp-input/NmorphOTPInput.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-radio-group/NmorphRadioGroup.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-select/NmorphSelect.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-select-button/NmorphSelectButton.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-text-input/NmorphTextInput.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-textarea/NmorphTextarea.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-time-picker/NmorphTimePicker.vue.d.ts +1 -1
- package/dist/src/hooks/use-virtual-list.d.ts +6 -0
- package/dist/src/types/index.d.ts +2 -1
- package/dist/src/utils/common.d.ts +5 -0
- package/dist/src/utils/create-modifiers.d.ts +4 -2
- package/dist/style.css +1 -1
- package/dist/utils/common.js +9 -2
- package/dist/utils/create-modifiers.js +6 -6
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import './NmorphSwitch.css';
|
|
2
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
|
+
import { toCssSize as a } from "../../../utils/common.js";
|
|
4
5
|
import { useFormItemInput as _ } from "../nmorph-form/use-form-item-input.js";
|
|
5
6
|
import w from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
6
7
|
import H from "../../../assets/icons/loader.svg.js";
|
|
7
|
-
const
|
|
8
|
+
const M = /* @__PURE__ */ q({
|
|
8
9
|
__name: "NmorphSwitch",
|
|
9
10
|
props: {
|
|
10
11
|
modelValue: { type: [Boolean, String, Number], required: !1, default: !1 },
|
|
@@ -23,39 +24,39 @@ const C = /* @__PURE__ */ q({
|
|
|
23
24
|
},
|
|
24
25
|
emits: ["update:model-value"],
|
|
25
26
|
setup(s, { expose: f, emit: m }) {
|
|
26
|
-
const e = s, { id: p, name: c, tabindex: h } = _(e), u = m,
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
|
|
27
|
+
const e = s, { id: p, name: c, tabindex: h } = _(e), u = m, r = i(!1), v = () => {
|
|
28
|
+
r.value = !0;
|
|
29
|
+
}, g = () => {
|
|
30
|
+
r.value = !1;
|
|
30
31
|
}, b = n(
|
|
31
32
|
() => V({
|
|
32
33
|
"nmorph-switch": [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
e.disabled && "disabled",
|
|
35
|
+
t.value ? "on" : "off",
|
|
36
|
+
e.loading && "loading",
|
|
37
|
+
r.value && "focus"
|
|
37
38
|
]
|
|
38
39
|
})
|
|
39
|
-
),
|
|
40
|
+
), t = i(e.modelValue === e.activeValue), y = () => {
|
|
40
41
|
if (e.disabled) return;
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
u("update:model-value",
|
|
42
|
+
t.value = !t.value;
|
|
43
|
+
const o = t.value ? e.activeValue : e.inactiveValue;
|
|
44
|
+
u("update:model-value", o);
|
|
44
45
|
}, l = i(null);
|
|
45
46
|
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":
|
|
47
|
+
const S = n(() => ({
|
|
48
|
+
...e.width !== void 0 && { "--width": a(e.width) },
|
|
49
|
+
...e.height !== void 0 && { "--height": a(e.height) },
|
|
50
|
+
...e.offset !== void 0 && { "--offset": a(e.offset) },
|
|
51
|
+
...e.thumbHeight !== void 0 && { "--thumb-height": a(e.thumbHeight) }
|
|
51
52
|
}));
|
|
52
53
|
N(
|
|
53
54
|
() => e.modelValue,
|
|
54
|
-
(
|
|
55
|
-
|
|
55
|
+
(o) => {
|
|
56
|
+
t.value = o === e.activeValue;
|
|
56
57
|
}
|
|
57
58
|
);
|
|
58
|
-
const d = { props: e, id: p, name: c, tabindex: h, emit: u, focus:
|
|
59
|
+
const d = { props: e, id: p, name: c, tabindex: h, emit: u, focus: r, focusHandler: v, blurHandler: g, modifiers: b, initialValue: t, changeHandler: y, inputDOMRef: l, styles: S, get NmorphIcon() {
|
|
59
60
|
return w;
|
|
60
61
|
}, get NmorphIconLoaderDots() {
|
|
61
62
|
return H;
|
|
@@ -64,5 +65,5 @@ const C = /* @__PURE__ */ q({
|
|
|
64
65
|
}
|
|
65
66
|
});
|
|
66
67
|
export {
|
|
67
|
-
|
|
68
|
+
M as default
|
|
68
69
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.nmorph-text-input{--prepend-icon-indent: 8px;--prepend-icon-size: 14px;display:flex;flex:1 1 auto;flex-direction:column;align-items:flex-start;min-width:0}.nmorph-text-input__input-side{position:relative;display:flex;justify-content:flex-end;align-items:center;width:100%}.nmorph-text-input__prepend-icon{position:absolute;left:0;z-index:1;display:flex;justify-content:center;align-items:center;width:var(--prepend-icon-size);min-width:var(--prepend-icon-size);height:var(--prepend-icon-size);min-height:var(--prepend-icon-size);margin-left:var(--prepend-icon-indent);pointer-events:none}.nmorph-text-input__prepend-icon svg,.nmorph-text-input__prepend-icon .nmorph-icon,.nmorph-text-input__prepend-icon .nmorph-icon__content{width:100%;min-width:100%;height:100%;min-height:100%}.nmorph-text-input__prepend-icon svg{fill:var(--nmorph-text-color);stroke-width:0}.nmorph-text-input__prepend-icon path{stroke:var(--nmorph-text-color)}.nmorph-text-input input{width:100%;height:var(--height);text-indent:var(--nmorph-text-input-indentation);border:none;border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-inset)}.nmorph-text-input--with-action input{padding-right:calc(var(--height) + var(--indentation-03))}.nmorph-text-input input:focus{background:var(--nmorph-accent-color);outline:none;box-shadow:var(--nmorph-shadow-outset)}.nmorph-text-input.nmorph--focused .nmorph-text-input__prepend-icon svg{fill:var(--nmorph-focus-text-color)}.nmorph-text-input.nmorph--focused .nmorph-text-input__prepend-icon path{stroke:var(--nmorph-focus-text-color)}.nmorph-text-input input:-webkit-autofill,.nmorph-text-input input:-webkit-autofill:hover,.nmorph-text-input input:-webkit-autofill:active{caret-color:var(--nmorph-text-color);box-shadow:var(--nmorph-shadow-inset),inset 0 0 0 1000px var(--nmorph-main-color);-webkit-text-fill-color:var(--nmorph-text-color)}.nmorph-text-input input:-webkit-autofill:focus{caret-color:var(--nmorph-focus-text-color);outline:none;box-shadow:var(--nmorph-shadow-outset),inset 0 0 0 1000px var(--nmorph-accent-color);-webkit-text-fill-color:var(--nmorph-focus-text-color)}.nmorph-text-input input:disabled{cursor:not-allowed;opacity:.6}.nmorph-text-input__password-btn{position:absolute;right:0;height:100%}.nmorph-text-input__password-btn .nmorph-button__content{padding:var(--indentation-03)}.nmorph-text-input.nmorph-button.nmorph--thin-component .nmorph-text-input__password-btn{margin-top:var(--indentation-00)}.nmorph-text-input.nmorph-button.nmorph--thin-component .nmorph-text-input__password-btn .nmorph-button{--height: var(--thin-component)}.nmorph-text-input.nmorph-button.nmorph--focused .nmorph-text-input__password-btn .nmorph-icon{--color: var(--nmorph-white-color)}.nmorph-text-input.nmorph-button.nmorph--focused .nmorph-text-input__password-btn .nmorph-button:not(:disabled,[loading=true]):hover .nmorph-icon{--color: var(--nmorph-white-color)}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import './NmorphTextInput.css';
|
|
1
2
|
import s from "./NmorphTextInput.vue2.js";
|
|
2
3
|
import { openBlock as n, createElementBlock as r, normalizeStyle as m, normalizeClass as c, createElementVNode as i, renderSlot as h, createCommentVNode as l, mergeProps as f, withKeys as y, createBlock as d, withModifiers as _, withCtx as a, createVNode as u, resolveDynamicComponent as b } from "vue";
|
|
4
|
+
/* empty css */
|
|
3
5
|
import x from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
6
|
const v = { class: "nmorph-text-input__input-side" }, k = {
|
|
5
7
|
key: 0,
|
|
@@ -64,7 +66,7 @@ function B(p, o, N, e, C, I) {
|
|
|
64
66
|
/* CLASS, STYLE */
|
|
65
67
|
);
|
|
66
68
|
}
|
|
67
|
-
const
|
|
69
|
+
const z = /* @__PURE__ */ x(s, [["render", B], ["__file", "/builds/ketjo/nmorph/library/src/components/form/nmorph-text-input/NmorphTextInput.vue"]]);
|
|
68
70
|
export {
|
|
69
|
-
|
|
71
|
+
z as default
|
|
70
72
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import './NmorphTextInput.css';
|
|
1
2
|
import { defineComponent as C, useSlots as E, computed as n, ref as l } from "vue";
|
|
2
3
|
import { NmorphComponentHeight as O } from "../../../types/index.js";
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { useFormItemInput as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
const
|
|
4
|
+
import { useModifiers as j } from "../../../utils/create-modifiers.js";
|
|
5
|
+
import { useFormItemInput as F } from "../nmorph-form/use-form-item-input.js";
|
|
6
|
+
import H from "../../../assets/icons/eye-blocked.svg.js";
|
|
7
|
+
import M from "../../../assets/icons/eye.svg.js";
|
|
8
|
+
import A from "../../basic/nmorph-button/NmorphButton.vue.js";
|
|
9
|
+
import D from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
10
|
+
import R from "../../../assets/icons/error.svg.js";
|
|
11
|
+
const W = /* @__PURE__ */ C({
|
|
11
12
|
__name: "NmorphTextInput",
|
|
12
13
|
props: {
|
|
13
14
|
placeholder: { type: String, required: !1, default: "" },
|
|
@@ -25,13 +26,10 @@ const U = /* @__PURE__ */ C({
|
|
|
25
26
|
},
|
|
26
27
|
emits: ["update:model-value", "focus", "blur", "on-enter", "keydown"],
|
|
27
28
|
setup(f, { expose: m, emit: h }) {
|
|
28
|
-
const s = E(), e = f, { id: y, name: b, autocomplete: v, tabindex: g } =
|
|
29
|
-
() =>
|
|
30
|
-
nmorph: [O[e.height],
|
|
31
|
-
"nmorph-text-input": [
|
|
32
|
-
`${e.typePassword && "password"}`,
|
|
33
|
-
`${(e.typePassword || e.clearable) && "with-action"}`
|
|
34
|
-
]
|
|
29
|
+
const s = E(), e = f, { id: y, name: b, autocomplete: v, tabindex: g } = F(e), q = n(
|
|
30
|
+
() => j({
|
|
31
|
+
nmorph: [O[e.height], a.value && "focused"],
|
|
32
|
+
"nmorph-text-input": [e.typePassword && "password", (e.typePassword || e.clearable) && "with-action"]
|
|
35
33
|
})
|
|
36
34
|
), w = (P) => {
|
|
37
35
|
const k = P.target;
|
|
@@ -50,14 +48,14 @@ const U = /* @__PURE__ */ C({
|
|
|
50
48
|
o.value?.select();
|
|
51
49
|
};
|
|
52
50
|
m({ inputDOMRef: o, focus: u, blur: p, select: i });
|
|
53
|
-
const r = h, S = n(() => e.clearable ?
|
|
54
|
-
return
|
|
51
|
+
const r = h, S = n(() => e.clearable ? R : t.value ? H : M), d = n(() => e.indentation || (s["prepend-icon"] ? "28px" : "8px")), B = n(() => ({ "--nmorph-text-input-indentation": d.value })), c = { slots: s, props: e, id: y, name: b, autocomplete: v, tabindex: g, modifiers: q, handleInput: w, showPassword: t, actionButtonClickHandler: x, type: I, focused: a, handleFocus: N, handleBlur: _, inputDOMRef: o, focus: u, blur: p, select: i, emit: r, actionIcon: S, indentation: d, styles: B, get NmorphIcon() {
|
|
52
|
+
return D;
|
|
55
53
|
}, get NmorphButton() {
|
|
56
|
-
return
|
|
54
|
+
return A;
|
|
57
55
|
} };
|
|
58
56
|
return Object.defineProperty(c, "__isScriptSetup", { enumerable: !1, value: !0 }), c;
|
|
59
57
|
}
|
|
60
58
|
});
|
|
61
59
|
export {
|
|
62
|
-
|
|
60
|
+
W as default
|
|
63
61
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import './NmorphTextarea.css';
|
|
2
2
|
import { defineComponent as F, ref as h, computed as l, watch as B, onMounted as I, nextTick as T } from "vue";
|
|
3
|
-
import { NmorphComponentHeight as
|
|
4
|
-
import { useModifiers as
|
|
5
|
-
import { useFormItemInput as
|
|
6
|
-
const
|
|
3
|
+
import { NmorphComponentHeight as O } from "../../../types/index.js";
|
|
4
|
+
import { useModifiers as V } from "../../../utils/create-modifiers.js";
|
|
5
|
+
import { useFormItemInput as j } from "../nmorph-form/use-form-item-input.js";
|
|
6
|
+
const Y = /* @__PURE__ */ F({
|
|
7
7
|
__name: "NmorphTextarea",
|
|
8
8
|
props: {
|
|
9
9
|
placeholder: { type: String, required: !1, default: "" },
|
|
@@ -24,10 +24,10 @@ const D = /* @__PURE__ */ F({
|
|
|
24
24
|
},
|
|
25
25
|
emits: ["update:model-value", "focus", "blur", "on-enter", "keydown"],
|
|
26
26
|
setup(y, { expose: g, emit: x }) {
|
|
27
|
-
const e = y, n = x, { id: b, name: w, autocomplete: q, tabindex: v } =
|
|
28
|
-
() =>
|
|
29
|
-
nmorph: [
|
|
30
|
-
"nmorph-textarea": [
|
|
27
|
+
const e = y, n = x, { id: b, name: w, autocomplete: q, tabindex: v } = j(e), a = h(null), s = h(!1), S = l(
|
|
28
|
+
() => V({
|
|
29
|
+
nmorph: [O[e.height], s.value && "focused"],
|
|
30
|
+
"nmorph-textarea": [e.disabled && "disabled", e.autoSize && "auto-size"]
|
|
31
31
|
})
|
|
32
32
|
), i = (t) => {
|
|
33
33
|
const o = window.getComputedStyle(t);
|
|
@@ -63,5 +63,5 @@ const D = /* @__PURE__ */ F({
|
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
export {
|
|
66
|
-
|
|
66
|
+
Y as default
|
|
67
67
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import './NmorphTimePicker.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { NmorphComponentHeight as
|
|
4
|
-
import { useI18n as
|
|
5
|
-
import { useModifiers as
|
|
2
|
+
import { defineComponent as Z, ref as v, computed as n, watch as ee } from "vue";
|
|
3
|
+
import { NmorphComponentHeight as C } from "../../../types/index.js";
|
|
4
|
+
import { useI18n as te } from "vue-i18n";
|
|
5
|
+
import { useModifiers as _ } from "../../../utils/create-modifiers.js";
|
|
6
|
+
import { toCssSize as oe } from "../../../utils/common.js";
|
|
6
7
|
import { useFormItemInput as re } from "../nmorph-form/use-form-item-input.js";
|
|
7
8
|
import ne from "../../../assets/icons/clock.svg.js";
|
|
8
9
|
import le from "../../../assets/icons/circle-close.svg.js";
|
|
9
10
|
import ue from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
10
|
-
import
|
|
11
|
-
const
|
|
11
|
+
import ae from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
|
|
12
|
+
const ve = /* @__PURE__ */ Z({
|
|
12
13
|
__name: "NmorphTimePicker",
|
|
13
14
|
props: {
|
|
14
15
|
modelValue: { type: [String, null], required: !1, default: null },
|
|
@@ -31,17 +32,17 @@ const Se = /* @__PURE__ */ ee({
|
|
|
31
32
|
},
|
|
32
33
|
emits: ["update:model-value", "focus", "blur"],
|
|
33
34
|
setup(O, { expose: H, emit: k }) {
|
|
34
|
-
const t = O,
|
|
35
|
+
const t = O, a = k, { t: T } = te(), { id: B, name: M, autocomplete: P, tabindex: $ } = re(t), s = v(!1), c = v(!1), w = v(null), m = (e) => String(e).padStart(2, "0"), p = (e) => Math.max(1, Math.floor(Number.isFinite(e) ? e : 1)), i = (e) => {
|
|
35
36
|
if (!e) return null;
|
|
36
37
|
const o = e.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/);
|
|
37
38
|
if (!o) return null;
|
|
38
|
-
const r = Number(o[1]),
|
|
39
|
-
return r > 23 ||
|
|
40
|
-
},
|
|
39
|
+
const r = Number(o[1]), b = Number(o[2]), d = Number(o[3] || 0);
|
|
40
|
+
return r > 23 || b > 59 || d > 59 ? null : { hour: r, minute: b, second: d };
|
|
41
|
+
}, g = (e) => {
|
|
41
42
|
const o = `${m(e.hour)}:${m(e.minute)}`;
|
|
42
43
|
return t.showSeconds ? `${o}:${m(e.second)}` : o;
|
|
43
|
-
}, f = (e) => e.hour * 3600 + e.minute * 60 + e.second, y = n(() => i(t.minTime)), N = n(() => i(t.maxTime)),
|
|
44
|
-
|
|
44
|
+
}, f = (e) => e.hour * 3600 + e.minute * 60 + e.second, y = n(() => i(t.minTime)), N = n(() => i(t.maxTime)), V = n(() => i(t.modelValue)), u = v(V.value || { hour: 0, minute: 0, second: 0 }), x = n(() => t.placeholder || T("pickATime"));
|
|
45
|
+
ee(
|
|
45
46
|
() => t.modelValue,
|
|
46
47
|
(e) => {
|
|
47
48
|
const o = i(e);
|
|
@@ -51,9 +52,9 @@ const Se = /* @__PURE__ */ ee({
|
|
|
51
52
|
const h = (e) => {
|
|
52
53
|
const o = f(e);
|
|
53
54
|
return !!(y.value && o < f(y.value) || N.value && o > f(N.value));
|
|
54
|
-
},
|
|
55
|
-
const
|
|
56
|
-
for (let l = 0; l <= o; l +=
|
|
55
|
+
}, S = (e, o, r) => {
|
|
56
|
+
const b = p(r), d = /* @__PURE__ */ new Set();
|
|
57
|
+
for (let l = 0; l <= o; l += b) d.add(l);
|
|
57
58
|
return d.add(u.value[e]), Array.from(d).filter((l) => l >= 0 && l <= o).sort((l, q) => l - q).map((l) => {
|
|
58
59
|
const q = { ...u.value, [e]: l };
|
|
59
60
|
return {
|
|
@@ -62,44 +63,44 @@ const Se = /* @__PURE__ */ ee({
|
|
|
62
63
|
disabled: h(q)
|
|
63
64
|
};
|
|
64
65
|
});
|
|
65
|
-
},
|
|
66
|
+
}, z = n(() => S("hour", 23, t.hourStep)), D = n(() => S("minute", 59, t.minuteStep)), A = n(() => S("second", 59, t.secondStep)), F = (e, o) => {
|
|
66
67
|
const r = { ...u.value, [e]: o };
|
|
67
|
-
h(r) || (u.value = r,
|
|
68
|
+
h(r) || (u.value = r, a("update:model-value", g(r)));
|
|
69
|
+
}, R = () => {
|
|
70
|
+
a("update:model-value", null), s.value = !1;
|
|
68
71
|
}, U = () => {
|
|
69
|
-
s
|
|
72
|
+
s.value = !1;
|
|
70
73
|
}, j = () => {
|
|
71
|
-
|
|
74
|
+
t.disabled || (s.value = !s.value);
|
|
72
75
|
}, E = () => {
|
|
73
|
-
|
|
76
|
+
c.value = !0, a("focus");
|
|
74
77
|
}, G = () => {
|
|
75
|
-
c.value = !
|
|
76
|
-
}, J = () => {
|
|
77
|
-
c.value = !1, s("blur");
|
|
78
|
-
}, K = (e) => {
|
|
78
|
+
c.value = !1, a("blur");
|
|
79
|
+
}, J = (e) => {
|
|
79
80
|
const o = e.target, r = i(o.value);
|
|
80
|
-
!r || h(r) || (u.value = r,
|
|
81
|
-
},
|
|
81
|
+
!r || h(r) || (u.value = r, a("update:model-value", g(r)));
|
|
82
|
+
}, K = n(() => t.modelValue || x.value), L = n(
|
|
82
83
|
() => t.showSeconds ? p(t.secondStep) : p(t.minuteStep) * 60
|
|
83
|
-
),
|
|
84
|
-
() =>
|
|
85
|
-
nmorph: [
|
|
84
|
+
), Q = n(() => t.clearable && !!t.modelValue && !t.disabled), W = n(
|
|
85
|
+
() => _({
|
|
86
|
+
nmorph: [C[t.height]],
|
|
86
87
|
"nmorph-time-picker": [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
t.disabled && "disabled",
|
|
89
|
+
s.value && "open",
|
|
90
|
+
c.value && "focus",
|
|
91
|
+
!t.modelValue && "placeholder"
|
|
91
92
|
]
|
|
92
93
|
})
|
|
93
|
-
),
|
|
94
|
-
() =>
|
|
95
|
-
nmorph: [
|
|
94
|
+
), X = n(
|
|
95
|
+
() => _({
|
|
96
|
+
nmorph: [C[t.height]]
|
|
96
97
|
})
|
|
97
|
-
),
|
|
98
|
-
...t.width !== void 0 && { "--width":
|
|
98
|
+
), Y = n(() => ({
|
|
99
|
+
...t.width !== void 0 && { "--width": oe(t.width) }
|
|
99
100
|
}));
|
|
100
101
|
H({ inputDOMRef: w });
|
|
101
|
-
const
|
|
102
|
-
return
|
|
102
|
+
const I = { props: t, emit: a, t: T, id: B, name: M, autocomplete: P, tabindex: $, open: s, focused: c, inputDOMRef: w, pad: m, normalizeStep: p, parseTime: i, formatTime: g, timeToSeconds: f, minTimeParts: y, maxTimeParts: N, modelTimeParts: V, pickerValue: u, placeholderText: x, isOutsideRange: h, getUnitOptions: S, hourOptions: z, minuteOptions: D, secondOptions: A, selectUnit: F, clearHandler: R, closeHandler: U, toggleOpen: j, focusHandler: E, blurHandler: G, nativeInputHandler: J, displayValue: K, inputStep: L, showClearButton: Q, modifiers: W, optionHeightModifiers: X, styles: Y, get NmorphDropdown() {
|
|
103
|
+
return ae;
|
|
103
104
|
}, get NmorphIcon() {
|
|
104
105
|
return ue;
|
|
105
106
|
}, get NmorphIconCircleClose() {
|
|
@@ -107,9 +108,9 @@ const Se = /* @__PURE__ */ ee({
|
|
|
107
108
|
}, get NmorphIconClock() {
|
|
108
109
|
return ne;
|
|
109
110
|
} };
|
|
110
|
-
return Object.defineProperty(
|
|
111
|
+
return Object.defineProperty(I, "__isScriptSetup", { enumerable: !1, value: !0 }), I;
|
|
111
112
|
}
|
|
112
113
|
});
|
|
113
114
|
export {
|
|
114
|
-
|
|
115
|
+
ve as default
|
|
115
116
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import './NmorphDropdown.css';
|
|
2
|
-
import { defineComponent as w, ref as q, toRef as
|
|
3
|
-
import { useModifiers as
|
|
2
|
+
import { defineComponent as w, ref as q, toRef as t, computed as l, watch as v } from "vue";
|
|
3
|
+
import { useModifiers as b } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { toCssSize as d } from "../../../utils/common.js";
|
|
4
5
|
import { usePlacement as x } from "../../../hooks/use-placement.js";
|
|
5
6
|
import O from "../../others/nmorph-overlay/NmorphOverlay.vue.js";
|
|
6
|
-
const
|
|
7
|
+
const B = /* @__PURE__ */ w({
|
|
7
8
|
__name: "NmorphDropdown",
|
|
8
9
|
props: {
|
|
9
10
|
open: { type: Boolean, required: !0 },
|
|
@@ -25,46 +26,46 @@ const k = /* @__PURE__ */ w({
|
|
|
25
26
|
hideShadow: { type: Boolean, required: !1, default: !1 }
|
|
26
27
|
},
|
|
27
28
|
emits: ["on-outside-click", "on-escape-keydown"],
|
|
28
|
-
setup(
|
|
29
|
-
|
|
30
|
-
const e =
|
|
31
|
-
initialPlacement:
|
|
29
|
+
setup(p, { expose: f, emit: m }) {
|
|
30
|
+
f();
|
|
31
|
+
const e = p, r = m, i = q(null), { placementCoords: o, placementReady: n, adjustPlacement: a } = x({
|
|
32
|
+
initialPlacement: t(e, "placement"),
|
|
32
33
|
contentDOMElement: i,
|
|
33
|
-
relativeElement:
|
|
34
|
-
yOffset:
|
|
35
|
-
xOffset:
|
|
36
|
-
enabled:
|
|
37
|
-
}),
|
|
38
|
-
() =>
|
|
39
|
-
"nmorph-dropdown": [
|
|
34
|
+
relativeElement: t(e, "relativeElement"),
|
|
35
|
+
yOffset: t(e, "yOffset"),
|
|
36
|
+
xOffset: t(e, "xOffset"),
|
|
37
|
+
enabled: t(e, "open")
|
|
38
|
+
}), c = l(
|
|
39
|
+
() => b({
|
|
40
|
+
"nmorph-dropdown": [!e.open && "closed", e.hideShadow && "hide-shadow"]
|
|
40
41
|
})
|
|
41
|
-
),
|
|
42
|
-
() => e.fillWidth && e.relativeElement ? `${e.relativeElement.clientWidth}px` :
|
|
43
|
-
), h =
|
|
44
|
-
"--nmorph-dropdown-width":
|
|
45
|
-
"--nmorph-dropdown-min-width":
|
|
46
|
-
"--nmorph-dropdown-max-width":
|
|
47
|
-
left:
|
|
48
|
-
top:
|
|
49
|
-
visibility: e.open &&
|
|
42
|
+
), s = l(
|
|
43
|
+
() => e.fillWidth && e.relativeElement ? `${e.relativeElement.clientWidth}px` : d(e.width)
|
|
44
|
+
), h = l(() => ({
|
|
45
|
+
"--nmorph-dropdown-width": s.value,
|
|
46
|
+
"--nmorph-dropdown-min-width": d(e.minWidth) || "auto",
|
|
47
|
+
"--nmorph-dropdown-max-width": d(e.maxWidth) || "none",
|
|
48
|
+
left: o.value.x,
|
|
49
|
+
top: o.value.y,
|
|
50
|
+
visibility: e.open && n.value ? "visible" : "hidden"
|
|
50
51
|
}));
|
|
51
|
-
|
|
52
|
+
v(
|
|
52
53
|
() => e.open,
|
|
53
|
-
(
|
|
54
|
-
|
|
54
|
+
(y) => {
|
|
55
|
+
y && a();
|
|
55
56
|
},
|
|
56
57
|
{ flush: "post" }
|
|
57
58
|
);
|
|
58
|
-
const
|
|
59
|
-
|
|
59
|
+
const u = { props: e, emit: r, dropdownDOMRef: i, placementCoords: o, placementReady: n, adjustPlacement: a, modifiers: c, width: s, dropdownStyle: h, outsideClickHandler: () => {
|
|
60
|
+
r("on-outside-click");
|
|
60
61
|
}, escapeHandler: () => {
|
|
61
|
-
|
|
62
|
+
r("on-escape-keydown");
|
|
62
63
|
}, get NmorphOverlay() {
|
|
63
64
|
return O;
|
|
64
65
|
} };
|
|
65
|
-
return Object.defineProperty(
|
|
66
|
+
return Object.defineProperty(u, "__isScriptSetup", { enumerable: !1, value: !0 }), u;
|
|
66
67
|
}
|
|
67
68
|
});
|
|
68
69
|
export {
|
|
69
|
-
|
|
70
|
+
B as default
|
|
70
71
|
};
|
|
@@ -22,7 +22,7 @@ const L = /* @__PURE__ */ _({
|
|
|
22
22
|
() => t.zIndex
|
|
23
23
|
), w = i(
|
|
24
24
|
() => F({
|
|
25
|
-
"nmorph-overlay": [
|
|
25
|
+
"nmorph-overlay": [t.show && "show", t.transparent && "transparent"]
|
|
26
26
|
})
|
|
27
27
|
), k = i(() => t.disabledTeleport || !t.show || typeof document > "u"), x = () => {
|
|
28
28
|
s("on-outside-click");
|