@douyinfe/semi-foundation 2.69.1-alpha.0 → 2.69.2
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/datePicker/yearAndMonthFoundation.ts +29 -9
- package/lib/cjs/datePicker/yearAndMonthFoundation.js +39 -8
- package/lib/cjs/resizable/foundation.d.ts +5 -2
- package/lib/cjs/resizable/group/index.d.ts +3 -6
- package/lib/cjs/resizable/group/index.js +23 -90
- package/lib/cjs/resizable/groupConstants.d.ts +16 -0
- package/lib/cjs/resizable/groupConstants.js +25 -0
- package/lib/cjs/resizable/resizable.css +0 -86
- package/lib/cjs/resizable/resizable.scss +3 -100
- package/lib/cjs/resizable/single/index.d.ts +1 -1
- package/lib/cjs/resizable/single/index.js +2 -2
- package/lib/cjs/resizable/singleConstants.d.ts +105 -0
- package/lib/cjs/resizable/singleConstants.js +67 -0
- package/lib/cjs/resizable/utils.js +5 -5
- package/lib/cjs/resizable/variables.scss +0 -8
- package/lib/cjs/table/table.css +2 -1
- package/lib/cjs/table/table.scss +2 -1
- package/lib/cjs/transfer/transfer.css +1 -0
- package/lib/cjs/transfer/transfer.scss +1 -0
- package/lib/cjs/treeSelect/treeSelect.css +3 -1
- package/lib/cjs/treeSelect/treeSelect.scss +4 -1
- package/lib/es/datePicker/yearAndMonthFoundation.js +39 -8
- package/lib/es/resizable/foundation.d.ts +5 -2
- package/lib/es/resizable/foundation.js +3 -2
- package/lib/es/resizable/group/index.d.ts +3 -6
- package/lib/es/resizable/group/index.js +23 -90
- package/lib/es/resizable/groupConstants.d.ts +16 -0
- package/lib/es/resizable/groupConstants.js +19 -0
- package/lib/es/resizable/resizable.css +0 -86
- package/lib/es/resizable/resizable.scss +3 -100
- package/lib/es/resizable/single/index.d.ts +1 -1
- package/lib/es/resizable/single/index.js +1 -1
- package/lib/es/resizable/singleConstants.d.ts +105 -0
- package/lib/es/resizable/singleConstants.js +61 -0
- package/lib/es/resizable/utils.js +5 -5
- package/lib/es/resizable/variables.scss +0 -8
- package/lib/es/table/table.css +2 -1
- package/lib/es/table/table.scss +2 -1
- package/lib/es/transfer/transfer.css +1 -0
- package/lib/es/transfer/transfer.scss +1 -0
- package/lib/es/treeSelect/treeSelect.css +3 -1
- package/lib/es/treeSelect/treeSelect.scss +4 -1
- package/package.json +3 -3
- package/resizable/foundation.ts +15 -4
- package/resizable/group/index.ts +29 -92
- package/resizable/groupConstants.ts +25 -0
- package/resizable/resizable.scss +3 -100
- package/resizable/single/index.ts +1 -1
- package/resizable/{types.ts → singleConstants.ts} +65 -0
- package/resizable/utils.ts +6 -7
- package/resizable/variables.scss +0 -8
- package/table/table.scss +2 -1
- package/transfer/transfer.scss +1 -0
- package/treeSelect/treeSelect.scss +4 -1
- package/lib/cjs/resizable/types.d.ts +0 -41
- package/lib/cjs/resizable/types.js +0 -12
- package/lib/es/resizable/types.d.ts +0 -41
- package/lib/es/resizable/types.js +0 -6
package/resizable/group/index.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { getItemDirection, getPixelSize } from "../utils";
|
|
2
2
|
import BaseFoundation, { DefaultAdapter } from '../../base/foundation';
|
|
3
|
-
import { ResizeStartCallback, ResizeCallback } from "../
|
|
3
|
+
import { ResizeStartCallback, ResizeCallback } from "../singleConstants";
|
|
4
4
|
import { adjustNewSize, judgeConstraint, getOffset } from "../utils";
|
|
5
|
-
import { debounce } from "lodash";
|
|
6
5
|
export interface ResizeHandlerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
7
6
|
registerEvents: () => void;
|
|
8
7
|
unregisterEvents: () => void
|
|
@@ -62,23 +61,16 @@ export class ResizeGroupFoundation<P = Record<string, any>, S = Record<string, a
|
|
|
62
61
|
return this._adapter.getGroupRef();
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
get groupSize(): number {
|
|
66
|
-
const { direction } = this.getProps();
|
|
67
|
-
let groupSize = direction === 'horizontal' ? this.groupRef.offsetWidth : this.groupRef.offsetHeight;
|
|
68
|
-
return groupSize;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
64
|
direction: 'horizontal' | 'vertical'
|
|
72
|
-
itemMinusMap: Map<number, number>;
|
|
65
|
+
itemMinusMap: Map<number, number>;
|
|
73
66
|
totalMinus: number;
|
|
74
|
-
|
|
67
|
+
avaliableSize: number;
|
|
75
68
|
|
|
76
69
|
|
|
77
70
|
init(): void {
|
|
78
71
|
this.direction = this.getProp('direction');
|
|
79
72
|
this.itemMinusMap = new Map();
|
|
80
|
-
this.
|
|
81
|
-
this.initSpace();
|
|
73
|
+
this.calculateSpace();
|
|
82
74
|
}
|
|
83
75
|
get window(): Window | null {
|
|
84
76
|
return this.groupRef.ownerDocument.defaultView as Window ?? null;
|
|
@@ -101,18 +93,16 @@ export class ResizeGroupFoundation<P = Record<string, any>, S = Record<string, a
|
|
|
101
93
|
const lastStyle = this.window.getComputedStyle(lastItem);
|
|
102
94
|
const nextStyle = this.window.getComputedStyle(nextItem);
|
|
103
95
|
|
|
104
|
-
lastOffset = getOffset(lastStyle, this.direction)
|
|
105
|
-
nextOffset = getOffset(nextStyle, this.direction)
|
|
106
|
-
let lastItemSize = (this.direction === 'horizontal' ? lastItem.offsetWidth : lastItem.offsetHeight) + this.itemMinusMap.get(handlerIndex),
|
|
107
|
-
nextItemSize = (this.direction === 'horizontal' ? nextItem.offsetWidth : nextItem.offsetHeight) + this.itemMinusMap.get(handlerIndex + 1);
|
|
96
|
+
lastOffset = getOffset(lastStyle, this.direction);
|
|
97
|
+
nextOffset = getOffset(nextStyle, this.direction);
|
|
108
98
|
const states = this.getStates();
|
|
109
99
|
this.setState({
|
|
110
100
|
isResizing: true,
|
|
111
101
|
originalPosition: {
|
|
112
102
|
x: clientX,
|
|
113
103
|
y: clientY,
|
|
114
|
-
lastItemSize,
|
|
115
|
-
nextItemSize,
|
|
104
|
+
lastItemSize: (this.direction === 'horizontal' ? lastItem.offsetWidth : lastItem.offsetHeight),
|
|
105
|
+
nextItemSize: (this.direction === 'horizontal' ? nextItem.offsetWidth : nextItem.offsetHeight),
|
|
116
106
|
lastOffset,
|
|
117
107
|
nextOffset,
|
|
118
108
|
},
|
|
@@ -148,38 +138,33 @@ export class ResizeGroupFoundation<P = Record<string, any>, S = Record<string, a
|
|
|
148
138
|
const props = this.getProps();
|
|
149
139
|
const { direction } = props;
|
|
150
140
|
let lastItem = this._adapter.getItem(curHandler), nextItem = this._adapter.getItem(curHandler + 1);
|
|
151
|
-
let parentSize = this.
|
|
141
|
+
let parentSize = this.direction === 'horizontal' ? this.groupRef.offsetWidth : this.groupRef.offsetHeight;
|
|
142
|
+
let availableSize = parentSize - this.totalMinus;
|
|
143
|
+
|
|
152
144
|
let delta = direction === 'horizontal' ? (clientX - initX) : (clientY - initY);
|
|
153
145
|
let lastNewSize = lastItemSize + delta;
|
|
154
146
|
let nextNewSize = nextItemSize - delta;
|
|
155
147
|
|
|
156
148
|
// 判断是否超出限制
|
|
157
|
-
let lastFlag = judgeConstraint(lastNewSize, this._adapter.getItemMin(curHandler), this._adapter.getItemMax(curHandler),
|
|
158
|
-
nextFlag = judgeConstraint(nextNewSize, this._adapter.getItemMin(curHandler + 1), this._adapter.getItemMax(curHandler + 1),
|
|
149
|
+
let lastFlag = judgeConstraint(lastNewSize, this._adapter.getItemMin(curHandler), this._adapter.getItemMax(curHandler), availableSize, lastOffset),
|
|
150
|
+
nextFlag = judgeConstraint(nextNewSize, this._adapter.getItemMin(curHandler + 1), this._adapter.getItemMax(curHandler + 1), availableSize, nextOffset);
|
|
159
151
|
|
|
160
152
|
if (lastFlag) {
|
|
161
|
-
lastNewSize = adjustNewSize(lastNewSize, this._adapter.getItemMin(curHandler), this._adapter.getItemMax(curHandler),
|
|
153
|
+
lastNewSize = adjustNewSize(lastNewSize, this._adapter.getItemMin(curHandler), this._adapter.getItemMax(curHandler), availableSize, lastOffset);
|
|
162
154
|
nextNewSize = lastItemSize + nextItemSize - lastNewSize;
|
|
163
155
|
}
|
|
164
156
|
|
|
165
157
|
if (nextFlag) {
|
|
166
|
-
nextNewSize = adjustNewSize(nextNewSize, this._adapter.getItemMin(curHandler + 1), this._adapter.getItemMax(curHandler + 1),
|
|
158
|
+
nextNewSize = adjustNewSize(nextNewSize, this._adapter.getItemMin(curHandler + 1), this._adapter.getItemMax(curHandler + 1), availableSize, nextOffset);
|
|
167
159
|
lastNewSize = lastItemSize + nextItemSize - nextNewSize;
|
|
168
160
|
}
|
|
169
161
|
|
|
170
|
-
let lastItemPercent = this.itemPercentMap.get(curHandler),
|
|
171
|
-
nextItemPercent = this.itemPercentMap.get(curHandler + 1);
|
|
172
|
-
|
|
173
|
-
let lastNewPercent = (lastNewSize) / parentSize * 100;
|
|
174
|
-
let nextNewPercent = lastItemPercent + nextItemPercent - lastNewPercent; // 消除浮点误差
|
|
175
|
-
this.itemPercentMap.set(curHandler, lastNewPercent);
|
|
176
|
-
this.itemPercentMap.set(curHandler + 1, nextNewPercent);
|
|
177
162
|
if (direction === 'horizontal') {
|
|
178
|
-
lastItem.style.width =
|
|
179
|
-
nextItem.style.width =
|
|
163
|
+
lastItem.style.width = (lastNewSize) / parentSize * 100 + '%';
|
|
164
|
+
nextItem.style.width = (nextNewSize) / parentSize * 100 + '%';
|
|
180
165
|
} else if (direction === 'vertical') {
|
|
181
|
-
lastItem.style.height =
|
|
182
|
-
nextItem.style.height =
|
|
166
|
+
lastItem.style.height = (lastNewSize) / parentSize * 100 + '%';
|
|
167
|
+
nextItem.style.height = (nextNewSize) / parentSize * 100 + '%';
|
|
183
168
|
}
|
|
184
169
|
|
|
185
170
|
let lastFunc = this._adapter.getItemChange(curHandler),
|
|
@@ -212,13 +197,13 @@ export class ResizeGroupFoundation<P = Record<string, any>, S = Record<string, a
|
|
|
212
197
|
this.unregisterEvents();
|
|
213
198
|
}
|
|
214
199
|
|
|
215
|
-
|
|
200
|
+
calculateSpace = () => {
|
|
216
201
|
const props = this.getProps();
|
|
217
202
|
const { direction } = props;
|
|
218
203
|
|
|
219
204
|
// calculate accurate space for group item
|
|
220
205
|
let handlerSizes = new Array(this._adapter.getHandlerCount()).fill(0);
|
|
221
|
-
let
|
|
206
|
+
let groupSize = direction === 'horizontal' ? this.groupRef.offsetWidth : this.groupRef.offsetHeight;
|
|
222
207
|
this.totalMinus = 0;
|
|
223
208
|
for (let i = 0; i < this._adapter.getHandlerCount(); i++) {
|
|
224
209
|
let handlerSize = direction === 'horizontal' ? this._adapter.getHandler(i).offsetWidth : this._adapter.getHandler(i).offsetHeight;
|
|
@@ -240,8 +225,8 @@ export class ResizeGroupFoundation<P = Record<string, any>, S = Record<string, a
|
|
|
240
225
|
}
|
|
241
226
|
const child = this._adapter.getItem(i);
|
|
242
227
|
let minSize = this._adapter.getItemMin(i), maxSize = this._adapter.getItemMax(i);
|
|
243
|
-
let minSizePercent = minSize ? getPixelSize(minSize,
|
|
244
|
-
maxSizePercent = maxSize ? getPixelSize(maxSize,
|
|
228
|
+
let minSizePercent = minSize ? getPixelSize(minSize, groupSize) / groupSize * 100 : 0,
|
|
229
|
+
maxSizePercent = maxSize ? getPixelSize(maxSize, groupSize) / groupSize * 100 : 100;
|
|
245
230
|
if (minSizePercent > maxSizePercent) {
|
|
246
231
|
console.warn('[Semi ResizableItem]: min size bigger than max size');
|
|
247
232
|
}
|
|
@@ -252,21 +237,21 @@ export class ResizeGroupFoundation<P = Record<string, any>, S = Record<string, a
|
|
|
252
237
|
if (typeof defaultSize === 'string') {
|
|
253
238
|
if (defaultSize.endsWith('%')) {
|
|
254
239
|
itemSizePercent = parseFloat(defaultSize.slice(0, -1));
|
|
255
|
-
this.itemPercentMap.set(i, itemSizePercent);
|
|
256
240
|
} else if (defaultSize.endsWith('px')) {
|
|
257
|
-
itemSizePercent = parseFloat(defaultSize.slice(0, -2)) /
|
|
258
|
-
this.itemPercentMap.set(i, itemSizePercent);
|
|
241
|
+
itemSizePercent = parseFloat(defaultSize.slice(0, -2)) / groupSize * 100;
|
|
259
242
|
} else if (/^-?\d+(\.\d+)?$/.test(defaultSize)) {
|
|
260
243
|
// 仅由数字组成,表示按比例分配剩下空间
|
|
261
244
|
undefineLoc.set(i, parseFloat(defaultSize));
|
|
262
245
|
undefinedTotal += parseFloat(defaultSize);
|
|
263
246
|
continue;
|
|
264
247
|
}
|
|
265
|
-
} else
|
|
248
|
+
} else {
|
|
266
249
|
undefineLoc.set(i, defaultSize);
|
|
267
250
|
undefinedTotal += defaultSize;
|
|
268
251
|
continue;
|
|
269
252
|
}
|
|
253
|
+
|
|
254
|
+
|
|
270
255
|
totalSizePercent += itemSizePercent;
|
|
271
256
|
|
|
272
257
|
if (direction === 'horizontal') {
|
|
@@ -294,62 +279,14 @@ export class ResizeGroupFoundation<P = Record<string, any>, S = Record<string, a
|
|
|
294
279
|
|
|
295
280
|
undefineLoc.forEach((value, key) => {
|
|
296
281
|
const child = this._adapter.getItem(key);
|
|
297
|
-
const percent = value / undefinedTotal * undefineSizePercent;
|
|
298
|
-
this.itemPercentMap.set(key, percent);
|
|
299
282
|
if (direction === 'horizontal') {
|
|
300
|
-
child.style.width = `calc(${
|
|
283
|
+
child.style.width = `calc(${undefineSizePercent / undefinedTotal * value}% - ${this.itemMinusMap.get(key)}px)`;
|
|
301
284
|
} else {
|
|
302
|
-
child.style.height = `calc(${
|
|
285
|
+
child.style.height = `calc(${undefineSizePercent / undefinedTotal * value}% - ${this.itemMinusMap.get(key)}px)`;
|
|
303
286
|
}
|
|
304
287
|
});
|
|
305
288
|
}
|
|
306
289
|
|
|
307
|
-
ensureConstraint = debounce(() => {
|
|
308
|
-
// 浏览器拖拽时保证px值最大最小仍生效
|
|
309
|
-
const { direction } = this.getProps();
|
|
310
|
-
const itemCount = this._adapter.getItemCount();
|
|
311
|
-
let continueFlag = true;
|
|
312
|
-
for (let i = 0; i < itemCount; i++) {
|
|
313
|
-
const child = this._adapter.getItem(i);
|
|
314
|
-
const childSize = direction === 'horizontal' ? child.offsetWidth : child.offsetHeight;
|
|
315
|
-
// 判断由非鼠标拖拽导致item的size变化过程中是否有超出限制的情况
|
|
316
|
-
const childFlag = judgeConstraint(childSize, this._adapter.getItemMin(i), this._adapter.getItemMax(i), this.groupSize, this.itemMinusMap.get(i));
|
|
317
|
-
if (childFlag) {
|
|
318
|
-
const childNewSize = adjustNewSize(childSize, this._adapter.getItemMin(i), this._adapter.getItemMax(i), this.groupSize, this.itemMinusMap.get(i));
|
|
319
|
-
for (let j = i + 1; j < itemCount; j++) {
|
|
320
|
-
// 找到下一个没有超出限制的item
|
|
321
|
-
const item = this._adapter.getItem(j);
|
|
322
|
-
const itemSize = direction === 'horizontal' ? item.offsetWidth : item.offsetHeight;
|
|
323
|
-
const itemFlag = judgeConstraint(itemSize, this._adapter.getItemMin(j), this._adapter.getItemMax(j), this.groupSize, this.itemMinusMap.get(j));
|
|
324
|
-
if (!itemFlag) {
|
|
325
|
-
let childPercent = this.itemPercentMap.get(i),
|
|
326
|
-
itemPercent = this.itemPercentMap.get(j);
|
|
327
|
-
let childNewPercent = childNewSize / this.groupSize * 100;
|
|
328
|
-
let itemNewPercent = childPercent + itemPercent - childNewPercent;
|
|
329
|
-
this.itemPercentMap.set(i, childNewPercent);
|
|
330
|
-
this.itemPercentMap.set(j, itemNewPercent);
|
|
331
|
-
if (direction === 'horizontal') {
|
|
332
|
-
child.style.width = `calc(${childNewPercent}% - ${this.itemMinusMap.get(i)}px)`;
|
|
333
|
-
item.style.width = `calc(${itemNewPercent}% - ${this.itemMinusMap.get(j)}px)`;
|
|
334
|
-
} else {
|
|
335
|
-
child.style.height = `calc(${childNewPercent}% - ${this.itemMinusMap.get(i)}px)`;
|
|
336
|
-
item.style.height = `calc(${itemNewPercent}% - ${this.itemMinusMap.get(j)}px)`;
|
|
337
|
-
}
|
|
338
|
-
break;
|
|
339
|
-
} else {
|
|
340
|
-
if (j === itemCount - 1) {
|
|
341
|
-
continueFlag = false;
|
|
342
|
-
console.warn('[Semi ResizableGroup]: no enough space to adjust min/max size');
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
if (!continueFlag) {
|
|
348
|
-
break;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}, 200)
|
|
352
|
-
|
|
353
290
|
destroy(): void {
|
|
354
291
|
|
|
355
292
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// group
|
|
2
|
+
const rowStyleBase = {
|
|
3
|
+
width: '100%',
|
|
4
|
+
height: '8px',
|
|
5
|
+
flexShrink: 0,
|
|
6
|
+
margin: '0',
|
|
7
|
+
cursor: 'row-resize',
|
|
8
|
+
} as const;
|
|
9
|
+
const colStyleBase = {
|
|
10
|
+
width: '8px',
|
|
11
|
+
flexShrink: 0,
|
|
12
|
+
height: '100%',
|
|
13
|
+
margin: '0',
|
|
14
|
+
cursor: 'col-resize',
|
|
15
|
+
} as const;
|
|
16
|
+
|
|
17
|
+
export const directionStyles = {
|
|
18
|
+
horizontal: {
|
|
19
|
+
...colStyleBase,
|
|
20
|
+
},
|
|
21
|
+
vertical: {
|
|
22
|
+
...rowStyleBase,
|
|
23
|
+
}
|
|
24
|
+
} as const;
|
|
25
|
+
|
package/resizable/resizable.scss
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
@import
|
|
1
|
+
@import './variables.scss';
|
|
2
|
+
|
|
2
3
|
$module: #{$prefix}-resizable;
|
|
3
4
|
|
|
4
5
|
.#{$module} {
|
|
@@ -12,83 +13,8 @@ $module: #{$prefix}-resizable;
|
|
|
12
13
|
position: absolute;
|
|
13
14
|
user-select: none;
|
|
14
15
|
z-index: $z-resizable_handler;
|
|
15
|
-
|
|
16
|
-
// 基础样式
|
|
17
|
-
@mixin row-resize-base {
|
|
18
|
-
width: 100%;
|
|
19
|
-
height: $height-row-handler;
|
|
20
|
-
top: 0;
|
|
21
|
-
left: 0;
|
|
22
|
-
cursor: row-resize;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@mixin col-resize-base {
|
|
26
|
-
width: $width-col-handler;
|
|
27
|
-
height: 100%;
|
|
28
|
-
top: 0;
|
|
29
|
-
left: 0;
|
|
30
|
-
cursor: col-resize;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@mixin edge-resize-base {
|
|
34
|
-
width: $width-edge-handler;
|
|
35
|
-
height: $height-edge-handler;
|
|
36
|
-
position: absolute;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// 方向样式
|
|
40
|
-
&-top {
|
|
41
|
-
@include row-resize-base;
|
|
42
|
-
top: calc(-1 * $height-row-handler / 2);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&-right {
|
|
46
|
-
@include col-resize-base;
|
|
47
|
-
left: auto;
|
|
48
|
-
right: calc(-1 * $width-col-handler / 2);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
&-bottom {
|
|
52
|
-
@include row-resize-base;
|
|
53
|
-
top: auto;
|
|
54
|
-
bottom: calc(-1 * $height-row-handler / 2);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
&-left {
|
|
58
|
-
@include col-resize-base;
|
|
59
|
-
left: calc(-1 * $width-col-handler / 2);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// 边角样式
|
|
63
|
-
&-topRight {
|
|
64
|
-
@include edge-resize-base;
|
|
65
|
-
right: calc(-1 * $width-edge-handler / 2);
|
|
66
|
-
top: calc(-1 * $height-edge-handler / 2);
|
|
67
|
-
cursor: ne-resize;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
&-bottomRight {
|
|
71
|
-
@include edge-resize-base;
|
|
72
|
-
right: calc(-1 * $width-edge-handler / 2);
|
|
73
|
-
bottom: calc(-1 * $height-edge-handler / 2);
|
|
74
|
-
cursor: se-resize;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
&-bottomLeft {
|
|
78
|
-
@include edge-resize-base;
|
|
79
|
-
left: calc(-1 * $width-edge-handler / 2);
|
|
80
|
-
bottom: calc(-1 * $height-edge-handler / 2);
|
|
81
|
-
cursor: sw-resize;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
&-topLeft {
|
|
85
|
-
@include edge-resize-base;
|
|
86
|
-
left: calc(-1 * $width-edge-handler / 2);
|
|
87
|
-
top: calc(-1 * $height-edge-handler / 2);
|
|
88
|
-
cursor: nw-resize;
|
|
89
|
-
}
|
|
90
16
|
}
|
|
91
|
-
|
|
17
|
+
|
|
92
18
|
&-group {
|
|
93
19
|
display: flex;
|
|
94
20
|
position: relative;
|
|
@@ -111,28 +37,5 @@ $module: #{$prefix}-resizable;
|
|
|
111
37
|
justify-content: center;
|
|
112
38
|
background-color: var(--semi-color-fill-0);
|
|
113
39
|
opacity: 1;
|
|
114
|
-
|
|
115
|
-
&-vertical {
|
|
116
|
-
width: 100%;
|
|
117
|
-
height: $height-vertical-handler;
|
|
118
|
-
flex-shrink: 0;
|
|
119
|
-
cursor: row-resize;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
&-horizontal {
|
|
123
|
-
height: 100%;
|
|
124
|
-
width: $width-horizontal-handler;
|
|
125
|
-
flex-shrink: 0;
|
|
126
|
-
cursor: col-resize;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
&-background {
|
|
131
|
-
height: 100%;
|
|
132
|
-
width: 100%;
|
|
133
|
-
inset: 0;
|
|
134
|
-
z-index: $z-resizable_background;
|
|
135
|
-
opacity: 0;
|
|
136
|
-
position: fixed;
|
|
137
40
|
}
|
|
138
41
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../../base/foundation';
|
|
2
|
-
import { DEFAULT_SIZE, Size, NumberSize, Direction, NewSize } from "../
|
|
2
|
+
import { DEFAULT_SIZE, Size, NumberSize, Direction, NewSize } from "../singleConstants";
|
|
3
3
|
import { getStringSize, getNumberSize, has, calculateNewMax, findNextSnap, snap, clamp } from "../utils";
|
|
4
4
|
export interface ResizableHandlerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
5
5
|
registerEvent: () => void;
|
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
// single
|
|
2
|
+
const rowStyleBase = {
|
|
3
|
+
width: '100%',
|
|
4
|
+
height: '10px',
|
|
5
|
+
top: '0px',
|
|
6
|
+
left: '0px',
|
|
7
|
+
cursor: 'row-resize',
|
|
8
|
+
} as const;
|
|
9
|
+
const colStyleBase = {
|
|
10
|
+
width: '10px',
|
|
11
|
+
height: '100%',
|
|
12
|
+
top: '0px',
|
|
13
|
+
left: '0px',
|
|
14
|
+
cursor: 'col-resize',
|
|
15
|
+
} as const;
|
|
16
|
+
const edgeStyleBase = {
|
|
17
|
+
width: '20px',
|
|
18
|
+
height: '20px',
|
|
19
|
+
position: 'absolute',
|
|
20
|
+
} as const;
|
|
21
|
+
|
|
2
22
|
export const directions = ['top', 'right', 'bottom', 'left', 'topRight', 'bottomRight', 'bottomLeft', 'topLeft'] as const;
|
|
3
23
|
|
|
24
|
+
export const directionStyles = {
|
|
25
|
+
top: {
|
|
26
|
+
...rowStyleBase,
|
|
27
|
+
top: '-5px',
|
|
28
|
+
},
|
|
29
|
+
right: {
|
|
30
|
+
...colStyleBase,
|
|
31
|
+
left: undefined,
|
|
32
|
+
right: '-5px',
|
|
33
|
+
},
|
|
34
|
+
bottom: {
|
|
35
|
+
...rowStyleBase,
|
|
36
|
+
top: undefined,
|
|
37
|
+
bottom: '-5px',
|
|
38
|
+
},
|
|
39
|
+
left: {
|
|
40
|
+
...colStyleBase,
|
|
41
|
+
left: '-5px',
|
|
42
|
+
},
|
|
43
|
+
topRight: {
|
|
44
|
+
...edgeStyleBase,
|
|
45
|
+
right: '-10px',
|
|
46
|
+
top: '-10px',
|
|
47
|
+
cursor: 'ne-resize',
|
|
48
|
+
},
|
|
49
|
+
bottomRight: {
|
|
50
|
+
...edgeStyleBase,
|
|
51
|
+
right: '-10px',
|
|
52
|
+
bottom: '-10px',
|
|
53
|
+
cursor: 'se-resize',
|
|
54
|
+
},
|
|
55
|
+
bottomLeft: {
|
|
56
|
+
...edgeStyleBase,
|
|
57
|
+
left: '-10px',
|
|
58
|
+
bottom: '-10px',
|
|
59
|
+
cursor: 'sw-resize',
|
|
60
|
+
},
|
|
61
|
+
topLeft: {
|
|
62
|
+
...edgeStyleBase,
|
|
63
|
+
left: '-10px',
|
|
64
|
+
top: '-10px',
|
|
65
|
+
cursor: 'nw-resize',
|
|
66
|
+
},
|
|
67
|
+
} as const;
|
|
68
|
+
|
|
4
69
|
export type Direction = 'top' | 'right' | 'bottom' | 'left' | 'topRight' | 'bottomRight' | 'bottomLeft' | 'topLeft';
|
|
5
70
|
|
|
6
71
|
export interface HandleClassName {
|
package/resizable/utils.ts
CHANGED
|
@@ -80,8 +80,7 @@ export const calculateNewMax = (
|
|
|
80
80
|
minWidth,
|
|
81
81
|
minHeight,
|
|
82
82
|
};
|
|
83
|
-
};
|
|
84
|
-
export const getItemDirection = (dir: 'vertical' | 'horizontal') => {
|
|
83
|
+
};export const getItemDirection = (dir: 'vertical' | 'horizontal') => {
|
|
85
84
|
if (dir === 'vertical') {
|
|
86
85
|
return ['bottom', 'top'];
|
|
87
86
|
} else {
|
|
@@ -105,10 +104,10 @@ export const judgeConstraint = (newSize: number, min: string, max: string, paren
|
|
|
105
104
|
max = max ?? "100%";
|
|
106
105
|
const minSize = getPixelSize(min, parentSize);
|
|
107
106
|
const maxSize = getPixelSize(max, parentSize);
|
|
108
|
-
if (newSize
|
|
107
|
+
if (newSize <= minSize + offset) {
|
|
109
108
|
return true;
|
|
110
109
|
}
|
|
111
|
-
if (newSize
|
|
110
|
+
if (newSize >= maxSize - offset) {
|
|
112
111
|
return true;
|
|
113
112
|
}
|
|
114
113
|
return false;
|
|
@@ -119,11 +118,11 @@ export const adjustNewSize = (newSize: number, min: string, max: string, parentS
|
|
|
119
118
|
max = max ?? "100%";
|
|
120
119
|
const minSize = getPixelSize(min, parentSize);
|
|
121
120
|
const maxSize = getPixelSize(max, parentSize);
|
|
122
|
-
if (newSize
|
|
121
|
+
if (newSize <= minSize + offset) {
|
|
123
122
|
return minSize + offset;
|
|
124
123
|
}
|
|
125
|
-
if (newSize
|
|
126
|
-
return maxSize;
|
|
124
|
+
if (newSize >= maxSize - offset) {
|
|
125
|
+
return maxSize - offset;
|
|
127
126
|
}
|
|
128
127
|
return newSize;
|
|
129
128
|
};
|
package/resizable/variables.scss
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
1
|
$z-resizable_handler: 2000 !default; // 伸缩框组件中handler的z-index
|
|
2
|
-
$z-resizable_background: 2010; // 伸缩框组件中背景的z-index
|
|
3
|
-
|
|
4
|
-
$height-row-handler: 10px; // 单个伸缩框中上下handler的高度
|
|
5
|
-
$width-col-handler: 10px; // 单个伸缩框中左右handler的宽度
|
|
6
|
-
$width-edge-handler: 20px; // 单个伸缩框中边角handler的宽度
|
|
7
|
-
$height-edge-handler: 20px; // 单个伸缩框中边角handler的高度
|
|
8
|
-
$width-horizontal-handler: 10px; // 组合伸缩框中水平方向handler的宽度
|
|
9
|
-
$height-vertical-handler: 10px; // 组合伸缩框中垂直方向handler的高度
|
package/table/table.scss
CHANGED
|
@@ -145,7 +145,8 @@ $module: #{$prefix}-table;
|
|
|
145
145
|
&.#{$module}-row-head-clickSort {
|
|
146
146
|
cursor: pointer;
|
|
147
147
|
&:hover {
|
|
148
|
-
background: $color-table_th-clickSort-bg-hover;
|
|
148
|
+
background-image: linear-gradient(0deg, $color-table_th-clickSort-bg-hover, $color-table_th-clickSort-bg-hover);
|
|
149
|
+
background-color: $color-table_cell-bg-hover;
|
|
149
150
|
|
|
150
151
|
&.#{$module}-cell-fixed {
|
|
151
152
|
&-left,
|
package/transfer/transfer.scss
CHANGED
|
@@ -53,6 +53,7 @@ $module: #{$prefix}-transfer;
|
|
|
53
53
|
margin-bottom: $spacing-transfer_header-marginBottom;
|
|
54
54
|
margin-left: $spacing-transfer_header-marginLeft;
|
|
55
55
|
color: $color-transfer_header-text;
|
|
56
|
+
flex-shrink: 0;
|
|
56
57
|
|
|
57
58
|
&-all {
|
|
58
59
|
font-weight: $font-transfer_header_all-fontWeight;
|
|
@@ -165,7 +165,6 @@ $module: #{$prefix}-tree-select;
|
|
|
165
165
|
|
|
166
166
|
&-placeholder {
|
|
167
167
|
opacity: .6;
|
|
168
|
-
z-index: -1;
|
|
169
168
|
}
|
|
170
169
|
|
|
171
170
|
&-disabled {
|
|
@@ -174,6 +173,10 @@ $module: #{$prefix}-tree-select;
|
|
|
174
173
|
}
|
|
175
174
|
}
|
|
176
175
|
|
|
176
|
+
.#{$module}-triggerSingleSearch-upper {
|
|
177
|
+
z-index: 1;
|
|
178
|
+
}
|
|
179
|
+
|
|
177
180
|
.#{$module}-triggerSingleSearch-wrapper{
|
|
178
181
|
width: 100%;
|
|
179
182
|
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export declare const directions: readonly ["top", "right", "bottom", "left", "topRight", "bottomRight", "bottomLeft", "topLeft"];
|
|
2
|
-
export type Direction = 'top' | 'right' | 'bottom' | 'left' | 'topRight' | 'bottomRight' | 'bottomLeft' | 'topLeft';
|
|
3
|
-
export interface HandleClassName {
|
|
4
|
-
top?: string;
|
|
5
|
-
right?: string;
|
|
6
|
-
bottom?: string;
|
|
7
|
-
left?: string;
|
|
8
|
-
topRight?: string;
|
|
9
|
-
bottomRight?: string;
|
|
10
|
-
bottomLeft?: string;
|
|
11
|
-
topLeft?: string;
|
|
12
|
-
}
|
|
13
|
-
export type HandlerCallback = (e: MouseEvent, direction: Direction) => void;
|
|
14
|
-
export interface Enable {
|
|
15
|
-
top?: boolean;
|
|
16
|
-
right?: boolean;
|
|
17
|
-
bottom?: boolean;
|
|
18
|
-
left?: boolean;
|
|
19
|
-
topRight?: boolean;
|
|
20
|
-
bottomRight?: boolean;
|
|
21
|
-
bottomLeft?: boolean;
|
|
22
|
-
topLeft?: boolean;
|
|
23
|
-
}
|
|
24
|
-
export interface Size {
|
|
25
|
-
width?: string | number;
|
|
26
|
-
height?: string | number;
|
|
27
|
-
}
|
|
28
|
-
export interface NumberSize {
|
|
29
|
-
width: number;
|
|
30
|
-
height: number;
|
|
31
|
-
}
|
|
32
|
-
export interface NewSize {
|
|
33
|
-
newHeight: number | string;
|
|
34
|
-
newWidth: number | string;
|
|
35
|
-
}
|
|
36
|
-
export declare const DEFAULT_SIZE: {
|
|
37
|
-
width: string;
|
|
38
|
-
height: string;
|
|
39
|
-
};
|
|
40
|
-
export type ResizeCallback = (size: Size, event: MouseEvent, direction: Direction) => void;
|
|
41
|
-
export type ResizeStartCallback = (e: MouseEvent, dir: Direction) => void | boolean;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.directions = exports.DEFAULT_SIZE = void 0;
|
|
7
|
-
// single
|
|
8
|
-
const directions = exports.directions = ['top', 'right', 'bottom', 'left', 'topRight', 'bottomRight', 'bottomLeft', 'topLeft'];
|
|
9
|
-
const DEFAULT_SIZE = exports.DEFAULT_SIZE = {
|
|
10
|
-
width: 'auto',
|
|
11
|
-
height: 'auto'
|
|
12
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export declare const directions: readonly ["top", "right", "bottom", "left", "topRight", "bottomRight", "bottomLeft", "topLeft"];
|
|
2
|
-
export type Direction = 'top' | 'right' | 'bottom' | 'left' | 'topRight' | 'bottomRight' | 'bottomLeft' | 'topLeft';
|
|
3
|
-
export interface HandleClassName {
|
|
4
|
-
top?: string;
|
|
5
|
-
right?: string;
|
|
6
|
-
bottom?: string;
|
|
7
|
-
left?: string;
|
|
8
|
-
topRight?: string;
|
|
9
|
-
bottomRight?: string;
|
|
10
|
-
bottomLeft?: string;
|
|
11
|
-
topLeft?: string;
|
|
12
|
-
}
|
|
13
|
-
export type HandlerCallback = (e: MouseEvent, direction: Direction) => void;
|
|
14
|
-
export interface Enable {
|
|
15
|
-
top?: boolean;
|
|
16
|
-
right?: boolean;
|
|
17
|
-
bottom?: boolean;
|
|
18
|
-
left?: boolean;
|
|
19
|
-
topRight?: boolean;
|
|
20
|
-
bottomRight?: boolean;
|
|
21
|
-
bottomLeft?: boolean;
|
|
22
|
-
topLeft?: boolean;
|
|
23
|
-
}
|
|
24
|
-
export interface Size {
|
|
25
|
-
width?: string | number;
|
|
26
|
-
height?: string | number;
|
|
27
|
-
}
|
|
28
|
-
export interface NumberSize {
|
|
29
|
-
width: number;
|
|
30
|
-
height: number;
|
|
31
|
-
}
|
|
32
|
-
export interface NewSize {
|
|
33
|
-
newHeight: number | string;
|
|
34
|
-
newWidth: number | string;
|
|
35
|
-
}
|
|
36
|
-
export declare const DEFAULT_SIZE: {
|
|
37
|
-
width: string;
|
|
38
|
-
height: string;
|
|
39
|
-
};
|
|
40
|
-
export type ResizeCallback = (size: Size, event: MouseEvent, direction: Direction) => void;
|
|
41
|
-
export type ResizeStartCallback = (e: MouseEvent, dir: Direction) => void | boolean;
|