@nethserver/ns8-ui-lib 0.0.88 → 0.0.91
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 +370 -425
- package/dist/ns8-ui-lib.min.js +1 -1
- package/dist/ns8-ui-lib.ssr.js +348 -403
- package/package.json +1 -1
- package/src/lib-components/NsMeterChart.vue +36 -57
- package/src/lib-components/NsProgressBar.vue +68 -24
- package/src/lib-components/NsTextInput.vue +1 -0
- package/src/lib-components/NsPieChart.vue +0 -51
package/package.json
CHANGED
|
@@ -1,68 +1,47 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<div>
|
|
3
|
+
<div class="mg-bottom-sm">
|
|
4
|
+
<span class="label">{{ label }}</span>
|
|
5
|
+
<span>{{
|
|
6
|
+
loading || Number.isNaN(Number(value)) ? "-" : value + "%"
|
|
7
|
+
}}</span>
|
|
8
|
+
</div>
|
|
9
|
+
<NsProgressBar
|
|
10
|
+
:value="value"
|
|
11
|
+
:indeterminate="loading"
|
|
12
|
+
:useStatusColors="true"
|
|
13
|
+
:warningThreshold="warningThreshold"
|
|
14
|
+
:dangerThreshold="dangerThreshold"
|
|
15
|
+
:height="progressBarHeight"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
3
18
|
</template>
|
|
4
19
|
|
|
5
20
|
<script>
|
|
6
|
-
import
|
|
7
|
-
import "@carbon/charts/styles.css";
|
|
8
|
-
import chartsVue from "@carbon/charts-vue";
|
|
9
|
-
import { CcvMeterChart } from "@carbon/charts-vue";
|
|
10
|
-
|
|
11
|
-
Vue.use(chartsVue);
|
|
21
|
+
import NsProgressBar from "./NsProgressBar.vue";
|
|
12
22
|
|
|
13
23
|
export default {
|
|
14
24
|
name: "NsMeterChart",
|
|
15
|
-
components: {
|
|
25
|
+
components: { NsProgressBar },
|
|
16
26
|
props: {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
data() {
|
|
25
|
-
return {
|
|
26
|
-
data: [],
|
|
27
|
-
options: {},
|
|
28
|
-
};
|
|
29
|
-
},
|
|
30
|
-
watch: {
|
|
31
|
-
value: function() {
|
|
32
|
-
this.data[0].value = this.value;
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
created() {
|
|
36
|
-
this.data = [
|
|
37
|
-
{
|
|
38
|
-
group: this.label,
|
|
39
|
-
value: this.value,
|
|
40
|
-
},
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
this.options = {
|
|
44
|
-
title: this.title,
|
|
45
|
-
meter: {
|
|
46
|
-
peak: null,
|
|
47
|
-
status: {
|
|
48
|
-
ranges: [
|
|
49
|
-
{
|
|
50
|
-
range: [0, this.warningTh],
|
|
51
|
-
status: "success",
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
range: [this.warningTh, this.dangerTh],
|
|
55
|
-
status: "warning",
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
range: [this.dangerTh, 100],
|
|
59
|
-
status: "danger",
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
height: this.height,
|
|
65
|
-
};
|
|
27
|
+
label: { type: String, required: true },
|
|
28
|
+
value: { type: [String, Number], default: 0 },
|
|
29
|
+
loading: { type: Boolean, default: false },
|
|
30
|
+
progressBarHeight: { type: String, default: "10px" },
|
|
31
|
+
// default value of following props is defined in NsProgressBar
|
|
32
|
+
warningThreshold: { type: Number, default: undefined },
|
|
33
|
+
dangerThreshold: { type: Number, default: undefined },
|
|
66
34
|
},
|
|
67
35
|
};
|
|
68
36
|
</script>
|
|
37
|
+
|
|
38
|
+
<style scoped lang="scss">
|
|
39
|
+
.label {
|
|
40
|
+
font-weight: bold;
|
|
41
|
+
margin-right: 0.5rem;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.mg-bottom-sm {
|
|
45
|
+
margin-bottom: 0.5rem !important;
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
@@ -1,15 +1,35 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- indeterminate -->
|
|
3
|
-
<div class="progress-bar-container">
|
|
4
|
-
<div class="slider">
|
|
3
|
+
<div class="progress-bar-container" :style="heightStyle">
|
|
4
|
+
<div class="slider" :style="heightStyle">
|
|
5
5
|
<template v-if="indeterminate">
|
|
6
|
-
<div class="indeterminate-line"></div>
|
|
7
|
-
<div class="indeterminate-subline inc"></div>
|
|
8
|
-
<div class="indeterminate-subline dec"></div>
|
|
6
|
+
<div class="indeterminate-line" :style="heightStyle"></div>
|
|
7
|
+
<div class="indeterminate-subline inc" :style="heightStyle"></div>
|
|
8
|
+
<div class="indeterminate-subline dec" :style="heightStyle"></div>
|
|
9
9
|
</template>
|
|
10
10
|
<template v-else>
|
|
11
|
-
<div
|
|
12
|
-
|
|
11
|
+
<div
|
|
12
|
+
:class="[
|
|
13
|
+
'line',
|
|
14
|
+
{
|
|
15
|
+
healthy: healthyStatus,
|
|
16
|
+
warning: warningStatus,
|
|
17
|
+
danger: dangerStatus,
|
|
18
|
+
},
|
|
19
|
+
]"
|
|
20
|
+
:style="heightStyle"
|
|
21
|
+
></div>
|
|
22
|
+
<div
|
|
23
|
+
:class="[
|
|
24
|
+
'progress-line',
|
|
25
|
+
{
|
|
26
|
+
healthy: healthyStatus,
|
|
27
|
+
warning: warningStatus,
|
|
28
|
+
danger: dangerStatus,
|
|
29
|
+
},
|
|
30
|
+
]"
|
|
31
|
+
:style="progressLineStyle"
|
|
32
|
+
></div>
|
|
13
33
|
</template>
|
|
14
34
|
</div>
|
|
15
35
|
</div>
|
|
@@ -21,25 +41,58 @@ export default {
|
|
|
21
41
|
props: {
|
|
22
42
|
value: {
|
|
23
43
|
// a number between 0 and 100
|
|
24
|
-
type: Number,
|
|
44
|
+
type: [String, Number],
|
|
25
45
|
default: 0,
|
|
26
46
|
},
|
|
27
47
|
indeterminate: {
|
|
28
48
|
type: Boolean,
|
|
29
49
|
default: false,
|
|
30
50
|
},
|
|
51
|
+
height: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: "5px",
|
|
54
|
+
},
|
|
55
|
+
warningThreshold: { type: Number, default: 70 },
|
|
56
|
+
dangerThreshold: { type: Number, default: 90 },
|
|
57
|
+
useStatusColors: { type: Boolean, default: false },
|
|
31
58
|
},
|
|
32
59
|
data() {
|
|
33
60
|
return {
|
|
34
|
-
|
|
35
|
-
width: this.
|
|
61
|
+
progressLineStyle: {
|
|
62
|
+
width: this.numericValue + "%",
|
|
36
63
|
transition: "width 0.3s",
|
|
64
|
+
height: this.height,
|
|
65
|
+
},
|
|
66
|
+
heightStyle: {
|
|
67
|
+
height: this.height,
|
|
37
68
|
},
|
|
38
69
|
};
|
|
39
70
|
},
|
|
71
|
+
created() {
|
|
72
|
+
this.progressLineStyle.width = this.numericValue + "%";
|
|
73
|
+
this.heightStyle.height = this.height;
|
|
74
|
+
},
|
|
75
|
+
computed: {
|
|
76
|
+
numericValue() {
|
|
77
|
+
return Number(this.value) || 0;
|
|
78
|
+
},
|
|
79
|
+
healthyStatus() {
|
|
80
|
+
return this.useStatusColors && this.numericValue < this.warningThreshold;
|
|
81
|
+
},
|
|
82
|
+
warningStatus() {
|
|
83
|
+
return (
|
|
84
|
+
this.useStatusColors &&
|
|
85
|
+
this.numericValue >= this.warningThreshold &&
|
|
86
|
+
this.numericValue < this.dangerThreshold
|
|
87
|
+
);
|
|
88
|
+
},
|
|
89
|
+
dangerStatus() {
|
|
90
|
+
return this.useStatusColors && this.numericValue >= this.dangerThreshold;
|
|
91
|
+
},
|
|
92
|
+
},
|
|
40
93
|
watch: {
|
|
41
94
|
value: function () {
|
|
42
|
-
this.
|
|
95
|
+
this.progressLineStyle.width = this.numericValue + "%";
|
|
43
96
|
},
|
|
44
97
|
},
|
|
45
98
|
};
|
|
@@ -54,40 +107,31 @@ export default {
|
|
|
54
107
|
.slider {
|
|
55
108
|
position: absolute;
|
|
56
109
|
width: 100%;
|
|
57
|
-
height: 5px;
|
|
58
110
|
overflow-x: hidden;
|
|
59
111
|
}
|
|
60
112
|
|
|
61
113
|
.line {
|
|
62
114
|
position: absolute;
|
|
63
115
|
opacity: 0.4;
|
|
64
|
-
//
|
|
65
|
-
// background: $interactive-01;
|
|
116
|
+
// branding color CSS rules are inside core: _core.scss
|
|
66
117
|
width: 100%;
|
|
67
|
-
height: 5px;
|
|
68
118
|
}
|
|
69
119
|
|
|
70
120
|
.progress-line {
|
|
71
121
|
position: absolute;
|
|
72
|
-
//
|
|
73
|
-
// background: $interactive-01;
|
|
74
|
-
height: 5px;
|
|
122
|
+
// branding color CSS rules are inside core: _core.scss
|
|
75
123
|
}
|
|
76
124
|
|
|
77
125
|
.indeterminate-line {
|
|
78
126
|
position: absolute;
|
|
79
127
|
opacity: 0.4;
|
|
80
|
-
//
|
|
81
|
-
// background: $interactive-01;
|
|
128
|
+
// branding color CSS rules are inside core: _core.scss
|
|
82
129
|
width: 150%;
|
|
83
|
-
height: 5px;
|
|
84
130
|
}
|
|
85
131
|
|
|
86
132
|
.indeterminate-subline {
|
|
87
133
|
position: absolute;
|
|
88
|
-
//
|
|
89
|
-
// background: $interactive-01;
|
|
90
|
-
height: 5px;
|
|
134
|
+
// branding color CSS rules are inside core: _core.scss
|
|
91
135
|
}
|
|
92
136
|
.inc {
|
|
93
137
|
animation: increase 2s infinite;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ccv-pie-chart :data="data" :options="options"></ccv-pie-chart>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
import Vue from "vue";
|
|
7
|
-
import "@carbon/charts/styles.css";
|
|
8
|
-
import chartsVue from "@carbon/charts-vue";
|
|
9
|
-
|
|
10
|
-
Vue.use(chartsVue);
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
name: "NsPieChart",
|
|
14
|
-
components: {},
|
|
15
|
-
props: {
|
|
16
|
-
data: Array,
|
|
17
|
-
loading: { type: Boolean, default: false },
|
|
18
|
-
title: { type: String, default: "" },
|
|
19
|
-
height: { type: String, default: "18rem" },
|
|
20
|
-
},
|
|
21
|
-
data() {
|
|
22
|
-
return {
|
|
23
|
-
options: {},
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
watch: {
|
|
27
|
-
loading: function() {
|
|
28
|
-
if (this.loading) {
|
|
29
|
-
// show skeleton
|
|
30
|
-
this.options.data.loading = true;
|
|
31
|
-
} else {
|
|
32
|
-
this.options.data.loading = false;
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
created() {
|
|
37
|
-
this.options = {
|
|
38
|
-
title: this.title,
|
|
39
|
-
resizable: true,
|
|
40
|
-
// legend: { ////
|
|
41
|
-
// alignment: "center",
|
|
42
|
-
// },
|
|
43
|
-
// pie: {
|
|
44
|
-
// alignment: "center",
|
|
45
|
-
// },
|
|
46
|
-
data: { loading: this.loading },
|
|
47
|
-
height: this.height,
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
</script>
|