@gitlab/ui 32.30.0 → 32.34.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 +28 -0
- package/dist/components/base/icon/icon.js +2 -19
- package/dist/components/base/toggle/toggle.js +8 -8
- package/dist/components/charts/area/area.js +3 -0
- package/dist/components/charts/bar/bar.js +2 -2
- package/dist/components/charts/chart/chart.js +20 -21
- package/dist/components/charts/legend/legend.js +1 -1
- package/dist/components/charts/tooltip/tooltip.js +1 -1
- package/dist/components/utilities/truncate/truncate.documentation.js +3 -0
- package/dist/components/utilities/truncate/truncate.js +34 -2
- package/dist/directives/resize_observer/resize_observer.documentation.js +1 -1
- package/dist/directives/resize_observer/resize_observer.js +43 -23
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/utils/charts/config.js +4 -3
- package/dist/utils/charts/mock_data.js +6 -3
- package/dist/utils/charts/theme.js +15 -9
- package/package.json +3 -3
- package/scss_to_js/scss_variables.js +0 -1
- package/scss_to_js/scss_variables.json +0 -5
- package/src/components/base/icon/icon.scss +1 -1
- package/src/components/base/icon/icon.spec.js +4 -24
- package/src/components/base/icon/icon.vue +1 -16
- package/src/components/base/toggle/toggle.spec.js +1 -3
- package/src/components/base/toggle/toggle.vue +7 -8
- package/src/components/charts/area/area.vue +3 -0
- package/src/components/charts/bar/__snapshots__/bar.spec.js.snap +2 -2
- package/src/components/charts/bar/bar.vue +2 -2
- package/src/components/charts/chart/chart.spec.js +3 -1
- package/src/components/charts/chart/chart.vue +22 -20
- package/src/components/charts/column/__snapshots__/column_chart.spec.js.snap +6 -6
- package/src/components/charts/legend/legend.vue +1 -1
- package/src/components/charts/stacked_column/__snapshots__/stacked_column.spec.js.snap +26 -26
- package/src/components/charts/tooltip/tooltip.vue +1 -1
- package/src/components/utilities/truncate/truncate.documentation.js +3 -0
- package/src/components/utilities/truncate/truncate.spec.js +8 -0
- package/src/components/utilities/truncate/truncate.stories.js +6 -2
- package/src/components/utilities/truncate/truncate.vue +57 -7
- package/src/directives/resize_observer/resize_observer.js +34 -19
- package/src/directives/resize_observer/resize_observer.md +20 -0
- package/src/directives/resize_observer/resize_observer.spec.js +33 -1
- package/src/scss/variables.scss +0 -5
- package/src/utils/charts/config.js +3 -2
- package/src/utils/charts/mock_data.js +5 -2
- package/src/utils/charts/theme.js +14 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
# [32.34.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.33.0...v32.34.0) (2021-11-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **echarts:** update to echarts@5 ([c257e58](https://gitlab.com/gitlab-org/gitlab-ui/commit/c257e58e2dfadac7f4ba515f630272ea0a4039e7))
|
|
7
|
+
|
|
8
|
+
# [32.33.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.32.0...v32.33.0) (2021-11-04)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **GlTruncate:** show full text in a tooltip ([168c532](https://gitlab.com/gitlab-org/gitlab-ui/commit/168c5325c1fab5174cfa5ad092d829ad11c85363))
|
|
14
|
+
|
|
15
|
+
# [32.32.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.31.0...v32.32.0) (2021-11-03)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **GlIcon:** remove support for deprecated icons sizes ([5ea2461](https://gitlab.com/gitlab-org/gitlab-ui/commit/5ea2461cfc1d3e2fd5f5c7f51f5e351e6b79ce5d))
|
|
21
|
+
|
|
22
|
+
# [32.31.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.30.0...v32.31.0) (2021-11-02)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **GlToggle:** Use uniqueId for toggle labels ([2ba11fb](https://gitlab.com/gitlab-org/gitlab-ui/commit/2ba11fbd5023233e4581507f24660a9ffa874f86))
|
|
28
|
+
|
|
1
29
|
# [32.30.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.29.2...v32.30.0) (2021-11-01)
|
|
2
30
|
|
|
3
31
|
|
|
@@ -63,17 +63,8 @@ var script = {
|
|
|
63
63
|
size: {
|
|
64
64
|
type: Number,
|
|
65
65
|
required: false,
|
|
66
|
-
default: 16
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Is used to deprecate 10&18 icon sizes iteratively.
|
|
71
|
-
* More info here https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1232
|
|
72
|
-
*/
|
|
73
|
-
useDeprecatedSizes: {
|
|
74
|
-
type: Boolean,
|
|
75
|
-
required: false,
|
|
76
|
-
default: false
|
|
66
|
+
default: 16,
|
|
67
|
+
validator: value => iconSizeOptions.includes(value)
|
|
77
68
|
}
|
|
78
69
|
},
|
|
79
70
|
computed: {
|
|
@@ -85,15 +76,7 @@ var script = {
|
|
|
85
76
|
return this.size ? `s${this.size}` : '';
|
|
86
77
|
}
|
|
87
78
|
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
created() {
|
|
91
|
-
if (!iconSizeOptions.includes(this.size) && !this.useDeprecatedSizes) {
|
|
92
|
-
// eslint-disable-next-line no-console
|
|
93
|
-
console.warn(`[gitlab-ui] Unexpected value '${this.size}' was provided for the icon size`);
|
|
94
|
-
}
|
|
95
79
|
}
|
|
96
|
-
|
|
97
80
|
};
|
|
98
81
|
|
|
99
82
|
/* script */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _uniqueId from 'lodash/uniqueId';
|
|
1
2
|
import { toggleLabelPosition } from '../../../utils/constants';
|
|
2
3
|
import GlIcon from '../icon/icon';
|
|
3
4
|
import GlLoadingIcon from '../loading_icon/loading_icon';
|
|
@@ -65,14 +66,6 @@ var script = {
|
|
|
65
66
|
default: undefined
|
|
66
67
|
},
|
|
67
68
|
|
|
68
|
-
/**
|
|
69
|
-
* The id for the label. This id is used by the aria-labelledby attribute on the toggle button.
|
|
70
|
-
*/
|
|
71
|
-
labelId: {
|
|
72
|
-
type: String,
|
|
73
|
-
required: true
|
|
74
|
-
},
|
|
75
|
-
|
|
76
69
|
/**
|
|
77
70
|
* The label's position relative to the toggle. If 'hidden', the toggle will add the .gl-sr-only class so the label is still accessible to screen readers.
|
|
78
71
|
*/
|
|
@@ -87,6 +80,13 @@ var script = {
|
|
|
87
80
|
|
|
88
81
|
}
|
|
89
82
|
},
|
|
83
|
+
|
|
84
|
+
data() {
|
|
85
|
+
return {
|
|
86
|
+
labelId: _uniqueId('toggle-label-')
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
|
|
90
90
|
computed: {
|
|
91
91
|
icon() {
|
|
92
92
|
return this.value ? 'mobile-issue-close' : 'close';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import echarts from 'echarts';
|
|
2
|
-
import { validRenderers, defaultHeight } from '../../../utils/charts/config';
|
|
1
|
+
import * as echarts from 'echarts';
|
|
2
|
+
import { validRenderers, defaultWidth, defaultHeight } from '../../../utils/charts/config';
|
|
3
3
|
import createTheme, { themeName } from '../../../utils/charts/theme';
|
|
4
4
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
5
5
|
|
|
@@ -76,28 +76,27 @@ var script = {
|
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
|
|
79
|
-
mounted() {
|
|
80
|
-
|
|
81
|
-
this.$
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
async mounted() {
|
|
80
|
+
await this.$nextTick();
|
|
81
|
+
this.chart = echarts.init(this.$refs.chart, this.disableTheme ? null : themeName, {
|
|
82
|
+
renderer: this.renderer,
|
|
83
|
+
width: defaultWidth,
|
|
84
|
+
height: defaultHeight
|
|
85
|
+
});
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
if (this.groupId.length) {
|
|
88
|
+
this.chart.group = this.groupId;
|
|
89
|
+
echarts.connect(this.groupId);
|
|
90
|
+
}
|
|
90
91
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
this.chart.on('click', this.clickHandler);
|
|
93
|
+
/**
|
|
94
|
+
* Emitted after calling `echarts.init`
|
|
95
|
+
*/
|
|
95
96
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
});
|
|
100
|
-
/* eslint-enable */
|
|
97
|
+
this.$emit('created', this.chart);
|
|
98
|
+
this.draw();
|
|
99
|
+
this.setChartSize();
|
|
101
100
|
},
|
|
102
101
|
|
|
103
102
|
beforeDestroy() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import echarts from 'echarts';
|
|
1
|
+
import * as echarts from 'echarts';
|
|
2
2
|
import { defaultFontSize } from '../../../utils/charts/config';
|
|
3
3
|
import { LEGEND_AVERAGE_TEXT, LEGEND_CURRENT_TEXT, LEGEND_MIN_TEXT, LEGEND_MAX_TEXT, LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE } from '../../../utils/charts/constants';
|
|
4
4
|
import { engineeringNotation, average } from '../../../utils/number_utils';
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { GlTooltipDirective } from '../../../directives/tooltip';
|
|
2
|
+
import { GlResizeObserverDirective } from '../../../directives/resize_observer/resize_observer';
|
|
1
3
|
import { POSITION } from './constants';
|
|
2
4
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
3
5
|
|
|
4
6
|
var script = {
|
|
7
|
+
POSITION,
|
|
8
|
+
directives: {
|
|
9
|
+
GlTooltip: GlTooltipDirective,
|
|
10
|
+
GlResizeObserver: GlResizeObserverDirective
|
|
11
|
+
},
|
|
5
12
|
props: {
|
|
6
13
|
text: {
|
|
7
14
|
type: String,
|
|
@@ -12,12 +19,17 @@ var script = {
|
|
|
12
19
|
required: false,
|
|
13
20
|
default: POSITION.END,
|
|
14
21
|
validator: value => Object.values(POSITION).includes(value)
|
|
22
|
+
},
|
|
23
|
+
withTooltip: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
required: false,
|
|
26
|
+
default: false
|
|
15
27
|
}
|
|
16
28
|
},
|
|
17
29
|
|
|
18
30
|
data() {
|
|
19
31
|
return {
|
|
20
|
-
|
|
32
|
+
isTruncated: false
|
|
21
33
|
};
|
|
22
34
|
},
|
|
23
35
|
|
|
@@ -32,6 +44,26 @@ var script = {
|
|
|
32
44
|
|
|
33
45
|
last() {
|
|
34
46
|
return this.text.slice(this.middleIndex);
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
isTooltipDisabled() {
|
|
50
|
+
return !this.withTooltip || !this.isTruncated;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
},
|
|
54
|
+
watch: {
|
|
55
|
+
withTooltip(withTooltip) {
|
|
56
|
+
if (withTooltip) {
|
|
57
|
+
this.checkTruncationState();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
},
|
|
62
|
+
methods: {
|
|
63
|
+
checkTruncationState() {
|
|
64
|
+
if (this.withTooltip) {
|
|
65
|
+
this.isTruncated = this.$refs.text.scrollWidth > this.$refs.text.offsetWidth;
|
|
66
|
+
}
|
|
35
67
|
}
|
|
36
68
|
|
|
37
69
|
}
|
|
@@ -41,7 +73,7 @@ var script = {
|
|
|
41
73
|
const __vue_script__ = script;
|
|
42
74
|
|
|
43
75
|
/* template */
|
|
44
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.position === _vm.POSITION.START)?_c('span',{staticClass:"gl-truncate",attrs:{"title":_vm.text}},[_c('span',{staticClass:"gl-truncate-start gl-text-overflow-ellipsis!"},[_vm._v(""+_vm._s(_vm.text)+"")])]):(_vm.position === _vm.POSITION.MIDDLE)?_c('span',{staticClass:"gl-truncate",attrs:{"title":_vm.text}},[_c('span',{staticClass:"gl-truncate-end"},[_vm._v(_vm._s(_vm.first))]),_c('span',{staticClass:"gl-truncate-start"},[_vm._v(""+_vm._s(_vm.last)+"")])]):_c('span',{staticClass:"gl-truncate",attrs:{"title":_vm.text}},[_c('span',{staticClass:"gl-truncate-end"},[_vm._v(_vm._s(_vm.text))])])};
|
|
76
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.position === _vm.$options.POSITION.START)?_c('span',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip",value:({ disabled: _vm.isTooltipDisabled }),expression:"{ disabled: isTooltipDisabled }"},{name:"gl-resize-observer",rawName:"v-gl-resize-observer:[withTooltip]",value:(_vm.checkTruncationState),expression:"checkTruncationState",arg:_vm.withTooltip}],staticClass:"gl-truncate",attrs:{"title":_vm.text}},[_c('span',{ref:"text",staticClass:"gl-truncate-start gl-text-overflow-ellipsis!"},[_vm._v(""+_vm._s(_vm.text)+"")])]):(_vm.position === _vm.$options.POSITION.MIDDLE)?_c('span',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip",value:({ disabled: _vm.isTooltipDisabled }),expression:"{ disabled: isTooltipDisabled }"},{name:"gl-resize-observer",rawName:"v-gl-resize-observer:[withTooltip]",value:(_vm.checkTruncationState),expression:"checkTruncationState",arg:_vm.withTooltip}],staticClass:"gl-truncate",attrs:{"title":_vm.text}},[_c('span',{ref:"text",staticClass:"gl-truncate-end"},[_vm._v(_vm._s(_vm.first))]),_c('span',{staticClass:"gl-truncate-start"},[_vm._v(""+_vm._s(_vm.last)+"")])]):_c('span',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip",value:({ disabled: _vm.isTooltipDisabled }),expression:"{ disabled: isTooltipDisabled }"},{name:"gl-resize-observer",rawName:"v-gl-resize-observer:[withTooltip]",value:(_vm.checkTruncationState),expression:"checkTruncationState",arg:_vm.withTooltip}],staticClass:"gl-truncate",attrs:{"data-testid":"truncate-end-container","title":_vm.text}},[_c('span',{ref:"text",staticClass:"gl-truncate-end"},[_vm._v(_vm._s(_vm.text))])])};
|
|
45
77
|
var __vue_staticRenderFns__ = [];
|
|
46
78
|
|
|
47
79
|
/* style */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import examples from './examples';
|
|
2
2
|
|
|
3
|
-
var description = "# Resize Observer\n\n<!-- STORY -->\n\n## Usage\n\nThis directive can be used to get notified whenever a given element's size (width or height) changes\nand to retrieve the updated dimensions.\n\nUnder the hood, it leverages the [Resize Observer API](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver).\nIf you use GitLab UI in an older browser which doesn't support the Resize Observer API,\nyou can use a [polyfill](https://github.com/que-etc/resize-observer-polyfill).\n\nThe directive accepts a callback as a value and passes on the received\n[contentRect](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/contentRect)\nand the target element whenever a resize event gets triggered.\n\n```html\n<script>\nexport default {\n data() {\n return {\n width: 0,\n height: 0,\n };\n },\n methods: {\n handleResize({ contentRect: { width, height } }) {\n this.width = width;\n this.height = height;\n },\n },\n};\n</script>\n<template>\n <div v-gl-resize-observer-directive=\"handleResize\">\n <p>{{ width }} x {{ height }}</p>\n </div>\n</template>\n```\n";
|
|
3
|
+
var description = "# Resize Observer\n\n<!-- STORY -->\n\n## Usage\n\nThis directive can be used to get notified whenever a given element's size (width or height) changes\nand to retrieve the updated dimensions.\n\nUnder the hood, it leverages the [Resize Observer API](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver).\nIf you use GitLab UI in an older browser which doesn't support the Resize Observer API,\nyou can use a [polyfill](https://github.com/que-etc/resize-observer-polyfill).\n\nThe directive accepts a callback as a value and passes on the received\n[contentRect](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/contentRect)\nand the target element whenever a resize event gets triggered.\n\n```html\n<script>\nexport default {\n data() {\n return {\n width: 0,\n height: 0,\n };\n },\n methods: {\n handleResize({ contentRect: { width, height } }) {\n this.width = width;\n this.height = height;\n },\n },\n};\n</script>\n<template>\n <div v-gl-resize-observer-directive=\"handleResize\">\n <p>{{ width }} x {{ height }}</p>\n </div>\n</template>\n```\n\nThe observer can be toggled on or off by passing a boolean argument to the directive:\n\n```html\n<script>\nexport default {\n data() {\n return {\n shouldObserve: true,\n };\n },\n methods: {\n handleResize() {},\n },\n};\n</script>\n<template>\n <div v-gl-resize-observer-directive[shouldObserve]=\"handleResize\"></div>\n</template>\n```\n";
|
|
4
4
|
|
|
5
5
|
var resize_observer_documentation = {
|
|
6
6
|
followsDesignSystem: false,
|
|
@@ -1,37 +1,57 @@
|
|
|
1
1
|
import isFunction from 'lodash/isFunction';
|
|
2
2
|
|
|
3
3
|
let observer = null;
|
|
4
|
+
|
|
5
|
+
const attachObserver = (el, resizeHandler) => {
|
|
6
|
+
if (!isFunction(resizeHandler)) {
|
|
7
|
+
throw TypeError('directive value must be a function');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (!observer) {
|
|
11
|
+
// the observer instance is shared for performance reasons
|
|
12
|
+
// more information: https://github.com/WICG/ResizeObserver/issues/59
|
|
13
|
+
observer = new ResizeObserver(entries => {
|
|
14
|
+
entries.forEach(event => {
|
|
15
|
+
event.target.glResizeHandler(event);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
el.glResizeHandler = resizeHandler;
|
|
21
|
+
observer.observe(el);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const detachObserver = el => {
|
|
25
|
+
if (el.glResizeHandler) {
|
|
26
|
+
var _observer;
|
|
27
|
+
|
|
28
|
+
delete el.glResizeHandler;
|
|
29
|
+
(_observer = observer) === null || _observer === void 0 ? void 0 : _observer.unobserve(el);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
4
33
|
const GlResizeObserverDirective = {
|
|
5
34
|
bind(el, {
|
|
6
|
-
value: resizeHandler
|
|
35
|
+
value: resizeHandler,
|
|
36
|
+
arg: enabled = true
|
|
7
37
|
}) {
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (!observer) {
|
|
13
|
-
// the observer instance is shared for performance reasons
|
|
14
|
-
// more information: https://github.com/WICG/ResizeObserver/issues/59
|
|
15
|
-
observer = new ResizeObserver(entries => {
|
|
16
|
-
entries.forEach(event => {
|
|
17
|
-
event.target.glResizeHandler(event);
|
|
18
|
-
});
|
|
19
|
-
});
|
|
38
|
+
if (enabled) {
|
|
39
|
+
attachObserver(el, resizeHandler);
|
|
20
40
|
}
|
|
21
|
-
|
|
22
|
-
el.glResizeHandler = resizeHandler;
|
|
23
|
-
observer.observe(el);
|
|
24
41
|
},
|
|
25
42
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
(
|
|
43
|
+
update(el, {
|
|
44
|
+
value: resizeHandler,
|
|
45
|
+
arg: enabled = true
|
|
46
|
+
}) {
|
|
47
|
+
if (enabled) {
|
|
48
|
+
attachObserver(el, resizeHandler);
|
|
49
|
+
} else {
|
|
50
|
+
detachObserver(el);
|
|
32
51
|
}
|
|
33
|
-
}
|
|
52
|
+
},
|
|
34
53
|
|
|
54
|
+
unbind: detachObserver
|
|
35
55
|
};
|
|
36
56
|
|
|
37
57
|
export { GlResizeObserverDirective };
|