beca-ui 2.1.7 → 2.1.8
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/dist/beca-ui.js +126084 -98266
- package/dist/components/DynamicForm/DynamicForm.d.ts +2 -2
- package/dist/components/DynamicForm/MasterDetail/EditableCell.d.ts +24 -0
- package/dist/components/DynamicForm/MasterDetail/MasterDetail.d.ts +24 -0
- package/dist/components/DynamicForm/MasterDetail/MasterDetails.d.ts +3 -0
- package/dist/components/DynamicForm/MasterDetail/index.d.ts +4 -0
- package/dist/components/DynamicForm/MasterDetail/types.d.ts +93 -0
- package/dist/components/DynamicForm/index.d.ts +2 -0
- package/dist/components/DynamicForm/scriptEngine/index.d.ts +3 -0
- package/dist/components/DynamicForm/scriptEngine/types.d.ts +67 -0
- package/dist/components/DynamicForm/scriptEngine/useWorkflowScriptEngine.d.ts +2 -0
- package/dist/components/DynamicForm/scriptEngine/workflowScriptEngine.d.ts +20 -0
- package/dist/components/DynamicForm/types.d.ts +26 -1
- package/dist/main.css +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { DynamicFormProps } from "./types";
|
|
2
|
+
import type { DynamicFormProps, DynamicFormRef } from "./types";
|
|
3
3
|
export declare const GENERAL_GROUP_KEY = "general";
|
|
4
|
-
export declare const DynamicForm: React.
|
|
4
|
+
export declare const DynamicForm: React.ForwardRefExoticComponent<DynamicFormProps & React.RefAttributes<DynamicFormRef>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ColumnType } from "../..";
|
|
3
|
+
import type { ColType } from "../types";
|
|
4
|
+
export declare const useDebounce: <T = any>(value: T, delay?: number) => T;
|
|
5
|
+
export declare function fetchItemsInLookupItems(searchTerm: string, id?: number, onSearchLookupDebounce?: (id?: number, searchTerm?: string) => Promise<any[]>): Promise<any[]>;
|
|
6
|
+
export interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
|
|
7
|
+
editing: boolean;
|
|
8
|
+
dataIndex: string;
|
|
9
|
+
title: any;
|
|
10
|
+
inputType: "number" | "input" | "select" | "textarea" | "text" | "checkbox" | "radio" | "editor" | "lookup" | "dateTime" | "yesno" | "currency" | "file";
|
|
11
|
+
record: any;
|
|
12
|
+
index: number;
|
|
13
|
+
selectData: any[];
|
|
14
|
+
required?: boolean;
|
|
15
|
+
children: any;
|
|
16
|
+
col?: ColumnType<any> & ColType;
|
|
17
|
+
value?: any;
|
|
18
|
+
mode?: string;
|
|
19
|
+
onChange?: (value: any) => void;
|
|
20
|
+
changeOptionOfCol: (id?: number, options?: any) => void;
|
|
21
|
+
onEdit: (id: string) => void;
|
|
22
|
+
isMobileApp?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare const EditableCell: React.FC<EditableCellProps>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { MasterDetailRefs, MasterDetailTableProps } from "./types";
|
|
3
|
+
export declare class ErrorBoundary extends React.Component<{
|
|
4
|
+
FallbackComponent?: React.ComponentType<any>;
|
|
5
|
+
onError?: (error: any, info: any) => void;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}, {
|
|
8
|
+
hasError: boolean;
|
|
9
|
+
error: any;
|
|
10
|
+
}> {
|
|
11
|
+
constructor(props: any);
|
|
12
|
+
static getDerivedStateFromError(error: any): {
|
|
13
|
+
hasError: boolean;
|
|
14
|
+
error: any;
|
|
15
|
+
};
|
|
16
|
+
componentDidCatch(error: any, errorInfo: any): void;
|
|
17
|
+
render(): string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
18
|
+
}
|
|
19
|
+
export declare const ErrorFallback: ({ error }: {
|
|
20
|
+
error?: any;
|
|
21
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const getMasterDetailRowData: (masterDetailRowId: string) => any;
|
|
23
|
+
export declare const formatFormData: (data: any) => any;
|
|
24
|
+
export declare const MasterDetail: React.ForwardRefExoticComponent<MasterDetailTableProps & React.RefAttributes<MasterDetailRefs>>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { ColumnType } from "../../Table";
|
|
2
|
+
import type { ColType, FieldType, FormInstance, MasterDetailType, RowsType, UserWorkflowActionsModel } from "../types";
|
|
3
|
+
export interface CustomColumnType<T = any> extends ColumnType<T> {
|
|
4
|
+
columnSearchDataIndex?: string | number;
|
|
5
|
+
filterBy?: any;
|
|
6
|
+
inputType?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
selectData?: any;
|
|
10
|
+
editable?: boolean;
|
|
11
|
+
executeJs?: string;
|
|
12
|
+
lookupItems?: any[];
|
|
13
|
+
selectItems?: any[];
|
|
14
|
+
isHide?: boolean;
|
|
15
|
+
id?: number;
|
|
16
|
+
realType?: FieldType | string;
|
|
17
|
+
}
|
|
18
|
+
export interface MasterDetailRefs {
|
|
19
|
+
addRow: () => void;
|
|
20
|
+
validate: () => boolean;
|
|
21
|
+
editingKey: number | undefined;
|
|
22
|
+
}
|
|
23
|
+
export interface WorkflowsCheckListModel {
|
|
24
|
+
createdBy?: string;
|
|
25
|
+
createdTime?: Date | string;
|
|
26
|
+
documentTypeTitle?: string;
|
|
27
|
+
id: number;
|
|
28
|
+
isDeleted?: boolean;
|
|
29
|
+
isQRCode?: boolean;
|
|
30
|
+
isReplaceText?: boolean;
|
|
31
|
+
isReplaceSignature?: boolean;
|
|
32
|
+
isReplaceFlashSignature?: boolean;
|
|
33
|
+
isPublicForEveryone?: boolean;
|
|
34
|
+
isAutoWatermarkEmbedWhenDownload?: boolean;
|
|
35
|
+
isSignaturedManually?: boolean;
|
|
36
|
+
isOnlyAllowedAttachedAfterApproving?: boolean;
|
|
37
|
+
permission?: string;
|
|
38
|
+
permissionArray?: string[];
|
|
39
|
+
isRequired?: boolean;
|
|
40
|
+
isSignature?: boolean;
|
|
41
|
+
lastModified?: Date | string;
|
|
42
|
+
modifiedBy?: string;
|
|
43
|
+
title?: string;
|
|
44
|
+
typeId?: number;
|
|
45
|
+
workflowStepId?: number;
|
|
46
|
+
workflowStepTitle?: string;
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
}
|
|
49
|
+
export interface MasterDetailTableProps {
|
|
50
|
+
name: string;
|
|
51
|
+
colTypes: ColType[];
|
|
52
|
+
dataSource: any;
|
|
53
|
+
workflowStepId?: number;
|
|
54
|
+
title?: string;
|
|
55
|
+
step?: number;
|
|
56
|
+
allowEdit: boolean;
|
|
57
|
+
allowSave: boolean;
|
|
58
|
+
autoGenerateNewRow: boolean;
|
|
59
|
+
onChangeValues: (values: any[]) => void;
|
|
60
|
+
isRequired?: boolean;
|
|
61
|
+
masterDetailIndex?: number;
|
|
62
|
+
changeOptionOfCol: (id: number, options: any) => void;
|
|
63
|
+
onRunScript?: (changedFields?: any) => void;
|
|
64
|
+
isColumnResizable?: boolean;
|
|
65
|
+
userWorkflowForm: FormInstance<any>;
|
|
66
|
+
userWorkflowRows: RowsType[];
|
|
67
|
+
onAdd: () => void;
|
|
68
|
+
masterDetail: MasterDetailType;
|
|
69
|
+
fitContent?: boolean;
|
|
70
|
+
workflowScripts?: string[];
|
|
71
|
+
mode?: "workflow" | "new" | "draft" | "detail" | "edit" | string;
|
|
72
|
+
userWorkflowId?: number;
|
|
73
|
+
workflow?: any;
|
|
74
|
+
isPrint?: boolean;
|
|
75
|
+
hidden?: boolean;
|
|
76
|
+
isMobileApp?: boolean;
|
|
77
|
+
}
|
|
78
|
+
export interface MasterDetailsProps {
|
|
79
|
+
userWorkflowId?: number;
|
|
80
|
+
masterDetailFormats: MasterDetailType[];
|
|
81
|
+
actions?: UserWorkflowActionsModel;
|
|
82
|
+
onChangeMDValues?: (values: any) => void;
|
|
83
|
+
workflowScripts?: string[];
|
|
84
|
+
masterDetailsRef?: React.MutableRefObject<MasterDetailRefs[]>;
|
|
85
|
+
masterDetailValues?: any;
|
|
86
|
+
form: FormInstance<any>;
|
|
87
|
+
rows: RowsType[];
|
|
88
|
+
workflow?: any;
|
|
89
|
+
mode?: "workflow" | "new" | "draft" | "detail" | "edit" | string;
|
|
90
|
+
changeOptionOfColMasterDetail?: (masterDetailName: string, id: number, options: any) => void;
|
|
91
|
+
hiddenMasterDetailNames?: string[];
|
|
92
|
+
isMobileApp?: boolean;
|
|
93
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { FormInstance } from "../..";
|
|
2
|
+
import type { ColType, RowsType } from "../types";
|
|
3
|
+
export type WorkflowScriptMode = "new" | "draft" | "detail" | "edit";
|
|
4
|
+
export interface DynamicWorkflowScriptWindow {
|
|
5
|
+
isDetail: boolean;
|
|
6
|
+
isMasterDetail: boolean;
|
|
7
|
+
colName?: string;
|
|
8
|
+
mdCellId?: string;
|
|
9
|
+
userWorkflowId?: number;
|
|
10
|
+
masterDetailId?: string;
|
|
11
|
+
currentForm?: FormInstance<any>;
|
|
12
|
+
currentMDForm?: FormInstance<any>;
|
|
13
|
+
currentColumns?: Record<string, ColType>;
|
|
14
|
+
currentMDColumns?: Record<string, any>;
|
|
15
|
+
handleActionButtons?: (valid: boolean, elementIds?: string[], masterDetailId?: string | boolean, error?: string | {
|
|
16
|
+
message: string;
|
|
17
|
+
errorId: string;
|
|
18
|
+
}) => void;
|
|
19
|
+
validateDatesRange?: (startDateName: string, endDateName: string, unit: "minute" | "hour" | "day" | "month" | "year", count: number) => void;
|
|
20
|
+
validatePhoneNumber?: (name: string) => void;
|
|
21
|
+
validateEmail?: (name: string) => void;
|
|
22
|
+
getFieldValue?: (name: string, masterDetailId?: any) => any;
|
|
23
|
+
getFieldContent?: (name: string, masterDetailId?: any) => any;
|
|
24
|
+
setFieldValue?: (name: string, val: any, masterDetailId?: string) => void;
|
|
25
|
+
setFormValue?: (name: string, value: any) => void;
|
|
26
|
+
runCellScript?: (value: any, col: any, id: number) => void;
|
|
27
|
+
getMasterDetailRowData?: (masterDetailRowId: string) => any;
|
|
28
|
+
scanAndRegisterMasterDetailOptionMappings?: (workflow: any) => void;
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}
|
|
31
|
+
export interface ExecuteWorkflowScriptsOptions {
|
|
32
|
+
userWorkflowId?: number;
|
|
33
|
+
workflow?: any;
|
|
34
|
+
rows: RowsType[];
|
|
35
|
+
form: FormInstance<any>;
|
|
36
|
+
isFieldsChanged?: boolean;
|
|
37
|
+
fieldName?: string;
|
|
38
|
+
isNew?: boolean;
|
|
39
|
+
mode?: WorkflowScriptMode;
|
|
40
|
+
t?: (key: string, params?: Record<string, any>) => string;
|
|
41
|
+
getLocalText?: (viText?: string, enText?: string) => string;
|
|
42
|
+
}
|
|
43
|
+
export interface ChangeFieldsValueOptions {
|
|
44
|
+
userWorkflowId?: number;
|
|
45
|
+
fields: any[];
|
|
46
|
+
allScripts?: string;
|
|
47
|
+
workflow?: any;
|
|
48
|
+
rows: RowsType[];
|
|
49
|
+
form: FormInstance<any>;
|
|
50
|
+
mode?: WorkflowScriptMode;
|
|
51
|
+
t?: (key: string, params?: Record<string, any>) => string;
|
|
52
|
+
getLocalText?: (viText?: string, enText?: string) => string;
|
|
53
|
+
}
|
|
54
|
+
export interface ScriptEngineRef {
|
|
55
|
+
allScripts: string;
|
|
56
|
+
executeScripts: (fieldName?: string, isNewOverride?: boolean) => Promise<void>;
|
|
57
|
+
handleChangeFields: (fields: any[]) => void;
|
|
58
|
+
}
|
|
59
|
+
export interface UseWorkflowScriptEngineProps {
|
|
60
|
+
form: FormInstance<any>;
|
|
61
|
+
rows: RowsType[];
|
|
62
|
+
workflow?: any;
|
|
63
|
+
userWorkflowId?: number;
|
|
64
|
+
mode?: WorkflowScriptMode;
|
|
65
|
+
autoRun?: boolean;
|
|
66
|
+
onChangeFields?: (fields: any[]) => void;
|
|
67
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FormInstance } from "../..";
|
|
2
|
+
import type { ColType, RowsType } from "../types";
|
|
3
|
+
import type { ExecuteWorkflowScriptsOptions, ChangeFieldsValueOptions } from "./types";
|
|
4
|
+
export declare const minifyScript: (script?: string) => string;
|
|
5
|
+
export declare const extractAllWorkflowScripts: (rows: RowsType[], workflow?: any) => string;
|
|
6
|
+
export declare const getHiddenColumnNames: (rows: RowsType[], workflow?: any) => string[];
|
|
7
|
+
export declare const isFormularScript: (script: string) => boolean;
|
|
8
|
+
export declare const isDataScript: (script: string) => boolean;
|
|
9
|
+
export interface MountScriptGlobalsContext {
|
|
10
|
+
form: FormInstance<any>;
|
|
11
|
+
rows: RowsType[];
|
|
12
|
+
t?: (key: string, params?: Record<string, any>) => string;
|
|
13
|
+
getLocalText?: (viText?: string, enText?: string) => string;
|
|
14
|
+
}
|
|
15
|
+
export declare const mountWorkflowScriptGlobals: (context: MountScriptGlobalsContext) => (() => void);
|
|
16
|
+
export declare const executeWorkflowScripts: (options: ExecuteWorkflowScriptsOptions) => Promise<void>;
|
|
17
|
+
export declare const changeFieldsValue: (options: ChangeFieldsValueOptions) => void;
|
|
18
|
+
export declare const isMMDScript: (scriptString?: string) => boolean;
|
|
19
|
+
export declare const handleMasterDetailScripts: (col: ColType) => string;
|
|
20
|
+
export declare const executeWorkflowJSMasterDetail: (col: ColType, userWorkflowForm: FormInstance<any>, userWorkflowCols: any, form: FormInstance<any>, fieldValue: any, masterDetailIndex: number, id: any, isEdit?: boolean, cols?: any[]) => void;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type { FormInstance
|
|
1
|
+
import type { FormInstance } from "../Form";
|
|
2
|
+
import type { UploadFile } from "../Upload";
|
|
3
|
+
import type { MasterDetailRefs } from "./MasterDetail/types";
|
|
4
|
+
import type { DynamicWorkflowScriptWindow } from "./scriptEngine/types";
|
|
5
|
+
export type { FormInstance, UploadFile, DynamicWorkflowScriptWindow, MasterDetailRefs, };
|
|
2
6
|
export type FieldType = "text" | "input" | "textarea" | "editor" | "checkbox" | "radio" | "select" | "lookup" | "dateTime" | "number" | "yesno" | "currency" | "choice" | "file";
|
|
3
7
|
export interface RadioType {
|
|
4
8
|
label: string | number;
|
|
@@ -215,6 +219,11 @@ export interface DynamicFormTranslations {
|
|
|
215
219
|
export interface DynamicFormProps {
|
|
216
220
|
form: FormInstance<any>;
|
|
217
221
|
rows: RowsType[];
|
|
222
|
+
mode?: "new" | "draft" | "detail" | "edit";
|
|
223
|
+
userWorkflowId?: number;
|
|
224
|
+
workflow?: any;
|
|
225
|
+
autoRunScripts?: boolean;
|
|
226
|
+
scriptEngineRef?: React.Ref<any>;
|
|
218
227
|
onFinish?: (values: any) => void;
|
|
219
228
|
onFinishFailed?: (errorFields: any) => void;
|
|
220
229
|
onChangeFields?: (changedFields: any) => void;
|
|
@@ -223,6 +232,13 @@ export interface DynamicFormProps {
|
|
|
223
232
|
changeOptionOfCol?: (id: number, options: any) => void;
|
|
224
233
|
checkFilterFromLookupItems?: (col: ColType, value: any) => void;
|
|
225
234
|
masterDetails?: any;
|
|
235
|
+
masterDetailFormats?: MasterDetailType[];
|
|
236
|
+
masterDetailValues?: any;
|
|
237
|
+
onChangeMDValues?: (values: any) => void;
|
|
238
|
+
workflowScripts?: string[];
|
|
239
|
+
masterDetailsRef?: React.MutableRefObject<MasterDetailRefs[]>;
|
|
240
|
+
changeOptionOfColMasterDetail?: (masterDetailName: string, id: number, options: any) => void;
|
|
241
|
+
hiddenMasterDetailNames?: string[];
|
|
226
242
|
renderMasterDetails?: (props: MasterDetailsRenderProps) => React.ReactNode;
|
|
227
243
|
onRequiredConditionsChange?: (conditions: DynamicFormRequiredCondition[]) => void;
|
|
228
244
|
selectedGroup?: string;
|
|
@@ -239,3 +255,12 @@ export interface DynamicFormProps {
|
|
|
239
255
|
className?: string;
|
|
240
256
|
style?: React.CSSProperties;
|
|
241
257
|
}
|
|
258
|
+
export interface DynamicFormRef {
|
|
259
|
+
form: FormInstance<any>;
|
|
260
|
+
masterDetailsRef: React.MutableRefObject<MasterDetailRefs[]>;
|
|
261
|
+
validate: () => Promise<any>;
|
|
262
|
+
validateMasterDetails: () => boolean;
|
|
263
|
+
getMasterDetailValues: () => any;
|
|
264
|
+
setMasterDetailValues: (values: any) => void;
|
|
265
|
+
}
|
|
266
|
+
export * from "./MasterDetail/types";
|