@nmorph/nmorph-ui-kit 3.0.6 → 3.0.7
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/hand.svg.js +2 -2
- package/dist/components/data/nmorph-calendar/NmorphCalendar.vue.js +34 -36
- package/dist/components/data/nmorph-calendar/NmorphCalendar.vue2.js +80 -78
- package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue.js +60 -60
- package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue2.js +118 -94
- package/dist/components/data/nmorph-media-tile/NmorphMediaTile.vue2.js +49 -39
- package/dist/components/data/nmorph-pagination/NmorphPagination.css +1 -1
- package/dist/components/data/nmorph-pagination/NmorphPagination.vue.js +5 -5
- package/dist/components/data/nmorph-pagination/NmorphPagination.vue2.js +80 -56
- package/dist/components/data/nmorph-table/NmorphTable.css +1 -1
- package/dist/components/data/nmorph-table/NmorphTable.vue.js +6 -6
- package/dist/components/data/nmorph-table/NmorphTable.vue2.js +41 -38
- package/dist/components/feedback/nmorph-drawer/NmorphDrawer.vue.js +8 -8
- package/dist/components/feedback/nmorph-drawer/NmorphDrawer.vue2.js +64 -24
- package/dist/index.umd.js +22 -22
- package/dist/package.json.js +1 -1
- package/dist/src/components/data/nmorph-pagination/NmorphPagination.vue.d.ts +3 -0
- package/dist/src/components/data/nmorph-pagination/types.d.ts +3 -0
- package/dist/src/components/data/nmorph-table/NmorphTable.vue.d.ts +2 -20
- package/dist/src/components/data/nmorph-table/types.d.ts +11 -3
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import './NmorphImagePreview.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { createCssSizeVariables 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 ee, ref as w, watch as I, computed as a, onBeforeUnmount as te } from "vue";
|
|
3
|
+
import { useModifiers as re } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { createCssSizeVariables as ae } from "../../../utils/common.js";
|
|
5
|
+
import oe from "../nmorph-preview-portal/NmorphPreviewPortal.vue.js";
|
|
6
|
+
import le from "../../../assets/icons/shrink.svg.js";
|
|
7
|
+
import ne from "../../../assets/icons/rotate-right.svg.js";
|
|
8
|
+
import ie from "../../../assets/icons/rotate-left.svg.js";
|
|
9
|
+
import ue from "../../../assets/icons/zoom-in.svg.js";
|
|
10
|
+
import se from "../../../assets/icons/zoom-out.svg.js";
|
|
11
|
+
import me from "../../../assets/icons/enlarge.svg.js";
|
|
12
|
+
import de from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
13
|
+
import ce from "../../basic/nmorph-button/NmorphButton.vue.js";
|
|
14
|
+
import ge from "../nmorph-image/NmorphImage.vue.js";
|
|
15
|
+
const _e = /* @__PURE__ */ ee({
|
|
16
16
|
__name: "NmorphImagePreview",
|
|
17
17
|
props: {
|
|
18
18
|
modelValue: { type: Boolean, required: !1, default: !1 },
|
|
@@ -38,117 +38,141 @@ const Ne = /* @__PURE__ */ $({
|
|
|
38
38
|
triggerGap: { type: [Number, String], required: !1, default: 8 }
|
|
39
39
|
},
|
|
40
40
|
emits: ["update:model-value"],
|
|
41
|
-
setup(
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
() =>
|
|
41
|
+
setup(O, { expose: D, emit: E }) {
|
|
42
|
+
D();
|
|
43
|
+
const t = O, l = w(t.modelValue);
|
|
44
|
+
I(
|
|
45
|
+
() => t.modelValue,
|
|
46
46
|
(e) => l.value = e
|
|
47
47
|
);
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
return
|
|
51
|
-
},
|
|
52
|
-
() =>
|
|
53
|
-
index:
|
|
48
|
+
const o = a(() => Array.isArray(t.src) ? t.src : [t.src]), s = (e) => {
|
|
49
|
+
const r = o.value.length - 1;
|
|
50
|
+
return r < 0 || e < 0 ? 0 : e > r ? r : e;
|
|
51
|
+
}, i = w(s(t.initialIndex)), u = a(() => s(i.value)), b = a(() => o.value[u.value] || ""), p = a(() => t.triggerView === "gallery" && o.value.length > 1), q = a(() => !t.triggerLimit || t.triggerLimit < 1 ? o.value.length : Math.min(Math.floor(t.triggerLimit), o.value.length)), d = a(
|
|
52
|
+
() => o.value.slice(0, q.value).map((e, r) => ({
|
|
53
|
+
index: r,
|
|
54
54
|
src: e
|
|
55
55
|
}))
|
|
56
|
-
),
|
|
57
|
-
() =>
|
|
58
|
-
"nmorph-image-preview": [l.value && "opened",
|
|
56
|
+
), G = a(() => o.value.length - d.value.length), j = a(() => d.value[d.value.length - 1]?.index ?? -1), F = a(
|
|
57
|
+
() => re({
|
|
58
|
+
"nmorph-image-preview": [l.value && "opened", p.value && "gallery-trigger"]
|
|
59
59
|
})
|
|
60
|
-
),
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
), c = w(/* @__PURE__ */ new Map()), x = (e, r) => e || `__empty-image-${r}`, f = a(() => x(b.value, u.value)), g = a(
|
|
61
|
+
() => c.value.get(f.value) || {
|
|
62
|
+
rotateLevel: 0,
|
|
63
|
+
scaleLevel: 1
|
|
64
|
+
}
|
|
65
|
+
), v = a(() => g.value.rotateLevel), m = a(() => g.value.scaleLevel), Z = a(() => `rotate(${v.value}deg) scale(${m.value})`), T = (e) => {
|
|
66
|
+
const r = new Map(c.value);
|
|
67
|
+
r.set(f.value, e), c.value = r;
|
|
68
|
+
}, n = (e) => {
|
|
69
|
+
T({
|
|
70
|
+
...g.value,
|
|
71
|
+
...e
|
|
72
|
+
});
|
|
73
|
+
}, h = (e) => {
|
|
74
|
+
const r = e % 360;
|
|
75
|
+
return Object.is(r, -0) ? 0 : r;
|
|
76
|
+
}, y = (e) => parseFloat(Math.min(Math.max(e, t.minScaleLevel), t.maxScaleLevel).toFixed(3));
|
|
77
|
+
I(
|
|
78
|
+
() => [t.initialIndex, o.value.length],
|
|
63
79
|
() => {
|
|
64
|
-
|
|
80
|
+
i.value = s(t.initialIndex);
|
|
65
81
|
}
|
|
66
82
|
);
|
|
67
|
-
const
|
|
68
|
-
|
|
83
|
+
const _ = (e) => {
|
|
84
|
+
i.value = s(e), l.value = !0, S("update:model-value", l.value);
|
|
85
|
+
}, U = () => {
|
|
86
|
+
p.value || _(u.value);
|
|
87
|
+
}, W = () => {
|
|
88
|
+
l.value = !1, S("update:model-value", l.value);
|
|
89
|
+
}, B = () => {
|
|
90
|
+
n({
|
|
91
|
+
rotateLevel: h(v.value + 90)
|
|
92
|
+
});
|
|
93
|
+
}, k = () => {
|
|
94
|
+
n({
|
|
95
|
+
rotateLevel: h(v.value - 90)
|
|
96
|
+
});
|
|
97
|
+
}, M = () => {
|
|
98
|
+
n({
|
|
99
|
+
scaleLevel: y(m.value + t.scaleStep)
|
|
100
|
+
});
|
|
101
|
+
}, A = () => {
|
|
102
|
+
n({
|
|
103
|
+
scaleLevel: y(m.value - t.scaleStep)
|
|
104
|
+
});
|
|
105
|
+
}, C = a(() => m.value < 1), K = () => {
|
|
106
|
+
n({ scaleLevel: 1 });
|
|
107
|
+
}, V = () => {
|
|
108
|
+
n({ scaleLevel: 1 });
|
|
69
109
|
}, z = () => {
|
|
70
|
-
|
|
71
|
-
}, F = () => {
|
|
72
|
-
l.value = !1, f("update:model-value", l.value);
|
|
73
|
-
}, S = () => {
|
|
74
|
-
n.value = n.value + 90, n.value >= 360 && (n.value = 0);
|
|
75
|
-
}, w = () => {
|
|
76
|
-
n.value = n.value - 90, n.value <= -360 && (n.value = 0);
|
|
77
|
-
}, I = () => {
|
|
78
|
-
i.value < r.maxScaleLevel && (i.value += r.scaleStep), i.value = parseFloat(i.value.toFixed(3));
|
|
79
|
-
}, b = () => {
|
|
80
|
-
i.value > r.minScaleLevel && (i.value -= r.scaleStep), i.value = parseFloat(i.value.toFixed(3));
|
|
81
|
-
}, L = t(() => i.value < 1), q = () => {
|
|
82
|
-
i.value = 1;
|
|
83
|
-
}, x = () => {
|
|
84
|
-
i.value = 1;
|
|
85
|
-
}, n = g(0), B = () => {
|
|
86
|
-
const e = a.value.length;
|
|
110
|
+
const e = o.value.length;
|
|
87
111
|
if (!e) return;
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
},
|
|
91
|
-
const e =
|
|
112
|
+
const r = u.value - 1;
|
|
113
|
+
i.value = r < 0 ? e - 1 : r;
|
|
114
|
+
}, H = () => {
|
|
115
|
+
const e = o.value.length;
|
|
92
116
|
if (!e) return;
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
},
|
|
96
|
-
!l.value ||
|
|
97
|
-
},
|
|
98
|
-
typeof document > "u" || document.addEventListener("keydown",
|
|
99
|
-
},
|
|
100
|
-
typeof document > "u" || document.removeEventListener("keydown",
|
|
117
|
+
const r = u.value + 1;
|
|
118
|
+
i.value = r > e - 1 ? 0 : r;
|
|
119
|
+
}, N = (e) => {
|
|
120
|
+
!l.value || o.value.length < 2 || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || (e.key === "ArrowLeft" && (e.preventDefault(), z()), e.key === "ArrowRight" && (e.preventDefault(), H()));
|
|
121
|
+
}, R = () => {
|
|
122
|
+
typeof document > "u" || document.addEventListener("keydown", N);
|
|
123
|
+
}, L = () => {
|
|
124
|
+
typeof document > "u" || document.removeEventListener("keydown", N);
|
|
101
125
|
};
|
|
102
|
-
|
|
126
|
+
I(
|
|
103
127
|
l,
|
|
104
128
|
(e) => {
|
|
105
|
-
e ?
|
|
129
|
+
e ? R() : L();
|
|
106
130
|
},
|
|
107
131
|
{ immediate: !0 }
|
|
108
|
-
),
|
|
109
|
-
const
|
|
132
|
+
), te(L);
|
|
133
|
+
const J = a(() => {
|
|
110
134
|
let e = {
|
|
111
|
-
icon:
|
|
112
|
-
handler:
|
|
135
|
+
icon: le,
|
|
136
|
+
handler: V
|
|
113
137
|
};
|
|
114
|
-
return
|
|
115
|
-
icon:
|
|
116
|
-
handler:
|
|
138
|
+
return C.value && (e = {
|
|
139
|
+
icon: me,
|
|
140
|
+
handler: K
|
|
117
141
|
}), e;
|
|
118
|
-
}),
|
|
142
|
+
}), Q = [
|
|
119
143
|
{
|
|
120
|
-
icon:
|
|
121
|
-
handler:
|
|
144
|
+
icon: ne,
|
|
145
|
+
handler: B
|
|
122
146
|
},
|
|
123
147
|
{
|
|
124
|
-
icon:
|
|
125
|
-
handler:
|
|
148
|
+
icon: ie,
|
|
149
|
+
handler: k
|
|
126
150
|
},
|
|
127
151
|
{
|
|
128
|
-
icon:
|
|
129
|
-
handler:
|
|
152
|
+
icon: ue,
|
|
153
|
+
handler: M
|
|
130
154
|
},
|
|
131
155
|
{
|
|
132
|
-
icon:
|
|
133
|
-
handler:
|
|
156
|
+
icon: se,
|
|
157
|
+
handler: A
|
|
134
158
|
}
|
|
135
|
-
],
|
|
136
|
-
() =>
|
|
137
|
-
"--nmorph-private-image-preview-trigger-width":
|
|
138
|
-
"--nmorph-private-image-preview-trigger-height":
|
|
139
|
-
"--nmorph-private-image-preview-radius":
|
|
140
|
-
"--nmorph-private-image-preview-trigger-gap":
|
|
159
|
+
], S = E, $ = a(() => o.value.length > 1), X = a(() => t.showNavigationButtons && $.value), Y = a(
|
|
160
|
+
() => ae({
|
|
161
|
+
"--nmorph-private-image-preview-trigger-width": t.width,
|
|
162
|
+
"--nmorph-private-image-preview-trigger-height": t.height,
|
|
163
|
+
"--nmorph-private-image-preview-radius": t.radius,
|
|
164
|
+
"--nmorph-private-image-preview-trigger-gap": t.triggerGap
|
|
141
165
|
})
|
|
142
|
-
),
|
|
143
|
-
return
|
|
166
|
+
), P = { props: t, open: l, sourceList: o, getClampedIndex: s, currentIndex: i, resolvedCurrentIndex: u, triggerSource: b, showGalleryTrigger: p, triggerSourceLimit: q, triggerSources: d, hiddenTriggerCount: G, lastVisibleTriggerIndex: j, modifiers: F, imageTransformStates: c, getImageTransformKey: x, currentTransformKey: f, currentTransformState: g, rotateLevel: v, scaleLevel: m, imageTransform: Z, setCurrentTransformState: T, updateCurrentTransformState: n, normalizeRotateLevel: h, clampScaleLevel: y, openPreviewAt: _, clickHandler: U, closeHandler: W, rotateRight: B, rotateLeft: k, zoomIn: M, zoomOut: A, isLevelChangedToMin: C, enlargeToNormal: K, shrinkToNormal: V, previousHandler: z, nextHandler: H, keyboardNavigationHandler: N, addKeyboardNavigationListener: R, removeKeyboardNavigationListener: L, enlargeShrinkActionData: J, actions: Q, emit: S, multipleSources: $, showNavigation: X, triggerStyle: Y, getTriggerLabel: (e) => t.alt ? `${t.alt} ${e + 1}` : `Image ${e + 1}`, get NmorphImage() {
|
|
167
|
+
return ge;
|
|
144
168
|
}, get NmorphButton() {
|
|
145
|
-
return
|
|
169
|
+
return ce;
|
|
146
170
|
}, get NmorphIcon() {
|
|
147
|
-
return
|
|
148
|
-
}, NmorphPreviewPortal:
|
|
149
|
-
return Object.defineProperty(
|
|
171
|
+
return de;
|
|
172
|
+
}, NmorphPreviewPortal: oe };
|
|
173
|
+
return Object.defineProperty(P, "__isScriptSetup", { enumerable: !1, value: !0 }), P;
|
|
150
174
|
}
|
|
151
175
|
});
|
|
152
176
|
export {
|
|
153
|
-
|
|
177
|
+
_e as default
|
|
154
178
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import './NmorphMediaTile.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import
|
|
2
|
+
import { defineComponent as _, ref as m, computed as t, watch as I } from "vue";
|
|
3
|
+
import { useModifiers as E } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import L from "../../../assets/icons/video-camera-off.svg.js";
|
|
5
5
|
import A from "../../../assets/icons/share.svg.js";
|
|
6
6
|
import C from "../../../assets/icons/mute.svg.js";
|
|
7
7
|
import x from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
8
8
|
import w from "../../basic/nmorph-button/NmorphButton.vue.js";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
const W = /* @__PURE__ */
|
|
9
|
+
import R from "../nmorph-avatar/NmorphAvatar.vue.js";
|
|
10
|
+
import D from "../../../assets/icons/loader.svg.js";
|
|
11
|
+
const W = /* @__PURE__ */ _({
|
|
12
12
|
__name: "NmorphMediaTile",
|
|
13
13
|
props: {
|
|
14
14
|
src: { type: String, required: !1, default: "" },
|
|
@@ -32,23 +32,21 @@ const W = /* @__PURE__ */ E({
|
|
|
32
32
|
error: { type: Boolean, required: !1, default: !1 },
|
|
33
33
|
errorText: { type: String, required: !1, default: "" }
|
|
34
34
|
},
|
|
35
|
-
setup(
|
|
36
|
-
const e =
|
|
35
|
+
setup(j, { expose: N }) {
|
|
36
|
+
const e = j, o = m(null), n = m(null), u = m({
|
|
37
37
|
audio: 0,
|
|
38
38
|
video: 0
|
|
39
|
-
}),
|
|
39
|
+
}), y = t(() => !!(e.src || e.srcObject)), h = (r) => !r || typeof r.getAudioTracks != "function" ? [] : r.getAudioTracks(), g = (r) => !r || typeof r.getVideoTracks != "function" ? [] : r.getVideoTracks(), d = (r) => {
|
|
40
40
|
u.value = {
|
|
41
|
-
audio:
|
|
42
|
-
video:
|
|
41
|
+
audio: h(r).length,
|
|
42
|
+
video: g(r).length
|
|
43
43
|
};
|
|
44
|
-
},
|
|
45
|
-
() => !!(e.src || e.srcObject && (!
|
|
46
|
-
),
|
|
47
|
-
() => !!(e.srcObject && !e.muted && !e.error && g.value)
|
|
48
|
-
), j = t(() => e.muted || i.value), N = t(() => n.value && e.src ? e.src : void 0), O = t(
|
|
44
|
+
}, k = t(() => typeof e.srcObject?.getVideoTracks == "function"), O = t(() => u.value.video > 0), S = t(
|
|
45
|
+
() => !!(e.src || e.srcObject && (!k.value || O.value))
|
|
46
|
+
), c = t(() => y.value && S.value && !e.videoOff && !e.error), i = t(() => !!(e.srcObject && !e.muted && !e.error)), b = t(() => e.muted || i.value), T = t(() => c.value && e.src ? e.src : void 0), q = t(
|
|
49
47
|
() => e.name.split(/\s+/).filter(Boolean).slice(0, 2).map((r) => r[0]?.toUpperCase()).join("")
|
|
50
|
-
),
|
|
51
|
-
() =>
|
|
48
|
+
), M = t(() => q.value || e.name || "?"), V = t(
|
|
49
|
+
() => E({
|
|
52
50
|
"nmorph-media-tile": [
|
|
53
51
|
e.fit,
|
|
54
52
|
e.mirrored && "mirrored",
|
|
@@ -62,62 +60,74 @@ const W = /* @__PURE__ */ E({
|
|
|
62
60
|
})
|
|
63
61
|
), s = (r) => {
|
|
64
62
|
if (!r || e.sinkId === void 0) return;
|
|
65
|
-
const
|
|
66
|
-
typeof
|
|
67
|
-
});
|
|
68
|
-
}, c = (r) => {
|
|
69
|
-
!r || !e.autoplay || r.play().catch(() => {
|
|
63
|
+
const a = r;
|
|
64
|
+
typeof a.setSinkId == "function" && a.setSinkId(e.sinkId).catch(() => {
|
|
70
65
|
});
|
|
66
|
+
}, f = (r) => {
|
|
67
|
+
console.warn("[NmorphMediaTile] media autoplay failed", r);
|
|
68
|
+
}, p = (r) => {
|
|
69
|
+
if (!r || !e.autoplay) return;
|
|
70
|
+
let a;
|
|
71
|
+
try {
|
|
72
|
+
a = r.play();
|
|
73
|
+
} catch (v) {
|
|
74
|
+
f(v);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
a && typeof a.catch == "function" && a.catch(f);
|
|
71
78
|
};
|
|
72
|
-
|
|
79
|
+
I(
|
|
73
80
|
() => e.srcObject,
|
|
74
|
-
(r,
|
|
81
|
+
(r, a, v) => {
|
|
75
82
|
if (d(r), !r || typeof r.addEventListener != "function" || typeof r.removeEventListener != "function")
|
|
76
83
|
return;
|
|
77
84
|
const l = () => d(r);
|
|
78
|
-
r.addEventListener("addtrack", l), r.addEventListener("removetrack", l),
|
|
85
|
+
r.addEventListener("addtrack", l), r.addEventListener("removetrack", l), v(() => {
|
|
79
86
|
r.removeEventListener("addtrack", l), r.removeEventListener("removetrack", l);
|
|
80
87
|
});
|
|
81
88
|
},
|
|
82
89
|
{ immediate: !0 }
|
|
83
|
-
),
|
|
90
|
+
), I(
|
|
84
91
|
() => [
|
|
85
92
|
e.srcObject,
|
|
86
93
|
e.sinkId,
|
|
87
94
|
e.autoplay,
|
|
88
|
-
|
|
95
|
+
e.videoOff,
|
|
96
|
+
e.error,
|
|
97
|
+
c.value,
|
|
89
98
|
i.value,
|
|
99
|
+
b.value,
|
|
90
100
|
o.value,
|
|
91
|
-
|
|
101
|
+
n.value
|
|
92
102
|
],
|
|
93
103
|
() => {
|
|
94
104
|
if (o.value) {
|
|
95
|
-
const r =
|
|
96
|
-
o.value.srcObject !== r && (o.value.srcObject = r), s(o.value), e.autoplay &&
|
|
105
|
+
const r = e.srcObject;
|
|
106
|
+
o.value.srcObject !== r && (o.value.srcObject = r), s(o.value), e.autoplay && r && !e.videoOff && !e.error && p(o.value);
|
|
97
107
|
}
|
|
98
|
-
if (
|
|
108
|
+
if (n.value) {
|
|
99
109
|
const r = i.value ? e.srcObject : null;
|
|
100
|
-
|
|
110
|
+
n.value.srcObject !== r && (n.value.srcObject = r), s(n.value), e.autoplay && i.value && p(n.value);
|
|
101
111
|
}
|
|
102
112
|
},
|
|
103
113
|
{ immediate: !0, flush: "post" }
|
|
104
|
-
),
|
|
105
|
-
const
|
|
106
|
-
return
|
|
114
|
+
), N({ videoRef: o });
|
|
115
|
+
const B = { props: e, videoRef: o, audioRef: n, srcObjectTrackCount: u, hasMediaSource: y, getAudioTracks: h, getVideoTracks: g, updateSrcObjectTrackCount: d, canInspectVideoTracks: k, hasVideoTracks: O, hasVideoSource: S, videoVisible: c, needsSeparateAudioOutput: i, videoMuted: b, videoSrc: T, initials: q, fallbackLabel: M, modifiers: V, setMediaElementSinkId: s, logMediaPlaybackError: f, playMediaElement: p, get NmorphAvatar() {
|
|
116
|
+
return R;
|
|
107
117
|
}, get NmorphButton() {
|
|
108
118
|
return w;
|
|
109
119
|
}, get NmorphIcon() {
|
|
110
120
|
return x;
|
|
111
121
|
}, get NmorphIconLoaderDots() {
|
|
112
|
-
return
|
|
122
|
+
return D;
|
|
113
123
|
}, get NmorphIconMute() {
|
|
114
124
|
return C;
|
|
115
125
|
}, get NmorphIconShare() {
|
|
116
126
|
return A;
|
|
117
127
|
}, get NmorphIconVideoCameraOff() {
|
|
118
|
-
return
|
|
128
|
+
return L;
|
|
119
129
|
} };
|
|
120
|
-
return Object.defineProperty(
|
|
130
|
+
return Object.defineProperty(B, "__isScriptSetup", { enumerable: !1, value: !0 }), B;
|
|
121
131
|
}
|
|
122
132
|
});
|
|
123
133
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.nmorph-pagination{display:flex;justify-content:center;margin-top:var(--indentation-04)}.nmorph-pagination .nmorph-radio-group__content{display:flex;gap:8px;justify-content:center}.nmorph-pagination .nmorph-radio-group{display:inline-flex;align-items:center}.nmorph-pagination .nmorph-radio-group .nmorph-radio:not(:last-child){margin-right:0;margin-bottom:0}.nmorph-pagination .nmorph-pagination__page-group{margin:0 var(--indentation-01)}.nmorph-pagination .nmorph-pagination__prev-icon{rotate:90deg}.nmorph-pagination .nmorph-pagination__next-icon{rotate:-90deg}.nmorph-pagination .nmorph-pagination__prev-btn{margin-right:8px}.nmorph-pagination .nmorph-pagination__next-btn{margin-left:8px}.nmorph-pagination .nmorph-pagination__page-btn{--nmorph-private-control-height: var(--nmorph-private-pagination-height);--nmorph-private-selection-control-size: var(--nmorph-private-pagination-height);width:40px;min-width:40px;height:var(--nmorph-private-pagination-height);min-height:var(--nmorph-private-pagination-height)}.nmorph-pagination .nmorph-pagination__page-btn.nmorph-radio .nmorph-radio__content,.nmorph-pagination .nmorph-pagination__page-btn.nmorph-radio .nmorph-radio__fake{width:100%;height:100%}.nmorph-pagination .nmorph-pagination__page-btn.nmorph-radio.nmorph-radio--nmorph .nmorph-radio__fake{padding:0}.nmorph-pagination .nmorph-pagination__page-btn-wrapper{display:flex}.nmorph-pagination .nmorph-pagination__prev-secondary-btn{margin-right:8px}.nmorph-pagination .nmorph-pagination__next-secondary-btn{margin-left:8px}
|
|
1
|
+
.nmorph-pagination{display:flex;justify-content:center;box-sizing:border-box;width:var(--nmorph-private-pagination-width, 100%);min-width:min(100%,var(--nmorph-private-pagination-min-width, 0px));max-width:100%;margin-top:var(--indentation-04);margin-right:auto;margin-left:auto}.nmorph-pagination.nmorph-pagination--fixed-container{width:var(--nmorph-private-pagination-width, var(--nmorph-private-pagination-fixed-width))}.nmorph-pagination .nmorph-radio-group__content{display:flex;gap:8px;justify-content:center}.nmorph-pagination .nmorph-radio-group{display:inline-flex;align-items:center}.nmorph-pagination .nmorph-radio-group .nmorph-radio:not(:last-child){margin-right:0;margin-bottom:0}.nmorph-pagination .nmorph-pagination__page-group{margin:0 var(--indentation-01)}.nmorph-pagination .nmorph-pagination__prev-icon{rotate:90deg}.nmorph-pagination .nmorph-pagination__next-icon{rotate:-90deg}.nmorph-pagination .nmorph-pagination__prev-btn{margin-right:8px}.nmorph-pagination .nmorph-pagination__next-btn{margin-left:8px}.nmorph-pagination .nmorph-pagination__page-btn{--nmorph-private-control-height: var(--nmorph-private-pagination-height);--nmorph-private-selection-control-size: var(--nmorph-private-pagination-height);width:40px;min-width:40px;height:var(--nmorph-private-pagination-height);min-height:var(--nmorph-private-pagination-height)}.nmorph-pagination .nmorph-pagination__page-btn.nmorph-radio .nmorph-radio__content,.nmorph-pagination .nmorph-pagination__page-btn.nmorph-radio .nmorph-radio__fake{width:100%;height:100%}.nmorph-pagination .nmorph-pagination__page-btn.nmorph-radio.nmorph-radio--nmorph .nmorph-radio__fake{padding:0}.nmorph-pagination .nmorph-pagination__page-btn-wrapper{display:flex}.nmorph-pagination .nmorph-pagination__prev-secondary-btn{margin-right:8px}.nmorph-pagination .nmorph-pagination__next-secondary-btn{margin-left:8px}
|
|
@@ -17,7 +17,7 @@ function k(v, r, g, n, f, N) {
|
|
|
17
17
|
disabled: n.blockPrevButton || n.interactionDisabled,
|
|
18
18
|
onClick: n.prevClick
|
|
19
19
|
}, {
|
|
20
|
-
|
|
20
|
+
"icon-only": e(() => [
|
|
21
21
|
i(n.NmorphIcon, { class: "nmorph-pagination__prev-icon" }, {
|
|
22
22
|
default: e(() => [
|
|
23
23
|
i(n.NmorphIconChevronDown)
|
|
@@ -50,7 +50,7 @@ function k(v, r, g, n, f, N) {
|
|
|
50
50
|
text: o.label,
|
|
51
51
|
thickness: n.props.thickness,
|
|
52
52
|
disabled: n.interactionDisabled,
|
|
53
|
-
onClick: (
|
|
53
|
+
onClick: (y) => n.bigStepUpdate(o.value)
|
|
54
54
|
}, null, 8, ["class", "text", "thickness", "disabled", "onClick"])) : (a(), s(n.NmorphRadio, {
|
|
55
55
|
key: 1,
|
|
56
56
|
value: o.value,
|
|
@@ -73,7 +73,7 @@ function k(v, r, g, n, f, N) {
|
|
|
73
73
|
disabled: n.blockNextButton || n.interactionDisabled,
|
|
74
74
|
onClick: n.nextClick
|
|
75
75
|
}, {
|
|
76
|
-
|
|
76
|
+
"icon-only": e(() => [
|
|
77
77
|
i(n.NmorphIcon, { class: "nmorph-pagination__next-icon" }, {
|
|
78
78
|
default: e(() => [
|
|
79
79
|
i(n.NmorphIconChevronDown)
|
|
@@ -87,7 +87,7 @@ function k(v, r, g, n, f, N) {
|
|
|
87
87
|
}, 8, ["thickness", "disabled"])
|
|
88
88
|
], 14, b)) : p("v-if", !0);
|
|
89
89
|
}
|
|
90
|
-
const
|
|
90
|
+
const P = /* @__PURE__ */ _(c, [["render", k], ["__file", "/builds/ketjo/nmorph/library/src/components/data/nmorph-pagination/NmorphPagination.vue"]]);
|
|
91
91
|
export {
|
|
92
|
-
|
|
92
|
+
P as default
|
|
93
93
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import './NmorphPagination.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import
|
|
2
|
+
import { defineComponent as V, computed as i, ref as b, watch as d } from "vue";
|
|
3
|
+
import { useModifiers as O } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { createCssSizeVariables as Q } from "../../../utils/common.js";
|
|
5
|
+
import W from "../../form/nmorph-radio/NmorphRadio.vue.js";
|
|
5
6
|
import F from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
const
|
|
7
|
+
import I from "../../basic/nmorph-button/NmorphButton.vue.js";
|
|
8
|
+
import R from "../../form/nmorph-radio-group/NmorphRadioGroup.vue.js";
|
|
9
|
+
import D from "../../../assets/icons/chevron-down.svg.js";
|
|
10
|
+
const K = /* @__PURE__ */ V({
|
|
10
11
|
__name: "NmorphPagination",
|
|
11
12
|
props: {
|
|
12
13
|
totalElementsQuantity: { type: Number, required: !0 },
|
|
@@ -17,88 +18,111 @@ const z = /* @__PURE__ */ O({
|
|
|
17
18
|
hideOnSinglePage: { type: Boolean, required: !1, default: !0 },
|
|
18
19
|
maxVisiblePages: { type: Number, required: !1, default: 9 },
|
|
19
20
|
fastForwardStep: { type: Number, required: !1, default: 5 },
|
|
20
|
-
thickness: { type: null, required: !1, default: "basic" }
|
|
21
|
+
thickness: { type: null, required: !1, default: "basic" },
|
|
22
|
+
fixedContainer: { type: Boolean, required: !1, default: !1 },
|
|
23
|
+
width: { type: [Number, String], required: !1, default: void 0 },
|
|
24
|
+
minWidth: { type: [Number, String], required: !1, default: void 0 }
|
|
21
25
|
},
|
|
22
26
|
emits: ["update:model-value"],
|
|
23
|
-
setup(
|
|
24
|
-
|
|
25
|
-
const t =
|
|
26
|
-
() =>
|
|
27
|
-
"nmorph-pagination": [
|
|
27
|
+
setup(N, { expose: S, emit: x }) {
|
|
28
|
+
S();
|
|
29
|
+
const t = N, c = x, y = i(
|
|
30
|
+
() => O({
|
|
31
|
+
"nmorph-pagination": [
|
|
32
|
+
t.disabled && "disabled",
|
|
33
|
+
t.loading && "loading",
|
|
34
|
+
t.fixedContainer && "fixed-container"
|
|
35
|
+
]
|
|
28
36
|
})
|
|
29
|
-
),
|
|
37
|
+
), g = {
|
|
30
38
|
thick: "var(--thick-component)",
|
|
31
39
|
basic: "var(--basic-component)",
|
|
32
40
|
thin: "var(--thin-component)"
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
}, o = i(() => Math.max(1, Math.floor(t.maxVisiblePages))), v = i(() => {
|
|
42
|
+
const e = o.value * 40, a = Math.max(0, o.value - 1) * 8;
|
|
43
|
+
return [
|
|
44
|
+
"calc(",
|
|
45
|
+
"var(--nmorph-private-pagination-height) + ",
|
|
46
|
+
"var(--nmorph-private-pagination-height) + ",
|
|
47
|
+
"16px + var(--indentation-01) + var(--indentation-01) + ",
|
|
48
|
+
`${e + a}px`,
|
|
49
|
+
")"
|
|
50
|
+
].join("");
|
|
51
|
+
}), P = i(() => ({
|
|
52
|
+
"--nmorph-private-pagination-height": g[t.thickness],
|
|
53
|
+
"--nmorph-private-pagination-fixed-pages": o.value,
|
|
54
|
+
"--nmorph-private-pagination-fixed-width": v.value,
|
|
55
|
+
...Q({
|
|
56
|
+
"--nmorph-private-pagination-width": t.width,
|
|
57
|
+
"--nmorph-private-pagination-min-width": t.minWidth
|
|
58
|
+
})
|
|
59
|
+
})), q = i(() => t.disabled || t.loading), k = () => {
|
|
60
|
+
n.value = String(Number(n.value) - 1);
|
|
61
|
+
}, w = () => {
|
|
62
|
+
n.value = String(Number(n.value) + 1);
|
|
63
|
+
}, n = b(String(t.modelValue)), u = i(() => {
|
|
40
64
|
const e = Number(t.totalElementsQuantity), a = Number(t.elementsQuantityOnPage);
|
|
41
65
|
return !Number.isFinite(e) || !Number.isFinite(a) || e <= 0 || a <= 0 ? 0 : Math.ceil(e / a);
|
|
42
|
-
}),
|
|
66
|
+
}), s = i(
|
|
43
67
|
() => Array.from({ length: u.value }, (e, a) => ({ value: String(a + 1), label: String(a + 1) }))
|
|
44
|
-
),
|
|
45
|
-
const e = String(Math.max(1, Number(
|
|
68
|
+
), p = b([]), f = i(() => {
|
|
69
|
+
const e = String(Math.max(1, Number(n.value) || 1));
|
|
46
70
|
return [{ value: e, label: e }];
|
|
47
|
-
}),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}),
|
|
51
|
-
[
|
|
71
|
+
}), r = i(() => t.loading && p.value.length ? p.value : s.value.length ? s.value : f.value), _ = i(() => t.loading || !t.hideOnSinglePage || u.value > 1);
|
|
72
|
+
d(n, (e) => {
|
|
73
|
+
c("update:model-value", Number(e));
|
|
74
|
+
}), d(
|
|
75
|
+
[s, () => t.loading],
|
|
52
76
|
([e, a]) => {
|
|
53
|
-
(e.length || !a) && (
|
|
77
|
+
(e.length || !a) && (p.value = e);
|
|
54
78
|
},
|
|
55
79
|
{ immediate: !0 }
|
|
56
|
-
),
|
|
80
|
+
), d(
|
|
57
81
|
() => t.modelValue,
|
|
58
82
|
(e) => {
|
|
59
|
-
|
|
83
|
+
n.value = String(e);
|
|
60
84
|
}
|
|
61
|
-
),
|
|
62
|
-
a || e <= 0 || Number(
|
|
85
|
+
), d([u, () => t.loading], ([e, a]) => {
|
|
86
|
+
a || e <= 0 || Number(n.value) > e && (n.value = String(e));
|
|
63
87
|
});
|
|
64
|
-
const
|
|
65
|
-
const e =
|
|
66
|
-
if (e <=
|
|
67
|
-
return
|
|
68
|
-
const m = Math.floor(
|
|
88
|
+
const B = i(() => Number(n.value) === 1), C = i(() => Number(n.value) >= r.value.length), M = i(() => {
|
|
89
|
+
const e = r.value.length, a = Number(n.value), l = t.maxVisiblePages;
|
|
90
|
+
if (e <= l)
|
|
91
|
+
return r.value;
|
|
92
|
+
const m = Math.floor(l / 2);
|
|
69
93
|
return a <= m ? [
|
|
70
|
-
...
|
|
94
|
+
...r.value.slice(0, l - 2),
|
|
71
95
|
{ value: "next", label: "..." },
|
|
72
|
-
|
|
96
|
+
r.value[e - 1]
|
|
73
97
|
] : a >= e - m ? [
|
|
74
|
-
|
|
98
|
+
r.value[0],
|
|
75
99
|
{ value: "prev", label: "..." },
|
|
76
|
-
...
|
|
100
|
+
...r.value.slice(e - (l - 2))
|
|
77
101
|
] : [
|
|
78
|
-
|
|
102
|
+
r.value[0],
|
|
79
103
|
{ value: "prev", label: "..." },
|
|
80
|
-
...
|
|
104
|
+
...r.value.slice(a - m, a + m - 1),
|
|
81
105
|
{ value: "next", label: "..." },
|
|
82
|
-
|
|
106
|
+
r.value[e - 1]
|
|
83
107
|
];
|
|
84
|
-
}),
|
|
85
|
-
const a = Number(
|
|
86
|
-
let
|
|
87
|
-
|
|
108
|
+
}), h = { props: t, emit: c, modifiers: y, thicknessHeightMap: g, fixedPagesCount: o, fixedContainerWidth: v, paginationStyle: P, interactionDisabled: q, prevClick: k, nextClick: w, selectedPage: n, totalPages: u, pages: s, retainedPages: p, fallbackPages: f, effectivePages: r, show: _, blockPrevButton: B, blockNextButton: C, visiblePages: M, bigStepUpdate: (e) => {
|
|
109
|
+
const a = Number(n.value);
|
|
110
|
+
let l = e === "prev" ? a - t.fastForwardStep : a + t.fastForwardStep;
|
|
111
|
+
l <= 0 && (l = 1), l >= r.value.length && (l = r.value.length), n.value = String(l);
|
|
88
112
|
}, get NmorphRadioGroup() {
|
|
89
|
-
return
|
|
113
|
+
return R;
|
|
90
114
|
}, get NmorphButton() {
|
|
91
|
-
return
|
|
115
|
+
return I;
|
|
92
116
|
}, get NmorphIcon() {
|
|
93
117
|
return F;
|
|
94
118
|
}, get NmorphRadio() {
|
|
95
|
-
return
|
|
119
|
+
return W;
|
|
96
120
|
}, get NmorphIconChevronDown() {
|
|
97
|
-
return
|
|
121
|
+
return D;
|
|
98
122
|
} };
|
|
99
|
-
return Object.defineProperty(
|
|
123
|
+
return Object.defineProperty(h, "__isScriptSetup", { enumerable: !1, value: !0 }), h;
|
|
100
124
|
}
|
|
101
125
|
});
|
|
102
126
|
export {
|
|
103
|
-
|
|
127
|
+
K as default
|
|
104
128
|
};
|