iglooform 3.1.0 → 3.1.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 (42) hide show
  1. package/.dumi/tmp/dumi/theme/ContextWrapper.tsx +1 -1
  2. package/es/admin-amount/style/index.d.ts +0 -0
  3. package/es/babel-plugin-import-option.d.ts +7 -0
  4. package/es/back-top/index.d.ts +5 -0
  5. package/{lib/confirmation/style → es/input/style/amount}/index.d.ts +1 -0
  6. package/es/input/style/index.d.ts +2 -0
  7. package/{lib/ocr/micro-blink/style → es/input/style/input-date}/index.d.ts +1 -0
  8. package/es/input/style/otp/index.d.ts +2 -0
  9. package/es/input/style/phone-number/index.d.ts +2 -0
  10. package/es/input/style/text-area/index.d.ts +2 -0
  11. package/es/locale/locale-provider.d.ts +11 -0
  12. package/es/login-page/index.d.ts +7 -0
  13. package/es/platform/platform-card/index.d.ts +12 -0
  14. package/es/platform/switch-platform/index.d.ts +12 -0
  15. package/es/tabs/index.d.ts +15 -0
  16. package/es/upload-photo/index.js +2 -4
  17. package/es/utils/tools.d.ts +1 -1
  18. package/es/utils/tools.js +3 -2
  19. package/lib/admin-amount/style/index.d.ts +0 -0
  20. package/lib/babel-plugin-import-option.d.ts +7 -0
  21. package/lib/back-top/index.d.ts +5 -0
  22. package/lib/input/style/amount/index.d.ts +2 -0
  23. package/lib/input/style/index.d.ts +2 -0
  24. package/lib/input/style/input-date/index.d.ts +2 -0
  25. package/lib/input/style/otp/index.d.ts +2 -0
  26. package/lib/input/style/phone-number/index.d.ts +2 -0
  27. package/lib/input/style/text-area/index.d.ts +2 -0
  28. package/lib/locale/locale-provider.d.ts +11 -0
  29. package/lib/login-page/index.d.ts +7 -0
  30. package/lib/platform/platform-card/index.d.ts +12 -0
  31. package/lib/platform/switch-platform/index.d.ts +12 -0
  32. package/lib/tabs/index.d.ts +15 -0
  33. package/lib/upload-photo/index.js +2 -4
  34. package/lib/utils/tools.d.ts +1 -1
  35. package/lib/utils/tools.js +3 -2
  36. package/package.json +1 -1
  37. package/es/form-context.d.ts +0 -28
  38. package/es/types.d.ts +0 -183
  39. package/lib/form-context.d.ts +0 -28
  40. package/lib/types.d.ts +0 -183
  41. /package/es/{confirmation → message}/style/index.d.ts +0 -0
  42. /package/{es/ocr/micro-blink → lib/message}/style/index.d.ts +0 -0
@@ -30,7 +30,7 @@ export default function DumiContextWrapper() {
30
30
 
31
31
  return (
32
32
  <SiteContext.Provider value={{
33
- pkg: {"name":"iglooform","version":"3.0.16","license":"MIT"},
33
+ pkg: {"name":"iglooform","version":"3.1.1","license":"MIT"},
34
34
  historyType: "browser",
35
35
  entryExports,
36
36
  demos,
File without changes
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ libraryName: string;
3
+ libraryDirectory: string;
4
+ style: boolean;
5
+ customName: (name: string) => string;
6
+ };
7
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ import './style';
3
+ import { BackTopProps } from 'antd';
4
+ declare const BackToTop: FC<BackTopProps>;
5
+ export default BackToTop;
@@ -1 +1,2 @@
1
+ import '../index';
1
2
  import './index.less';
@@ -0,0 +1,2 @@
1
+ import './default-input.less';
2
+ import './common.less';
@@ -1 +1,2 @@
1
+ import '../index';
1
2
  import './index.less';
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -0,0 +1,11 @@
1
+ import { FC, ReactNode } from 'react';
2
+ export declare const locales: {
3
+ [key: string]: {
4
+ [id: string]: string;
5
+ };
6
+ };
7
+ declare const LocaleProvider: FC<{
8
+ currentLang: string;
9
+ children?: ReactNode;
10
+ }>;
11
+ export default LocaleProvider;
@@ -0,0 +1,7 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ import './style';
3
+ interface Props {
4
+ showAppStore?: boolean;
5
+ }
6
+ declare const LoginPage: FC<PropsWithChildren<Props>>;
7
+ export default LoginPage;
@@ -0,0 +1,12 @@
1
+ import { FC, CSSProperties } from 'react';
2
+ import './style';
3
+ declare const PlatformCard: FC<{
4
+ platform: string | {
5
+ name: string;
6
+ key: string;
7
+ };
8
+ onClick: any;
9
+ className?: any;
10
+ style?: CSSProperties;
11
+ }>;
12
+ export default PlatformCard;
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ import './style';
3
+ interface Props {
4
+ platforms: (string | {
5
+ name: string;
6
+ key: string;
7
+ })[];
8
+ currentPlatform: string;
9
+ onChange: (platform: string) => any;
10
+ }
11
+ declare const SwitchPlatform: FC<Props>;
12
+ export default SwitchPlatform;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { TabsProps } from 'antd';
3
+ import './style';
4
+ interface IglooTabsProps extends TabsProps {
5
+ }
6
+ export declare const TabPane: React.FC<import("antd").TabPaneProps>;
7
+ /**
8
+ * Tab
9
+ * @param {*} 所有antd的tabs
10
+ */
11
+ declare function Tabs(props: IglooTabsProps): import("react/jsx-runtime").JSX.Element;
12
+ declare namespace Tabs {
13
+ var TabPane: React.FC<import("antd").TabPaneProps>;
14
+ }
15
+ export default Tabs;
@@ -30,7 +30,6 @@ import UploadPreview from "../upload-preview";
30
30
  import { isMobileAgent } from "../utils/agent-detect";
31
31
  import { UploadOutlined, LoadingOutlined, ErrorFilled, ShowOutlined, RefreshOutlined } from 'iglooicon';
32
32
  import Preview from "../upload-preview/media";
33
- import { classifyType } from "../utils/tools";
34
33
  import MediaItem from "./media";
35
34
  import FormContext from "../form-context";
36
35
  import { staticFormatMessage } from "../locale";
@@ -147,7 +146,6 @@ var UploadPhoto = function UploadPhoto(props) {
147
146
  _props$capture = props.capture,
148
147
  capture = _props$capture === void 0 ? false : _props$capture,
149
148
  disabled = props.disabled;
150
- console.log(props, 'props');
151
149
  var _useContext2 = useContext(LocaleContext),
152
150
  formatMessage = _useContext2.formatMessage;
153
151
  var _useState = useState(isMobileAgent()),
@@ -311,7 +309,7 @@ var UploadPhoto = function UploadPhoto(props) {
311
309
  dataUrl = URL.createObjectURL(file);
312
310
  dataUrlRef.current.push(dataUrl);
313
311
  name = file.name, size = file.size, mimeType = file.type;
314
- type = classifyType(mimeType);
312
+ type = ClassifyType(mimeType);
315
313
  if (!(type === 'unknown')) {
316
314
  _context4.next = 10;
317
315
  break;
@@ -510,7 +508,7 @@ var UploadPhoto = function UploadPhoto(props) {
510
508
  Modal.noFooter({
511
509
  content: /*#__PURE__*/_jsx(Preview, {
512
510
  src: dataUrl,
513
- type: classifyType(type)
511
+ type: ClassifyType(type)
514
512
  }),
515
513
  title: name,
516
514
  className: 'igloo-upload-photo-preview-modal',
@@ -2,4 +2,4 @@ export declare const parseFileSize: (size: number) => string;
2
2
  export declare function classifyType(mimeType: string): string;
3
3
  export declare const downloadByUrl: (filename: string, url: string) => void;
4
4
  export declare const getFileNameByUrl: (fileUrl: string) => string;
5
- export declare const getResourceContentType: (resourceUrl: string) => Promise<string | null>;
5
+ export declare const getResourceContentType: (resourceUrl: string) => Promise<string | undefined>;
package/es/utils/tools.js CHANGED
@@ -60,7 +60,7 @@ export var getFileNameByUrl = function getFileNameByUrl(fileUrl) {
60
60
  };
61
61
  export var getResourceContentType = /*#__PURE__*/function () {
62
62
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resourceUrl) {
63
- var r, contentType;
63
+ var _r$headers$get, r, contentType;
64
64
  return _regeneratorRuntime().wrap(function _callee$(_context) {
65
65
  while (1) switch (_context.prev = _context.next) {
66
66
  case 0:
@@ -71,7 +71,8 @@ export var getResourceContentType = /*#__PURE__*/function () {
71
71
  });
72
72
  case 3:
73
73
  r = _context.sent;
74
- contentType = r.headers.get('Content-Type');
74
+ // 'image/svg+xml; charset=utf-8' --> 'image/svg+xml'
75
+ contentType = (_r$headers$get = r.headers.get('Content-Type')) === null || _r$headers$get === void 0 ? void 0 : _r$headers$get.split(';')[0];
75
76
  return _context.abrupt("return", contentType);
76
77
  case 8:
77
78
  _context.prev = 8;
File without changes
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ libraryName: string;
3
+ libraryDirectory: string;
4
+ style: boolean;
5
+ customName: (name: string) => string;
6
+ };
7
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ import './style';
3
+ import { BackTopProps } from 'antd';
4
+ declare const BackToTop: FC<BackTopProps>;
5
+ export default BackToTop;
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import './default-input.less';
2
+ import './common.less';
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -0,0 +1,11 @@
1
+ import { FC, ReactNode } from 'react';
2
+ export declare const locales: {
3
+ [key: string]: {
4
+ [id: string]: string;
5
+ };
6
+ };
7
+ declare const LocaleProvider: FC<{
8
+ currentLang: string;
9
+ children?: ReactNode;
10
+ }>;
11
+ export default LocaleProvider;
@@ -0,0 +1,7 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ import './style';
3
+ interface Props {
4
+ showAppStore?: boolean;
5
+ }
6
+ declare const LoginPage: FC<PropsWithChildren<Props>>;
7
+ export default LoginPage;
@@ -0,0 +1,12 @@
1
+ import { FC, CSSProperties } from 'react';
2
+ import './style';
3
+ declare const PlatformCard: FC<{
4
+ platform: string | {
5
+ name: string;
6
+ key: string;
7
+ };
8
+ onClick: any;
9
+ className?: any;
10
+ style?: CSSProperties;
11
+ }>;
12
+ export default PlatformCard;
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ import './style';
3
+ interface Props {
4
+ platforms: (string | {
5
+ name: string;
6
+ key: string;
7
+ })[];
8
+ currentPlatform: string;
9
+ onChange: (platform: string) => any;
10
+ }
11
+ declare const SwitchPlatform: FC<Props>;
12
+ export default SwitchPlatform;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { TabsProps } from 'antd';
3
+ import './style';
4
+ interface IglooTabsProps extends TabsProps {
5
+ }
6
+ export declare const TabPane: React.FC<import("antd").TabPaneProps>;
7
+ /**
8
+ * Tab
9
+ * @param {*} 所有antd的tabs
10
+ */
11
+ declare function Tabs(props: IglooTabsProps): import("react/jsx-runtime").JSX.Element;
12
+ declare namespace Tabs {
13
+ var TabPane: React.FC<import("antd").TabPaneProps>;
14
+ }
15
+ export default Tabs;
@@ -16,7 +16,6 @@ var _uploadPreview = _interopRequireDefault(require("../upload-preview"));
16
16
  var _agentDetect = require("../utils/agent-detect");
17
17
  var _iglooicon = require("iglooicon");
18
18
  var _media = _interopRequireDefault(require("../upload-preview/media"));
19
- var _tools = require("../utils/tools");
20
19
  var _media2 = _interopRequireDefault(require("./media"));
21
20
  var _formContext = _interopRequireDefault(require("../form-context"));
22
21
  var _jsxRuntime = require("react/jsx-runtime");
@@ -151,7 +150,6 @@ var UploadPhoto = function UploadPhoto(props) {
151
150
  _props$capture = props.capture,
152
151
  capture = _props$capture === void 0 ? false : _props$capture,
153
152
  disabled = props.disabled;
154
- console.log(props, 'props');
155
153
  var _useContext2 = (0, _react.useContext)(_locale.LocaleContext),
156
154
  formatMessage = _useContext2.formatMessage;
157
155
  var _useState = (0, _react.useState)((0, _agentDetect.isMobileAgent)()),
@@ -315,7 +313,7 @@ var UploadPhoto = function UploadPhoto(props) {
315
313
  dataUrl = URL.createObjectURL(file);
316
314
  dataUrlRef.current.push(dataUrl);
317
315
  name = file.name, size = file.size, mimeType = file.type;
318
- type = (0, _tools.classifyType)(mimeType);
316
+ type = ClassifyType(mimeType);
319
317
  if (!(type === 'unknown')) {
320
318
  _context4.next = 10;
321
319
  break;
@@ -514,7 +512,7 @@ var UploadPhoto = function UploadPhoto(props) {
514
512
  _modal.default.noFooter({
515
513
  content: /*#__PURE__*/(0, _jsxRuntime.jsx)(_media.default, {
516
514
  src: dataUrl,
517
- type: (0, _tools.classifyType)(type)
515
+ type: ClassifyType(type)
518
516
  }),
519
517
  title: name,
520
518
  className: 'igloo-upload-photo-preview-modal',
@@ -2,4 +2,4 @@ export declare const parseFileSize: (size: number) => string;
2
2
  export declare function classifyType(mimeType: string): string;
3
3
  export declare const downloadByUrl: (filename: string, url: string) => void;
4
4
  export declare const getFileNameByUrl: (fileUrl: string) => string;
5
- export declare const getResourceContentType: (resourceUrl: string) => Promise<string | null>;
5
+ export declare const getResourceContentType: (resourceUrl: string) => Promise<string | undefined>;
@@ -70,7 +70,7 @@ var getFileNameByUrl = function getFileNameByUrl(fileUrl) {
70
70
  exports.getFileNameByUrl = getFileNameByUrl;
71
71
  var getResourceContentType = /*#__PURE__*/function () {
72
72
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resourceUrl) {
73
- var r, contentType;
73
+ var _r$headers$get, r, contentType;
74
74
  return _regeneratorRuntime().wrap(function _callee$(_context) {
75
75
  while (1) switch (_context.prev = _context.next) {
76
76
  case 0:
@@ -81,7 +81,8 @@ var getResourceContentType = /*#__PURE__*/function () {
81
81
  });
82
82
  case 3:
83
83
  r = _context.sent;
84
- contentType = r.headers.get('Content-Type');
84
+ // 'image/svg+xml; charset=utf-8' --> 'image/svg+xml'
85
+ contentType = (_r$headers$get = r.headers.get('Content-Type')) === null || _r$headers$get === void 0 ? void 0 : _r$headers$get.split(';')[0];
85
86
  return _context.abrupt("return", contentType);
86
87
  case 8:
87
88
  _context.prev = 8;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iglooform",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "build-dev": "dumi build",
@@ -1,28 +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
- validationCodeExtraParams?: Record<string, any> | undefined;
27
- }>;
28
- export default _default;
package/es/types.d.ts DELETED
@@ -1,183 +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
- 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
- }[];
142
- length?: number;
143
- minLength?: number;
144
- maxLength?: number;
145
- idType?: 'KTP' | 'NIK';
146
- validationRule?: string;
147
- shouldRenderCode?: string;
148
- [key: string]: any;
149
- }
150
- export interface FormItemConfig extends FormItemExtraConfig {
151
- type?: string;
152
- name?: NamePath;
153
- label?: string | React.ReactNode;
154
- previewLabel?: string | React.ReactNode;
155
- labelProps?: any;
156
- contentProps?: any;
157
- ocr?: {
158
- vender: string;
159
- outputMap: {
160
- field: string[];
161
- source: string[];
162
- }[];
163
- };
164
- }
165
- export type FormItemPropsHandler = (config: FormItemConfig) => FormItemConfig;
166
- export interface FC<P = {}> extends React.FunctionComponent<P> {
167
- formItemPropsHandler?: FormItemPropsHandler;
168
- isPreviewSupport?: boolean;
169
- }
170
- export interface Form extends React.ForwardRefExoticComponent<FormBasicConfig & React.RefAttributes<any>> {
171
- useForm: () => FormInstance;
172
- }
173
- export interface IglooComponentProps {
174
- validateField?: (nameList?: NamePath[]) => Promise<any>;
175
- containerRef?: React.RefObject<any>;
176
- setFieldError?(errorMsg?: string): void;
177
- setFieldValue?(value?: any): void;
178
- setShowStepButton?: (showButton: boolean) => void;
179
- getFormInstance?: () => FormInstance;
180
- locales?: {
181
- [key: string]: string;
182
- };
183
- }
@@ -1,28 +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
- validationCodeExtraParams?: Record<string, any> | undefined;
27
- }>;
28
- export default _default;
package/lib/types.d.ts DELETED
@@ -1,183 +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
- 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
- }[];
142
- length?: number;
143
- minLength?: number;
144
- maxLength?: number;
145
- idType?: 'KTP' | 'NIK';
146
- validationRule?: string;
147
- shouldRenderCode?: string;
148
- [key: string]: any;
149
- }
150
- export interface FormItemConfig extends FormItemExtraConfig {
151
- type?: string;
152
- name?: NamePath;
153
- label?: string | React.ReactNode;
154
- previewLabel?: string | React.ReactNode;
155
- labelProps?: any;
156
- contentProps?: any;
157
- ocr?: {
158
- vender: string;
159
- outputMap: {
160
- field: string[];
161
- source: string[];
162
- }[];
163
- };
164
- }
165
- export type FormItemPropsHandler = (config: FormItemConfig) => FormItemConfig;
166
- export interface FC<P = {}> extends React.FunctionComponent<P> {
167
- formItemPropsHandler?: FormItemPropsHandler;
168
- isPreviewSupport?: boolean;
169
- }
170
- export interface Form extends React.ForwardRefExoticComponent<FormBasicConfig & React.RefAttributes<any>> {
171
- useForm: () => FormInstance;
172
- }
173
- export interface IglooComponentProps {
174
- validateField?: (nameList?: NamePath[]) => Promise<any>;
175
- containerRef?: React.RefObject<any>;
176
- setFieldError?(errorMsg?: string): void;
177
- setFieldValue?(value?: any): void;
178
- setShowStepButton?: (showButton: boolean) => void;
179
- getFormInstance?: () => FormInstance;
180
- locales?: {
181
- [key: string]: string;
182
- };
183
- }
File without changes