@knovator/pagecreator-admin 0.0.10 → 0.3.0
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/README.md +2 -2
- package/index.css +21 -1
- package/index.js +1002 -1113
- package/lib/api/list.d.ts +1 -1
- package/lib/components/Widget/Form/ItemsAccordian.d.ts +4 -0
- package/lib/components/common/Input/SrcSet.d.ts +4 -0
- package/lib/components/common/Input/index.d.ts +2 -0
- package/lib/constants/common.d.ts +24 -19
- package/lib/context/ProviderContext.d.ts +1 -1
- package/lib/context/WidgetContext.d.ts +1 -1
- package/lib/hooks/useWidget.d.ts +10 -6
- package/lib/icons/plus.d.ts +4 -0
- package/lib/types/api.d.ts +3 -3
- package/lib/types/common.d.ts +6 -1
- package/lib/types/components.d.ts +7 -28
- package/lib/types/context.d.ts +10 -9
- package/package.json +2 -2
- package/lib/components/Widget/Form/TileItemsAccordian.d.ts +0 -4
package/lib/api/list.d.ts
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ItemsAccordianProps } from '../../../types';
|
|
3
|
+
declare const ItemsAccordian: ({ schema, onDataSubmit, show, title, id, itemsData, collapseId, toggleShow, itemType, widgetId, onDelete, addText, saveText, cancelText, deleteText, editText, }: ItemsAccordianProps) => JSX.Element;
|
|
4
|
+
export default ItemsAccordian;
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
import Checkbox from "./Checkbox";
|
|
3
3
|
import Select from "./Select";
|
|
4
4
|
import ReactSelect from "./ReactSelect";
|
|
5
|
+
import SrcSet from './SrcSet';
|
|
5
6
|
declare const _default: (({ label, id, placeholder, type, size, required, error, className, disabled, rest, onInput, onBlur, value, onChange, wrapperClassName, }: import("../../../types").InputProps) => JSX.Element) & {
|
|
6
7
|
Select: typeof Select;
|
|
7
8
|
ReactSelect: typeof ReactSelect;
|
|
8
9
|
Checkbox: typeof Checkbox;
|
|
10
|
+
SrcSet: typeof SrcSet;
|
|
9
11
|
};
|
|
10
12
|
export default _default;
|
|
@@ -46,13 +46,13 @@ declare const TRANSLATION_PAIRS_WIDGET: {
|
|
|
46
46
|
'widget.name': string;
|
|
47
47
|
'widget.namePlaceholder': string;
|
|
48
48
|
'widget.nameRequired': string;
|
|
49
|
-
'widget.
|
|
50
|
-
'widget.
|
|
51
|
-
'widget.
|
|
49
|
+
'widget.widgetTitle': string;
|
|
50
|
+
'widget.widgetTitlePlaceholder': string;
|
|
51
|
+
'widget.widgetTitleRequired': string;
|
|
52
|
+
'widget.itemsType': string;
|
|
53
|
+
'widget.itemsTypePlaceholder': string;
|
|
52
54
|
'widget.widgetType': string;
|
|
53
|
-
'widget.
|
|
54
|
-
'widget.selectionType': string;
|
|
55
|
-
'widget.selectionTypeRequired': string;
|
|
55
|
+
'widget.widgetTypeRequired': string;
|
|
56
56
|
'widget.code': string;
|
|
57
57
|
'widget.codePlaceholder': string;
|
|
58
58
|
'widget.codeRequired': string;
|
|
@@ -62,7 +62,8 @@ declare const TRANSLATION_PAIRS_WIDGET: {
|
|
|
62
62
|
'widget.mobilePerRowPlaceholder': string;
|
|
63
63
|
'widget.tabletPerRow': string;
|
|
64
64
|
'widget.tabletPerRowPlaceholder': string;
|
|
65
|
-
'widget.
|
|
65
|
+
'widget.mobileItems': string;
|
|
66
|
+
'widget.webItems': string;
|
|
66
67
|
'widget.searchPlaceholder': string;
|
|
67
68
|
'widget.autoPlay': string;
|
|
68
69
|
'widget.tableName': string;
|
|
@@ -70,18 +71,22 @@ declare const TRANSLATION_PAIRS_WIDGET: {
|
|
|
70
71
|
'widget.tableActive': string;
|
|
71
72
|
'widget.addWidgetTitle': string;
|
|
72
73
|
'widget.updateWidgetTitle': string;
|
|
74
|
+
'widget.webPerRowRequired': string;
|
|
75
|
+
'widget.tabletPerRowRequired': string;
|
|
76
|
+
'widget.mobilePerRowRequired': string;
|
|
73
77
|
};
|
|
74
|
-
declare const
|
|
75
|
-
'
|
|
76
|
-
'
|
|
77
|
-
'
|
|
78
|
-
'
|
|
79
|
-
'
|
|
80
|
-
'
|
|
81
|
-
'
|
|
82
|
-
'
|
|
83
|
-
'
|
|
84
|
-
'
|
|
78
|
+
declare const TRANSLATION_PAIRS_ITEM: {
|
|
79
|
+
'item.title': string;
|
|
80
|
+
'item.titlePlaceholder': string;
|
|
81
|
+
'item.altText': string;
|
|
82
|
+
'item.altTextPlaceholder': string;
|
|
83
|
+
'item.link': string;
|
|
84
|
+
'item.linkPlaceholder': string;
|
|
85
|
+
'item.image': string;
|
|
86
|
+
'item.uploadFile': string;
|
|
87
|
+
'item.dragDrop': string;
|
|
88
|
+
'item.allowedFormat': string;
|
|
89
|
+
'item.srcset': string;
|
|
85
90
|
};
|
|
86
91
|
declare const TRANSLATION_PAIRS_PAGE: {
|
|
87
92
|
'page.name': string;
|
|
@@ -97,4 +102,4 @@ declare const TRANSLATION_PAIRS_PAGE: {
|
|
|
97
102
|
'page.tableCode': string;
|
|
98
103
|
'page.widgets': string;
|
|
99
104
|
};
|
|
100
|
-
export { 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,
|
|
105
|
+
export { 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_ITEM, TRANSLATION_PAIRS_PAGE, };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ProviderContextProviderProps, ProviderContextType } from '../types';
|
|
3
|
-
declare const Provider: ({ children, baseUrl, token, onError, onSuccess, onLogout, switchClass,
|
|
3
|
+
declare const Provider: ({ children, baseUrl, token, onError, onSuccess, onLogout, switchClass, itemsRoutesPrefix, widgetRoutesPrefix, pageRoutesPrefix, }: ProviderContextProviderProps) => JSX.Element;
|
|
4
4
|
export declare function useProviderState(): ProviderContextType;
|
|
5
5
|
export default Provider;
|
|
@@ -2,6 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { WidgetContextType } from '../types';
|
|
3
3
|
interface WidgetContextProviderProps extends React.PropsWithChildren, Partial<WidgetContextType> {
|
|
4
4
|
}
|
|
5
|
-
declare const WidgetContextProvider: ({ t, list, formState, closeForm, loading, onChangeFormState, onWidgetFormSubmit, updateData, canAdd, canUpdate,
|
|
5
|
+
declare const WidgetContextProvider: ({ t, list, 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, webItems, mobileItems, itemsLoading, onItemFormSubmit, children, }: WidgetContextProviderProps) => JSX.Element;
|
|
6
6
|
export declare function useWidgetState(): WidgetContextType;
|
|
7
7
|
export default WidgetContextProvider;
|
package/lib/hooks/useWidget.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Routes_Input,
|
|
2
|
+
import { Routes_Input, WidgetType, ItemsType } from '../types';
|
|
3
3
|
import { FormActionTypes, ObjectType } from '../types/common';
|
|
4
4
|
interface UseWidgetProps {
|
|
5
5
|
defaultLimit: number;
|
|
@@ -8,6 +8,10 @@ interface UseWidgetProps {
|
|
|
8
8
|
row: ObjectType;
|
|
9
9
|
}) => Promise<boolean>;
|
|
10
10
|
}
|
|
11
|
+
interface ItemsList {
|
|
12
|
+
web: ObjectType[];
|
|
13
|
+
mobile: ObjectType[];
|
|
14
|
+
}
|
|
11
15
|
declare const useWidget: ({ defaultLimit, routes, preConfirmDelete, }: UseWidgetProps) => {
|
|
12
16
|
list: ObjectType[];
|
|
13
17
|
getWidgets: (search?: string) => Promise<void>;
|
|
@@ -23,7 +27,7 @@ declare const useWidget: ({ defaultLimit, routes, preConfirmDelete, }: UseWidget
|
|
|
23
27
|
itemData: ObjectType | null;
|
|
24
28
|
onChangeFormState: (state: FormActionTypes, data?: ObjectType) => void;
|
|
25
29
|
onCloseForm: () => void;
|
|
26
|
-
|
|
30
|
+
onDeleteItem: (id: string) => Promise<void>;
|
|
27
31
|
onWidgetFormSubmit: (data: ObjectType) => Promise<void>;
|
|
28
32
|
onCofirmDeleteWidget: () => Promise<void>;
|
|
29
33
|
onPartialUpdateWidget: (data: ObjectType, id: string) => Promise<void>;
|
|
@@ -33,13 +37,13 @@ declare const useWidget: ({ defaultLimit, routes, preConfirmDelete, }: UseWidget
|
|
|
33
37
|
fileUri: string;
|
|
34
38
|
} | void>;
|
|
35
39
|
onImageRemove: (id: string) => Promise<void>;
|
|
40
|
+
itemsTypes: ItemsType[];
|
|
36
41
|
widgetTypes: WidgetType[];
|
|
37
|
-
selectionTypes: SelectionType[];
|
|
38
42
|
collectionDataLoading: boolean;
|
|
39
43
|
getCollectionData: (collectionName: string, search?: string) => Promise<void>;
|
|
40
44
|
collectionData: any[];
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
itemsList: ItemsList;
|
|
46
|
+
itemsLoading: boolean;
|
|
47
|
+
onItemFormSubmit: (state: FormActionTypes, data: ObjectType, updateId?: string) => Promise<void>;
|
|
44
48
|
};
|
|
45
49
|
export default useWidget;
|
package/lib/types/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare type ACTION_TYPES = 'IMAGE_UPLOAD' | 'IMAGE_REMOVE' | 'CREATE' | 'LIST' | 'DELETE' | 'UPDATE' | '
|
|
1
|
+
export declare type ACTION_TYPES = 'IMAGE_UPLOAD' | 'IMAGE_REMOVE' | 'CREATE' | 'LIST' | 'DELETE' | 'UPDATE' | 'ITEM' | 'PARTIAL_UPDATE' | 'WIDGET_TYPES' | 'SELECTION_TYPES' | 'COLLECTION_DATA';
|
|
2
2
|
export declare type API_TYPE = {
|
|
3
3
|
url: string;
|
|
4
4
|
method: string;
|
|
@@ -10,11 +10,11 @@ export declare type API_INPUT_TYPE = {
|
|
|
10
10
|
export declare type Routes_Input = {
|
|
11
11
|
[K in ACTION_TYPES]?: (data: API_INPUT_TYPE) => API_TYPE;
|
|
12
12
|
};
|
|
13
|
-
export declare type
|
|
13
|
+
export declare type ItemsType = {
|
|
14
14
|
value: string;
|
|
15
15
|
label: string;
|
|
16
16
|
};
|
|
17
|
-
export declare type
|
|
17
|
+
export declare type WidgetType = {
|
|
18
18
|
value: string;
|
|
19
19
|
label: string;
|
|
20
20
|
};
|
package/lib/types/common.d.ts
CHANGED
|
@@ -15,6 +15,11 @@ export declare type ObjectType = {
|
|
|
15
15
|
[key: string]: string;
|
|
16
16
|
};
|
|
17
17
|
export declare type CombineObjectType = {
|
|
18
|
-
[key: string]: string | boolean | number | string[] | null |
|
|
18
|
+
[key: string]: string | boolean | number | string[] | null | CombineObjectType;
|
|
19
19
|
};
|
|
20
20
|
export declare type ValuesType = string | boolean | number | string[];
|
|
21
|
+
export interface SrcSetItem {
|
|
22
|
+
screenSize: number | string;
|
|
23
|
+
width: number | string;
|
|
24
|
+
height: number | string;
|
|
25
|
+
}
|
|
@@ -40,6 +40,7 @@ export interface InputProps {
|
|
|
40
40
|
size?: InputSizes;
|
|
41
41
|
className?: string;
|
|
42
42
|
error?: string;
|
|
43
|
+
errors?: any;
|
|
43
44
|
required?: boolean;
|
|
44
45
|
disabled?: boolean;
|
|
45
46
|
rest?: any;
|
|
@@ -48,6 +49,8 @@ export interface InputProps {
|
|
|
48
49
|
value?: string | number;
|
|
49
50
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
50
51
|
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
52
|
+
control?: any;
|
|
53
|
+
register?: any;
|
|
51
54
|
}
|
|
52
55
|
export interface CheckboxProps {
|
|
53
56
|
rest?: any;
|
|
@@ -100,30 +103,6 @@ export interface ReactSelectProps {
|
|
|
100
103
|
listCode?: string;
|
|
101
104
|
wrapperClassName?: string;
|
|
102
105
|
}
|
|
103
|
-
export interface SchemaType extends ReactSelectProps {
|
|
104
|
-
label?: string;
|
|
105
|
-
accessor: string;
|
|
106
|
-
Input?: (props: InputRendererProps) => JSX.Element;
|
|
107
|
-
validations?: import('react-hook-form').RegisterOptions;
|
|
108
|
-
editable?: boolean;
|
|
109
|
-
onInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
110
|
-
type?: 'text' | 'number' | 'select' | 'checkbox' | 'textarea' | 'file' | 'url' | 'ReactSelect';
|
|
111
|
-
options?: {
|
|
112
|
-
value: string;
|
|
113
|
-
label: string;
|
|
114
|
-
}[];
|
|
115
|
-
selectedOptions?: {
|
|
116
|
-
value: string;
|
|
117
|
-
label: string;
|
|
118
|
-
}[];
|
|
119
|
-
isMulti?: boolean;
|
|
120
|
-
defaultValue?: string | number | boolean;
|
|
121
|
-
placeholder?: string;
|
|
122
|
-
required?: boolean;
|
|
123
|
-
onChange?: (e: any) => void;
|
|
124
|
-
show?: boolean;
|
|
125
|
-
wrapperClassName?: string;
|
|
126
|
-
}
|
|
127
106
|
export interface FormProps {
|
|
128
107
|
formRef: MutableRefObject<HTMLFormElement | null>;
|
|
129
108
|
}
|
|
@@ -163,7 +142,7 @@ export interface SchemaType extends ReactSelectProps {
|
|
|
163
142
|
validations?: RegisterOptions;
|
|
164
143
|
editable?: boolean;
|
|
165
144
|
onInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
166
|
-
type?: 'text' | 'number' | 'select' | 'checkbox' | 'textarea' | 'file' | 'url' | 'ReactSelect';
|
|
145
|
+
type?: 'text' | 'number' | 'select' | 'checkbox' | 'textarea' | 'file' | 'url' | 'ReactSelect' | 'srcset';
|
|
167
146
|
options?: {
|
|
168
147
|
value: string;
|
|
169
148
|
label: string;
|
|
@@ -197,15 +176,15 @@ export interface PaginationProps {
|
|
|
197
176
|
pageText?: string;
|
|
198
177
|
ofText?: string;
|
|
199
178
|
}
|
|
200
|
-
export interface
|
|
179
|
+
export interface ItemsAccordianProps {
|
|
201
180
|
id: string;
|
|
202
181
|
show: boolean;
|
|
203
182
|
title: string;
|
|
204
|
-
|
|
183
|
+
itemsData: any[];
|
|
205
184
|
widgetId: string;
|
|
206
185
|
collapseId: string;
|
|
207
186
|
schema: SchemaType[];
|
|
208
|
-
|
|
187
|
+
itemType: 'Web' | 'Mobile';
|
|
209
188
|
toggleShow: (status: boolean) => void;
|
|
210
189
|
onDataSubmit: (state: FormActionTypes, data: any, updateId?: string) => void;
|
|
211
190
|
onDelete: (id: string) => void;
|
package/lib/types/context.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { WidgetType, ItemsType } from './api';
|
|
3
3
|
import { FormActionTypes, OptionType } from './common';
|
|
4
4
|
export interface ProviderContextType {
|
|
5
5
|
baseUrl: string;
|
|
@@ -9,16 +9,16 @@ export interface ProviderContextType {
|
|
|
9
9
|
switchClass: string;
|
|
10
10
|
onLogout: () => void;
|
|
11
11
|
widgetRoutesPrefix: string;
|
|
12
|
-
|
|
12
|
+
itemsRoutesPrefix: string;
|
|
13
13
|
pageRoutesPrefix: string;
|
|
14
14
|
}
|
|
15
|
-
export interface ProviderContextProviderProps extends React.PropsWithChildren, Omit<ProviderContextType, 'onError' | 'onSuccess' | 'onLogout' | 'widgetRoutesPrefix' | '
|
|
15
|
+
export interface ProviderContextProviderProps extends React.PropsWithChildren, Omit<ProviderContextType, 'onError' | 'onSuccess' | 'onLogout' | 'widgetRoutesPrefix' | 'itemsRoutesPrefix' | 'pageRoutesPrefix' | 'switchClass'> {
|
|
16
16
|
onError?: (callback_code: import('../constants/common').CALLBACK_CODES, code: string, message: string) => void;
|
|
17
17
|
onSuccess?: (callback_code: import('../constants/common').CALLBACK_CODES, code: string, message: string) => void;
|
|
18
18
|
onLogout?: () => void;
|
|
19
19
|
switchClass?: string;
|
|
20
20
|
widgetRoutesPrefix?: string;
|
|
21
|
-
|
|
21
|
+
itemsRoutesPrefix?: string;
|
|
22
22
|
pageRoutesPrefix?: string;
|
|
23
23
|
}
|
|
24
24
|
export interface WidgetContextType {
|
|
@@ -32,7 +32,7 @@ export interface WidgetContextType {
|
|
|
32
32
|
loading: boolean;
|
|
33
33
|
canAdd: boolean;
|
|
34
34
|
canUpdate: boolean;
|
|
35
|
-
|
|
35
|
+
onDeleteItem: (id: string) => void;
|
|
36
36
|
getWidgets: (searchText: string) => void;
|
|
37
37
|
onImageUpload: (file: File) => Promise<{
|
|
38
38
|
fileUrl: string;
|
|
@@ -40,8 +40,8 @@ export interface WidgetContextType {
|
|
|
40
40
|
fileUri: string;
|
|
41
41
|
} | void>;
|
|
42
42
|
onImageRemove: (id: string) => Promise<void>;
|
|
43
|
+
itemsTypes: ItemsType[];
|
|
43
44
|
widgetTypes: WidgetType[];
|
|
44
|
-
selectionTypes: SelectionType[];
|
|
45
45
|
getCollectionData: (collectionName: string, search?: string) => Promise<void>;
|
|
46
46
|
collectionDataLoading: boolean;
|
|
47
47
|
collectionData: any[];
|
|
@@ -61,9 +61,10 @@ export interface WidgetContextType {
|
|
|
61
61
|
loader?: JSX.Element;
|
|
62
62
|
canDelete?: boolean;
|
|
63
63
|
onPartialUpdateWidget: (data: any, id: string) => Promise<void>;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
webItems: any[];
|
|
65
|
+
mobileItems: any[];
|
|
66
|
+
itemsLoading: boolean;
|
|
67
|
+
onItemFormSubmit: (state: FormActionTypes, data: any) => void;
|
|
67
68
|
}
|
|
68
69
|
export interface PageContextType {
|
|
69
70
|
t: (key: string) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knovator/pagecreator-admin",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"classnames": "^2.3.1",
|
|
6
6
|
"react-beautiful-dnd": "^13.1.0",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@knovator/api": "^1.0.2"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"react": "^18"
|
|
14
|
+
"react": "^18 | ^17"
|
|
15
15
|
},
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { TileItemsAccordianProps } from '../../../types';
|
|
3
|
-
declare const TileItemsAccordian: ({ schema, onDataSubmit, show, title, id, tilesData, collapseId, toggleShow, tileType, widgetId, onDelete, addText, saveText, cancelText, deleteText, editText, }: TileItemsAccordianProps) => JSX.Element;
|
|
4
|
-
export default TileItemsAccordian;
|