@solidstarters/solid-core-ui 1.1.30 → 1.1.32

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 (80) hide show
  1. package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeChangeHandler.d.ts +7 -0
  2. package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeChangeHandler.d.ts.map +1 -0
  3. package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeChangeHandler.js +17 -0
  4. package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeChangeHandler.js.map +1 -0
  5. package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeLoad.d.ts +7 -0
  6. package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeLoad.d.ts.map +1 -0
  7. package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeLoad.js +17 -0
  8. package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeLoad.js.map +1 -0
  9. package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.d.ts +3 -0
  10. package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.d.ts.map +1 -0
  11. package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.js +78 -0
  12. package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.js.map +1 -0
  13. package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
  14. package/dist/components/core/form/SolidFormView.js +58 -20
  15. package/dist/components/core/form/SolidFormView.js.map +1 -1
  16. package/dist/components/core/form/fields/SolidLongTextField.d.ts +2 -0
  17. package/dist/components/core/form/fields/SolidLongTextField.d.ts.map +1 -1
  18. package/dist/components/core/form/fields/SolidLongTextField.js +32 -3
  19. package/dist/components/core/form/fields/SolidLongTextField.js.map +1 -1
  20. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts +1 -3
  21. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts.map +1 -1
  22. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +19 -274
  23. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
  24. package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyAutocompleteWidget.d.ts +3 -0
  25. package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyAutocompleteWidget.d.ts.map +1 -0
  26. package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyAutocompleteWidget.js +38 -0
  27. package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyAutocompleteWidget.js.map +1 -0
  28. package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyCheckboxWidget.d.ts +3 -0
  29. package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyCheckboxWidget.d.ts.map +1 -0
  30. package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyCheckboxWidget.js +48 -0
  31. package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyCheckboxWidget.js.map +1 -0
  32. package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.d.ts +2 -0
  33. package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.d.ts.map +1 -0
  34. package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.js +35 -0
  35. package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.js.map +1 -0
  36. package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.d.ts +6 -0
  37. package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.d.ts.map +1 -0
  38. package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.js +119 -0
  39. package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.js.map +1 -0
  40. package/dist/helpers/registry.d.ts +1 -1
  41. package/dist/helpers/registry.d.ts.map +1 -1
  42. package/dist/helpers/registry.js +19 -2
  43. package/dist/helpers/registry.js.map +1 -1
  44. package/dist/resources/fonts/SF-Pro-Display-Black.otf +0 -0
  45. package/dist/resources/fonts/SF-Pro-Display-Bold.otf +0 -0
  46. package/dist/resources/fonts/SF-Pro-Display-Heavy.otf +0 -0
  47. package/dist/resources/fonts/SF-Pro-Display-Light.otf +0 -0
  48. package/dist/resources/fonts/SF-Pro-Display-Medium.otf +0 -0
  49. package/dist/resources/fonts/SF-Pro-Display-Regular.otf +0 -0
  50. package/dist/resources/fonts/SF-Pro-Display-Semibold.otf +0 -0
  51. package/dist/resources/fonts/SF-Pro-Display-Thin.otf +0 -0
  52. package/dist/resources/fonts/SF-Pro-Display-Ultralight.otf +0 -0
  53. package/dist/resources/solid-primereact.css +2983 -0
  54. package/dist/resources/themes/solid-dark-purple/theme.css +6082 -0
  55. package/dist/resources/themes/solid-light-purple/theme.css +6124 -0
  56. package/package.json +1 -1
  57. package/src/components/core/extension/solid-core/emailTemplate/emailFormTypeChangeHandler.ts +18 -0
  58. package/src/components/core/extension/solid-core/emailTemplate/emailFormTypeLoad.ts +18 -0
  59. package/src/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.tsx +123 -0
  60. package/src/components/core/form/SolidFormView.tsx +62 -18
  61. package/src/components/core/form/fields/SolidLongTextField.tsx +79 -20
  62. package/src/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +20 -356
  63. package/src/components/core/form/fields/relations/widgets/SolidRelationManyToManyAutocompleteWidget.tsx +74 -0
  64. package/src/components/core/form/fields/relations/widgets/SolidRelationManyToManyCheckboxWidget.tsx +103 -0
  65. package/src/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.tsx +33 -0
  66. package/src/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.ts +64 -0
  67. package/src/helpers/registry.ts +21 -2
  68. package/src/resources/fonts/SF-Pro-Display-Black.otf +0 -0
  69. package/src/resources/fonts/SF-Pro-Display-Bold.otf +0 -0
  70. package/src/resources/fonts/SF-Pro-Display-Heavy.otf +0 -0
  71. package/src/resources/fonts/SF-Pro-Display-Light.otf +0 -0
  72. package/src/resources/fonts/SF-Pro-Display-Medium.otf +0 -0
  73. package/src/resources/fonts/SF-Pro-Display-Regular.otf +0 -0
  74. package/src/resources/fonts/SF-Pro-Display-Semibold.otf +0 -0
  75. package/src/resources/fonts/SF-Pro-Display-Thin.otf +0 -0
  76. package/src/resources/fonts/SF-Pro-Display-Ultralight.otf +0 -0
  77. package/src/resources/solid-primereact.css +2983 -0
  78. package/src/resources/themes/solid-dark-purple/theme.css +6082 -0
  79. package/src/resources/themes/solid-light-purple/theme.css +6124 -0
  80. package/src/types/solid-core.d.ts +14 -1
@@ -0,0 +1,64 @@
1
+ import { useState } from "react";
2
+ import qs from "qs";
3
+ import { createSolidEntityApi } from "@/redux/api/solidEntityApi";
4
+
5
+ export const useRelationEntityHandler = ({ fieldContext, formik, autoCompleteLimit = 1000 }: any) => {
6
+ const fieldMetadata = fieldContext.fieldMetadata;
7
+ const fieldLayoutInfo = fieldContext.field;
8
+
9
+ const entityApi = createSolidEntityApi(fieldMetadata.relationCoModelSingularName);
10
+ const { useLazyGetSolidEntitiesQuery } = entityApi;
11
+ const [triggerGetSolidEntities] = useLazyGetSolidEntitiesQuery();
12
+
13
+ const [autoCompleteItems, setAutoCompleteItems] = useState([]);
14
+
15
+ const fetchRelationEntities = async (query = "", limit = autoCompleteLimit) => {
16
+ const queryData = {
17
+ offset: 0,
18
+ limit: limit,
19
+ filters: {
20
+ [fieldMetadata?.relationModel?.userKeyField?.name]: {
21
+ '$containsi': query
22
+ }
23
+ }
24
+ };
25
+
26
+ const autocompleteQs = qs.stringify(queryData, { encodeValuesOnly: true });
27
+
28
+ const response = await triggerGetSolidEntities(autocompleteQs);
29
+ const data = response.data;
30
+
31
+ if (data) {
32
+ const mappedItems = data.records.map((item: any) => ({
33
+ label: item[fieldMetadata?.relationModel?.userKeyField?.name],
34
+ value: item['id'],
35
+ original: item
36
+ }));
37
+ setAutoCompleteItems(mappedItems);
38
+ }
39
+ };
40
+
41
+ const addNewRelation = (values: any) => {
42
+ const currentData = formik.values[fieldLayoutInfo.attrs.name] || [];
43
+ const jsonValues = Object.fromEntries(values.entries());
44
+ const newItem = {
45
+ label: jsonValues[fieldMetadata?.relationModel?.userKeyField?.name],
46
+ value: "new",
47
+ original: jsonValues,
48
+ };
49
+
50
+ formik.setFieldValue(fieldLayoutInfo.attrs.name, [...currentData, newItem]);
51
+
52
+ // Optionally add to autocomplete list
53
+ setAutoCompleteItems((prev: any) => {
54
+ const exists = prev.some((item: any) => item.label === newItem.label);
55
+ return exists ? prev : [...prev, newItem];
56
+ });
57
+ };
58
+
59
+ return {
60
+ autoCompleteItems,
61
+ fetchRelationEntities,
62
+ addNewRelation
63
+ };
64
+ };
@@ -1,3 +1,8 @@
1
+ import hanldeEmailFormTypeChange from "@/components/core/extension/solid-core/emailTemplate/emailFormTypeChangeHandler";
2
+ import hanldeEmailFormTypeLoad from "@/components/core/extension/solid-core/emailTemplate/emailFormTypeLoad";
3
+ import { RolePermissionsManyToManyFieldWidget } from "@/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget";
4
+ import { SolidRelationManyToManyAutocompleteWidget } from "@/components/core/form/fields/relations/widgets/SolidRelationManyToManyAutocompleteWidget";
5
+ import { SolidRelationManyToManyCheckboxWidget } from "@/components/core/form/fields/relations/widgets/SolidRelationManyToManyCheckboxWidget";
1
6
  import { CustomHtml } from "@/components/core/form/widgets/CustomHtml";
2
7
  import React from "react";
3
8
 
@@ -11,9 +16,13 @@ const extensionRegistry: ExtensionRegistry = {
11
16
  functions: {},
12
17
  };
13
18
 
14
- export const registerExtensionComponent = (name: string, component: React.ComponentType<any>) => {
19
+ export const registerExtensionComponent = (name: string, component: React.ComponentType<any>, aliases: string[] = []) => {
15
20
  // console.log(`registerExtensionComponent invoked... ${name}`);
16
21
  extensionRegistry.components[name] = component;
22
+ for (let i = 0; i < aliases.length; i++) {
23
+ const alias = aliases[i];
24
+ extensionRegistry.components[alias] = component;
25
+ }
17
26
  };
18
27
 
19
28
  export const registerExtensionFunction = (name: string, fn: (...args: any[]) => any) => {
@@ -55,10 +64,20 @@ export const getExtensionFunction = (name: string) => {
55
64
 
56
65
  // Register all the dynamic widget & functions from inside solid-core-ui
57
66
  // Common
58
- registerExtensionComponent("CustomHtml", CustomHtml);
67
+ registerExtensionComponent("CustomHtml", CustomHtml, []);
68
+ registerExtensionComponent("SolidRelationManyToManyCheckboxWidget", SolidRelationManyToManyCheckboxWidget, ["checkbox"]);
69
+ registerExtensionComponent("SolidRelationManyToManyAutocompleteWidget", SolidRelationManyToManyAutocompleteWidget, ["autocomplete"]);
59
70
 
60
71
 
61
72
  // ModuleMetadata
62
73
 
63
74
 
64
75
  // ModelMetadata
76
+
77
+
78
+ // Email Template
79
+ registerExtensionFunction("emailFormTypeChangeHandler", hanldeEmailFormTypeChange);
80
+ registerExtensionFunction("emailFormTypeLoad", hanldeEmailFormTypeLoad);
81
+
82
+ // RoleMetadata
83
+ registerExtensionComponent("RolePermissionsManyToManyFieldWidget", RolePermissionsManyToManyFieldWidget, ["inputSwitch"]);