@salesforcedevs/dx-components 0.19.2 → 0.19.3-alpha.12
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.3-alpha.12",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -28,6 +28,5 @@
|
|
|
28
28
|
"@types/classnames": "^2.2.10",
|
|
29
29
|
"@types/debounce": "^1.2.0",
|
|
30
30
|
"@types/lodash.get": "^4.4.6"
|
|
31
|
-
}
|
|
32
|
-
"gitHead": "8bfc13904276093b75868ad2c4d9003d74873fbb"
|
|
31
|
+
}
|
|
33
32
|
}
|
package/src/.DS_Store
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -27,6 +27,7 @@ export const SESSION_KEY = "dx-sidebar-search-state";
|
|
|
27
27
|
|
|
28
28
|
const DEFAULT_RESULT_COUNT = 20;
|
|
29
29
|
const SEARCH_DEBOUNCE_DELAY = 780;
|
|
30
|
+
const HIGHLIGHT_DEBOUNCE_DELAY = 200;
|
|
30
31
|
|
|
31
32
|
const UserRecentSearches = new RecentSearches();
|
|
32
33
|
|
|
@@ -217,10 +218,6 @@ export default class SidebarSearch extends LightningElement {
|
|
|
217
218
|
this.onResultListChange
|
|
218
219
|
);
|
|
219
220
|
|
|
220
|
-
if (this.value) {
|
|
221
|
-
this.dispatchHighlightedTermChange();
|
|
222
|
-
}
|
|
223
|
-
|
|
224
221
|
if (!this.preloadedState) {
|
|
225
222
|
if (this.value) {
|
|
226
223
|
this.submitSearch();
|
|
@@ -291,7 +288,10 @@ export default class SidebarSearch extends LightningElement {
|
|
|
291
288
|
} else {
|
|
292
289
|
const isNestedGuide = clickUri.includes("/guide/");
|
|
293
290
|
const url = new URL(clickUri);
|
|
294
|
-
const extension =
|
|
291
|
+
const extension =
|
|
292
|
+
isNestedGuide && !url.pathname?.endsWith(".html")
|
|
293
|
+
? ".html"
|
|
294
|
+
: "";
|
|
295
295
|
pathname = `${url.pathname}${extension}`;
|
|
296
296
|
}
|
|
297
297
|
|
|
@@ -334,7 +334,7 @@ export default class SidebarSearch extends LightningElement {
|
|
|
334
334
|
this.dispatchEvent(new CustomEvent("loading", { detail: loading }));
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
-
private dispatchHighlightedTermChange() {
|
|
337
|
+
private dispatchHighlightedTermChange = debounce(() => {
|
|
338
338
|
this.dispatchEvent(
|
|
339
339
|
new CustomEvent("highlightedtermchange", {
|
|
340
340
|
detail: this.value,
|
|
@@ -342,7 +342,7 @@ export default class SidebarSearch extends LightningElement {
|
|
|
342
342
|
bubbles: true
|
|
343
343
|
})
|
|
344
344
|
);
|
|
345
|
-
}
|
|
345
|
+
}, HIGHLIGHT_DEBOUNCE_DELAY);
|
|
346
346
|
|
|
347
347
|
private updateRecentSearches = () =>
|
|
348
348
|
(this.recentSearches = UserRecentSearches.get().map((item: string) => ({
|
|
@@ -2,6 +2,10 @@ import { createSearchRegExp } from "utils/regexps";
|
|
|
2
2
|
|
|
3
3
|
const MARK_TAGS = /<\/?mark>/gi;
|
|
4
4
|
|
|
5
|
+
// mark tags not being removed from ref page
|
|
6
|
+
// mark tags dif color on ref page
|
|
7
|
+
// need to reset to first match on highlight change
|
|
8
|
+
|
|
5
9
|
export const highlightTerms = (
|
|
6
10
|
// eslint-disable-next-line no-undef
|
|
7
11
|
elements: NodeListOf<Element>,
|
|
@@ -9,6 +13,7 @@ export const highlightTerms = (
|
|
|
9
13
|
): void => {
|
|
10
14
|
searchTerm = searchTerm.trim();
|
|
11
15
|
const searchExp = createSearchRegExp(searchTerm);
|
|
16
|
+
let scrolled = false;
|
|
12
17
|
elements.forEach((element) => {
|
|
13
18
|
if (
|
|
14
19
|
element?.innerHTML.includes("<dx-") ||
|
|
@@ -24,7 +29,20 @@ export const highlightTerms = (
|
|
|
24
29
|
);
|
|
25
30
|
|
|
26
31
|
if (searchTerm) {
|
|
27
|
-
|
|
32
|
+
try {
|
|
33
|
+
innerHtml = innerHtml.replace(searchExp, "<mark>$&</mark>");
|
|
34
|
+
} catch (e) {
|
|
35
|
+
console.error(e);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const mark = element.querySelector("mark");
|
|
40
|
+
|
|
41
|
+
console.log("should i scroll?");
|
|
42
|
+
if (mark && !scrolled) {
|
|
43
|
+
scrolled = true;
|
|
44
|
+
console.log("scrolling", element);
|
|
45
|
+
element.scrollIntoView({ block: "nearest" });
|
|
28
46
|
}
|
|
29
47
|
|
|
30
48
|
element.innerHTML = innerHtml;
|
package/LICENSE
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2020, Salesforce.com, Inc.
|
|
2
|
-
All rights reserved.
|
|
3
|
-
|
|
4
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
-
|
|
6
|
-
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
-
|
|
8
|
-
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
-
|
|
10
|
-
* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
11
|
-
|
|
12
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|