@knovator/pagecreator-admin 0.5.4 → 0.5.6
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/index.cjs +87 -79
- package/index.js +87 -79
- package/package.json +2 -2
- package/src/index.d.ts +5 -0
- package/src/lib/api/index.d.ts +10 -0
- package/src/lib/api/list.d.ts +48 -0
- package/src/lib/components/Page/AddButton/AddButton.d.ts +3 -0
- package/src/lib/components/Page/AddButton/index.d.ts +2 -0
- package/src/lib/components/Page/Form/PageForm.d.ts +4 -0
- package/src/lib/components/Page/Form/index.d.ts +2 -0
- package/src/lib/components/Page/Page/Page.d.ts +13 -0
- package/src/lib/components/Page/Page/index.d.ts +2 -0
- package/src/lib/components/Page/PageFormActions/PageFormActions.d.ts +4 -0
- package/src/lib/components/Page/PageFormActions/index.d.ts +2 -0
- package/src/lib/components/Page/PageFormWrapper/PageFormWrapper.d.ts +4 -0
- package/src/lib/components/Page/PageFormWrapper/index.d.ts +2 -0
- package/src/lib/components/Page/Pagination/PagePagination.d.ts +3 -0
- package/src/lib/components/Page/Pagination/index.d.ts +2 -0
- package/src/lib/components/Page/Search/PageSearch.d.ts +3 -0
- package/src/lib/components/Page/Search/index.d.ts +2 -0
- package/src/lib/components/Page/Table/PageTable.d.ts +3 -0
- package/src/lib/components/Page/Table/index.d.ts +2 -0
- package/src/lib/components/Page/index.d.ts +2 -0
- package/src/lib/components/Widget/AddButton/AddButton.d.ts +3 -0
- package/src/lib/components/Widget/AddButton/index.d.ts +2 -0
- package/src/lib/components/Widget/Form/ItemsAccordian.d.ts +4 -0
- package/src/lib/components/Widget/Form/Tabs/TabItem.d.ts +4 -0
- package/src/lib/components/Widget/Form/Tabs/Tabs.d.ts +4 -0
- package/src/lib/components/Widget/Form/Tabs/index.d.ts +2 -0
- package/src/lib/components/Widget/Form/WidgetForm.d.ts +4 -0
- package/src/lib/components/Widget/Form/index.d.ts +2 -0
- package/src/lib/components/Widget/Pagination/WidgetPagination.d.ts +3 -0
- package/src/lib/components/Widget/Pagination/index.d.ts +2 -0
- package/src/lib/components/Widget/Search/WidgetSearch.d.ts +3 -0
- package/src/lib/components/Widget/Search/index.d.ts +2 -0
- package/src/lib/components/Widget/Table/WidgetTable.d.ts +3 -0
- package/src/lib/components/Widget/Table/index.d.ts +2 -0
- package/src/lib/components/Widget/Widget/Widget.d.ts +13 -0
- package/src/lib/components/Widget/Widget/index.d.ts +2 -0
- package/src/lib/components/Widget/WidgetFormActions/WidgetFormActions.d.ts +4 -0
- package/src/lib/components/Widget/WidgetFormActions/index.d.ts +2 -0
- package/src/lib/components/Widget/WidgetFormWrapper/WidgetFormWrapper.d.ts +4 -0
- package/src/lib/components/Widget/WidgetFormWrapper/index.d.ts +2 -0
- package/src/lib/components/Widget/index.d.ts +2 -0
- package/src/lib/components/common/Accordian/Accordian.d.ts +13 -0
- package/src/lib/components/common/Accordian/index.d.ts +2 -0
- package/src/lib/components/common/Button/Button.d.ts +4 -0
- package/src/lib/components/common/Button/index.d.ts +2 -0
- package/src/lib/components/common/ConfirmPopover/ConfirmPopover.d.ts +4 -0
- package/src/lib/components/common/ConfirmPopover/index.d.ts +2 -0
- package/src/lib/components/common/DNDItemsList/DNDItemsList.d.ts +4 -0
- package/src/lib/components/common/DNDItemsList/index.d.ts +2 -0
- package/src/lib/components/common/DeleteModal/DeleteModal.d.ts +4 -0
- package/src/lib/components/common/DeleteModal/index.d.ts +2 -0
- package/src/lib/components/common/Drawer/Drawer.d.ts +9 -0
- package/src/lib/components/common/Drawer/index.d.ts +2 -0
- package/src/lib/components/common/Form/Form.d.ts +15 -0
- package/src/lib/components/common/Form/SimpleForm.d.ts +17 -0
- package/src/lib/components/common/Form/index.d.ts +4 -0
- package/src/lib/components/common/FormActions/FormActions.d.ts +10 -0
- package/src/lib/components/common/FormActions/index.d.ts +2 -0
- package/src/lib/components/common/ImageUpload/ImageUpload.d.ts +4 -0
- package/src/lib/components/common/ImageUpload/index.d.ts +2 -0
- package/src/lib/components/common/Input/Checkbox.d.ts +4 -0
- package/src/lib/components/common/Input/Input.d.ts +4 -0
- package/src/lib/components/common/Input/ReactSelect.d.ts +4 -0
- package/src/lib/components/common/Input/Select.d.ts +4 -0
- package/src/lib/components/common/Input/SrcSet.d.ts +4 -0
- package/src/lib/components/common/Input/index.d.ts +12 -0
- package/src/lib/components/common/Modal/Modal.d.ts +8 -0
- package/src/lib/components/common/Modal/index.d.ts +2 -0
- package/src/lib/components/common/Pagination/Pagination.d.ts +4 -0
- package/src/lib/components/common/Pagination/index.d.ts +2 -0
- package/src/lib/components/common/Table/Table.d.ts +4 -0
- package/src/lib/components/common/Table/index.d.ts +2 -0
- package/src/lib/components/common/Toggle/Toggle.d.ts +4 -0
- package/src/lib/components/common/Toggle/index.d.ts +2 -0
- package/src/lib/constants/common.d.ts +113 -0
- package/src/lib/context/PageContext.d.ts +7 -0
- package/src/lib/context/ProviderContext.d.ts +5 -0
- package/src/lib/context/WidgetContext.d.ts +7 -0
- package/src/lib/helper/utils.d.ts +11 -0
- package/src/lib/hooks/usePage.d.ts +41 -0
- package/src/lib/hooks/usePagination.d.ts +27 -0
- package/src/lib/hooks/useWidget.d.ts +50 -0
- package/src/lib/icons/chevronDown.d.ts +4 -0
- package/src/lib/icons/chevronLeft.d.ts +4 -0
- package/src/lib/icons/chevronRight.d.ts +4 -0
- package/src/lib/icons/chevronUp.d.ts +4 -0
- package/src/lib/icons/close.d.ts +4 -0
- package/src/lib/icons/pencil.d.ts +4 -0
- package/src/lib/icons/plus.d.ts +4 -0
- package/src/lib/icons/trash.d.ts +4 -0
- package/src/lib/types/api.d.ts +34 -0
- package/src/lib/types/common.d.ts +25 -0
- package/src/lib/types/components.d.ts +307 -0
- package/src/lib/types/context.d.ts +98 -0
- package/src/lib/types/index.d.ts +4 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type ACTION_TYPES = 'IMAGE_UPLOAD' | 'IMAGE_REMOVE' | 'CREATE' | 'LIST' | 'DELETE' | 'UPDATE' | 'ITEM' | 'PARTIAL_UPDATE' | 'WIDGET_TYPES' | 'SELECTION_TYPES' | 'COLLECTION_DATA';
|
|
2
|
+
export type API_TYPE = {
|
|
3
|
+
url: string;
|
|
4
|
+
method: string;
|
|
5
|
+
};
|
|
6
|
+
export type API_INPUT_TYPE = {
|
|
7
|
+
prefix: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
};
|
|
10
|
+
export type Routes_Input = {
|
|
11
|
+
[K in ACTION_TYPES]?: (data: API_INPUT_TYPE) => API_TYPE;
|
|
12
|
+
};
|
|
13
|
+
export type ItemsType = {
|
|
14
|
+
value: string;
|
|
15
|
+
label: string;
|
|
16
|
+
};
|
|
17
|
+
export type WidgetType = {
|
|
18
|
+
value: string;
|
|
19
|
+
label: string;
|
|
20
|
+
};
|
|
21
|
+
export interface BaseAPIProps {
|
|
22
|
+
config?: any;
|
|
23
|
+
baseUrl: string;
|
|
24
|
+
token: string | (() => Promise<string>);
|
|
25
|
+
data?: any;
|
|
26
|
+
url: string;
|
|
27
|
+
method: string;
|
|
28
|
+
onError?: (error: Error) => void;
|
|
29
|
+
}
|
|
30
|
+
export interface ResponseType {
|
|
31
|
+
message: string;
|
|
32
|
+
code: 'SUCCESS' | 'FAILED';
|
|
33
|
+
data: any;
|
|
34
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type FormActionTypes = 'ADD' | 'UPDATE' | 'DELETE' | null | '';
|
|
2
|
+
export type TFunc = (key: string) => string;
|
|
3
|
+
export type OptionType = {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
};
|
|
7
|
+
export interface PermissionsObj {
|
|
8
|
+
list: boolean;
|
|
9
|
+
add: boolean;
|
|
10
|
+
update: boolean;
|
|
11
|
+
partialUpdate: boolean;
|
|
12
|
+
delete: boolean;
|
|
13
|
+
}
|
|
14
|
+
export type ObjectType = {
|
|
15
|
+
[key: string]: string;
|
|
16
|
+
};
|
|
17
|
+
export type CombineObjectType = {
|
|
18
|
+
[key: string]: string | boolean | number | string[] | null | Record<string | number, CombineObjectType> | CombineObjectType | CombineObjectType[];
|
|
19
|
+
};
|
|
20
|
+
export type ValuesType = string | boolean | number | string[];
|
|
21
|
+
export interface SrcSetItem {
|
|
22
|
+
screenSize: number | string;
|
|
23
|
+
width: number | string;
|
|
24
|
+
height: number | string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import React, { MutableRefObject } from 'react';
|
|
2
|
+
import { DropResult } from 'react-beautiful-dnd';
|
|
3
|
+
import { RegisterOptions } from 'react-hook-form';
|
|
4
|
+
import { Routes_Input } from './api';
|
|
5
|
+
import { OptionType, FormActionTypes, PermissionsObj, ObjectType } from './common';
|
|
6
|
+
export interface DNDItemsListProps {
|
|
7
|
+
onDragEnd: (result: DropResult) => void;
|
|
8
|
+
items: OptionType[];
|
|
9
|
+
listCode?: string;
|
|
10
|
+
formatItem?: (code: string, data: any) => JSX.Element;
|
|
11
|
+
}
|
|
12
|
+
export interface DrawerProps {
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
open: boolean;
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
id?: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
}
|
|
20
|
+
export type ButtonTypes = 'primary' | 'secondary' | 'success' | 'danger';
|
|
21
|
+
export type ButtonSizes = 'xs' | 'sm' | 'base' | 'lg';
|
|
22
|
+
export interface ButtonProps {
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
type?: ButtonTypes;
|
|
25
|
+
size?: ButtonSizes;
|
|
26
|
+
onClick?: () => void;
|
|
27
|
+
className?: string;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface IconProps {
|
|
31
|
+
srText?: string;
|
|
32
|
+
className?: string;
|
|
33
|
+
}
|
|
34
|
+
export type InputSizes = 'xs' | 'sm' | 'base' | 'lg';
|
|
35
|
+
export interface InputProps {
|
|
36
|
+
id?: string;
|
|
37
|
+
label?: string;
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
type?: string;
|
|
40
|
+
size?: InputSizes;
|
|
41
|
+
className?: string;
|
|
42
|
+
error?: string;
|
|
43
|
+
errors?: any;
|
|
44
|
+
required?: boolean;
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
rest?: any;
|
|
47
|
+
wrapperClassName?: string;
|
|
48
|
+
onInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
49
|
+
value?: string | number;
|
|
50
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
51
|
+
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
52
|
+
control?: any;
|
|
53
|
+
register?: any;
|
|
54
|
+
info?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface CheckboxProps {
|
|
57
|
+
rest?: any;
|
|
58
|
+
label?: string;
|
|
59
|
+
error?: string;
|
|
60
|
+
className?: string;
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
wrapperClassName?: string;
|
|
63
|
+
switchClass?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface SelectProps {
|
|
66
|
+
value?: string | number;
|
|
67
|
+
onChange?: (e: React.ChangeEvent<HTMLSelectElement>) => void;
|
|
68
|
+
label?: string;
|
|
69
|
+
error?: string;
|
|
70
|
+
options?: {
|
|
71
|
+
value: string;
|
|
72
|
+
label: string;
|
|
73
|
+
}[];
|
|
74
|
+
className?: string;
|
|
75
|
+
disabled?: boolean;
|
|
76
|
+
size?: InputSizes;
|
|
77
|
+
id?: string;
|
|
78
|
+
rest?: any;
|
|
79
|
+
required?: boolean;
|
|
80
|
+
wrapperClassName?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface ReactSelectProps {
|
|
83
|
+
onChange?: (opt: OptionType[] | OptionType | null) => void;
|
|
84
|
+
label?: string;
|
|
85
|
+
error?: string;
|
|
86
|
+
options?: {
|
|
87
|
+
value: string;
|
|
88
|
+
label: string;
|
|
89
|
+
}[];
|
|
90
|
+
className?: string;
|
|
91
|
+
disabled?: boolean;
|
|
92
|
+
id?: string;
|
|
93
|
+
isMulti?: boolean;
|
|
94
|
+
required?: boolean;
|
|
95
|
+
selectedOptions?: {
|
|
96
|
+
value: string;
|
|
97
|
+
label: string;
|
|
98
|
+
}[];
|
|
99
|
+
isLoading?: boolean;
|
|
100
|
+
isSearchable?: boolean;
|
|
101
|
+
placeholder?: string;
|
|
102
|
+
formatOptionLabel?: (code: string, data: any) => JSX.Element;
|
|
103
|
+
listCode?: string;
|
|
104
|
+
wrapperClassName?: string;
|
|
105
|
+
customStyles?: any;
|
|
106
|
+
loadOptions?: (value?: string, callback?: (options: OptionType[]) => void) => Promise<OptionType[]>;
|
|
107
|
+
selectKey?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface FormProps {
|
|
110
|
+
formRef: MutableRefObject<HTMLFormElement | null>;
|
|
111
|
+
}
|
|
112
|
+
export interface InputRendererProps {
|
|
113
|
+
field: import('react-hook-form').ControllerRenderProps;
|
|
114
|
+
error?: string;
|
|
115
|
+
setError: (msg: string) => void;
|
|
116
|
+
disabled?: boolean;
|
|
117
|
+
}
|
|
118
|
+
export interface WidgetProps {
|
|
119
|
+
t?: any;
|
|
120
|
+
loader?: any;
|
|
121
|
+
routes?: Routes_Input;
|
|
122
|
+
explicitForm?: boolean;
|
|
123
|
+
permissions?: PermissionsObj;
|
|
124
|
+
formatListItem?: (code: string, data: any) => JSX.Element;
|
|
125
|
+
formatOptionLabel?: (code: string, data: any) => JSX.Element;
|
|
126
|
+
preConfirmDelete?: (data: {
|
|
127
|
+
row: ObjectType;
|
|
128
|
+
}) => Promise<boolean>;
|
|
129
|
+
children?: JSX.Element;
|
|
130
|
+
reactSelectStyles?: any;
|
|
131
|
+
}
|
|
132
|
+
export interface FormWrapperProps {
|
|
133
|
+
children: (data: {
|
|
134
|
+
formState: FormActionTypes | undefined;
|
|
135
|
+
onClose: () => void;
|
|
136
|
+
open: boolean;
|
|
137
|
+
}) => JSX.Element | null;
|
|
138
|
+
}
|
|
139
|
+
export interface FormActionWrapperProps {
|
|
140
|
+
formRef: MutableRefObject<HTMLFormElement | null>;
|
|
141
|
+
}
|
|
142
|
+
export interface SchemaType extends ReactSelectProps {
|
|
143
|
+
label?: string;
|
|
144
|
+
accessor: string;
|
|
145
|
+
Input?: (props: InputRendererProps) => JSX.Element;
|
|
146
|
+
validations?: RegisterOptions;
|
|
147
|
+
editable?: boolean;
|
|
148
|
+
onInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
149
|
+
type?: 'text' | 'number' | 'select' | 'checkbox' | 'textarea' | 'file' | 'url' | 'ReactSelect' | 'srcset' | 'color';
|
|
150
|
+
options?: {
|
|
151
|
+
value: string;
|
|
152
|
+
label: string;
|
|
153
|
+
}[];
|
|
154
|
+
selectedOptions?: {
|
|
155
|
+
value: string;
|
|
156
|
+
label: string;
|
|
157
|
+
}[];
|
|
158
|
+
isMulti?: boolean;
|
|
159
|
+
placeholder?: string;
|
|
160
|
+
required?: boolean;
|
|
161
|
+
onChange?: (e: any) => void;
|
|
162
|
+
show?: boolean;
|
|
163
|
+
wrapperClassName?: string;
|
|
164
|
+
switchClass?: string;
|
|
165
|
+
info?: string;
|
|
166
|
+
customStyles?: any;
|
|
167
|
+
}
|
|
168
|
+
export interface PageProps {
|
|
169
|
+
t?: any;
|
|
170
|
+
loader?: any;
|
|
171
|
+
explicitForm?: boolean;
|
|
172
|
+
children?: JSX.Element;
|
|
173
|
+
permissions?: PermissionsObj;
|
|
174
|
+
preConfirmDelete?: (data: {
|
|
175
|
+
row: ObjectType;
|
|
176
|
+
}) => Promise<boolean>;
|
|
177
|
+
}
|
|
178
|
+
export interface PaginationProps {
|
|
179
|
+
totalPages: number;
|
|
180
|
+
totalRecords: number;
|
|
181
|
+
currentPage: number;
|
|
182
|
+
pageSize: number;
|
|
183
|
+
setCurrentPage: (value: number) => void;
|
|
184
|
+
showingText?: string;
|
|
185
|
+
pageText?: string;
|
|
186
|
+
ofText?: string;
|
|
187
|
+
previousContent?: string | React.ReactNode;
|
|
188
|
+
nextContent?: string | React.ReactNode;
|
|
189
|
+
}
|
|
190
|
+
export interface ItemsAccordianProps {
|
|
191
|
+
id: string;
|
|
192
|
+
show: boolean;
|
|
193
|
+
title: string;
|
|
194
|
+
itemsData: any[];
|
|
195
|
+
widgetId: string;
|
|
196
|
+
collapseId: string;
|
|
197
|
+
schema: SchemaType[];
|
|
198
|
+
itemType: 'Web' | 'Mobile';
|
|
199
|
+
toggleShow: (status: boolean) => void;
|
|
200
|
+
onDataSubmit: (state: FormActionTypes, data: any, updateId?: string) => void;
|
|
201
|
+
onDelete: (id: string) => void;
|
|
202
|
+
addText?: string;
|
|
203
|
+
editText?: string;
|
|
204
|
+
cancelText?: string;
|
|
205
|
+
deleteText?: string;
|
|
206
|
+
saveText?: string;
|
|
207
|
+
}
|
|
208
|
+
export interface TabItemProps {
|
|
209
|
+
showDelete?: boolean;
|
|
210
|
+
isDisabled?: boolean;
|
|
211
|
+
deleteTitle: string;
|
|
212
|
+
onRemoveTab: () => void;
|
|
213
|
+
register?: any;
|
|
214
|
+
noButtonText: string;
|
|
215
|
+
yesButtonText: string;
|
|
216
|
+
}
|
|
217
|
+
export interface TabsProps {
|
|
218
|
+
activeTab: number;
|
|
219
|
+
setActiveTab: (value: number) => void;
|
|
220
|
+
onSubmit?: () => void;
|
|
221
|
+
control: any;
|
|
222
|
+
register: any;
|
|
223
|
+
options?: {
|
|
224
|
+
value: string;
|
|
225
|
+
label: string;
|
|
226
|
+
}[];
|
|
227
|
+
deleteTitle: string;
|
|
228
|
+
listCode: string;
|
|
229
|
+
noButtonText: string;
|
|
230
|
+
yesButtonText: string;
|
|
231
|
+
itemsPlaceholder?: string;
|
|
232
|
+
formatOptionLabel?: (code: string, data: any) => JSX.Element;
|
|
233
|
+
isItemsLoading?: boolean;
|
|
234
|
+
formatItem?: (code: string, data: any) => JSX.Element;
|
|
235
|
+
onCollectionItemsIndexChange: (index: number, data: DropResult) => void;
|
|
236
|
+
tabCollectionItems: any[];
|
|
237
|
+
customStyles?: any;
|
|
238
|
+
loadOptions?: (value?: string, callback?: (options: OptionType[]) => void) => Promise<OptionType[]>;
|
|
239
|
+
}
|
|
240
|
+
export interface ImageUploadProps {
|
|
241
|
+
className?: string;
|
|
242
|
+
text: string | JSX.Element;
|
|
243
|
+
maxSize: number;
|
|
244
|
+
imgId?: string | ObjectType;
|
|
245
|
+
setImgId: (value?: string | null) => void;
|
|
246
|
+
clearError?: () => void;
|
|
247
|
+
onError: (msg: string) => void;
|
|
248
|
+
onImageUpload: (file: File) => Promise<{
|
|
249
|
+
fileUrl: string;
|
|
250
|
+
fileId: string;
|
|
251
|
+
fileUri: string;
|
|
252
|
+
} | void>;
|
|
253
|
+
onImageRemove?: (id: string) => Promise<void>;
|
|
254
|
+
baseUrl: string;
|
|
255
|
+
error?: string;
|
|
256
|
+
disabled?: boolean;
|
|
257
|
+
}
|
|
258
|
+
export interface ToggleProps {
|
|
259
|
+
isChecked?: boolean;
|
|
260
|
+
disabled?: boolean;
|
|
261
|
+
onChange?: (status: boolean) => void;
|
|
262
|
+
switchClass?: string;
|
|
263
|
+
}
|
|
264
|
+
export interface ConfirmPopoverProps {
|
|
265
|
+
children?: JSX.Element;
|
|
266
|
+
onConfirm: () => void;
|
|
267
|
+
confirmText?: string;
|
|
268
|
+
cancelText?: string;
|
|
269
|
+
title: string;
|
|
270
|
+
}
|
|
271
|
+
export interface DeleteModalProps {
|
|
272
|
+
formState: FormActionTypes | undefined;
|
|
273
|
+
onClose: () => void;
|
|
274
|
+
itemData: ObjectType;
|
|
275
|
+
onConfirmDelete: () => void;
|
|
276
|
+
confirmationRequired?: string;
|
|
277
|
+
permanentlyDelete?: string;
|
|
278
|
+
lossOfData?: string;
|
|
279
|
+
pleaseType?: string;
|
|
280
|
+
toProceedOrCancel?: string;
|
|
281
|
+
confirm?: string;
|
|
282
|
+
typeHerePlaceholder?: string;
|
|
283
|
+
}
|
|
284
|
+
export type CellInputType = (parameters: {
|
|
285
|
+
row: any;
|
|
286
|
+
onUpdate?: (row: any) => void;
|
|
287
|
+
}) => JSX.Element | null | string;
|
|
288
|
+
export type TableDataItemFormat = {
|
|
289
|
+
label: string;
|
|
290
|
+
dataKey: string;
|
|
291
|
+
highlight?: boolean;
|
|
292
|
+
Cell?: CellInputType;
|
|
293
|
+
};
|
|
294
|
+
export interface TableProps {
|
|
295
|
+
data: any[];
|
|
296
|
+
dataKeys: TableDataItemFormat[];
|
|
297
|
+
loading?: boolean;
|
|
298
|
+
loader?: any;
|
|
299
|
+
actions?: {
|
|
300
|
+
edit?: ((data: {
|
|
301
|
+
[key: string]: any;
|
|
302
|
+
}) => void) | boolean;
|
|
303
|
+
delete?: ((data: {
|
|
304
|
+
[key: string]: any;
|
|
305
|
+
}) => void) | boolean;
|
|
306
|
+
};
|
|
307
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { WidgetType, ItemsType } from './api';
|
|
3
|
+
import { FormActionTypes, OptionType } from './common';
|
|
4
|
+
export interface ProviderContextType {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
token: string | (() => Promise<string>);
|
|
7
|
+
onError: (callback_code: import('../constants/common').CALLBACK_CODES, code: string, message: string) => void;
|
|
8
|
+
onSuccess: (callback_code: import('../constants/common').CALLBACK_CODES, code: string, message: string) => void;
|
|
9
|
+
switchClass: string;
|
|
10
|
+
onLogout: () => void;
|
|
11
|
+
widgetRoutesPrefix: string;
|
|
12
|
+
itemsRoutesPrefix: string;
|
|
13
|
+
pageRoutesPrefix: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ProviderContextProviderProps extends React.PropsWithChildren, Omit<ProviderContextType, 'onError' | 'onSuccess' | 'onLogout' | 'widgetRoutesPrefix' | 'itemsRoutesPrefix' | 'pageRoutesPrefix' | 'switchClass'> {
|
|
16
|
+
onError?: (callback_code: import('../constants/common').CALLBACK_CODES, code: string, message: string) => void;
|
|
17
|
+
onSuccess?: (callback_code: import('../constants/common').CALLBACK_CODES, code: string, message: string) => void;
|
|
18
|
+
onLogout?: () => void;
|
|
19
|
+
switchClass?: string;
|
|
20
|
+
widgetRoutesPrefix?: string;
|
|
21
|
+
itemsRoutesPrefix?: string;
|
|
22
|
+
pageRoutesPrefix?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface WidgetContextType {
|
|
25
|
+
t: (key: string) => string;
|
|
26
|
+
list: any[];
|
|
27
|
+
formState: FormActionTypes | undefined;
|
|
28
|
+
closeForm: () => void;
|
|
29
|
+
onWidgetFormSubmit: (data: any) => void;
|
|
30
|
+
onChangeFormState: (status: FormActionTypes, data?: any) => void;
|
|
31
|
+
updateData: any;
|
|
32
|
+
loading: boolean;
|
|
33
|
+
canAdd: boolean;
|
|
34
|
+
canUpdate: boolean;
|
|
35
|
+
onDeleteItem: (id: string) => void;
|
|
36
|
+
getWidgets: (searchText: string) => void;
|
|
37
|
+
onImageUpload: (file: File) => Promise<{
|
|
38
|
+
fileUrl: string;
|
|
39
|
+
fileId: string;
|
|
40
|
+
fileUri: string;
|
|
41
|
+
} | void>;
|
|
42
|
+
onImageRemove: (id: string) => Promise<void>;
|
|
43
|
+
itemsTypes: ItemsType[];
|
|
44
|
+
widgetTypes: WidgetType[];
|
|
45
|
+
getCollectionData: (collectionName: string, search?: string, callback?: (options: OptionType[]) => void, collectionItems?: string[]) => Promise<void>;
|
|
46
|
+
collectionDataLoading: boolean;
|
|
47
|
+
collectionData: any[];
|
|
48
|
+
formatListItem?: (code: string, data: any) => JSX.Element;
|
|
49
|
+
formatOptionLabel?: (code: string, data: any) => JSX.Element;
|
|
50
|
+
currentPage: number;
|
|
51
|
+
setCurrentPage: (page: number) => void;
|
|
52
|
+
totalPages: number;
|
|
53
|
+
pageSize: number;
|
|
54
|
+
setPageSize: (size: number) => void;
|
|
55
|
+
totalRecords: number;
|
|
56
|
+
limits: number[];
|
|
57
|
+
canList: boolean;
|
|
58
|
+
canPartialUpdate: boolean;
|
|
59
|
+
columns: any[];
|
|
60
|
+
data: any;
|
|
61
|
+
loader?: JSX.Element;
|
|
62
|
+
canDelete?: boolean;
|
|
63
|
+
onPartialUpdateWidget: (data: any, id: string) => Promise<void>;
|
|
64
|
+
webItems: any[];
|
|
65
|
+
mobileItems: any[];
|
|
66
|
+
itemsLoading: boolean;
|
|
67
|
+
onItemFormSubmit: (state: FormActionTypes, data: any) => void;
|
|
68
|
+
reactSelectStyles?: any;
|
|
69
|
+
}
|
|
70
|
+
export interface PageContextType {
|
|
71
|
+
t: (key: string) => string;
|
|
72
|
+
list: any[];
|
|
73
|
+
getWidgets: (callback?: (data: any) => void) => void;
|
|
74
|
+
formState: FormActionTypes | undefined;
|
|
75
|
+
closeForm: () => void;
|
|
76
|
+
onPageFormSubmit: (data: any) => void;
|
|
77
|
+
onChangeFormState: (status: FormActionTypes, data?: any) => void;
|
|
78
|
+
loading: boolean;
|
|
79
|
+
canAdd: boolean;
|
|
80
|
+
canUpdate: boolean;
|
|
81
|
+
widgets: any[];
|
|
82
|
+
selectedWidgets: OptionType[];
|
|
83
|
+
setSelectedWidgets: (widgets: OptionType[]) => void;
|
|
84
|
+
onChangeWidgetSequence: (souceIndex: number, destinationIndex: number) => void;
|
|
85
|
+
getPages: (searchText: string) => void;
|
|
86
|
+
currentPage: number;
|
|
87
|
+
setCurrentPage: (page: number) => void;
|
|
88
|
+
totalPages: number;
|
|
89
|
+
pageSize: number;
|
|
90
|
+
setPageSize: (size: number) => void;
|
|
91
|
+
totalRecords: number;
|
|
92
|
+
limits: number[];
|
|
93
|
+
canList: boolean;
|
|
94
|
+
columns: any[];
|
|
95
|
+
data: any;
|
|
96
|
+
loader?: JSX.Element;
|
|
97
|
+
canDelete?: boolean;
|
|
98
|
+
}
|