iglooform 3.1.2 → 3.1.4
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/.dumi/tmp/dumi/theme/ContextWrapper.tsx +1 -1
- package/es/form-context.d.ts +28 -0
- package/es/types.d.ts +184 -0
- package/es/utils/form-utils.js +4 -2
- package/es/utils/tools.js +1 -1
- package/lib/form-context.d.ts +28 -0
- package/lib/types.d.ts +184 -0
- package/lib/utils/form-utils.js +4 -2
- package/lib/utils/tools.js +1 -1
- package/package.json +1 -1
- package/es/media/file-icon.d.ts +0 -9
- package/lib/media/file-icon.d.ts +0 -9
|
@@ -30,7 +30,7 @@ export default function DumiContextWrapper() {
|
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
32
|
<SiteContext.Provider value={{
|
|
33
|
-
pkg: {"name":"iglooform","version":"3.1.
|
|
33
|
+
pkg: {"name":"iglooform","version":"3.1.3","license":"MIT"},
|
|
34
34
|
historyType: "browser",
|
|
35
35
|
entryExports,
|
|
36
36
|
demos,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormInstance } from 'antd/es/form';
|
|
3
|
+
import { FC, FormItemName, OCRHooks } from './types';
|
|
4
|
+
declare const _default: React.Context<{
|
|
5
|
+
form?: FormInstance<any> | undefined;
|
|
6
|
+
onCancel?(): void;
|
|
7
|
+
cancelText?: string | undefined;
|
|
8
|
+
submitText?: string | undefined;
|
|
9
|
+
previewText?: string | undefined;
|
|
10
|
+
nextText?: string | undefined;
|
|
11
|
+
continueText?: string | undefined;
|
|
12
|
+
validateMessages?: Object | undefined;
|
|
13
|
+
submitting?: boolean | undefined;
|
|
14
|
+
requiredMark?: boolean | undefined;
|
|
15
|
+
showSubmitButton?: boolean | undefined;
|
|
16
|
+
getScrollContainer: () => HTMLElement | Window | null;
|
|
17
|
+
registerDependencies: (name: FormItemName | FormItemName[], updater: Function) => void;
|
|
18
|
+
handleValuesChange(changedFields: any): any;
|
|
19
|
+
uploadApi?: string | undefined;
|
|
20
|
+
selectDatasourceApi?: string | undefined;
|
|
21
|
+
getRuleValidationApi?: string | undefined;
|
|
22
|
+
customizeComponents?: {
|
|
23
|
+
[name: string]: FC<{}>;
|
|
24
|
+
} | undefined;
|
|
25
|
+
ocrHooks?: OCRHooks | undefined;
|
|
26
|
+
validationCodeExtraParams?: Record<string, any> | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
export default _default;
|
package/es/types.d.ts
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/// <reference path="../typings.d.ts" />
|
|
2
|
+
import { FormItemProps, FormInstance } from 'antd/es/form';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { NamePath } from 'rc-field-form/lib/interface';
|
|
5
|
+
import { CheckboxOptionType } from 'antd/es/checkbox';
|
|
6
|
+
import { SelectProps } from 'antd/es/select';
|
|
7
|
+
import { BlinkIdSingleSideRecognizerResult } from '@microblink/blinkid-in-browser-sdk';
|
|
8
|
+
export { Rule } from 'rc-field-form/lib/interface';
|
|
9
|
+
export interface OCRHooks {
|
|
10
|
+
microBlink?: {
|
|
11
|
+
initResult: {
|
|
12
|
+
error?: string;
|
|
13
|
+
failed: boolean;
|
|
14
|
+
};
|
|
15
|
+
recognize: ((file: File) => Promise<BlinkIdSingleSideRecognizerResult | null>) | null;
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface OCRConfig {
|
|
20
|
+
microBlink?: {
|
|
21
|
+
licenseKey: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export type FormItemName = NamePath;
|
|
25
|
+
export interface FormBasicConfig {
|
|
26
|
+
config: FormItemConfig;
|
|
27
|
+
className?: string;
|
|
28
|
+
style?: Object;
|
|
29
|
+
locales?: {
|
|
30
|
+
cancelText?: string;
|
|
31
|
+
submitText?: string;
|
|
32
|
+
previewText?: string;
|
|
33
|
+
nextText?: string;
|
|
34
|
+
continueText?: string;
|
|
35
|
+
validateMessages?: Object;
|
|
36
|
+
};
|
|
37
|
+
initialValues?: any;
|
|
38
|
+
form?: FormInstance;
|
|
39
|
+
onCancel?(): void;
|
|
40
|
+
onSubmit?(values: Object, allValues?: Object): any;
|
|
41
|
+
requiredMark?: boolean;
|
|
42
|
+
showSubmitButton?: boolean;
|
|
43
|
+
getScrollContainer?: () => HTMLElement | null;
|
|
44
|
+
onFirstModified?: () => any;
|
|
45
|
+
uploadApi?: string;
|
|
46
|
+
selectDatasourceApi?: string;
|
|
47
|
+
validationRule?: string;
|
|
48
|
+
getRuleValidationApi?: string;
|
|
49
|
+
stepDirection?: 'vertical' | 'horizontal';
|
|
50
|
+
customizeComponents?: {
|
|
51
|
+
[name: string]: FC;
|
|
52
|
+
};
|
|
53
|
+
ocr?: OCRConfig;
|
|
54
|
+
validationCodeExtraParams?: Record<string, any>;
|
|
55
|
+
}
|
|
56
|
+
export type FormItemAssert = {
|
|
57
|
+
field: NamePath;
|
|
58
|
+
value?: any;
|
|
59
|
+
operation?: 'eq' | 'ne' | 'in' | 'ni' | 'lt' | 'le' | 'gt' | 'ge' | 'co' | 'nc' | 'filled' | 'unfilled' | 'co-some' | 'co-every' | 'some-in' | 'every-in';
|
|
60
|
+
};
|
|
61
|
+
export type FormItemCopyValue = {
|
|
62
|
+
assert: FormItemAssert;
|
|
63
|
+
copyFrom: NamePath;
|
|
64
|
+
disabled?: boolean;
|
|
65
|
+
};
|
|
66
|
+
export type FormItemSelectValue = {
|
|
67
|
+
assert: FormItemAssert;
|
|
68
|
+
value: any;
|
|
69
|
+
disabled?: boolean;
|
|
70
|
+
};
|
|
71
|
+
export interface FormItemExtraConfig extends FormItemProps {
|
|
72
|
+
elements?: FormItemConfig[];
|
|
73
|
+
required?: boolean;
|
|
74
|
+
requiredAsserts?: FormItemAssert[];
|
|
75
|
+
extraLabel?: any;
|
|
76
|
+
xl?: number;
|
|
77
|
+
md?: number;
|
|
78
|
+
xs?: number;
|
|
79
|
+
span?: number;
|
|
80
|
+
areaCode?: number | string | (number | string)[];
|
|
81
|
+
phoneNumber?: number | string;
|
|
82
|
+
mergeRules?: boolean;
|
|
83
|
+
dependencies?: NamePath[];
|
|
84
|
+
antdDependencies?: NamePath[];
|
|
85
|
+
asserts?: FormItemAssert[];
|
|
86
|
+
shouldRender?: (form?: FormInstance) => boolean;
|
|
87
|
+
ignore?: boolean;
|
|
88
|
+
copyValue?: FormItemCopyValue;
|
|
89
|
+
selectValue?: FormItemSelectValue[];
|
|
90
|
+
disabled?: boolean | FormItemAssert | FormItemAssert[];
|
|
91
|
+
halfRow?: boolean;
|
|
92
|
+
fullRow?: boolean;
|
|
93
|
+
limit?: number;
|
|
94
|
+
hideWhenPreview?: boolean;
|
|
95
|
+
hideWhenEdit?: boolean;
|
|
96
|
+
requiredMessage?: string | ReactNode;
|
|
97
|
+
showOptional?: boolean;
|
|
98
|
+
previewFormater?(value: any, form?: FormInstance): any;
|
|
99
|
+
handleNext?(values: any): any;
|
|
100
|
+
render?(preview: boolean, form?: FormInstance, value?: any, onChange?: (params: any) => any, setShowStepButton?: IglooComponentProps['setShowStepButton']): any;
|
|
101
|
+
locales?: {
|
|
102
|
+
[key: string]: string;
|
|
103
|
+
};
|
|
104
|
+
options?: (CheckboxOptionType & {
|
|
105
|
+
extraInfo?: {
|
|
106
|
+
content: any;
|
|
107
|
+
shownTrigger: 'unchecked' | 'checked' | 'all';
|
|
108
|
+
};
|
|
109
|
+
})[] | SelectProps['options'];
|
|
110
|
+
sendOtp?: (value: any) => any;
|
|
111
|
+
dependField?: FormItemName;
|
|
112
|
+
countDownSeconds?: number;
|
|
113
|
+
getButtonDisabledState?: (form: FormInstance) => boolean;
|
|
114
|
+
getPreviousDisabledState?: (form: FormInstance) => boolean;
|
|
115
|
+
handleUpload?(file: File): PromiseLike<string>;
|
|
116
|
+
withoutForm?: boolean;
|
|
117
|
+
disableEditButton?: boolean;
|
|
118
|
+
hidePreviewDivider?: boolean;
|
|
119
|
+
valueFormater?: (value: any) => any;
|
|
120
|
+
currentStep?: number;
|
|
121
|
+
subscribedFields?: FormItemName[];
|
|
122
|
+
description?: string | React.ReactNode;
|
|
123
|
+
dateLimitationType?: 'relative' | 'absolute';
|
|
124
|
+
absoluteRangeStart?: number;
|
|
125
|
+
absoluteRangeEnd?: number;
|
|
126
|
+
relativeRangeStart?: {
|
|
127
|
+
type: 'day' | 'month' | 'year';
|
|
128
|
+
quantity: number;
|
|
129
|
+
pattern?: string;
|
|
130
|
+
dependField?: NamePath;
|
|
131
|
+
};
|
|
132
|
+
relativeRangeEnd?: {
|
|
133
|
+
type: 'day' | 'month' | 'year';
|
|
134
|
+
quantity: number;
|
|
135
|
+
pattern?: string;
|
|
136
|
+
dependField?: NamePath;
|
|
137
|
+
};
|
|
138
|
+
validationCode?: {
|
|
139
|
+
code: string;
|
|
140
|
+
errorMessage: string;
|
|
141
|
+
warningOnly?: boolean;
|
|
142
|
+
}[];
|
|
143
|
+
length?: number;
|
|
144
|
+
minLength?: number;
|
|
145
|
+
maxLength?: number;
|
|
146
|
+
idType?: 'KTP' | 'NIK';
|
|
147
|
+
validationRule?: string;
|
|
148
|
+
shouldRenderCode?: string;
|
|
149
|
+
[key: string]: any;
|
|
150
|
+
}
|
|
151
|
+
export interface FormItemConfig extends FormItemExtraConfig {
|
|
152
|
+
type?: string;
|
|
153
|
+
name?: NamePath;
|
|
154
|
+
label?: string | React.ReactNode;
|
|
155
|
+
previewLabel?: string | React.ReactNode;
|
|
156
|
+
labelProps?: any;
|
|
157
|
+
contentProps?: any;
|
|
158
|
+
ocr?: {
|
|
159
|
+
vender: string;
|
|
160
|
+
outputMap: {
|
|
161
|
+
field: string[];
|
|
162
|
+
source: string[];
|
|
163
|
+
}[];
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
export type FormItemPropsHandler = (config: FormItemConfig) => FormItemConfig;
|
|
167
|
+
export interface FC<P = {}> extends React.FunctionComponent<P> {
|
|
168
|
+
formItemPropsHandler?: FormItemPropsHandler;
|
|
169
|
+
isPreviewSupport?: boolean;
|
|
170
|
+
}
|
|
171
|
+
export interface Form extends React.ForwardRefExoticComponent<FormBasicConfig & React.RefAttributes<any>> {
|
|
172
|
+
useForm: () => FormInstance;
|
|
173
|
+
}
|
|
174
|
+
export interface IglooComponentProps {
|
|
175
|
+
validateField?: (nameList?: NamePath[]) => Promise<any>;
|
|
176
|
+
containerRef?: React.RefObject<any>;
|
|
177
|
+
setFieldError?(errorMsg?: string): void;
|
|
178
|
+
setFieldValue?(value?: any): void;
|
|
179
|
+
setShowStepButton?: (showButton: boolean) => void;
|
|
180
|
+
getFormInstance?: () => FormInstance;
|
|
181
|
+
locales?: {
|
|
182
|
+
[key: string]: string;
|
|
183
|
+
};
|
|
184
|
+
}
|
package/es/utils/form-utils.js
CHANGED
|
@@ -295,7 +295,8 @@ export var calcFormItemProps = function calcFormItemProps(config, extraProps, fo
|
|
|
295
295
|
if (validationCode.length) {
|
|
296
296
|
rules.push.apply(rules, _toConsumableArray(validationCode.map(function (_ref2) {
|
|
297
297
|
var code = _ref2.code,
|
|
298
|
-
errorMessage = _ref2.errorMessage
|
|
298
|
+
errorMessage = _ref2.errorMessage,
|
|
299
|
+
warningOnly = _ref2.warningOnly;
|
|
299
300
|
return {
|
|
300
301
|
validator: function validator(_, value) {
|
|
301
302
|
try {
|
|
@@ -308,7 +309,8 @@ export var calcFormItemProps = function calcFormItemProps(config, extraProps, fo
|
|
|
308
309
|
} catch (_unused) {
|
|
309
310
|
return Promise.reject(errorMessage);
|
|
310
311
|
}
|
|
311
|
-
}
|
|
312
|
+
},
|
|
313
|
+
warningOnly: warningOnly
|
|
312
314
|
};
|
|
313
315
|
})));
|
|
314
316
|
}
|
package/es/utils/tools.js
CHANGED
|
@@ -25,7 +25,7 @@ export var parseFileSize = function parseFileSize(size) {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
export function classifyType(mimeType) {
|
|
28
|
-
var CONFIGS = [['image', 'image/jpeg image/apng image/avif image/bmp image/vnd.microsoft.icon image/png image/gif image/svg+xml image/tiff image/webp'], ['video', 'video/mp4 video/x-msvideo video/mpeg video/ogg video/mp2t video/webm'], ['pdf', 'application/pdf'], ['eps', 'application/postscript'], ['doc', 'application/msword'], ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'], ['xls', 'application/vnd.ms-excel'], ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], ['csv', 'text/csv'], ['ppt', 'application/vnd.ms-powerpoint'], ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'], ['txt', 'text/plain']];
|
|
28
|
+
var CONFIGS = [['image', 'image/jpeg image/apng image/avif image/bmp image/vnd.microsoft.icon image/png image/gif image/svg+xml image/tiff image/webp'], ['image', 'binary/octet-stream'], ['video', 'video/mp4 video/x-msvideo video/mpeg video/ogg video/mp2t video/webm video/quicktime'], ['pdf', 'application/pdf'], ['eps', 'application/postscript'], ['doc', 'application/msword'], ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'], ['xls', 'application/vnd.ms-excel'], ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], ['csv', 'text/csv'], ['ppt', 'application/vnd.ms-powerpoint'], ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'], ['txt', 'text/plain']];
|
|
29
29
|
var type = 'unknown';
|
|
30
30
|
for (var i = 0, len = CONFIGS.length; i < len; i++) {
|
|
31
31
|
var _CONFIGS$i = _slicedToArray(CONFIGS[i], 2),
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormInstance } from 'antd/es/form';
|
|
3
|
+
import { FC, FormItemName, OCRHooks } from './types';
|
|
4
|
+
declare const _default: React.Context<{
|
|
5
|
+
form?: FormInstance<any> | undefined;
|
|
6
|
+
onCancel?(): void;
|
|
7
|
+
cancelText?: string | undefined;
|
|
8
|
+
submitText?: string | undefined;
|
|
9
|
+
previewText?: string | undefined;
|
|
10
|
+
nextText?: string | undefined;
|
|
11
|
+
continueText?: string | undefined;
|
|
12
|
+
validateMessages?: Object | undefined;
|
|
13
|
+
submitting?: boolean | undefined;
|
|
14
|
+
requiredMark?: boolean | undefined;
|
|
15
|
+
showSubmitButton?: boolean | undefined;
|
|
16
|
+
getScrollContainer: () => HTMLElement | Window | null;
|
|
17
|
+
registerDependencies: (name: FormItemName | FormItemName[], updater: Function) => void;
|
|
18
|
+
handleValuesChange(changedFields: any): any;
|
|
19
|
+
uploadApi?: string | undefined;
|
|
20
|
+
selectDatasourceApi?: string | undefined;
|
|
21
|
+
getRuleValidationApi?: string | undefined;
|
|
22
|
+
customizeComponents?: {
|
|
23
|
+
[name: string]: FC<{}>;
|
|
24
|
+
} | undefined;
|
|
25
|
+
ocrHooks?: OCRHooks | undefined;
|
|
26
|
+
validationCodeExtraParams?: Record<string, any> | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
export default _default;
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/// <reference path="../typings.d.ts" />
|
|
2
|
+
import { FormItemProps, FormInstance } from 'antd/es/form';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { NamePath } from 'rc-field-form/lib/interface';
|
|
5
|
+
import { CheckboxOptionType } from 'antd/es/checkbox';
|
|
6
|
+
import { SelectProps } from 'antd/es/select';
|
|
7
|
+
import { BlinkIdSingleSideRecognizerResult } from '@microblink/blinkid-in-browser-sdk';
|
|
8
|
+
export { Rule } from 'rc-field-form/lib/interface';
|
|
9
|
+
export interface OCRHooks {
|
|
10
|
+
microBlink?: {
|
|
11
|
+
initResult: {
|
|
12
|
+
error?: string;
|
|
13
|
+
failed: boolean;
|
|
14
|
+
};
|
|
15
|
+
recognize: ((file: File) => Promise<BlinkIdSingleSideRecognizerResult | null>) | null;
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface OCRConfig {
|
|
20
|
+
microBlink?: {
|
|
21
|
+
licenseKey: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export type FormItemName = NamePath;
|
|
25
|
+
export interface FormBasicConfig {
|
|
26
|
+
config: FormItemConfig;
|
|
27
|
+
className?: string;
|
|
28
|
+
style?: Object;
|
|
29
|
+
locales?: {
|
|
30
|
+
cancelText?: string;
|
|
31
|
+
submitText?: string;
|
|
32
|
+
previewText?: string;
|
|
33
|
+
nextText?: string;
|
|
34
|
+
continueText?: string;
|
|
35
|
+
validateMessages?: Object;
|
|
36
|
+
};
|
|
37
|
+
initialValues?: any;
|
|
38
|
+
form?: FormInstance;
|
|
39
|
+
onCancel?(): void;
|
|
40
|
+
onSubmit?(values: Object, allValues?: Object): any;
|
|
41
|
+
requiredMark?: boolean;
|
|
42
|
+
showSubmitButton?: boolean;
|
|
43
|
+
getScrollContainer?: () => HTMLElement | null;
|
|
44
|
+
onFirstModified?: () => any;
|
|
45
|
+
uploadApi?: string;
|
|
46
|
+
selectDatasourceApi?: string;
|
|
47
|
+
validationRule?: string;
|
|
48
|
+
getRuleValidationApi?: string;
|
|
49
|
+
stepDirection?: 'vertical' | 'horizontal';
|
|
50
|
+
customizeComponents?: {
|
|
51
|
+
[name: string]: FC;
|
|
52
|
+
};
|
|
53
|
+
ocr?: OCRConfig;
|
|
54
|
+
validationCodeExtraParams?: Record<string, any>;
|
|
55
|
+
}
|
|
56
|
+
export type FormItemAssert = {
|
|
57
|
+
field: NamePath;
|
|
58
|
+
value?: any;
|
|
59
|
+
operation?: 'eq' | 'ne' | 'in' | 'ni' | 'lt' | 'le' | 'gt' | 'ge' | 'co' | 'nc' | 'filled' | 'unfilled' | 'co-some' | 'co-every' | 'some-in' | 'every-in';
|
|
60
|
+
};
|
|
61
|
+
export type FormItemCopyValue = {
|
|
62
|
+
assert: FormItemAssert;
|
|
63
|
+
copyFrom: NamePath;
|
|
64
|
+
disabled?: boolean;
|
|
65
|
+
};
|
|
66
|
+
export type FormItemSelectValue = {
|
|
67
|
+
assert: FormItemAssert;
|
|
68
|
+
value: any;
|
|
69
|
+
disabled?: boolean;
|
|
70
|
+
};
|
|
71
|
+
export interface FormItemExtraConfig extends FormItemProps {
|
|
72
|
+
elements?: FormItemConfig[];
|
|
73
|
+
required?: boolean;
|
|
74
|
+
requiredAsserts?: FormItemAssert[];
|
|
75
|
+
extraLabel?: any;
|
|
76
|
+
xl?: number;
|
|
77
|
+
md?: number;
|
|
78
|
+
xs?: number;
|
|
79
|
+
span?: number;
|
|
80
|
+
areaCode?: number | string | (number | string)[];
|
|
81
|
+
phoneNumber?: number | string;
|
|
82
|
+
mergeRules?: boolean;
|
|
83
|
+
dependencies?: NamePath[];
|
|
84
|
+
antdDependencies?: NamePath[];
|
|
85
|
+
asserts?: FormItemAssert[];
|
|
86
|
+
shouldRender?: (form?: FormInstance) => boolean;
|
|
87
|
+
ignore?: boolean;
|
|
88
|
+
copyValue?: FormItemCopyValue;
|
|
89
|
+
selectValue?: FormItemSelectValue[];
|
|
90
|
+
disabled?: boolean | FormItemAssert | FormItemAssert[];
|
|
91
|
+
halfRow?: boolean;
|
|
92
|
+
fullRow?: boolean;
|
|
93
|
+
limit?: number;
|
|
94
|
+
hideWhenPreview?: boolean;
|
|
95
|
+
hideWhenEdit?: boolean;
|
|
96
|
+
requiredMessage?: string | ReactNode;
|
|
97
|
+
showOptional?: boolean;
|
|
98
|
+
previewFormater?(value: any, form?: FormInstance): any;
|
|
99
|
+
handleNext?(values: any): any;
|
|
100
|
+
render?(preview: boolean, form?: FormInstance, value?: any, onChange?: (params: any) => any, setShowStepButton?: IglooComponentProps['setShowStepButton']): any;
|
|
101
|
+
locales?: {
|
|
102
|
+
[key: string]: string;
|
|
103
|
+
};
|
|
104
|
+
options?: (CheckboxOptionType & {
|
|
105
|
+
extraInfo?: {
|
|
106
|
+
content: any;
|
|
107
|
+
shownTrigger: 'unchecked' | 'checked' | 'all';
|
|
108
|
+
};
|
|
109
|
+
})[] | SelectProps['options'];
|
|
110
|
+
sendOtp?: (value: any) => any;
|
|
111
|
+
dependField?: FormItemName;
|
|
112
|
+
countDownSeconds?: number;
|
|
113
|
+
getButtonDisabledState?: (form: FormInstance) => boolean;
|
|
114
|
+
getPreviousDisabledState?: (form: FormInstance) => boolean;
|
|
115
|
+
handleUpload?(file: File): PromiseLike<string>;
|
|
116
|
+
withoutForm?: boolean;
|
|
117
|
+
disableEditButton?: boolean;
|
|
118
|
+
hidePreviewDivider?: boolean;
|
|
119
|
+
valueFormater?: (value: any) => any;
|
|
120
|
+
currentStep?: number;
|
|
121
|
+
subscribedFields?: FormItemName[];
|
|
122
|
+
description?: string | React.ReactNode;
|
|
123
|
+
dateLimitationType?: 'relative' | 'absolute';
|
|
124
|
+
absoluteRangeStart?: number;
|
|
125
|
+
absoluteRangeEnd?: number;
|
|
126
|
+
relativeRangeStart?: {
|
|
127
|
+
type: 'day' | 'month' | 'year';
|
|
128
|
+
quantity: number;
|
|
129
|
+
pattern?: string;
|
|
130
|
+
dependField?: NamePath;
|
|
131
|
+
};
|
|
132
|
+
relativeRangeEnd?: {
|
|
133
|
+
type: 'day' | 'month' | 'year';
|
|
134
|
+
quantity: number;
|
|
135
|
+
pattern?: string;
|
|
136
|
+
dependField?: NamePath;
|
|
137
|
+
};
|
|
138
|
+
validationCode?: {
|
|
139
|
+
code: string;
|
|
140
|
+
errorMessage: string;
|
|
141
|
+
warningOnly?: boolean;
|
|
142
|
+
}[];
|
|
143
|
+
length?: number;
|
|
144
|
+
minLength?: number;
|
|
145
|
+
maxLength?: number;
|
|
146
|
+
idType?: 'KTP' | 'NIK';
|
|
147
|
+
validationRule?: string;
|
|
148
|
+
shouldRenderCode?: string;
|
|
149
|
+
[key: string]: any;
|
|
150
|
+
}
|
|
151
|
+
export interface FormItemConfig extends FormItemExtraConfig {
|
|
152
|
+
type?: string;
|
|
153
|
+
name?: NamePath;
|
|
154
|
+
label?: string | React.ReactNode;
|
|
155
|
+
previewLabel?: string | React.ReactNode;
|
|
156
|
+
labelProps?: any;
|
|
157
|
+
contentProps?: any;
|
|
158
|
+
ocr?: {
|
|
159
|
+
vender: string;
|
|
160
|
+
outputMap: {
|
|
161
|
+
field: string[];
|
|
162
|
+
source: string[];
|
|
163
|
+
}[];
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
export type FormItemPropsHandler = (config: FormItemConfig) => FormItemConfig;
|
|
167
|
+
export interface FC<P = {}> extends React.FunctionComponent<P> {
|
|
168
|
+
formItemPropsHandler?: FormItemPropsHandler;
|
|
169
|
+
isPreviewSupport?: boolean;
|
|
170
|
+
}
|
|
171
|
+
export interface Form extends React.ForwardRefExoticComponent<FormBasicConfig & React.RefAttributes<any>> {
|
|
172
|
+
useForm: () => FormInstance;
|
|
173
|
+
}
|
|
174
|
+
export interface IglooComponentProps {
|
|
175
|
+
validateField?: (nameList?: NamePath[]) => Promise<any>;
|
|
176
|
+
containerRef?: React.RefObject<any>;
|
|
177
|
+
setFieldError?(errorMsg?: string): void;
|
|
178
|
+
setFieldValue?(value?: any): void;
|
|
179
|
+
setShowStepButton?: (showButton: boolean) => void;
|
|
180
|
+
getFormInstance?: () => FormInstance;
|
|
181
|
+
locales?: {
|
|
182
|
+
[key: string]: string;
|
|
183
|
+
};
|
|
184
|
+
}
|
package/lib/utils/form-utils.js
CHANGED
|
@@ -303,7 +303,8 @@ var calcFormItemProps = function calcFormItemProps(config, extraProps, form, par
|
|
|
303
303
|
if (validationCode.length) {
|
|
304
304
|
rules.push.apply(rules, _toConsumableArray(validationCode.map(function (_ref2) {
|
|
305
305
|
var code = _ref2.code,
|
|
306
|
-
errorMessage = _ref2.errorMessage
|
|
306
|
+
errorMessage = _ref2.errorMessage,
|
|
307
|
+
warningOnly = _ref2.warningOnly;
|
|
307
308
|
return {
|
|
308
309
|
validator: function validator(_, value) {
|
|
309
310
|
try {
|
|
@@ -316,7 +317,8 @@ var calcFormItemProps = function calcFormItemProps(config, extraProps, form, par
|
|
|
316
317
|
} catch (_unused) {
|
|
317
318
|
return Promise.reject(errorMessage);
|
|
318
319
|
}
|
|
319
|
-
}
|
|
320
|
+
},
|
|
321
|
+
warningOnly: warningOnly
|
|
320
322
|
};
|
|
321
323
|
})));
|
|
322
324
|
}
|
package/lib/utils/tools.js
CHANGED
|
@@ -33,7 +33,7 @@ var parseFileSize = function parseFileSize(size) {
|
|
|
33
33
|
};
|
|
34
34
|
exports.parseFileSize = parseFileSize;
|
|
35
35
|
function classifyType(mimeType) {
|
|
36
|
-
var CONFIGS = [['image', 'image/jpeg image/apng image/avif image/bmp image/vnd.microsoft.icon image/png image/gif image/svg+xml image/tiff image/webp'], ['video', 'video/mp4 video/x-msvideo video/mpeg video/ogg video/mp2t video/webm'], ['pdf', 'application/pdf'], ['eps', 'application/postscript'], ['doc', 'application/msword'], ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'], ['xls', 'application/vnd.ms-excel'], ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], ['csv', 'text/csv'], ['ppt', 'application/vnd.ms-powerpoint'], ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'], ['txt', 'text/plain']];
|
|
36
|
+
var CONFIGS = [['image', 'image/jpeg image/apng image/avif image/bmp image/vnd.microsoft.icon image/png image/gif image/svg+xml image/tiff image/webp'], ['image', 'binary/octet-stream'], ['video', 'video/mp4 video/x-msvideo video/mpeg video/ogg video/mp2t video/webm video/quicktime'], ['pdf', 'application/pdf'], ['eps', 'application/postscript'], ['doc', 'application/msword'], ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'], ['xls', 'application/vnd.ms-excel'], ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], ['csv', 'text/csv'], ['ppt', 'application/vnd.ms-powerpoint'], ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'], ['txt', 'text/plain']];
|
|
37
37
|
var type = 'unknown';
|
|
38
38
|
for (var i = 0, len = CONFIGS.length; i < len; i++) {
|
|
39
39
|
var _CONFIGS$i = _slicedToArray(CONFIGS[i], 2),
|
package/package.json
CHANGED
package/es/media/file-icon.d.ts
DELETED
package/lib/media/file-icon.d.ts
DELETED