@douyinfe/semi-foundation 2.50.0 → 2.51.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/autoComplete/foundation.ts +10 -6
- package/breadcrumb/breadcrumb.scss +4 -0
- package/cascader/constants.ts +3 -1
- package/cascader/foundation.ts +11 -13
- package/cascader/util.ts +21 -10
- package/lib/cjs/autoComplete/foundation.js +10 -5
- package/lib/cjs/breadcrumb/breadcrumb.css +3 -0
- package/lib/cjs/breadcrumb/breadcrumb.scss +4 -0
- package/lib/cjs/cascader/constants.d.ts +1 -0
- package/lib/cjs/cascader/constants.js +4 -2
- package/lib/cjs/cascader/foundation.d.ts +10 -1
- package/lib/cjs/cascader/foundation.js +10 -9
- package/lib/cjs/cascader/util.d.ts +3 -1
- package/lib/cjs/cascader/util.js +20 -8
- package/lib/cjs/table/foundation.js +2 -1
- package/lib/cjs/tree/rtl.scss +16 -0
- package/lib/cjs/tree/tree.css +170 -0
- package/lib/cjs/tree/tree.scss +6 -0
- package/lib/es/autoComplete/foundation.js +10 -5
- package/lib/es/breadcrumb/breadcrumb.css +3 -0
- package/lib/es/breadcrumb/breadcrumb.scss +4 -0
- package/lib/es/cascader/constants.d.ts +1 -0
- package/lib/es/cascader/constants.js +2 -1
- package/lib/es/cascader/foundation.d.ts +10 -1
- package/lib/es/cascader/foundation.js +11 -10
- package/lib/es/cascader/util.d.ts +3 -1
- package/lib/es/cascader/util.js +18 -8
- package/lib/es/table/foundation.js +2 -1
- package/lib/es/tree/rtl.scss +16 -0
- package/lib/es/tree/tree.css +170 -0
- package/lib/es/tree/tree.scss +6 -0
- package/package.json +3 -3
- package/table/foundation.ts +2 -1
- package/tree/rtl.scss +16 -0
- package/tree/tree.scss +6 -0
|
@@ -235,7 +235,7 @@ class AutoCompleteFoundation<P = Record<string, any>, S = Record<string, any>> e
|
|
|
235
235
|
|
|
236
236
|
const options = this._generateList(data);
|
|
237
237
|
// Get the option whose value match from options
|
|
238
|
-
let selectedOption: StateOptionItem | Array<StateOptionItem> = options.filter(option => renderSelectedItem(option) === selectedValue);
|
|
238
|
+
let selectedOption: StateOptionItem | Array<StateOptionItem> = options.length ? options.filter(option => renderSelectedItem(option) === selectedValue) : [];
|
|
239
239
|
const canMatchInData = selectedOption.length;
|
|
240
240
|
|
|
241
241
|
const selectedOptionIndex = options.findIndex(option => renderSelectedItem(option) === selectedValue);
|
|
@@ -262,11 +262,13 @@ class AutoCompleteFoundation<P = Record<string, any>, S = Record<string, any>> e
|
|
|
262
262
|
|
|
263
263
|
let { data, defaultActiveFirstOption } = this.getProps();
|
|
264
264
|
|
|
265
|
-
let
|
|
266
|
-
|
|
267
|
-
const options = this._generateList(data);
|
|
265
|
+
let selectedOptionIndex = -1;
|
|
268
266
|
|
|
269
|
-
|
|
267
|
+
if (searchValue) {
|
|
268
|
+
let renderSelectedItem = this._getRenderSelectedItem();
|
|
269
|
+
const options = this._generateList(data);
|
|
270
|
+
selectedOptionIndex = options.findIndex(option => renderSelectedItem(option) === searchValue);
|
|
271
|
+
}
|
|
270
272
|
|
|
271
273
|
if (selectedOptionIndex === -1 && defaultActiveFirstOption) {
|
|
272
274
|
if (focusIndex !== 0) {
|
|
@@ -288,7 +290,9 @@ class AutoCompleteFoundation<P = Record<string, any>, S = Record<string, any>> e
|
|
|
288
290
|
let { renderSelectedItem } = this.getProps();
|
|
289
291
|
|
|
290
292
|
if (typeof renderSelectedItem === 'undefined') {
|
|
291
|
-
renderSelectedItem = (option: any) =>
|
|
293
|
+
renderSelectedItem = (option: any) => {
|
|
294
|
+
return option?.value;
|
|
295
|
+
};
|
|
292
296
|
} else if (renderSelectedItem && typeof renderSelectedItem === 'function') {
|
|
293
297
|
// do nothing
|
|
294
298
|
}
|
package/cascader/constants.ts
CHANGED
package/cascader/foundation.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isEqual, get, difference, isUndefined, assign, cloneDeep, isEmpty, isNumber, includes, isFunction } from 'lodash';
|
|
1
|
+
import { isEqual, get, difference, isUndefined, assign, cloneDeep, isEmpty, isNumber, includes, isFunction, isObject } from 'lodash';
|
|
2
2
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
3
3
|
import {
|
|
4
4
|
filter,
|
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
import { Motion } from '../utils/type';
|
|
13
13
|
import {
|
|
14
14
|
convertDataToEntities,
|
|
15
|
-
findKeysForValues,
|
|
16
15
|
normalizedArr,
|
|
17
16
|
isValid,
|
|
18
|
-
calcMergeType
|
|
17
|
+
calcMergeType,
|
|
18
|
+
getKeysByValuePath
|
|
19
19
|
} from './util';
|
|
20
20
|
import { strings } from './constants';
|
|
21
21
|
import isEnterPress from '../utils/isEnterPress';
|
|
@@ -439,14 +439,14 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
|
|
|
439
439
|
const loadingKeys = this._adapter.getLoadingKeyRefValue();
|
|
440
440
|
const filterable = this._isFilterable();
|
|
441
441
|
const loadingActive = [...activeKeys].filter(i => loadingKeys.has(i));
|
|
442
|
-
|
|
443
|
-
const valuePath = onChangeWithObject
|
|
444
|
-
const selectedKeys =
|
|
442
|
+
const normalizedValue = normalizedArr(value);
|
|
443
|
+
const valuePath = onChangeWithObject && isObject(normalizedValue[0]) ? normalizedValue.map(i => i.value) : normalizedValue;
|
|
444
|
+
const selectedKeys = getKeysByValuePath(valuePath);
|
|
445
445
|
let updateStates: Partial<BasicCascaderInnerData> = {};
|
|
446
446
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
447
|
+
const selectedKey = selectedKeys.length > 0 ? selectedKeys[0] : undefined;
|
|
448
|
+
const selectedItem = selectedKey ? keyEntities[selectedKey] : undefined;
|
|
449
|
+
if (selectedItem) {
|
|
450
450
|
/**
|
|
451
451
|
* When changeOnSelect is turned on, or the target option is a leaf option,
|
|
452
452
|
* the option is considered to be selected, even if the option is disabled
|
|
@@ -874,10 +874,8 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
|
|
|
874
874
|
const { keyEntities } = this.getStates();
|
|
875
875
|
const values: (string | number)[] = [];
|
|
876
876
|
keys.forEach(key => {
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
values.push(valueItem);
|
|
880
|
-
}
|
|
877
|
+
const valueItem = keyEntities[key]?.data?.value;
|
|
878
|
+
valueItem !== undefined && values.push(valueItem);
|
|
881
879
|
});
|
|
882
880
|
const formatValue: number | string | Array<string | number> = values.length === 1 ?
|
|
883
881
|
values[0] :
|
package/cascader/util.ts
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
isUndefined,
|
|
4
4
|
isEqual
|
|
5
5
|
} from 'lodash';
|
|
6
|
-
import { strings } from './constants';
|
|
6
|
+
import { strings, VALUE_SPLIT } from './constants';
|
|
7
7
|
|
|
8
8
|
function getPosition(level: any, index: any) {
|
|
9
9
|
return `${level}-${index}`;
|
|
@@ -30,7 +30,7 @@ function traverseDataNodes(treeNodes: any, callback: any) {
|
|
|
30
30
|
let item: any = null;
|
|
31
31
|
// Process node if is not root
|
|
32
32
|
if (node) {
|
|
33
|
-
const key = parent ?
|
|
33
|
+
const key = parent ? `${parent.key}${VALUE_SPLIT}${node.value}` : node.value;
|
|
34
34
|
item = {
|
|
35
35
|
data: { ...node },
|
|
36
36
|
ind,
|
|
@@ -55,6 +55,25 @@ function traverseDataNodes(treeNodes: any, callback: any) {
|
|
|
55
55
|
processNode(null);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
export function getKeysByValuePath(valuePath: (string | number)[][] | (string | number)[]) {
|
|
59
|
+
if (valuePath?.length) {
|
|
60
|
+
if (Array.isArray(valuePath[0])) {
|
|
61
|
+
return valuePath.map((item) => getKeyByValuePath(item));
|
|
62
|
+
} else {
|
|
63
|
+
return [getKeyByValuePath(valuePath as (string | number)[])];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function getKeyByValuePath(valuePath: (string | number)[]) {
|
|
70
|
+
return valuePath.join(VALUE_SPLIT);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function getValuePathByKey(key: string) {
|
|
74
|
+
return key.split(VALUE_SPLIT);
|
|
75
|
+
}
|
|
76
|
+
|
|
58
77
|
export function convertDataToEntities(dataNodes: any) {
|
|
59
78
|
const keyEntities: any = {};
|
|
60
79
|
|
|
@@ -74,14 +93,6 @@ export function convertDataToEntities(dataNodes: any) {
|
|
|
74
93
|
return keyEntities;
|
|
75
94
|
}
|
|
76
95
|
|
|
77
|
-
export function findKeysForValues(value: any, keyEntities: any) {
|
|
78
|
-
const valuePath = normalizedArr(value);
|
|
79
|
-
const res = Object.values(keyEntities)
|
|
80
|
-
.filter((item: any) => isEqual(item.valuePath, valuePath))
|
|
81
|
-
.map((item: any) => item.key);
|
|
82
|
-
return res;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
96
|
export function calcMergeType(autoMergeValue: boolean, leafOnly: boolean): string {
|
|
86
97
|
let mergeType: string;
|
|
87
98
|
if (leafOnly) {
|
|
@@ -205,7 +205,7 @@ class AutoCompleteFoundation extends _foundation.default {
|
|
|
205
205
|
let renderSelectedItem = this._getRenderSelectedItem();
|
|
206
206
|
const options = this._generateList(data);
|
|
207
207
|
// Get the option whose value match from options
|
|
208
|
-
let selectedOption = options.filter(option => renderSelectedItem(option) === selectedValue);
|
|
208
|
+
let selectedOption = options.length ? options.filter(option => renderSelectedItem(option) === selectedValue) : [];
|
|
209
209
|
const canMatchInData = selectedOption.length;
|
|
210
210
|
const selectedOptionIndex = options.findIndex(option => renderSelectedItem(option) === selectedValue);
|
|
211
211
|
let inputValue = '';
|
|
@@ -235,9 +235,12 @@ class AutoCompleteFoundation extends _foundation.default {
|
|
|
235
235
|
data,
|
|
236
236
|
defaultActiveFirstOption
|
|
237
237
|
} = this.getProps();
|
|
238
|
-
let
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
let selectedOptionIndex = -1;
|
|
239
|
+
if (searchValue) {
|
|
240
|
+
let renderSelectedItem = this._getRenderSelectedItem();
|
|
241
|
+
const options = this._generateList(data);
|
|
242
|
+
selectedOptionIndex = options.findIndex(option => renderSelectedItem(option) === searchValue);
|
|
243
|
+
}
|
|
241
244
|
if (selectedOptionIndex === -1 && defaultActiveFirstOption) {
|
|
242
245
|
if (focusIndex !== 0) {
|
|
243
246
|
this._adapter.updateFocusIndex(0);
|
|
@@ -259,7 +262,9 @@ class AutoCompleteFoundation extends _foundation.default {
|
|
|
259
262
|
renderSelectedItem
|
|
260
263
|
} = this.getProps();
|
|
261
264
|
if (typeof renderSelectedItem === 'undefined') {
|
|
262
|
-
renderSelectedItem = option =>
|
|
265
|
+
renderSelectedItem = option => {
|
|
266
|
+
return option === null || option === void 0 ? void 0 : option.value;
|
|
267
|
+
};
|
|
263
268
|
} else if (renderSelectedItem && typeof renderSelectedItem === 'function') {
|
|
264
269
|
// do nothing
|
|
265
270
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.strings = exports.numbers = exports.cssClasses = void 0;
|
|
6
|
+
exports.strings = exports.numbers = exports.cssClasses = exports.VALUE_SPLIT = void 0;
|
|
7
7
|
var _constants = require("../base/constants");
|
|
8
8
|
const cssClasses = {
|
|
9
9
|
PREFIX: `${_constants.BASE_CLASS_PREFIX}-cascader`,
|
|
@@ -24,4 +24,6 @@ const strings = {
|
|
|
24
24
|
};
|
|
25
25
|
exports.strings = strings;
|
|
26
26
|
const numbers = {};
|
|
27
|
-
exports.numbers = numbers;
|
|
27
|
+
exports.numbers = numbers;
|
|
28
|
+
const VALUE_SPLIT = '_SEMI_CASCADER_SPLIT_';
|
|
29
|
+
exports.VALUE_SPLIT = VALUE_SPLIT;
|
|
@@ -239,7 +239,16 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
|
|
|
239
239
|
* @param {boolean} curCheckedStatus checked status of node
|
|
240
240
|
*/
|
|
241
241
|
calcCheckedKeys(key: string, curCheckedStatus: boolean): {
|
|
242
|
-
checkedKeys: Set<string>;
|
|
242
|
+
checkedKeys: Set<string>; /**
|
|
243
|
+
* If selectedKeys does not meet the update conditions,
|
|
244
|
+
* and state.selectedKeys is the same as selectedKeys
|
|
245
|
+
* at this time, state.selectedKeys should be cleared.
|
|
246
|
+
* A typical scenario is:
|
|
247
|
+
* The originally selected node is the leaf node, but
|
|
248
|
+
* after props.treeData is dynamically updated, the node
|
|
249
|
+
* is a non-leaf node. At this point, selectedKeys should
|
|
250
|
+
* be cleared.
|
|
251
|
+
*/
|
|
243
252
|
halfCheckedKeys: Set<string>;
|
|
244
253
|
};
|
|
245
254
|
handleInputChange(sugInput: string): void;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _isObject2 = _interopRequireDefault(require("lodash/isObject"));
|
|
7
8
|
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
|
8
9
|
var _includes2 = _interopRequireDefault(require("lodash/includes"));
|
|
9
10
|
var _isNumber2 = _interopRequireDefault(require("lodash/isNumber"));
|
|
@@ -227,12 +228,13 @@ class CascaderFoundation extends _foundation.default {
|
|
|
227
228
|
const loadingKeys = this._adapter.getLoadingKeyRefValue();
|
|
228
229
|
const filterable = this._isFilterable();
|
|
229
230
|
const loadingActive = [...activeKeys].filter(i => loadingKeys.has(i));
|
|
230
|
-
const
|
|
231
|
-
const
|
|
231
|
+
const normalizedValue = (0, _util.normalizedArr)(value);
|
|
232
|
+
const valuePath = onChangeWithObject && (0, _isObject2.default)(normalizedValue[0]) ? normalizedValue.map(i => i.value) : normalizedValue;
|
|
233
|
+
const selectedKeys = (0, _util.getKeysByValuePath)(valuePath);
|
|
232
234
|
let updateStates = {};
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
235
|
+
const selectedKey = selectedKeys.length > 0 ? selectedKeys[0] : undefined;
|
|
236
|
+
const selectedItem = selectedKey ? keyEntities[selectedKey] : undefined;
|
|
237
|
+
if (selectedItem) {
|
|
236
238
|
/**
|
|
237
239
|
* When changeOnSelect is turned on, or the target option is a leaf option,
|
|
238
240
|
* the option is considered to be selected, even if the option is disabled
|
|
@@ -692,10 +694,9 @@ class CascaderFoundation extends _foundation.default {
|
|
|
692
694
|
} = this.getStates();
|
|
693
695
|
const values = [];
|
|
694
696
|
keys.forEach(key => {
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
}
|
|
697
|
+
var _a, _b;
|
|
698
|
+
const valueItem = (_b = (_a = keyEntities[key]) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.value;
|
|
699
|
+
valueItem !== undefined && values.push(valueItem);
|
|
699
700
|
});
|
|
700
701
|
const formatValue = values.length === 1 ? values[0] : values;
|
|
701
702
|
this._adapter.notifySelect(formatValue);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare function isValid(val: any): boolean;
|
|
2
2
|
export declare function normalizedArr(val: any): any[];
|
|
3
|
+
export declare function getKeysByValuePath(valuePath: (string | number)[][] | (string | number)[]): string[];
|
|
4
|
+
export declare function getKeyByValuePath(valuePath: (string | number)[]): string;
|
|
5
|
+
export declare function getValuePathByKey(key: string): string[];
|
|
3
6
|
export declare function convertDataToEntities(dataNodes: any): any;
|
|
4
|
-
export declare function findKeysForValues(value: any, keyEntities: any): any[];
|
|
5
7
|
export declare function calcMergeType(autoMergeValue: boolean, leafOnly: boolean): string;
|
package/lib/cjs/cascader/util.js
CHANGED
|
@@ -5,10 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.calcMergeType = calcMergeType;
|
|
7
7
|
exports.convertDataToEntities = convertDataToEntities;
|
|
8
|
-
exports.
|
|
8
|
+
exports.getKeyByValuePath = getKeyByValuePath;
|
|
9
|
+
exports.getKeysByValuePath = getKeysByValuePath;
|
|
10
|
+
exports.getValuePathByKey = getValuePathByKey;
|
|
9
11
|
exports.isValid = isValid;
|
|
10
12
|
exports.normalizedArr = normalizedArr;
|
|
11
|
-
var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
|
|
12
13
|
var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
|
|
13
14
|
var _isNull2 = _interopRequireDefault(require("lodash/isNull"));
|
|
14
15
|
var _constants = require("./constants");
|
|
@@ -35,7 +36,7 @@ function traverseDataNodes(treeNodes, callback) {
|
|
|
35
36
|
let item = null;
|
|
36
37
|
// Process node if is not root
|
|
37
38
|
if (node) {
|
|
38
|
-
const key = parent ?
|
|
39
|
+
const key = parent ? `${parent.key}${_constants.VALUE_SPLIT}${node.value}` : node.value;
|
|
39
40
|
item = {
|
|
40
41
|
data: Object.assign({}, node),
|
|
41
42
|
ind,
|
|
@@ -56,6 +57,22 @@ function traverseDataNodes(treeNodes, callback) {
|
|
|
56
57
|
};
|
|
57
58
|
processNode(null);
|
|
58
59
|
}
|
|
60
|
+
function getKeysByValuePath(valuePath) {
|
|
61
|
+
if (valuePath === null || valuePath === void 0 ? void 0 : valuePath.length) {
|
|
62
|
+
if (Array.isArray(valuePath[0])) {
|
|
63
|
+
return valuePath.map(item => getKeyByValuePath(item));
|
|
64
|
+
} else {
|
|
65
|
+
return [getKeyByValuePath(valuePath)];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
function getKeyByValuePath(valuePath) {
|
|
71
|
+
return valuePath.join(_constants.VALUE_SPLIT);
|
|
72
|
+
}
|
|
73
|
+
function getValuePathByKey(key) {
|
|
74
|
+
return key.split(_constants.VALUE_SPLIT);
|
|
75
|
+
}
|
|
59
76
|
function convertDataToEntities(dataNodes) {
|
|
60
77
|
const keyEntities = {};
|
|
61
78
|
traverseDataNodes(dataNodes, data => {
|
|
@@ -74,11 +91,6 @@ function convertDataToEntities(dataNodes) {
|
|
|
74
91
|
});
|
|
75
92
|
return keyEntities;
|
|
76
93
|
}
|
|
77
|
-
function findKeysForValues(value, keyEntities) {
|
|
78
|
-
const valuePath = normalizedArr(value);
|
|
79
|
-
const res = Object.values(keyEntities).filter(item => (0, _isEqual2.default)(item.valuePath, valuePath)).map(item => item.key);
|
|
80
|
-
return res;
|
|
81
|
-
}
|
|
82
94
|
function calcMergeType(autoMergeValue, leafOnly) {
|
|
83
95
|
let mergeType;
|
|
84
96
|
if (leafOnly) {
|
package/lib/cjs/tree/rtl.scss
CHANGED
|
@@ -20,6 +20,8 @@ $module: #{$prefix}-tree;
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.#{$module}-option {
|
|
23
|
+
padding-left: 0;
|
|
24
|
+
padding-right: $spacing-tree_option_level1-paddingLeft;
|
|
23
25
|
&-label {
|
|
24
26
|
& > .#{$prefix}-icon {
|
|
25
27
|
margin-right: 0;
|
|
@@ -39,10 +41,24 @@ $module: #{$prefix}-tree;
|
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
|
|
44
|
+
@for $i from 1 through 20 {
|
|
45
|
+
li.#{$module}-option.#{$module}-option-fullLabel-level-#{$i} {
|
|
46
|
+
padding-left: 0;
|
|
47
|
+
padding-right: $spacing-tree_option_level-paddingLeft * ($i - 1) + $spacing-tree_option_level1-paddingLeft;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
42
51
|
.#{$module}-option-label-empty {
|
|
43
52
|
padding-left: auto;
|
|
44
53
|
padding-right: 0;
|
|
45
54
|
}
|
|
55
|
+
|
|
56
|
+
.#{$module}-option {
|
|
57
|
+
&-switcher {
|
|
58
|
+
margin-right: 0;
|
|
59
|
+
margin-left: $spacing-tree_icon-marginRight;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
46
62
|
}
|
|
47
63
|
|
|
48
64
|
.#{$module}-option-list-block {
|
package/lib/cjs/tree/tree.css
CHANGED
|
@@ -245,6 +245,66 @@
|
|
|
245
245
|
.semi-tree-option-list li.semi-tree-option-draggable.semi-tree-option .semi-tree-option-selected:hover, .semi-tree-option-list li.semi-tree-option-draggable.semi-tree-option .semi-tree-option-selected:active {
|
|
246
246
|
background-color: transparent;
|
|
247
247
|
}
|
|
248
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-1 {
|
|
249
|
+
padding-left: 8px;
|
|
250
|
+
}
|
|
251
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-2 {
|
|
252
|
+
padding-left: 28px;
|
|
253
|
+
}
|
|
254
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-3 {
|
|
255
|
+
padding-left: 48px;
|
|
256
|
+
}
|
|
257
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-4 {
|
|
258
|
+
padding-left: 68px;
|
|
259
|
+
}
|
|
260
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-5 {
|
|
261
|
+
padding-left: 88px;
|
|
262
|
+
}
|
|
263
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-6 {
|
|
264
|
+
padding-left: 108px;
|
|
265
|
+
}
|
|
266
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-7 {
|
|
267
|
+
padding-left: 128px;
|
|
268
|
+
}
|
|
269
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-8 {
|
|
270
|
+
padding-left: 148px;
|
|
271
|
+
}
|
|
272
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-9 {
|
|
273
|
+
padding-left: 168px;
|
|
274
|
+
}
|
|
275
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-10 {
|
|
276
|
+
padding-left: 188px;
|
|
277
|
+
}
|
|
278
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-11 {
|
|
279
|
+
padding-left: 208px;
|
|
280
|
+
}
|
|
281
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-12 {
|
|
282
|
+
padding-left: 228px;
|
|
283
|
+
}
|
|
284
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-13 {
|
|
285
|
+
padding-left: 248px;
|
|
286
|
+
}
|
|
287
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-14 {
|
|
288
|
+
padding-left: 268px;
|
|
289
|
+
}
|
|
290
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-15 {
|
|
291
|
+
padding-left: 288px;
|
|
292
|
+
}
|
|
293
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-16 {
|
|
294
|
+
padding-left: 308px;
|
|
295
|
+
}
|
|
296
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-17 {
|
|
297
|
+
padding-left: 328px;
|
|
298
|
+
}
|
|
299
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-18 {
|
|
300
|
+
padding-left: 348px;
|
|
301
|
+
}
|
|
302
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-19 {
|
|
303
|
+
padding-left: 368px;
|
|
304
|
+
}
|
|
305
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-20 {
|
|
306
|
+
padding-left: 388px;
|
|
307
|
+
}
|
|
248
308
|
.semi-tree-option-list .semi-tree-option-empty:hover, .semi-tree-option-list .semi-tree-option-empty:active {
|
|
249
309
|
background-color: transparent;
|
|
250
310
|
}
|
|
@@ -350,6 +410,11 @@
|
|
|
350
410
|
margin-right: 0;
|
|
351
411
|
margin-left: 8px;
|
|
352
412
|
}
|
|
413
|
+
.semi-rtl .semi-tree-option-list .semi-tree-option,
|
|
414
|
+
.semi-popover-rtl .semi-tree-option-list .semi-tree-option {
|
|
415
|
+
padding-left: 0;
|
|
416
|
+
padding-right: 8px;
|
|
417
|
+
}
|
|
353
418
|
.semi-rtl .semi-tree-option-list .semi-tree-option-label > .semi-icon,
|
|
354
419
|
.semi-popover-rtl .semi-tree-option-list .semi-tree-option-label > .semi-icon {
|
|
355
420
|
margin-right: 0;
|
|
@@ -364,11 +429,116 @@
|
|
|
364
429
|
.semi-popover-rtl .semi-tree-option-list .semi-tree-option-collapsed .semi-tree-option-expand-icon {
|
|
365
430
|
transform: rotate(90deg);
|
|
366
431
|
}
|
|
432
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-1,
|
|
433
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-1 {
|
|
434
|
+
padding-left: 0;
|
|
435
|
+
padding-right: 8px;
|
|
436
|
+
}
|
|
437
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-2,
|
|
438
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-2 {
|
|
439
|
+
padding-left: 0;
|
|
440
|
+
padding-right: 28px;
|
|
441
|
+
}
|
|
442
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-3,
|
|
443
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-3 {
|
|
444
|
+
padding-left: 0;
|
|
445
|
+
padding-right: 48px;
|
|
446
|
+
}
|
|
447
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-4,
|
|
448
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-4 {
|
|
449
|
+
padding-left: 0;
|
|
450
|
+
padding-right: 68px;
|
|
451
|
+
}
|
|
452
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-5,
|
|
453
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-5 {
|
|
454
|
+
padding-left: 0;
|
|
455
|
+
padding-right: 88px;
|
|
456
|
+
}
|
|
457
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-6,
|
|
458
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-6 {
|
|
459
|
+
padding-left: 0;
|
|
460
|
+
padding-right: 108px;
|
|
461
|
+
}
|
|
462
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-7,
|
|
463
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-7 {
|
|
464
|
+
padding-left: 0;
|
|
465
|
+
padding-right: 128px;
|
|
466
|
+
}
|
|
467
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-8,
|
|
468
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-8 {
|
|
469
|
+
padding-left: 0;
|
|
470
|
+
padding-right: 148px;
|
|
471
|
+
}
|
|
472
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-9,
|
|
473
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-9 {
|
|
474
|
+
padding-left: 0;
|
|
475
|
+
padding-right: 168px;
|
|
476
|
+
}
|
|
477
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-10,
|
|
478
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-10 {
|
|
479
|
+
padding-left: 0;
|
|
480
|
+
padding-right: 188px;
|
|
481
|
+
}
|
|
482
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-11,
|
|
483
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-11 {
|
|
484
|
+
padding-left: 0;
|
|
485
|
+
padding-right: 208px;
|
|
486
|
+
}
|
|
487
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-12,
|
|
488
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-12 {
|
|
489
|
+
padding-left: 0;
|
|
490
|
+
padding-right: 228px;
|
|
491
|
+
}
|
|
492
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-13,
|
|
493
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-13 {
|
|
494
|
+
padding-left: 0;
|
|
495
|
+
padding-right: 248px;
|
|
496
|
+
}
|
|
497
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-14,
|
|
498
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-14 {
|
|
499
|
+
padding-left: 0;
|
|
500
|
+
padding-right: 268px;
|
|
501
|
+
}
|
|
502
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-15,
|
|
503
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-15 {
|
|
504
|
+
padding-left: 0;
|
|
505
|
+
padding-right: 288px;
|
|
506
|
+
}
|
|
507
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-16,
|
|
508
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-16 {
|
|
509
|
+
padding-left: 0;
|
|
510
|
+
padding-right: 308px;
|
|
511
|
+
}
|
|
512
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-17,
|
|
513
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-17 {
|
|
514
|
+
padding-left: 0;
|
|
515
|
+
padding-right: 328px;
|
|
516
|
+
}
|
|
517
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-18,
|
|
518
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-18 {
|
|
519
|
+
padding-left: 0;
|
|
520
|
+
padding-right: 348px;
|
|
521
|
+
}
|
|
522
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-19,
|
|
523
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-19 {
|
|
524
|
+
padding-left: 0;
|
|
525
|
+
padding-right: 368px;
|
|
526
|
+
}
|
|
527
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-20,
|
|
528
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-20 {
|
|
529
|
+
padding-left: 0;
|
|
530
|
+
padding-right: 388px;
|
|
531
|
+
}
|
|
367
532
|
.semi-rtl .semi-tree-option-list .semi-tree-option-label-empty,
|
|
368
533
|
.semi-popover-rtl .semi-tree-option-list .semi-tree-option-label-empty {
|
|
369
534
|
padding-left: auto;
|
|
370
535
|
padding-right: 0;
|
|
371
536
|
}
|
|
537
|
+
.semi-rtl .semi-tree-option-list .semi-tree-option-switcher,
|
|
538
|
+
.semi-popover-rtl .semi-tree-option-list .semi-tree-option-switcher {
|
|
539
|
+
margin-right: 0;
|
|
540
|
+
margin-left: 8px;
|
|
541
|
+
}
|
|
372
542
|
.semi-rtl .semi-tree-option-list-block,
|
|
373
543
|
.semi-popover-rtl .semi-tree-option-list-block {
|
|
374
544
|
direction: rtl;
|
package/lib/cjs/tree/tree.scss
CHANGED
|
@@ -329,6 +329,12 @@ $module: #{$prefix}-tree;
|
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
+
@for $i from 1 through 20 {
|
|
333
|
+
li.#{$module}-option.#{$module}-option-fullLabel-level-#{$i} {
|
|
334
|
+
padding-left: $spacing-tree_option_level-paddingLeft * ($i - 1) + $spacing-tree_option_level1-paddingLeft;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
332
338
|
.#{$module}-option-empty {
|
|
333
339
|
&:hover,
|
|
334
340
|
&:active {
|
|
@@ -198,7 +198,7 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
198
198
|
let renderSelectedItem = this._getRenderSelectedItem();
|
|
199
199
|
const options = this._generateList(data);
|
|
200
200
|
// Get the option whose value match from options
|
|
201
|
-
let selectedOption = options.filter(option => renderSelectedItem(option) === selectedValue);
|
|
201
|
+
let selectedOption = options.length ? options.filter(option => renderSelectedItem(option) === selectedValue) : [];
|
|
202
202
|
const canMatchInData = selectedOption.length;
|
|
203
203
|
const selectedOptionIndex = options.findIndex(option => renderSelectedItem(option) === selectedValue);
|
|
204
204
|
let inputValue = '';
|
|
@@ -228,9 +228,12 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
228
228
|
data,
|
|
229
229
|
defaultActiveFirstOption
|
|
230
230
|
} = this.getProps();
|
|
231
|
-
let
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
let selectedOptionIndex = -1;
|
|
232
|
+
if (searchValue) {
|
|
233
|
+
let renderSelectedItem = this._getRenderSelectedItem();
|
|
234
|
+
const options = this._generateList(data);
|
|
235
|
+
selectedOptionIndex = options.findIndex(option => renderSelectedItem(option) === searchValue);
|
|
236
|
+
}
|
|
234
237
|
if (selectedOptionIndex === -1 && defaultActiveFirstOption) {
|
|
235
238
|
if (focusIndex !== 0) {
|
|
236
239
|
this._adapter.updateFocusIndex(0);
|
|
@@ -252,7 +255,9 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
252
255
|
renderSelectedItem
|
|
253
256
|
} = this.getProps();
|
|
254
257
|
if (typeof renderSelectedItem === 'undefined') {
|
|
255
|
-
renderSelectedItem = option =>
|
|
258
|
+
renderSelectedItem = option => {
|
|
259
|
+
return option === null || option === void 0 ? void 0 : option.value;
|
|
260
|
+
};
|
|
256
261
|
} else if (renderSelectedItem && typeof renderSelectedItem === 'function') {
|
|
257
262
|
// do nothing
|
|
258
263
|
}
|
|
@@ -239,7 +239,16 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
|
|
|
239
239
|
* @param {boolean} curCheckedStatus checked status of node
|
|
240
240
|
*/
|
|
241
241
|
calcCheckedKeys(key: string, curCheckedStatus: boolean): {
|
|
242
|
-
checkedKeys: Set<string>;
|
|
242
|
+
checkedKeys: Set<string>; /**
|
|
243
|
+
* If selectedKeys does not meet the update conditions,
|
|
244
|
+
* and state.selectedKeys is the same as selectedKeys
|
|
245
|
+
* at this time, state.selectedKeys should be cleared.
|
|
246
|
+
* A typical scenario is:
|
|
247
|
+
* The originally selected node is the leaf node, but
|
|
248
|
+
* after props.treeData is dynamically updated, the node
|
|
249
|
+
* is a non-leaf node. At this point, selectedKeys should
|
|
250
|
+
* be cleared.
|
|
251
|
+
*/
|
|
243
252
|
halfCheckedKeys: Set<string>;
|
|
244
253
|
};
|
|
245
254
|
handleInputChange(sugInput: string): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _isObject from "lodash/isObject";
|
|
1
2
|
import _isFunction from "lodash/isFunction";
|
|
2
3
|
import _includes from "lodash/includes";
|
|
3
4
|
import _isNumber from "lodash/isNumber";
|
|
@@ -10,7 +11,7 @@ import _get from "lodash/get";
|
|
|
10
11
|
import _isEqual from "lodash/isEqual";
|
|
11
12
|
import BaseFoundation from '../base/foundation';
|
|
12
13
|
import { filter, findAncestorKeys, calcCheckedKeysForUnchecked, calcCheckedKeysForChecked, calcCheckedKeys, findDescendantKeys, normalizeKeyList } from '../tree/treeUtil';
|
|
13
|
-
import { convertDataToEntities,
|
|
14
|
+
import { convertDataToEntities, normalizedArr, isValid, calcMergeType, getKeysByValuePath } from './util';
|
|
14
15
|
import { strings } from './constants';
|
|
15
16
|
import isEnterPress from '../utils/isEnterPress';
|
|
16
17
|
export default class CascaderFoundation extends BaseFoundation {
|
|
@@ -220,12 +221,13 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
220
221
|
const loadingKeys = this._adapter.getLoadingKeyRefValue();
|
|
221
222
|
const filterable = this._isFilterable();
|
|
222
223
|
const loadingActive = [...activeKeys].filter(i => loadingKeys.has(i));
|
|
223
|
-
const
|
|
224
|
-
const
|
|
224
|
+
const normalizedValue = normalizedArr(value);
|
|
225
|
+
const valuePath = onChangeWithObject && _isObject(normalizedValue[0]) ? normalizedValue.map(i => i.value) : normalizedValue;
|
|
226
|
+
const selectedKeys = getKeysByValuePath(valuePath);
|
|
225
227
|
let updateStates = {};
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
228
|
+
const selectedKey = selectedKeys.length > 0 ? selectedKeys[0] : undefined;
|
|
229
|
+
const selectedItem = selectedKey ? keyEntities[selectedKey] : undefined;
|
|
230
|
+
if (selectedItem) {
|
|
229
231
|
/**
|
|
230
232
|
* When changeOnSelect is turned on, or the target option is a leaf option,
|
|
231
233
|
* the option is considered to be selected, even if the option is disabled
|
|
@@ -685,10 +687,9 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
685
687
|
} = this.getStates();
|
|
686
688
|
const values = [];
|
|
687
689
|
keys.forEach(key => {
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
}
|
|
690
|
+
var _a, _b;
|
|
691
|
+
const valueItem = (_b = (_a = keyEntities[key]) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.value;
|
|
692
|
+
valueItem !== undefined && values.push(valueItem);
|
|
692
693
|
});
|
|
693
694
|
const formatValue = values.length === 1 ? values[0] : values;
|
|
694
695
|
this._adapter.notifySelect(formatValue);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare function isValid(val: any): boolean;
|
|
2
2
|
export declare function normalizedArr(val: any): any[];
|
|
3
|
+
export declare function getKeysByValuePath(valuePath: (string | number)[][] | (string | number)[]): string[];
|
|
4
|
+
export declare function getKeyByValuePath(valuePath: (string | number)[]): string;
|
|
5
|
+
export declare function getValuePathByKey(key: string): string[];
|
|
3
6
|
export declare function convertDataToEntities(dataNodes: any): any;
|
|
4
|
-
export declare function findKeysForValues(value: any, keyEntities: any): any[];
|
|
5
7
|
export declare function calcMergeType(autoMergeValue: boolean, leafOnly: boolean): string;
|
package/lib/es/cascader/util.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import _isEqual from "lodash/isEqual";
|
|
2
1
|
import _isUndefined from "lodash/isUndefined";
|
|
3
2
|
import _isNull from "lodash/isNull";
|
|
4
|
-
import { strings } from './constants';
|
|
3
|
+
import { strings, VALUE_SPLIT } from './constants';
|
|
5
4
|
function getPosition(level, index) {
|
|
6
5
|
return `${level}-${index}`;
|
|
7
6
|
}
|
|
@@ -24,7 +23,7 @@ function traverseDataNodes(treeNodes, callback) {
|
|
|
24
23
|
let item = null;
|
|
25
24
|
// Process node if is not root
|
|
26
25
|
if (node) {
|
|
27
|
-
const key = parent ?
|
|
26
|
+
const key = parent ? `${parent.key}${VALUE_SPLIT}${node.value}` : node.value;
|
|
28
27
|
item = {
|
|
29
28
|
data: Object.assign({}, node),
|
|
30
29
|
ind,
|
|
@@ -45,6 +44,22 @@ function traverseDataNodes(treeNodes, callback) {
|
|
|
45
44
|
};
|
|
46
45
|
processNode(null);
|
|
47
46
|
}
|
|
47
|
+
export function getKeysByValuePath(valuePath) {
|
|
48
|
+
if (valuePath === null || valuePath === void 0 ? void 0 : valuePath.length) {
|
|
49
|
+
if (Array.isArray(valuePath[0])) {
|
|
50
|
+
return valuePath.map(item => getKeyByValuePath(item));
|
|
51
|
+
} else {
|
|
52
|
+
return [getKeyByValuePath(valuePath)];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
export function getKeyByValuePath(valuePath) {
|
|
58
|
+
return valuePath.join(VALUE_SPLIT);
|
|
59
|
+
}
|
|
60
|
+
export function getValuePathByKey(key) {
|
|
61
|
+
return key.split(VALUE_SPLIT);
|
|
62
|
+
}
|
|
48
63
|
export function convertDataToEntities(dataNodes) {
|
|
49
64
|
const keyEntities = {};
|
|
50
65
|
traverseDataNodes(dataNodes, data => {
|
|
@@ -63,11 +78,6 @@ export function convertDataToEntities(dataNodes) {
|
|
|
63
78
|
});
|
|
64
79
|
return keyEntities;
|
|
65
80
|
}
|
|
66
|
-
export function findKeysForValues(value, keyEntities) {
|
|
67
|
-
const valuePath = normalizedArr(value);
|
|
68
|
-
const res = Object.values(keyEntities).filter(item => _isEqual(item.valuePath, valuePath)).map(item => item.key);
|
|
69
|
-
return res;
|
|
70
|
-
}
|
|
71
81
|
export function calcMergeType(autoMergeValue, leafOnly) {
|
|
72
82
|
let mergeType;
|
|
73
83
|
if (leafOnly) {
|
package/lib/es/tree/rtl.scss
CHANGED
|
@@ -20,6 +20,8 @@ $module: #{$prefix}-tree;
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.#{$module}-option {
|
|
23
|
+
padding-left: 0;
|
|
24
|
+
padding-right: $spacing-tree_option_level1-paddingLeft;
|
|
23
25
|
&-label {
|
|
24
26
|
& > .#{$prefix}-icon {
|
|
25
27
|
margin-right: 0;
|
|
@@ -39,10 +41,24 @@ $module: #{$prefix}-tree;
|
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
|
|
44
|
+
@for $i from 1 through 20 {
|
|
45
|
+
li.#{$module}-option.#{$module}-option-fullLabel-level-#{$i} {
|
|
46
|
+
padding-left: 0;
|
|
47
|
+
padding-right: $spacing-tree_option_level-paddingLeft * ($i - 1) + $spacing-tree_option_level1-paddingLeft;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
42
51
|
.#{$module}-option-label-empty {
|
|
43
52
|
padding-left: auto;
|
|
44
53
|
padding-right: 0;
|
|
45
54
|
}
|
|
55
|
+
|
|
56
|
+
.#{$module}-option {
|
|
57
|
+
&-switcher {
|
|
58
|
+
margin-right: 0;
|
|
59
|
+
margin-left: $spacing-tree_icon-marginRight;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
46
62
|
}
|
|
47
63
|
|
|
48
64
|
.#{$module}-option-list-block {
|
package/lib/es/tree/tree.css
CHANGED
|
@@ -245,6 +245,66 @@
|
|
|
245
245
|
.semi-tree-option-list li.semi-tree-option-draggable.semi-tree-option .semi-tree-option-selected:hover, .semi-tree-option-list li.semi-tree-option-draggable.semi-tree-option .semi-tree-option-selected:active {
|
|
246
246
|
background-color: transparent;
|
|
247
247
|
}
|
|
248
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-1 {
|
|
249
|
+
padding-left: 8px;
|
|
250
|
+
}
|
|
251
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-2 {
|
|
252
|
+
padding-left: 28px;
|
|
253
|
+
}
|
|
254
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-3 {
|
|
255
|
+
padding-left: 48px;
|
|
256
|
+
}
|
|
257
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-4 {
|
|
258
|
+
padding-left: 68px;
|
|
259
|
+
}
|
|
260
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-5 {
|
|
261
|
+
padding-left: 88px;
|
|
262
|
+
}
|
|
263
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-6 {
|
|
264
|
+
padding-left: 108px;
|
|
265
|
+
}
|
|
266
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-7 {
|
|
267
|
+
padding-left: 128px;
|
|
268
|
+
}
|
|
269
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-8 {
|
|
270
|
+
padding-left: 148px;
|
|
271
|
+
}
|
|
272
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-9 {
|
|
273
|
+
padding-left: 168px;
|
|
274
|
+
}
|
|
275
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-10 {
|
|
276
|
+
padding-left: 188px;
|
|
277
|
+
}
|
|
278
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-11 {
|
|
279
|
+
padding-left: 208px;
|
|
280
|
+
}
|
|
281
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-12 {
|
|
282
|
+
padding-left: 228px;
|
|
283
|
+
}
|
|
284
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-13 {
|
|
285
|
+
padding-left: 248px;
|
|
286
|
+
}
|
|
287
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-14 {
|
|
288
|
+
padding-left: 268px;
|
|
289
|
+
}
|
|
290
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-15 {
|
|
291
|
+
padding-left: 288px;
|
|
292
|
+
}
|
|
293
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-16 {
|
|
294
|
+
padding-left: 308px;
|
|
295
|
+
}
|
|
296
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-17 {
|
|
297
|
+
padding-left: 328px;
|
|
298
|
+
}
|
|
299
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-18 {
|
|
300
|
+
padding-left: 348px;
|
|
301
|
+
}
|
|
302
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-19 {
|
|
303
|
+
padding-left: 368px;
|
|
304
|
+
}
|
|
305
|
+
.semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-20 {
|
|
306
|
+
padding-left: 388px;
|
|
307
|
+
}
|
|
248
308
|
.semi-tree-option-list .semi-tree-option-empty:hover, .semi-tree-option-list .semi-tree-option-empty:active {
|
|
249
309
|
background-color: transparent;
|
|
250
310
|
}
|
|
@@ -350,6 +410,11 @@
|
|
|
350
410
|
margin-right: 0;
|
|
351
411
|
margin-left: 8px;
|
|
352
412
|
}
|
|
413
|
+
.semi-rtl .semi-tree-option-list .semi-tree-option,
|
|
414
|
+
.semi-popover-rtl .semi-tree-option-list .semi-tree-option {
|
|
415
|
+
padding-left: 0;
|
|
416
|
+
padding-right: 8px;
|
|
417
|
+
}
|
|
353
418
|
.semi-rtl .semi-tree-option-list .semi-tree-option-label > .semi-icon,
|
|
354
419
|
.semi-popover-rtl .semi-tree-option-list .semi-tree-option-label > .semi-icon {
|
|
355
420
|
margin-right: 0;
|
|
@@ -364,11 +429,116 @@
|
|
|
364
429
|
.semi-popover-rtl .semi-tree-option-list .semi-tree-option-collapsed .semi-tree-option-expand-icon {
|
|
365
430
|
transform: rotate(90deg);
|
|
366
431
|
}
|
|
432
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-1,
|
|
433
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-1 {
|
|
434
|
+
padding-left: 0;
|
|
435
|
+
padding-right: 8px;
|
|
436
|
+
}
|
|
437
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-2,
|
|
438
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-2 {
|
|
439
|
+
padding-left: 0;
|
|
440
|
+
padding-right: 28px;
|
|
441
|
+
}
|
|
442
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-3,
|
|
443
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-3 {
|
|
444
|
+
padding-left: 0;
|
|
445
|
+
padding-right: 48px;
|
|
446
|
+
}
|
|
447
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-4,
|
|
448
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-4 {
|
|
449
|
+
padding-left: 0;
|
|
450
|
+
padding-right: 68px;
|
|
451
|
+
}
|
|
452
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-5,
|
|
453
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-5 {
|
|
454
|
+
padding-left: 0;
|
|
455
|
+
padding-right: 88px;
|
|
456
|
+
}
|
|
457
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-6,
|
|
458
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-6 {
|
|
459
|
+
padding-left: 0;
|
|
460
|
+
padding-right: 108px;
|
|
461
|
+
}
|
|
462
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-7,
|
|
463
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-7 {
|
|
464
|
+
padding-left: 0;
|
|
465
|
+
padding-right: 128px;
|
|
466
|
+
}
|
|
467
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-8,
|
|
468
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-8 {
|
|
469
|
+
padding-left: 0;
|
|
470
|
+
padding-right: 148px;
|
|
471
|
+
}
|
|
472
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-9,
|
|
473
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-9 {
|
|
474
|
+
padding-left: 0;
|
|
475
|
+
padding-right: 168px;
|
|
476
|
+
}
|
|
477
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-10,
|
|
478
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-10 {
|
|
479
|
+
padding-left: 0;
|
|
480
|
+
padding-right: 188px;
|
|
481
|
+
}
|
|
482
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-11,
|
|
483
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-11 {
|
|
484
|
+
padding-left: 0;
|
|
485
|
+
padding-right: 208px;
|
|
486
|
+
}
|
|
487
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-12,
|
|
488
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-12 {
|
|
489
|
+
padding-left: 0;
|
|
490
|
+
padding-right: 228px;
|
|
491
|
+
}
|
|
492
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-13,
|
|
493
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-13 {
|
|
494
|
+
padding-left: 0;
|
|
495
|
+
padding-right: 248px;
|
|
496
|
+
}
|
|
497
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-14,
|
|
498
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-14 {
|
|
499
|
+
padding-left: 0;
|
|
500
|
+
padding-right: 268px;
|
|
501
|
+
}
|
|
502
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-15,
|
|
503
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-15 {
|
|
504
|
+
padding-left: 0;
|
|
505
|
+
padding-right: 288px;
|
|
506
|
+
}
|
|
507
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-16,
|
|
508
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-16 {
|
|
509
|
+
padding-left: 0;
|
|
510
|
+
padding-right: 308px;
|
|
511
|
+
}
|
|
512
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-17,
|
|
513
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-17 {
|
|
514
|
+
padding-left: 0;
|
|
515
|
+
padding-right: 328px;
|
|
516
|
+
}
|
|
517
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-18,
|
|
518
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-18 {
|
|
519
|
+
padding-left: 0;
|
|
520
|
+
padding-right: 348px;
|
|
521
|
+
}
|
|
522
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-19,
|
|
523
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-19 {
|
|
524
|
+
padding-left: 0;
|
|
525
|
+
padding-right: 368px;
|
|
526
|
+
}
|
|
527
|
+
.semi-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-20,
|
|
528
|
+
.semi-popover-rtl .semi-tree-option-list li.semi-tree-option.semi-tree-option-fullLabel-level-20 {
|
|
529
|
+
padding-left: 0;
|
|
530
|
+
padding-right: 388px;
|
|
531
|
+
}
|
|
367
532
|
.semi-rtl .semi-tree-option-list .semi-tree-option-label-empty,
|
|
368
533
|
.semi-popover-rtl .semi-tree-option-list .semi-tree-option-label-empty {
|
|
369
534
|
padding-left: auto;
|
|
370
535
|
padding-right: 0;
|
|
371
536
|
}
|
|
537
|
+
.semi-rtl .semi-tree-option-list .semi-tree-option-switcher,
|
|
538
|
+
.semi-popover-rtl .semi-tree-option-list .semi-tree-option-switcher {
|
|
539
|
+
margin-right: 0;
|
|
540
|
+
margin-left: 8px;
|
|
541
|
+
}
|
|
372
542
|
.semi-rtl .semi-tree-option-list-block,
|
|
373
543
|
.semi-popover-rtl .semi-tree-option-list-block {
|
|
374
544
|
direction: rtl;
|
package/lib/es/tree/tree.scss
CHANGED
|
@@ -329,6 +329,12 @@ $module: #{$prefix}-tree;
|
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
+
@for $i from 1 through 20 {
|
|
333
|
+
li.#{$module}-option.#{$module}-option-fullLabel-level-#{$i} {
|
|
334
|
+
padding-left: $spacing-tree_option_level-paddingLeft * ($i - 1) + $spacing-tree_option_level1-paddingLeft;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
332
338
|
.#{$module}-option-empty {
|
|
333
339
|
&:hover,
|
|
334
340
|
&:active {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.51.0-beta.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
7
7
|
"prepublishOnly": "npm run build:lib"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@douyinfe/semi-animation": "2.
|
|
10
|
+
"@douyinfe/semi-animation": "2.51.0-beta.0",
|
|
11
11
|
"async-validator": "^3.5.0",
|
|
12
12
|
"classnames": "^2.2.6",
|
|
13
13
|
"date-fns": "^2.29.3",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"*.scss",
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "35dcd5c5793fbe9c564eeac62486a402b84f4075",
|
|
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
|
@@ -989,7 +989,8 @@ class TableFoundation<RecordType> extends BaseFoundation<TableAdapter<RecordType
|
|
|
989
989
|
}
|
|
990
990
|
return true;
|
|
991
991
|
} else {
|
|
992
|
-
|
|
992
|
+
const isAllSelected = allKeys.every(rowKey => selectedRowKeysSet.has(rowKey));
|
|
993
|
+
return isAllSelected || false;
|
|
993
994
|
}
|
|
994
995
|
}
|
|
995
996
|
|
package/tree/rtl.scss
CHANGED
|
@@ -20,6 +20,8 @@ $module: #{$prefix}-tree;
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.#{$module}-option {
|
|
23
|
+
padding-left: 0;
|
|
24
|
+
padding-right: $spacing-tree_option_level1-paddingLeft;
|
|
23
25
|
&-label {
|
|
24
26
|
& > .#{$prefix}-icon {
|
|
25
27
|
margin-right: 0;
|
|
@@ -39,10 +41,24 @@ $module: #{$prefix}-tree;
|
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
|
|
44
|
+
@for $i from 1 through 20 {
|
|
45
|
+
li.#{$module}-option.#{$module}-option-fullLabel-level-#{$i} {
|
|
46
|
+
padding-left: 0;
|
|
47
|
+
padding-right: $spacing-tree_option_level-paddingLeft * ($i - 1) + $spacing-tree_option_level1-paddingLeft;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
42
51
|
.#{$module}-option-label-empty {
|
|
43
52
|
padding-left: auto;
|
|
44
53
|
padding-right: 0;
|
|
45
54
|
}
|
|
55
|
+
|
|
56
|
+
.#{$module}-option {
|
|
57
|
+
&-switcher {
|
|
58
|
+
margin-right: 0;
|
|
59
|
+
margin-left: $spacing-tree_icon-marginRight;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
46
62
|
}
|
|
47
63
|
|
|
48
64
|
.#{$module}-option-list-block {
|
package/tree/tree.scss
CHANGED
|
@@ -329,6 +329,12 @@ $module: #{$prefix}-tree;
|
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
+
@for $i from 1 through 20 {
|
|
333
|
+
li.#{$module}-option.#{$module}-option-fullLabel-level-#{$i} {
|
|
334
|
+
padding-left: $spacing-tree_option_level-paddingLeft * ($i - 1) + $spacing-tree_option_level1-paddingLeft;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
332
338
|
.#{$module}-option-empty {
|
|
333
339
|
&:hover,
|
|
334
340
|
&:active {
|