@gitlab/ui 63.1.3 → 63.2.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 +14 -0
- package/dist/components/charts/area/area.js +8 -5
- package/dist/components/utilities/truncate_text/constants.js +7 -0
- package/dist/components/utilities/truncate_text/truncate_text.js +136 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -0
- package/package.json +5 -4
- package/src/components/charts/area/area.vue +5 -5
- package/src/components/regions/empty_state/empty_state.stories.js +1 -1
- package/src/components/utilities/truncate_text/constants.js +5 -0
- package/src/components/utilities/truncate_text/truncate_text.md +26 -0
- package/src/components/utilities/truncate_text/truncate_text.scss +14 -0
- package/src/components/utilities/truncate_text/truncate_text.spec.js +136 -0
- package/src/components/utilities/truncate_text/truncate_text.stories.js +43 -0
- package/src/components/utilities/truncate_text/truncate_text.vue +110 -0
- package/src/index.js +1 -0
- package/src/scss/components.scss +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [63.2.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v63.2.0...v63.2.1) (2023-05-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **GlAreaChart:** Replace the getDom to getZr for supporting edge ([2a5bef8](https://gitlab.com/gitlab-org/gitlab-ui/commit/2a5bef897dcd54422cb1163e497461558a8f06ac))
|
|
7
|
+
|
|
8
|
+
# [63.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v63.1.3...v63.2.0) (2023-05-23)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* Add TruncateText component ([5539662](https://gitlab.com/gitlab-org/gitlab-ui/commit/553966208df8fc23736080619b68f73a56e41a48))
|
|
14
|
+
|
|
1
15
|
## [63.1.3](https://gitlab.com/gitlab-org/gitlab-ui/compare/v63.1.2...v63.1.3) (2023-05-22)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -218,8 +218,8 @@ var script = {
|
|
|
218
218
|
}
|
|
219
219
|
},
|
|
220
220
|
beforeDestroy() {
|
|
221
|
-
this.chart.
|
|
222
|
-
this.chart.
|
|
221
|
+
this.chart.getZr().off('mousemove', this.debouncedShowHideTooltip);
|
|
222
|
+
this.chart.getZr().off('mouseout', this.debouncedShowHideTooltip);
|
|
223
223
|
this.chart.off('mouseout', this.hideAnnotationsTooltip);
|
|
224
224
|
this.chart.off('mouseover', this.onChartMouseOver);
|
|
225
225
|
},
|
|
@@ -244,8 +244,8 @@ var script = {
|
|
|
244
244
|
// when the mouse is hovered over the parent container
|
|
245
245
|
// of echarts' svg element. This works only for data points
|
|
246
246
|
// and not markPoints.
|
|
247
|
-
chart.
|
|
248
|
-
chart.
|
|
247
|
+
chart.getZr().on('mousemove', this.debouncedShowHideTooltip);
|
|
248
|
+
chart.getZr().on('mouseout', this.debouncedShowHideTooltip);
|
|
249
249
|
|
|
250
250
|
// eCharts inbuild mouse events
|
|
251
251
|
// https://echarts.apache.org/en/api.html#events.Mouse%20events
|
|
@@ -264,7 +264,10 @@ var script = {
|
|
|
264
264
|
this.chart = chart;
|
|
265
265
|
this.$emit('created', chart);
|
|
266
266
|
},
|
|
267
|
-
showHideTooltip(
|
|
267
|
+
showHideTooltip(_ref) {
|
|
268
|
+
let {
|
|
269
|
+
event: mouseEvent
|
|
270
|
+
} = _ref;
|
|
268
271
|
this.showDataTooltip = this.chart.containPixel('grid', [mouseEvent.zrX, mouseEvent.zrY]);
|
|
269
272
|
this.dataTooltipPosition = {
|
|
270
273
|
left: `${mouseEvent.zrX + DATA_TOOLTIP_LEFT_OFFSET}px`,
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { GlResizeObserverDirective } from '../../../directives/resize_observer/resize_observer';
|
|
2
|
+
import GlButton from '../../base/button/button';
|
|
3
|
+
import { STATES } from './constants';
|
|
4
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
5
|
+
|
|
6
|
+
var script = {
|
|
7
|
+
name: 'GlTruncateText',
|
|
8
|
+
components: {
|
|
9
|
+
GlButton
|
|
10
|
+
},
|
|
11
|
+
directives: {
|
|
12
|
+
GlResizeObserver: GlResizeObserverDirective
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
/**
|
|
16
|
+
* The text for the 'Show more' button
|
|
17
|
+
*/
|
|
18
|
+
showMoreText: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: false,
|
|
21
|
+
default: 'Show more'
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* The text for the 'Show less' button
|
|
25
|
+
*/
|
|
26
|
+
showLessText: {
|
|
27
|
+
type: String,
|
|
28
|
+
required: false,
|
|
29
|
+
default: 'Show less'
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* The number of lines that are initially visible on larger screens
|
|
33
|
+
*/
|
|
34
|
+
lines: {
|
|
35
|
+
type: Number,
|
|
36
|
+
required: false,
|
|
37
|
+
default: 3
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* The number of lines that are initially visible on smaller screens
|
|
41
|
+
*/
|
|
42
|
+
mobileLines: {
|
|
43
|
+
type: Number,
|
|
44
|
+
required: false,
|
|
45
|
+
default: 10
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
data() {
|
|
49
|
+
return {
|
|
50
|
+
state: STATES.INITIAL
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
computed: {
|
|
54
|
+
showTruncationToggle() {
|
|
55
|
+
return this.isTruncated || this.isExtended;
|
|
56
|
+
},
|
|
57
|
+
truncationToggleText() {
|
|
58
|
+
return this.isTruncated ? this.showMoreText : this.showLessText;
|
|
59
|
+
},
|
|
60
|
+
cssVariables() {
|
|
61
|
+
return {
|
|
62
|
+
'--lines': this.lines,
|
|
63
|
+
'--mobile-lines': this.mobileLines
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
truncationClasses() {
|
|
67
|
+
return this.isExtended ? null : 'gl-truncate-text gl-overflow-hidden';
|
|
68
|
+
},
|
|
69
|
+
ariaExpanded() {
|
|
70
|
+
return (!this.isTruncated).toString();
|
|
71
|
+
},
|
|
72
|
+
isTruncated() {
|
|
73
|
+
return this.state === STATES.TRUNCATED;
|
|
74
|
+
},
|
|
75
|
+
isExtended() {
|
|
76
|
+
return this.state === STATES.EXTENDED;
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
methods: {
|
|
80
|
+
onResize(_ref) {
|
|
81
|
+
let {
|
|
82
|
+
target
|
|
83
|
+
} = _ref;
|
|
84
|
+
if (target.scrollHeight > target.offsetHeight) {
|
|
85
|
+
this.state = STATES.TRUNCATED;
|
|
86
|
+
} else if (this.isTruncated) {
|
|
87
|
+
this.state = STATES.INITIAL;
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
toggleTruncation() {
|
|
91
|
+
if (this.isTruncated) {
|
|
92
|
+
this.state = STATES.EXTENDED;
|
|
93
|
+
} else if (this.isExtended) {
|
|
94
|
+
this.state = STATES.TRUNCATED;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/* script */
|
|
101
|
+
const __vue_script__ = script;
|
|
102
|
+
|
|
103
|
+
/* template */
|
|
104
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('section',[_c('article',{directives:[{name:"gl-resize-observer",rawName:"v-gl-resize-observer",value:(_vm.onResize),expression:"onResize"}],class:_vm.truncationClasses,style:(_vm.cssVariables),attrs:{"aria-expanded":_vm.ariaExpanded}},[_vm._t("default")],2),_vm._v(" "),(_vm.showTruncationToggle)?_c('gl-button',{attrs:{"variant":"link"},on:{"click":_vm.toggleTruncation}},[_vm._v(_vm._s(_vm.truncationToggleText))]):_vm._e()],1)};
|
|
105
|
+
var __vue_staticRenderFns__ = [];
|
|
106
|
+
|
|
107
|
+
/* style */
|
|
108
|
+
const __vue_inject_styles__ = undefined;
|
|
109
|
+
/* scoped */
|
|
110
|
+
const __vue_scope_id__ = undefined;
|
|
111
|
+
/* module identifier */
|
|
112
|
+
const __vue_module_identifier__ = undefined;
|
|
113
|
+
/* functional template */
|
|
114
|
+
const __vue_is_functional_template__ = false;
|
|
115
|
+
/* style inject */
|
|
116
|
+
|
|
117
|
+
/* style inject SSR */
|
|
118
|
+
|
|
119
|
+
/* style inject shadow dom */
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
const __vue_component__ = __vue_normalize__(
|
|
124
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
125
|
+
__vue_inject_styles__,
|
|
126
|
+
__vue_script__,
|
|
127
|
+
__vue_scope_id__,
|
|
128
|
+
__vue_is_functional_template__,
|
|
129
|
+
__vue_module_identifier__,
|
|
130
|
+
false,
|
|
131
|
+
undefined,
|
|
132
|
+
undefined,
|
|
133
|
+
undefined
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
export default __vue_component__;
|