@knovator/pagecreator-admin 0.5.12 → 0.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knovator/pagecreator-admin",
3
- "version": "0.5.12",
3
+ "version": "0.7.0",
4
4
  "dependencies": {
5
5
  "classnames": "^2.3.1",
6
6
  "react-beautiful-dnd": "^13.1.0",
@@ -1,5 +1,9 @@
1
1
  import { API_INPUT_TYPE } from '../types';
2
2
  declare const apiList: {
3
+ GET_ONE: ({ prefix, id }: API_INPUT_TYPE) => {
4
+ url: string;
5
+ method: string;
6
+ };
3
7
  LIST: ({ prefix }: API_INPUT_TYPE) => {
4
8
  url: string;
5
9
  method: string;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
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;
3
+ declare const ItemsAccordian: ({ show, title, id, collapseId, toggleShow, loading, name, errors, control, register, setError, itemType, clearError, addText, deleteText, }: ItemsAccordianProps) => JSX.Element;
4
4
  export default ItemsAccordian;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { ButtonProps } from '../../../types';
3
- declare const Button: ({ type, size, onClick, className, children, disabled, }: ButtonProps) => JSX.Element;
3
+ declare const Button: ({ type, size, onClick, className, children, disabled, loading, }: ButtonProps) => JSX.Element;
4
4
  export default Button;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { ImageUploadProps } from '../../../types';
3
- declare const _default: React.MemoExoticComponent<({ className, text, maxSize, setImgId, onError, error, imgId, onImageUpload, onImageRemove, baseUrl, disabled, }: ImageUploadProps) => JSX.Element>;
3
+ declare const _default: React.MemoExoticComponent<({ className, text, maxSize, setImgId, onError, error, imgId, onImageUpload, onImageRemove, clearError, baseUrl, disabled, }: ImageUploadProps) => JSX.Element>;
4
4
  export default _default;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { InputProps } from '../../../types';
3
- declare const SrcSet: ({ label, size, required, error, className, register, wrapperClassName, control, errors, disabled, }: InputProps) => JSX.Element;
3
+ declare const SrcSet: ({ label, size, required, error, className, register, wrapperClassName, control, errors, name, disabled, t, }: InputProps) => JSX.Element;
4
4
  export default SrcSet;
@@ -15,6 +15,11 @@ declare enum CALLBACK_CODES {
15
15
  'IMAGE_REMOVE' = "IMAGE_REMOVE",
16
16
  'INTERNAL' = "INTERNAL"
17
17
  }
18
+ declare const CONSTANTS: {
19
+ EMPTY_REGEX: RegExp;
20
+ SLUG_REGEX: RegExp;
21
+ SLUG_REPLACE_REGEX: RegExp;
22
+ };
18
23
  declare const DEFAULT_PERMISSIONS: {
19
24
  list: boolean;
20
25
  add: boolean;
@@ -97,6 +102,14 @@ declare const TRANSLATION_PAIRS_ITEM: {
97
102
  'item.dragDrop': string;
98
103
  'item.allowedFormat': string;
99
104
  'item.srcset': string;
105
+ 'item.screenSizeRequired': string;
106
+ 'item.widthRequired': string;
107
+ 'item.heightRequired': string;
108
+ 'item.minScreenSize': string;
109
+ 'item.minWidth': string;
110
+ 'item.minHeight': string;
111
+ 'item.titleRequired': string;
112
+ 'item.deleteTitle': string;
100
113
  };
101
114
  declare const TRANSLATION_PAIRS_PAGE: {
102
115
  'page.name': string;
@@ -105,6 +118,9 @@ declare const TRANSLATION_PAIRS_PAGE: {
105
118
  'page.code': string;
106
119
  'page.codePlaceholder': string;
107
120
  'page.codeRequired': string;
121
+ 'page.slug': string;
122
+ 'page.slugPlaceholder': string;
123
+ 'page.slugRequired': string;
108
124
  'page.addPageTitle': string;
109
125
  'page.updatePageTitle': string;
110
126
  'page.searchPages': string;
@@ -113,4 +129,4 @@ declare const TRANSLATION_PAIRS_PAGE: {
113
129
  'page.widgets': string;
114
130
  'page.actionsLabel': string;
115
131
  };
116
- 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, };
132
+ 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_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, itemsRoutesPrefix, widgetRoutesPrefix, pageRoutesPrefix, }: ProviderContextProviderProps) => JSX.Element;
3
+ declare const Provider: ({ children, baseUrl, token, onError, onSuccess, onLogout, switchClass, 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, 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, webItems, mobileItems, itemsLoading, onItemFormSubmit, reactSelectStyles, children, }: WidgetContextProviderProps) => JSX.Element;
5
+ declare const WidgetContextProvider: ({ t, list, 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, children, }: WidgetContextProviderProps) => JSX.Element;
6
6
  export declare function useWidgetState(): WidgetContextType;
7
7
  export default WidgetContextProvider;
@@ -3,6 +3,7 @@ export declare const paginationDataGatter: (data: any) => any;
3
3
  export declare const dataGatter: (data: any) => any;
4
4
  export declare const capitalizeFirstLetter: (string?: string) => string;
5
5
  export declare const changeToCode: (string?: string) => string;
6
+ export declare const changeToSlug: (string?: string) => string;
6
7
  export declare const isObject: (data: any) => boolean;
7
8
  export declare const isString: (data: any) => boolean;
8
9
  export declare const isArray: (data: any) => boolean;
@@ -10,10 +10,6 @@ interface UseWidgetProps {
10
10
  }) => Promise<boolean>;
11
11
  imageBaseUrl?: string;
12
12
  }
13
- interface ItemsList {
14
- web: ObjectType[];
15
- mobile: ObjectType[];
16
- }
17
13
  declare const useWidget: ({ canList, defaultLimit, routes, preConfirmDelete, imageBaseUrl }: UseWidgetProps) => {
18
14
  list: ObjectType[];
19
15
  getWidgets: (search?: string) => Promise<void>;
@@ -28,9 +24,8 @@ declare const useWidget: ({ canList, defaultLimit, routes, preConfirmDelete, ima
28
24
  setPageSize: (value: number) => void;
29
25
  formState: FormActionTypes | undefined;
30
26
  itemData: ObjectType | null;
31
- onChangeFormState: (state: FormActionTypes, data?: ObjectType) => void;
27
+ onChangeFormState: (state: FormActionTypes, data?: ObjectType) => Promise<void>;
32
28
  onCloseForm: () => void;
33
- onDeleteItem: (id: string) => Promise<void>;
34
29
  onWidgetFormSubmit: (data: ObjectType) => Promise<void>;
35
30
  onCofirmDeleteWidget: () => Promise<void>;
36
31
  onPartialUpdateWidget: (data: ObjectType, id: string) => Promise<void>;
@@ -46,8 +41,5 @@ declare const useWidget: ({ canList, defaultLimit, routes, preConfirmDelete, ima
46
41
  collectionDataLoading: boolean;
47
42
  getCollectionData: (collectionName: string, search?: string, callback?: ((data: any) => void) | undefined, collectionItems?: string[]) => Promise<void>;
48
43
  collectionData: any[];
49
- itemsList: ItemsList;
50
- itemsLoading: boolean;
51
- onItemFormSubmit: (state: FormActionTypes, data: ObjectType, updateId?: string) => Promise<void>;
52
44
  };
53
45
  export default useWidget;
@@ -1,4 +1,4 @@
1
- export type ACTION_TYPES = 'IMAGE_UPLOAD' | 'IMAGE_REMOVE' | 'CREATE' | 'LIST' | 'DELETE' | 'UPDATE' | 'ITEM' | 'PARTIAL_UPDATE' | 'WIDGET_TYPES' | 'SELECTION_TYPES' | 'COLLECTION_DATA';
1
+ export type ACTION_TYPES = 'IMAGE_UPLOAD' | 'IMAGE_REMOVE' | 'CREATE' | 'LIST' | 'DELETE' | 'UPDATE' | 'ITEM' | 'PARTIAL_UPDATE' | 'WIDGET_TYPES' | 'SELECTION_TYPES' | 'COLLECTION_DATA' | 'GET_ONE';
2
2
  export type API_TYPE = {
3
3
  url: string;
4
4
  method: string;
@@ -26,6 +26,7 @@ export interface ButtonProps {
26
26
  onClick?: () => void;
27
27
  className?: string;
28
28
  disabled?: boolean;
29
+ loading?: boolean;
29
30
  }
30
31
  export interface IconProps {
31
32
  srText?: string;
@@ -52,6 +53,8 @@ export interface InputProps {
52
53
  control?: any;
53
54
  register?: any;
54
55
  info?: string;
56
+ name?: string;
57
+ t?: any;
55
58
  }
56
59
  export interface HTMLEditorProps {
57
60
  id?: string;
@@ -218,19 +221,18 @@ export interface ItemsAccordianProps {
218
221
  id: string;
219
222
  show: boolean;
220
223
  title: string;
221
- itemsData: any[];
222
- widgetId: string;
223
224
  collapseId: string;
224
- schema: SchemaType[];
225
- itemType: 'Web' | 'Mobile';
226
225
  toggleShow: (status: boolean) => void;
227
- onDataSubmit: (state: FormActionTypes, data: any, updateId?: string) => void;
228
- onDelete: (id: string) => void;
229
226
  addText?: string;
230
- editText?: string;
231
- cancelText?: string;
232
227
  deleteText?: string;
233
- saveText?: string;
228
+ loading?: boolean;
229
+ name: string;
230
+ itemType: 'Web' | 'Mobile';
231
+ errors: any;
232
+ control: any;
233
+ register: any;
234
+ setError: any;
235
+ clearError: (key: string) => void;
234
236
  }
235
237
  export interface TabItemProps {
236
238
  showDelete?: boolean;
@@ -9,7 +9,6 @@ export interface ProviderContextType {
9
9
  switchClass: string;
10
10
  onLogout: () => void;
11
11
  widgetRoutesPrefix: string;
12
- itemsRoutesPrefix: string;
13
12
  pageRoutesPrefix: string;
14
13
  }
15
14
  export interface ProviderContextProviderProps extends React.PropsWithChildren, Omit<ProviderContextType, 'onError' | 'onSuccess' | 'onLogout' | 'widgetRoutesPrefix' | 'itemsRoutesPrefix' | 'pageRoutesPrefix' | 'switchClass'> {
@@ -63,10 +62,6 @@ export interface WidgetContextType {
63
62
  loader?: JSX.Element;
64
63
  canDelete?: boolean;
65
64
  onPartialUpdateWidget: (data: any, id: string) => Promise<void>;
66
- webItems: any[];
67
- mobileItems: any[];
68
- itemsLoading: boolean;
69
- onItemFormSubmit: (state: FormActionTypes, data: any) => void;
70
65
  reactSelectStyles?: any;
71
66
  imageBaseUrl?: string;
72
67
  }