@knovator/pagecreator-admin 1.2.9 → 1.3.1
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 +7878 -0
- package/index.css +2 -0
- package/index.js +7864 -0
- package/package.json +42 -38
- package/src/{index.ts → index.d.ts} +0 -1
- package/src/lib/api/index.d.ts +10 -0
- package/src/lib/api/list.d.ts +56 -0
- package/src/lib/components/Page/AddButton/AddButton.d.ts +3 -0
- package/src/lib/components/Page/AddButton/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/Page/Form/PageForm.d.ts +4 -0
- package/src/lib/components/Page/Form/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/Page/Page/Page.d.ts +13 -0
- package/src/lib/components/Page/Page/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/Page/PageFormActions/PageFormActions.d.ts +4 -0
- package/src/lib/components/Page/PageFormActions/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/Page/PageFormWrapper/PageFormWrapper.d.ts +4 -0
- package/src/lib/components/Page/PageFormWrapper/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/Page/Pagination/PagePagination.d.ts +3 -0
- package/src/lib/components/Page/Pagination/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/Page/Search/PageSearch.d.ts +3 -0
- package/src/lib/components/Page/Search/{index.tsx → index.d.ts} +0 -1
- package/src/lib/components/Page/Table/PageTable.d.ts +4 -0
- package/src/lib/components/Page/Table/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/Page/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/Widget/AddButton/AddButton.d.ts +3 -0
- package/src/lib/components/Widget/AddButton/{index.ts → index.d.ts} +0 -1
- 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.ts → index.d.ts} +0 -1
- package/src/lib/components/Widget/Form/WidgetForm.d.ts +4 -0
- package/src/lib/components/Widget/Form/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/Widget/Pagination/WidgetPagination.d.ts +3 -0
- package/src/lib/components/Widget/Pagination/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/Widget/Search/WidgetSearch.d.ts +3 -0
- package/src/lib/components/Widget/Search/{index.tsx → index.d.ts} +0 -1
- package/src/lib/components/Widget/Table/WidgetTable.d.ts +4 -0
- package/src/lib/components/Widget/Table/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/Widget/Widget/Widget.d.ts +13 -0
- package/src/lib/components/Widget/Widget/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/Widget/WidgetFormActions/WidgetFormActions.d.ts +4 -0
- package/src/lib/components/Widget/WidgetFormActions/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/Widget/WidgetFormWrapper/WidgetFormWrapper.d.ts +4 -0
- package/src/lib/components/Widget/WidgetFormWrapper/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/Widget/{index.tsx → index.d.ts} +0 -1
- package/src/lib/components/common/Accordian/Accordian.d.ts +13 -0
- package/src/lib/components/common/Accordian/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/common/Button/Button.d.ts +4 -0
- package/src/lib/components/common/Button/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/common/ConfirmPopover/ConfirmPopover.d.ts +4 -0
- package/src/lib/components/common/ConfirmPopover/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/common/DNDItemsList/DNDItemsList.d.ts +4 -0
- package/src/lib/components/common/DNDItemsList/{index.ts → index.d.ts} +0 -1
- 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.ts → index.d.ts} +0 -1
- package/src/lib/components/common/Form/Form.d.ts +15 -0
- package/src/lib/components/common/Form/SimpleForm.d.ts +18 -0
- package/src/lib/components/common/Form/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/common/FormActions/FormActions.d.ts +10 -0
- package/src/lib/components/common/FormActions/{index.ts → index.d.ts} +0 -1
- 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.ts → index.d.ts} +0 -1
- package/src/lib/components/common/Table/Table.d.ts +4 -0
- package/src/lib/components/common/Table/{index.ts → index.d.ts} +0 -1
- package/src/lib/components/common/Toggle/Toggle.d.ts +4 -0
- package/src/lib/components/common/Toggle/{index.ts → index.d.ts} +0 -1
- package/src/lib/constants/common.d.ts +122 -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 +10 -0
- package/src/lib/hooks/usePage.d.ts +37 -0
- package/src/lib/hooks/usePagination.d.ts +15 -0
- package/src/lib/hooks/useWidget.d.ts +46 -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/settings.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 +30 -0
- package/src/lib/types/components.d.ts +422 -0
- package/src/lib/types/context.d.ts +135 -0
- package/index.d.ts +0 -1
- package/src/lib/api/index.ts +0 -70
- package/src/lib/api/list.ts +0 -59
- package/src/lib/components/Page/AddButton/AddButton.tsx +0 -16
- package/src/lib/components/Page/Form/PageForm.tsx +0 -194
- package/src/lib/components/Page/Page/Page.tsx +0 -151
- package/src/lib/components/Page/PageFormActions/PageFormActions.tsx +0 -50
- package/src/lib/components/Page/PageFormWrapper/PageFormWrapper.tsx +0 -16
- package/src/lib/components/Page/Pagination/PagePagination.tsx +0 -26
- package/src/lib/components/Page/Search/PageSearch.tsx +0 -32
- package/src/lib/components/Page/Table/PageTable.tsx +0 -36
- package/src/lib/components/Widget/AddButton/AddButton.tsx +0 -16
- package/src/lib/components/Widget/Form/ItemsAccordian.tsx +0 -354
- package/src/lib/components/Widget/Form/Tabs/TabItem.tsx +0 -43
- package/src/lib/components/Widget/Form/Tabs/Tabs.tsx +0 -190
- package/src/lib/components/Widget/Form/WidgetForm.tsx +0 -771
- package/src/lib/components/Widget/Pagination/WidgetPagination.tsx +0 -26
- package/src/lib/components/Widget/Search/WidgetSearch.tsx +0 -32
- package/src/lib/components/Widget/Table/WidgetTable.tsx +0 -70
- package/src/lib/components/Widget/Widget/Widget.tsx +0 -173
- package/src/lib/components/Widget/WidgetFormActions/WidgetFormActions.tsx +0 -50
- package/src/lib/components/Widget/WidgetFormWrapper/WidgetFormWrapper.tsx +0 -16
- package/src/lib/components/common/Accordian/Accordian.tsx +0 -56
- package/src/lib/components/common/Button/Button.tsx +0 -45
- package/src/lib/components/common/ConfirmPopover/ConfirmPopover.tsx +0 -47
- package/src/lib/components/common/DNDItemsList/DNDItemsList.tsx +0 -77
- package/src/lib/components/common/DeleteModal/DeleteModal.tsx +0 -72
- package/src/lib/components/common/DeleteModal/index.tsx +0 -3
- package/src/lib/components/common/Drawer/Drawer.tsx +0 -79
- package/src/lib/components/common/Form/Form.tsx +0 -256
- package/src/lib/components/common/Form/SimpleForm.tsx +0 -314
- package/src/lib/components/common/FormActions/FormActions.tsx +0 -37
- package/src/lib/components/common/ImageUpload/ImageUpload.tsx +0 -113
- package/src/lib/components/common/ImageUpload/index.tsx +0 -3
- package/src/lib/components/common/Input/Checkbox.tsx +0 -25
- package/src/lib/components/common/Input/Input.tsx +0 -51
- package/src/lib/components/common/Input/ReactSelect.tsx +0 -61
- package/src/lib/components/common/Input/Select.tsx +0 -47
- package/src/lib/components/common/Input/SrcSet.tsx +0 -143
- package/src/lib/components/common/Input/index.ts +0 -20
- package/src/lib/components/common/Modal/Modal.tsx +0 -57
- package/src/lib/components/common/Modal/index.tsx +0 -3
- package/src/lib/components/common/Pagination/Pagination.tsx +0 -88
- package/src/lib/components/common/Table/Table.tsx +0 -133
- package/src/lib/components/common/Toggle/Toggle.tsx +0 -23
- package/src/lib/constants/common.ts +0 -145
- package/src/lib/context/PageContext.tsx +0 -100
- package/src/lib/context/ProviderContext.tsx +0 -52
- package/src/lib/context/WidgetContext.tsx +0 -127
- package/src/lib/helper/utils.ts +0 -46
- package/src/lib/hooks/usePage.tsx +0 -306
- package/src/lib/hooks/usePagination.tsx +0 -41
- package/src/lib/hooks/useWidget.tsx +0 -503
- package/src/lib/icons/chevronDown.tsx +0 -21
- package/src/lib/icons/chevronLeft.tsx +0 -20
- package/src/lib/icons/chevronRight.tsx +0 -20
- package/src/lib/icons/chevronUp.tsx +0 -21
- package/src/lib/icons/close.tsx +0 -21
- package/src/lib/icons/pencil.tsx +0 -21
- package/src/lib/icons/plus.tsx +0 -23
- package/src/lib/icons/settings.tsx +0 -35
- package/src/lib/icons/trash.tsx +0 -21
- package/src/lib/types/api.ts +0 -44
- package/src/lib/types/common.ts +0 -31
- package/src/lib/types/components.ts +0 -428
- package/src/lib/types/context.ts +0 -184
- package/src/styles/index.css +0 -481
- /package/src/lib/types/{index.ts → index.d.ts} +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
declare const DEFAULT_OFFSET_PAYLOAD = 0;
|
|
2
|
+
declare const DECIMAL_REDIX = 10;
|
|
3
|
+
declare const DEFAULT_CURRENT_PAGE = 1;
|
|
4
|
+
declare const INTERNAL_ERROR_CODE = "INTERNAL_ERROR";
|
|
5
|
+
declare const DEFAULT_LIMIT = 10;
|
|
6
|
+
declare const PAGE_LIMITS: number[];
|
|
7
|
+
declare enum CALLBACK_CODES {
|
|
8
|
+
'GET_ALL' = "GET_ALL",
|
|
9
|
+
'GET_SINGLE' = "GET_SINGLE",
|
|
10
|
+
'CREATE' = "CREATE",
|
|
11
|
+
'UPDATE' = "UPDATE",
|
|
12
|
+
'PARTIAL_UPDATE' = "PARTIAL_UPDATE",
|
|
13
|
+
'DELETE' = "DELETE",
|
|
14
|
+
'IMAGE_UPLOAD' = "IMAGE_UPLOAD",
|
|
15
|
+
'IMAGE_REMOVE' = "IMAGE_REMOVE",
|
|
16
|
+
'INTERNAL' = "INTERNAL"
|
|
17
|
+
}
|
|
18
|
+
declare const CONSTANTS: {
|
|
19
|
+
EMPTY_REGEX: RegExp;
|
|
20
|
+
SLUG_REGEX: RegExp;
|
|
21
|
+
SLUG_REPLACE_REGEX: RegExp;
|
|
22
|
+
};
|
|
23
|
+
declare const DEFAULT_PERMISSIONS: {
|
|
24
|
+
list: boolean;
|
|
25
|
+
add: boolean;
|
|
26
|
+
delete: boolean;
|
|
27
|
+
partialUpdate: boolean;
|
|
28
|
+
update: boolean;
|
|
29
|
+
};
|
|
30
|
+
declare const TRANSLATION_PAIRS_COMMON: {
|
|
31
|
+
confirmationRequired: string;
|
|
32
|
+
permanentlyDelete: string;
|
|
33
|
+
lossOfData: string;
|
|
34
|
+
pleaseType: string;
|
|
35
|
+
toProceedOrCancel: string;
|
|
36
|
+
confirm: string;
|
|
37
|
+
next: string;
|
|
38
|
+
previous: string;
|
|
39
|
+
page: string;
|
|
40
|
+
indicatesRequired: string;
|
|
41
|
+
cancel: string;
|
|
42
|
+
yes: string;
|
|
43
|
+
delete: string;
|
|
44
|
+
create: string;
|
|
45
|
+
update: string;
|
|
46
|
+
showing: string;
|
|
47
|
+
add: string;
|
|
48
|
+
of: string;
|
|
49
|
+
typeHerePlaceholder: string;
|
|
50
|
+
code: string;
|
|
51
|
+
codePlaceholder: string;
|
|
52
|
+
codeRequired: string;
|
|
53
|
+
name: string;
|
|
54
|
+
namePlaceholder: string;
|
|
55
|
+
nameRequired: string;
|
|
56
|
+
title: string;
|
|
57
|
+
titlePlaceholder: string;
|
|
58
|
+
titleRequired: string;
|
|
59
|
+
active: string;
|
|
60
|
+
actions: string;
|
|
61
|
+
};
|
|
62
|
+
declare const TRANSLATION_PAIRS_WIDGET: {
|
|
63
|
+
itemsType: string;
|
|
64
|
+
itemsTypePlaceholder: string;
|
|
65
|
+
widgetType: string;
|
|
66
|
+
widgetTypeRequired: string;
|
|
67
|
+
color: string;
|
|
68
|
+
webPerRow: string;
|
|
69
|
+
webPerRowPlaceholder: string;
|
|
70
|
+
mobilePerRow: string;
|
|
71
|
+
mobilePerRowPlaceholder: string;
|
|
72
|
+
tabletPerRow: string;
|
|
73
|
+
tabletPerRowPlaceholder: string;
|
|
74
|
+
mobileItems: string;
|
|
75
|
+
webItems: string;
|
|
76
|
+
searchPlaceholder: string;
|
|
77
|
+
autoPlay: string;
|
|
78
|
+
addWidgetTitle: string;
|
|
79
|
+
updateWidgetTitle: string;
|
|
80
|
+
webPerRowRequired: string;
|
|
81
|
+
tabletPerRowRequired: string;
|
|
82
|
+
mobilePerRowRequired: string;
|
|
83
|
+
tabDeleteTitle: string;
|
|
84
|
+
widgetTitleInfo: string;
|
|
85
|
+
minPerRow: string;
|
|
86
|
+
tabNameRequired: string;
|
|
87
|
+
subtitle: string;
|
|
88
|
+
subTitlePlaceholder: string;
|
|
89
|
+
altText: string;
|
|
90
|
+
altTextPlaceholder: string;
|
|
91
|
+
link: string;
|
|
92
|
+
linkPlaceholder: string;
|
|
93
|
+
image: string;
|
|
94
|
+
uploadFile: string;
|
|
95
|
+
dragDrop: string;
|
|
96
|
+
allowedFormat: string;
|
|
97
|
+
srcset: string;
|
|
98
|
+
screenSizeRequired: string;
|
|
99
|
+
widthRequired: string;
|
|
100
|
+
heightRequired: string;
|
|
101
|
+
minScreenSize: string;
|
|
102
|
+
minWidth: string;
|
|
103
|
+
minHeight: string;
|
|
104
|
+
deleteTitle: string;
|
|
105
|
+
htmlContent: string;
|
|
106
|
+
htmlContentPlaceholder: string;
|
|
107
|
+
htmlContentRequired: string;
|
|
108
|
+
textContent: string;
|
|
109
|
+
textContentRequired: string;
|
|
110
|
+
textContentInfo: string;
|
|
111
|
+
textContentPlaceholder: string;
|
|
112
|
+
};
|
|
113
|
+
declare const TRANSLATION_PAIRS_PAGE: {
|
|
114
|
+
widgets: string;
|
|
115
|
+
slug: string;
|
|
116
|
+
slugPlaceholder: string;
|
|
117
|
+
slugRequired: string;
|
|
118
|
+
addPage: string;
|
|
119
|
+
updatePage: string;
|
|
120
|
+
searchPages: string;
|
|
121
|
+
};
|
|
122
|
+
export { CONSTANTS, CALLBACK_CODES, DECIMAL_REDIX, DEFAULT_CURRENT_PAGE, DEFAULT_OFFSET_PAYLOAD, INTERNAL_ERROR_CODE, DEFAULT_PERMISSIONS, TRANSLATION_PAIRS_COMMON, DEFAULT_LIMIT, PAGE_LIMITS, TRANSLATION_PAIRS_WIDGET, TRANSLATION_PAIRS_PAGE, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PageContextType } from '../types';
|
|
3
|
+
interface PageContextProviderProps extends React.PropsWithChildren, Partial<PageContextType> {
|
|
4
|
+
}
|
|
5
|
+
declare const PageContextProvider: ({ searchText, changeSearch, list, widgets, formState, closeForm, getPages, loading, getWidgets, onChangeFormState, onPageFormSubmit, canAdd, canUpdate, selectedWidgets, setSelectedWidgets, onChangeWidgetSequence, currentPage, limits, pageSize, setCurrentPage, setPageSize, totalPages, totalRecords, canList, columns, data, canDelete, loader, pageTranslations, children, }: PageContextProviderProps) => JSX.Element;
|
|
6
|
+
export declare function usePageState(): PageContextType;
|
|
7
|
+
export default PageContextProvider;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ProviderContextProviderProps, ProviderContextType } from '../types';
|
|
3
|
+
declare const Provider: ({ children, baseUrl, token, translations, onError, onSuccess, onLogout, switchClass, widgetRoutesPrefix, pageRoutesPrefix, }: ProviderContextProviderProps) => JSX.Element;
|
|
4
|
+
export declare function useProviderState(): ProviderContextType;
|
|
5
|
+
export default Provider;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WidgetContextType } from '../types';
|
|
3
|
+
interface WidgetContextProviderProps extends React.PropsWithChildren, Partial<WidgetContextType> {
|
|
4
|
+
}
|
|
5
|
+
declare const WidgetContextProvider: ({ list, languages, imageBaseUrl, searchText, changeSearch, formState, closeForm, loading, onChangeFormState, onWidgetFormSubmit, updateData, canAdd, canUpdate, onDeleteItem, getWidgets, onImageUpload, onImageRemove, itemsTypes, widgetTypes, getCollectionData, collectionDataLoading, collectionData, formatListItem, formatOptionLabel, currentPage, limits, pageSize, setCurrentPage, setPageSize, totalPages, totalRecords, canList, canPartialUpdate, columns, data, canDelete, loader, onPartialUpdateWidget, reactSelectStyles, imageMaxSize, widgetTranslations, children, }: WidgetContextProviderProps) => JSX.Element;
|
|
6
|
+
export declare function useWidgetState(): WidgetContextType;
|
|
7
|
+
export default WidgetContextProvider;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const paginationDataGatter: (data: any) => any;
|
|
2
|
+
export declare const dataGatter: (data: any) => any;
|
|
3
|
+
export declare const capitalizeFirstLetter: (string?: string) => string;
|
|
4
|
+
export declare const changeToCode: (string?: string) => string;
|
|
5
|
+
export declare const changeToSlug: (string?: string) => string;
|
|
6
|
+
export declare const isObject: (data: any) => boolean;
|
|
7
|
+
export declare const isString: (data: any) => boolean;
|
|
8
|
+
export declare const isArray: (data: any) => boolean;
|
|
9
|
+
export declare const isEmpty: (data: any) => boolean;
|
|
10
|
+
export declare const build_path: (...args: string[]) => string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormActionTypes, ObjectType, OptionType, Routes_Input } from '../types';
|
|
3
|
+
interface UsePageProps {
|
|
4
|
+
canList?: boolean;
|
|
5
|
+
defaultLimit: number;
|
|
6
|
+
routes?: Routes_Input;
|
|
7
|
+
preConfirmDelete?: (data: {
|
|
8
|
+
row: ObjectType;
|
|
9
|
+
}) => Promise<boolean>;
|
|
10
|
+
}
|
|
11
|
+
declare const usePage: ({ routes, defaultLimit, canList, preConfirmDelete, }: UsePageProps) => {
|
|
12
|
+
list: ObjectType[];
|
|
13
|
+
getPages: (search?: string) => Promise<void>;
|
|
14
|
+
loading: boolean;
|
|
15
|
+
setLoading: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
16
|
+
searchText: string;
|
|
17
|
+
changeSearch: (value: string) => void;
|
|
18
|
+
pageSize: number;
|
|
19
|
+
totalPages: number;
|
|
20
|
+
currentPage: number;
|
|
21
|
+
totalRecords: number;
|
|
22
|
+
setCurrentPage: (page: number) => void;
|
|
23
|
+
setPageSize: (value: number) => void;
|
|
24
|
+
widgets: ObjectType[];
|
|
25
|
+
itemData: any;
|
|
26
|
+
formState: FormActionTypes | undefined;
|
|
27
|
+
getWidgets: (search?: string, collectionItems?: string[], callback?: ((data: any) => void) | undefined) => Promise<void>;
|
|
28
|
+
onCloseForm: () => void;
|
|
29
|
+
widgetsLoading: boolean;
|
|
30
|
+
selectedWidgets: OptionType[];
|
|
31
|
+
setSelectedWidgets: import("react").Dispatch<import("react").SetStateAction<OptionType[]>>;
|
|
32
|
+
onPageFormSubmit: (data: ObjectType) => Promise<void>;
|
|
33
|
+
onChangeFormState: (state: FormActionTypes, data?: any) => void;
|
|
34
|
+
onCofirmDeletePage: () => Promise<void>;
|
|
35
|
+
onChangeWidgetSequence: (sourceIndex: number, destinationIndex: number) => void;
|
|
36
|
+
};
|
|
37
|
+
export default usePage;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface UsePaginationProps {
|
|
3
|
+
defaultLimit?: number;
|
|
4
|
+
}
|
|
5
|
+
declare const usePagination: ({ defaultLimit }: UsePaginationProps) => {
|
|
6
|
+
pageSize: number;
|
|
7
|
+
currentPageRef: import("react").MutableRefObject<number>;
|
|
8
|
+
limitRef: import("react").MutableRefObject<number>;
|
|
9
|
+
offsetRef: import("react").MutableRefObject<number>;
|
|
10
|
+
searchRef: import("react").MutableRefObject<string>;
|
|
11
|
+
setPageSize: (value: number) => void;
|
|
12
|
+
changeSearch: (value: string) => void;
|
|
13
|
+
setCurrentPage: (value: number) => void;
|
|
14
|
+
};
|
|
15
|
+
export default usePagination;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Routes_Input, WidgetType, ItemsType } from '../types';
|
|
3
|
+
import { FormActionTypes, ObjectType, LanguageType } from '../types/common';
|
|
4
|
+
interface UseWidgetProps {
|
|
5
|
+
canList?: boolean;
|
|
6
|
+
defaultLimit: number;
|
|
7
|
+
routes?: Routes_Input;
|
|
8
|
+
preConfirmDelete?: (data: {
|
|
9
|
+
row: ObjectType;
|
|
10
|
+
}) => Promise<boolean>;
|
|
11
|
+
imageBaseUrl?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const useWidget: ({ canList, defaultLimit, routes, preConfirmDelete, imageBaseUrl, }: UseWidgetProps) => {
|
|
14
|
+
list: ObjectType[];
|
|
15
|
+
getWidgets: (search?: string) => Promise<void>;
|
|
16
|
+
loading: boolean;
|
|
17
|
+
languages: LanguageType[];
|
|
18
|
+
setLoading: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
19
|
+
searchText: string;
|
|
20
|
+
pageSize: number;
|
|
21
|
+
totalPages: number;
|
|
22
|
+
currentPage: number;
|
|
23
|
+
totalRecords: number;
|
|
24
|
+
setCurrentPage: (page: number) => void;
|
|
25
|
+
setPageSize: (value: number) => void;
|
|
26
|
+
formState: FormActionTypes | undefined;
|
|
27
|
+
itemData: ObjectType | null;
|
|
28
|
+
onChangeFormState: (state: FormActionTypes, data?: ObjectType) => Promise<void>;
|
|
29
|
+
onCloseForm: () => void;
|
|
30
|
+
onWidgetFormSubmit: (data: ObjectType) => Promise<void>;
|
|
31
|
+
onCofirmDeleteWidget: () => Promise<void>;
|
|
32
|
+
onPartialUpdateWidget: (data: ObjectType, id: string) => Promise<void>;
|
|
33
|
+
onImageUpload: (file: File) => Promise<{
|
|
34
|
+
fileUrl: string;
|
|
35
|
+
fileId: string;
|
|
36
|
+
fileUri: string;
|
|
37
|
+
} | void>;
|
|
38
|
+
onImageRemove: (id: string) => Promise<void>;
|
|
39
|
+
itemsTypes: ItemsType[];
|
|
40
|
+
widgetTypes: WidgetType[];
|
|
41
|
+
changeSearch: (value: string) => void;
|
|
42
|
+
collectionDataLoading: boolean;
|
|
43
|
+
getCollectionData: (collectionName: string, search?: string, callback?: ((data: any) => void) | undefined, collectionItems?: string[]) => Promise<void>;
|
|
44
|
+
collectionData: any[];
|
|
45
|
+
};
|
|
46
|
+
export default useWidget;
|
|
@@ -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' | 'GET_ONE' | 'LANGUAGES';
|
|
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,30 @@
|
|
|
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
|
+
code?: string;
|
|
7
|
+
};
|
|
8
|
+
export interface PermissionsObj {
|
|
9
|
+
list: boolean;
|
|
10
|
+
add: boolean;
|
|
11
|
+
update: boolean;
|
|
12
|
+
partialUpdate: boolean;
|
|
13
|
+
delete: boolean;
|
|
14
|
+
}
|
|
15
|
+
export type LanguageType = {
|
|
16
|
+
name: string;
|
|
17
|
+
code: string;
|
|
18
|
+
};
|
|
19
|
+
export type ObjectType = {
|
|
20
|
+
[key: string]: string;
|
|
21
|
+
};
|
|
22
|
+
export type CombineObjectType = {
|
|
23
|
+
[key: string]: string | boolean | number | string[] | null | Record<string | number, CombineObjectType> | CombineObjectType | CombineObjectType[];
|
|
24
|
+
};
|
|
25
|
+
export type ValuesType = string | boolean | number | string[];
|
|
26
|
+
export interface SrcSetItem {
|
|
27
|
+
screenSize: number | string;
|
|
28
|
+
width: number | string;
|
|
29
|
+
height: number | string;
|
|
30
|
+
}
|