@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,13 +1,14 @@
|
|
|
1
1
|
import './NmorphAutocomplete.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
2
|
+
import { defineComponent as J, ref as s, computed as a, watch as c, nextTick as K } from "vue";
|
|
3
|
+
import { useModifiers as _ } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { NmorphComponentHeight as Q } from "../../../types/index.js";
|
|
5
|
+
import { useVirtualList as W } from "../../../hooks/use-virtual-list.js";
|
|
6
|
+
import { useZIndex as X } from "../../../hooks/use-z-index.js";
|
|
7
|
+
import ee from "../nmorph-text-input/NmorphTextInput.vue.js";
|
|
8
|
+
import te from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
|
|
9
|
+
import ae from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
10
|
+
import le from "../../../assets/icons/loader.svg.js";
|
|
11
|
+
const fe = /* @__PURE__ */ J({
|
|
11
12
|
__name: "NmorphAutocomplete",
|
|
12
13
|
props: {
|
|
13
14
|
modelValue: { type: String, required: !1, default: "" },
|
|
@@ -17,7 +18,7 @@ const se = /* @__PURE__ */ P({
|
|
|
17
18
|
actionCallback: { type: Function, required: !1, default: void 0 },
|
|
18
19
|
zIndex: { type: Number, required: !1, default: void 0 },
|
|
19
20
|
virtual: { type: Boolean, required: !1, default: !1 },
|
|
20
|
-
virtualItemHeight: { type: Number, required: !1, default:
|
|
21
|
+
virtualItemHeight: { type: Number, required: !1, default: void 0 },
|
|
21
22
|
virtualMaxHeight: { type: [Number, String], required: !1, default: 240 },
|
|
22
23
|
virtualOverscan: { type: Number, required: !1, default: 5 },
|
|
23
24
|
virtualDynamicHeight: { type: Boolean, required: !1, default: !1 },
|
|
@@ -29,81 +30,89 @@ const se = /* @__PURE__ */ P({
|
|
|
29
30
|
tabindex: { type: Number, required: !1 }
|
|
30
31
|
},
|
|
31
32
|
emits: ["update:model-value", "select"],
|
|
32
|
-
setup(
|
|
33
|
-
|
|
34
|
-
const t =
|
|
35
|
-
() =>
|
|
36
|
-
"nmorph-autocomplete": [`${
|
|
33
|
+
setup(M, { expose: O, emit: $ }) {
|
|
34
|
+
O();
|
|
35
|
+
const t = M, o = s(t.modelValue), d = $, L = a(
|
|
36
|
+
() => _({
|
|
37
|
+
"nmorph-autocomplete": [`${l.value && "open"}`]
|
|
37
38
|
})
|
|
38
|
-
), i = s(!1),
|
|
39
|
-
i.value = e === "",
|
|
40
|
-
},
|
|
41
|
-
i.value = !0,
|
|
42
|
-
}, r =
|
|
39
|
+
), i = s(!1), T = (e) => {
|
|
40
|
+
i.value = e === "", o.value = e, l.value = !i.value && r.value.length > 0, u.value = 0, d("update:model-value", o.value);
|
|
41
|
+
}, l = s(!1), A = s(null), y = () => {
|
|
42
|
+
i.value = !0, l.value = !1;
|
|
43
|
+
}, r = a(() => t.list.filter((e) => Object.keys(e).some((g) => String(e[g]).toLowerCase().includes(o.value.toLowerCase())))), f = a(() => t.virtual && r.value.length > 0), b = a(() => ({
|
|
44
|
+
basic: 30,
|
|
45
|
+
thick: 38,
|
|
46
|
+
thin: 22
|
|
47
|
+
})[t.height || "basic"]), x = a(() => t.virtualItemHeight || b.value), I = a(() => t.virtualOverscan), H = a(() => t.virtualDynamicHeight), n = W(r, {
|
|
43
48
|
enabled: f,
|
|
44
49
|
itemHeight: x,
|
|
45
50
|
overscan: I,
|
|
46
|
-
dynamic:
|
|
47
|
-
}),
|
|
51
|
+
dynamic: H
|
|
52
|
+
}), V = a(() => n.virtualItems.value), z = a(() => ({
|
|
48
53
|
height: `${n.totalHeight.value}px`
|
|
49
|
-
})),
|
|
54
|
+
})), B = a(() => ({
|
|
50
55
|
transform: `translateY(${n.offsetTop.value}px)`
|
|
51
|
-
})),
|
|
56
|
+
})), q = (e) => typeof e == "number" ? `${e}px` : e, E = a(() => q(t.virtualMaxHeight)), u = s(0), v = a(() => r.value[u.value]), m = a(() => `${t.id || t.name || "nmorph-autocomplete"}-listbox`), N = (e) => `${m.value}-option-${e}`;
|
|
52
57
|
c(
|
|
53
58
|
() => t.modelValue,
|
|
54
59
|
(e) => {
|
|
55
|
-
e !==
|
|
60
|
+
e !== o.value && (o.value = e);
|
|
56
61
|
}
|
|
57
62
|
), c(r, async (e) => {
|
|
58
|
-
|
|
63
|
+
l.value = !i.value && o.value !== "" && e.length > 0, u.value = 0, await K(), n.scrollToIndex(0), n.refresh();
|
|
59
64
|
});
|
|
60
65
|
const h = (e) => {
|
|
61
|
-
d("select", e),
|
|
62
|
-
i.value = !0,
|
|
66
|
+
d("select", e), o.value = e.value, d("update:model-value", o.value), setTimeout(() => {
|
|
67
|
+
i.value = !0, l.value = !1;
|
|
63
68
|
});
|
|
64
|
-
},
|
|
69
|
+
}, j = (e) => {
|
|
65
70
|
h(e);
|
|
66
|
-
},
|
|
67
|
-
i.value = !1,
|
|
71
|
+
}, R = () => {
|
|
72
|
+
i.value = !1, l.value = r.value.length > 0;
|
|
68
73
|
}, p = s(!1);
|
|
69
|
-
c(
|
|
74
|
+
c(o, async (e) => {
|
|
70
75
|
e !== "" && t.actionCallback && (p.value = !0, await t.actionCallback(), p.value = !1);
|
|
71
76
|
}), c(p, (e) => {
|
|
72
|
-
e && (
|
|
73
|
-
}), c(
|
|
77
|
+
e && (l.value = !0);
|
|
78
|
+
}), c(u, (e) => {
|
|
74
79
|
f.value && n.scrollToIndex(e);
|
|
75
80
|
});
|
|
76
81
|
const w = () => {
|
|
77
|
-
r.value.length && (
|
|
78
|
-
}, N = () => {
|
|
79
|
-
r.value.length && (a.value = !0, o.value = (o.value - 1 + r.value.length) % r.value.length);
|
|
82
|
+
r.value.length && (l.value = !0, u.value = (u.value + 1) % r.value.length);
|
|
80
83
|
}, S = () => {
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
},
|
|
84
|
+
r.value.length && (l.value = !0, u.value = (u.value - 1 + r.value.length) % r.value.length);
|
|
85
|
+
}, k = () => {
|
|
86
|
+
!l.value || !v.value || h(v.value);
|
|
87
|
+
}, U = (e) => {
|
|
88
|
+
e.key === "ArrowDown" ? (e.preventDefault(), w()) : e.key === "ArrowUp" ? (e.preventDefault(), S()) : e.key === "Enter" ? (e.preventDefault(), k()) : e.key === "Escape" && (e.preventDefault(), y());
|
|
89
|
+
}, Z = a(() => ({
|
|
85
90
|
role: "combobox",
|
|
86
91
|
"aria-autocomplete": "list",
|
|
87
|
-
"aria-expanded":
|
|
92
|
+
"aria-expanded": l.value,
|
|
88
93
|
"aria-controls": m.value,
|
|
89
|
-
"aria-activedescendant":
|
|
90
|
-
})),
|
|
91
|
-
const
|
|
92
|
-
n.measureElement(g,
|
|
93
|
-
}, D =
|
|
94
|
+
"aria-activedescendant": l.value ? N(u.value) : void 0
|
|
95
|
+
})), F = (e, g) => {
|
|
96
|
+
const G = e instanceof Element ? e : e?.$el;
|
|
97
|
+
n.measureElement(g, G);
|
|
98
|
+
}, D = X(l, () => t.zIndex), P = a(() => ({
|
|
94
99
|
"--nmorph-autocomplete-input-z-index": D.value + 1
|
|
95
|
-
})),
|
|
96
|
-
|
|
100
|
+
})), Y = a(
|
|
101
|
+
() => _({
|
|
102
|
+
nmorph: [Q[t.height]]
|
|
103
|
+
})
|
|
104
|
+
), C = { props: t, initialValue: o, emit: d, modifiers: L, userClosed: i, updateValueHandler: T, open: l, nmorphAutocompleteDOMRef: A, closeHandler: y, filteredList: r, virtualEnabled: f, defaultOptionHeight: b, virtualItemHeight: x, virtualOverscan: I, virtualDynamicHeight: H, virtualList: n, virtualItems: V, virtualSpacerStyle: z, virtualContentStyle: B, getCssSize: q, virtualMaxHeight: E, currentIndex: u, activeItem: v, listboxId: m, getOptionId: N, selectItem: h, clickHandler: j, focusHandler: R, loader: p, arrowDownHandler: w, arrowUpHandler: S, enterHandler: k, keydownHandler: U, inputAttrs: Z, setVirtualItemRef: F, dropdownZIndex: D, styles: P, optionHeightModifiers: Y, get NmorphIcon() {
|
|
105
|
+
return ae;
|
|
97
106
|
}, get NmorphDropdown() {
|
|
98
|
-
return
|
|
107
|
+
return te;
|
|
99
108
|
}, get NmorphTextInput() {
|
|
100
|
-
return Q;
|
|
101
|
-
}, get NmorphIconLoader() {
|
|
102
109
|
return ee;
|
|
110
|
+
}, get NmorphIconLoader() {
|
|
111
|
+
return le;
|
|
103
112
|
} };
|
|
104
|
-
return Object.defineProperty(
|
|
113
|
+
return Object.defineProperty(C, "__isScriptSetup", { enumerable: !1, value: !0 }), C;
|
|
105
114
|
}
|
|
106
115
|
});
|
|
107
116
|
export {
|
|
108
|
-
|
|
117
|
+
fe as default
|
|
109
118
|
};
|
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import './NmorphFileUpload.css';
|
|
2
|
-
import
|
|
3
|
-
import { openBlock as
|
|
2
|
+
import m from "./NmorphFileUpload.vue2.js";
|
|
3
|
+
import { openBlock as o, createElementBlock as r, normalizeClass as d, createElementVNode as l, renderSlot as _, createVNode as n, TransitionGroup as h, withCtx as t, Fragment as f, renderList as v, createBlock as a, createCommentVNode as p, resolveDynamicComponent as u, toDisplayString as g } from "vue";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import y from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
6
|
-
const
|
|
6
|
+
const k = { class: "nmorph-file-upload__trigger" }, N = ["multiple", "disabled", "accept"], C = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "nmorph-file-upload__list"
|
|
9
9
|
}, b = { class: "nmorph-file-upload__file-info" }, x = { class: "nmorph-file-upload__file-name" }, F = { class: "nmorph-file-upload__remove-file" };
|
|
10
|
-
function B(
|
|
11
|
-
return
|
|
10
|
+
function B(s, I, w, e, D, S) {
|
|
11
|
+
return o(), r(
|
|
12
12
|
"div",
|
|
13
13
|
{
|
|
14
|
-
class:
|
|
14
|
+
class: d(e.modifiers)
|
|
15
15
|
},
|
|
16
16
|
[
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
l("div", k, [
|
|
18
|
+
l("input", {
|
|
19
19
|
ref: "inputDOMRef",
|
|
20
20
|
type: "file",
|
|
21
21
|
multiple: e.props.multiple,
|
|
22
22
|
disabled: e.props.disabled,
|
|
23
|
+
accept: e.inputAccept,
|
|
23
24
|
class: "nmorph-native-input",
|
|
24
25
|
onChange: e.handleFileUpload
|
|
25
|
-
}, null, 40,
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
}, null, 40, N),
|
|
27
|
+
_(s.$slots, "trigger", {}, () => [
|
|
28
|
+
n(e.NmorphButton, {
|
|
28
29
|
text: e.computedButtonText,
|
|
29
30
|
fill: "",
|
|
30
31
|
disabled: e.props.disabled,
|
|
@@ -32,22 +33,25 @@ function B(a, I, w, e, D, S) {
|
|
|
32
33
|
}, null, 8, ["text", "disabled"])
|
|
33
34
|
])
|
|
34
35
|
]),
|
|
35
|
-
e.files.length > 0 ? (
|
|
36
|
-
|
|
36
|
+
e.files.length > 0 ? (o(), r("div", C, [
|
|
37
|
+
n(h, {
|
|
37
38
|
name: "list",
|
|
38
39
|
tag: "div"
|
|
39
40
|
}, {
|
|
40
41
|
default: t(() => [
|
|
41
|
-
(
|
|
42
|
-
|
|
42
|
+
(o(!0), r(
|
|
43
|
+
f,
|
|
43
44
|
null,
|
|
44
|
-
|
|
45
|
-
key:
|
|
45
|
+
v(e.files, ({ data: i, previewUrl: c }) => (o(), r("div", {
|
|
46
|
+
key: i.name,
|
|
46
47
|
class: "nmorph-file-upload__file"
|
|
47
48
|
}, [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
e.props.photoWithPreview && e.isImageFile(i) ? (o(), a(e.NmorphImagePreview, {
|
|
50
|
+
key: 0,
|
|
51
|
+
src: c
|
|
52
|
+
}, null, 8, ["src"])) : p("v-if", !0),
|
|
53
|
+
l("div", b, [
|
|
54
|
+
n(
|
|
51
55
|
e.NmorphIcon,
|
|
52
56
|
{
|
|
53
57
|
width: "14px",
|
|
@@ -55,7 +59,7 @@ function B(a, I, w, e, D, S) {
|
|
|
55
59
|
},
|
|
56
60
|
{
|
|
57
61
|
default: t(() => [
|
|
58
|
-
(
|
|
62
|
+
(o(), a(u(e.typeFileIconMap(i))))
|
|
59
63
|
]),
|
|
60
64
|
_: 2
|
|
61
65
|
/* DYNAMIC */
|
|
@@ -63,22 +67,22 @@ function B(a, I, w, e, D, S) {
|
|
|
63
67
|
1024
|
|
64
68
|
/* DYNAMIC_SLOTS */
|
|
65
69
|
),
|
|
66
|
-
|
|
70
|
+
l(
|
|
67
71
|
"span",
|
|
68
72
|
x,
|
|
69
|
-
|
|
73
|
+
g(i.name),
|
|
70
74
|
1
|
|
71
75
|
/* TEXT */
|
|
72
76
|
)
|
|
73
77
|
]),
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
l("div", F, [
|
|
79
|
+
n(e.NmorphButton, {
|
|
76
80
|
height: "thin",
|
|
77
81
|
"style-type": "transparent",
|
|
78
|
-
onClick: (U) => e.removeFile(
|
|
82
|
+
onClick: (U) => e.removeFile(i.name)
|
|
79
83
|
}, {
|
|
80
84
|
"icon-only": t(() => [
|
|
81
|
-
|
|
85
|
+
n(e.NmorphIconCross)
|
|
82
86
|
]),
|
|
83
87
|
_: 1
|
|
84
88
|
/* STABLE */
|
|
@@ -92,13 +96,13 @@ function B(a, I, w, e, D, S) {
|
|
|
92
96
|
_: 1
|
|
93
97
|
/* STABLE */
|
|
94
98
|
})
|
|
95
|
-
])) :
|
|
99
|
+
])) : p("v-if", !0)
|
|
96
100
|
],
|
|
97
101
|
2
|
|
98
102
|
/* CLASS */
|
|
99
103
|
);
|
|
100
104
|
}
|
|
101
|
-
const
|
|
105
|
+
const T = /* @__PURE__ */ y(m, [["render", B], ["__file", "/builds/ketjo/nmorph/library/src/components/form/nmorph-file-upload/NmorphFileUpload.vue"]]);
|
|
102
106
|
export {
|
|
103
|
-
|
|
107
|
+
T as default
|
|
104
108
|
};
|
|
@@ -1,94 +1,126 @@
|
|
|
1
1
|
import './NmorphFileUpload.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { useI18n as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
const
|
|
2
|
+
import { defineComponent as M, computed as y, ref as F, watch as E, onBeforeUnmount as W } from "vue";
|
|
3
|
+
import { useModifiers as $ } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { useI18n as D } from "vue-i18n";
|
|
5
|
+
import { resolution as T, NmorphImageResolution as A, NmorphAudioResolution as K, NmorphVideoResolution as z, NmorphArchiveResolution as G } from "./types.js";
|
|
6
|
+
import H from "../../../assets/icons/doc.svg.js";
|
|
7
|
+
import J from "../../data/nmorph-image-preview/NmorphImagePreview.vue.js";
|
|
8
|
+
import Q from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
9
|
+
import X from "../../basic/nmorph-button/NmorphButton.vue.js";
|
|
10
|
+
import Y from "../../../assets/icons/audio.svg.js";
|
|
11
|
+
import Z from "../../../assets/icons/video.svg.js";
|
|
12
|
+
import ee from "../../../assets/icons/archive.svg.js";
|
|
13
|
+
import oe from "../../../assets/icons/cross.svg.js";
|
|
14
|
+
import te from "../../../assets/icons/image.svg.js";
|
|
15
|
+
const ye = /* @__PURE__ */ M({
|
|
16
16
|
__name: "NmorphFileUpload",
|
|
17
17
|
props: {
|
|
18
18
|
modelValue: { type: Array, required: !1, default: () => [] },
|
|
19
19
|
disabled: { type: Boolean, required: !1, default: !1 },
|
|
20
20
|
multiple: { type: Boolean, required: !1, default: !1 },
|
|
21
|
-
allowedTypes: { type: Array, required: !1, default: () => [
|
|
21
|
+
allowedTypes: { type: Array, required: !1, default: () => [] },
|
|
22
22
|
photoWithPreview: { type: Boolean, required: !1, default: !0 },
|
|
23
23
|
buttonText: { type: String, required: !1, default: "" }
|
|
24
24
|
},
|
|
25
25
|
emits: ["update:model-value", "on-unsupported-file-type-error"],
|
|
26
|
-
setup(
|
|
27
|
-
const { t:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
const
|
|
26
|
+
setup(R, { expose: U, emit: _ }) {
|
|
27
|
+
const { t: w } = D(), n = R, d = _, B = y(() => n.buttonText ? n.buttonText : w("selectFile")), g = Object.entries(T), v = {
|
|
28
|
+
"svg-xml": "svg",
|
|
29
|
+
"audio-ogg": "ogg",
|
|
30
|
+
"wideo-ogg": "ogg"
|
|
31
|
+
}, C = (e) => e.split("/")[1]?.toLowerCase() || "", f = (e) => {
|
|
32
|
+
const o = e.split(".").pop()?.toLowerCase();
|
|
33
|
+
return o && o !== e.toLowerCase() ? o : "";
|
|
34
|
+
}, I = (e) => g.find(([, o]) => o.toLowerCase() === e.toLowerCase())?.[0] || "", u = (e) => Array.from(
|
|
35
|
+
new Set(
|
|
36
|
+
[
|
|
37
|
+
e.type.toLowerCase(),
|
|
38
|
+
I(e.type),
|
|
39
|
+
f(e.name),
|
|
40
|
+
C(e.type)
|
|
41
|
+
].filter(Boolean).map((o) => o.toLowerCase())
|
|
42
|
+
)
|
|
43
|
+
), i = (e, o) => Object.prototype.hasOwnProperty.call(o, e), P = (e) => {
|
|
44
|
+
const o = u(e);
|
|
45
|
+
return e.type.toLowerCase().startsWith("image/") || o.some((t) => i(t, A));
|
|
46
|
+
}, L = (e) => {
|
|
47
|
+
if (n.allowedTypes.length === 0) return !0;
|
|
48
|
+
const o = u(e);
|
|
49
|
+
return n.allowedTypes.some((t) => o.includes(String(t).toLowerCase()));
|
|
50
|
+
}, S = y(() => {
|
|
51
|
+
if (n.allowedTypes.length !== 0)
|
|
52
|
+
return Array.from(
|
|
53
|
+
new Set(
|
|
54
|
+
n.allowedTypes.flatMap((e) => {
|
|
55
|
+
const o = String(e).toLowerCase(), t = T[o], r = v[o] || o;
|
|
56
|
+
return o.includes("/") ? o : t ? [`.${r}`, t] : `.${r}`;
|
|
57
|
+
})
|
|
58
|
+
)
|
|
59
|
+
).join(",");
|
|
60
|
+
}), V = (e) => {
|
|
61
|
+
const o = u(e);
|
|
62
|
+
let t = H;
|
|
63
|
+
return (e.type.toLowerCase().startsWith("image/") || o.some((r) => i(r, A))) && (t = te), (e.type.toLowerCase().startsWith("audio/") || o.some((r) => i(r, K))) && (t = Y), (e.type.toLowerCase().startsWith("video/") || o.some((r) => i(r, z))) && (t = Z), o.some((r) => i(r, G)) && (t = ee), t;
|
|
64
|
+
}, p = F(null), a = F([...n.modelValue]), l = /* @__PURE__ */ new Set(), m = () => {
|
|
65
|
+
const e = p.value;
|
|
33
66
|
e && (e.value = "");
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
},
|
|
67
|
+
}, c = (e) => {
|
|
68
|
+
l.has(e) && (URL.revokeObjectURL(e), l.delete(e));
|
|
69
|
+
}, N = (e) => {
|
|
37
70
|
const o = new Set(e.map((t) => t.previewUrl));
|
|
38
|
-
Array.from(
|
|
39
|
-
o.has(t) ||
|
|
71
|
+
Array.from(l).forEach((t) => {
|
|
72
|
+
o.has(t) || c(t);
|
|
40
73
|
});
|
|
41
|
-
},
|
|
74
|
+
}, h = (e) => {
|
|
42
75
|
const o = [...e];
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
if (
|
|
48
|
-
const o = e.target, t = Array.from(o.files || []),
|
|
49
|
-
t.forEach((
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
m("on-unsupported-file-type-error", l.type);
|
|
76
|
+
a.value = o, d("update:model-value", o);
|
|
77
|
+
}, O = () => {
|
|
78
|
+
n.disabled || !p.value || p.value.click();
|
|
79
|
+
}, j = (e) => {
|
|
80
|
+
if (n.disabled) return;
|
|
81
|
+
const o = e.target, t = Array.from(o.files || []), r = [];
|
|
82
|
+
t.forEach((s) => {
|
|
83
|
+
if (!L(s)) {
|
|
84
|
+
d("on-unsupported-file-type-error", s.type || f(s.name) || s.name);
|
|
53
85
|
return;
|
|
54
86
|
}
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
}),
|
|
58
|
-
},
|
|
59
|
-
if (
|
|
60
|
-
const o =
|
|
87
|
+
const b = URL.createObjectURL(s);
|
|
88
|
+
l.add(b), r.push({ data: s, previewUrl: b });
|
|
89
|
+
}), m(), r.length > 0 && h([...a.value, ...r]);
|
|
90
|
+
}, k = (e) => {
|
|
91
|
+
if (n.disabled) return;
|
|
92
|
+
const o = a.value.findIndex((t) => t.data.name === e);
|
|
61
93
|
if (o !== -1) {
|
|
62
|
-
const t =
|
|
63
|
-
|
|
94
|
+
const t = a.value[o];
|
|
95
|
+
c(t.previewUrl), m(), h(a.value.filter((r, s) => s !== o));
|
|
64
96
|
}
|
|
65
97
|
};
|
|
66
|
-
|
|
67
|
-
() =>
|
|
98
|
+
E(
|
|
99
|
+
() => n.modelValue,
|
|
68
100
|
(e) => {
|
|
69
101
|
const o = [...e];
|
|
70
|
-
|
|
102
|
+
N(o), a.value = o, o.length === 0 && m();
|
|
71
103
|
},
|
|
72
104
|
{ deep: !0 }
|
|
73
|
-
),
|
|
74
|
-
Array.from(
|
|
75
|
-
}),
|
|
76
|
-
const
|
|
77
|
-
() =>
|
|
78
|
-
"nmorph-file-upload": [`${
|
|
105
|
+
), W(() => {
|
|
106
|
+
Array.from(l).forEach((e) => c(e));
|
|
107
|
+
}), U({ inputDOMRef: p });
|
|
108
|
+
const q = y(
|
|
109
|
+
() => $({
|
|
110
|
+
"nmorph-file-upload": [`${n.disabled && "disabled"}`]
|
|
79
111
|
})
|
|
80
|
-
),
|
|
81
|
-
return
|
|
112
|
+
), x = { t: w, props: n, emit: d, computedButtonText: B, knownResolutionEntries: g, extensionByResolution: v, getPlainType: C, getFileExtension: f, getKnownResolutionByMime: I, getFileTypeCandidates: u, isKnownFileType: i, isImageFile: P, isFileAllowed: L, inputAccept: S, typeFileIconMap: V, inputDOMRef: p, files: a, createdPreviewUrls: l, resetInputValue: m, revokePreviewUrl: c, revokeRemovedPreviewUrls: N, filesChanged: h, openFileSelector: O, handleFileUpload: j, removeFile: k, modifiers: q, get NmorphButton() {
|
|
113
|
+
return X;
|
|
82
114
|
}, get NmorphIcon() {
|
|
83
|
-
return
|
|
115
|
+
return Q;
|
|
84
116
|
}, get NmorphImagePreview() {
|
|
85
|
-
return
|
|
117
|
+
return J;
|
|
86
118
|
}, get NmorphIconCross() {
|
|
87
|
-
return
|
|
119
|
+
return oe;
|
|
88
120
|
} };
|
|
89
|
-
return Object.defineProperty(
|
|
121
|
+
return Object.defineProperty(x, "__isScriptSetup", { enumerable: !1, value: !0 }), x;
|
|
90
122
|
}
|
|
91
123
|
});
|
|
92
124
|
export {
|
|
93
|
-
|
|
125
|
+
ye as default
|
|
94
126
|
};
|