iglooform 3.0.8 → 3.0.10

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 (105) hide show
  1. package/.dumi/tmp/core/defineApp.ts +1 -1
  2. package/.dumi/tmp/core/helmet.ts +1 -1
  3. package/.dumi/tmp/core/history.ts +1 -1
  4. package/.dumi/tmp/core/historyIntelli.ts +1 -1
  5. package/.dumi/tmp/core/plugin.ts +2 -2
  6. package/.dumi/tmp/core/polyfill.ts +197 -197
  7. package/.dumi/tmp/core/route.tsx +33 -33
  8. package/.dumi/tmp/dumi/exports.ts +1 -1
  9. package/.dumi/tmp/dumi/locales/runtime.tsx +2 -2
  10. package/.dumi/tmp/dumi/meta/index.ts +33 -33
  11. package/.dumi/tmp/dumi/meta/runtime.ts +1 -1
  12. package/.dumi/tmp/dumi/theme/ContextWrapper.tsx +2 -2
  13. package/.dumi/tmp/dumi/theme/builtins/API.ts +1 -1
  14. package/.dumi/tmp/dumi/theme/builtins/Badge.ts +1 -1
  15. package/.dumi/tmp/dumi/theme/builtins/Container.ts +1 -1
  16. package/.dumi/tmp/dumi/theme/builtins/Previewer.ts +1 -1
  17. package/.dumi/tmp/dumi/theme/builtins/SourceCode.ts +1 -1
  18. package/.dumi/tmp/dumi/theme/builtins/Table.ts +1 -1
  19. package/.dumi/tmp/dumi/theme/builtins/Tree.ts +1 -1
  20. package/.dumi/tmp/dumi/theme/layouts/DocLayout.ts +1 -1
  21. package/.dumi/tmp/dumi/theme/loading.tsx +1 -1
  22. package/.dumi/tmp/dumi/theme/slots/ColorSwitch.ts +1 -1
  23. package/.dumi/tmp/dumi/theme/slots/Content.ts +1 -1
  24. package/.dumi/tmp/dumi/theme/slots/ContentFooter.ts +1 -1
  25. package/.dumi/tmp/dumi/theme/slots/ContentTabs.ts +1 -1
  26. package/.dumi/tmp/dumi/theme/slots/Features.ts +1 -1
  27. package/.dumi/tmp/dumi/theme/slots/Footer.ts +1 -1
  28. package/.dumi/tmp/dumi/theme/slots/Header.ts +1 -1
  29. package/.dumi/tmp/dumi/theme/slots/HeaderExtra.ts +1 -1
  30. package/.dumi/tmp/dumi/theme/slots/Hero.ts +1 -1
  31. package/.dumi/tmp/dumi/theme/slots/HeroTitle.ts +1 -1
  32. package/.dumi/tmp/dumi/theme/slots/LangSwitch.ts +1 -1
  33. package/.dumi/tmp/dumi/theme/slots/Logo.ts +1 -1
  34. package/.dumi/tmp/dumi/theme/slots/Navbar.ts +1 -1
  35. package/.dumi/tmp/dumi/theme/slots/NavbarExtra.ts +1 -1
  36. package/.dumi/tmp/dumi/theme/slots/NotFound.ts +1 -1
  37. package/.dumi/tmp/dumi/theme/slots/PreviewerActions.ts +1 -1
  38. package/.dumi/tmp/dumi/theme/slots/PreviewerActionsExtra.ts +1 -1
  39. package/.dumi/tmp/dumi/theme/slots/RtlSwitch.ts +1 -1
  40. package/.dumi/tmp/dumi/theme/slots/SearchBar.ts +2 -2
  41. package/.dumi/tmp/dumi/theme/slots/SearchResult.ts +1 -1
  42. package/.dumi/tmp/dumi/theme/slots/Sidebar.ts +1 -1
  43. package/.dumi/tmp/dumi/theme/slots/SocialIcon.ts +1 -1
  44. package/.dumi/tmp/dumi/theme/slots/Toc.ts +1 -1
  45. package/.dumi/tmp/exports.ts +5 -5
  46. package/.dumi/tmp/testBrowser.tsx +3 -3
  47. package/.dumi/tmp/umi.ts +4 -4
  48. package/.idea/codeStyles/Project.xml +59 -0
  49. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  50. package/.idea/iglooform.iml +7 -4
  51. package/.idea/prettier.xml +6 -0
  52. package/es/admin-upload/index.d.ts +1 -0
  53. package/es/admin-upload/index.js +5 -4
  54. package/es/form/addable-section/index.js +3 -2
  55. package/es/form/element/index.js +3 -2
  56. package/es/form/index.js +4 -2
  57. package/es/form/section/index.js +3 -2
  58. package/es/free-form/addable-section/index.js +3 -2
  59. package/es/free-form/element/index.js +3 -2
  60. package/es/free-form/index.js +4 -2
  61. package/es/free-form/section/index.js +3 -2
  62. package/es/select/style/index.less +10 -10
  63. package/es/upload/index.js +14 -4
  64. package/es/upload-photo/index.js +14 -4
  65. package/es/utils/form-utils.js +2 -2
  66. package/lib/admin-upload/index.d.ts +1 -0
  67. package/lib/admin-upload/index.js +5 -4
  68. package/lib/form/addable-section/index.js +3 -2
  69. package/lib/form/element/index.js +3 -2
  70. package/lib/form/index.js +4 -2
  71. package/lib/form/section/index.js +3 -2
  72. package/lib/free-form/addable-section/index.js +3 -2
  73. package/lib/free-form/element/index.js +3 -2
  74. package/lib/free-form/index.js +4 -2
  75. package/lib/free-form/section/index.js +3 -2
  76. package/lib/select/style/index.less +10 -10
  77. package/lib/upload/index.js +14 -4
  78. package/lib/upload-photo/index.js +14 -4
  79. package/lib/utils/form-utils.js +2 -2
  80. package/package.json +1 -1
  81. package/.idea/misc.xml +0 -5
  82. package/es/form/addable-section/index.d.ts +0 -20
  83. package/es/form/element/index.d.ts +0 -12
  84. package/es/form/index.d.ts +0 -4
  85. package/es/form/section/index.d.ts +0 -16
  86. package/es/form-context.d.ts +0 -27
  87. package/es/free-form/addable-section/index.d.ts +0 -19
  88. package/es/free-form/element/index.d.ts +0 -11
  89. package/es/free-form/index.d.ts +0 -11
  90. package/es/free-form/section/index.d.ts +0 -13
  91. package/es/modal/index.d.ts +0 -30
  92. package/es/types.d.ts +0 -182
  93. package/es/utils/form-utils.d.ts +0 -77
  94. package/lib/form/addable-section/index.d.ts +0 -20
  95. package/lib/form/element/index.d.ts +0 -12
  96. package/lib/form/index.d.ts +0 -4
  97. package/lib/form/section/index.d.ts +0 -16
  98. package/lib/form-context.d.ts +0 -27
  99. package/lib/free-form/addable-section/index.d.ts +0 -19
  100. package/lib/free-form/element/index.d.ts +0 -11
  101. package/lib/free-form/index.d.ts +0 -11
  102. package/lib/free-form/section/index.d.ts +0 -13
  103. package/lib/modal/index.d.ts +0 -30
  104. package/lib/types.d.ts +0 -182
  105. package/lib/utils/form-utils.d.ts +0 -77
@@ -37,7 +37,8 @@ var Section = function Section(props) {
37
37
  var _useContext = (0, _react.useContext)(_formContext.default),
38
38
  form = _useContext.form,
39
39
  requiredMark = _useContext.requiredMark,
40
- registerDependencies = _useContext.registerDependencies;
40
+ registerDependencies = _useContext.registerDependencies,
41
+ validationCodeExtraParams = _useContext.validationCodeExtraParams;
41
42
  var _useReducer = (0, _react.useReducer)(function (r) {
42
43
  return r + 1;
43
44
  }, 0),
@@ -103,7 +104,7 @@ var Section = function Section(props) {
103
104
  }, []);
104
105
  var _calcFormItemProps = (0, _formUtils.calcFormItemProps)(rest, {
105
106
  requiredMark: requiredMark
106
- }, form, parentName),
107
+ }, form, parentName, validationCodeExtraParams),
107
108
  formItemProps = _calcFormItemProps.formItemProps,
108
109
  elementProps = _calcFormItemProps.elementProps,
109
110
  display = _calcFormItemProps.display;
@@ -45,7 +45,7 @@
45
45
  padding: 12px 16px;
46
46
 
47
47
  &:not(.ant-select-item-option-disabled) {
48
- color: @text-color;
48
+ color: @text-color;
49
49
  }
50
50
 
51
51
  .ant-select-item-option-content {
@@ -79,7 +79,7 @@
79
79
  .igloo-attached-select {
80
80
  .ant-select-selector {
81
81
  padding: 0 40px 0 16px !important;
82
- border-color: @select-border-color;
82
+ border-color: @select-border-color;
83
83
  height: 100%;
84
84
  border-radius: @select-border-radius;
85
85
 
@@ -122,7 +122,7 @@
122
122
  position: absolute;
123
123
  top: 12px;
124
124
  right: 16px;
125
- color: @icon-color;
125
+ color: @icon-color;
126
126
  font-size: 24px;
127
127
  }
128
128
 
@@ -182,7 +182,7 @@
182
182
 
183
183
  .igloo-icon {
184
184
  font-size: 24px;
185
- color: @icon-color;
185
+ color: @icon-color;
186
186
  cursor: pointer;
187
187
 
188
188
  &:hover {
@@ -217,9 +217,9 @@
217
217
  border-radius: 0px 0px @select-border-radius @select-border-radius;
218
218
 
219
219
  .ant-select-item {
220
- padding: 8px 16px;
220
+ padding: 12px 16px;
221
221
  &:not(.ant-select-item-option-disabled) {
222
- color: @text-color;
222
+ color: @text-color;
223
223
  }
224
224
  }
225
225
  }
@@ -230,7 +230,7 @@
230
230
 
231
231
  .ant-select-selector {
232
232
  padding: 0 40px 0 16px;
233
- border-color: @select-border-color;
233
+ border-color: @select-border-color;
234
234
  height: 100%;
235
235
  border-radius: @select-border-radius;
236
236
 
@@ -275,7 +275,7 @@
275
275
  .ant-form-item-has-error {
276
276
  .igloo-hour-select {
277
277
  .igloo-icon {
278
- color: @icon-color;
278
+ color: @icon-color;
279
279
  }
280
280
  }
281
281
 
@@ -298,7 +298,7 @@
298
298
 
299
299
  .igloo-select-arrow {
300
300
  font-size: @select-icon-size;
301
- color: @icon-color;
301
+ color: @icon-color;
302
302
  transition: all 0.3s ease;
303
303
  position: absolute;
304
304
  top: 0;
@@ -349,7 +349,7 @@
349
349
  }
350
350
 
351
351
  .ant-select-single.ant-select-open .ant-select-selection-item {
352
- color: @text-color;
352
+ color: @text-color;
353
353
  }
354
354
 
355
355
  .ant-select-show-search.ant-select-single.ant-select-open
@@ -66,7 +66,7 @@ var IglooUpload = function IglooUpload(props) {
66
66
  _props$handleUpload = props.handleUpload,
67
67
  handleUpload = _props$handleUpload === void 0 ? /*#__PURE__*/function () {
68
68
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
69
- var formData, response, rst;
69
+ var formData, response, error, rst;
70
70
  return _regeneratorRuntime().wrap(function _callee$(_context) {
71
71
  while (1) switch (_context.prev = _context.next) {
72
72
  case 0:
@@ -80,12 +80,22 @@ var IglooUpload = function IglooUpload(props) {
80
80
  });
81
81
  case 5:
82
82
  response = _context.sent;
83
- _context.next = 8;
83
+ if (response.ok) {
84
+ _context.next = 11;
85
+ break;
86
+ }
87
+ _context.next = 9;
88
+ return response.json();
89
+ case 9:
90
+ error = _context.sent;
91
+ throw new Error(error.message || 'upload failed');
92
+ case 11:
93
+ _context.next = 13;
84
94
  return response.json();
85
- case 8:
95
+ case 13:
86
96
  rst = _context.sent;
87
97
  return _context.abrupt("return", rst.url);
88
- case 10:
98
+ case 15:
89
99
  case "end":
90
100
  return _context.stop();
91
101
  }
@@ -105,7 +105,7 @@ var UploadPhoto = function UploadPhoto(props) {
105
105
  _props$handleUpload = props.handleUpload,
106
106
  handleUpload = _props$handleUpload === void 0 ? /*#__PURE__*/function () {
107
107
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(file) {
108
- var formData, response, rst;
108
+ var formData, response, error, rst;
109
109
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
110
110
  while (1) switch (_context2.prev = _context2.next) {
111
111
  case 0:
@@ -119,12 +119,22 @@ var UploadPhoto = function UploadPhoto(props) {
119
119
  });
120
120
  case 5:
121
121
  response = _context2.sent;
122
- _context2.next = 8;
122
+ if (response.ok) {
123
+ _context2.next = 11;
124
+ break;
125
+ }
126
+ _context2.next = 9;
127
+ return response.json();
128
+ case 9:
129
+ error = _context2.sent;
130
+ throw new Error(error.message || 'upload failed');
131
+ case 11:
132
+ _context2.next = 13;
123
133
  return response.json();
124
- case 8:
134
+ case 13:
125
135
  rst = _context2.sent;
126
136
  return _context2.abrupt("return", rst.url);
127
- case 10:
137
+ case 15:
128
138
  case "end":
129
139
  return _context2.stop();
130
140
  }
@@ -132,7 +132,7 @@ var calcRequired = function calcRequired(required, form, requiredAsserts) {
132
132
  }
133
133
  return required;
134
134
  };
135
- var calcFormItemProps = function calcFormItemProps(config, extraProps, form, parentName) {
135
+ var calcFormItemProps = function calcFormItemProps(config, extraProps, form, parentName, validationCodeExtraParams) {
136
136
  var type = config.type,
137
137
  nameProp = config.name,
138
138
  _config$required = config.required,
@@ -311,7 +311,7 @@ var calcFormItemProps = function calcFormItemProps(config, extraProps, form, par
311
311
  var formValues = form === null || form === void 0 ? void 0 : form.getFieldsValue(true);
312
312
  var _result2 = fn(value, formValues, {
313
313
  moment: _dayjs.default
314
- });
314
+ }, validationCodeExtraParams);
315
315
  return _result2 ? Promise.resolve() : Promise.reject(errorMessage);
316
316
  } catch (_unused) {
317
317
  return Promise.reject(errorMessage);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iglooform",
3
- "version": "3.0.8",
3
+ "version": "3.0.10",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "build-dev": "dumi build",
package/.idea/misc.xml DELETED
@@ -1,5 +0,0 @@
1
- <project version="4">
2
- <component name="ProjectRootManager">
3
- <output url="file://$PROJECT_DIR$/out" />
4
- </component>
5
- </project>
@@ -1,20 +0,0 @@
1
- import { FC, ReactNode } from 'react';
2
- import { FormItemProps } from 'antd/es/form';
3
- import { FormItemConfig, FormItemName } from '../../types';
4
- import './style';
5
- export interface AddableSectionProps {
6
- parentName?: FormItemName;
7
- formItemProps?: FormItemProps;
8
- config: FormItemConfig;
9
- preview?: boolean;
10
- disabled?: boolean;
11
- setShowStepButton?: (showButton: boolean) => void;
12
- max?: number;
13
- min?: number;
14
- initCount?: number;
15
- addButtonText?: string;
16
- addButtonIcon?: ReactNode;
17
- description?: string | ReactNode;
18
- }
19
- declare const AddableSection: FC<AddableSectionProps>;
20
- export default AddableSection;
@@ -1,12 +0,0 @@
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;
@@ -1,4 +0,0 @@
1
- import { Form as FormType } from '../types';
2
- import './style';
3
- declare const ExportedForm: FormType;
4
- export default ExportedForm;
@@ -1,16 +0,0 @@
1
- import { FC } from 'react';
2
- import { FormItemProps } from 'antd/es/form';
3
- import { FormItemConfig, FormItemName } from '../../types';
4
- import './style';
5
- export interface SectionProps {
6
- parentName?: FormItemName;
7
- formItemProps?: FormItemProps;
8
- config: FormItemConfig;
9
- preview?: boolean;
10
- disabled?: boolean;
11
- collapsable?: boolean;
12
- defaultCollapsed?: boolean;
13
- setShowStepButton?: (showButton: boolean) => void;
14
- }
15
- declare const Section: FC<SectionProps>;
16
- export default Section;
@@ -1,27 +0,0 @@
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
- }>;
27
- export default _default;
@@ -1,19 +0,0 @@
1
- import { FC, ReactNode } from 'react';
2
- import { FormItemProps } from 'antd/es/form';
3
- import { FormItemConfig, FormItemName } from '../../types';
4
- import './style';
5
- export interface AddableSectionProps extends FormItemConfig {
6
- parentName?: FormItemName;
7
- formItemProps?: FormItemProps;
8
- preview?: boolean;
9
- disabledFromParent?: boolean;
10
- setShowStepButton?: (showButton: boolean) => void;
11
- max?: number;
12
- min?: number;
13
- initCount?: number;
14
- addButtonText?: string;
15
- addButtonIcon?: ReactNode;
16
- description?: string | ReactNode;
17
- }
18
- declare const AddableSection: FC<AddableSectionProps>;
19
- export default AddableSection;
@@ -1,11 +0,0 @@
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;
@@ -1,11 +0,0 @@
1
- import { FC, PropsWithChildren } from 'react';
2
- import { Form } from 'antd';
3
- import { FormBasicConfig } from '../types';
4
- import './style';
5
- interface FreeFormProps extends Omit<FormBasicConfig, 'config'> {
6
- }
7
- interface FreeFormType extends FC<PropsWithChildren<FreeFormProps>> {
8
- useForm: typeof Form.useForm;
9
- }
10
- declare const FreeForm: FreeFormType;
11
- export default FreeForm;
@@ -1,13 +0,0 @@
1
- import { FC } from 'react';
2
- import { FormItemProps } from 'antd/es/form';
3
- import { FormItemConfig, FormItemName } from '../../types';
4
- import './style';
5
- export interface SectionProps extends FormItemConfig {
6
- parentName?: FormItemName;
7
- formItemProps?: FormItemProps;
8
- preview?: boolean;
9
- disabledFromParent?: boolean;
10
- setShowStepButton?: (showButton: boolean) => void;
11
- }
12
- declare const Section: FC<SectionProps>;
13
- export default Section;
@@ -1,30 +0,0 @@
1
- import { FC } from 'react';
2
- import { ModalFuncProps, ModalProps } from 'antd/lib/modal';
3
- import { FormBasicConfig, FormItemConfig } from '../types';
4
- import './style';
5
- interface FormModalProps {
6
- mode?: 'form' | 'normal';
7
- formConfig?: FormItemConfig;
8
- formProps?: {
9
- locales?: FormBasicConfig['locales'];
10
- initialValues?: FormBasicConfig['initialValues'];
11
- };
12
- onOk?: (values: any, fullValue: any) => any;
13
- limitHeight?: boolean;
14
- }
15
- interface ModalFuncReturn {
16
- destroy: Function;
17
- update: (props: ModalProps & ModalFuncProps & FormModalProps) => any;
18
- }
19
- type ModalFunction = (props: ModalProps & ModalFuncProps & FormModalProps) => ModalFuncReturn;
20
- interface ModalType extends FC<ModalProps & ModalFuncProps & FormModalProps> {
21
- confirm: ModalFunction;
22
- info: ModalFunction;
23
- warning: ModalFunction;
24
- error: ModalFunction;
25
- success: ModalFunction;
26
- noFooter: ModalFunction;
27
- destroyAll: Function;
28
- }
29
- declare const IglooModal: ModalType;
30
- export default IglooModal;
package/es/types.d.ts DELETED
@@ -1,182 +0,0 @@
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
- }
55
- export type FormItemAssert = {
56
- field: NamePath;
57
- value?: any;
58
- operation?: 'eq' | 'ne' | 'in' | 'ni' | 'lt' | 'le' | 'gt' | 'ge' | 'co' | 'nc' | 'filled' | 'unfilled' | 'co-some' | 'co-every' | 'some-in' | 'every-in';
59
- };
60
- export type FormItemCopyValue = {
61
- assert: FormItemAssert;
62
- copyFrom: NamePath;
63
- disabled?: boolean;
64
- };
65
- export type FormItemSelectValue = {
66
- assert: FormItemAssert;
67
- value: any;
68
- disabled?: boolean;
69
- };
70
- export interface FormItemExtraConfig extends FormItemProps {
71
- elements?: FormItemConfig[];
72
- required?: boolean;
73
- requiredAsserts?: FormItemAssert[];
74
- extraLabel?: any;
75
- xl?: number;
76
- md?: number;
77
- xs?: number;
78
- span?: number;
79
- areaCode?: number | string | (number | string)[];
80
- phoneNumber?: number | string;
81
- mergeRules?: boolean;
82
- dependencies?: NamePath[];
83
- antdDependencies?: NamePath[];
84
- asserts?: FormItemAssert[];
85
- shouldRender?: (form?: FormInstance) => boolean;
86
- ignore?: boolean;
87
- copyValue?: FormItemCopyValue;
88
- selectValue?: FormItemSelectValue[];
89
- disabled?: boolean | FormItemAssert | FormItemAssert[];
90
- halfRow?: boolean;
91
- fullRow?: boolean;
92
- limit?: number;
93
- hideWhenPreview?: boolean;
94
- hideWhenEdit?: boolean;
95
- requiredMessage?: string | ReactNode;
96
- showOptional?: boolean;
97
- previewFormater?(value: any, form?: FormInstance): any;
98
- handleNext?(values: any): any;
99
- render?(preview: boolean, form?: FormInstance, value?: any, onChange?: (params: any) => any, setShowStepButton?: IglooComponentProps['setShowStepButton']): any;
100
- locales?: {
101
- [key: string]: string;
102
- };
103
- options?: (CheckboxOptionType & {
104
- extraInfo?: {
105
- content: any;
106
- shownTrigger: 'unchecked' | 'checked' | 'all';
107
- };
108
- })[] | SelectProps['options'];
109
- sendOtp?: (value: any) => any;
110
- dependField?: FormItemName;
111
- countDownSeconds?: number;
112
- getButtonDisabledState?: (form: FormInstance) => boolean;
113
- getPreviousDisabledState?: (form: FormInstance) => boolean;
114
- handleUpload?(file: File): PromiseLike<string>;
115
- withoutForm?: boolean;
116
- disableEditButton?: boolean;
117
- hidePreviewDivider?: boolean;
118
- valueFormater?: (value: any) => any;
119
- currentStep?: number;
120
- subscribedFields?: FormItemName[];
121
- description?: string | React.ReactNode;
122
- dateLimitationType?: 'relative' | 'absolute';
123
- absoluteRangeStart?: number;
124
- absoluteRangeEnd?: number;
125
- relativeRangeStart?: {
126
- type: 'day' | 'month' | 'year';
127
- quantity: number;
128
- pattern?: string;
129
- dependField?: NamePath;
130
- };
131
- relativeRangeEnd?: {
132
- type: 'day' | 'month' | 'year';
133
- quantity: number;
134
- pattern?: string;
135
- dependField?: NamePath;
136
- };
137
- validationCode?: {
138
- code: string;
139
- errorMessage: string;
140
- }[];
141
- length?: number;
142
- minLength?: number;
143
- maxLength?: number;
144
- idType?: 'KTP' | 'NIK';
145
- validationRule?: string;
146
- shouldRenderCode?: string;
147
- [key: string]: any;
148
- }
149
- export interface FormItemConfig extends FormItemExtraConfig {
150
- type?: string;
151
- name?: NamePath;
152
- label?: string | React.ReactNode;
153
- previewLabel?: string | React.ReactNode;
154
- labelProps?: any;
155
- contentProps?: any;
156
- ocr?: {
157
- vender: string;
158
- outputMap: {
159
- field: string[];
160
- source: string[];
161
- }[];
162
- };
163
- }
164
- export type FormItemPropsHandler = (config: FormItemConfig) => FormItemConfig;
165
- export interface FC<P = {}> extends React.FunctionComponent<P> {
166
- formItemPropsHandler?: FormItemPropsHandler;
167
- isPreviewSupport?: boolean;
168
- }
169
- export interface Form extends React.ForwardRefExoticComponent<FormBasicConfig & React.RefAttributes<any>> {
170
- useForm: () => FormInstance;
171
- }
172
- export interface IglooComponentProps {
173
- validateField?: (nameList?: NamePath[]) => Promise<any>;
174
- containerRef?: React.RefObject<any>;
175
- setFieldError?(errorMsg?: string): void;
176
- setFieldValue?(value?: any): void;
177
- setShowStepButton?: (showButton: boolean) => void;
178
- getFormInstance?: () => FormInstance;
179
- locales?: {
180
- [key: string]: string;
181
- };
182
- }
@@ -1,77 +0,0 @@
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) => {
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) => boolean;
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, dependencies?: NamePath[], asserts?: FormItemAssert[], shouldRender?: ((form?: FormInstance) => boolean) | undefined, shouldRenderCode?: string, form?: FormInstance) => any;
77
- export declare const getRuleValidation: (url: string, rule: string | string[], values?: any, lang?: string) => Promise<any>;
@@ -1,20 +0,0 @@
1
- import { FC, ReactNode } from 'react';
2
- import { FormItemProps } from 'antd/es/form';
3
- import { FormItemConfig, FormItemName } from '../../types';
4
- import './style';
5
- export interface AddableSectionProps {
6
- parentName?: FormItemName;
7
- formItemProps?: FormItemProps;
8
- config: FormItemConfig;
9
- preview?: boolean;
10
- disabled?: boolean;
11
- setShowStepButton?: (showButton: boolean) => void;
12
- max?: number;
13
- min?: number;
14
- initCount?: number;
15
- addButtonText?: string;
16
- addButtonIcon?: ReactNode;
17
- description?: string | ReactNode;
18
- }
19
- declare const AddableSection: FC<AddableSectionProps>;
20
- export default AddableSection;
@@ -1,12 +0,0 @@
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;