@douyinfe/semi-foundation 2.4.1 → 2.6.0-beta.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/button/button.scss +11 -0
- package/button/variables.scss +4 -0
- package/cascader/cascader.scss +3 -2
- package/cascader/foundation.ts +19 -0
- package/cascader/variables.scss +6 -3
- package/datePicker/foundation.ts +16 -4
- package/datePicker/inputFoundation.ts +0 -1
- package/datePicker/monthFoundation.ts +1 -0
- package/form/form.scss +7 -1
- package/form/foundation.ts +40 -36
- package/form/interface.ts +1 -1
- package/input/input.scss +2 -1
- package/lib/cjs/autoComplete/constants.d.ts +1 -1
- package/lib/cjs/button/button.css +9 -0
- package/lib/cjs/button/button.scss +11 -0
- package/lib/cjs/button/variables.scss +4 -0
- package/lib/cjs/cascader/cascader.css +2 -1
- package/lib/cjs/cascader/cascader.scss +3 -2
- package/lib/cjs/cascader/foundation.d.ts +19 -0
- package/lib/cjs/cascader/foundation.js +22 -0
- package/lib/cjs/cascader/variables.scss +6 -3
- package/lib/cjs/datePicker/foundation.d.ts +9 -4
- package/lib/cjs/datePicker/foundation.js +18 -0
- package/lib/cjs/datePicker/inputFoundation.d.ts +0 -1
- package/lib/cjs/datePicker/monthFoundation.d.ts +1 -0
- package/lib/cjs/dropdown/constants.d.ts +1 -1
- package/lib/cjs/form/form.css +4 -0
- package/lib/cjs/form/form.scss +7 -1
- package/lib/cjs/form/foundation.d.ts +6 -6
- package/lib/cjs/form/foundation.js +51 -52
- package/lib/cjs/form/interface.d.ts +1 -1
- package/lib/cjs/input/input.css +1 -0
- package/lib/cjs/input/input.scss +2 -1
- package/lib/cjs/select/constants.d.ts +1 -1
- package/lib/cjs/select/foundation.d.ts +1 -1
- package/lib/cjs/select/foundation.js +2 -1
- package/lib/cjs/select/optionFoundation.d.ts +1 -1
- package/lib/cjs/select/optionFoundation.js +3 -3
- package/lib/cjs/slider/foundation.js +2 -2
- package/lib/cjs/table/foundation.d.ts +2 -0
- package/lib/cjs/table/foundation.js +16 -4
- package/lib/cjs/table/table.css +1 -2
- package/lib/cjs/table/table.scss +4 -5
- package/lib/cjs/table/utils.js +4 -1
- package/lib/cjs/table/variables.scss +1 -0
- package/lib/cjs/tooltip/constants.d.ts +1 -1
- package/lib/cjs/tooltip/constants.js +1 -1
- package/lib/cjs/tooltip/foundation.js +65 -4
- package/lib/cjs/tree/foundation.d.ts +4 -1
- package/lib/cjs/tree/foundation.js +69 -20
- package/lib/cjs/treeSelect/foundation.d.ts +3 -3
- package/lib/cjs/treeSelect/foundation.js +103 -35
- package/lib/cjs/upload/upload.css +49 -27
- package/lib/cjs/upload/upload.scss +66 -41
- package/lib/cjs/upload/variables.scss +3 -1
- package/lib/es/autoComplete/constants.d.ts +1 -1
- package/lib/es/button/button.css +9 -0
- package/lib/es/button/button.scss +11 -0
- package/lib/es/button/variables.scss +4 -0
- package/lib/es/cascader/cascader.css +2 -1
- package/lib/es/cascader/cascader.scss +3 -2
- package/lib/es/cascader/foundation.d.ts +19 -0
- package/lib/es/cascader/foundation.js +22 -1
- package/lib/es/cascader/variables.scss +6 -3
- package/lib/es/datePicker/foundation.d.ts +9 -4
- package/lib/es/datePicker/foundation.js +18 -0
- package/lib/es/datePicker/inputFoundation.d.ts +0 -1
- package/lib/es/datePicker/monthFoundation.d.ts +1 -0
- package/lib/es/dropdown/constants.d.ts +1 -1
- package/lib/es/form/form.css +4 -0
- package/lib/es/form/form.scss +7 -1
- package/lib/es/form/foundation.d.ts +6 -6
- package/lib/es/form/foundation.js +51 -52
- package/lib/es/form/interface.d.ts +1 -1
- package/lib/es/input/input.css +1 -0
- package/lib/es/input/input.scss +2 -1
- package/lib/es/select/constants.d.ts +1 -1
- package/lib/es/select/foundation.d.ts +1 -1
- package/lib/es/select/foundation.js +2 -1
- package/lib/es/select/optionFoundation.d.ts +1 -1
- package/lib/es/select/optionFoundation.js +3 -3
- package/lib/es/slider/foundation.js +2 -2
- package/lib/es/table/foundation.d.ts +2 -0
- package/lib/es/table/foundation.js +16 -4
- package/lib/es/table/table.css +1 -2
- package/lib/es/table/table.scss +4 -5
- package/lib/es/table/utils.js +4 -1
- package/lib/es/table/variables.scss +1 -0
- package/lib/es/tooltip/constants.d.ts +1 -1
- package/lib/es/tooltip/constants.js +1 -1
- package/lib/es/tooltip/foundation.js +65 -4
- package/lib/es/tree/foundation.d.ts +4 -1
- package/lib/es/tree/foundation.js +69 -20
- package/lib/es/treeSelect/foundation.d.ts +3 -3
- package/lib/es/treeSelect/foundation.js +102 -35
- package/lib/es/upload/upload.css +49 -27
- package/lib/es/upload/upload.scss +66 -41
- package/lib/es/upload/variables.scss +3 -1
- package/package.json +3 -3
- package/select/foundation.ts +3 -2
- package/select/optionFoundation.ts +3 -3
- package/slider/foundation.ts +2 -2
- package/table/foundation.ts +23 -10
- package/table/table.scss +4 -5
- package/table/utils.ts +3 -1
- package/table/variables.scss +1 -0
- package/tooltip/constants.ts +2 -0
- package/tooltip/foundation.ts +52 -4
- package/tree/foundation.ts +56 -17
- package/treeSelect/foundation.ts +89 -41
- package/upload/upload.scss +66 -41
- package/upload/variables.scss +3 -1
|
@@ -548,6 +548,19 @@ class Tooltip extends _foundation.default {
|
|
|
548
548
|
translateX = -1;
|
|
549
549
|
break;
|
|
550
550
|
|
|
551
|
+
case 'leftBottomOver':
|
|
552
|
+
left = triggerRect.left;
|
|
553
|
+
top = triggerRect.bottom;
|
|
554
|
+
translateY = -1;
|
|
555
|
+
break;
|
|
556
|
+
|
|
557
|
+
case 'rightBottomOver':
|
|
558
|
+
left = triggerRect.right;
|
|
559
|
+
top = triggerRect.bottom;
|
|
560
|
+
translateX = -1;
|
|
561
|
+
translateY = -1;
|
|
562
|
+
break;
|
|
563
|
+
|
|
551
564
|
default:
|
|
552
565
|
break;
|
|
553
566
|
}
|
|
@@ -669,12 +682,16 @@ class Tooltip extends _foundation.default {
|
|
|
669
682
|
|
|
670
683
|
const shouldReverseTop = clientTop < wrapperRect.height + spacing && restClientBottom > wrapperRect.height + spacing;
|
|
671
684
|
const shouldReverseLeft = clientLeft < wrapperRect.width + spacing && restClientRight > wrapperRect.width + spacing;
|
|
672
|
-
const
|
|
685
|
+
const shouldReverseBottom = restClientBottom < wrapperRect.height + spacing && clientTop > wrapperRect.height + spacing;
|
|
673
686
|
const shouldReverseRight = restClientRight < wrapperRect.width + spacing && clientLeft > wrapperRect.width + spacing;
|
|
687
|
+
const shouldReverseTopOver = restClientTop < wrapperRect.height + spacing && clientBottom > wrapperRect.height + spacing;
|
|
688
|
+
const shouldReverseBottomOver = clientBottom < wrapperRect.height + spacing && restClientTop > wrapperRect.height + spacing;
|
|
674
689
|
const shouldReverseTopSide = restClientTop < wrapperRect.height && clientBottom > wrapperRect.height;
|
|
675
690
|
const shouldReverseBottomSide = clientBottom < wrapperRect.height && restClientTop > wrapperRect.height;
|
|
676
691
|
const shouldReverseLeftSide = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
|
|
677
692
|
const shouldReverseRightSide = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
|
|
693
|
+
const shouldReverseLeftOver = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
|
|
694
|
+
const shouldReverseRightOver = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
|
|
678
695
|
|
|
679
696
|
switch (position) {
|
|
680
697
|
case 'top':
|
|
@@ -736,14 +753,14 @@ class Tooltip extends _foundation.default {
|
|
|
736
753
|
break;
|
|
737
754
|
|
|
738
755
|
case 'bottom':
|
|
739
|
-
if (
|
|
756
|
+
if (shouldReverseBottom) {
|
|
740
757
|
position = this._reversePos(position, true);
|
|
741
758
|
}
|
|
742
759
|
|
|
743
760
|
break;
|
|
744
761
|
|
|
745
762
|
case 'bottomLeft':
|
|
746
|
-
if (
|
|
763
|
+
if (shouldReverseBottom) {
|
|
747
764
|
position = this._reversePos(position, true);
|
|
748
765
|
}
|
|
749
766
|
|
|
@@ -754,7 +771,7 @@ class Tooltip extends _foundation.default {
|
|
|
754
771
|
break;
|
|
755
772
|
|
|
756
773
|
case 'bottomRight':
|
|
757
|
-
if (
|
|
774
|
+
if (shouldReverseBottom) {
|
|
758
775
|
position = this._reversePos(position, true);
|
|
759
776
|
}
|
|
760
777
|
|
|
@@ -793,6 +810,50 @@ class Tooltip extends _foundation.default {
|
|
|
793
810
|
|
|
794
811
|
break;
|
|
795
812
|
|
|
813
|
+
case 'leftTopOver':
|
|
814
|
+
if (shouldReverseTopOver) {
|
|
815
|
+
position = this._reversePos(position, true);
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
if (shouldReverseLeftOver) {
|
|
819
|
+
position = this._reversePos(position);
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
break;
|
|
823
|
+
|
|
824
|
+
case 'leftBottomOver':
|
|
825
|
+
if (shouldReverseBottomOver) {
|
|
826
|
+
position = this._reversePos(position, true);
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
if (shouldReverseLeftOver) {
|
|
830
|
+
position = this._reversePos(position);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
break;
|
|
834
|
+
|
|
835
|
+
case 'rightTopOver':
|
|
836
|
+
if (shouldReverseTopOver) {
|
|
837
|
+
position = this._reversePos(position, true);
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
if (shouldReverseRightOver) {
|
|
841
|
+
position = this._reversePos(position);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
break;
|
|
845
|
+
|
|
846
|
+
case 'rightBottomOver':
|
|
847
|
+
if (shouldReverseBottomOver) {
|
|
848
|
+
position = this._reversePos(position, true);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
if (shouldReverseRightOver) {
|
|
852
|
+
position = this._reversePos(position);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
break;
|
|
856
|
+
|
|
796
857
|
default:
|
|
797
858
|
break;
|
|
798
859
|
}
|
|
@@ -128,6 +128,7 @@ export interface Virtualize {
|
|
|
128
128
|
height?: number | string;
|
|
129
129
|
width?: number | string;
|
|
130
130
|
}
|
|
131
|
+
export declare type CheckRelation = 'related' | 'unRelated';
|
|
131
132
|
export interface BasicTreeProps {
|
|
132
133
|
autoExpandParent?: boolean;
|
|
133
134
|
autoExpandWhenDragEnter?: boolean;
|
|
@@ -183,6 +184,7 @@ export interface BasicTreeProps {
|
|
|
183
184
|
value?: BasicValue;
|
|
184
185
|
virtualize?: Virtualize;
|
|
185
186
|
icon?: any;
|
|
187
|
+
checkRelation?: CheckRelation;
|
|
186
188
|
'aria-label'?: string;
|
|
187
189
|
}
|
|
188
190
|
export interface BasicTreeInnerData {
|
|
@@ -193,6 +195,7 @@ export interface BasicTreeInnerData {
|
|
|
193
195
|
selectedKeys: string[];
|
|
194
196
|
checkedKeys: Set<string>;
|
|
195
197
|
halfCheckedKeys: Set<string>;
|
|
198
|
+
realCheckedKeys: Set<string>;
|
|
196
199
|
motionKeys: Set<string>;
|
|
197
200
|
motionType: string;
|
|
198
201
|
expandedKeys: Set<string>;
|
|
@@ -242,7 +245,7 @@ export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTre
|
|
|
242
245
|
getCopyFromState(items: string[] | string): Partial<BasicTreeInnerData>;
|
|
243
246
|
getTreeNodeProps(key: string): BasicTreeNodeProps;
|
|
244
247
|
notifyJsonChange(key: string[] | string, e: any): void;
|
|
245
|
-
notifyMultipleChange(key: string[]
|
|
248
|
+
notifyMultipleChange(key: string[], e: any): void;
|
|
246
249
|
notifyChange(key: string[] | string, e: any): void;
|
|
247
250
|
handleInputChange(sugInput: string): void;
|
|
248
251
|
handleNodeSelect(e: any, treeNode: BasicTreeNodeProps): void;
|
|
@@ -112,6 +112,7 @@ class TreeFoundation extends _foundation.default {
|
|
|
112
112
|
selectedKeys = [],
|
|
113
113
|
checkedKeys = new _set.default([]),
|
|
114
114
|
halfCheckedKeys = new _set.default([]),
|
|
115
|
+
realCheckedKeys = new _set.default([]),
|
|
115
116
|
keyEntities = {},
|
|
116
117
|
filteredKeys = new _set.default([]),
|
|
117
118
|
inputValue = '',
|
|
@@ -121,13 +122,26 @@ class TreeFoundation extends _foundation.default {
|
|
|
121
122
|
disabledKeys = new _set.default([])
|
|
122
123
|
} = this.getStates();
|
|
123
124
|
const {
|
|
124
|
-
treeNodeFilterProp
|
|
125
|
+
treeNodeFilterProp,
|
|
126
|
+
checkRelation
|
|
125
127
|
} = this.getProps();
|
|
126
128
|
const entity = keyEntities[key];
|
|
127
129
|
const notExist = !entity;
|
|
128
130
|
|
|
129
131
|
if (notExist) {
|
|
130
132
|
return null;
|
|
133
|
+
} // if checkRelation is invalid, the checked status of node will be false
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
let realChecked = false;
|
|
137
|
+
let realHalfChecked = false;
|
|
138
|
+
|
|
139
|
+
if (checkRelation === 'related') {
|
|
140
|
+
realChecked = checkedKeys.has(key);
|
|
141
|
+
realHalfChecked = halfCheckedKeys.has(key);
|
|
142
|
+
} else if (checkRelation === 'unRelated') {
|
|
143
|
+
realChecked = realCheckedKeys.has(key);
|
|
144
|
+
realHalfChecked = false;
|
|
131
145
|
}
|
|
132
146
|
|
|
133
147
|
const isSearching = Boolean(inputValue);
|
|
@@ -135,8 +149,8 @@ class TreeFoundation extends _foundation.default {
|
|
|
135
149
|
eventKey: key,
|
|
136
150
|
expanded: isSearching ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
|
|
137
151
|
selected: (0, _includes.default)(selectedKeys).call(selectedKeys, key),
|
|
138
|
-
checked:
|
|
139
|
-
halfChecked:
|
|
152
|
+
checked: realChecked,
|
|
153
|
+
halfChecked: realHalfChecked,
|
|
140
154
|
pos: String(entity ? entity.pos : ''),
|
|
141
155
|
level: entity.level,
|
|
142
156
|
filtered: filteredKeys.has(key),
|
|
@@ -168,10 +182,17 @@ class TreeFoundation extends _foundation.default {
|
|
|
168
182
|
keyEntities
|
|
169
183
|
} = this.getStates();
|
|
170
184
|
const {
|
|
171
|
-
leafOnly
|
|
185
|
+
leafOnly,
|
|
186
|
+
checkRelation
|
|
172
187
|
} = this.getProps();
|
|
173
188
|
let value;
|
|
174
|
-
|
|
189
|
+
let keyList = [];
|
|
190
|
+
|
|
191
|
+
if (checkRelation === 'related') {
|
|
192
|
+
keyList = (0, _treeUtil.normalizeKeyList)(key, keyEntities, leafOnly);
|
|
193
|
+
} else if (checkRelation === 'unRelated') {
|
|
194
|
+
keyList = key;
|
|
195
|
+
}
|
|
175
196
|
|
|
176
197
|
if (this.getProp('onChangeWithObject')) {
|
|
177
198
|
value = (0, _map.default)(keyList).call(keyList, itemKey => keyEntities[itemKey].data);
|
|
@@ -376,30 +397,58 @@ class TreeFoundation extends _foundation.default {
|
|
|
376
397
|
|
|
377
398
|
handleMultipleSelect(e, treeNode) {
|
|
378
399
|
const {
|
|
379
|
-
disableStrictly
|
|
380
|
-
|
|
400
|
+
disableStrictly,
|
|
401
|
+
checkRelation
|
|
402
|
+
} = this.getProps();
|
|
403
|
+
const {
|
|
404
|
+
realCheckedKeys
|
|
405
|
+
} = this.getStates(); // eventKey: The key value of the currently clicked node
|
|
381
406
|
|
|
382
407
|
const {
|
|
383
408
|
checked,
|
|
384
409
|
eventKey,
|
|
385
410
|
data
|
|
386
|
-
} = treeNode;
|
|
411
|
+
} = treeNode;
|
|
387
412
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
413
|
+
if (checkRelation === 'related') {
|
|
414
|
+
// Find the checked state of the current node
|
|
415
|
+
const targetStatus = disableStrictly ? this.calcChekcedStatus(!checked, eventKey) : !checked;
|
|
416
|
+
const {
|
|
417
|
+
checkedKeys,
|
|
418
|
+
halfCheckedKeys
|
|
419
|
+
} = disableStrictly ? this.calcNonDisabedCheckedKeys(eventKey, targetStatus) : this.calcCheckedKeys(eventKey, targetStatus);
|
|
393
420
|
|
|
394
|
-
|
|
421
|
+
this._adapter.notifySelect(eventKey, targetStatus, data);
|
|
395
422
|
|
|
396
|
-
|
|
423
|
+
this.notifyChange([...checkedKeys], e);
|
|
397
424
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
425
|
+
if (!this._isControlledComponent()) {
|
|
426
|
+
this._adapter.updateState({
|
|
427
|
+
checkedKeys,
|
|
428
|
+
halfCheckedKeys
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
} else if (checkRelation === 'unRelated') {
|
|
432
|
+
const newRealCheckedKeys = new _set.default(realCheckedKeys);
|
|
433
|
+
let targetStatus;
|
|
434
|
+
|
|
435
|
+
if (realCheckedKeys.has(eventKey)) {
|
|
436
|
+
newRealCheckedKeys.delete(eventKey);
|
|
437
|
+
targetStatus = false;
|
|
438
|
+
} else {
|
|
439
|
+
newRealCheckedKeys.add(eventKey);
|
|
440
|
+
targetStatus = true;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
this._adapter.notifySelect(eventKey, targetStatus, data);
|
|
444
|
+
|
|
445
|
+
this.notifyChange([...newRealCheckedKeys], e);
|
|
446
|
+
|
|
447
|
+
if (!this._isControlledComponent()) {
|
|
448
|
+
this._adapter.updateState({
|
|
449
|
+
realCheckedKeys: newRealCheckedKeys
|
|
450
|
+
});
|
|
451
|
+
}
|
|
403
452
|
}
|
|
404
453
|
}
|
|
405
454
|
|
|
@@ -27,7 +27,7 @@ export interface BasicOnChange {
|
|
|
27
27
|
(node: BasicTreeNodeData[] | BasicTreeNodeData, e: any): void;
|
|
28
28
|
(value: BasicTreeNodeData['value'] | Array<BasicTreeNodeData['value']>, node: BasicTreeNodeData[] | BasicTreeNodeData, e: any): void;
|
|
29
29
|
}
|
|
30
|
-
export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize' | 'renderFullLabel' | 'renderLabel' | 'autoExpandParent' | 'className' | 'defaultExpandAll' | 'defaultExpandedKeys' | 'defaultValue' | 'disabled' | 'emptyContent' | 'expandAction' | 'expandedKeys' | 'filterTreeNode' | 'labelEllipsis' | 'leafOnly' | 'multiple' | 'onChangeWithObject' | 'showClear' | 'showFilteredOnly' | 'style' | 'treeData' | 'treeNodeFilterProp' | 'value' | 'onExpand' | 'onSearch' | 'expandAll' | 'disableStrictly' | 'aria-label'> {
|
|
30
|
+
export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize' | 'renderFullLabel' | 'renderLabel' | 'autoExpandParent' | 'className' | 'defaultExpandAll' | 'defaultExpandedKeys' | 'defaultValue' | 'disabled' | 'emptyContent' | 'expandAction' | 'expandedKeys' | 'filterTreeNode' | 'labelEllipsis' | 'leafOnly' | 'multiple' | 'onChangeWithObject' | 'showClear' | 'showFilteredOnly' | 'style' | 'treeData' | 'treeNodeFilterProp' | 'value' | 'onExpand' | 'onSearch' | 'expandAll' | 'disableStrictly' | 'aria-label' | 'checkRelation'> {
|
|
31
31
|
motion?: Motion;
|
|
32
32
|
mouseEnterDelay?: number;
|
|
33
33
|
mouseLeaveDelay?: number;
|
|
@@ -68,7 +68,7 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize'
|
|
|
68
68
|
onVisibleChange?: (isVisible: boolean) => void;
|
|
69
69
|
onLoad?: (keys: Set<string>, data: BasicTreeNodeData) => void;
|
|
70
70
|
}
|
|
71
|
-
export interface BasicTreeSelectInnerData extends Pick<BasicTreeInnerData, 'keyEntities' | 'treeData' | 'flattenNodes' | 'selectedKeys' | 'checkedKeys' | 'halfCheckedKeys' | 'motionKeys' | 'motionType' | 'expandedKeys' | 'filteredKeys' | 'filteredExpandedKeys' | 'filteredShownKeys' | 'cachedKeyValuePairs' | 'inputValue' | 'disabledKeys' | 'loadedKeys' | 'loadingKeys'> {
|
|
71
|
+
export interface BasicTreeSelectInnerData extends Pick<BasicTreeInnerData, 'keyEntities' | 'treeData' | 'flattenNodes' | 'selectedKeys' | 'checkedKeys' | 'halfCheckedKeys' | 'motionKeys' | 'motionType' | 'expandedKeys' | 'filteredKeys' | 'filteredExpandedKeys' | 'filteredShownKeys' | 'cachedKeyValuePairs' | 'inputValue' | 'disabledKeys' | 'loadedKeys' | 'loadingKeys' | 'realCheckedKeys'> {
|
|
72
72
|
inputTriggerFocus: boolean;
|
|
73
73
|
isOpen: boolean;
|
|
74
74
|
isInput: boolean;
|
|
@@ -82,7 +82,7 @@ export interface TreeSelectAdapter<P = Record<string, any>, S = Record<string, a
|
|
|
82
82
|
registerClickOutsideHandler: (cb: (e: any) => void) => void;
|
|
83
83
|
unregisterClickOutsideHandler: () => void;
|
|
84
84
|
rePositionDropdown: () => void;
|
|
85
|
-
updateState: (states:
|
|
85
|
+
updateState: (states: Partial<BasicTreeSelectInnerData>) => void;
|
|
86
86
|
notifySelect: (selectedKeys: string, selected: boolean, selectedNode: BasicTreeNodeData) => void;
|
|
87
87
|
notifySearch: (input: string) => void;
|
|
88
88
|
cacheFlattenNodes: (bool: boolean) => void;
|
|
@@ -158,6 +158,7 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
158
158
|
selectedKeys = [],
|
|
159
159
|
checkedKeys = new _set.default([]),
|
|
160
160
|
halfCheckedKeys = new _set.default([]),
|
|
161
|
+
realCheckedKeys = new _set.default([]),
|
|
161
162
|
keyEntities = {},
|
|
162
163
|
filteredKeys = new _set.default([]),
|
|
163
164
|
inputValue = '',
|
|
@@ -167,13 +168,26 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
167
168
|
disabledKeys = new _set.default([])
|
|
168
169
|
} = this.getStates();
|
|
169
170
|
const {
|
|
170
|
-
treeNodeFilterProp
|
|
171
|
+
treeNodeFilterProp,
|
|
172
|
+
checkRelation
|
|
171
173
|
} = this.getProps();
|
|
172
174
|
const entity = keyEntities[key];
|
|
173
175
|
const notExist = !entity;
|
|
174
176
|
|
|
175
177
|
if (notExist) {
|
|
176
178
|
return null;
|
|
179
|
+
} // if checkRelation is invalid, the checked status of node will be false
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
let realChecked = false;
|
|
183
|
+
let realHalfChecked = false;
|
|
184
|
+
|
|
185
|
+
if (checkRelation === 'related') {
|
|
186
|
+
realChecked = checkedKeys.has(key);
|
|
187
|
+
realHalfChecked = halfCheckedKeys.has(key);
|
|
188
|
+
} else if (checkRelation === 'unRelated') {
|
|
189
|
+
realChecked = realCheckedKeys.has(key);
|
|
190
|
+
realHalfChecked = false;
|
|
177
191
|
}
|
|
178
192
|
|
|
179
193
|
const isSearching = Boolean(inputValue);
|
|
@@ -181,8 +195,8 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
181
195
|
eventKey: key,
|
|
182
196
|
expanded: isSearching ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
|
|
183
197
|
selected: (0, _includes.default)(selectedKeys).call(selectedKeys, key),
|
|
184
|
-
checked:
|
|
185
|
-
halfChecked:
|
|
198
|
+
checked: realChecked,
|
|
199
|
+
halfChecked: realHalfChecked,
|
|
186
200
|
pos: String(entity ? entity.pos : ''),
|
|
187
201
|
level: entity.level,
|
|
188
202
|
filtered: filteredKeys.has(key),
|
|
@@ -248,9 +262,17 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
248
262
|
keyEntities
|
|
249
263
|
} = this.getStates();
|
|
250
264
|
const {
|
|
251
|
-
leafOnly
|
|
265
|
+
leafOnly,
|
|
266
|
+
checkRelation
|
|
252
267
|
} = this.getProps();
|
|
253
|
-
|
|
268
|
+
let keyList = [];
|
|
269
|
+
|
|
270
|
+
if (checkRelation === 'related') {
|
|
271
|
+
keyList = (0, _treeUtil.normalizeKeyList)(key, keyEntities, leafOnly);
|
|
272
|
+
} else if (checkRelation === 'unRelated') {
|
|
273
|
+
keyList = key;
|
|
274
|
+
}
|
|
275
|
+
|
|
254
276
|
const nodes = (0, _map.default)(keyList).call(keyList, i => keyEntities[i].data);
|
|
255
277
|
|
|
256
278
|
if (this.getProp('onChangeWithObject')) {
|
|
@@ -376,7 +398,8 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
376
398
|
this._adapter.updateState({
|
|
377
399
|
selectedKeys: [],
|
|
378
400
|
checkedKeys: new _set.default(),
|
|
379
|
-
halfCheckedKeys: new _set.default()
|
|
401
|
+
halfCheckedKeys: new _set.default(),
|
|
402
|
+
realCheckedKeys: new _set.default([])
|
|
380
403
|
});
|
|
381
404
|
} // When triggerSearch, clicking the clear button will trigger to clear Input
|
|
382
405
|
|
|
@@ -404,11 +427,13 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
404
427
|
|
|
405
428
|
removeTag(eventKey) {
|
|
406
429
|
const {
|
|
407
|
-
disableStrictly
|
|
430
|
+
disableStrictly,
|
|
431
|
+
checkRelation
|
|
408
432
|
} = this.getProps();
|
|
409
433
|
const {
|
|
410
434
|
keyEntities,
|
|
411
|
-
disabledKeys
|
|
435
|
+
disabledKeys,
|
|
436
|
+
realCheckedKeys
|
|
412
437
|
} = this.getStates();
|
|
413
438
|
const item = keyEntities[eventKey].data;
|
|
414
439
|
|
|
@@ -416,20 +441,35 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
416
441
|
return;
|
|
417
442
|
}
|
|
418
443
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
} = this.calcCheckedKeys(eventKey, false);
|
|
444
|
+
if (checkRelation === 'unRelated') {
|
|
445
|
+
const newRealCheckedKeys = new _set.default(realCheckedKeys);
|
|
446
|
+
newRealCheckedKeys.delete(eventKey);
|
|
423
447
|
|
|
424
|
-
|
|
448
|
+
this._notifyChange([...newRealCheckedKeys], null);
|
|
425
449
|
|
|
426
|
-
|
|
427
|
-
|
|
450
|
+
if (!this._isControlledComponent()) {
|
|
451
|
+
this._adapter.updateState({
|
|
452
|
+
realCheckedKeys: newRealCheckedKeys
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
this._adapter.rePositionDropdown();
|
|
456
|
+
}
|
|
457
|
+
} else if (checkRelation === 'related') {
|
|
458
|
+
const {
|
|
428
459
|
checkedKeys,
|
|
429
460
|
halfCheckedKeys
|
|
430
|
-
});
|
|
461
|
+
} = this.calcCheckedKeys(eventKey, false);
|
|
431
462
|
|
|
432
|
-
this.
|
|
463
|
+
this._notifyChange([...checkedKeys], null);
|
|
464
|
+
|
|
465
|
+
if (!this._isControlledComponent()) {
|
|
466
|
+
this._adapter.updateState({
|
|
467
|
+
checkedKeys,
|
|
468
|
+
halfCheckedKeys
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
this._adapter.rePositionDropdown();
|
|
472
|
+
}
|
|
433
473
|
}
|
|
434
474
|
|
|
435
475
|
this._adapter.notifySelect(eventKey, false, item); // reposition dropdown when selected values change
|
|
@@ -576,39 +616,67 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
576
616
|
handleMultipleSelect(e, treeNode) {
|
|
577
617
|
const {
|
|
578
618
|
searchPosition,
|
|
579
|
-
disableStrictly
|
|
619
|
+
disableStrictly,
|
|
620
|
+
checkRelation
|
|
580
621
|
} = this.getProps();
|
|
581
622
|
const {
|
|
582
|
-
inputValue
|
|
623
|
+
inputValue,
|
|
624
|
+
realCheckedKeys
|
|
583
625
|
} = this.getStates();
|
|
584
626
|
const {
|
|
585
627
|
checked,
|
|
586
628
|
eventKey,
|
|
587
629
|
data
|
|
588
630
|
} = treeNode;
|
|
589
|
-
const targetStatus = disableStrictly ? this.calcChekcedStatus(!checked, eventKey) : !checked;
|
|
590
|
-
const {
|
|
591
|
-
checkedKeys,
|
|
592
|
-
halfCheckedKeys
|
|
593
|
-
} = disableStrictly ? this.calcNonDisabedCheckedKeys(eventKey, targetStatus) : this.calcCheckedKeys(eventKey, targetStatus);
|
|
594
631
|
|
|
595
|
-
|
|
632
|
+
if (checkRelation === 'related') {
|
|
633
|
+
const targetStatus = disableStrictly ? this.calcChekcedStatus(!checked, eventKey) : !checked;
|
|
634
|
+
const {
|
|
635
|
+
checkedKeys,
|
|
636
|
+
halfCheckedKeys
|
|
637
|
+
} = disableStrictly ? this.calcNonDisabedCheckedKeys(eventKey, targetStatus) : this.calcCheckedKeys(eventKey, targetStatus);
|
|
596
638
|
|
|
597
|
-
|
|
639
|
+
this._adapter.notifySelect(eventKey, targetStatus, data);
|
|
598
640
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
641
|
+
this._notifyChange([...checkedKeys], e);
|
|
642
|
+
|
|
643
|
+
if (!this._isControlledComponent()) {
|
|
644
|
+
this._adapter.updateState({
|
|
645
|
+
checkedKeys,
|
|
646
|
+
halfCheckedKeys
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
this._adapter.rePositionDropdown();
|
|
650
|
+
}
|
|
651
|
+
} else if (checkRelation === 'unRelated') {
|
|
652
|
+
const newRealCheckedKeys = new _set.default(realCheckedKeys);
|
|
653
|
+
let targetStatus;
|
|
654
|
+
|
|
655
|
+
if (realCheckedKeys.has(eventKey)) {
|
|
656
|
+
newRealCheckedKeys.delete(eventKey);
|
|
657
|
+
targetStatus = false;
|
|
658
|
+
} else {
|
|
659
|
+
newRealCheckedKeys.add(eventKey);
|
|
660
|
+
targetStatus = true;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
this._adapter.notifySelect(eventKey, targetStatus, data);
|
|
664
|
+
|
|
665
|
+
this._notifyChange([...newRealCheckedKeys], e);
|
|
666
|
+
|
|
667
|
+
if (!this._isControlledComponent()) {
|
|
668
|
+
this._adapter.updateState({
|
|
669
|
+
realCheckedKeys: newRealCheckedKeys
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
this._adapter.rePositionDropdown();
|
|
673
|
+
}
|
|
603
674
|
}
|
|
604
675
|
|
|
605
|
-
if (
|
|
676
|
+
if (searchPosition === _constants.strings.SEARCH_POSITION_TRIGGER && inputValue !== '') {
|
|
606
677
|
this._adapter.updateState({
|
|
607
|
-
|
|
608
|
-
halfCheckedKeys
|
|
678
|
+
inputValue: ''
|
|
609
679
|
});
|
|
610
|
-
|
|
611
|
-
this._adapter.rePositionDropdown();
|
|
612
680
|
}
|
|
613
681
|
}
|
|
614
682
|
|
|
@@ -53,11 +53,10 @@
|
|
|
53
53
|
}
|
|
54
54
|
.semi-upload[x-prompt-pos=left] .semi-upload-add {
|
|
55
55
|
display: inline-flex;
|
|
56
|
-
order: 2;
|
|
57
56
|
}
|
|
58
57
|
.semi-upload[x-prompt-pos=left] .semi-upload-prompt {
|
|
59
58
|
display: inline-flex;
|
|
60
|
-
order: 1;
|
|
59
|
+
order: -1;
|
|
61
60
|
}
|
|
62
61
|
.semi-upload[x-prompt-pos=left] .semi-upload-file-list {
|
|
63
62
|
order: 2;
|
|
@@ -237,15 +236,9 @@
|
|
|
237
236
|
.semi-upload-picture[x-prompt-pos=bottom] .semi-upload-prompt {
|
|
238
237
|
order: 1;
|
|
239
238
|
}
|
|
240
|
-
.semi-upload-picture[x-prompt-pos=bottom] .semi-upload-add {
|
|
241
|
-
order: 0;
|
|
242
|
-
}
|
|
243
239
|
.semi-upload-picture[x-prompt-pos=right] .semi-upload-prompt {
|
|
244
240
|
order: 1;
|
|
245
241
|
}
|
|
246
|
-
.semi-upload-picture[x-prompt-pos=right] .semi-upload-add {
|
|
247
|
-
order: 0;
|
|
248
|
-
}
|
|
249
242
|
.semi-upload-picture-add {
|
|
250
243
|
background-color: var(--semi-color-fill-0);
|
|
251
244
|
height: 96px;
|
|
@@ -257,7 +250,6 @@
|
|
|
257
250
|
border: 2px dashed var(--semi-color-border);
|
|
258
251
|
color: var(--semi-color-tertiary);
|
|
259
252
|
border-radius: var(--semi-border-radius-small);
|
|
260
|
-
order: 2;
|
|
261
253
|
cursor: pointer;
|
|
262
254
|
}
|
|
263
255
|
.semi-upload-picture-add:hover {
|
|
@@ -297,35 +289,32 @@
|
|
|
297
289
|
border-radius: var(--semi-border-radius-small);
|
|
298
290
|
}
|
|
299
291
|
.semi-upload-picture-file-card-close {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
background-color: var(--semi-color-overlay-bg);
|
|
292
|
+
visibility: hidden;
|
|
293
|
+
display: inline-flex;
|
|
303
294
|
position: absolute;
|
|
304
295
|
top: 8px;
|
|
305
296
|
right: 8px;
|
|
306
|
-
display: flex;
|
|
307
|
-
justify-content: center;
|
|
308
|
-
align-items: center;
|
|
309
|
-
display: none;
|
|
310
297
|
border-radius: var(--semi-border-radius-circle);
|
|
311
|
-
color: white;
|
|
312
298
|
cursor: pointer;
|
|
313
299
|
transition: all 0s;
|
|
314
300
|
}
|
|
315
|
-
.semi-upload-picture-file-card
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
.semi-upload-picture-file-card:hover .semi-upload-picture-file-card-replace {
|
|
319
|
-
visibility: visible;
|
|
301
|
+
.semi-upload-picture-file-card-icon-close {
|
|
302
|
+
font-size: 16px;
|
|
303
|
+
color: var(--semi-color-white);
|
|
320
304
|
}
|
|
321
|
-
.semi-upload-picture-file-card
|
|
305
|
+
.semi-upload-picture-file-card::before {
|
|
306
|
+
visibility: hidden;
|
|
307
|
+
background-color: var(--semi-color-overlay-bg);
|
|
308
|
+
content: "";
|
|
322
309
|
position: absolute;
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
310
|
+
left: 0;
|
|
311
|
+
right: 0;
|
|
312
|
+
top: 0;
|
|
313
|
+
bottom: 0;
|
|
326
314
|
}
|
|
327
315
|
.semi-upload-picture-file-card-retry {
|
|
328
|
-
|
|
316
|
+
visibility: hidden;
|
|
317
|
+
background-color: var(--semi-color-white);
|
|
329
318
|
width: 24px;
|
|
330
319
|
height: 24px;
|
|
331
320
|
position: absolute;
|
|
@@ -353,6 +342,15 @@
|
|
|
353
342
|
color: var(--semi-color-white);
|
|
354
343
|
transform: translate3D(-50%, -50%, 0);
|
|
355
344
|
}
|
|
345
|
+
.semi-upload-picture-file-card-preview {
|
|
346
|
+
visibility: hidden;
|
|
347
|
+
display: inline-flex;
|
|
348
|
+
position: absolute;
|
|
349
|
+
cursor: pointer;
|
|
350
|
+
top: 50%;
|
|
351
|
+
left: 50%;
|
|
352
|
+
transform: translate3D(-50%, -50%, 0);
|
|
353
|
+
}
|
|
356
354
|
.semi-upload-picture-file-card-pic-info {
|
|
357
355
|
display: inline-flex;
|
|
358
356
|
box-sizing: border-box;
|
|
@@ -384,6 +382,30 @@
|
|
|
384
382
|
.semi-upload-picture-file-card-error {
|
|
385
383
|
outline: 1px solid var(--semi-color-danger);
|
|
386
384
|
}
|
|
385
|
+
.semi-upload-picture-file-card:hover::before {
|
|
386
|
+
visibility: visible;
|
|
387
|
+
}
|
|
388
|
+
.semi-upload-picture-file-card:hover .semi-upload-picture-file-card-close {
|
|
389
|
+
visibility: visible;
|
|
390
|
+
}
|
|
391
|
+
.semi-upload-picture-file-card:hover .semi-upload-picture-file-card-replace {
|
|
392
|
+
visibility: visible;
|
|
393
|
+
}
|
|
394
|
+
.semi-upload-picture-file-card:hover .semi-upload-picture-file-card-retry {
|
|
395
|
+
visibility: visible;
|
|
396
|
+
}
|
|
397
|
+
.semi-upload-picture-file-card:hover .semi-upload-picture-file-card-preview {
|
|
398
|
+
visibility: visible;
|
|
399
|
+
}
|
|
400
|
+
.semi-upload-picture-file-card-uploading::before {
|
|
401
|
+
visibility: visible;
|
|
402
|
+
}
|
|
403
|
+
.semi-upload-picture-file-card .semi-progress-circle {
|
|
404
|
+
position: absolute;
|
|
405
|
+
top: 50%;
|
|
406
|
+
left: 50%;
|
|
407
|
+
transform: translate(-50%, -50%);
|
|
408
|
+
}
|
|
387
409
|
.semi-upload-drag-area {
|
|
388
410
|
border-radius: var(--semi-border-radius-small);
|
|
389
411
|
border: 2px dashed var(--semi-color-border);
|