@knovator/pagecreator-admin 1.2.9 → 1.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.
Files changed (167) hide show
  1. package/index.cjs +7876 -0
  2. package/index.css +2 -0
  3. package/index.js +7862 -0
  4. package/package.json +42 -38
  5. package/src/{index.ts → index.d.ts} +0 -1
  6. package/src/lib/api/index.d.ts +10 -0
  7. package/src/lib/api/list.d.ts +56 -0
  8. package/src/lib/components/Page/AddButton/AddButton.d.ts +3 -0
  9. package/src/lib/components/Page/AddButton/{index.ts → index.d.ts} +0 -1
  10. package/src/lib/components/Page/Form/PageForm.d.ts +4 -0
  11. package/src/lib/components/Page/Form/{index.ts → index.d.ts} +0 -1
  12. package/src/lib/components/Page/Page/Page.d.ts +13 -0
  13. package/src/lib/components/Page/Page/{index.ts → index.d.ts} +0 -1
  14. package/src/lib/components/Page/PageFormActions/PageFormActions.d.ts +4 -0
  15. package/src/lib/components/Page/PageFormActions/{index.ts → index.d.ts} +0 -1
  16. package/src/lib/components/Page/PageFormWrapper/PageFormWrapper.d.ts +4 -0
  17. package/src/lib/components/Page/PageFormWrapper/{index.ts → index.d.ts} +0 -1
  18. package/src/lib/components/Page/Pagination/PagePagination.d.ts +3 -0
  19. package/src/lib/components/Page/Pagination/{index.ts → index.d.ts} +0 -1
  20. package/src/lib/components/Page/Search/PageSearch.d.ts +3 -0
  21. package/src/lib/components/Page/Search/{index.tsx → index.d.ts} +0 -1
  22. package/src/lib/components/Page/Table/PageTable.d.ts +4 -0
  23. package/src/lib/components/Page/Table/{index.ts → index.d.ts} +0 -1
  24. package/src/lib/components/Page/{index.ts → index.d.ts} +0 -1
  25. package/src/lib/components/Widget/AddButton/AddButton.d.ts +3 -0
  26. package/src/lib/components/Widget/AddButton/{index.ts → index.d.ts} +0 -1
  27. package/src/lib/components/Widget/Form/ItemsAccordian.d.ts +4 -0
  28. package/src/lib/components/Widget/Form/Tabs/TabItem.d.ts +4 -0
  29. package/src/lib/components/Widget/Form/Tabs/Tabs.d.ts +4 -0
  30. package/src/lib/components/Widget/Form/Tabs/{index.ts → index.d.ts} +0 -1
  31. package/src/lib/components/Widget/Form/WidgetForm.d.ts +4 -0
  32. package/src/lib/components/Widget/Form/{index.ts → index.d.ts} +0 -1
  33. package/src/lib/components/Widget/Pagination/WidgetPagination.d.ts +3 -0
  34. package/src/lib/components/Widget/Pagination/{index.ts → index.d.ts} +0 -1
  35. package/src/lib/components/Widget/Search/WidgetSearch.d.ts +3 -0
  36. package/src/lib/components/Widget/Search/{index.tsx → index.d.ts} +0 -1
  37. package/src/lib/components/Widget/Table/WidgetTable.d.ts +4 -0
  38. package/src/lib/components/Widget/Table/{index.ts → index.d.ts} +0 -1
  39. package/src/lib/components/Widget/Widget/Widget.d.ts +13 -0
  40. package/src/lib/components/Widget/Widget/{index.ts → index.d.ts} +0 -1
  41. package/src/lib/components/Widget/WidgetFormActions/WidgetFormActions.d.ts +4 -0
  42. package/src/lib/components/Widget/WidgetFormActions/{index.ts → index.d.ts} +0 -1
  43. package/src/lib/components/Widget/WidgetFormWrapper/WidgetFormWrapper.d.ts +4 -0
  44. package/src/lib/components/Widget/WidgetFormWrapper/{index.ts → index.d.ts} +0 -1
  45. package/src/lib/components/Widget/{index.tsx → index.d.ts} +0 -1
  46. package/src/lib/components/common/Accordian/Accordian.d.ts +13 -0
  47. package/src/lib/components/common/Accordian/{index.ts → index.d.ts} +0 -1
  48. package/src/lib/components/common/Button/Button.d.ts +4 -0
  49. package/src/lib/components/common/Button/{index.ts → index.d.ts} +0 -1
  50. package/src/lib/components/common/ConfirmPopover/ConfirmPopover.d.ts +4 -0
  51. package/src/lib/components/common/ConfirmPopover/{index.ts → index.d.ts} +0 -1
  52. package/src/lib/components/common/DNDItemsList/DNDItemsList.d.ts +4 -0
  53. package/src/lib/components/common/DNDItemsList/{index.ts → index.d.ts} +0 -1
  54. package/src/lib/components/common/DeleteModal/DeleteModal.d.ts +4 -0
  55. package/src/lib/components/common/DeleteModal/index.d.ts +2 -0
  56. package/src/lib/components/common/Drawer/Drawer.d.ts +9 -0
  57. package/src/lib/components/common/Drawer/{index.ts → index.d.ts} +0 -1
  58. package/src/lib/components/common/Form/Form.d.ts +15 -0
  59. package/src/lib/components/common/Form/SimpleForm.d.ts +18 -0
  60. package/src/lib/components/common/Form/{index.ts → index.d.ts} +0 -1
  61. package/src/lib/components/common/FormActions/FormActions.d.ts +10 -0
  62. package/src/lib/components/common/FormActions/{index.ts → index.d.ts} +0 -1
  63. package/src/lib/components/common/ImageUpload/ImageUpload.d.ts +4 -0
  64. package/src/lib/components/common/ImageUpload/index.d.ts +2 -0
  65. package/src/lib/components/common/Input/Checkbox.d.ts +4 -0
  66. package/src/lib/components/common/Input/Input.d.ts +4 -0
  67. package/src/lib/components/common/Input/ReactSelect.d.ts +4 -0
  68. package/src/lib/components/common/Input/Select.d.ts +4 -0
  69. package/src/lib/components/common/Input/SrcSet.d.ts +4 -0
  70. package/src/lib/components/common/Input/index.d.ts +12 -0
  71. package/src/lib/components/common/Modal/Modal.d.ts +8 -0
  72. package/src/lib/components/common/Modal/index.d.ts +2 -0
  73. package/src/lib/components/common/Pagination/Pagination.d.ts +4 -0
  74. package/src/lib/components/common/Pagination/{index.ts → index.d.ts} +0 -1
  75. package/src/lib/components/common/Table/Table.d.ts +4 -0
  76. package/src/lib/components/common/Table/{index.ts → index.d.ts} +0 -1
  77. package/src/lib/components/common/Toggle/Toggle.d.ts +4 -0
  78. package/src/lib/components/common/Toggle/{index.ts → index.d.ts} +0 -1
  79. package/src/lib/constants/common.d.ts +122 -0
  80. package/src/lib/context/PageContext.d.ts +7 -0
  81. package/src/lib/context/ProviderContext.d.ts +5 -0
  82. package/src/lib/context/WidgetContext.d.ts +7 -0
  83. package/src/lib/helper/utils.d.ts +10 -0
  84. package/src/lib/hooks/usePage.d.ts +37 -0
  85. package/src/lib/hooks/usePagination.d.ts +15 -0
  86. package/src/lib/hooks/useWidget.d.ts +46 -0
  87. package/src/lib/icons/chevronDown.d.ts +4 -0
  88. package/src/lib/icons/chevronLeft.d.ts +4 -0
  89. package/src/lib/icons/chevronRight.d.ts +4 -0
  90. package/src/lib/icons/chevronUp.d.ts +4 -0
  91. package/src/lib/icons/close.d.ts +4 -0
  92. package/src/lib/icons/pencil.d.ts +4 -0
  93. package/src/lib/icons/plus.d.ts +4 -0
  94. package/src/lib/icons/settings.d.ts +4 -0
  95. package/src/lib/icons/trash.d.ts +4 -0
  96. package/src/lib/types/api.d.ts +34 -0
  97. package/src/lib/types/common.d.ts +30 -0
  98. package/src/lib/types/components.d.ts +421 -0
  99. package/src/lib/types/context.d.ts +135 -0
  100. package/index.d.ts +0 -1
  101. package/src/lib/api/index.ts +0 -70
  102. package/src/lib/api/list.ts +0 -59
  103. package/src/lib/components/Page/AddButton/AddButton.tsx +0 -16
  104. package/src/lib/components/Page/Form/PageForm.tsx +0 -194
  105. package/src/lib/components/Page/Page/Page.tsx +0 -151
  106. package/src/lib/components/Page/PageFormActions/PageFormActions.tsx +0 -50
  107. package/src/lib/components/Page/PageFormWrapper/PageFormWrapper.tsx +0 -16
  108. package/src/lib/components/Page/Pagination/PagePagination.tsx +0 -26
  109. package/src/lib/components/Page/Search/PageSearch.tsx +0 -32
  110. package/src/lib/components/Page/Table/PageTable.tsx +0 -36
  111. package/src/lib/components/Widget/AddButton/AddButton.tsx +0 -16
  112. package/src/lib/components/Widget/Form/ItemsAccordian.tsx +0 -354
  113. package/src/lib/components/Widget/Form/Tabs/TabItem.tsx +0 -43
  114. package/src/lib/components/Widget/Form/Tabs/Tabs.tsx +0 -190
  115. package/src/lib/components/Widget/Form/WidgetForm.tsx +0 -771
  116. package/src/lib/components/Widget/Pagination/WidgetPagination.tsx +0 -26
  117. package/src/lib/components/Widget/Search/WidgetSearch.tsx +0 -32
  118. package/src/lib/components/Widget/Table/WidgetTable.tsx +0 -70
  119. package/src/lib/components/Widget/Widget/Widget.tsx +0 -173
  120. package/src/lib/components/Widget/WidgetFormActions/WidgetFormActions.tsx +0 -50
  121. package/src/lib/components/Widget/WidgetFormWrapper/WidgetFormWrapper.tsx +0 -16
  122. package/src/lib/components/common/Accordian/Accordian.tsx +0 -56
  123. package/src/lib/components/common/Button/Button.tsx +0 -45
  124. package/src/lib/components/common/ConfirmPopover/ConfirmPopover.tsx +0 -47
  125. package/src/lib/components/common/DNDItemsList/DNDItemsList.tsx +0 -77
  126. package/src/lib/components/common/DeleteModal/DeleteModal.tsx +0 -72
  127. package/src/lib/components/common/DeleteModal/index.tsx +0 -3
  128. package/src/lib/components/common/Drawer/Drawer.tsx +0 -79
  129. package/src/lib/components/common/Form/Form.tsx +0 -256
  130. package/src/lib/components/common/Form/SimpleForm.tsx +0 -314
  131. package/src/lib/components/common/FormActions/FormActions.tsx +0 -37
  132. package/src/lib/components/common/ImageUpload/ImageUpload.tsx +0 -113
  133. package/src/lib/components/common/ImageUpload/index.tsx +0 -3
  134. package/src/lib/components/common/Input/Checkbox.tsx +0 -25
  135. package/src/lib/components/common/Input/Input.tsx +0 -51
  136. package/src/lib/components/common/Input/ReactSelect.tsx +0 -61
  137. package/src/lib/components/common/Input/Select.tsx +0 -47
  138. package/src/lib/components/common/Input/SrcSet.tsx +0 -143
  139. package/src/lib/components/common/Input/index.ts +0 -20
  140. package/src/lib/components/common/Modal/Modal.tsx +0 -57
  141. package/src/lib/components/common/Modal/index.tsx +0 -3
  142. package/src/lib/components/common/Pagination/Pagination.tsx +0 -88
  143. package/src/lib/components/common/Table/Table.tsx +0 -133
  144. package/src/lib/components/common/Toggle/Toggle.tsx +0 -23
  145. package/src/lib/constants/common.ts +0 -145
  146. package/src/lib/context/PageContext.tsx +0 -100
  147. package/src/lib/context/ProviderContext.tsx +0 -52
  148. package/src/lib/context/WidgetContext.tsx +0 -127
  149. package/src/lib/helper/utils.ts +0 -46
  150. package/src/lib/hooks/usePage.tsx +0 -306
  151. package/src/lib/hooks/usePagination.tsx +0 -41
  152. package/src/lib/hooks/useWidget.tsx +0 -503
  153. package/src/lib/icons/chevronDown.tsx +0 -21
  154. package/src/lib/icons/chevronLeft.tsx +0 -20
  155. package/src/lib/icons/chevronRight.tsx +0 -20
  156. package/src/lib/icons/chevronUp.tsx +0 -21
  157. package/src/lib/icons/close.tsx +0 -21
  158. package/src/lib/icons/pencil.tsx +0 -21
  159. package/src/lib/icons/plus.tsx +0 -23
  160. package/src/lib/icons/settings.tsx +0 -35
  161. package/src/lib/icons/trash.tsx +0 -21
  162. package/src/lib/types/api.ts +0 -44
  163. package/src/lib/types/common.ts +0 -31
  164. package/src/lib/types/components.ts +0 -428
  165. package/src/lib/types/context.ts +0 -184
  166. package/src/styles/index.css +0 -481
  167. /package/src/lib/types/{index.ts → index.d.ts} +0 -0
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import { IconProps } from '../types';
3
-
4
- const Trash = ({ srText, className }: IconProps) => {
5
- return (
6
- <>
7
- {srText ? <span className="khb_sr-only">{srText}</span> : null}
8
- <svg
9
- className={className}
10
- xmlns="http://www.w3.org/2000/svg"
11
- viewBox="-4 -2 24 24"
12
- width="24"
13
- fill="currentColor"
14
- >
15
- <path d="M14.833 5l-.728 13.11A2 2 0 0 1 12.108 20H3.892a2 2 0 0 1-1.997-1.89L1.167 5H1a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-.167zM12.83 5H3.17l.722 13h8.216l.722-13zM2 2v1h12V2H2zm4 5a1 1 0 0 1 1 1v7a1 1 0 0 1-2 0V8a1 1 0 0 1 1-1zm4 0a1 1 0 0 1 1 1v7a1 1 0 0 1-2 0V8a1 1 0 0 1 1-1z"></path>
16
- </svg>
17
- </>
18
- );
19
- };
20
-
21
- export default Trash;
@@ -1,44 +0,0 @@
1
- export type ACTION_TYPES =
2
- | 'IMAGE_UPLOAD'
3
- | 'IMAGE_REMOVE'
4
- | 'CREATE'
5
- | 'LIST'
6
- | 'DELETE'
7
- | 'UPDATE'
8
- | 'ITEM'
9
- | 'PARTIAL_UPDATE'
10
- | 'WIDGET_TYPES'
11
- | 'SELECTION_TYPES'
12
- | 'COLLECTION_DATA'
13
- | 'GET_ONE'
14
- | 'LANGUAGES';
15
-
16
- export type API_TYPE = {
17
- url: string;
18
- method: string;
19
- };
20
-
21
- export type API_INPUT_TYPE = { prefix: string; id?: string };
22
-
23
- export type Routes_Input = {
24
- [K in ACTION_TYPES]?: (data: API_INPUT_TYPE) => API_TYPE;
25
- };
26
-
27
- export type ItemsType = { value: string; label: string };
28
- export type WidgetType = { value: string; label: string };
29
-
30
- export interface BaseAPIProps {
31
- config?: any;
32
- baseUrl: string;
33
- token: string | (() => Promise<string>);
34
- data?: any;
35
- url: string;
36
- method: string;
37
- onError?: (error: Error) => void;
38
- }
39
-
40
- export interface ResponseType {
41
- message: string;
42
- code: 'SUCCESS' | 'FAILED';
43
- data: any;
44
- }
@@ -1,31 +0,0 @@
1
- export type FormActionTypes = 'ADD' | 'UPDATE' | 'DELETE' | null | '';
2
- export type TFunc = (key: string) => string;
3
- export type OptionType = { label: string; value: string; code?: string };
4
- export interface PermissionsObj {
5
- list: boolean;
6
- add: boolean;
7
- update: boolean;
8
- partialUpdate: boolean;
9
- delete: boolean;
10
- }
11
- export type LanguageType = { name: string; code: string };
12
- export type ObjectType = {
13
- [key: string]: string;
14
- };
15
- export type CombineObjectType = {
16
- [key: string]:
17
- | string
18
- | boolean
19
- | number
20
- | string[]
21
- | null
22
- | Record<string | number, CombineObjectType>
23
- | CombineObjectType
24
- | CombineObjectType[];
25
- };
26
- export type ValuesType = string | boolean | number | string[];
27
- export interface SrcSetItem {
28
- screenSize: number | string;
29
- width: number | string;
30
- height: number | string;
31
- }
@@ -1,428 +0,0 @@
1
- import React, { MutableRefObject } from 'react';
2
- import { DropResult } from 'react-beautiful-dnd';
3
- import {
4
- FieldValues,
5
- RegisterOptions,
6
- UseFormClearErrors,
7
- UseFormGetValues,
8
- UseFormSetValue,
9
- ValidationRule,
10
- } from 'react-hook-form';
11
- import { Routes_Input } from './api';
12
- import {
13
- OptionType,
14
- FormActionTypes,
15
- PermissionsObj,
16
- ObjectType,
17
- LanguageType,
18
- } from './common';
19
-
20
- export interface DNDItemsListProps {
21
- onDragEnd: (result: DropResult) => void;
22
- items: OptionType[];
23
- listCode?: string;
24
- formatItem?: (code: string, data: any) => JSX.Element;
25
- onFilterClick?: (item: OptionType) => void;
26
- }
27
- export interface DrawerProps {
28
- children?: React.ReactNode;
29
- open: boolean;
30
- onClose?: () => void;
31
- id?: string;
32
- name?: string;
33
- title?: string;
34
- }
35
- export type ButtonTypes = 'primary' | 'secondary' | 'success' | 'danger';
36
- export type ButtonSizes = 'xs' | 'sm' | 'base' | 'lg';
37
- export interface ButtonProps {
38
- children?: React.ReactNode;
39
- type?: ButtonTypes;
40
- size?: ButtonSizes;
41
- onClick?: () => void;
42
- className?: string;
43
- disabled?: boolean;
44
- loading?: boolean;
45
- }
46
- export interface IconProps {
47
- srText?: string;
48
- className?: string;
49
- }
50
- export type InputSizes = 'xs' | 'sm' | 'base' | 'lg';
51
- export interface InputProps {
52
- id?: string;
53
- label?: string;
54
- placeholder?: string;
55
- type?: string;
56
- size?: InputSizes;
57
- className?: string;
58
- error?: string;
59
- errors?: any;
60
- required?: boolean;
61
- disabled?: boolean;
62
- rest?: any;
63
- wrapperClassName?: string;
64
- onInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;
65
- value?: string | number;
66
- onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
67
- onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
68
- control?: any;
69
- register?: any;
70
- info?: string;
71
- name?: string;
72
- }
73
- export interface SrcSetMessageProps {
74
- screenSizeRequired: string;
75
- minScreenSize: string;
76
- widthRequired: string;
77
- minWidth: string;
78
- heightRequired: string;
79
- minHeight: string;
80
- }
81
- export interface HTMLEditorProps {
82
- id?: string;
83
- label?: string;
84
- placeholder?: string;
85
- value?: string;
86
- wrapperClassName?: string;
87
- onChange: (value: string) => void;
88
- onInput?: (e: any) => void;
89
- required?: boolean;
90
- error?: string;
91
- }
92
- export interface CheckboxProps {
93
- rest?: any;
94
- label?: string;
95
- error?: string;
96
- className?: string;
97
- disabled?: boolean;
98
- wrapperClassName?: string;
99
- switchClass?: string;
100
- }
101
- export interface SelectProps {
102
- value?: string | number;
103
- onChange?: (e: React.ChangeEvent<HTMLSelectElement>) => void;
104
- label?: string;
105
- error?: string;
106
- options?: { value: string; label: string }[];
107
- className?: string;
108
- disabled?: boolean;
109
- size?: InputSizes;
110
- id?: string;
111
- rest?: any;
112
- required?: boolean;
113
- wrapperClassName?: string;
114
- }
115
- export interface ReactSelectProps {
116
- onChange?: (opt: OptionType[] | OptionType | null) => void;
117
- label?: string;
118
- error?: string;
119
- options?: { value: string; label: string }[];
120
- className?: string;
121
- disabled?: boolean;
122
- id?: string;
123
- isMulti?: boolean;
124
- required?: boolean;
125
- selectedOptions?: { value: string; label: string }[];
126
- isLoading?: boolean;
127
- isSearchable?: boolean;
128
- placeholder?: string;
129
- formatOptionLabel?: (code: string, data: any) => JSX.Element;
130
- listCode?: string;
131
- wrapperClassName?: string;
132
- customStyles?: any;
133
- loadOptions?: (
134
- value?: string,
135
- callback?: (options: OptionType[]) => void
136
- ) => Promise<OptionType[]>;
137
- selectKey?: string;
138
- }
139
- export interface CustomInputType {
140
- field: import('react-hook-form').ControllerRenderProps;
141
- error?: string;
142
- setError: (msg: string) => void;
143
- }
144
- export interface FormProps {
145
- formRef: MutableRefObject<HTMLFormElement | null>;
146
- customInputs?: Record<string, (props: InputRendererProps) => JSX.Element>;
147
- }
148
- export interface InputRendererProps {
149
- field: import('react-hook-form').ControllerRenderProps;
150
- error?: string;
151
- setError: (msg: string) => void;
152
- disabled?: boolean;
153
- }
154
- export interface WidgetTranslationPairs {
155
- htmlContentRequired: string | ValidationRule<boolean> | undefined;
156
- htmlContentPlaceholder: string | undefined;
157
- htmlContent: string | undefined;
158
- itemsType: string;
159
- itemsTypePlaceholder: string;
160
- widgetType: string;
161
- widgetTypeRequired: string;
162
- color: string;
163
- webPerRow: string;
164
- webPerRowPlaceholder: string;
165
- mobilePerRow: string;
166
- mobilePerRowPlaceholder: string;
167
- tabletPerRow: string;
168
- tabletPerRowPlaceholder: string;
169
- mobileItems: string;
170
- webItems: string;
171
- searchPlaceholder: string;
172
- autoPlay: string;
173
- addWidgetTitle: string;
174
- updateWidgetTitle: string;
175
- webPerRowRequired: string;
176
- tabletPerRowRequired: string;
177
- mobilePerRowRequired: string;
178
- tabDeleteTitle: string;
179
- widgetTitleInfo: string;
180
- minPerRow: string;
181
- tabNameRequired: string;
182
-
183
- subtitle: string;
184
- subTitlePlaceholder: string;
185
- altText: string;
186
- altTextPlaceholder: string;
187
- link: string;
188
- linkPlaceholder: string;
189
- image: string;
190
- uploadFile: string;
191
- dragDrop: string;
192
- allowedFormat: string;
193
- srcset: string;
194
- screenSizeRequired: string;
195
- widthRequired: string;
196
- heightRequired: string;
197
- minScreenSize: string;
198
- minWidth: string;
199
- minHeight: string;
200
- deleteTitle: string;
201
-
202
- textContent: string;
203
- textContentRequired: string;
204
- textContentInfo: string;
205
- textContentPlaceholder: string;
206
- }
207
- export interface WidgetProps {
208
- loader?: any;
209
- routes?: Routes_Input;
210
- explicitForm?: boolean;
211
- permissions?: PermissionsObj;
212
- formatListItem?: (code: string, data: any) => JSX.Element;
213
- formatOptionLabel?: (code: string, data: any) => JSX.Element;
214
- preConfirmDelete?: (data: { row: ObjectType }) => Promise<boolean>;
215
- children?: JSX.Element;
216
- reactSelectStyles?: any;
217
- imageBaseUrl?: string;
218
- imageMaxSize?: number;
219
- translations?: WidgetTranslationPairs;
220
- }
221
- export interface DerivedTableProps {
222
- extraActions?: (item: any) => JSX.Element;
223
- extraColumns?: [
224
- {
225
- label: string;
226
- Cell: (item: any) => JSX.Element;
227
- }
228
- ];
229
- }
230
-
231
- export interface FormWrapperProps {
232
- children: (data: {
233
- formState: FormActionTypes | undefined;
234
- onClose: () => void;
235
- open: boolean;
236
- }) => JSX.Element | null;
237
- }
238
- export interface FormActionWrapperProps {
239
- formRef: MutableRefObject<HTMLFormElement | null>;
240
- }
241
-
242
- export interface SchemaType extends ReactSelectProps {
243
- label?: string;
244
- accessor: string;
245
- Input?: (props: InputRendererProps) => JSX.Element;
246
- validations?: RegisterOptions;
247
- editable?: boolean;
248
- onInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;
249
- type?:
250
- | 'text'
251
- | 'number'
252
- | 'select'
253
- | 'checkbox'
254
- | 'textarea'
255
- | 'file'
256
- | 'url'
257
- | 'ReactSelect'
258
- // | 'srcset'
259
- | 'color'
260
- | 'html';
261
- options?: { value: string; label: string }[];
262
- selectedOptions?: { value: string; label: string }[];
263
- isMulti?: boolean;
264
- placeholder?: string;
265
- required?: boolean;
266
- onChange?: (e: any) => void;
267
- show?: boolean;
268
- wrapperClassName?: string;
269
- switchClass?: string;
270
- info?: string;
271
- customStyles?: any;
272
- }
273
- export interface PageTranslationPairs {
274
- slug: string;
275
- slugPlaceholder: string;
276
- slugRequired: string;
277
- addPage: string;
278
- updatePage: string;
279
- searchPages: string;
280
- widgets: string;
281
- }
282
- export interface PageProps {
283
- loader?: any;
284
- explicitForm?: boolean;
285
- children?: JSX.Element;
286
- permissions?: PermissionsObj;
287
- translations?: PageTranslationPairs;
288
- preConfirmDelete?: (data: { row: ObjectType }) => Promise<boolean>;
289
- }
290
- export interface PaginationProps {
291
- totalPages: number;
292
- totalRecords: number;
293
- currentPage: number;
294
- pageSize: number;
295
- setCurrentPage: (value: number) => void;
296
- showingText?: string;
297
- pageText?: string;
298
- ofText?: string;
299
- previousContent?: string | React.ReactNode;
300
- nextContent?: string | React.ReactNode;
301
- }
302
- export interface ItemsAccordianProps {
303
- id: string;
304
- show: boolean;
305
- title: string;
306
- collapseId: string;
307
- toggleShow: (status: boolean) => void;
308
- addText?: string;
309
- deleteText?: string;
310
- loading?: boolean;
311
- languages?: LanguageType[];
312
-
313
- name: string;
314
- itemType: 'Web' | 'Mobile';
315
- errors: any;
316
- control: any;
317
- register: any;
318
- setError: any;
319
- clearError: (key: string) => void;
320
- }
321
- export interface TabItemProps {
322
- showDelete?: boolean;
323
- isDisabled?: boolean;
324
- deleteTitle: string;
325
- onRemoveTab: () => void;
326
- register?: any;
327
- noButtonText: string;
328
- yesButtonText: string;
329
- error?: string;
330
- }
331
- export interface TabsProps {
332
- activeTab: number;
333
- setActiveTab: (value: number) => void;
334
- onSubmit?: () => void;
335
- control: any;
336
- options?: { value: string; label: string }[];
337
- deleteTitle: string;
338
- listCode: string;
339
- noButtonText: string;
340
- yesButtonText: string;
341
- itemsPlaceholder?: string;
342
- formatOptionLabel?: (code: string, data: any) => JSX.Element;
343
- isItemsLoading?: boolean;
344
- formatItem?: (code: string, data: any) => JSX.Element;
345
- onCollectionItemsIndexChange: (index: number, data: DropResult) => void;
346
- tabCollectionItems: any[];
347
- errors?: { [key: string]: any };
348
- customStyles?: any;
349
- clearErrors: UseFormClearErrors<FieldValues>;
350
- getValues: UseFormGetValues<FieldValues>;
351
- setValue: UseFormSetValue<FieldValues>;
352
- languages?: LanguageType[];
353
- loadOptions?: (
354
- value?: string,
355
- callback?: (options: OptionType[]) => void
356
- ) => Promise<OptionType[]>;
357
- }
358
-
359
- export interface ImageUploadProps {
360
- className?: string;
361
- text: string | JSX.Element;
362
- maxSize: number;
363
- imgId?: string | ObjectType;
364
- setImgId: (value?: string | null) => void;
365
- clearError?: () => void;
366
- onError: (msg: string) => void;
367
- onImageUpload: (
368
- file: File
369
- ) => Promise<{ fileUrl: string; fileId: string; fileUri: string } | void>;
370
- onImageRemove?: (id: string) => Promise<void>;
371
- baseUrl: string;
372
- error?: string;
373
- disabled?: boolean;
374
- }
375
- export interface ToggleProps {
376
- isChecked?: boolean;
377
- disabled?: boolean;
378
- onChange?: (status: boolean) => void;
379
- switchClass?: string;
380
- }
381
- export interface ConfirmPopoverProps {
382
- children?: JSX.Element;
383
- onConfirm: () => void;
384
- confirmText?: string;
385
- cancelText?: string;
386
- title: string;
387
- }
388
- export interface DeleteModalProps {
389
- formState: FormActionTypes | undefined;
390
- onClose: () => void;
391
- itemData: ObjectType;
392
- onConfirmDelete: () => void;
393
- confirmationRequired?: string;
394
- permanentlyDelete?: string;
395
- lossOfData?: string;
396
- pleaseType?: string;
397
- toProceedOrCancel?: string;
398
- confirm?: string;
399
- typeHerePlaceholder?: string;
400
- }
401
- // Table
402
- export type CellInputType = (parameters: {
403
- row: any;
404
- onUpdate?: (row: any) => void;
405
- }) => JSX.Element | null | string;
406
- export type TableDataItemFormat = {
407
- label: string;
408
- dataKey: string;
409
- highlight?: boolean;
410
- Cell?: CellInputType;
411
- };
412
- export interface TableProps {
413
- data: any[];
414
- dataKeys: TableDataItemFormat[];
415
- loading?: boolean;
416
- loader?: any;
417
- actions?: {
418
- edit?: ((data: { [key: string]: any }) => void) | boolean;
419
- delete?: ((data: { [key: string]: any }) => void) | boolean;
420
- };
421
- actionsLabel: string;
422
- extraActions?: (item: any) => JSX.Element;
423
- extraColumns?: [{
424
- label: string
425
- Cell: (item: any) => JSX.Element;
426
- }]
427
- }
428
- // \ End Table
@@ -1,184 +0,0 @@
1
- import { WidgetType, ItemsType } from './api';
2
- import { FormActionTypes, LanguageType, OptionType } from './common';
3
- import { WidgetTranslationPairs, PageTranslationPairs } from './components';
4
-
5
- export interface CommonTranslationPairs {
6
- confirmationRequired: string;
7
- permanentlyDelete: string;
8
- lossOfData: string;
9
- pleaseType: string;
10
- toProceedOrCancel: string;
11
- confirm: string;
12
- next: string;
13
- previous: string;
14
- page: string;
15
- indicatesRequired: string;
16
- cancel: string;
17
- yes: string;
18
- delete: string;
19
- create: string;
20
- update: string;
21
- showing: string;
22
- add: string;
23
- of: string;
24
- typeHerePlaceholder: string;
25
-
26
- code: string;
27
- codePlaceholder: string;
28
- codeRequired: string;
29
- name: string;
30
- namePlaceholder: string;
31
- nameRequired: string;
32
- title: string;
33
- titlePlaceholder: string;
34
- titleRequired: string;
35
-
36
- active: string;
37
- actions: string;
38
- }
39
-
40
- export interface ProviderContextType {
41
- baseUrl: string;
42
- token: string | (() => Promise<string>);
43
- onError: (
44
- callback_code: import('../constants/common').CALLBACK_CODES,
45
- code: string,
46
- message: string
47
- ) => void;
48
- onSuccess: (
49
- callback_code: import('../constants/common').CALLBACK_CODES,
50
- code: string,
51
- message: string
52
- ) => void;
53
- switchClass: string;
54
- onLogout: () => void;
55
- commonTranslations: CommonTranslationPairs;
56
- widgetRoutesPrefix: string;
57
- pageRoutesPrefix: string;
58
- }
59
- export interface ProviderContextProviderProps
60
- extends React.PropsWithChildren,
61
- Omit<
62
- ProviderContextType,
63
- | 'onError'
64
- | 'onSuccess'
65
- | 'onLogout'
66
- | 'widgetRoutesPrefix'
67
- | 'itemsRoutesPrefix'
68
- | 'pageRoutesPrefix'
69
- | 'switchClass'
70
- | 'commonTranslations'
71
- > {
72
- onError?: (
73
- callback_code: import('../constants/common').CALLBACK_CODES,
74
- code: string,
75
- message: string
76
- ) => void;
77
- onSuccess?: (
78
- callback_code: import('../constants/common').CALLBACK_CODES,
79
- code: string,
80
- message: string
81
- ) => void;
82
- onLogout?: () => void;
83
- switchClass?: string;
84
- widgetRoutesPrefix?: string;
85
- itemsRoutesPrefix?: string;
86
- pageRoutesPrefix?: string;
87
- translations?: Partial<CommonTranslationPairs>;
88
- }
89
-
90
- export interface WidgetContextType {
91
- // Form
92
- list: any[];
93
- languages: LanguageType[];
94
- searchText?: string;
95
- changeSearch: (str: string) => void;
96
- formState: FormActionTypes | undefined;
97
- closeForm: () => void;
98
- onWidgetFormSubmit: (data: any) => void;
99
- onChangeFormState: (status: FormActionTypes, data?: any) => void;
100
- updateData: any;
101
- loading: boolean;
102
- canAdd: boolean;
103
- canUpdate: boolean;
104
- onDeleteItem: (id: string) => void;
105
- getWidgets: (searchText?: string) => void;
106
- onImageUpload: (
107
- file: File
108
- ) => Promise<{ fileUrl: string; fileId: string; fileUri: string } | void>;
109
- onImageRemove: (id: string) => Promise<void>;
110
- itemsTypes: ItemsType[];
111
- widgetTypes: WidgetType[];
112
- getCollectionData: (
113
- collectionName: string,
114
- search?: string,
115
- callback?: (options: OptionType[]) => void,
116
- collectionItems?: string[]
117
- ) => Promise<void>;
118
- collectionDataLoading: boolean;
119
- collectionData: any[];
120
- formatListItem?: (code: string, data: any) => JSX.Element;
121
- formatOptionLabel?: (code: string, data: any) => JSX.Element;
122
- // Pagination
123
- currentPage: number;
124
- setCurrentPage: (page: number) => void;
125
- totalPages: number;
126
- pageSize: number;
127
- setPageSize: (size: number) => void;
128
- totalRecords: number;
129
- limits: number[];
130
- // Table
131
- canList: boolean;
132
- canPartialUpdate: boolean;
133
- columns: any[]; //ColumnsSchema
134
- data: any;
135
- loader?: JSX.Element;
136
- canDelete?: boolean;
137
- onPartialUpdateWidget: (data: any, id: string) => Promise<void>;
138
- reactSelectStyles?: any;
139
- imageBaseUrl?: string;
140
- imageMaxSize: number;
141
- widgetTranslations: WidgetTranslationPairs;
142
- }
143
-
144
- export interface PageContextType {
145
- // Form
146
- list: any[];
147
- searchText: string;
148
- changeSearch: (val: string) => void;
149
- getWidgets: (
150
- search: string,
151
- collectionItems: string[],
152
- callback?: (data: any) => void
153
- ) => void;
154
- formState: FormActionTypes | undefined;
155
- closeForm: () => void;
156
- onPageFormSubmit: (data: any) => void;
157
- onChangeFormState: (status: FormActionTypes, data?: any) => void;
158
- loading: boolean;
159
- canAdd: boolean;
160
- canUpdate: boolean;
161
- widgets: any[];
162
- selectedWidgets: OptionType[];
163
- setSelectedWidgets: (widgets: OptionType[]) => void;
164
- onChangeWidgetSequence: (
165
- souceIndex: number,
166
- destinationIndex: number
167
- ) => void;
168
- getPages: (searchText: string) => void;
169
- // Pagination
170
- currentPage: number;
171
- setCurrentPage: (page: number) => void;
172
- totalPages: number;
173
- pageSize: number;
174
- setPageSize: (size: number) => void;
175
- totalRecords: number;
176
- limits: number[];
177
- // Table
178
- canList: boolean;
179
- columns: any[]; //ColumnsSchema
180
- data: any;
181
- loader?: JSX.Element;
182
- canDelete?: boolean;
183
- pageTranslations: PageTranslationPairs;
184
- }