@salesforcedevs/dx-components 0.43.3-tree-selected-scroll-2 → 0.44.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/LICENSE ADDED
@@ -0,0 +1,12 @@
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "0.43.3-tree-selected-scroll-2",
3
+ "version": "0.44.0",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -27,5 +27,6 @@
27
27
  "@types/debounce": "^1.2.0",
28
28
  "@types/lodash.get": "^4.4.6",
29
29
  "@types/vimeo__player": "^2.16.2"
30
- }
30
+ },
31
+ "gitHead": "86bac144ec8f2b4aea5909d2ef091e1e49888b04"
31
32
  }
@@ -254,4 +254,18 @@
254
254
  </g>
255
255
  </g>
256
256
  </symbol>
257
+ <symbol viewBox="0 0 56 45" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="revenue">
258
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
259
+ <g id="Sales-Revenue-Cloud-Icon-Square-2Color-RGB" fill-rule="nonzero">
260
+ <path d="M46.6,29.8 C46,29.2 45.8,28.2 46.3,27.4 C46.8,26.5 47.2,25.5 47.5,24.5 C47.7,23.6 48.5,23 49.4,23 L52,23 L52,19 L49.4,19 C48.5,19 47.7,18.4 47.5,17.5 C47.2,16.5 46.8,15.5 46.3,14.6 C45.9,13.8 46,12.8 46.6,12.2 L48.4,10.4 L45.6,7.6 L43.8,9.4 C43.2,10 42.2,10.2 41.4,9.7 C40.5,9.2 39.5,8.8 38.5,8.5 C37.6,8.3 37,7.5 37,6.6 L37,4 L33,4 L33,6.6 C33,7.5 32.4,8.3 31.5,8.5 C30.5,8.8 29.5,9.2 28.6,9.7 C27.8,10.1 26.8,10 26.2,9.4 L24.4,7.6 L21.6,10.4 L23.4,12.2 C24,12.8 24.2,13.8 23.7,14.6 C23.2,15.5 22.8,16.5 22.5,17.5 C22.3,18.4 21.5,19 20.6,19 L18,19 L18,23 L26.2,23 C26.1,22.4 26,21.7 26,21 C26,16 30,12 35,12 C40,12 44,16 44,21 C44,26 40,30 35,30 C34.3,30 33.7,29.9 33,29.8 L33,38.1 L37,38.1 L37,35.5 C37,34.6 37.6,33.8 38.5,33.6 C39.5,33.3 40.5,32.9 41.4,32.4 C42.2,32 43.2,32.1 43.8,32.7 L45.6,34.5 L48.4,31.7 L46.6,29.8 Z" id="Path" fill="#04E1CB"></path>
261
+ <path d="M39,0 C40.05,0 40.9177686,0.820041322 40.9944872,1.85130541 L41,2 L41,5.1 C41.225,5.175 41.50625,5.30625 41.759375,5.409375 L42,5.5 L44.2,3.3 C44.9578947,2.54210526 46.0747922,2.50221607 46.8704767,3.18033241 L47,3.3 L52.7,9 C53.1,9.4 53.3,9.9 53.3,10.4 C53.3,10.8444444 53.1419753,11.2888889 52.8259259,11.6631001 L52.7,11.8 L50.5,14 C50.575,14.225 50.70625,14.50625 50.809375,14.759375 L50.9,15 L54,15 C55.05,15 55.9177686,15.8200413 55.9944872,16.8513054 L56,17 L56,25 C56,25.5 55.8,26 55.4,26.4 C55.0444444,26.7555556 54.6098765,26.9530864 54.1665295,26.9925926 L54,27 L50.9,27 C50.825,27.225 50.69375,27.50625 50.590625,27.759375 L50.5,28 L52.7,30.2 C53.1,30.6 53.3,31.1 53.3,31.6 C53.3,32.0444444 53.1419753,32.4888889 52.8259259,32.8631001 L52.7,33 L47,38.7 C46.2421053,39.4578947 45.1252078,39.4977839 44.3295233,38.8196676 L44.2,38.7 L42,36.5 C41.775,36.575 41.49375,36.70625 41.240625,36.809375 L41,36.9 L41,40 C41,41.05 40.1799587,41.9177686 39.1486946,41.9944872 L39,42 L33,42 L33,43 C33,44.05 32.1799587,44.9177686 31.1486946,44.9944872 L31,45 L2,45 C0.95,45 0.082231405,44.1799587 0.00551277235,43.1486946 L0,43 L0,25 C0,23.95 0.820041322,23.0822314 1.85130541,23.0055128 L2,23 L14,23 L14,17 C14,15.95 14.8200413,15.0822314 15.8513054,15.0055128 L16,15 L19.1,15 C19.175,14.775 19.30625,14.49375 19.409375,14.240625 L19.5,14 L17.3,11.8 C16.5421053,11.0421053 16.5022161,9.92520776 17.1803324,9.12952325 L17.3,9 L23,3.3 C23.7578947,2.54210526 24.8747922,2.50221607 25.6704767,3.18033241 L25.8,3.3 L28,5.5 C28.225,5.425 28.50625,5.29375 28.759375,5.190625 L29,5.1 L29,2 C29,0.95 29.8200413,0.082231405 30.8513054,0.00551277235 L31,0 L39,0 Z M29,27 L4,27 L4,41 L29,41 L29,27 Z M35,16 C32.2385763,16 30,18.2385763 30,21 C30,23.7614237 32.2385763,26 35,26 C37.7614237,26 40,23.7614237 40,21 C40,18.2385763 37.7614237,16 35,16 Z" id="Combined-Shape" fill="#0B827C"></path>
262
+ <path d="M43.8,32.6 C43.2,32 42.2,31.8 41.4,32.3 C40.5,32.8 39.5,33.2 38.5,33.5 C37.6,33.7 37,34.5 37,35.4 L37,38 L33,38 L33,29.7 C33.6,29.8 34.3,29.9 35,29.9 C40,29.9 44,25.9 44,20.9 C44,15.9 40,11.9 35,11.9 C30,11.9 26,15.9 26,20.9 C26,21.6 26.1,22.3 26.2,22.9 L18,22.9 L18,18.9 L20.6,18.9 C21.5,18.9 22.3,18.3 22.5,17.4 C22.8,16.4 23.2,15.4 23.7,14.5 C24.1,13.7 24,12.7 23.4,12.1 L21.6,10.3 L24.4,7.5 L26.2,9.3 C26.8,9.9 27.8,10.1 28.6,9.6 C29.5,9.1 30.5,8.7 31.5,8.4 C32.4,8.2 33,7.4 33,6.5 L33,3.9 L37,3.9 L37,6.5 C37,7.4 37.6,8.2 38.5,8.4 C39.5,8.7 40.5,9.1 41.4,9.6 C42.2,10 43.2,9.9 43.8,9.3 L45.6,7.5 L48.4,10.3 L46.6,12.1 C46,12.7 45.8,13.7 46.3,14.5 C46.8,15.4 47.2,16.4 47.5,17.4 C47.7,18.3 48.5,18.9 49.4,18.9 L52,18.9 L52,22.9 L49.4,22.9 C48.5,22.9 47.7,23.5 47.5,24.4 C47.2,25.4 46.8,26.4 46.3,27.3 C45.9,28.1 46,29.1 46.6,29.7 L48.4,31.5 L45.6,34.5 L43.8,32.6 Z" id="Path" fill="#04E1CB"></path>
263
+ <path d="M29,27 L29,41 L4,41 L4,27 L29,27 Z M16.7,31.5 L16.5,31.5 C15.1,31.5 14,32.6 14,34 C14,35.4 15.1,36.5 16.5,36.5 C17.7,36.5 18.6,35.7 18.9,34.7 C19,34.4 19,34.2 19,34 C19,32.7 18,31.6 16.7,31.5 L16.7,31.5 Z" id="Combined-Shape" fill="#04E1CB"></path>
264
+ <path d="M25.8,33.1 C25.9,33.4 26,33.7 26,34 C26,35.1 25.1,36 24,36 C22.9,36 22,35.1 22,34 C22,33.5 22.2,33 22.5,32.6 C22.9,32.2 23.4,32 24,32 C24.8,32 25.4,32.4 25.8,33.1 Z" id="Path" fill="#04E1CB"></path>
265
+ <circle id="Oval" fill="#04E1CB" cx="9" cy="34" r="2"></circle>
266
+ <path d="M22,34 C22,35.1 22.9,36 24,36 C25.1,36 26,35.1 26,34 C26,33.7 25.9,33.3 25.8,33.1 C25.5,32.5 24.8,32 24,32 C23.4,32 22.9,32.2 22.5,32.6 C22.2,33 22,33.5 22,34 Z" id="Path" fill="#0B827C"></path>
267
+ <circle id="Oval" fill="#0B827C" cx="9" cy="34" r="2"></circle>
268
+ </g>
269
+ </g>
270
+ </symbol>
257
271
  </svg>
@@ -14,6 +14,7 @@ const VALID_BRANDS = [
14
14
  "marketing",
15
15
  "partners",
16
16
  "platform",
17
+ "revenue",
17
18
  "sales",
18
19
  "service",
19
20
  "success"
@@ -56,7 +56,6 @@
56
56
  shortcut-key="k"
57
57
  size="small"
58
58
  type="search"
59
- value={searchBox.value}
60
59
  ></dx-input>
61
60
  </dx-dropdown>
62
61
  </template>
@@ -88,7 +88,6 @@
88
88
  tree-root={tree.tree}
89
89
  onselect={onSelect}
90
90
  value={value}
91
- onselecteditemrendered={onSelectedItemRendered}
92
91
  ></dx-tree>
93
92
  </div>
94
93
  </div>
@@ -1,6 +1,6 @@
1
1
  import cx from "classnames";
2
2
  import { track as trackAnalytics } from "dx/instrumentation";
3
- import { api, track } from "lwc";
3
+ import { LightningElement, api, track } from "lwc";
4
4
  import {
5
5
  TreeNode,
6
6
  SidebarGtmAction,
@@ -9,12 +9,11 @@ import {
9
9
  import { getSidebarSearchParams } from "utils/coveo";
10
10
  import { toJson } from "utils/normalizers";
11
11
  import SidebarSearch from "dx/sidebarSearch";
12
- import { SidebarBase } from "base-elements/sidebarBase";
13
12
 
14
13
  const MOBILE_SIZE_MATCH = "768px";
15
14
  const TOGGLE_BUTTON_LABEL = "Toggle Sidebar";
16
15
 
17
- export default class Sidebar extends SidebarBase {
16
+ export default class Sidebar extends LightningElement {
18
17
  @api coveoOrganizationId!: string;
19
18
  @api coveoPublicAccessToken!: string;
20
19
  @api coveoSearchHub!: string;
@@ -49,7 +49,7 @@
49
49
  ></dx-input>
50
50
  </div>
51
51
  </div>
52
- <div class="sidebar-content sidebar-content-tree" if:true={anyResultMatch}>
52
+ <div class="sidebar-content" if:true={anyResultMatch}>
53
53
  <dx-tree
54
54
  for:each={filteredTrees}
55
55
  for:item="tree"
@@ -57,7 +57,6 @@
57
57
  tree-root={tree.tree}
58
58
  onselect={onSelect}
59
59
  value={value}
60
- onselecteditemrendered={onSelectedItemRendered}
61
60
  ></dx-tree>
62
61
  </div>
63
62
  <dx-empty-state
@@ -1,16 +1,15 @@
1
1
  import cx from "classnames";
2
2
  import { track } from "dx/instrumentation";
3
- import { api } from "lwc";
3
+ import { LightningElement, api } from "lwc";
4
4
 
5
5
  import { TreeNode, SidebarGtmAction } from "typings/custom";
6
6
  import { toJson } from "utils/normalizers";
7
- import { SidebarBase } from "base-elements/sidebarBase";
8
7
 
9
8
  const WAIT_TIME = 500;
10
9
  const MOBILE_SIZE_MATCH = "768px";
11
10
  const TOGGLE_BUTTON_LABEL = "Toggle Sidebar";
12
11
 
13
- export default class Sidebar extends SidebarBase {
12
+ export default class Sidebar extends LightningElement {
14
13
  @api header: string = "";
15
14
 
16
15
  @api
@@ -2,7 +2,6 @@ import { LightningElement, api } from "lwc";
2
2
  import { InternalTreeNode } from "typings/custom";
3
3
  import { track } from "dx/instrumentation";
4
4
  import { SidebarGtmAction } from "typings/custom";
5
- import { isInViewport } from "utils/browser";
6
5
 
7
6
  const DEFAULT_TARGET = "_self";
8
7
 
@@ -62,25 +61,6 @@ export default class TreeItem extends LightningElement {
62
61
  }
63
62
  }
64
63
 
65
- renderedCallback(): void {
66
- this.sendEventToParentIfSelected();
67
- }
68
-
69
- private sendEventToParentIfSelected(): void {
70
- /**
71
- * This is to send selected element reference to parent if it's not visible in the viewport
72
- * Parent component will use the elements offsetTop scrollTo that element's position
73
- */
74
- if (this.isSelected) {
75
- const element = this.template.querySelector("dx-tree-tile");
76
- if (element && !isInViewport(element)) {
77
- this.fireEvent("selecteditemrendered", {
78
- element
79
- });
80
- }
81
- }
82
- }
83
-
84
64
  private onIconClick(event: CustomEvent): void {
85
65
  const isSelectAction = false;
86
66
  this.doExpand(isSelectAction);
@@ -1,25 +0,0 @@
1
- import { LightningElement } from "lwc";
2
-
3
- const HEIGHT_OF_SIDEBAR_ITEM = 32;
4
-
5
- export class SidebarBase extends LightningElement {
6
- /*Scroll to selected tree item */
7
- private onSelectedItemRendered(event: CustomEvent) {
8
- event.preventDefault();
9
- const selectedTreeItem = event.detail.element;
10
- if (selectedTreeItem) {
11
- const sidebarContent = this.template.querySelector(
12
- ".sidebar-content-tree"
13
- );
14
- if (sidebarContent) {
15
- sidebarContent.scrollTo({
16
- top:
17
- selectedTreeItem.offsetTop +
18
- HEIGHT_OF_SIDEBAR_ITEM + // add height of sidebar item
19
- HEIGHT_OF_SIDEBAR_ITEM * 2, // add height of 2 more items so that user can see at least two more items after selected item
20
- behavior: "smooth"
21
- });
22
- }
23
- }
24
- }
25
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * Returns whether given element is in browser viewport or not
3
- */
4
- function isInViewport(element: HTMLElement): boolean {
5
- if (element) {
6
- const rect = element.getBoundingClientRect();
7
- return (
8
- rect.top >= 0 &&
9
- rect.left >= 0 &&
10
- rect.bottom <=
11
- (window.innerHeight || document.documentElement.clientHeight) &&
12
- rect.right <=
13
- (window.innerWidth || document.documentElement.clientWidth)
14
- );
15
- }
16
- return false;
17
- }
18
-
19
- export { isInViewport };