iglooform 3.3.1 → 3.3.3
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/admin-upload/index.d.ts +37 -0
- package/es/app/context.d.ts +9 -0
- package/es/app/index.d.ts +8 -0
- package/es/card-detail/card-page.d.ts +12 -0
- package/es/card-detail/card.d.ts +10 -0
- package/es/confirmation/index.d.ts +16 -0
- package/es/date-picker/buddhist.d.ts +6 -0
- package/es/date-picker/index.d.ts +13 -0
- package/es/documents/index.d.ts +15 -0
- package/es/filter/index.d.ts +52 -0
- package/es/form/addable-section/index.d.ts +20 -0
- package/es/form/element/index.d.ts +12 -0
- package/es/form/elements.d.ts +8 -0
- package/es/form/hsteps/index.d.ts +21 -0
- package/es/form/index.d.ts +4 -0
- package/es/form/section/index.d.ts +16 -0
- package/es/form/step-items-selection/components/checkbox-group-items/index.d.ts +12 -0
- package/es/form/step-items-selection/components/checkbox-group-items/style/index.d.ts +1 -0
- package/es/form/step-items-selection/components/index.d.ts +2 -0
- package/es/form/step-items-selection/components/item-info/index.d.ts +11 -0
- package/es/form/step-items-selection/components/item-info/style/index.d.ts +1 -0
- package/es/form/step-items-selection/components/item-info/style/index.less +3 -0
- package/es/form/step-items-selection/components/section-of-item-condition/hooks/index.d.ts +1 -0
- package/es/form/step-items-selection/components/section-of-item-condition/index.d.ts +17 -0
- package/es/form/step-items-selection/components/section-of-item-condition/style/index.d.ts +1 -0
- package/es/form/step-items-selection/config.d.ts +5 -0
- package/es/form/step-items-selection/index.d.ts +6 -0
- package/es/form/step-items-selection/types.d.ts +27 -0
- package/es/form/steps/index.d.ts +10 -0
- package/es/form-context.d.ts +28 -0
- package/es/free-form/addable-section/index.d.ts +19 -0
- package/es/free-form/element/index.d.ts +11 -0
- package/es/free-form/index.d.ts +11 -0
- package/es/free-form/section/index.d.ts +13 -0
- package/es/free-form/step/index.d.ts +21 -0
- package/es/free-form/steps/index.d.ts +12 -0
- package/es/hooks/ocr/index.d.ts +3 -0
- package/es/hooks/ocr/micro-blink.d.ts +10 -0
- package/es/index.d.ts +49 -0
- package/es/input/amount.d.ts +14 -0
- package/es/input/expiry-date.d.ts +16 -0
- package/es/input/input-date.d.ts +8 -0
- package/es/input/input-number/basic.d.ts +6 -0
- package/es/input/input-number/index.d.ts +8 -0
- package/es/input/input-number/stepper/index.d.ts +7 -0
- package/es/input/phone-number.d.ts +14 -0
- package/es/layout/defaultFooter.d.ts +4 -0
- package/es/media/index.d.ts +29 -0
- package/es/media/preview.d.ts +12 -0
- package/es/message/index.d.ts +14 -0
- package/es/message/useMessage.d.ts +6 -0
- package/es/modal/index.d.ts +33 -0
- package/es/modal/useModal.d.ts +12 -0
- package/es/ocr/index.d.ts +15 -0
- package/es/ocr/micro-blink/index.d.ts +8 -0
- package/es/radio/index.d.ts +24 -0
- package/es/radio/radio-group-with-other.d.ts +7 -0
- package/es/types.d.ts +188 -0
- package/es/upload/index.d.ts +16 -0
- package/es/upload-photo/index.d.ts +28 -0
- package/es/upload-preview/index.d.ts +9 -0
- package/es/upload-preview/media.d.ts +7 -0
- package/es/utils/form-utils.d.ts +79 -0
- package/es/utils/option-utils.d.ts +29 -0
- package/lib/admin-upload/index.d.ts +37 -0
- package/lib/app/context.d.ts +9 -0
- package/lib/app/index.d.ts +8 -0
- package/lib/card-detail/card-page.d.ts +12 -0
- package/lib/card-detail/card.d.ts +10 -0
- package/lib/confirmation/index.d.ts +16 -0
- package/lib/date-picker/buddhist.d.ts +6 -0
- package/lib/date-picker/index.d.ts +13 -0
- package/lib/documents/index.d.ts +15 -0
- package/lib/filter/index.d.ts +52 -0
- package/lib/form/addable-section/index.d.ts +20 -0
- package/lib/form/element/index.d.ts +12 -0
- package/lib/form/elements.d.ts +8 -0
- package/lib/form/hsteps/index.d.ts +21 -0
- package/lib/form/index.d.ts +4 -0
- package/lib/form/section/index.d.ts +16 -0
- package/lib/form/step-items-selection/components/checkbox-group-items/index.d.ts +12 -0
- package/lib/form/step-items-selection/components/checkbox-group-items/style/index.d.ts +1 -0
- package/lib/form/step-items-selection/components/index.d.ts +2 -0
- package/lib/form/step-items-selection/components/item-info/index.d.ts +11 -0
- package/lib/form/step-items-selection/components/item-info/style/index.d.ts +1 -0
- package/lib/form/step-items-selection/components/item-info/style/index.less +3 -0
- package/lib/form/step-items-selection/components/section-of-item-condition/hooks/index.d.ts +1 -0
- package/lib/form/step-items-selection/components/section-of-item-condition/index.d.ts +17 -0
- package/lib/form/step-items-selection/components/section-of-item-condition/style/index.d.ts +1 -0
- package/lib/form/step-items-selection/config.d.ts +5 -0
- package/lib/form/step-items-selection/index.d.ts +6 -0
- package/lib/form/step-items-selection/types.d.ts +27 -0
- package/lib/form/steps/index.d.ts +10 -0
- package/lib/form-context.d.ts +28 -0
- package/lib/free-form/addable-section/index.d.ts +19 -0
- package/lib/free-form/element/index.d.ts +11 -0
- package/lib/free-form/index.d.ts +11 -0
- package/lib/free-form/section/index.d.ts +13 -0
- package/lib/free-form/step/index.d.ts +21 -0
- package/lib/free-form/steps/index.d.ts +12 -0
- package/lib/hooks/ocr/index.d.ts +3 -0
- package/lib/hooks/ocr/micro-blink.d.ts +10 -0
- package/lib/index.d.ts +49 -0
- package/lib/input/amount.d.ts +14 -0
- package/lib/input/expiry-date.d.ts +16 -0
- package/lib/input/input-date.d.ts +8 -0
- package/lib/input/input-number/basic.d.ts +6 -0
- package/lib/input/input-number/index.d.ts +8 -0
- package/lib/input/input-number/stepper/index.d.ts +7 -0
- package/lib/input/phone-number.d.ts +14 -0
- package/lib/layout/defaultFooter.d.ts +4 -0
- package/lib/media/index.d.ts +29 -0
- package/lib/media/preview.d.ts +12 -0
- package/lib/message/index.d.ts +14 -0
- package/lib/message/useMessage.d.ts +6 -0
- package/lib/modal/index.d.ts +33 -0
- package/lib/modal/useModal.d.ts +12 -0
- package/lib/ocr/index.d.ts +15 -0
- package/lib/ocr/micro-blink/index.d.ts +8 -0
- package/lib/radio/index.d.ts +24 -0
- package/lib/radio/radio-group-with-other.d.ts +7 -0
- package/lib/types.d.ts +188 -0
- package/lib/upload/index.d.ts +16 -0
- package/lib/upload-photo/index.d.ts +28 -0
- package/lib/upload-preview/index.d.ts +9 -0
- package/lib/upload-preview/media.d.ts +7 -0
- package/lib/utils/form-utils.d.ts +79 -0
- package/lib/utils/option-utils.d.ts +29 -0
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC, IglooComponentProps } from '../types';
|
|
2
|
+
import './style/input-date';
|
|
3
|
+
type Props = IglooComponentProps & {
|
|
4
|
+
value?: {
|
|
5
|
+
year: string | number;
|
|
6
|
+
month: string | number;
|
|
7
|
+
};
|
|
8
|
+
onChange?: any;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
check?: (value: {
|
|
11
|
+
year: string;
|
|
12
|
+
month: string;
|
|
13
|
+
}) => boolean;
|
|
14
|
+
};
|
|
15
|
+
declare const IglooExpiryDate: FC<Props>;
|
|
16
|
+
export default IglooExpiryDate;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InputProps } from 'antd/es/input';
|
|
2
|
+
import { FC, IglooComponentProps } from '../types';
|
|
3
|
+
import './style/input-date';
|
|
4
|
+
type Props = InputProps & IglooComponentProps & {
|
|
5
|
+
format: string;
|
|
6
|
+
};
|
|
7
|
+
declare const IglooInputDate: FC<Props>;
|
|
8
|
+
export default IglooInputDate;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InputProps } from 'antd/es/input';
|
|
2
|
+
import { InputNumberProps } from 'antd/es/input-number';
|
|
3
|
+
import { FC, IglooComponentProps } from '../../types';
|
|
4
|
+
type Props = InputProps & InputNumberProps & IglooComponentProps & {
|
|
5
|
+
mode?: 'step' | 'default';
|
|
6
|
+
};
|
|
7
|
+
declare const IglooInputNumber: FC<Props>;
|
|
8
|
+
export default IglooInputNumber;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InputNumberProps } from 'antd/es/input-number';
|
|
2
|
+
import { FC, IglooComponentProps } from '../../../types';
|
|
3
|
+
import '../../style/index';
|
|
4
|
+
import './index.less';
|
|
5
|
+
type Props = InputNumberProps & IglooComponentProps;
|
|
6
|
+
declare const Stepper: FC<Props>;
|
|
7
|
+
export default Stepper;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { FC, IglooComponentProps } from '../types';
|
|
3
|
+
import './style/phone-number';
|
|
4
|
+
export interface PhoneNumberProps extends IglooComponentProps {
|
|
5
|
+
areaCode?: string | string[];
|
|
6
|
+
phoneNumber?: number;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
value?: any;
|
|
11
|
+
onChange?: any;
|
|
12
|
+
}
|
|
13
|
+
declare const PhoneNumber: FC<PhoneNumberProps>;
|
|
14
|
+
export default PhoneNumber;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FC, CSSProperties } from 'react';
|
|
2
|
+
import './style';
|
|
3
|
+
type Download = false | {
|
|
4
|
+
actionType?: 'downloadBlob' | 'openUrl';
|
|
5
|
+
};
|
|
6
|
+
type GetNonCORSUrl = (originUrl: string) => Promise<string> | string;
|
|
7
|
+
interface Props {
|
|
8
|
+
src: string | {
|
|
9
|
+
origin: string;
|
|
10
|
+
nonCORS: string;
|
|
11
|
+
};
|
|
12
|
+
name?: string;
|
|
13
|
+
type?: string;
|
|
14
|
+
index?: number;
|
|
15
|
+
list?: Array<{
|
|
16
|
+
type: string;
|
|
17
|
+
src: string;
|
|
18
|
+
nonCORSSrc?: string;
|
|
19
|
+
}>;
|
|
20
|
+
docNames?: string[];
|
|
21
|
+
className?: any;
|
|
22
|
+
style?: CSSProperties;
|
|
23
|
+
showAllPages?: boolean;
|
|
24
|
+
destroyOnClose?: boolean;
|
|
25
|
+
download?: Download;
|
|
26
|
+
getNonCORSUrl?: GetNonCORSUrl;
|
|
27
|
+
}
|
|
28
|
+
declare const MediaWithPreview: FC<Props>;
|
|
29
|
+
export default MediaWithPreview;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC, CSSProperties } from 'react';
|
|
2
|
+
interface MediaProps {
|
|
3
|
+
src: string;
|
|
4
|
+
type: string;
|
|
5
|
+
scale?: number;
|
|
6
|
+
isCurrent?: boolean;
|
|
7
|
+
className?: any;
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
showAllPages?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const Media: FC<MediaProps>;
|
|
12
|
+
export default Media;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import useMessage from './useMessage';
|
|
3
|
+
import './style';
|
|
4
|
+
type ConfigContent = React.ReactNode | string;
|
|
5
|
+
type ConfigDuration = number;
|
|
6
|
+
export interface IglooGlobalMessage {
|
|
7
|
+
info(content: ConfigContent, duration?: ConfigDuration): any;
|
|
8
|
+
success(content: ConfigContent, duration?: ConfigDuration): any;
|
|
9
|
+
error(content: ConfigContent, duration?: ConfigDuration): any;
|
|
10
|
+
warning(content: ConfigContent, duration?: ConfigDuration): any;
|
|
11
|
+
useMessage: typeof useMessage;
|
|
12
|
+
}
|
|
13
|
+
declare const IglooMessage: IglooGlobalMessage;
|
|
14
|
+
export default IglooMessage;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import type { IglooGlobalMessage } from './';
|
|
3
|
+
import './style';
|
|
4
|
+
export type HookAPI = Omit<IglooGlobalMessage, 'useMessage'>;
|
|
5
|
+
declare const useMessage: () => readonly [HookAPI, ReactElement];
|
|
6
|
+
export default useMessage;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ModalFuncProps, ModalProps } from 'antd/lib/modal';
|
|
3
|
+
import { FormBasicConfig, FormItemConfig } from '../types';
|
|
4
|
+
import useModal from './useModal';
|
|
5
|
+
import './style';
|
|
6
|
+
interface FormModalProps {
|
|
7
|
+
mode?: 'form' | 'normal';
|
|
8
|
+
formConfig?: FormItemConfig;
|
|
9
|
+
formProps?: {
|
|
10
|
+
locales?: FormBasicConfig['locales'];
|
|
11
|
+
initialValues?: FormBasicConfig['initialValues'];
|
|
12
|
+
validationCodeExtraParams?: Record<string, any>;
|
|
13
|
+
};
|
|
14
|
+
onOk?: (values: any, fullValue: any) => any;
|
|
15
|
+
limitHeight?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface ModalFuncReturn {
|
|
18
|
+
destroy: Function;
|
|
19
|
+
update: (props: ModalProps & ModalFuncProps & FormModalProps) => any;
|
|
20
|
+
}
|
|
21
|
+
export type ModalFunction = (props: ModalProps & ModalFuncProps & FormModalProps) => ModalFuncReturn;
|
|
22
|
+
interface ModalType extends FC<ModalProps & ModalFuncProps & FormModalProps> {
|
|
23
|
+
confirm: ModalFunction;
|
|
24
|
+
info: ModalFunction;
|
|
25
|
+
warning: ModalFunction;
|
|
26
|
+
error: ModalFunction;
|
|
27
|
+
success: ModalFunction;
|
|
28
|
+
noFooter: ModalFunction;
|
|
29
|
+
destroyAll: Function;
|
|
30
|
+
useModal: typeof useModal;
|
|
31
|
+
}
|
|
32
|
+
declare const IglooModal: ModalType;
|
|
33
|
+
export default IglooModal;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import { type ModalFunction } from './';
|
|
3
|
+
export interface HookAPI {
|
|
4
|
+
confirm: ModalFunction;
|
|
5
|
+
info: ModalFunction;
|
|
6
|
+
warning: ModalFunction;
|
|
7
|
+
error: ModalFunction;
|
|
8
|
+
success: ModalFunction;
|
|
9
|
+
noFooter: ModalFunction;
|
|
10
|
+
}
|
|
11
|
+
declare const useModal: () => readonly [HookAPI, ReactElement];
|
|
12
|
+
export default useModal;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC, IglooComponentProps, FormItemExtraConfig } from '../types';
|
|
2
|
+
export interface OutputMap {
|
|
3
|
+
field: string[];
|
|
4
|
+
source: string[];
|
|
5
|
+
format?: string;
|
|
6
|
+
formatType?: string;
|
|
7
|
+
}
|
|
8
|
+
interface OCRProps extends IglooComponentProps, FormItemExtraConfig {
|
|
9
|
+
ocrConfig: {
|
|
10
|
+
vendor: string;
|
|
11
|
+
outputMap: OutputMap[];
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
declare const OCR: FC<OCRProps>;
|
|
15
|
+
export default OCR;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC, IglooComponentProps, FormItemExtraConfig } from '../../types';
|
|
2
|
+
import { OutputMap } from '../index';
|
|
3
|
+
import './style';
|
|
4
|
+
interface MicroBlinkProps extends IglooComponentProps, FormItemExtraConfig {
|
|
5
|
+
outputMap: OutputMap[];
|
|
6
|
+
}
|
|
7
|
+
declare const MicroBlink: FC<MicroBlinkProps>;
|
|
8
|
+
export default MicroBlink;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RadioProps, RadioGroupProps } from 'antd/es/radio';
|
|
3
|
+
import { FC, IglooComponentProps } from '../types';
|
|
4
|
+
import './style';
|
|
5
|
+
import { ComponentProps } from '../utils/option-utils';
|
|
6
|
+
import { DefaultOptionType } from 'rc-select/lib/Select';
|
|
7
|
+
type Props = RadioProps & IglooComponentProps;
|
|
8
|
+
declare const IglooRadio: FC<Props>;
|
|
9
|
+
export interface Option extends DefaultOptionType {
|
|
10
|
+
extraInfo?: {
|
|
11
|
+
content: any;
|
|
12
|
+
shownTrigger: 'unchecked' | 'checked' | 'all';
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export interface IProps extends IglooComponentProps, Omit<RadioGroupProps, 'options'>, ComponentProps {
|
|
16
|
+
className?: string;
|
|
17
|
+
radioType?: string;
|
|
18
|
+
options: Option[];
|
|
19
|
+
preview?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const InnerRadioGroup: FC<IProps>;
|
|
22
|
+
export declare const RadioGroup: FC<React.PropsWithChildren<import("../utils/option-utils").HOCProps & IProps>>;
|
|
23
|
+
export default IglooRadio;
|
|
24
|
+
export { default as RadioGroupWithOther } from './radio-group-with-other';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IProps as RadioGroupProps } from './index';
|
|
3
|
+
import { FC } from '../types';
|
|
4
|
+
declare const RadioGroupWithOther: FC<import("react").PropsWithChildren<import("../utils/option-utils").HOCProps & RadioGroupProps & {
|
|
5
|
+
otherOptionLabel: string;
|
|
6
|
+
}>>;
|
|
7
|
+
export default RadioGroupWithOther;
|
package/es/types.d.ts
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
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
|
+
elements?: FormItemConfig[];
|
|
74
|
+
required?: boolean;
|
|
75
|
+
requiredAsserts?: FormItemAssert[];
|
|
76
|
+
extraLabel?: any;
|
|
77
|
+
xl?: number;
|
|
78
|
+
md?: number;
|
|
79
|
+
xs?: number;
|
|
80
|
+
span?: number;
|
|
81
|
+
areaCode?: number | string | (number | string)[];
|
|
82
|
+
phoneNumber?: number | string;
|
|
83
|
+
mergeRules?: boolean;
|
|
84
|
+
dependencies?: NamePath[];
|
|
85
|
+
antdDependencies?: NamePath[];
|
|
86
|
+
asserts?: FormItemAssert[];
|
|
87
|
+
shouldRender?: (form?: FormInstance) => boolean;
|
|
88
|
+
ignore?: boolean;
|
|
89
|
+
copyValue?: FormItemCopyValue;
|
|
90
|
+
selectValue?: FormItemSelectValue[];
|
|
91
|
+
disabled?: boolean | FormItemAssert | FormItemAssert[];
|
|
92
|
+
halfRow?: boolean;
|
|
93
|
+
fullRow?: boolean;
|
|
94
|
+
limit?: number;
|
|
95
|
+
hideWhenPreview?: boolean;
|
|
96
|
+
hideWhenEdit?: boolean;
|
|
97
|
+
requiredMessage?: string | ReactNode;
|
|
98
|
+
showOptional?: boolean;
|
|
99
|
+
previewFormater?(value: any, form?: FormInstance): any;
|
|
100
|
+
handleNext?(values: any): any;
|
|
101
|
+
render?(preview: boolean, form?: FormInstance, value?: any, onChange?: (params: any) => any, setShowStepButton?: IglooComponentProps['setShowStepButton']): any;
|
|
102
|
+
locales?: {
|
|
103
|
+
[key: string]: string;
|
|
104
|
+
};
|
|
105
|
+
options?: (CheckboxOptionType & {
|
|
106
|
+
extraInfo?: {
|
|
107
|
+
content: any;
|
|
108
|
+
shownTrigger: 'unchecked' | 'checked' | 'all';
|
|
109
|
+
};
|
|
110
|
+
})[] | SelectProps['options'];
|
|
111
|
+
sendOtp?: (value: any) => any;
|
|
112
|
+
dependField?: FormItemName;
|
|
113
|
+
countDownSeconds?: number;
|
|
114
|
+
getButtonDisabledState?: (form: FormInstance) => boolean;
|
|
115
|
+
getPreviousDisabledState?: (form: FormInstance) => boolean;
|
|
116
|
+
handleUpload?(file: File): PromiseLike<string>;
|
|
117
|
+
withoutForm?: boolean;
|
|
118
|
+
disableEditButton?: boolean;
|
|
119
|
+
hidePreviewDivider?: boolean;
|
|
120
|
+
valueFormater?: (value: any) => any;
|
|
121
|
+
currentStep?: number;
|
|
122
|
+
subscribedFields?: FormItemName[];
|
|
123
|
+
description?: string | React.ReactNode;
|
|
124
|
+
dateLimitationType?: 'relative' | 'absolute';
|
|
125
|
+
absoluteRangeStart?: number;
|
|
126
|
+
absoluteRangeEnd?: number;
|
|
127
|
+
relativeRangeStart?: {
|
|
128
|
+
type: 'day' | 'month' | 'year';
|
|
129
|
+
quantity: number;
|
|
130
|
+
pattern?: string;
|
|
131
|
+
dependField?: NamePath;
|
|
132
|
+
};
|
|
133
|
+
relativeRangeEnd?: {
|
|
134
|
+
type: 'day' | 'month' | 'year';
|
|
135
|
+
quantity: number;
|
|
136
|
+
pattern?: string;
|
|
137
|
+
dependField?: NamePath;
|
|
138
|
+
};
|
|
139
|
+
validationCode?: {
|
|
140
|
+
code: string;
|
|
141
|
+
errorMessage: string;
|
|
142
|
+
warningOnly?: boolean;
|
|
143
|
+
}[];
|
|
144
|
+
length?: number;
|
|
145
|
+
minLength?: number;
|
|
146
|
+
maxLength?: number;
|
|
147
|
+
idType?: 'KTP' | 'NIK';
|
|
148
|
+
validationRule?: string;
|
|
149
|
+
shouldRenderCode?: string;
|
|
150
|
+
disabledCode?: string;
|
|
151
|
+
automaticCalcCode?: string;
|
|
152
|
+
enableAutomaticCalc?: boolean;
|
|
153
|
+
[key: string]: any;
|
|
154
|
+
}
|
|
155
|
+
export interface FormItemConfig extends FormItemExtraConfig {
|
|
156
|
+
type?: string;
|
|
157
|
+
name?: NamePath;
|
|
158
|
+
label?: string | React.ReactNode;
|
|
159
|
+
previewLabel?: string | React.ReactNode;
|
|
160
|
+
labelProps?: any;
|
|
161
|
+
contentProps?: any;
|
|
162
|
+
ocr?: {
|
|
163
|
+
vender: string;
|
|
164
|
+
outputMap: {
|
|
165
|
+
field: string[];
|
|
166
|
+
source: string[];
|
|
167
|
+
}[];
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
export type FormItemPropsHandler = (config: FormItemConfig) => FormItemConfig;
|
|
171
|
+
export interface FC<P = {}> extends React.FunctionComponent<P> {
|
|
172
|
+
formItemPropsHandler?: FormItemPropsHandler;
|
|
173
|
+
isPreviewSupport?: boolean;
|
|
174
|
+
}
|
|
175
|
+
export interface Form extends React.ForwardRefExoticComponent<FormBasicConfig & React.RefAttributes<any>> {
|
|
176
|
+
useForm: () => FormInstance;
|
|
177
|
+
}
|
|
178
|
+
export interface IglooComponentProps {
|
|
179
|
+
validateField?: (nameList?: NamePath[]) => Promise<any>;
|
|
180
|
+
containerRef?: React.RefObject<any>;
|
|
181
|
+
setFieldError?(errorMsg?: string): void;
|
|
182
|
+
setFieldValue?(value?: any): void;
|
|
183
|
+
setShowStepButton?: (showButton: boolean) => void;
|
|
184
|
+
getFormInstance?: () => FormInstance;
|
|
185
|
+
locales?: {
|
|
186
|
+
[key: string]: string;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { UploadProps, RcFile } from 'antd/es/upload';
|
|
2
|
+
import { FC, IglooComponentProps } from '../types';
|
|
3
|
+
import './style';
|
|
4
|
+
export interface IglooUploadProps extends UploadProps, IglooComponentProps {
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
handleUpload?(file: RcFile): PromiseLike<string>;
|
|
7
|
+
value?: string[];
|
|
8
|
+
onChange?: (value: any) => void;
|
|
9
|
+
limit?: number;
|
|
10
|
+
limitErrorMessage?: Function | string;
|
|
11
|
+
containerRef?: any;
|
|
12
|
+
descriptions?: any;
|
|
13
|
+
bizKey?: string;
|
|
14
|
+
}
|
|
15
|
+
declare const IglooUpload: FC<IglooUploadProps>;
|
|
16
|
+
export default IglooUpload;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FC, IglooComponentProps } from '../types';
|
|
2
|
+
import './style';
|
|
3
|
+
export interface Props extends IglooComponentProps {
|
|
4
|
+
handleUpload?(file: File): PromiseLike<string>;
|
|
5
|
+
value?: (string | {
|
|
6
|
+
name: string;
|
|
7
|
+
status: 'failed';
|
|
8
|
+
errorMsg: string;
|
|
9
|
+
})[];
|
|
10
|
+
onChange?: (value: any) => void;
|
|
11
|
+
limit?: number;
|
|
12
|
+
limitErrorMessage?: Function | string;
|
|
13
|
+
descriptions?: any;
|
|
14
|
+
buttonText?: any;
|
|
15
|
+
samples?: Sample[];
|
|
16
|
+
className?: any;
|
|
17
|
+
id?: string;
|
|
18
|
+
bizKey?: string;
|
|
19
|
+
capture?: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export type Sample = {
|
|
23
|
+
src: string;
|
|
24
|
+
label?: string;
|
|
25
|
+
type?: 'good' | 'bad';
|
|
26
|
+
};
|
|
27
|
+
declare const UploadPhoto: FC<Props>;
|
|
28
|
+
export default UploadPhoto;
|
|
@@ -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,29 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { FC, IglooComponentProps } from '../types';
|
|
3
|
+
import { FormInstance } from 'antd/es/form';
|
|
4
|
+
import { NamePath } from 'antd/es/form/interface';
|
|
5
|
+
import { SelectProps, SelectValue } from 'antd/es/select';
|
|
6
|
+
export declare const compareOptions: (newOptions: any[], oldOptions?: any[]) => boolean;
|
|
7
|
+
export declare const compareSelected: (newValue: any | any[], oldValue: any | any[]) => boolean;
|
|
8
|
+
type Options = SelectProps<SelectValue>['options'];
|
|
9
|
+
export interface HOCProps extends IglooComponentProps {
|
|
10
|
+
options?: Options;
|
|
11
|
+
onSearch?: any;
|
|
12
|
+
getOptions?: (form: FormInstance) => any[];
|
|
13
|
+
optionGroups?: {
|
|
14
|
+
parentKey: string;
|
|
15
|
+
options: Options;
|
|
16
|
+
}[];
|
|
17
|
+
datasourceFilters?: string[];
|
|
18
|
+
datasourceKey?: string;
|
|
19
|
+
datasourceApi?: string;
|
|
20
|
+
dependField?: NamePath;
|
|
21
|
+
passCompareOptions?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface ComponentProps extends IglooComponentProps {
|
|
24
|
+
options?: Options;
|
|
25
|
+
clearWhenOptionsUpdated?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare function optionsHOC<T>(Component: FC<T>): FC<PropsWithChildren<HOCProps & T>>;
|
|
28
|
+
export declare function previewSelectedOptions(options: Options, value: any): any;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { RequestMethod } from 'umi-request';
|
|
3
|
+
import { IglooButtonProps } from '../button';
|
|
4
|
+
import { UploadProps } from 'antd/es/upload';
|
|
5
|
+
import { Job } from './job-list';
|
|
6
|
+
import './style';
|
|
7
|
+
export interface AdminUploadProps {
|
|
8
|
+
dataSource: string | {
|
|
9
|
+
label: string;
|
|
10
|
+
value: string;
|
|
11
|
+
}[];
|
|
12
|
+
requestMethod: RequestMethod;
|
|
13
|
+
uploadMethod: (dataSource: string, file: File, enableApiAuth: boolean, onProgess: (e: ProgressEvent) => any) => {
|
|
14
|
+
abort: () => any;
|
|
15
|
+
result: Promise<{
|
|
16
|
+
success: boolean;
|
|
17
|
+
errorMessage?: string;
|
|
18
|
+
}>;
|
|
19
|
+
};
|
|
20
|
+
modalTitle?: string;
|
|
21
|
+
floatTitle?: string;
|
|
22
|
+
buttonText?: string;
|
|
23
|
+
buttonType?: IglooButtonProps['type'];
|
|
24
|
+
enableApiAuth?: boolean;
|
|
25
|
+
accept?: UploadProps['accept'];
|
|
26
|
+
refreshInteval?: number;
|
|
27
|
+
formatTips?: (props: {
|
|
28
|
+
uploading: number;
|
|
29
|
+
processing: number;
|
|
30
|
+
done: number;
|
|
31
|
+
}) => string;
|
|
32
|
+
selectPlaceholder?: string;
|
|
33
|
+
onFinish?: (jobs: Job[]) => any;
|
|
34
|
+
handleCloseFloat?: (hidden: () => {}) => any;
|
|
35
|
+
}
|
|
36
|
+
declare const AdminUpload: FC<AdminUploadProps>;
|
|
37
|
+
export default AdminUpload;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { HookAPI as ModalHookAPI } from '../modal/useModal';
|
|
3
|
+
import type { HookAPI as MessageHookAPI } from '../message/useMessage';
|
|
4
|
+
export type AppContextType = {
|
|
5
|
+
modal: ModalHookAPI;
|
|
6
|
+
message: MessageHookAPI;
|
|
7
|
+
};
|
|
8
|
+
declare const AppContext: import("react").Context<AppContextType>;
|
|
9
|
+
export default AppContext;
|