@signalplus/params-about 0.1.53 → 1.0.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/index.d.ts +309 -243
- package/lib/es/index.js +19 -15
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -2,324 +2,390 @@ 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
|
-
|
|
30
|
-
valueId?: string;
|
|
31
|
-
[key: string]: any;
|
|
32
|
-
}
|
|
29
|
+
declare type ParamValueStruct = Record<string, any>;
|
|
33
30
|
interface ParamRendererProps extends BaseInputProps {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
valueType?: ParamType;
|
|
32
|
+
value?: ParamValueStruct;
|
|
33
|
+
expiriesOptions?: string[];
|
|
34
|
+
onChange?(val: ParamValueStruct): void;
|
|
38
35
|
}
|
|
39
36
|
declare class ParamRenderer extends PureComponent<ParamRendererProps> {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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;
|
|
51
48
|
}
|
|
52
49
|
|
|
53
50
|
interface ParentSelectorOption {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
parentId?: string | number;
|
|
52
|
+
$paramId: string | number;
|
|
53
|
+
name?: string;
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
valueType: ParamType;
|
|
56
|
+
children?: ParentSelectorOption[];
|
|
57
|
+
[key: string]: any;
|
|
61
58
|
}
|
|
62
59
|
interface ParentSelectorProps extends BaseInputProps {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
parentOptions?: ParentSelectorOption[];
|
|
61
|
+
value?: string;
|
|
62
|
+
onChange?(val: string): void;
|
|
66
63
|
}
|
|
67
64
|
|
|
68
65
|
interface ParamFormData {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
[key: string]: any;
|
|
77
|
-
};
|
|
78
|
-
description?: string;
|
|
66
|
+
parentId?: string;
|
|
67
|
+
$paramId?: string;
|
|
68
|
+
key: string;
|
|
69
|
+
name?: string;
|
|
70
|
+
valueType: ParamType;
|
|
71
|
+
defaultValue?: Record<string, any>;
|
|
72
|
+
description?: string;
|
|
79
73
|
}
|
|
80
74
|
interface ParamFormProps {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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;
|
|
88
82
|
}
|
|
89
83
|
declare class ParamForm extends PureComponent<ParamFormProps> {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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;
|
|
100
94
|
}
|
|
101
|
-
declare class ParamFormModalEl extends PureComponent<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
95
|
+
declare class ParamFormModalEl extends PureComponent<
|
|
96
|
+
ParamFormProps & Required<Pick<ParamFormProps, 'onSubmit'>>
|
|
97
|
+
> {
|
|
98
|
+
ref: React.RefObject<ParamForm>;
|
|
99
|
+
state: {
|
|
100
|
+
visible: boolean;
|
|
101
|
+
pending: boolean;
|
|
102
|
+
};
|
|
103
|
+
get isEdit(): boolean;
|
|
104
|
+
onShow: () => void;
|
|
105
|
+
onHide: () => void;
|
|
106
|
+
onSubmit: () => any;
|
|
107
|
+
render(): JSX.Element;
|
|
112
108
|
}
|
|
113
109
|
declare class ParamFormModal {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
110
|
+
static el: ReactGlobalComp<ParamFormProps & Required<Pick<ParamFormProps, 'onSubmit'>>>;
|
|
111
|
+
static show(props: Omit<ComponentProps<typeof ParamFormModalEl>, 'visible'>): Promise<void>;
|
|
112
|
+
static hide(): Promise<void>;
|
|
117
113
|
}
|
|
118
114
|
|
|
119
115
|
interface ParamValueEditorData {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
};
|
|
126
|
-
value?: {
|
|
127
|
-
valueId?: string;
|
|
128
|
-
[key: string]: any;
|
|
129
|
-
};
|
|
130
|
-
defaultValue?: {
|
|
131
|
-
valueId?: string;
|
|
132
|
-
[key: string]: any;
|
|
133
|
-
};
|
|
116
|
+
paramId: string;
|
|
117
|
+
description?: string;
|
|
118
|
+
valueBefore: Record<string, any>;
|
|
119
|
+
value?: Record<string, any>;
|
|
120
|
+
defaultValue?: Record<string, any>;
|
|
134
121
|
}
|
|
135
122
|
interface ParamValueEditorProps {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
123
|
+
allParams: ParentSelectorProps['parentOptions'];
|
|
124
|
+
expiriesOptions: string[];
|
|
125
|
+
valueType: ParamType;
|
|
126
|
+
initialValues: ParamValueEditorData;
|
|
127
|
+
onChange?(data: ParamValueEditorData): void;
|
|
128
|
+
onSubmit?(data: ParamValueEditorData): any;
|
|
142
129
|
}
|
|
143
130
|
declare class ParamValueEditor extends PureComponent<ParamValueEditorProps> {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
131
|
+
ref: React.RefObject<any>;
|
|
132
|
+
get formItems(): {
|
|
133
|
+
label: string;
|
|
134
|
+
name: string;
|
|
135
|
+
className?: string;
|
|
136
|
+
Comp: React.ComponentType<BaseInputProps>;
|
|
137
|
+
required?: boolean;
|
|
138
|
+
validator?(_: any, val: any): Promise<any>;
|
|
139
|
+
}[];
|
|
140
|
+
onChange: (changed: any, data: any) => void;
|
|
141
|
+
render(): JSX.Element;
|
|
155
142
|
}
|
|
156
|
-
declare class ParamValueEditorModalEl extends PureComponent<
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
143
|
+
declare class ParamValueEditorModalEl extends PureComponent<
|
|
144
|
+
ParamValueEditorProps & Required<Pick<ParamValueEditorProps, 'onSubmit'>>
|
|
145
|
+
> {
|
|
146
|
+
ref: React.RefObject<ParamValueEditor>;
|
|
147
|
+
state: {
|
|
148
|
+
visible: boolean;
|
|
149
|
+
pending: boolean;
|
|
150
|
+
};
|
|
151
|
+
onShow: () => void;
|
|
152
|
+
onHide: () => void;
|
|
153
|
+
onSubmit: () => any;
|
|
154
|
+
render(): JSX.Element;
|
|
166
155
|
}
|
|
167
156
|
declare class ParamValueEditorModal {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
157
|
+
static el: ReactGlobalComp<
|
|
158
|
+
ParamValueEditorProps & Required<Pick<ParamValueEditorProps, 'onSubmit'>>
|
|
159
|
+
>;
|
|
160
|
+
static show(
|
|
161
|
+
props: Omit<ComponentProps<typeof ParamValueEditorModalEl>, 'visible'>,
|
|
162
|
+
): Promise<void>;
|
|
163
|
+
static hide(): Promise<void>;
|
|
171
164
|
}
|
|
172
165
|
|
|
173
166
|
interface ImageUploadProps extends BaseInputProps {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
167
|
+
value?: string;
|
|
168
|
+
onChange?(val?: string): void;
|
|
169
|
+
getSignedUrl(key: string): Promise<string>;
|
|
170
|
+
/**
|
|
171
|
+
* 返回图片的 key
|
|
172
|
+
* */
|
|
173
|
+
handleUpload(file: Blob): Promise<string>;
|
|
181
174
|
}
|
|
182
175
|
|
|
183
176
|
interface ParamGroupEditorData {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
177
|
+
parentId: string;
|
|
178
|
+
$paramId?: string;
|
|
179
|
+
name: string;
|
|
180
|
+
valueType?: ParamType;
|
|
181
|
+
descriptionUrl?: string;
|
|
189
182
|
}
|
|
190
|
-
interface ParamGroupEditorProps
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
183
|
+
interface ParamGroupEditorProps
|
|
184
|
+
extends Required<Pick<ImageUploadProps, 'getSignedUrl' | 'handleUpload'>> {
|
|
185
|
+
/**
|
|
186
|
+
* 传了表示为有父级
|
|
187
|
+
* */
|
|
188
|
+
parentOptions?: ParentSelectorProps['parentOptions'];
|
|
189
|
+
initialValues?: Partial<ParamGroupEditorData>;
|
|
190
|
+
onChange?(data: ParamGroupEditorData): void;
|
|
191
|
+
onSubmit?(data: ParamGroupEditorData): any;
|
|
198
192
|
}
|
|
199
193
|
declare class ParamGroupEditor extends PureComponent<ParamGroupEditorProps> {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
194
|
+
ref: React.RefObject<any>;
|
|
195
|
+
get formItems(): {
|
|
196
|
+
label: string;
|
|
197
|
+
name: string;
|
|
198
|
+
Comp: React.ComponentType<BaseInputProps>;
|
|
199
|
+
required?: boolean | undefined;
|
|
200
|
+
validator?(_: any, val: any): Promise<any>;
|
|
201
|
+
}[];
|
|
202
|
+
onChange: (changed: any, data: any) => void;
|
|
203
|
+
render(): JSX.Element;
|
|
210
204
|
}
|
|
211
|
-
declare class ParamGroupEditorModalEl extends PureComponent<
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
205
|
+
declare class ParamGroupEditorModalEl extends PureComponent<
|
|
206
|
+
ParamGroupEditorProps & Required<Pick<ParamGroupEditorProps, 'onSubmit'>>
|
|
207
|
+
> {
|
|
208
|
+
ref: React.RefObject<ParamGroupEditor>;
|
|
209
|
+
state: {
|
|
210
|
+
visible: boolean;
|
|
211
|
+
pending: boolean;
|
|
212
|
+
};
|
|
213
|
+
get isEdit(): boolean;
|
|
214
|
+
onShow: () => void;
|
|
215
|
+
onHide: () => void;
|
|
216
|
+
onSubmit: () => any;
|
|
217
|
+
render(): JSX.Element;
|
|
222
218
|
}
|
|
223
219
|
declare class ParamGroupEditorModal {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
220
|
+
static el: ReactGlobalComp<
|
|
221
|
+
ParamGroupEditorProps & Required<Pick<ParamGroupEditorProps, 'onSubmit'>>
|
|
222
|
+
>;
|
|
223
|
+
static show(
|
|
224
|
+
props: Omit<ComponentProps<typeof ParamGroupEditorModalEl>, 'visible'>,
|
|
225
|
+
): Promise<void>;
|
|
226
|
+
static hide(): Promise<void>;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
interface ParamMoverData {
|
|
230
|
-
|
|
230
|
+
parentId: string | number;
|
|
231
231
|
}
|
|
232
232
|
interface ParamMoverProps {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
233
|
+
/**
|
|
234
|
+
* 需要确保 targetParams 的元素之间无父子或者祖先子孙关系
|
|
235
|
+
* */
|
|
236
|
+
targetParams: (string | number)[];
|
|
237
|
+
allParams: NonNullable<ParentSelectorProps['parentOptions']>;
|
|
238
|
+
/**
|
|
239
|
+
* 最大层级(包括参数)
|
|
240
|
+
* @default 3
|
|
241
|
+
* */
|
|
242
|
+
maxLevel?: number;
|
|
243
|
+
onSubmit?(params: NonNullable<ParentSelectorProps['parentOptions']>): any;
|
|
244
244
|
}
|
|
245
245
|
declare function initState(props: ParamMoverProps): {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
246
|
+
preProps: ParamMoverProps;
|
|
247
|
+
options: any[];
|
|
248
|
+
paramsMap: Record<string, ParentSelectorOption>;
|
|
249
249
|
};
|
|
250
250
|
declare type ParamMoverState = ReturnType<typeof initState>;
|
|
251
251
|
declare class ParamMover extends PureComponent<ParamMoverProps, ParamMoverState> {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
252
|
+
static getDerivedStateFromProps(
|
|
253
|
+
props: ParamMoverProps,
|
|
254
|
+
state: ParamMoverState,
|
|
255
|
+
): {
|
|
256
|
+
preProps: ParamMoverProps;
|
|
257
|
+
options: any[];
|
|
258
|
+
paramsMap: Record<string, ParentSelectorOption>;
|
|
259
|
+
};
|
|
260
|
+
get newParams(): ParentSelectorOption[];
|
|
261
|
+
state: {
|
|
262
|
+
preProps: ParamMoverProps;
|
|
263
|
+
options: any[];
|
|
264
|
+
paramsMap: Record<string, ParentSelectorOption>;
|
|
265
|
+
};
|
|
266
|
+
ref: React.RefObject<any>;
|
|
267
|
+
get formItems(): {
|
|
268
|
+
label: string;
|
|
269
|
+
name: string;
|
|
270
|
+
Comp: React.ComponentType<BaseInputProps>;
|
|
271
|
+
required?: boolean | undefined;
|
|
272
|
+
validator?(_: any, val: any): Promise<any>;
|
|
273
|
+
}[];
|
|
274
|
+
render(): JSX.Element;
|
|
272
275
|
}
|
|
273
|
-
declare class ParamMoverModalEl extends PureComponent<
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
276
|
+
declare class ParamMoverModalEl extends PureComponent<
|
|
277
|
+
ParamMoverProps & Required<Pick<ParamMoverProps, 'onSubmit'>>
|
|
278
|
+
> {
|
|
279
|
+
ref: React.RefObject<ParamMover>;
|
|
280
|
+
state: {
|
|
281
|
+
visible: boolean;
|
|
282
|
+
pending: boolean;
|
|
283
|
+
};
|
|
284
|
+
onShow: () => void;
|
|
285
|
+
onHide: () => void;
|
|
286
|
+
onSubmit: () => any;
|
|
287
|
+
render(): JSX.Element;
|
|
283
288
|
}
|
|
284
289
|
declare class ParamMoverModal {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
290
|
+
static el: ReactGlobalComp<ParamMoverProps & Required<Pick<ParamMoverProps, 'onSubmit'>>>;
|
|
291
|
+
static show(props: Omit<ComponentProps<typeof ParamMoverModalEl>, 'visible'>): Promise<void>;
|
|
292
|
+
static hide(): Promise<void>;
|
|
288
293
|
}
|
|
289
294
|
|
|
290
|
-
declare const ParamTypeConfig: Record<
|
|
295
|
+
declare const ParamTypeConfig: Record<
|
|
296
|
+
ParamType,
|
|
297
|
+
{
|
|
291
298
|
name: string;
|
|
292
299
|
key?: string;
|
|
293
300
|
defaultValue?: any;
|
|
294
301
|
Comp: React.ComponentType<BaseInputProps>;
|
|
295
302
|
validator?(value: any): string;
|
|
296
303
|
required?: boolean;
|
|
297
|
-
}
|
|
298
|
-
|
|
304
|
+
}
|
|
305
|
+
>;
|
|
306
|
+
declare function paramValidator(
|
|
307
|
+
val: any,
|
|
308
|
+
values: {
|
|
299
309
|
valueType: ParamType;
|
|
300
|
-
}
|
|
310
|
+
},
|
|
311
|
+
): string;
|
|
301
312
|
declare const ParamTypeOptions: {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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;
|
|
310
321
|
}[];
|
|
311
322
|
|
|
312
323
|
declare function formatNum(val: string): number | undefined;
|
|
313
324
|
declare function isNullLike(val: any): val is undefined | null;
|
|
314
|
-
declare function emptyValidator(val: any, enableEmpty?: boolean):
|
|
315
|
-
declare function numRangeValidator(
|
|
325
|
+
declare function emptyValidator(val: any, enableEmpty?: boolean): 'Should not be empty' | '';
|
|
326
|
+
declare function numRangeValidator(
|
|
327
|
+
val: {
|
|
316
328
|
min?: string;
|
|
317
329
|
max?: string;
|
|
318
|
-
},
|
|
319
|
-
|
|
330
|
+
},
|
|
331
|
+
enableEmpty?: boolean,
|
|
332
|
+
): string;
|
|
333
|
+
declare function expiryValidator(
|
|
334
|
+
val: string,
|
|
335
|
+
enableEmpty?: boolean,
|
|
336
|
+
): 'Should not be empty' | '' | 'Out of format';
|
|
320
337
|
declare function expiriesValidator(val: string[]): string;
|
|
321
|
-
declare function keyValidator(
|
|
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';
|
|
322
346
|
declare function isExpired(val?: string): boolean;
|
|
323
|
-
declare function validatorCvt(
|
|
347
|
+
declare function validatorCvt(
|
|
348
|
+
validator: (val: any, values: any) => ValidateInfo['string'],
|
|
349
|
+
form?: () => any,
|
|
350
|
+
): (_: any, val: any) => Promise<any>;
|
|
324
351
|
|
|
325
|
-
export {
|
|
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
|
+
};
|
package/lib/es/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bundle of @signalplus/params-about
|
|
3
|
-
* Generated: 2022-
|
|
4
|
-
* Version: 0.
|
|
3
|
+
* Generated: 2022-06-16
|
|
4
|
+
* Version: 1.0.2
|
|
5
5
|
* License: MIT
|
|
6
6
|
* Author: 2631541504@qq.com
|
|
7
7
|
*/
|
|
@@ -769,9 +769,13 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
|
|
|
769
769
|
});
|
|
770
770
|
|
|
771
771
|
_defineProperty(_assertThisInitialized(_this), "onChange", function (val) {
|
|
772
|
-
var _this$props$onChange, _this$props, _this$props$onBlur, _this$props2;
|
|
772
|
+
var _this$props$value, _this$props$onChange, _this$props, _this$props$onBlur, _this$props2;
|
|
773
|
+
|
|
774
|
+
var value = _toConsumableArray(((_this$props$value = _this.props.value) === null || _this$props$value === void 0 ? void 0 : _this$props$value.filter(function (item) {
|
|
775
|
+
var _this$props$options;
|
|
773
776
|
|
|
774
|
-
|
|
777
|
+
return (_this$props$options = _this.props.options) === null || _this$props$options === void 0 ? void 0 : _this$props$options.includes(item);
|
|
778
|
+
})) || []);
|
|
775
779
|
|
|
776
780
|
if (_this.props.multiple !== false) {
|
|
777
781
|
var index = value.findIndex(function (it) {
|
|
@@ -793,10 +797,10 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
|
|
|
793
797
|
_createClass(Expiries, [{
|
|
794
798
|
key: "renderValue",
|
|
795
799
|
value: function renderValue() {
|
|
796
|
-
var _this$props$
|
|
800
|
+
var _this$props$value2,
|
|
797
801
|
_this2 = this;
|
|
798
802
|
|
|
799
|
-
var value = (_this$props$
|
|
803
|
+
var value = (_this$props$value2 = this.props.value) === null || _this$props$value2 === void 0 ? void 0 : _this$props$value2.filter(function (it) {
|
|
800
804
|
return it && !isExpired(it);
|
|
801
805
|
});
|
|
802
806
|
|
|
@@ -811,9 +815,9 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
|
|
|
811
815
|
}, "Choose");
|
|
812
816
|
|
|
813
817
|
if (this.props.multiple === false) {
|
|
814
|
-
var _this$props$
|
|
818
|
+
var _this$props$value3;
|
|
815
819
|
|
|
816
|
-
var _val = (_this$props$
|
|
820
|
+
var _val = (_this$props$value3 = this.props.value) === null || _this$props$value3 === void 0 ? void 0 : _this$props$value3[0];
|
|
817
821
|
|
|
818
822
|
return !_val || isExpired(_val) ? placeholder : /*#__PURE__*/React.createElement("span", {
|
|
819
823
|
className: "param-expiries-val"
|
|
@@ -836,7 +840,7 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
|
|
|
836
840
|
}, {
|
|
837
841
|
key: "render",
|
|
838
842
|
value: function render() {
|
|
839
|
-
var _this$props$
|
|
843
|
+
var _this$props$options2,
|
|
840
844
|
_this3 = this;
|
|
841
845
|
|
|
842
846
|
return /*#__PURE__*/React.createElement(Popover, {
|
|
@@ -845,7 +849,7 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
|
|
|
845
849
|
placement: 'bottomLeft',
|
|
846
850
|
visible: !this.props.readonly && this.state.visible,
|
|
847
851
|
onVisibleChange: this.handleVisibleChange,
|
|
848
|
-
content: (_this$props$
|
|
852
|
+
content: (_this$props$options2 = this.props.options) === null || _this$props$options2 === void 0 ? void 0 : _this$props$options2.map(function (it) {
|
|
849
853
|
var _this3$props$value, _this3$props$calcDisa, _this3$props, _this3$onChange;
|
|
850
854
|
|
|
851
855
|
var checked = (_this3$props$value = _this3.props.value) === null || _this3$props$value === void 0 ? void 0 : _this3$props$value.includes(it);
|
|
@@ -1432,7 +1436,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
1432
1436
|
})
|
|
1433
1437
|
}, {
|
|
1434
1438
|
label: '默认值',
|
|
1435
|
-
name: '
|
|
1439
|
+
name: 'defaultValue',
|
|
1436
1440
|
required: config === null || config === void 0 ? void 0 : config.required,
|
|
1437
1441
|
Comp: function Comp(props) {
|
|
1438
1442
|
var _this2$ref$current$ge, _this2$ref$current, _this2$props$initialV;
|
|
@@ -1541,7 +1545,7 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
1541
1545
|
}
|
|
1542
1546
|
|
|
1543
1547
|
return _this3.props.onSubmit(data);
|
|
1544
|
-
}).then(_this3.onHide).finally(function () {
|
|
1548
|
+
}).then(_this3.onHide).catch(console.error).finally(function () {
|
|
1545
1549
|
return _this3.setState({
|
|
1546
1550
|
pending: false
|
|
1547
1551
|
});
|
|
@@ -1788,7 +1792,7 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
1788
1792
|
}
|
|
1789
1793
|
|
|
1790
1794
|
return _this3.props.onSubmit(data);
|
|
1791
|
-
}).then(_this3.onHide).finally(function () {
|
|
1795
|
+
}).then(_this3.onHide).catch(console.error).finally(function () {
|
|
1792
1796
|
return _this3.setState({
|
|
1793
1797
|
pending: false
|
|
1794
1798
|
});
|
|
@@ -2060,7 +2064,7 @@ var ParamGroupEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
2060
2064
|
}
|
|
2061
2065
|
|
|
2062
2066
|
return _this3.props.onSubmit(data);
|
|
2063
|
-
}).then(_this3.onHide).finally(function () {
|
|
2067
|
+
}).then(_this3.onHide).catch(console.error).finally(function () {
|
|
2064
2068
|
return _this3.setState({
|
|
2065
2069
|
pending: false
|
|
2066
2070
|
});
|
|
@@ -2352,7 +2356,7 @@ var ParamMoverModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
2352
2356
|
});
|
|
2353
2357
|
}).then(function () {
|
|
2354
2358
|
return _this4.props.onSubmit(_this4.ref.current.newParams);
|
|
2355
|
-
}).then(_this4.onHide).finally(function () {
|
|
2359
|
+
}).then(_this4.onHide).catch(console.error).finally(function () {
|
|
2356
2360
|
return _this4.setState({
|
|
2357
2361
|
pending: false
|
|
2358
2362
|
});
|