@douyinfe/semi-foundation 2.1.0-beta.0 → 2.1.0-beta.1
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/foundation.ts +1 -1
- package/lib/es/cascader/foundation.d.ts +1 -1
- package/lib/es/select/foundation.js +10 -5
- package/lib/es/tree/foundation.d.ts +1 -1
- package/lib/es/tree/treeUtil.js +10 -7
- package/lib/es/treeSelect/foundation.d.ts +1 -1
- package/package.json +3 -3
- package/select/foundation.ts +6 -5
- package/tree/foundation.ts +1 -1
- package/tree/treeUtil.ts +1 -1
- package/treeSelect/foundation.ts +1 -1
package/cascader/foundation.ts
CHANGED
|
@@ -77,7 +77,7 @@ export interface BasicTriggerRenderProps {
|
|
|
77
77
|
/** The hierarchical position of the selected node in treeData,
|
|
78
78
|
* as in the following example, when Zhejiang-Hangzhou-Xiaoshan
|
|
79
79
|
* District is selected, the value here is 0-0-1 */
|
|
80
|
-
value?: string
|
|
80
|
+
value?: string | Set<string>;
|
|
81
81
|
/* The input value of the current input box */
|
|
82
82
|
inputValue: string;
|
|
83
83
|
/* Cascader's placeholder */
|
|
@@ -40,7 +40,7 @@ export interface BasicTriggerRenderProps {
|
|
|
40
40
|
/** The hierarchical position of the selected node in treeData,
|
|
41
41
|
* as in the following example, when Zhejiang-Hangzhou-Xiaoshan
|
|
42
42
|
* District is selected, the value here is 0-0-1 */
|
|
43
|
-
value?: string
|
|
43
|
+
value?: string | Set<string>;
|
|
44
44
|
inputValue: string;
|
|
45
45
|
placeholder?: string;
|
|
46
46
|
/** The function used to update the value of the input box. You
|
|
@@ -29,7 +29,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
29
29
|
|
|
30
30
|
import BaseFoundation from '../base/foundation';
|
|
31
31
|
import KeyCode from '../utils/keyCode';
|
|
32
|
-
import { isNumber, isString, isEqual } from 'lodash-es';
|
|
32
|
+
import { isNumber, isString, isEqual, omit } from 'lodash-es';
|
|
33
33
|
import warning from '../utils/warning';
|
|
34
34
|
import isNullOrUndefined from '../utils/isNullOrUndefined';
|
|
35
35
|
export default class SelectFoundation extends BaseFoundation {
|
|
@@ -266,12 +266,14 @@ export default class SelectFoundation extends BaseFoundation {
|
|
|
266
266
|
let optionNotExist = {
|
|
267
267
|
value: propValue,
|
|
268
268
|
label: propValue,
|
|
269
|
-
_notExist: true
|
|
269
|
+
_notExist: true,
|
|
270
|
+
_scrollIndex: -1
|
|
270
271
|
};
|
|
271
272
|
|
|
272
273
|
if (onChangeWithObject) {
|
|
273
274
|
optionNotExist = _Object$assign(_Object$assign({}, propValue), {
|
|
274
|
-
_notExist: true
|
|
275
|
+
_notExist: true,
|
|
276
|
+
_scrollIndex: -1
|
|
275
277
|
});
|
|
276
278
|
}
|
|
277
279
|
|
|
@@ -330,7 +332,9 @@ export default class SelectFoundation extends BaseFoundation {
|
|
|
330
332
|
onChangeWithObject ? optionNotExist = _Object$assign(_Object$assign({}, propValue[i]), {
|
|
331
333
|
_notExist: true
|
|
332
334
|
}) : null;
|
|
333
|
-
selections.set(optionNotExist.label, optionNotExist)
|
|
335
|
+
selections.set(optionNotExist.label, _Object$assign(_Object$assign({}, optionNotExist), {
|
|
336
|
+
_scrollIndex: -1
|
|
337
|
+
}));
|
|
334
338
|
}
|
|
335
339
|
}
|
|
336
340
|
});
|
|
@@ -515,7 +519,7 @@ export default class SelectFoundation extends BaseFoundation {
|
|
|
515
519
|
this._adapter.notifyMaxLimit(_Object$assign({
|
|
516
520
|
value,
|
|
517
521
|
label
|
|
518
|
-
}, rest));
|
|
522
|
+
}, omit(rest, '_scrollIndex')));
|
|
519
523
|
|
|
520
524
|
return;
|
|
521
525
|
} else {
|
|
@@ -1016,6 +1020,7 @@ export default class SelectFoundation extends BaseFoundation {
|
|
|
1016
1020
|
delete option._parentGroup;
|
|
1017
1021
|
delete option._show;
|
|
1018
1022
|
delete option._selected;
|
|
1023
|
+
delete option._scrollIndex;
|
|
1019
1024
|
|
|
1020
1025
|
if ('_keyInOptionList' in option) {
|
|
1021
1026
|
option.key = option._keyInOptionList;
|
|
@@ -162,7 +162,7 @@ export interface BasicTreeProps {
|
|
|
162
162
|
onDragOver?: (dragProps: BasicDragProps) => void;
|
|
163
163
|
onDragStart?: (dragProps: BasicDragProps) => void;
|
|
164
164
|
onDrop?: (onDragProps: BasicOnDragProps) => void;
|
|
165
|
-
onExpand?: (expandedKeys: string[],
|
|
165
|
+
onExpand?: (expandedKeys: string[], expandedOtherProps: BasicExpandedOtherProps) => void;
|
|
166
166
|
onLoad?: (loadedKeys?: Set<string>, treeNode?: BasicTreeNodeData) => void;
|
|
167
167
|
onContextMenu?: (e: any, node: BasicTreeNodeData) => void;
|
|
168
168
|
onSearch?: (sunInput: string) => void;
|
package/lib/es/tree/treeUtil.js
CHANGED
|
@@ -9,6 +9,7 @@ import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
|
9
9
|
import _everyInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/every";
|
|
10
10
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
11
11
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
12
|
+
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
12
13
|
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
13
14
|
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
|
14
15
|
|
|
@@ -514,7 +515,9 @@ export function normalizeKeyList(keyList, keyEntities) {
|
|
|
514
515
|
res.push(key);
|
|
515
516
|
});
|
|
516
517
|
} else {
|
|
517
|
-
|
|
518
|
+
var _context8;
|
|
519
|
+
|
|
520
|
+
res = _filterInstanceProperty(_context8 = _Array$from(keyList)).call(_context8, key => keyEntities[key] && !isValid(keyEntities[key].children));
|
|
518
521
|
}
|
|
519
522
|
|
|
520
523
|
return res;
|
|
@@ -523,9 +526,9 @@ export function getMotionKeys(eventKey, expandedKeys, keyEntities) {
|
|
|
523
526
|
const res = [];
|
|
524
527
|
|
|
525
528
|
const getChild = itemKey => {
|
|
526
|
-
var
|
|
529
|
+
var _context9;
|
|
527
530
|
|
|
528
|
-
keyEntities[itemKey].children && _forEachInstanceProperty(
|
|
531
|
+
keyEntities[itemKey].children && _forEachInstanceProperty(_context9 = keyEntities[itemKey].children).call(_context9, item => {
|
|
529
532
|
const {
|
|
530
533
|
key
|
|
531
534
|
} = item;
|
|
@@ -641,7 +644,7 @@ export function calcCheckedKeysForUnchecked(key, keyEntities, checkedKeys, halfC
|
|
|
641
644
|
};
|
|
642
645
|
}
|
|
643
646
|
export function filterTreeData(info) {
|
|
644
|
-
var
|
|
647
|
+
var _context10, _context11;
|
|
645
648
|
|
|
646
649
|
const {
|
|
647
650
|
showFilteredOnly,
|
|
@@ -653,7 +656,7 @@ export function filterTreeData(info) {
|
|
|
653
656
|
prevExpandedKeys
|
|
654
657
|
} = info;
|
|
655
658
|
let filteredOptsKeys = [];
|
|
656
|
-
filteredOptsKeys = _mapInstanceProperty(
|
|
659
|
+
filteredOptsKeys = _mapInstanceProperty(_context10 = _filterInstanceProperty(_context11 = _Object$values(keyEntities)).call(_context11, item => filter(inputValue, item.data, filterTreeNode, filterProps))).call(_context10, item => item.key);
|
|
657
660
|
let expandedOptsKeys = findAncestorKeys(filteredOptsKeys, keyEntities, false);
|
|
658
661
|
|
|
659
662
|
if (prevExpandedKeys.length) {
|
|
@@ -694,9 +697,9 @@ export function updateKeys(keySet, keyEntities) {
|
|
|
694
697
|
return _filterInstanceProperty(keyArr).call(keyArr, key => key in keyEntities);
|
|
695
698
|
}
|
|
696
699
|
export function calcDisabledKeys(keyEntities) {
|
|
697
|
-
var
|
|
700
|
+
var _context12;
|
|
698
701
|
|
|
699
|
-
const disabledKeys = _filterInstanceProperty(
|
|
702
|
+
const disabledKeys = _filterInstanceProperty(_context12 = _Object$keys(keyEntities)).call(_context12, key => keyEntities[key].data.disabled);
|
|
700
703
|
|
|
701
704
|
const {
|
|
702
705
|
checkedKeys
|
|
@@ -93,7 +93,7 @@ export interface TreeSelectAdapter<P = Record<string, any>, S = Record<string, a
|
|
|
93
93
|
setOptionWrapperWidth: (width: null | number) => void;
|
|
94
94
|
notifyChange: BasicOnChangeWithBasic;
|
|
95
95
|
notifyChangeWithObject: BasicOnChangeWithObject;
|
|
96
|
-
notifyExpand: (expandedKeys: Set<string>,
|
|
96
|
+
notifyExpand: (expandedKeys: Set<string>, expandedOtherProps: BasicExpandedOtherProps) => void;
|
|
97
97
|
notifyFocus: (e: any) => void;
|
|
98
98
|
notifyBlur: (e: any) => void;
|
|
99
99
|
toggleHovering: (bool: boolean) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
11
|
-
"@douyinfe/semi-animation": "2.1.0-beta.
|
|
11
|
+
"@douyinfe/semi-animation": "2.1.0-beta.1",
|
|
12
12
|
"async-validator": "^3.5.0",
|
|
13
13
|
"classnames": "^2.2.6",
|
|
14
14
|
"date-fns": "^2.9.0",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"*.scss",
|
|
25
25
|
"*.css"
|
|
26
26
|
],
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "112ef9a681542c2057f98e2e708648b4fdd5618c",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
30
30
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
package/select/foundation.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable max-len */
|
|
3
3
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
4
4
|
import KeyCode from '../utils/keyCode';
|
|
5
|
-
import { isNumber, isString, isEqual } from 'lodash-es';
|
|
5
|
+
import { isNumber, isString, isEqual, omit } from 'lodash-es';
|
|
6
6
|
import warning from '../utils/warning';
|
|
7
7
|
import isNullOrUndefined from '../utils/isNullOrUndefined';
|
|
8
8
|
import { BasicOptionProps } from './optionFoundation';
|
|
@@ -230,9 +230,9 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
|
|
|
230
230
|
selections.set(optionExist.label, optionExist);
|
|
231
231
|
} else if (noMatchOptionInList) {
|
|
232
232
|
// If the current value does not have a corresponding item in the optionList, construct an option and update it to the selection. However, it does not need to be inserted into the list
|
|
233
|
-
let optionNotExist = { value: propValue, label: propValue, _notExist: true };
|
|
233
|
+
let optionNotExist = { value: propValue, label: propValue, _notExist: true, _scrollIndex: -1 } as BasicOptionProps;
|
|
234
234
|
if (onChangeWithObject) {
|
|
235
|
-
optionNotExist = { ...propValue as BasicOptionProps, _notExist: true
|
|
235
|
+
optionNotExist = { ...propValue as BasicOptionProps, _notExist: true, _scrollIndex: -1 };
|
|
236
236
|
}
|
|
237
237
|
selections.set(optionNotExist.label, optionNotExist);
|
|
238
238
|
}
|
|
@@ -277,7 +277,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
|
|
|
277
277
|
// The current value does not exist in the current optionList or the list before the change. Construct an option and update it to the selection
|
|
278
278
|
let optionNotExist = { value: selectedValue, label: selectedValue, _notExist: true };
|
|
279
279
|
onChangeWithObject ? (optionNotExist = { ...propValue[i] as any, _notExist: true }) : null;
|
|
280
|
-
selections.set(optionNotExist.label, optionNotExist);
|
|
280
|
+
selections.set(optionNotExist.label, { ...optionNotExist, _scrollIndex: -1 });
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
});
|
|
@@ -409,7 +409,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
|
|
|
409
409
|
this._notifyDeselect(value, { value, label, ...rest });
|
|
410
410
|
selections.delete(label);
|
|
411
411
|
} else if (maxLimit && selections.size === maxLimit) {
|
|
412
|
-
this._adapter.notifyMaxLimit({ value, label, ...rest });
|
|
412
|
+
this._adapter.notifyMaxLimit({ value, label, ...omit(rest, '_scrollIndex') });
|
|
413
413
|
return;
|
|
414
414
|
} else {
|
|
415
415
|
this._notifySelect(value, { value, label, ...rest });
|
|
@@ -787,6 +787,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
|
|
|
787
787
|
delete option._parentGroup;
|
|
788
788
|
delete option._show;
|
|
789
789
|
delete option._selected;
|
|
790
|
+
delete option._scrollIndex;
|
|
790
791
|
if ('_keyInOptionList' in option) {
|
|
791
792
|
option.key = option._keyInOptionList;
|
|
792
793
|
delete option._keyInOptionList;
|
package/tree/foundation.ts
CHANGED
|
@@ -212,7 +212,7 @@ export interface BasicTreeProps {
|
|
|
212
212
|
onDragOver?: (dragProps: BasicDragProps) => void;
|
|
213
213
|
onDragStart?: (dragProps: BasicDragProps) => void;
|
|
214
214
|
onDrop?: (onDragProps: BasicOnDragProps) => void;
|
|
215
|
-
onExpand?: (expandedKeys: string[],
|
|
215
|
+
onExpand?: (expandedKeys: string[], expandedOtherProps: BasicExpandedOtherProps) => void;
|
|
216
216
|
onLoad?: (loadedKeys?: Set<string>, treeNode?: BasicTreeNodeData) => void;
|
|
217
217
|
onContextMenu?: (e: any, node: BasicTreeNodeData) => void;
|
|
218
218
|
onSearch?: (sunInput: string) => void;
|
package/tree/treeUtil.ts
CHANGED
|
@@ -441,7 +441,7 @@ export function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnl
|
|
|
441
441
|
res.push(key);
|
|
442
442
|
});
|
|
443
443
|
} else {
|
|
444
|
-
res = keyList.filter((key: string) => keyEntities[key] && !isValid(keyEntities[key].children));
|
|
444
|
+
res = Array.from(keyList).filter((key: string) => keyEntities[key] && !isValid(keyEntities[key].children)) as string[];
|
|
445
445
|
}
|
|
446
446
|
return res;
|
|
447
447
|
}
|
package/treeSelect/foundation.ts
CHANGED
|
@@ -179,7 +179,7 @@ export interface TreeSelectAdapter<P = Record<string, any>, S = Record<string, a
|
|
|
179
179
|
setOptionWrapperWidth: (width: null | number) => void;
|
|
180
180
|
notifyChange: BasicOnChangeWithBasic;
|
|
181
181
|
notifyChangeWithObject: BasicOnChangeWithObject;
|
|
182
|
-
notifyExpand: (expandedKeys: Set<string>,
|
|
182
|
+
notifyExpand: (expandedKeys: Set<string>, expandedOtherProps: BasicExpandedOtherProps) => void;
|
|
183
183
|
notifyFocus: (e: any) => void;
|
|
184
184
|
notifyBlur: (e: any) => void;
|
|
185
185
|
toggleHovering: (bool: boolean) => void;
|