iglooform 3.7.8 → 3.7.9
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/core/defineApp.ts +1 -1
- package/.dumi/tmp/core/helmet.ts +1 -1
- package/.dumi/tmp/core/history.ts +1 -1
- package/.dumi/tmp/core/historyIntelli.ts +1 -1
- package/.dumi/tmp/core/plugin.ts +2 -2
- package/.dumi/tmp/core/polyfill.ts +197 -197
- package/.dumi/tmp/core/route.tsx +33 -33
- package/.dumi/tmp/dumi/exports.ts +1 -1
- package/.dumi/tmp/dumi/locales/runtime.tsx +2 -2
- package/.dumi/tmp/dumi/meta/index.ts +33 -33
- package/.dumi/tmp/dumi/meta/runtime.ts +1 -1
- package/.dumi/tmp/dumi/theme/ContextWrapper.tsx +2 -2
- package/.dumi/tmp/dumi/theme/builtins/API.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Badge.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Container.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Previewer.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/SourceCode.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Table.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Tree.ts +1 -1
- package/.dumi/tmp/dumi/theme/layouts/DocLayout.ts +1 -1
- package/.dumi/tmp/dumi/theme/loading.tsx +1 -1
- package/.dumi/tmp/dumi/theme/slots/ColorSwitch.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Content.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/ContentFooter.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/ContentTabs.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Features.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Footer.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Header.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/HeaderExtra.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Hero.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/HeroTitle.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/LangSwitch.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Logo.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Navbar.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/NavbarExtra.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/NotFound.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/PreviewerActions.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/PreviewerActionsExtra.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/RtlSwitch.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/SearchBar.ts +2 -2
- package/.dumi/tmp/dumi/theme/slots/SearchResult.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Sidebar.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/SocialIcon.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Toc.ts +1 -1
- package/.dumi/tmp/exports.ts +5 -5
- package/.dumi/tmp/testBrowser.tsx +3 -3
- package/.dumi/tmp/umi.ts +4 -4
- package/.idea/codeStyles/Project.xml +80 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/iglooformv3.iml +12 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/vcs.xml +6 -0
- package/es/form/element/index.d.ts +12 -0
- package/es/form/element/index.js +6 -3
- package/es/form/element/style/index.less +4 -0
- package/es/free-form/element/index.d.ts +11 -0
- package/es/free-form/element/index.js +6 -3
- package/es/free-form/element/style/index.less +7 -3
- package/es/types.d.ts +190 -0
- package/es/upload-preview/index.d.ts +9 -0
- package/es/utils/form-utils.d.ts +79 -0
- package/lib/form/element/index.d.ts +12 -0
- package/lib/form/element/index.js +6 -3
- package/lib/form/element/style/index.less +4 -0
- package/lib/free-form/element/index.d.ts +11 -0
- package/lib/free-form/element/index.js +6 -3
- package/lib/free-form/element/style/index.less +7 -3
- package/lib/types.d.ts +190 -0
- package/lib/upload-preview/index.d.ts +9 -0
- package/lib/utils/form-utils.d.ts +79 -0
- package/package.json +1 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<component name="ProjectCodeStyleConfiguration">
|
|
2
|
+
<code_scheme name="Project" version="173">
|
|
3
|
+
<HTMLCodeStyleSettings>
|
|
4
|
+
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
|
5
|
+
</HTMLCodeStyleSettings>
|
|
6
|
+
<JSCodeStyleSettings version="0">
|
|
7
|
+
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
8
|
+
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
9
|
+
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
10
|
+
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
11
|
+
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
12
|
+
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
13
|
+
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
14
|
+
</JSCodeStyleSettings>
|
|
15
|
+
<JetCodeStyleSettings>
|
|
16
|
+
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
|
17
|
+
</JetCodeStyleSettings>
|
|
18
|
+
<TypeScriptCodeStyleSettings version="0">
|
|
19
|
+
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
20
|
+
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
21
|
+
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
22
|
+
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
23
|
+
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
24
|
+
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
25
|
+
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
26
|
+
</TypeScriptCodeStyleSettings>
|
|
27
|
+
<VueCodeStyleSettings>
|
|
28
|
+
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
|
|
29
|
+
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
|
|
30
|
+
</VueCodeStyleSettings>
|
|
31
|
+
<codeStyleSettings language="HTML">
|
|
32
|
+
<option name="SOFT_MARGINS" value="80" />
|
|
33
|
+
<indentOptions>
|
|
34
|
+
<option name="INDENT_SIZE" value="2" />
|
|
35
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
36
|
+
<option name="TAB_SIZE" value="2" />
|
|
37
|
+
</indentOptions>
|
|
38
|
+
</codeStyleSettings>
|
|
39
|
+
<codeStyleSettings language="JAVA">
|
|
40
|
+
<indentOptions>
|
|
41
|
+
<option name="INDENT_SIZE" value="2" />
|
|
42
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
43
|
+
<option name="TAB_SIZE" value="2" />
|
|
44
|
+
</indentOptions>
|
|
45
|
+
</codeStyleSettings>
|
|
46
|
+
<codeStyleSettings language="JavaScript">
|
|
47
|
+
<option name="SPACE_BEFORE_METHOD_PARENTHESES" value="true" />
|
|
48
|
+
<option name="SOFT_MARGINS" value="80" />
|
|
49
|
+
<indentOptions>
|
|
50
|
+
<option name="INDENT_SIZE" value="2" />
|
|
51
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
52
|
+
<option name="TAB_SIZE" value="2" />
|
|
53
|
+
</indentOptions>
|
|
54
|
+
</codeStyleSettings>
|
|
55
|
+
<codeStyleSettings language="TypeScript">
|
|
56
|
+
<option name="SOFT_MARGINS" value="80" />
|
|
57
|
+
<indentOptions>
|
|
58
|
+
<option name="INDENT_SIZE" value="2" />
|
|
59
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
60
|
+
<option name="TAB_SIZE" value="2" />
|
|
61
|
+
</indentOptions>
|
|
62
|
+
</codeStyleSettings>
|
|
63
|
+
<codeStyleSettings language="Vue">
|
|
64
|
+
<option name="SOFT_MARGINS" value="80" />
|
|
65
|
+
<indentOptions>
|
|
66
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
67
|
+
</indentOptions>
|
|
68
|
+
</codeStyleSettings>
|
|
69
|
+
<codeStyleSettings language="XML">
|
|
70
|
+
<indentOptions>
|
|
71
|
+
<option name="INDENT_SIZE" value="2" />
|
|
72
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
73
|
+
<option name="TAB_SIZE" value="2" />
|
|
74
|
+
</indentOptions>
|
|
75
|
+
</codeStyleSettings>
|
|
76
|
+
<codeStyleSettings language="kotlin">
|
|
77
|
+
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
|
78
|
+
</codeStyleSettings>
|
|
79
|
+
</code_scheme>
|
|
80
|
+
</component>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
+
</content>
|
|
9
|
+
<orderEntry type="inheritedJdk" />
|
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
+
</component>
|
|
12
|
+
</module>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/iglooformv3.iml" filepath="$PROJECT_DIR$/.idea/iglooformv3.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
package/.idea/vcs.xml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FormItemConfig, FormItemName } from '../../types';
|
|
3
|
+
import './style';
|
|
4
|
+
interface ElementProps {
|
|
5
|
+
config: FormItemConfig;
|
|
6
|
+
parentName?: FormItemName;
|
|
7
|
+
preview?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
setShowStepButton?: (showButton: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const Element: FC<ElementProps>;
|
|
12
|
+
export default Element;
|
package/es/form/element/index.js
CHANGED
|
@@ -264,7 +264,7 @@ var Element = function Element(_ref) {
|
|
|
264
264
|
'igloo-element-preview-hide': config.hideWhenPreview,
|
|
265
265
|
'igloo-element-preview-hide-divider': config.hidePreviewDivider
|
|
266
266
|
}),
|
|
267
|
-
children: /*#__PURE__*/
|
|
267
|
+
children: /*#__PURE__*/_jsxs(Form.Item, _objectSpread(_objectSpread({}, omit(formItemProps, ['copiedValue', 'selectedValue'])), {}, {
|
|
268
268
|
labelCol: {
|
|
269
269
|
span: 24
|
|
270
270
|
},
|
|
@@ -272,7 +272,7 @@ var Element = function Element(_ref) {
|
|
|
272
272
|
span: 24
|
|
273
273
|
},
|
|
274
274
|
label: null,
|
|
275
|
-
children: /*#__PURE__*/_jsxs(Row, {
|
|
275
|
+
children: [/*#__PURE__*/_jsxs(Row, {
|
|
276
276
|
className: "igloo-element-preview-item",
|
|
277
277
|
gutter: {
|
|
278
278
|
md: 32,
|
|
@@ -311,7 +311,10 @@ var Element = function Element(_ref) {
|
|
|
311
311
|
children: renderPreviewValue()
|
|
312
312
|
})]
|
|
313
313
|
})]
|
|
314
|
-
})
|
|
314
|
+
}), config.showExtraWhenPreview && /*#__PURE__*/_jsx("div", {
|
|
315
|
+
className: "igloo-element-preview-extra",
|
|
316
|
+
children: formItemProps.extra
|
|
317
|
+
})]
|
|
315
318
|
}))
|
|
316
319
|
});
|
|
317
320
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FormItemConfig, FormItemName } from '../../types';
|
|
3
|
+
import './style';
|
|
4
|
+
interface ElementProps extends FormItemConfig {
|
|
5
|
+
parentName?: FormItemName;
|
|
6
|
+
preview?: boolean;
|
|
7
|
+
setShowStepButton?: (showButton: boolean) => void;
|
|
8
|
+
disabledFromParent?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const Element: FC<ElementProps>;
|
|
11
|
+
export default Element;
|
|
@@ -199,7 +199,7 @@ var Element = function Element(props) {
|
|
|
199
199
|
'igloo-freeform-element-preview-hide': props.hideWhenPreview,
|
|
200
200
|
'igloo-freeform-element-preview-hide-divider': props.hidePreviewDivider
|
|
201
201
|
}),
|
|
202
|
-
children: /*#__PURE__*/
|
|
202
|
+
children: /*#__PURE__*/_jsxs(Form.Item, _objectSpread(_objectSpread({}, omit(formItemProps, ['copiedValue', 'selectedValue'])), {}, {
|
|
203
203
|
labelCol: {
|
|
204
204
|
span: 24
|
|
205
205
|
},
|
|
@@ -207,7 +207,7 @@ var Element = function Element(props) {
|
|
|
207
207
|
span: 24
|
|
208
208
|
},
|
|
209
209
|
label: null,
|
|
210
|
-
children: /*#__PURE__*/_jsxs(Row, {
|
|
210
|
+
children: [/*#__PURE__*/_jsxs(Row, {
|
|
211
211
|
className: "igloo-freeform-element-preview-item",
|
|
212
212
|
gutter: {
|
|
213
213
|
md: 32,
|
|
@@ -246,7 +246,10 @@ var Element = function Element(props) {
|
|
|
246
246
|
children: previewFormater ? previewFormater(value, form) : _typeof(value) === 'object' ? JSON.stringify(value) : value
|
|
247
247
|
})]
|
|
248
248
|
})]
|
|
249
|
-
})
|
|
249
|
+
}), rest.showExtraWhenPreview && /*#__PURE__*/_jsx("div", {
|
|
250
|
+
className: "igloo-freeform-element-preview-extra",
|
|
251
|
+
children: formItemProps.extra
|
|
252
|
+
})]
|
|
250
253
|
}))
|
|
251
254
|
});
|
|
252
255
|
}
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
.igloo-freeform-element-preview-item {
|
|
13
13
|
.igloo-freeform-element-preview-label {
|
|
14
|
-
color:
|
|
14
|
+
color: @icon-color;
|
|
15
15
|
line-height: 24px;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
.igloo-freeform-element-preview-value {
|
|
19
|
-
color:
|
|
19
|
+
color: @text-color;
|
|
20
20
|
white-space: pre-wrap;
|
|
21
21
|
word-break: break-word;
|
|
22
22
|
line-height: 24px;
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
.igloo-freeform-element-preview-extra {
|
|
36
|
+
margin-top: 6px;
|
|
37
|
+
}
|
|
38
|
+
|
|
35
39
|
.ant-form-item-explain-error {
|
|
36
40
|
margin-top: 0;
|
|
37
41
|
margin-left: calc(~'50%' + 16px);
|
|
@@ -95,7 +99,7 @@
|
|
|
95
99
|
width: 100%;
|
|
96
100
|
|
|
97
101
|
.igloo-freeform-label-text {
|
|
98
|
-
color:
|
|
102
|
+
color: @icon-color;
|
|
99
103
|
font-size: 16px;
|
|
100
104
|
line-height: 24px;
|
|
101
105
|
|
package/es/types.d.ts
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/// <reference path="../typings.d.ts" />
|
|
2
|
+
import { BlinkIdSingleSideRecognizerResult } from '@microblink/blinkid-in-browser-sdk';
|
|
3
|
+
import { FormItemProps, FormInstance } from 'antd/es/form';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
import { NamePath } from 'rc-field-form/lib/interface';
|
|
6
|
+
import { CheckboxOptionType } from 'antd/es/checkbox';
|
|
7
|
+
import { SelectProps } from 'antd/es/select';
|
|
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
|
+
onValuesChange?: (changedValues: any, values: any) => void;
|
|
56
|
+
}
|
|
57
|
+
export type FormItemAssert = {
|
|
58
|
+
field: NamePath;
|
|
59
|
+
value?: any;
|
|
60
|
+
operation?: 'eq' | 'ne' | 'in' | 'ni' | 'lt' | 'le' | 'gt' | 'ge' | 'co' | 'nc' | 'filled' | 'unfilled' | 'co-some' | 'co-every' | 'some-in' | 'every-in';
|
|
61
|
+
};
|
|
62
|
+
export type FormItemCopyValue = {
|
|
63
|
+
assert: FormItemAssert;
|
|
64
|
+
copyFrom: NamePath;
|
|
65
|
+
disabled?: boolean;
|
|
66
|
+
};
|
|
67
|
+
export type FormItemSelectValue = {
|
|
68
|
+
assert: FormItemAssert;
|
|
69
|
+
value: any;
|
|
70
|
+
disabled?: boolean;
|
|
71
|
+
};
|
|
72
|
+
export interface FormItemExtraConfig extends FormItemProps {
|
|
73
|
+
labelTooltip?: string;
|
|
74
|
+
elements?: FormItemConfig[];
|
|
75
|
+
required?: boolean;
|
|
76
|
+
requiredAsserts?: FormItemAssert[];
|
|
77
|
+
extraLabel?: any;
|
|
78
|
+
xl?: number;
|
|
79
|
+
md?: number;
|
|
80
|
+
xs?: number;
|
|
81
|
+
span?: number;
|
|
82
|
+
areaCode?: number | string | (number | string)[];
|
|
83
|
+
phoneNumber?: number | string;
|
|
84
|
+
mergeRules?: boolean;
|
|
85
|
+
dependencies?: NamePath[];
|
|
86
|
+
antdDependencies?: NamePath[];
|
|
87
|
+
asserts?: FormItemAssert[];
|
|
88
|
+
shouldRender?: (form?: FormInstance) => boolean;
|
|
89
|
+
ignore?: boolean;
|
|
90
|
+
copyValue?: FormItemCopyValue;
|
|
91
|
+
selectValue?: FormItemSelectValue[];
|
|
92
|
+
disabled?: boolean | FormItemAssert | FormItemAssert[];
|
|
93
|
+
halfRow?: boolean;
|
|
94
|
+
fullRow?: boolean;
|
|
95
|
+
limit?: number;
|
|
96
|
+
hideWhenPreview?: boolean;
|
|
97
|
+
hideWhenEdit?: boolean;
|
|
98
|
+
showExtraWhenPreview?: boolean;
|
|
99
|
+
requiredMessage?: string | ReactNode;
|
|
100
|
+
showOptional?: boolean;
|
|
101
|
+
previewFormater?(value: any, form?: FormInstance): any;
|
|
102
|
+
handleNext?(values: any): any;
|
|
103
|
+
render?(preview: boolean, form?: FormInstance, value?: any, onChange?: (params: any) => any, setShowStepButton?: IglooComponentProps['setShowStepButton']): any;
|
|
104
|
+
locales?: {
|
|
105
|
+
[key: string]: string;
|
|
106
|
+
};
|
|
107
|
+
options?: (CheckboxOptionType & {
|
|
108
|
+
extraInfo?: {
|
|
109
|
+
content: any;
|
|
110
|
+
shownTrigger: 'unchecked' | 'checked' | 'all';
|
|
111
|
+
};
|
|
112
|
+
})[] | SelectProps['options'];
|
|
113
|
+
sendOtp?: (value: any) => any;
|
|
114
|
+
dependField?: FormItemName;
|
|
115
|
+
countDownSeconds?: number;
|
|
116
|
+
getButtonDisabledState?: (form: FormInstance) => boolean;
|
|
117
|
+
getPreviousDisabledState?: (form: FormInstance) => boolean;
|
|
118
|
+
handleUpload?(file: File): PromiseLike<string>;
|
|
119
|
+
withoutForm?: boolean;
|
|
120
|
+
disableEditButton?: boolean;
|
|
121
|
+
hidePreviewDivider?: boolean;
|
|
122
|
+
valueFormater?: (value: any) => any;
|
|
123
|
+
currentStep?: number;
|
|
124
|
+
subscribedFields?: FormItemName[];
|
|
125
|
+
description?: string | React.ReactNode;
|
|
126
|
+
dateLimitationType?: 'relative' | 'absolute';
|
|
127
|
+
absoluteRangeStart?: number;
|
|
128
|
+
absoluteRangeEnd?: number;
|
|
129
|
+
relativeRangeStart?: {
|
|
130
|
+
type: 'day' | 'month' | 'year';
|
|
131
|
+
quantity: number;
|
|
132
|
+
pattern?: string;
|
|
133
|
+
dependField?: NamePath;
|
|
134
|
+
};
|
|
135
|
+
relativeRangeEnd?: {
|
|
136
|
+
type: 'day' | 'month' | 'year';
|
|
137
|
+
quantity: number;
|
|
138
|
+
pattern?: string;
|
|
139
|
+
dependField?: NamePath;
|
|
140
|
+
};
|
|
141
|
+
validationCode?: {
|
|
142
|
+
code: string;
|
|
143
|
+
errorMessage: string;
|
|
144
|
+
warningOnly?: boolean;
|
|
145
|
+
}[];
|
|
146
|
+
length?: number;
|
|
147
|
+
minLength?: number;
|
|
148
|
+
maxLength?: number;
|
|
149
|
+
idType?: 'KTP' | 'NIK';
|
|
150
|
+
validationRule?: string;
|
|
151
|
+
shouldRenderCode?: string;
|
|
152
|
+
disabledCode?: string;
|
|
153
|
+
automaticCalcCode?: string;
|
|
154
|
+
enableAutomaticCalc?: boolean;
|
|
155
|
+
[key: string]: any;
|
|
156
|
+
}
|
|
157
|
+
export interface FormItemConfig extends FormItemExtraConfig {
|
|
158
|
+
type?: string;
|
|
159
|
+
name?: NamePath;
|
|
160
|
+
label?: string | React.ReactNode;
|
|
161
|
+
previewLabel?: string | React.ReactNode;
|
|
162
|
+
labelProps?: any;
|
|
163
|
+
contentProps?: any;
|
|
164
|
+
ocr?: {
|
|
165
|
+
vender: string;
|
|
166
|
+
outputMap: {
|
|
167
|
+
field: string[];
|
|
168
|
+
source: string[];
|
|
169
|
+
}[];
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
export type FormItemPropsHandler = (config: FormItemConfig) => FormItemConfig;
|
|
173
|
+
export interface FC<P = {}> extends React.FunctionComponent<P> {
|
|
174
|
+
formItemPropsHandler?: FormItemPropsHandler;
|
|
175
|
+
isPreviewSupport?: boolean;
|
|
176
|
+
}
|
|
177
|
+
export interface Form extends React.ForwardRefExoticComponent<FormBasicConfig & React.RefAttributes<any>> {
|
|
178
|
+
useForm: () => FormInstance;
|
|
179
|
+
}
|
|
180
|
+
export interface IglooComponentProps {
|
|
181
|
+
validateField?: (nameList?: NamePath[]) => Promise<any>;
|
|
182
|
+
containerRef?: React.RefObject<any>;
|
|
183
|
+
setFieldError?(errorMsg?: string): void;
|
|
184
|
+
setFieldValue?(value?: any): void;
|
|
185
|
+
setShowStepButton?: (showButton: boolean) => void;
|
|
186
|
+
getFormInstance?: () => FormInstance;
|
|
187
|
+
locales?: {
|
|
188
|
+
[key: string]: string;
|
|
189
|
+
};
|
|
190
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormInstance } from 'antd/es/form';
|
|
3
|
+
import { FormItemConfig, FormItemExtraConfig, FormItemName, FormItemCopyValue, FormItemSelectValue, FormItemAssert, Rule } from '../types';
|
|
4
|
+
import { NamePath } from 'antd/es/form/interface';
|
|
5
|
+
export declare const calcNamePath: (parentName: FormItemName | undefined, name: FormItemName | undefined) => any[];
|
|
6
|
+
export declare const testAssert: (form: FormInstance, assert: FormItemAssert) => boolean;
|
|
7
|
+
export declare const calcFormItemProps: (config: FormItemConfig, extraProps: FormItemExtraConfig, form?: FormInstance, parentName?: FormItemName, validationCodeExtraParams?: Record<string, any>) => {
|
|
8
|
+
colProps: {
|
|
9
|
+
span: number;
|
|
10
|
+
xs: number;
|
|
11
|
+
sm: number;
|
|
12
|
+
md: number;
|
|
13
|
+
halfRow: boolean | undefined;
|
|
14
|
+
};
|
|
15
|
+
formItemProps: {
|
|
16
|
+
name: any[];
|
|
17
|
+
className: string | undefined;
|
|
18
|
+
initialValue: any;
|
|
19
|
+
copiedValue: {
|
|
20
|
+
copied: boolean;
|
|
21
|
+
value?: undefined;
|
|
22
|
+
disabled?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
copied: boolean;
|
|
25
|
+
value: any;
|
|
26
|
+
disabled: boolean | undefined;
|
|
27
|
+
};
|
|
28
|
+
selectedValue: {
|
|
29
|
+
selected: boolean;
|
|
30
|
+
value?: undefined;
|
|
31
|
+
disabled?: undefined;
|
|
32
|
+
} | {
|
|
33
|
+
selected: boolean;
|
|
34
|
+
value: any;
|
|
35
|
+
disabled: boolean | undefined;
|
|
36
|
+
};
|
|
37
|
+
normalize: ((value: any, prevValue: any, allValues: import("rc-field-form/lib/interface").Store) => any) | undefined;
|
|
38
|
+
rules: Rule[];
|
|
39
|
+
validateTrigger: any[];
|
|
40
|
+
label: import("react/jsx-runtime").JSX.Element | null;
|
|
41
|
+
getValueFromEvent: ((...args: import("rc-field-form/lib/interface").EventArgs) => any) | undefined;
|
|
42
|
+
getValueProps: ((value: any) => Record<string, unknown>) | undefined;
|
|
43
|
+
extra: false | "" | 0 | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
44
|
+
help: React.ReactNode;
|
|
45
|
+
valuePropName: string | undefined;
|
|
46
|
+
messageVariables: {
|
|
47
|
+
label: string;
|
|
48
|
+
};
|
|
49
|
+
dependencies: any[] | undefined;
|
|
50
|
+
};
|
|
51
|
+
elementProps: {
|
|
52
|
+
[key: string]: any;
|
|
53
|
+
};
|
|
54
|
+
display: any;
|
|
55
|
+
previewFormater: ((value: any, form?: FormInstance<any> | undefined) => any) | undefined;
|
|
56
|
+
};
|
|
57
|
+
export declare const calcDisabled: (disabled?: boolean | FormItemAssert | FormItemAssert[], form?: FormInstance, disabledCode?: string, name?: FormItemName, parentName?: FormItemName) => any;
|
|
58
|
+
export declare const calcCopyValue: (copyValue?: FormItemCopyValue, form?: FormInstance) => {
|
|
59
|
+
copied: boolean;
|
|
60
|
+
value?: undefined;
|
|
61
|
+
disabled?: undefined;
|
|
62
|
+
} | {
|
|
63
|
+
copied: boolean;
|
|
64
|
+
value: any;
|
|
65
|
+
disabled: boolean | undefined;
|
|
66
|
+
};
|
|
67
|
+
export declare const calcSelectValue: (selectValue?: FormItemSelectValue[], form?: FormInstance) => {
|
|
68
|
+
selected: boolean;
|
|
69
|
+
value?: undefined;
|
|
70
|
+
disabled?: undefined;
|
|
71
|
+
} | {
|
|
72
|
+
selected: boolean;
|
|
73
|
+
value: any;
|
|
74
|
+
disabled: boolean | undefined;
|
|
75
|
+
};
|
|
76
|
+
export declare const calcShouldRender: (name: NamePath, parentName: NamePath, dependencies?: NamePath[], asserts?: FormItemAssert[], shouldRender?: ((form?: FormInstance) => boolean) | undefined, shouldRenderCode?: string, form?: FormInstance) => any;
|
|
77
|
+
export declare const automaticCalculate: (name: NamePath, parentName: NamePath, automaticCalcCode?: string, form?: FormInstance) => void;
|
|
78
|
+
export declare const getRuleValidation: (url: string, rule: string | string[], values?: any, lang?: string) => Promise<any>;
|
|
79
|
+
export declare const calcAddableSectionAssertField: (name: any[], field: FormItemAssert['field'], index: number, elements: FormItemConfig[] | React.ReactElement[]) => any;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FormItemConfig, FormItemName } from '../../types';
|
|
3
|
+
import './style';
|
|
4
|
+
interface ElementProps {
|
|
5
|
+
config: FormItemConfig;
|
|
6
|
+
parentName?: FormItemName;
|
|
7
|
+
preview?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
setShowStepButton?: (showButton: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const Element: FC<ElementProps>;
|
|
12
|
+
export default Element;
|
|
@@ -270,7 +270,7 @@ var Element = function Element(_ref) {
|
|
|
270
270
|
'igloo-element-preview-hide': config.hideWhenPreview,
|
|
271
271
|
'igloo-element-preview-hide-divider': config.hidePreviewDivider
|
|
272
272
|
}),
|
|
273
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
273
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Form.Item, _objectSpread(_objectSpread({}, (0, _omit.default)(formItemProps, ['copiedValue', 'selectedValue'])), {}, {
|
|
274
274
|
labelCol: {
|
|
275
275
|
span: 24
|
|
276
276
|
},
|
|
@@ -278,7 +278,7 @@ var Element = function Element(_ref) {
|
|
|
278
278
|
span: 24
|
|
279
279
|
},
|
|
280
280
|
label: null,
|
|
281
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Row, {
|
|
281
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Row, {
|
|
282
282
|
className: "igloo-element-preview-item",
|
|
283
283
|
gutter: {
|
|
284
284
|
md: 32,
|
|
@@ -317,7 +317,10 @@ var Element = function Element(_ref) {
|
|
|
317
317
|
children: renderPreviewValue()
|
|
318
318
|
})]
|
|
319
319
|
})]
|
|
320
|
-
})
|
|
320
|
+
}), config.showExtraWhenPreview && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
321
|
+
className: "igloo-element-preview-extra",
|
|
322
|
+
children: formItemProps.extra
|
|
323
|
+
})]
|
|
321
324
|
}))
|
|
322
325
|
});
|
|
323
326
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FormItemConfig, FormItemName } from '../../types';
|
|
3
|
+
import './style';
|
|
4
|
+
interface ElementProps extends FormItemConfig {
|
|
5
|
+
parentName?: FormItemName;
|
|
6
|
+
preview?: boolean;
|
|
7
|
+
setShowStepButton?: (showButton: boolean) => void;
|
|
8
|
+
disabledFromParent?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const Element: FC<ElementProps>;
|
|
11
|
+
export default Element;
|
|
@@ -205,7 +205,7 @@ var Element = function Element(props) {
|
|
|
205
205
|
'igloo-freeform-element-preview-hide': props.hideWhenPreview,
|
|
206
206
|
'igloo-freeform-element-preview-hide-divider': props.hidePreviewDivider
|
|
207
207
|
}),
|
|
208
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
208
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Form.Item, _objectSpread(_objectSpread({}, (0, _omit.default)(formItemProps, ['copiedValue', 'selectedValue'])), {}, {
|
|
209
209
|
labelCol: {
|
|
210
210
|
span: 24
|
|
211
211
|
},
|
|
@@ -213,7 +213,7 @@ var Element = function Element(props) {
|
|
|
213
213
|
span: 24
|
|
214
214
|
},
|
|
215
215
|
label: null,
|
|
216
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Row, {
|
|
216
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Row, {
|
|
217
217
|
className: "igloo-freeform-element-preview-item",
|
|
218
218
|
gutter: {
|
|
219
219
|
md: 32,
|
|
@@ -252,7 +252,10 @@ var Element = function Element(props) {
|
|
|
252
252
|
children: previewFormater ? previewFormater(value, form) : _typeof(value) === 'object' ? JSON.stringify(value) : value
|
|
253
253
|
})]
|
|
254
254
|
})]
|
|
255
|
-
})
|
|
255
|
+
}), rest.showExtraWhenPreview && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
256
|
+
className: "igloo-freeform-element-preview-extra",
|
|
257
|
+
children: formItemProps.extra
|
|
258
|
+
})]
|
|
256
259
|
}))
|
|
257
260
|
});
|
|
258
261
|
}
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
.igloo-freeform-element-preview-item {
|
|
13
13
|
.igloo-freeform-element-preview-label {
|
|
14
|
-
color:
|
|
14
|
+
color: @icon-color;
|
|
15
15
|
line-height: 24px;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
.igloo-freeform-element-preview-value {
|
|
19
|
-
color:
|
|
19
|
+
color: @text-color;
|
|
20
20
|
white-space: pre-wrap;
|
|
21
21
|
word-break: break-word;
|
|
22
22
|
line-height: 24px;
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
.igloo-freeform-element-preview-extra {
|
|
36
|
+
margin-top: 6px;
|
|
37
|
+
}
|
|
38
|
+
|
|
35
39
|
.ant-form-item-explain-error {
|
|
36
40
|
margin-top: 0;
|
|
37
41
|
margin-left: calc(~'50%' + 16px);
|
|
@@ -95,7 +99,7 @@
|
|
|
95
99
|
width: 100%;
|
|
96
100
|
|
|
97
101
|
.igloo-freeform-label-text {
|
|
98
|
-
color:
|
|
102
|
+
color: @icon-color;
|
|
99
103
|
font-size: 16px;
|
|
100
104
|
line-height: 24px;
|
|
101
105
|
|