@gitlab/ui 80.1.0 → 80.2.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 +7 -0
- package/dist/components/base/filtered_search/filtered_search.js +5 -2
- package/dist/tokens/css/tokens.css +1 -1
- package/dist/tokens/css/tokens.dark.css +1 -1
- package/dist/tokens/js/tokens.dark.js +1 -1
- package/dist/tokens/js/tokens.js +1 -1
- package/dist/tokens/scss/_tokens.dark.scss +1 -1
- package/dist/tokens/scss/_tokens.scss +1 -1
- package/package.json +1 -1
- package/src/components/base/filtered_search/filtered_search.spec.js +19 -0
- package/src/components/base/filtered_search/filtered_search.vue +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [80.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v80.1.0...v80.2.0) (2024-05-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **GlFilteredSearch:** pass appliedTokens prop to nested token ([4eea90a](https://gitlab.com/gitlab-org/gitlab-ui/commit/4eea90a9358c0fa07e25878b515970d0f6bbf297))
|
|
7
|
+
|
|
1
8
|
# [80.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v80.0.1...v80.1.0) (2024-05-03)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -5,7 +5,7 @@ import { GlTooltipDirective } from '../../../directives/tooltip';
|
|
|
5
5
|
import GlIcon from '../icon/icon';
|
|
6
6
|
import GlSearchBoxByClick from '../search_box_by_click/search_box_by_click';
|
|
7
7
|
import GlFilteredSearchTerm from './filtered_search_term';
|
|
8
|
-
import { termTokenDefinition, createTerm, needDenormalization, denormalizeTokens,
|
|
8
|
+
import { termTokenDefinition, createTerm, isEmptyTerm, needDenormalization, denormalizeTokens, INTENT_ACTIVATE_PREVIOUS, ensureTokenId, normalizeTokens } from './filtered_search_utils';
|
|
9
9
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
10
10
|
|
|
11
11
|
let portalUuid = 0;
|
|
@@ -175,6 +175,9 @@ var script = {
|
|
|
175
175
|
activeToken() {
|
|
176
176
|
return this.tokens[this.activeTokenIdx];
|
|
177
177
|
},
|
|
178
|
+
appliedTokens() {
|
|
179
|
+
return this.tokens.filter(token => !isEmptyTerm(token));
|
|
180
|
+
},
|
|
178
181
|
lastTokenIdx() {
|
|
179
182
|
return this.tokens.length - 1;
|
|
180
183
|
},
|
|
@@ -367,7 +370,7 @@ const __vue_script__ = script;
|
|
|
367
370
|
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,"show-search-button":_vm.showSearchButton,"disabled":_vm.viewOnly,"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-container",class:{
|
|
368
371
|
'gl-filtered-search-scrollable-container-with-search-button': _vm.showSearchButton,
|
|
369
372
|
'gl-bg-gray-10! gl-inset-border-1-gray-100!': _vm.viewOnly,
|
|
370
|
-
}},[_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",class:_vm.getTokenClassList(idx),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,"view-only":_vm.viewOnly,"is-last-token":_vm.isLastToken(idx),"search-text-option-label":_vm.searchTextOptionLabel},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"}})}),1)]),_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))};
|
|
373
|
+
}},[_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",class:_vm.getTokenClassList(idx),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,"view-only":_vm.viewOnly,"is-last-token":_vm.isLastToken(idx),"search-text-option-label":_vm.searchTextOptionLabel,"applied-tokens":_vm.appliedTokens},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"}})}),1)]),_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))};
|
|
371
374
|
var __vue_staticRenderFns__ = [];
|
|
372
375
|
|
|
373
376
|
/* style */
|
package/dist/tokens/js/tokens.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
// Do not edit directly
|
|
3
|
-
// Generated on Fri, 03 May 2024
|
|
3
|
+
// Generated on Fri, 03 May 2024 22:13:37 GMT
|
|
4
4
|
|
|
5
5
|
$gl-text-color-disabled: #89888d !default; // Used for disabled text.
|
|
6
6
|
$gl-text-color-link: #63a6e9 !default; // Used for default text links.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
// Do not edit directly
|
|
3
|
-
// Generated on Fri, 03 May 2024
|
|
3
|
+
// Generated on Fri, 03 May 2024 22:13:37 GMT
|
|
4
4
|
|
|
5
5
|
$gl-text-color-disabled: #89888d !default; // Used for disabled text.
|
|
6
6
|
$gl-text-color-success: #217645 !default; // Used for text indicating success or validity.
|
package/package.json
CHANGED
|
@@ -25,6 +25,11 @@ const FakeToken = avoidReactivity({
|
|
|
25
25
|
render: (h) => h('div'),
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
+
const AppliedTokensTestFakeToken = avoidReactivity({
|
|
29
|
+
props: ['appliedTokens'],
|
|
30
|
+
render: (h) => h('div'),
|
|
31
|
+
});
|
|
32
|
+
|
|
28
33
|
Vue.directive('GlTooltip', () => {});
|
|
29
34
|
|
|
30
35
|
let wrapper;
|
|
@@ -475,6 +480,20 @@ describe('Filtered search', () => {
|
|
|
475
480
|
);
|
|
476
481
|
});
|
|
477
482
|
|
|
483
|
+
it('passes appliedTokens prop to the token component', async () => {
|
|
484
|
+
const value = [{ type: 'faketoken', value: 'foo' }];
|
|
485
|
+
const expectedAppliedTokens = [{ type: 'faketoken', value: 'foo', id: expect.anything() }];
|
|
486
|
+
createComponent({
|
|
487
|
+
value,
|
|
488
|
+
availableTokens: [{ type: 'faketoken', token: AppliedTokensTestFakeToken }],
|
|
489
|
+
});
|
|
490
|
+
await nextTick();
|
|
491
|
+
|
|
492
|
+
const fakeTokenInstance = wrapper.findComponent(AppliedTokensTestFakeToken);
|
|
493
|
+
expect(fakeTokenInstance.exists()).toBe(true);
|
|
494
|
+
expect(fakeTokenInstance.props('appliedTokens')).toEqual(expectedAppliedTokens);
|
|
495
|
+
});
|
|
496
|
+
|
|
478
497
|
it('passes `searchButtonAttributes` prop to `GlSearchBoxByClick`', () => {
|
|
479
498
|
const searchButtonAttributes = { 'data-prop': 'foo-bar' };
|
|
480
499
|
|
|
@@ -183,6 +183,9 @@ export default {
|
|
|
183
183
|
activeToken() {
|
|
184
184
|
return this.tokens[this.activeTokenIdx];
|
|
185
185
|
},
|
|
186
|
+
appliedTokens() {
|
|
187
|
+
return this.tokens.filter((token) => !isEmptyTerm(token));
|
|
188
|
+
},
|
|
186
189
|
lastTokenIdx() {
|
|
187
190
|
return this.tokens.length - 1;
|
|
188
191
|
},
|
|
@@ -433,6 +436,7 @@ export default {
|
|
|
433
436
|
:is-last-token="isLastToken(idx)"
|
|
434
437
|
:class="getTokenClassList(idx)"
|
|
435
438
|
:search-text-option-label="searchTextOptionLabel"
|
|
439
|
+
:applied-tokens="appliedTokens"
|
|
436
440
|
@activate="activate(idx)"
|
|
437
441
|
@deactivate="deactivate(token)"
|
|
438
442
|
@destroy="destroyToken(idx, $event)"
|