@gitlab/ui 32.32.0 → 32.35.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/filtered_search/filtered_search_suggestion_list.js +7 -2
- 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/utility_classes.css +1 -1
- package/dist/utility_classes.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/src/components/base/filtered_search/filtered_search_suggestion_list.spec.js +15 -8
- package/src/components/base/filtered_search/filtered_search_suggestion_list.vue +11 -2
- 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/utilities.scss +12 -0
- package/src/scss/utility-mixins/sizing.scss +6 -0
- 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.35.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.34.1...v32.35.0) (2021-11-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **CSS:** Add `gl-lg-w-1px` utility class ([c74d9c9](https://gitlab.com/gitlab-org/gitlab-ui/commit/c74d9c98a1d34029e5c1858922827aead5a5baf6))
|
|
7
|
+
|
|
8
|
+
## [32.34.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.34.0...v32.34.1) (2021-11-08)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **FilteredSearch:** Remove case sensitivity ([6e3c271](https://gitlab.com/gitlab-org/gitlab-ui/commit/6e3c271cefb3f44893fb6b684c59ec73e3b6f7e5))
|
|
14
|
+
|
|
15
|
+
# [32.34.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.33.0...v32.34.0) (2021-11-05)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **echarts:** update to echarts@5 ([c257e58](https://gitlab.com/gitlab-org/gitlab-ui/commit/c257e58e2dfadac7f4ba515f630272ea0a4039e7))
|
|
21
|
+
|
|
22
|
+
# [32.33.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.32.0...v32.33.0) (2021-11-04)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **GlTruncate:** show full text in a tooltip ([168c532](https://gitlab.com/gitlab-org/gitlab-ui/commit/168c5325c1fab5174cfa5ad092d829ad11c85363))
|
|
28
|
+
|
|
1
29
|
# [32.32.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.31.0...v32.32.0) (2021-11-03)
|
|
2
30
|
|
|
3
31
|
|
|
@@ -36,15 +36,20 @@ var script = {
|
|
|
36
36
|
},
|
|
37
37
|
watch: {
|
|
38
38
|
initialValue(newValue) {
|
|
39
|
-
this.activeIdx = this.registeredItems.findIndex(item => item.value
|
|
39
|
+
this.activeIdx = this.registeredItems.findIndex(item => this.valuesMatch(item.value, newValue));
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
},
|
|
43
43
|
methods: {
|
|
44
|
+
valuesMatch(firstValue, secondValue) {
|
|
45
|
+
if (!firstValue || !secondValue) return false;
|
|
46
|
+
return typeof firstValue === 'string' ? firstValue.toLowerCase() === secondValue.toLowerCase() : firstValue === secondValue;
|
|
47
|
+
},
|
|
48
|
+
|
|
44
49
|
register(item) {
|
|
45
50
|
this.registeredItems.push(item);
|
|
46
51
|
|
|
47
|
-
if (item.value
|
|
52
|
+
if (this.valuesMatch(item.value, this.initialValue)) {
|
|
48
53
|
this.activeIdx = this.registeredItems.length - 1;
|
|
49
54
|
}
|
|
50
55
|
},
|
|
@@ -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 };
|