@signalplus/params-about 1.0.2 → 1.0.4-alpha
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/index.d.ts +254 -308
- package/lib/es/index.js +16 -11
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -2,390 +2,336 @@ import React, { PureComponent, ComponentProps } from 'react';
|
|
|
2
2
|
import ReactGlobalComp from 'react-global-comp';
|
|
3
3
|
|
|
4
4
|
declare enum ParamType {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
ParamGroup = -1,
|
|
6
|
+
Number = 1,
|
|
7
|
+
Percentage = 2,
|
|
8
|
+
Bool = 3,
|
|
9
|
+
NumberRange = 4,
|
|
10
|
+
PercentageRange = 5,
|
|
11
|
+
ExpiryLimit = 6,
|
|
12
|
+
Expiry = 7,
|
|
13
|
+
Phone = 8,
|
|
14
|
+
Text = 9
|
|
15
15
|
}
|
|
16
16
|
interface BaseInputProps {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
value?: any;
|
|
18
|
+
onChange?(val: any): void;
|
|
19
|
+
onBlur?(): void;
|
|
20
|
+
readonly?: boolean;
|
|
21
|
+
className?: string;
|
|
22
|
+
style?: any;
|
|
23
|
+
[key: string]: any | undefined | null;
|
|
24
24
|
}
|
|
25
25
|
interface ValidateInfo {
|
|
26
|
-
|
|
26
|
+
[key: string]: undefined | string | ValidateInfo;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
declare type ParamValueStruct = Record<string, any>;
|
|
30
30
|
interface ParamRendererProps extends BaseInputProps {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
valueType?: ParamType;
|
|
32
|
+
value?: ParamValueStruct;
|
|
33
|
+
expiriesOptions?: string[];
|
|
34
|
+
onChange?(val: ParamValueStruct): void;
|
|
35
35
|
}
|
|
36
36
|
declare class ParamRenderer extends PureComponent<ParamRendererProps> {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
get typeConfig(): {
|
|
38
|
+
name: string;
|
|
39
|
+
key?: string | undefined;
|
|
40
|
+
defaultValue?: any;
|
|
41
|
+
Comp: React.ComponentType<BaseInputProps>;
|
|
42
|
+
validator?(value: any): string;
|
|
43
|
+
required?: boolean | undefined;
|
|
44
|
+
};
|
|
45
|
+
get value(): any;
|
|
46
|
+
onChange: (val: any) => void;
|
|
47
|
+
render(): JSX.Element;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
interface ParentSelectorOption {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
parentId?: string | number;
|
|
52
|
+
$paramId: string | number;
|
|
53
|
+
name?: string;
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
valueType: ParamType;
|
|
56
|
+
children?: ParentSelectorOption[];
|
|
57
|
+
[key: string]: any;
|
|
58
58
|
}
|
|
59
59
|
interface ParentSelectorProps extends BaseInputProps {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
parentOptions?: ParentSelectorOption[];
|
|
61
|
+
value?: string;
|
|
62
|
+
onChange?(val: string): void;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
interface ParamFormData {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
parentId?: string;
|
|
67
|
+
$paramId?: string;
|
|
68
|
+
key: string;
|
|
69
|
+
name?: string;
|
|
70
|
+
valueType: ParamType;
|
|
71
|
+
defaultValue?: Record<string, any>;
|
|
72
|
+
description?: string;
|
|
73
73
|
}
|
|
74
74
|
interface ParamFormProps {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
parentOptions: ParentSelectorProps['parentOptions'];
|
|
76
|
+
allKeys: string[];
|
|
77
|
+
expiriesOptions: string[];
|
|
78
|
+
initialValues?: Partial<ParamFormData>;
|
|
79
|
+
groupEditable?: boolean;
|
|
80
|
+
onChange?(data: ParamFormData): void;
|
|
81
|
+
onSubmit?(data: ParamFormData): any;
|
|
82
82
|
}
|
|
83
83
|
declare class ParamForm extends PureComponent<ParamFormProps> {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
84
|
+
ref: React.RefObject<any>;
|
|
85
|
+
get formItems(): {
|
|
86
|
+
label: string;
|
|
87
|
+
name: string;
|
|
88
|
+
Comp: React.ComponentType<BaseInputProps>;
|
|
89
|
+
required?: boolean;
|
|
90
|
+
validator?(_: any, val: any): Promise<any>;
|
|
91
|
+
}[];
|
|
92
|
+
onChange: (changed: any, data: any) => void;
|
|
93
|
+
render(): JSX.Element;
|
|
94
94
|
}
|
|
95
|
-
declare class ParamFormModalEl extends PureComponent<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
onSubmit: () => any;
|
|
107
|
-
render(): JSX.Element;
|
|
95
|
+
declare class ParamFormModalEl extends PureComponent<ParamFormProps & Required<Pick<ParamFormProps, 'onSubmit'>>> {
|
|
96
|
+
ref: React.RefObject<ParamForm>;
|
|
97
|
+
state: {
|
|
98
|
+
visible: boolean;
|
|
99
|
+
pending: boolean;
|
|
100
|
+
};
|
|
101
|
+
get isEdit(): boolean;
|
|
102
|
+
onShow: () => void;
|
|
103
|
+
onHide: () => void;
|
|
104
|
+
onSubmit: () => any;
|
|
105
|
+
render(): JSX.Element;
|
|
108
106
|
}
|
|
109
107
|
declare class ParamFormModal {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
static el: ReactGlobalComp<ParamFormProps & Required<Pick<ParamFormProps, "onSubmit">>>;
|
|
109
|
+
static show(props: Omit<ComponentProps<typeof ParamFormModalEl>, 'visible'>): Promise<void>;
|
|
110
|
+
static hide(): Promise<void>;
|
|
113
111
|
}
|
|
114
112
|
|
|
115
113
|
interface ParamValueEditorData {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
paramId: string;
|
|
115
|
+
description?: string;
|
|
116
|
+
valueBefore: Record<string, any>;
|
|
117
|
+
value?: Record<string, any>;
|
|
118
|
+
defaultValue?: Record<string, any>;
|
|
121
119
|
}
|
|
122
120
|
interface ParamValueEditorProps {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
121
|
+
allParams: ParentSelectorProps['parentOptions'];
|
|
122
|
+
expiriesOptions: string[];
|
|
123
|
+
valueType: ParamType;
|
|
124
|
+
initialValues: ParamValueEditorData;
|
|
125
|
+
onChange?(data: ParamValueEditorData): void;
|
|
126
|
+
onSubmit?(data: ParamValueEditorData): any;
|
|
129
127
|
}
|
|
130
128
|
declare class ParamValueEditor extends PureComponent<ParamValueEditorProps> {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
129
|
+
ref: React.RefObject<any>;
|
|
130
|
+
get formItems(): {
|
|
131
|
+
label: string;
|
|
132
|
+
name: string;
|
|
133
|
+
className?: string;
|
|
134
|
+
Comp: React.ComponentType<BaseInputProps>;
|
|
135
|
+
required?: boolean;
|
|
136
|
+
validator?(_: any, val: any): Promise<any>;
|
|
137
|
+
}[];
|
|
138
|
+
onChange: (changed: any, data: any) => void;
|
|
139
|
+
render(): JSX.Element;
|
|
142
140
|
}
|
|
143
|
-
declare class ParamValueEditorModalEl extends PureComponent<
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
onSubmit: () => any;
|
|
154
|
-
render(): JSX.Element;
|
|
141
|
+
declare class ParamValueEditorModalEl extends PureComponent<ParamValueEditorProps & Required<Pick<ParamValueEditorProps, 'onSubmit'>>> {
|
|
142
|
+
ref: React.RefObject<ParamValueEditor>;
|
|
143
|
+
state: {
|
|
144
|
+
visible: boolean;
|
|
145
|
+
pending: boolean;
|
|
146
|
+
};
|
|
147
|
+
onShow: () => void;
|
|
148
|
+
onHide: () => void;
|
|
149
|
+
onSubmit: () => any;
|
|
150
|
+
render(): JSX.Element;
|
|
155
151
|
}
|
|
156
152
|
declare class ParamValueEditorModal {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
static show(
|
|
161
|
-
props: Omit<ComponentProps<typeof ParamValueEditorModalEl>, 'visible'>,
|
|
162
|
-
): Promise<void>;
|
|
163
|
-
static hide(): Promise<void>;
|
|
153
|
+
static el: ReactGlobalComp<ParamValueEditorProps & Required<Pick<ParamValueEditorProps, "onSubmit">>>;
|
|
154
|
+
static show(props: Omit<ComponentProps<typeof ParamValueEditorModalEl>, 'visible'>): Promise<void>;
|
|
155
|
+
static hide(): Promise<void>;
|
|
164
156
|
}
|
|
165
157
|
|
|
166
158
|
interface ImageUploadProps extends BaseInputProps {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
159
|
+
value?: string;
|
|
160
|
+
onChange?(val?: string): void;
|
|
161
|
+
getSignedUrl(key: string): Promise<string>;
|
|
162
|
+
/**
|
|
163
|
+
* 返回图片的 key
|
|
164
|
+
* */
|
|
165
|
+
handleUpload(file: Blob): Promise<string>;
|
|
174
166
|
}
|
|
175
167
|
|
|
176
168
|
interface ParamGroupEditorData {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
169
|
+
parentId: string;
|
|
170
|
+
$paramId?: string;
|
|
171
|
+
name: string;
|
|
172
|
+
valueType?: ParamType;
|
|
173
|
+
descriptionUrl?: string;
|
|
174
|
+
}
|
|
175
|
+
interface ParamItem {
|
|
176
|
+
parentId?: number | string;
|
|
177
|
+
paramId: number | string;
|
|
178
|
+
name?: string;
|
|
179
|
+
key?: string;
|
|
180
|
+
valueType: ParamType;
|
|
181
|
+
description?: string;
|
|
182
|
+
descriptionUrl?: string;
|
|
183
|
+
rank?: number;
|
|
184
|
+
value?: Record<string, any>;
|
|
185
|
+
defaultValue?: Record<string, any>;
|
|
186
|
+
children?: ParamItem[];
|
|
187
|
+
}
|
|
188
|
+
interface LocalParamItem extends Omit<ParamItem, 'paramId' | 'children' | 'childrenList'> {
|
|
189
|
+
paramId?: number | string;
|
|
190
|
+
/**
|
|
191
|
+
* 前端字段,用于本地建立参数与参数组之间的关系
|
|
192
|
+
* 提交到服务端不解析
|
|
193
|
+
* */
|
|
194
|
+
$paramId: number | string;
|
|
195
|
+
children?: LocalParamItem[];
|
|
182
196
|
}
|
|
183
|
-
interface ParamGroupEditorProps
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
197
|
+
interface ParamGroupEditorProps extends Required<Pick<ImageUploadProps, 'getSignedUrl' | 'handleUpload'>> {
|
|
198
|
+
/**
|
|
199
|
+
* 传了表示为有父级
|
|
200
|
+
* */
|
|
201
|
+
parentOptions?: ParentSelectorProps['parentOptions'];
|
|
202
|
+
initialValues?: Partial<ParamGroupEditorData>;
|
|
203
|
+
paramList: LocalParamItem[];
|
|
204
|
+
projectName: string;
|
|
205
|
+
templateName: string;
|
|
206
|
+
parentNames?: string;
|
|
207
|
+
onChange?(data: ParamGroupEditorData): void;
|
|
208
|
+
onSubmit?(data: ParamGroupEditorData): any;
|
|
192
209
|
}
|
|
193
210
|
declare class ParamGroupEditor extends PureComponent<ParamGroupEditorProps> {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
211
|
+
ref: React.RefObject<any>;
|
|
212
|
+
get formItems(): {
|
|
213
|
+
label: string;
|
|
214
|
+
name: string;
|
|
215
|
+
Comp: React.ComponentType<BaseInputProps>;
|
|
216
|
+
required?: boolean | undefined;
|
|
217
|
+
validator?(_: any, val: any): Promise<any>;
|
|
218
|
+
}[];
|
|
219
|
+
onChange: (changed: any, data: any) => void;
|
|
220
|
+
render(): JSX.Element;
|
|
204
221
|
}
|
|
205
|
-
declare class ParamGroupEditorModalEl extends PureComponent<
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
onSubmit: () => any;
|
|
217
|
-
render(): JSX.Element;
|
|
222
|
+
declare class ParamGroupEditorModalEl extends PureComponent<ParamGroupEditorProps & Required<Pick<ParamGroupEditorProps, 'onSubmit'>>> {
|
|
223
|
+
ref: React.RefObject<ParamGroupEditor>;
|
|
224
|
+
state: {
|
|
225
|
+
visible: boolean;
|
|
226
|
+
pending: boolean;
|
|
227
|
+
};
|
|
228
|
+
get isEdit(): boolean;
|
|
229
|
+
onShow: () => void;
|
|
230
|
+
onHide: () => void;
|
|
231
|
+
onSubmit: () => any;
|
|
232
|
+
render(): JSX.Element;
|
|
218
233
|
}
|
|
219
234
|
declare class ParamGroupEditorModal {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
static show(
|
|
224
|
-
props: Omit<ComponentProps<typeof ParamGroupEditorModalEl>, 'visible'>,
|
|
225
|
-
): Promise<void>;
|
|
226
|
-
static hide(): Promise<void>;
|
|
235
|
+
static el: ReactGlobalComp<ParamGroupEditorProps & Required<Pick<ParamGroupEditorProps, "onSubmit">>>;
|
|
236
|
+
static show(props: Omit<ComponentProps<typeof ParamGroupEditorModalEl>, 'visible'>): Promise<void>;
|
|
237
|
+
static hide(): Promise<void>;
|
|
227
238
|
}
|
|
228
239
|
|
|
229
240
|
interface ParamMoverData {
|
|
230
|
-
|
|
241
|
+
parentId: string | number;
|
|
231
242
|
}
|
|
232
243
|
interface ParamMoverProps {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
+
/**
|
|
245
|
+
* 需要确保 targetParams 的元素之间无父子或者祖先子孙关系
|
|
246
|
+
* */
|
|
247
|
+
targetParams: (string | number)[];
|
|
248
|
+
allParams: NonNullable<ParentSelectorProps['parentOptions']>;
|
|
249
|
+
/**
|
|
250
|
+
* 最大层级(包括参数)
|
|
251
|
+
* @default 3
|
|
252
|
+
* */
|
|
253
|
+
maxLevel?: number;
|
|
254
|
+
onSubmit?(params: NonNullable<ParentSelectorProps['parentOptions']>): any;
|
|
244
255
|
}
|
|
245
256
|
declare function initState(props: ParamMoverProps): {
|
|
246
|
-
preProps: ParamMoverProps;
|
|
247
|
-
options: any[];
|
|
248
|
-
paramsMap: Record<string, ParentSelectorOption>;
|
|
249
|
-
};
|
|
250
|
-
declare type ParamMoverState = ReturnType<typeof initState>;
|
|
251
|
-
declare class ParamMover extends PureComponent<ParamMoverProps, ParamMoverState> {
|
|
252
|
-
static getDerivedStateFromProps(
|
|
253
|
-
props: ParamMoverProps,
|
|
254
|
-
state: ParamMoverState,
|
|
255
|
-
): {
|
|
256
257
|
preProps: ParamMoverProps;
|
|
257
258
|
options: any[];
|
|
258
259
|
paramsMap: Record<string, ParentSelectorOption>;
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
260
|
+
};
|
|
261
|
+
declare type ParamMoverState = ReturnType<typeof initState>;
|
|
262
|
+
declare class ParamMover extends PureComponent<ParamMoverProps, ParamMoverState> {
|
|
263
|
+
static getDerivedStateFromProps(props: ParamMoverProps, state: ParamMoverState): {
|
|
264
|
+
preProps: ParamMoverProps;
|
|
265
|
+
options: any[];
|
|
266
|
+
paramsMap: Record<string, ParentSelectorOption>;
|
|
267
|
+
};
|
|
268
|
+
get newParams(): ParentSelectorOption[];
|
|
269
|
+
state: {
|
|
270
|
+
preProps: ParamMoverProps;
|
|
271
|
+
options: any[];
|
|
272
|
+
paramsMap: Record<string, ParentSelectorOption>;
|
|
273
|
+
};
|
|
274
|
+
ref: React.RefObject<any>;
|
|
275
|
+
get formItems(): {
|
|
276
|
+
label: string;
|
|
277
|
+
name: string;
|
|
278
|
+
Comp: React.ComponentType<BaseInputProps>;
|
|
279
|
+
required?: boolean | undefined;
|
|
280
|
+
validator?(_: any, val: any): Promise<any>;
|
|
281
|
+
}[];
|
|
282
|
+
render(): JSX.Element;
|
|
275
283
|
}
|
|
276
|
-
declare class ParamMoverModalEl extends PureComponent<
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
onSubmit: () => any;
|
|
287
|
-
render(): JSX.Element;
|
|
284
|
+
declare class ParamMoverModalEl extends PureComponent<ParamMoverProps & Required<Pick<ParamMoverProps, 'onSubmit'>>> {
|
|
285
|
+
ref: React.RefObject<ParamMover>;
|
|
286
|
+
state: {
|
|
287
|
+
visible: boolean;
|
|
288
|
+
pending: boolean;
|
|
289
|
+
};
|
|
290
|
+
onShow: () => void;
|
|
291
|
+
onHide: () => void;
|
|
292
|
+
onSubmit: () => any;
|
|
293
|
+
render(): JSX.Element;
|
|
288
294
|
}
|
|
289
295
|
declare class ParamMoverModal {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
296
|
+
static el: ReactGlobalComp<ParamMoverProps & Required<Pick<ParamMoverProps, "onSubmit">>>;
|
|
297
|
+
static show(props: Omit<ComponentProps<typeof ParamMoverModalEl>, 'visible'>): Promise<void>;
|
|
298
|
+
static hide(): Promise<void>;
|
|
293
299
|
}
|
|
294
300
|
|
|
295
|
-
declare const ParamTypeConfig: Record<
|
|
296
|
-
ParamType,
|
|
297
|
-
{
|
|
301
|
+
declare const ParamTypeConfig: Record<ParamType, {
|
|
298
302
|
name: string;
|
|
299
303
|
key?: string;
|
|
300
304
|
defaultValue?: any;
|
|
301
305
|
Comp: React.ComponentType<BaseInputProps>;
|
|
302
306
|
validator?(value: any): string;
|
|
303
307
|
required?: boolean;
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
declare function paramValidator(
|
|
307
|
-
val: any,
|
|
308
|
-
values: {
|
|
308
|
+
}>;
|
|
309
|
+
declare function paramValidator(val: any, values: {
|
|
309
310
|
valueType: ParamType;
|
|
310
|
-
|
|
311
|
-
): string;
|
|
311
|
+
}): string;
|
|
312
312
|
declare const ParamTypeOptions: {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
313
|
+
value: number;
|
|
314
|
+
label: string;
|
|
315
|
+
name: string;
|
|
316
|
+
key?: string | undefined;
|
|
317
|
+
defaultValue?: any;
|
|
318
|
+
Comp: React.ComponentType<BaseInputProps>;
|
|
319
|
+
validator?(value: any): string;
|
|
320
|
+
required?: boolean | undefined;
|
|
321
321
|
}[];
|
|
322
322
|
|
|
323
323
|
declare function formatNum(val: string): number | undefined;
|
|
324
324
|
declare function isNullLike(val: any): val is undefined | null;
|
|
325
|
-
declare function emptyValidator(val: any, enableEmpty?: boolean):
|
|
326
|
-
declare function numRangeValidator(
|
|
327
|
-
val: {
|
|
325
|
+
declare function emptyValidator(val: any, enableEmpty?: boolean): "Should not be empty" | "";
|
|
326
|
+
declare function numRangeValidator(val: {
|
|
328
327
|
min?: string;
|
|
329
328
|
max?: string;
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
): string;
|
|
333
|
-
declare function expiryValidator(
|
|
334
|
-
val: string,
|
|
335
|
-
enableEmpty?: boolean,
|
|
336
|
-
): 'Should not be empty' | '' | 'Out of format';
|
|
329
|
+
}, enableEmpty?: boolean): string;
|
|
330
|
+
declare function expiryValidator(val: string, enableEmpty?: boolean): "Should not be empty" | "" | "Out of format";
|
|
337
331
|
declare function expiriesValidator(val: string[]): string;
|
|
338
|
-
declare function keyValidator(
|
|
339
|
-
val: string,
|
|
340
|
-
allKeys: string[],
|
|
341
|
-
):
|
|
342
|
-
| 'Should not be empty'
|
|
343
|
-
| ''
|
|
344
|
-
| 'Out of format: should be a combination of the following chars `_.0-9a-zA-Z`'
|
|
345
|
-
| 'This key has been used';
|
|
332
|
+
declare function keyValidator(val: string, allKeys: string[]): "Should not be empty" | "" | "Out of format: should be a combination of the following chars `_.0-9a-zA-Z`" | "This key has been used";
|
|
346
333
|
declare function isExpired(val?: string): boolean;
|
|
347
|
-
declare function
|
|
348
|
-
|
|
349
|
-
form?: () => any,
|
|
350
|
-
): (_: any, val: any) => Promise<any>;
|
|
334
|
+
declare function sameGroupNameValidator(val: string, paramList: LocalParamItem[], projectName: string, templateName: string, parentNames?: string): string | undefined;
|
|
335
|
+
declare function validatorCvt(validator: (val: any, values: any) => ValidateInfo['string'], form?: () => any): (_: any, val: any) => Promise<any>;
|
|
351
336
|
|
|
352
|
-
export {
|
|
353
|
-
BaseInputProps,
|
|
354
|
-
ParamForm,
|
|
355
|
-
ParamFormData,
|
|
356
|
-
ParamFormModal,
|
|
357
|
-
ParamFormProps,
|
|
358
|
-
ParamGroupEditor,
|
|
359
|
-
ParamGroupEditorData,
|
|
360
|
-
ParamGroupEditorModal,
|
|
361
|
-
ParamGroupEditorModalEl,
|
|
362
|
-
ParamGroupEditorProps,
|
|
363
|
-
ParamMover,
|
|
364
|
-
ParamMoverData,
|
|
365
|
-
ParamMoverModal,
|
|
366
|
-
ParamMoverModalEl,
|
|
367
|
-
ParamMoverProps,
|
|
368
|
-
ParamMoverState,
|
|
369
|
-
ParamRenderer,
|
|
370
|
-
ParamRendererProps,
|
|
371
|
-
ParamType,
|
|
372
|
-
ParamTypeConfig,
|
|
373
|
-
ParamTypeOptions,
|
|
374
|
-
ParamValueEditor,
|
|
375
|
-
ParamValueEditorData,
|
|
376
|
-
ParamValueEditorModal,
|
|
377
|
-
ParamValueEditorModalEl,
|
|
378
|
-
ParamValueEditorProps,
|
|
379
|
-
ParamValueStruct,
|
|
380
|
-
ValidateInfo,
|
|
381
|
-
emptyValidator,
|
|
382
|
-
expiriesValidator,
|
|
383
|
-
expiryValidator,
|
|
384
|
-
formatNum,
|
|
385
|
-
isExpired,
|
|
386
|
-
isNullLike,
|
|
387
|
-
keyValidator,
|
|
388
|
-
numRangeValidator,
|
|
389
|
-
paramValidator,
|
|
390
|
-
validatorCvt,
|
|
391
|
-
};
|
|
337
|
+
export { BaseInputProps, LocalParamItem, ParamForm, ParamFormData, ParamFormModal, ParamFormProps, ParamGroupEditor, ParamGroupEditorData, ParamGroupEditorModal, ParamGroupEditorModalEl, ParamGroupEditorProps, ParamItem, ParamMover, ParamMoverData, ParamMoverModal, ParamMoverModalEl, ParamMoverProps, ParamMoverState, ParamRenderer, ParamRendererProps, ParamType, ParamTypeConfig, ParamTypeOptions, ParamValueEditor, ParamValueEditorData, ParamValueEditorModal, ParamValueEditorModalEl, ParamValueEditorProps, ParamValueStruct, ValidateInfo, emptyValidator, expiriesValidator, expiryValidator, formatNum, isExpired, isNullLike, keyValidator, numRangeValidator, paramValidator, sameGroupNameValidator, validatorCvt };
|
package/lib/es/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bundle of @signalplus/params-about
|
|
3
|
-
* Generated:
|
|
4
|
-
* Version: 1.0.
|
|
3
|
+
* Generated: 2023-05-06
|
|
4
|
+
* Version: 1.0.4-alpha
|
|
5
5
|
* License: MIT
|
|
6
6
|
* Author: 2631541504@qq.com
|
|
7
7
|
*/
|
|
@@ -278,7 +278,7 @@ function numRangeValidator(val, enableEmpty) {
|
|
|
278
278
|
return "Max: ".concat(error);
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
return val.min > val.max ? 'Max should bigger than Min' : '';
|
|
281
|
+
return +val.min > +val.max ? 'Max should bigger than Min' : '';
|
|
282
282
|
}
|
|
283
283
|
function expiryValidator(val, enableEmpty) {
|
|
284
284
|
var error = emptyValidator(val, enableEmpty);
|
|
@@ -324,6 +324,14 @@ function isExpired(val) {
|
|
|
324
324
|
var expireTime = dayjs("".concat(expiry.format('YYYY-MM-DD'), "T08:00Z"));
|
|
325
325
|
return now >= expireTime;
|
|
326
326
|
}
|
|
327
|
+
function sameGroupNameValidator(val, paramList, projectName, templateName, parentNames) {
|
|
328
|
+
var error = emptyValidator(val);
|
|
329
|
+
if (error) return error;
|
|
330
|
+
var hasSame = paramList.some(function (_it) {
|
|
331
|
+
return _it.name === val;
|
|
332
|
+
});
|
|
333
|
+
return hasSame ? "\u8BE5\u53C2\u6570\u7EC4\u540D\u79F0\u5728".concat(projectName, ">").concat(templateName).concat(parentNames ? '>' + parentNames : '', "\u4E0B\u5DF2\u5B58\u5728") : undefined;
|
|
334
|
+
}
|
|
327
335
|
function validatorCvt(validator, form) {
|
|
328
336
|
return function (_, val) {
|
|
329
337
|
var $form = form === null || form === void 0 ? void 0 : form();
|
|
@@ -1176,10 +1184,10 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
1176
1184
|
return "The ".concat(i + 1, "th item: at least one parameter must be specified between AUM and ABS");
|
|
1177
1185
|
}
|
|
1178
1186
|
|
|
1179
|
-
if ((!isNullLike(val === null || val === void 0 ? void 0 : val.minAbs) || !isNullLike(val === null || val === void 0 ? void 0 : val.maxAbs)) && val.minAbs >= val.maxAbs) // return { [i]: { minAbs: 'Min ABS should smaller than Max ABS' } }
|
|
1187
|
+
if ((!isNullLike(val === null || val === void 0 ? void 0 : val.minAbs) || !isNullLike(val === null || val === void 0 ? void 0 : val.maxAbs)) && +val.minAbs >= +val.maxAbs) // return { [i]: { minAbs: 'Min ABS should smaller than Max ABS' } }
|
|
1180
1188
|
return "The ".concat(i + 1, "th item: Min ABS should smaller than Max ABS");
|
|
1181
1189
|
|
|
1182
|
-
if ((!isNullLike(val === null || val === void 0 ? void 0 : val.minAumPercentage) || !isNullLike(val === null || val === void 0 ? void 0 : val.maxAumPercentage)) && val.minAumPercentage >= val.maxAumPercentage) {
|
|
1190
|
+
if ((!isNullLike(val === null || val === void 0 ? void 0 : val.minAumPercentage) || !isNullLike(val === null || val === void 0 ? void 0 : val.maxAumPercentage)) && +val.minAumPercentage >= +val.maxAumPercentage) {
|
|
1183
1191
|
// return {
|
|
1184
1192
|
// [i]: { minAumPercentage: 'Min AUM should smaller than Max AUM' },
|
|
1185
1193
|
// }
|
|
@@ -1952,7 +1960,7 @@ var ParamGroupEditor = /*#__PURE__*/function (_PureComponent) {
|
|
|
1952
1960
|
}));
|
|
1953
1961
|
},
|
|
1954
1962
|
validator: validatorCvt(function (val) {
|
|
1955
|
-
return
|
|
1963
|
+
return sameGroupNameValidator(val, _this2.props.paramList, _this2.props.projectName, _this2.props.templateName, _this2.props.parentNames);
|
|
1956
1964
|
})
|
|
1957
1965
|
}, {
|
|
1958
1966
|
label: '业务流程图',
|
|
@@ -1962,10 +1970,7 @@ var ParamGroupEditor = /*#__PURE__*/function (_PureComponent) {
|
|
|
1962
1970
|
getSignedUrl: _this2.props.getSignedUrl,
|
|
1963
1971
|
handleUpload: _this2.props.handleUpload
|
|
1964
1972
|
}));
|
|
1965
|
-
}
|
|
1966
|
-
validator: isFirstLevel ? validatorCvt(function (val) {
|
|
1967
|
-
return emptyValidator(val);
|
|
1968
|
-
}) : undefined
|
|
1973
|
+
}
|
|
1969
1974
|
}];
|
|
1970
1975
|
|
|
1971
1976
|
if (!isFirstLevel) {
|
|
@@ -2419,4 +2424,4 @@ var ParamMoverModal = /*#__PURE__*/function () {
|
|
|
2419
2424
|
|
|
2420
2425
|
_defineProperty(ParamMoverModal, "el", new ReactGlobalComp('param-mover-modal', ParamMoverModalEl));
|
|
2421
2426
|
|
|
2422
|
-
export { ParamForm, ParamFormModal, ParamGroupEditor, ParamGroupEditorModal, ParamGroupEditorModalEl, ParamMover, ParamMoverModal, ParamMoverModalEl, ParamRenderer, ParamType, ParamTypeConfig, ParamTypeOptions, ParamValueEditor, ParamValueEditorModal, ParamValueEditorModalEl, emptyValidator, expiriesValidator, expiryValidator, formatNum, isExpired, isNullLike, keyValidator, numRangeValidator, paramValidator, validatorCvt };
|
|
2427
|
+
export { ParamForm, ParamFormModal, ParamGroupEditor, ParamGroupEditorModal, ParamGroupEditorModalEl, ParamMover, ParamMoverModal, ParamMoverModalEl, ParamRenderer, ParamType, ParamTypeConfig, ParamTypeOptions, ParamValueEditor, ParamValueEditorModal, ParamValueEditorModalEl, emptyValidator, expiriesValidator, expiryValidator, formatNum, isExpired, isNullLike, keyValidator, numRangeValidator, paramValidator, sameGroupNameValidator, validatorCvt };
|