@gitlab/ui 38.10.1 → 38.12.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/alert/alert.js +1 -1
- package/dist/components/base/filtered_search/filtered_search.js +18 -2
- package/dist/components/base/filtered_search/filtered_search_term.js +6 -1
- package/dist/components/base/filtered_search/filtered_search_token.js +32 -4
- package/dist/components/base/filtered_search/filtered_search_token_segment.js +36 -16
- package/dist/components/charts/tooltip/tooltip.js +7 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/package.json +9 -9
- package/src/components/base/alert/alert.vue +8 -8
- package/src/components/base/filtered_search/__snapshots__/filtered_search_term.spec.js.snap +4 -4
- package/src/components/base/filtered_search/filtered_search.stories.js +8 -1
- package/src/components/base/filtered_search/filtered_search.vue +19 -0
- package/src/components/base/filtered_search/filtered_search_term.spec.js +1 -0
- package/src/components/base/filtered_search/filtered_search_term.vue +11 -1
- package/src/components/base/filtered_search/filtered_search_token.spec.js +1 -0
- package/src/components/base/filtered_search/filtered_search_token.vue +41 -1
- package/src/components/base/filtered_search/filtered_search_token_segment.spec.js +2 -2
- package/src/components/base/filtered_search/filtered_search_token_segment.vue +33 -12
- package/src/components/base/form/form_checkbox/form_checkbox.scss +4 -2
- package/src/components/charts/tooltip/tooltip.spec.js +42 -0
- package/src/components/charts/tooltip/tooltip.vue +13 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
# [38.12.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v38.11.0...v38.12.0) (2022-04-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **Alert:** change Dismiss button DOM order ([5afc9a4](https://gitlab.com/gitlab-org/gitlab-ui/commit/5afc9a4b7f6585d30a09914021219492644b2571))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **checkbox:** Fix disabled custom control color ([ddcdca9](https://gitlab.com/gitlab-org/gitlab-ui/commit/ddcdca9b5d192cfe1c3710e73ae31c07fac6bd75))
|
|
12
|
+
|
|
13
|
+
# [38.11.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v38.10.2...v38.11.0) (2022-04-18)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **GlFilteredSearch:** Allow token navigation with arrows ([80844aa](https://gitlab.com/gitlab-org/gitlab-ui/commit/80844aac908452e626d1c3e4fb0c9aef9c8a5e25))
|
|
19
|
+
* **GlFilteredSearch:** Allow token navigation with arrows ([b7d1519](https://gitlab.com/gitlab-org/gitlab-ui/commit/b7d15196145f53bb5d7be0361e7d7a692c2b5dc4))
|
|
20
|
+
* **GlFilteredSearch:** Allow token navigation with arrows ([9f2a449](https://gitlab.com/gitlab-org/gitlab-ui/commit/9f2a44951657a4aeaaa162f1bd31d60231eb8be1))
|
|
21
|
+
|
|
22
|
+
## [38.10.2](https://gitlab.com/gitlab-org/gitlab-ui/compare/v38.10.1...v38.10.2) (2022-04-14)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **ChartTooltip:** restore right placement by default ([4dfed07](https://gitlab.com/gitlab-org/gitlab-ui/commit/4dfed07d69cc50b59c950f85cda2fe8ef11b7a03))
|
|
28
|
+
|
|
1
29
|
## [38.10.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v38.10.0...v38.10.1) (2022-04-14)
|
|
2
30
|
|
|
3
31
|
|
|
@@ -175,7 +175,7 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
|
|
|
175
175
|
'gl-alert',
|
|
176
176
|
{ 'gl-alert-sticky': _vm.sticky },
|
|
177
177
|
{ 'gl-alert-not-dismissible': !_vm.dismissible },
|
|
178
|
-
_vm.variantClass ]},[_c('gl-icon',{class:{ 'gl-alert-icon': true, 'gl-alert-icon-no-title': !_vm.title },attrs:{"name":_vm.iconName}}),_vm._v(" "),
|
|
178
|
+
_vm.variantClass ]},[_c('gl-icon',{class:{ 'gl-alert-icon': true, 'gl-alert-icon-no-title': !_vm.title },attrs:{"name":_vm.iconName}}),_vm._v(" "),_c('div',{staticClass:"gl-alert-content",attrs:{"role":"alert"}},[(_vm.title)?_c('h4',{staticClass:"gl-alert-title"},[_vm._v(_vm._s(_vm.title))]):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-alert-body"},[_vm._t("default")],2),_vm._v(" "),(_vm.shouldRenderActions)?_c('div',{staticClass:"gl-alert-actions"},[_vm._t("actions",_vm._l((_vm.actionButtons),function(actionButton,index){return _c('gl-button',_vm._g(_vm._b({key:index,staticClass:"gl-alert-action"},'gl-button',actionButton.attrs,false),actionButton.listeners),[_vm._v("\n "+_vm._s(actionButton.text)+"\n ")])}))],2):_vm._e()]),_vm._v(" "),(_vm.dismissible)?_c('close-button',{ref:"dismiss",staticClass:"gl-dismiss-btn",attrs:{"label":_vm.dismissLabel},on:{"click":_vm.onDismiss}}):_vm._e()],1)};
|
|
179
179
|
var __vue_staticRenderFns__ = [];
|
|
180
180
|
|
|
181
181
|
/* style */
|
|
@@ -120,7 +120,8 @@ var script = {
|
|
|
120
120
|
return {
|
|
121
121
|
tokens: initialState(),
|
|
122
122
|
activeTokenIdx: null,
|
|
123
|
-
suggestionsStyle: {}
|
|
123
|
+
suggestionsStyle: {},
|
|
124
|
+
intendedCursorPosition: 'end'
|
|
124
125
|
};
|
|
125
126
|
},
|
|
126
127
|
|
|
@@ -224,6 +225,20 @@ var script = {
|
|
|
224
225
|
this.activeTokenIdx = idx;
|
|
225
226
|
},
|
|
226
227
|
|
|
228
|
+
activatePreviousToken() {
|
|
229
|
+
if (this.activeTokenIdx > 0) {
|
|
230
|
+
this.activeTokenIdx -= 1;
|
|
231
|
+
this.intendedCursorPosition = 'end';
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
activateNextToken() {
|
|
236
|
+
if (this.activeTokenIdx < this.value.length) {
|
|
237
|
+
this.activeTokenIdx += 1;
|
|
238
|
+
this.intendedCursorPosition = 'start';
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
|
|
227
242
|
alignSuggestions(ref) {
|
|
228
243
|
const offsetRef = ref.getBoundingClientRect().left;
|
|
229
244
|
const offsetMenu = this.$el.getBoundingClientRect().left;
|
|
@@ -234,6 +249,7 @@ var script = {
|
|
|
234
249
|
},
|
|
235
250
|
|
|
236
251
|
deactivate(token) {
|
|
252
|
+
this.intendedCursorPosition = 'end';
|
|
237
253
|
const tokenIdx = this.tokens.indexOf(token);
|
|
238
254
|
|
|
239
255
|
if (tokenIdx === -1 || this.activeTokenIdx !== tokenIdx) {
|
|
@@ -327,7 +343,7 @@ const __vue_script__ = script;
|
|
|
327
343
|
/* template */
|
|
328
344
|
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-search-box-by-click',_vm._b({attrs:{"value":_vm.tokens,"history-items":_vm.historyItems,"clearable":_vm.hasValue,"search-button-attributes":_vm.searchButtonAttributes,"data-testid":"filtered-search-input"},on:{"submit":_vm.submit,"input":_vm.applyNewValue,"history-item-selected":function($event){return _vm.$emit('history-item-selected', $event)},"clear":function($event){return _vm.$emit('clear')},"clear-history":function($event){return _vm.$emit('clear-history')}},scopedSlots:_vm._u([{key:"history-item",fn:function(slotScope){return [_vm._t("history-item",null,null,slotScope)]}},{key:"input",fn:function(){return [_c('div',{staticClass:"gl-filtered-search-scrollable"},[_vm._l((_vm.tokens),function(token,idx){return [_c(_vm.getTokenComponent(token.type),{key:token.id,ref:"tokens",refInFor:true,tag:"component",staticClass:"gl-filtered-search-item",class:{
|
|
329
345
|
'gl-filtered-search-last-item': _vm.isLastToken(idx),
|
|
330
|
-
},attrs:{"config":_vm.getTokenEntry(token.type),"active":_vm.activeTokenIdx === idx,"available-tokens":_vm.currentAvailableTokens,"current-value":_vm.tokens,"index":idx,"placeholder":_vm.termPlaceholder,"show-friendly-text":_vm.showFriendlyText,"search-input-attributes":_vm.searchInputAttributes,"is-last-token":_vm.isLastToken(idx)},on:{"activate":function($event){return _vm.activate(idx)},"deactivate":function($event){return _vm.deactivate(token)},"destroy":function($event){return _vm.destroyToken(idx, $event)},"replace":function($event){return _vm.replaceToken(idx, $event)},"complete":_vm.completeToken,"submit":_vm.submit,"split":function($event){return _vm.createTokens(idx, $event)}},model:{value:(token.value),callback:function ($$v) {_vm.$set(token, "value", $$v);},expression:"token.value"}})]})],2),_vm._v(" "),_c('portal-target',{key:_vm.activeTokenIdx,ref:"menu",style:(_vm.suggestionsStyle),attrs:{"name":_vm.portalName,"slim":""}})]},proxy:true}],null,true)},'gl-search-box-by-click',_vm.$attrs,false))};
|
|
346
|
+
},attrs:{"config":_vm.getTokenEntry(token.type),"active":_vm.activeTokenIdx === idx,"cursor-position":_vm.intendedCursorPosition,"available-tokens":_vm.currentAvailableTokens,"current-value":_vm.tokens,"index":idx,"placeholder":_vm.termPlaceholder,"show-friendly-text":_vm.showFriendlyText,"search-input-attributes":_vm.searchInputAttributes,"is-last-token":_vm.isLastToken(idx)},on:{"activate":function($event){return _vm.activate(idx)},"deactivate":function($event){return _vm.deactivate(token)},"destroy":function($event){return _vm.destroyToken(idx, $event)},"replace":function($event){return _vm.replaceToken(idx, $event)},"complete":_vm.completeToken,"submit":_vm.submit,"split":function($event){return _vm.createTokens(idx, $event)},"previous":_vm.activatePreviousToken,"next":_vm.activateNextToken},model:{value:(token.value),callback:function ($$v) {_vm.$set(token, "value", $$v);},expression:"token.value"}})]})],2),_vm._v(" "),_c('portal-target',{key:_vm.activeTokenIdx,ref:"menu",style:(_vm.suggestionsStyle),attrs:{"name":_vm.portalName,"slim":""}})]},proxy:true}],null,true)},'gl-search-box-by-click',_vm.$attrs,false))};
|
|
331
347
|
var __vue_staticRenderFns__ = [];
|
|
332
348
|
|
|
333
349
|
/* style */
|
|
@@ -69,6 +69,11 @@ var script = {
|
|
|
69
69
|
type: Array,
|
|
70
70
|
required: false,
|
|
71
71
|
default: () => []
|
|
72
|
+
},
|
|
73
|
+
cursorPosition: {
|
|
74
|
+
type: String,
|
|
75
|
+
required: true,
|
|
76
|
+
validator: value => ['start', 'end'].includes(value)
|
|
72
77
|
}
|
|
73
78
|
},
|
|
74
79
|
computed: {
|
|
@@ -116,7 +121,7 @@ var script = {
|
|
|
116
121
|
const __vue_script__ = script;
|
|
117
122
|
|
|
118
123
|
/* template */
|
|
119
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-h-auto gl-filtered-search-term"},[_c('gl-filtered-search-token-segment',{staticClass:"gl-filtered-search-term-token",class:{ 'gl-w-full': _vm.placeholder },attrs:{"active":_vm.active,"search-input-attributes":_vm.searchInputAttributes,"is-last-token":_vm.isLastToken,"current-value":_vm.currentValue},on:{"activate":function($event){return _vm.$emit('activate')},"deactivate":function($event){return _vm.$emit('deactivate')},"complete":function($event){return _vm.$emit('replace', { type: $event })},"backspace":_vm.onBackspace,"submit":function($event){return _vm.$emit('submit')},"split":function($event){return _vm.$emit('split', $event)}},scopedSlots:_vm._u([{key:"suggestions",fn:function(){return _vm._l((_vm.suggestedTokens),function(item,idx){return _c('gl-filtered-search-suggestion',{key:idx,attrs:{"value":item.type,"icon-name":item.icon}},[_vm._v("\n "+_vm._s(item.title)+"\n ")])})},proxy:true},{key:"view",fn:function(){return [(_vm.placeholder)?_c('input',_vm._b({staticClass:"gl-filtered-search-term-input",attrs:{"placeholder":_vm.placeholder,"aria-label":_vm.placeholder}},'input',_vm.searchInputAttributes,false)):[_vm._v(_vm._s(_vm.value.data))]]},proxy:true}]),model:{value:(_vm.internalValue),callback:function ($$v) {_vm.internalValue=$$v;},expression:"internalValue"}})],1)};
|
|
124
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-h-auto gl-filtered-search-term",attrs:{"data-testid":"filtered-search-term"}},[_c('gl-filtered-search-token-segment',{ref:"segment",staticClass:"gl-filtered-search-term-token",class:{ 'gl-w-full': _vm.placeholder },attrs:{"active":_vm.active,"cursor-position":_vm.cursorPosition,"search-input-attributes":_vm.searchInputAttributes,"is-last-token":_vm.isLastToken,"current-value":_vm.currentValue},on:{"activate":function($event){return _vm.$emit('activate')},"deactivate":function($event){return _vm.$emit('deactivate')},"complete":function($event){return _vm.$emit('replace', { type: $event })},"backspace":_vm.onBackspace,"submit":function($event){return _vm.$emit('submit')},"split":function($event){return _vm.$emit('split', $event)},"previous":function($event){return _vm.$emit('previous')},"next":function($event){return _vm.$emit('next')}},scopedSlots:_vm._u([{key:"suggestions",fn:function(){return _vm._l((_vm.suggestedTokens),function(item,idx){return _c('gl-filtered-search-suggestion',{key:idx,attrs:{"value":item.type,"icon-name":item.icon}},[_vm._v("\n "+_vm._s(item.title)+"\n ")])})},proxy:true},{key:"view",fn:function(){return [(_vm.placeholder)?_c('input',_vm._b({staticClass:"gl-filtered-search-term-input",attrs:{"placeholder":_vm.placeholder,"aria-label":_vm.placeholder,"data-testid":"filtered-search-term-input"}},'input',_vm.searchInputAttributes,false)):[_vm._v(_vm._s(_vm.value.data))]]},proxy:true}]),model:{value:(_vm.internalValue),callback:function ($$v) {_vm.internalValue=$$v;},expression:"internalValue"}})],1)};
|
|
120
125
|
var __vue_staticRenderFns__ = [];
|
|
121
126
|
|
|
122
127
|
/* style */
|
|
@@ -73,13 +73,19 @@ var script = {
|
|
|
73
73
|
type: Boolean,
|
|
74
74
|
required: false,
|
|
75
75
|
default: false
|
|
76
|
+
},
|
|
77
|
+
cursorPosition: {
|
|
78
|
+
type: String,
|
|
79
|
+
required: true,
|
|
80
|
+
validator: value => ['start', 'end'].includes(value)
|
|
76
81
|
}
|
|
77
82
|
},
|
|
78
83
|
|
|
79
84
|
data() {
|
|
80
85
|
return {
|
|
81
86
|
activeSegment: null,
|
|
82
|
-
tokenValue: _cloneDeep(this.value)
|
|
87
|
+
tokenValue: _cloneDeep(this.value),
|
|
88
|
+
intendedCursorPosition: this.cursorPosition
|
|
83
89
|
};
|
|
84
90
|
},
|
|
85
91
|
|
|
@@ -139,6 +145,8 @@ var script = {
|
|
|
139
145
|
|
|
140
146
|
handler(newValue) {
|
|
141
147
|
if (newValue) {
|
|
148
|
+
this.intendedCursorPosition = this.cursorPosition;
|
|
149
|
+
|
|
142
150
|
if (!this.activeSegment) {
|
|
143
151
|
this.activateSegment(this.tokenValue.data !== '' ? SEGMENT_DATA : SEGMENT_OPERATOR);
|
|
144
152
|
}
|
|
@@ -274,6 +282,26 @@ var script = {
|
|
|
274
282
|
this.activateSegment(this.$options.segments.SEGMENT_DATA);
|
|
275
283
|
},
|
|
276
284
|
|
|
285
|
+
activatePreviousOperatorSegment() {
|
|
286
|
+
this.activateSegment(this.$options.segments.SEGMENT_OPERATOR);
|
|
287
|
+
this.intendedCursorPosition = 'end';
|
|
288
|
+
},
|
|
289
|
+
|
|
290
|
+
activatePreviousTitleSegment() {
|
|
291
|
+
this.activateSegment(this.$options.segments.SEGMENT_TITLE);
|
|
292
|
+
this.intendedCursorPosition = 'end';
|
|
293
|
+
},
|
|
294
|
+
|
|
295
|
+
activateNextDataSegment() {
|
|
296
|
+
this.activateDataSegment();
|
|
297
|
+
this.intendedCursorPosition = 'start';
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
activateNextOperatorSegment() {
|
|
301
|
+
this.activateSegment(this.$options.segments.SEGMENT_OPERATOR);
|
|
302
|
+
this.intendedCursorPosition = 'start';
|
|
303
|
+
},
|
|
304
|
+
|
|
277
305
|
handleComplete() {
|
|
278
306
|
if (this.config.multiSelect) {
|
|
279
307
|
this.$emit('input', { ...this.tokenValue,
|
|
@@ -305,11 +333,11 @@ var script = {
|
|
|
305
333
|
const __vue_script__ = script;
|
|
306
334
|
|
|
307
335
|
/* template */
|
|
308
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-filtered-search-token",class:{ 'gl-filtered-search-token-active': _vm.active }},[_c('gl-filtered-search-token-segment',{key:"title-segment",attrs:{"value":_vm.config.title,"active":_vm.isSegmentActive(_vm.$options.segments.SEGMENT_TITLE),"options":_vm.availableTokensWithSelf},on:{"activate":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_TITLE)},"deactivate":function($event){return _vm.$emit('deactivate')},"complete":_vm.replaceToken,"backspace":function($event){return _vm.$emit('destroy')},"submit":function($event){return _vm.$emit('submit')}},scopedSlots:_vm._u([{key:"view",fn:function(ref){
|
|
336
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-filtered-search-token",class:{ 'gl-filtered-search-token-active': _vm.active },attrs:{"data-testid":"filtered-search-token"}},[_c('gl-filtered-search-token-segment',{key:"title-segment",attrs:{"value":_vm.config.title,"active":_vm.isSegmentActive(_vm.$options.segments.SEGMENT_TITLE),"cursor-position":_vm.intendedCursorPosition,"options":_vm.availableTokensWithSelf},on:{"activate":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_TITLE)},"deactivate":function($event){return _vm.$emit('deactivate')},"complete":_vm.replaceToken,"backspace":function($event){return _vm.$emit('destroy')},"submit":function($event){return _vm.$emit('submit')},"previous":function($event){return _vm.$emit('previous')},"next":_vm.activateNextOperatorSegment},scopedSlots:_vm._u([{key:"view",fn:function(ref){
|
|
309
337
|
var inputValue = ref.inputValue;
|
|
310
|
-
return [_c('gl-token',{staticClass:"gl-filtered-search-token-type",class:_vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_TITLE),attrs:{"view-only":""}},[_vm._v(_vm._s(inputValue))])]}}])}),_vm._v(" "),_c('gl-filtered-search-token-segment',{key:"operator-segment",attrs:{"active":_vm.isSegmentActive(_vm.$options.segments.SEGMENT_OPERATOR),"options":_vm.operators,"custom-input-keydown-handler":_vm.handleOperatorKeydown,"view-only":""},on:{"activate":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_OPERATOR)},"backspace":_vm.replaceWithTermIfEmpty,"complete":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_DATA)},"deactivate":function($event){return _vm.$emit('deactivate')}},scopedSlots:_vm._u([{key:"view",fn:function(){return [_c('gl-token',{staticClass:"gl-filtered-search-token-operator",class:_vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_OPERATOR),attrs:{"variant":"search-value","view-only":""}},[_vm._v(_vm._s(_vm.operatorDescription))])]},proxy:true},{key:"option",fn:function(ref){
|
|
338
|
+
return [_c('gl-token',{staticClass:"gl-filtered-search-token-type",class:_vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_TITLE),attrs:{"view-only":""}},[_vm._v(_vm._s(inputValue))])]}}])}),_vm._v(" "),_c('gl-filtered-search-token-segment',{key:"operator-segment",attrs:{"active":_vm.isSegmentActive(_vm.$options.segments.SEGMENT_OPERATOR),"cursor-position":_vm.intendedCursorPosition,"options":_vm.operators,"custom-input-keydown-handler":_vm.handleOperatorKeydown,"view-only":""},on:{"activate":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_OPERATOR)},"backspace":_vm.replaceWithTermIfEmpty,"complete":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_DATA)},"deactivate":function($event){return _vm.$emit('deactivate')},"previous":_vm.activatePreviousTitleSegment,"next":_vm.activateNextDataSegment},scopedSlots:_vm._u([{key:"view",fn:function(){return [_c('gl-token',{staticClass:"gl-filtered-search-token-operator",class:_vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_OPERATOR),attrs:{"variant":"search-value","view-only":""}},[_vm._v(_vm._s(_vm.operatorDescription))])]},proxy:true},{key:"option",fn:function(ref){
|
|
311
339
|
var option = ref.option;
|
|
312
|
-
return [_c('div',{staticClass:"gl-display-flex"},[_vm._v("\n "+_vm._s(option.value)+"\n "),(option.description)?_c('span',{staticClass:"gl-filtered-search-token-operator-description"},[_vm._v("\n "+_vm._s(option.description)+"\n ")]):_vm._e()])]}}]),model:{value:(_vm.tokenValue.operator),callback:function ($$v) {_vm.$set(_vm.tokenValue, "operator", $$v);},expression:"tokenValue.operator"}}),_vm._v(" "),(_vm.hasDataOrDataSegmentIsCurrentlyActive)?_c('gl-filtered-search-token-segment',{key:"data-segment",attrs:{"active":_vm.isSegmentActive(_vm.$options.segments.SEGMENT_DATA),"multi-select":_vm.config.multiSelect,"options":_vm.config.options,"option-text-field":"title"},on:{"activate":_vm.activateDataSegment,"backspace":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_OPERATOR)},"complete":_vm.handleComplete,"select":function($event){return _vm.$emit('select', $event)},"submit":function($event){return _vm.$emit('submit')},"deactivate":function($event){return _vm.$emit('deactivate')},"split":function($event){return _vm.$emit('split', $event)}},scopedSlots:_vm._u([{key:"suggestions",fn:function(){return [_vm._t("suggestions")]},proxy:true},{key:"view",fn:function(ref){
|
|
340
|
+
return [_c('div',{staticClass:"gl-display-flex"},[_vm._v("\n "+_vm._s(option.value)+"\n "),(option.description)?_c('span',{staticClass:"gl-filtered-search-token-operator-description"},[_vm._v("\n "+_vm._s(option.description)+"\n ")]):_vm._e()])]}}]),model:{value:(_vm.tokenValue.operator),callback:function ($$v) {_vm.$set(_vm.tokenValue, "operator", $$v);},expression:"tokenValue.operator"}}),_vm._v(" "),(_vm.hasDataOrDataSegmentIsCurrentlyActive)?_c('gl-filtered-search-token-segment',{key:"data-segment",attrs:{"active":_vm.isSegmentActive(_vm.$options.segments.SEGMENT_DATA),"cursor-position":_vm.intendedCursorPosition,"multi-select":_vm.config.multiSelect,"options":_vm.config.options,"option-text-field":"title"},on:{"activate":_vm.activateDataSegment,"backspace":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_OPERATOR)},"complete":_vm.handleComplete,"select":function($event){return _vm.$emit('select', $event)},"submit":function($event){return _vm.$emit('submit')},"deactivate":function($event){return _vm.$emit('deactivate')},"split":function($event){return _vm.$emit('split', $event)},"previous":_vm.activatePreviousOperatorSegment,"next":function($event){return _vm.$emit('next')}},scopedSlots:_vm._u([{key:"suggestions",fn:function(){return [_vm._t("suggestions")]},proxy:true},{key:"view",fn:function(ref){
|
|
313
341
|
var inputValue = ref.inputValue;
|
|
314
342
|
return [_vm._t("view-token",[_c('gl-token',{staticClass:"gl-filtered-search-token-data",class:_vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_DATA),attrs:{"variant":"search-value"},on:{"mousedown":_vm.destroyByClose}},[_c('span',{staticClass:"gl-filtered-search-token-data-content"},[_vm._t("view",[_vm._v(_vm._s(inputValue))],null,{ inputValue: inputValue })],2)])],null,{
|
|
315
343
|
inputValue: inputValue,
|
|
@@ -79,6 +79,11 @@ var script = {
|
|
|
79
79
|
type: Array,
|
|
80
80
|
required: false,
|
|
81
81
|
default: () => []
|
|
82
|
+
},
|
|
83
|
+
cursorPosition: {
|
|
84
|
+
type: String,
|
|
85
|
+
required: true,
|
|
86
|
+
validator: value => ['start', 'end'].includes(value)
|
|
82
87
|
}
|
|
83
88
|
},
|
|
84
89
|
|
|
@@ -218,6 +223,10 @@ var script = {
|
|
|
218
223
|
inline: 'end'
|
|
219
224
|
});
|
|
220
225
|
this.alignSuggestions(input);
|
|
226
|
+
|
|
227
|
+
if (this.cursorPosition === 'start') {
|
|
228
|
+
input === null || input === void 0 ? void 0 : input.setSelectionRange(0, 0);
|
|
229
|
+
}
|
|
221
230
|
}
|
|
222
231
|
});
|
|
223
232
|
},
|
|
@@ -255,24 +264,33 @@ var script = {
|
|
|
255
264
|
key
|
|
256
265
|
} = e;
|
|
257
266
|
const {
|
|
258
|
-
suggestions
|
|
267
|
+
suggestions,
|
|
268
|
+
input
|
|
259
269
|
} = this.$refs;
|
|
260
270
|
const suggestedValue = suggestions === null || suggestions === void 0 ? void 0 : suggestions.getValue();
|
|
261
|
-
|
|
262
|
-
if (key === 'Backspace') {
|
|
263
|
-
if (this.inputValue === '') {
|
|
264
|
-
e.preventDefault();
|
|
265
|
-
/**
|
|
266
|
-
* Emitted when Backspace is pressed and the value is empty
|
|
267
|
-
*/
|
|
268
|
-
|
|
269
|
-
this.$emit('backspace');
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
271
|
const handlers = {
|
|
272
|
+
ArrowLeft: () => {
|
|
273
|
+
if (input.selectionStart === 0) {
|
|
274
|
+
e.preventDefault();
|
|
275
|
+
this.$emit('previous');
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
ArrowRight: () => {
|
|
279
|
+
if (input.selectionEnd === this.inputValue.length) {
|
|
280
|
+
e.preventDefault();
|
|
281
|
+
this.$emit('next');
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
Backspace: () => {
|
|
285
|
+
if (this.inputValue === '') {
|
|
286
|
+
e.preventDefault();
|
|
287
|
+
/**
|
|
288
|
+
* Emitted when Backspace is pressed and the value is empty
|
|
289
|
+
*/
|
|
290
|
+
|
|
291
|
+
this.$emit('backspace');
|
|
292
|
+
}
|
|
293
|
+
},
|
|
276
294
|
Enter: () => {
|
|
277
295
|
e.preventDefault();
|
|
278
296
|
|
|
@@ -341,7 +359,9 @@ var script = {
|
|
|
341
359
|
const __vue_script__ = script;
|
|
342
360
|
|
|
343
361
|
/* template */
|
|
344
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',_vm._b({staticClass:"gl-filtered-search-token-segment",class:{
|
|
362
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',_vm._b({staticClass:"gl-filtered-search-token-segment",class:{
|
|
363
|
+
'gl-filtered-search-token-segment-active': _vm.active,
|
|
364
|
+
},attrs:{"data-testid":"filtered-search-token-segment"},on:{"mousedown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"left",37,$event.key,["Left","ArrowLeft"])){ return null; }if('button' in $event && $event.button !== 0){ return null; }return _vm.emitIfInactive($event)}}},'div',_vm.containerAttributes,false),[(_vm.active)?[(((_vm.searchInputAttributes).type)==='checkbox')?_c('input',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.inputValue),expression:"inputValue"}],ref:"input",staticClass:"gl-filtered-search-token-segment-input",attrs:{"aria-label":_vm.label,"type":"checkbox"},domProps:{"checked":Array.isArray(_vm.inputValue)?_vm._i(_vm.inputValue,null)>-1:(_vm.inputValue)},on:{"keydown":_vm.handleInputKeydown,"blur":_vm.handleBlur,"change":function($event){var $$a=_vm.inputValue,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.inputValue=$$a.concat([$$v]));}else {$$i>-1&&(_vm.inputValue=$$a.slice(0,$$i).concat($$a.slice($$i+1)));}}else {_vm.inputValue=$$c;}}}},'input',_vm.searchInputAttributes,false)):(((_vm.searchInputAttributes).type)==='radio')?_c('input',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.inputValue),expression:"inputValue"}],ref:"input",staticClass:"gl-filtered-search-token-segment-input",attrs:{"aria-label":_vm.label,"type":"radio"},domProps:{"checked":_vm._q(_vm.inputValue,null)},on:{"keydown":_vm.handleInputKeydown,"blur":_vm.handleBlur,"change":function($event){_vm.inputValue=null;}}},'input',_vm.searchInputAttributes,false)):_c('input',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.inputValue),expression:"inputValue"}],ref:"input",staticClass:"gl-filtered-search-token-segment-input",attrs:{"aria-label":_vm.label,"type":(_vm.searchInputAttributes).type},domProps:{"value":(_vm.inputValue)},on:{"keydown":_vm.handleInputKeydown,"blur":_vm.handleBlur,"input":function($event){if($event.target.composing){ return; }_vm.inputValue=$event.target.value;}}},'input',_vm.searchInputAttributes,false)),_vm._v(" "),_c('portal',{key:("operator-" + _vm._uid),attrs:{"to":_vm.portalName}},[(_vm.hasOptionsOrSuggestions)?_c('gl-filtered-search-suggestion-list',{key:("operator-" + _vm._uid),ref:"suggestions",attrs:{"initial-value":_vm.defaultSuggestedValue},on:{"suggestion":_vm.applySuggestion}},[(_vm.options)?_vm._l((_vm.options),function(option,idx){return _c('gl-filtered-search-suggestion',{key:((option.value) + "-" + idx),attrs:{"value":option.value,"icon-name":option.icon}},[_vm._t("option",[_vm._v("\n "+_vm._s(option[_vm.optionTextField])+"\n ")],null,{ option: option })],2)}):_vm._t("suggestions")],2):_vm._e()],1)]:_vm._t("view",[_vm._v(_vm._s(_vm.inputValue))],null,{ inputValue: _vm.inputValue })],2)};
|
|
345
365
|
var __vue_staticRenderFns__ = [];
|
|
346
366
|
|
|
347
367
|
/* style */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as echarts from 'echarts';
|
|
2
2
|
import { uid } from '../../../utils/utils';
|
|
3
3
|
import GlPopover from '../../base/popover/popover';
|
|
4
|
+
import { popoverPlacements } from '../../../utils/constants';
|
|
4
5
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
5
6
|
|
|
6
7
|
var script = {
|
|
@@ -42,6 +43,11 @@ var script = {
|
|
|
42
43
|
type: String,
|
|
43
44
|
required: false,
|
|
44
45
|
default: null
|
|
46
|
+
},
|
|
47
|
+
placement: {
|
|
48
|
+
type: String,
|
|
49
|
+
required: false,
|
|
50
|
+
default: popoverPlacements.right
|
|
45
51
|
}
|
|
46
52
|
},
|
|
47
53
|
computed: {
|
|
@@ -71,7 +77,7 @@ var script = {
|
|
|
71
77
|
const __vue_script__ = script;
|
|
72
78
|
|
|
73
79
|
/* template */
|
|
74
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:"gl-chart-tooltip",staticStyle:{"width":"1px","height":"1px"},style:(_vm.containerPosition),attrs:{"id":_vm.containerId}}),_vm._v(" "),_c('gl-popover',_vm._b({attrs:{"target":_vm.containerId,"container":_vm.containerId,"triggers":""},scopedSlots:_vm._u([(_vm.$scopedSlots.title)?{key:"title",fn:function(){return [_vm._t("title")]},proxy:true}:null],null,true)},'gl-popover',_vm.$attrs,false),[_vm._v(" "),_vm._t("default")],2)],1)};
|
|
80
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:"gl-chart-tooltip",staticStyle:{"width":"1px","height":"1px"},style:(_vm.containerPosition),attrs:{"id":_vm.containerId}}),_vm._v(" "),_c('gl-popover',_vm._b({attrs:{"target":_vm.containerId,"container":_vm.containerId,"placement":_vm.placement,"triggers":""},scopedSlots:_vm._u([(_vm.$scopedSlots.title)?{key:"title",fn:function(){return [_vm._t("title")]},proxy:true}:null],null,true)},'gl-popover',_vm.$attrs,false),[_vm._v(" "),_vm._t("default")],2)],1)};
|
|
75
81
|
var __vue_staticRenderFns__ = [];
|
|
76
82
|
|
|
77
83
|
/* style */
|