@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.
Files changed (3) hide show
  1. package/index.d.ts +309 -243
  2. package/lib/es/index.js +19 -15
  3. 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
- 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
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
- 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;
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
- [key: string]: undefined | string | ValidateInfo;
26
+ [key: string]: undefined | string | ValidateInfo;
27
27
  }
28
28
 
29
- interface ParamValueStruct {
30
- valueId?: string;
31
- [key: string]: any;
32
- }
29
+ declare type ParamValueStruct = Record<string, any>;
33
30
  interface ParamRendererProps extends BaseInputProps {
34
- valueType?: ParamType;
35
- value?: ParamValueStruct;
36
- expiriesOptions?: string[];
37
- onChange?(val: ParamValueStruct): void;
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
- get typeConfig(): {
41
- name: string;
42
- key?: string | undefined;
43
- defaultValue?: any;
44
- Comp: React.ComponentType<BaseInputProps>;
45
- validator?(value: any): string;
46
- required?: boolean | undefined;
47
- };
48
- get value(): any;
49
- onChange: (val: any) => void;
50
- render(): JSX.Element;
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
- parentId?: string | number;
55
- $paramId: string | number;
56
- name?: string;
57
- disabled?: boolean;
58
- valueType: ParamType;
59
- children?: ParentSelectorOption[];
60
- [key: string]: any;
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
- parentOptions?: ParentSelectorOption[];
64
- value?: string;
65
- onChange?(val: string): void;
60
+ parentOptions?: ParentSelectorOption[];
61
+ value?: string;
62
+ onChange?(val: string): void;
66
63
  }
67
64
 
68
65
  interface ParamFormData {
69
- parentId?: string;
70
- $paramId?: string;
71
- key: string;
72
- name?: string;
73
- valueType: ParamType;
74
- defaultValue?: {
75
- valueId?: string;
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
- parentOptions: ParentSelectorProps['parentOptions'];
82
- allKeys: string[];
83
- expiriesOptions: string[];
84
- initialValues?: Partial<ParamFormData>;
85
- groupEditable?: boolean;
86
- onChange?(data: ParamFormData): void;
87
- onSubmit?(data: ParamFormData): any;
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
- ref: React.RefObject<any>;
91
- get formItems(): {
92
- label: string;
93
- name: string;
94
- Comp: React.ComponentType<BaseInputProps>;
95
- required?: boolean;
96
- validator?(_: any, val: any): Promise<any>;
97
- }[];
98
- onChange: (changed: any, data: any) => void;
99
- render(): JSX.Element;
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<ParamFormProps & Required<Pick<ParamFormProps, 'onSubmit'>>> {
102
- ref: React.RefObject<ParamForm>;
103
- state: {
104
- visible: boolean;
105
- pending: boolean;
106
- };
107
- get isEdit(): boolean;
108
- onShow: () => void;
109
- onHide: () => void;
110
- onSubmit: () => any;
111
- render(): JSX.Element;
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
- static el: ReactGlobalComp<ParamFormProps & Required<Pick<ParamFormProps, "onSubmit">>>;
115
- static show(props: Omit<ComponentProps<typeof ParamFormModalEl>, 'visible'>): Promise<void>;
116
- static hide(): Promise<void>;
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
- paramId: string;
121
- description?: string;
122
- valueBefore: {
123
- valueId?: string;
124
- [key: string]: any;
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
- allParams: ParentSelectorProps['parentOptions'];
137
- expiriesOptions: string[];
138
- valueType: ParamType;
139
- initialValues: ParamValueEditorData;
140
- onChange?(data: ParamValueEditorData): void;
141
- onSubmit?(data: ParamValueEditorData): any;
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
- ref: React.RefObject<any>;
145
- get formItems(): {
146
- label: string;
147
- name: string;
148
- className?: string;
149
- Comp: React.ComponentType<BaseInputProps>;
150
- required?: boolean;
151
- validator?(_: any, val: any): Promise<any>;
152
- }[];
153
- onChange: (changed: any, data: any) => void;
154
- render(): JSX.Element;
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<ParamValueEditorProps & Required<Pick<ParamValueEditorProps, 'onSubmit'>>> {
157
- ref: React.RefObject<ParamValueEditor>;
158
- state: {
159
- visible: boolean;
160
- pending: boolean;
161
- };
162
- onShow: () => void;
163
- onHide: () => void;
164
- onSubmit: () => any;
165
- render(): JSX.Element;
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
- static el: ReactGlobalComp<ParamValueEditorProps & Required<Pick<ParamValueEditorProps, "onSubmit">>>;
169
- static show(props: Omit<ComponentProps<typeof ParamValueEditorModalEl>, 'visible'>): Promise<void>;
170
- static hide(): Promise<void>;
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
- value?: string;
175
- onChange?(val?: string): void;
176
- getSignedUrl(key: string): Promise<string>;
177
- /**
178
- * 返回图片的 key
179
- * */
180
- handleUpload(file: Blob): Promise<string>;
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
- parentId: string;
185
- $paramId?: string;
186
- name: string;
187
- valueType?: ParamType;
188
- descriptionUrl?: string;
177
+ parentId: string;
178
+ $paramId?: string;
179
+ name: string;
180
+ valueType?: ParamType;
181
+ descriptionUrl?: string;
189
182
  }
190
- interface ParamGroupEditorProps extends Required<Pick<ImageUploadProps, 'getSignedUrl' | 'handleUpload'>> {
191
- /**
192
- * 传了表示为有父级
193
- * */
194
- parentOptions?: ParentSelectorProps['parentOptions'];
195
- initialValues?: Partial<ParamGroupEditorData>;
196
- onChange?(data: ParamGroupEditorData): void;
197
- onSubmit?(data: ParamGroupEditorData): any;
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
- ref: React.RefObject<any>;
201
- get formItems(): {
202
- label: string;
203
- name: string;
204
- Comp: React.ComponentType<BaseInputProps>;
205
- required?: boolean | undefined;
206
- validator?(_: any, val: any): Promise<any>;
207
- }[];
208
- onChange: (changed: any, data: any) => void;
209
- render(): JSX.Element;
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<ParamGroupEditorProps & Required<Pick<ParamGroupEditorProps, 'onSubmit'>>> {
212
- ref: React.RefObject<ParamGroupEditor>;
213
- state: {
214
- visible: boolean;
215
- pending: boolean;
216
- };
217
- get isEdit(): boolean;
218
- onShow: () => void;
219
- onHide: () => void;
220
- onSubmit: () => any;
221
- render(): JSX.Element;
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
- static el: ReactGlobalComp<ParamGroupEditorProps & Required<Pick<ParamGroupEditorProps, "onSubmit">>>;
225
- static show(props: Omit<ComponentProps<typeof ParamGroupEditorModalEl>, 'visible'>): Promise<void>;
226
- static hide(): Promise<void>;
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
- parentId: string | number;
230
+ parentId: string | number;
231
231
  }
232
232
  interface ParamMoverProps {
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;
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
- preProps: ParamMoverProps;
247
- options: any[];
248
- paramsMap: Record<string, ParentSelectorOption>;
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
- static getDerivedStateFromProps(props: ParamMoverProps, state: ParamMoverState): {
253
- preProps: ParamMoverProps;
254
- options: any[];
255
- paramsMap: Record<string, ParentSelectorOption>;
256
- };
257
- get newParams(): ParentSelectorOption[];
258
- state: {
259
- preProps: ParamMoverProps;
260
- options: any[];
261
- paramsMap: Record<string, ParentSelectorOption>;
262
- };
263
- ref: React.RefObject<any>;
264
- get formItems(): {
265
- label: string;
266
- name: string;
267
- Comp: React.ComponentType<BaseInputProps>;
268
- required?: boolean | undefined;
269
- validator?(_: any, val: any): Promise<any>;
270
- }[];
271
- render(): JSX.Element;
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<ParamMoverProps & Required<Pick<ParamMoverProps, 'onSubmit'>>> {
274
- ref: React.RefObject<ParamMover>;
275
- state: {
276
- visible: boolean;
277
- pending: boolean;
278
- };
279
- onShow: () => void;
280
- onHide: () => void;
281
- onSubmit: () => any;
282
- render(): JSX.Element;
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
- static el: ReactGlobalComp<ParamMoverProps & Required<Pick<ParamMoverProps, "onSubmit">>>;
286
- static show(props: Omit<ComponentProps<typeof ParamMoverModalEl>, 'visible'>): Promise<void>;
287
- static hide(): Promise<void>;
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<ParamType, {
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
- declare function paramValidator(val: any, values: {
304
+ }
305
+ >;
306
+ declare function paramValidator(
307
+ val: any,
308
+ values: {
299
309
  valueType: ParamType;
300
- }): string;
310
+ },
311
+ ): string;
301
312
  declare const ParamTypeOptions: {
302
- value: number;
303
- label: string;
304
- name: string;
305
- key?: string | undefined;
306
- defaultValue?: any;
307
- Comp: React.ComponentType<BaseInputProps>;
308
- validator?(value: any): string;
309
- required?: boolean | undefined;
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): "Should not be empty" | "";
315
- declare function numRangeValidator(val: {
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
- }, enableEmpty?: boolean): string;
319
- declare function expiryValidator(val: string, enableEmpty?: boolean): "Should not be empty" | "" | "Out of format";
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(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";
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(validator: (val: any, values: any) => ValidateInfo['string'], form?: () => any): (_: any, val: any) => Promise<any>;
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 { BaseInputProps, ParamForm, ParamFormData, ParamFormModal, ParamFormProps, ParamGroupEditor, ParamGroupEditorData, ParamGroupEditorModal, ParamGroupEditorModalEl, ParamGroupEditorProps, 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, validatorCvt };
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-05-05
4
- * Version: 0.1.53
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
- var value = _toConsumableArray(_this.props.value || []);
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$value,
800
+ var _this$props$value2,
797
801
  _this2 = this;
798
802
 
799
- var value = (_this$props$value = this.props.value) === null || _this$props$value === void 0 ? void 0 : _this$props$value.filter(function (it) {
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$value2;
818
+ var _this$props$value3;
815
819
 
816
- var _val = (_this$props$value2 = this.props.value) === null || _this$props$value2 === void 0 ? void 0 : _this$props$value2[0];
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$options,
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$options = this.props.options) === null || _this$props$options === void 0 ? void 0 : _this$props$options.map(function (it) {
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: 'value',
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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalplus/params-about",
3
- "version": "0.1.53",
3
+ "version": "1.0.2",
4
4
  "description": "A description for the module",
5
5
  "main": "./lib/umd/index.js",
6
6
  "module": "./lib/es/index.js",