@empathyco/x-components 3.0.0-alpha.39 → 3.0.0-alpha.40

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.
Files changed (141) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/core/index.js +1 -1
  3. package/docs/API-reference/api/x-adapter.empathynextquery.md +1 -0
  4. package/docs/API-reference/api/x-adapter.empathynextquery.source.md +11 -0
  5. package/docs/API-reference/api/x-components.cancelfetchandsavesearchresponsewire.md +1 -1
  6. package/docs/API-reference/api/x-components.fetchandsavesearchresponsewire.md +1 -1
  7. package/docs/API-reference/api/x-components.getnewandupdatedkeys.md +27 -0
  8. package/docs/API-reference/api/x-components.increasepageappendingresults.md +1 -1
  9. package/docs/API-reference/api/x-components.md +7 -6
  10. package/docs/API-reference/api/x-components.resetappending.md +1 -1
  11. package/docs/API-reference/api/x-components.resetspellcheckquery.md +1 -1
  12. package/docs/API-reference/api/x-components.resetstatewire.md +13 -0
  13. package/docs/API-reference/api/x-components.saveoriginwire.md +1 -1
  14. package/docs/API-reference/api/x-components.scroll.md +1 -3
  15. package/docs/API-reference/api/x-components.scrollmixin.md +1 -0
  16. package/docs/API-reference/api/x-components.scrollmixin.reseton.md +13 -0
  17. package/docs/API-reference/api/x-components.searchactions.md +1 -0
  18. package/docs/API-reference/api/x-components.searchactions.resetstate.md +24 -0
  19. package/docs/API-reference/api/x-components.searchxevents.md +1 -0
  20. package/docs/API-reference/api/x-components.searchxevents.searchrequestupdated.md +13 -0
  21. package/docs/API-reference/api/x-components.setpagesize.md +1 -1
  22. package/docs/API-reference/api/x-components.setquerytagginginfo.md +13 -0
  23. package/docs/API-reference/api/x-components.setrelatedtags.md +1 -1
  24. package/docs/API-reference/api/x-components.setsearchextraparams.md +1 -1
  25. package/docs/API-reference/api/x-components.setsearchpage.md +1 -1
  26. package/docs/API-reference/api/x-components.setsearchquery.md +1 -1
  27. package/docs/API-reference/api/x-components.setselectedfilters.md +1 -1
  28. package/docs/API-reference/api/x-components.setsort.md +1 -1
  29. package/docs/API-reference/api/x-components.seturlparams.md +1 -1
  30. package/docs/API-reference/api/x-components.slidingpanel.md +2 -12
  31. package/docs/API-reference/api/x-components.slidingpanel.resetoncontentchange.md +13 -0
  32. package/docs/API-reference/api/x-components.slidingpanel.scrollfactor.md +1 -1
  33. package/docs/API-reference/api/x-components.slidingpanel.showbuttons.md +1 -1
  34. package/docs/API-reference/api/x-components.taggingmutations.md +1 -0
  35. package/docs/API-reference/api/x-components.taggingmutations.setquerytagginginfo.md +24 -0
  36. package/docs/API-reference/api/x-components.taggingstate.md +1 -0
  37. package/docs/API-reference/api/x-components.taggingstate.querytagginginfo.md +13 -0
  38. package/docs/API-reference/api/x-components.taggingxevents.md +1 -0
  39. package/docs/API-reference/api/x-components.taggingxevents.searchtaggingreceived.md +13 -0
  40. package/docs/API-reference/api/x-components.trackquerywire.md +1 -1
  41. package/docs/API-reference/api/x-components.watchedinternalsearchrequest.md +21 -0
  42. package/docs/API-reference/api/x-components.watchedinternalsearchrequest.newrequest.md +11 -0
  43. package/docs/API-reference/api/x-components.watchedinternalsearchrequest.oldrequest.md +11 -0
  44. package/docs/API-reference/api/x-components.wiremetadata.md +1 -0
  45. package/docs/API-reference/api/x-components.wiremetadata.oldvalue.md +13 -0
  46. package/docs/API-reference/api/x-types.nextquery.iscurated.md +13 -0
  47. package/docs/API-reference/api/x-types.nextquery.md +6 -0
  48. package/docs/API-reference/components/common/scroll/x-components.base-scroll.md +52 -33
  49. package/docs/API-reference/components/common/x-components.sliding-panel.md +192 -33
  50. package/docs/API-reference/components/scroll/x-components.scroll.md +5 -8
  51. package/js/components/scroll/base-scroll.vue.js +2 -2
  52. package/js/components/scroll/base-scroll.vue.js.map +1 -1
  53. package/js/components/scroll/scroll.mixin.js +12 -6
  54. package/js/components/scroll/scroll.mixin.js.map +1 -1
  55. package/js/components/sliding-panel.vue.js +2 -2
  56. package/js/components/sliding-panel.vue.js.map +1 -1
  57. package/js/components/sliding-panel.vue_rollup-plugin-vue=script.js +56 -40
  58. package/js/components/sliding-panel.vue_rollup-plugin-vue=script.js.map +1 -1
  59. package/js/index.js +3 -3
  60. package/js/plugins/x-emitters.js +3 -3
  61. package/js/plugins/x-emitters.js.map +1 -1
  62. package/js/utils/object.js +17 -1
  63. package/js/utils/object.js.map +1 -1
  64. package/js/x-modules/facets/wiring.js +3 -0
  65. package/js/x-modules/facets/wiring.js.map +1 -1
  66. package/js/x-modules/related-tags/wiring.js +3 -0
  67. package/js/x-modules/related-tags/wiring.js.map +1 -1
  68. package/js/x-modules/scroll/components/scroll.vue.js +14 -13
  69. package/js/x-modules/scroll/components/scroll.vue.js.map +1 -1
  70. package/js/x-modules/scroll/components/scroll.vue_rollup-plugin-vue=script.js +2 -9
  71. package/js/x-modules/scroll/components/scroll.vue_rollup-plugin-vue=script.js.map +1 -1
  72. package/js/x-modules/search/store/actions/increase-page-apending-results.action.js +1 -1
  73. package/js/x-modules/search/store/actions/increase-page-apending-results.action.js.map +1 -1
  74. package/js/x-modules/search/store/actions/reset-state.action.js +32 -0
  75. package/js/x-modules/search/store/actions/reset-state.action.js.map +1 -0
  76. package/js/x-modules/search/store/emitters.js +6 -0
  77. package/js/x-modules/search/store/emitters.js.map +1 -1
  78. package/js/x-modules/search/store/module.js +2 -0
  79. package/js/x-modules/search/store/module.js.map +1 -1
  80. package/js/x-modules/search/wiring.js +15 -32
  81. package/js/x-modules/search/wiring.js.map +1 -1
  82. package/js/x-modules/tagging/store/emitters.js +2 -4
  83. package/js/x-modules/tagging/store/emitters.js.map +1 -1
  84. package/js/x-modules/tagging/store/module.js +5 -1
  85. package/js/x-modules/tagging/store/module.js.map +1 -1
  86. package/js/x-modules/tagging/wiring.js +15 -6
  87. package/js/x-modules/tagging/wiring.js.map +1 -1
  88. package/package.json +4 -4
  89. package/report/x-adapter.api.json +26 -0
  90. package/report/x-components.api.json +449 -290
  91. package/report/x-components.api.md +51 -34
  92. package/report/x-types.api.json +28 -1
  93. package/search/index.js +1 -1
  94. package/tagging/index.js +1 -1
  95. package/types/components/scroll/scroll.mixin.d.ts +7 -0
  96. package/types/components/scroll/scroll.mixin.d.ts.map +1 -1
  97. package/types/components/sliding-panel.vue.d.ts +35 -18
  98. package/types/components/sliding-panel.vue.d.ts.map +1 -1
  99. package/types/utils/object.d.ts +11 -0
  100. package/types/utils/object.d.ts.map +1 -1
  101. package/types/wiring/wiring.types.d.ts +2 -0
  102. package/types/wiring/wiring.types.d.ts.map +1 -1
  103. package/types/x-modules/facets/wiring.d.ts +3 -0
  104. package/types/x-modules/facets/wiring.d.ts.map +1 -1
  105. package/types/x-modules/related-tags/wiring.d.ts +3 -0
  106. package/types/x-modules/related-tags/wiring.d.ts.map +1 -1
  107. package/types/x-modules/scroll/components/scroll.vue.d.ts +2 -17
  108. package/types/x-modules/scroll/components/scroll.vue.d.ts.map +1 -1
  109. package/types/x-modules/search/events.types.d.ts +5 -0
  110. package/types/x-modules/search/events.types.d.ts.map +1 -1
  111. package/types/x-modules/search/store/actions/reset-state.action.d.ts +11 -0
  112. package/types/x-modules/search/store/actions/reset-state.action.d.ts.map +1 -0
  113. package/types/x-modules/search/store/emitters.d.ts +4 -0
  114. package/types/x-modules/search/store/emitters.d.ts.map +1 -1
  115. package/types/x-modules/search/store/module.d.ts.map +1 -1
  116. package/types/x-modules/search/store/types.d.ts +7 -1
  117. package/types/x-modules/search/store/types.d.ts.map +1 -1
  118. package/types/x-modules/search/types.d.ts +10 -0
  119. package/types/x-modules/search/types.d.ts.map +1 -1
  120. package/types/x-modules/search/wiring.d.ts +37 -59
  121. package/types/x-modules/search/wiring.d.ts.map +1 -1
  122. package/types/x-modules/tagging/events.types.d.ts +6 -0
  123. package/types/x-modules/tagging/events.types.d.ts.map +1 -1
  124. package/types/x-modules/tagging/store/emitters.d.ts +1 -0
  125. package/types/x-modules/tagging/store/emitters.d.ts.map +1 -1
  126. package/types/x-modules/tagging/store/module.d.ts.map +1 -1
  127. package/types/x-modules/tagging/store/types.d.ts +10 -0
  128. package/types/x-modules/tagging/store/types.d.ts.map +1 -1
  129. package/types/x-modules/tagging/wiring.d.ts +14 -5
  130. package/types/x-modules/tagging/wiring.d.ts.map +1 -1
  131. package/docs/API-reference/api/x-components.resetfacets.md +0 -13
  132. package/docs/API-reference/api/x-components.resetpage.md +0 -13
  133. package/docs/API-reference/api/x-components.resetsort.md +0 -13
  134. package/docs/API-reference/api/x-components.scroll.distancetobottom.md +0 -13
  135. package/docs/API-reference/api/x-components.scroll.throttlems.md +0 -13
  136. package/docs/API-reference/api/x-components.slidingpanel._refs.md +0 -15
  137. package/docs/API-reference/api/x-components.slidingpanel.beforedestroy.md +0 -15
  138. package/docs/API-reference/api/x-components.slidingpanel.isscrollatend.md +0 -13
  139. package/docs/API-reference/api/x-components.slidingpanel.isscrollatstart.md +0 -13
  140. package/docs/API-reference/api/x-components.slidingpanel.mounted.md +0 -15
  141. package/docs/API-reference/api/x-components.slidingpanel.scrollobserver.md +0 -13
@@ -20,5 +20,6 @@ export interface WireMetadata
20
20
  | [id?](./x-components.wiremetadata.id.md) | string | <i>(Optional)</i> The id of the component origin. |
21
21
  | [location?](./x-components.wiremetadata.location.md) | [FeatureLocation](./x-components.featurelocation.md) | <i>(Optional)</i> The [FeatureLocation](./x-components.featurelocation.md) from where the event has been emitted. |
22
22
  | [moduleName](./x-components.wiremetadata.modulename.md) | [XModuleName](./x-components.xmodulename.md) \| null | The [XModule](./x-components.xmodule.md) name that emitted the event or <code>null</code> if it has been emitted from an unknown module. |
23
+ | [oldValue?](./x-components.wiremetadata.oldvalue.md) | unknown | <i>(Optional)</i> The old value of a watched selector triggering an emitter. |
23
24
  | [target?](./x-components.wiremetadata.target.md) | HTMLElement | <i>(Optional)</i> The DOM element that triggered the event emission. |
24
25
 
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [WireMetadata](./x-components.wiremetadata.md) &gt; [oldValue](./x-components.wiremetadata.oldvalue.md)
4
+
5
+ ## WireMetadata.oldValue property
6
+
7
+ The old value of a watched selector triggering an emitter.
8
+
9
+ <b>Signature:</b>
10
+
11
+ ```typescript
12
+ oldValue?: unknown;
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-types](./x-types.md) &gt; [NextQuery](./x-types.nextquery.md) &gt; [isCurated](./x-types.nextquery.iscurated.md)
4
+
5
+ ## NextQuery.isCurated property
6
+
7
+ If it's a curated next query.
8
+
9
+ <b>Signature:</b>
10
+
11
+ ```typescript
12
+ isCurated?: boolean;
13
+ ```
@@ -13,3 +13,9 @@ export interface NextQuery extends NamedModel<'NextQuery'>, Required<Previewable
13
13
  ```
14
14
  <b>Extends:</b> [NamedModel](./x-types.namedmodel.md)<!-- -->&lt;'NextQuery'&gt;, Required&lt;[Previewable](./x-types.previewable.md)<!-- -->&gt;
15
15
 
16
+ ## Properties
17
+
18
+ | Property | Type | Description |
19
+ | --- | --- | --- |
20
+ | [isCurated?](./x-types.nextquery.iscurated.md) | boolean | <i>(Optional)</i> If it's a curated next query. |
21
+
@@ -11,12 +11,13 @@ knowing when the user scrolls, the direction of scroll and if user reaches the s
11
11
 
12
12
  ## Props
13
13
 
14
- | Name | Description | Type | Default |
15
- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ----------------- |
16
- | <code>distanceToBottom</code> | Distance to the end of the scroll that when reached will emit the<br />`scroll:about-to-end` event. | <code>number</code> | <code>100</code> |
17
- | <code>firstElementThresholdPx</code> | Positive vertical distance to still consider that the an element is the first one visible.<br />For example, if set to 100, after scrolling 100 pixels, the first rendered element<br />will still be considered the first one. | <code>number</code> | <code>100</code> |
18
- | <code>throttleMs</code> | Time duration to ignore the subsequent scroll events after an emission.<br />Higher values will decrease events precision but can prevent performance issues. | <code>number</code> | <code>100</code> |
19
- | <code>resetOnChange</code> | If true (default), sets the scroll position to the top when certain events are emitted. | <code>boolean</code> | <code>true</code> |
14
+ | Name | Description | Type | Default |
15
+ | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
16
+ | <code>distanceToBottom</code> | Distance to the end of the scroll that when reached will emit the<br />`scroll:about-to-end` event. | <code>number</code> | <code>100</code> |
17
+ | <code>firstElementThresholdPx</code> | Positive vertical distance to still consider that the an element is the first one visible.<br />For example, if set to 100, after scrolling 100 pixels, the first rendered element<br />will still be considered the first one. | <code>number</code> | <code>100</code> |
18
+ | <code>throttleMs</code> | Time duration to ignore the subsequent scroll events after an emission.<br />Higher values will decrease events precision but can prevent performance issues. | <code>number</code> | <code>100</code> |
19
+ | <code>resetOnChange</code> | If true (default), sets the scroll position to the top when certain events are emitted. | <code>boolean</code> | <code>true</code> |
20
+ | <code>resetOn</code> | List of events that should reset the scroll when emitted. | <code>XEvent</code> | <code>() => [<br /> 'SearchBoxQueryChanged',<br /> 'SortChanged',<br /> 'SelectedFiltersChanged',<br /> 'SelectedRelatedTagsChanged',<br /> 'UserChangedExtraParams'<br />]</code> |
20
21
 
21
22
  ## Events
22
23
 
@@ -36,10 +37,10 @@ knowing when the user scrolls, the direction of scroll and if user reaches the s
36
37
 
37
38
  ## Example
38
39
 
39
- The BaseScroll is a component that manage the states of scroll of a specified element. The component
40
- does the necessary calculations for knowing the direction of scroll, if the scroll has reached to
41
- start or to end, and is about to reaching to end. The components emits the next events depending of
42
- movement that realize the user:
40
+ The `BaseScroll` is a component that manages the state of scroll of a specified element. The
41
+ component does the necessary calculations for knowing the direction of scroll, if the scroll has
42
+ reached to start or to end, and is about to reaching to end. The components emits the next events
43
+ depending of movement that realize the user:
43
44
 
44
45
  ```vue
45
46
  <template>
@@ -49,8 +50,8 @@ movement that realize the user:
49
50
  @scroll:at-start="scrollAtStart"
50
51
  @scroll:almost-at-end="scrollAlmostAtEnd"
51
52
  @scroll:at-end="scrollAtEnd"
52
- throttleMs="1000"
53
- distanceToBottom="200"
53
+ :throttleMs="1000"
54
+ :distanceToBottom="200"
54
55
  >
55
56
  <template>
56
57
  <div class="content-scroll">
@@ -96,15 +97,7 @@ Set to false the reset scroll on query change feature which is true by default.
96
97
 
97
98
  ```vue
98
99
  <template>
99
- <BaseScroll
100
- @scroll="scroll"
101
- @scroll:direction-change="scrollDirectionChange"
102
- @scroll:at-start="scrollAtStart"
103
- @scroll:almost-at-end="scrollAlmostAtEnd"
104
- @scroll:at-end="scrollAtEnd"
105
- throttleMs="1000"
106
- distanceToBottom="200"
107
- >
100
+ <BaseScroll @scroll="scroll" :resetOnChange="false">
108
101
  <template>
109
102
  <div class="content-scroll">
110
103
  <span>content1</span>
@@ -125,18 +118,44 @@ export default {
125
118
  methods: {
126
119
  scroll(position) {
127
120
  console.log("scroll", position);
128
- },
129
- scrollDirectionChange(direction) {
130
- console.log("scroll:direction-change", direction);
131
- },
132
- scrollAtStart() {
133
- console.log("scroll:at-start");
134
- },
135
- scrollAlmostAtEnd(distance) {
136
- console.log("scroll:almost-at-end", distance);
137
- },
138
- scrollAtEnd() {
139
- console.log("scroll:at-end");
121
+ }
122
+ }
123
+ };
124
+ </script>
125
+ ```
126
+
127
+ ### Reset scroll
128
+
129
+ You can configure which events reset the scroll position using the `resetOn` prop.
130
+
131
+ ```vue
132
+ <template>
133
+ <BaseScroll @scroll="scroll" :resetOn="resetScrollEvents">
134
+ <template>
135
+ <div class="content-scroll">
136
+ <span>content1</span>
137
+ <span>content1</span>
138
+ </div>
139
+ </template>
140
+ </BaseScroll>
141
+ </template>
142
+
143
+ <script>
144
+ import { BaseScroll } from "@empathyco/x-components";
145
+
146
+ export default {
147
+ name: "ScrollTest",
148
+ components: {
149
+ BaseScroll
150
+ },
151
+ data() {
152
+ return {
153
+ resetScrollEvents: ["UserAcceptedAQuery"]
154
+ };
155
+ },
156
+ methods: {
157
+ scroll(position) {
158
+ console.log("scroll", position);
140
159
  }
141
160
  }
142
161
  };
@@ -6,15 +6,17 @@ title: SlidingPanel
6
6
 
7
7
  # SlidingPanel
8
8
 
9
- Horizontal slide panel component. The content that is provided to this component would be
10
- navigable horizontally using two navigational buttons.
9
+ This component allows for any other component or element inside it to be horizontally
10
+ navigable. It also implements customizable buttons as well as other minor customizations to its
11
+ general behavior.
11
12
 
12
13
  ## Props
13
14
 
14
- | Name | Description | Type | Default |
15
- | ------------------------- | -------------------------------------------------------------------------------------------- | -------------------- | ----------------- |
16
- | <code>scrollFactor</code> | Scroll factor that will dictate how much the scroll moves when pressing a navigation button. | <code>number</code> | <code>0.7</code> |
17
- | <code>showButtons</code> | Would make the navigation buttons visible when they're needed or always hide them. | <code>boolean</code> | <code>true</code> |
15
+ | Name | Description | Type | Default |
16
+ | --------------------------------- | ------------------------------------------------------------------------------------------------------------------- | -------------------- | ----------------- |
17
+ | <code>scrollFactor</code> | Scroll factor that will dictate how much the scroll moves when pressing a navigation button. | <code>number</code> | <code>0.7</code> |
18
+ | <code>showButtons</code> | Would make the navigation buttons visible when they're needed or always hide them. | <code>boolean</code> | <code>true</code> |
19
+ | <code>resetOnContentChange</code> | When true, whenever the DOM content in the sliding panel slot changes, it will reset<br />the scroll position to 0. | <code>boolean</code> | <code>true</code> |
18
20
 
19
21
  ## Slots
20
22
 
@@ -24,57 +26,214 @@ navigable horizontally using two navigational buttons.
24
26
  | <code>default</code> | (Required) Sliding panel content | None |
25
27
  | <code>sliding-panel-right-button</code> | Right button content | None |
26
28
 
27
- ## Examples
29
+ ## Events
28
30
 
29
- This component allows for any other component or element inside it to be horizontally navigable. It
30
- also implements customizable buttons as well as other minor customizations to its general behavior.
31
- The component uses the method `scrollBy` from `Element` to function, and it doesn't work properly in
32
- all browsers. A polyfill for the `scrollBy` would be needed for the component to behave as expected
33
- in those browsers.
31
+ This component emits no events.
34
32
 
35
- ### Default usage
33
+ ## See it in action
36
34
 
37
35
  Simplest implementation of the component, just a list-based component inside its slot.
38
36
 
39
37
  ```vue
40
- <SlidingPanel>
41
- <RelatedTags />
42
- </SlidingPanel>
38
+ <template>
39
+ <SlidingPanel>
40
+ <div class="item">Item 1</div>
41
+ <div class="item">Item 2</div>
42
+ <div class="item">Item 3</div>
43
+ <div class="item">Item 4</div>
44
+ </SlidingPanel>
45
+ </template>
46
+
47
+ <script>
48
+ import { SlidingPanel } from "@empathyco/x-components";
49
+
50
+ export default {
51
+ name: "SlidingPanelDemo",
52
+ components: {
53
+ SlidingPanel
54
+ }
55
+ };
56
+ </script>
57
+
58
+ <style>
59
+ .x-sliding-panel {
60
+ width: 200px;
61
+ }
62
+
63
+ .item {
64
+ display: inline-block;
65
+ width: 100px;
66
+ }
67
+ </style>
43
68
  ```
44
69
 
45
- ### Behavior customization
70
+ ### Play with props
46
71
 
47
- Edit how much the scroll travels when navigating with the buttons by changing the `scrollFactor`.
72
+ #### Modifying scroll buttons travel distance
73
+
74
+ Edit how much the scroll travels when navigating with the buttons by changing the `scrollFactor`
75
+ prop.
48
76
 
49
77
  ```vue
50
- <SlidingPanel :scrollFactor="1.2">
51
- <RelatedTags />
52
- </SlidingPanel>
78
+ <template>
79
+ <SlidingPanel :scrollFactor="1.5">
80
+ <div class="item">Item 1</div>
81
+ <div class="item">Item 2</div>
82
+ <div class="item">Item 3</div>
83
+ <div class="item">Item 4</div>
84
+ </SlidingPanel>
85
+ </template>
86
+
87
+ <script>
88
+ import { SlidingPanel } from "@empathyco/x-components";
89
+
90
+ export default {
91
+ name: "SlidingPanelDemo",
92
+ components: {
93
+ SlidingPanel
94
+ }
95
+ };
96
+ </script>
97
+
98
+ <style>
99
+ .x-sliding-panel {
100
+ width: 200px;
101
+ }
102
+
103
+ .item {
104
+ display: inline-block;
105
+ width: 100px;
106
+ }
107
+ </style>
53
108
  ```
54
109
 
110
+ #### Hiding scroll buttons
111
+
55
112
  Hide the navigational buttons completely by setting the `showButtons` prop to `false`. This is
56
113
  intended to be used when other scrolling options are available, like in mobile, where you can scroll
57
114
  just by swiping.
58
115
 
59
116
  ```vue
60
- <SlidingPanel :showButtons="isMobile">
61
- <RelatedTags />
62
- </SlidingPanel>
117
+ <template>
118
+ <SlidingPanel :showButtons="false">
119
+ <div class="item">Item 1</div>
120
+ <div class="item">Item 2</div>
121
+ <div class="item">Item 3</div>
122
+ <div class="item">Item 4</div>
123
+ </SlidingPanel>
124
+ </template>
125
+
126
+ <script>
127
+ import { SlidingPanel } from "@empathyco/x-components";
128
+
129
+ export default {
130
+ name: "SlidingPanelDemo",
131
+ components: {
132
+ SlidingPanel
133
+ }
134
+ };
135
+ </script>
136
+
137
+ <style>
138
+ .x-sliding-panel {
139
+ width: 200px;
140
+ }
141
+
142
+ .item {
143
+ display: inline-block;
144
+ width: 100px;
145
+ }
146
+ </style>
147
+ ```
148
+
149
+ #### Disabling reset the scroll when content changes
150
+
151
+ By default, whenever the content of the sliding panel changes, it auto resets its scroll position.
152
+ You can disable this behavior setting the `resetOnContentChange` prop to `false`.
153
+
154
+ ```vue
155
+ <template>
156
+ <div>
157
+ <button @click="items++">Add item</button>
158
+ <label>
159
+ <input type="checkbox" v-model="resetOnContentChange" />
160
+ Reset content onchange
161
+ </label>
162
+ <SlidingPanel :resetOnContentChange="resetOnContentChange">
163
+ <div class="item" v-for="item in items" :key="item">Item {{ item }}</div>
164
+ </SlidingPanel>
165
+ </div>
166
+ </template>
167
+
168
+ <script>
169
+ import { SlidingPanel } from "@empathyco/x-components";
170
+
171
+ export default {
172
+ name: "SlidingPanelDemo",
173
+ components: {
174
+ SlidingPanel
175
+ },
176
+ data() {
177
+ return {
178
+ items: 4,
179
+ resetOnContentChange: false
180
+ };
181
+ }
182
+ };
183
+ </script>
184
+
185
+ <style>
186
+ .x-sliding-panel {
187
+ width: 200px;
188
+ }
189
+
190
+ .item {
191
+ display: inline-block;
192
+ width: 100px;
193
+ }
194
+ </style>
63
195
  ```
64
196
 
197
+ ## Extending the component
198
+
65
199
  ### Overriding Button content
66
200
 
67
201
  By default the buttons show an arrow depicting the direction the scroll would go to when clicked,
68
202
  but this content can be customized with anything, from characters to SVG and images.
69
203
 
70
204
  ```vue
71
- <SlidingPanel>
72
- <template #sliding-panel-left-button>
73
- Left
74
- </template>
75
- <RelatedTags />
76
- <template #sliding-panel-right-button>
77
- Right
78
- </template>
79
- </SlidingPanel>
205
+ <template>
206
+ <SlidingPanel>
207
+ <template #sliding-panel-left-button>Left</template>
208
+ <template #default>
209
+ <div class="item">Item 1</div>
210
+ <div class="item">Item 2</div>
211
+ <div class="item">Item 3</div>
212
+ <div class="item">Item 4</div>
213
+ </template>
214
+ <template #sliding-panel-right-button>Right</template>
215
+ </SlidingPanel>
216
+ </template>
217
+
218
+ <script>
219
+ import { SlidingPanel } from "@empathyco/x-components";
220
+
221
+ export default {
222
+ name: "SlidingPanelDemo",
223
+ components: {
224
+ SlidingPanel
225
+ }
226
+ };
227
+ </script>
228
+
229
+ <style>
230
+ .x-sliding-panel {
231
+ width: 200px;
232
+ }
233
+
234
+ .item {
235
+ display: inline-block;
236
+ width: 100px;
237
+ }
238
+ </style>
80
239
  ```
@@ -6,17 +6,14 @@ title: Scroll
6
6
 
7
7
  # Scroll
8
8
 
9
- Base scroll component that depending on base scroll component and the user interaction emits
10
- different x events for knowing when the user scrolls, the direction of scroll and if user
11
- reaches the start or end.
9
+ Scrollable container that emits scroll related X Events. It exposes all the listeners
10
+ and props from the {@link BaseScroll} component.
12
11
 
13
12
  ## Props
14
13
 
15
- | Name | Description | Type | Default |
16
- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ------------------------- |
17
- | <code>throttleMs</code> | Time duration to ignore the subsequent scroll events after an emission.<br />Higher values will decrease events precision but can prevent performance issues. | <code>number</code> | <code></code> |
18
- | <code>distanceToBottom</code> | Distance to the end of the scroll that when reached will emit the<br />`scroll:about-to-end` event. | <code>number</code> | <code></code> |
19
- | <code>id</code> | Id to identify the component. | <code>string</code> | <code>MainScrollId</code> |
14
+ | Name | Description | Type | Default |
15
+ | --------------- | ----------------------------- | ------------------- | ------------------------- |
16
+ | <code>id</code> | Id to identify the component. | <code>string</code> | <code>MainScrollId</code> |
20
17
 
21
18
  ## Slots
22
19
 
@@ -27,11 +27,11 @@ __vue_render__._withStripped = true;
27
27
  /* style */
28
28
  var __vue_inject_styles__ = function (inject) {
29
29
  if (!inject) { return }
30
- inject("data-v-3b6a5d44_0", { source: ".x-base-scroll[data-v-3b6a5d44] {\n overflow-y: var(--x-string-overflow-scroll, auto);\n}", map: undefined, media: undefined });
30
+ inject("data-v-437d066c_0", { source: ".x-base-scroll[data-v-437d066c] {\n overflow-y: var(--x-string-overflow-scroll, auto);\n}", map: undefined, media: undefined });
31
31
 
32
32
  };
33
33
  /* scoped */
34
- var __vue_scope_id__ = "data-v-3b6a5d44";
34
+ var __vue_scope_id__ = "data-v-437d066c";
35
35
  /* module identifier */
36
36
  var __vue_module_identifier__ = undefined;
37
37
  /* functional template */
@@ -1 +1 @@
1
- {"version":3,"file":"base-scroll.vue.js","sources":["../../../../src/components/scroll/base-scroll.vue"],"sourcesContent":["<template>\n <div @scroll=\"throttledStoreScrollData\" class=\"x-scroll x-base-scroll\" data-test=\"base-scroll\">\n <slot />\n </div>\n</template>\n\n<script lang=\"ts\">\n import { mixins } from 'vue-class-component';\n import { Component } from 'vue-property-decorator';\n import ScrollMixin from './scroll.mixin';\n\n /**\n * Base scroll component that depending on the user interactivity emits different events for\n * knowing when the user scrolls, the direction of scroll and if user reaches the start or end.\n *\n * @public\n */\n @Component\n export default class BaseScroll extends mixins(ScrollMixin) {}\n</script>\n\n<style lang=\"scss\" scoped>\n .x-base-scroll {\n overflow-y: var(--x-string-overflow-scroll, auto);\n }\n</style>\n\n<docs lang=\"mdx\">\n## Example\n\nThe BaseScroll is a component that manage the states of scroll of a specified element. The component\ndoes the necessary calculations for knowing the direction of scroll, if the scroll has reached to\nstart or to end, and is about to reaching to end. The components emits the next events depending of\nmovement that realize the user:\n\n```vue\n<template>\n <BaseScroll\n @scroll=\"scroll\"\n @scroll:direction-change=\"scrollDirectionChange\"\n @scroll:at-start=\"scrollAtStart\"\n @scroll:almost-at-end=\"scrollAlmostAtEnd\"\n @scroll:at-end=\"scrollAtEnd\"\n throttleMs=\"1000\"\n distanceToBottom=\"200\"\n >\n <template>\n <div class=\"content-scroll\">\n <span>content1</span>\n <span>content1</span>\n </div>\n </template>\n </BaseScroll>\n</template>\n\n<script>\n import { BaseScroll } from '@empathyco/x-components';\n\n export default {\n name: 'ScrollTest',\n components: {\n BaseScroll\n },\n methods: {\n scroll(position) {\n console.log('scroll', position);\n },\n scrollDirectionChange(direction) {\n console.log('scroll:direction-change', direction);\n },\n scrollAtStart() {\n console.log('scroll:at-start');\n },\n scrollAlmostAtEnd(distance) {\n console.log('scroll:almost-at-end', distance);\n },\n scrollAtEnd() {\n console.log('scroll:at-end');\n }\n }\n };\n</script>\n```\n\n### Avoid reset scroll on query change\n\nSet to false the reset scroll on query change feature which is true by default.\n\n```vue\n<template>\n <BaseScroll\n @scroll=\"scroll\"\n @scroll:direction-change=\"scrollDirectionChange\"\n @scroll:at-start=\"scrollAtStart\"\n @scroll:almost-at-end=\"scrollAlmostAtEnd\"\n @scroll:at-end=\"scrollAtEnd\"\n throttleMs=\"1000\"\n distanceToBottom=\"200\"\n >\n <template>\n <div class=\"content-scroll\">\n <span>content1</span>\n <span>content1</span>\n </div>\n </template>\n </BaseScroll>\n</template>\n\n<script>\n import { BaseScroll } from '@empathyco/x-components';\n\n export default {\n name: 'ScrollTest',\n components: {\n BaseScroll\n },\n methods: {\n scroll(position) {\n console.log('scroll', position);\n },\n scrollDirectionChange(direction) {\n console.log('scroll:direction-change', direction);\n },\n scrollAtStart() {\n console.log('scroll:at-start');\n },\n scrollAlmostAtEnd(distance) {\n console.log('scroll:almost-at-end', distance);\n },\n scrollAtEnd() {\n console.log('scroll:at-end');\n }\n }\n };\n</script>\n```\n\n## Vue Events:\n\n- `scroll`: the event is emitted after the user scrolls in this container. The payload is the scroll\n top distance in pixels.\n- `scroll:direction-change`: the event is emitted when the user changes the scroll direction. The\n payload is the new scrolling direction.\n- `scroll:at-start`: the event is emitted when the user scrolls up to the initial position of the\n scroll.\n- `scroll:almost-at-end`: the event is emitted when the user is about to reach the bottom part of\n the scroll.\n- `scroll:at-end`: the event is emitted when the user has reached the bottom part of the scroll.\n</docs>\n"],"names":["const"],"mappings":";;;;;AAEAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"base-scroll.vue.js","sources":["../../../../src/components/scroll/base-scroll.vue"],"sourcesContent":["<template>\n <div @scroll=\"throttledStoreScrollData\" class=\"x-scroll x-base-scroll\" data-test=\"base-scroll\">\n <slot />\n </div>\n</template>\n\n<script lang=\"ts\">\n import { mixins } from 'vue-class-component';\n import { Component } from 'vue-property-decorator';\n import ScrollMixin from './scroll.mixin';\n\n /**\n * Base scroll component that depending on the user interactivity emits different events for\n * knowing when the user scrolls, the direction of scroll and if user reaches the start or end.\n *\n * @public\n */\n @Component\n export default class BaseScroll extends mixins(ScrollMixin) {}\n</script>\n\n<style lang=\"scss\" scoped>\n .x-base-scroll {\n overflow-y: var(--x-string-overflow-scroll, auto);\n }\n</style>\n\n<docs lang=\"mdx\">\n## Example\n\nThe `BaseScroll` is a component that manages the state of scroll of a specified element. The\ncomponent does the necessary calculations for knowing the direction of scroll, if the scroll has\nreached to start or to end, and is about to reaching to end. The components emits the next events\ndepending of movement that realize the user:\n\n```vue\n<template>\n <BaseScroll\n @scroll=\"scroll\"\n @scroll:direction-change=\"scrollDirectionChange\"\n @scroll:at-start=\"scrollAtStart\"\n @scroll:almost-at-end=\"scrollAlmostAtEnd\"\n @scroll:at-end=\"scrollAtEnd\"\n :throttleMs=\"1000\"\n :distanceToBottom=\"200\"\n >\n <template>\n <div class=\"content-scroll\">\n <span>content1</span>\n <span>content1</span>\n </div>\n </template>\n </BaseScroll>\n</template>\n\n<script>\n import { BaseScroll } from '@empathyco/x-components';\n\n export default {\n name: 'ScrollTest',\n components: {\n BaseScroll\n },\n methods: {\n scroll(position) {\n console.log('scroll', position);\n },\n scrollDirectionChange(direction) {\n console.log('scroll:direction-change', direction);\n },\n scrollAtStart() {\n console.log('scroll:at-start');\n },\n scrollAlmostAtEnd(distance) {\n console.log('scroll:almost-at-end', distance);\n },\n scrollAtEnd() {\n console.log('scroll:at-end');\n }\n }\n };\n</script>\n```\n\n### Avoid reset scroll on query change\n\nSet to false the reset scroll on query change feature which is true by default.\n\n```vue\n<template>\n <BaseScroll @scroll=\"scroll\" :resetOnChange=\"false\">\n <template>\n <div class=\"content-scroll\">\n <span>content1</span>\n <span>content1</span>\n </div>\n </template>\n </BaseScroll>\n</template>\n\n<script>\n import { BaseScroll } from '@empathyco/x-components';\n\n export default {\n name: 'ScrollTest',\n components: {\n BaseScroll\n },\n methods: {\n scroll(position) {\n console.log('scroll', position);\n }\n }\n };\n</script>\n```\n\n### Reset scroll\n\nYou can configure which events reset the scroll position using the `resetOn` prop.\n\n```vue\n<template>\n <BaseScroll @scroll=\"scroll\" :resetOn=\"resetScrollEvents\">\n <template>\n <div class=\"content-scroll\">\n <span>content1</span>\n <span>content1</span>\n </div>\n </template>\n </BaseScroll>\n</template>\n\n<script>\n import { BaseScroll } from '@empathyco/x-components';\n\n export default {\n name: 'ScrollTest',\n components: {\n BaseScroll\n },\n data() {\n return {\n resetScrollEvents: ['UserAcceptedAQuery']\n };\n },\n methods: {\n scroll(position) {\n console.log('scroll', position);\n }\n }\n };\n</script>\n```\n\n## Vue Events:\n\n- `scroll`: the event is emitted after the user scrolls in this container. The payload is the scroll\n top distance in pixels.\n- `scroll:direction-change`: the event is emitted when the user changes the scroll direction. The\n payload is the new scrolling direction.\n- `scroll:at-start`: the event is emitted when the user scrolls up to the initial position of the\n scroll.\n- `scroll:almost-at-end`: the event is emitted when the user is about to reach the bottom part of\n the scroll.\n- `scroll:at-end`: the event is emitted when the user has reached the bottom part of the scroll.\n</docs>\n"],"names":["const"],"mappings":";;;;;AAEAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -237,12 +237,18 @@ var ScrollMixin = /** @class */ (function (_super) {
237
237
  Prop({ type: Boolean, default: true })
238
238
  ], ScrollMixin.prototype, "resetOnChange", void 0);
239
239
  __decorate([
240
- XOn([
241
- 'SearchBoxQueryChanged',
242
- 'SortChanged',
243
- 'SelectedFiltersChanged',
244
- 'SelectedRelatedTagsChanged'
245
- ])
240
+ Prop({
241
+ default: function () { return [
242
+ 'SearchBoxQueryChanged',
243
+ 'SortChanged',
244
+ 'SelectedFiltersChanged',
245
+ 'SelectedRelatedTagsChanged',
246
+ 'UserChangedExtraParams'
247
+ ]; }
248
+ })
249
+ ], ScrollMixin.prototype, "resetOn", void 0);
250
+ __decorate([
251
+ XOn(function (instance) { return instance.resetOn; })
246
252
  ], ScrollMixin.prototype, "resetScroll", null);
247
253
  __decorate([
248
254
  Watch('currentPosition')
@@ -1 +1 @@
1
- {"version":3,"file":"scroll.mixin.js","sources":["../../../../src/components/scroll/scroll.mixin.ts"],"sourcesContent":["import Vue from 'vue';\nimport { Component, Prop, Watch } from 'vue-property-decorator';\nimport { throttle } from '../../utils/throttle';\nimport { XOn } from '../decorators/bus.decorators';\nimport { ScrollDirection } from './scroll.types';\n\n/**\n * Mixin to share Scroll logic.\n *\n * @public\n */\n@Component\n/* eslint-disable @typescript-eslint/unbound-method */\nexport default class ScrollMixin extends Vue {\n /**\n * The scrolling container reference.\n *\n * @public\n */\n public $el!: HTMLElement;\n /**\n * Distance to the end of the scroll that when reached will emit the\n * `scroll:about-to-end` event.\n *\n * @public\n */\n @Prop({ default: 100 })\n public distanceToBottom!: number;\n /**\n * Positive vertical distance to still consider that the an element is the first one visible.\n * For example, if set to 100, after scrolling 100 pixels, the first rendered element\n * will still be considered the first one.\n */\n @Prop({ default: 100 })\n public firstElementThresholdPx!: number;\n /**\n * Time duration to ignore the subsequent scroll events after an emission.\n * Higher values will decrease events precision but can prevent performance issues.\n *\n * @public\n */\n @Prop({ default: 100 })\n public throttleMs!: number;\n\n /**\n * If true (default), sets the scroll position to the top when certain events are emitted.\n *\n * @public\n */\n @Prop({ type: Boolean, default: true })\n protected resetOnChange!: boolean;\n /**\n * Property for getting the client height of scroll.\n *\n * @internal\n */\n protected clientHeight = 0;\n /**\n * Property for getting the current position of scroll.\n *\n * @internal\n */\n protected currentPosition = 0;\n /**\n * Property for getting the direction of scroll.\n *\n * @internal\n */\n protected direction!: ScrollDirection;\n /**\n * Property for getting the previous position of scroll.\n *\n * @internal\n */\n protected previousPosition = 0;\n /**\n * Property for getting the scroll height.\n *\n * @internal\n */\n protected scrollHeight = 0;\n\n /**\n * Throttled version of the function that stores the DOM scroll related properties.\n * The duration of the throttle is configured through the\n * {@link ScrollMixin.throttleMs}.\n *\n * @returns A throttled version of the function to store the scroll data.\n * @internal\n */\n protected get throttledStoreScrollData(): () => void {\n return throttle(this.storeScrollData, this.throttleMs);\n }\n\n /**\n * Returns distance missing to end position position.\n *\n * @returns A number for knowing the distance missing to end position position.\n * @internal\n */\n protected get distanceToEnd(): number {\n return this.scrollEndPosition - this.currentPosition;\n }\n\n /**\n * Returns `true` when the amount of pixels scrolled is greater than\n * the {@link ScrollMixin.distanceToBottom}.\n *\n * @returns A boolean for knowing if the user is about to reaching to the end.\n * @internal\n */\n protected get hasScrollAlmostReachedEnd(): boolean {\n return !this.hasScrollReachedStart && this.distanceToBottom > this.distanceToEnd;\n }\n\n /**\n * Returns `true` when there is no more content to scroll.\n *\n * @returns A boolean for knowing if the user scrolls to the end.\n * @internal\n */\n protected get hasScrollReachedEnd(): boolean {\n return this.currentPosition === this.scrollEndPosition;\n }\n\n /**\n * Returns `true` when the scroll is at the initial position.\n *\n * @returns A boolean for knowing if the user scrolls to the start.\n * @internal\n */\n protected get hasScrollReachedStart(): boolean {\n return this.currentPosition === 0;\n }\n\n /**\n * Returns direction of scroll based in {@link ScrollDirection}.\n *\n * @returns The scroll direction.\n * @internal\n */\n protected get scrollDirection(): ScrollDirection {\n return this.currentPosition > this.previousPosition ? 'DOWN' : 'UP';\n }\n\n /**\n * Returns end position of scroll.\n *\n * @returns A number for knowing end position of scroll.\n * @internal\n */\n protected get scrollEndPosition(): number {\n return this.scrollHeight - this.clientHeight;\n }\n\n /**\n * Initialises DOM dependant scroll properties.\n *\n * @internal\n */\n mounted(): void {\n this.$nextTick().then(() => {\n if (!this.$el) {\n // TODO Replace with Empathy's logger\n // eslint-disable-next-line no-console\n console.warn(\n '[ScrollMixin]',\n 'Components using this mixin must set `this.$el` to the HTML node that is scrolling.'\n );\n } else {\n this.storeScrollData();\n }\n });\n }\n\n /**\n * Resets the scroll position.\n *\n * @internal\n */\n @XOn([\n 'SearchBoxQueryChanged',\n 'SortChanged',\n 'SelectedFiltersChanged',\n 'SelectedRelatedTagsChanged'\n ])\n resetScroll(): void {\n this.$nextTick().then(() => {\n if (this.resetOnChange) {\n this.$el.scrollTo({ top: 0 });\n }\n });\n }\n\n /**\n * Emits the `scroll` event.\n *\n * @param _newScrollPosition - The new position of scroll.\n * @param oldScrollPosition - The old position of scroll.\n * @internal\n */\n @Watch('currentPosition')\n protected emitScroll(_newScrollPosition: number, oldScrollPosition: number): void {\n this.$emit('scroll', this.currentPosition);\n this.previousPosition = oldScrollPosition;\n }\n\n /**\n * Emits the 'scroll:at-start' event when the user reaches the start.\n *\n * @param isScrollAtStart - For knowing if the user reaches at start.\n * @internal\n */\n @Watch('hasScrollReachedStart')\n protected emitScrollReachedAtStart(isScrollAtStart: boolean): void {\n this.$emit('scroll:at-start', isScrollAtStart);\n }\n\n /**\n * Emits the 'scroll:almost-at-end' event when the user is about to reach to end.\n *\n * @param isScrollAlmostAtEnd - For knowing if the user is about to reach to end.\n * @internal\n */\n @Watch('hasScrollAlmostReachedEnd')\n protected emitScrollAlmostAtEnd(isScrollAlmostAtEnd: boolean): void {\n this.$emit('scroll:almost-at-end', isScrollAlmostAtEnd);\n }\n\n /**\n * Emits the 'scroll:at-end' event when the user reaches the end.\n *\n * @param isScrollAtEnd - For knowing if the user reaches at end.\n * @internal\n */\n @Watch('hasScrollReachedEnd')\n protected emitScrollAtEnd(isScrollAtEnd: boolean): void {\n this.$emit('scroll:at-end', isScrollAtEnd);\n }\n\n /**\n * Emits the `scroll:direction-change` event when the scrolling direction has changed.\n *\n * @param direction - The new direction of scroll.\n * @internal\n */\n @Watch('scrollDirection')\n protected emitScrollDirection(direction: ScrollDirection): void {\n this.$emit('scroll:direction-change', direction);\n }\n\n /**\n * Updates scroll related properties.\n *\n * @internal\n */\n protected storeScrollData(): void {\n if (this.$el) {\n this.currentPosition = this.$el.scrollTop;\n this.scrollHeight = this.$el.scrollHeight;\n this.clientHeight = this.$el.clientHeight;\n }\n }\n}\n/* eslint-enable @typescript-eslint/unbound-method */\n"],"names":[],"mappings":";;;;;;AAMA;;;;;AAOA;IAAyC,+BAAG;;IAA5C;QAAA,qEA0PC;;;;;;QA/MW,kBAAY,GAAG,CAAC,CAAC;;;;;;QAMjB,qBAAe,GAAG,CAAC,CAAC;;;;;;QAYpB,sBAAgB,GAAG,CAAC,CAAC;;;;;;QAMrB,kBAAY,GAAG,CAAC,CAAC;;KAuL5B;IA7KC,sBAAc,iDAAwB;;;;;;;;;aAAtC;YACE,OAAO,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;SACxD;;;OAAA;IAQD,sBAAc,sCAAa;;;;;;;aAA3B;YACE,OAAO,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,eAAe,CAAC;SACtD;;;OAAA;IASD,sBAAc,kDAAyB;;;;;;;;aAAvC;YACE,OAAO,CAAC,IAAI,CAAC,qBAAqB,IAAI,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,aAAa,CAAC;SAClF;;;OAAA;IAQD,sBAAc,4CAAmB;;;;;;;aAAjC;YAC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,SAAS;;OAEW,WAAW,CA0P/B;IAAD,kBAAC;CAAA,CA1PwC,GAAG,GA0P3C;AACD;;;;"}
1
+ {"version":3,"file":"scroll.mixin.js","sources":["../../../../src/components/scroll/scroll.mixin.ts"],"sourcesContent":["import Vue from 'vue';\nimport { Component, Prop, Watch } from 'vue-property-decorator';\nimport { throttle } from '../../utils/throttle';\nimport { XEvent } from '../../wiring/events.types';\nimport { XOn } from '../decorators/bus.decorators';\nimport { ScrollDirection } from './scroll.types';\n\n/**\n * Mixin to share Scroll logic.\n *\n * @public\n */\n@Component\n/* eslint-disable @typescript-eslint/unbound-method */\nexport default class ScrollMixin extends Vue {\n /**\n * The scrolling container reference.\n *\n * @public\n */\n public $el!: HTMLElement;\n /**\n * Distance to the end of the scroll that when reached will emit the\n * `scroll:about-to-end` event.\n *\n * @public\n */\n @Prop({ default: 100 })\n public distanceToBottom!: number;\n /**\n * Positive vertical distance to still consider that the an element is the first one visible.\n * For example, if set to 100, after scrolling 100 pixels, the first rendered element\n * will still be considered the first one.\n */\n @Prop({ default: 100 })\n public firstElementThresholdPx!: number;\n /**\n * Time duration to ignore the subsequent scroll events after an emission.\n * Higher values will decrease events precision but can prevent performance issues.\n *\n * @public\n */\n @Prop({ default: 100 })\n public throttleMs!: number;\n\n /**\n * If true (default), sets the scroll position to the top when certain events are emitted.\n *\n * @public\n */\n @Prop({ type: Boolean, default: true })\n protected resetOnChange!: boolean;\n\n /**\n * List of events that should reset the scroll when emitted.\n *\n * @public\n */\n @Prop({\n default: () => [\n 'SearchBoxQueryChanged',\n 'SortChanged',\n 'SelectedFiltersChanged',\n 'SelectedRelatedTagsChanged',\n 'UserChangedExtraParams'\n ]\n })\n public resetOn!: XEvent;\n\n /**\n * Property for getting the client height of scroll.\n *\n * @internal\n */\n protected clientHeight = 0;\n /**\n * Property for getting the current position of scroll.\n *\n * @internal\n */\n protected currentPosition = 0;\n /**\n * Property for getting the direction of scroll.\n *\n * @internal\n */\n protected direction!: ScrollDirection;\n /**\n * Property for getting the previous position of scroll.\n *\n * @internal\n */\n protected previousPosition = 0;\n /**\n * Property for getting the scroll height.\n *\n * @internal\n */\n protected scrollHeight = 0;\n\n /**\n * Throttled version of the function that stores the DOM scroll related properties.\n * The duration of the throttle is configured through the\n * {@link ScrollMixin.throttleMs}.\n *\n * @returns A throttled version of the function to store the scroll data.\n * @internal\n */\n protected get throttledStoreScrollData(): () => void {\n return throttle(this.storeScrollData, this.throttleMs);\n }\n\n /**\n * Returns distance missing to end position position.\n *\n * @returns A number for knowing the distance missing to end position position.\n * @internal\n */\n protected get distanceToEnd(): number {\n return this.scrollEndPosition - this.currentPosition;\n }\n\n /**\n * Returns `true` when the amount of pixels scrolled is greater than\n * the {@link ScrollMixin.distanceToBottom}.\n *\n * @returns A boolean for knowing if the user is about to reaching to the end.\n * @internal\n */\n protected get hasScrollAlmostReachedEnd(): boolean {\n return !this.hasScrollReachedStart && this.distanceToBottom > this.distanceToEnd;\n }\n\n /**\n * Returns `true` when there is no more content to scroll.\n *\n * @returns A boolean for knowing if the user scrolls to the end.\n * @internal\n */\n protected get hasScrollReachedEnd(): boolean {\n return this.currentPosition === this.scrollEndPosition;\n }\n\n /**\n * Returns `true` when the scroll is at the initial position.\n *\n * @returns A boolean for knowing if the user scrolls to the start.\n * @internal\n */\n protected get hasScrollReachedStart(): boolean {\n return this.currentPosition === 0;\n }\n\n /**\n * Returns direction of scroll based in {@link ScrollDirection}.\n *\n * @returns The scroll direction.\n * @internal\n */\n protected get scrollDirection(): ScrollDirection {\n return this.currentPosition > this.previousPosition ? 'DOWN' : 'UP';\n }\n\n /**\n * Returns end position of scroll.\n *\n * @returns A number for knowing end position of scroll.\n * @internal\n */\n protected get scrollEndPosition(): number {\n return this.scrollHeight - this.clientHeight;\n }\n\n /**\n * Initialises DOM dependant scroll properties.\n *\n * @internal\n */\n mounted(): void {\n this.$nextTick().then(() => {\n if (!this.$el) {\n // TODO Replace with Empathy's logger\n // eslint-disable-next-line no-console\n console.warn(\n '[ScrollMixin]',\n 'Components using this mixin must set `this.$el` to the HTML node that is scrolling.'\n );\n } else {\n this.storeScrollData();\n }\n });\n }\n\n /**\n * Resets the scroll position.\n *\n * @internal\n */\n @XOn(instance => (instance as ScrollMixin).resetOn)\n resetScroll(): void {\n this.$nextTick().then(() => {\n if (this.resetOnChange) {\n this.$el.scrollTo({ top: 0 });\n }\n });\n }\n\n /**\n * Emits the `scroll` event.\n *\n * @param _newScrollPosition - The new position of scroll.\n * @param oldScrollPosition - The old position of scroll.\n * @internal\n */\n @Watch('currentPosition')\n protected emitScroll(_newScrollPosition: number, oldScrollPosition: number): void {\n this.$emit('scroll', this.currentPosition);\n this.previousPosition = oldScrollPosition;\n }\n\n /**\n * Emits the 'scroll:at-start' event when the user reaches the start.\n *\n * @param isScrollAtStart - For knowing if the user reaches at start.\n * @internal\n */\n @Watch('hasScrollReachedStart')\n protected emitScrollReachedAtStart(isScrollAtStart: boolean): void {\n this.$emit('scroll:at-start', isScrollAtStart);\n }\n\n /**\n * Emits the 'scroll:almost-at-end' event when the user is about to reach to end.\n *\n * @param isScrollAlmostAtEnd - For knowing if the user is about to reach to end.\n * @internal\n */\n @Watch('hasScrollAlmostReachedEnd')\n protected emitScrollAlmostAtEnd(isScrollAlmostAtEnd: boolean): void {\n this.$emit('scroll:almost-at-end', isScrollAlmostAtEnd);\n }\n\n /**\n * Emits the 'scroll:at-end' event when the user reaches the end.\n *\n * @param isScrollAtEnd - For knowing if the user reaches at end.\n * @internal\n */\n @Watch('hasScrollReachedEnd')\n protected emitScrollAtEnd(isScrollAtEnd: boolean): void {\n this.$emit('scroll:at-end', isScrollAtEnd);\n }\n\n /**\n * Emits the `scroll:direction-change` event when the scrolling direction has changed.\n *\n * @param direction - The new direction of scroll.\n * @internal\n */\n @Watch('scrollDirection')\n protected emitScrollDirection(direction: ScrollDirection): void {\n this.$emit('scroll:direction-change', direction);\n }\n\n /**\n * Updates scroll related properties.\n *\n * @internal\n */\n protected storeScrollData(): void {\n if (this.$el) {\n this.currentPosition = this.$el.scrollTop;\n this.scrollHeight = this.$el.scrollHeight;\n this.clientHeight = this.$el.clientHeight;\n }\n }\n}\n/* eslint-enable @typescript-eslint/unbound-method */\n"],"names":[],"mappings":";;;;;;AAOA;;;;;AAOA;IAAyC,+BAAG;;IAA5C;QAAA,qEAsQC;;;;;;QA1MW,kBAAY,GAAG,CAAC,CAAC;;;;;;QAMjB,qBAAe,GAAG,CAAC,CAAC;;;;;;QAYpB,sBAAgB,GAAG,CAAC,CAAC;;;;;;QAMrB,kBAAY,GAAG,CAAC,CAAC;;KAkL5B;IAxKC,sBAAc,iDAAwB;;;;;;;;;aAAtC;YACE,OAAO,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;SACxD;;;OAAA;IAQD,sBAAc,sCAAa;;;;;;;aAA3B;YACE,OAAO,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,eAAe,CAAC;SACtD;;;OAAA;IASD,sBAAc,kDAAyB;;;;;;;;aAAvC;YACE,OAAO,CAAC,IAAI,CAAC,qBAAqB,IAAI,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,aAAa,CAAC;SAClF;;;OAAA;IAQD,sBAAc,4CAAmB;;;;;;;aAAjC;YACE,OAAO,IAAI,CAAC,eAAe,KAAK,IAAI,CAAC,iBAAiB,CAAC;SACxD;;;OAAA;IAQD,sBAAc,8CAAqB;;;;;;;aAAnC;YACE,OAAO,IAAI,CAAC,eAAe,KAAK,CAAC,CAAC;SACnC;;;OAAA;IAQD,sBAAc,wCAAe;;;;;;;aAA7B;YACE,OAAO,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,gBAAgB,GAAG,MAAM,GAAG,IAAI,CAAC;SACrE;;;OAAA;IAQD,sBAAc,0CAAiB;;;;;;;aAA/B;YACE,OAAO,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;SAC9C;;;OAAA;;;;;;IAOD,6BAAO,GA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,SAAS,CAAC;YAC1C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC;YAC1C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC;SAC3C;KACF;IAvPD;QADC,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;yDACU;IAOjC;QADC,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;gEACiB;IAQxC;QADC,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;mDACI;IAQ3B;QADC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sDACL;IAgBlC;QATC,IAAI,CAAC;YACJ,OAAO,EAAE,cAAM,OAAA;gBACb,uBAAuB;gBACvB,aAAa;gBACb,wBAAwB;gBACxB,4BAA4B;gBAC5B,wBAAwB;aACzB,GAAA;SACF,CAAC;gDACsB;IAoIxB;QADC,GAAG,CAAC,UAAA,QAAQ,IAAI,OAAC,QAAwB,CAAC,OAAO,GAAA,CAAC;kDAOlD;IAUD;QADC,KAAK,CAAC,iBAAiB,CAAC;iDAIxB;IASD;QADC,KAAK,CAAC,uBAAuB,CAAC;+DAG9B;IASD;QADC,KAAK,CAAC,2BAA2B,CAAC;4DAGlC;IASD;QADC,KAAK,CAAC,qBAAqB,CAAC;sDAG5B;IASD;QADC,KAAK,CAAC,iBAAiB,CAAC;0DAGxB;IAxPkB,WAAW;QAF/B,SAAS;;OAEW,WAAW,CAsQ/B;IAAD,kBAAC;CAAA,CAtQwC,GAAG,GAsQ3C;AACD;;;;"}
@@ -77,11 +77,11 @@ __vue_render__._withStripped = true;
77
77
  /* style */
78
78
  var __vue_inject_styles__ = function (inject) {
79
79
  if (!inject) { return }
80
- inject("data-v-6800b566_0", { source: ".x-sliding-panel[data-v-6800b566] {\n align-items: center;\n display: flex;\n flex-flow: row nowrap;\n height: 100%;\n position: relative;\n}\n.x-sliding-panel__button[data-v-6800b566] {\n opacity: 0;\n pointer-events: none;\n position: absolute;\n transition: all ease-out 0.2s;\n z-index: 2;\n /* To overlay the design system gradient with z-index:1 */\n}\n.x-sliding-panel__button-left[data-v-6800b566] {\n left: 0;\n}\n.x-sliding-panel__button-right[data-v-6800b566] {\n right: 0;\n}\n.x-sliding-panel__scroll[data-v-6800b566] {\n display: flex;\n flex: 100%;\n flex-flow: row nowrap;\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n.x-sliding-panel__scroll[data-v-6800b566]::-webkit-scrollbar {\n display: none;\n}\n.x-sliding-panel:not(.x-sliding-panel--show-buttons-on-hover):not(.x-sliding-panel--at-start) .x-sliding-panel__button-left[data-v-6800b566] {\n opacity: 1;\n pointer-events: all;\n}\n.x-sliding-panel:not(.x-sliding-panel--show-buttons-on-hover):not(.x-sliding-panel--at-end) .x-sliding-panel__button-right[data-v-6800b566] {\n opacity: 1;\n pointer-events: all;\n}", map: undefined, media: undefined });
80
+ inject("data-v-561f2662_0", { source: ".x-sliding-panel[data-v-561f2662] {\n align-items: center;\n display: flex;\n flex-flow: row nowrap;\n height: 100%;\n position: relative;\n}\n.x-sliding-panel__button[data-v-561f2662] {\n opacity: 0;\n pointer-events: none;\n position: absolute;\n transition: all ease-out 0.2s;\n z-index: 2;\n /* To overlay the design system gradient with z-index:1 */\n}\n.x-sliding-panel__button-left[data-v-561f2662] {\n left: 0;\n}\n.x-sliding-panel__button-right[data-v-561f2662] {\n right: 0;\n}\n.x-sliding-panel__scroll[data-v-561f2662] {\n display: flex;\n flex: 100%;\n flex-flow: row nowrap;\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n.x-sliding-panel__scroll[data-v-561f2662]::-webkit-scrollbar {\n display: none;\n}\n.x-sliding-panel:not(.x-sliding-panel--show-buttons-on-hover):not(.x-sliding-panel--at-start) .x-sliding-panel__button-left[data-v-561f2662] {\n opacity: 1;\n pointer-events: all;\n}\n.x-sliding-panel:not(.x-sliding-panel--show-buttons-on-hover):not(.x-sliding-panel--at-end) .x-sliding-panel__button-right[data-v-561f2662] {\n opacity: 1;\n pointer-events: all;\n}", map: undefined, media: undefined });
81
81
 
82
82
  };
83
83
  /* scoped */
84
- var __vue_scope_id__ = "data-v-6800b566";
84
+ var __vue_scope_id__ = "data-v-561f2662";
85
85
  /* module identifier */
86
86
  var __vue_module_identifier__ = undefined;
87
87
  /* functional template */