@vertexvis/ui 0.1.0-testing.3 → 0.1.0-testing.5
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/cjs/badge-d39ac1fc.js +23 -0
- package/dist/cjs/components.cjs.js +1 -1
- package/dist/cjs/{icon-53d62a46.js → icon-460fd0f5.js} +1 -1
- package/dist/cjs/icon-button-786427d6.js +43 -0
- package/dist/cjs/{icon-helper-caf2699e.js → icon-helper-ba408f49.js} +7 -0
- package/dist/cjs/index.cjs.js +11 -9
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{popover-d9ec8e10.js → popover-942209b8.js} +23 -1
- package/dist/cjs/{result-list-1e592c3c.js → result-list-241ffe8d.js} +46 -2
- package/dist/cjs/search-bar-a321b3e1.js +353 -0
- package/dist/cjs/{select-0eb7203f.js → select-5f8aecfe.js} +27 -4
- package/dist/cjs/{text-field-0397fb34.js → text-field-bccbde1f.js} +1 -0
- package/dist/cjs/{tooltip-31b596f5.js → tooltip-e9f63631.js} +58 -19
- package/dist/cjs/vertex-badge.cjs.entry.js +11 -0
- package/dist/cjs/vertex-icon-button.cjs.entry.js +2 -2
- package/dist/cjs/vertex-icon.cjs.entry.js +2 -2
- package/dist/cjs/vertex-popover.cjs.entry.js +1 -1
- package/dist/cjs/vertex-result-list.cjs.entry.js +1 -1
- package/dist/cjs/vertex-search-bar.cjs.entry.js +1 -1
- package/dist/cjs/vertex-select.cjs.entry.js +1 -1
- package/dist/cjs/vertex-textfield.cjs.entry.js +1 -1
- package/dist/cjs/vertex-tooltip.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/badge/badge.css +18 -0
- package/dist/collection/components/badge/badge.js +69 -0
- package/dist/collection/components/icon/icon-helper.js +3 -0
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/icon/icons/comment-filled.js +2 -0
- package/dist/collection/components/icon-button/icon-button.css +16 -1
- package/dist/collection/components/icon-button/icon-button.js +2 -2
- package/dist/collection/components/index.js +1 -0
- package/dist/collection/components/menu/menu.js +1 -1
- package/dist/collection/components/popover/popover.js +51 -0
- package/dist/collection/components/result-list/result-list.js +47 -3
- package/dist/collection/components/search-bar/dom.js +12 -0
- package/dist/collection/components/search-bar/lib.js +23 -15
- package/dist/collection/components/search-bar/search-bar.css +2 -29
- package/dist/collection/components/search-bar/search-bar.js +352 -326
- package/dist/collection/components/select/select.css +16 -0
- package/dist/collection/components/select/select.js +49 -2
- package/dist/collection/components/text-field/text-field.js +1 -0
- package/dist/collection/components/tooltip/tooltip.css +2 -0
- package/dist/collection/components/tooltip/tooltip.js +62 -18
- package/dist/collection/types/icon.js +1 -0
- package/dist/collection/util/templates/element-pool.js +19 -1
- package/dist/components/components.css +1 -1
- package/dist/components/components.esm.js +1 -1
- package/dist/components/index.esm.js +1 -1
- package/dist/components/p-03dbb28c.js +1 -0
- package/dist/components/p-0b1cdc8a.entry.js +1 -0
- package/dist/components/p-0b4406fa.entry.js +1 -0
- package/dist/components/p-103249b4.js +1 -0
- package/dist/components/p-29d7697f.js +1 -0
- package/dist/components/p-406e73da.entry.js +1 -0
- package/dist/components/p-43b1b3f9.js +1 -0
- package/dist/components/p-606596de.entry.js +1 -0
- package/dist/components/p-6b862967.js +1 -0
- package/dist/components/p-7cfb3736.entry.js +1 -0
- package/dist/components/p-7dba2574.entry.js +1 -0
- package/dist/components/p-912f6e24.js +1 -0
- package/dist/components/p-92930f2a.js +1 -0
- package/dist/components/p-c2706288.js +1 -0
- package/dist/components/p-c4518377.entry.js +1 -0
- package/dist/components/{p-17b97932.js → p-ca52a423.js} +1 -1
- package/dist/components/p-ee496965.entry.js +1 -0
- package/dist/components/p-f064f911.js +1 -0
- package/dist/components/p-f71fc166.entry.js +1 -0
- package/dist/esm/badge-6d27ca92.js +21 -0
- package/dist/esm/components.js +1 -1
- package/dist/esm/icon-button-aad3c0e7.js +41 -0
- package/dist/esm/{icon-2630793d.js → icon-d37150b4.js} +1 -1
- package/dist/esm/{icon-helper-10a99d95.js → icon-helper-83f10f73.js} +7 -0
- package/dist/esm/index.js +10 -9
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{popover-67c88e4b.js → popover-6e806354.js} +23 -1
- package/dist/esm/{result-list-36cfb08a.js → result-list-16c6afbd.js} +46 -2
- package/dist/esm/search-bar-6fad2f2e.js +351 -0
- package/dist/esm/{select-75ed5653.js → select-d4e135b7.js} +27 -4
- package/dist/esm/{text-field-e542da25.js → text-field-32ac877e.js} +1 -0
- package/dist/esm/{tooltip-14b65fb5.js → tooltip-933da261.js} +58 -19
- package/dist/esm/vertex-badge.entry.js +3 -0
- package/dist/esm/vertex-icon-button.entry.js +2 -2
- package/dist/esm/vertex-icon.entry.js +2 -2
- package/dist/esm/vertex-popover.entry.js +1 -1
- package/dist/esm/vertex-result-list.entry.js +1 -1
- package/dist/esm/vertex-search-bar.entry.js +1 -1
- package/dist/esm/vertex-select.entry.js +1 -1
- package/dist/esm/vertex-textfield.entry.js +1 -1
- package/dist/esm/vertex-tooltip.entry.js +1 -1
- package/dist/types/components/badge/badge.d.ts +14 -0
- package/dist/types/components/icon/icons/comment-filled.d.ts +3 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/popover/popover.d.ts +7 -0
- package/dist/types/components/result-list/result-list.d.ts +9 -1
- package/dist/types/components/search-bar/dom.d.ts +3 -0
- package/dist/types/components/search-bar/lib.d.ts +12 -6
- package/dist/types/components/search-bar/search-bar.d.ts +98 -41
- package/dist/types/components/select/select.d.ts +8 -0
- package/dist/types/components/tooltip/tooltip.d.ts +7 -0
- package/dist/types/components.d.ts +111 -16
- package/dist/types/types/icon.d.ts +1 -0
- package/dist/types/util/templates/element-pool.d.ts +10 -1
- package/package.json +2 -2
- package/dist/cjs/icon-button-f868bf06.js +0 -43
- package/dist/cjs/search-bar-bb40cfa7.js +0 -290
- package/dist/components/p-19318fee.entry.js +0 -1
- package/dist/components/p-209db2ba.entry.js +0 -1
- package/dist/components/p-4224c2ad.js +0 -1
- package/dist/components/p-45cfd66e.entry.js +0 -1
- package/dist/components/p-52739247.js +0 -1
- package/dist/components/p-552c128f.js +0 -1
- package/dist/components/p-6505cdb3.js +0 -1
- package/dist/components/p-79fd6fb6.entry.js +0 -1
- package/dist/components/p-94168b92.js +0 -1
- package/dist/components/p-ae6a3c46.entry.js +0 -1
- package/dist/components/p-bd11e7d1.js +0 -1
- package/dist/components/p-da0a7b57.js +0 -1
- package/dist/components/p-e576818b.entry.js +0 -1
- package/dist/components/p-ebabee40.entry.js +0 -1
- package/dist/components/p-ee8b96b2.js +0 -1
- package/dist/components/p-f900d0f4.entry.js +0 -1
- package/dist/esm/icon-button-25edf617.js +0 -41
- package/dist/esm/search-bar-59cc151d.js +0 -288
|
@@ -1,94 +1,73 @@
|
|
|
1
1
|
import { h, Host, } from '@stencil/core';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { generateInstanceFromTemplate } from '../../util/templates/templates';
|
|
4
|
-
import { createDocumentRange, createTextNode, getWindowSelection
|
|
4
|
+
import { createDocumentRange, createTextNode, getWindowSelection } from './dom';
|
|
5
|
+
import { createResultUrn, createSearchResultReplacement, getNodesForSearchResultReplacement, trimNonstandardSpaces, } from './lib';
|
|
5
6
|
export class SearchBar {
|
|
6
7
|
constructor() {
|
|
7
|
-
this.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
this.
|
|
11
|
-
this.triggerKey = event.key;
|
|
12
|
-
this.updateCursorPosition();
|
|
13
|
-
this.triggerCharacterPressed.emit('');
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
this.restartTriggerInput();
|
|
17
|
-
}
|
|
18
|
-
if (event.key === 'Backspace') {
|
|
19
|
-
const selection = getWindowSelection();
|
|
20
|
-
if (selection && (selection === null || selection === void 0 ? void 0 : selection.rangeCount) > 0) {
|
|
21
|
-
const range = selection.getRangeAt(0);
|
|
22
|
-
range.deleteContents();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
this.valueChanged.emit();
|
|
8
|
+
this.rawElements = [];
|
|
9
|
+
this.isIdenticalElement = (child, other) => {
|
|
10
|
+
return (child === this.triggeredElement ||
|
|
11
|
+
this.getTextContent(child) === this.getTextContent(other));
|
|
26
12
|
};
|
|
27
|
-
this.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (event.key === 'Enter') {
|
|
32
|
-
this.clearTriggerState();
|
|
13
|
+
this.getTextContent = (node) => {
|
|
14
|
+
var _a;
|
|
15
|
+
if (node instanceof HTMLElement) {
|
|
16
|
+
return node.innerText;
|
|
33
17
|
}
|
|
34
|
-
|
|
18
|
+
return (_a = node.textContent) !== null && _a !== void 0 ? _a : '';
|
|
35
19
|
};
|
|
36
|
-
this.
|
|
37
|
-
var _a, _b, _c
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
this.
|
|
20
|
+
this.handleCursorPositionUpdate = () => {
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
const windowRange = (_a = getWindowSelection()) === null || _a === void 0 ? void 0 : _a.getRangeAt(0);
|
|
23
|
+
if (windowRange != null) {
|
|
24
|
+
if (!this.hasTriggered) {
|
|
25
|
+
const triggerText = this.readTriggerValue((_b = windowRange.commonAncestorContainer.textContent) !== null && _b !== void 0 ? _b : '', windowRange.startOffset);
|
|
26
|
+
if (triggerText != null) {
|
|
27
|
+
this.hasTriggered = true;
|
|
28
|
+
this.triggeredRange = windowRange;
|
|
29
|
+
this.triggeredElement = windowRange.commonAncestorContainer;
|
|
30
|
+
this.searchChanged.emit(triggerText.replace(this.triggerCharacter, ''));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else if (this.hasTriggered) {
|
|
34
|
+
const triggerText = this.readTriggerValue((_c = windowRange.commonAncestorContainer.textContent) !== null && _c !== void 0 ? _c : '', windowRange.startOffset);
|
|
35
|
+
if (triggerText != null) {
|
|
36
|
+
this.triggeredRange = windowRange;
|
|
37
|
+
this.triggeredElement = windowRange.commonAncestorContainer;
|
|
38
|
+
this.searchChanged.emit(triggerText.replace(this.triggerCharacter, ''));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
this.hasTriggered = false;
|
|
42
|
+
this.triggeredRange = undefined;
|
|
43
|
+
this.triggeredElement = undefined;
|
|
44
|
+
}
|
|
51
45
|
}
|
|
52
46
|
}
|
|
47
|
+
this.cursorPosition = this.getCursorPosition();
|
|
53
48
|
};
|
|
54
|
-
this.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
this.readTriggerValue = (value, fromIndex) => {
|
|
50
|
+
const adjustedValue = value.replace(String.fromCharCode(160), ' ');
|
|
51
|
+
const beforeSubstr = adjustedValue.substring(0, fromIndex);
|
|
52
|
+
const afterSubstr = adjustedValue.substring(fromIndex);
|
|
53
|
+
const adjustedBeforeSubstr = beforeSubstr.includes(this.triggerCharacter)
|
|
54
|
+
? beforeSubstr.substring(beforeSubstr.lastIndexOf(this.triggerCharacter))
|
|
55
|
+
: '';
|
|
56
|
+
const adjustedAfterSubstr = afterSubstr.substring(0, this.firstIndexOfBreakCharacter(afterSubstr));
|
|
57
|
+
const result = `${adjustedBeforeSubstr}${adjustedAfterSubstr}`;
|
|
58
|
+
return result.includes(this.triggerCharacter) &&
|
|
59
|
+
!this.includesBreakCharacter(result)
|
|
60
|
+
? result
|
|
61
|
+
: undefined;
|
|
63
62
|
};
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
66
|
-
this.triggerTimeout = setTimeout(() => {
|
|
67
|
-
if (this.triggerRange != null && this.triggerKey != null) {
|
|
68
|
-
this.triggerCharacterPressed.emit(this.triggerText());
|
|
69
|
-
}
|
|
70
|
-
this.triggerTimeout = undefined;
|
|
71
|
-
}, this.debounce);
|
|
63
|
+
this.includesBreakCharacter = (value) => {
|
|
64
|
+
return this.breakCharacters.some((bc) => value.includes(bc));
|
|
72
65
|
};
|
|
73
|
-
this.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
79
|
-
this.updateCursorPosition = () => {
|
|
80
|
-
var _a;
|
|
81
|
-
const selection = getWindowSelection();
|
|
82
|
-
if (selection != null && selection.rangeCount > 0) {
|
|
83
|
-
const cursorBounds = selection.getRangeAt(0).getBoundingClientRect();
|
|
84
|
-
const inputBounds = (_a = this.contentEl) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
85
|
-
const cursorBottom = cursorBounds.bottom || (inputBounds === null || inputBounds === void 0 ? void 0 : inputBounds.bottom) || 0;
|
|
86
|
-
const cursorTop = cursorBounds.top || (inputBounds === null || inputBounds === void 0 ? void 0 : inputBounds.top) || 0;
|
|
87
|
-
this.cursorPosition = {
|
|
88
|
-
x: cursorBounds.left || (inputBounds === null || inputBounds === void 0 ? void 0 : inputBounds.left) || 0,
|
|
89
|
-
y: this.placement.includes('top') ? cursorTop : cursorBottom,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
66
|
+
this.firstIndexOfBreakCharacter = (value) => {
|
|
67
|
+
const indices = this.breakCharacters
|
|
68
|
+
.map((bc) => value.indexOf(bc))
|
|
69
|
+
.filter((i) => i >= 0);
|
|
70
|
+
return indices.length > 0 ? Math.min(...indices) : value.length;
|
|
92
71
|
};
|
|
93
72
|
this.moveCursorToNodeEnd = (node, collapseToStart = false) => {
|
|
94
73
|
const selection = getWindowSelection();
|
|
@@ -100,143 +79,124 @@ export class SearchBar {
|
|
|
100
79
|
selection.addRange(range);
|
|
101
80
|
}
|
|
102
81
|
};
|
|
103
|
-
this.
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
82
|
+
this.getContentAsString = () => {
|
|
83
|
+
if (this.contentEl != null) {
|
|
84
|
+
return trimNonstandardSpaces(Array.from(this.contentEl.childNodes).reduce((res, n) => {
|
|
85
|
+
var _a;
|
|
86
|
+
if (n instanceof HTMLElement &&
|
|
87
|
+
n.getAttribute('data-replaced') === 'true') {
|
|
88
|
+
return `${res}${n.getAttribute('data-original')}`;
|
|
89
|
+
}
|
|
90
|
+
else if (n instanceof HTMLElement) {
|
|
91
|
+
return `${res}${n.innerText}`;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
return `${res}${(_a = n.textContent) !== null && _a !== void 0 ? _a : ''}`;
|
|
95
|
+
}
|
|
96
|
+
}, ''));
|
|
111
97
|
}
|
|
98
|
+
return '';
|
|
112
99
|
};
|
|
113
|
-
this.createReplacedElement = (data) => {
|
|
100
|
+
this.createReplacedElement = (original, data) => {
|
|
114
101
|
const template = this.hostEl.querySelector('template[slot="replaced"]');
|
|
115
102
|
if (template != null) {
|
|
116
103
|
const instance = generateInstanceFromTemplate(template);
|
|
117
104
|
instance.bindings.bind(data);
|
|
105
|
+
instance.element.id = data.id;
|
|
118
106
|
instance.element.style.display = 'inline-block';
|
|
119
107
|
instance.element.contentEditable = 'false';
|
|
108
|
+
instance.element.tabIndex = -1;
|
|
120
109
|
instance.element.setAttribute('data-replaced', 'true');
|
|
110
|
+
instance.element.setAttribute('data-original', original);
|
|
121
111
|
return instance.element;
|
|
122
112
|
}
|
|
123
113
|
else {
|
|
124
114
|
throw new Error('Replaced template not defined.');
|
|
125
115
|
}
|
|
126
116
|
};
|
|
127
|
-
this.handleSelectionChange = () => {
|
|
128
|
-
this.updateTriggerState(this.getSelectionSubstring());
|
|
129
|
-
};
|
|
130
|
-
this.getSelectionSubstring = () => {
|
|
131
|
-
var _a;
|
|
132
|
-
const selection = getWindowSelection();
|
|
133
|
-
if (selection != null && selection.rangeCount > 0) {
|
|
134
|
-
const range = selection.getRangeAt(0);
|
|
135
|
-
this.updateTriggerRange();
|
|
136
|
-
if (range != null &&
|
|
137
|
-
range.startOffset === range.endOffset &&
|
|
138
|
-
isTextNode(range.startContainer) &&
|
|
139
|
-
range.startContainer.textContent != null &&
|
|
140
|
-
!isReplacedElement(range.startContainer.parentElement) &&
|
|
141
|
-
((_a = this.contentEl) === null || _a === void 0 ? void 0 : _a.contains(range.startContainer))) {
|
|
142
|
-
return range.startContainer.textContent.slice(this.lastIndexOfBreakCharacter(range.startContainer.textContent.slice(0, range.startOffset)) + 1, range.startOffset);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return '';
|
|
146
|
-
};
|
|
147
|
-
this.insertAdjacentTextNode = (el) => {
|
|
148
|
-
el.insertAdjacentText('afterend', '');
|
|
149
|
-
if (el.nextSibling != null) {
|
|
150
|
-
this.moveCursorToNodeEnd(el.nextSibling);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
this.updateTriggerState = (text) => {
|
|
154
|
-
const triggers = this.triggerCharacter != null
|
|
155
|
-
? [...this.triggerCharacters, this.triggerCharacter]
|
|
156
|
-
: this.triggerCharacters;
|
|
157
|
-
const trigger = triggers.find((tc) => text.includes(tc));
|
|
158
|
-
if (trigger != null) {
|
|
159
|
-
this.restartTriggerInput();
|
|
160
|
-
this.triggerKey = trigger;
|
|
161
|
-
this.updateTriggerRange();
|
|
162
|
-
if (this.cursorPosition == null) {
|
|
163
|
-
this.updateCursorPosition();
|
|
164
|
-
}
|
|
165
|
-
this.open = true;
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
this.clearTriggerState();
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
this.updateTriggerRange = () => {
|
|
172
|
-
var _a;
|
|
173
|
-
const selection = getWindowSelection();
|
|
174
|
-
if (selection != null && selection.rangeCount > 0) {
|
|
175
|
-
const range = selection.getRangeAt(0);
|
|
176
|
-
if (this.triggerKey != null) {
|
|
177
|
-
this.triggerRange = (_a = this.triggerRange) !== null && _a !== void 0 ? _a : range.cloneRange();
|
|
178
|
-
this.triggerRange.setEnd(range.endContainer, range.endOffset);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
this.clearTriggerState = () => {
|
|
183
|
-
this.triggerKey = undefined;
|
|
184
|
-
this.triggerRange = undefined;
|
|
185
|
-
this.cursorPosition = undefined;
|
|
186
|
-
this.open = false;
|
|
187
|
-
this.clearTriggerTimeout();
|
|
188
|
-
};
|
|
189
|
-
this.lastIndexOfBreakCharacter = (search) => {
|
|
190
|
-
const index = this.breakCharacters.reduce((index, bc) => {
|
|
191
|
-
const searchIndex = search
|
|
192
|
-
.replace(String.fromCharCode(160), ' ')
|
|
193
|
-
.lastIndexOf(bc);
|
|
194
|
-
return searchIndex > index ? searchIndex : index;
|
|
195
|
-
}, -1);
|
|
196
|
-
return index;
|
|
197
|
-
};
|
|
198
|
-
this.handleFocus = (ev) => {
|
|
199
|
-
this.inputFocus.emit(ev);
|
|
200
|
-
};
|
|
201
|
-
this.handleBlur = (ev) => {
|
|
202
|
-
this.open = false;
|
|
203
|
-
this.inputBlur.emit(ev);
|
|
204
|
-
};
|
|
205
|
-
this.handleInputPointerEvent = (ev) => {
|
|
206
|
-
if (ev.target != null) {
|
|
207
|
-
this.updateInputCursorPosition(ev.target);
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
this.handleResultPointerDown = (ev) => {
|
|
211
|
-
ev.preventDefault();
|
|
212
|
-
};
|
|
213
117
|
this.variant = 'standard';
|
|
118
|
+
this.disabled = false;
|
|
119
|
+
this.triggerCharacter = '@';
|
|
120
|
+
this.breakCharacters = [' ', '\n'];
|
|
214
121
|
this.resultItems = undefined;
|
|
215
|
-
this.triggerCharacters = [];
|
|
216
|
-
this.triggerCharacter = undefined;
|
|
217
|
-
this.breakCharacters = [' '];
|
|
218
|
-
this.debounce = 100;
|
|
219
|
-
this.placeholder = undefined;
|
|
220
122
|
this.placement = 'bottom-start';
|
|
221
|
-
this.
|
|
222
|
-
this.
|
|
223
|
-
this.
|
|
224
|
-
this.
|
|
123
|
+
this.value = undefined;
|
|
124
|
+
this.placeholder = undefined;
|
|
125
|
+
this.replacements = [];
|
|
126
|
+
this.cursorPosition = { x: 0, y: 0 };
|
|
127
|
+
this.displayedElements = [];
|
|
128
|
+
this.hasTriggered = false;
|
|
129
|
+
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
130
|
+
this.handleKeyUp = this.handleKeyUp.bind(this);
|
|
131
|
+
this.handleResultClick = this.handleResultClick.bind(this);
|
|
132
|
+
this.handleClick = this.handleClick.bind(this);
|
|
133
|
+
this.handleWindowClick = this.handleWindowClick.bind(this);
|
|
134
|
+
this.handleInput = this.handleInput.bind(this);
|
|
135
|
+
this.handleBlur = this.handleBlur.bind(this);
|
|
136
|
+
this.handleFocus = this.handleFocus.bind(this);
|
|
137
|
+
this.handleCursorPositionUpdate =
|
|
138
|
+
this.handleCursorPositionUpdate.bind(this);
|
|
139
|
+
this.updateContent = this.updateContent.bind(this);
|
|
140
|
+
this.replaceContent = this.replaceContent.bind(this);
|
|
141
|
+
}
|
|
142
|
+
componentDidLoad() {
|
|
143
|
+
this.replaceContent(this.value);
|
|
225
144
|
}
|
|
226
|
-
|
|
227
|
-
|
|
145
|
+
connectedCallback() {
|
|
146
|
+
window.addEventListener('click', this.handleWindowClick);
|
|
228
147
|
}
|
|
229
148
|
disconnectedCallback() {
|
|
230
|
-
|
|
149
|
+
window.removeEventListener('click', this.handleWindowClick);
|
|
231
150
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
151
|
+
replaceContent(newValue, oldValue) {
|
|
152
|
+
if (newValue != null && newValue !== oldValue) {
|
|
153
|
+
const matches = newValue.match(/[a-z]*:[0-9a-z-]{36}/g);
|
|
154
|
+
const replacementsMap = this.replacements.reduce((map, r) => (Object.assign(Object.assign({}, map), { [createResultUrn(r)]: r })), {});
|
|
155
|
+
let nextSubstr = newValue;
|
|
156
|
+
const parts = matches != null
|
|
157
|
+
? matches === null || matches === void 0 ? void 0 : matches.reduce((res, m) => {
|
|
158
|
+
if (replacementsMap[m] != null) {
|
|
159
|
+
const urn = createResultUrn(replacementsMap[m]);
|
|
160
|
+
const index = nextSubstr.indexOf(urn);
|
|
161
|
+
const before = nextSubstr.substring(0, index);
|
|
162
|
+
const after = nextSubstr.substring(index + urn.length);
|
|
163
|
+
const replacement = createSearchResultReplacement(replacementsMap[m], before);
|
|
164
|
+
nextSubstr = after;
|
|
165
|
+
return [
|
|
166
|
+
...res,
|
|
167
|
+
replacement.before,
|
|
168
|
+
replacement.beforeSpace,
|
|
169
|
+
replacement.result,
|
|
170
|
+
];
|
|
171
|
+
}
|
|
172
|
+
return res;
|
|
173
|
+
}, [])
|
|
174
|
+
: [];
|
|
175
|
+
this.rawElements = [...parts, createTextNode(nextSubstr)];
|
|
176
|
+
this.updateContent();
|
|
177
|
+
}
|
|
236
178
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
179
|
+
updateContent() {
|
|
180
|
+
if (this.contentEl != null) {
|
|
181
|
+
this.contentEl.innerHTML = '';
|
|
182
|
+
this.displayedElements = this.rawElements.map((el) => {
|
|
183
|
+
const raw = el instanceof HTMLElement ? el.innerText : el.textContent;
|
|
184
|
+
const replacement = this.replacements.find((r) => raw === null || raw === void 0 ? void 0 : raw.includes(r.id));
|
|
185
|
+
if (raw != null && replacement != null) {
|
|
186
|
+
const replacementElement = this.createReplacedElement(raw, replacement);
|
|
187
|
+
return replacementElement;
|
|
188
|
+
}
|
|
189
|
+
return el;
|
|
190
|
+
});
|
|
191
|
+
this.displayedElements.forEach((el) => {
|
|
192
|
+
var _a;
|
|
193
|
+
(_a = this.contentEl) === null || _a === void 0 ? void 0 : _a.appendChild(typeof el === 'string' ? createTextNode(el) : el);
|
|
194
|
+
});
|
|
195
|
+
if (this.lastReplacedSpace != null) {
|
|
196
|
+
this.moveCursorToNodeEnd(this.lastReplacedSpace);
|
|
197
|
+
}
|
|
198
|
+
this.inputChanged.emit(this.getContentAsString());
|
|
199
|
+
}
|
|
240
200
|
}
|
|
241
201
|
render() {
|
|
242
202
|
var _a;
|
|
@@ -245,11 +205,91 @@ export class SearchBar {
|
|
|
245
205
|
filled: this.variant === 'filled',
|
|
246
206
|
underlined: this.variant === 'underlined',
|
|
247
207
|
blank: this.variant === 'blank',
|
|
208
|
+
disabled: this.disabled,
|
|
248
209
|
});
|
|
249
|
-
return (h(Host, null, h("div", { class: classes }, h("span", { class: "content-input",
|
|
210
|
+
return (h(Host, null, h("div", { class: classes }, h("span", { class: "content-input", role: "textbox", contentEditable: "true", "aria-multiline": "true", "data-placeholder": this.placeholder, ref: (el) => (this.contentEl = el), onKeyDown: this.handleKeyDown, onKeyUp: this.handleCursorPositionUpdate, onClick: this.handleCursorPositionUpdate, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur })), h("vertex-result-list", { position: this.cursorPosition, placement: this.placement, open: this.hasTriggered &&
|
|
250
211
|
this.resultItems != null &&
|
|
251
|
-
this.resultItems.length > 0 &&
|
|
252
|
-
|
|
212
|
+
this.resultItems.length > 0, items: (_a = this.resultItems) !== null && _a !== void 0 ? _a : [], onEnterPressed: this.handleResultClick, onResultClick: this.handleResultClick }, h("slot", { name: "results" })), h("slot", { name: "replaced" })));
|
|
213
|
+
}
|
|
214
|
+
handleKeyDown(event) {
|
|
215
|
+
if (this.hasTriggered && this.breakCharacters.includes(event.key)) {
|
|
216
|
+
this.hasTriggered = false;
|
|
217
|
+
this.triggeredRange = undefined;
|
|
218
|
+
this.triggeredElement = undefined;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
handleKeyUp(event) {
|
|
222
|
+
this.handleCursorPositionUpdate();
|
|
223
|
+
this.cursorPosition = this.getCursorPosition();
|
|
224
|
+
}
|
|
225
|
+
async handleInput() {
|
|
226
|
+
this.inputChanged.emit(this.getContentAsString());
|
|
227
|
+
}
|
|
228
|
+
handleClick() {
|
|
229
|
+
this.handleCursorPositionUpdate();
|
|
230
|
+
}
|
|
231
|
+
handleWindowClick(event) {
|
|
232
|
+
if (event.target instanceof HTMLElement &&
|
|
233
|
+
event.target.getAttribute('data-replaced') === 'true' &&
|
|
234
|
+
event.target.nextSibling != null) {
|
|
235
|
+
this.moveCursorToNodeEnd(event.target.nextSibling, true);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
handleFocus(event) {
|
|
239
|
+
this.inputFocus.emit(event);
|
|
240
|
+
}
|
|
241
|
+
handleBlur(event) {
|
|
242
|
+
this.hasTriggered = false;
|
|
243
|
+
this.inputBlur.emit(event);
|
|
244
|
+
}
|
|
245
|
+
handleResultClick(event) {
|
|
246
|
+
var _a;
|
|
247
|
+
const triggeredRange = this.triggeredRange;
|
|
248
|
+
const triggeredElement = this.triggeredElement;
|
|
249
|
+
const value = triggeredElement instanceof HTMLElement
|
|
250
|
+
? triggeredElement.innerText
|
|
251
|
+
: triggeredElement === null || triggeredElement === void 0 ? void 0 : triggeredElement.textContent;
|
|
252
|
+
if (this.contentEl != null &&
|
|
253
|
+
triggeredRange != null &&
|
|
254
|
+
triggeredElement != null &&
|
|
255
|
+
value != null) {
|
|
256
|
+
const triggeredValue = (_a = this.readTriggerValue(value, triggeredRange.startOffset)) !== null && _a !== void 0 ? _a : '';
|
|
257
|
+
const split = value.split(triggeredValue);
|
|
258
|
+
const before = split[0];
|
|
259
|
+
const after = split[1];
|
|
260
|
+
const replacement = createSearchResultReplacement(event.detail, before, after);
|
|
261
|
+
this.lastReplacedSpace = replacement.afterSpace;
|
|
262
|
+
this.rawElements = Array.from(this.contentEl.childNodes).reduce((re, e) => {
|
|
263
|
+
// TODO: see if we can do anything about the collapse to single line in safari
|
|
264
|
+
if (this.isIdenticalElement(e, triggeredElement)) {
|
|
265
|
+
return [...re, ...getNodesForSearchResultReplacement(replacement)];
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
return [...re, e];
|
|
269
|
+
}
|
|
270
|
+
}, []);
|
|
271
|
+
this.hasTriggered = false;
|
|
272
|
+
this.replacements = [
|
|
273
|
+
...this.replacements.filter((r) => r.id !== event.detail.id),
|
|
274
|
+
event.detail,
|
|
275
|
+
];
|
|
276
|
+
this.resultReplaced.emit(event.detail);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
getCursorPosition() {
|
|
280
|
+
var _a;
|
|
281
|
+
const selection = getWindowSelection();
|
|
282
|
+
if (selection != null && selection.rangeCount > 0) {
|
|
283
|
+
const cursorBounds = selection.getRangeAt(0).getBoundingClientRect();
|
|
284
|
+
const contentBounds = (_a = this.contentEl) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
285
|
+
const cursorBottom = cursorBounds.bottom || (contentBounds === null || contentBounds === void 0 ? void 0 : contentBounds.bottom) || 0;
|
|
286
|
+
const cursorTop = cursorBounds.top || (contentBounds === null || contentBounds === void 0 ? void 0 : contentBounds.top) || 0;
|
|
287
|
+
return {
|
|
288
|
+
x: cursorBounds.left || (contentBounds === null || contentBounds === void 0 ? void 0 : contentBounds.left) || 0,
|
|
289
|
+
y: this.placement.includes('top') ? cursorTop : cursorBottom,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
throw new Error('Unable to retrieve window selection.');
|
|
253
293
|
}
|
|
254
294
|
static get is() { return "vertex-search-bar"; }
|
|
255
295
|
static get encapsulation() { return "scoped"; }
|
|
@@ -281,64 +321,47 @@ export class SearchBar {
|
|
|
281
321
|
"optional": false,
|
|
282
322
|
"docs": {
|
|
283
323
|
"tags": [],
|
|
284
|
-
"text": ""
|
|
324
|
+
"text": "The search bar variant to display.\n\nPossible options are:\n- 'standard' (default)\n- 'filled'\n- 'underlined'\n- 'blank"
|
|
285
325
|
},
|
|
286
326
|
"attribute": "variant",
|
|
287
327
|
"reflect": false,
|
|
288
328
|
"defaultValue": "'standard'"
|
|
289
329
|
},
|
|
290
|
-
"
|
|
291
|
-
"type": "
|
|
292
|
-
"mutable": false,
|
|
293
|
-
"complexType": {
|
|
294
|
-
"original": "Result[]",
|
|
295
|
-
"resolved": "Result[] | undefined",
|
|
296
|
-
"references": {
|
|
297
|
-
"Result": {
|
|
298
|
-
"location": "import",
|
|
299
|
-
"path": "../result-list/result-list"
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
"required": false,
|
|
304
|
-
"optional": true,
|
|
305
|
-
"docs": {
|
|
306
|
-
"tags": [],
|
|
307
|
-
"text": ""
|
|
308
|
-
}
|
|
309
|
-
},
|
|
310
|
-
"triggerCharacters": {
|
|
311
|
-
"type": "unknown",
|
|
330
|
+
"disabled": {
|
|
331
|
+
"type": "boolean",
|
|
312
332
|
"mutable": false,
|
|
313
333
|
"complexType": {
|
|
314
|
-
"original": "
|
|
315
|
-
"resolved": "
|
|
334
|
+
"original": "boolean",
|
|
335
|
+
"resolved": "boolean",
|
|
316
336
|
"references": {}
|
|
317
337
|
},
|
|
318
338
|
"required": false,
|
|
319
339
|
"optional": false,
|
|
320
340
|
"docs": {
|
|
321
341
|
"tags": [],
|
|
322
|
-
"text": ""
|
|
342
|
+
"text": "Whether this search bar is disabled."
|
|
323
343
|
},
|
|
324
|
-
"
|
|
344
|
+
"attribute": "disabled",
|
|
345
|
+
"reflect": false,
|
|
346
|
+
"defaultValue": "false"
|
|
325
347
|
},
|
|
326
348
|
"triggerCharacter": {
|
|
327
349
|
"type": "string",
|
|
328
350
|
"mutable": false,
|
|
329
351
|
"complexType": {
|
|
330
352
|
"original": "string",
|
|
331
|
-
"resolved": "string
|
|
353
|
+
"resolved": "string",
|
|
332
354
|
"references": {}
|
|
333
355
|
},
|
|
334
356
|
"required": false,
|
|
335
|
-
"optional":
|
|
357
|
+
"optional": false,
|
|
336
358
|
"docs": {
|
|
337
359
|
"tags": [],
|
|
338
|
-
"text": ""
|
|
360
|
+
"text": "The character indicating that we should trigger a search.\n\nWhen this character is encountered, the text following it\n(omitting `breakCharacters`) will be emitted as a `searchChanged`\nevent."
|
|
339
361
|
},
|
|
340
362
|
"attribute": "trigger-character",
|
|
341
|
-
"reflect": false
|
|
363
|
+
"reflect": false,
|
|
364
|
+
"defaultValue": "'@'"
|
|
342
365
|
},
|
|
343
366
|
"breakCharacters": {
|
|
344
367
|
"type": "unknown",
|
|
@@ -352,29 +375,57 @@ export class SearchBar {
|
|
|
352
375
|
"optional": false,
|
|
353
376
|
"docs": {
|
|
354
377
|
"tags": [],
|
|
355
|
-
"text": ""
|
|
378
|
+
"text": "Characters that should trigger a \"break\" of the search. If\na value in this list is encountered when trying to parse back\nto the `triggerCharacter`, this will hide the result list."
|
|
356
379
|
},
|
|
357
|
-
"defaultValue": "[' ']"
|
|
380
|
+
"defaultValue": "[' ', '\\n']"
|
|
358
381
|
},
|
|
359
|
-
"
|
|
360
|
-
"type": "
|
|
382
|
+
"resultItems": {
|
|
383
|
+
"type": "unknown",
|
|
361
384
|
"mutable": false,
|
|
362
385
|
"complexType": {
|
|
363
|
-
"original": "
|
|
364
|
-
"resolved": "
|
|
365
|
-
"references": {
|
|
386
|
+
"original": "Result[]",
|
|
387
|
+
"resolved": "Result[] | undefined",
|
|
388
|
+
"references": {
|
|
389
|
+
"Result": {
|
|
390
|
+
"location": "import",
|
|
391
|
+
"path": "../result-list/result-list"
|
|
392
|
+
}
|
|
393
|
+
}
|
|
366
394
|
},
|
|
367
395
|
"required": false,
|
|
368
|
-
"optional":
|
|
396
|
+
"optional": true,
|
|
369
397
|
"docs": {
|
|
370
398
|
"tags": [],
|
|
371
|
-
"text": ""
|
|
399
|
+
"text": "The items to display in this search bar's `<vertex-result-list>`.\n\nThis can be used alongside the `searchChanged` event to query for\nresults to display."
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
"placement": {
|
|
403
|
+
"type": "string",
|
|
404
|
+
"mutable": false,
|
|
405
|
+
"complexType": {
|
|
406
|
+
"original": "PopoverPlacement",
|
|
407
|
+
"resolved": "\"bottom\" | \"bottom-end\" | \"bottom-start\" | \"left\" | \"left-end\" | \"left-start\" | \"right\" | \"right-end\" | \"right-start\" | \"top\" | \"top-end\" | \"top-start\"",
|
|
408
|
+
"references": {
|
|
409
|
+
"PopoverPlacement": {
|
|
410
|
+
"location": "import",
|
|
411
|
+
"path": "../popover/popover"
|
|
412
|
+
}
|
|
413
|
+
}
|
|
372
414
|
},
|
|
373
|
-
"
|
|
415
|
+
"required": false,
|
|
416
|
+
"optional": false,
|
|
417
|
+
"docs": {
|
|
418
|
+
"tags": [{
|
|
419
|
+
"name": "see",
|
|
420
|
+
"text": " (PopoverPlacement)"
|
|
421
|
+
}],
|
|
422
|
+
"text": "The placement of the result list for this search bar.\n\nCorresponds to the value for the underlying <vertex-popover>\nplacement value."
|
|
423
|
+
},
|
|
424
|
+
"attribute": "placement",
|
|
374
425
|
"reflect": false,
|
|
375
|
-
"defaultValue": "
|
|
426
|
+
"defaultValue": "'bottom-start'"
|
|
376
427
|
},
|
|
377
|
-
"
|
|
428
|
+
"value": {
|
|
378
429
|
"type": "string",
|
|
379
430
|
"mutable": false,
|
|
380
431
|
"complexType": {
|
|
@@ -386,21 +437,38 @@ export class SearchBar {
|
|
|
386
437
|
"optional": true,
|
|
387
438
|
"docs": {
|
|
388
439
|
"tags": [],
|
|
389
|
-
"text": "
|
|
440
|
+
"text": "The initial value of this search bar. This will be used in\ncombination with the value of `replacements` to display existing\nreplaced values."
|
|
390
441
|
},
|
|
391
|
-
"attribute": "
|
|
442
|
+
"attribute": "value",
|
|
392
443
|
"reflect": false
|
|
393
444
|
},
|
|
394
|
-
"
|
|
445
|
+
"placeholder": {
|
|
395
446
|
"type": "string",
|
|
396
447
|
"mutable": false,
|
|
397
448
|
"complexType": {
|
|
398
|
-
"original": "
|
|
399
|
-
"resolved": "
|
|
449
|
+
"original": "string",
|
|
450
|
+
"resolved": "string | undefined",
|
|
451
|
+
"references": {}
|
|
452
|
+
},
|
|
453
|
+
"required": false,
|
|
454
|
+
"optional": true,
|
|
455
|
+
"docs": {
|
|
456
|
+
"tags": [],
|
|
457
|
+
"text": "A placeholder to display when no text has been entered."
|
|
458
|
+
},
|
|
459
|
+
"attribute": "placeholder",
|
|
460
|
+
"reflect": false
|
|
461
|
+
},
|
|
462
|
+
"replacements": {
|
|
463
|
+
"type": "unknown",
|
|
464
|
+
"mutable": true,
|
|
465
|
+
"complexType": {
|
|
466
|
+
"original": "Result[]",
|
|
467
|
+
"resolved": "Result[]",
|
|
400
468
|
"references": {
|
|
401
|
-
"
|
|
469
|
+
"Result": {
|
|
402
470
|
"location": "import",
|
|
403
|
-
"path": "../
|
|
471
|
+
"path": "../result-list/result-list"
|
|
404
472
|
}
|
|
405
473
|
}
|
|
406
474
|
},
|
|
@@ -408,32 +476,29 @@ export class SearchBar {
|
|
|
408
476
|
"optional": false,
|
|
409
477
|
"docs": {
|
|
410
478
|
"tags": [],
|
|
411
|
-
"text": ""
|
|
479
|
+
"text": "Replaced result values. This will be used in combination with the\nvalue of `value` to display existing replaced values.\n\nThis value will be automatically updated as `Result`s are clicked\nwithin this search bar's `<vertex-result-list>`."
|
|
412
480
|
},
|
|
413
|
-
"
|
|
414
|
-
"reflect": false,
|
|
415
|
-
"defaultValue": "'bottom-start'"
|
|
481
|
+
"defaultValue": "[]"
|
|
416
482
|
}
|
|
417
483
|
};
|
|
418
484
|
}
|
|
419
485
|
static get states() {
|
|
420
486
|
return {
|
|
421
487
|
"cursorPosition": {},
|
|
422
|
-
"
|
|
423
|
-
"
|
|
424
|
-
"triggerRange": {}
|
|
488
|
+
"displayedElements": {},
|
|
489
|
+
"hasTriggered": {}
|
|
425
490
|
};
|
|
426
491
|
}
|
|
427
492
|
static get events() {
|
|
428
493
|
return [{
|
|
429
|
-
"method": "
|
|
430
|
-
"name": "
|
|
494
|
+
"method": "searchChanged",
|
|
495
|
+
"name": "searchChanged",
|
|
431
496
|
"bubbles": true,
|
|
432
497
|
"cancelable": true,
|
|
433
498
|
"composed": true,
|
|
434
499
|
"docs": {
|
|
435
500
|
"tags": [],
|
|
436
|
-
"text": ""
|
|
501
|
+
"text": "Emitted when the value of the current search triggered by\nthe specified `triggerCharacter` has changed."
|
|
437
502
|
},
|
|
438
503
|
"complexType": {
|
|
439
504
|
"original": "string",
|
|
@@ -441,48 +506,49 @@ export class SearchBar {
|
|
|
441
506
|
"references": {}
|
|
442
507
|
}
|
|
443
508
|
}, {
|
|
444
|
-
"method": "
|
|
445
|
-
"name": "
|
|
509
|
+
"method": "inputChanged",
|
|
510
|
+
"name": "inputChanged",
|
|
446
511
|
"bubbles": true,
|
|
447
512
|
"cancelable": true,
|
|
448
513
|
"composed": true,
|
|
449
514
|
"docs": {
|
|
450
515
|
"tags": [],
|
|
451
|
-
"text": "Emitted when the value has changed."
|
|
516
|
+
"text": "Emitted when the value of the input has changed."
|
|
452
517
|
},
|
|
453
518
|
"complexType": {
|
|
454
|
-
"original": "
|
|
455
|
-
"resolved": "
|
|
519
|
+
"original": "string",
|
|
520
|
+
"resolved": "string",
|
|
456
521
|
"references": {}
|
|
457
522
|
}
|
|
458
523
|
}, {
|
|
459
|
-
"method": "
|
|
460
|
-
"name": "
|
|
524
|
+
"method": "resultReplaced",
|
|
525
|
+
"name": "resultReplaced",
|
|
461
526
|
"bubbles": true,
|
|
462
527
|
"cancelable": true,
|
|
463
528
|
"composed": true,
|
|
464
529
|
"docs": {
|
|
465
530
|
"tags": [],
|
|
466
|
-
"text": "Emitted when
|
|
531
|
+
"text": "Emitted when a result has been selected to replace the trigger text.\n\nIncludes the ID of the `Result` selected."
|
|
467
532
|
},
|
|
468
533
|
"complexType": {
|
|
469
|
-
"original": "
|
|
470
|
-
"resolved": "
|
|
534
|
+
"original": "Result",
|
|
535
|
+
"resolved": "{ id: string; type: string; } & Record<string, unknown>",
|
|
471
536
|
"references": {
|
|
472
|
-
"
|
|
473
|
-
"location": "
|
|
537
|
+
"Result": {
|
|
538
|
+
"location": "import",
|
|
539
|
+
"path": "../result-list/result-list"
|
|
474
540
|
}
|
|
475
541
|
}
|
|
476
542
|
}
|
|
477
543
|
}, {
|
|
478
|
-
"method": "
|
|
479
|
-
"name": "
|
|
544
|
+
"method": "inputFocus",
|
|
545
|
+
"name": "inputFocus",
|
|
480
546
|
"bubbles": true,
|
|
481
547
|
"cancelable": true,
|
|
482
548
|
"composed": true,
|
|
483
549
|
"docs": {
|
|
484
550
|
"tags": [],
|
|
485
|
-
"text": "Emitted when input
|
|
551
|
+
"text": "Emitted when the input is focused."
|
|
486
552
|
},
|
|
487
553
|
"complexType": {
|
|
488
554
|
"original": "FocusEvent",
|
|
@@ -494,74 +560,34 @@ export class SearchBar {
|
|
|
494
560
|
}
|
|
495
561
|
}
|
|
496
562
|
}, {
|
|
497
|
-
"method": "
|
|
498
|
-
"name": "
|
|
563
|
+
"method": "inputBlur",
|
|
564
|
+
"name": "inputBlur",
|
|
499
565
|
"bubbles": true,
|
|
500
566
|
"cancelable": true,
|
|
501
567
|
"composed": true,
|
|
502
568
|
"docs": {
|
|
503
569
|
"tags": [],
|
|
504
|
-
"text": "Emitted when
|
|
570
|
+
"text": "Emitted when the input is blurred."
|
|
505
571
|
},
|
|
506
572
|
"complexType": {
|
|
507
|
-
"original": "
|
|
508
|
-
"resolved": "
|
|
573
|
+
"original": "FocusEvent",
|
|
574
|
+
"resolved": "FocusEvent",
|
|
509
575
|
"references": {
|
|
510
|
-
"
|
|
511
|
-
"location": "
|
|
512
|
-
"path": "../result-list/result-list"
|
|
576
|
+
"FocusEvent": {
|
|
577
|
+
"location": "global"
|
|
513
578
|
}
|
|
514
579
|
}
|
|
515
580
|
}
|
|
516
581
|
}];
|
|
517
582
|
}
|
|
518
|
-
static get methods() {
|
|
519
|
-
return {
|
|
520
|
-
"replaceTriggeredValue": {
|
|
521
|
-
"complexType": {
|
|
522
|
-
"signature": "(data: Record<string, unknown>) => Promise<void>",
|
|
523
|
-
"parameters": [{
|
|
524
|
-
"tags": [],
|
|
525
|
-
"text": ""
|
|
526
|
-
}],
|
|
527
|
-
"references": {
|
|
528
|
-
"Promise": {
|
|
529
|
-
"location": "global"
|
|
530
|
-
},
|
|
531
|
-
"Record": {
|
|
532
|
-
"location": "global"
|
|
533
|
-
}
|
|
534
|
-
},
|
|
535
|
-
"return": "Promise<void>"
|
|
536
|
-
},
|
|
537
|
-
"docs": {
|
|
538
|
-
"text": "",
|
|
539
|
-
"tags": []
|
|
540
|
-
}
|
|
541
|
-
},
|
|
542
|
-
"getEditableContent": {
|
|
543
|
-
"complexType": {
|
|
544
|
-
"signature": "() => Promise<NodeListOf<ChildNode> | undefined>",
|
|
545
|
-
"parameters": [],
|
|
546
|
-
"references": {
|
|
547
|
-
"Promise": {
|
|
548
|
-
"location": "global"
|
|
549
|
-
},
|
|
550
|
-
"NodeListOf": {
|
|
551
|
-
"location": "global"
|
|
552
|
-
},
|
|
553
|
-
"ChildNode": {
|
|
554
|
-
"location": "global"
|
|
555
|
-
}
|
|
556
|
-
},
|
|
557
|
-
"return": "Promise<NodeListOf<ChildNode> | undefined>"
|
|
558
|
-
},
|
|
559
|
-
"docs": {
|
|
560
|
-
"text": "",
|
|
561
|
-
"tags": []
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
583
|
static get elementRef() { return "hostEl"; }
|
|
584
|
+
static get watchers() {
|
|
585
|
+
return [{
|
|
586
|
+
"propName": "value",
|
|
587
|
+
"methodName": "replaceContent"
|
|
588
|
+
}, {
|
|
589
|
+
"propName": "replacements",
|
|
590
|
+
"methodName": "updateContent"
|
|
591
|
+
}];
|
|
592
|
+
}
|
|
567
593
|
}
|