@gitlab/ui 55.0.1 → 55.1.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
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [55.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v55.0.1...v55.1.0) (2023-02-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **GlFilteredSearchToken:** added title slot to GlFilteredSearchToken ([8e1a6d6](https://gitlab.com/gitlab-org/gitlab-ui/commit/8e1a6d6d67b75356fb334053eb33c4a5d7047cbd))
|
|
7
|
+
|
|
1
8
|
## [55.0.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v55.0.0...v55.0.1) (2023-02-07)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -305,6 +305,9 @@ var script = {
|
|
|
305
305
|
event.stopPropagation();
|
|
306
306
|
this.$emit('destroy');
|
|
307
307
|
}
|
|
308
|
+
},
|
|
309
|
+
hasTitleOptionSlot() {
|
|
310
|
+
return Boolean(this.$scopedSlots['title-option']);
|
|
308
311
|
}
|
|
309
312
|
}
|
|
310
313
|
};
|
|
@@ -319,7 +322,7 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
|
|
|
319
322
|
'gl-cursor-default': _vm.viewOnly,
|
|
320
323
|
},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,"view-only":_vm.viewOnly},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){
|
|
321
324
|
var inputValue = ref.inputValue;
|
|
322
|
-
return [_c('gl-token',{staticClass:"gl-filtered-search-token-type",class:_vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_TITLE),attrs:{"view-only":""}},[_vm._v("\n "+_vm._s(inputValue)+"\n ")])]}}])}),_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":_vm.viewOnly},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("\n "+_vm._s(_vm.operatorDescription)+"\n ")])]},proxy:true},{key:"option",fn:function(ref){
|
|
325
|
+
return [_c('gl-token',{staticClass:"gl-filtered-search-token-type",class:_vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_TITLE),attrs:{"view-only":""}},[_vm._v("\n "+_vm._s(inputValue)+"\n ")])]}},(_vm.hasTitleOptionSlot())?{key:"option",fn:function(){return [_vm._t("title-option")]},proxy:true}:null],null,true)}),_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":_vm.viewOnly},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("\n "+_vm._s(_vm.operatorDescription)+"\n ")])]},proxy:true},{key:"option",fn:function(ref){
|
|
323
326
|
var option = ref.option;
|
|
324
327
|
return [_c('div',{staticClass:"gl-display-flex"},[_vm._v("\n "+_vm._s(_vm.showFriendlyText ? option.description : option.value)+"\n "),(option.description)?_c('span',{staticClass:"gl-filtered-search-token-operator-description"},[_vm._v("\n "+_vm._s(_vm.showFriendlyText ? option.value : 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,"view-only":_vm.viewOnly,"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){
|
|
325
328
|
var inputValue = ref.inputValue;
|
package/package.json
CHANGED
|
@@ -33,9 +33,10 @@ describe('Filtered search token', () => {
|
|
|
33
33
|
cursorPosition: 'end',
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
const createComponent = (props) => {
|
|
36
|
+
const createComponent = (props, options = {}) => {
|
|
37
37
|
wrapper = shallowMount(GlFilteredSearchToken, {
|
|
38
38
|
propsData: { ...defaultProps, ...props },
|
|
39
|
+
...options,
|
|
39
40
|
});
|
|
40
41
|
};
|
|
41
42
|
|
|
@@ -372,4 +373,22 @@ describe('Filtered search token', () => {
|
|
|
372
373
|
}
|
|
373
374
|
);
|
|
374
375
|
});
|
|
376
|
+
|
|
377
|
+
it('renders title options passed via slot', async () => {
|
|
378
|
+
createComponent(
|
|
379
|
+
{},
|
|
380
|
+
{
|
|
381
|
+
slots: {
|
|
382
|
+
'title-option': '<div>new title</div>',
|
|
383
|
+
},
|
|
384
|
+
stubs: {
|
|
385
|
+
GlFilteredSearchTokenSegment: {
|
|
386
|
+
template: `<div><slot name="option" v-bind='{ option: { value: "default title"} }'></slot></div>`,
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
}
|
|
390
|
+
);
|
|
391
|
+
|
|
392
|
+
expect(findTitleSegment().text()).toBe('new title');
|
|
393
|
+
});
|
|
375
394
|
});
|
|
@@ -303,6 +303,10 @@ export default {
|
|
|
303
303
|
this.$emit('destroy');
|
|
304
304
|
}
|
|
305
305
|
},
|
|
306
|
+
|
|
307
|
+
hasTitleOptionSlot() {
|
|
308
|
+
return Boolean(this.$scopedSlots['title-option']);
|
|
309
|
+
},
|
|
306
310
|
},
|
|
307
311
|
};
|
|
308
312
|
</script>
|
|
@@ -346,6 +350,9 @@ export default {
|
|
|
346
350
|
{{ inputValue }}
|
|
347
351
|
</gl-token>
|
|
348
352
|
</template>
|
|
353
|
+
<template v-if="hasTitleOptionSlot()" #option>
|
|
354
|
+
<slot name="title-option"></slot>
|
|
355
|
+
</template>
|
|
349
356
|
</gl-filtered-search-token-segment>
|
|
350
357
|
|
|
351
358
|
<gl-filtered-search-token-segment
|