@douyinfe/semi-foundation 2.70.0-alpha.2 → 2.70.0
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/chat/foundation.ts +17 -2
- package/datePicker/yearAndMonthFoundation.ts +29 -9
- package/lib/cjs/chat/foundation.d.ts +4 -0
- package/lib/cjs/chat/foundation.js +12 -1
- package/lib/cjs/datePicker/yearAndMonthFoundation.js +39 -8
- package/lib/cjs/markdownRender/foundation.d.ts +1 -0
- package/lib/cjs/markdownRender/foundation.js +9 -4
- package/lib/cjs/overflowList/constants.d.ts +1 -1
- package/lib/cjs/resizable/foundation.d.ts +2 -4
- package/lib/cjs/resizable/group/index.d.ts +6 -3
- package/lib/cjs/resizable/group/index.js +90 -23
- package/lib/cjs/resizable/resizable.css +86 -0
- package/lib/cjs/resizable/resizable.scss +100 -3
- package/lib/cjs/resizable/single/index.d.ts +1 -1
- package/lib/cjs/resizable/single/index.js +2 -2
- package/lib/cjs/resizable/types.d.ts +41 -0
- package/lib/cjs/resizable/types.js +12 -0
- package/lib/cjs/resizable/utils.js +5 -5
- package/lib/cjs/resizable/variables.scss +8 -0
- 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/tree/treeUtil.d.ts +1 -1
- package/lib/cjs/treeSelect/treeSelect.css +3 -1
- package/lib/cjs/treeSelect/treeSelect.scss +4 -1
- package/lib/es/chat/foundation.d.ts +4 -0
- package/lib/es/chat/foundation.js +12 -1
- package/lib/es/datePicker/yearAndMonthFoundation.js +39 -8
- package/lib/es/markdownRender/foundation.d.ts +1 -0
- package/lib/es/markdownRender/foundation.js +9 -4
- package/lib/es/overflowList/constants.d.ts +1 -1
- package/lib/es/resizable/foundation.d.ts +2 -4
- package/lib/es/resizable/foundation.js +2 -4
- package/lib/es/resizable/group/index.d.ts +6 -3
- package/lib/es/resizable/group/index.js +90 -23
- package/lib/es/resizable/resizable.css +86 -0
- package/lib/es/resizable/resizable.scss +100 -3
- package/lib/es/resizable/single/index.d.ts +1 -1
- package/lib/es/resizable/single/index.js +1 -1
- package/lib/es/resizable/types.d.ts +41 -0
- package/lib/es/resizable/types.js +6 -0
- package/lib/es/resizable/utils.js +5 -5
- package/lib/es/resizable/variables.scss +8 -0
- 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/tree/treeUtil.d.ts +1 -1
- package/lib/es/treeSelect/treeSelect.css +3 -1
- package/lib/es/treeSelect/treeSelect.scss +4 -1
- package/markdownRender/foundation.ts +13 -7
- package/package.json +3 -5
- package/resizable/foundation.ts +3 -19
- package/resizable/group/index.ts +92 -29
- package/resizable/resizable.scss +100 -3
- package/resizable/single/index.ts +1 -1
- package/resizable/{singleConstants.ts → types.ts} +0 -65
- package/resizable/utils.ts +7 -6
- package/resizable/variables.scss +8 -0
- package/table/table.scss +2 -1
- package/transfer/transfer.scss +1 -0
- package/treeSelect/treeSelect.scss +4 -1
- package/tsconfig.json +1 -1
- package/jsonViewer/constants.ts +0 -7
- package/jsonViewer/foundation.ts +0 -67
- package/jsonViewer/jsonViewer.scss +0 -152
- package/jsonViewer/script/build.js +0 -51
- package/jsonViewer/variables.scss +0 -27
- package/lib/cjs/jsonViewer/constants.d.ts +0 -4
- package/lib/cjs/jsonViewer/constants.js +0 -10
- package/lib/cjs/jsonViewer/foundation.d.ts +0 -21
- package/lib/cjs/jsonViewer/foundation.js +0 -78
- package/lib/cjs/jsonViewer/jsonViewer.css +0 -136
- package/lib/cjs/jsonViewer/jsonViewer.scss +0 -152
- package/lib/cjs/jsonViewer/variables.scss +0 -27
- package/lib/cjs/resizable/groupConstants.d.ts +0 -16
- package/lib/cjs/resizable/groupConstants.js +0 -25
- package/lib/cjs/resizable/singleConstants.d.ts +0 -105
- package/lib/cjs/resizable/singleConstants.js +0 -67
- package/lib/es/jsonViewer/constants.d.ts +0 -4
- package/lib/es/jsonViewer/constants.js +0 -5
- package/lib/es/jsonViewer/foundation.d.ts +0 -21
- package/lib/es/jsonViewer/foundation.js +0 -60
- package/lib/es/jsonViewer/jsonViewer.css +0 -136
- package/lib/es/jsonViewer/jsonViewer.scss +0 -152
- package/lib/es/jsonViewer/variables.scss +0 -27
- package/lib/es/resizable/groupConstants.d.ts +0 -16
- package/lib/es/resizable/groupConstants.js +0 -19
- package/lib/es/resizable/singleConstants.d.ts +0 -105
- package/lib/es/resizable/singleConstants.js +0 -61
- package/resizable/groupConstants.ts +0 -25
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _debounce from "lodash/debounce";
|
|
1
2
|
import { getItemDirection, getPixelSize } from "../utils";
|
|
2
3
|
import BaseFoundation from '../../base/foundation';
|
|
3
4
|
import { adjustNewSize, judgeConstraint, getOffset } from "../utils";
|
|
@@ -39,16 +40,18 @@ export class ResizeGroupFoundation extends BaseFoundation {
|
|
|
39
40
|
// offset caused by padding and border
|
|
40
41
|
const lastStyle = this.window.getComputedStyle(lastItem);
|
|
41
42
|
const nextStyle = this.window.getComputedStyle(nextItem);
|
|
42
|
-
lastOffset = getOffset(lastStyle, this.direction);
|
|
43
|
-
nextOffset = getOffset(nextStyle, this.direction);
|
|
43
|
+
lastOffset = getOffset(lastStyle, this.direction) + this.itemMinusMap.get(handlerIndex);
|
|
44
|
+
nextOffset = getOffset(nextStyle, this.direction) + this.itemMinusMap.get(handlerIndex + 1);
|
|
45
|
+
let lastItemSize = (this.direction === 'horizontal' ? lastItem.offsetWidth : lastItem.offsetHeight) + this.itemMinusMap.get(handlerIndex),
|
|
46
|
+
nextItemSize = (this.direction === 'horizontal' ? nextItem.offsetWidth : nextItem.offsetHeight) + this.itemMinusMap.get(handlerIndex + 1);
|
|
44
47
|
const states = this.getStates();
|
|
45
48
|
this.setState({
|
|
46
49
|
isResizing: true,
|
|
47
50
|
originalPosition: {
|
|
48
51
|
x: clientX,
|
|
49
52
|
y: clientY,
|
|
50
|
-
lastItemSize
|
|
51
|
-
nextItemSize
|
|
53
|
+
lastItemSize,
|
|
54
|
+
nextItemSize,
|
|
52
55
|
lastOffset,
|
|
53
56
|
nextOffset
|
|
54
57
|
},
|
|
@@ -95,28 +98,33 @@ export class ResizeGroupFoundation extends BaseFoundation {
|
|
|
95
98
|
} = props;
|
|
96
99
|
let lastItem = this._adapter.getItem(curHandler),
|
|
97
100
|
nextItem = this._adapter.getItem(curHandler + 1);
|
|
98
|
-
let parentSize = this.
|
|
99
|
-
let availableSize = parentSize - this.totalMinus;
|
|
101
|
+
let parentSize = this.groupSize;
|
|
100
102
|
let delta = direction === 'horizontal' ? clientX - initX : clientY - initY;
|
|
101
103
|
let lastNewSize = lastItemSize + delta;
|
|
102
104
|
let nextNewSize = nextItemSize - delta;
|
|
103
105
|
// 判断是否超出限制
|
|
104
|
-
let lastFlag = judgeConstraint(lastNewSize, this._adapter.getItemMin(curHandler), this._adapter.getItemMax(curHandler),
|
|
105
|
-
nextFlag = judgeConstraint(nextNewSize, this._adapter.getItemMin(curHandler + 1), this._adapter.getItemMax(curHandler + 1),
|
|
106
|
+
let lastFlag = judgeConstraint(lastNewSize, this._adapter.getItemMin(curHandler), this._adapter.getItemMax(curHandler), parentSize, lastOffset),
|
|
107
|
+
nextFlag = judgeConstraint(nextNewSize, this._adapter.getItemMin(curHandler + 1), this._adapter.getItemMax(curHandler + 1), parentSize, nextOffset);
|
|
106
108
|
if (lastFlag) {
|
|
107
|
-
lastNewSize = adjustNewSize(lastNewSize, this._adapter.getItemMin(curHandler), this._adapter.getItemMax(curHandler),
|
|
109
|
+
lastNewSize = adjustNewSize(lastNewSize, this._adapter.getItemMin(curHandler), this._adapter.getItemMax(curHandler), parentSize, lastOffset);
|
|
108
110
|
nextNewSize = lastItemSize + nextItemSize - lastNewSize;
|
|
109
111
|
}
|
|
110
112
|
if (nextFlag) {
|
|
111
|
-
nextNewSize = adjustNewSize(nextNewSize, this._adapter.getItemMin(curHandler + 1), this._adapter.getItemMax(curHandler + 1),
|
|
113
|
+
nextNewSize = adjustNewSize(nextNewSize, this._adapter.getItemMin(curHandler + 1), this._adapter.getItemMax(curHandler + 1), parentSize, nextOffset);
|
|
112
114
|
lastNewSize = lastItemSize + nextItemSize - nextNewSize;
|
|
113
115
|
}
|
|
116
|
+
let lastItemPercent = this.itemPercentMap.get(curHandler),
|
|
117
|
+
nextItemPercent = this.itemPercentMap.get(curHandler + 1);
|
|
118
|
+
let lastNewPercent = lastNewSize / parentSize * 100;
|
|
119
|
+
let nextNewPercent = lastItemPercent + nextItemPercent - lastNewPercent; // 消除浮点误差
|
|
120
|
+
this.itemPercentMap.set(curHandler, lastNewPercent);
|
|
121
|
+
this.itemPercentMap.set(curHandler + 1, nextNewPercent);
|
|
114
122
|
if (direction === 'horizontal') {
|
|
115
|
-
lastItem.style.width =
|
|
116
|
-
nextItem.style.width =
|
|
123
|
+
lastItem.style.width = `calc(${lastNewPercent}% - ${this.itemMinusMap.get(curHandler)}px)`;
|
|
124
|
+
nextItem.style.width = `calc(${nextNewPercent}% - ${this.itemMinusMap.get(curHandler + 1)}px)`;
|
|
117
125
|
} else if (direction === 'vertical') {
|
|
118
|
-
lastItem.style.height =
|
|
119
|
-
nextItem.style.height =
|
|
126
|
+
lastItem.style.height = `calc(${lastNewPercent}% - ${this.itemMinusMap.get(curHandler)}px)`;
|
|
127
|
+
nextItem.style.height = `calc(${nextNewPercent}% - ${this.itemMinusMap.get(curHandler + 1)}px)`;
|
|
120
128
|
}
|
|
121
129
|
let lastFunc = this._adapter.getItemChange(curHandler),
|
|
122
130
|
nextFunc = this._adapter.getItemChange(curHandler + 1);
|
|
@@ -161,14 +169,14 @@ export class ResizeGroupFoundation extends BaseFoundation {
|
|
|
161
169
|
});
|
|
162
170
|
this.unregisterEvents();
|
|
163
171
|
};
|
|
164
|
-
this.
|
|
172
|
+
this.initSpace = () => {
|
|
165
173
|
const props = this.getProps();
|
|
166
174
|
const {
|
|
167
175
|
direction
|
|
168
176
|
} = props;
|
|
169
177
|
// calculate accurate space for group item
|
|
170
178
|
let handlerSizes = new Array(this._adapter.getHandlerCount()).fill(0);
|
|
171
|
-
let
|
|
179
|
+
let parentSize = this.groupSize;
|
|
172
180
|
this.totalMinus = 0;
|
|
173
181
|
for (let i = 0; i < this._adapter.getHandlerCount(); i++) {
|
|
174
182
|
let handlerSize = direction === 'horizontal' ? this._adapter.getHandler(i).offsetWidth : this._adapter.getHandler(i).offsetHeight;
|
|
@@ -190,8 +198,8 @@ export class ResizeGroupFoundation extends BaseFoundation {
|
|
|
190
198
|
const child = this._adapter.getItem(i);
|
|
191
199
|
let minSize = this._adapter.getItemMin(i),
|
|
192
200
|
maxSize = this._adapter.getItemMax(i);
|
|
193
|
-
let minSizePercent = minSize ? getPixelSize(minSize,
|
|
194
|
-
maxSizePercent = maxSize ? getPixelSize(maxSize,
|
|
201
|
+
let minSizePercent = minSize ? getPixelSize(minSize, parentSize) / parentSize * 100 : 0,
|
|
202
|
+
maxSizePercent = maxSize ? getPixelSize(maxSize, parentSize) / parentSize * 100 : 100;
|
|
195
203
|
if (minSizePercent > maxSizePercent) {
|
|
196
204
|
console.warn('[Semi ResizableItem]: min size bigger than max size');
|
|
197
205
|
}
|
|
@@ -201,15 +209,17 @@ export class ResizeGroupFoundation extends BaseFoundation {
|
|
|
201
209
|
if (typeof defaultSize === 'string') {
|
|
202
210
|
if (defaultSize.endsWith('%')) {
|
|
203
211
|
itemSizePercent = parseFloat(defaultSize.slice(0, -1));
|
|
212
|
+
this.itemPercentMap.set(i, itemSizePercent);
|
|
204
213
|
} else if (defaultSize.endsWith('px')) {
|
|
205
|
-
itemSizePercent = parseFloat(defaultSize.slice(0, -2)) /
|
|
214
|
+
itemSizePercent = parseFloat(defaultSize.slice(0, -2)) / parentSize * 100;
|
|
215
|
+
this.itemPercentMap.set(i, itemSizePercent);
|
|
206
216
|
} else if (/^-?\d+(\.\d+)?$/.test(defaultSize)) {
|
|
207
217
|
// 仅由数字组成,表示按比例分配剩下空间
|
|
208
218
|
undefineLoc.set(i, parseFloat(defaultSize));
|
|
209
219
|
undefinedTotal += parseFloat(defaultSize);
|
|
210
220
|
continue;
|
|
211
221
|
}
|
|
212
|
-
} else {
|
|
222
|
+
} else if (typeof defaultSize === 'number') {
|
|
213
223
|
undefineLoc.set(i, defaultSize);
|
|
214
224
|
undefinedTotal += defaultSize;
|
|
215
225
|
continue;
|
|
@@ -238,21 +248,78 @@ export class ResizeGroupFoundation extends BaseFoundation {
|
|
|
238
248
|
}
|
|
239
249
|
undefineLoc.forEach((value, key) => {
|
|
240
250
|
const child = this._adapter.getItem(key);
|
|
251
|
+
const percent = value / undefinedTotal * undefineSizePercent;
|
|
252
|
+
this.itemPercentMap.set(key, percent);
|
|
241
253
|
if (direction === 'horizontal') {
|
|
242
|
-
child.style.width = `calc(${
|
|
254
|
+
child.style.width = `calc(${percent}% - ${this.itemMinusMap.get(key)}px)`;
|
|
243
255
|
} else {
|
|
244
|
-
child.style.height = `calc(${
|
|
256
|
+
child.style.height = `calc(${percent}% - ${this.itemMinusMap.get(key)}px)`;
|
|
245
257
|
}
|
|
246
258
|
});
|
|
247
259
|
};
|
|
260
|
+
this.ensureConstraint = _debounce(() => {
|
|
261
|
+
// 浏览器拖拽时保证px值最大最小仍生效
|
|
262
|
+
const {
|
|
263
|
+
direction
|
|
264
|
+
} = this.getProps();
|
|
265
|
+
const itemCount = this._adapter.getItemCount();
|
|
266
|
+
let continueFlag = true;
|
|
267
|
+
for (let i = 0; i < itemCount; i++) {
|
|
268
|
+
const child = this._adapter.getItem(i);
|
|
269
|
+
const childSize = direction === 'horizontal' ? child.offsetWidth : child.offsetHeight;
|
|
270
|
+
// 判断由非鼠标拖拽导致item的size变化过程中是否有超出限制的情况
|
|
271
|
+
const childFlag = judgeConstraint(childSize, this._adapter.getItemMin(i), this._adapter.getItemMax(i), this.groupSize, this.itemMinusMap.get(i));
|
|
272
|
+
if (childFlag) {
|
|
273
|
+
const childNewSize = adjustNewSize(childSize, this._adapter.getItemMin(i), this._adapter.getItemMax(i), this.groupSize, this.itemMinusMap.get(i));
|
|
274
|
+
for (let j = i + 1; j < itemCount; j++) {
|
|
275
|
+
// 找到下一个没有超出限制的item
|
|
276
|
+
const item = this._adapter.getItem(j);
|
|
277
|
+
const itemSize = direction === 'horizontal' ? item.offsetWidth : item.offsetHeight;
|
|
278
|
+
const itemFlag = judgeConstraint(itemSize, this._adapter.getItemMin(j), this._adapter.getItemMax(j), this.groupSize, this.itemMinusMap.get(j));
|
|
279
|
+
if (!itemFlag) {
|
|
280
|
+
let childPercent = this.itemPercentMap.get(i),
|
|
281
|
+
itemPercent = this.itemPercentMap.get(j);
|
|
282
|
+
let childNewPercent = childNewSize / this.groupSize * 100;
|
|
283
|
+
let itemNewPercent = childPercent + itemPercent - childNewPercent;
|
|
284
|
+
this.itemPercentMap.set(i, childNewPercent);
|
|
285
|
+
this.itemPercentMap.set(j, itemNewPercent);
|
|
286
|
+
if (direction === 'horizontal') {
|
|
287
|
+
child.style.width = `calc(${childNewPercent}% - ${this.itemMinusMap.get(i)}px)`;
|
|
288
|
+
item.style.width = `calc(${itemNewPercent}% - ${this.itemMinusMap.get(j)}px)`;
|
|
289
|
+
} else {
|
|
290
|
+
child.style.height = `calc(${childNewPercent}% - ${this.itemMinusMap.get(i)}px)`;
|
|
291
|
+
item.style.height = `calc(${itemNewPercent}% - ${this.itemMinusMap.get(j)}px)`;
|
|
292
|
+
}
|
|
293
|
+
break;
|
|
294
|
+
} else {
|
|
295
|
+
if (j === itemCount - 1) {
|
|
296
|
+
continueFlag = false;
|
|
297
|
+
console.warn('[Semi ResizableGroup]: no enough space to adjust min/max size');
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
if (!continueFlag) {
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}, 200);
|
|
248
307
|
}
|
|
249
308
|
get groupRef() {
|
|
250
309
|
return this._adapter.getGroupRef();
|
|
251
310
|
}
|
|
311
|
+
get groupSize() {
|
|
312
|
+
const {
|
|
313
|
+
direction
|
|
314
|
+
} = this.getProps();
|
|
315
|
+
let groupSize = direction === 'horizontal' ? this.groupRef.offsetWidth : this.groupRef.offsetHeight;
|
|
316
|
+
return groupSize;
|
|
317
|
+
}
|
|
252
318
|
init() {
|
|
253
319
|
this.direction = this.getProp('direction');
|
|
254
320
|
this.itemMinusMap = new Map();
|
|
255
|
-
this.
|
|
321
|
+
this.itemPercentMap = new Map();
|
|
322
|
+
this.initSpace();
|
|
256
323
|
}
|
|
257
324
|
get window() {
|
|
258
325
|
var _a;
|
|
@@ -11,6 +11,72 @@
|
|
|
11
11
|
user-select: none;
|
|
12
12
|
z-index: 2000;
|
|
13
13
|
}
|
|
14
|
+
.semi-resizable-resizableHandler-top {
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 10px;
|
|
17
|
+
top: 0;
|
|
18
|
+
left: 0;
|
|
19
|
+
cursor: row-resize;
|
|
20
|
+
top: -5px;
|
|
21
|
+
}
|
|
22
|
+
.semi-resizable-resizableHandler-right {
|
|
23
|
+
width: 10px;
|
|
24
|
+
height: 100%;
|
|
25
|
+
top: 0;
|
|
26
|
+
left: 0;
|
|
27
|
+
cursor: col-resize;
|
|
28
|
+
left: auto;
|
|
29
|
+
right: -5px;
|
|
30
|
+
}
|
|
31
|
+
.semi-resizable-resizableHandler-bottom {
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 10px;
|
|
34
|
+
top: 0;
|
|
35
|
+
left: 0;
|
|
36
|
+
cursor: row-resize;
|
|
37
|
+
top: auto;
|
|
38
|
+
bottom: -5px;
|
|
39
|
+
}
|
|
40
|
+
.semi-resizable-resizableHandler-left {
|
|
41
|
+
width: 10px;
|
|
42
|
+
height: 100%;
|
|
43
|
+
top: 0;
|
|
44
|
+
left: 0;
|
|
45
|
+
cursor: col-resize;
|
|
46
|
+
left: -5px;
|
|
47
|
+
}
|
|
48
|
+
.semi-resizable-resizableHandler-topRight {
|
|
49
|
+
width: 20px;
|
|
50
|
+
height: 20px;
|
|
51
|
+
position: absolute;
|
|
52
|
+
right: -10px;
|
|
53
|
+
top: -10px;
|
|
54
|
+
cursor: ne-resize;
|
|
55
|
+
}
|
|
56
|
+
.semi-resizable-resizableHandler-bottomRight {
|
|
57
|
+
width: 20px;
|
|
58
|
+
height: 20px;
|
|
59
|
+
position: absolute;
|
|
60
|
+
right: -10px;
|
|
61
|
+
bottom: -10px;
|
|
62
|
+
cursor: se-resize;
|
|
63
|
+
}
|
|
64
|
+
.semi-resizable-resizableHandler-bottomLeft {
|
|
65
|
+
width: 20px;
|
|
66
|
+
height: 20px;
|
|
67
|
+
position: absolute;
|
|
68
|
+
left: -10px;
|
|
69
|
+
bottom: -10px;
|
|
70
|
+
cursor: sw-resize;
|
|
71
|
+
}
|
|
72
|
+
.semi-resizable-resizableHandler-topLeft {
|
|
73
|
+
width: 20px;
|
|
74
|
+
height: 20px;
|
|
75
|
+
position: absolute;
|
|
76
|
+
left: -10px;
|
|
77
|
+
top: -10px;
|
|
78
|
+
cursor: nw-resize;
|
|
79
|
+
}
|
|
14
80
|
.semi-resizable-group {
|
|
15
81
|
display: flex;
|
|
16
82
|
position: relative;
|
|
@@ -31,4 +97,24 @@
|
|
|
31
97
|
justify-content: center;
|
|
32
98
|
background-color: var(--semi-color-fill-0);
|
|
33
99
|
opacity: 1;
|
|
100
|
+
}
|
|
101
|
+
.semi-resizable-handler-vertical {
|
|
102
|
+
width: 100%;
|
|
103
|
+
height: 10px;
|
|
104
|
+
flex-shrink: 0;
|
|
105
|
+
cursor: row-resize;
|
|
106
|
+
}
|
|
107
|
+
.semi-resizable-handler-horizontal {
|
|
108
|
+
height: 100%;
|
|
109
|
+
width: 10px;
|
|
110
|
+
flex-shrink: 0;
|
|
111
|
+
cursor: col-resize;
|
|
112
|
+
}
|
|
113
|
+
.semi-resizable-background {
|
|
114
|
+
height: 100%;
|
|
115
|
+
width: 100%;
|
|
116
|
+
inset: 0;
|
|
117
|
+
z-index: 2010;
|
|
118
|
+
opacity: 0;
|
|
119
|
+
position: fixed;
|
|
34
120
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
@import
|
|
2
|
-
|
|
1
|
+
@import "./variables.scss";
|
|
3
2
|
$module: #{$prefix}-resizable;
|
|
4
3
|
|
|
5
4
|
.#{$module} {
|
|
@@ -13,8 +12,83 @@ $module: #{$prefix}-resizable;
|
|
|
13
12
|
position: absolute;
|
|
14
13
|
user-select: none;
|
|
15
14
|
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
|
+
}
|
|
16
90
|
}
|
|
17
|
-
|
|
91
|
+
|
|
18
92
|
&-group {
|
|
19
93
|
display: flex;
|
|
20
94
|
position: relative;
|
|
@@ -37,5 +111,28 @@ $module: #{$prefix}-resizable;
|
|
|
37
111
|
justify-content: center;
|
|
38
112
|
background-color: var(--semi-color-fill-0);
|
|
39
113
|
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;
|
|
40
137
|
}
|
|
41
138
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../../base/foundation';
|
|
2
|
-
import { Size, NumberSize, Direction } from "../
|
|
2
|
+
import { Size, NumberSize, Direction } from "../types";
|
|
3
3
|
export interface ResizableHandlerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
4
4
|
registerEvent: () => void;
|
|
5
5
|
unregisterEvent: () => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseFoundation from '../../base/foundation';
|
|
2
|
-
import { DEFAULT_SIZE } from "../
|
|
2
|
+
import { DEFAULT_SIZE } from "../types";
|
|
3
3
|
import { getStringSize, getNumberSize, has, calculateNewMax, findNextSnap, snap, clamp } from "../utils";
|
|
4
4
|
export class ResizableHandlerFoundation extends BaseFoundation {
|
|
5
5
|
constructor(adapter) {
|
|
@@ -0,0 +1,41 @@
|
|
|
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;
|
|
@@ -86,10 +86,10 @@ export const judgeConstraint = function (newSize, min, max, parentSize) {
|
|
|
86
86
|
max = max !== null && max !== void 0 ? max : "100%";
|
|
87
87
|
const minSize = getPixelSize(min, parentSize);
|
|
88
88
|
const maxSize = getPixelSize(max, parentSize);
|
|
89
|
-
if (newSize
|
|
89
|
+
if (newSize < minSize + offset) {
|
|
90
90
|
return true;
|
|
91
91
|
}
|
|
92
|
-
if (newSize
|
|
92
|
+
if (newSize > maxSize) {
|
|
93
93
|
return true;
|
|
94
94
|
}
|
|
95
95
|
return false;
|
|
@@ -99,11 +99,11 @@ export const adjustNewSize = (newSize, min, max, parentSize, offset) => {
|
|
|
99
99
|
max = max !== null && max !== void 0 ? max : "100%";
|
|
100
100
|
const minSize = getPixelSize(min, parentSize);
|
|
101
101
|
const maxSize = getPixelSize(max, parentSize);
|
|
102
|
-
if (newSize
|
|
102
|
+
if (newSize < minSize + offset) {
|
|
103
103
|
return minSize + offset;
|
|
104
104
|
}
|
|
105
|
-
if (newSize
|
|
106
|
-
return maxSize
|
|
105
|
+
if (newSize > maxSize) {
|
|
106
|
+
return maxSize;
|
|
107
107
|
}
|
|
108
108
|
return newSize;
|
|
109
109
|
};
|
|
@@ -1 +1,9 @@
|
|
|
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/lib/es/table/table.css
CHANGED
|
@@ -140,7 +140,8 @@
|
|
|
140
140
|
cursor: pointer;
|
|
141
141
|
}
|
|
142
142
|
.semi-table-thead > .semi-table-row > .semi-table-row-head.semi-table-row-head-clickSort:hover {
|
|
143
|
-
background: var(--semi-color-fill-0);
|
|
143
|
+
background-image: linear-gradient(0deg, var(--semi-color-fill-0), var(--semi-color-fill-0));
|
|
144
|
+
background-color: var(--semi-color-bg-0);
|
|
144
145
|
}
|
|
145
146
|
.semi-table-thead > .semi-table-row > .semi-table-row-head.semi-table-row-head-clickSort:hover.semi-table-cell-fixed-left::before, .semi-table-thead > .semi-table-row > .semi-table-row-head.semi-table-row-head-clickSort:hover.semi-table-cell-fixed-right::before {
|
|
146
147
|
background-color: transparent;
|
package/lib/es/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,
|
|
@@ -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;
|
|
@@ -83,6 +83,6 @@ export declare function getValueOrKey(data: any, keyMaps?: KeyMapProps): any;
|
|
|
83
83
|
export declare function normalizeValue(value: any, withObject: boolean, keyMaps?: KeyMapProps): any;
|
|
84
84
|
export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
|
|
85
85
|
export declare function calcDisabledKeys(keyEntities: KeyEntities, keyMaps?: KeyMapProps): Set<string>;
|
|
86
|
-
export declare function calcDropRelativePosition(event: any, treeNode: any):
|
|
86
|
+
export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
|
|
87
87
|
export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
|
|
88
88
|
export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
|
|
@@ -136,12 +136,14 @@
|
|
|
136
136
|
}
|
|
137
137
|
.semi-tree-select-selection-TriggerSearchItem-placeholder {
|
|
138
138
|
opacity: 0.6;
|
|
139
|
-
z-index: -1;
|
|
140
139
|
}
|
|
141
140
|
.semi-tree-select-selection-TriggerSearchItem-disabled {
|
|
142
141
|
cursor: not-allowed;
|
|
143
142
|
color: var(--semi-color-disabled-text);
|
|
144
143
|
}
|
|
144
|
+
.semi-tree-select-selection .semi-tree-select-triggerSingleSearch-upper {
|
|
145
|
+
z-index: 1;
|
|
146
|
+
}
|
|
145
147
|
.semi-tree-select-selection .semi-tree-select-triggerSingleSearch-wrapper {
|
|
146
148
|
width: 100%;
|
|
147
149
|
}
|
|
@@ -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
|
|
|
@@ -16,7 +16,8 @@ export interface MarkdownRenderBaseProps{
|
|
|
16
16
|
components: MDXProps['components'];
|
|
17
17
|
format: "md"|"mdx";
|
|
18
18
|
remarkPlugins?: PluggableList;
|
|
19
|
-
rehypePlugins?: PluggableList
|
|
19
|
+
rehypePlugins?: PluggableList;
|
|
20
|
+
remarkGfm?: boolean
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
|
|
@@ -26,16 +27,21 @@ export interface MarkdownRenderBaseState{
|
|
|
26
27
|
|
|
27
28
|
class MarkdownRenderFoundation extends BaseFoundation<MarkdownRenderAdapter> {
|
|
28
29
|
|
|
29
|
-
private getOptions = ()=>{
|
|
30
|
+
private getOptions = () => {
|
|
31
|
+
const enableRemarkGfm = this._adapter.getProp("remarkGfm");
|
|
32
|
+
const remarkPlugins = [...(this.getProp("remarkPlugins") ?? [])];
|
|
33
|
+
if (enableRemarkGfm) {
|
|
34
|
+
remarkPlugins.unshift(remarkGfm);
|
|
35
|
+
}
|
|
30
36
|
return {
|
|
31
37
|
evaluateOptions: {
|
|
32
|
-
remarkPlugins:
|
|
38
|
+
remarkPlugins: remarkPlugins,
|
|
33
39
|
rehypePlugins: this.getProp("rehypePlugins") ?? [],
|
|
34
40
|
format: this.getProp("format")
|
|
35
41
|
},
|
|
36
42
|
compileOptions: {
|
|
37
43
|
format: this.getProp("format"),
|
|
38
|
-
remarkPlugins:
|
|
44
|
+
remarkPlugins: remarkPlugins,
|
|
39
45
|
rehypePlugins: this.getProp("rehypePlugins") ?? [],
|
|
40
46
|
},
|
|
41
47
|
runOptions: {
|
|
@@ -47,11 +53,11 @@ class MarkdownRenderFoundation extends BaseFoundation<MarkdownRenderAdapter> {
|
|
|
47
53
|
};
|
|
48
54
|
}
|
|
49
55
|
|
|
50
|
-
compile = async (mdxRaw: string)=>{
|
|
56
|
+
compile = async (mdxRaw: string) => {
|
|
51
57
|
return await compile(mdxRaw, this.getOptions().compileOptions);
|
|
52
58
|
}
|
|
53
59
|
|
|
54
|
-
evaluate = async (mdxRaw: string)=>{
|
|
60
|
+
evaluate = async (mdxRaw: string) => {
|
|
55
61
|
return (await evaluate(mdxRaw, {
|
|
56
62
|
...this.getOptions().runOptions,
|
|
57
63
|
...this.getOptions().evaluateOptions,
|
|
@@ -59,7 +65,7 @@ class MarkdownRenderFoundation extends BaseFoundation<MarkdownRenderAdapter> {
|
|
|
59
65
|
})).default;
|
|
60
66
|
}
|
|
61
67
|
|
|
62
|
-
evaluateSync = (mdxRaw: string)=>{
|
|
68
|
+
evaluateSync = (mdxRaw: string) => {
|
|
63
69
|
return ( evaluateSync(mdxRaw, {
|
|
64
70
|
...this.getOptions().runOptions,
|
|
65
71
|
...this.getOptions().evaluateOptions,
|