@gitlab/ui 39.5.0 → 39.5.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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [39.5.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v39.5.0...v39.5.1) (2022-05-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **GlFilteredSearch:** cursorPosition prop not required ([ff3b3e0](https://gitlab.com/gitlab-org/gitlab-ui/commit/ff3b3e03199d703d0251e1b751bee30a942852cf))
7
+
1
8
  # [39.5.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v39.4.0...v39.5.0) (2022-05-02)
2
9
 
3
10
 
@@ -72,7 +72,8 @@ var script = {
72
72
  },
73
73
  cursorPosition: {
74
74
  type: String,
75
- required: true,
75
+ required: false,
76
+ default: 'end',
76
77
  validator: value => ['start', 'end'].includes(value)
77
78
  }
78
79
  },
@@ -76,7 +76,8 @@ var script = {
76
76
  },
77
77
  cursorPosition: {
78
78
  type: String,
79
- required: true,
79
+ required: false,
80
+ default: 'end',
80
81
  validator: value => ['start', 'end'].includes(value)
81
82
  }
82
83
  },
@@ -335,7 +336,7 @@ const __vue_script__ = script;
335
336
  /* template */
336
337
  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){
337
338
  var inputValue = ref.inputValue;
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){
339
+ 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":""},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){
339
340
  var option = ref.option;
340
341
  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){
341
342
  var inputValue = ref.inputValue;
@@ -82,7 +82,8 @@ var script = {
82
82
  },
83
83
  cursorPosition: {
84
84
  type: String,
85
- required: true,
85
+ required: false,
86
+ default: 'end',
86
87
  validator: value => ['start', 'end'].includes(value)
87
88
  }
88
89
  },
@@ -361,7 +362,7 @@ const __vue_script__ = script;
361
362
  /* template */
362
363
  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
364
  '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)};
365
+ },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(" "+_vm._s(option[_vm.optionTextField])+" ")],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)};
365
366
  var __vue_staticRenderFns__ = [];
366
367
 
367
368
  /* style */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "39.5.0",
3
+ "version": "39.5.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -65,7 +65,8 @@ export default {
65
65
  },
66
66
  cursorPosition: {
67
67
  type: String,
68
- required: true,
68
+ required: false,
69
+ default: 'end',
69
70
  validator: (value) => ['start', 'end'].includes(value),
70
71
  },
71
72
  },
@@ -111,24 +112,29 @@ export default {
111
112
  Emitted when this term token is clicked.
112
113
  @event activate
113
114
  -->
115
+
114
116
  <!--
115
117
  Emitted when this term token will lose its focus.
116
118
  @event deactivate
117
119
  -->
120
+
118
121
  <!--
119
122
  Emitted when autocomplete entry is selected.
120
123
  @event replace
121
124
  @property {object} token Replacement token configuration.
122
125
  -->
126
+
123
127
  <!--
124
128
  Emitted when the token is submitted.
125
129
  @event submit
126
130
  -->
131
+
127
132
  <!--
128
133
  Emitted when Space is pressed in-between term text.
129
134
  @event split
130
135
  @property {array} newTokens Token configurations
131
136
  -->
137
+
132
138
  <gl-filtered-search-token-segment
133
139
  ref="segment"
134
140
  v-model="internalValue"
@@ -158,6 +164,7 @@ export default {
158
164
  {{ item.title }}
159
165
  </gl-filtered-search-suggestion>
160
166
  </template>
167
+
161
168
  <template #view>
162
169
  <input
163
170
  v-if="placeholder"
@@ -167,6 +174,7 @@ export default {
167
174
  :aria-label="placeholder"
168
175
  data-testid="filtered-search-term-input"
169
176
  />
177
+
170
178
  <template v-else>{{ value.data }}</template>
171
179
  </template>
172
180
  </gl-filtered-search-token-segment>
@@ -67,7 +67,8 @@ export default {
67
67
  },
68
68
  cursorPosition: {
69
69
  type: String,
70
- required: true,
70
+ required: false,
71
+ default: 'end',
71
72
  validator: (value) => ['start', 'end'].includes(value),
72
73
  },
73
74
  },
@@ -299,6 +300,7 @@ export default {
299
300
  Emitted when the token is submitted.
300
301
  @event submit
301
302
  -->
303
+
302
304
  <gl-filtered-search-token-segment
303
305
  key="title-segment"
304
306
  :value="config.title"
@@ -318,10 +320,12 @@ export default {
318
320
  class="gl-filtered-search-token-type"
319
321
  :class="getAdditionalSegmentClasses($options.segments.SEGMENT_TITLE)"
320
322
  view-only
321
- >{{ inputValue }}</gl-token
322
323
  >
324
+ {{ inputValue }}
325
+ </gl-token>
323
326
  </template>
324
327
  </gl-filtered-search-token-segment>
328
+
325
329
  <gl-filtered-search-token-segment
326
330
  key="operator-segment"
327
331
  v-model="tokenValue.operator"
@@ -343,9 +347,11 @@ export default {
343
347
  variant="search-value"
344
348
  :class="getAdditionalSegmentClasses($options.segments.SEGMENT_OPERATOR)"
345
349
  view-only
346
- >{{ operatorDescription }}</gl-token
347
350
  >
351
+ {{ operatorDescription }}
352
+ </gl-token>
348
353
  </template>
354
+
349
355
  <template #option="{ option }">
350
356
  <div class="gl-display-flex">
351
357
  {{ option.value }}
@@ -355,16 +361,19 @@ export default {
355
361
  </div>
356
362
  </template>
357
363
  </gl-filtered-search-token-segment>
364
+
358
365
  <!--
359
366
  Emitted when a suggestion has been selected.
360
367
  @event select
361
368
  @type {string} value The value of the selected suggestion.
362
369
  -->
370
+
363
371
  <!--
364
372
  Emitted when Space is pressed in-between term text.
365
373
  @event split
366
374
  @property {array} newTokens Token configurations
367
375
  -->
376
+
368
377
  <gl-filtered-search-token-segment
369
378
  v-if="hasDataOrDataSegmentIsCurrentlyActive"
370
379
  key="data-segment"
@@ -386,10 +395,13 @@ export default {
386
395
  >
387
396
  <template #suggestions>
388
397
  <!-- @slot The suggestions (implemented with GlFilteredSearchSuggestion). -->
398
+
389
399
  <slot name="suggestions"></slot>
390
400
  </template>
401
+
391
402
  <template #view="{ inputValue }">
392
403
  <!-- @slot Used to customize how the token is rendered. -->
404
+
393
405
  <slot
394
406
  name="view-token"
395
407
  v-bind="{
@@ -412,6 +424,7 @@ export default {
412
424
  @slot Template for token value in inactive state
413
425
  @binding {array} suggestions Slot for rendering autocomplete suggestions when no options are provided.
414
426
  -->
427
+
415
428
  <slot name="view" v-bind="{ inputValue }">{{ inputValue }}</slot>
416
429
  </span>
417
430
  </gl-token>
@@ -79,7 +79,8 @@ export default {
79
79
  },
80
80
  cursorPosition: {
81
81
  type: String,
82
- required: true,
82
+ required: false,
83
+ default: 'end',
83
84
  validator: (value) => ['start', 'end'].includes(value),
84
85
  },
85
86
  },
@@ -346,6 +347,7 @@ export default {
346
347
  @keydown="handleInputKeydown"
347
348
  @blur="handleBlur"
348
349
  />
350
+
349
351
  <portal :key="`operator-${_uid}`" :to="portalName">
350
352
  <gl-filtered-search-suggestion-list
351
353
  v-if="hasOptionsOrSuggestions"
@@ -361,11 +363,10 @@ export default {
361
363
  :value="option.value"
362
364
  :icon-name="option.icon"
363
365
  >
364
- <slot name="option" v-bind="{ option }">
365
- {{ option[optionTextField] }}
366
- </slot>
366
+ <slot name="option" v-bind="{ option }"> {{ option[optionTextField] }} </slot>
367
367
  </gl-filtered-search-suggestion>
368
368
  </template>
369
+
369
370
  <slot v-else name="suggestions"></slot>
370
371
  </gl-filtered-search-suggestion-list>
371
372
  </portal>