@douyinfe/semi-foundation 2.0.9-alpha.0 → 2.0.9-alpha.2
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/lib/es/calendar/foundation.d.ts +2 -1
- package/lib/es/pagination/foundation.d.ts +2 -2
- package/lib/es/scrollList/itemFoundation.d.ts +3 -3
- package/lib/es/select/foundation.d.ts +2 -1
- package/lib/es/table/utils.d.ts +1 -1
- package/lib/es/tree/treeUtil.d.ts +1 -1
- package/lib/es/treeSelect/foundation.d.ts +0 -1
- package/lib/es/upload/constants.d.ts +1 -1
- package/lib/es/utils/log.js +3 -1
- package/package.json +2 -2
- package/pagination/foundation.ts +2 -2
- package/scrollList/itemFoundation.ts +3 -3
- package/select/foundation.ts +4 -3
- package/table/utils.ts +1 -1
- package/treeSelect/foundation.ts +1 -1
- 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;
|
|
@@ -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;
|
|
@@ -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[];
|
|
@@ -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;
|
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
|
|
@@ -74,6 +74,6 @@ export declare function getValueOrKey(data: any): any;
|
|
|
74
74
|
export declare function normalizeValue(value: any, withObject: boolean): any;
|
|
75
75
|
export declare function updateKeys(keySet: Set<string>, keyEntities: KeyEntities): string[];
|
|
76
76
|
export declare function calcDisabledKeys(keyEntities: KeyEntities): Set<string>;
|
|
77
|
-
export declare function calcDropRelativePosition(event: any, treeNode: any):
|
|
77
|
+
export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
|
|
78
78
|
export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
|
|
79
79
|
export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
|
|
@@ -63,7 +63,6 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize'
|
|
|
63
63
|
searchRender?: (inputProps: any) => any;
|
|
64
64
|
renderSelectedItem?: BasicRenderSelectedItem;
|
|
65
65
|
getPopupContainer?: () => HTMLElement;
|
|
66
|
-
triggerRender?: (props: BasicTriggerRenderProps) => any;
|
|
67
66
|
onBlur?: (e: any) => void;
|
|
68
67
|
onChange?: BasicOnChange;
|
|
69
68
|
onFocus?: (e: any) => void;
|
|
@@ -18,7 +18,7 @@ declare const strings: {
|
|
|
18
18
|
DRAG_AREA_ILLEGAL: string;
|
|
19
19
|
TRIGGER_AUTO: "auto";
|
|
20
20
|
TRIGGER_CUSTOM: "custom";
|
|
21
|
-
UPLOAD_TRIGGER: ("
|
|
21
|
+
UPLOAD_TRIGGER: ("auto" | "custom")[];
|
|
22
22
|
VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
|
|
23
23
|
PROMPT_POSITION: readonly ["left", "right", "bottom"];
|
|
24
24
|
};
|
package/lib/es/utils/log.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { get } from 'lodash-es';
|
|
2
|
+
|
|
1
3
|
const log = function (text) {
|
|
2
|
-
if (process
|
|
4
|
+
if (get(process, 'env.NODE_ENV') === 'development') {
|
|
3
5
|
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
4
6
|
rest[_key - 1] = arguments[_key];
|
|
5
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.0.9-alpha.
|
|
3
|
+
"version": "2.0.9-alpha.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"*.scss",
|
|
25
25
|
"*.css"
|
|
26
26
|
],
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "7a4c4799d28e62f8f278d53bfa08a21ee591dc5d",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
30
30
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
package/pagination/foundation.ts
CHANGED
|
@@ -12,9 +12,9 @@ export interface PaginationAdapter<P = Record<string, any>, S = Record<string, a
|
|
|
12
12
|
setCurrentPage: (pageIndex: number) => void;
|
|
13
13
|
registerKeyDownHandler: (handler: KeyDownHandler) => void;
|
|
14
14
|
unregisterKeyDownHandler: (handler: KeyDownHandler) => void;
|
|
15
|
-
notifyPageChange: (pageIndex: number
|
|
15
|
+
notifyPageChange: (pageIndex: number) => void;
|
|
16
16
|
notifyPageSizeChange: (pageSize: number) => void;
|
|
17
|
-
notifyChange: (pageIndex: number
|
|
17
|
+
notifyChange: (pageIndex: number, pageSize: number) => void;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export type PageRenderText = number | '...';
|
|
@@ -11,16 +11,16 @@ export interface Item {
|
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export interface ScrollItemAdapter<P = Record<string, any>, S = Record<string, any
|
|
14
|
+
export interface ScrollItemAdapter<P = Record<string, any>, S = Record<string, any>, I = Item> extends DefaultAdapter<P, S> {
|
|
15
15
|
setPrependCount: (prependCount: number) => void;
|
|
16
16
|
setAppendCount: (appendCount: number) => void;
|
|
17
17
|
setSelectedNode: (el: HTMLElement) => void;
|
|
18
18
|
isDisabledIndex: (i: number) => boolean;
|
|
19
|
-
notifySelectItem: (data:
|
|
19
|
+
notifySelectItem: (data: I) => void;
|
|
20
20
|
scrollToCenter: (selectedNode: Element, scrollWrapper?: Element, duration?: number) => void;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export default class ItemFoundation<P = Record<string, any>, S = Record<string, any
|
|
23
|
+
export default class ItemFoundation<P = Record<string, any>, S = Record<string, any>, I = Item> extends BaseFoundation<ScrollItemAdapter<P, S, I>, P, S> {
|
|
24
24
|
_cachedSelectedNode: HTMLElement = null;
|
|
25
25
|
|
|
26
26
|
selectIndex(index: number, listWrapper: HTMLElement) {
|
package/select/foundation.ts
CHANGED
|
@@ -45,8 +45,9 @@ export interface SelectAdapter<P = Record<string, any>, S = Record<string, any>>
|
|
|
45
45
|
updateHovering(isHover: boolean): void;
|
|
46
46
|
updateScrollTop(): void;
|
|
47
47
|
}
|
|
48
|
-
type PropValue = string | number | Record<string, any>;
|
|
49
48
|
|
|
49
|
+
type LabelValue = string | number;
|
|
50
|
+
type PropValue = LabelValue | Record<string, any>;
|
|
50
51
|
export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
|
|
51
52
|
|
|
52
53
|
constructor(adapter: SelectAdapter) {
|
|
@@ -258,11 +259,11 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
|
|
|
258
259
|
|
|
259
260
|
// When onChangeWithObject is true
|
|
260
261
|
if (onChangeWithObject && propValueIsArray) {
|
|
261
|
-
selectedValues = propValue.map(
|
|
262
|
+
selectedValues = (propValue as BasicOptionProps[]).map(item => item.value);
|
|
262
263
|
}
|
|
263
264
|
|
|
264
265
|
if (propValueIsArray && selectedValues.length) {
|
|
265
|
-
selectedValues.forEach((selectedValue
|
|
266
|
+
(selectedValues as LabelValue[]).forEach((selectedValue, i: number) => {
|
|
266
267
|
// The current value exists in the current optionList
|
|
267
268
|
const index = originalOptions.findIndex(option => option.value === selectedValue);
|
|
268
269
|
if (index !== -1) {
|
package/table/utils.ts
CHANGED
|
@@ -166,7 +166,7 @@ export function isSelectionColumn(column: Record<string, any>) {
|
|
|
166
166
|
return get(column, 'key') === strings.DEFAULT_KEY_COLUMN_SELECTION;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
export function filterColumns(columns: Record<string, any>[], ignoreKeys = [strings.DEFAULT_KEY_COLUMN_SCROLLBAR]) {
|
|
169
|
+
export function filterColumns(columns: Record<string, any>[], ignoreKeys = [strings.DEFAULT_KEY_COLUMN_SCROLLBAR as string]) {
|
|
170
170
|
return filter(columns, col => !ignoreKeys.includes(col.key));
|
|
171
171
|
}
|
|
172
172
|
|
package/treeSelect/foundation.ts
CHANGED
|
@@ -127,7 +127,7 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps,
|
|
|
127
127
|
searchRender?: (inputProps: any) => any;
|
|
128
128
|
renderSelectedItem?: BasicRenderSelectedItem;
|
|
129
129
|
getPopupContainer?: () => HTMLElement;
|
|
130
|
-
triggerRender?: (props: BasicTriggerRenderProps) => any;
|
|
130
|
+
// triggerRender?: (props: BasicTriggerRenderProps) => any;
|
|
131
131
|
onBlur?: (e: any) => void;
|
|
132
132
|
onChange?: BasicOnChange;
|
|
133
133
|
onFocus?: (e: any) => void;
|