@douyinfe/semi-foundation 2.25.1 → 2.26.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/cascader/cascader.scss +8 -20
- package/grid/grid.scss +1 -1
- package/lib/cjs/cascader/cascader.css +3 -3
- package/lib/cjs/cascader/cascader.scss +8 -20
- package/lib/cjs/grid/grid.css +1 -1
- package/lib/cjs/grid/grid.scss +1 -1
- package/lib/cjs/table/foundation.js +3 -3
- package/lib/cjs/table/utils.js +3 -2
- package/lib/cjs/tagInput/tagInput.css +9 -0
- package/lib/cjs/tagInput/tagInput.scss +11 -0
- package/lib/cjs/tooltip/foundation.js +1 -1
- package/lib/cjs/tree/treeUtil.d.ts +1 -1
- package/lib/cjs/tree/treeUtil.js +17 -2
- package/lib/cjs/treeSelect/foundation.d.ts +6 -0
- package/lib/cjs/treeSelect/foundation.js +50 -4
- package/lib/cjs/treeSelect/treeSelect.css +6 -8
- package/lib/cjs/treeSelect/treeSelect.scss +9 -19
- package/lib/es/cascader/cascader.css +3 -3
- package/lib/es/cascader/cascader.scss +8 -20
- package/lib/es/grid/grid.css +1 -1
- package/lib/es/grid/grid.scss +1 -1
- package/lib/es/table/foundation.js +4 -3
- package/lib/es/table/utils.js +3 -2
- package/lib/es/tagInput/tagInput.css +9 -0
- package/lib/es/tagInput/tagInput.scss +11 -0
- package/lib/es/tooltip/foundation.js +1 -1
- package/lib/es/tree/treeUtil.d.ts +1 -1
- package/lib/es/tree/treeUtil.js +17 -2
- package/lib/es/treeSelect/foundation.d.ts +6 -0
- package/lib/es/treeSelect/foundation.js +50 -4
- package/lib/es/treeSelect/treeSelect.css +6 -8
- package/lib/es/treeSelect/treeSelect.scss +9 -19
- package/package.json +2 -2
- package/table/foundation.ts +2 -4
- package/table/utils.ts +2 -2
- package/tagInput/tagInput.scss +11 -0
- package/tooltip/foundation.ts +1 -1
- package/tree/treeUtil.ts +14 -2
- package/treeSelect/foundation.ts +38 -6
- package/treeSelect/treeSelect.scss +9 -19
package/cascader/cascader.scss
CHANGED
|
@@ -161,22 +161,17 @@ $module: #{$prefix}-cascader;
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
.#{$prefix}-tagInput {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
&-large {
|
|
174
|
-
min-height: $height-cascader_selection_tagInput_wrapper_large;
|
|
175
|
-
}
|
|
164
|
+
min-height: $height-cascader_selection_tagInput_wrapper_default;
|
|
165
|
+
|
|
166
|
+
&-small {
|
|
167
|
+
min-height: $height-cascader_selection_tagInput_wrapper_small;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&-large {
|
|
171
|
+
min-height: $height-cascader_selection_tagInput_wrapper_large;
|
|
176
172
|
}
|
|
177
173
|
|
|
178
174
|
.#{$prefix}-input-wrapper {
|
|
179
|
-
// height: $height-cascader_selection_tagInput_input_default;
|
|
180
175
|
|
|
181
176
|
margin-left: $spacing-cascader_selection_input-marginLeft;
|
|
182
177
|
.#{$prefix}-input {
|
|
@@ -193,13 +188,6 @@ $module: #{$prefix}-cascader;
|
|
|
193
188
|
margin-bottom: $spacing-cascader_selection_tag-marginY;
|
|
194
189
|
}
|
|
195
190
|
}
|
|
196
|
-
|
|
197
|
-
// .#{$prefix}-input-wrapper-small {
|
|
198
|
-
// height: $height-cascader_selection_tagInput_input_small;
|
|
199
|
-
// }
|
|
200
|
-
// .#{$prefix}-input-wrapper-large {
|
|
201
|
-
// height: $height-cascader_selection_tagInput_input_large;
|
|
202
|
-
// }
|
|
203
191
|
}
|
|
204
192
|
|
|
205
193
|
&-text {
|
package/grid/grid.scss
CHANGED
|
@@ -136,13 +136,13 @@
|
|
|
136
136
|
background: transparent;
|
|
137
137
|
margin-left: -4px;
|
|
138
138
|
}
|
|
139
|
-
.semi-cascader-selection .semi-tagInput
|
|
139
|
+
.semi-cascader-selection .semi-tagInput {
|
|
140
140
|
min-height: 30px;
|
|
141
141
|
}
|
|
142
|
-
.semi-cascader-selection .semi-tagInput-
|
|
142
|
+
.semi-cascader-selection .semi-tagInput-small {
|
|
143
143
|
min-height: 22px;
|
|
144
144
|
}
|
|
145
|
-
.semi-cascader-selection .semi-tagInput-
|
|
145
|
+
.semi-cascader-selection .semi-tagInput-large {
|
|
146
146
|
min-height: 38px;
|
|
147
147
|
}
|
|
148
148
|
.semi-cascader-selection .semi-tagInput .semi-input-wrapper {
|
|
@@ -161,22 +161,17 @@ $module: #{$prefix}-cascader;
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
.#{$prefix}-tagInput {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
&-large {
|
|
174
|
-
min-height: $height-cascader_selection_tagInput_wrapper_large;
|
|
175
|
-
}
|
|
164
|
+
min-height: $height-cascader_selection_tagInput_wrapper_default;
|
|
165
|
+
|
|
166
|
+
&-small {
|
|
167
|
+
min-height: $height-cascader_selection_tagInput_wrapper_small;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&-large {
|
|
171
|
+
min-height: $height-cascader_selection_tagInput_wrapper_large;
|
|
176
172
|
}
|
|
177
173
|
|
|
178
174
|
.#{$prefix}-input-wrapper {
|
|
179
|
-
// height: $height-cascader_selection_tagInput_input_default;
|
|
180
175
|
|
|
181
176
|
margin-left: $spacing-cascader_selection_input-marginLeft;
|
|
182
177
|
.#{$prefix}-input {
|
|
@@ -193,13 +188,6 @@ $module: #{$prefix}-cascader;
|
|
|
193
188
|
margin-bottom: $spacing-cascader_selection_tag-marginY;
|
|
194
189
|
}
|
|
195
190
|
}
|
|
196
|
-
|
|
197
|
-
// .#{$prefix}-input-wrapper-small {
|
|
198
|
-
// height: $height-cascader_selection_tagInput_input_small;
|
|
199
|
-
// }
|
|
200
|
-
// .#{$prefix}-input-wrapper-large {
|
|
201
|
-
// height: $height-cascader_selection_tagInput_input_large;
|
|
202
|
-
// }
|
|
203
191
|
}
|
|
204
192
|
|
|
205
193
|
&-text {
|
package/lib/cjs/grid/grid.css
CHANGED
package/lib/cjs/grid/grid.scss
CHANGED
|
@@ -125,9 +125,9 @@ class TableFoundation extends _foundation.default {
|
|
|
125
125
|
const {
|
|
126
126
|
defaultFilteredValue,
|
|
127
127
|
filteredValue,
|
|
128
|
-
|
|
128
|
+
onFilter
|
|
129
129
|
} = column;
|
|
130
|
-
const hasFilter =
|
|
130
|
+
const hasFilter = (0, _isFunction2.default)(onFilter);
|
|
131
131
|
|
|
132
132
|
if (hasFilter && (0, _isUndefined2.default)(filteredValue)) {
|
|
133
133
|
if (Array.isArray(defaultFilteredValue) && defaultFilteredValue.length) {
|
|
@@ -244,7 +244,7 @@ class TableFoundation extends _foundation.default {
|
|
|
244
244
|
* When initializing we should use `defaultFilteredValue`, after clicking we should use `filteredValue`
|
|
245
245
|
*/
|
|
246
246
|
const currentFilteredValue = query.filteredValue ? query.filteredValue : query.defaultFilteredValue;
|
|
247
|
-
return (0, _isFunction2.default)(query.onFilter) && Array.isArray(
|
|
247
|
+
return (0, _isFunction2.default)(query.onFilter) && Array.isArray(currentFilteredValue) && currentFilteredValue.length;
|
|
248
248
|
}));
|
|
249
249
|
const sortedDataSource = this.sortDataSource(filteredDataSource, queries.filter(query => query && (0, _isFunction2.default)(query.sorter)));
|
|
250
250
|
return sortedDataSource;
|
package/lib/cjs/table/utils.js
CHANGED
|
@@ -581,11 +581,12 @@ function warnIfNoDataIndex(column) {
|
|
|
581
581
|
const {
|
|
582
582
|
filters,
|
|
583
583
|
sorter,
|
|
584
|
-
dataIndex
|
|
584
|
+
dataIndex,
|
|
585
|
+
onFilter
|
|
585
586
|
} = column;
|
|
586
587
|
const logger = new _Logger.default('[@douyinfe/semi-ui Table]');
|
|
587
588
|
|
|
588
|
-
if ((Array.isArray(filters) || (0, _isFunction2.default)(sorter)) && (0, _isNullOrUndefined.default)(dataIndex)) {
|
|
589
|
+
if ((Array.isArray(filters) || (0, _isFunction2.default)(onFilter) || (0, _isFunction2.default)(sorter)) && (0, _isNullOrUndefined.default)(dataIndex)) {
|
|
589
590
|
logger.warn("The column with sorter or filter must pass the 'dataIndex' prop");
|
|
590
591
|
}
|
|
591
592
|
}
|
|
@@ -208,6 +208,15 @@
|
|
|
208
208
|
.semi-tagInput-suffix-text {
|
|
209
209
|
color: var(--semi-color-text-2);
|
|
210
210
|
}
|
|
211
|
+
.semi-tagInput-tag-content-wrapper {
|
|
212
|
+
display: flex;
|
|
213
|
+
align-items: center;
|
|
214
|
+
}
|
|
215
|
+
.semi-tagInput-sortable-list {
|
|
216
|
+
display: flex;
|
|
217
|
+
flex-flow: row wrap;
|
|
218
|
+
width: 100%;
|
|
219
|
+
}
|
|
211
220
|
|
|
212
221
|
.semi-rtl .semi-tagInput,
|
|
213
222
|
.semi-portal-rtl .semi-tagInput {
|
|
@@ -259,6 +259,17 @@ $module: #{$prefix}-tagInput;
|
|
|
259
259
|
color: $color-tagInput_suffix-default;
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
+
|
|
263
|
+
&-tag-content-wrapper {
|
|
264
|
+
display: flex;
|
|
265
|
+
align-items: center;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
&-sortable-list {
|
|
269
|
+
display: flex;
|
|
270
|
+
flex-flow: row wrap;
|
|
271
|
+
width: 100%;
|
|
272
|
+
}
|
|
262
273
|
}
|
|
263
274
|
|
|
264
275
|
@import "./rtl.scss";
|
|
@@ -944,7 +944,7 @@ class Tooltip extends _foundation.default {
|
|
|
944
944
|
}
|
|
945
945
|
|
|
946
946
|
if (shouldReverseLeftSide && widthIsBigger) {
|
|
947
|
-
position = this._adjustPos(position
|
|
947
|
+
position = this._adjustPos(position);
|
|
948
948
|
}
|
|
949
949
|
|
|
950
950
|
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
@@ -54,7 +54,7 @@ export declare function calcMotionKeys(oldKeySet: Set<string>, newKeySet: Set<st
|
|
|
54
54
|
*/
|
|
55
55
|
export declare function filter(sugInput: string, option: any, filterTreeNode: any, filterProps: any): any;
|
|
56
56
|
export declare function normalizedArr(val: any): any[];
|
|
57
|
-
export declare function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly?: boolean): string[];
|
|
57
|
+
export declare function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly?: boolean, flag?: boolean): string[];
|
|
58
58
|
export declare function getMotionKeys(eventKey: string, expandedKeys: Set<string>, keyEntities: KeyEntities): any[];
|
|
59
59
|
export declare function calcCheckedKeysForChecked(key: string, keyEntities: KeyEntities, checkedKeys: Set<string>, halfCheckedKeys: Set<string>): {
|
|
60
60
|
checkedKeys: Set<string>;
|
package/lib/cjs/tree/treeUtil.js
CHANGED
|
@@ -234,6 +234,9 @@ function findKeysForValues(valueList, valueEntities) {
|
|
|
234
234
|
valueList.forEach(val => {
|
|
235
235
|
if (val in valueEntities) {
|
|
236
236
|
res.push(valueEntities[val]);
|
|
237
|
+
} else {
|
|
238
|
+
// if val not in valueEntities, then value push to keys array
|
|
239
|
+
val && res.push(val);
|
|
237
240
|
}
|
|
238
241
|
});
|
|
239
242
|
return res;
|
|
@@ -512,16 +515,23 @@ function normalizedArr(val) {
|
|
|
512
515
|
} else {
|
|
513
516
|
return val;
|
|
514
517
|
}
|
|
515
|
-
}
|
|
518
|
+
} // flag is used to determine whether to return when the key does not belong to the keys in keyEntities
|
|
519
|
+
// export function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly = false) {
|
|
520
|
+
|
|
516
521
|
|
|
517
522
|
function normalizeKeyList(keyList, keyEntities) {
|
|
518
523
|
let leafOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
524
|
+
let flag = arguments.length > 3 ? arguments[3] : undefined;
|
|
519
525
|
const res = [];
|
|
520
526
|
const keyListSet = new Set(keyList);
|
|
521
527
|
|
|
522
528
|
if (!leafOnly) {
|
|
523
529
|
keyList.forEach(key => {
|
|
524
530
|
if (!keyEntities[key]) {
|
|
531
|
+
if (flag) {
|
|
532
|
+
res.push(key);
|
|
533
|
+
}
|
|
534
|
+
|
|
525
535
|
return;
|
|
526
536
|
}
|
|
527
537
|
|
|
@@ -539,6 +549,11 @@ function normalizeKeyList(keyList, keyEntities) {
|
|
|
539
549
|
keyList.forEach(key => {
|
|
540
550
|
if (keyEntities[key] && !isValid(keyEntities[key].children)) {
|
|
541
551
|
res.push(key);
|
|
552
|
+
} // when key is not in keyEntities, if flag is true, key should be push in res
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
if (!keyEntities[key] && flag) {
|
|
556
|
+
res.push(key);
|
|
542
557
|
}
|
|
543
558
|
});
|
|
544
559
|
}
|
|
@@ -658,7 +673,7 @@ function calcCheckedKeysForUnchecked(key, keyEntities, checkedKeys, halfCheckedK
|
|
|
658
673
|
}
|
|
659
674
|
};
|
|
660
675
|
|
|
661
|
-
calcCurrLevel(nodeItem);
|
|
676
|
+
nodeItem && calcCurrLevel(nodeItem);
|
|
662
677
|
return {
|
|
663
678
|
checkedKeys,
|
|
664
679
|
halfCheckedKeys
|
|
@@ -115,6 +115,12 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
115
115
|
_isSelectToClose(): boolean;
|
|
116
116
|
_isLoadControlled(): any;
|
|
117
117
|
_showFilteredOnly(): any;
|
|
118
|
+
findDataForValue(findValue: string): any;
|
|
119
|
+
constructDataForValue(value: string): {
|
|
120
|
+
[x: number]: string;
|
|
121
|
+
key: string;
|
|
122
|
+
};
|
|
123
|
+
getDataForKeyNotInKeyEntities(value: string): any;
|
|
118
124
|
getCopyFromState(items: string | string[]): BasicTreeInnerData;
|
|
119
125
|
getTreeNodeProps(key: string): BasicTreeNodeProps;
|
|
120
126
|
handleNodeLoad(loadedKeys: Set<string>, loadingKeys: Set<string>, data: BasicTreeNodeData, resolve: (value?: any) => void): {
|
|
@@ -115,6 +115,46 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
115
115
|
return Boolean(inputValue) && showFilteredOnly;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
findDataForValue(findValue) {
|
|
119
|
+
const {
|
|
120
|
+
value,
|
|
121
|
+
defaultValue
|
|
122
|
+
} = this.getProps();
|
|
123
|
+
let valueArr = [];
|
|
124
|
+
|
|
125
|
+
if (value) {
|
|
126
|
+
valueArr = Array.isArray(value) ? value : [value];
|
|
127
|
+
} else if (defaultValue) {
|
|
128
|
+
valueArr = Array.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return valueArr.find(item => {
|
|
132
|
+
return item.value === findValue || item.key === findValue;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
constructDataForValue(value) {
|
|
137
|
+
const {
|
|
138
|
+
treeNodeLabelProp
|
|
139
|
+
} = this.getProps();
|
|
140
|
+
return {
|
|
141
|
+
key: value,
|
|
142
|
+
[treeNodeLabelProp]: value
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
getDataForKeyNotInKeyEntities(value) {
|
|
147
|
+
const {
|
|
148
|
+
onChangeWithObject
|
|
149
|
+
} = this.getProps();
|
|
150
|
+
|
|
151
|
+
if (onChangeWithObject) {
|
|
152
|
+
return this.findDataForValue(value);
|
|
153
|
+
} else {
|
|
154
|
+
return this.constructDataForValue(value);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
118
158
|
getCopyFromState(items) {
|
|
119
159
|
const res = {};
|
|
120
160
|
(0, _treeUtil.normalizedArr)(items).forEach(key => {
|
|
@@ -241,12 +281,12 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
241
281
|
let keyList = [];
|
|
242
282
|
|
|
243
283
|
if (checkRelation === 'related') {
|
|
244
|
-
keyList = (0, _treeUtil.normalizeKeyList)(key, keyEntities, leafOnly);
|
|
284
|
+
keyList = (0, _treeUtil.normalizeKeyList)(key, keyEntities, leafOnly, true);
|
|
245
285
|
} else if (checkRelation === 'unRelated') {
|
|
246
286
|
keyList = key;
|
|
247
287
|
}
|
|
248
288
|
|
|
249
|
-
const nodes = keyList.map(
|
|
289
|
+
const nodes = keyList.map(key => keyEntities[key] && keyEntities[key].data.key === key ? keyEntities[key].data : this.getDataForKeyNotInKeyEntities(key));
|
|
250
290
|
|
|
251
291
|
if (this.getProp('onChangeWithObject')) {
|
|
252
292
|
this._adapter.notifyChangeWithObject(nodes, e);
|
|
@@ -420,7 +460,7 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
420
460
|
disabledKeys,
|
|
421
461
|
realCheckedKeys
|
|
422
462
|
} = this.getStates();
|
|
423
|
-
const item = keyEntities[eventKey].data;
|
|
463
|
+
const item = keyEntities[eventKey] && keyEntities[eventKey].data.key === eventKey ? keyEntities[eventKey].data : this.getDataForKeyNotInKeyEntities(eventKey);
|
|
424
464
|
|
|
425
465
|
if (item.disabled || disableStrictly && disabledKeys.has(eventKey)) {
|
|
426
466
|
return;
|
|
@@ -843,7 +883,13 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
843
883
|
keyEntities
|
|
844
884
|
} = this.getStates();
|
|
845
885
|
const renderSelectedItem = (0, _isFunction2.default)(propRenderSelectedItem) ? propRenderSelectedItem : item => (0, _get2.default)(item, treeNodeLabelProp, null);
|
|
846
|
-
|
|
886
|
+
let item;
|
|
887
|
+
|
|
888
|
+
if (selectedKeys.length) {
|
|
889
|
+
const key = selectedKeys[0];
|
|
890
|
+
item = keyEntities[key] && keyEntities[key].data.key === key ? keyEntities[key].data : this.getDataForKeyNotInKeyEntities(key);
|
|
891
|
+
}
|
|
892
|
+
|
|
847
893
|
const renderText = item && treeNodeLabelProp in item ? renderSelectedItem(item) : null;
|
|
848
894
|
return renderText;
|
|
849
895
|
}
|
|
@@ -139,20 +139,18 @@
|
|
|
139
139
|
.semi-tree-select-selection .semi-tagInput {
|
|
140
140
|
border: hidden;
|
|
141
141
|
background: transparent;
|
|
142
|
-
}
|
|
143
|
-
.semi-tree-select-selection .semi-tagInput .semi-tagInput-wrapper {
|
|
144
|
-
padding-left: 4px;
|
|
145
|
-
padding-right: 4px;
|
|
146
|
-
}
|
|
147
|
-
.semi-tree-select-selection .semi-tagInput .semi-tagInput-wrapper-default {
|
|
148
142
|
min-height: 30px;
|
|
149
143
|
}
|
|
150
|
-
.semi-tree-select-selection .semi-tagInput
|
|
144
|
+
.semi-tree-select-selection .semi-tagInput-small {
|
|
151
145
|
min-height: 22px;
|
|
152
146
|
}
|
|
153
|
-
.semi-tree-select-selection .semi-tagInput
|
|
147
|
+
.semi-tree-select-selection .semi-tagInput-large {
|
|
154
148
|
min-height: 38px;
|
|
155
149
|
}
|
|
150
|
+
.semi-tree-select-selection .semi-tagInput .semi-tagInput-wrapper {
|
|
151
|
+
padding-left: 4px;
|
|
152
|
+
padding-right: 4px;
|
|
153
|
+
}
|
|
156
154
|
.semi-tree-select-selection .semi-tagInput .semi-tagInput-wrapper .semi-input-wrapper .semi-input {
|
|
157
155
|
padding-left: 0;
|
|
158
156
|
}
|
|
@@ -171,23 +171,20 @@ $module: #{$prefix}-tree-select;
|
|
|
171
171
|
.#{$prefix}-tagInput {
|
|
172
172
|
border: hidden;
|
|
173
173
|
background: transparent;
|
|
174
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_default;
|
|
175
|
+
|
|
176
|
+
&-small {
|
|
177
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_small;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&-large {
|
|
181
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_large;
|
|
182
|
+
}
|
|
174
183
|
|
|
175
184
|
.#{$prefix}-tagInput-wrapper {
|
|
176
185
|
padding-left: $spacing-treeSelect_selection_tagInput_wrapper-paddingX;
|
|
177
186
|
padding-right: $spacing-treeSelect_selection_tagInput_wrapper-paddingX;
|
|
178
187
|
|
|
179
|
-
&-default {
|
|
180
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_default;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
&-small {
|
|
184
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_small;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
&-large {
|
|
188
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_large;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
188
|
.#{$prefix}-input-wrapper {
|
|
192
189
|
// height: $height-treeSelect_selection_tagInput_input_default;
|
|
193
190
|
|
|
@@ -205,13 +202,6 @@ $module: #{$prefix}-tree-select;
|
|
|
205
202
|
margin-bottom: $spacing-treeSelect_tag-marginY;
|
|
206
203
|
}
|
|
207
204
|
}
|
|
208
|
-
|
|
209
|
-
// .#{$prefix}-input-wrapper-small {
|
|
210
|
-
// height: $height-treeSelect_selection_tagInput_input_small;
|
|
211
|
-
// }
|
|
212
|
-
// .#{$prefix}-input-wrapper-large {
|
|
213
|
-
// height: $height-treeSelect_selection_tagInput_input_large;
|
|
214
|
-
// }
|
|
215
205
|
}
|
|
216
206
|
}
|
|
217
207
|
}
|
|
@@ -136,13 +136,13 @@
|
|
|
136
136
|
background: transparent;
|
|
137
137
|
margin-left: -4px;
|
|
138
138
|
}
|
|
139
|
-
.semi-cascader-selection .semi-tagInput
|
|
139
|
+
.semi-cascader-selection .semi-tagInput {
|
|
140
140
|
min-height: 30px;
|
|
141
141
|
}
|
|
142
|
-
.semi-cascader-selection .semi-tagInput-
|
|
142
|
+
.semi-cascader-selection .semi-tagInput-small {
|
|
143
143
|
min-height: 22px;
|
|
144
144
|
}
|
|
145
|
-
.semi-cascader-selection .semi-tagInput-
|
|
145
|
+
.semi-cascader-selection .semi-tagInput-large {
|
|
146
146
|
min-height: 38px;
|
|
147
147
|
}
|
|
148
148
|
.semi-cascader-selection .semi-tagInput .semi-input-wrapper {
|
|
@@ -161,22 +161,17 @@ $module: #{$prefix}-cascader;
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
.#{$prefix}-tagInput {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
&-large {
|
|
174
|
-
min-height: $height-cascader_selection_tagInput_wrapper_large;
|
|
175
|
-
}
|
|
164
|
+
min-height: $height-cascader_selection_tagInput_wrapper_default;
|
|
165
|
+
|
|
166
|
+
&-small {
|
|
167
|
+
min-height: $height-cascader_selection_tagInput_wrapper_small;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&-large {
|
|
171
|
+
min-height: $height-cascader_selection_tagInput_wrapper_large;
|
|
176
172
|
}
|
|
177
173
|
|
|
178
174
|
.#{$prefix}-input-wrapper {
|
|
179
|
-
// height: $height-cascader_selection_tagInput_input_default;
|
|
180
175
|
|
|
181
176
|
margin-left: $spacing-cascader_selection_input-marginLeft;
|
|
182
177
|
.#{$prefix}-input {
|
|
@@ -193,13 +188,6 @@ $module: #{$prefix}-cascader;
|
|
|
193
188
|
margin-bottom: $spacing-cascader_selection_tag-marginY;
|
|
194
189
|
}
|
|
195
190
|
}
|
|
196
|
-
|
|
197
|
-
// .#{$prefix}-input-wrapper-small {
|
|
198
|
-
// height: $height-cascader_selection_tagInput_input_small;
|
|
199
|
-
// }
|
|
200
|
-
// .#{$prefix}-input-wrapper-large {
|
|
201
|
-
// height: $height-cascader_selection_tagInput_input_large;
|
|
202
|
-
// }
|
|
203
191
|
}
|
|
204
192
|
|
|
205
193
|
&-text {
|
package/lib/es/grid/grid.css
CHANGED
package/lib/es/grid/grid.scss
CHANGED
|
@@ -99,9 +99,10 @@ class TableFoundation extends BaseFoundation {
|
|
|
99
99
|
const {
|
|
100
100
|
defaultFilteredValue,
|
|
101
101
|
filteredValue,
|
|
102
|
-
|
|
102
|
+
onFilter
|
|
103
103
|
} = column;
|
|
104
|
-
|
|
104
|
+
|
|
105
|
+
const hasFilter = _isFunction(onFilter);
|
|
105
106
|
|
|
106
107
|
if (hasFilter && _isUndefined(filteredValue)) {
|
|
107
108
|
if (Array.isArray(defaultFilteredValue) && defaultFilteredValue.length) {
|
|
@@ -219,7 +220,7 @@ class TableFoundation extends BaseFoundation {
|
|
|
219
220
|
* When initializing we should use `defaultFilteredValue`, after clicking we should use `filteredValue`
|
|
220
221
|
*/
|
|
221
222
|
const currentFilteredValue = query.filteredValue ? query.filteredValue : query.defaultFilteredValue;
|
|
222
|
-
return _isFunction(query.onFilter) && Array.isArray(
|
|
223
|
+
return _isFunction(query.onFilter) && Array.isArray(currentFilteredValue) && currentFilteredValue.length;
|
|
223
224
|
}));
|
|
224
225
|
const sortedDataSource = this.sortDataSource(filteredDataSource, queries.filter(query => query && _isFunction(query.sorter)));
|
|
225
226
|
return sortedDataSource;
|
package/lib/es/table/utils.js
CHANGED
|
@@ -498,11 +498,12 @@ export function warnIfNoDataIndex(column) {
|
|
|
498
498
|
const {
|
|
499
499
|
filters,
|
|
500
500
|
sorter,
|
|
501
|
-
dataIndex
|
|
501
|
+
dataIndex,
|
|
502
|
+
onFilter
|
|
502
503
|
} = column;
|
|
503
504
|
const logger = new Logger('[@douyinfe/semi-ui Table]');
|
|
504
505
|
|
|
505
|
-
if ((Array.isArray(filters) || _isFunction(sorter)) && isNullOrUndefined(dataIndex)) {
|
|
506
|
+
if ((Array.isArray(filters) || _isFunction(onFilter) || _isFunction(sorter)) && isNullOrUndefined(dataIndex)) {
|
|
506
507
|
logger.warn("The column with sorter or filter must pass the 'dataIndex' prop");
|
|
507
508
|
}
|
|
508
509
|
}
|
|
@@ -208,6 +208,15 @@
|
|
|
208
208
|
.semi-tagInput-suffix-text {
|
|
209
209
|
color: var(--semi-color-text-2);
|
|
210
210
|
}
|
|
211
|
+
.semi-tagInput-tag-content-wrapper {
|
|
212
|
+
display: flex;
|
|
213
|
+
align-items: center;
|
|
214
|
+
}
|
|
215
|
+
.semi-tagInput-sortable-list {
|
|
216
|
+
display: flex;
|
|
217
|
+
flex-flow: row wrap;
|
|
218
|
+
width: 100%;
|
|
219
|
+
}
|
|
211
220
|
|
|
212
221
|
.semi-rtl .semi-tagInput,
|
|
213
222
|
.semi-portal-rtl .semi-tagInput {
|
|
@@ -259,6 +259,17 @@ $module: #{$prefix}-tagInput;
|
|
|
259
259
|
color: $color-tagInput_suffix-default;
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
+
|
|
263
|
+
&-tag-content-wrapper {
|
|
264
|
+
display: flex;
|
|
265
|
+
align-items: center;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
&-sortable-list {
|
|
269
|
+
display: flex;
|
|
270
|
+
flex-flow: row wrap;
|
|
271
|
+
width: 100%;
|
|
272
|
+
}
|
|
262
273
|
}
|
|
263
274
|
|
|
264
275
|
@import "./rtl.scss";
|
|
@@ -934,7 +934,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
934
934
|
}
|
|
935
935
|
|
|
936
936
|
if (shouldReverseLeftSide && widthIsBigger) {
|
|
937
|
-
position = this._adjustPos(position
|
|
937
|
+
position = this._adjustPos(position);
|
|
938
938
|
}
|
|
939
939
|
|
|
940
940
|
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
@@ -54,7 +54,7 @@ export declare function calcMotionKeys(oldKeySet: Set<string>, newKeySet: Set<st
|
|
|
54
54
|
*/
|
|
55
55
|
export declare function filter(sugInput: string, option: any, filterTreeNode: any, filterProps: any): any;
|
|
56
56
|
export declare function normalizedArr(val: any): any[];
|
|
57
|
-
export declare function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly?: boolean): string[];
|
|
57
|
+
export declare function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly?: boolean, flag?: boolean): string[];
|
|
58
58
|
export declare function getMotionKeys(eventKey: string, expandedKeys: Set<string>, keyEntities: KeyEntities): any[];
|
|
59
59
|
export declare function calcCheckedKeysForChecked(key: string, keyEntities: KeyEntities, checkedKeys: Set<string>, halfCheckedKeys: Set<string>): {
|
|
60
60
|
checkedKeys: Set<string>;
|
package/lib/es/tree/treeUtil.js
CHANGED
|
@@ -186,6 +186,9 @@ export function findKeysForValues(valueList, valueEntities) {
|
|
|
186
186
|
valueList.forEach(val => {
|
|
187
187
|
if (val in valueEntities) {
|
|
188
188
|
res.push(valueEntities[val]);
|
|
189
|
+
} else {
|
|
190
|
+
// if val not in valueEntities, then value push to keys array
|
|
191
|
+
val && res.push(val);
|
|
189
192
|
}
|
|
190
193
|
});
|
|
191
194
|
return res;
|
|
@@ -455,15 +458,22 @@ export function normalizedArr(val) {
|
|
|
455
458
|
} else {
|
|
456
459
|
return val;
|
|
457
460
|
}
|
|
458
|
-
}
|
|
461
|
+
} // flag is used to determine whether to return when the key does not belong to the keys in keyEntities
|
|
462
|
+
// export function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly = false) {
|
|
463
|
+
|
|
459
464
|
export function normalizeKeyList(keyList, keyEntities) {
|
|
460
465
|
let leafOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
466
|
+
let flag = arguments.length > 3 ? arguments[3] : undefined;
|
|
461
467
|
const res = [];
|
|
462
468
|
const keyListSet = new Set(keyList);
|
|
463
469
|
|
|
464
470
|
if (!leafOnly) {
|
|
465
471
|
keyList.forEach(key => {
|
|
466
472
|
if (!keyEntities[key]) {
|
|
473
|
+
if (flag) {
|
|
474
|
+
res.push(key);
|
|
475
|
+
}
|
|
476
|
+
|
|
467
477
|
return;
|
|
468
478
|
}
|
|
469
479
|
|
|
@@ -481,6 +491,11 @@ export function normalizeKeyList(keyList, keyEntities) {
|
|
|
481
491
|
keyList.forEach(key => {
|
|
482
492
|
if (keyEntities[key] && !isValid(keyEntities[key].children)) {
|
|
483
493
|
res.push(key);
|
|
494
|
+
} // when key is not in keyEntities, if flag is true, key should be push in res
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
if (!keyEntities[key] && flag) {
|
|
498
|
+
res.push(key);
|
|
484
499
|
}
|
|
485
500
|
});
|
|
486
501
|
}
|
|
@@ -597,7 +612,7 @@ export function calcCheckedKeysForUnchecked(key, keyEntities, checkedKeys, halfC
|
|
|
597
612
|
}
|
|
598
613
|
};
|
|
599
614
|
|
|
600
|
-
calcCurrLevel(nodeItem);
|
|
615
|
+
nodeItem && calcCurrLevel(nodeItem);
|
|
601
616
|
return {
|
|
602
617
|
checkedKeys,
|
|
603
618
|
halfCheckedKeys
|
|
@@ -115,6 +115,12 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
115
115
|
_isSelectToClose(): boolean;
|
|
116
116
|
_isLoadControlled(): any;
|
|
117
117
|
_showFilteredOnly(): any;
|
|
118
|
+
findDataForValue(findValue: string): any;
|
|
119
|
+
constructDataForValue(value: string): {
|
|
120
|
+
[x: number]: string;
|
|
121
|
+
key: string;
|
|
122
|
+
};
|
|
123
|
+
getDataForKeyNotInKeyEntities(value: string): any;
|
|
118
124
|
getCopyFromState(items: string | string[]): BasicTreeInnerData;
|
|
119
125
|
getTreeNodeProps(key: string): BasicTreeNodeProps;
|
|
120
126
|
handleNodeLoad(loadedKeys: Set<string>, loadingKeys: Set<string>, data: BasicTreeNodeData, resolve: (value?: any) => void): {
|
|
@@ -94,6 +94,46 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
94
94
|
return Boolean(inputValue) && showFilteredOnly;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
findDataForValue(findValue) {
|
|
98
|
+
const {
|
|
99
|
+
value,
|
|
100
|
+
defaultValue
|
|
101
|
+
} = this.getProps();
|
|
102
|
+
let valueArr = [];
|
|
103
|
+
|
|
104
|
+
if (value) {
|
|
105
|
+
valueArr = Array.isArray(value) ? value : [value];
|
|
106
|
+
} else if (defaultValue) {
|
|
107
|
+
valueArr = Array.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return valueArr.find(item => {
|
|
111
|
+
return item.value === findValue || item.key === findValue;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
constructDataForValue(value) {
|
|
116
|
+
const {
|
|
117
|
+
treeNodeLabelProp
|
|
118
|
+
} = this.getProps();
|
|
119
|
+
return {
|
|
120
|
+
key: value,
|
|
121
|
+
[treeNodeLabelProp]: value
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
getDataForKeyNotInKeyEntities(value) {
|
|
126
|
+
const {
|
|
127
|
+
onChangeWithObject
|
|
128
|
+
} = this.getProps();
|
|
129
|
+
|
|
130
|
+
if (onChangeWithObject) {
|
|
131
|
+
return this.findDataForValue(value);
|
|
132
|
+
} else {
|
|
133
|
+
return this.constructDataForValue(value);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
97
137
|
getCopyFromState(items) {
|
|
98
138
|
const res = {};
|
|
99
139
|
normalizedArr(items).forEach(key => {
|
|
@@ -220,12 +260,12 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
220
260
|
let keyList = [];
|
|
221
261
|
|
|
222
262
|
if (checkRelation === 'related') {
|
|
223
|
-
keyList = normalizeKeyList(key, keyEntities, leafOnly);
|
|
263
|
+
keyList = normalizeKeyList(key, keyEntities, leafOnly, true);
|
|
224
264
|
} else if (checkRelation === 'unRelated') {
|
|
225
265
|
keyList = key;
|
|
226
266
|
}
|
|
227
267
|
|
|
228
|
-
const nodes = keyList.map(
|
|
268
|
+
const nodes = keyList.map(key => keyEntities[key] && keyEntities[key].data.key === key ? keyEntities[key].data : this.getDataForKeyNotInKeyEntities(key));
|
|
229
269
|
|
|
230
270
|
if (this.getProp('onChangeWithObject')) {
|
|
231
271
|
this._adapter.notifyChangeWithObject(nodes, e);
|
|
@@ -399,7 +439,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
399
439
|
disabledKeys,
|
|
400
440
|
realCheckedKeys
|
|
401
441
|
} = this.getStates();
|
|
402
|
-
const item = keyEntities[eventKey].data;
|
|
442
|
+
const item = keyEntities[eventKey] && keyEntities[eventKey].data.key === eventKey ? keyEntities[eventKey].data : this.getDataForKeyNotInKeyEntities(eventKey);
|
|
403
443
|
|
|
404
444
|
if (item.disabled || disableStrictly && disabledKeys.has(eventKey)) {
|
|
405
445
|
return;
|
|
@@ -822,7 +862,13 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
822
862
|
keyEntities
|
|
823
863
|
} = this.getStates();
|
|
824
864
|
const renderSelectedItem = _isFunction(propRenderSelectedItem) ? propRenderSelectedItem : item => _get(item, treeNodeLabelProp, null);
|
|
825
|
-
|
|
865
|
+
let item;
|
|
866
|
+
|
|
867
|
+
if (selectedKeys.length) {
|
|
868
|
+
const key = selectedKeys[0];
|
|
869
|
+
item = keyEntities[key] && keyEntities[key].data.key === key ? keyEntities[key].data : this.getDataForKeyNotInKeyEntities(key);
|
|
870
|
+
}
|
|
871
|
+
|
|
826
872
|
const renderText = item && treeNodeLabelProp in item ? renderSelectedItem(item) : null;
|
|
827
873
|
return renderText;
|
|
828
874
|
}
|
|
@@ -139,20 +139,18 @@
|
|
|
139
139
|
.semi-tree-select-selection .semi-tagInput {
|
|
140
140
|
border: hidden;
|
|
141
141
|
background: transparent;
|
|
142
|
-
}
|
|
143
|
-
.semi-tree-select-selection .semi-tagInput .semi-tagInput-wrapper {
|
|
144
|
-
padding-left: 4px;
|
|
145
|
-
padding-right: 4px;
|
|
146
|
-
}
|
|
147
|
-
.semi-tree-select-selection .semi-tagInput .semi-tagInput-wrapper-default {
|
|
148
142
|
min-height: 30px;
|
|
149
143
|
}
|
|
150
|
-
.semi-tree-select-selection .semi-tagInput
|
|
144
|
+
.semi-tree-select-selection .semi-tagInput-small {
|
|
151
145
|
min-height: 22px;
|
|
152
146
|
}
|
|
153
|
-
.semi-tree-select-selection .semi-tagInput
|
|
147
|
+
.semi-tree-select-selection .semi-tagInput-large {
|
|
154
148
|
min-height: 38px;
|
|
155
149
|
}
|
|
150
|
+
.semi-tree-select-selection .semi-tagInput .semi-tagInput-wrapper {
|
|
151
|
+
padding-left: 4px;
|
|
152
|
+
padding-right: 4px;
|
|
153
|
+
}
|
|
156
154
|
.semi-tree-select-selection .semi-tagInput .semi-tagInput-wrapper .semi-input-wrapper .semi-input {
|
|
157
155
|
padding-left: 0;
|
|
158
156
|
}
|
|
@@ -171,23 +171,20 @@ $module: #{$prefix}-tree-select;
|
|
|
171
171
|
.#{$prefix}-tagInput {
|
|
172
172
|
border: hidden;
|
|
173
173
|
background: transparent;
|
|
174
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_default;
|
|
175
|
+
|
|
176
|
+
&-small {
|
|
177
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_small;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&-large {
|
|
181
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_large;
|
|
182
|
+
}
|
|
174
183
|
|
|
175
184
|
.#{$prefix}-tagInput-wrapper {
|
|
176
185
|
padding-left: $spacing-treeSelect_selection_tagInput_wrapper-paddingX;
|
|
177
186
|
padding-right: $spacing-treeSelect_selection_tagInput_wrapper-paddingX;
|
|
178
187
|
|
|
179
|
-
&-default {
|
|
180
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_default;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
&-small {
|
|
184
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_small;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
&-large {
|
|
188
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_large;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
188
|
.#{$prefix}-input-wrapper {
|
|
192
189
|
// height: $height-treeSelect_selection_tagInput_input_default;
|
|
193
190
|
|
|
@@ -205,13 +202,6 @@ $module: #{$prefix}-tree-select;
|
|
|
205
202
|
margin-bottom: $spacing-treeSelect_tag-marginY;
|
|
206
203
|
}
|
|
207
204
|
}
|
|
208
|
-
|
|
209
|
-
// .#{$prefix}-input-wrapper-small {
|
|
210
|
-
// height: $height-treeSelect_selection_tagInput_input_small;
|
|
211
|
-
// }
|
|
212
|
-
// .#{$prefix}-input-wrapper-large {
|
|
213
|
-
// height: $height-treeSelect_selection_tagInput_input_large;
|
|
214
|
-
// }
|
|
215
205
|
}
|
|
216
206
|
}
|
|
217
207
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.26.0-beta.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"*.scss",
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "97f744558e96e39201b54219f82ce64da7163b81",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
29
29
|
"@babel/preset-env": "^7.15.8",
|
package/table/foundation.ts
CHANGED
|
@@ -130,8 +130,8 @@ class TableFoundation<RecordType> extends BaseFoundation<TableAdapter<RecordType
|
|
|
130
130
|
* init filteredValue of filtering column, use defaultFilteredValue or [] when it is undefined
|
|
131
131
|
*/
|
|
132
132
|
static initFilteredValue(column: BaseColumnProps<unknown>) {
|
|
133
|
-
const { defaultFilteredValue, filteredValue,
|
|
134
|
-
const hasFilter =
|
|
133
|
+
const { defaultFilteredValue, filteredValue, onFilter } = column;
|
|
134
|
+
const hasFilter = isFunction(onFilter);
|
|
135
135
|
if (hasFilter && isUndefined(filteredValue)) {
|
|
136
136
|
if (Array.isArray(defaultFilteredValue) && defaultFilteredValue.length) {
|
|
137
137
|
column.filteredValue = defaultFilteredValue;
|
|
@@ -253,8 +253,6 @@ class TableFoundation<RecordType> extends BaseFoundation<TableAdapter<RecordType
|
|
|
253
253
|
const currentFilteredValue = query.filteredValue ? query.filteredValue : query.defaultFilteredValue;
|
|
254
254
|
return (
|
|
255
255
|
isFunction(query.onFilter) &&
|
|
256
|
-
Array.isArray(query.filters) &&
|
|
257
|
-
query.filters.length &&
|
|
258
256
|
Array.isArray(currentFilteredValue) &&
|
|
259
257
|
currentFilteredValue.length
|
|
260
258
|
);
|
package/table/utils.ts
CHANGED
|
@@ -480,9 +480,9 @@ export interface GetAllDisabledRowKeysProps {
|
|
|
480
480
|
|
|
481
481
|
export function warnIfNoDataIndex(column: Record<string, any>) {
|
|
482
482
|
if (typeof column === 'object' && column !== null) {
|
|
483
|
-
const { filters, sorter, dataIndex } = column;
|
|
483
|
+
const { filters, sorter, dataIndex, onFilter } = column;
|
|
484
484
|
const logger = new Logger('[@douyinfe/semi-ui Table]');
|
|
485
|
-
if ((Array.isArray(filters) || isFunction(sorter)) && isNullOrUndefined(dataIndex) ) {
|
|
485
|
+
if ((Array.isArray(filters) || isFunction(onFilter) || isFunction(sorter)) && isNullOrUndefined(dataIndex) ) {
|
|
486
486
|
logger.warn(`The column with sorter or filter must pass the 'dataIndex' prop`);
|
|
487
487
|
}
|
|
488
488
|
}
|
package/tagInput/tagInput.scss
CHANGED
|
@@ -259,6 +259,17 @@ $module: #{$prefix}-tagInput;
|
|
|
259
259
|
color: $color-tagInput_suffix-default;
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
+
|
|
263
|
+
&-tag-content-wrapper {
|
|
264
|
+
display: flex;
|
|
265
|
+
align-items: center;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
&-sortable-list {
|
|
269
|
+
display: flex;
|
|
270
|
+
flex-flow: row wrap;
|
|
271
|
+
width: 100%;
|
|
272
|
+
}
|
|
262
273
|
}
|
|
263
274
|
|
|
264
275
|
@import "./rtl.scss";
|
package/tooltip/foundation.ts
CHANGED
|
@@ -855,7 +855,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
855
855
|
position = this._adjustPos(position, true);
|
|
856
856
|
}
|
|
857
857
|
if (shouldReverseLeftSide && widthIsBigger) {
|
|
858
|
-
position = this._adjustPos(position
|
|
858
|
+
position = this._adjustPos(position);
|
|
859
859
|
}
|
|
860
860
|
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
861
861
|
position = this._adjustPos(position, true, 'reduce');
|
package/tree/treeUtil.ts
CHANGED
|
@@ -187,6 +187,9 @@ export function findKeysForValues(valueList: any, valueEntities: any, isMultiple
|
|
|
187
187
|
valueList.forEach((val: string) => {
|
|
188
188
|
if (val in valueEntities) {
|
|
189
189
|
res.push(valueEntities[val]);
|
|
190
|
+
} else {
|
|
191
|
+
// if val not in valueEntities, then value push to keys array
|
|
192
|
+
val && res.push(val);
|
|
190
193
|
}
|
|
191
194
|
});
|
|
192
195
|
|
|
@@ -427,12 +430,17 @@ export function normalizedArr(val: any) {
|
|
|
427
430
|
}
|
|
428
431
|
}
|
|
429
432
|
|
|
430
|
-
|
|
433
|
+
// flag is used to determine whether to return when the key does not belong to the keys in keyEntities
|
|
434
|
+
// export function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly = false) {
|
|
435
|
+
export function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly = false, flag?: boolean) {
|
|
431
436
|
const res: string[] = [];
|
|
432
437
|
const keyListSet = new Set(keyList);
|
|
433
438
|
if (!leafOnly) {
|
|
434
439
|
keyList.forEach((key: string) => {
|
|
435
440
|
if (!keyEntities[key]) {
|
|
441
|
+
if (flag) {
|
|
442
|
+
res.push(key);
|
|
443
|
+
}
|
|
436
444
|
return;
|
|
437
445
|
}
|
|
438
446
|
const { parent } = keyEntities[key];
|
|
@@ -446,6 +454,10 @@ export function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnl
|
|
|
446
454
|
if (keyEntities[key] && !isValid(keyEntities[key].children)) {
|
|
447
455
|
res.push(key);
|
|
448
456
|
}
|
|
457
|
+
// when key is not in keyEntities, if flag is true, key should be push in res
|
|
458
|
+
if (!keyEntities[key] && flag) {
|
|
459
|
+
res.push(key);
|
|
460
|
+
}
|
|
449
461
|
});
|
|
450
462
|
}
|
|
451
463
|
return res;
|
|
@@ -546,7 +558,7 @@ export function calcCheckedKeysForUnchecked(key: string, keyEntities: KeyEntitie
|
|
|
546
558
|
calcCurrLevel(par);
|
|
547
559
|
}
|
|
548
560
|
};
|
|
549
|
-
calcCurrLevel(nodeItem);
|
|
561
|
+
nodeItem && calcCurrLevel(nodeItem);
|
|
550
562
|
return {
|
|
551
563
|
checkedKeys,
|
|
552
564
|
halfCheckedKeys,
|
package/treeSelect/foundation.ts
CHANGED
|
@@ -262,6 +262,36 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
262
262
|
return Boolean(inputValue) && showFilteredOnly;
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
+
findDataForValue(findValue: string) {
|
|
266
|
+
const { value, defaultValue } = this.getProps();
|
|
267
|
+
let valueArr = [];
|
|
268
|
+
if (value) {
|
|
269
|
+
valueArr = Array.isArray(value) ? value : [value];
|
|
270
|
+
} else if (defaultValue) {
|
|
271
|
+
valueArr = Array.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
272
|
+
}
|
|
273
|
+
return valueArr.find(item => {
|
|
274
|
+
return item.value === findValue || item.key === findValue;
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
constructDataForValue(value: string) {
|
|
279
|
+
const { treeNodeLabelProp } = this.getProps();
|
|
280
|
+
return {
|
|
281
|
+
key: value,
|
|
282
|
+
[treeNodeLabelProp]: value
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
getDataForKeyNotInKeyEntities(value: string) {
|
|
287
|
+
const { onChangeWithObject } = this.getProps();
|
|
288
|
+
if (onChangeWithObject) {
|
|
289
|
+
return this.findDataForValue(value);
|
|
290
|
+
} else {
|
|
291
|
+
return this.constructDataForValue(value);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
265
295
|
getCopyFromState(items: string | string[]) {
|
|
266
296
|
const res = {};
|
|
267
297
|
normalizedArr(items).forEach(key => {
|
|
@@ -366,11 +396,11 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
366
396
|
const { leafOnly, checkRelation } = this.getProps();
|
|
367
397
|
let keyList = [];
|
|
368
398
|
if (checkRelation === 'related') {
|
|
369
|
-
keyList = normalizeKeyList(key, keyEntities, leafOnly);
|
|
399
|
+
keyList = normalizeKeyList(key, keyEntities, leafOnly, true);
|
|
370
400
|
} else if (checkRelation === 'unRelated') {
|
|
371
401
|
keyList = key as string[];
|
|
372
402
|
}
|
|
373
|
-
const nodes = keyList.map(
|
|
403
|
+
const nodes = keyList.map(key => (keyEntities[key] && keyEntities[key].data.key === key) ? keyEntities[key].data : this.getDataForKeyNotInKeyEntities(key));
|
|
374
404
|
if (this.getProp('onChangeWithObject')) {
|
|
375
405
|
this._adapter.notifyChangeWithObject(nodes, e);
|
|
376
406
|
} else {
|
|
@@ -498,7 +528,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
498
528
|
removeTag(eventKey: BasicTreeNodeData['key']) {
|
|
499
529
|
const { disableStrictly, checkRelation } = this.getProps();
|
|
500
530
|
const { keyEntities, disabledKeys, realCheckedKeys } = this.getStates();
|
|
501
|
-
const item = keyEntities[eventKey].data;
|
|
531
|
+
const item = (keyEntities[eventKey] && keyEntities[eventKey].data.key === eventKey) ? keyEntities[eventKey].data : this.getDataForKeyNotInKeyEntities(eventKey);
|
|
502
532
|
if (item.disabled || (disableStrictly && disabledKeys.has(eventKey))) {
|
|
503
533
|
return;
|
|
504
534
|
}
|
|
@@ -789,9 +819,11 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
789
819
|
const renderSelectedItem = isFunction(propRenderSelectedItem) ?
|
|
790
820
|
propRenderSelectedItem :
|
|
791
821
|
(item: BasicTreeNodeData) => get(item, treeNodeLabelProp, null);
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
822
|
+
let item;
|
|
823
|
+
if (selectedKeys.length) {
|
|
824
|
+
const key = selectedKeys[0];
|
|
825
|
+
item = (keyEntities[key] && keyEntities[key].data.key === key) ? keyEntities[key].data : this.getDataForKeyNotInKeyEntities(key);
|
|
826
|
+
}
|
|
795
827
|
const renderText = item && treeNodeLabelProp in item ? renderSelectedItem(item) : null;
|
|
796
828
|
return renderText;
|
|
797
829
|
}
|
|
@@ -171,23 +171,20 @@ $module: #{$prefix}-tree-select;
|
|
|
171
171
|
.#{$prefix}-tagInput {
|
|
172
172
|
border: hidden;
|
|
173
173
|
background: transparent;
|
|
174
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_default;
|
|
175
|
+
|
|
176
|
+
&-small {
|
|
177
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_small;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&-large {
|
|
181
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_large;
|
|
182
|
+
}
|
|
174
183
|
|
|
175
184
|
.#{$prefix}-tagInput-wrapper {
|
|
176
185
|
padding-left: $spacing-treeSelect_selection_tagInput_wrapper-paddingX;
|
|
177
186
|
padding-right: $spacing-treeSelect_selection_tagInput_wrapper-paddingX;
|
|
178
187
|
|
|
179
|
-
&-default {
|
|
180
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_default;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
&-small {
|
|
184
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_small;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
&-large {
|
|
188
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_large;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
188
|
.#{$prefix}-input-wrapper {
|
|
192
189
|
// height: $height-treeSelect_selection_tagInput_input_default;
|
|
193
190
|
|
|
@@ -205,13 +202,6 @@ $module: #{$prefix}-tree-select;
|
|
|
205
202
|
margin-bottom: $spacing-treeSelect_tag-marginY;
|
|
206
203
|
}
|
|
207
204
|
}
|
|
208
|
-
|
|
209
|
-
// .#{$prefix}-input-wrapper-small {
|
|
210
|
-
// height: $height-treeSelect_selection_tagInput_input_small;
|
|
211
|
-
// }
|
|
212
|
-
// .#{$prefix}-input-wrapper-large {
|
|
213
|
-
// height: $height-treeSelect_selection_tagInput_input_large;
|
|
214
|
-
// }
|
|
215
205
|
}
|
|
216
206
|
}
|
|
217
207
|
}
|