@nmorph/nmorph-ui-kit 3.0.6 → 3.0.8
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/basic/nmorph-icon/NmorphIcon.css +1 -1
- 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-carousel/NmorphCarousel.css +1 -1
- package/dist/components/data/nmorph-carousel/NmorphCarousel.vue.js +26 -24
- package/dist/components/data/nmorph-carousel/NmorphCarousel.vue2.js +80 -30
- package/dist/components/data/nmorph-carousel/components/nmorph-carousel-item/NmorphCarouselItem.vue.js +21 -14
- package/dist/components/data/nmorph-carousel/components/nmorph-carousel-item/NmorphCarouselItem.vue2.js +20 -16
- 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.css +1 -1
- package/dist/components/data/nmorph-media-tile/NmorphMediaTile.vue2.js +55 -41
- 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/components/navigation/nmorph-stepper/NmorphStepper.css +1 -1
- package/dist/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.js +101 -96
- package/dist/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue2.js +84 -60
- package/dist/hooks/use-z-index.js +10 -10
- package/dist/index.umd.js +23 -23
- package/dist/package.json.js +1 -1
- package/dist/src/components/data/nmorph-carousel/NmorphCarousel.vue.d.ts +3 -1
- package/dist/src/components/data/nmorph-carousel/types.d.ts +1 -0
- package/dist/src/components/data/nmorph-media-tile/NmorphMediaTile.vue.d.ts +3 -1
- package/dist/src/components/data/nmorph-media-tile/types.d.ts +4 -0
- 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/src/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.d.ts +3 -1
- package/dist/src/components/providers/nmorph-notification-provider/types.d.ts +2 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,16 +1,18 @@
|
|
|
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
|
+
design: { type: null, required: !1, default: "nmorph" },
|
|
15
|
+
aspect: { type: String, required: !1, default: "video" },
|
|
14
16
|
src: { type: String, required: !1, default: "" },
|
|
15
17
|
srcObject: { type: null, required: !1, default: null },
|
|
16
18
|
sinkId: { type: String, required: !1, default: void 0 },
|
|
@@ -32,24 +34,24 @@ const W = /* @__PURE__ */ E({
|
|
|
32
34
|
error: { type: Boolean, required: !1, default: !1 },
|
|
33
35
|
errorText: { type: String, required: !1, default: "" }
|
|
34
36
|
},
|
|
35
|
-
setup(
|
|
36
|
-
const e =
|
|
37
|
+
setup(j, { expose: N }) {
|
|
38
|
+
const e = j, o = m(null), i = m(null), u = m({
|
|
37
39
|
audio: 0,
|
|
38
40
|
video: 0
|
|
39
|
-
}),
|
|
41
|
+
}), 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
42
|
u.value = {
|
|
41
|
-
audio:
|
|
42
|
-
video:
|
|
43
|
+
audio: h(r).length,
|
|
44
|
+
video: g(r).length
|
|
43
45
|
};
|
|
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(
|
|
46
|
+
}, k = t(() => typeof e.srcObject?.getVideoTracks == "function"), S = t(() => u.value.video > 0), O = t(
|
|
47
|
+
() => !!(e.src || e.srcObject && (!k.value || S.value))
|
|
48
|
+
), s = t(() => y.value && O.value && !e.videoOff && !e.error), n = t(() => !!(e.srcObject && !e.muted && !e.error)), b = t(() => e.muted || n.value), T = t(() => s.value && e.src ? e.src : void 0), q = t(
|
|
49
49
|
() => e.name.split(/\s+/).filter(Boolean).slice(0, 2).map((r) => r[0]?.toUpperCase()).join("")
|
|
50
|
-
),
|
|
51
|
-
() =>
|
|
50
|
+
), M = t(() => q.value || e.name || "?"), V = t(
|
|
51
|
+
() => E({
|
|
52
52
|
"nmorph-media-tile": [
|
|
53
|
+
e.design,
|
|
54
|
+
e.aspect,
|
|
53
55
|
e.fit,
|
|
54
56
|
e.mirrored && "mirrored",
|
|
55
57
|
e.selected && "selected",
|
|
@@ -60,64 +62,76 @@ const W = /* @__PURE__ */ E({
|
|
|
60
62
|
e.loading && "loading"
|
|
61
63
|
]
|
|
62
64
|
})
|
|
63
|
-
),
|
|
65
|
+
), c = (r) => {
|
|
64
66
|
if (!r || e.sinkId === void 0) return;
|
|
65
|
-
const
|
|
66
|
-
typeof
|
|
67
|
-
});
|
|
68
|
-
}, c = (r) => {
|
|
69
|
-
!r || !e.autoplay || r.play().catch(() => {
|
|
67
|
+
const a = r;
|
|
68
|
+
typeof a.setSinkId == "function" && a.setSinkId(e.sinkId).catch(() => {
|
|
70
69
|
});
|
|
70
|
+
}, f = (r) => {
|
|
71
|
+
console.warn("[NmorphMediaTile] media autoplay failed", r);
|
|
72
|
+
}, p = (r) => {
|
|
73
|
+
if (!r || !e.autoplay) return;
|
|
74
|
+
let a;
|
|
75
|
+
try {
|
|
76
|
+
a = r.play();
|
|
77
|
+
} catch (v) {
|
|
78
|
+
f(v);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
a && typeof a.catch == "function" && a.catch(f);
|
|
71
82
|
};
|
|
72
|
-
|
|
83
|
+
I(
|
|
73
84
|
() => e.srcObject,
|
|
74
|
-
(r,
|
|
85
|
+
(r, a, v) => {
|
|
75
86
|
if (d(r), !r || typeof r.addEventListener != "function" || typeof r.removeEventListener != "function")
|
|
76
87
|
return;
|
|
77
88
|
const l = () => d(r);
|
|
78
|
-
r.addEventListener("addtrack", l), r.addEventListener("removetrack", l),
|
|
89
|
+
r.addEventListener("addtrack", l), r.addEventListener("removetrack", l), v(() => {
|
|
79
90
|
r.removeEventListener("addtrack", l), r.removeEventListener("removetrack", l);
|
|
80
91
|
});
|
|
81
92
|
},
|
|
82
93
|
{ immediate: !0 }
|
|
83
|
-
),
|
|
94
|
+
), I(
|
|
84
95
|
() => [
|
|
85
96
|
e.srcObject,
|
|
86
97
|
e.sinkId,
|
|
87
98
|
e.autoplay,
|
|
99
|
+
e.videoOff,
|
|
100
|
+
e.error,
|
|
101
|
+
s.value,
|
|
88
102
|
n.value,
|
|
89
|
-
|
|
103
|
+
b.value,
|
|
90
104
|
o.value,
|
|
91
|
-
|
|
105
|
+
i.value
|
|
92
106
|
],
|
|
93
107
|
() => {
|
|
94
108
|
if (o.value) {
|
|
95
|
-
const r =
|
|
96
|
-
o.value.srcObject !== r && (o.value.srcObject = r),
|
|
109
|
+
const r = e.srcObject;
|
|
110
|
+
o.value.srcObject !== r && (o.value.srcObject = r), c(o.value), e.autoplay && r && !e.videoOff && !e.error && p(o.value);
|
|
97
111
|
}
|
|
98
|
-
if (
|
|
99
|
-
const r =
|
|
100
|
-
|
|
112
|
+
if (i.value) {
|
|
113
|
+
const r = n.value ? e.srcObject : null;
|
|
114
|
+
i.value.srcObject !== r && (i.value.srcObject = r), c(i.value), e.autoplay && n.value && p(i.value);
|
|
101
115
|
}
|
|
102
116
|
},
|
|
103
117
|
{ immediate: !0, flush: "post" }
|
|
104
|
-
),
|
|
105
|
-
const
|
|
106
|
-
return
|
|
118
|
+
), N({ videoRef: o });
|
|
119
|
+
const B = { props: e, videoRef: o, audioRef: i, srcObjectTrackCount: u, hasMediaSource: y, getAudioTracks: h, getVideoTracks: g, updateSrcObjectTrackCount: d, canInspectVideoTracks: k, hasVideoTracks: S, hasVideoSource: O, videoVisible: s, needsSeparateAudioOutput: n, videoMuted: b, videoSrc: T, initials: q, fallbackLabel: M, modifiers: V, setMediaElementSinkId: c, logMediaPlaybackError: f, playMediaElement: p, get NmorphAvatar() {
|
|
120
|
+
return R;
|
|
107
121
|
}, get NmorphButton() {
|
|
108
122
|
return w;
|
|
109
123
|
}, get NmorphIcon() {
|
|
110
124
|
return x;
|
|
111
125
|
}, get NmorphIconLoaderDots() {
|
|
112
|
-
return
|
|
126
|
+
return D;
|
|
113
127
|
}, get NmorphIconMute() {
|
|
114
128
|
return C;
|
|
115
129
|
}, get NmorphIconShare() {
|
|
116
130
|
return A;
|
|
117
131
|
}, get NmorphIconVideoCameraOff() {
|
|
118
|
-
return
|
|
132
|
+
return L;
|
|
119
133
|
} };
|
|
120
|
-
return Object.defineProperty(
|
|
134
|
+
return Object.defineProperty(B, "__isScriptSetup", { enumerable: !1, value: !0 }), B;
|
|
121
135
|
}
|
|
122
136
|
});
|
|
123
137
|
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
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.nmorph-table{--nmorph-private-table-border-color: var(--nmorph-info-text-color);--nmorph-private-table-cell-height: auto;--nmorph-private-table-row-hover-background: var(--nmorph-info-color)}.nmorph-table .nmorph-table__header th{border-bottom:0}.nmorph-table .nmorph-table__button-wrapper{display:flex;align-items:center;margin-left:var(--indentation-03)}.nmorph-table table{width:calc(100% - 2px);margin-left:1px;border-collapse:collapse;border-spacing:0}.nmorph-table .nmorph-table__table-data{padding:var(--indentation-03) 0;border-bottom:1px solid var(--nmorph-private-table-border-color)}.nmorph-table .nmorph-table__table-data--bordered{border:1px solid var(--nmorph-private-table-border-color)}.nmorph-table .nmorph-table__cell{padding:0 var(--indentation-03)}.nmorph-table .nmorph-table__cell-content{display:flex;align-items:center}.nmorph-table .nmorph-table__cell--data{height:var(--nmorph-private-table-cell-height)}.nmorph-table .nmorph-table__body{position:relative}.nmorph-table .nmorph-table__body--virtual{overflow-x:hidden}.nmorph-table .nmorph-table__body--virtual .nmorph-table__table-data{height:var(--nmorph-private-table-virtual-row-height);padding-top:0;padding-bottom:0}.nmorph-table .nmorph-table__body--virtual.nmorph-table__body--dynamic .nmorph-table__table-data{height:auto}.nmorph-table .nmorph-table__virtual-spacer{position:relative;min-width:100%}.nmorph-table .nmorph-table__virtual-content{position:absolute;top:0;right:0;left:0}.nmorph-table .nmorph-table__table-data-row--row-hover:hover,.nmorph-table .nmorph-table__table-data-row--active{background:var(--nmorph-private-table-row-hover-background)}.nmorph-table--nmorph{overflow:hidden;background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-outset);--nmorph-private-table-border-color: transparent}.nmorph-table--nmorph .nmorph-table__button-wrapper{padding:var(--indentation-02)}.nmorph-table--nmorph .nmorph-table__table-row{background:var(--nmorph-main-color);box-shadow:var(--nmorph-shadow-inset)}.nmorph-table--plain{overflow:hidden;background:var(--nmorph-main-color);border:var(--nmorph-plain-border);border-radius:var(--default-border-radius)}
|
|
1
|
+
.nmorph-table{--nmorph-private-table-border-color: var(--nmorph-info-text-color);--nmorph-private-table-cell-height: auto;--nmorph-private-table-row-hover-background: var(--nmorph-info-color)}.nmorph-table .nmorph-table__header th{border-bottom:0}.nmorph-table .nmorph-table__button-wrapper{display:flex;align-items:center;margin-left:var(--indentation-03)}.nmorph-table table{width:calc(100% - 2px);margin-left:1px;table-layout:fixed;border-collapse:collapse;border-spacing:0}.nmorph-table .nmorph-table__table-data{padding:var(--indentation-03) 0;border-bottom:1px solid var(--nmorph-private-table-border-color)}.nmorph-table .nmorph-table__table-data--bordered{border:1px solid var(--nmorph-private-table-border-color)}.nmorph-table .nmorph-table__cell{padding:0 var(--indentation-03)}.nmorph-table .nmorph-table__cell-content{display:flex;align-items:center}.nmorph-table .nmorph-table__cell--data{height:var(--nmorph-private-table-cell-height)}.nmorph-table .nmorph-table__body{position:relative}.nmorph-table .nmorph-table__body--virtual{overflow-x:hidden}.nmorph-table .nmorph-table__body--virtual .nmorph-table__table-data{height:var(--nmorph-private-table-virtual-row-height);padding-top:0;padding-bottom:0}.nmorph-table .nmorph-table__body--virtual.nmorph-table__body--dynamic .nmorph-table__table-data{height:auto}.nmorph-table .nmorph-table__virtual-spacer{position:relative;min-width:100%}.nmorph-table .nmorph-table__virtual-content{position:absolute;top:0;right:0;left:0}.nmorph-table .nmorph-table__table-data-row--row-hover:hover,.nmorph-table .nmorph-table__table-data-row--active{background:var(--nmorph-private-table-row-hover-background)}.nmorph-table--nmorph{overflow:hidden;background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-outset);--nmorph-private-table-border-color: transparent}.nmorph-table--nmorph .nmorph-table__button-wrapper{padding:var(--indentation-02)}.nmorph-table--nmorph .nmorph-table__table-row{background:var(--nmorph-main-color);box-shadow:var(--nmorph-shadow-inset)}.nmorph-table--plain{overflow:hidden;background:var(--nmorph-main-color);border:var(--nmorph-plain-border);border-radius:var(--default-border-radius)}.nmorph-table--plain.nmorph-table--bordered{border:1px solid var(--nmorph-private-table-border-color)}.nmorph-table--plain.nmorph-table--bordered table{width:100%;margin-left:0}.nmorph-table--plain.nmorph-table--bordered .nmorph-table__table-data--bordered{border:0;border-right:1px solid var(--nmorph-private-table-border-color);border-bottom:1px solid var(--nmorph-private-table-border-color)}.nmorph-table--plain.nmorph-table--bordered .nmorph-table__table-data--bordered:last-child{border-right:0}.nmorph-table--plain.nmorph-table--bordered .nmorph-table__body:not(.nmorph-table__body--virtual) .nmorph-table__table-data-row:last-child .nmorph-table__table-data--bordered{border-bottom:0}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './NmorphTable.css';
|
|
2
2
|
import h from "./NmorphTable.vue2.js";
|
|
3
|
-
import { openBlock as r, createElementBlock as t, normalizeStyle as n, normalizeClass as _, createElementVNode as o, renderSlot as
|
|
3
|
+
import { openBlock as r, createElementBlock as t, normalizeStyle as n, normalizeClass as _, createElementVNode as o, renderSlot as m, Fragment as d, renderList as i, toDisplayString as s, createBlock as p, createCommentVNode as y } from "vue";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import v from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
6
6
|
const w = { class: "nmorph-table__wrapper" }, f = {
|
|
@@ -20,7 +20,7 @@ function H(c, N, W, e, C, I) {
|
|
|
20
20
|
[
|
|
21
21
|
o("div", w, [
|
|
22
22
|
o("div", f, [
|
|
23
|
-
|
|
23
|
+
m(c.$slots, "default")
|
|
24
24
|
]),
|
|
25
25
|
o("table", k, [
|
|
26
26
|
o("colgroup", null, [
|
|
@@ -45,7 +45,7 @@ function H(c, N, W, e, C, I) {
|
|
|
45
45
|
"th",
|
|
46
46
|
{
|
|
47
47
|
key: b,
|
|
48
|
-
class: _(["nmorph-table__table-data", { "nmorph-table__table-data--bordered": e.
|
|
48
|
+
class: _(["nmorph-table__table-data", { "nmorph-table__table-data--bordered": e.bordered }])
|
|
49
49
|
},
|
|
50
50
|
[
|
|
51
51
|
o("div", x, [
|
|
@@ -63,7 +63,7 @@ function H(c, N, W, e, C, I) {
|
|
|
63
63
|
1
|
|
64
64
|
/* TEXT */
|
|
65
65
|
),
|
|
66
|
-
e.sortData && e.sortData[l.prop] ? (r(),
|
|
66
|
+
e.sortData && e.sortData[l.prop] ? (r(), p(e.NmorphSortButton, {
|
|
67
67
|
key: 0,
|
|
68
68
|
class: "nmorph-table__button-wrapper",
|
|
69
69
|
value: e.sortData[l.prop],
|
|
@@ -154,7 +154,7 @@ function H(c, N, W, e, C, I) {
|
|
|
154
154
|
"td",
|
|
155
155
|
{
|
|
156
156
|
key: a.prop,
|
|
157
|
-
class: _([{ "nmorph-table__table-data--bordered": e.
|
|
157
|
+
class: _([{ "nmorph-table__table-data--bordered": e.bordered }, "nmorph-table__table-data"])
|
|
158
158
|
},
|
|
159
159
|
[
|
|
160
160
|
o("div", {
|
|
@@ -222,7 +222,7 @@ function H(c, N, W, e, C, I) {
|
|
|
222
222
|
"td",
|
|
223
223
|
{
|
|
224
224
|
key: a.prop,
|
|
225
|
-
class: _([{ "nmorph-table__table-data--bordered": e.
|
|
225
|
+
class: _([{ "nmorph-table__table-data--bordered": e.bordered }, "nmorph-table__table-data"])
|
|
226
226
|
},
|
|
227
227
|
[
|
|
228
228
|
o("div", {
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import './NmorphTable.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { generateUUID as
|
|
5
|
-
import { useVirtualList as
|
|
6
|
-
import
|
|
7
|
-
const
|
|
2
|
+
import { defineComponent as P, computed as l, ref as n, provide as _, watch as z, nextTick as K } from "vue";
|
|
3
|
+
import { useModifiers as Q } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { generateUUID as Y, toCssSize as $, createCssSizeVariables as F, createCssVariables as G, resolveDomElement as J } from "../../../utils/common.js";
|
|
5
|
+
import { useVirtualList as X } from "../../../hooks/use-virtual-list.js";
|
|
6
|
+
import Z from "./inner-components/nmorph-sort-button/NmorphSortButton.vue.js";
|
|
7
|
+
const ie = /* @__PURE__ */ P({
|
|
8
8
|
__name: "NmorphTable",
|
|
9
9
|
props: {
|
|
10
10
|
data: { type: Array, required: !1, default: () => [] },
|
|
11
11
|
rowHover: { type: Boolean, required: !1, default: !0 },
|
|
12
|
-
bordered: { type: Boolean, required: !1, default: !1 },
|
|
13
12
|
sort: { type: Object, required: !1, default: void 0 },
|
|
14
|
-
design: { type: null, required: !1, default: "nmorph" },
|
|
15
13
|
virtual: { type: Boolean, required: !1, default: !1 },
|
|
16
14
|
virtualHeight: { type: [Number, String], required: !1, default: "320px" },
|
|
17
15
|
virtualOverscan: { type: Number, required: !1, default: 5 },
|
|
@@ -19,22 +17,27 @@ const oe = /* @__PURE__ */ j({
|
|
|
19
17
|
virtualDynamicHeight: { type: Boolean, required: !1, default: !1 },
|
|
20
18
|
borderColor: { type: String, required: !1, default: void 0 },
|
|
21
19
|
cellHeight: { type: [Number, String], required: !1, default: void 0 },
|
|
22
|
-
rowHoverBackground: { type: String, required: !1, default: void 0 }
|
|
20
|
+
rowHoverBackground: { type: String, required: !1, default: void 0 },
|
|
21
|
+
design: { type: null, required: !1, default: "nmorph" },
|
|
22
|
+
bordered: { type: Boolean, required: !1, skipCheck: !0 }
|
|
23
23
|
},
|
|
24
|
-
setup(
|
|
25
|
-
|
|
26
|
-
const t =
|
|
27
|
-
() =>
|
|
28
|
-
"nmorph-table":
|
|
24
|
+
setup(B, { expose: T }) {
|
|
25
|
+
T();
|
|
26
|
+
const t = B, w = l(() => t.design === "plain" && t.bordered === !0), I = l(
|
|
27
|
+
() => Q({
|
|
28
|
+
"nmorph-table": {
|
|
29
|
+
[t.design]: !0,
|
|
30
|
+
bordered: w.value
|
|
31
|
+
}
|
|
29
32
|
})
|
|
30
|
-
), o = n([...t.data]), u = l(() => t.virtual),
|
|
33
|
+
), o = n([...t.data]), u = l(() => t.virtual), H = l(() => t.virtualRowHeight), S = l(() => t.virtualOverscan), C = l(() => t.virtualDynamicHeight), r = X(o, {
|
|
31
34
|
enabled: u,
|
|
32
|
-
itemHeight:
|
|
33
|
-
overscan:
|
|
34
|
-
dynamic:
|
|
35
|
-
}),
|
|
35
|
+
itemHeight: H,
|
|
36
|
+
overscan: S,
|
|
37
|
+
dynamic: C
|
|
38
|
+
}), x = l(
|
|
36
39
|
() => u.value ? r.virtualItems.value : o.value.map((e, a) => ({ item: e, index: a }))
|
|
37
|
-
),
|
|
40
|
+
), D = l(() => x.value.map((e) => e.item)), s = n(-1), p = n(0), d = n(t.sort), W = (e, a) => {
|
|
38
41
|
d.value && (d.value[a] = e, o.value.sort((g, y) => {
|
|
39
42
|
const b = String(g[a]).toLowerCase(), i = String(y[a]).toLowerCase();
|
|
40
43
|
if (!d.value)
|
|
@@ -43,15 +46,15 @@ const oe = /* @__PURE__ */ j({
|
|
|
43
46
|
return f === "ascending" ? b.localeCompare(i) : f === "descending" ? i.localeCompare(b) : 0;
|
|
44
47
|
}));
|
|
45
48
|
}, h = n(null), c = n([]);
|
|
46
|
-
|
|
47
|
-
const
|
|
49
|
+
_("table-data", { rows: D, columns: c });
|
|
50
|
+
const R = l(() => {
|
|
48
51
|
const e = c.value.map((i) => i.width).filter((i) => !!i), a = e.length, g = e.reduce((i, f) => (i += Number(f), i), 0), y = c.value.length - a;
|
|
49
52
|
return h.value?.clientWidth ? (h.value?.clientWidth - g) / y : 0;
|
|
50
|
-
}),
|
|
51
|
-
|
|
53
|
+
}), N = (e) => e || R.value, m = n(0);
|
|
54
|
+
z(
|
|
52
55
|
() => t.data,
|
|
53
56
|
async () => {
|
|
54
|
-
m.value = m.value + 1, o.value = [...t.data], c.value = [], await
|
|
57
|
+
m.value = m.value + 1, o.value = [...t.data], c.value = [], await K();
|
|
55
58
|
const e = r.containerRef.value;
|
|
56
59
|
e && (e.scrollTop = Math.min(
|
|
57
60
|
p.value,
|
|
@@ -62,38 +65,38 @@ const oe = /* @__PURE__ */ j({
|
|
|
62
65
|
immediate: !0
|
|
63
66
|
}
|
|
64
67
|
);
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
const q = l(() =>
|
|
68
|
-
...
|
|
68
|
+
const O = (e) => typeof e == "object" ? "" : e, k = Y();
|
|
69
|
+
_("table-identifier", k);
|
|
70
|
+
const q = l(() => $(t.virtualHeight)), A = l(() => ({
|
|
71
|
+
...G({
|
|
69
72
|
"--nmorph-private-table-border-color": t.borderColor,
|
|
70
73
|
"--nmorph-private-table-row-hover-background": t.rowHoverBackground
|
|
71
74
|
}),
|
|
72
|
-
|
|
75
|
+
...F({
|
|
73
76
|
"--nmorph-private-table-cell-height": t.cellHeight
|
|
74
77
|
})
|
|
75
|
-
})),
|
|
78
|
+
})), E = l(() => ({
|
|
76
79
|
"--nmorph-private-table-virtual-row-height": `${t.virtualRowHeight}px`,
|
|
77
80
|
height: u.value ? q.value : void 0,
|
|
78
81
|
overflowY: u.value ? "auto" : void 0
|
|
79
|
-
})),
|
|
80
|
-
r.measureElement(a,
|
|
81
|
-
},
|
|
82
|
+
})), L = r.spacerStyle, U = r.contentStyle, V = (e, a) => {
|
|
83
|
+
r.measureElement(a, J(e));
|
|
84
|
+
}, j = () => {
|
|
82
85
|
r.scrollHandler(), p.value = r.containerRef.value?.scrollTop || 0;
|
|
83
86
|
}, v = (e) => {
|
|
84
87
|
if (!o.value.length) return;
|
|
85
88
|
const a = s.value < 0 ? 0 : Math.min(Math.max(s.value + e, 0), o.value.length - 1);
|
|
86
89
|
s.value = a, r.scrollToIndex(a);
|
|
87
|
-
},
|
|
90
|
+
}, M = { props: t, bordered: w, modifiers: I, rows: o, virtualEnabled: u, virtualRowHeight: H, virtualOverscan: S, virtualDynamicHeight: C, virtualList: r, renderedRows: x, tableRows: D, activeRowIndex: s, lastScrollTop: p, sortData: d, onSort: W, nmorphDOMTable: h, columns: c, defaultColWidth: R, getWidth: N, key: m, tableData: O, tableIdentifier: k, virtualHeight: q, tableStyle: A, tableBodyStyle: E, virtualSpacerStyle: L, virtualContentStyle: U, setVirtualRowRef: V, scrollHandler: j, moveActiveRow: v, tableKeydownHandler: (e) => {
|
|
88
91
|
u.value && (e.key === "ArrowDown" ? (e.preventDefault(), v(1)) : e.key === "ArrowUp" ? (e.preventDefault(), v(-1)) : e.key === "Home" ? (e.preventDefault(), s.value = 0, r.scrollToIndex(0)) : e.key === "End" ? (e.preventDefault(), s.value = o.value.length - 1, r.scrollToIndex(o.value.length - 1)) : e.key === "PageDown" ? (e.preventDefault(), v(
|
|
89
92
|
Math.max(Math.floor((r.viewportHeight.value || t.virtualRowHeight) / t.virtualRowHeight), 1)
|
|
90
93
|
)) : e.key === "PageUp" && (e.preventDefault(), v(
|
|
91
94
|
-Math.max(Math.floor((r.viewportHeight.value || t.virtualRowHeight) / t.virtualRowHeight), 1)
|
|
92
95
|
)));
|
|
93
|
-
}, NmorphSortButton:
|
|
94
|
-
return Object.defineProperty(
|
|
96
|
+
}, NmorphSortButton: Z };
|
|
97
|
+
return Object.defineProperty(M, "__isScriptSetup", { enumerable: !1, value: !0 }), M;
|
|
95
98
|
}
|
|
96
99
|
});
|
|
97
100
|
export {
|
|
98
|
-
|
|
101
|
+
ie as default
|
|
99
102
|
};
|