@ringcentral/juno 2.33.0 → 2.35.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/components/Presence/styles/StyledPresence.js +3 -3
- package/components/Presence/utils/RcPresenceUtils.js +1 -1
- package/components/Tabs/Tabs/MoreMenuTab/MoreMenuTab.js +4 -5
- package/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabSentinel.d.ts +7 -0
- package/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabSentinel.js +9 -0
- package/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.d.ts +0 -1
- package/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.js +276 -197
- package/components/Tabs/Tabs/MoreMenuTabs/utils/MoreMenuTabsUtils.d.ts +3 -34
- package/components/Tabs/Tabs/MoreMenuTabs/utils/MoreMenuTabsUtils.js +0 -87
- package/components/Tabs/Tabs/MoreMenuTabs/utils/index.js +0 -2
- package/es6/components/Presence/styles/StyledPresence.js +3 -3
- package/es6/components/Presence/utils/RcPresenceUtils.js +1 -1
- package/es6/components/Tabs/Tabs/MoreMenuTab/MoreMenuTab.js +4 -5
- package/es6/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabSentinel.js +6 -0
- package/es6/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.js +278 -199
- package/es6/components/Tabs/Tabs/MoreMenuTabs/utils/MoreMenuTabsUtils.js +0 -87
- package/es6/components/Tabs/Tabs/MoreMenuTabs/utils/index.js +0 -1
- package/es6/foundation/hooks/useDebounce/useDebounce.js +3 -2
- package/es6/foundation/hooks/useOnReRender/useOnReRender.js +6 -3
- package/es6/foundation/hooks/useThrottle/useThrottle.js +4 -3
- package/foundation/hooks/useDebounce/useDebounce.d.ts +3 -2
- package/foundation/hooks/useDebounce/useDebounce.js +3 -2
- package/foundation/hooks/useOnReRender/useOnReRender.d.ts +1 -1
- package/foundation/hooks/useOnReRender/useOnReRender.js +5 -2
- package/foundation/hooks/useThrottle/useThrottle.d.ts +3 -2
- package/foundation/hooks/useThrottle/useThrottle.js +4 -3
- package/package.json +1 -1
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
export var DEFAULT_SIZE = {
|
|
2
|
-
width: 0,
|
|
3
|
-
height: 0,
|
|
4
|
-
};
|
|
5
|
-
export var computeChildBySize = function (labelArray, fixLabel, limitSize) {
|
|
6
|
-
var plainArr = [];
|
|
7
|
-
var groupArr = [];
|
|
8
|
-
var sumSize = 0;
|
|
9
|
-
var groupFlag = false;
|
|
10
|
-
labelArray.forEach(function (_label) {
|
|
11
|
-
var label = _label.key, size = _label.size;
|
|
12
|
-
if (groupFlag === false && sumSize + size < limitSize) {
|
|
13
|
-
sumSize += size;
|
|
14
|
-
plainArr.push(label);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
groupFlag = true;
|
|
18
|
-
groupArr.push(label);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
if (fixLabel && groupArr.includes(fixLabel)) {
|
|
22
|
-
plainArr = [];
|
|
23
|
-
groupArr = [];
|
|
24
|
-
var fixLabelSize_1 = 0;
|
|
25
|
-
labelArray.forEach(function (_label) {
|
|
26
|
-
var label = _label.key, size = _label.size;
|
|
27
|
-
if (label === fixLabel) {
|
|
28
|
-
fixLabelSize_1 = size;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
var sumFixSize_1 = 0;
|
|
32
|
-
var groupFlag_1 = false;
|
|
33
|
-
labelArray.forEach(function (_label) {
|
|
34
|
-
var label = _label.key, size = _label.size;
|
|
35
|
-
if (label === fixLabel) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
if (groupFlag_1 === false && sumFixSize_1 + size < limitSize - fixLabelSize_1) {
|
|
39
|
-
sumFixSize_1 += size;
|
|
40
|
-
plainArr.push(label);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
groupFlag_1 = true;
|
|
44
|
-
groupArr.push(label);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
plainArr.push(fixLabel);
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
plainArr: plainArr,
|
|
51
|
-
groupArr: groupArr,
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
export var getDomBoundingClientSize = function (dom) {
|
|
55
|
-
if (!dom || dom.nodeType !== 1) {
|
|
56
|
-
return DEFAULT_SIZE;
|
|
57
|
-
}
|
|
58
|
-
var _a = dom.getBoundingClientRect(), width = _a.width, height = _a.height;
|
|
59
|
-
return {
|
|
60
|
-
width: width,
|
|
61
|
-
height: height,
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
* @param keyProp React.key
|
|
67
|
-
* @param idx string
|
|
68
|
-
* @example
|
|
69
|
-
* getKey('tab_0', 0) => childIdx_0_propKey_tab_0
|
|
70
|
-
* getKey(undefined, 1) => childIdx_1
|
|
71
|
-
*/
|
|
72
|
-
export var getKey = function (keyProp, idx) {
|
|
73
|
-
return "childIdx_" + idx + (keyProp ? "_propKey_" + keyProp : '');
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* parseKey(childIdx_1) => { index: 1 }
|
|
79
|
-
* parseKey(childIdx_1_propKey_tab_1) => { index: 1, key: tab_1 }
|
|
80
|
-
*/
|
|
81
|
-
export var parseKey = function (key) {
|
|
82
|
-
var match = /^(?:childIdx_)(\d+)(?:_propKey_)?(.*)/gi.exec(key);
|
|
83
|
-
return {
|
|
84
|
-
index: match === null || match === void 0 ? void 0 : match[1],
|
|
85
|
-
key: match === null || match === void 0 ? void 0 : match[2].replace(/^\.\$/i, ''),
|
|
86
|
-
};
|
|
87
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './MoreMenuTabsUtils';
|
|
@@ -5,12 +5,13 @@ import { useEventCallback } from '../useEventCallback';
|
|
|
5
5
|
* provide a debounce method for debounce method
|
|
6
6
|
* @param fn method for debounce
|
|
7
7
|
* @param debounceTime debounce timeout value, default is `200`ms
|
|
8
|
+
* @param debounceSettings debounce setting object, more detail see `lodash`
|
|
8
9
|
*/
|
|
9
|
-
export var useDebounce = function (fn, debounceTime) {
|
|
10
|
+
export var useDebounce = function (fn, debounceTime, debounceSettings) {
|
|
10
11
|
if (debounceTime === void 0) { debounceTime = 200; }
|
|
11
12
|
var memoFn = useEventCallback(fn);
|
|
12
13
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
13
|
-
var debounceFn = useCallback(debounce(memoFn, debounceTime), []);
|
|
14
|
+
var debounceFn = useCallback(debounce(memoFn, debounceTime, debounceSettings), []);
|
|
14
15
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
15
16
|
useEffect(function () { return function () { return debounceFn.cancel(); }; }, []);
|
|
16
17
|
return debounceFn;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { useLayoutEffect, useRef } from 'react';
|
|
1
|
+
import { useLayoutEffect, useRef, useEffect } from 'react';
|
|
2
2
|
import { useEventCallback } from '../useEventCallback';
|
|
3
3
|
/**
|
|
4
4
|
* only trigger when re-render, not trigger on component first render
|
|
5
5
|
*/
|
|
6
|
-
export var useOnReRender = function (cb, deps) {
|
|
6
|
+
export var useOnReRender = function (cb, deps, isLayout) {
|
|
7
|
+
if (isLayout === void 0) { isLayout = true; }
|
|
7
8
|
var count = useRef(0);
|
|
8
9
|
var method = useEventCallback(cb);
|
|
9
|
-
|
|
10
|
+
var isLayoutRef = useRef(isLayout);
|
|
11
|
+
var useTargetEffect = isLayoutRef.current ? useLayoutEffect : useEffect;
|
|
12
|
+
useTargetEffect(function () {
|
|
10
13
|
if (count.current === 0) {
|
|
11
14
|
count.current = 1;
|
|
12
15
|
return function () { };
|
|
@@ -5,12 +5,13 @@ import { useEventCallback } from '../useEventCallback';
|
|
|
5
5
|
* provide a throttle method for throttle method
|
|
6
6
|
* @param fn method for throttle
|
|
7
7
|
* @param throttleTime throttle timeout value, default is `200`ms
|
|
8
|
+
* @param throttleSettings throttle setting object, more detail see `lodash`
|
|
8
9
|
*/
|
|
9
|
-
export var useThrottle = function (fn,
|
|
10
|
-
if (
|
|
10
|
+
export var useThrottle = function (fn, throttleTime, throttleSettings) {
|
|
11
|
+
if (throttleTime === void 0) { throttleTime = 200; }
|
|
11
12
|
var memoFn = useEventCallback(fn);
|
|
12
13
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
13
|
-
var throttleFn = useCallback(throttle(memoFn,
|
|
14
|
+
var throttleFn = useCallback(throttle(memoFn, throttleTime, throttleSettings), []);
|
|
14
15
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
15
16
|
useEffect(function () { return function () { return throttleFn.cancel(); }; }, []);
|
|
16
17
|
return throttleFn;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { DebounceSettings } from 'lodash';
|
|
2
2
|
/**
|
|
3
3
|
* provide a debounce method for debounce method
|
|
4
4
|
* @param fn method for debounce
|
|
5
5
|
* @param debounceTime debounce timeout value, default is `200`ms
|
|
6
|
+
* @param debounceSettings debounce setting object, more detail see `lodash`
|
|
6
7
|
*/
|
|
7
|
-
export declare const useDebounce: <F extends (...args: any[]) => any>(fn: F, debounceTime?: number) => import("lodash").DebouncedFunc<F>;
|
|
8
|
+
export declare const useDebounce: <F extends (...args: any[]) => any>(fn: F, debounceTime?: number, debounceSettings?: DebounceSettings | undefined) => import("lodash").DebouncedFunc<F>;
|
|
@@ -8,12 +8,13 @@ var useEventCallback_1 = require("../useEventCallback");
|
|
|
8
8
|
* provide a debounce method for debounce method
|
|
9
9
|
* @param fn method for debounce
|
|
10
10
|
* @param debounceTime debounce timeout value, default is `200`ms
|
|
11
|
+
* @param debounceSettings debounce setting object, more detail see `lodash`
|
|
11
12
|
*/
|
|
12
|
-
exports.useDebounce = function (fn, debounceTime) {
|
|
13
|
+
exports.useDebounce = function (fn, debounceTime, debounceSettings) {
|
|
13
14
|
if (debounceTime === void 0) { debounceTime = 200; }
|
|
14
15
|
var memoFn = useEventCallback_1.useEventCallback(fn);
|
|
15
16
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
|
-
var debounceFn = react_1.useCallback(debounce_1.default(memoFn, debounceTime), []);
|
|
17
|
+
var debounceFn = react_1.useCallback(debounce_1.default(memoFn, debounceTime, debounceSettings), []);
|
|
17
18
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18
19
|
react_1.useEffect(function () { return function () { return debounceFn.cancel(); }; }, []);
|
|
19
20
|
return debounceFn;
|
|
@@ -2,4 +2,4 @@ import { DependencyList } from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* only trigger when re-render, not trigger on component first render
|
|
4
4
|
*/
|
|
5
|
-
export declare const useOnReRender: (cb: () => any, deps?: DependencyList | undefined) => void;
|
|
5
|
+
export declare const useOnReRender: (cb: () => any, deps?: DependencyList | undefined, isLayout?: boolean) => void;
|
|
@@ -5,10 +5,13 @@ var useEventCallback_1 = require("../useEventCallback");
|
|
|
5
5
|
/**
|
|
6
6
|
* only trigger when re-render, not trigger on component first render
|
|
7
7
|
*/
|
|
8
|
-
exports.useOnReRender = function (cb, deps) {
|
|
8
|
+
exports.useOnReRender = function (cb, deps, isLayout) {
|
|
9
|
+
if (isLayout === void 0) { isLayout = true; }
|
|
9
10
|
var count = react_1.useRef(0);
|
|
10
11
|
var method = useEventCallback_1.useEventCallback(cb);
|
|
11
|
-
react_1.
|
|
12
|
+
var isLayoutRef = react_1.useRef(isLayout);
|
|
13
|
+
var useTargetEffect = isLayoutRef.current ? react_1.useLayoutEffect : react_1.useEffect;
|
|
14
|
+
useTargetEffect(function () {
|
|
12
15
|
if (count.current === 0) {
|
|
13
16
|
count.current = 1;
|
|
14
17
|
return function () { };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { ThrottleSettings } from 'lodash';
|
|
2
2
|
/**
|
|
3
3
|
* provide a throttle method for throttle method
|
|
4
4
|
* @param fn method for throttle
|
|
5
5
|
* @param throttleTime throttle timeout value, default is `200`ms
|
|
6
|
+
* @param throttleSettings throttle setting object, more detail see `lodash`
|
|
6
7
|
*/
|
|
7
|
-
export declare const useThrottle: <F extends (...args: any[]) => any>(fn: F,
|
|
8
|
+
export declare const useThrottle: <F extends (...args: any[]) => any>(fn: F, throttleTime?: number, throttleSettings?: ThrottleSettings | undefined) => import("lodash").DebouncedFunc<F>;
|
|
@@ -8,12 +8,13 @@ var useEventCallback_1 = require("../useEventCallback");
|
|
|
8
8
|
* provide a throttle method for throttle method
|
|
9
9
|
* @param fn method for throttle
|
|
10
10
|
* @param throttleTime throttle timeout value, default is `200`ms
|
|
11
|
+
* @param throttleSettings throttle setting object, more detail see `lodash`
|
|
11
12
|
*/
|
|
12
|
-
exports.useThrottle = function (fn,
|
|
13
|
-
if (
|
|
13
|
+
exports.useThrottle = function (fn, throttleTime, throttleSettings) {
|
|
14
|
+
if (throttleTime === void 0) { throttleTime = 200; }
|
|
14
15
|
var memoFn = useEventCallback_1.useEventCallback(fn);
|
|
15
16
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
|
-
var throttleFn = react_1.useCallback(throttle_1.default(memoFn,
|
|
17
|
+
var throttleFn = react_1.useCallback(throttle_1.default(memoFn, throttleTime, throttleSettings), []);
|
|
17
18
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18
19
|
react_1.useEffect(function () { return function () { return throttleFn.cancel(); }; }, []);
|
|
19
20
|
return throttleFn;
|