@nethserver/ns8-ui-lib 0.0.32 → 0.0.36
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/ns8-ui-lib.esm.js +283 -86
- package/dist/ns8-ui-lib.min.js +1 -1
- package/dist/ns8-ui-lib.ssr.js +252 -90
- package/package.json +1 -1
- package/src/lib-components/NsCircleTimer.vue +109 -0
- package/src/lib-components/NsDangerDeleteModal.vue +2 -0
- package/src/lib-components/NsInfoCard.vue +9 -1
- package/src/lib-components/NsInlineNotification.vue +21 -1
package/package.json
CHANGED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="base-timer" :style="{ height: size + 'px', width: size + 'px' }">
|
|
3
|
+
<svg
|
|
4
|
+
class="base-timer__svg"
|
|
5
|
+
viewBox="0 0 100 100"
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
>
|
|
8
|
+
<g class="base-timer__circle">
|
|
9
|
+
<path
|
|
10
|
+
id="base-timer-path-remaining"
|
|
11
|
+
stroke-dasharray="251"
|
|
12
|
+
class="base-timer__path-remaining green"
|
|
13
|
+
d="
|
|
14
|
+
M 50, 50
|
|
15
|
+
m -40, 0
|
|
16
|
+
a 40,40 0 1,0 80,0
|
|
17
|
+
a 40,40 0 1,0 -80,0
|
|
18
|
+
"
|
|
19
|
+
:style="{
|
|
20
|
+
'stroke-width': strokeWidth + 'px',
|
|
21
|
+
'stroke-dasharray': circleDasharray,
|
|
22
|
+
color: color,
|
|
23
|
+
}"
|
|
24
|
+
></path>
|
|
25
|
+
</g>
|
|
26
|
+
</svg>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
export default {
|
|
32
|
+
name: "NsCircleTimer",
|
|
33
|
+
props: {
|
|
34
|
+
timeLimit: {
|
|
35
|
+
type: Number, // milliseconds
|
|
36
|
+
required: true,
|
|
37
|
+
},
|
|
38
|
+
size: {
|
|
39
|
+
type: Number,
|
|
40
|
+
default: 16,
|
|
41
|
+
},
|
|
42
|
+
strokeWidth: {
|
|
43
|
+
type: Number,
|
|
44
|
+
default: 20,
|
|
45
|
+
},
|
|
46
|
+
color: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: "#00a2de",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
data() {
|
|
52
|
+
return {
|
|
53
|
+
timerInterval: null,
|
|
54
|
+
timePassed: 0,
|
|
55
|
+
timeLeft: -1,
|
|
56
|
+
// length = 2πr = 2 * π * 40 = 251
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
computed: {
|
|
60
|
+
circleDasharray() {
|
|
61
|
+
return `${(this.calculateTimeFraction() * 251).toFixed(0)} 251`;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
created() {
|
|
65
|
+
this.timeLimitSeconds = (this.timeLimit - 1000) / 1000;
|
|
66
|
+
this.timeLeft = this.timeLimitSeconds;
|
|
67
|
+
|
|
68
|
+
this.timerInterval = setInterval(() => {
|
|
69
|
+
this.timePassed += 1;
|
|
70
|
+
this.timeLeft = this.timeLimitSeconds - this.timePassed;
|
|
71
|
+
}, 1000);
|
|
72
|
+
},
|
|
73
|
+
beforeDestroy() {
|
|
74
|
+
clearInterval(this.timerInterval);
|
|
75
|
+
},
|
|
76
|
+
methods: {
|
|
77
|
+
calculateTimeFraction() {
|
|
78
|
+
return this.timeLeft / this.timeLimitSeconds;
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<style scoped lang="scss">
|
|
85
|
+
.base-timer {
|
|
86
|
+
position: relative;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.base-timer__circle {
|
|
90
|
+
fill: none;
|
|
91
|
+
stroke: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.base-timer__path-remaining {
|
|
95
|
+
stroke: currentColor;
|
|
96
|
+
|
|
97
|
+
/* animation starts at the top of the circle */
|
|
98
|
+
transform: rotate(90deg);
|
|
99
|
+
transform-origin: center;
|
|
100
|
+
|
|
101
|
+
/* one second aligns with the speed of the countdown timer */
|
|
102
|
+
transition: 1s linear all;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.base-timer__svg {
|
|
106
|
+
/* flips the svg and makes the animation to move left-to-right */
|
|
107
|
+
transform: scaleX(-1);
|
|
108
|
+
}
|
|
109
|
+
</style>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<cv-tile kind="standard" :light="light" class="info-card">
|
|
3
|
+
<!-- overflow menu -->
|
|
4
|
+
<slot v-if="showOverflowMenu" name="menu"></slot>
|
|
3
5
|
<!-- icon -->
|
|
4
6
|
<div v-if="icon" class="row">
|
|
5
7
|
<NsSvg :svg="icon" />
|
|
@@ -12,7 +14,7 @@
|
|
|
12
14
|
</div>
|
|
13
15
|
<div class="row slot">
|
|
14
16
|
<!-- Extra content -->
|
|
15
|
-
<slot></slot>
|
|
17
|
+
<slot name="content"></slot>
|
|
16
18
|
</div>
|
|
17
19
|
</cv-tile>
|
|
18
20
|
</template>
|
|
@@ -41,6 +43,10 @@ export default {
|
|
|
41
43
|
return val.render !== null;
|
|
42
44
|
},
|
|
43
45
|
},
|
|
46
|
+
showOverflowMenu: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false,
|
|
49
|
+
},
|
|
44
50
|
light: Boolean,
|
|
45
51
|
},
|
|
46
52
|
};
|
|
@@ -52,6 +58,8 @@ export default {
|
|
|
52
58
|
flex-direction: column;
|
|
53
59
|
justify-content: center;
|
|
54
60
|
min-height: 7rem;
|
|
61
|
+
// needed for abosulute positioning of overflow menu
|
|
62
|
+
position: relative;
|
|
55
63
|
}
|
|
56
64
|
|
|
57
65
|
.row {
|
|
@@ -27,11 +27,19 @@
|
|
|
27
27
|
v-if="description"
|
|
28
28
|
:class="[
|
|
29
29
|
`${carbonPrefix}--inline-notification__subtitle`,
|
|
30
|
-
{ 'mg-right': loading },
|
|
30
|
+
{ 'mg-right': loading || timer },
|
|
31
31
|
]"
|
|
32
32
|
v-html="description"
|
|
33
33
|
></p>
|
|
34
34
|
<p v-if="loading" class="loader"></p>
|
|
35
|
+
<p v-if="timer">
|
|
36
|
+
<NsCircleTimer
|
|
37
|
+
:timeLimit="timer"
|
|
38
|
+
:size="16"
|
|
39
|
+
:strokeWidth="20"
|
|
40
|
+
color="white"
|
|
41
|
+
/>
|
|
42
|
+
</p>
|
|
35
43
|
</div>
|
|
36
44
|
</div>
|
|
37
45
|
<button
|
|
@@ -62,10 +70,12 @@
|
|
|
62
70
|
|
|
63
71
|
<script>
|
|
64
72
|
import { CvInlineNotification } from "@carbon/vue";
|
|
73
|
+
import NsCircleTimer from "./NsCircleTimer.vue";
|
|
65
74
|
|
|
66
75
|
export default {
|
|
67
76
|
name: "NsInlineNotification",
|
|
68
77
|
extends: CvInlineNotification,
|
|
78
|
+
components: { NsCircleTimer },
|
|
69
79
|
props: {
|
|
70
80
|
showCloseButton: {
|
|
71
81
|
type: Boolean,
|
|
@@ -84,6 +94,9 @@ export default {
|
|
|
84
94
|
type: Boolean,
|
|
85
95
|
default: false,
|
|
86
96
|
},
|
|
97
|
+
timer: {
|
|
98
|
+
type: Number,
|
|
99
|
+
},
|
|
87
100
|
},
|
|
88
101
|
};
|
|
89
102
|
</script>
|
|
@@ -92,6 +105,8 @@ export default {
|
|
|
92
105
|
.title {
|
|
93
106
|
margin-right: 0.75rem;
|
|
94
107
|
margin-bottom: 0.2rem;
|
|
108
|
+
font-size: 0.875rem !important;
|
|
109
|
+
font-weight: 600 !important;
|
|
95
110
|
}
|
|
96
111
|
|
|
97
112
|
.mg-right {
|
|
@@ -107,4 +122,9 @@ export default {
|
|
|
107
122
|
.bx--inline-notification__close-button {
|
|
108
123
|
position: absolute !important;
|
|
109
124
|
}
|
|
125
|
+
|
|
126
|
+
.bx--inline-notification__text-wrapper p {
|
|
127
|
+
// needed for inline notifications inside modal
|
|
128
|
+
padding-right: 0 !important;
|
|
129
|
+
}
|
|
110
130
|
</style>
|