aloha-vue 1.2.256 → 1.2.257

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
@@ -14,7 +14,7 @@
14
14
  "Vue.js"
15
15
  ],
16
16
  "homepage": "https://github.com/ilia-brykin/aloha/#README.md",
17
- "version": "1.2.256",
17
+ "version": "1.2.257",
18
18
  "author": {
19
19
  "name": "Ilia Brykin",
20
20
  "email": "brykin.ilia@gmail.com"
@@ -5,6 +5,7 @@ import {
5
5
  } from "vue";
6
6
 
7
7
  import {
8
+ debounce,
8
9
  get,
9
10
  } from "lodash-es";
10
11
 
@@ -33,9 +34,11 @@ export default function ObservingAPI(props, {
33
34
  if (isBtnHiddenDependentOnTextLength.value) {
34
35
  return;
35
36
  }
36
- observer.value = new ResizeObserver(() => {
37
- checkHeight();
38
- });
37
+ observer.value = new ResizeObserver(
38
+ debounce(() => {
39
+ checkHeight();
40
+ }, 300)
41
+ );
39
42
  observer.value.observe(containerRef.value);
40
43
  };
41
44
 
@@ -7,6 +7,7 @@ import {
7
7
  import PreviewRightRewAPI from "./PreviewRightRewAPI";
8
8
 
9
9
  import {
10
+ debounce,
10
11
  get,
11
12
  } from "lodash-es";
12
13
 
@@ -90,14 +91,16 @@ export default function PreviewRightResizeAPI(props, { emit }, {
90
91
  });
91
92
  };
92
93
 
93
- const resizeOb = new ResizeObserver(entries => {
94
- // since we are observing only a single element, so we access the first element in entries array
95
- const RECT = entries[0].contentRect;
96
- if (tableGrandparentWidth !== RECT.width) {
97
- tableGrandparentWidth = RECT.width;
98
- correctTableUndPreviewWidth();
99
- }
100
- });
94
+ const resizeOb = new ResizeObserver(
95
+ debounce(entries => {
96
+ // since we are observing only a single element, so we access the first element in entries array
97
+ const RECT = entries[0].contentRect;
98
+ if (tableGrandparentWidth !== RECT.width) {
99
+ tableGrandparentWidth = RECT.width;
100
+ correctTableUndPreviewWidth();
101
+ }
102
+ }, 300)
103
+ );
101
104
 
102
105
  const addEventListenerWindowResize = () => {
103
106
  resizeOb.observe(tableGrandparentRef.value);
@@ -12,6 +12,7 @@ import {
12
12
  } from "../utils/utils.js";
13
13
  import {
14
14
  cloneDeep,
15
+ debounce,
15
16
  forEach,
16
17
  isNil,
17
18
  isUndefined,
@@ -35,7 +36,6 @@ export default function ScrollControlAPI(props, { emit }, {
35
36
 
36
37
  const aTableRef = ref(undefined);
37
38
  const columnsVisibleAdditionalSpaceForOneGrow = ref(0);
38
- const resizeTimeout = ref(undefined);
39
39
  const tableWidth = ref(undefined);
40
40
  let changingTableWidth = false;
41
41
  const delta = 20; // approx scrollbar width + 2px for <tr> border
@@ -179,18 +179,16 @@ export default function ScrollControlAPI(props, { emit }, {
179
179
  }
180
180
  };
181
181
 
182
- const resizeOb = new ResizeObserver(entries => {
183
- // since we are observing only a single element, so we access the first element in entries array
184
- if (isUndefined(tableWidth.value)) {
185
- adjustTableWidth({ entries, forceAdjust: true });
186
- } else {
187
- clearTimeout(resizeTimeout.value);
188
-
189
- resizeTimeout.value = setTimeout(() => {
182
+ const resizeOb = new ResizeObserver(
183
+ debounce(entries => {
184
+ // since we are observing only a single element, so we access the first element in entries array
185
+ if (isUndefined(tableWidth.value)) {
186
+ adjustTableWidth({ entries, forceAdjust: true });
187
+ } else {
190
188
  adjustTableWidth({ entries });
191
- }, 300);
192
- }
193
- });
189
+ }
190
+ }, 300)
191
+ );
194
192
 
195
193
  const onWatchMobileScrollControl = newValue => {
196
194
  if (newValue) {
@@ -2,6 +2,10 @@ import {
2
2
  ref,
3
3
  } from "vue";
4
4
 
5
+ import {
6
+ debounce,
7
+ } from "lodash-es";
8
+
5
9
  export default function ObserverAPI({
6
10
  checkScroll = () => {},
7
11
  containerRef = ref(undefined),
@@ -33,11 +37,15 @@ export default function ObserverAPI({
33
37
  };
34
38
 
35
39
  const initContainerObserver = () => {
36
- resizeContainerObserver.value = new ResizeObserver(callbackContainerObserver);
40
+ resizeContainerObserver.value = new ResizeObserver(
41
+ debounce(entries => callbackContainerObserver(entries), 300)
42
+ );
37
43
  };
38
44
 
39
45
  const initScrollContentObserver = () => {
40
- resizeScrollContentObserver.value = new ResizeObserver(callbackScrollContentObserver);
46
+ resizeScrollContentObserver.value = new ResizeObserver(
47
+ debounce(entries => callbackScrollContentObserver(entries), 300)
48
+ );
41
49
  };
42
50
 
43
51
  const connectContainerObserver = () => {