@gitlab/ui 64.1.1 → 64.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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [64.2.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v64.2.0...v64.2.1) (2023-06-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **GlStackedColumnChart:** Replace the getDom to getZr for supporting edge ([8412f24](https://gitlab.com/gitlab-org/gitlab-ui/commit/8412f2456c56ea58c68ef8f78ff753ec4701388d))
7
+
8
+ # [64.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v64.1.1...v64.2.0) (2023-06-02)
9
+
10
+
11
+ ### Features
12
+
13
+ * **GlFilteredSearchToken:** Pass input attributes to data segment ([e8dcc5f](https://gitlab.com/gitlab-org/gitlab-ui/commit/e8dcc5f8fb8ff4b6fa78f1e46b899a18990d39c8))
14
+
1
15
  ## [64.1.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v64.1.0...v64.1.1) (2023-06-01)
2
16
 
3
17
 
@@ -81,6 +81,11 @@ var script = {
81
81
  type: Boolean,
82
82
  required: false,
83
83
  default: false
84
+ },
85
+ dataSegmentInputAttributes: {
86
+ type: Object,
87
+ required: false,
88
+ default: () => ({})
84
89
  }
85
90
  },
86
91
  data() {
@@ -322,7 +327,7 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
322
327
  var inputValue = ref.inputValue;
323
328
  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,"option-text-field":"value","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){
324
329
  var option = ref.option;
325
- 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},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){
330
+ 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,"search-input-attributes":_vm.dataSegmentInputAttributes},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){
326
331
  var inputValue = ref.inputValue;
327
332
  return [_vm._t("view-token",function(){return [_c('gl-token',_vm._g({staticClass:"gl-filtered-search-token-data",class:_vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_DATA),attrs:{"variant":"search-value","view-only":_vm.viewOnly}},_vm.eventListeners),[_c('span',{staticClass:"gl-filtered-search-token-data-content"},[_vm._t("view",function(){return [_vm._v(_vm._s(inputValue))]},null,{ inputValue: inputValue })],2)])]},null,{
328
333
  inputValue: inputValue,
@@ -266,15 +266,18 @@ var script = {
266
266
  }
267
267
  },
268
268
  beforeDestroy() {
269
- this.chart.getDom().removeEventListener('mousemove', this.debouncedMoveShowTooltip);
270
- this.chart.getDom().removeEventListener('mouseout', this.debouncedMoveShowTooltip);
269
+ this.chart.getZr().off('mousemove', this.debouncedMoveShowTooltip);
270
+ this.chart.getZr().off('mouseout', this.debouncedMoveShowTooltip);
271
271
  },
272
272
  methods: {
273
273
  getColor(index) {
274
274
  var _this$customPalette;
275
275
  return this.customPalette ? (_this$customPalette = this.customPalette) === null || _this$customPalette === void 0 ? void 0 : _this$customPalette[index] : colorFromDefaultPalette(index);
276
276
  },
277
- moveShowTooltip(mouseEvent) {
277
+ moveShowTooltip(_ref4) {
278
+ let {
279
+ event: mouseEvent
280
+ } = _ref4;
278
281
  this.tooltipPosition = {
279
282
  left: `${mouseEvent.zrX}px`,
280
283
  top: `${mouseEvent.zrY + ANNOTATION_TOOLTIP_TOP_OFFSET}px`
@@ -282,8 +285,8 @@ var script = {
282
285
  this.showTooltip = this.chart.containPixel('grid', [mouseEvent.zrX, mouseEvent.zrY]);
283
286
  },
284
287
  onCreated(chart) {
285
- chart.getDom().addEventListener('mousemove', this.debouncedMoveShowTooltip);
286
- chart.getDom().addEventListener('mouseout', this.debouncedMoveShowTooltip);
288
+ chart.getZr().on('mousemove', this.debouncedMoveShowTooltip);
289
+ chart.getZr().on('mouseout', this.debouncedMoveShowTooltip);
287
290
  this.chart = chart;
288
291
  this.$emit('created', chart);
289
292
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "64.1.1",
3
+ "version": "64.2.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -85,7 +85,7 @@
85
85
  "devDependencies": {
86
86
  "@arkweid/lefthook": "0.7.7",
87
87
  "@babel/core": "^7.22.1",
88
- "@babel/preset-env": "^7.22.2",
88
+ "@babel/preset-env": "^7.22.4",
89
89
  "@babel/preset-react": "^7.22.3",
90
90
  "@gitlab/eslint-plugin": "19.0.0",
91
91
  "@gitlab/fonts": "^1.2.0",
@@ -210,6 +210,21 @@ describe('Filtered search token', () => {
210
210
  expect(wrapper.emitted().replace[0][0].value).toStrictEqual({ data: '' });
211
211
  });
212
212
 
213
+ it('sets input attributes on data segment when provided', () => {
214
+ const dataSegmentInputAttributes = {
215
+ placeholder: 'YYYY-MM-DD',
216
+ id: 'this-id',
217
+ };
218
+ createComponent({
219
+ active: true,
220
+ dataSegmentInputAttributes,
221
+ value: { operator: '=', data: 'something' },
222
+ });
223
+ expect(findDataSegment().props().searchInputAttributes).toStrictEqual(
224
+ dataSegmentInputAttributes
225
+ );
226
+ });
227
+
213
228
  describe('integration tests', () => {
214
229
  beforeAll(() => {
215
230
  if (!HTMLElement.prototype.scrollIntoView) {
@@ -1,6 +1,7 @@
1
1
  import PortalVue from 'portal-vue';
2
2
  import Vue from 'vue';
3
3
  import GlIcon from '../icon/icon.vue';
4
+ import GlDatepicker from '../datepicker/datepicker.vue';
4
5
  import { provide } from './common_story_options';
5
6
  import GlFilteredSearchSuggestion from './filtered_search_suggestion.vue';
6
7
  import readme from './filtered_search_token.md';
@@ -153,6 +154,53 @@ export const WithStaticOptions = (args, { argTypes }) => ({
153
154
  });
154
155
  WithStaticOptions.args = generateProps();
155
156
 
157
+ // eslint-disable-next-line no-unused-vars
158
+ export const WithDataSegmentInputAttributes = (args, { argTypes }) => ({
159
+ components: {
160
+ GlFilteredSearchToken,
161
+ GlDatepicker,
162
+ },
163
+ provide,
164
+ props: ['active'],
165
+ data() {
166
+ return {
167
+ value: { operator: '<', data: null },
168
+ config: {
169
+ title: 'Date',
170
+ operators: [
171
+ { value: '<', description: 'before' },
172
+ { value: '>', description: 'after' },
173
+ ],
174
+ },
175
+ dataSegmentInputAttributes: {
176
+ placeholder: 'YYYY-MM-DD',
177
+ id: 'this-id',
178
+ },
179
+ };
180
+ },
181
+ mounted() {
182
+ this.$nextTick(() => {
183
+ document.activeElement.blur();
184
+ });
185
+ },
186
+ template: `
187
+ <div>
188
+ <div> {{ value }} </div>
189
+ <div class="gl-border-1 gl-border-solid gl-border-gray-200">
190
+ <gl-filtered-search-token
191
+ v-model="value"
192
+ class="gl-h-full"
193
+ :config="config"
194
+ :active="active"
195
+ :data-segment-input-attributes="dataSegmentInputAttributes"
196
+ />
197
+ <gl-datepicker target='#this-id' />
198
+ </div>
199
+ </div>
200
+ `,
201
+ });
202
+ WithDataSegmentInputAttributes.args = generateProps();
203
+
156
204
  export default {
157
205
  title: 'base/filtered-search/token',
158
206
  component: GlFilteredSearchToken,
@@ -78,6 +78,11 @@ export default {
78
78
  required: false,
79
79
  default: false,
80
80
  },
81
+ dataSegmentInputAttributes: {
82
+ type: Object,
83
+ required: false,
84
+ default: () => ({}),
85
+ },
81
86
  },
82
87
  data() {
83
88
  return {
@@ -405,6 +410,7 @@ export default {
405
410
  :multi-select="config.multiSelect"
406
411
  :options="config.options"
407
412
  :view-only="viewOnly"
413
+ :search-input-attributes="dataSegmentInputAttributes"
408
414
  @activate="activateDataSegment"
409
415
  @backspace="activateSegment($options.segments.SEGMENT_OPERATOR)"
410
416
  @complete="handleComplete"
@@ -58,8 +58,8 @@ const Template = (args, { argTypes }) => ({
58
58
  template,
59
59
  });
60
60
 
61
- export const Stacked = Template.bind({});
62
- Stacked.args = generateProps();
61
+ export const Default = Template.bind({});
62
+ Default.args = generateProps();
63
63
 
64
64
  export const Tiled = Template.bind({});
65
65
  Tiled.args = generateProps({ presentation: columnOptions.tiled });
@@ -261,14 +261,14 @@ export default {
261
261
  },
262
262
  },
263
263
  beforeDestroy() {
264
- this.chart.getDom().removeEventListener('mousemove', this.debouncedMoveShowTooltip);
265
- this.chart.getDom().removeEventListener('mouseout', this.debouncedMoveShowTooltip);
264
+ this.chart.getZr().off('mousemove', this.debouncedMoveShowTooltip);
265
+ this.chart.getZr().off('mouseout', this.debouncedMoveShowTooltip);
266
266
  },
267
267
  methods: {
268
268
  getColor(index) {
269
269
  return this.customPalette ? this.customPalette?.[index] : colorFromDefaultPalette(index);
270
270
  },
271
- moveShowTooltip(mouseEvent) {
271
+ moveShowTooltip({ event: mouseEvent }) {
272
272
  this.tooltipPosition = {
273
273
  left: `${mouseEvent.zrX}px`,
274
274
  top: `${mouseEvent.zrY + ANNOTATION_TOOLTIP_TOP_OFFSET}px`,
@@ -276,8 +276,8 @@ export default {
276
276
  this.showTooltip = this.chart.containPixel('grid', [mouseEvent.zrX, mouseEvent.zrY]);
277
277
  },
278
278
  onCreated(chart) {
279
- chart.getDom().addEventListener('mousemove', this.debouncedMoveShowTooltip);
280
- chart.getDom().addEventListener('mouseout', this.debouncedMoveShowTooltip);
279
+ chart.getZr().on('mousemove', this.debouncedMoveShowTooltip);
280
+ chart.getZr().on('mouseout', this.debouncedMoveShowTooltip);
281
281
  this.chart = chart;
282
282
  this.$emit('created', chart);
283
283
  },
@@ -21,7 +21,7 @@
21
21
  @return $value;
22
22
  }
23
23
 
24
- $converted: $value / $font-size-base;
24
+ $converted: calc($value / $font-size-base);
25
25
 
26
26
  @return strip-unit($converted) * 1rem;
27
27
  }
@@ -54,7 +54,7 @@
54
54
  $min-width: px-to-rem($min-width);
55
55
  $max-width: px-to-rem($max-width);
56
56
 
57
- $slope: ($max - $min) / ($max-width - $min-width);
57
+ $slope: calc(($max - $min) / ($max-width - $min-width));
58
58
  $intersection: (-$min-width * $slope) + $min;
59
59
 
60
60
  // Use calc() inside of clamp() function to work around SassC