@douyinfe/semi-foundation 2.4.0 → 2.5.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/cascader/cascader.scss +1 -0
- package/cascader/variables.scss +4 -2
- package/datePicker/foundation.ts +12 -0
- package/lib/cjs/autoComplete/constants.d.ts +1 -1
- package/lib/cjs/cascader/cascader.css +1 -0
- package/lib/cjs/cascader/cascader.scss +1 -0
- package/lib/cjs/cascader/variables.scss +4 -2
- package/lib/cjs/datePicker/foundation.d.ts +5 -0
- package/lib/cjs/datePicker/foundation.js +18 -0
- package/lib/cjs/dropdown/constants.d.ts +1 -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/utils.js +4 -1
- package/lib/cjs/tagInput/tagInput.css +1 -0
- package/lib/cjs/tagInput/tagInput.scss +3 -2
- package/lib/cjs/tagInput/variables.scss +8 -2
- 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/cascader/cascader.css +1 -0
- package/lib/es/cascader/cascader.scss +1 -0
- package/lib/es/cascader/variables.scss +4 -2
- package/lib/es/datePicker/foundation.d.ts +5 -0
- package/lib/es/datePicker/foundation.js +18 -0
- package/lib/es/dropdown/constants.d.ts +1 -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/utils.js +4 -1
- package/lib/es/tagInput/tagInput.css +1 -0
- package/lib/es/tagInput/tagInput.scss +3 -2
- package/lib/es/tagInput/variables.scss +8 -2
- 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/utils.ts +3 -1
- package/tagInput/tagInput.scss +3 -2
- package/tagInput/variables.scss +8 -2
- 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
|
@@ -530,6 +530,19 @@ export default class Tooltip extends BaseFoundation {
|
|
|
530
530
|
translateX = -1;
|
|
531
531
|
break;
|
|
532
532
|
|
|
533
|
+
case 'leftBottomOver':
|
|
534
|
+
left = triggerRect.left;
|
|
535
|
+
top = triggerRect.bottom;
|
|
536
|
+
translateY = -1;
|
|
537
|
+
break;
|
|
538
|
+
|
|
539
|
+
case 'rightBottomOver':
|
|
540
|
+
left = triggerRect.right;
|
|
541
|
+
top = triggerRect.bottom;
|
|
542
|
+
translateX = -1;
|
|
543
|
+
translateY = -1;
|
|
544
|
+
break;
|
|
545
|
+
|
|
533
546
|
default:
|
|
534
547
|
break;
|
|
535
548
|
}
|
|
@@ -653,12 +666,16 @@ export default class Tooltip extends BaseFoundation {
|
|
|
653
666
|
|
|
654
667
|
const shouldReverseTop = clientTop < wrapperRect.height + spacing && restClientBottom > wrapperRect.height + spacing;
|
|
655
668
|
const shouldReverseLeft = clientLeft < wrapperRect.width + spacing && restClientRight > wrapperRect.width + spacing;
|
|
656
|
-
const
|
|
669
|
+
const shouldReverseBottom = restClientBottom < wrapperRect.height + spacing && clientTop > wrapperRect.height + spacing;
|
|
657
670
|
const shouldReverseRight = restClientRight < wrapperRect.width + spacing && clientLeft > wrapperRect.width + spacing;
|
|
671
|
+
const shouldReverseTopOver = restClientTop < wrapperRect.height + spacing && clientBottom > wrapperRect.height + spacing;
|
|
672
|
+
const shouldReverseBottomOver = clientBottom < wrapperRect.height + spacing && restClientTop > wrapperRect.height + spacing;
|
|
658
673
|
const shouldReverseTopSide = restClientTop < wrapperRect.height && clientBottom > wrapperRect.height;
|
|
659
674
|
const shouldReverseBottomSide = clientBottom < wrapperRect.height && restClientTop > wrapperRect.height;
|
|
660
675
|
const shouldReverseLeftSide = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
|
|
661
676
|
const shouldReverseRightSide = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
|
|
677
|
+
const shouldReverseLeftOver = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
|
|
678
|
+
const shouldReverseRightOver = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
|
|
662
679
|
|
|
663
680
|
switch (position) {
|
|
664
681
|
case 'top':
|
|
@@ -720,14 +737,14 @@ export default class Tooltip extends BaseFoundation {
|
|
|
720
737
|
break;
|
|
721
738
|
|
|
722
739
|
case 'bottom':
|
|
723
|
-
if (
|
|
740
|
+
if (shouldReverseBottom) {
|
|
724
741
|
position = this._reversePos(position, true);
|
|
725
742
|
}
|
|
726
743
|
|
|
727
744
|
break;
|
|
728
745
|
|
|
729
746
|
case 'bottomLeft':
|
|
730
|
-
if (
|
|
747
|
+
if (shouldReverseBottom) {
|
|
731
748
|
position = this._reversePos(position, true);
|
|
732
749
|
}
|
|
733
750
|
|
|
@@ -738,7 +755,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
738
755
|
break;
|
|
739
756
|
|
|
740
757
|
case 'bottomRight':
|
|
741
|
-
if (
|
|
758
|
+
if (shouldReverseBottom) {
|
|
742
759
|
position = this._reversePos(position, true);
|
|
743
760
|
}
|
|
744
761
|
|
|
@@ -777,6 +794,50 @@ export default class Tooltip extends BaseFoundation {
|
|
|
777
794
|
|
|
778
795
|
break;
|
|
779
796
|
|
|
797
|
+
case 'leftTopOver':
|
|
798
|
+
if (shouldReverseTopOver) {
|
|
799
|
+
position = this._reversePos(position, true);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
if (shouldReverseLeftOver) {
|
|
803
|
+
position = this._reversePos(position);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
break;
|
|
807
|
+
|
|
808
|
+
case 'leftBottomOver':
|
|
809
|
+
if (shouldReverseBottomOver) {
|
|
810
|
+
position = this._reversePos(position, true);
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
if (shouldReverseLeftOver) {
|
|
814
|
+
position = this._reversePos(position);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
break;
|
|
818
|
+
|
|
819
|
+
case 'rightTopOver':
|
|
820
|
+
if (shouldReverseTopOver) {
|
|
821
|
+
position = this._reversePos(position, true);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
if (shouldReverseRightOver) {
|
|
825
|
+
position = this._reversePos(position);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
break;
|
|
829
|
+
|
|
830
|
+
case 'rightBottomOver':
|
|
831
|
+
if (shouldReverseBottomOver) {
|
|
832
|
+
position = this._reversePos(position, true);
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
if (shouldReverseRightOver) {
|
|
836
|
+
position = this._reversePos(position);
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
break;
|
|
840
|
+
|
|
780
841
|
default:
|
|
781
842
|
break;
|
|
782
843
|
}
|
|
@@ -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;
|
|
@@ -82,6 +82,7 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
82
82
|
selectedKeys = [],
|
|
83
83
|
checkedKeys = new _Set([]),
|
|
84
84
|
halfCheckedKeys = new _Set([]),
|
|
85
|
+
realCheckedKeys = new _Set([]),
|
|
85
86
|
keyEntities = {},
|
|
86
87
|
filteredKeys = new _Set([]),
|
|
87
88
|
inputValue = '',
|
|
@@ -91,13 +92,26 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
91
92
|
disabledKeys = new _Set([])
|
|
92
93
|
} = this.getStates();
|
|
93
94
|
const {
|
|
94
|
-
treeNodeFilterProp
|
|
95
|
+
treeNodeFilterProp,
|
|
96
|
+
checkRelation
|
|
95
97
|
} = this.getProps();
|
|
96
98
|
const entity = keyEntities[key];
|
|
97
99
|
const notExist = !entity;
|
|
98
100
|
|
|
99
101
|
if (notExist) {
|
|
100
102
|
return null;
|
|
103
|
+
} // if checkRelation is invalid, the checked status of node will be false
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
let realChecked = false;
|
|
107
|
+
let realHalfChecked = false;
|
|
108
|
+
|
|
109
|
+
if (checkRelation === 'related') {
|
|
110
|
+
realChecked = checkedKeys.has(key);
|
|
111
|
+
realHalfChecked = halfCheckedKeys.has(key);
|
|
112
|
+
} else if (checkRelation === 'unRelated') {
|
|
113
|
+
realChecked = realCheckedKeys.has(key);
|
|
114
|
+
realHalfChecked = false;
|
|
101
115
|
}
|
|
102
116
|
|
|
103
117
|
const isSearching = Boolean(inputValue);
|
|
@@ -105,8 +119,8 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
105
119
|
eventKey: key,
|
|
106
120
|
expanded: isSearching ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
|
|
107
121
|
selected: _includesInstanceProperty(selectedKeys).call(selectedKeys, key),
|
|
108
|
-
checked:
|
|
109
|
-
halfChecked:
|
|
122
|
+
checked: realChecked,
|
|
123
|
+
halfChecked: realHalfChecked,
|
|
110
124
|
pos: String(entity ? entity.pos : ''),
|
|
111
125
|
level: entity.level,
|
|
112
126
|
filtered: filteredKeys.has(key),
|
|
@@ -140,10 +154,17 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
140
154
|
keyEntities
|
|
141
155
|
} = this.getStates();
|
|
142
156
|
const {
|
|
143
|
-
leafOnly
|
|
157
|
+
leafOnly,
|
|
158
|
+
checkRelation
|
|
144
159
|
} = this.getProps();
|
|
145
160
|
let value;
|
|
146
|
-
|
|
161
|
+
let keyList = [];
|
|
162
|
+
|
|
163
|
+
if (checkRelation === 'related') {
|
|
164
|
+
keyList = normalizeKeyList(key, keyEntities, leafOnly);
|
|
165
|
+
} else if (checkRelation === 'unRelated') {
|
|
166
|
+
keyList = key;
|
|
167
|
+
}
|
|
147
168
|
|
|
148
169
|
if (this.getProp('onChangeWithObject')) {
|
|
149
170
|
value = _mapInstanceProperty(keyList).call(keyList, itemKey => keyEntities[itemKey].data);
|
|
@@ -358,30 +379,58 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
358
379
|
|
|
359
380
|
handleMultipleSelect(e, treeNode) {
|
|
360
381
|
const {
|
|
361
|
-
disableStrictly
|
|
362
|
-
|
|
382
|
+
disableStrictly,
|
|
383
|
+
checkRelation
|
|
384
|
+
} = this.getProps();
|
|
385
|
+
const {
|
|
386
|
+
realCheckedKeys
|
|
387
|
+
} = this.getStates(); // eventKey: The key value of the currently clicked node
|
|
363
388
|
|
|
364
389
|
const {
|
|
365
390
|
checked,
|
|
366
391
|
eventKey,
|
|
367
392
|
data
|
|
368
|
-
} = treeNode;
|
|
393
|
+
} = treeNode;
|
|
369
394
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
395
|
+
if (checkRelation === 'related') {
|
|
396
|
+
// Find the checked state of the current node
|
|
397
|
+
const targetStatus = disableStrictly ? this.calcChekcedStatus(!checked, eventKey) : !checked;
|
|
398
|
+
const {
|
|
399
|
+
checkedKeys,
|
|
400
|
+
halfCheckedKeys
|
|
401
|
+
} = disableStrictly ? this.calcNonDisabedCheckedKeys(eventKey, targetStatus) : this.calcCheckedKeys(eventKey, targetStatus);
|
|
375
402
|
|
|
376
|
-
|
|
403
|
+
this._adapter.notifySelect(eventKey, targetStatus, data);
|
|
377
404
|
|
|
378
|
-
|
|
405
|
+
this.notifyChange([...checkedKeys], e);
|
|
379
406
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
407
|
+
if (!this._isControlledComponent()) {
|
|
408
|
+
this._adapter.updateState({
|
|
409
|
+
checkedKeys,
|
|
410
|
+
halfCheckedKeys
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
} else if (checkRelation === 'unRelated') {
|
|
414
|
+
const newRealCheckedKeys = new _Set(realCheckedKeys);
|
|
415
|
+
let targetStatus;
|
|
416
|
+
|
|
417
|
+
if (realCheckedKeys.has(eventKey)) {
|
|
418
|
+
newRealCheckedKeys.delete(eventKey);
|
|
419
|
+
targetStatus = false;
|
|
420
|
+
} else {
|
|
421
|
+
newRealCheckedKeys.add(eventKey);
|
|
422
|
+
targetStatus = true;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
this._adapter.notifySelect(eventKey, targetStatus, data);
|
|
426
|
+
|
|
427
|
+
this.notifyChange([...newRealCheckedKeys], e);
|
|
428
|
+
|
|
429
|
+
if (!this._isControlledComponent()) {
|
|
430
|
+
this._adapter.updateState({
|
|
431
|
+
realCheckedKeys: newRealCheckedKeys
|
|
432
|
+
});
|
|
433
|
+
}
|
|
385
434
|
}
|
|
386
435
|
}
|
|
387
436
|
|
|
@@ -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;
|
|
@@ -124,6 +124,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
124
124
|
selectedKeys = [],
|
|
125
125
|
checkedKeys = new _Set([]),
|
|
126
126
|
halfCheckedKeys = new _Set([]),
|
|
127
|
+
realCheckedKeys = new _Set([]),
|
|
127
128
|
keyEntities = {},
|
|
128
129
|
filteredKeys = new _Set([]),
|
|
129
130
|
inputValue = '',
|
|
@@ -133,13 +134,26 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
133
134
|
disabledKeys = new _Set([])
|
|
134
135
|
} = this.getStates();
|
|
135
136
|
const {
|
|
136
|
-
treeNodeFilterProp
|
|
137
|
+
treeNodeFilterProp,
|
|
138
|
+
checkRelation
|
|
137
139
|
} = this.getProps();
|
|
138
140
|
const entity = keyEntities[key];
|
|
139
141
|
const notExist = !entity;
|
|
140
142
|
|
|
141
143
|
if (notExist) {
|
|
142
144
|
return null;
|
|
145
|
+
} // if checkRelation is invalid, the checked status of node will be false
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
let realChecked = false;
|
|
149
|
+
let realHalfChecked = false;
|
|
150
|
+
|
|
151
|
+
if (checkRelation === 'related') {
|
|
152
|
+
realChecked = checkedKeys.has(key);
|
|
153
|
+
realHalfChecked = halfCheckedKeys.has(key);
|
|
154
|
+
} else if (checkRelation === 'unRelated') {
|
|
155
|
+
realChecked = realCheckedKeys.has(key);
|
|
156
|
+
realHalfChecked = false;
|
|
143
157
|
}
|
|
144
158
|
|
|
145
159
|
const isSearching = Boolean(inputValue);
|
|
@@ -147,8 +161,8 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
147
161
|
eventKey: key,
|
|
148
162
|
expanded: isSearching ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
|
|
149
163
|
selected: _includesInstanceProperty(selectedKeys).call(selectedKeys, key),
|
|
150
|
-
checked:
|
|
151
|
-
halfChecked:
|
|
164
|
+
checked: realChecked,
|
|
165
|
+
halfChecked: realHalfChecked,
|
|
152
166
|
pos: String(entity ? entity.pos : ''),
|
|
153
167
|
level: entity.level,
|
|
154
168
|
filtered: filteredKeys.has(key),
|
|
@@ -214,9 +228,16 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
214
228
|
keyEntities
|
|
215
229
|
} = this.getStates();
|
|
216
230
|
const {
|
|
217
|
-
leafOnly
|
|
231
|
+
leafOnly,
|
|
232
|
+
checkRelation
|
|
218
233
|
} = this.getProps();
|
|
219
|
-
|
|
234
|
+
let keyList = [];
|
|
235
|
+
|
|
236
|
+
if (checkRelation === 'related') {
|
|
237
|
+
keyList = normalizeKeyList(key, keyEntities, leafOnly);
|
|
238
|
+
} else if (checkRelation === 'unRelated') {
|
|
239
|
+
keyList = key;
|
|
240
|
+
}
|
|
220
241
|
|
|
221
242
|
const nodes = _mapInstanceProperty(keyList).call(keyList, i => keyEntities[i].data);
|
|
222
243
|
|
|
@@ -343,7 +364,8 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
343
364
|
this._adapter.updateState({
|
|
344
365
|
selectedKeys: [],
|
|
345
366
|
checkedKeys: new _Set(),
|
|
346
|
-
halfCheckedKeys: new _Set()
|
|
367
|
+
halfCheckedKeys: new _Set(),
|
|
368
|
+
realCheckedKeys: new _Set([])
|
|
347
369
|
});
|
|
348
370
|
} // When triggerSearch, clicking the clear button will trigger to clear Input
|
|
349
371
|
|
|
@@ -371,11 +393,13 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
371
393
|
|
|
372
394
|
removeTag(eventKey) {
|
|
373
395
|
const {
|
|
374
|
-
disableStrictly
|
|
396
|
+
disableStrictly,
|
|
397
|
+
checkRelation
|
|
375
398
|
} = this.getProps();
|
|
376
399
|
const {
|
|
377
400
|
keyEntities,
|
|
378
|
-
disabledKeys
|
|
401
|
+
disabledKeys,
|
|
402
|
+
realCheckedKeys
|
|
379
403
|
} = this.getStates();
|
|
380
404
|
const item = keyEntities[eventKey].data;
|
|
381
405
|
|
|
@@ -383,20 +407,35 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
383
407
|
return;
|
|
384
408
|
}
|
|
385
409
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
} = this.calcCheckedKeys(eventKey, false);
|
|
410
|
+
if (checkRelation === 'unRelated') {
|
|
411
|
+
const newRealCheckedKeys = new _Set(realCheckedKeys);
|
|
412
|
+
newRealCheckedKeys.delete(eventKey);
|
|
390
413
|
|
|
391
|
-
|
|
414
|
+
this._notifyChange([...newRealCheckedKeys], null);
|
|
392
415
|
|
|
393
|
-
|
|
394
|
-
|
|
416
|
+
if (!this._isControlledComponent()) {
|
|
417
|
+
this._adapter.updateState({
|
|
418
|
+
realCheckedKeys: newRealCheckedKeys
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
this._adapter.rePositionDropdown();
|
|
422
|
+
}
|
|
423
|
+
} else if (checkRelation === 'related') {
|
|
424
|
+
const {
|
|
395
425
|
checkedKeys,
|
|
396
426
|
halfCheckedKeys
|
|
397
|
-
});
|
|
427
|
+
} = this.calcCheckedKeys(eventKey, false);
|
|
398
428
|
|
|
399
|
-
this.
|
|
429
|
+
this._notifyChange([...checkedKeys], null);
|
|
430
|
+
|
|
431
|
+
if (!this._isControlledComponent()) {
|
|
432
|
+
this._adapter.updateState({
|
|
433
|
+
checkedKeys,
|
|
434
|
+
halfCheckedKeys
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
this._adapter.rePositionDropdown();
|
|
438
|
+
}
|
|
400
439
|
}
|
|
401
440
|
|
|
402
441
|
this._adapter.notifySelect(eventKey, false, item); // reposition dropdown when selected values change
|
|
@@ -547,39 +586,67 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
547
586
|
handleMultipleSelect(e, treeNode) {
|
|
548
587
|
const {
|
|
549
588
|
searchPosition,
|
|
550
|
-
disableStrictly
|
|
589
|
+
disableStrictly,
|
|
590
|
+
checkRelation
|
|
551
591
|
} = this.getProps();
|
|
552
592
|
const {
|
|
553
|
-
inputValue
|
|
593
|
+
inputValue,
|
|
594
|
+
realCheckedKeys
|
|
554
595
|
} = this.getStates();
|
|
555
596
|
const {
|
|
556
597
|
checked,
|
|
557
598
|
eventKey,
|
|
558
599
|
data
|
|
559
600
|
} = treeNode;
|
|
560
|
-
const targetStatus = disableStrictly ? this.calcChekcedStatus(!checked, eventKey) : !checked;
|
|
561
|
-
const {
|
|
562
|
-
checkedKeys,
|
|
563
|
-
halfCheckedKeys
|
|
564
|
-
} = disableStrictly ? this.calcNonDisabedCheckedKeys(eventKey, targetStatus) : this.calcCheckedKeys(eventKey, targetStatus);
|
|
565
601
|
|
|
566
|
-
|
|
602
|
+
if (checkRelation === 'related') {
|
|
603
|
+
const targetStatus = disableStrictly ? this.calcChekcedStatus(!checked, eventKey) : !checked;
|
|
604
|
+
const {
|
|
605
|
+
checkedKeys,
|
|
606
|
+
halfCheckedKeys
|
|
607
|
+
} = disableStrictly ? this.calcNonDisabedCheckedKeys(eventKey, targetStatus) : this.calcCheckedKeys(eventKey, targetStatus);
|
|
567
608
|
|
|
568
|
-
|
|
609
|
+
this._adapter.notifySelect(eventKey, targetStatus, data);
|
|
569
610
|
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
611
|
+
this._notifyChange([...checkedKeys], e);
|
|
612
|
+
|
|
613
|
+
if (!this._isControlledComponent()) {
|
|
614
|
+
this._adapter.updateState({
|
|
615
|
+
checkedKeys,
|
|
616
|
+
halfCheckedKeys
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
this._adapter.rePositionDropdown();
|
|
620
|
+
}
|
|
621
|
+
} else if (checkRelation === 'unRelated') {
|
|
622
|
+
const newRealCheckedKeys = new _Set(realCheckedKeys);
|
|
623
|
+
let targetStatus;
|
|
624
|
+
|
|
625
|
+
if (realCheckedKeys.has(eventKey)) {
|
|
626
|
+
newRealCheckedKeys.delete(eventKey);
|
|
627
|
+
targetStatus = false;
|
|
628
|
+
} else {
|
|
629
|
+
newRealCheckedKeys.add(eventKey);
|
|
630
|
+
targetStatus = true;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
this._adapter.notifySelect(eventKey, targetStatus, data);
|
|
634
|
+
|
|
635
|
+
this._notifyChange([...newRealCheckedKeys], e);
|
|
636
|
+
|
|
637
|
+
if (!this._isControlledComponent()) {
|
|
638
|
+
this._adapter.updateState({
|
|
639
|
+
realCheckedKeys: newRealCheckedKeys
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
this._adapter.rePositionDropdown();
|
|
643
|
+
}
|
|
574
644
|
}
|
|
575
645
|
|
|
576
|
-
if (
|
|
646
|
+
if (searchPosition === strings.SEARCH_POSITION_TRIGGER && inputValue !== '') {
|
|
577
647
|
this._adapter.updateState({
|
|
578
|
-
|
|
579
|
-
halfCheckedKeys
|
|
648
|
+
inputValue: ''
|
|
580
649
|
});
|
|
581
|
-
|
|
582
|
-
this._adapter.rePositionDropdown();
|
|
583
650
|
}
|
|
584
651
|
}
|
|
585
652
|
|
package/lib/es/upload/upload.css
CHANGED
|
@@ -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);
|