@chaomingd/design 0.0.68

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 (159) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +23 -0
  3. package/dist/esm/CheckGroup/context.d.ts +9 -0
  4. package/dist/esm/CheckGroup/context.js +6 -0
  5. package/dist/esm/CheckGroup/hooks/useCheckGroup.d.ts +21 -0
  6. package/dist/esm/CheckGroup/hooks/useCheckGroup.js +180 -0
  7. package/dist/esm/CheckGroup/index.d.ts +9 -0
  8. package/dist/esm/CheckGroup/index.js +79 -0
  9. package/dist/esm/CheckGroup/type.d.ts +28 -0
  10. package/dist/esm/CheckGroup/type.js +1 -0
  11. package/dist/esm/Grid/index.d.ts +15 -0
  12. package/dist/esm/Grid/index.js +64 -0
  13. package/dist/esm/Grid/index.less +7 -0
  14. package/dist/esm/KaTeXRenderer/index.d.ts +9 -0
  15. package/dist/esm/KaTeXRenderer/index.js +33 -0
  16. package/dist/esm/KaTeXRenderer/index.less +0 -0
  17. package/dist/esm/PixelPlayer/index.d.ts +28 -0
  18. package/dist/esm/PixelPlayer/index.js +118 -0
  19. package/dist/esm/PixelPlayer/index.less +29 -0
  20. package/dist/esm/PixelPlayer/lib/peer-stream.d.ts +62 -0
  21. package/dist/esm/PixelPlayer/lib/peer-stream.js +876 -0
  22. package/dist/esm/PixelPlayer/useAutoLayoutContainer.d.ts +2 -0
  23. package/dist/esm/PixelPlayer/useAutoLayoutContainer.js +53 -0
  24. package/dist/esm/PixelPlayer/useVideoWithCustomEvent.d.ts +5 -0
  25. package/dist/esm/PixelPlayer/useVideoWithCustomEvent.js +37 -0
  26. package/dist/esm/Resizer/index.d.ts +17 -0
  27. package/dist/esm/Resizer/index.js +73 -0
  28. package/dist/esm/Resizer/index.less +73 -0
  29. package/dist/esm/SetupAntApp/index.d.ts +1 -0
  30. package/dist/esm/SetupAntApp/index.js +10 -0
  31. package/dist/esm/Transition/index.d.ts +4 -0
  32. package/dist/esm/Transition/index.js +132 -0
  33. package/dist/esm/Transition/type.d.ts +33 -0
  34. package/dist/esm/Transition/type.js +12 -0
  35. package/dist/esm/Transition/utils.d.ts +6 -0
  36. package/dist/esm/Transition/utils.js +15 -0
  37. package/dist/esm/UploadFile/components/IconButton/index.d.ts +11 -0
  38. package/dist/esm/UploadFile/components/IconButton/index.js +26 -0
  39. package/dist/esm/UploadFile/components/IconButton/index.less +58 -0
  40. package/dist/esm/UploadFile/components/Slash.d.ts +2 -0
  41. package/dist/esm/UploadFile/components/Slash.js +15 -0
  42. package/dist/esm/UploadFile/components/SvgIcons.d.ts +11 -0
  43. package/dist/esm/UploadFile/components/SvgIcons.js +141 -0
  44. package/dist/esm/UploadFile/hooks/useUploadModel.d.ts +16 -0
  45. package/dist/esm/UploadFile/hooks/useUploadModel.js +376 -0
  46. package/dist/esm/UploadFile/index.d.ts +4 -0
  47. package/dist/esm/UploadFile/index.js +277 -0
  48. package/dist/esm/UploadFile/index.less +274 -0
  49. package/dist/esm/UploadFile/type.d.ts +63 -0
  50. package/dist/esm/UploadFile/type.js +1 -0
  51. package/dist/esm/UploadFile/utils/formatBitString.d.ts +1 -0
  52. package/dist/esm/UploadFile/utils/formatBitString.js +9 -0
  53. package/dist/esm/UploadFile/utils/getExt.d.ts +1 -0
  54. package/dist/esm/UploadFile/utils/getExt.js +6 -0
  55. package/dist/esm/UploadFile/utils/isImage.d.ts +1 -0
  56. package/dist/esm/UploadFile/utils/isImage.js +8 -0
  57. package/dist/esm/UploadFile/utils/normalizeExt.d.ts +1 -0
  58. package/dist/esm/UploadFile/utils/normalizeExt.js +4 -0
  59. package/dist/esm/UploadFile/utils/validateFileTypes.d.ts +13 -0
  60. package/dist/esm/UploadFile/utils/validateFileTypes.js +83 -0
  61. package/dist/esm/UploadFile/utils/validateRule.d.ts +3 -0
  62. package/dist/esm/UploadFile/utils/validateRule.js +22 -0
  63. package/dist/esm/UploadFile/utils/validateUpload.d.ts +5 -0
  64. package/dist/esm/UploadFile/utils/validateUpload.js +35 -0
  65. package/dist/esm/constant/index.d.ts +7 -0
  66. package/dist/esm/constant/index.js +18 -0
  67. package/dist/esm/constants/cssPrefix.d.ts +1 -0
  68. package/dist/esm/constants/cssPrefix.js +1 -0
  69. package/dist/esm/getAntApp/index.d.ts +8 -0
  70. package/dist/esm/getAntApp/index.js +17 -0
  71. package/dist/esm/index.d.ts +10 -0
  72. package/dist/esm/index.js +10 -0
  73. package/dist/esm/interface.d.ts +1 -0
  74. package/dist/esm/interface.js +1 -0
  75. package/dist/esm/styles/cssVar.less +28 -0
  76. package/dist/esm/styles/reset.css +3 -0
  77. package/dist/esm/styles/var.d.ts +1 -0
  78. package/dist/esm/styles/var.js +1 -0
  79. package/dist/esm/styles/var.less +2 -0
  80. package/dist/esm/variable.less +52 -0
  81. package/dist/lib/CheckGroup/context.d.ts +9 -0
  82. package/dist/lib/CheckGroup/context.js +12 -0
  83. package/dist/lib/CheckGroup/hooks/useCheckGroup.d.ts +21 -0
  84. package/dist/lib/CheckGroup/hooks/useCheckGroup.js +164 -0
  85. package/dist/lib/CheckGroup/index.d.ts +9 -0
  86. package/dist/lib/CheckGroup/index.js +93 -0
  87. package/dist/lib/CheckGroup/type.d.ts +28 -0
  88. package/dist/lib/CheckGroup/type.js +5 -0
  89. package/dist/lib/Grid/index.d.ts +15 -0
  90. package/dist/lib/Grid/index.js +77 -0
  91. package/dist/lib/Grid/index.less +7 -0
  92. package/dist/lib/KaTeXRenderer/index.d.ts +9 -0
  93. package/dist/lib/KaTeXRenderer/index.js +41 -0
  94. package/dist/lib/KaTeXRenderer/index.less +0 -0
  95. package/dist/lib/PixelPlayer/index.d.ts +28 -0
  96. package/dist/lib/PixelPlayer/index.js +108 -0
  97. package/dist/lib/PixelPlayer/index.less +29 -0
  98. package/dist/lib/PixelPlayer/lib/peer-stream.d.ts +62 -0
  99. package/dist/lib/PixelPlayer/lib/peer-stream.js +707 -0
  100. package/dist/lib/PixelPlayer/useAutoLayoutContainer.d.ts +2 -0
  101. package/dist/lib/PixelPlayer/useAutoLayoutContainer.js +60 -0
  102. package/dist/lib/PixelPlayer/useVideoWithCustomEvent.d.ts +5 -0
  103. package/dist/lib/PixelPlayer/useVideoWithCustomEvent.js +35 -0
  104. package/dist/lib/Resizer/index.d.ts +17 -0
  105. package/dist/lib/Resizer/index.js +75 -0
  106. package/dist/lib/Resizer/index.less +73 -0
  107. package/dist/lib/SetupAntApp/index.d.ts +1 -0
  108. package/dist/lib/SetupAntApp/index.js +16 -0
  109. package/dist/lib/Transition/index.d.ts +4 -0
  110. package/dist/lib/Transition/index.js +128 -0
  111. package/dist/lib/Transition/type.d.ts +33 -0
  112. package/dist/lib/Transition/type.js +18 -0
  113. package/dist/lib/Transition/utils.d.ts +6 -0
  114. package/dist/lib/Transition/utils.js +22 -0
  115. package/dist/lib/UploadFile/components/IconButton/index.d.ts +11 -0
  116. package/dist/lib/UploadFile/components/IconButton/index.js +29 -0
  117. package/dist/lib/UploadFile/components/IconButton/index.less +58 -0
  118. package/dist/lib/UploadFile/components/Slash.d.ts +2 -0
  119. package/dist/lib/UploadFile/components/Slash.js +22 -0
  120. package/dist/lib/UploadFile/components/SvgIcons.d.ts +11 -0
  121. package/dist/lib/UploadFile/components/SvgIcons.js +158 -0
  122. package/dist/lib/UploadFile/hooks/useUploadModel.d.ts +16 -0
  123. package/dist/lib/UploadFile/hooks/useUploadModel.js +306 -0
  124. package/dist/lib/UploadFile/index.d.ts +4 -0
  125. package/dist/lib/UploadFile/index.js +280 -0
  126. package/dist/lib/UploadFile/index.less +274 -0
  127. package/dist/lib/UploadFile/type.d.ts +63 -0
  128. package/dist/lib/UploadFile/type.js +5 -0
  129. package/dist/lib/UploadFile/utils/formatBitString.d.ts +1 -0
  130. package/dist/lib/UploadFile/utils/formatBitString.js +15 -0
  131. package/dist/lib/UploadFile/utils/getExt.d.ts +1 -0
  132. package/dist/lib/UploadFile/utils/getExt.js +12 -0
  133. package/dist/lib/UploadFile/utils/isImage.d.ts +1 -0
  134. package/dist/lib/UploadFile/utils/isImage.js +14 -0
  135. package/dist/lib/UploadFile/utils/normalizeExt.d.ts +1 -0
  136. package/dist/lib/UploadFile/utils/normalizeExt.js +10 -0
  137. package/dist/lib/UploadFile/utils/validateFileTypes.d.ts +13 -0
  138. package/dist/lib/UploadFile/utils/validateFileTypes.js +87 -0
  139. package/dist/lib/UploadFile/utils/validateRule.d.ts +3 -0
  140. package/dist/lib/UploadFile/utils/validateRule.js +28 -0
  141. package/dist/lib/UploadFile/utils/validateUpload.d.ts +5 -0
  142. package/dist/lib/UploadFile/utils/validateUpload.js +31 -0
  143. package/dist/lib/constant/index.d.ts +7 -0
  144. package/dist/lib/constant/index.js +24 -0
  145. package/dist/lib/constants/cssPrefix.d.ts +1 -0
  146. package/dist/lib/constants/cssPrefix.js +7 -0
  147. package/dist/lib/getAntApp/index.d.ts +8 -0
  148. package/dist/lib/getAntApp/index.js +27 -0
  149. package/dist/lib/index.d.ts +10 -0
  150. package/dist/lib/index.js +69 -0
  151. package/dist/lib/interface.d.ts +1 -0
  152. package/dist/lib/interface.js +5 -0
  153. package/dist/lib/styles/cssVar.less +28 -0
  154. package/dist/lib/styles/reset.css +3 -0
  155. package/dist/lib/styles/var.d.ts +1 -0
  156. package/dist/lib/styles/var.js +7 -0
  157. package/dist/lib/styles/var.less +2 -0
  158. package/dist/lib/variable.less +52 -0
  159. package/package.json +54 -0
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useAutoLayoutContainer = void 0;
7
+ var _react = require("react");
8
+ /* eslint-disable @typescript-eslint/no-non-null-assertion -- assert it is not null */
9
+
10
+ const useAutoLayoutContainer = (videoRef, positionOrigin) => {
11
+ const containerRef = (0, _react.useRef)(null);
12
+ (0, _react.useEffect)(() => {
13
+ const positionStyles = {
14
+ 'top-left': {
15
+ top: 0,
16
+ left: 0
17
+ },
18
+ 'top-right': {
19
+ top: 0,
20
+ right: 0
21
+ },
22
+ 'bottom-left': {
23
+ bottom: 0,
24
+ left: 0
25
+ },
26
+ 'bottom-right': {
27
+ bottom: 0,
28
+ right: 0
29
+ }
30
+ };
31
+ // 暂不支持自适应
32
+ const setup = () => {
33
+ if (!containerRef.current) {
34
+ requestAnimationFrame(setup);
35
+ return;
36
+ }
37
+ const clientWidth = containerRef.current.clientWidth;
38
+ const clientHeight = containerRef.current.clientHeight;
39
+ if (clientHeight === 0 && clientWidth === 0) {
40
+ // 重新查询
41
+ requestAnimationFrame(setup);
42
+ return;
43
+ }
44
+ const ratio = clientWidth / clientHeight;
45
+ const height = `${clientHeight}px`;
46
+ const width = `${clientWidth}px`;
47
+ const defaultRatio = 1920 / 1080;
48
+ if (ratio > defaultRatio) {
49
+ videoRef.current.style.width = width;
50
+ } else {
51
+ videoRef.current.style.height = height;
52
+ }
53
+ videoRef.current.style.position = 'absolute';
54
+ Object.assign(videoRef.current.style, positionStyles[positionOrigin]);
55
+ };
56
+ setup();
57
+ }, []);
58
+ return containerRef;
59
+ };
60
+ exports.useAutoLayoutContainer = useAutoLayoutContainer;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { type PeerStream } from './lib/peer-stream';
3
+ type EventHandlers = Record<string, (event: Event) => void>;
4
+ export declare const useVideoWithCustomEvent: (eventHandlers: EventHandlers) => import("react").RefObject<PeerStream>;
5
+ export {};
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useVideoWithCustomEvent = void 0;
7
+ var _react = require("react");
8
+ function lowercaseFirstLetter(word) {
9
+ return word.charAt(0).toLowerCase() + word.slice(1);
10
+ }
11
+ const useVideoWithCustomEvent = eventHandlers => {
12
+ const videoRef = (0, _react.useRef)(null);
13
+ (0, _react.useEffect)(() => {
14
+ const addEventListeners = () => {
15
+ Object.entries(eventHandlers).forEach(([eventHandlerName, eventHandler]) => {
16
+ const eventName = lowercaseFirstLetter(eventHandlerName.replace(/^on/, ''));
17
+ videoRef.current?.addEventListener(eventName, eventHandler);
18
+ });
19
+ };
20
+ const removeEventListeners = () => {
21
+ Object.entries(eventHandlers).forEach(([eventHandlerName, eventHandler]) => {
22
+ const eventName = lowercaseFirstLetter(eventHandlerName.replace(/^on/, ''));
23
+ videoRef.current?.removeEventListener(eventName, eventHandler);
24
+ });
25
+ };
26
+ addEventListeners();
27
+
28
+ // Cleanup function
29
+ return () => {
30
+ removeEventListeners();
31
+ };
32
+ }, [eventHandlers]);
33
+ return videoRef;
34
+ };
35
+ exports.useVideoWithCustomEvent = useVideoWithCustomEvent;
@@ -0,0 +1,17 @@
1
+ import { IConfig as IResizerConfig } from '@chaomingd/hooks';
2
+ import { HTMLAttributes, MutableRefObject } from 'react';
3
+ import './index.less';
4
+ export interface ResizerProps extends HTMLAttributes<HTMLDivElement> {
5
+ resizerConfig?: Omit<IResizerConfig, 'elRef'>;
6
+ thumbClassName?: string;
7
+ thumbStyle?: ResizerProps['style'];
8
+ containerRef?: MutableRefObject<HTMLDivElement | null>;
9
+ manu?: boolean;
10
+ thumbColor?: string;
11
+ onResize?: (size: {
12
+ width: number;
13
+ height: number;
14
+ }) => void;
15
+ }
16
+ declare const _default: import("react").NamedExoticComponent<ResizerProps>;
17
+ export default _default;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _hooks = require("@chaomingd/hooks");
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _react = require("react");
11
+ require("./index.less");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ const Resizer = ({
14
+ children,
15
+ resizerConfig,
16
+ thumbClassName,
17
+ style,
18
+ thumbStyle,
19
+ containerRef,
20
+ className,
21
+ manu,
22
+ thumbColor,
23
+ onResize,
24
+ ...props
25
+ }) => {
26
+ const thumbRef = (0, _react.useRef)();
27
+ const elRef = (0, _react.useRef)(null);
28
+ const [resizing, setResizing] = (0, _react.useState)(false);
29
+ const direction = resizerConfig?.direction || 'left';
30
+ (0, _hooks.useResizer)({
31
+ elRef: thumbRef,
32
+ firstUpdate: true,
33
+ ...(resizerConfig || {}),
34
+ updator: state => {
35
+ const el = elRef.current;
36
+ if (!el) return;
37
+ if (manu !== true) {
38
+ if (direction === 'left' || direction === 'right') {
39
+ el.style.width = state.deltaX + 'px';
40
+ } else {
41
+ el.style.height = state.deltaY + 'px';
42
+ }
43
+ }
44
+ resizerConfig?.updator?.(state);
45
+ onResize?.({
46
+ width: state.deltaX,
47
+ height: state.deltaY
48
+ });
49
+ },
50
+ resizingChange: setResizing
51
+ });
52
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
53
+ ...props,
54
+ ref: el => {
55
+ elRef.current = el;
56
+ if (containerRef) {
57
+ containerRef.current = el;
58
+ }
59
+ },
60
+ style: {
61
+ ...style,
62
+ transition: resizing ? 'none' : undefined
63
+ },
64
+ className: (0, _classnames.default)('laf-resizer', className),
65
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
66
+ ref: thumbRef,
67
+ style: {
68
+ ...(thumbStyle || {}),
69
+ '--laf-resizer-thumb-color': thumbColor
70
+ },
71
+ className: (0, _classnames.default)('laf-resizer-thumb', thumbClassName, resizing && 'laf-resizer-thumb-resizing', `laf-resizer-thumb-direction-${direction}`)
72
+ }), children]
73
+ });
74
+ };
75
+ var _default = exports.default = /*#__PURE__*/(0, _react.memo)(Resizer);
@@ -0,0 +1,73 @@
1
+ .laf-resizer {
2
+ position: relative;
3
+
4
+ &-thumb {
5
+ position: absolute;
6
+ z-index: 1000;
7
+ background-color: transparent;
8
+ transition: background-color 0.3s;
9
+ user-select: none;
10
+
11
+ &:hover {
12
+ background-color: var(--laf-resizer-thumb-color);
13
+ }
14
+
15
+ &-resizing {
16
+ background-color: var(--laf-resizer-thumb-color);
17
+
18
+ &::after {
19
+ display: block;
20
+ }
21
+ }
22
+
23
+ &::after {
24
+ content: '';
25
+ position: absolute;
26
+ top: 50%;
27
+ left: 50%;
28
+ transform: translate(-50%, -50%);
29
+ width: 200px;
30
+ height: 200px;
31
+ min-width: 100%;
32
+ min-height: 100%;
33
+ cursor: inherit;
34
+ display: none;
35
+ }
36
+
37
+ &-direction-left {
38
+ width: 2px;
39
+ left: 0;
40
+ top: 0;
41
+ transform: translateX(-50%);
42
+ height: 100%;
43
+ cursor: col-resize;
44
+ }
45
+
46
+ &-direction-right {
47
+ width: 2px;
48
+ right: 0;
49
+ top: 0;
50
+ transform: translateX(50%);
51
+ height: 100%;
52
+ cursor: col-resize;
53
+ }
54
+
55
+ &-direction-top {
56
+ width: 100%;
57
+ left: 0;
58
+ top: 0;
59
+ transform: translateY(-50%);
60
+ height: 2px;
61
+ cursor: row-resize;
62
+ }
63
+
64
+ &-direction-bottom {
65
+ width: 100%;
66
+ left: 0;
67
+ bottom: 0;
68
+ transform: translateY(50%);
69
+ height: 2px;
70
+ cursor: row-resize;
71
+ }
72
+ }
73
+ }
@@ -0,0 +1 @@
1
+ export default function SetupAntApp(): null;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = SetupAntApp;
7
+ var _react = require("react");
8
+ var _antd = require("antd");
9
+ var _getAntApp = require("../getAntApp");
10
+ function SetupAntApp() {
11
+ const antApp = _antd.App.useApp();
12
+ (0, _react.useEffect)(() => {
13
+ (0, _getAntApp.setAntApp)(antApp);
14
+ }, []);
15
+ return null;
16
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { TransitionProps } from './type';
3
+ declare const Transition: ({ children, visible, exitUnMount, transitionName, duration, appear, ...props }: TransitionProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
4
+ export default Transition;
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _store = require("@chaomingd/store");
8
+ var _ahooks = require("ahooks");
9
+ var _react = require("react");
10
+ var _type = require("./type");
11
+ var _utils = require("./utils");
12
+ const Transition = ({
13
+ children,
14
+ visible,
15
+ exitUnMount = true,
16
+ transitionName,
17
+ duration = _utils.DEFAULT_DURATION,
18
+ appear = true,
19
+ ...props
20
+ }) => {
21
+ const propsRef = (0, _ahooks.useLatest)(props);
22
+ const transitionModel = (0, _store.useModel)({
23
+ state: {
24
+ status: visible && !appear ? _type.ETransitionStatus.entered : _type.ETransitionStatus.exited
25
+ }
26
+ });
27
+ const transitionClassNames = (0, _react.useMemo)(() => {
28
+ let baseClassNames;
29
+ if (!transitionName) {
30
+ baseClassNames = ['transtion'];
31
+ } else {
32
+ baseClassNames = typeof transitionName === 'string' ? [transitionName] : transitionName;
33
+ }
34
+ return baseClassNames.map(baseClassName => {
35
+ const classNames = {};
36
+ Object.keys(_type.ETransitionStatus).forEach(status => {
37
+ classNames[status] = `${baseClassName}-${status}`;
38
+ });
39
+ return classNames;
40
+ });
41
+ }, [transitionName]);
42
+ const {
43
+ status
44
+ } = transitionModel.useGetState();
45
+ const transitionClassNamesWithStatus = (0, _react.useMemo)(() => {
46
+ return transitionClassNames.map(item => item[status]);
47
+ }, [transitionClassNames, status]);
48
+ const transitionTimerRef = (0, _react.useRef)();
49
+ const enteringTimerRef = (0, _react.useRef)();
50
+ (0, _react.useEffect)(() => {
51
+ clearTimeout(transitionTimerRef.current);
52
+ clearTimeout(enteringTimerRef.current);
53
+ const {
54
+ status: currentStatus
55
+ } = transitionModel.getState();
56
+ if (visible) {
57
+ if (![_type.ETransitionStatus.entering, _type.ETransitionStatus.entered].includes(currentStatus)) {
58
+ transitionModel.setState({
59
+ status: _type.ETransitionStatus.enter
60
+ });
61
+ propsRef.current?.onEnter?.();
62
+ }
63
+ } else {
64
+ if (![_type.ETransitionStatus.exited, _type.ETransitionStatus.exiting].includes(currentStatus)) {
65
+ transitionModel.setState({
66
+ status: _type.ETransitionStatus.exit
67
+ });
68
+ propsRef.current?.onExit?.();
69
+ }
70
+ }
71
+ // eslint-disable-next-line
72
+ }, [visible]);
73
+ // entering
74
+ (0, _react.useEffect)(() => {
75
+ if ([_type.ETransitionStatus.enter, _type.ETransitionStatus.exit].includes(status)) {
76
+ clearTimeout(enteringTimerRef.current);
77
+ enteringTimerRef.current = setTimeout(() => {
78
+ if (status === _type.ETransitionStatus.enter) {
79
+ transitionModel.setState({
80
+ status: _type.ETransitionStatus.entering
81
+ });
82
+ propsRef.current?.onEntering?.();
83
+ } else if (status === _type.ETransitionStatus.exit) {
84
+ transitionModel.setState({
85
+ status: _type.ETransitionStatus.exiting
86
+ });
87
+ propsRef.current?.onExiting?.();
88
+ }
89
+ }, 17);
90
+ }
91
+ // eslint-disable-next-line
92
+ }, [status]);
93
+ // entered
94
+ (0, _react.useEffect)(() => {
95
+ if ([_type.ETransitionStatus.entering, _type.ETransitionStatus.exiting].includes(status)) {
96
+ clearTimeout(transitionTimerRef.current);
97
+ transitionTimerRef.current = setTimeout(() => {
98
+ if (status === _type.ETransitionStatus.entering) {
99
+ transitionModel.setState({
100
+ status: _type.ETransitionStatus.entered
101
+ });
102
+ propsRef.current?.onEntered?.();
103
+ } else if (status === _type.ETransitionStatus.exiting) {
104
+ transitionModel.setState({
105
+ status: _type.ETransitionStatus.exited
106
+ });
107
+ propsRef.current?.onExited?.();
108
+ }
109
+ }, (0, _utils.getDuration)({
110
+ duration,
111
+ status: _type.ETransitionStatus.entering === status ? _type.ETransitionStatus.enter : _type.ETransitionStatus.exit
112
+ }));
113
+ }
114
+ // eslint-disable-next-line
115
+ }, [status]);
116
+ (0, _ahooks.useUnmount)(() => {
117
+ clearTimeout(transitionTimerRef.current);
118
+ clearTimeout(enteringTimerRef.current);
119
+ });
120
+ if (exitUnMount) {
121
+ if (status === _type.ETransitionStatus.exited) return null;
122
+ }
123
+ if (typeof children === 'function') {
124
+ return children(status, transitionClassNamesWithStatus[0], transitionClassNamesWithStatus);
125
+ }
126
+ return children;
127
+ };
128
+ var _default = exports.default = Transition;
@@ -0,0 +1,33 @@
1
+ import { ReactElement } from 'react';
2
+ export interface TransitionProps {
3
+ visible?: boolean;
4
+ appear?: boolean;
5
+ exitUnMount?: boolean;
6
+ children: ReactElement | ((status: ETransitionStatus, transitionName: string, transitionNames: string[]) => ReactElement);
7
+ duration?: number | {
8
+ enter: number;
9
+ exit: number;
10
+ };
11
+ transitionName?: string | string[];
12
+ onEnter?: () => any;
13
+ onEntering?: () => any;
14
+ onEntered?: () => any;
15
+ onExit?: () => any;
16
+ onExiting?: () => any;
17
+ onExited?: () => any;
18
+ }
19
+ export declare enum ETransitionStatus {
20
+ none = "none",
21
+ enter = "enter",
22
+ entering = "entering",
23
+ entered = "entered",
24
+ exit = "exit",
25
+ exiting = "exiting",
26
+ exited = "exited"
27
+ }
28
+ export interface ITransitionState {
29
+ status: ETransitionStatus;
30
+ }
31
+ export declare const ENTER_STATUS_SQUENCE: ETransitionStatus[];
32
+ export declare const EXIT_STATUS_SQUENCE: ETransitionStatus[];
33
+ export type TransitionClassNames = Record<ETransitionStatus, string>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EXIT_STATUS_SQUENCE = exports.ETransitionStatus = exports.ENTER_STATUS_SQUENCE = void 0;
7
+ let ETransitionStatus = exports.ETransitionStatus = /*#__PURE__*/function (ETransitionStatus) {
8
+ ETransitionStatus["none"] = "none";
9
+ ETransitionStatus["enter"] = "enter";
10
+ ETransitionStatus["entering"] = "entering";
11
+ ETransitionStatus["entered"] = "entered";
12
+ ETransitionStatus["exit"] = "exit";
13
+ ETransitionStatus["exiting"] = "exiting";
14
+ ETransitionStatus["exited"] = "exited";
15
+ return ETransitionStatus;
16
+ }({});
17
+ const ENTER_STATUS_SQUENCE = exports.ENTER_STATUS_SQUENCE = [ETransitionStatus.entering, ETransitionStatus.entered];
18
+ const EXIT_STATUS_SQUENCE = exports.EXIT_STATUS_SQUENCE = [ETransitionStatus.exiting, ETransitionStatus.exited];
@@ -0,0 +1,6 @@
1
+ import { TransitionProps, ETransitionStatus } from './type';
2
+ export declare const DEFAULT_DURATION = 300;
3
+ export declare function getDuration({ duration, status, }: {
4
+ duration?: TransitionProps['duration'];
5
+ status: ETransitionStatus;
6
+ }): number;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DEFAULT_DURATION = void 0;
7
+ exports.getDuration = getDuration;
8
+ const DEFAULT_DURATION = exports.DEFAULT_DURATION = 300;
9
+ function getDuration({
10
+ duration,
11
+ status
12
+ }) {
13
+ let dur;
14
+ if (duration === undefined) {
15
+ dur = DEFAULT_DURATION;
16
+ } else if (typeof duration === 'number') {
17
+ dur = duration;
18
+ } else {
19
+ dur = duration[status] ?? DEFAULT_DURATION;
20
+ }
21
+ return dur;
22
+ }
@@ -0,0 +1,11 @@
1
+ import { FC, HTMLAttributes, ReactNode } from 'react';
2
+ import './index.less';
3
+ export interface IButtonIconProps extends HTMLAttributes<HTMLDivElement> {
4
+ icon?: ReactNode;
5
+ size?: 'default' | 'middle' | 'small' | 'large';
6
+ clickable?: boolean;
7
+ disabled?: boolean;
8
+ type?: 'primary' | 'default' | 'danger';
9
+ }
10
+ declare const IconButton: FC<IButtonIconProps>;
11
+ export default IconButton;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _cssPrefix = require("../../../constants/cssPrefix");
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ require("./index.less");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ const preCls = `${_cssPrefix.CSS_PREFIX}-icon-btn`;
14
+ const IconButton = ({
15
+ size = 'default',
16
+ disabled,
17
+ clickable = true,
18
+ icon,
19
+ type = 'default',
20
+ className,
21
+ ...props
22
+ }) => {
23
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
24
+ ...props,
25
+ className: (0, _classnames.default)(preCls, `${preCls}-size--${size}`, clickable && `${preCls}--clickable`, disabled && `${preCls}--disabled`, `${preCls}-type-${type}`, className),
26
+ children: icon
27
+ });
28
+ };
29
+ var _default = exports.default = IconButton;
@@ -0,0 +1,58 @@
1
+ @import '../../../styles/var.less';
2
+
3
+ .buttonIconType(@type) {
4
+ &-type-@{type} {
5
+ color: ~'var(--cm-icon-btn-@{type}-color)';
6
+
7
+ &:hover {
8
+ color: ~'var(--cm-icon-btn-@{type}-color-hover)';
9
+ }
10
+
11
+ &:active {
12
+ color: ~'var(--cm-icon-btn-@{type}-color-active)';
13
+ }
14
+
15
+ }
16
+ &--disabled&-type-@{type} {
17
+ color: ~'var(--cm-icon-btn-@{type}-color-disabled)';
18
+ }
19
+ }
20
+
21
+ @fontSizeMap: {
22
+ @large: 32px;
23
+ @default: 24px;
24
+ @middle: 18px;
25
+ @small: 16px;
26
+ }
27
+
28
+ .buttonSize(@size) {
29
+ &-size--@{size} {
30
+ font-size: @fontSizeMap[@@size];
31
+ }
32
+ }
33
+
34
+ @preCls: ~'@{prefix}-icon-btn';
35
+
36
+ .@{preCls} {
37
+ display: inline-block;
38
+ line-height: 1em;
39
+ // size
40
+ .buttonSize(default);
41
+ .buttonSize(middle);
42
+ .buttonSize(small);
43
+ .buttonSize(large);
44
+
45
+ // type
46
+ .buttonIconType(default);
47
+ .buttonIconType(primary);
48
+ .buttonIconType(danger);
49
+
50
+ &--clickable {
51
+ cursor: pointer;
52
+ }
53
+
54
+ &--disabled {
55
+ cursor: not-allowed;
56
+ }
57
+ }
58
+
@@ -0,0 +1,2 @@
1
+ declare const SlashSvg: () => import("react/jsx-runtime").JSX.Element;
2
+ export default SlashSvg;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ const SlashSvg = () => {
11
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
12
+ width: "1em",
13
+ height: "1em",
14
+ viewBox: "0 0 16 16",
15
+ fill: "currentColor",
16
+ xmlns: "http://www.w3.org/2000/svg",
17
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
18
+ d: "M4.06689 13.8119L11.0669 1.6875L11.9329 2.1875L4.93292 14.3119L4.06689 13.8119Z"
19
+ })
20
+ });
21
+ };
22
+ var _default = exports.default = SlashSvg;
@@ -0,0 +1,11 @@
1
+ import { HTMLAttributes } from 'react';
2
+ type SvgIconProps = HTMLAttributes<HTMLOrSVGElement>;
3
+ export declare const SlashSvg: (props: SvgIconProps) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const ZipSvg: (props: SvgIconProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const RarSvg: (props: SvgIconProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const DocSvg: (props: SvgIconProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const PdfSvg: (props: SvgIconProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const TxtSvg: (props: SvgIconProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const CloseSvg: (props: SvgIconProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const DeleteSvg: (props: SvgIconProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};