assui 3.2.67 → 3.2.69

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 (41) hide show
  1. package/es/button-drawer/index.d.ts +2 -2
  2. package/es/button-drawer/index.js +19 -18
  3. package/es/button-modal/index.d.ts +2 -2
  4. package/es/button-modal/index.js +16 -12
  5. package/es/index.d.ts +2 -0
  6. package/es/index.js +2 -1
  7. package/es/rc-split-view/DraggableHandle.d.ts +19 -0
  8. package/es/rc-split-view/DraggableHandle.js +37 -0
  9. package/es/rc-split-view/View.d.ts +13 -0
  10. package/es/rc-split-view/View.js +28 -0
  11. package/es/rc-split-view/demo/index.modules.less +9 -0
  12. package/es/rc-split-view/index.d.ts +65 -0
  13. package/es/rc-split-view/index.js +240 -0
  14. package/es/rc-split-view/style/index.css +76 -0
  15. package/es/rc-split-view/style/index.d.ts +1 -0
  16. package/es/rc-split-view/style/index.js +1 -0
  17. package/es/rc-split-view/style/index.less +92 -0
  18. package/es/rc-split-view/utils.d.ts +16 -0
  19. package/es/rc-split-view/utils.js +47 -0
  20. package/es/style/variables.less +1 -0
  21. package/lib/button-drawer/index.d.ts +2 -2
  22. package/lib/button-drawer/index.js +18 -17
  23. package/lib/button-modal/index.d.ts +2 -2
  24. package/lib/button-modal/index.js +16 -12
  25. package/lib/index.d.ts +2 -0
  26. package/lib/index.js +8 -0
  27. package/lib/rc-split-view/DraggableHandle.d.ts +19 -0
  28. package/lib/rc-split-view/DraggableHandle.js +47 -0
  29. package/lib/rc-split-view/View.d.ts +13 -0
  30. package/lib/rc-split-view/View.js +38 -0
  31. package/lib/rc-split-view/demo/index.modules.less +9 -0
  32. package/lib/rc-split-view/index.d.ts +65 -0
  33. package/lib/rc-split-view/index.js +251 -0
  34. package/lib/rc-split-view/style/index.css +76 -0
  35. package/lib/rc-split-view/style/index.d.ts +1 -0
  36. package/lib/rc-split-view/style/index.js +6 -0
  37. package/lib/rc-split-view/style/index.less +92 -0
  38. package/lib/rc-split-view/utils.d.ts +16 -0
  39. package/lib/rc-split-view/utils.js +62 -0
  40. package/lib/style/variables.less +1 -0
  41. package/package.json +2 -2
@@ -7,8 +7,8 @@ export type DrawerAction = {
7
7
  export interface ButtonDrawerProps extends Omit<DrawerProps, 'children'> {
8
8
  onClose?: () => void;
9
9
  onOpen?: () => void;
10
- trigger: React.ReactElement;
10
+ trigger?: ((fun: () => void) => React.ReactElement) | React.ReactElement;
11
11
  children: ((v: DrawerAction) => React.ReactElement) | React.ReactElement;
12
12
  }
13
- declare const ForwardRefButtonDrawer: React.ForwardRefExoticComponent<ButtonDrawerProps & React.RefAttributes<unknown>>;
13
+ declare const ForwardRefButtonDrawer: React.ForwardRefExoticComponent<ButtonDrawerProps & React.RefAttributes<DrawerAction>>;
14
14
  export default ForwardRefButtonDrawer;
@@ -38,13 +38,17 @@ var __read = this && this.__read || function (o, n) {
38
38
  }
39
39
  return ar;
40
40
  };
41
- import React, { useState, useRef, useImperativeHandle } from 'react';
41
+ import React, { useRef, useImperativeHandle } from 'react';
42
42
  import Drawer from "antd/es/drawer";
43
43
  import isFunction from 'lodash/isFunction';
44
44
  import classNames from 'classnames';
45
45
  import CloseOutlined from "a-icons/es/CloseOutlined";
46
+ import { useControllableValue } from 'ahooks';
46
47
  var ButtonDrawer = function ButtonDrawer(props, ref) {
47
- var _a = __read(useState(false), 2),
48
+ var _a = __read(useControllableValue(props, {
49
+ valuePropName: 'open',
50
+ defaultValue: false
51
+ }), 2),
48
52
  drawerVisible = _a[0],
49
53
  setDrawerVisible = _a[1];
50
54
  var children = props.children,
@@ -55,32 +59,29 @@ var ButtonDrawer = function ButtonDrawer(props, ref) {
55
59
  className = props.className,
56
60
  restProps = __rest(props, ["children", "onOpen", "onClose", "trigger", "title", "className"]);
57
61
  var closeDrawer = function closeDrawer() {
58
- if (onClose) {
59
- onClose();
60
- }
61
62
  setDrawerVisible(false);
63
+ onClose === null || onClose === void 0 ? void 0 : onClose();
62
64
  };
63
65
  var openDrawer = function openDrawer() {
64
- if (onOpen) {
65
- onOpen();
66
- }
67
66
  setDrawerVisible(true);
67
+ onOpen === null || onOpen === void 0 ? void 0 : onOpen();
68
68
  };
69
69
  var actionRef = useRef({
70
- close: function close() {
71
- closeDrawer();
72
- },
73
- open: function open() {
74
- openDrawer();
75
- }
70
+ open: openDrawer,
71
+ close: closeDrawer
76
72
  });
77
73
  useImperativeHandle(ref, function () {
78
74
  return actionRef.current;
79
75
  });
80
- var buttonNode = trigger && /*#__PURE__*/React.cloneElement(trigger, {
81
- onClick: openDrawer
82
- });
83
- return /*#__PURE__*/React.createElement(React.Fragment, null, buttonNode, /*#__PURE__*/React.createElement(Drawer, __assign({
76
+ var triggerNode;
77
+ if (isFunction(trigger)) {
78
+ triggerNode = trigger(openDrawer);
79
+ } else {
80
+ triggerNode = trigger && /*#__PURE__*/React.cloneElement(trigger, {
81
+ onClick: openDrawer
82
+ });
83
+ }
84
+ return /*#__PURE__*/React.createElement(React.Fragment, null, triggerNode, /*#__PURE__*/React.createElement(Drawer, __assign({
84
85
  maskClosable: false,
85
86
  className: classNames('button-drawer', className),
86
87
  title: title,
@@ -7,8 +7,8 @@ export interface ModalAction {
7
7
  export interface ButtonModalProps extends Omit<ModalProps, 'children'> {
8
8
  onClose?: () => void;
9
9
  onOpen?: () => void;
10
- trigger?: React.ReactElement;
10
+ trigger?: ((fun: () => void) => React.ReactElement) | React.ReactElement;
11
11
  children: ((v: ModalAction) => React.ReactElement) | React.ReactElement;
12
12
  }
13
- declare const ForwardRefButtonModal: React.ForwardRefExoticComponent<ButtonModalProps & React.RefAttributes<unknown>>;
13
+ declare const ForwardRefButtonModal: React.ForwardRefExoticComponent<ButtonModalProps & React.RefAttributes<ModalAction>>;
14
14
  export default ForwardRefButtonModal;
@@ -42,8 +42,12 @@ import * as React from 'react';
42
42
  import isFunction from 'lodash/isFunction';
43
43
  import Modal from "antd/es/modal";
44
44
  import CloseOutlined from "a-icons/es/CloseOutlined";
45
+ import { useControllableValue } from 'ahooks';
45
46
  var ButtonModal = function ButtonModal(props, ref) {
46
- var _a = __read(React.useState(false), 2),
47
+ var _a = __read(useControllableValue(props, {
48
+ valuePropName: 'open',
49
+ defaultValue: false
50
+ }), 2),
47
51
  visible = _a[0],
48
52
  setModalVisible = _a[1];
49
53
  var children = props.children,
@@ -69,22 +73,22 @@ var ButtonModal = function ButtonModal(props, ref) {
69
73
  return modalActionRef.current;
70
74
  });
71
75
  var handleModalOk = function handleModalOk(e) {
72
- if (onOk) {
73
- return onOk(e);
74
- }
76
+ onOk === null || onOk === void 0 ? void 0 : onOk(e);
75
77
  closeModal();
76
- return null;
77
78
  };
78
79
  var handleModalCancel = function handleModalCancel(e) {
79
- if (onCancel) {
80
- onCancel(e);
81
- }
80
+ onCancel === null || onCancel === void 0 ? void 0 : onCancel(e);
82
81
  closeModal();
83
82
  };
84
- var buttonNode = trigger && /*#__PURE__*/React.cloneElement(trigger, {
85
- onClick: openModal
86
- });
87
- return /*#__PURE__*/React.createElement(React.Fragment, null, buttonNode, /*#__PURE__*/React.createElement(Modal, __assign({
83
+ var triggerNode;
84
+ if (isFunction(trigger)) {
85
+ triggerNode = trigger(openModal);
86
+ } else {
87
+ triggerNode = trigger && /*#__PURE__*/React.cloneElement(trigger, {
88
+ onClick: openModal
89
+ });
90
+ }
91
+ return /*#__PURE__*/React.createElement(React.Fragment, null, triggerNode, /*#__PURE__*/React.createElement(Modal, __assign({
88
92
  open: visible,
89
93
  onOk: handleModalOk,
90
94
  onCancel: handleModalCancel,
package/es/index.d.ts CHANGED
@@ -94,3 +94,5 @@ export { default as SignaturePad } from './signature-pad';
94
94
  export type { SignaturePadProps } from './signature-pad';
95
95
  export { default as MultiLineEllipsisText } from './multi-line-ellipsis-text';
96
96
  export type { MultiLineEllipsisTextProps } from './multi-line-ellipsis-text';
97
+ export type { RcSplitViewProps } from './rc-split-view';
98
+ export { default as RcSplitView } from './rc-split-view';
package/es/index.js CHANGED
@@ -47,4 +47,5 @@ export { default as CountDown } from './count-down';
47
47
  export { default as CountUp } from './count-up';
48
48
  export { default as ConditionSelect } from './condition-select';
49
49
  export { default as SignaturePad } from './signature-pad';
50
- export { default as MultiLineEllipsisText } from './multi-line-ellipsis-text';
50
+ export { default as MultiLineEllipsisText } from './multi-line-ellipsis-text';
51
+ export { default as RcSplitView } from './rc-split-view';
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ interface DraggableHandleProps {
3
+ /** 组件样式 */
4
+ className: string;
5
+ /** 点击回调 */
6
+ onClick?: (value: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
7
+ /** 双击回调 */
8
+ onDoubleClick?: (value: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
9
+ /** 按下鼠标按钮回调 */
10
+ onMouseDown: (value: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
11
+ /** 事件在一个或多个触点与触控设备表面接触时被触发 */
12
+ onTouchStart: (value: React.TouchEvent<HTMLSpanElement>) => void;
13
+ /** 事件在一个或多个触点从触控平面上移开时触发 */
14
+ onTouchEnd: (value: React.TouchEvent<HTMLSpanElement>) => void;
15
+ /** 子元素 */
16
+ children?: React.ReactNode;
17
+ }
18
+ declare const DraggableHandle: React.FC<DraggableHandleProps>;
19
+ export default DraggableHandle;
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ var DraggableHandle = function DraggableHandle(props) {
3
+ var className = props.className,
4
+ _onClick = props.onClick,
5
+ _onDoubleClick = props.onDoubleClick,
6
+ _onMouseDown = props.onMouseDown,
7
+ _onTouchEnd = props.onTouchEnd,
8
+ _onTouchStart = props.onTouchStart,
9
+ children = props.children;
10
+ return /*#__PURE__*/React.createElement("div", {
11
+ className: className,
12
+ onMouseDown: function onMouseDown(event) {
13
+ return _onMouseDown(event);
14
+ },
15
+ onTouchStart: function onTouchStart(event) {
16
+ event.preventDefault();
17
+ _onTouchStart(event);
18
+ },
19
+ onTouchEnd: function onTouchEnd(event) {
20
+ event.preventDefault();
21
+ _onTouchEnd(event);
22
+ },
23
+ onClick: function onClick(event) {
24
+ if (_onClick) {
25
+ event.preventDefault();
26
+ _onClick(event);
27
+ }
28
+ },
29
+ onDoubleClick: function onDoubleClick(event) {
30
+ if (_onDoubleClick) {
31
+ event.preventDefault();
32
+ _onDoubleClick(event);
33
+ }
34
+ }
35
+ }, children);
36
+ };
37
+ export default DraggableHandle;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ interface ViewProps {
3
+ /** 子元素 */
4
+ children: React.ReactNode;
5
+ /** 样式 */
6
+ className?: string;
7
+ /** 拆分方式 */
8
+ split: 'vertical' | 'horizontal';
9
+ /** 大小 */
10
+ size?: string | number;
11
+ }
12
+ declare const View: React.ForwardRefExoticComponent<ViewProps & React.RefAttributes<HTMLDivElement>>;
13
+ export default View;
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import isUndefined from 'lodash/isUndefined';
3
+ var View = /*#__PURE__*/React.forwardRef(function (props, ref) {
4
+ var children = props.children,
5
+ className = props.className,
6
+ split = props.split,
7
+ size = props.size;
8
+ var viewStyle = {
9
+ flex: 1,
10
+ position: 'relative',
11
+ outline: 'none'
12
+ };
13
+ if (!isUndefined(size)) {
14
+ if (split === 'vertical') {
15
+ viewStyle.width = size;
16
+ } else {
17
+ viewStyle.height = size;
18
+ viewStyle.display = 'flex';
19
+ }
20
+ viewStyle.flex = 'none';
21
+ }
22
+ return /*#__PURE__*/React.createElement("div", {
23
+ ref: ref,
24
+ className: className,
25
+ style: viewStyle
26
+ }, children);
27
+ });
28
+ export default View;
@@ -0,0 +1,9 @@
1
+ .handle {
2
+ position: absolute;
3
+ top: 50%;
4
+ left: 5px;
5
+ width: 4px;
6
+ height: 40px;
7
+ background-color: red;
8
+ transform: translateY(-50%);
9
+ }
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import View from './View';
3
+ export { View };
4
+ export interface RcSplitViewProps {
5
+ /** 是否允许拖动 */
6
+ draggable?: boolean;
7
+ /** children */
8
+ children: React.ReactNode;
9
+ /** 自定义组件类名 */
10
+ className?: string;
11
+ /** 拖拽条单击回调 */
12
+ onResizerClick?: (event: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
13
+ /** 拖拽条双击回调 */
14
+ onResizerDoubleClick?: (event: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
15
+ /** 面板样式 */
16
+ viewClassName?: string;
17
+ /** 第一个面板样式 */
18
+ firstViewClassName?: string;
19
+ /** 第二个面板样式 */
20
+ secondViewClassName?: string;
21
+ /** 分隔条样式 */
22
+ handleClassName?: string;
23
+ /** 分隔条内容样式 */
24
+ handleContentClassName?: string;
25
+ /** 拆分方式 */
26
+ split?: 'vertical' | 'horizontal';
27
+ /** 拖拽过程回调 */
28
+ onChange?: (newSize: number) => void;
29
+ /** 拖拽开始回调 */
30
+ onDragStarted?: () => void;
31
+ /** 拖拽完成回调 */
32
+ onDragFinished?: (newSize: number) => void;
33
+ /** 主体窗口 */
34
+ primary?: 'first' | 'second';
35
+ /** 拖动固定步进值 */
36
+ step?: number;
37
+ /** 最大窗口大小 */
38
+ maxSize?: number;
39
+ /** 最小窗口大小 */
40
+ minSize?: number;
41
+ /** 窗口大小 */
42
+ size?: string | number;
43
+ /** 默认窗口大小 */
44
+ defaultSize?: string | number;
45
+ /** 分隔条内容 */
46
+ handleContent?: React.ReactNode;
47
+ }
48
+ export type StatesTypes = {
49
+ /** 激活 */
50
+ active: boolean;
51
+ /** 位置 */
52
+ position: number;
53
+ /** 拖拽尺寸 */
54
+ draggedSize?: number;
55
+ /** 实例参数 */
56
+ instanceProps: {
57
+ size?: string | number;
58
+ };
59
+ /** 第一面板的尺寸 */
60
+ firstViewSize?: number | string;
61
+ /** 第二面板的尺寸 */
62
+ secondViewSize?: number | string;
63
+ };
64
+ declare const RcSplitView: React.FC<RcSplitViewProps>;
65
+ export default RcSplitView;
@@ -0,0 +1,240 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6
+ }
7
+ return t;
8
+ };
9
+ return __assign.apply(this, arguments);
10
+ };
11
+ var __read = this && this.__read || function (o, n) {
12
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
13
+ if (!m) return o;
14
+ var i = m.call(o),
15
+ r,
16
+ ar = [],
17
+ e;
18
+ try {
19
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
20
+ } catch (error) {
21
+ e = {
22
+ error: error
23
+ };
24
+ } finally {
25
+ try {
26
+ if (r && !r.done && (m = i["return"])) m.call(i);
27
+ } finally {
28
+ if (e) throw e.error;
29
+ }
30
+ }
31
+ return ar;
32
+ };
33
+ import React from 'react';
34
+ import useGetState from "ahooks/es/useGetState";
35
+ import useMount from "ahooks/es/useMount";
36
+ import useUnmount from "ahooks/es/useUnmount";
37
+ import classNames from 'classnames';
38
+ import isUndefined from 'lodash/isUndefined';
39
+ import View from './View';
40
+ import DraggableHandle from './DraggableHandle';
41
+ import { getSizeUpdate, removeNullChildren, getDefaultSize, unFocus } from './utils';
42
+ export { View };
43
+ var RcSplitView = function RcSplitView(props) {
44
+ var _a;
45
+ var _b = props.draggable,
46
+ draggable = _b === void 0 ? true : _b,
47
+ children = props.children,
48
+ className = props.className,
49
+ onResizerClick = props.onResizerClick,
50
+ onResizerDoubleClick = props.onResizerDoubleClick,
51
+ viewClassName = props.viewClassName,
52
+ firstViewClassName = props.firstViewClassName,
53
+ secondViewClassName = props.secondViewClassName,
54
+ handleClassName = props.handleClassName,
55
+ _c = props.split,
56
+ split = _c === void 0 ? 'vertical' : _c,
57
+ onDragStarted = props.onDragStarted,
58
+ onDragFinished = props.onDragFinished,
59
+ _d = props.primary,
60
+ primary = _d === void 0 ? 'first' : _d,
61
+ step = props.step,
62
+ maxSize = props.maxSize,
63
+ _e = props.minSize,
64
+ minSize = _e === void 0 ? 50 : _e,
65
+ onChange = props.onChange,
66
+ size = props.size,
67
+ defaultSize = props.defaultSize,
68
+ handleContent = props.handleContent,
69
+ handleContentClassName = props.handleContentClassName;
70
+ var initialSize = isUndefined(size) ? getDefaultSize(defaultSize, minSize, maxSize) : size;
71
+ var initialValue = {
72
+ active: false,
73
+ firstViewSize: primary === 'first' ? initialSize : undefined,
74
+ secondViewSize: primary === 'second' ? initialSize : undefined,
75
+ // these are props that are needed in static functions. ie: gDSFP
76
+ instanceProps: {
77
+ size: size
78
+ },
79
+ position: 0
80
+ };
81
+ var splitViewRef = React.useRef(null);
82
+ var firstViewRef = React.useRef(null);
83
+ var secondViewRef = React.useRef(null);
84
+ var _f = __read(useGetState(initialValue), 3),
85
+ states = _f[0],
86
+ setStates = _f[1],
87
+ getStates = _f[2];
88
+ var onTouchStart = function onTouchStart(event) {
89
+ var currentValue = getStates();
90
+ if (draggable) {
91
+ unFocus(document, window);
92
+ var _a = event.touches[0],
93
+ clientX = _a.clientX,
94
+ clientY = _a.clientY;
95
+ var position = split === 'vertical' ? clientX : clientY;
96
+ onDragStarted === null || onDragStarted === void 0 ? void 0 : onDragStarted();
97
+ setStates(__assign(__assign({}, currentValue), {
98
+ active: true,
99
+ position: position
100
+ }));
101
+ }
102
+ };
103
+ var onMouseDown = function onMouseDown(event) {
104
+ var eventWithTouches = __assign(__assign({}, event), {
105
+ touches: [{
106
+ clientX: event.clientX,
107
+ clientY: event.clientY
108
+ }]
109
+ });
110
+ onTouchStart(eventWithTouches);
111
+ };
112
+ var onMouseUp = function onMouseUp() {
113
+ var currentValue = getStates();
114
+ var active = currentValue.active,
115
+ draggedSize = currentValue.draggedSize;
116
+ if (draggable && active && draggedSize) {
117
+ onDragFinished === null || onDragFinished === void 0 ? void 0 : onDragFinished(draggedSize);
118
+ setStates(__assign(__assign({}, currentValue), {
119
+ active: false
120
+ }));
121
+ }
122
+ };
123
+ var onTouchMove = function onTouchMove(event) {
124
+ var _a;
125
+ var _b;
126
+ var currentValue = getStates();
127
+ var active = currentValue.active,
128
+ position = currentValue.position;
129
+ if (draggable && active) {
130
+ unFocus(document, window);
131
+ var isFirstPrimary = primary === 'first';
132
+ var firstRef = isFirstPrimary ? firstViewRef.current : secondViewRef.current;
133
+ var secondRef = isFirstPrimary ? secondViewRef.current : firstViewRef.current;
134
+ if (firstRef && secondRef) {
135
+ var firstNode = firstRef;
136
+ var secondNode = secondRef;
137
+ if (firstNode.getBoundingClientRect) {
138
+ var _c = firstNode.getBoundingClientRect(),
139
+ width = _c.width,
140
+ height = _c.height;
141
+ var current = split === 'vertical' ? event.touches[0].clientX : event.touches[0].clientY;
142
+ var nodeSize = split === 'vertical' ? width : height;
143
+ var positionDelta = position - current;
144
+ if (step) {
145
+ if (Math.abs(positionDelta) < step) {
146
+ return;
147
+ }
148
+ positionDelta = Math.trunc(positionDelta / step) * step;
149
+ }
150
+ var sizeDelta = isFirstPrimary ? positionDelta : -positionDelta;
151
+ var firstViewOrder = parseInt(window.getComputedStyle(firstNode).order, 10);
152
+ var secondViewOrder = parseInt(window.getComputedStyle(secondNode).order, 10);
153
+ if (firstViewOrder > secondViewOrder) {
154
+ sizeDelta = -sizeDelta;
155
+ }
156
+ var newMaxSize = maxSize || 0;
157
+ if (!isUndefined(maxSize) && maxSize <= 0) {
158
+ if (split === 'vertical') {
159
+ newMaxSize = ((_b = splitViewRef.current.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.width) + maxSize;
160
+ } else {
161
+ newMaxSize = splitViewRef.current.getBoundingClientRect().height + maxSize;
162
+ }
163
+ }
164
+ var newSize = +nodeSize - sizeDelta;
165
+ var newPosition = position - positionDelta;
166
+ var restValue = {};
167
+ if (newSize < minSize) {
168
+ newSize = minSize;
169
+ } else if (!isUndefined(maxSize) && newSize > newMaxSize) {
170
+ newSize = newMaxSize;
171
+ } else {
172
+ restValue = {
173
+ position: newPosition
174
+ };
175
+ }
176
+ onChange === null || onChange === void 0 ? void 0 : onChange(newSize);
177
+ setStates(__assign(__assign(__assign({}, currentValue), (_a = {
178
+ draggedSize: newSize
179
+ }, _a[isFirstPrimary ? 'firstViewSize' : 'secondViewSize'] = newSize, _a)), restValue));
180
+ }
181
+ }
182
+ }
183
+ };
184
+ var onMouseMove = function onMouseMove(event) {
185
+ var eventWithTouches = __assign(__assign({}, event), {
186
+ touches: [{
187
+ clientX: event.clientX,
188
+ clientY: event.clientY
189
+ }]
190
+ });
191
+ onTouchMove(eventWithTouches);
192
+ };
193
+ useMount(function () {
194
+ document.addEventListener('mouseup', onMouseUp);
195
+ document.addEventListener('mousemove', onMouseMove);
196
+ document.addEventListener('touchmove', onTouchMove);
197
+ setStates(getSizeUpdate({
198
+ size: size,
199
+ defaultSize: defaultSize,
200
+ maxSize: maxSize,
201
+ minSize: minSize,
202
+ primary: primary
203
+ }, states));
204
+ });
205
+ useUnmount(function () {
206
+ document.removeEventListener('mouseup', onMouseUp);
207
+ document.removeEventListener('mousemove', onMouseMove);
208
+ document.removeEventListener('touchmove', onTouchMove);
209
+ });
210
+ var _g = __read(removeNullChildren(children), 2),
211
+ firstViewNode = _g[0],
212
+ secondViewNode = _g[1];
213
+ return /*#__PURE__*/React.createElement("div", {
214
+ className: classNames('split-view', "split-view-".concat(split), className),
215
+ ref: splitViewRef
216
+ }, /*#__PURE__*/React.createElement(View, {
217
+ className: classNames(viewClassName, firstViewClassName),
218
+ key: "first-view",
219
+ ref: firstViewRef,
220
+ size: states.firstViewSize,
221
+ split: split
222
+ }, firstViewNode), /*#__PURE__*/React.createElement(DraggableHandle, {
223
+ className: classNames('split-view-draggable-handle', (_a = {}, _a["split-view-draggable-handle-".concat(split, "-disabled")] = !draggable, _a), "split-view-draggable-handle-".concat(split), handleClassName),
224
+ onClick: onResizerClick,
225
+ onDoubleClick: onResizerDoubleClick,
226
+ onMouseDown: onMouseDown,
227
+ onTouchStart: onTouchStart,
228
+ onTouchEnd: onMouseUp,
229
+ key: "draggableHandle"
230
+ }, draggable && /*#__PURE__*/React.createElement("div", {
231
+ className: classNames("split-view-draggable-handle-".concat(split, "-content"), handleContentClassName)
232
+ }, handleContent)), /*#__PURE__*/React.createElement(View, {
233
+ className: classNames(viewClassName, secondViewClassName),
234
+ key: "second-view",
235
+ ref: secondViewRef,
236
+ size: states.secondViewSize,
237
+ split: split
238
+ }, secondViewNode));
239
+ };
240
+ export default RcSplitView;
@@ -0,0 +1,76 @@
1
+ .split-view {
2
+ position: absolute;
3
+ display: flex;
4
+ flex: 1;
5
+ height: 100%;
6
+ overflow: hidden;
7
+ outline: none;
8
+ -moz-user-select: text;
9
+ -webkit-user-select: text;
10
+ user-select: text;
11
+ }
12
+ .split-view-horizontal {
13
+ top: 0;
14
+ bottom: 0;
15
+ flex-direction: column;
16
+ width: 100%;
17
+ min-height: 100%;
18
+ }
19
+ .split-view-vertical {
20
+ right: 0;
21
+ left: 0;
22
+ flex-direction: row;
23
+ }
24
+ .split-view-draggable-handle {
25
+ position: relative;
26
+ z-index: 1;
27
+ background-color: #f5f5f5;
28
+ }
29
+ .split-view-draggable-handle-horizontal {
30
+ justify-content: center;
31
+ height: 2px;
32
+ border-top: 1px solid transparent;
33
+ transform: translateY(-50%);
34
+ cursor: row-resize;
35
+ }
36
+ .split-view-draggable-handle-horizontal-content {
37
+ position: absolute;
38
+ top: 50%;
39
+ left: 0;
40
+ width: 100%;
41
+ min-height: 10px;
42
+ transform: translateY(calc(-50% - 1px));
43
+ }
44
+ .split-view-draggable-handle-horizontal:hover {
45
+ border-top-color: #02a6e3;
46
+ }
47
+ .split-view-draggable-handle-horizontal-disabled {
48
+ cursor: default;
49
+ }
50
+ .split-view-draggable-handle-horizontal-disabled:hover {
51
+ border-top-color: transparent;
52
+ }
53
+ .split-view-draggable-handle-vertical {
54
+ align-items: center;
55
+ width: 2px;
56
+ border-left: 1px solid transparent;
57
+ transform: translateX(-50%);
58
+ cursor: col-resize;
59
+ }
60
+ .split-view-draggable-handle-vertical-content {
61
+ position: absolute;
62
+ top: 0;
63
+ left: 50%;
64
+ min-width: 10px;
65
+ height: 100%;
66
+ transform: translateX(calc(-50% - 1px));
67
+ }
68
+ .split-view-draggable-handle-vertical:hover {
69
+ border-left-color: #02a6e3;
70
+ }
71
+ .split-view-draggable-handle-vertical-disabled {
72
+ cursor: default;
73
+ }
74
+ .split-view-draggable-handle-vertical-disabled:hover {
75
+ border-left-color: transparent;
76
+ }
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1 @@
1
+ import './index.less';