@gitlab/ui 66.14.0 → 66.16.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,17 @@
1
+ # [66.16.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.15.0...v66.16.0) (2023-09-27)
2
+
3
+
4
+ ### Features
5
+
6
+ * **Typography:** Add heading scale classes ([4bfa950](https://gitlab.com/gitlab-org/gitlab-ui/commit/4bfa9505db2cfeb12009a0a4f0ea69a9f1c234ef))
7
+
8
+ # [66.15.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.14.0...v66.15.0) (2023-09-26)
9
+
10
+
11
+ ### Features
12
+
13
+ * **GLFilteredSearch:** Allow commas in multiSelect values ([160781a](https://gitlab.com/gitlab-org/gitlab-ui/commit/160781ad70105069163bc56631fb333a75764163))
14
+
1
15
  # [66.14.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.13.1...v66.14.0) (2023-09-25)
2
16
 
3
17
 
@@ -1,5 +1,5 @@
1
1
  import cloneDeep from 'lodash/cloneDeep';
2
- import { COMMA } from '../../../utils/constants';
2
+ import isEqual from 'lodash/isEqual';
3
3
  import GlToken from '../token/token';
4
4
  import GlFilteredSearchTokenSegment from './filtered_search_token_segment';
5
5
  import { tokenToOption, createTerm, TOKEN_CLOSE_SELECTOR } from './filtered_search_utils';
@@ -99,8 +99,13 @@ var script = {
99
99
  operators() {
100
100
  return this.config.operators || DEFAULT_OPERATORS;
101
101
  },
102
+ tokenEmpty() {
103
+ var _this$tokenValue$data;
104
+ return ((_this$tokenValue$data = this.tokenValue.data) === null || _this$tokenValue$data === void 0 ? void 0 : _this$tokenValue$data.length) === 0;
105
+ },
102
106
  hasDataOrDataSegmentIsCurrentlyActive() {
103
- return this.tokenValue.data !== '' || this.isSegmentActive(SEGMENT_DATA);
107
+ const hasData = !this.tokenEmpty;
108
+ return hasData || this.isSegmentActive(SEGMENT_DATA);
104
109
  },
105
110
  availableTokensWithSelf() {
106
111
  return [this.config, ...this.availableTokens.filter(token => token !== this.config)].map(tokenToOption);
@@ -135,7 +140,7 @@ var script = {
135
140
  },
136
141
  value: {
137
142
  handler(newValue, oldValue) {
138
- if ((newValue === null || newValue === void 0 ? void 0 : newValue.data) === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.data) && (newValue === null || newValue === void 0 ? void 0 : newValue.operator) === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.operator)) {
143
+ if (isEqual(newValue === null || newValue === void 0 ? void 0 : newValue.data, oldValue === null || oldValue === void 0 ? void 0 : oldValue.data) && (newValue === null || newValue === void 0 ? void 0 : newValue.operator) === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.operator)) {
139
144
  return;
140
145
  }
141
146
  this.tokenValue = cloneDeep(newValue);
@@ -143,20 +148,31 @@ var script = {
143
148
  },
144
149
  active: {
145
150
  immediate: true,
146
- handler(newValue) {
147
- if (newValue) {
151
+ handler(tokenIsActive) {
152
+ if (tokenIsActive) {
148
153
  this.intendedCursorPosition = this.cursorPosition;
149
154
  if (!this.activeSegment) {
150
- this.activateSegment(this.tokenValue.data !== '' ? SEGMENT_DATA : SEGMENT_OPERATOR);
155
+ this.activateSegment(this.tokenEmpty ? SEGMENT_OPERATOR : SEGMENT_DATA);
151
156
  }
152
- } else if (this.tokenValue.data === '') {
157
+ } else {
153
158
  this.activeSegment = null;
154
- /**
155
- * Emitted when token is about to be destroyed.
156
- *
157
- * @event destroy
158
- */
159
- this.$emit('destroy');
159
+
160
+ // restore multi select values if we have them
161
+ // otherwise destroy the token
162
+ if (this.config.multiSelect) {
163
+ this.$emit('input', {
164
+ ...this.tokenValue,
165
+ data: this.multiSelectValues || ''
166
+ });
167
+ }
168
+ if (this.tokenEmpty && this.multiSelectValues.length === 0) {
169
+ /**
170
+ * Emitted when token is about to be destroyed.
171
+ *
172
+ * @event destroy
173
+ */
174
+ this.$emit('destroy');
175
+ }
160
176
  }
161
177
  }
162
178
  }
@@ -203,7 +219,7 @@ var script = {
203
219
  return this.active && this.activeSegment === segment;
204
220
  },
205
221
  replaceWithTermIfEmpty() {
206
- if (this.tokenValue.operator === '' && this.tokenValue.data === '') {
222
+ if (this.tokenValue.operator === '' && this.tokenEmpty) {
207
223
  /**
208
224
  * Emitted when this token is converted to another type
209
225
  * @property {object} token Replacement token configuration
@@ -259,7 +275,7 @@ var script = {
259
275
  } = _ref3;
260
276
  return value.startsWith(potentialValue);
261
277
  })) {
262
- if (this.tokenValue.data === '') {
278
+ if (this.tokenEmpty) {
263
279
  applySuggestion(suggestedValue);
264
280
  } else {
265
281
  evt.preventDefault();
@@ -292,12 +308,6 @@ var script = {
292
308
  this.intendedCursorPosition = 'start';
293
309
  },
294
310
  handleComplete() {
295
- if (this.config.multiSelect) {
296
- this.$emit('input', {
297
- ...this.tokenValue,
298
- data: this.multiSelectValues.join(COMMA)
299
- });
300
- }
301
311
  /**
302
312
  * Emitted when the token entry has been completed.
303
313
  *
@@ -1,6 +1,6 @@
1
1
  import last from 'lodash/last';
2
2
  import { Portal } from 'portal-vue';
3
- import { COMMA, LEFT_MOUSE_BUTTON } from '../../../utils/constants';
3
+ import { LEFT_MOUSE_BUTTON } from '../../../utils/constants';
4
4
  import GlFilteredSearchSuggestion from './filtered_search_suggestion';
5
5
  import GlFilteredSearchSuggestionList from './filtered_search_suggestion_list';
6
6
  import { TERM_TOKEN_TYPE, splitOnQuotes, match, wrapTokenInQuotes } from './filtered_search_utils';
@@ -151,7 +151,7 @@ var script = {
151
151
  return (_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.find(o => o.value === this.value);
152
152
  },
153
153
  nonMultipleValue() {
154
- return this.multiSelect ? last(this.value.split(COMMA)) : this.value;
154
+ return Array.isArray(this.value) ? last(this.value) : this.value;
155
155
  },
156
156
  inputValue: {
157
157
  get() {
@@ -210,6 +210,7 @@ var script = {
210
210
  },
211
211
  inputValue(newValue) {
212
212
  if (this.termsAsTokens()) return;
213
+ if (this.multiSelect) return;
213
214
  const hasUnclosedQuote = newValue.split('"').length % 2 === 0;
214
215
  if (newValue.indexOf(' ') === -1 || hasUnclosedQuote) {
215
216
  return;