@douyinfe/semi-foundation 2.1.0-beta.2 → 2.1.0-beta.3
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/calendar/foundation.ts +3 -1
- package/cascader/foundation.ts +1 -1
- package/collapse/foundation.ts +1 -1
- package/lib/es/calendar/foundation.d.ts +2 -1
- package/lib/es/cascader/foundation.d.ts +1 -1
- package/lib/es/collapse/foundation.d.ts +1 -1
- package/lib/es/pagination/foundation.d.ts +2 -2
- package/lib/es/popconfirm/popconfirmFoundation.d.ts +2 -0
- package/lib/es/popconfirm/popconfirmFoundation.js +4 -0
- package/lib/es/scrollList/itemFoundation.d.ts +3 -3
- package/lib/es/select/foundation.d.ts +2 -1
- package/lib/es/select/foundation.js +10 -5
- package/lib/es/table/utils.d.ts +1 -1
- package/lib/es/tabs/foundation.d.ts +3 -0
- package/lib/es/tabs/foundation.js +4 -8
- package/lib/es/tabs/tabs.css +13 -1
- package/lib/es/tabs/tabs.scss +96 -76
- package/lib/es/tagInput/foundation.d.ts +1 -0
- package/lib/es/tagInput/foundation.js +2 -0
- package/lib/es/tooltip/foundation.js +5 -2
- package/lib/es/tree/foundation.d.ts +1 -1
- package/lib/es/tree/treeUtil.js +10 -7
- package/lib/es/treeSelect/foundation.d.ts +10 -12
- package/lib/es/utils/log.js +3 -1
- package/package.json +3 -3
- package/pagination/foundation.ts +2 -2
- package/popconfirm/popconfirmFoundation.ts +5 -0
- package/scrollList/itemFoundation.ts +3 -3
- package/select/foundation.ts +10 -8
- package/table/utils.ts +1 -1
- package/tabs/foundation.ts +7 -8
- package/tabs/tabs.scss +96 -76
- package/tagInput/foundation.ts +2 -0
- package/tooltip/foundation.ts +4 -2
- package/tree/foundation.ts +1 -1
- package/tree/treeUtil.ts +1 -1
- package/treeSelect/foundation.ts +11 -10
- package/utils/log.ts +3 -1
package/calendar/foundation.ts
CHANGED
|
@@ -83,11 +83,13 @@ export type MonthData = Record<number, DateObj[]>;
|
|
|
83
83
|
// cacheEventKeys: (cachedKeys: Array<string>) => void;
|
|
84
84
|
// }
|
|
85
85
|
|
|
86
|
+
export type ParsedEventsType = ParsedEvents | ParsedEventsWithArray | MonthlyEvent;
|
|
87
|
+
|
|
86
88
|
export interface CalendarAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
87
89
|
updateCurrPos?: (currPos: number) => void;
|
|
88
90
|
updateShowCurrTime?: () => void;
|
|
89
91
|
updateScrollHeight?: (scrollHeight: number) => void;
|
|
90
|
-
setParsedEvents?: (parsedEvents:
|
|
92
|
+
setParsedEvents?: (parsedEvents: ParsedEventsType) => void;
|
|
91
93
|
cacheEventKeys?: (cachedKeys: Array<string>) => void;
|
|
92
94
|
setRangeData?: (data: RangeData) => void;
|
|
93
95
|
getRangeData?: () => RangeData;
|
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 */
|
package/collapse/foundation.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface CollapseState{
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export interface CollapseAdapter extends DefaultAdapter<CollapseProps, CollapseState>{
|
|
26
|
-
handleChange: (
|
|
26
|
+
handleChange: (activeKey: CollapseProps['activeKey'], e: any) => void;
|
|
27
27
|
// getStates: () => CollapseState;
|
|
28
28
|
// getProps: () => CollapseProps;
|
|
29
29
|
addActiveKey: (newSet: CollapseState['activeSet']) => void;
|
|
@@ -36,11 +36,12 @@ export interface WeeklyData {
|
|
|
36
36
|
week: DateObj[];
|
|
37
37
|
}
|
|
38
38
|
export declare type MonthData = Record<number, DateObj[]>;
|
|
39
|
+
export declare type ParsedEventsType = ParsedEvents | ParsedEventsWithArray | MonthlyEvent;
|
|
39
40
|
export interface CalendarAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
40
41
|
updateCurrPos?: (currPos: number) => void;
|
|
41
42
|
updateShowCurrTime?: () => void;
|
|
42
43
|
updateScrollHeight?: (scrollHeight: number) => void;
|
|
43
|
-
setParsedEvents?: (parsedEvents:
|
|
44
|
+
setParsedEvents?: (parsedEvents: ParsedEventsType) => void;
|
|
44
45
|
cacheEventKeys?: (cachedKeys: Array<string>) => void;
|
|
45
46
|
setRangeData?: (data: RangeData) => void;
|
|
46
47
|
getRangeData?: () => RangeData;
|
|
@@ -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
|
|
@@ -18,7 +18,7 @@ export interface CollapseState {
|
|
|
18
18
|
activeSet: Set<string>;
|
|
19
19
|
}
|
|
20
20
|
export interface CollapseAdapter extends DefaultAdapter<CollapseProps, CollapseState> {
|
|
21
|
-
handleChange: (
|
|
21
|
+
handleChange: (activeKey: CollapseProps['activeKey'], e: any) => void;
|
|
22
22
|
addActiveKey: (newSet: CollapseState['activeSet']) => void;
|
|
23
23
|
}
|
|
24
24
|
export default class CollapseFoundation extends BaseFoundation<CollapseAdapter> {
|
|
@@ -8,9 +8,9 @@ export interface PaginationAdapter<P = Record<string, any>, S = Record<string, a
|
|
|
8
8
|
setCurrentPage: (pageIndex: number) => void;
|
|
9
9
|
registerKeyDownHandler: (handler: KeyDownHandler) => void;
|
|
10
10
|
unregisterKeyDownHandler: (handler: KeyDownHandler) => void;
|
|
11
|
-
notifyPageChange: (pageIndex: number
|
|
11
|
+
notifyPageChange: (pageIndex: number) => void;
|
|
12
12
|
notifyPageSizeChange: (pageSize: number) => void;
|
|
13
|
-
notifyChange: (pageIndex: number
|
|
13
|
+
notifyChange: (pageIndex: number, pageSize: number) => void;
|
|
14
14
|
}
|
|
15
15
|
export declare type PageRenderText = number | '...';
|
|
16
16
|
export declare type PageList = PageRenderText[];
|
|
@@ -4,11 +4,13 @@ export interface PopconfirmAdapter<P = Record<string, any>, S = Record<string, a
|
|
|
4
4
|
notifyConfirm: (e: any) => void;
|
|
5
5
|
notifyCancel: (e: any) => void;
|
|
6
6
|
notifyVisibleChange: (visible: boolean) => void;
|
|
7
|
+
notifyClickOutSide: (e: any) => void;
|
|
7
8
|
}
|
|
8
9
|
export default class PopConfirmFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<PopconfirmAdapter<P, S>, P, S> {
|
|
9
10
|
init(): void;
|
|
10
11
|
destroy(): void;
|
|
11
12
|
handleCancel(e: any): void;
|
|
12
13
|
handleConfirm(e: any): void;
|
|
14
|
+
handleClickOutSide(e: any): void;
|
|
13
15
|
handleVisibleChange(visible: boolean): void;
|
|
14
16
|
}
|
|
@@ -17,6 +17,10 @@ export default class PopConfirmFoundation extends BaseFoundation {
|
|
|
17
17
|
this.handleVisibleChange(false);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
handleClickOutSide(e) {
|
|
21
|
+
this._adapter.notifyClickOutSide(e);
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
handleVisibleChange(visible) {
|
|
21
25
|
if (!this._isControlledComponent('visible')) {
|
|
22
26
|
this._adapter.setVisible(visible);
|
|
@@ -6,15 +6,15 @@ export interface Item {
|
|
|
6
6
|
text?: string;
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
}
|
|
9
|
-
export interface ScrollItemAdapter<P = Record<string, any>, S = Record<string, any
|
|
9
|
+
export interface ScrollItemAdapter<P = Record<string, any>, S = Record<string, any>, I = Item> extends DefaultAdapter<P, S> {
|
|
10
10
|
setPrependCount: (prependCount: number) => void;
|
|
11
11
|
setAppendCount: (appendCount: number) => void;
|
|
12
12
|
setSelectedNode: (el: HTMLElement) => void;
|
|
13
13
|
isDisabledIndex: (i: number) => boolean;
|
|
14
|
-
notifySelectItem: (data:
|
|
14
|
+
notifySelectItem: (data: I) => void;
|
|
15
15
|
scrollToCenter: (selectedNode: Element, scrollWrapper?: Element, duration?: number) => void;
|
|
16
16
|
}
|
|
17
|
-
export default class ItemFoundation<P = Record<string, any>, S = Record<string, any
|
|
17
|
+
export default class ItemFoundation<P = Record<string, any>, S = Record<string, any>, I = Item> extends BaseFoundation<ScrollItemAdapter<P, S, I>, P, S> {
|
|
18
18
|
_cachedSelectedNode: HTMLElement;
|
|
19
19
|
selectIndex(index: number, listWrapper: HTMLElement): void;
|
|
20
20
|
selectNode(node: HTMLElement, listWrapper: HTMLElement): void;
|
|
@@ -38,7 +38,8 @@ export interface SelectAdapter<P = Record<string, any>, S = Record<string, any>>
|
|
|
38
38
|
updateHovering(isHover: boolean): void;
|
|
39
39
|
updateScrollTop(): void;
|
|
40
40
|
}
|
|
41
|
-
declare type
|
|
41
|
+
declare type LabelValue = string | number;
|
|
42
|
+
declare type PropValue = LabelValue | Record<string, any>;
|
|
42
43
|
export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
|
|
43
44
|
constructor(adapter: SelectAdapter);
|
|
44
45
|
_keydownHandler: (...arg: any[]) => void | null;
|
|
@@ -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;
|
package/lib/es/table/utils.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare function isInnerColumnKey(key: string | number): boolean;
|
|
|
21
21
|
export declare function isExpandedColumn(column: Record<string, any>): boolean;
|
|
22
22
|
export declare function isScrollbarColumn(column: Record<string, any>): boolean;
|
|
23
23
|
export declare function isSelectionColumn(column: Record<string, any>): boolean;
|
|
24
|
-
export declare function filterColumns(columns: Record<string, any>[], ignoreKeys?:
|
|
24
|
+
export declare function filterColumns(columns: Record<string, any>[], ignoreKeys?: string[]): Record<string, any>[];
|
|
25
25
|
/**
|
|
26
26
|
* get width of scroll bar
|
|
27
27
|
* @param {Array} columns
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
2
|
export interface TabsAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
3
3
|
collectPane: () => void;
|
|
4
|
+
collectActiveKey: () => void;
|
|
4
5
|
notifyTabClick: (activeKey: string, event: any) => void;
|
|
5
6
|
notifyChange: (activeKey: string) => void;
|
|
6
7
|
setNewActiveKey: (activeKey: string) => void;
|
|
7
8
|
getDefaultActiveKeyFromChildren: () => string;
|
|
9
|
+
notifyTabDelete: (tabKey: string) => void;
|
|
8
10
|
}
|
|
9
11
|
declare class TabsFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<TabsAdapter<P, S>, P, S> {
|
|
10
12
|
constructor(adapter: TabsAdapter<P, S>);
|
|
@@ -16,5 +18,6 @@ declare class TabsFoundation<P = Record<string, any>, S = Record<string, any>> e
|
|
|
16
18
|
getDefaultActiveKey(): string;
|
|
17
19
|
handleTabListChange(): void;
|
|
18
20
|
handleTabPanesChange(): void;
|
|
21
|
+
handleTabDelete(tabKey: string): void;
|
|
19
22
|
}
|
|
20
23
|
export default TabsFoundation;
|
|
@@ -68,15 +68,11 @@ class TabsFoundation extends BaseFoundation {
|
|
|
68
68
|
handleTabPanesChange() {
|
|
69
69
|
this._adapter.collectPane();
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (typeof activeKey === 'undefined') {
|
|
74
|
-
activeKey = this._adapter.getDefaultActiveKeyFromChildren();
|
|
75
|
-
}
|
|
71
|
+
this._adapter.collectActiveKey();
|
|
72
|
+
}
|
|
76
73
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
74
|
+
handleTabDelete(tabKey) {
|
|
75
|
+
this._adapter.notifyTabDelete(tabKey);
|
|
80
76
|
}
|
|
81
77
|
|
|
82
78
|
}
|
package/lib/es/tabs/tabs.css
CHANGED
|
@@ -40,6 +40,13 @@
|
|
|
40
40
|
top: 3px;
|
|
41
41
|
color: var(--semi-color-text-2);
|
|
42
42
|
}
|
|
43
|
+
.semi-tabs-bar .semi-tabs-tab .semi-icon-close {
|
|
44
|
+
margin-right: 0;
|
|
45
|
+
font-size: 14px;
|
|
46
|
+
color: var(--semi-color-text-2);
|
|
47
|
+
margin-left: 10px;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
}
|
|
43
50
|
.semi-tabs-bar .semi-tabs-tab:hover {
|
|
44
51
|
color: var(--semi-color-text-0);
|
|
45
52
|
}
|
|
@@ -53,7 +60,6 @@
|
|
|
53
60
|
color: var(--semi-color-text-0);
|
|
54
61
|
}
|
|
55
62
|
.semi-tabs-bar .semi-tabs-tab-active, .semi-tabs-bar .semi-tabs-tab-active:hover {
|
|
56
|
-
color: var(--semi-color-text-0);
|
|
57
63
|
cursor: default;
|
|
58
64
|
font-weight: 600;
|
|
59
65
|
color: var(--semi-color-text-0);
|
|
@@ -61,6 +67,12 @@
|
|
|
61
67
|
.semi-tabs-bar .semi-tabs-tab-active .semi-icon, .semi-tabs-bar .semi-tabs-tab-active:hover .semi-icon {
|
|
62
68
|
color: var(--semi-color-primary);
|
|
63
69
|
}
|
|
70
|
+
.semi-tabs-bar .semi-tabs-tab-active .semi-icon-close, .semi-tabs-bar .semi-tabs-tab-active:hover .semi-icon-close {
|
|
71
|
+
color: var(--semi-color-text-2);
|
|
72
|
+
}
|
|
73
|
+
.semi-tabs-bar .semi-tabs-tab-active .semi-icon-close:hover {
|
|
74
|
+
color: var(--semi-color-text-1);
|
|
75
|
+
}
|
|
64
76
|
.semi-tabs-bar .semi-tabs-tab-disabled {
|
|
65
77
|
cursor: not-allowed;
|
|
66
78
|
color: var(--semi-color-disabled-text);
|