@gitlab/ui 127.1.0 → 127.1.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/dist/components/base/filtered_search/filtered_search.js +9 -7
- package/dist/components/base/filtered_search/filtered_search_suggestion_list.js +2 -2
- package/dist/components/base/filtered_search/filtered_search_token_segment.js +10 -2
- package/dist/components/base/filtered_search/filtered_search_utils.js +2 -1
- package/dist/components/base/toast/toast.js +2 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/package.json +1 -1
- package/src/components/base/filtered_search/filtered_search.vue +8 -7
- package/src/components/base/filtered_search/filtered_search_suggestion_list.vue +2 -2
- package/src/components/base/filtered_search/filtered_search_token_segment.vue +15 -2
- package/src/components/base/filtered_search/filtered_search_utils.js +2 -0
- package/src/components/base/toast/toast.js +1 -0
- package/src/components/base/toast/toast.scss +18 -2
|
@@ -6,13 +6,17 @@ import { logWarning } from '../../../utils/utils';
|
|
|
6
6
|
import GlIcon from '../icon/icon';
|
|
7
7
|
import GlSearchBoxByClick from '../search_box_by_click/search_box_by_click';
|
|
8
8
|
import GlFilteredSearchTerm from './filtered_search_term';
|
|
9
|
-
import { termTokenDefinition, isEmptyTerm, createTerm,
|
|
9
|
+
import { termTokenDefinition, isEmptyTerm, createTerm, INTENT_ACTIVATE_PREVIOUS, ensureTokenId, normalizeTokens, needDenormalization, denormalizeTokens } from './filtered_search_utils';
|
|
10
10
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
11
11
|
|
|
12
12
|
let portalUuid = 0;
|
|
13
13
|
function initialState() {
|
|
14
14
|
return [createTerm()];
|
|
15
15
|
}
|
|
16
|
+
function computeTokens(value, termsAsTokens) {
|
|
17
|
+
const resolved = value !== null && value !== void 0 && value.length ? cloneDeep(value) : initialState();
|
|
18
|
+
return needDenormalization(resolved) ? denormalizeTokens(resolved, termsAsTokens) : resolved;
|
|
19
|
+
}
|
|
16
20
|
var script = {
|
|
17
21
|
name: 'GlFilteredSearch',
|
|
18
22
|
components: {
|
|
@@ -167,7 +171,7 @@ var script = {
|
|
|
167
171
|
},
|
|
168
172
|
data() {
|
|
169
173
|
return {
|
|
170
|
-
tokens:
|
|
174
|
+
tokens: computeTokens(this.value, this.termsAsTokens),
|
|
171
175
|
activeTokenIdx: null,
|
|
172
176
|
suggestionsStyle: {},
|
|
173
177
|
intendedCursorPosition: 'end'
|
|
@@ -229,17 +233,15 @@ var script = {
|
|
|
229
233
|
value: {
|
|
230
234
|
handler(newValue, oldValue) {
|
|
231
235
|
if (!isEqual(newValue, oldValue)) {
|
|
232
|
-
|
|
233
|
-
this.applyNewValue(cloneDeep(value));
|
|
236
|
+
this.applyNewValue(newValue);
|
|
234
237
|
}
|
|
235
238
|
},
|
|
236
|
-
deep: true
|
|
237
|
-
immediate: true
|
|
239
|
+
deep: true
|
|
238
240
|
}
|
|
239
241
|
},
|
|
240
242
|
methods: {
|
|
241
243
|
applyNewValue(newValue) {
|
|
242
|
-
this.tokens =
|
|
244
|
+
this.tokens = computeTokens(newValue, this.termsAsTokens);
|
|
243
245
|
},
|
|
244
246
|
isActiveToken(idx) {
|
|
245
247
|
return this.activeTokenIdx === idx;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { stepIndexAndWrap } from './filtered_search_utils';
|
|
1
|
+
import { FILTERED_SEARCH_SUGGESTIONS_CLASS, stepIndexAndWrap } from './filtered_search_utils';
|
|
2
2
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
3
3
|
|
|
4
4
|
const DEFER_TO_INITIAL_VALUE = -1;
|
|
@@ -40,7 +40,7 @@ var script = {
|
|
|
40
40
|
return this.registeredItems[this.activeIdx];
|
|
41
41
|
},
|
|
42
42
|
listClasses() {
|
|
43
|
-
return [this.suggestionsListClass(),
|
|
43
|
+
return [this.suggestionsListClass(), `dropdown-menu ${FILTERED_SEARCH_SUGGESTIONS_CLASS}`];
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
watch: {
|
|
@@ -3,7 +3,7 @@ import { Portal } from 'portal-vue';
|
|
|
3
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
|
-
import { TERM_TOKEN_TYPE, splitOnQuotes, match, wrapTokenInQuotes } from './filtered_search_utils';
|
|
6
|
+
import { TERM_TOKEN_TYPE, splitOnQuotes, match, wrapTokenInQuotes, FILTERED_SEARCH_SUGGESTIONS_CLASS } from './filtered_search_utils';
|
|
7
7
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
8
8
|
|
|
9
9
|
// We need some helpers to ensure @vue/compat compatibility
|
|
@@ -381,7 +381,15 @@ var script = {
|
|
|
381
381
|
applySuggestion: v => this.applySuggestion(v)
|
|
382
382
|
});
|
|
383
383
|
},
|
|
384
|
-
handleBlur() {
|
|
384
|
+
handleBlur(e) {
|
|
385
|
+
var _e$relatedTarget;
|
|
386
|
+
// Keep focus on input when blur event is on same element
|
|
387
|
+
// (e.g. scrollbar in filtered search suggestions list)
|
|
388
|
+
if ((_e$relatedTarget = e.relatedTarget) !== null && _e$relatedTarget !== void 0 && _e$relatedTarget.classList.contains(FILTERED_SEARCH_SUGGESTIONS_CLASS)) {
|
|
389
|
+
var _this$$refs$input;
|
|
390
|
+
(_this$$refs$input = this.$refs.input) === null || _this$$refs$input === void 0 ? void 0 : _this$$refs$input.focus();
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
385
393
|
if (this.multiSelect) {
|
|
386
394
|
this.$emit('complete');
|
|
387
395
|
} else if (this.active) {
|
|
@@ -6,6 +6,7 @@ import { modulo } from '../../../utils/number_utils';
|
|
|
6
6
|
const TERM_TOKEN_TYPE = 'filtered-search-term';
|
|
7
7
|
const INTENT_ACTIVATE_PREVIOUS = 'intent-activate-previous';
|
|
8
8
|
const TOKEN_CLOSE_SELECTOR = '.gl-token-close';
|
|
9
|
+
const FILTERED_SEARCH_SUGGESTIONS_CLASS = 'gl-filtered-search-suggestion-list';
|
|
9
10
|
function isEmptyTerm(token) {
|
|
10
11
|
return token.type === TERM_TOKEN_TYPE && token.value.data.trim() === '';
|
|
11
12
|
}
|
|
@@ -239,4 +240,4 @@ function wrapTokenInQuotes(token) {
|
|
|
239
240
|
return `"${token}"`;
|
|
240
241
|
}
|
|
241
242
|
|
|
242
|
-
export { INTENT_ACTIVATE_PREVIOUS, TERM_TOKEN_TYPE, TOKEN_CLOSE_SELECTOR, createTerm, denormalizeTokens, ensureTokenId, isEmptyTerm, match, needDenormalization, normalizeTokens, splitOnQuotes, stepIndexAndWrap, termTokenDefinition, tokenToOption, wrapTokenInQuotes };
|
|
243
|
+
export { FILTERED_SEARCH_SUGGESTIONS_CLASS, INTENT_ACTIVATE_PREVIOUS, TERM_TOKEN_TYPE, TOKEN_CLOSE_SELECTOR, createTerm, denormalizeTokens, ensureTokenId, isEmptyTerm, match, needDenormalization, normalizeTokens, splitOnQuotes, stepIndexAndWrap, termTokenDefinition, tokenToOption, wrapTokenInQuotes };
|