@nmorph/nmorph-ui-kit 2.2.42 → 2.2.44
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/chevron-up.svg.js +4 -4
- package/dist/assets/icons/download.svg.js +5 -5
- package/dist/assets/icons/open.svg.js +2 -2
- package/dist/assets/icons/search.svg.js +1 -1
- package/dist/assets/icons/smile.svg.js +4 -4
- package/dist/components/basic/nmorph-button/NmorphButton.vue.js +16 -16
- package/dist/components/basic/nmorph-icon/NmorphIcon.css +1 -1
- package/dist/components/data/nmorph-audio-preview/NmorphAudioPreview.css +1 -0
- package/dist/components/data/nmorph-audio-preview/NmorphAudioPreview.vue.js +207 -0
- package/dist/components/data/nmorph-audio-preview/NmorphAudioPreview.vue3.js +6 -0
- package/dist/components/data/nmorph-emoji-picker/NmorphEmojiPicker.css +1 -0
- package/dist/components/data/nmorph-emoji-picker/NmorphEmojiPicker.vue.js +371 -0
- package/dist/components/data/nmorph-emoji-picker/NmorphEmojiPicker.vue3.js +6 -0
- package/dist/components/data/nmorph-file-card/NmorphFileCard.css +1 -0
- package/dist/components/data/nmorph-file-card/NmorphFileCard.vue.js +124 -0
- package/dist/components/data/nmorph-file-card/NmorphFileCard.vue3.js +6 -0
- package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue.js +164 -150
- package/dist/components/data/nmorph-media-tile/NmorphMediaTile.vue.js +8 -8
- package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.css +1 -0
- package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.vue.js +147 -0
- package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.vue3.js +6 -0
- package/dist/components/form/nmorph-file-upload/NmorphFileUpload.css +1 -1
- package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue.js +154 -125
- package/dist/components/form/nmorph-file-upload/types.js +9 -9
- package/dist/hooks/use-common-styles.js +73 -22
- package/dist/index.es.js +861 -849
- package/dist/index.umd.js +76 -25
- package/dist/package.json.js +1 -1
- package/dist/src/components/data/index.d.ts +8 -0
- package/dist/src/components/data/nmorph-audio-preview/NmorphAudioPreview.vue.d.ts +38 -0
- package/dist/src/components/data/nmorph-audio-preview/types.d.ts +20 -0
- package/dist/src/components/data/nmorph-calendar/NmorphCalendar.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-emoji-picker/NmorphEmojiPicker.vue.d.ts +25 -0
- package/dist/src/components/data/nmorph-emoji-picker/types.d.ts +50 -0
- package/dist/src/components/data/nmorph-file-card/NmorphFileCard.vue.d.ts +30 -0
- package/dist/src/components/data/nmorph-file-card/types.d.ts +18 -0
- package/dist/src/components/data/nmorph-media-tile/NmorphMediaTile.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-video-preview/NmorphVideoPreview.vue.d.ts +41 -0
- package/dist/src/components/data/nmorph-video-preview/types.d.ts +27 -0
- package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-year-month-picker/NmorphYearMonthPicker.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-file-upload/NmorphFileUpload.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-file-upload/types.d.ts +4 -0
- package/dist/src/components/form/nmorph-number-input/NmorphNumberInput.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-slider/NmorphSlider.vue.d.ts +1 -1
- package/dist/src/utils/file-types.d.ts +8 -1
- package/dist/style.css +1 -1
- package/dist/utils/file-types.js +28 -21
- package/package.json +23 -24
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import './NmorphVideoPreview.css';
|
|
2
|
+
import { defineComponent as C, useSlots as b, computed as p, openBlock as o, createElementBlock as t, normalizeStyle as D, normalizeClass as H, createBlock as v, unref as a, withCtx as m, createVNode as l, toDisplayString as f, createCommentVNode as s, renderSlot as V, createElementVNode as $ } from "vue";
|
|
3
|
+
import { useModifiers as x } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { createCssSizeVariables as I } from "../../../utils/common.js";
|
|
5
|
+
import c from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import A from "../../../assets/icons/loading.svg.js";
|
|
8
|
+
import E from "../../../assets/icons/video.svg.js";
|
|
9
|
+
import M from "../../../assets/icons/open.svg.js";
|
|
10
|
+
import P from "../../../assets/icons/download.svg.js";
|
|
11
|
+
const T = ["src", "poster", "controls", "muted", "playsinline", "preload"], O = {
|
|
12
|
+
key: 1,
|
|
13
|
+
class: "nmorph-video-preview__state"
|
|
14
|
+
}, L = {
|
|
15
|
+
key: 2,
|
|
16
|
+
class: "nmorph-video-preview__error"
|
|
17
|
+
}, j = {
|
|
18
|
+
key: 2,
|
|
19
|
+
class: "nmorph-video-preview__meta"
|
|
20
|
+
}, q = {
|
|
21
|
+
key: 0,
|
|
22
|
+
class: "nmorph-video-preview__name"
|
|
23
|
+
}, F = {
|
|
24
|
+
key: 1,
|
|
25
|
+
class: "nmorph-video-preview__duration"
|
|
26
|
+
}, G = {
|
|
27
|
+
key: 3,
|
|
28
|
+
class: "nmorph-video-preview__actions"
|
|
29
|
+
}, J = ["href", "aria-label"], K = ["href", "download", "aria-label"], re = /* @__PURE__ */ C({
|
|
30
|
+
__name: "NmorphVideoPreview",
|
|
31
|
+
props: {
|
|
32
|
+
src: {},
|
|
33
|
+
poster: { default: "" },
|
|
34
|
+
name: { default: "" },
|
|
35
|
+
width: { default: void 0 },
|
|
36
|
+
height: { default: void 0 },
|
|
37
|
+
durationMs: { default: void 0 },
|
|
38
|
+
compact: { type: Boolean, default: !1 },
|
|
39
|
+
controls: { type: Boolean, default: !0 },
|
|
40
|
+
muted: { type: Boolean, default: !1 },
|
|
41
|
+
playsinline: { type: Boolean, default: !0 },
|
|
42
|
+
preload: { default: "metadata" },
|
|
43
|
+
fit: { default: "cover" },
|
|
44
|
+
downloadHref: { default: "" },
|
|
45
|
+
loading: { type: Boolean, default: !1 },
|
|
46
|
+
error: { type: Boolean, default: !1 },
|
|
47
|
+
errorText: { default: "" },
|
|
48
|
+
showDefaultActions: { type: Boolean, default: !0 }
|
|
49
|
+
},
|
|
50
|
+
emits: ["play", "pause", "open", "download", "error"],
|
|
51
|
+
setup(_, { emit: h }) {
|
|
52
|
+
const e = _, i = h, w = b(), y = (d) => {
|
|
53
|
+
if (!d || d < 0) return "";
|
|
54
|
+
const r = Math.round(d / 1e3), n = Math.floor(r / 60), z = r % 60;
|
|
55
|
+
return `${n}:${z.toString().padStart(2, "0")}`;
|
|
56
|
+
}, u = p(() => y(e.durationMs)), k = p(
|
|
57
|
+
() => !!w.actions || e.showDefaultActions && (e.src || e.downloadHref)
|
|
58
|
+
), g = p(
|
|
59
|
+
() => x({
|
|
60
|
+
"nmorph-video-preview": [e.compact && "compact", e.fit, e.loading && "loading", e.error && "error"]
|
|
61
|
+
})
|
|
62
|
+
), B = p(
|
|
63
|
+
() => I({
|
|
64
|
+
"--nmorph-video-preview-width": e.width,
|
|
65
|
+
"--nmorph-video-preview-height": e.height
|
|
66
|
+
})
|
|
67
|
+
), N = () => i("open"), S = () => i("download");
|
|
68
|
+
return (d, r) => (o(), t("div", {
|
|
69
|
+
class: H(g.value),
|
|
70
|
+
style: D(B.value)
|
|
71
|
+
}, [
|
|
72
|
+
!e.loading && !e.error ? (o(), t("video", {
|
|
73
|
+
key: 0,
|
|
74
|
+
class: "nmorph-video-preview__media",
|
|
75
|
+
src: e.src,
|
|
76
|
+
poster: e.poster || void 0,
|
|
77
|
+
controls: e.controls,
|
|
78
|
+
muted: e.muted,
|
|
79
|
+
playsinline: e.playsinline,
|
|
80
|
+
preload: e.preload,
|
|
81
|
+
onPlay: r[0] || (r[0] = (n) => i("play", n)),
|
|
82
|
+
onPause: r[1] || (r[1] = (n) => i("pause", n)),
|
|
83
|
+
onError: r[2] || (r[2] = (n) => i("error", n))
|
|
84
|
+
}, null, 40, T)) : (o(), t("div", O, [
|
|
85
|
+
e.loading ? (o(), v(a(c), {
|
|
86
|
+
key: 0,
|
|
87
|
+
size: "large"
|
|
88
|
+
}, {
|
|
89
|
+
default: m(() => [
|
|
90
|
+
l(a(A))
|
|
91
|
+
]),
|
|
92
|
+
_: 1
|
|
93
|
+
})) : (o(), v(a(c), {
|
|
94
|
+
key: 1,
|
|
95
|
+
size: "large"
|
|
96
|
+
}, {
|
|
97
|
+
default: m(() => [
|
|
98
|
+
l(a(E))
|
|
99
|
+
]),
|
|
100
|
+
_: 1
|
|
101
|
+
})),
|
|
102
|
+
e.error && e.errorText ? (o(), t("span", L, f(e.errorText), 1)) : s("", !0)
|
|
103
|
+
])),
|
|
104
|
+
e.name || u.value ? (o(), t("div", j, [
|
|
105
|
+
e.name ? (o(), t("span", q, f(e.name), 1)) : s("", !0),
|
|
106
|
+
u.value ? (o(), t("span", F, f(u.value), 1)) : s("", !0)
|
|
107
|
+
])) : s("", !0),
|
|
108
|
+
k.value ? (o(), t("div", G, [
|
|
109
|
+
V(d.$slots, "actions", {}, () => [
|
|
110
|
+
$("a", {
|
|
111
|
+
href: e.src,
|
|
112
|
+
target: "_blank",
|
|
113
|
+
rel: "noopener noreferrer",
|
|
114
|
+
class: "nmorph-video-preview__action-link",
|
|
115
|
+
"aria-label": `Open ${e.name || "video"}`,
|
|
116
|
+
onClick: N
|
|
117
|
+
}, [
|
|
118
|
+
l(a(c), { size: "small" }, {
|
|
119
|
+
default: m(() => [
|
|
120
|
+
l(a(M))
|
|
121
|
+
]),
|
|
122
|
+
_: 1
|
|
123
|
+
})
|
|
124
|
+
], 8, J),
|
|
125
|
+
e.downloadHref ? (o(), t("a", {
|
|
126
|
+
key: 0,
|
|
127
|
+
href: e.downloadHref,
|
|
128
|
+
download: e.name,
|
|
129
|
+
class: "nmorph-video-preview__action-link",
|
|
130
|
+
"aria-label": `Download ${e.name || "video"}`,
|
|
131
|
+
onClick: S
|
|
132
|
+
}, [
|
|
133
|
+
l(a(c), { size: "small" }, {
|
|
134
|
+
default: m(() => [
|
|
135
|
+
l(a(P))
|
|
136
|
+
]),
|
|
137
|
+
_: 1
|
|
138
|
+
})
|
|
139
|
+
], 8, K)) : s("", !0)
|
|
140
|
+
])
|
|
141
|
+
])) : s("", !0)
|
|
142
|
+
], 6));
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
export {
|
|
146
|
+
re as default
|
|
147
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.nmorph-file-upload{box-sizing:border-box;width:100%;min-width:0}.nmorph-file-upload .nmorph-file-upload__trigger{position:relative;width:100%;min-width:0}.nmorph-file-upload input{display:none}.nmorph-file-upload .nmorph-file-upload__list{width:100%;min-width:0;margin-top:var(--indentation-03)}.nmorph-file-upload .nmorph-file-upload__list>div{box-sizing:border-box;width:100%;min-width:0}.nmorph-file-upload .nmorph-file-upload__file{display:flex;gap:var(--indentation-02);align-items:center;box-sizing:border-box;width:100%;min-width:0;max-width:100%;margin-bottom:var(--indentation-02);padding:var(--indentation-02) var(--indentation-03);overflow:hidden;background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-file-upload.nmorph-file-upload--compact .nmorph-file-upload__file{padding:var(--indentation-01) var(--indentation-02)}.nmorph-file-upload.nmorph-file-upload--layout-grid .nmorph-file-upload__list>div{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:var(--indentation-02)}.nmorph-file-upload.nmorph-file-upload--layout-grid .nmorph-file-upload__file{margin-bottom:0}.nmorph-file-upload.nmorph-file-upload--layout-inline .nmorph-file-upload__list>div{display:flex;flex-wrap:wrap;gap:var(--indentation-02)}.nmorph-file-upload.nmorph-file-upload--layout-inline .nmorph-file-upload__file{width:auto;margin-bottom:0}.nmorph-file-upload .nmorph-file-upload__file>.nmorph-image-preview{flex:0 0 auto}.nmorph-file-upload .nmorph-file-upload__file-info{display:flex;flex:1 1 0;gap:var(--indentation-02);align-items:center;min-width:0;max-width:100%;overflow:hidden}.nmorph-file-upload .nmorph-file-upload__file-info>.nmorph-icon{flex:0 0 auto}.nmorph-file-upload .nmorph-file-upload__file-name{display:block;flex:1 1 0;width:var(--nmorph-file-upload-name-width, auto);min-width:0;max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.nmorph-file-upload .nmorph-file-upload__remove-file{flex:0 0 auto}
|
|
1
|
+
.nmorph-file-upload{box-sizing:border-box;width:100%;min-width:0}.nmorph-file-upload .nmorph-file-upload__trigger{position:relative;width:100%;min-width:0}.nmorph-file-upload input{display:none}.nmorph-file-upload .nmorph-file-upload__list{width:100%;min-width:0;margin-top:var(--indentation-03)}.nmorph-file-upload .nmorph-file-upload__list>div{box-sizing:border-box;width:100%;min-width:0}.nmorph-file-upload .nmorph-file-upload__file{display:flex;gap:var(--indentation-02);align-items:center;box-sizing:border-box;width:100%;min-width:0;max-width:100%;margin-bottom:var(--indentation-02);padding:var(--indentation-02) var(--indentation-03);overflow:hidden;background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-file-upload.nmorph-file-upload--compact .nmorph-file-upload__file{padding:var(--indentation-01) var(--indentation-02)}.nmorph-file-upload.nmorph-file-upload--layout-grid .nmorph-file-upload__list>div{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:var(--indentation-02)}.nmorph-file-upload.nmorph-file-upload--layout-grid .nmorph-file-upload__file{margin-bottom:0}.nmorph-file-upload.nmorph-file-upload--layout-inline .nmorph-file-upload__list>div{display:flex;flex-wrap:wrap;gap:var(--indentation-02)}.nmorph-file-upload.nmorph-file-upload--layout-inline .nmorph-file-upload__file{width:auto;margin-bottom:0}.nmorph-file-upload .nmorph-file-upload__file>.nmorph-image-preview{flex:0 0 auto}.nmorph-file-upload .nmorph-file-upload__file>.nmorph-video-preview,.nmorph-file-upload .nmorph-file-upload__file>.nmorph-audio-preview,.nmorph-file-upload .nmorph-file-upload__file>.nmorph-file-card{flex:1 1 0;min-width:0}.nmorph-file-upload .nmorph-file-upload__file-info{display:flex;flex:1 1 0;gap:var(--indentation-02);align-items:center;min-width:0;max-width:100%;overflow:hidden}.nmorph-file-upload .nmorph-file-upload__file-info>.nmorph-icon{flex:0 0 auto}.nmorph-file-upload .nmorph-file-upload__file-name{display:block;flex:1 1 0;width:var(--nmorph-file-upload-name-width, auto);min-width:0;max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.nmorph-file-upload .nmorph-file-upload__remove-file{flex:0 0 auto}
|
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import './NmorphFileUpload.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { createCssSizeVariables as
|
|
5
|
-
import { getFileAcceptValue as ue,
|
|
6
|
-
import { useI18n as
|
|
2
|
+
import { defineComponent as ee, computed as x, inject as te, ref as R, watch as oe, onBeforeUnmount as le, openBlock as r, createElementBlock as c, normalizeStyle as ie, normalizeClass as ne, createElementVNode as u, unref as l, renderSlot as ae, createVNode as m, TransitionGroup as se, withCtx as F, Fragment as T, renderList as re, toDisplayString as $, createBlock as V, createCommentVNode as me } from "vue";
|
|
3
|
+
import { useModifiers as de } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { createCssSizeVariables as ce } from "../../../utils/common.js";
|
|
5
|
+
import { getFileAcceptValue as ue, isImageFile as N, isVideoFile as pe, isAudioFile as fe, getFileExtension as P, isFileAllowedByTypes as he } from "../../../utils/file-types.js";
|
|
6
|
+
import { useI18n as ve } from "vue-i18n";
|
|
7
7
|
import { useFormItemInput as _e, useFormItemModel as ye } from "../nmorph-form/use-form-item-input.js";
|
|
8
|
-
import
|
|
8
|
+
import A from "../../basic/nmorph-button/NmorphButton.vue.js";
|
|
9
9
|
/* empty css */
|
|
10
|
-
import
|
|
10
|
+
import xe from "../../data/nmorph-image-preview/NmorphImagePreview.vue.js";
|
|
11
11
|
/* empty css */
|
|
12
|
-
import
|
|
12
|
+
import S from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
13
13
|
/* empty css */
|
|
14
|
-
import
|
|
15
|
-
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
import
|
|
21
|
-
|
|
14
|
+
import Fe from "../../data/nmorph-video-preview/NmorphVideoPreview.vue.js";
|
|
15
|
+
/* empty css */
|
|
16
|
+
import ge from "../../data/nmorph-audio-preview/NmorphAudioPreview.vue.js";
|
|
17
|
+
/* empty css */
|
|
18
|
+
import be from "../../data/nmorph-file-card/NmorphFileCard.vue.js";
|
|
19
|
+
/* empty css */
|
|
20
|
+
import z from "../../../assets/icons/image.svg.js";
|
|
21
|
+
import we from "../../../assets/icons/cross.svg.js";
|
|
22
|
+
const ke = { class: "nmorph-file-upload__trigger" }, Ve = ["id", "name", "autocomplete", "tabindex", "multiple", "disabled", "accept"], Ce = {
|
|
22
23
|
key: 0,
|
|
23
24
|
class: "nmorph-file-upload__list"
|
|
24
|
-
},
|
|
25
|
+
}, Ie = { class: "nmorph-file-upload__file-info" }, Be = { class: "nmorph-file-upload__file-name" }, Re = {
|
|
26
|
+
key: 1,
|
|
27
|
+
class: "nmorph-file-upload__file-info"
|
|
28
|
+
}, Te = { class: "nmorph-file-upload__file-name" }, $e = { class: "nmorph-file-upload__remove-file" }, Ye = /* @__PURE__ */ ee({
|
|
25
29
|
__name: "NmorphFileUpload",
|
|
26
30
|
props: {
|
|
27
31
|
id: {},
|
|
@@ -39,151 +43,176 @@ const Te = { class: "nmorph-file-upload__trigger" }, Ue = ["id", "name", "autoco
|
|
|
39
43
|
fileNameWidth: { default: void 0 }
|
|
40
44
|
},
|
|
41
45
|
emits: ["update:model-value", "on-unsupported-file-type-error", "on-file-validation-error"],
|
|
42
|
-
setup(
|
|
43
|
-
const { t:
|
|
44
|
-
|
|
45
|
-
(e) =>
|
|
46
|
+
setup(E, { expose: L, emit: M }) {
|
|
47
|
+
const { t: U } = ve(), o = E, g = M, D = x(() => o.buttonText ? o.buttonText : U("selectFile")), { id: _, name: O, autocomplete: W, tabindex: j } = _e(o), { modelValue: C, updateModelValue: G } = ye(
|
|
48
|
+
o,
|
|
49
|
+
(e) => g("update:model-value", e),
|
|
46
50
|
[]
|
|
47
|
-
), b =
|
|
48
|
-
const
|
|
49
|
-
return e.type.toLowerCase().startsWith("image/") || t.some((o) => h(o, L));
|
|
50
|
-
}, G = F(() => ue(l.allowedTypes)), K = (e) => {
|
|
51
|
-
const t = A(e);
|
|
52
|
-
let o = xe;
|
|
53
|
-
return (e.type.toLowerCase().startsWith("image/") || t.some((i) => h(i, L))) && (o = ke), (e.type.toLowerCase().startsWith("audio/") || t.some((i) => h(i, Ce))) && (o = be), (e.type.toLowerCase().startsWith("video/") || t.some((i) => h(i, Ie))) && (o = Re), t.some((i) => h(i, Ne)) && (o = we), o;
|
|
54
|
-
}, m = R(null), r = R([...N.value]), c = /* @__PURE__ */ new Set(), w = () => {
|
|
55
|
-
const e = m.value;
|
|
51
|
+
), b = te("form-data", void 0), q = x(() => ue(o.allowedTypes)), H = (e) => o.photoWithPreview && N(e), p = R(null), s = R([...C.value]), f = /* @__PURE__ */ new Set(), w = () => {
|
|
52
|
+
const e = p.value;
|
|
56
53
|
e && (e.value = "");
|
|
57
|
-
}, C = (e) => {
|
|
58
|
-
c.has(e) && (URL.revokeObjectURL(e), c.delete(e));
|
|
59
|
-
}, V = (e) => {
|
|
60
|
-
const t = new Set(e.map((o) => o.previewUrl));
|
|
61
|
-
Array.from(c).forEach((o) => {
|
|
62
|
-
t.has(o) || C(o);
|
|
63
|
-
});
|
|
64
54
|
}, k = (e) => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
55
|
+
f.has(e) && (URL.revokeObjectURL(e), f.delete(e));
|
|
56
|
+
}, I = (e) => {
|
|
57
|
+
const i = new Set(e.map((t) => t.previewUrl));
|
|
58
|
+
Array.from(f).forEach((t) => {
|
|
59
|
+
i.has(t) || k(t);
|
|
60
|
+
});
|
|
61
|
+
}, B = (e) => {
|
|
62
|
+
const i = [...e];
|
|
63
|
+
s.value = i, G(i);
|
|
64
|
+
}, J = (e) => {
|
|
65
|
+
const i = b?.validateField(_.value, e);
|
|
69
66
|
return {
|
|
70
|
-
valid:
|
|
71
|
-
errors:
|
|
67
|
+
valid: i?.valid.value ?? !0,
|
|
68
|
+
errors: i?.errors.value ?? []
|
|
72
69
|
};
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
if (
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
if (!
|
|
80
|
-
|
|
70
|
+
}, K = () => {
|
|
71
|
+
o.disabled || !p.value || p.value.click();
|
|
72
|
+
}, Q = (e) => {
|
|
73
|
+
if (o.disabled) return;
|
|
74
|
+
const i = e.target, t = Array.from(i.files || []), a = o.multiple ? t : t.slice(0, 1), d = [];
|
|
75
|
+
if (a.forEach((n) => {
|
|
76
|
+
if (!he(n, o.allowedTypes)) {
|
|
77
|
+
g("on-unsupported-file-type-error", n.type || P(n.name) || n.name);
|
|
81
78
|
return;
|
|
82
79
|
}
|
|
83
|
-
const
|
|
84
|
-
if (!
|
|
85
|
-
|
|
80
|
+
const h = o.multiple ? [...s.value.map((y) => y.data), ...d, n] : [n], v = J(h);
|
|
81
|
+
if (!v.valid) {
|
|
82
|
+
g("on-file-validation-error", { file: n, errors: v.errors });
|
|
86
83
|
return;
|
|
87
84
|
}
|
|
88
|
-
|
|
89
|
-
}), w(),
|
|
90
|
-
const
|
|
91
|
-
const y = URL.createObjectURL(
|
|
92
|
-
return
|
|
93
|
-
}),
|
|
94
|
-
|
|
85
|
+
d.push(n);
|
|
86
|
+
}), w(), d.length > 0) {
|
|
87
|
+
const n = d.map((v) => {
|
|
88
|
+
const y = URL.createObjectURL(v);
|
|
89
|
+
return f.add(y), { data: v, previewUrl: y };
|
|
90
|
+
}), h = o.multiple ? [...s.value, ...n] : n;
|
|
91
|
+
I(h), B(h), b?.validateField(_.value, h);
|
|
95
92
|
}
|
|
96
|
-
},
|
|
97
|
-
if (
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
93
|
+
}, X = (e) => {
|
|
94
|
+
if (o.disabled) return;
|
|
95
|
+
const i = s.value.findIndex((t) => t.data.name === e);
|
|
96
|
+
if (i !== -1) {
|
|
97
|
+
const t = s.value[i];
|
|
98
|
+
k(t.previewUrl), w();
|
|
99
|
+
const a = s.value.filter((d, n) => n !== i);
|
|
100
|
+
B(a), b?.validateField(_.value, a);
|
|
104
101
|
}
|
|
105
102
|
};
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
oe(
|
|
104
|
+
C,
|
|
108
105
|
(e) => {
|
|
109
|
-
const
|
|
110
|
-
|
|
106
|
+
const i = [...e];
|
|
107
|
+
I(i), s.value = i, i.length === 0 && w();
|
|
111
108
|
},
|
|
112
109
|
{ deep: !0 }
|
|
113
|
-
),
|
|
114
|
-
Array.from(
|
|
115
|
-
}),
|
|
116
|
-
const
|
|
117
|
-
() =>
|
|
118
|
-
"nmorph-file-upload": [
|
|
110
|
+
), le(() => {
|
|
111
|
+
Array.from(f).forEach((e) => k(e));
|
|
112
|
+
}), L({ inputDOMRef: p });
|
|
113
|
+
const Y = x(
|
|
114
|
+
() => de({
|
|
115
|
+
"nmorph-file-upload": [o.disabled && "disabled", o.compact && "compact", `layout-${o.layout}`]
|
|
119
116
|
})
|
|
120
|
-
),
|
|
121
|
-
() =>
|
|
122
|
-
"--nmorph-file-upload-name-width":
|
|
117
|
+
), Z = x(
|
|
118
|
+
() => ce({
|
|
119
|
+
"--nmorph-file-upload-name-width": o.fileNameWidth
|
|
123
120
|
})
|
|
124
121
|
);
|
|
125
|
-
return (e,
|
|
126
|
-
class:
|
|
127
|
-
style:
|
|
122
|
+
return (e, i) => (r(), c("div", {
|
|
123
|
+
class: ne(Y.value),
|
|
124
|
+
style: ie(Z.value)
|
|
128
125
|
}, [
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
id:
|
|
126
|
+
u("div", ke, [
|
|
127
|
+
u("input", {
|
|
128
|
+
id: l(_),
|
|
132
129
|
ref_key: "inputDOMRef",
|
|
133
|
-
ref:
|
|
134
|
-
name:
|
|
135
|
-
autocomplete:
|
|
136
|
-
tabindex:
|
|
130
|
+
ref: p,
|
|
131
|
+
name: l(O),
|
|
132
|
+
autocomplete: l(W),
|
|
133
|
+
tabindex: l(j),
|
|
137
134
|
type: "file",
|
|
138
|
-
multiple:
|
|
139
|
-
disabled:
|
|
140
|
-
accept:
|
|
135
|
+
multiple: o.multiple,
|
|
136
|
+
disabled: o.disabled,
|
|
137
|
+
accept: q.value,
|
|
141
138
|
class: "nmorph-native-input",
|
|
142
|
-
onChange:
|
|
143
|
-
}, null, 40,
|
|
139
|
+
onChange: Q
|
|
140
|
+
}, null, 40, Ve),
|
|
144
141
|
ae(e.$slots, "trigger", {}, () => [
|
|
145
|
-
|
|
146
|
-
text:
|
|
142
|
+
m(l(A), {
|
|
143
|
+
text: D.value,
|
|
147
144
|
fill: "",
|
|
148
|
-
disabled:
|
|
149
|
-
onClick:
|
|
145
|
+
disabled: o.disabled,
|
|
146
|
+
onClick: K
|
|
150
147
|
}, null, 8, ["text", "disabled"])
|
|
151
148
|
])
|
|
152
149
|
]),
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
s.value.length > 0 ? (r(), c("div", Ce, [
|
|
151
|
+
m(se, {
|
|
155
152
|
name: "list",
|
|
156
153
|
tag: "div"
|
|
157
154
|
}, {
|
|
158
|
-
default:
|
|
159
|
-
(
|
|
160
|
-
key:
|
|
155
|
+
default: F(() => [
|
|
156
|
+
(r(!0), c(T, null, re(s.value, ({ data: t, previewUrl: a }) => (r(), c("div", {
|
|
157
|
+
key: t.name,
|
|
161
158
|
class: "nmorph-file-upload__file"
|
|
162
159
|
}, [
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
160
|
+
H(t) ? (r(), c(T, { key: 0 }, [
|
|
161
|
+
m(l(xe), { src: a }, null, 8, ["src"]),
|
|
162
|
+
u("div", Ie, [
|
|
163
|
+
m(l(S), {
|
|
164
|
+
width: "14px",
|
|
165
|
+
height: "17px"
|
|
166
|
+
}, {
|
|
167
|
+
default: F(() => [
|
|
168
|
+
m(l(z))
|
|
169
|
+
]),
|
|
170
|
+
_: 1
|
|
171
|
+
}),
|
|
172
|
+
u("span", Be, $(t.name), 1)
|
|
173
|
+
])
|
|
174
|
+
], 64)) : l(N)(t) ? (r(), c("div", Re, [
|
|
175
|
+
m(l(S), {
|
|
169
176
|
width: "14px",
|
|
170
177
|
height: "17px"
|
|
171
178
|
}, {
|
|
172
|
-
default:
|
|
173
|
-
(
|
|
179
|
+
default: F(() => [
|
|
180
|
+
m(l(z))
|
|
174
181
|
]),
|
|
175
|
-
_:
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
]),
|
|
179
|
-
|
|
180
|
-
|
|
182
|
+
_: 1
|
|
183
|
+
}),
|
|
184
|
+
u("span", Te, $(t.name), 1)
|
|
185
|
+
])) : l(pe)(t) ? (r(), V(l(Fe), {
|
|
186
|
+
key: 2,
|
|
187
|
+
src: a,
|
|
188
|
+
name: t.name,
|
|
189
|
+
"download-href": a,
|
|
190
|
+
compact: "",
|
|
191
|
+
controls: ""
|
|
192
|
+
}, null, 8, ["src", "name", "download-href"])) : l(fe)(t) ? (r(), V(l(ge), {
|
|
193
|
+
key: 3,
|
|
194
|
+
src: a,
|
|
195
|
+
name: t.name,
|
|
196
|
+
"download-href": a,
|
|
197
|
+
compact: ""
|
|
198
|
+
}, null, 8, ["src", "name", "download-href"])) : (r(), V(l(be), {
|
|
199
|
+
key: 4,
|
|
200
|
+
name: t.name,
|
|
201
|
+
"mime-type": t.type,
|
|
202
|
+
size: t.size,
|
|
203
|
+
extension: l(P)(t.name),
|
|
204
|
+
"preview-src": a,
|
|
205
|
+
"download-href": a,
|
|
206
|
+
compact: ""
|
|
207
|
+
}, null, 8, ["name", "mime-type", "size", "extension", "preview-src", "download-href"])),
|
|
208
|
+
u("div", $e, [
|
|
209
|
+
m(l(A), {
|
|
181
210
|
height: "thin",
|
|
182
211
|
"style-type": "transparent",
|
|
183
|
-
onClick: (
|
|
212
|
+
onClick: (d) => X(t.name)
|
|
184
213
|
}, {
|
|
185
|
-
"icon-only":
|
|
186
|
-
|
|
214
|
+
"icon-only": F(() => [
|
|
215
|
+
m(l(we))
|
|
187
216
|
]),
|
|
188
217
|
_: 1
|
|
189
218
|
}, 8, ["onClick"])
|
|
@@ -192,10 +221,10 @@ const Te = { class: "nmorph-file-upload__trigger" }, Ue = ["id", "name", "autoco
|
|
|
192
221
|
]),
|
|
193
222
|
_: 1
|
|
194
223
|
})
|
|
195
|
-
])) :
|
|
224
|
+
])) : me("", !0)
|
|
196
225
|
], 6));
|
|
197
226
|
}
|
|
198
227
|
});
|
|
199
228
|
export {
|
|
200
|
-
|
|
229
|
+
Ye as default
|
|
201
230
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var p = /* @__PURE__ */ ((a) => (a.jpeg = "image/jpeg", a.jpg = "image/jpg", a.png = "image/png", a.gif = "image/gif", a["svg-xml"] = "image/svg+xml", a.webp = "image/webp", a))(p || {});
|
|
2
|
-
const
|
|
2
|
+
const g = {
|
|
3
3
|
mp4: "video/mp4",
|
|
4
4
|
webm: "video/webm",
|
|
5
5
|
"video-ogg": "video/ogg",
|
|
@@ -8,19 +8,19 @@ const d = {
|
|
|
8
8
|
*/
|
|
9
9
|
"wideo-ogg": "video/ogg"
|
|
10
10
|
};
|
|
11
|
-
var
|
|
11
|
+
var i = /* @__PURE__ */ ((a) => (a.mpeg = "audio/mpeg", a["audio-ogg"] = "audio/ogg", a.wav = "audio/wav", a))(i || {}), e = /* @__PURE__ */ ((a) => (a.pdf = "application/pdf", a.msword = "application/msword", a.docx = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", a.xls = "application/vnd.ms-excel", a.xlsx = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", a.ppt = "application/vnd.ms-powerpoint", a.pptx = "application/vnd.openxmlformats-officedocument.presentationml.presentation", a.json = "application/json", a.xml = "application/xml", a))(e || {}), d = /* @__PURE__ */ ((a) => (a.zip = "application/zip", a.rar = "application/x-rar-compressed", a["7z"] = "application/x-7z-compressed", a))(d || {});
|
|
12
12
|
const n = {
|
|
13
13
|
...p,
|
|
14
|
-
...
|
|
15
|
-
...e,
|
|
14
|
+
...g,
|
|
16
15
|
...i,
|
|
17
|
-
...
|
|
16
|
+
...e,
|
|
17
|
+
...d
|
|
18
18
|
};
|
|
19
19
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
d as NmorphArchiveResolution,
|
|
21
|
+
i as NmorphAudioResolution,
|
|
22
|
+
e as NmorphDocResolution,
|
|
23
23
|
p as NmorphImageResolution,
|
|
24
|
-
|
|
24
|
+
g as NmorphVideoResolution,
|
|
25
25
|
n as resolution
|
|
26
26
|
};
|