@gitlab/ui 52.9.2 → 52.10.0
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/CHANGELOG.md +14 -0
- package/dist/components/charts/sparkline/sparkline.js +29 -12
- package/package.json +4 -4
- package/src/components/charts/sparkline/sparkline.spec.js +25 -0
- package/src/components/charts/sparkline/sparkline.stories.js +9 -0
- package/src/components/charts/sparkline/sparkline.vue +28 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [52.10.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v52.9.3...v52.10.0) (2023-01-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **GlSparklineChart:** Add smooth prop ([f28d852](https://gitlab.com/gitlab-org/gitlab-ui/commit/f28d8527e170afd0077b191eaff307be551dfdc0))
|
|
7
|
+
|
|
8
|
+
## [52.9.3](https://gitlab.com/gitlab-org/gitlab-ui/compare/v52.9.2...v52.9.3) (2023-01-10)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency dompurify to ^2.4.3 ([0899f93](https://gitlab.com/gitlab-org/gitlab-ui/commit/0899f936c7044f380be4a1fdf72f663f599ce799))
|
|
14
|
+
|
|
1
15
|
## [52.9.2](https://gitlab.com/gitlab-org/gitlab-ui/compare/v52.9.1...v52.9.2) (2023-01-09)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -66,6 +66,15 @@ var script = {
|
|
|
66
66
|
type: Array,
|
|
67
67
|
required: false,
|
|
68
68
|
default: () => []
|
|
69
|
+
},
|
|
70
|
+
/**
|
|
71
|
+
* The smoothness of the line, valued from 0 to 1. A smaller value makes it less smooth.
|
|
72
|
+
*/
|
|
73
|
+
smooth: {
|
|
74
|
+
type: Number,
|
|
75
|
+
required: false,
|
|
76
|
+
default: 0,
|
|
77
|
+
validator: x => x >= 0 && x <= 1
|
|
69
78
|
}
|
|
70
79
|
},
|
|
71
80
|
data() {
|
|
@@ -116,8 +125,21 @@ var script = {
|
|
|
116
125
|
},
|
|
117
126
|
series() {
|
|
118
127
|
const {
|
|
119
|
-
data
|
|
128
|
+
data,
|
|
129
|
+
smooth,
|
|
130
|
+
itemStyle,
|
|
131
|
+
showLastYValue
|
|
120
132
|
} = this;
|
|
133
|
+
const markPoint = showLastYValue ? {
|
|
134
|
+
symbol: 'circle',
|
|
135
|
+
cursor: 'auto',
|
|
136
|
+
animation: false,
|
|
137
|
+
symbolSize,
|
|
138
|
+
data: [{
|
|
139
|
+
xAxis: data.length - 1,
|
|
140
|
+
yAxis: data[data.length - 1][1]
|
|
141
|
+
}]
|
|
142
|
+
} : undefined;
|
|
121
143
|
return {
|
|
122
144
|
type: 'line',
|
|
123
145
|
symbol: 'circle',
|
|
@@ -125,18 +147,13 @@ var script = {
|
|
|
125
147
|
animation: true,
|
|
126
148
|
cursor: 'auto',
|
|
127
149
|
symbolSize,
|
|
128
|
-
markPoint
|
|
129
|
-
symbol: 'circle',
|
|
130
|
-
cursor: 'auto',
|
|
131
|
-
animation: false,
|
|
132
|
-
symbolSize,
|
|
133
|
-
data: [{
|
|
134
|
-
xAxis: data.length - 1,
|
|
135
|
-
yAxis: data[data.length - 1][1]
|
|
136
|
-
}]
|
|
137
|
-
},
|
|
150
|
+
markPoint,
|
|
138
151
|
data,
|
|
139
|
-
|
|
152
|
+
smooth,
|
|
153
|
+
itemStyle,
|
|
154
|
+
lineStyle: {
|
|
155
|
+
cap: 'round'
|
|
156
|
+
}
|
|
140
157
|
};
|
|
141
158
|
},
|
|
142
159
|
itemStyle() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "52.
|
|
3
|
+
"version": "52.10.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@popperjs/core": "^2.11.2",
|
|
64
64
|
"bootstrap-vue": "2.20.1",
|
|
65
|
-
"dompurify": "^2.4.
|
|
65
|
+
"dompurify": "^2.4.3",
|
|
66
66
|
"echarts": "^5.3.2",
|
|
67
67
|
"iframe-resizer": "^4.3.2",
|
|
68
68
|
"lodash": "^4.17.20",
|
|
@@ -82,12 +82,12 @@
|
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@arkweid/lefthook": "0.7.7",
|
|
85
|
-
"@babel/core": "^7.20.
|
|
85
|
+
"@babel/core": "^7.20.12",
|
|
86
86
|
"@babel/preset-env": "^7.20.2",
|
|
87
87
|
"@gitlab/eslint-plugin": "18.1.0",
|
|
88
88
|
"@gitlab/fonts": "^1.0.1",
|
|
89
89
|
"@gitlab/stylelint-config": "4.1.0",
|
|
90
|
-
"@gitlab/svgs": "3.
|
|
90
|
+
"@gitlab/svgs": "3.15.0",
|
|
91
91
|
"@rollup/plugin-commonjs": "^11.1.0",
|
|
92
92
|
"@rollup/plugin-node-resolve": "^7.1.3",
|
|
93
93
|
"@rollup/plugin-replace": "^2.3.2",
|
|
@@ -63,6 +63,8 @@ describe('sparkline chart component', () => {
|
|
|
63
63
|
return formatter;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
+
const validateSmooth = (smooth) => SparklineChart.props.smooth.validator(smooth);
|
|
67
|
+
|
|
66
68
|
const emitChartCreated = () => getChart().vm.$emit('created', mockChartInstance);
|
|
67
69
|
|
|
68
70
|
beforeEach(() => {
|
|
@@ -178,6 +180,7 @@ describe('sparkline chart component', () => {
|
|
|
178
180
|
|
|
179
181
|
await wrapper.vm.$nextTick();
|
|
180
182
|
expect(getLastYValue().exists()).toBe(false);
|
|
183
|
+
expect(getChartOptions().series[0].markPoint).toBe(undefined);
|
|
181
184
|
});
|
|
182
185
|
|
|
183
186
|
it('gradient will set the series itemStyle color', async () => {
|
|
@@ -187,4 +190,26 @@ describe('sparkline chart component', () => {
|
|
|
187
190
|
|
|
188
191
|
expect(getChartOptions().series[0].itemStyle.color).toBeDefined();
|
|
189
192
|
});
|
|
193
|
+
|
|
194
|
+
describe('smooth', () => {
|
|
195
|
+
it.each`
|
|
196
|
+
value | expected
|
|
197
|
+
${-1} | ${false}
|
|
198
|
+
${0} | ${true}
|
|
199
|
+
${0.5} | ${true}
|
|
200
|
+
${1} | ${true}
|
|
201
|
+
${1.1} | ${false}
|
|
202
|
+
`(`validate $value`, ({ value, expected }) => {
|
|
203
|
+
expect(validateSmooth(value)).toBe(expected);
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
it('sets the series smoothing', async () => {
|
|
207
|
+
const smooth = 0.75;
|
|
208
|
+
wrapper.setProps({ smooth });
|
|
209
|
+
|
|
210
|
+
await wrapper.vm.$nextTick();
|
|
211
|
+
|
|
212
|
+
expect(getChartOptions().series[0].smooth).toBe(smooth);
|
|
213
|
+
});
|
|
214
|
+
});
|
|
190
215
|
});
|
|
@@ -24,12 +24,14 @@ const generateProps = ({
|
|
|
24
24
|
tooltipLabel = 'tooltipLabel',
|
|
25
25
|
showLastYValue = true,
|
|
26
26
|
gradient,
|
|
27
|
+
smooth,
|
|
27
28
|
} = {}) => ({
|
|
28
29
|
data,
|
|
29
30
|
height,
|
|
30
31
|
tooltipLabel,
|
|
31
32
|
showLastYValue,
|
|
32
33
|
gradient,
|
|
34
|
+
smooth,
|
|
33
35
|
});
|
|
34
36
|
|
|
35
37
|
const Template = (args) => ({
|
|
@@ -43,6 +45,7 @@ const Template = (args) => ({
|
|
|
43
45
|
:tooltip-label="tooltipLabel"
|
|
44
46
|
:show-last-y-value="showLastYValue"
|
|
45
47
|
:gradient="gradient"
|
|
48
|
+
:smooth="smooth"
|
|
46
49
|
/>
|
|
47
50
|
</div>`,
|
|
48
51
|
});
|
|
@@ -50,9 +53,15 @@ const Template = (args) => ({
|
|
|
50
53
|
export const Default = Template.bind({});
|
|
51
54
|
Default.args = generateProps();
|
|
52
55
|
|
|
56
|
+
export const WithoutLastYValue = Template.bind({});
|
|
57
|
+
WithoutLastYValue.args = generateProps({ showLastYValue: false });
|
|
58
|
+
|
|
53
59
|
export const WithChartColorGradient = Template.bind({});
|
|
54
60
|
WithChartColorGradient.args = generateProps({ gradient: customGradient });
|
|
55
61
|
|
|
62
|
+
export const WithSmoothing = Template.bind({});
|
|
63
|
+
WithSmoothing.args = generateProps({ smooth: 0.5 });
|
|
64
|
+
|
|
56
65
|
export default {
|
|
57
66
|
title: 'charts/sparkline-chart',
|
|
58
67
|
component: GlSparklineChart,
|
|
@@ -72,6 +72,15 @@ export default {
|
|
|
72
72
|
required: false,
|
|
73
73
|
default: () => [],
|
|
74
74
|
},
|
|
75
|
+
/**
|
|
76
|
+
* The smoothness of the line, valued from 0 to 1. A smaller value makes it less smooth.
|
|
77
|
+
*/
|
|
78
|
+
smooth: {
|
|
79
|
+
type: Number,
|
|
80
|
+
required: false,
|
|
81
|
+
default: 0,
|
|
82
|
+
validator: (x) => x >= 0 && x <= 1,
|
|
83
|
+
},
|
|
75
84
|
},
|
|
76
85
|
data() {
|
|
77
86
|
return {
|
|
@@ -120,7 +129,21 @@ export default {
|
|
|
120
129
|
return mergeSeriesToOptions(mergedOptions, this.series);
|
|
121
130
|
},
|
|
122
131
|
series() {
|
|
123
|
-
const { data } = this;
|
|
132
|
+
const { data, smooth, itemStyle, showLastYValue } = this;
|
|
133
|
+
const markPoint = showLastYValue
|
|
134
|
+
? {
|
|
135
|
+
symbol: 'circle',
|
|
136
|
+
cursor: 'auto',
|
|
137
|
+
animation: false,
|
|
138
|
+
symbolSize,
|
|
139
|
+
data: [
|
|
140
|
+
{
|
|
141
|
+
xAxis: data.length - 1,
|
|
142
|
+
yAxis: data[data.length - 1][1],
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
}
|
|
146
|
+
: undefined;
|
|
124
147
|
return {
|
|
125
148
|
type: 'line',
|
|
126
149
|
symbol: 'circle',
|
|
@@ -128,20 +151,11 @@ export default {
|
|
|
128
151
|
animation: true,
|
|
129
152
|
cursor: 'auto',
|
|
130
153
|
symbolSize,
|
|
131
|
-
markPoint
|
|
132
|
-
symbol: 'circle',
|
|
133
|
-
cursor: 'auto',
|
|
134
|
-
animation: false,
|
|
135
|
-
symbolSize,
|
|
136
|
-
data: [
|
|
137
|
-
{
|
|
138
|
-
xAxis: data.length - 1,
|
|
139
|
-
yAxis: data[data.length - 1][1],
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
},
|
|
154
|
+
markPoint,
|
|
143
155
|
data,
|
|
144
|
-
|
|
156
|
+
smooth,
|
|
157
|
+
itemStyle,
|
|
158
|
+
lineStyle: { cap: 'round' },
|
|
145
159
|
};
|
|
146
160
|
},
|
|
147
161
|
itemStyle() {
|