@solidstarters/solid-core-ui 1.1.47 → 1.1.49

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 (166) hide show
  1. package/dist/components/core/common/FilterComponent.d.ts.map +1 -1
  2. package/dist/components/core/common/FilterComponent.js +26 -10
  3. package/dist/components/core/common/FilterComponent.js.map +1 -1
  4. package/dist/components/core/common/SolidGlobalSearchElement.d.ts.map +1 -1
  5. package/dist/components/core/common/SolidGlobalSearchElement.js +160 -94
  6. package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
  7. package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
  8. package/dist/components/core/form/SolidFormView.js +43 -16
  9. package/dist/components/core/form/SolidFormView.js.map +1 -1
  10. package/dist/components/core/form/fields/ISolidField.d.ts +1 -0
  11. package/dist/components/core/form/fields/ISolidField.d.ts.map +1 -1
  12. package/dist/components/core/form/fields/SolidBooleanField.d.ts.map +1 -1
  13. package/dist/components/core/form/fields/SolidBooleanField.js +9 -2
  14. package/dist/components/core/form/fields/SolidBooleanField.js.map +1 -1
  15. package/dist/components/core/form/fields/SolidDateField.d.ts.map +1 -1
  16. package/dist/components/core/form/fields/SolidDateField.js +27 -11
  17. package/dist/components/core/form/fields/SolidDateField.js.map +1 -1
  18. package/dist/components/core/form/fields/SolidDateTimeField.d.ts.map +1 -1
  19. package/dist/components/core/form/fields/SolidDateTimeField.js +28 -11
  20. package/dist/components/core/form/fields/SolidDateTimeField.js.map +1 -1
  21. package/dist/components/core/form/fields/SolidDecimalField.d.ts.map +1 -1
  22. package/dist/components/core/form/fields/SolidDecimalField.js +24 -5
  23. package/dist/components/core/form/fields/SolidDecimalField.js.map +1 -1
  24. package/dist/components/core/form/fields/SolidEmailField.d.ts.map +1 -1
  25. package/dist/components/core/form/fields/SolidEmailField.js +24 -5
  26. package/dist/components/core/form/fields/SolidEmailField.js.map +1 -1
  27. package/dist/components/core/form/fields/SolidIntegerField.d.ts.map +1 -1
  28. package/dist/components/core/form/fields/SolidIntegerField.js +24 -5
  29. package/dist/components/core/form/fields/SolidIntegerField.js.map +1 -1
  30. package/dist/components/core/form/fields/SolidJsonField.d.ts.map +1 -1
  31. package/dist/components/core/form/fields/SolidJsonField.js +22 -3
  32. package/dist/components/core/form/fields/SolidJsonField.js.map +1 -1
  33. package/dist/components/core/form/fields/SolidLongTextField.d.ts.map +1 -1
  34. package/dist/components/core/form/fields/SolidLongTextField.js +30 -4
  35. package/dist/components/core/form/fields/SolidLongTextField.js.map +1 -1
  36. package/dist/components/core/form/fields/SolidMediaMultipleField.d.ts.map +1 -1
  37. package/dist/components/core/form/fields/SolidMediaMultipleField.js +52 -29
  38. package/dist/components/core/form/fields/SolidMediaMultipleField.js.map +1 -1
  39. package/dist/components/core/form/fields/SolidMediaSingleField.d.ts.map +1 -1
  40. package/dist/components/core/form/fields/SolidMediaSingleField.js +39 -16
  41. package/dist/components/core/form/fields/SolidMediaSingleField.js.map +1 -1
  42. package/dist/components/core/form/fields/SolidPasswordField.d.ts.map +1 -1
  43. package/dist/components/core/form/fields/SolidPasswordField.js +23 -3
  44. package/dist/components/core/form/fields/SolidPasswordField.js.map +1 -1
  45. package/dist/components/core/form/fields/SolidRichTextField.d.ts.map +1 -1
  46. package/dist/components/core/form/fields/SolidRichTextField.js +23 -3
  47. package/dist/components/core/form/fields/SolidRichTextField.js.map +1 -1
  48. package/dist/components/core/form/fields/SolidSelectionDynamicField.d.ts.map +1 -1
  49. package/dist/components/core/form/fields/SolidSelectionDynamicField.js +14 -5
  50. package/dist/components/core/form/fields/SolidSelectionDynamicField.js.map +1 -1
  51. package/dist/components/core/form/fields/SolidSelectionStaticField.d.ts.map +1 -1
  52. package/dist/components/core/form/fields/SolidSelectionStaticField.js +10 -2
  53. package/dist/components/core/form/fields/SolidSelectionStaticField.js.map +1 -1
  54. package/dist/components/core/form/fields/SolidShortTextField.d.ts.map +1 -1
  55. package/dist/components/core/form/fields/SolidShortTextField.js +28 -8
  56. package/dist/components/core/form/fields/SolidShortTextField.js.map +1 -1
  57. package/dist/components/core/form/fields/SolidTimeField.d.ts.map +1 -1
  58. package/dist/components/core/form/fields/SolidTimeField.js +27 -8
  59. package/dist/components/core/form/fields/SolidTimeField.js.map +1 -1
  60. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts.map +1 -1
  61. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +15 -4
  62. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
  63. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.d.ts.map +1 -1
  64. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +13 -4
  65. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
  66. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.d.ts.map +1 -1
  67. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js +17 -5
  68. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js.map +1 -1
  69. package/dist/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.js +1 -1
  70. package/dist/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.js.map +1 -1
  71. package/dist/components/core/form/fields/widgets/SolidBooleanSelectFieldWidget.js +1 -1
  72. package/dist/components/core/form/fields/widgets/SolidBooleanSelectFieldWidget.js.map +1 -1
  73. package/dist/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.d.ts +2 -0
  74. package/dist/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.d.ts.map +1 -0
  75. package/dist/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.js +9 -0
  76. package/dist/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.js.map +1 -0
  77. package/dist/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.d.ts +2 -0
  78. package/dist/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.d.ts.map +1 -0
  79. package/dist/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.js +8 -0
  80. package/dist/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.js.map +1 -0
  81. package/dist/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.d.ts +2 -0
  82. package/dist/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.d.ts.map +1 -0
  83. package/dist/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.js +9 -0
  84. package/dist/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.js.map +1 -0
  85. package/dist/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.d.ts +2 -0
  86. package/dist/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.d.ts.map +1 -0
  87. package/dist/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.js +20 -0
  88. package/dist/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.js.map +1 -0
  89. package/dist/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.d.ts +2 -0
  90. package/dist/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.d.ts.map +1 -0
  91. package/dist/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.js +7 -0
  92. package/dist/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.js.map +1 -0
  93. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.d.ts +3 -0
  94. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.d.ts.map +1 -0
  95. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.js +74 -0
  96. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.js.map +1 -0
  97. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.d.ts +3 -0
  98. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.d.ts.map +1 -0
  99. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.js +58 -0
  100. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.js.map +1 -0
  101. package/dist/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.d.ts +2 -0
  102. package/dist/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.d.ts.map +1 -0
  103. package/dist/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.js +6 -0
  104. package/dist/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.js.map +1 -0
  105. package/dist/components/core/form/fields/widgets/SolidSelectionStaticAutocompleteFieldWidget.js +1 -1
  106. package/dist/components/core/form/fields/widgets/SolidSelectionStaticAutocompleteFieldWidget.js.map +1 -1
  107. package/dist/components/core/form/fields/widgets/SolidSelectionStaticRadioFieldWidget.js +1 -1
  108. package/dist/components/core/form/fields/widgets/SolidSelectionStaticRadioFieldWidget.js.map +1 -1
  109. package/dist/components/core/kanban/SolidKanbanView.d.ts.map +1 -1
  110. package/dist/components/core/kanban/SolidKanbanView.js +37 -14
  111. package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
  112. package/dist/components/core/list/SolidListView.d.ts +3 -0
  113. package/dist/components/core/list/SolidListView.d.ts.map +1 -1
  114. package/dist/components/core/list/SolidListView.js +167 -95
  115. package/dist/components/core/list/SolidListView.js.map +1 -1
  116. package/dist/components/core/model/FieldMetaDataForm.js +1 -1
  117. package/dist/components/core/model/FieldMetaDataForm.js.map +1 -1
  118. package/dist/components/core/users/CreateUser.js +1 -3
  119. package/dist/components/core/users/CreateUser.js.map +1 -1
  120. package/dist/helpers/registry.d.ts.map +1 -1
  121. package/dist/helpers/registry.js +16 -0
  122. package/dist/helpers/registry.js.map +1 -1
  123. package/dist/resources/globals.css +15 -2
  124. package/package.json +1 -1
  125. package/src/components/core/common/FilterComponent.tsx +39 -10
  126. package/src/components/core/common/SolidGlobalSearchElement.tsx +228 -135
  127. package/src/components/core/form/SolidFormView.tsx +69 -21
  128. package/src/components/core/form/fields/ISolidField.tsx +1 -0
  129. package/src/components/core/form/fields/SolidBooleanField.tsx +39 -25
  130. package/src/components/core/form/fields/SolidDateField.tsx +46 -32
  131. package/src/components/core/form/fields/SolidDateTimeField.tsx +47 -34
  132. package/src/components/core/form/fields/SolidDecimalField.tsx +42 -26
  133. package/src/components/core/form/fields/SolidEmailField.tsx +43 -27
  134. package/src/components/core/form/fields/SolidIntegerField.tsx +42 -25
  135. package/src/components/core/form/fields/SolidJsonField.tsx +40 -23
  136. package/src/components/core/form/fields/SolidLongTextField.tsx +86 -53
  137. package/src/components/core/form/fields/SolidMediaMultipleField.tsx +170 -139
  138. package/src/components/core/form/fields/SolidMediaSingleField.tsx +124 -93
  139. package/src/components/core/form/fields/SolidPasswordField.tsx +42 -25
  140. package/src/components/core/form/fields/SolidRichTextField.tsx +41 -24
  141. package/src/components/core/form/fields/SolidSelectionDynamicField.tsx +46 -28
  142. package/src/components/core/form/fields/SolidSelectionStaticField.tsx +38 -22
  143. package/src/components/core/form/fields/SolidShortTextField.tsx +63 -47
  144. package/src/components/core/form/fields/SolidTimeField.tsx +47 -30
  145. package/src/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +30 -8
  146. package/src/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +49 -31
  147. package/src/components/core/form/fields/relations/SolidRelationOneToManyField.tsx +38 -19
  148. package/src/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.tsx +1 -1
  149. package/src/components/core/form/fields/widgets/SolidBooleanSelectFieldWidget.tsx +1 -1
  150. package/src/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.tsx +23 -0
  151. package/src/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.tsx +13 -0
  152. package/src/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.tsx +23 -0
  153. package/src/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.tsx +32 -0
  154. package/src/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.tsx +17 -0
  155. package/src/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.tsx +157 -0
  156. package/src/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.tsx +98 -0
  157. package/src/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.tsx +11 -0
  158. package/src/components/core/form/fields/widgets/SolidSelectionStaticAutocompleteFieldWidget.tsx +1 -1
  159. package/src/components/core/form/fields/widgets/SolidSelectionStaticRadioFieldWidget.tsx +1 -1
  160. package/src/components/core/kanban/SolidKanbanView.tsx +26 -5
  161. package/src/components/core/list/SolidListView.tsx +166 -105
  162. package/src/components/core/model/FieldMetaDataForm.tsx +1 -1
  163. package/src/components/core/users/CreateUser.tsx +5 -5
  164. package/src/helpers/registry.ts +16 -0
  165. package/src/resources/globals.css +15 -2
  166. package/src/types/solid-core.d.ts +6 -1
@@ -23,7 +23,7 @@ import { SolidGlobalSearchElement } from "../common/SolidGlobalSearchElement";
23
23
  import { pascalCase } from "change-case";
24
24
  import { useLazyCheckIfPermissionExistsQuery } from "@/redux/api/userApi";
25
25
  import { createPermission, deletePermission, updatePermission } from "@/helpers/permissions";
26
- import { useRouter } from "next/navigation";
26
+ import { usePathname, useRouter, useSearchParams } from "next/navigation";
27
27
  import { ListViewRowActionPopup } from "./ListViewRowActionPopup";
28
28
  import FilterComponent, { FilterOperator, FilterRule, FilterRuleType } from "@/components/core/common/FilterComponent";
29
29
  import { SolidLayoutViews } from '../common/SolidLayoutViews'
@@ -36,7 +36,7 @@ import CozyImage from '../../../resources/images/layout/images/cozy.png';
36
36
  import ComfortableImage from '../../../resources/images/layout/images/comfortable.png';
37
37
  import ListImage from '../../../resources/images/layout/images/cozy.png';
38
38
  import KanbanImage from '../../../resources/images/layout/images/kanban.png';
39
- import { capitalize } from "lodash";
39
+ import { capitalize, filter, set } from "lodash";
40
40
  import Lightbox from "yet-another-react-lightbox";
41
41
  import Counter from "yet-another-react-lightbox/plugins/counter";
42
42
  import Download from "yet-another-react-lightbox/plugins/download";
@@ -44,10 +44,40 @@ import "yet-another-react-lightbox/styles.css";
44
44
  import "yet-another-react-lightbox/plugins/counter.css";
45
45
  import { SolidListViewConfigure } from "./SolidListViewConfigure";
46
46
 
47
+
47
48
  const getRandomInt = (min: number, max: number) => {
48
49
  return Math.floor(Math.random() * (max - min + 1)) + min;
49
50
  }
50
51
 
52
+ export const queryStringToQueryObject = () => {
53
+ const currentPageUrl = window.location.href; // Get the current page URL
54
+ const encodedQueryString = localStorage.getItem(currentPageUrl); // Retrieve the encoded query string from local storage
55
+
56
+ if (encodedQueryString) {
57
+ try {
58
+ const decodedQueryString = atob(encodedQueryString); // Base64 decode the string
59
+ const parsedParams = qs.parse(decodedQueryString); // Parse the decoded string into an object
60
+ console.log("Parsed Params from Local Storage:", parsedParams);
61
+ return parsedParams;
62
+ } catch (error) {
63
+ console.error("Error decoding or parsing query string from local storage:", error);
64
+ }
65
+ };
66
+
67
+ };
68
+ export const queryObjectToQueryString = (queryObject: string) => {
69
+ if (queryObject) {
70
+ const stringifiedObject = qs.stringify(queryObject);
71
+ const encodedQueryString = btoa(stringifiedObject); // Base64 encode the stringified object
72
+ const currentPageUrl = window.location.href; // Get the current page URL
73
+ localStorage.setItem(currentPageUrl, encodedQueryString); // Store in local storage with the URL as the key
74
+ console.log("Encoded and stored queryObject in localStorage:", encodedQueryString);
75
+
76
+ return encodedQueryString;
77
+ }
78
+ return null;
79
+ };
80
+
51
81
  type SolidListViewParams = {
52
82
  moduleName: string;
53
83
  modelName: string;
@@ -64,8 +94,10 @@ export const SolidListView = (params: SolidListViewParams) => {
64
94
 
65
95
 
66
96
  const router = useRouter()
97
+ const searchParams = useSearchParams().toString(); // Converts the query params to a string
98
+
67
99
  // TODO: The initial filter state will be created based on the fields which are present on this list view.
68
- const [filters, setFilters] = useState<any>();
100
+ const [filters, setFilters] = useState<any>(params.customFilter || null);
69
101
  // const [customFilter, setCustomFilter] = useState<FilterRule[]>(initialState);
70
102
  // const [showGlobalSearchElement, setShowGlobalSearchElement] = useState<boolean>(false);
71
103
 
@@ -74,8 +106,8 @@ export const SolidListView = (params: SolidListViewParams) => {
74
106
  const [actionsAllowed, setActionsAllowed] = useState<string[]>([]);
75
107
 
76
108
  const [triggerCheckIfPermissionExists] = useLazyCheckIfPermissionExistsQuery();
77
- useEffect(() => {
78
109
 
110
+ useEffect(() => {
79
111
  const fetchPermissions = async () => {
80
112
  if (params.modelName) {
81
113
  const permissionNames = [
@@ -130,8 +162,8 @@ export const SolidListView = (params: SolidListViewParams) => {
130
162
 
131
163
  const initialFilterMethod = () => {
132
164
 
133
- const solidView = solidListViewMetaData.data.solidView;
134
- const solidFieldsMetadata = solidListViewMetaData.data.solidFieldsMetadata;
165
+ const solidView = solidListViewMetaData?.data?.solidView;
166
+ const solidFieldsMetadata = solidListViewMetaData?.data?.solidFieldsMetadata;
135
167
 
136
168
  const initialFilters: any = {};
137
169
  const toPopulate: string[] = [];
@@ -139,7 +171,7 @@ export const SolidListView = (params: SolidListViewParams) => {
139
171
 
140
172
  for (let i = 0; i < solidView.layout.children?.length; i++) {
141
173
  const column = solidView.layout.children[i];
142
- const fieldMetadata = solidFieldsMetadata[column.attrs.name];
174
+ const fieldMetadata = solidFieldsMetadata?.[column.attrs.name];
143
175
  if (!fieldMetadata?.type) {
144
176
  showFieldError(`${column.attrs.label} is not present in metadata`)
145
177
  return;
@@ -174,28 +206,50 @@ export const SolidListView = (params: SolidListViewParams) => {
174
206
  }
175
207
  }
176
208
  // setFilters(initialFilters);
177
- setRows(solidListViewMetaData?.data?.solidView?.layout?.attrs?.defaultPageSize ? solidListViewMetaData?.data?.solidView?.layout?.attrs.defaultPageSize : 25)
178
- setToPopulate(toPopulate);
179
- setToPopulateMedia(toPopulateMedia);
209
+ const rows = solidListViewMetaData?.data?.solidView?.layout?.attrs?.defaultPageSize ?? 25;
210
+ const populate = toPopulate;
211
+ const populateMedia = toPopulateMedia;
212
+ setRows(rows);
213
+ setToPopulate(populate);
214
+ setToPopulateMedia(populateMedia);
215
+ setSortField('id');
216
+ setSortOrder(-1);
217
+ return { rows, populate, populateMedia }
180
218
  }
181
219
 
220
+ // Set the initial filter state based on the metadata.
182
221
  useEffect(() => {
183
222
  // refetch();
184
223
  if (solidListViewMetaData) {
185
224
  if (params.customLayout) {
186
- const upatedSolidListViewMetaData = structuredClone(solidListViewMetaData);
187
- upatedSolidListViewMetaData.data.solidView.layout = params.customLayout;
188
- setListViewMetaData(upatedSolidListViewMetaData);
189
-
225
+ const updatedSolidListViewMetaData = structuredClone(solidListViewMetaData);
226
+ if (updatedSolidListViewMetaData?.data?.solidView?.layout) {
227
+ updatedSolidListViewMetaData.data.solidView.layout = params.customLayout;
228
+ }
229
+ setListViewMetaData(updatedSolidListViewMetaData);
190
230
  } else {
191
231
  setListViewMetaData(solidListViewMetaData);
192
-
193
232
  }
194
-
195
- initialFilterMethod()
233
+ // initialFilterMethod()
196
234
  }
197
235
  }, [solidListViewMetaData]);
198
236
 
237
+ // set layout and actions for create and edit buttons and view modes
238
+ useEffect(() => {
239
+ if (solidListViewMetaData) {
240
+ const createActionUrl = solidListViewMetaData?.data?.solidView?.layout?.attrs?.createAction && solidListViewMetaData?.data?.solidView?.layout?.attrs?.createAction?.type === "custom" ? solidListViewMetaData?.data?.solidView?.layout?.attrs?.createAction?.customComponent : "form/new";
241
+ const editActionUrl = solidListViewMetaData?.data?.solidView?.layout?.attrs?.editAction && solidListViewMetaData?.data?.solidView?.layout?.attrs?.editAction?.type === "custom" ? solidListViewMetaData?.data?.solidView?.layout?.attrs?.editAction?.customComponent : "form";
242
+ const viewModes = solidListViewMetaData?.data?.solidView?.layout?.attrs?.allowedViews && solidListViewMetaData?.data?.solidView?.layout?.attrs?.allowedViews.length > 0 && solidListViewMetaData?.data?.solidView?.layout?.attrs?.allowedViews.map((view: any) => { return { label: capitalize(view), value: view } });
243
+ setViewModes(viewModes);
244
+ if (createActionUrl) {
245
+ setCreateButtonUrl(createActionUrl)
246
+ }
247
+ if (editActionUrl) {
248
+ setEditButtonUrl(editActionUrl)
249
+ }
250
+ }
251
+ }, [solidListViewMetaData])
252
+
199
253
 
200
254
  // All list view state.
201
255
  const [listViewData, setListViewData] = useState<any[]>([]);
@@ -212,7 +266,8 @@ export const SolidListView = (params: SolidListViewParams) => {
212
266
  const [createButtonUrl, setCreateButtonUrl] = useState<string>();
213
267
  const [editButtonUrl, setEditButtonUrl] = useState<string>();
214
268
  const [showArchived, setShowArchived] = useState(false);
215
-
269
+ const [queryDataLoaded, setQueryDataLoaded] = useState(false);
270
+ const [customFilter, setCustomFilter] = useState(null);
216
271
  const sizeOptions = [
217
272
  { label: 'Compact', value: 'small', image: CompactImage },
218
273
  { label: 'Cozy', value: 'normal', image: CozyImage },
@@ -227,8 +282,6 @@ export const SolidListView = (params: SolidListViewParams) => {
227
282
  const [size, setSize] = useState<string | any>(sizeOptions[1].value);
228
283
  const [viewModes, setViewModes] = useState<any>([]);
229
284
 
230
-
231
-
232
285
  // Custom Row Action
233
286
  const [listViewRowActionPopupState, setListViewRowActionPopupState] = useState(false);
234
287
  const [listViewRowActionData, setListRowActionData] = useState<any>();
@@ -248,25 +301,9 @@ export const SolidListView = (params: SolidListViewParams) => {
248
301
  setListViewData(solidEntityListViewData?.records);
249
302
  setTotalRecords(solidEntityListViewData?.meta.totalRecords);
250
303
  setLoading(false);
251
-
252
304
  }
253
305
  }, [solidEntityListViewData]);
254
306
 
255
-
256
- useEffect(() => {
257
- if (solidListViewMetaData) {
258
- const createActionUrl = solidListViewMetaData?.data?.solidView?.layout?.attrs?.createAction && solidListViewMetaData?.data?.solidView?.layout?.attrs?.createAction?.type === "custom" ? solidListViewMetaData?.data?.solidView?.layout?.attrs?.createAction?.customComponent : "form/new";
259
- const editActionUrl = solidListViewMetaData?.data?.solidView?.layout?.attrs?.editAction && solidListViewMetaData?.data?.solidView?.layout?.attrs?.editAction?.type === "custom" ? solidListViewMetaData?.data?.solidView?.layout?.attrs?.editAction?.customComponent : "form";
260
- const viewModes = solidListViewMetaData?.data?.solidView?.layout?.attrs?.allowedViews && solidListViewMetaData?.data?.solidView?.layout?.attrs?.allowedViews.length > 0 && solidListViewMetaData?.data?.solidView?.layout?.attrs?.allowedViews.map((view: any) => { return { label: capitalize(view), value: view } });
261
- setViewModes(viewModes);
262
- if (createActionUrl) {
263
- setCreateButtonUrl(createActionUrl)
264
- }
265
- if (editActionUrl) {
266
- setEditButtonUrl(editActionUrl)
267
- }
268
- }
269
- }, [solidListViewMetaData])
270
307
  const [deleteSolidSingleEntiry, { isSuccess: isDeleteSolidSingleEntitySuccess }] = useDeleteSolidEntityMutation()
271
308
 
272
309
  // Delete mutation
@@ -281,57 +318,69 @@ export const SolidListView = (params: SolidListViewParams) => {
281
318
  },
282
319
  ] = useDeleteMultipleSolidEntitiesMutation();
283
320
 
284
- // Fetch Soft Deleted data
285
- useEffect(() => {
286
- const queryData = {
287
- offset: 0,
288
- limit: 25,
289
- populate: toPopulate,
290
- sort: [`id:desc`],
291
- };
292
- if (showArchived) {
293
- queryData.showSoftDeleted = 'inclusive';
294
- }
295
- const queryString = qs.stringify(queryData, {
296
- encodeValuesOnly: true
297
- });
298
-
299
- triggerGetSolidEntities(queryString);
300
- setSelectedRecords([]);
301
- setSelectedRecoverRecords([]);
302
- }, [showArchived, recoverByIdIsSuccess, recoverByIsSuccess]);
303
-
304
321
 
305
322
  // Fetch data after toPopulate has been populated...
306
323
  useEffect(() => {
307
- if (toPopulate || toPopulateMedia) {
308
- const queryData = {
309
- offset: 0,
310
- limit: 25,
311
- populate: toPopulate,
312
- populateMedia: toPopulateMedia,
313
- sort: [`id:desc`],
314
- filters: { ...params.customFilter }
315
- };
316
- if (params.embeded) {
324
+ if (solidListViewMetaData) {
325
+ const queryObject = queryStringToQueryObject();
317
326
 
327
+ if (queryObject) {
328
+ const queryData = {
329
+ offset: queryObject.offset || 0,
330
+ limit: queryObject.limit || 25,
331
+ populate: queryObject.populate,
332
+ populateMedia: queryObject.populateMedia,
333
+ sort: queryObject.sort ? queryObject.sort?.map((sortItem: string) => {
334
+ const [field, order] = sortItem.split(":");
335
+ return { field, order };
336
+ }) : [`id:desc`],
337
+ filters: queryObject.filters
338
+ };
339
+ const filters = {
340
+ $and: []
341
+ }
342
+ if (queryObject.s_filter) {
343
+ filters.$and.push(queryObject.s_filter);
344
+ }
345
+ if (queryObject.c_filter) {
346
+ filters.$and.push(queryObject.c_filter);
347
+ }
348
+ setRows(queryData.limit);
349
+ setToPopulate(queryData?.populate);
350
+ setToPopulateMedia(queryData?.populateMedia);
351
+ setFirst(queryData?.offset);
352
+ setSortField(queryData?.sort[0]?.field);
353
+ setSortOrder(queryData?.sort[0]?.order);
354
+ setFilters(filters);
355
+ setQueryDataLoaded(true);
356
+ } else {
357
+ initialFilterMethod();
358
+ setQueryDataLoaded(true)
318
359
  }
319
- const queryString = qs.stringify(queryData, {
320
- encodeValuesOnly: true
321
- });
322
-
323
- triggerGetSolidEntities(queryString);
324
360
  setSelectedRecords([]);
325
361
  setSelectedRecoverRecords([]);
326
- setShowArchived(false);
362
+
363
+ }
364
+ }, [isDeleteSolidEntitiesSucess, isDeleteSolidSingleEntitySuccess, recoverByIdIsSuccess, recoverByIsSuccess, solidListViewMetaData]);
365
+
366
+ useEffect(() => {
367
+ if (queryDataLoaded) {
368
+ setQueryString(
369
+ first,
370
+ rows,
371
+ sortField,
372
+ sortOrder,
373
+ filters,
374
+ showArchived
375
+ );
327
376
  }
328
- }, [isDeleteSolidEntitiesSucess, isDeleteSolidSingleEntitySuccess, toPopulate, toPopulateMedia]);
377
+ }, [first, rows, sortField, sortOrder, showArchived, toPopulate, toPopulateMedia, customFilter, queryDataLoaded]);
329
378
 
330
379
  // Handle pagination event.
331
380
  const onPageChange = (event: any) => {
332
381
  setFirst(event.first);
333
382
  setRows(event.rows);
334
- setQueryString(event.first, event.rows, sortField, sortOrder, filters);
383
+ // setQueryString(event.first, event.rows, sortField, sortOrder, filters, showArchived);
335
384
  };
336
385
 
337
386
  // Handle sort event.
@@ -341,13 +390,13 @@ export const SolidListView = (params: SolidListViewParams) => {
341
390
  setSortField(sortField);
342
391
  setSortOrder(validSortOrder);
343
392
  setFirst(0);
344
- setQueryString(
345
- 0,
346
- rows,
347
- sortField,
348
- sortOrder === 1 || sortOrder === -1 ? sortOrder : 0,
349
- filters
350
- );
393
+ // setQueryString(
394
+ // 0,
395
+ // rows,
396
+ // sortField,
397
+ // sortOrder === 1 || sortOrder === -1 ? sortOrder : 0,
398
+ // filters
399
+ // );
351
400
  };
352
401
 
353
402
  // handle change in the records which are currently selected...
@@ -428,10 +477,11 @@ export const SolidListView = (params: SolidListViewParams) => {
428
477
  limit?: number,
429
478
  sortField?: string,
430
479
  sortOrder?: number,
431
- filters?: any
480
+ filters?: any,
481
+ showArchived?: boolean,
432
482
  ) => {
433
483
 
434
- const solidFieldsMetadata = solidListViewMetaData.data.solidFieldsMetadata;
484
+ const solidFieldsMetadata = solidListViewMetaData?.data?.solidFieldsMetadata;
435
485
 
436
486
 
437
487
  const queryData: any = {
@@ -455,23 +505,40 @@ export const SolidListView = (params: SolidListViewParams) => {
455
505
  queryData.sort = [`id:desc`];
456
506
  }
457
507
 
458
- const queryString = qs.stringify(queryData, {
459
- encodeValuesOnly: true,
460
- });
461
-
508
+ if (showArchived) {
509
+ queryData.showSoftDeleted = 'inclusive';
510
+ }
511
+ const queryString = qs.stringify(queryData, { encodeValuesOnly: true });
512
+
513
+ if (customFilter) {
514
+ let url
515
+ const urlData = queryData;
516
+ delete urlData.filters;
517
+ urlData.s_filter = customFilter.s_filter || {};
518
+ urlData.c_filter = customFilter.c_filter || {};
519
+ queryObjectToQueryString(urlData);
520
+ }
462
521
  triggerGetSolidEntities(queryString);
463
522
  };
464
523
 
465
524
  // handle filter...
466
- const handleApplyCustomFilter = (filters) => {
467
- setFilters(filters);
468
- setQueryString(
469
- 0,
470
- rows,
471
- sortField,
472
- sortOrder === 1 || sortOrder === -1 ? sortOrder : 0,
473
- filters
474
- );
525
+ const handleApplyCustomFilter = (transformedFilter: any) => {
526
+
527
+ const queryfilter = {
528
+ $and: [
529
+ ]
530
+ }
531
+ if (transformedFilter.s_filter) {
532
+ queryfilter.$and.push(transformedFilter.s_filter)
533
+ }
534
+ if (transformedFilter.c_filter) {
535
+ queryfilter.$and.push(transformedFilter.c_filter)
536
+ }
537
+
538
+ const customFilter = transformedFilter;
539
+ const updatedFilter = { ...(filters || {}), ...(queryfilter || {}) };
540
+ setFilters((prevFilters) => ({ ...(prevFilters || {}), ...(queryfilter || {}) }));
541
+ setCustomFilter(customFilter)
475
542
  };
476
543
 
477
544
  // clear Filter
@@ -493,6 +560,7 @@ export const SolidListView = (params: SolidListViewParams) => {
493
560
  return (
494
561
  <div>
495
562
  <Button
563
+ type="button"
496
564
  text
497
565
  size="small"
498
566
  className=""
@@ -634,24 +702,17 @@ export const SolidListView = (params: SolidListViewParams) => {
634
702
  });
635
703
  };
636
704
 
637
- // const handlCustomRowAction = ((i, rowData) : any) => {
638
-
639
- // }
640
-
641
705
  //Note - Custom Row Action Popup
642
706
  const closeListViewRowActionPopup = () => {
643
707
  setListViewRowActionPopupState(false)
644
708
  }
645
709
 
646
-
647
- const listViewTitle = solidListViewMetaData?.data?.solidView?.displayName
648
-
649
710
  return (
650
711
  <div className="page-parent-wrapper">
651
712
  <div className="page-header">
652
713
  <Toast ref={toast} />
653
714
  <div className="flex gap-3 align-items-center">
654
- <p className="m-0 view-title">{listViewTitle}</p>
715
+ <p className="m-0 view-title">{solidListViewMetaData?.data?.solidView?.displayName}</p>
655
716
  {solidListViewMetaData?.data?.solidView?.layout?.attrs?.enableGlobalSearch === true && params.embeded === false &&
656
717
  <SolidGlobalSearchElement filters={filters} clearFilter={clearFilter} ref={solidGlobalSearchElementRef} viewData={solidListViewMetaData} handleApplyCustomFilter={handleApplyCustomFilter}></SolidGlobalSearchElement>
657
718
  }
@@ -675,7 +736,7 @@ export const SolidListView = (params: SolidListViewParams) => {
675
736
  severity="secondary"
676
737
  outlined
677
738
  onClick={() => {
678
- setQueryString(first, rows, sortField, sortOrder, filters);
739
+ setQueryString(first, rows, sortField, sortOrder, filters, showArchived);
679
740
  }}
680
741
  />
681
742
  {showArchived && <Button type="button" icon="pi pi-refresh" label="Recover" size='small' severity="secondary"
@@ -2481,7 +2481,7 @@ const FieldMetaDataForm = ({ setIsDirty, modelMetaData, fieldMetaData, setFieldM
2481
2481
  )}
2482
2482
  </div>
2483
2483
  {currentFields.includes("regexPattern") && (
2484
- <div className="field col-6 flex-flex-column gap-2">
2484
+ <div className="field col-6 flex-flex-column gap-2 mt-3">
2485
2485
  <label
2486
2486
  htmlFor="regexPatternNotMatchingErrorMsg"
2487
2487
  className="form-field-label"
@@ -244,9 +244,9 @@ const CreateUser = ({ data, params }: any) => {
244
244
  <div className="form-wrapper-title">Create User</div>
245
245
  </div>
246
246
  <div className="gap-3 flex">
247
- {formik.dirty &&
247
+ {/* {formik.dirty && */}
248
248
  <Button label="Save" size="small" type="submit" />
249
- }
249
+ {/* } */}
250
250
  <CancelButton />
251
251
  </div>
252
252
  </>
@@ -254,13 +254,13 @@ const CreateUser = ({ data, params }: any) => {
254
254
  <>
255
255
  <div className="flex align-items-center gap-3">
256
256
  <BackButton />
257
- <h1 className="m-0">Update User</h1>
257
+ <div className="form-wrapper-title">Update User</div>
258
258
  </div>
259
259
  <div>
260
260
  <div className="gap-3 flex">
261
- {formik.dirty &&
261
+ {/* {formik.dirty && */}
262
262
  <Button label="Save" size="small" type="submit" />
263
- }
263
+ {/* } */}
264
264
  {data &&
265
265
  <Button outlined label="Delete" size="small" severity="danger" type="button" onClick={() => deleteUser(data.id)} />
266
266
  }
@@ -11,6 +11,14 @@ import { SolidSelectionStaticAutocompleteWidget } from "@/components/core/form/f
11
11
  import { SolidSelectionStaticRadioWidget } from "@/components/core/form/fields/widgets/SolidSelectionStaticRadioFieldWidget";
12
12
  import { SolidShortTextFieldTextRenderModeWidget } from "@/components/core/list/widgets/SolidShortTextFieldTextRenderModeWidget copy";
13
13
  import { SolidShortTextFieldImageRenderModeWidget } from "@/components/core/list/widgets/SolidShortTextFieldImageRenderModeWidget";
14
+ import { SolidFormFieldViewModeWidget } from "@/components/core/form/fields/widgets/SolidFormFieldViewModeWidget";
15
+ import { SolidFormFieldJsonViewModeWidget } from "@/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget";
16
+ import { SolidFormFieldPasswordViewModeWidget } from "@/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget";
17
+ import { SolidFormFieldRichTextViewModeWidget } from "@/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget";
18
+ import { SolidFormFieldMediaViewModeWidget } from "@/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget";
19
+ import { SolidFormFieldRelationViewModeWidget } from "@/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget";
20
+ import { SolidFormFieldViewMediaSingleWidget } from "@/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget";
21
+ import { SolidFormFieldViewMediaMultipleWidget } from "@/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget";
14
22
 
15
23
  type ExtensionRegistry = {
16
24
  components: Record<string, React.ComponentType<any>>;
@@ -79,6 +87,14 @@ registerExtensionComponent("SolidSelectionStaticAutocompleteWidget", SolidSelect
79
87
  registerExtensionComponent("SolidSelectionStaticRadioWidget", SolidSelectionStaticRadioWidget, ["field-radio"]);
80
88
  registerExtensionComponent("SolidShortTextFieldTextRenderModeWidget", SolidShortTextFieldTextRenderModeWidget, []);
81
89
  registerExtensionComponent("SolidShortTextFieldImageRenderModeWidget", SolidShortTextFieldImageRenderModeWidget, []);
90
+ registerExtensionComponent("SolidFormFieldViewModeWidget", SolidFormFieldViewModeWidget, []);
91
+ registerExtensionComponent("SolidFormFieldJsonViewModeWidget", SolidFormFieldJsonViewModeWidget, []);
92
+ registerExtensionComponent("SolidFormFieldPasswordViewModeWidget", SolidFormFieldPasswordViewModeWidget, []);
93
+ registerExtensionComponent("SolidFormFieldRichTextViewModeWidget", SolidFormFieldRichTextViewModeWidget, []);
94
+ registerExtensionComponent("SolidFormFieldMediaViewModeWidget", SolidFormFieldMediaViewModeWidget, []);
95
+ registerExtensionComponent("SolidFormFieldRelationViewModeWidget", SolidFormFieldRelationViewModeWidget, []);
96
+ registerExtensionComponent("SolidFormFieldViewMediaSingleWidget", SolidFormFieldViewMediaSingleWidget, []);
97
+ registerExtensionComponent("SolidFormFieldViewMediaMultipleWidget", SolidFormFieldViewMediaMultipleWidget, []);
82
98
 
83
99
 
84
100
  // ModuleMetadata
@@ -1564,9 +1564,9 @@ li.header-li-px {
1564
1564
  border: 8px;
1565
1565
  padding: 5px;
1566
1566
  height: 100%;
1567
- min-width:fit-content;
1567
+ min-width: fit-content;
1568
1568
  width: 100%;
1569
- max-width:fit-content;
1569
+ max-width: fit-content;
1570
1570
  }
1571
1571
 
1572
1572
  .kaban-heading-area {
@@ -1729,6 +1729,9 @@ li.header-li-px {
1729
1729
  margin-top: 10px;
1730
1730
  }
1731
1731
 
1732
+ .solid-file-vieww-wrapper {
1733
+ margin-top: 10px;
1734
+ }
1732
1735
 
1733
1736
  .solid-dynamic-stepper {
1734
1737
  overflow: hidden;
@@ -2950,4 +2953,14 @@ flex-shrink: 0; */
2950
2953
 
2951
2954
  .kanban-column-cogwheel.p-button.p-button-secondary.p-button-text:not(:disabled):hover {
2952
2955
  background: transparent;
2956
+ }
2957
+
2958
+ .view-widget-chip.p-chip {
2959
+ background-color: #f9f9f9 !important;
2960
+ padding: 4px 10px !important;
2961
+ }
2962
+
2963
+ .view-widget-chip.p-chip .p-chip-text {
2964
+ margin-top: 0 !important;
2965
+ margin-bottom: 0 !important;
2953
2966
  }
@@ -121,4 +121,9 @@ export type SolidSelectionStaticFieldWidgetProps = {
121
121
 
122
122
  export type SolidShortTextImageRenderModeWidgetProps = {
123
123
  data: string;
124
- }
124
+ }
125
+
126
+ export type SolidMediaSingleFieldWidgetProps = {
127
+ formik: any;
128
+ fieldContext?: SolidFieldProps;
129
+ };