@aloudata/aloudata-design 0.4.0-beta.10 → 0.4.0-beta.11

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.
@@ -1,90 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
-
3
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
-
7
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
-
9
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
-
11
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
-
13
- // @ts-nocheck
14
- import { useRef, useState, useEffect } from 'react';
15
- /**
16
- * Execute code before next frame but async
17
- */
18
-
19
- export function useLayoutState(defaultState) {
20
- var stateRef = useRef(defaultState);
21
-
22
- var _useState = useState({}),
23
- _useState2 = _slicedToArray(_useState, 2),
24
- forceUpdate = _useState2[1];
25
-
26
- var lastPromiseRef = useRef(null);
27
- var updateBatchRef = useRef([]);
28
-
29
- function setFrameState(updater) {
30
- updateBatchRef.current.push(updater);
31
- var promise = Promise.resolve(); // @ts-ignore;
32
-
33
- lastPromiseRef.current = promise;
34
- promise.then(function () {
35
- if (lastPromiseRef.current === promise) {
36
- var prevBatch = updateBatchRef.current;
37
- var prevState = stateRef.current;
38
- updateBatchRef.current = [];
39
- prevBatch.forEach(function (batchUpdater) {
40
- stateRef.current = batchUpdater(stateRef.current);
41
- }); // @ts-ignore;
42
-
43
- lastPromiseRef.current = null;
44
-
45
- if (prevState !== stateRef.current) {
46
- forceUpdate({});
47
- }
48
- }
49
- });
50
- }
51
-
52
- useEffect(function () {
53
- return function () {
54
- // @ts-ignore;
55
- lastPromiseRef.current = null;
56
- };
57
- }, []);
58
- return [stateRef.current, setFrameState];
59
- }
60
- /** Lock frame, when frame pass reset the lock. */
61
-
62
- export function useTimeoutLock(defaultState) {
63
- var frameRef = useRef(defaultState || null);
64
- var timeoutRef = useRef();
65
- var TIMEOUT_DELAY = 50;
66
-
67
- function cleanUp() {
68
- window.clearTimeout(timeoutRef.current);
69
- }
70
-
71
- function setState(newState) {
72
- // @ts-ignore;
73
- frameRef.current = newState;
74
- cleanUp();
75
- timeoutRef.current = window.setTimeout(function () {
76
- // @ts-ignore;
77
- frameRef.current = null;
78
- timeoutRef.current = undefined;
79
- }, TIMEOUT_DELAY);
80
- }
81
-
82
- function getState() {
83
- return frameRef.current;
84
- }
85
-
86
- useEffect(function () {
87
- return cleanUp;
88
- }, []);
89
- return [setState, getState];
90
- }
@@ -1,21 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export interface ITabPaneProps {
3
- /**
4
- * @description 被隐藏时是否渲染 DOM 结构
5
- * @default false
6
- */
7
- forceRender?: boolean;
8
- /**
9
- * @description 对应 activeKey
10
- * @default -
11
- */
12
- key?: string;
13
- /**
14
- * @description 选项卡头显示的内容
15
- * @default -
16
- */
17
- tab: ReactNode;
18
- className?: string;
19
- children?: ReactNode;
20
- }
21
- export default function TabPane(props: ITabPaneProps): JSX.Element;
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import AntdTabs from 'antd/lib/tabs';
3
- var AntdTabPane = AntdTabs.TabPane;
4
- export default function TabPane(props) {
5
- return /*#__PURE__*/React.createElement(AntdTabPane, Object.assign({}, props));
6
- }
@@ -1,7 +0,0 @@
1
- export declare type Updater<State> = (prev: State) => State;
2
- /**
3
- * Execute code before next frame but async
4
- */
5
- export declare function useLayoutState<State>(defaultState: State): [State, (updater: Updater<State>) => void];
6
- /** Lock frame, when frame pass reset the lock. */
7
- export declare function useTimeoutLock<State>(defaultState?: State): [(state: State) => void, () => State];
@@ -1,98 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useLayoutState = useLayoutState;
7
- exports.useTimeoutLock = useTimeoutLock;
8
-
9
- var _react = require("react");
10
-
11
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
-
13
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
14
-
15
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
16
-
17
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
18
-
19
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
20
-
21
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
-
23
- /**
24
- * Execute code before next frame but async
25
- */
26
- function useLayoutState(defaultState) {
27
- var stateRef = (0, _react.useRef)(defaultState);
28
-
29
- var _useState = (0, _react.useState)({}),
30
- _useState2 = _slicedToArray(_useState, 2),
31
- forceUpdate = _useState2[1];
32
-
33
- var lastPromiseRef = (0, _react.useRef)(null);
34
- var updateBatchRef = (0, _react.useRef)([]);
35
-
36
- function setFrameState(updater) {
37
- updateBatchRef.current.push(updater);
38
- var promise = Promise.resolve(); // @ts-ignore;
39
-
40
- lastPromiseRef.current = promise;
41
- promise.then(function () {
42
- if (lastPromiseRef.current === promise) {
43
- var prevBatch = updateBatchRef.current;
44
- var prevState = stateRef.current;
45
- updateBatchRef.current = [];
46
- prevBatch.forEach(function (batchUpdater) {
47
- stateRef.current = batchUpdater(stateRef.current);
48
- }); // @ts-ignore;
49
-
50
- lastPromiseRef.current = null;
51
-
52
- if (prevState !== stateRef.current) {
53
- forceUpdate({});
54
- }
55
- }
56
- });
57
- }
58
-
59
- (0, _react.useEffect)(function () {
60
- return function () {
61
- // @ts-ignore;
62
- lastPromiseRef.current = null;
63
- };
64
- }, []);
65
- return [stateRef.current, setFrameState];
66
- }
67
- /** Lock frame, when frame pass reset the lock. */
68
-
69
-
70
- function useTimeoutLock(defaultState) {
71
- var frameRef = (0, _react.useRef)(defaultState || null);
72
- var timeoutRef = (0, _react.useRef)();
73
- var TIMEOUT_DELAY = 50;
74
-
75
- function cleanUp() {
76
- window.clearTimeout(timeoutRef.current);
77
- }
78
-
79
- function setState(newState) {
80
- // @ts-ignore;
81
- frameRef.current = newState;
82
- cleanUp();
83
- timeoutRef.current = window.setTimeout(function () {
84
- // @ts-ignore;
85
- frameRef.current = null;
86
- timeoutRef.current = undefined;
87
- }, TIMEOUT_DELAY);
88
- }
89
-
90
- function getState() {
91
- return frameRef.current;
92
- }
93
-
94
- (0, _react.useEffect)(function () {
95
- return cleanUp;
96
- }, []);
97
- return [setState, getState];
98
- }
@@ -1,21 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export interface ITabPaneProps {
3
- /**
4
- * @description 被隐藏时是否渲染 DOM 结构
5
- * @default false
6
- */
7
- forceRender?: boolean;
8
- /**
9
- * @description 对应 activeKey
10
- * @default -
11
- */
12
- key?: string;
13
- /**
14
- * @description 选项卡头显示的内容
15
- * @default -
16
- */
17
- tab: ReactNode;
18
- className?: string;
19
- children?: ReactNode;
20
- }
21
- export default function TabPane(props: ITabPaneProps): JSX.Element;
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = TabPane;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _tabs = _interopRequireDefault(require("antd/lib/tabs"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- var AntdTabPane = _tabs.default.TabPane;
15
-
16
- function TabPane(props) {
17
- return /*#__PURE__*/_react.default.createElement(AntdTabPane, Object.assign({}, props));
18
- }