@douyinfe/semi-foundation 2.76.0-alpha.1 → 2.76.0-alpha.5
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/datePicker/monthFoundation.ts +2 -6
- package/form/interface.ts +62 -69
- package/lib/cjs/calendar/eventUtil.d.ts +1 -1
- package/lib/cjs/chat/foundation.d.ts +0 -1
- package/lib/cjs/colorPicker/DataPartFoundation.d.ts +1 -1
- package/lib/cjs/colorPicker/foundation.d.ts +1 -1
- package/lib/cjs/colorPicker/utils/split.d.ts +1 -1
- package/lib/cjs/datePicker/constants.js +3 -0
- package/lib/cjs/datePicker/monthFoundation.d.ts +2 -6
- package/lib/cjs/form/foundation.d.ts +5 -5
- package/lib/cjs/form/interface.d.ts +19 -19
- package/lib/cjs/image/previewInnerFoundation.d.ts +0 -1
- package/lib/cjs/navigation/constants.js +3 -0
- package/lib/cjs/pincode/foundation.d.ts +1 -1
- package/lib/cjs/resizable/group/index.d.ts +0 -1
- package/lib/cjs/resizable/utils.d.ts +3 -3
- package/lib/cjs/select/foundation.d.ts +1 -1
- package/lib/cjs/slider/foundation.d.ts +15 -15
- package/lib/cjs/slider/foundation.js +3 -1
- package/lib/cjs/tooltip/constants.js +1 -0
- package/lib/cjs/utils/date-fns-extra.js +9 -1
- package/lib/cjs/utils/keyCode.js +25 -0
- package/lib/cjs/utils/object.d.ts +1 -1
- package/lib/es/calendar/eventUtil.d.ts +1 -1
- package/lib/es/chat/foundation.d.ts +0 -1
- package/lib/es/colorPicker/DataPartFoundation.d.ts +1 -1
- package/lib/es/colorPicker/foundation.d.ts +1 -1
- package/lib/es/colorPicker/utils/split.d.ts +1 -1
- package/lib/es/datePicker/constants.js +3 -0
- package/lib/es/datePicker/monthFoundation.d.ts +2 -6
- package/lib/es/form/foundation.d.ts +5 -5
- package/lib/es/form/interface.d.ts +19 -19
- package/lib/es/image/previewInnerFoundation.d.ts +0 -1
- package/lib/es/navigation/constants.js +3 -0
- package/lib/es/pincode/foundation.d.ts +1 -1
- package/lib/es/resizable/group/index.d.ts +0 -1
- package/lib/es/resizable/utils.d.ts +3 -3
- package/lib/es/select/foundation.d.ts +1 -1
- package/lib/es/slider/foundation.d.ts +15 -15
- package/lib/es/slider/foundation.js +3 -1
- package/lib/es/tooltip/constants.js +1 -0
- package/lib/es/utils/date-fns-extra.js +9 -1
- package/lib/es/utils/keyCode.js +25 -0
- package/lib/es/utils/object.d.ts +1 -1
- package/package.json +4 -4
- package/utils/object.ts +1 -1
|
@@ -19,8 +19,8 @@ export interface MonthFoundationProps {
|
|
|
19
19
|
disabledDate: (day: Date, options?: { rangeStart: string; rangeEnd: string }) => boolean;
|
|
20
20
|
weeksRowNum: number;
|
|
21
21
|
onWeeksRowNumChange: (weeksRowNum: number) => void;
|
|
22
|
-
renderDate: () =>
|
|
23
|
-
renderFullDate: () =>
|
|
22
|
+
renderDate: (dayNumber: number, fullDate: string) => React.ReactNode;
|
|
23
|
+
renderFullDate: (dayNumber: number, fullDate: string, dayStatus: any) => React.ReactNode;
|
|
24
24
|
hoverDay: string; // Real-time hover date
|
|
25
25
|
startDateOffset: () => void;
|
|
26
26
|
endDateOffset: () => void;
|
|
@@ -35,10 +35,6 @@ export type MonthDayInfo = {
|
|
|
35
35
|
dayNumber: number;
|
|
36
36
|
dayNumberFull?: string;
|
|
37
37
|
fullDate: string
|
|
38
|
-
} | {
|
|
39
|
-
dayNumber: string;
|
|
40
|
-
dayNumberFull?: string;
|
|
41
|
-
fullDate: string
|
|
42
38
|
};
|
|
43
39
|
|
|
44
40
|
export interface MonthInfo {
|
package/form/interface.ts
CHANGED
|
@@ -51,22 +51,49 @@ type ArrayIndexPath<K extends string | number, U> =
|
|
|
51
51
|
| `${K}.${number}` // 支持 array.index
|
|
52
52
|
| `${K}.${number}.${FieldPath<U>}`; // 支持 array.index.child
|
|
53
53
|
|
|
54
|
+
// FieldPath 类型定义,支持对象和数组字段路径
|
|
55
|
+
// export type FieldPath<T> = T extends Array<infer U>
|
|
56
|
+
// ? | `${number}` // 如果是数组,支持数字索引(如 `[0]`)
|
|
57
|
+
// | `${number}.${FieldPath<U>}` // 支持数组嵌套路径(如 `[0].field`)
|
|
58
|
+
// : T extends object
|
|
59
|
+
// ? {
|
|
60
|
+
// [K in keyof T]: K extends string
|
|
61
|
+
// ? T[K] extends Array<infer U> | object
|
|
62
|
+
// ? | `${K}`
|
|
63
|
+
// | `${K}.${FieldPath<T[K]>}`
|
|
64
|
+
// | ArrayIndexPath<K, U>
|
|
65
|
+
// : `${K}` // 只允许键路径
|
|
66
|
+
// : never;
|
|
67
|
+
// }[keyof T]
|
|
68
|
+
// : never;
|
|
69
|
+
|
|
54
70
|
// FieldPath 类型定义,支持对象和数组字段路径
|
|
55
71
|
export type FieldPath<T> = T extends Array<infer U>
|
|
56
|
-
? | `${number}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
?
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
: `${K}`
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
? `${number}` | `${number}.${FieldPath<Exclude<U, undefined>>}`
|
|
73
|
+
: T extends object ? {
|
|
74
|
+
[K in keyof T]: K extends string
|
|
75
|
+
? Exclude<T[K], undefined> extends Date
|
|
76
|
+
? `${K}`
|
|
77
|
+
: T[K] extends Array<infer U> | object | undefined
|
|
78
|
+
? `${K}` |
|
|
79
|
+
`${K}.${FieldPath<T[K]>}` |
|
|
80
|
+
ArrayIndexPath<K, U>
|
|
81
|
+
: `${K}`
|
|
82
|
+
: never;
|
|
83
|
+
}[keyof T]
|
|
68
84
|
: never;
|
|
69
85
|
|
|
86
|
+
|
|
87
|
+
export type FieldPathValue<T, P extends string> =
|
|
88
|
+
ArrayFieldPathValue<T, P> |
|
|
89
|
+
(P extends `${infer K}.${infer Rest}`
|
|
90
|
+
? K extends keyof T
|
|
91
|
+
? FieldPathValue<Exclude<T[K], undefined>, Rest> // 添加 undefined过滤,避免用户 tsconfig strictNullChecks 为 true 时,无法正确推断
|
|
92
|
+
: never
|
|
93
|
+
: P extends keyof T
|
|
94
|
+
? T[P]
|
|
95
|
+
: never);
|
|
96
|
+
|
|
70
97
|
type ArrayFieldPathValue<T, P extends string> =
|
|
71
98
|
P extends `${infer K}[${infer I}]${infer Rest}`
|
|
72
99
|
? K extends keyof T
|
|
@@ -83,68 +110,34 @@ type ArrayFieldPathValue<T, P extends string> =
|
|
|
83
110
|
: never;
|
|
84
111
|
|
|
85
112
|
// FieldPathValue 类型定义,支持从路径字符串中推导数组和对象的值
|
|
86
|
-
export type FieldPathValue<T, P extends string> =
|
|
87
|
-
ArrayFieldPathValue<T, P> // 处理数组路径
|
|
88
|
-
| (P extends `${infer K}.${infer Rest}`
|
|
89
|
-
? K extends keyof T
|
|
90
|
-
? FieldPathValue<T[K], Rest>
|
|
91
|
-
: never
|
|
92
|
-
: P extends keyof T
|
|
93
|
-
? T[P]
|
|
94
|
-
: never);
|
|
95
|
-
|
|
96
|
-
// FieldPathValue 类型定义,支持从路径字符串中推导数组和对象的值 (Complex version)
|
|
97
113
|
// export type FieldPathValue<T, P extends string> =
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
101
|
-
//
|
|
102
|
-
//
|
|
103
|
-
//
|
|
104
|
-
//
|
|
105
|
-
//
|
|
106
|
-
// : never
|
|
107
|
-
// : never
|
|
108
|
-
// : never
|
|
109
|
-
// : never
|
|
110
|
-
// : P extends `${infer K}.${infer Rest}` // 处理 key.rest 或 array.index 形式
|
|
111
|
-
// ? K extends keyof T
|
|
112
|
-
// ? T[K] extends Array<infer U>
|
|
113
|
-
// ? Rest extends `${number}${infer IndexRest}`
|
|
114
|
-
// ? IndexRest extends ''
|
|
115
|
-
// ? U // 简单的数组索引访问 (array.0)
|
|
116
|
-
// : IndexRest extends `.${infer RestPath}`
|
|
117
|
-
// ? FieldPathValue<U, RestPath> // 嵌套路径 (array.0.field)
|
|
118
|
-
// : never
|
|
119
|
-
// : FieldPathValue<T[K], Rest> // 其他嵌套对象字段
|
|
120
|
-
// : FieldPathValue<T[K], Rest>
|
|
121
|
-
// : never
|
|
122
|
-
// : P extends keyof T // 简单的顶层键访问
|
|
123
|
-
// ? T[P]
|
|
124
|
-
// : P extends `${number}` // 对于顶层数组路径
|
|
125
|
-
// ? T extends Array<infer U>
|
|
126
|
-
// ? U
|
|
127
|
-
// : never
|
|
128
|
-
// : never;
|
|
114
|
+
// ArrayFieldPathValue<T, P> // 处理数组路径
|
|
115
|
+
// | (P extends `${infer K}.${infer Rest}`
|
|
116
|
+
// ? K extends keyof T
|
|
117
|
+
// ? FieldPathValue<Exclude<T[K], undefined>, Rest> // 添加 undefined过滤,避免用户 tsconfig strictNullChecks 为 true 时,无法正确推断
|
|
118
|
+
// : never
|
|
119
|
+
// : P extends keyof T
|
|
120
|
+
// ? T[P]
|
|
121
|
+
// : never);
|
|
129
122
|
|
|
130
123
|
// use object replace Record<string, any>, fix issue 933
|
|
131
|
-
export interface BaseFormApi<
|
|
124
|
+
export interface BaseFormApi<FormValuesType extends object = any> {
|
|
132
125
|
/** get value of field */
|
|
133
|
-
getValue: <
|
|
126
|
+
getValue: <F extends FieldPath<FormValuesType>>(field?: F) => FieldPathValue<FormValuesType, F>;
|
|
134
127
|
/** set value of field */
|
|
135
|
-
setValue: <
|
|
128
|
+
setValue: <F extends FieldPath<FormValuesType>>(field: F, newFieldValue: any) => void;
|
|
136
129
|
/** get error of field */
|
|
137
|
-
getError: <
|
|
130
|
+
getError: <F extends FieldPath<FormValuesType>>(field: F) => any;
|
|
138
131
|
/** set error of field */
|
|
139
|
-
setError: <
|
|
132
|
+
setError: <F extends FieldPath<FormValuesType>>(field: F, fieldError: any) => void;
|
|
140
133
|
/** get touched of field */
|
|
141
|
-
getTouched: <
|
|
134
|
+
getTouched: <F extends FieldPath<FormValuesType>>(field: F) => boolean;
|
|
142
135
|
/** set touch of field */
|
|
143
|
-
setTouched: <
|
|
136
|
+
setTouched: <F extends FieldPath<FormValuesType>>(field: F, fieldTouch: boolean) => void;
|
|
144
137
|
/** judge field exist */
|
|
145
|
-
getFieldExist: <
|
|
138
|
+
getFieldExist: <F extends FieldPath<FormValuesType>>(field: F) => boolean;
|
|
146
139
|
/** get formState of form */
|
|
147
|
-
getFormState: () => FormState<
|
|
140
|
+
getFormState: () => FormState<FormValuesType extends object ? FormValuesType : object>;
|
|
148
141
|
/** get formProps of form */
|
|
149
142
|
getFormProps: (keys?: Array<string>) => ComponentProps;
|
|
150
143
|
/** submit form manual */
|
|
@@ -152,14 +145,14 @@ export interface BaseFormApi<T extends object = any> {
|
|
|
152
145
|
/** reset form manual */
|
|
153
146
|
reset: (fields?: Array<string>) => void;
|
|
154
147
|
/** trigger validate manual */
|
|
155
|
-
validate: <K extends keyof
|
|
156
|
-
getInitValue: <
|
|
148
|
+
validate: <K extends keyof FormValuesType, Params extends Array<K>, V extends Params[number]>(fields?: Params) => Promise<{ [R in V]: [R] }>;
|
|
149
|
+
getInitValue: <F extends FieldPath<FormValuesType>>(field: F) => any;
|
|
157
150
|
getInitValues: () => any;
|
|
158
|
-
getValues: () =>
|
|
151
|
+
getValues: () => FormValuesType;
|
|
159
152
|
/** set value of multiple fields */
|
|
160
|
-
setValues: (fieldsValue: Partial<
|
|
161
|
-
scrollToField: <
|
|
162
|
-
scrollToError: <
|
|
153
|
+
setValues: (fieldsValue: Partial<FormValuesType>, config?: setValuesConfig) => void;
|
|
154
|
+
scrollToField: <F extends FieldPath<FormValuesType>>(field: F, scrollConfig?: ScrollIntoViewOptions) => void;
|
|
155
|
+
scrollToError: <F extends FieldPath<FormValuesType>>(config?: ScrollToErrorOptions<F>) => void
|
|
163
156
|
}
|
|
164
157
|
|
|
165
158
|
export interface CallOpts {
|
|
@@ -65,7 +65,7 @@ export declare const parseEvent: (event: EventObject) => any[];
|
|
|
65
65
|
* @returns {map}
|
|
66
66
|
* convert events array to may, use datestring as key
|
|
67
67
|
*/
|
|
68
|
-
export declare const convertEventsArrToMap: (arr: EventObject[], key:
|
|
68
|
+
export declare const convertEventsArrToMap: (arr: EventObject[], key: "start" | "date", func: (val: Date) => Date, displayValue?: Date) => Map<any, any>;
|
|
69
69
|
/**
|
|
70
70
|
* @returns {arr}
|
|
71
71
|
* filter out event that is not in the date range
|
|
@@ -23,6 +23,6 @@ declare class DataPartFoundation extends BaseFoundation<DataPartAdapter<DataPart
|
|
|
23
23
|
getValueByInputValue: (value: string) => string | false | HsvaColor | RgbaColor;
|
|
24
24
|
handlePickValueWithStraw: () => Promise<void>;
|
|
25
25
|
handleInputValueChange: (value: string) => void;
|
|
26
|
-
handleFormatChange: (format: DataPartBaseState[
|
|
26
|
+
handleFormatChange: (format: DataPartBaseState["format"]) => void;
|
|
27
27
|
}
|
|
28
28
|
export default DataPartFoundation;
|
|
@@ -36,7 +36,7 @@ declare class ColorPickerFoundation extends BaseFoundation<ColorPickerAdapter<Co
|
|
|
36
36
|
handleChangeH: (currentColor: ColorValue, newH: number) => void;
|
|
37
37
|
handleChangeA: (currentColor: ColorValue, newAlpha: number) => void;
|
|
38
38
|
getCurrentColor: () => any;
|
|
39
|
-
handleChange: (color: HsvaColor | RgbaColor | string, format:
|
|
39
|
+
handleChange: (color: HsvaColor | RgbaColor | string, format: "hex" | "rgba" | "hsva") => void;
|
|
40
40
|
handleAlphaChangeByHandle: (newAlpha: {
|
|
41
41
|
a: number;
|
|
42
42
|
}) => void;
|
|
@@ -58,7 +58,10 @@ const strings = exports.strings = Object.assign({
|
|
|
58
58
|
}, formatToken);
|
|
59
59
|
const numbers = exports.numbers = {
|
|
60
60
|
WEEK_START_ON: 0,
|
|
61
|
+
// Take the day of the week as the first day of the week, 0 for Sunday, 1 for Monday, and so on
|
|
61
62
|
WEEK_HEIGHT: 36,
|
|
63
|
+
// Date per line height 36px
|
|
62
64
|
SPACING: _constants2.numbers.SPACING,
|
|
65
|
+
// Floating distance trigger interval
|
|
63
66
|
SPACING_INSET_INPUT: 1
|
|
64
67
|
};
|
|
@@ -17,8 +17,8 @@ export interface MonthFoundationProps {
|
|
|
17
17
|
}) => boolean;
|
|
18
18
|
weeksRowNum: number;
|
|
19
19
|
onWeeksRowNumChange: (weeksRowNum: number) => void;
|
|
20
|
-
renderDate: () =>
|
|
21
|
-
renderFullDate: () =>
|
|
20
|
+
renderDate: (dayNumber: number, fullDate: string) => React.ReactNode;
|
|
21
|
+
renderFullDate: (dayNumber: number, fullDate: string, dayStatus: any) => React.ReactNode;
|
|
22
22
|
hoverDay: string;
|
|
23
23
|
startDateOffset: () => void;
|
|
24
24
|
endDateOffset: () => void;
|
|
@@ -32,10 +32,6 @@ export type MonthDayInfo = {
|
|
|
32
32
|
dayNumber: number;
|
|
33
33
|
dayNumberFull?: string;
|
|
34
34
|
fullDate: string;
|
|
35
|
-
} | {
|
|
36
|
-
dayNumber: string;
|
|
37
|
-
dayNumberFull?: string;
|
|
38
|
-
fullDate: string;
|
|
39
35
|
};
|
|
40
36
|
export interface MonthInfo {
|
|
41
37
|
weeks: Array<MonthDayInfo[]>;
|
|
@@ -63,13 +63,13 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
63
63
|
updateStateValue: (field: string, value: any, opts: CallOpts, callback?: () => void) => void;
|
|
64
64
|
updateStateError: (field: string, error: any, opts: CallOpts, callback?: () => void) => void;
|
|
65
65
|
updateStateTouched: (field: string, isTouched: boolean, opts?: CallOpts, callback?: () => void) => void;
|
|
66
|
-
getValue: (field: string, opts?: CallOpts) => any;
|
|
66
|
+
getValue: (field: string | undefined, opts?: CallOpts) => any;
|
|
67
67
|
getError: (field?: string) => any;
|
|
68
|
-
getTouched: (field?: string) => boolean | Record<string, any
|
|
68
|
+
getTouched: (field?: string) => boolean | Record<string, any> | undefined;
|
|
69
69
|
getInitValues: () => any;
|
|
70
70
|
getInitValue: (field?: string) => any;
|
|
71
|
-
getFormProps: (keys?: string
|
|
72
|
-
getField: (field: string) => FieldStaff;
|
|
71
|
+
getFormProps: (keys?: Array<string>) => ComponentProps;
|
|
72
|
+
getField: (field: string) => FieldStaff | undefined;
|
|
73
73
|
registerArrayField: (arrayFieldPath: string, val: any) => void;
|
|
74
74
|
unRegisterArrayField: (arrayField: string) => void;
|
|
75
75
|
getArrayField: (arrayField: string) => ArrayFieldStaff;
|
|
@@ -103,6 +103,6 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
103
103
|
getFieldExist(field: string): boolean;
|
|
104
104
|
_autoScroll(timeout?: boolean | number): void;
|
|
105
105
|
_getErrorFieldAndScroll(scrollOpts?: ScrollIntoViewOptions | boolean): void;
|
|
106
|
-
scrollToField(field: string, scrollOpts?: ScrollIntoViewOptions
|
|
106
|
+
scrollToField(field: string, scrollOpts?: ScrollIntoViewOptions): void;
|
|
107
107
|
scrollToError(config?: ScrollToErrorOpts): void;
|
|
108
108
|
}
|
|
@@ -39,28 +39,28 @@ export type ScrollToErrorOptions<K> = {
|
|
|
39
39
|
scrollOpts?: ScrollIntoViewOptions;
|
|
40
40
|
};
|
|
41
41
|
type ArrayIndexPath<K extends string | number, U> = `${K}[${number}]` | `${K}[${number}].${FieldPath<U>}` | `${K}.${number}` | `${K}.${number}.${FieldPath<U>}`;
|
|
42
|
-
export type FieldPath<T> = T extends Array<infer U> ? `${number}` | `${number}.${FieldPath<U
|
|
43
|
-
[K in keyof T]: K extends string ? T[K] extends Array<infer U> | object ? `${K}` | `${K}.${FieldPath<T[K]>}` | ArrayIndexPath<K, U> : `${K}` : never;
|
|
42
|
+
export type FieldPath<T> = T extends Array<infer U> ? `${number}` | `${number}.${FieldPath<Exclude<U, undefined>>}` : T extends object ? {
|
|
43
|
+
[K in keyof T]: K extends string ? Exclude<T[K], undefined> extends Date ? `${K}` : T[K] extends Array<infer U> | object | undefined ? `${K}` | `${K}.${FieldPath<T[K]>}` | ArrayIndexPath<K, U> : `${K}` : never;
|
|
44
44
|
}[keyof T] : never;
|
|
45
|
+
export type FieldPathValue<T, P extends string> = ArrayFieldPathValue<T, P> | (P extends `${infer K}.${infer Rest}` ? K extends keyof T ? FieldPathValue<Exclude<T[K], undefined>, Rest> : never : P extends keyof T ? T[P] : never);
|
|
45
46
|
type ArrayFieldPathValue<T, P extends string> = P extends `${infer K}[${infer I}]${infer Rest}` ? K extends keyof T ? T[K] extends Array<infer U> ? I extends `${number}` ? Rest extends '' ? U : Rest extends `.${infer RestPath}` ? FieldPathValue<U, RestPath> : never : never : never : never : never;
|
|
46
|
-
export
|
|
47
|
-
export interface BaseFormApi<T extends object = any> {
|
|
47
|
+
export interface BaseFormApi<FormValuesType extends object = any> {
|
|
48
48
|
/** get value of field */
|
|
49
|
-
getValue: <
|
|
49
|
+
getValue: <F extends FieldPath<FormValuesType>>(field?: F) => FieldPathValue<FormValuesType, F>;
|
|
50
50
|
/** set value of field */
|
|
51
|
-
setValue: <
|
|
51
|
+
setValue: <F extends FieldPath<FormValuesType>>(field: F, newFieldValue: any) => void;
|
|
52
52
|
/** get error of field */
|
|
53
|
-
getError: <
|
|
53
|
+
getError: <F extends FieldPath<FormValuesType>>(field: F) => any;
|
|
54
54
|
/** set error of field */
|
|
55
|
-
setError: <
|
|
55
|
+
setError: <F extends FieldPath<FormValuesType>>(field: F, fieldError: any) => void;
|
|
56
56
|
/** get touched of field */
|
|
57
|
-
getTouched: <
|
|
57
|
+
getTouched: <F extends FieldPath<FormValuesType>>(field: F) => boolean;
|
|
58
58
|
/** set touch of field */
|
|
59
|
-
setTouched: <
|
|
59
|
+
setTouched: <F extends FieldPath<FormValuesType>>(field: F, fieldTouch: boolean) => void;
|
|
60
60
|
/** judge field exist */
|
|
61
|
-
getFieldExist: <
|
|
61
|
+
getFieldExist: <F extends FieldPath<FormValuesType>>(field: F) => boolean;
|
|
62
62
|
/** get formState of form */
|
|
63
|
-
getFormState: () => FormState<
|
|
63
|
+
getFormState: () => FormState<FormValuesType extends object ? FormValuesType : object>;
|
|
64
64
|
/** get formProps of form */
|
|
65
65
|
getFormProps: (keys?: Array<string>) => ComponentProps;
|
|
66
66
|
/** submit form manual */
|
|
@@ -68,16 +68,16 @@ export interface BaseFormApi<T extends object = any> {
|
|
|
68
68
|
/** reset form manual */
|
|
69
69
|
reset: (fields?: Array<string>) => void;
|
|
70
70
|
/** trigger validate manual */
|
|
71
|
-
validate: <K extends keyof
|
|
72
|
-
[R in V]:
|
|
71
|
+
validate: <K extends keyof FormValuesType, Params extends Array<K>, V extends Params[number]>(fields?: Params) => Promise<{
|
|
72
|
+
[R in V]: [R];
|
|
73
73
|
}>;
|
|
74
|
-
getInitValue: <
|
|
74
|
+
getInitValue: <F extends FieldPath<FormValuesType>>(field: F) => any;
|
|
75
75
|
getInitValues: () => any;
|
|
76
|
-
getValues: () =>
|
|
76
|
+
getValues: () => FormValuesType;
|
|
77
77
|
/** set value of multiple fields */
|
|
78
|
-
setValues: (fieldsValue: Partial<
|
|
79
|
-
scrollToField: <
|
|
80
|
-
scrollToError: <
|
|
78
|
+
setValues: (fieldsValue: Partial<FormValuesType>, config?: setValuesConfig) => void;
|
|
79
|
+
scrollToField: <F extends FieldPath<FormValuesType>>(field: F, scrollConfig?: ScrollIntoViewOptions) => void;
|
|
80
|
+
scrollToError: <F extends FieldPath<FormValuesType>>(config?: ScrollToErrorOptions<F>) => void;
|
|
81
81
|
}
|
|
82
82
|
export interface CallOpts {
|
|
83
83
|
[x: string]: any;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="lodash" />
|
|
2
1
|
import BaseFoundation, { DefaultAdapter } from "../base/foundation";
|
|
3
2
|
export type RatioType = "adaptation" | "realSize";
|
|
4
3
|
export interface PreviewInnerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
@@ -23,7 +23,10 @@ const strings = exports.strings = {
|
|
|
23
23
|
const numbers = exports.numbers = {
|
|
24
24
|
DEFAULT_SUBNAV_MAX_HEIGHT: 999,
|
|
25
25
|
DEFAULT_TOOLTIP_SHOW_DELAY: 0,
|
|
26
|
+
// ms
|
|
26
27
|
DEFAULT_TOOLTIP_HIDE_DELAY: 100,
|
|
28
|
+
// ms
|
|
27
29
|
DEFAULT_SUBNAV_OPEN_DELAY: 0,
|
|
30
|
+
// ms
|
|
28
31
|
DEFAULT_SUBNAV_CLOSE_DELAY: 100 // ms
|
|
29
32
|
};
|
|
@@ -26,7 +26,7 @@ declare class PinCodeFoundation<P = Record<string, any>, S = Record<string, any>
|
|
|
26
26
|
handleCurrentActiveIndexChange: (index: number, state: "focus" | "blur") => void;
|
|
27
27
|
completeSingleInput: (i: number, singleInputValue: string) => Promise<void>;
|
|
28
28
|
validateValue: (value?: string) => boolean;
|
|
29
|
-
updateValueList: (newValueList: PinCodeBaseState[
|
|
29
|
+
updateValueList: (newValueList: PinCodeBaseState["valueList"]) => Promise<void>;
|
|
30
30
|
handlePaste: (e: ClipboardEvent, startInputIndex: number) => Promise<void>;
|
|
31
31
|
handleKeyDownOnSingleInput: (e: KeyboardEvent, index: number) => void;
|
|
32
32
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="lodash" />
|
|
2
1
|
import BaseFoundation, { DefaultAdapter } from '../../base/foundation';
|
|
3
2
|
import { ResizeStartCallback, ResizeCallback, ResizeEventType } from "../types";
|
|
4
3
|
export interface ResizeHandlerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const clamp: (n: number, min: number, max: number) => number;
|
|
2
2
|
export declare const snap: (n: number, size: number) => number;
|
|
3
|
-
export declare const has: (dir:
|
|
3
|
+
export declare const has: (dir: "top" | "right" | "bottom" | "left", target: string) => boolean;
|
|
4
4
|
export declare const findNextSnap: (n: number, snapArray: number[], snapGap?: number) => number;
|
|
5
5
|
export declare const getStringSize: (n: number | string) => string;
|
|
6
6
|
export declare const getNumberSize: (size: undefined | string | number, parentSize: number, innerWidth: number, innerHeight: number) => number;
|
|
@@ -13,8 +13,8 @@ export declare const calculateNewMax: (parentSize: {
|
|
|
13
13
|
minWidth: number;
|
|
14
14
|
minHeight: number;
|
|
15
15
|
};
|
|
16
|
-
export declare const getItemDirection: (dir:
|
|
16
|
+
export declare const getItemDirection: (dir: "vertical" | "horizontal") => string[];
|
|
17
17
|
export declare const getPixelSize: (size: string, parentSize: number) => number;
|
|
18
18
|
export declare const judgeConstraint: (newSize: number, min: string, max: string, parentSize: number, offset?: number) => boolean;
|
|
19
19
|
export declare const adjustNewSize: (newSize: number, min: string, max: string, parentSize: number, offset: number) => number;
|
|
20
|
-
export declare const getOffset: (style: CSSStyleDeclaration, direction:
|
|
20
|
+
export declare const getOffset: (style: CSSStyleDeclaration, direction: "horizontal" | "vertical") => number;
|
|
@@ -103,7 +103,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
|
|
|
103
103
|
_removeInternalKey(option: BasicOptionProps): {
|
|
104
104
|
[x: string]: any;
|
|
105
105
|
value?: string | number;
|
|
106
|
-
label?: unknown;
|
|
106
|
+
label?: string | number | unknown;
|
|
107
107
|
children?: unknown;
|
|
108
108
|
disabled?: boolean;
|
|
109
109
|
showTick?: boolean;
|
|
@@ -123,7 +123,7 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
123
123
|
* @formatter: tooltip content formatting function
|
|
124
124
|
* @memberof SliderFoundation
|
|
125
125
|
*/
|
|
126
|
-
computeHandleVisibleVal: (visible: SliderProps[
|
|
126
|
+
computeHandleVisibleVal: (visible: SliderProps["tooltipVisible"], formatter: SliderProps["tipFormatter"], range: SliderProps["range"]) => {
|
|
127
127
|
tipVisible: {
|
|
128
128
|
min: boolean;
|
|
129
129
|
max: boolean;
|
|
@@ -135,7 +135,7 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
135
135
|
*
|
|
136
136
|
* @memberof SliderFoundation
|
|
137
137
|
*/
|
|
138
|
-
valueFormatIsCorrect: (value: SliderProps[
|
|
138
|
+
valueFormatIsCorrect: (value: SliderProps["value"]) => boolean;
|
|
139
139
|
/**
|
|
140
140
|
* Fix the mouse position to position the parent container relative to the position
|
|
141
141
|
*
|
|
@@ -168,7 +168,7 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
168
168
|
*
|
|
169
169
|
* @memberof SliderFoundation
|
|
170
170
|
*/
|
|
171
|
-
transValueToPos: (value: SliderProps[
|
|
171
|
+
transValueToPos: (value: SliderProps["value"]) => number | number[];
|
|
172
172
|
/**
|
|
173
173
|
* Determine whether the mark should be highlighted: valid interval and include = false
|
|
174
174
|
*
|
|
@@ -180,8 +180,8 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
180
180
|
*
|
|
181
181
|
* @memberof SliderFoundation
|
|
182
182
|
*/
|
|
183
|
-
outPutValue: (inputValue: SliderProps[
|
|
184
|
-
handleDisabledChange: (disabled: SliderState[
|
|
183
|
+
outPutValue: (inputValue: SliderProps["value"]) => number | number[];
|
|
184
|
+
handleDisabledChange: (disabled: SliderState["disabled"]) => void;
|
|
185
185
|
checkAndUpdateIsInRenderTreeState: () => boolean;
|
|
186
186
|
calculateOutputValue: (position: number, isMin: boolean) => undefined | number | number[];
|
|
187
187
|
/**
|
|
@@ -189,22 +189,22 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
189
189
|
*
|
|
190
190
|
* @memberof SliderFoundation
|
|
191
191
|
*/
|
|
192
|
-
handleValueChange: (prevValue: SliderProps[
|
|
192
|
+
handleValueChange: (prevValue: SliderProps["value"], nextValue: SliderProps["value"]) => void;
|
|
193
193
|
onHandleDown: (e: any, handler: any) => boolean;
|
|
194
194
|
onHandleMove: (e: any) => boolean;
|
|
195
|
-
onHandleTouchStart: (e: any, handler:
|
|
195
|
+
onHandleTouchStart: (e: any, handler: "min" | "max") => void;
|
|
196
196
|
onHandleTouchMove: (e: any) => void;
|
|
197
|
-
onHandleEnter: (pos: SliderState[
|
|
197
|
+
onHandleEnter: (pos: SliderState["focusPos"]) => void;
|
|
198
198
|
onHandleLeave: () => void;
|
|
199
199
|
onHandleUp: (e: any) => boolean;
|
|
200
|
-
_handleValueDecreaseWithKeyBoard: (step: number, handler:
|
|
201
|
-
_handleValueIncreaseWithKeyBoard: (step: number, handler:
|
|
202
|
-
_handleHomeKey: (handler:
|
|
203
|
-
_handleEndKey: (handler:
|
|
204
|
-
handleKeyDown: (event: any, handler:
|
|
200
|
+
_handleValueDecreaseWithKeyBoard: (step: number, handler: "min" | "max") => number | any[];
|
|
201
|
+
_handleValueIncreaseWithKeyBoard: (step: number, handler: "min" | "max") => any;
|
|
202
|
+
_handleHomeKey: (handler: "min" | "max") => any;
|
|
203
|
+
_handleEndKey: (handler: "min" | "max") => any;
|
|
204
|
+
handleKeyDown: (event: any, handler: "min" | "max") => void;
|
|
205
205
|
_noTooltip: () => boolean;
|
|
206
|
-
onFocus: (e: any, handler:
|
|
207
|
-
onBlur: (e: any, handler:
|
|
206
|
+
onFocus: (e: any, handler: "min" | "max") => void;
|
|
207
|
+
onBlur: (e: any, handler: "min" | "max") => void;
|
|
208
208
|
handleWrapClick: (e: any) => void;
|
|
209
209
|
/**
|
|
210
210
|
* Move the slider to the current click position
|
|
@@ -344,7 +344,9 @@ class SliderFoundation extends _foundation.default {
|
|
|
344
344
|
const disableState = {};
|
|
345
345
|
if (this.valueFormatIsCorrect(nextValue)) {
|
|
346
346
|
if (Array.isArray(prevValue) && Array.isArray(nextValue)) {
|
|
347
|
-
nextValue = [nextValue[0] < min ? min : nextValue[0],
|
|
347
|
+
nextValue = [nextValue[0] < min ? min : nextValue[0],
|
|
348
|
+
// Math.round(nextValue[0]),
|
|
349
|
+
nextValue[1] > max ? max : nextValue[1] // Math.round(nextValue[1])
|
|
348
350
|
];
|
|
349
351
|
// this._adapter.notifyChange(this.outPutValue(nextValue));
|
|
350
352
|
resultState = Object.assign(disableState, {
|
|
@@ -11,7 +11,15 @@ var _dateFns = require("date-fns");
|
|
|
11
11
|
/**
|
|
12
12
|
* Need to be IANA logo without daylight saving time
|
|
13
13
|
*/
|
|
14
|
-
const IANAOffsetMap = exports.IANAOffsetMap = [[-11, ['Pacific/Midway']], [-10, ['Pacific/Honolulu']], [-9.5, ['Pacific/Marquesas']], [-9, ['Pacific/Gambier']], [-8, ['Pacific/Pitcairn']], [-7, ['America/Phoenix']], [-6, ['America/Tegucigalpa']], [-5, ['America/Bogota']], [-4, ['America/Puerto_Rico']], [-3.5, ['America/St_Johns']],
|
|
14
|
+
const IANAOffsetMap = exports.IANAOffsetMap = [[-11, ['Pacific/Midway']], [-10, ['Pacific/Honolulu']], [-9.5, ['Pacific/Marquesas']], [-9, ['Pacific/Gambier']], [-8, ['Pacific/Pitcairn']], [-7, ['America/Phoenix']], [-6, ['America/Tegucigalpa']], [-5, ['America/Bogota']], [-4, ['America/Puerto_Rico']], [-3.5, ['America/St_Johns']],
|
|
15
|
+
// No alternative daylight saving time zone
|
|
16
|
+
[-3, ['America/Montevideo']], [-2, ['Atlantic/South_Georgia']], [-1, ['Atlantic/Cape_Verde']], [0, ['Africa/Accra']], [1, ['Africa/Bangui']], [2, ['Africa/Cairo']], [3, ['Asia/Bahrain', 'Indian/Antananarivo']], [3.5, ['Asia/Tehran']],
|
|
17
|
+
// No alternative daylight saving time zone
|
|
18
|
+
[4, ['Asia/Dubai', 'Asia/Muscat']], [4.5, ['Asia/Kabul']], [5, ['Asia/Samarkand', 'Asia/Karachi']], [5.5, ['Asia/Kolkata']], [5.75, ['Asia/Kathmandu']], [6, ['Asia/Dhaka']], [6.5, ['Asia/Rangoon', 'Asia/Rangoon']], [7, ['Asia/Jakarta', 'Asia/Phnom_Penh', 'Asia/Bangkok']], [8, ['Asia/Shanghai', 'Asia/Singapore']], [8.75, ['Australia/Eucla']], [9, ['Asia/Tokyo', 'Asia/Seoul', 'Asia/Pyongyang']], [9.5, ['Australia/Darwin']], [10, ['Pacific/Guam']], [10.5, ['Australia/Adelaide']],
|
|
19
|
+
// No alternative daylight saving time zone
|
|
20
|
+
[11, ['Pacific/Guadalcanal']], [12, ['Pacific/Funafuti']], [13, ['Pacific/Enderbury']], [13.75, ['Pacific/Chatham']],
|
|
21
|
+
// No alternative daylight saving time zone
|
|
22
|
+
[14, ['Pacific/Kiritimati']]];
|
|
15
23
|
/**
|
|
16
24
|
* Etc/GMT* no DST
|
|
17
25
|
* @see https://data.iana.org/time-zones/tzdb/etcetera
|