@gitlab/ui 32.66.0 → 33.0.1
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 +42 -0
- package/dist/components/base/datepicker/datepicker.js +4 -1
- package/dist/components/base/dropdown/dropdown.js +4 -4
- package/dist/components/base/filtered_search/filtered_search.js +5 -2
- package/dist/components/base/filtered_search/filtered_search_token.js +12 -8
- package/dist/components/base/filtered_search/filtered_search_token_segment.js +6 -5
- package/dist/components/base/form/form_checkbox_tree/models/node.js +9 -8
- package/dist/components/base/form/form_checkbox_tree/models/tree.js +21 -10
- package/dist/components/base/form/form_input/form_input.js +14 -4
- package/dist/components/base/form/form_textarea/form_textarea.js +14 -4
- package/dist/components/base/infinite_scroll/infinite_scroll.documentation.js +2 -33
- package/dist/components/base/infinite_scroll/infinite_scroll.js +21 -3
- package/dist/components/base/pagination/pagination.js +2 -1
- package/dist/components/base/path/path.js +6 -5
- package/dist/components/base/segmented_control/segmented_control.js +9 -4
- package/dist/components/base/skeleton_loader/skeleton_loader.js +6 -4
- package/dist/components/base/sorting/sorting_item.js +6 -5
- package/dist/components/base/table/table.js +5 -4
- package/dist/components/base/tabs/tabs/scrollable_tabs.js +6 -5
- package/dist/components/base/toast/toast.js +2 -1
- package/dist/components/base/token_selector/token_container.js +2 -1
- package/dist/components/base/token_selector/token_selector.js +2 -1
- package/dist/components/charts/bar/bar.js +2 -1
- package/dist/components/charts/column/column.documentation.js +1 -7
- package/dist/components/charts/column/column.js +17 -14
- package/dist/components/charts/gauge/gauge.js +45 -42
- package/dist/components/charts/sparkline/sparkline.js +6 -4
- package/dist/components/charts/stacked_column/stacked_column.js +17 -14
- package/dist/components/utilities/friendly_wrap/friendly_wrap.js +4 -3
- package/dist/components/utilities/sprintf/sprintf.js +4 -2
- package/dist/directives/hover_load/hover_load.js +5 -3
- package/dist/directives/outside/outside.js +12 -8
- package/dist/directives/resize_observer/examples/resize_observer.basic.example.js +7 -6
- package/dist/directives/resize_observer/resize_observer.js +12 -8
- package/dist/directives/safe_link/safe_link.js +12 -6
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/dist/utils/charts/config.js +95 -72
- package/dist/utils/charts/story_config.js +4 -2
- package/dist/utils/charts/theme.js +106 -103
- package/dist/utils/charts/utils.js +14 -6
- package/dist/utils/number_utils.js +14 -5
- package/dist/utils/use_mock_intersection_observer.js +31 -11
- package/dist/utils/utils.js +15 -4
- package/dist/utils/validation_utils.js +3 -1
- package/documentation/documented_stories.js +2 -0
- package/package.json +14 -13
- package/scss_to_js/scss_variables.js +1 -0
- package/scss_to_js/scss_variables.json +5 -0
- package/src/components/base/infinite_scroll/infinite_scroll.documentation.js +0 -38
- package/src/components/base/infinite_scroll/infinite_scroll.md +0 -4
- package/src/components/base/infinite_scroll/infinite_scroll.stories.js +49 -24
- package/src/components/base/infinite_scroll/infinite_scroll.vue +18 -0
- package/src/components/base/search_box_by_click/search_box_by_click.scss +4 -0
- package/src/components/base/search_box_by_type/search_box_by_type.scss +4 -0
- package/src/components/charts/column/column.documentation.js +0 -5
- package/src/components/charts/column/column.stories.js +61 -88
- package/src/scss/utilities.scss +44 -26
- package/src/scss/utility-mixins/flex.scss +1 -8
- package/src/scss/utility-mixins/sizing.scss +20 -0
- package/src/scss/utility-mixins/spacing.scss +1 -7
- package/src/scss/variables.scss +1 -0
- package/dist/components/charts/column/examples/column.basic.example.js +0 -49
- package/dist/components/charts/column/examples/index.js +0 -13
- package/src/components/charts/column/column.md +0 -1
- package/src/components/charts/column/examples/column.basic.example.vue +0 -22
- package/src/components/charts/column/examples/index.js +0 -15
|
@@ -85,9 +85,10 @@ const LESS_THAN = ['<', '<'];
|
|
|
85
85
|
* @param {Object} options
|
|
86
86
|
*/
|
|
87
87
|
|
|
88
|
-
const getDataZoomConfig = ({
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
const getDataZoomConfig = function () {
|
|
89
|
+
let {
|
|
90
|
+
filterMode = 'none'
|
|
91
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
91
92
|
const disabledBreakpoints = ['lg', 'xl'];
|
|
92
93
|
const disabled = disabledBreakpoints.includes(Breakpoints.getBreakpointSize());
|
|
93
94
|
const minSpan = filterMode === 'none' ? 0.01 : null;
|
|
@@ -115,7 +116,8 @@ const getDataZoomConfig = ({
|
|
|
115
116
|
// Series can be an object for single series or
|
|
116
117
|
// an array of objects.
|
|
117
118
|
|
|
118
|
-
const mergeSeriesToOptions = (options
|
|
119
|
+
const mergeSeriesToOptions = function (options) {
|
|
120
|
+
let series = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
119
121
|
const {
|
|
120
122
|
series: optSeries = []
|
|
121
123
|
} = options;
|
|
@@ -133,11 +135,14 @@ const mergeSeriesToOptions = (options, series = []) => {
|
|
|
133
135
|
* @returns {Object} options
|
|
134
136
|
*/
|
|
135
137
|
|
|
136
|
-
const mergeAnnotationAxisToOptions = (options
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
const mergeAnnotationAxisToOptions = function (options) {
|
|
139
|
+
let hasAnnotations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
140
|
+
return { ...options,
|
|
141
|
+
...(hasAnnotations && {
|
|
142
|
+
yAxis: [options.yAxis, annotationsYAxisCoords]
|
|
143
|
+
})
|
|
144
|
+
};
|
|
145
|
+
};
|
|
141
146
|
const dataZoomAdjustments = dataZoom => {
|
|
142
147
|
// handle cases where dataZoom is array and object.
|
|
143
148
|
const useSlider = dataZoom && isArray(dataZoom) ? dataZoom.length : Boolean(dataZoom);
|
|
@@ -145,12 +150,13 @@ const dataZoomAdjustments = dataZoom => {
|
|
|
145
150
|
filterMode: 'weakFilter'
|
|
146
151
|
}) : [];
|
|
147
152
|
};
|
|
148
|
-
const getToolboxConfig = ({
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
153
|
+
const getToolboxConfig = function () {
|
|
154
|
+
let {
|
|
155
|
+
restoreIconPath = '',
|
|
156
|
+
saveImageIconPath = '',
|
|
157
|
+
zoomIconPath = '',
|
|
158
|
+
backIconPath = ''
|
|
159
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
154
160
|
const toolboxConfig = {
|
|
155
161
|
toolbox: {
|
|
156
162
|
feature: {}
|
|
@@ -199,14 +205,18 @@ const getToolboxConfig = ({
|
|
|
199
205
|
* @returns {Array}
|
|
200
206
|
*/
|
|
201
207
|
|
|
202
|
-
const generateMarkArea = ({
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
[
|
|
209
|
-
|
|
208
|
+
const generateMarkArea = function (_ref) {
|
|
209
|
+
let {
|
|
210
|
+
min,
|
|
211
|
+
max
|
|
212
|
+
} = _ref;
|
|
213
|
+
let axis = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yAxis';
|
|
214
|
+
return [{
|
|
215
|
+
[axis]: min
|
|
216
|
+
}, {
|
|
217
|
+
[axis]: max
|
|
218
|
+
}];
|
|
219
|
+
};
|
|
210
220
|
/**
|
|
211
221
|
* Generate eCharts markLine objects for thresholds and annotations.
|
|
212
222
|
*
|
|
@@ -231,10 +241,13 @@ const generateMarkArea = ({
|
|
|
231
241
|
*/
|
|
232
242
|
|
|
233
243
|
|
|
234
|
-
const generateMarkLines = ({
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
244
|
+
const generateMarkLines = function (_ref2) {
|
|
245
|
+
let {
|
|
246
|
+
min,
|
|
247
|
+
max
|
|
248
|
+
} = _ref2;
|
|
249
|
+
let axis = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yAxis';
|
|
250
|
+
|
|
238
251
|
if (min) {
|
|
239
252
|
return {
|
|
240
253
|
[axis]: min
|
|
@@ -257,10 +270,11 @@ const generateMarkLines = ({
|
|
|
257
270
|
*/
|
|
258
271
|
|
|
259
272
|
|
|
260
|
-
const generateMarkPoints =
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
273
|
+
const generateMarkPoints = _ref3 => {
|
|
274
|
+
let {
|
|
275
|
+
min,
|
|
276
|
+
tooltipData
|
|
277
|
+
} = _ref3;
|
|
264
278
|
return {
|
|
265
279
|
name: 'annotations',
|
|
266
280
|
xAxis: min,
|
|
@@ -403,7 +417,9 @@ const getAnnotationsConfig = annotations => {
|
|
|
403
417
|
* @returns {Object} Annotation series
|
|
404
418
|
*/
|
|
405
419
|
|
|
406
|
-
const generateAnnotationSeries = (annotations
|
|
420
|
+
const generateAnnotationSeries = function (annotations) {
|
|
421
|
+
let yAxisIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
422
|
+
|
|
407
423
|
if (!annotations.length) {
|
|
408
424
|
return null;
|
|
409
425
|
}
|
|
@@ -427,30 +443,33 @@ const generateAnnotationSeries = (annotations, yAxisIndex = 1) => {
|
|
|
427
443
|
* @returns {Object} Bar chart series
|
|
428
444
|
*/
|
|
429
445
|
|
|
430
|
-
const generateBarSeries =
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
borderColor: color,
|
|
446
|
-
borderWidth: 1
|
|
447
|
-
},
|
|
448
|
-
emphasis: {
|
|
446
|
+
const generateBarSeries = _ref4 => {
|
|
447
|
+
let {
|
|
448
|
+
name,
|
|
449
|
+
color,
|
|
450
|
+
data = [],
|
|
451
|
+
stack = columnOptions.stacked,
|
|
452
|
+
yAxisIndex = 0
|
|
453
|
+
} = _ref4;
|
|
454
|
+
return {
|
|
455
|
+
type: CHART_TYPE_BAR,
|
|
456
|
+
name,
|
|
457
|
+
data,
|
|
458
|
+
stack,
|
|
459
|
+
barMaxWidth: '50%',
|
|
460
|
+
yAxisIndex,
|
|
449
461
|
itemStyle: {
|
|
450
|
-
color: hexToRgba(color, 0.
|
|
462
|
+
color: hexToRgba(color, 0.2),
|
|
463
|
+
borderColor: color,
|
|
464
|
+
borderWidth: 1
|
|
465
|
+
},
|
|
466
|
+
emphasis: {
|
|
467
|
+
itemStyle: {
|
|
468
|
+
color: hexToRgba(color, 0.4)
|
|
469
|
+
}
|
|
451
470
|
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
471
|
+
};
|
|
472
|
+
};
|
|
454
473
|
/**
|
|
455
474
|
* This method generates the data series and relevant defaults for a line chart
|
|
456
475
|
*
|
|
@@ -462,23 +481,26 @@ const generateBarSeries = ({
|
|
|
462
481
|
* @returns {Object} Line chart series
|
|
463
482
|
*/
|
|
464
483
|
|
|
465
|
-
const generateLineSeries =
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
484
|
+
const generateLineSeries = _ref5 => {
|
|
485
|
+
let {
|
|
486
|
+
name,
|
|
487
|
+
color,
|
|
488
|
+
data = [],
|
|
489
|
+
yAxisIndex = 0
|
|
490
|
+
} = _ref5;
|
|
491
|
+
return {
|
|
492
|
+
name,
|
|
493
|
+
data,
|
|
494
|
+
type: CHART_TYPE_LINE,
|
|
495
|
+
yAxisIndex,
|
|
496
|
+
lineStyle: {
|
|
497
|
+
color
|
|
498
|
+
},
|
|
499
|
+
itemStyle: {
|
|
500
|
+
color
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
};
|
|
482
504
|
/**
|
|
483
505
|
* The method works well if tooltip content should be against y-axis values.
|
|
484
506
|
* However, for bar charts, the tooltip should be against x-axis values.
|
|
@@ -490,7 +512,8 @@ const generateLineSeries = ({
|
|
|
490
512
|
* @returns {Object} tooltip title and content
|
|
491
513
|
*/
|
|
492
514
|
|
|
493
|
-
const getDefaultTooltipContent = (params
|
|
515
|
+
const getDefaultTooltipContent = function (params) {
|
|
516
|
+
let yAxisTitle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
494
517
|
const seriesDataLength = params.seriesData.length;
|
|
495
518
|
const {
|
|
496
519
|
xLabels,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import times from 'lodash/times';
|
|
2
|
-
import {
|
|
2
|
+
import { SERIES_NAME, SERIES_NAME_SHORT } from '../stories_utils';
|
|
3
3
|
import { marqueeSelectionSvgPath, redoSvgPath, clearAllSvgPath, downloadSvgPath } from '../svgs/svg_paths';
|
|
4
4
|
import { colorFromDefaultPalette } from './theme';
|
|
5
5
|
|
|
@@ -27,7 +27,9 @@ const toolbox = {
|
|
|
27
27
|
* @returns {Array} generated series data
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
-
const generateSeriesData = (
|
|
30
|
+
const generateSeriesData = function () {
|
|
31
|
+
let amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
|
|
32
|
+
let nameType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SERIES_NAME_SHORT;
|
|
31
33
|
const defaultData = [820, 932, 960, 1150, 1290, 1330, 1390];
|
|
32
34
|
const name = SERIES_NAME[nameType];
|
|
33
35
|
return times(amount, index => ({
|
|
@@ -103,126 +103,129 @@ const axes = {
|
|
|
103
103
|
|
|
104
104
|
const isLineChartWithoutArea = options => Array.isArray(options === null || options === void 0 ? void 0 : options.series) && options.series.some(series => series.type === 'line' && !series.areaStyle);
|
|
105
105
|
|
|
106
|
-
const createTheme = (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
silent: true,
|
|
114
|
-
symbol: 'none',
|
|
115
|
-
label: {
|
|
116
|
-
show: false
|
|
106
|
+
const createTheme = function () {
|
|
107
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
108
|
+
return {
|
|
109
|
+
color: colorPaletteDefault,
|
|
110
|
+
backgroundColor: 'transparent',
|
|
111
|
+
textStyle: {
|
|
112
|
+
color: gray900
|
|
117
113
|
},
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
markArea: {
|
|
125
|
-
silent: true,
|
|
126
|
-
itemStyle: {
|
|
127
|
-
color: hexToRgba(red500, 0.1)
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
dataZoom: {
|
|
131
|
-
borderColor: 'transparent',
|
|
132
|
-
filterMode: 'none',
|
|
133
|
-
brushSelect: false,
|
|
134
|
-
dataBackground: {
|
|
135
|
-
lineStyle: {
|
|
136
|
-
width: 2,
|
|
137
|
-
color: gray200,
|
|
138
|
-
opacity: 1
|
|
114
|
+
markLine: {
|
|
115
|
+
silent: true,
|
|
116
|
+
symbol: 'none',
|
|
117
|
+
label: {
|
|
118
|
+
show: false
|
|
139
119
|
},
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
color: gray50,
|
|
145
|
-
opacity: 1
|
|
120
|
+
lineStyle: {
|
|
121
|
+
color: red500,
|
|
122
|
+
width: 1,
|
|
123
|
+
type: 'dashed'
|
|
146
124
|
}
|
|
147
125
|
},
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
color: gray500
|
|
153
|
-
},
|
|
154
|
-
handleSize: '50%',
|
|
155
|
-
labelFormatter: () => null,
|
|
156
|
-
textStyle: {
|
|
157
|
-
color: gray600
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
toolbox: {
|
|
161
|
-
top: '-5',
|
|
162
|
-
left: 'center',
|
|
163
|
-
itemSize: 14,
|
|
164
|
-
emphasis: {
|
|
165
|
-
iconStyle: {
|
|
166
|
-
borderWidth: 0,
|
|
167
|
-
color: gray700
|
|
126
|
+
markArea: {
|
|
127
|
+
silent: true,
|
|
128
|
+
itemStyle: {
|
|
129
|
+
color: hexToRgba(red500, 0.1)
|
|
168
130
|
}
|
|
169
131
|
},
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
132
|
+
dataZoom: {
|
|
133
|
+
borderColor: 'transparent',
|
|
134
|
+
filterMode: 'none',
|
|
135
|
+
brushSelect: false,
|
|
136
|
+
dataBackground: {
|
|
137
|
+
lineStyle: {
|
|
138
|
+
width: 2,
|
|
139
|
+
color: gray200,
|
|
140
|
+
opacity: 1
|
|
141
|
+
},
|
|
142
|
+
// render unfilled zoom-graph if the series is a line chart without area styles
|
|
143
|
+
// more details: https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/2364#note_666637306
|
|
144
|
+
areaStyle: isLineChartWithoutArea(options) ? {} // Use empty object instead of null, see https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/2185#note_707711029 for more context
|
|
145
|
+
: {
|
|
146
|
+
color: gray50,
|
|
147
|
+
opacity: 1
|
|
180
148
|
}
|
|
181
149
|
},
|
|
182
|
-
|
|
183
|
-
|
|
150
|
+
fillerColor: hexToRgba(gray200, 0.23),
|
|
151
|
+
handleIcon: scrollHandleSvgPath,
|
|
152
|
+
handleStyle: {
|
|
153
|
+
borderColor: 'transparent',
|
|
154
|
+
color: gray500
|
|
184
155
|
},
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
156
|
+
handleSize: '50%',
|
|
157
|
+
labelFormatter: () => null,
|
|
158
|
+
textStyle: {
|
|
159
|
+
color: gray600
|
|
188
160
|
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
161
|
+
},
|
|
162
|
+
toolbox: {
|
|
163
|
+
top: '-5',
|
|
164
|
+
left: 'center',
|
|
165
|
+
itemSize: 14,
|
|
166
|
+
emphasis: {
|
|
167
|
+
iconStyle: {
|
|
168
|
+
borderWidth: 0,
|
|
169
|
+
color: gray700
|
|
196
170
|
}
|
|
197
171
|
},
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
172
|
+
iconStyle: {
|
|
173
|
+
color: gray200,
|
|
174
|
+
borderWidth: 0
|
|
175
|
+
},
|
|
176
|
+
itemGap: 8,
|
|
177
|
+
feature: {
|
|
178
|
+
dataZoom: {
|
|
179
|
+
title: {
|
|
180
|
+
zoom: 'Click to zoom in on a portion of the graph',
|
|
181
|
+
back: 'Remove selection'
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
restore: {
|
|
185
|
+
title: 'Remove all selections and return chart to default state'
|
|
186
|
+
},
|
|
187
|
+
saveAsImage: {
|
|
188
|
+
title: 'Save chart as an image',
|
|
189
|
+
name: 'graph'
|
|
201
190
|
}
|
|
202
191
|
}
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
line: {
|
|
206
|
-
itemStyle: {
|
|
207
|
-
normal: {
|
|
208
|
-
borderWidth: 1
|
|
209
|
-
}
|
|
210
192
|
},
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
193
|
+
markPoint: {
|
|
194
|
+
label: {
|
|
195
|
+
normal: {
|
|
196
|
+
textStyle: {
|
|
197
|
+
color: whiteNormal
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
emphasis: {
|
|
201
|
+
textStyle: {
|
|
202
|
+
color: whiteNormal
|
|
203
|
+
}
|
|
204
|
+
}
|
|
214
205
|
}
|
|
215
206
|
},
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
207
|
+
line: {
|
|
208
|
+
itemStyle: {
|
|
209
|
+
normal: {
|
|
210
|
+
borderWidth: 1
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
lineStyle: {
|
|
214
|
+
normal: {
|
|
215
|
+
width: 2
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
symbolSize: '6',
|
|
219
|
+
symbol: 'circle',
|
|
220
|
+
showSymbol: false,
|
|
221
|
+
smooth: false
|
|
222
|
+
},
|
|
223
|
+
categoryAxis: axes,
|
|
224
|
+
valueAxis: axes,
|
|
225
|
+
logAxis: axes,
|
|
226
|
+
timeAxis: axes
|
|
227
|
+
};
|
|
228
|
+
};
|
|
226
229
|
|
|
227
230
|
export default createTheme;
|
|
228
231
|
export { colorFromDefaultPalette, colorPaletteDefault, gaugeNeutralHues, gaugeSafeHues, gaugeWarningHue, heatmapHues, themeName };
|
|
@@ -9,11 +9,14 @@ import { ANNOTATIONS_SERIES_NAME, ANNOTATIONS_COMPONENT_TYPE } from './constants
|
|
|
9
9
|
* @returns {Boolean}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const seriesHasAnnotations =
|
|
13
|
-
|
|
12
|
+
const seriesHasAnnotations = function () {
|
|
13
|
+
let series = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
14
|
+
return (series || []).filter(seriesData => {
|
|
15
|
+
var _seriesData$ANNOTATIO, _seriesData$ANNOTATIO2;
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
}).length !== 0;
|
|
17
|
+
return seriesData.name === ANNOTATIONS_SERIES_NAME && ((_seriesData$ANNOTATIO = seriesData[ANNOTATIONS_COMPONENT_TYPE]) === null || _seriesData$ANNOTATIO === void 0 ? void 0 : (_seriesData$ANNOTATIO2 = _seriesData$ANNOTATIO.data) === null || _seriesData$ANNOTATIO2 === void 0 ? void 0 : _seriesData$ANNOTATIO2.length);
|
|
18
|
+
}).length !== 0;
|
|
19
|
+
};
|
|
17
20
|
/**
|
|
18
21
|
* Check if a data point is from an annotation series.
|
|
19
22
|
*
|
|
@@ -24,7 +27,10 @@ const seriesHasAnnotations = (series = []) => (series || []).filter(seriesData =
|
|
|
24
27
|
* @returns {boolean}
|
|
25
28
|
*/
|
|
26
29
|
|
|
27
|
-
const isDataPointAnnotation = (
|
|
30
|
+
const isDataPointAnnotation = function () {
|
|
31
|
+
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
32
|
+
return params.name === ANNOTATIONS_SERIES_NAME && params.componentType === ANNOTATIONS_COMPONENT_TYPE;
|
|
33
|
+
};
|
|
28
34
|
/**
|
|
29
35
|
* Date formatter to make date strings more
|
|
30
36
|
* readable.
|
|
@@ -36,7 +42,9 @@ const isDataPointAnnotation = (params = {}) => params.name === ANNOTATIONS_SERIE
|
|
|
36
42
|
* @returns {String}
|
|
37
43
|
*/
|
|
38
44
|
|
|
39
|
-
const timeSeriesDateFormatter = (
|
|
45
|
+
const timeSeriesDateFormatter = function () {
|
|
46
|
+
let d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
47
|
+
|
|
40
48
|
if (!d) {
|
|
41
49
|
return '';
|
|
42
50
|
}
|
|
@@ -9,13 +9,21 @@ const addition = (a, b) => a + b;
|
|
|
9
9
|
* @param {...Number} numbers
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const sum = (
|
|
12
|
+
const sum = function () {
|
|
13
|
+
for (var _len = arguments.length, numbers = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
14
|
+
numbers[_key] = arguments[_key];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return numbers.reduce(addition);
|
|
18
|
+
};
|
|
13
19
|
/**
|
|
14
20
|
* Returns the average of all arguments
|
|
15
21
|
* @param {...Number} numbers
|
|
16
22
|
*/
|
|
17
23
|
|
|
18
|
-
const average =
|
|
24
|
+
const average = function () {
|
|
25
|
+
return sum(...arguments) / arguments.length;
|
|
26
|
+
};
|
|
19
27
|
/**
|
|
20
28
|
* Convert number to engineering format, using SI suffix
|
|
21
29
|
* @param {Number|String} value - Number or Number-convertible String
|
|
@@ -23,7 +31,8 @@ const average = (...numbers) => sum(...numbers) / numbers.length;
|
|
|
23
31
|
* @return {String} number, possibly with a suffix
|
|
24
32
|
*/
|
|
25
33
|
|
|
26
|
-
const engineeringNotation = (value
|
|
34
|
+
const engineeringNotation = function (value) {
|
|
35
|
+
let precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
27
36
|
const invalidValues = [NaN, Infinity, -Infinity];
|
|
28
37
|
const num = Number(value);
|
|
29
38
|
|
|
@@ -58,8 +67,8 @@ const engineeringNotation = (value, precision = 2) => {
|
|
|
58
67
|
}
|
|
59
68
|
|
|
60
69
|
const scaledPower = 3 * Math.floor(power / 3);
|
|
61
|
-
const scaledMantissa = (exponentialNotation / 10 ** scaledPower
|
|
62
|
-
toFixed(precision) // strip trailing 0s after a decimal point
|
|
70
|
+
const scaledMantissa = (exponentialNotation / 10 ** scaledPower // strip trailing decimals from floating point rounding errors
|
|
71
|
+
).toFixed(precision) // strip trailing 0s after a decimal point
|
|
63
72
|
.replace(/\.([1-9]*)0+$/, (_, fractionalDigits) => {
|
|
64
73
|
if (fractionalDigits) {
|
|
65
74
|
return `.${fractionalDigits}`;
|
|
@@ -16,7 +16,8 @@ class MockObserver {
|
|
|
16
16
|
this.$_observers = [];
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
observe(node
|
|
19
|
+
observe(node) {
|
|
20
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
20
21
|
this.$_observers.push([node, options]);
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -27,10 +28,11 @@ class MockObserver {
|
|
|
27
28
|
takeRecords() {} // eslint-disable-next-line babel/camelcase
|
|
28
29
|
|
|
29
30
|
|
|
30
|
-
$_triggerObserve(nodeParam
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
$_triggerObserve(nodeParam) {
|
|
32
|
+
let {
|
|
33
|
+
entry = {},
|
|
34
|
+
options = {}
|
|
35
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
34
36
|
const nodes = this.$_getNodesFromParam(nodeParam);
|
|
35
37
|
nodes.forEach(node => {
|
|
36
38
|
if (this.$_hasObserver(node, options)) {
|
|
@@ -43,13 +45,20 @@ class MockObserver {
|
|
|
43
45
|
} // eslint-disable-next-line babel/camelcase
|
|
44
46
|
|
|
45
47
|
|
|
46
|
-
$_hasObserver(node
|
|
47
|
-
|
|
48
|
+
$_hasObserver(node) {
|
|
49
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
50
|
+
return this.$_observers.some(_ref => {
|
|
51
|
+
let [obvNode, obvOptions] = _ref;
|
|
52
|
+
return node === obvNode && _isMatch(options, obvOptions);
|
|
53
|
+
});
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
$_getNodesFromParam(nodeParam) {
|
|
51
57
|
if (!nodeParam) {
|
|
52
|
-
return this.$_observers.map(
|
|
58
|
+
return this.$_observers.map(_ref2 => {
|
|
59
|
+
let [node] = _ref2;
|
|
60
|
+
return node;
|
|
61
|
+
});
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
if (!_isArray(nodeParam)) {
|
|
@@ -63,7 +72,10 @@ class MockObserver {
|
|
|
63
72
|
|
|
64
73
|
class MockIntersectionObserver extends MockObserver {
|
|
65
74
|
unobserve(node) {
|
|
66
|
-
this.$_observers = this.$_observers.filter(
|
|
75
|
+
this.$_observers = this.$_observers.filter(_ref3 => {
|
|
76
|
+
let [obvNode] = _ref3;
|
|
77
|
+
return node !== obvNode;
|
|
78
|
+
});
|
|
67
79
|
}
|
|
68
80
|
|
|
69
81
|
}
|
|
@@ -74,7 +86,11 @@ const useMockIntersectionObserver = () => {
|
|
|
74
86
|
beforeEach(() => {
|
|
75
87
|
instances = [];
|
|
76
88
|
origObserver = global.IntersectionObserver;
|
|
77
|
-
global.IntersectionObserver = jest.fn().mockImplementation((
|
|
89
|
+
global.IntersectionObserver = jest.fn().mockImplementation(function () {
|
|
90
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
91
|
+
args[_key] = arguments[_key];
|
|
92
|
+
}
|
|
93
|
+
|
|
78
94
|
const mockObserver = new MockIntersectionObserver(...args);
|
|
79
95
|
instances.push(mockObserver);
|
|
80
96
|
return mockObserver;
|
|
@@ -85,7 +101,11 @@ const useMockIntersectionObserver = () => {
|
|
|
85
101
|
global.IntersectionObserver = origObserver;
|
|
86
102
|
});
|
|
87
103
|
|
|
88
|
-
const trigger = (observer
|
|
104
|
+
const trigger = function (observer) {
|
|
105
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
106
|
+
args[_key2 - 1] = arguments[_key2];
|
|
107
|
+
}
|
|
108
|
+
|
|
89
109
|
observer.$_triggerObserve(...args);
|
|
90
110
|
};
|
|
91
111
|
|