assui 3.2.66 → 3.2.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.
- package/es/button-drawer/index.d.ts +13 -5
- package/es/button-drawer/index.js +20 -20
- package/es/button-modal/index.d.ts +13 -5
- package/es/button-modal/index.js +19 -20
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -1
- package/es/multi-line-ellipsis-text/index.d.ts +1 -1
- package/es/rc-split-view/DraggableHandle.d.ts +19 -0
- package/es/rc-split-view/DraggableHandle.js +37 -0
- package/es/rc-split-view/View.d.ts +13 -0
- package/es/rc-split-view/View.js +28 -0
- package/es/rc-split-view/demo/index.modules.less +9 -0
- package/es/rc-split-view/index.d.ts +65 -0
- package/es/rc-split-view/index.js +240 -0
- package/es/rc-split-view/style/index.css +76 -0
- package/es/rc-split-view/style/index.d.ts +1 -0
- package/es/rc-split-view/style/index.js +1 -0
- package/es/rc-split-view/style/index.less +92 -0
- package/es/rc-split-view/utils.d.ts +16 -0
- package/es/rc-split-view/utils.js +47 -0
- package/es/style/variables.less +1 -0
- package/lib/button-drawer/index.d.ts +13 -5
- package/lib/button-drawer/index.js +19 -19
- package/lib/button-modal/index.d.ts +13 -5
- package/lib/button-modal/index.js +19 -20
- package/lib/index.d.ts +2 -0
- package/lib/index.js +8 -0
- package/lib/multi-line-ellipsis-text/index.d.ts +1 -1
- package/lib/rc-split-view/DraggableHandle.d.ts +19 -0
- package/lib/rc-split-view/DraggableHandle.js +47 -0
- package/lib/rc-split-view/View.d.ts +13 -0
- package/lib/rc-split-view/View.js +38 -0
- package/lib/rc-split-view/demo/index.modules.less +9 -0
- package/lib/rc-split-view/index.d.ts +65 -0
- package/lib/rc-split-view/index.js +251 -0
- package/lib/rc-split-view/style/index.css +76 -0
- package/lib/rc-split-view/style/index.d.ts +1 -0
- package/lib/rc-split-view/style/index.js +6 -0
- package/lib/rc-split-view/style/index.less +92 -0
- package/lib/rc-split-view/utils.d.ts +16 -0
- package/lib/rc-split-view/utils.js +62 -0
- package/lib/style/variables.less +1 -0
- package/package.json +3 -4
- package/LICENSE +0 -21
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __assign = this && this.__assign || function () {
|
|
4
|
+
__assign = Object.assign || function (t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __read = this && this.__read || function (o, n) {
|
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
+
if (!m) return o;
|
|
16
|
+
var i = m.call(o),
|
|
17
|
+
r,
|
|
18
|
+
ar = [],
|
|
19
|
+
e;
|
|
20
|
+
try {
|
|
21
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
e = {
|
|
24
|
+
error: error
|
|
25
|
+
};
|
|
26
|
+
} finally {
|
|
27
|
+
try {
|
|
28
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
29
|
+
} finally {
|
|
30
|
+
if (e) throw e.error;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
|
36
|
+
return mod && mod.__esModule ? mod : {
|
|
37
|
+
"default": mod
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", {
|
|
41
|
+
value: true
|
|
42
|
+
});
|
|
43
|
+
exports.View = void 0;
|
|
44
|
+
var react_1 = __importDefault(require("react"));
|
|
45
|
+
var useGetState_1 = __importDefault(require("ahooks/lib/useGetState"));
|
|
46
|
+
var useMount_1 = __importDefault(require("ahooks/lib/useMount"));
|
|
47
|
+
var useUnmount_1 = __importDefault(require("ahooks/lib/useUnmount"));
|
|
48
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
49
|
+
var isUndefined_1 = __importDefault(require("lodash/isUndefined"));
|
|
50
|
+
var View_1 = __importDefault(require("./View"));
|
|
51
|
+
exports.View = View_1["default"];
|
|
52
|
+
var DraggableHandle_1 = __importDefault(require("./DraggableHandle"));
|
|
53
|
+
var utils_1 = require("./utils");
|
|
54
|
+
var RcSplitView = function RcSplitView(props) {
|
|
55
|
+
var _a;
|
|
56
|
+
var _b = props.draggable,
|
|
57
|
+
draggable = _b === void 0 ? true : _b,
|
|
58
|
+
children = props.children,
|
|
59
|
+
className = props.className,
|
|
60
|
+
onResizerClick = props.onResizerClick,
|
|
61
|
+
onResizerDoubleClick = props.onResizerDoubleClick,
|
|
62
|
+
viewClassName = props.viewClassName,
|
|
63
|
+
firstViewClassName = props.firstViewClassName,
|
|
64
|
+
secondViewClassName = props.secondViewClassName,
|
|
65
|
+
handleClassName = props.handleClassName,
|
|
66
|
+
_c = props.split,
|
|
67
|
+
split = _c === void 0 ? 'vertical' : _c,
|
|
68
|
+
onDragStarted = props.onDragStarted,
|
|
69
|
+
onDragFinished = props.onDragFinished,
|
|
70
|
+
_d = props.primary,
|
|
71
|
+
primary = _d === void 0 ? 'first' : _d,
|
|
72
|
+
step = props.step,
|
|
73
|
+
maxSize = props.maxSize,
|
|
74
|
+
_e = props.minSize,
|
|
75
|
+
minSize = _e === void 0 ? 50 : _e,
|
|
76
|
+
onChange = props.onChange,
|
|
77
|
+
size = props.size,
|
|
78
|
+
defaultSize = props.defaultSize,
|
|
79
|
+
handleContent = props.handleContent,
|
|
80
|
+
handleContentClassName = props.handleContentClassName;
|
|
81
|
+
var initialSize = (0, isUndefined_1["default"])(size) ? (0, utils_1.getDefaultSize)(defaultSize, minSize, maxSize) : size;
|
|
82
|
+
var initialValue = {
|
|
83
|
+
active: false,
|
|
84
|
+
firstViewSize: primary === 'first' ? initialSize : undefined,
|
|
85
|
+
secondViewSize: primary === 'second' ? initialSize : undefined,
|
|
86
|
+
// these are props that are needed in static functions. ie: gDSFP
|
|
87
|
+
instanceProps: {
|
|
88
|
+
size: size
|
|
89
|
+
},
|
|
90
|
+
position: 0
|
|
91
|
+
};
|
|
92
|
+
var splitViewRef = react_1["default"].useRef(null);
|
|
93
|
+
var firstViewRef = react_1["default"].useRef(null);
|
|
94
|
+
var secondViewRef = react_1["default"].useRef(null);
|
|
95
|
+
var _f = __read((0, useGetState_1["default"])(initialValue), 3),
|
|
96
|
+
states = _f[0],
|
|
97
|
+
setStates = _f[1],
|
|
98
|
+
getStates = _f[2];
|
|
99
|
+
var onTouchStart = function onTouchStart(event) {
|
|
100
|
+
var currentValue = getStates();
|
|
101
|
+
if (draggable) {
|
|
102
|
+
(0, utils_1.unFocus)(document, window);
|
|
103
|
+
var _a = event.touches[0],
|
|
104
|
+
clientX = _a.clientX,
|
|
105
|
+
clientY = _a.clientY;
|
|
106
|
+
var position = split === 'vertical' ? clientX : clientY;
|
|
107
|
+
onDragStarted === null || onDragStarted === void 0 ? void 0 : onDragStarted();
|
|
108
|
+
setStates(__assign(__assign({}, currentValue), {
|
|
109
|
+
active: true,
|
|
110
|
+
position: position
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
var onMouseDown = function onMouseDown(event) {
|
|
115
|
+
var eventWithTouches = __assign(__assign({}, event), {
|
|
116
|
+
touches: [{
|
|
117
|
+
clientX: event.clientX,
|
|
118
|
+
clientY: event.clientY
|
|
119
|
+
}]
|
|
120
|
+
});
|
|
121
|
+
onTouchStart(eventWithTouches);
|
|
122
|
+
};
|
|
123
|
+
var onMouseUp = function onMouseUp() {
|
|
124
|
+
var currentValue = getStates();
|
|
125
|
+
var active = currentValue.active,
|
|
126
|
+
draggedSize = currentValue.draggedSize;
|
|
127
|
+
if (draggable && active && draggedSize) {
|
|
128
|
+
onDragFinished === null || onDragFinished === void 0 ? void 0 : onDragFinished(draggedSize);
|
|
129
|
+
setStates(__assign(__assign({}, currentValue), {
|
|
130
|
+
active: false
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
var onTouchMove = function onTouchMove(event) {
|
|
135
|
+
var _a;
|
|
136
|
+
var _b;
|
|
137
|
+
var currentValue = getStates();
|
|
138
|
+
var active = currentValue.active,
|
|
139
|
+
position = currentValue.position;
|
|
140
|
+
if (draggable && active) {
|
|
141
|
+
(0, utils_1.unFocus)(document, window);
|
|
142
|
+
var isFirstPrimary = primary === 'first';
|
|
143
|
+
var firstRef = isFirstPrimary ? firstViewRef.current : secondViewRef.current;
|
|
144
|
+
var secondRef = isFirstPrimary ? secondViewRef.current : firstViewRef.current;
|
|
145
|
+
if (firstRef && secondRef) {
|
|
146
|
+
var firstNode = firstRef;
|
|
147
|
+
var secondNode = secondRef;
|
|
148
|
+
if (firstNode.getBoundingClientRect) {
|
|
149
|
+
var _c = firstNode.getBoundingClientRect(),
|
|
150
|
+
width = _c.width,
|
|
151
|
+
height = _c.height;
|
|
152
|
+
var current = split === 'vertical' ? event.touches[0].clientX : event.touches[0].clientY;
|
|
153
|
+
var nodeSize = split === 'vertical' ? width : height;
|
|
154
|
+
var positionDelta = position - current;
|
|
155
|
+
if (step) {
|
|
156
|
+
if (Math.abs(positionDelta) < step) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
positionDelta = Math.trunc(positionDelta / step) * step;
|
|
160
|
+
}
|
|
161
|
+
var sizeDelta = isFirstPrimary ? positionDelta : -positionDelta;
|
|
162
|
+
var firstViewOrder = parseInt(window.getComputedStyle(firstNode).order, 10);
|
|
163
|
+
var secondViewOrder = parseInt(window.getComputedStyle(secondNode).order, 10);
|
|
164
|
+
if (firstViewOrder > secondViewOrder) {
|
|
165
|
+
sizeDelta = -sizeDelta;
|
|
166
|
+
}
|
|
167
|
+
var newMaxSize = maxSize || 0;
|
|
168
|
+
if (!(0, isUndefined_1["default"])(maxSize) && maxSize <= 0) {
|
|
169
|
+
if (split === 'vertical') {
|
|
170
|
+
newMaxSize = ((_b = splitViewRef.current.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.width) + maxSize;
|
|
171
|
+
} else {
|
|
172
|
+
newMaxSize = splitViewRef.current.getBoundingClientRect().height + maxSize;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
var newSize = +nodeSize - sizeDelta;
|
|
176
|
+
var newPosition = position - positionDelta;
|
|
177
|
+
var restValue = {};
|
|
178
|
+
if (newSize < minSize) {
|
|
179
|
+
newSize = minSize;
|
|
180
|
+
} else if (!(0, isUndefined_1["default"])(maxSize) && newSize > newMaxSize) {
|
|
181
|
+
newSize = newMaxSize;
|
|
182
|
+
} else {
|
|
183
|
+
restValue = {
|
|
184
|
+
position: newPosition
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newSize);
|
|
188
|
+
setStates(__assign(__assign(__assign({}, currentValue), (_a = {
|
|
189
|
+
draggedSize: newSize
|
|
190
|
+
}, _a[isFirstPrimary ? 'firstViewSize' : 'secondViewSize'] = newSize, _a)), restValue));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
var onMouseMove = function onMouseMove(event) {
|
|
196
|
+
var eventWithTouches = __assign(__assign({}, event), {
|
|
197
|
+
touches: [{
|
|
198
|
+
clientX: event.clientX,
|
|
199
|
+
clientY: event.clientY
|
|
200
|
+
}]
|
|
201
|
+
});
|
|
202
|
+
onTouchMove(eventWithTouches);
|
|
203
|
+
};
|
|
204
|
+
(0, useMount_1["default"])(function () {
|
|
205
|
+
document.addEventListener('mouseup', onMouseUp);
|
|
206
|
+
document.addEventListener('mousemove', onMouseMove);
|
|
207
|
+
document.addEventListener('touchmove', onTouchMove);
|
|
208
|
+
setStates((0, utils_1.getSizeUpdate)({
|
|
209
|
+
size: size,
|
|
210
|
+
defaultSize: defaultSize,
|
|
211
|
+
maxSize: maxSize,
|
|
212
|
+
minSize: minSize,
|
|
213
|
+
primary: primary
|
|
214
|
+
}, states));
|
|
215
|
+
});
|
|
216
|
+
(0, useUnmount_1["default"])(function () {
|
|
217
|
+
document.removeEventListener('mouseup', onMouseUp);
|
|
218
|
+
document.removeEventListener('mousemove', onMouseMove);
|
|
219
|
+
document.removeEventListener('touchmove', onTouchMove);
|
|
220
|
+
});
|
|
221
|
+
var _g = __read((0, utils_1.removeNullChildren)(children), 2),
|
|
222
|
+
firstViewNode = _g[0],
|
|
223
|
+
secondViewNode = _g[1];
|
|
224
|
+
return react_1["default"].createElement("div", {
|
|
225
|
+
className: (0, classnames_1["default"])('split-view', "split-view-".concat(split), className),
|
|
226
|
+
ref: splitViewRef
|
|
227
|
+
}, react_1["default"].createElement(View_1["default"], {
|
|
228
|
+
className: (0, classnames_1["default"])(viewClassName, firstViewClassName),
|
|
229
|
+
key: "first-view",
|
|
230
|
+
ref: firstViewRef,
|
|
231
|
+
size: states.firstViewSize,
|
|
232
|
+
split: split
|
|
233
|
+
}, firstViewNode), react_1["default"].createElement(DraggableHandle_1["default"], {
|
|
234
|
+
className: (0, classnames_1["default"])('split-view-draggable-handle', (_a = {}, _a["split-view-draggable-handle-".concat(split, "-disabled")] = !draggable, _a), "split-view-draggable-handle-".concat(split), handleClassName),
|
|
235
|
+
onClick: onResizerClick,
|
|
236
|
+
onDoubleClick: onResizerDoubleClick,
|
|
237
|
+
onMouseDown: onMouseDown,
|
|
238
|
+
onTouchStart: onTouchStart,
|
|
239
|
+
onTouchEnd: onMouseUp,
|
|
240
|
+
key: "draggableHandle"
|
|
241
|
+
}, draggable && react_1["default"].createElement("div", {
|
|
242
|
+
className: (0, classnames_1["default"])("split-view-draggable-handle-".concat(split, "-content"), handleContentClassName)
|
|
243
|
+
}, handleContent)), react_1["default"].createElement(View_1["default"], {
|
|
244
|
+
className: (0, classnames_1["default"])(viewClassName, secondViewClassName),
|
|
245
|
+
key: "second-view",
|
|
246
|
+
ref: secondViewRef,
|
|
247
|
+
size: states.secondViewSize,
|
|
248
|
+
split: split
|
|
249
|
+
}, secondViewNode));
|
|
250
|
+
};
|
|
251
|
+
exports["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,92 @@
|
|
|
1
|
+
@import '../../style/variables.less';
|
|
2
|
+
|
|
3
|
+
.split-view {
|
|
4
|
+
position: absolute;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex: 1;
|
|
7
|
+
height: 100%;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
outline: none;
|
|
10
|
+
-moz-user-select: text;
|
|
11
|
+
-webkit-user-select: text;
|
|
12
|
+
-ms-user-select: text;
|
|
13
|
+
user-select: text;
|
|
14
|
+
|
|
15
|
+
&-horizontal {
|
|
16
|
+
top: 0;
|
|
17
|
+
bottom: 0;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
width: 100%;
|
|
20
|
+
min-height: 100%;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&-vertical {
|
|
24
|
+
right: 0;
|
|
25
|
+
left: 0;
|
|
26
|
+
flex-direction: row;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.split-view-draggable-handle {
|
|
31
|
+
position: relative;
|
|
32
|
+
z-index: 1;
|
|
33
|
+
background-color: @color_f5f5f5;
|
|
34
|
+
|
|
35
|
+
&-horizontal {
|
|
36
|
+
justify-content: center;
|
|
37
|
+
height: 2px;
|
|
38
|
+
border-top: 1px solid transparent;
|
|
39
|
+
transform: translateY(-50%);
|
|
40
|
+
cursor: row-resize;
|
|
41
|
+
|
|
42
|
+
&-content {
|
|
43
|
+
position: absolute;
|
|
44
|
+
top: 50%;
|
|
45
|
+
left: 0;
|
|
46
|
+
width: 100%;
|
|
47
|
+
min-height: 10px;
|
|
48
|
+
transform: translateY(calc(-50% - 1px));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:hover {
|
|
52
|
+
border-top-color: @color_02a6e3;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&-disabled {
|
|
56
|
+
cursor: default;
|
|
57
|
+
|
|
58
|
+
&:hover {
|
|
59
|
+
border-top-color: transparent;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&-vertical {
|
|
65
|
+
align-items: center;
|
|
66
|
+
width: 2px;
|
|
67
|
+
border-left: 1px solid transparent;
|
|
68
|
+
transform: translateX(-50%);
|
|
69
|
+
cursor: col-resize;
|
|
70
|
+
|
|
71
|
+
&-content {
|
|
72
|
+
position: absolute;
|
|
73
|
+
top: 0;
|
|
74
|
+
left: 50%;
|
|
75
|
+
min-width: 10px;
|
|
76
|
+
height: 100%;
|
|
77
|
+
transform: translateX(calc(-50% - 1px));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:hover {
|
|
81
|
+
border-left-color: @color_02a6e3;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&-disabled {
|
|
85
|
+
cursor: default;
|
|
86
|
+
|
|
87
|
+
&:hover {
|
|
88
|
+
border-left-color: transparent;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { StatesTypes } from './index';
|
|
3
|
+
/** 获取默认尺寸 */
|
|
4
|
+
export declare const getDefaultSize: (defaultSize: number | string | undefined, minSize: number | undefined, maxSize: number | undefined, draggedSize?: number) => string | number | undefined;
|
|
5
|
+
/** 获取更新尺寸 */
|
|
6
|
+
export declare const getSizeUpdate: (props: {
|
|
7
|
+
size?: string | number;
|
|
8
|
+
defaultSize?: string | number;
|
|
9
|
+
minSize?: number;
|
|
10
|
+
maxSize?: number;
|
|
11
|
+
primary: "first" | "second";
|
|
12
|
+
}, state: StatesTypes) => any;
|
|
13
|
+
/** 排除空的子元素 */
|
|
14
|
+
export declare const removeNullChildren: (children: React.ReactNode) => (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | React.ReactPortal)[];
|
|
15
|
+
/** 失去焦点 */
|
|
16
|
+
export declare const unFocus: (document: Document, window: Window) => void;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
|
4
|
+
return mod && mod.__esModule ? mod : {
|
|
5
|
+
"default": mod
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
exports.unFocus = exports.removeNullChildren = exports.getSizeUpdate = exports.getDefaultSize = void 0;
|
|
12
|
+
var react_1 = __importDefault(require("react"));
|
|
13
|
+
var isUndefined_1 = __importDefault(require("lodash/isUndefined"));
|
|
14
|
+
var isNumber_1 = __importDefault(require("lodash/isNumber"));
|
|
15
|
+
/** 获取默认尺寸 */
|
|
16
|
+
var getDefaultSize = function getDefaultSize(defaultSize, minSize, maxSize, draggedSize) {
|
|
17
|
+
if ((0, isNumber_1["default"])(draggedSize)) {
|
|
18
|
+
var min = (0, isNumber_1["default"])(minSize) ? minSize : 0;
|
|
19
|
+
var max = (0, isNumber_1["default"])(maxSize) && maxSize >= 0 ? maxSize : Infinity;
|
|
20
|
+
return Math.max(min, Math.min(max, draggedSize));
|
|
21
|
+
}
|
|
22
|
+
if (!(0, isUndefined_1["default"])(defaultSize)) {
|
|
23
|
+
return defaultSize;
|
|
24
|
+
}
|
|
25
|
+
return minSize;
|
|
26
|
+
};
|
|
27
|
+
exports.getDefaultSize = getDefaultSize;
|
|
28
|
+
/** 获取更新尺寸 */
|
|
29
|
+
var getSizeUpdate = function getSizeUpdate(props, state) {
|
|
30
|
+
var newState = {};
|
|
31
|
+
var instanceProps = state.instanceProps;
|
|
32
|
+
var hasSize = !(0, isUndefined_1["default"])(props.size);
|
|
33
|
+
if (instanceProps.size === props.size && hasSize) {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
var newSize = hasSize ? props.size : (0, exports.getDefaultSize)(props.defaultSize, props.minSize, props.maxSize, state.draggedSize);
|
|
37
|
+
if (hasSize) {
|
|
38
|
+
newState.draggedSize = newSize;
|
|
39
|
+
}
|
|
40
|
+
var isFirstViewPrimary = props.primary === 'first';
|
|
41
|
+
newState[isFirstViewPrimary ? 'firstViewSize' : 'secondViewSize'] = newSize;
|
|
42
|
+
newState[isFirstViewPrimary ? 'secondViewSize' : 'firstViewSize'] = undefined;
|
|
43
|
+
newState.instanceProps = {
|
|
44
|
+
size: props.size
|
|
45
|
+
};
|
|
46
|
+
return newState;
|
|
47
|
+
};
|
|
48
|
+
exports.getSizeUpdate = getSizeUpdate;
|
|
49
|
+
/** 排除空的子元素 */
|
|
50
|
+
var removeNullChildren = function removeNullChildren(children) {
|
|
51
|
+
return react_1["default"].Children.toArray(children).filter(function (c) {
|
|
52
|
+
return c;
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
exports.removeNullChildren = removeNullChildren;
|
|
56
|
+
/** 失去焦点 */
|
|
57
|
+
var unFocus = function unFocus(document, window) {
|
|
58
|
+
var _a, _b;
|
|
59
|
+
(_a = document.getSelection()) === null || _a === void 0 ? void 0 : _a.empty();
|
|
60
|
+
(_b = window.getSelection()) === null || _b === void 0 ? void 0 : _b.removeAllRanges();
|
|
61
|
+
};
|
|
62
|
+
exports.unFocus = unFocus;
|
package/lib/style/variables.less
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assui",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.68",
|
|
4
4
|
"description": "react ui library",
|
|
5
5
|
"author": "jason <usochen@gmail.com>",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@types/react-beautiful-dnd": "^13.1.2",
|
|
36
36
|
"@types/react-color": "^3.0.6",
|
|
37
37
|
"@types/react-resizable": "^3.0.0",
|
|
38
|
-
"a-icons": "^1.2.
|
|
38
|
+
"a-icons": "^1.2.50",
|
|
39
39
|
"aa-utils": "^2.1.31",
|
|
40
40
|
"ahooks": "^3.9.5",
|
|
41
41
|
"bignumber.js": "^9.0.1",
|
|
@@ -86,6 +86,5 @@
|
|
|
86
86
|
"engines": {
|
|
87
87
|
"node": ">=10.0.0"
|
|
88
88
|
},
|
|
89
|
-
"license": "MIT"
|
|
90
|
-
"gitHead": "910457e800d85d7167c5c8a7b2de3395930420a1"
|
|
89
|
+
"license": "MIT"
|
|
91
90
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 assui
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|