beca-ui 2.1.6 → 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.
Files changed (37) hide show
  1. package/dist/DynamicWorkflowScript.js +1968 -363
  2. package/dist/beca-ui.js +127882 -94217
  3. package/dist/components/DebounceSelect/DebounceSelect.d.ts +9 -0
  4. package/dist/components/DebounceSelect/index.d.ts +1 -0
  5. package/dist/components/DynamicForm/AttachIcon.d.ts +6 -0
  6. package/dist/components/DynamicForm/AvatarItem.d.ts +6 -0
  7. package/dist/components/DynamicForm/DynamicForm.d.ts +4 -0
  8. package/dist/components/DynamicForm/DynamicFormInfo.d.ts +13 -0
  9. package/dist/components/DynamicForm/DynamicFormSidebar.d.ts +21 -0
  10. package/dist/components/DynamicForm/DynamicWorkflowForm.d.ts +19 -0
  11. package/dist/components/DynamicForm/MasterDetail/EditableCell.d.ts +24 -0
  12. package/dist/components/DynamicForm/MasterDetail/MasterDetail.d.ts +24 -0
  13. package/dist/components/DynamicForm/MasterDetail/MasterDetails.d.ts +3 -0
  14. package/dist/components/DynamicForm/MasterDetail/index.d.ts +4 -0
  15. package/dist/components/DynamicForm/MasterDetail/types.d.ts +93 -0
  16. package/dist/components/DynamicForm/PropertyFileUpload.d.ts +27 -0
  17. package/dist/components/DynamicForm/PropertyImageList.d.ts +8 -0
  18. package/dist/components/DynamicForm/WorkflowForm.d.ts +30 -0
  19. package/dist/components/DynamicForm/context.d.ts +30 -0
  20. package/dist/components/DynamicForm/index.d.ts +15 -0
  21. package/dist/components/DynamicForm/layout.d.ts +9 -0
  22. package/dist/components/DynamicForm/scriptEngine/index.d.ts +3 -0
  23. package/dist/components/DynamicForm/scriptEngine/types.d.ts +67 -0
  24. package/dist/components/DynamicForm/scriptEngine/useWorkflowScriptEngine.d.ts +2 -0
  25. package/dist/components/DynamicForm/scriptEngine/workflowScriptEngine.d.ts +20 -0
  26. package/dist/components/DynamicForm/types.d.ts +266 -0
  27. package/dist/components/DynamicForm/utils.d.ts +59 -0
  28. package/dist/components/FormEditor/FormEditor.d.ts +25 -0
  29. package/dist/components/FormEditor/index.d.ts +2 -0
  30. package/dist/components/QrBarCodeScanField/QrBarCodeScanField.d.ts +24 -0
  31. package/dist/components/QrBarCodeScanField/index.d.ts +1 -0
  32. package/dist/components/index.d.ts +4 -0
  33. package/dist/index.d.ts +1 -0
  34. package/dist/main.css +1 -1
  35. package/package.json +16 -33
  36. package/README.md +0 -115
  37. package/dist/styles/components/layout/test.d.ts +0 -0
@@ -0,0 +1,266 @@
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, };
6
+ export type FieldType = "text" | "input" | "textarea" | "editor" | "checkbox" | "radio" | "select" | "lookup" | "dateTime" | "number" | "yesno" | "currency" | "choice" | "file";
7
+ export interface RadioType {
8
+ label: string | number;
9
+ value: string | number;
10
+ }
11
+ export interface CheckboxType {
12
+ label: string | number;
13
+ value: string | number;
14
+ }
15
+ export interface SelectItemType {
16
+ label: string | number;
17
+ value: string | number;
18
+ userStatus?: number;
19
+ fullName?: string;
20
+ linkAvatar?: string;
21
+ [key: string]: any;
22
+ }
23
+ export interface ColType {
24
+ allowExtensions?: string;
25
+ allowInput?: boolean;
26
+ allowMulitpleSelections?: boolean;
27
+ apiLabelColumn?: string;
28
+ apiValueColumn?: string;
29
+ avatarName?: string;
30
+ avatarGroupSize?: number;
31
+ avatarGroupMax?: number;
32
+ checkboxItems?: CheckboxType[];
33
+ debounce?: boolean;
34
+ defaultValue?: any;
35
+ defaultValue2?: any;
36
+ displayType?: string;
37
+ description?: string;
38
+ editable?: boolean;
39
+ executeJs?: string;
40
+ extra?: string;
41
+ filterByColumn?: string;
42
+ filterByProperty?: string;
43
+ hidden?: boolean;
44
+ id?: number;
45
+ isAverageGrid?: boolean;
46
+ isDateOnly?: boolean;
47
+ isEdit?: boolean;
48
+ isHide?: boolean;
49
+ isNotAllowSelectToday?: boolean;
50
+ isPercentages?: boolean;
51
+ isPlainText?: boolean;
52
+ isMultiLine?: boolean;
53
+ setting?: any;
54
+ isQrBarCodeScan?: boolean;
55
+ isSumGrid?: boolean;
56
+ key?: string;
57
+ label?: string;
58
+ labelEN?: string;
59
+ lookupItems?: SelectItemType[];
60
+ lookupItemsAfterFilter?: SelectItemType[];
61
+ maxLength?: number;
62
+ maximum?: number;
63
+ minLength?: number;
64
+ minimum?: number;
65
+ name: string;
66
+ numberOfDecimalPlaces?: number;
67
+ placeholder?: string;
68
+ radioItems?: RadioType[];
69
+ realType?: FieldType;
70
+ required?: boolean;
71
+ selectedCheckbox?: any[];
72
+ selectItems?: SelectItemType[];
73
+ styleClass?: string;
74
+ type: FieldType;
75
+ viewOnly?: boolean;
76
+ width?: number;
77
+ widthInReport?: number;
78
+ visibleCondition?: string;
79
+ selectDisplayType?: "Tree" | "Select";
80
+ choiceDescription?: string;
81
+ masterDetailFormats?: ColType[];
82
+ groupTitle?: boolean;
83
+ groupNumber?: string | number;
84
+ [key: string]: any;
85
+ }
86
+ export interface RowsType {
87
+ row: ColType[];
88
+ }
89
+ export interface FieldData {
90
+ name: string | number | (string | number)[];
91
+ value?: any;
92
+ touched?: boolean;
93
+ validating?: boolean;
94
+ validated?: boolean;
95
+ errors?: string[];
96
+ }
97
+ export interface FormEditorType {
98
+ item: ColType;
99
+ isNew?: boolean;
100
+ rowLength?: number;
101
+ formVertical?: boolean;
102
+ }
103
+ export interface MasterDetailType {
104
+ id: number;
105
+ name: string;
106
+ title: string;
107
+ visibleCondition?: string;
108
+ colTypes: ColType[];
109
+ rows: ColType[][];
110
+ dataSource: any[];
111
+ isRequired?: boolean;
112
+ defaultValue?: string;
113
+ defaultValueEN?: string;
114
+ isAutoGenerateNewRow?: boolean;
115
+ groupNumber?: string | number;
116
+ groupTitle?: boolean;
117
+ originalIndex?: number;
118
+ [key: string]: any;
119
+ }
120
+ export interface DynamicFormVisibleCondition {
121
+ name: string;
122
+ visibleCondition: string;
123
+ }
124
+ export interface DynamicFormVisibleGroupCondition {
125
+ groupNumber: string;
126
+ visibleCondition: string;
127
+ }
128
+ export type DynamicFormRequiredType = "checklist" | "outdated" | "link";
129
+ export interface DynamicFormRequiredCondition {
130
+ name: string;
131
+ typeRequired: DynamicFormRequiredType;
132
+ target?: string;
133
+ requiredCondition: string;
134
+ }
135
+ export interface UserWorkflowActionsModel {
136
+ allowShare?: boolean;
137
+ allowPrint?: boolean;
138
+ allowExit?: boolean;
139
+ allowSave?: boolean;
140
+ allowProcessConfiguration?: boolean;
141
+ allowSend?: boolean;
142
+ allowRecall?: boolean;
143
+ allowAccept?: boolean;
144
+ allowApprove?: boolean;
145
+ allowReturn?: boolean;
146
+ allowReject?: boolean;
147
+ allowReplace?: boolean;
148
+ allowAddInfo?: boolean;
149
+ allowAddLinking?: boolean;
150
+ allowAttachment?: boolean;
151
+ allowIdea?: boolean;
152
+ allowAddIdea?: boolean;
153
+ allowEdit?: boolean;
154
+ allowEditResource?: boolean;
155
+ allowReFileApproved?: boolean;
156
+ allowReInsertTemplateFile?: boolean;
157
+ allowReAllFileApproved?: boolean;
158
+ allowEditUserWorkflow?: boolean;
159
+ allowDeleteByAdmin?: boolean;
160
+ allowDeleteFileByAdmin?: boolean;
161
+ allowEditMasterDetail?: boolean[];
162
+ allowAddMasterDetail?: boolean[];
163
+ allowEditApplication?: boolean;
164
+ defaultAllowEditMasterDetail?: boolean[];
165
+ allowAddNote?: boolean;
166
+ allowShowIssuedDocumentLabel?: boolean;
167
+ isHavingIdeaStep?: boolean;
168
+ labelAddInfo?: string;
169
+ labelSave?: string;
170
+ labelNext?: string;
171
+ labelReturn?: string;
172
+ labelApprove?: string;
173
+ labelReject?: string;
174
+ labelRecall?: string;
175
+ labelReplace?: string;
176
+ labelIdea?: string;
177
+ labelShare?: string;
178
+ labelExit?: string;
179
+ labelPrint?: string;
180
+ labelSend?: string;
181
+ labelAddInfoEN?: string;
182
+ [key: string]: any;
183
+ }
184
+ export interface PropertyFileItem {
185
+ Id: number;
186
+ Name: string;
187
+ Path: string;
188
+ ViewUrl?: string;
189
+ DownloadUrl?: string;
190
+ [key: string]: any;
191
+ }
192
+ export interface PropertyFileUploadValue {
193
+ fileList: PropertyUploadFile[];
194
+ nextId: number;
195
+ }
196
+ export type PropertyUploadFile = UploadFile<any> & {
197
+ propertyFile?: PropertyFileItem;
198
+ };
199
+ export interface DynamicFormGroup {
200
+ groupNumber: string;
201
+ level: number;
202
+ groupTitle?: string;
203
+ rows: RowsType[];
204
+ masterDetailFormats: MasterDetailType[];
205
+ children: DynamicFormGroup[];
206
+ }
207
+ export interface MasterDetailsRenderProps {
208
+ [key: string]: any;
209
+ masterDetailFormats: MasterDetailType[];
210
+ form: FormInstance<any>;
211
+ rows: RowsType[];
212
+ actions: UserWorkflowActionsModel;
213
+ hiddenMasterDetailNames: string[];
214
+ }
215
+ export type DynamicFormLocale = "vi" | "en";
216
+ export interface DynamicFormTranslations {
217
+ [key: string]: string;
218
+ }
219
+ export interface DynamicFormProps {
220
+ form: FormInstance<any>;
221
+ rows: RowsType[];
222
+ mode?: "new" | "draft" | "detail" | "edit";
223
+ userWorkflowId?: number;
224
+ workflow?: any;
225
+ autoRunScripts?: boolean;
226
+ scriptEngineRef?: React.Ref<any>;
227
+ onFinish?: (values: any) => void;
228
+ onFinishFailed?: (errorFields: any) => void;
229
+ onChangeFields?: (changedFields: any) => void;
230
+ actions?: UserWorkflowActionsModel;
231
+ isMobileApp?: boolean;
232
+ changeOptionOfCol?: (id: number, options: any) => void;
233
+ checkFilterFromLookupItems?: (col: ColType, value: any) => void;
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[];
242
+ renderMasterDetails?: (props: MasterDetailsRenderProps) => React.ReactNode;
243
+ onRequiredConditionsChange?: (conditions: DynamicFormRequiredCondition[]) => void;
244
+ selectedGroup?: string;
245
+ onSelectedGroupChange?: (groupNumber: string) => void;
246
+ locale?: DynamicFormLocale;
247
+ translations?: DynamicFormTranslations;
248
+ userType?: string;
249
+ onSearchLookupDebounce?: (id?: number, searchTerm?: string) => Promise<any[]>;
250
+ onUploadPropertyFile?: (colId: number, file: any) => Promise<{
251
+ success: boolean;
252
+ value: string | number;
253
+ message?: string;
254
+ }>;
255
+ className?: string;
256
+ style?: React.CSSProperties;
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";
@@ -0,0 +1,59 @@
1
+ import type { FormInstance } from "..";
2
+ import type { ColType, DynamicFormRequiredCondition, DynamicFormVisibleCondition, DynamicFormVisibleGroupCondition, SelectItemType } from "./types";
3
+ export declare const imageExtensions: string[];
4
+ export declare const videoExtensions: string[];
5
+ export declare const msWordExtensions: string[];
6
+ export declare const msExcelExtensions: string[];
7
+ export declare const msPowerPointExtensions: string[];
8
+ export declare const msPdfExtensions: string[];
9
+ export declare const FileUtils: {
10
+ getFileExtension(fileName?: string): string;
11
+ isImage(extension?: string | false): boolean;
12
+ isVideo(extension?: string | false): boolean;
13
+ isMSWord(extension?: string): boolean;
14
+ isMSExcel(extension?: string): boolean;
15
+ isMSPowerPoint(extension?: string): boolean;
16
+ isMSPdf(extension?: string): boolean;
17
+ };
18
+ export declare function displayDate(val?: any): string;
19
+ export declare function displayDateTime(val?: any): string;
20
+ export declare function thousandsSeparator(val?: string | number): string;
21
+ export declare function formatVietnameseNumberInput(val: any, isPercentages?: boolean): string;
22
+ export declare function parseVietnameseNumberInput(val?: string): string;
23
+ export declare function displayNumber(val: any, options?: {
24
+ isPercentages?: boolean;
25
+ numberOfDecimalPlaces?: number;
26
+ }): string;
27
+ export declare function formatCurrency(val: any, numberOfDecimalPlaces?: number): string;
28
+ export declare function htmlToText(html?: string): string;
29
+ export declare function isEmptyEditorValue(value: unknown): boolean;
30
+ export declare function createEditorRequiredRule(message: string): {
31
+ required: boolean;
32
+ validator: (_: unknown, value: unknown) => Promise<void>;
33
+ };
34
+ export declare function checkUserItems(items?: SelectItemType[]): boolean;
35
+ export declare function getLocalText(viText?: string, enText?: string, locale?: string): string;
36
+ export declare const WorkflowUtils: {
37
+ getProperiesFromStyleClass(col: ColType): {
38
+ isHidden: boolean;
39
+ isFormVertical: boolean;
40
+ };
41
+ };
42
+ export declare const DynamicWorkflowUtils: {
43
+ isHideColumn(col: ColType, hiddenNames?: string[]): boolean;
44
+ evaluateCondition(condition: string, columns: ColType[] | undefined, form: FormInstance): boolean;
45
+ handleVisibleFields(columns: ColType[] | undefined, visibleConditionColumns: DynamicFormVisibleCondition[] | undefined, _hiddenNames: string[] | undefined, form: FormInstance): string[];
46
+ handleVisibleGroups(columns: ColType[] | undefined, groupVisibleConditions: DynamicFormVisibleGroupCondition[] | undefined, form: FormInstance): string[];
47
+ handleRequiredFields(columns: ColType[] | undefined, requiredConditionColumns: DynamicFormRequiredCondition[] | undefined, form: FormInstance): DynamicFormRequiredCondition[];
48
+ parseRequiredConditions(fieldName: string, description: string): DynamicFormRequiredCondition[];
49
+ getValue(col: ColType, data?: any, isMasterDetail?: boolean): any;
50
+ scrollAndHighlightRequired(target: string | HTMLElement | null | undefined, options?: {
51
+ durationMs?: number;
52
+ scrollContainer?: string | HTMLElement | null;
53
+ }): void;
54
+ getRequiredFlags(conditions?: DynamicFormRequiredCondition[]): {
55
+ checklistIds: number[];
56
+ requireOutdated: boolean;
57
+ requireLink: boolean;
58
+ };
59
+ };
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { ColProps } from "..";
3
+ export interface FormEditorItem {
4
+ name: string;
5
+ label?: string;
6
+ labelEN?: string;
7
+ extra?: string;
8
+ hidden?: boolean;
9
+ required?: boolean;
10
+ defaultValue?: any;
11
+ }
12
+ export interface FormEditorProps {
13
+ item: FormEditorItem;
14
+ rowLength?: number;
15
+ formVertical?: boolean;
16
+ label?: React.ReactNode;
17
+ labelCol?: ColProps;
18
+ wrapperCol?: ColProps;
19
+ isMobile?: boolean;
20
+ isMobileApp?: boolean;
21
+ requiredRule?: any;
22
+ className?: string;
23
+ }
24
+ export declare function FormEditor({ item, formVertical, label, labelCol, wrapperCol, isMobile, requiredRule, className, }: FormEditorProps): import("react/jsx-runtime").JSX.Element;
25
+ export default FormEditor;
@@ -0,0 +1,2 @@
1
+ export * from "./FormEditor";
2
+ export { default } from "./FormEditor";
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ interface BarcodeDetectorConstructor {
3
+ new (options?: {
4
+ formats?: string[];
5
+ }): {
6
+ detect: (image: HTMLVideoElement) => Promise<Array<{
7
+ rawValue?: string;
8
+ }>>;
9
+ };
10
+ }
11
+ export interface QrBarCodeScanFieldProps {
12
+ children: React.ReactNode;
13
+ disabled?: boolean;
14
+ onScan: (value: string) => void;
15
+ value?: any;
16
+ onChange?: (value: any) => void;
17
+ title?: string;
18
+ notSupportedText?: string;
19
+ permissionDeniedText?: string;
20
+ scanSuccessText?: string;
21
+ customBarcodeDetector?: BarcodeDetectorConstructor;
22
+ }
23
+ export declare const QrBarCodeScanField: ({ children, disabled, onScan, value, onChange, title, notSupportedText, permissionDeniedText, scanSuccessText, customBarcodeDetector, }: QrBarCodeScanFieldProps) => import("react/jsx-runtime").JSX.Element;
24
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./QrBarCodeScanField";
@@ -80,3 +80,7 @@ export * from "./TreeSelect";
80
80
  export * from "./TreeSelectField";
81
81
  export * from "./BecaChatBox";
82
82
  export * from "./AIChat";
83
+ export * from "./DebounceSelect";
84
+ export * from "./QrBarCodeScanField";
85
+ export * from "./FormEditor";
86
+ export * from "./DynamicForm";
@@ -0,0 +1 @@
1
+ export * from "./main";