@solidxai/core-ui 0.1.2 → 0.1.4-beta.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 (149) hide show
  1. package/dist/components/auth/SolidInitialLoginOtp.d.ts.map +1 -1
  2. package/dist/components/auth/SolidInitialLoginOtp.js +0 -5
  3. package/dist/components/auth/SolidInitialLoginOtp.js.map +1 -1
  4. package/dist/components/auth/SolidInitialLoginOtp.tsx +0 -5
  5. package/dist/components/auth/SolidLogin.d.ts.map +1 -1
  6. package/dist/components/auth/SolidLogin.js +7 -5
  7. package/dist/components/auth/SolidLogin.js.map +1 -1
  8. package/dist/components/auth/SolidLogin.tsx +10 -8
  9. package/dist/components/common/GeneralSettings.d.ts.map +1 -1
  10. package/dist/components/common/GeneralSettings.js +48 -47
  11. package/dist/components/common/GeneralSettings.js.map +1 -1
  12. package/dist/components/common/GeneralSettings.tsx +41 -10
  13. package/dist/components/core/common/FilterComponent.js.map +1 -1
  14. package/dist/components/core/common/FilterComponent.tsx +1 -1
  15. package/dist/components/core/common/GroupingComponent.d.ts +54 -0
  16. package/dist/components/core/common/GroupingComponent.d.ts.map +1 -0
  17. package/dist/components/core/common/GroupingComponent.js +196 -0
  18. package/dist/components/core/common/GroupingComponent.js.map +1 -0
  19. package/dist/components/core/common/GroupingComponent.tsx +452 -0
  20. package/dist/components/core/common/SolidGlobalSearchElement.d.ts +18 -1
  21. package/dist/components/core/common/SolidGlobalSearchElement.d.ts.map +1 -1
  22. package/dist/components/core/common/SolidGlobalSearchElement.js +197 -74
  23. package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
  24. package/dist/components/core/common/SolidGlobalSearchElement.tsx +276 -40
  25. package/dist/components/core/common/SolidImageViewer.d.ts +10 -0
  26. package/dist/components/core/common/SolidImageViewer.d.ts.map +1 -0
  27. package/dist/components/core/common/SolidImageViewer.js +59 -0
  28. package/dist/components/core/common/SolidImageViewer.js.map +1 -0
  29. package/dist/components/core/common/SolidImageViewer.tsx +84 -0
  30. package/dist/components/core/extension/solid-core/modelSequence/modelSequenceFormViewChangeHandler.d.ts +19 -0
  31. package/dist/components/core/extension/solid-core/modelSequence/modelSequenceFormViewChangeHandler.d.ts.map +1 -0
  32. package/dist/components/core/extension/solid-core/modelSequence/modelSequenceFormViewChangeHandler.js +90 -0
  33. package/dist/components/core/extension/solid-core/modelSequence/modelSequenceFormViewChangeHandler.js.map +1 -0
  34. package/dist/components/core/extension/solid-core/modelSequence/modelSequenceFormViewChangeHandler.tsx +59 -0
  35. package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.d.ts.map +1 -1
  36. package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.js +7 -3
  37. package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.js.map +1 -1
  38. package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.tsx +45 -40
  39. package/dist/components/core/filter/SolidOneToManyFilterElement.d.ts +2 -0
  40. package/dist/components/core/filter/SolidOneToManyFilterElement.d.ts.map +1 -0
  41. package/dist/components/core/filter/SolidOneToManyFilterElement.js +86 -0
  42. package/dist/components/core/filter/SolidOneToManyFilterElement.js.map +1 -0
  43. package/dist/components/core/filter/SolidOneToManyFilterElement.tsx +62 -0
  44. package/dist/components/core/filter/SolidVarInputsFilterElement.d.ts +1 -0
  45. package/dist/components/core/filter/SolidVarInputsFilterElement.d.ts.map +1 -1
  46. package/dist/components/core/filter/SolidVarInputsFilterElement.js +4 -1
  47. package/dist/components/core/filter/SolidVarInputsFilterElement.js.map +1 -1
  48. package/dist/components/core/filter/SolidVarInputsFilterElement.tsx +10 -0
  49. package/dist/components/core/filter/fields/SolidRelationField.d.ts.map +1 -1
  50. package/dist/components/core/filter/fields/SolidRelationField.js +4 -2
  51. package/dist/components/core/filter/fields/SolidRelationField.js.map +1 -1
  52. package/dist/components/core/filter/fields/SolidRelationField.tsx +4 -2
  53. package/dist/components/core/filter/fields/relations/SolidRelationOneToManyField.d.ts +4 -0
  54. package/dist/components/core/filter/fields/relations/SolidRelationOneToManyField.d.ts.map +1 -0
  55. package/dist/components/core/filter/fields/relations/SolidRelationOneToManyField.js +25 -0
  56. package/dist/components/core/filter/fields/relations/SolidRelationOneToManyField.js.map +1 -0
  57. package/dist/components/core/filter/fields/relations/SolidRelationOneToManyField.tsx +60 -0
  58. package/dist/components/core/form/SolidFormFooter.js +4 -4
  59. package/dist/components/core/form/SolidFormFooter.js.map +1 -1
  60. package/dist/components/core/form/SolidFormFooter.tsx +4 -4
  61. package/dist/components/core/form/fields/SolidBooleanField.d.ts.map +1 -1
  62. package/dist/components/core/form/fields/SolidBooleanField.js +11 -8
  63. package/dist/components/core/form/fields/SolidBooleanField.js.map +1 -1
  64. package/dist/components/core/form/fields/SolidBooleanField.tsx +20 -8
  65. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts.map +1 -1
  66. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +26 -21
  67. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
  68. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +27 -17
  69. package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.d.ts +1 -0
  70. package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.d.ts.map +1 -1
  71. package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.js +51 -0
  72. package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.js.map +1 -1
  73. package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.ts +51 -0
  74. package/dist/components/core/form/fields/widgets/SolidS3FileViewerWidget.d.ts.map +1 -1
  75. package/dist/components/core/form/fields/widgets/SolidS3FileViewerWidget.js +80 -79
  76. package/dist/components/core/form/fields/widgets/SolidS3FileViewerWidget.js.map +1 -1
  77. package/dist/components/core/form/fields/widgets/SolidS3FileViewerWidget.tsx +92 -85
  78. package/dist/components/core/kanban/SolidKanbanView.js +5 -5
  79. package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
  80. package/dist/components/core/kanban/SolidKanbanView.tsx +5 -5
  81. package/dist/components/core/list/SolidListView.d.ts +12 -7
  82. package/dist/components/core/list/SolidListView.d.ts.map +1 -1
  83. package/dist/components/core/list/SolidListView.js +143 -153
  84. package/dist/components/core/list/SolidListView.js.map +1 -1
  85. package/dist/components/core/list/SolidListView.tsx +89 -94
  86. package/dist/components/core/list/columns/SolidMediaMultipleColumn.d.ts.map +1 -1
  87. package/dist/components/core/list/columns/SolidMediaMultipleColumn.js +16 -17
  88. package/dist/components/core/list/columns/SolidMediaMultipleColumn.js.map +1 -1
  89. package/dist/components/core/list/columns/SolidMediaMultipleColumn.tsx +46 -44
  90. package/dist/components/core/list/columns/SolidMediaSingleColumn.d.ts.map +1 -1
  91. package/dist/components/core/list/columns/SolidMediaSingleColumn.js +6 -4
  92. package/dist/components/core/list/columns/SolidMediaSingleColumn.js.map +1 -1
  93. package/dist/components/core/list/columns/SolidMediaSingleColumn.tsx +7 -5
  94. package/dist/components/core/list/listViewRegistry.js.map +1 -1
  95. package/dist/components/core/list/listViewRegistry.ts +1 -2
  96. package/dist/components/core/tree/SolidTreeView.d.ts +38 -0
  97. package/dist/components/core/tree/SolidTreeView.d.ts.map +1 -0
  98. package/dist/components/core/tree/SolidTreeView.js +1170 -0
  99. package/dist/components/core/tree/SolidTreeView.js.map +1 -0
  100. package/dist/components/core/tree/SolidTreeView.tsx +1603 -0
  101. package/dist/components/core/tree/treeViewRegistry.d.ts +7 -0
  102. package/dist/components/core/tree/treeViewRegistry.d.ts.map +1 -0
  103. package/dist/components/core/tree/treeViewRegistry.js +17 -0
  104. package/dist/components/core/tree/treeViewRegistry.js.map +1 -0
  105. package/dist/components/core/tree/treeViewRegistry.ts +23 -0
  106. package/dist/components/core/users/CreateUser.d.ts.map +1 -1
  107. package/dist/components/core/users/CreateUser.js +19 -6
  108. package/dist/components/core/users/CreateUser.js.map +1 -1
  109. package/dist/components/core/users/CreateUser.tsx +39 -0
  110. package/dist/helpers/fetchS3Url.d.ts +19 -0
  111. package/dist/helpers/fetchS3Url.d.ts.map +1 -0
  112. package/dist/helpers/fetchS3Url.js +60 -0
  113. package/dist/helpers/fetchS3Url.js.map +1 -0
  114. package/dist/helpers/fetchS3Url.ts +33 -0
  115. package/dist/helpers/helpers.d.ts +2 -0
  116. package/dist/helpers/helpers.d.ts.map +1 -1
  117. package/dist/helpers/helpers.js +3 -1
  118. package/dist/helpers/helpers.js.map +1 -1
  119. package/dist/helpers/helpers.ts +4 -1
  120. package/dist/helpers/registry.d.ts.map +1 -1
  121. package/dist/helpers/registry.js +2 -0
  122. package/dist/helpers/registry.js.map +1 -1
  123. package/dist/helpers/registry.ts +3 -1
  124. package/dist/index.d.ts +9 -2
  125. package/dist/index.d.ts.map +1 -1
  126. package/dist/index.js +6 -1
  127. package/dist/index.js.map +1 -1
  128. package/dist/index.ts +14 -2
  129. package/dist/resources/globals.css +18 -4
  130. package/dist/routes/pages/admin/core/ListPage.d.ts.map +1 -1
  131. package/dist/routes/pages/admin/core/ListPage.js +8 -3
  132. package/dist/routes/pages/admin/core/ListPage.js.map +1 -1
  133. package/dist/routes/pages/admin/core/ListPage.tsx +11 -3
  134. package/dist/routes/pages/admin/core/TreePage.d.ts +2 -0
  135. package/dist/routes/pages/admin/core/TreePage.d.ts.map +1 -0
  136. package/dist/routes/pages/admin/core/TreePage.js +37 -0
  137. package/dist/routes/pages/admin/core/TreePage.js.map +1 -0
  138. package/dist/routes/pages/admin/core/TreePage.tsx +30 -0
  139. package/dist/routes/solidRoutes.d.ts.map +1 -1
  140. package/dist/routes/solidRoutes.js +2 -0
  141. package/dist/routes/solidRoutes.js.map +1 -1
  142. package/dist/routes/solidRoutes.tsx +3 -1
  143. package/dist/routes/types.d.ts +1 -1
  144. package/dist/routes/types.d.ts.map +1 -1
  145. package/dist/routes/types.js.map +1 -1
  146. package/dist/routes/types.ts +1 -0
  147. package/dist/types/index.d.ts +8 -2
  148. package/dist/types/solid-core.d.ts +40 -0
  149. package/package.json +1 -1
@@ -0,0 +1,84 @@
1
+ import { useEffect, useRef } from "react";
2
+ import Viewer from "viewerjs";
3
+ import "viewerjs/dist/viewer.css";
4
+
5
+ export interface SolidImageViewerProps {
6
+ images: string[];
7
+ open: boolean;
8
+ onClose: () => void;
9
+ viewerOptions?: Viewer.Options;
10
+ }
11
+
12
+ export const SolidImageViewer = ({
13
+ images,
14
+ open,
15
+ onClose,
16
+ viewerOptions,
17
+ }: SolidImageViewerProps) => {
18
+ const containerRef = useRef<HTMLDivElement | null>(null);
19
+ const viewerRef = useRef<Viewer | null>(null);
20
+
21
+ // Initialize viewer
22
+ useEffect(() => {
23
+ if (!containerRef.current || images.length === 0) return;
24
+
25
+ if (viewerRef.current) {
26
+ viewerRef.current.destroy();
27
+ }
28
+
29
+ viewerRef.current = new Viewer(containerRef.current, {
30
+ navbar: images.length > 1, // show navbar only if multiple
31
+ title: false,
32
+ transition: true,
33
+ movable: true,
34
+ scalable: true,
35
+ rotatable: true,
36
+ zoomable: true,
37
+ zIndex: 9999,
38
+ hidden: () => {
39
+ onClose();
40
+ },
41
+ toolbar: {
42
+ prev: 1,
43
+ next: 1,
44
+ zoomIn: 1,
45
+ zoomOut: 1,
46
+ rotateLeft: 1,
47
+ rotateRight: 1,
48
+ reset: 1,
49
+ },
50
+ ...viewerOptions,
51
+ });
52
+
53
+ return () => {
54
+ if (viewerRef.current) {
55
+ viewerRef.current.destroy();
56
+ viewerRef.current = null;
57
+ }
58
+ };
59
+ }, [images, open]);
60
+
61
+ // Show viewer when open becomes true
62
+ useEffect(() => {
63
+ if (open && viewerRef.current) {
64
+ viewerRef.current.show();
65
+ }
66
+ }, [open]);
67
+
68
+ return (
69
+ <div
70
+ ref={containerRef}
71
+ style={{
72
+ position: "absolute",
73
+ visibility: "hidden",
74
+ width: 0,
75
+ height: 0,
76
+ overflow: "hidden",
77
+ }}
78
+ >
79
+ {images.map((src, index) => (
80
+ <img key={index} src={src} alt={`preview-${index}`} />
81
+ ))}
82
+ </div>
83
+ );
84
+ };
@@ -0,0 +1,19 @@
1
+ declare const hanldeModelSequenceFormViewChange: (event: any) => Promise<{
2
+ layoutChanged: boolean;
3
+ dataChanged: boolean;
4
+ newFormData: {
5
+ model: null;
6
+ field: null;
7
+ };
8
+ newLayout: import("../../../../..").LayoutNode;
9
+ } | {
10
+ layoutChanged: boolean;
11
+ dataChanged: boolean;
12
+ newFormData: {
13
+ field: null;
14
+ model?: undefined;
15
+ };
16
+ newLayout: import("../../../../..").LayoutNode;
17
+ } | undefined>;
18
+ export default hanldeModelSequenceFormViewChange;
19
+ //# sourceMappingURL=modelSequenceFormViewChangeHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modelSequenceFormViewChangeHandler.d.ts","sourceRoot":"","sources":["../../../../../../src/components/core/extension/solid-core/modelSequence/modelSequenceFormViewChangeHandler.tsx"],"names":[],"mappings":"AAEA,QAAA,MAAM,iCAAiC,UAAiB,GAAG;;;;;;;;;;;;;;;;cAuD1D,CAAA;AACD,eAAe,iCAAiC,CAAC"}
@@ -0,0 +1,90 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { SolidViewLayoutManager } from "../../../../../components/core/common/SolidViewLayoutManager";
38
+ var hanldeModelSequenceFormViewChange = function (event) { return __awaiter(void 0, void 0, void 0, function () {
39
+ var modifiedField, modifiedFieldValue, formViewLayout, layout, layoutManager, modelWhereClause, fieldWhereClauseOnModule, fieldWhereClauseOnModel;
40
+ return __generator(this, function (_a) {
41
+ console.log("event", event);
42
+ modifiedField = event.modifiedField, modifiedFieldValue = event.modifiedFieldValue, formViewLayout = event.formViewLayout;
43
+ layout = formViewLayout;
44
+ layoutManager = new SolidViewLayoutManager(layout);
45
+ if (modifiedField === 'module') {
46
+ modelWhereClause = {
47
+ module: {
48
+ id: { $eq: modifiedFieldValue.id }
49
+ }
50
+ };
51
+ fieldWhereClauseOnModule = {
52
+ model: {
53
+ module: {
54
+ id: { $eq: modifiedFieldValue.id }
55
+ }
56
+ }
57
+ };
58
+ layoutManager.updateNodeAttributes('model', { "whereClause": JSON.stringify(modelWhereClause) });
59
+ layoutManager.updateNodeAttributes('field', { "whereClause": JSON.stringify(fieldWhereClauseOnModule) });
60
+ return [2 /*return*/, {
61
+ layoutChanged: true,
62
+ dataChanged: true,
63
+ newFormData: {
64
+ model: null,
65
+ field: null
66
+ },
67
+ newLayout: layoutManager.getLayout(),
68
+ }];
69
+ }
70
+ if (modifiedField === 'model') {
71
+ fieldWhereClauseOnModel = {
72
+ model: {
73
+ id: { $eq: modifiedFieldValue.id }
74
+ }
75
+ };
76
+ layoutManager.updateNodeAttributes('field', { "whereClause": JSON.stringify(fieldWhereClauseOnModel) });
77
+ return [2 /*return*/, {
78
+ layoutChanged: true,
79
+ dataChanged: true,
80
+ newFormData: {
81
+ field: null
82
+ },
83
+ newLayout: layoutManager.getLayout(),
84
+ }];
85
+ }
86
+ return [2 /*return*/];
87
+ });
88
+ }); };
89
+ export default hanldeModelSequenceFormViewChange;
90
+ //# sourceMappingURL=modelSequenceFormViewChangeHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modelSequenceFormViewChangeHandler.js","sourceRoot":"","sources":["../../../../../../src/components/core/extension/solid-core/modelSequence/modelSequenceFormViewChangeHandler.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8DAA8D,CAAC;AAEtG,IAAM,iCAAiC,GAAG,UAAO,KAAU;;;QAEvD,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;Q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H,aAAa,EAAE,IAAI;oBACnB,WAAW,EAAE,IAAI;oBACjB,WAAW,EAAE;wBACT,KAAK,EAAE,IAAI;qBACd;oBACD,SAAS,EAAE,aAAa,CAAC,SAAS,EAAE;iBACvC,EAAA;SACJ;;;KACJ,CAAA;AACD,eAAe,iCAAiC,CAAC","sourcesContent":["import { SolidViewLayoutManager } from \"../../../../../components/core/common/SolidViewLayoutManager\";\n\nconst hanldeModelSequenceFormViewChange = async (event: any) => {\n\n console.log(\"event\", event)\n\n const { modifiedField, modifiedFieldValue, formViewLayout } = event;\n\n const layout = formViewLayout;\n const layoutManager = new SolidViewLayoutManager(layout);\n if (modifiedField === 'module') {\n // module change\n const modelWhereClause = {\n module: {\n id: { $eq: modifiedFieldValue.id }\n }\n };\n const fieldWhereClauseOnModule = {\n model: {\n module: {\n id: { $eq: modifiedFieldValue.id }\n }\n }\n };\n\n layoutManager.updateNodeAttributes('model', { \"whereClause\": JSON.stringify(modelWhereClause) });\n layoutManager.updateNodeAttributes('field', { \"whereClause\": JSON.stringify(fieldWhereClauseOnModule) });\n\n return {\n layoutChanged: true,\n dataChanged: true,\n newFormData: {\n model: null,\n field: null\n },\n newLayout: layoutManager.getLayout(),\n }\n }\n if (modifiedField === 'model') {\n // model change\n const fieldWhereClauseOnModel = {\n model: {\n id: { $eq: modifiedFieldValue.id }\n }\n };\n\n layoutManager.updateNodeAttributes('field', { \"whereClause\": JSON.stringify(fieldWhereClauseOnModel) });\n\n return {\n layoutChanged: true,\n dataChanged: true,\n newFormData: {\n field: null\n },\n newLayout: layoutManager.getLayout(),\n }\n }\n}\nexport default hanldeModelSequenceFormViewChange;"]}
@@ -0,0 +1,59 @@
1
+ import { SolidViewLayoutManager } from "../../../../../components/core/common/SolidViewLayoutManager";
2
+
3
+ const hanldeModelSequenceFormViewChange = async (event: any) => {
4
+
5
+ console.log("event", event)
6
+
7
+ const { modifiedField, modifiedFieldValue, formViewLayout } = event;
8
+
9
+ const layout = formViewLayout;
10
+ const layoutManager = new SolidViewLayoutManager(layout);
11
+ if (modifiedField === 'module') {
12
+ // module change
13
+ const modelWhereClause = {
14
+ module: {
15
+ id: { $eq: modifiedFieldValue.id }
16
+ }
17
+ };
18
+ const fieldWhereClauseOnModule = {
19
+ model: {
20
+ module: {
21
+ id: { $eq: modifiedFieldValue.id }
22
+ }
23
+ }
24
+ };
25
+
26
+ layoutManager.updateNodeAttributes('model', { "whereClause": JSON.stringify(modelWhereClause) });
27
+ layoutManager.updateNodeAttributes('field', { "whereClause": JSON.stringify(fieldWhereClauseOnModule) });
28
+
29
+ return {
30
+ layoutChanged: true,
31
+ dataChanged: true,
32
+ newFormData: {
33
+ model: null,
34
+ field: null
35
+ },
36
+ newLayout: layoutManager.getLayout(),
37
+ }
38
+ }
39
+ if (modifiedField === 'model') {
40
+ // model change
41
+ const fieldWhereClauseOnModel = {
42
+ model: {
43
+ id: { $eq: modifiedFieldValue.id }
44
+ }
45
+ };
46
+
47
+ layoutManager.updateNodeAttributes('field', { "whereClause": JSON.stringify(fieldWhereClauseOnModel) });
48
+
49
+ return {
50
+ layoutChanged: true,
51
+ dataChanged: true,
52
+ newFormData: {
53
+ field: null
54
+ },
55
+ newLayout: layoutManager.getLayout(),
56
+ }
57
+ }
58
+ }
59
+ export default hanldeModelSequenceFormViewChange;
@@ -1 +1 @@
1
- {"version":3,"file":"RolePermissionsManyToManyFieldWidget.d.ts","sourceRoot":"","sources":["../../../../../../src/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAe5E,eAAO,MAAM,oCAAoC,6BAA8B,yBAAyB,4CA0GvG,CAAC"}
1
+ {"version":3,"file":"RolePermissionsManyToManyFieldWidget.d.ts","sourceRoot":"","sources":["../../../../../../src/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAe5E,eAAO,MAAM,oCAAoC,6BAA8B,yBAAyB,4CA+GvG,CAAC"}
@@ -38,12 +38,16 @@ var groupByController = function (items) {
38
38
  return grouped;
39
39
  };
40
40
  export var RolePermissionsManyToManyFieldWidget = function (_a) {
41
+ var _b;
41
42
  var formik = _a.formik, fieldContext = _a.fieldContext;
42
43
  var fieldLayoutInfo = fieldContext.field;
43
44
  var readOnlyPermission = fieldContext.readOnly;
44
- var _b = useState(false), visibleCreateDialog = _b[0], setVisibleCreateDialog = _b[1];
45
- var _c = useRelationEntityHandler({ fieldContext: fieldContext, formik: formik }), autoCompleteItems = _c.autoCompleteItems, fetchRelationEntities = _c.fetchRelationEntities, addNewRelation = _c.addNewRelation;
46
- var _d = useState({}), visibleDialogs = _d[0], setVisibleDialogs = _d[1];
45
+ var _c = useState(false), visibleCreateDialog = _c[0], setVisibleCreateDialog = _c[1];
46
+ var _d = useRelationEntityHandler({ fieldContext: fieldContext, formik: formik }), autoCompleteItems = _d.autoCompleteItems, fetchRelationEntities = _d.fetchRelationEntities, populateFormikWithRelatedEntities = _d.populateFormikWithRelatedEntities, addNewRelation = _d.addNewRelation;
47
+ var _e = useState({}), visibleDialogs = _e[0], setVisibleDialogs = _e[1];
48
+ useEffect(function () {
49
+ populateFormikWithRelatedEntities();
50
+ }, [(_b = formik.values) === null || _b === void 0 ? void 0 : _b.id]);
47
51
  useEffect(function () {
48
52
  var queryData = {
49
53
  offset: 0,
@@ -1 +1 @@
1
- {"version":3,"file":"RolePermissionsManyToManyFieldWidget.js","sourceRoot":"","sources":["../../../../../../src/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,M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L,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,MAAM,CAAC,KAAK,EACrB,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,cAAM,OAAA,oBAAoB,CAAC,MAAM,CAAC,EAA5B,CAA4B,GAC9C,EACF,iBAAO,OAAO,EAAE,MAAM,CAAC,KAAK,EAAE,SAAS,EAAC,iDAAiD,kBAAG,MAAM,CAAC,KAAK,IAAS,KAP3G,MAAM,CAAC,KAAK,CAQhB,CACT,CAAA;oBACL,CAAC,CAAC,GACA,IAhBgE,cAAc,CAiBhF,CACX,EAnBqD,CAmBrD,CAAC,EACD,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,UAAC,cAAc,IAAK,OAAA,CAClD,KAAC,0BAA0B,IAEvB,OAAO,EAAE,cAAc,CAAC,cAAc,CAAC,IAAI,KAAK,EAChD,UAAU,EAAE,UAAC,OAAY;oBACrB,OAAA,iBAAiB,CAAC,UAAC,IAAI;;wBAAK,OAAA,uBACrB,IAAI,gBACN,cAAc,IAAG,OAAO,OAC3B;oBAH0B,CAG1B,CAAC;gBAHH,CAGG,EAEP,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,cAAc,IATnB,iBAAU,cAAc,CAAE,CAUjC,CACL,EAbqD,CAarD,CAAC,IACA,CACT,CAAA;AACT,CAAC,CAAC","sourcesContent":["\nimport { capitalize } from \"lodash\";\nimport { Panel } from \"primereact/panel\";\nimport { useEffect, useState } from \"react\";\nimport { Button } from \"primereact/button\";\nimport { InputSwitch } from \"primereact/inputswitch\";\nimport { useRelationEntityHandler } from \"../../../../../components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler\";\nimport { InlineRelationEntityDialog } from \"../../../../../components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog\";\nimport { Checkbox } from \"primereact/checkbox\";\nimport { SolidFormFieldWidgetProps } from \"../../../../../types/solid-core\";\nimport qs from 'qs';\n\nconst groupByController = (items: any[]) => {\n const grouped: { [key: string]: any[] } = {};\n items.forEach((item) => {\n const controllerName = item.label.split(\".\")[0];\n if (!grouped[controllerName]) {\n grouped[controllerName] = [];\n }\n grouped[controllerName].push(item);\n });\n return grouped;\n};\n\nexport const RolePermissionsManyToManyFieldWidget = ({ formik, fieldContext }: SolidFormFieldWidgetProps) => {\n const fieldLayoutInfo = fieldContext.field;\n\n const readOnlyPermission = fieldContext.readOnly;\n const [visibleCreateDialog, setVisibleCreateDialog] = useState(false);\n const { autoCompleteItems, fetchRelationEntities, addNewRelation } = useRelationEntityHandler({ fieldContext, formik });\n const [visibleDialogs, setVisibleDialogs] = useState<{ [key: string]: boolean }>({});\n\n useEffect(() => {\n const queryData: any = {\n offset: 0,\n limit: 1000\n };\n const autocompleteQs = qs.stringify(queryData, {\n encodeValuesOnly: true,\n });\n fetchRelationEntities(autocompleteQs);\n }, []);\n\n const handleCheckboxChange = (e: any) => {\n if (formik.values[fieldLayoutInfo.attrs.name].some((item: any) => item.value === e.value)) {\n formik.setFieldValue(fieldLayoutInfo.attrs.name, formik.values[fieldLayoutInfo.attrs.name].filter((s: any) => s.value !== e.value));\n } else {\n formik.setFieldValue(fieldLayoutInfo.attrs.name, [...formik.values[fieldLayoutInfo.attrs.name], e]);\n }\n };\n\n const getHeaderTemplate = (controllerName: string) => (options: any) => {\n const className = `${options.className} justify-content-space-between`;\n \n return (\n <div className={className}>\n <div className=\"flex align-items-center gap-3\">\n <label className=\"form-field-label text-base lg:text-lg font-bold\">\n {controllerName}\n </label>\n {fieldContext.field.attrs.inlineCreate && (\n <>\n <Button\n icon=\"pi pi-plus\"\n rounded\n outlined\n aria-label=\"Add\"\n type=\"button\"\n size=\"small\"\n onClick={() =>\n setVisibleDialogs((prev) => ({\n ...prev,\n [controllerName]: true,\n }))\n }\n className=\"custom-add-button\"\n />\n <InlineRelationEntityDialog\n visible={visibleCreateDialog}\n setVisible={setVisibleCreateDialog}\n fieldContext={fieldContext}\n onCreate={addNewRelation}\n />\n </>\n )}\n </div>\n <div>{options.togglerElement}</div>\n </div>\n );\n };\n \n const groupedEntities = groupByController(autoCompleteItems || []);\n return (\n <div>\n {Object.keys(groupedEntities).map((controllerName) => (\n <Panel toggleable headerTemplate={getHeaderTemplate(controllerName)} key={controllerName} className=\"mt-3 lg:mt-4\">\n <div className=\"formgrid grid gap-3 lg:gap-0 \">\n {groupedEntities[controllerName].map((entity: any, i: number) => {\n const isChecked = formik.values[fieldLayoutInfo.attrs.name].some((item: any) => item.value === entity.value);\n return (\n <div key={entity.label} className={`field col-12 lg:col-6 flex gap-2 ${i >= 2 ? 'lg:mt-3' : ''}`}>\n <Checkbox\n readOnly={readOnlyPermission}\n inputId={entity.label}\n checked={isChecked}\n onChange={() => handleCheckboxChange(entity)}\n />\n <label htmlFor={entity.label} className=\"form-field-label m-0 solid-permisson-form-label\"> {entity.label}</label>\n </div>\n )\n })}\n </div>\n </Panel>\n ))}\n {Object.keys(groupedEntities).map((controllerName) => (\n <InlineRelationEntityDialog\n key={`dialog-${controllerName}`}\n visible={visibleDialogs[controllerName] || false}\n setVisible={(visible: any) =>\n setVisibleDialogs((prev) => ({\n ...prev,\n [controllerName]: visible,\n }))\n }\n fieldContext={fieldContext}\n onCreate={addNewRelation}\n />\n ))}\n </div>\n )\n};"]}
1
+ {"version":3,"file":"RolePermissionsManyToManyFieldWidget.js","sourceRoot":"","sources":["../../../../../../src/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,+FAA+F,CAAC;AACzI,OAAO,EAAE,0BAA0B,EAAE,MAAM,iGAAiG,CAAC;AAC7I,OAAO,EAAE,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,IACL,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,MAAM,CAAC,KAAK,EACrB,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,cAAM,OAAA,oBAAoB,CAAC,MAAM,CAAC,EAA5B,CAA4B,GAC9C,EACF,iBAAO,OAAO,EAAE,MAAM,CAAC,KAAK,EAAE,SAAS,EAAC,iDAAiD,kBAAG,MAAM,CAAC,KAAK,IAAS,KAP3G,MAAM,CAAC,KAAK,CAQhB,CACT,CAAA;oBACL,CAAC,CAAC,GACA,IAhBgE,cAAc,CAiBhF,CACX,EAnBqD,CAmBrD,CAAC,EACD,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,UAAC,cAAc,IAAK,OAAA,CAClD,KAAC,0BAA0B,IAEvB,OAAO,EAAE,cAAc,CAAC,cAAc,CAAC,IAAI,KAAK,EAChD,UAAU,EAAE,UAAC,OAAY;oBACrB,OAAA,iBAAiB,CAAC,UAAC,IAAI;;wBAAK,OAAA,uBACrB,IAAI,gBACN,cAAc,IAAG,OAAO,OAC3B;oBAH0B,CAG1B,CAAC;gBAHH,CAGG,EAEP,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,cAAc,IATnB,iBAAU,cAAc,CAAE,CAUjC,CACL,EAbqD,CAarD,CAAC,IACA,CACT,CAAA;AACL,CAAC,CAAC","sourcesContent":["\nimport { capitalize } from \"lodash\";\nimport { Panel } from \"primereact/panel\";\nimport { useEffect, useState } from \"react\";\nimport { Button } from \"primereact/button\";\nimport { InputSwitch } from \"primereact/inputswitch\";\nimport { useRelationEntityHandler } from \"../../../../../components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler\";\nimport { InlineRelationEntityDialog } from \"../../../../../components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog\";\nimport { Checkbox } from \"primereact/checkbox\";\nimport { SolidFormFieldWidgetProps } from \"../../../../../types/solid-core\";\nimport qs from 'qs';\n\nconst groupByController = (items: any[]) => {\n const grouped: { [key: string]: any[] } = {};\n items.forEach((item) => {\n const controllerName = item.label.split(\".\")[0];\n if (!grouped[controllerName]) {\n grouped[controllerName] = [];\n }\n grouped[controllerName].push(item);\n });\n return grouped;\n};\n\nexport const RolePermissionsManyToManyFieldWidget = ({ formik, fieldContext }: SolidFormFieldWidgetProps) => {\n const fieldLayoutInfo = fieldContext.field;\n\n const readOnlyPermission = fieldContext.readOnly;\n const [visibleCreateDialog, setVisibleCreateDialog] = useState(false);\n const { autoCompleteItems, fetchRelationEntities, populateFormikWithRelatedEntities, addNewRelation } = useRelationEntityHandler({ fieldContext, formik });\n const [visibleDialogs, setVisibleDialogs] = useState<{ [key: string]: boolean }>({});\n\n\n useEffect(() => {\n populateFormikWithRelatedEntities();\n }, [formik.values?.id]);\n\n useEffect(() => {\n const queryData: any = {\n offset: 0,\n limit: 1000\n };\n const autocompleteQs = qs.stringify(queryData, {\n encodeValuesOnly: true,\n });\n fetchRelationEntities(autocompleteQs);\n }, []);\n\n const handleCheckboxChange = (e: any) => {\n if (formik.values[fieldLayoutInfo.attrs.name].some((item: any) => item.value === e.value)) {\n formik.setFieldValue(fieldLayoutInfo.attrs.name, formik.values[fieldLayoutInfo.attrs.name].filter((s: any) => s.value !== e.value));\n } else {\n formik.setFieldValue(fieldLayoutInfo.attrs.name, [...formik.values[fieldLayoutInfo.attrs.name], e]);\n }\n };\n\n const getHeaderTemplate = (controllerName: string) => (options: any) => {\n const className = `${options.className} justify-content-space-between`;\n\n return (\n <div className={className}>\n <div className=\"flex align-items-center gap-3\">\n <label className=\"form-field-label text-base lg:text-lg font-bold\">\n {controllerName}\n </label>\n {fieldContext.field.attrs.inlineCreate && (\n <>\n <Button\n icon=\"pi pi-plus\"\n rounded\n outlined\n aria-label=\"Add\"\n type=\"button\"\n size=\"small\"\n onClick={() =>\n setVisibleDialogs((prev) => ({\n ...prev,\n [controllerName]: true,\n }))\n }\n className=\"custom-add-button\"\n />\n <InlineRelationEntityDialog\n visible={visibleCreateDialog}\n setVisible={setVisibleCreateDialog}\n fieldContext={fieldContext}\n onCreate={addNewRelation}\n />\n </>\n )}\n </div>\n <div>{options.togglerElement}</div>\n </div>\n );\n };\n\n const groupedEntities = groupByController(autoCompleteItems || []);\n return (\n <div>\n {Object.keys(groupedEntities).map((controllerName) => (\n <Panel toggleable headerTemplate={getHeaderTemplate(controllerName)} key={controllerName} className=\"mt-3 lg:mt-4\">\n <div className=\"formgrid grid gap-3 lg:gap-0 \">\n {groupedEntities[controllerName].map((entity: any, i: number) => {\n const isChecked = formik.values[fieldLayoutInfo.attrs.name].some((item: any) => item.value === entity.value);\n return (\n <div key={entity.label} className={`field col-12 lg:col-6 flex gap-2 ${i >= 2 ? 'lg:mt-3' : ''}`}>\n <Checkbox\n readOnly={readOnlyPermission}\n inputId={entity.label}\n checked={isChecked}\n onChange={() => handleCheckboxChange(entity)}\n />\n <label htmlFor={entity.label} className=\"form-field-label m-0 solid-permisson-form-label\"> {entity.label}</label>\n </div>\n )\n })}\n </div>\n </Panel>\n ))}\n {Object.keys(groupedEntities).map((controllerName) => (\n <InlineRelationEntityDialog\n key={`dialog-${controllerName}`}\n visible={visibleDialogs[controllerName] || false}\n setVisible={(visible: any) =>\n setVisibleDialogs((prev) => ({\n ...prev,\n [controllerName]: visible,\n }))\n }\n fieldContext={fieldContext}\n onCreate={addNewRelation}\n />\n ))}\n </div>\n )\n};"]}
@@ -27,9 +27,14 @@ export const RolePermissionsManyToManyFieldWidget = ({ formik, fieldContext }: S
27
27
 
28
28
  const readOnlyPermission = fieldContext.readOnly;
29
29
  const [visibleCreateDialog, setVisibleCreateDialog] = useState(false);
30
- const { autoCompleteItems, fetchRelationEntities, addNewRelation } = useRelationEntityHandler({ fieldContext, formik });
30
+ const { autoCompleteItems, fetchRelationEntities, populateFormikWithRelatedEntities, addNewRelation } = useRelationEntityHandler({ fieldContext, formik });
31
31
  const [visibleDialogs, setVisibleDialogs] = useState<{ [key: string]: boolean }>({});
32
32
 
33
+
34
+ useEffect(() => {
35
+ populateFormikWithRelatedEntities();
36
+ }, [formik.values?.id]);
37
+
33
38
  useEffect(() => {
34
39
  const queryData: any = {
35
40
  offset: 0,
@@ -51,7 +56,7 @@ export const RolePermissionsManyToManyFieldWidget = ({ formik, fieldContext }: S
51
56
 
52
57
  const getHeaderTemplate = (controllerName: string) => (options: any) => {
53
58
  const className = `${options.className} justify-content-space-between`;
54
-
59
+
55
60
  return (
56
61
  <div className={className}>
57
62
  <div className="flex align-items-center gap-3">
@@ -88,44 +93,44 @@ export const RolePermissionsManyToManyFieldWidget = ({ formik, fieldContext }: S
88
93
  </div>
89
94
  );
90
95
  };
91
-
96
+
92
97
  const groupedEntities = groupByController(autoCompleteItems || []);
93
98
  return (
94
- <div>
95
- {Object.keys(groupedEntities).map((controllerName) => (
96
- <Panel toggleable headerTemplate={getHeaderTemplate(controllerName)} key={controllerName} className="mt-3 lg:mt-4">
97
- <div className="formgrid grid gap-3 lg:gap-0 ">
98
- {groupedEntities[controllerName].map((entity: any, i: number) => {
99
- const isChecked = formik.values[fieldLayoutInfo.attrs.name].some((item: any) => item.value === entity.value);
100
- return (
101
- <div key={entity.label} className={`field col-12 lg:col-6 flex gap-2 ${i >= 2 ? 'lg:mt-3' : ''}`}>
102
- <Checkbox
103
- readOnly={readOnlyPermission}
104
- inputId={entity.label}
105
- checked={isChecked}
106
- onChange={() => handleCheckboxChange(entity)}
107
- />
108
- <label htmlFor={entity.label} className="form-field-label m-0 solid-permisson-form-label"> {entity.label}</label>
109
- </div>
110
- )
111
- })}
112
- </div>
113
- </Panel>
114
- ))}
115
- {Object.keys(groupedEntities).map((controllerName) => (
116
- <InlineRelationEntityDialog
117
- key={`dialog-${controllerName}`}
118
- visible={visibleDialogs[controllerName] || false}
119
- setVisible={(visible: any) =>
120
- setVisibleDialogs((prev) => ({
121
- ...prev,
122
- [controllerName]: visible,
123
- }))
124
- }
125
- fieldContext={fieldContext}
126
- onCreate={addNewRelation}
127
- />
128
- ))}
129
- </div>
130
- )
99
+ <div>
100
+ {Object.keys(groupedEntities).map((controllerName) => (
101
+ <Panel toggleable headerTemplate={getHeaderTemplate(controllerName)} key={controllerName} className="mt-3 lg:mt-4">
102
+ <div className="formgrid grid gap-3 lg:gap-0 ">
103
+ {groupedEntities[controllerName].map((entity: any, i: number) => {
104
+ const isChecked = formik.values[fieldLayoutInfo.attrs.name].some((item: any) => item.value === entity.value);
105
+ return (
106
+ <div key={entity.label} className={`field col-12 lg:col-6 flex gap-2 ${i >= 2 ? 'lg:mt-3' : ''}`}>
107
+ <Checkbox
108
+ readOnly={readOnlyPermission}
109
+ inputId={entity.label}
110
+ checked={isChecked}
111
+ onChange={() => handleCheckboxChange(entity)}
112
+ />
113
+ <label htmlFor={entity.label} className="form-field-label m-0 solid-permisson-form-label"> {entity.label}</label>
114
+ </div>
115
+ )
116
+ })}
117
+ </div>
118
+ </Panel>
119
+ ))}
120
+ {Object.keys(groupedEntities).map((controllerName) => (
121
+ <InlineRelationEntityDialog
122
+ key={`dialog-${controllerName}`}
123
+ visible={visibleDialogs[controllerName] || false}
124
+ setVisible={(visible: any) =>
125
+ setVisibleDialogs((prev) => ({
126
+ ...prev,
127
+ [controllerName]: visible,
128
+ }))
129
+ }
130
+ fieldContext={fieldContext}
131
+ onCreate={addNewRelation}
132
+ />
133
+ ))}
134
+ </div>
135
+ )
131
136
  };
@@ -0,0 +1,2 @@
1
+ export declare const SolidOneToManyFilterElement: ({ value, updateInputs, index, fieldMetadata }: any) => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=SolidOneToManyFilterElement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SolidOneToManyFilterElement.d.ts","sourceRoot":"","sources":["../../../../src/components/core/filter/SolidOneToManyFilterElement.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,2BAA2B,kDAKrC,GAAG,4CAiDL,CAAC"}
@@ -0,0 +1,86 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { jsx as _jsx } from "react/jsx-runtime";
38
+ import { createSolidEntityApi } from "../../../redux/api/solidEntityApi";
39
+ import { AutoComplete } from "primereact/autocomplete";
40
+ import { useState } from "react";
41
+ import qs from "qs";
42
+ export var SolidOneToManyFilterElement = function (_a) {
43
+ var _b = _a.value, value = _b === void 0 ? [] : _b, updateInputs = _a.updateInputs, index = _a.index, fieldMetadata = _a.fieldMetadata;
44
+ var entityApi = createSolidEntityApi(fieldMetadata.relationCoModelSingularName);
45
+ var useLazyGetSolidEntitiesQuery = entityApi.useLazyGetSolidEntitiesQuery;
46
+ var triggerGetSolidEntities = useLazyGetSolidEntitiesQuery()[0];
47
+ var _c = useState([]), suggestions = _c[0], setSuggestions = _c[1];
48
+ var search = function (event) { return __awaiter(void 0, void 0, void 0, function () {
49
+ var queryData, qsString, response;
50
+ var _a;
51
+ var _b, _c;
52
+ return __generator(this, function (_d) {
53
+ switch (_d.label) {
54
+ case 0:
55
+ queryData = {
56
+ offset: 0,
57
+ limit: 20,
58
+ filters: (_a = {},
59
+ _a[(_c = (_b = fieldMetadata === null || fieldMetadata === void 0 ? void 0 : fieldMetadata.relationModel) === null || _b === void 0 ? void 0 : _b.userKeyField) === null || _c === void 0 ? void 0 : _c.name] = {
60
+ $containsi: event.query
61
+ },
62
+ _a)
63
+ };
64
+ qsString = qs.stringify(queryData, { encodeValuesOnly: true });
65
+ return [4 /*yield*/, triggerGetSolidEntities(qsString)];
66
+ case 1:
67
+ response = _d.sent();
68
+ if (response.data) {
69
+ setSuggestions(response.data.records.map(function (item) { return ({
70
+ label: item[fieldMetadata.relationModel.userKeyField.name],
71
+ value: item.id
72
+ }); }));
73
+ }
74
+ return [2 /*return*/];
75
+ }
76
+ });
77
+ }); };
78
+ return (_jsx(AutoComplete
79
+ // multiple
80
+ , {
81
+ // multiple
82
+ dropdown: true, field: "label", value: value, suggestions: suggestions, completeMethod: search, onChange: function (e) {
83
+ updateInputs(index, e.value);
84
+ }, placeholder: "Select ".concat(fieldMetadata.displayName), className: "w-full", inputClassName: "w-full p-inputtext-sm" }));
85
+ };
86
+ //# sourceMappingURL=SolidOneToManyFilterElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SolidOneToManyFilterElement.js","sourceRoot":"","sources":["../../../../src/components/core/filter/SolidOneToManyFilterElement.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,YAAY,EAA6B,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAa,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,MAAM,CAAC,IAAM,2BAA2B,GAAG,UAAC,EAKtC;QAJF,aAAU,EAAV,KAAK,mBAAG,EAAE,KAAA,EACV,YAAY,kBAAA,EACZ,KAAK,WAAA,EACL,aAAa,mBAAA;IAGb,IAAM,SAAS,GAAG,oBAAoB,CAAC,aAAa,CAAC,2BAA2B,CAAC,CAAC;IAC1E,IAAA,4BAA4B,GAAK,SAAS,6BAAd,CAAe;IAC5C,IAAA,uBAAuB,GAAI,4BAA4B,EAAE,GAAlC,CAAmC;IAE3D,IAAA,KAAgC,QAAQ,CAAQ,EAAE,CAAC,EAAlD,WAAW,QAAA,EAAE,cAAc,QAAuB,CAAC;IAE1D,IAAM,MAAM,GAAG,UAAO,KAAgC;;;;;;;oBAC5C,SAAS,GAAG;wBACd,MAAM,EAAE,CAAC;wBACT,KAAK,EAAE,EAAE;wBACT,OAAO;4BACH,GAAC,MAAA,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,aAAa,0CAAE,YAAY,0CAAE,IAAI,IAAG;gCAChD,UAAU,EAAE,KAAK,CAAC,KAAK;6BAC1B;+BACJ;qBACJ,CAAC;oBAEI,QAAQ,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;oBACpD,qBAAM,uBAAuB,CAAC,QAAQ,CAAC,EAAA;;oBAAlD,QAAQ,GAAG,SAAuC;oBAExD,IAAI,QAAQ,CAAC,IAAI,EAAE;wBACf,cAAc,CACV,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAC,IAAS,IAAK,OAAA,CAAC;4BACtC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC;4BAC1D,KAAK,EAAE,IAAI,CAAC,EAAE;yBACjB,CAAC,EAHuC,CAGvC,CAAC,CACN,CAAC;qBACL;;;;SACJ,CAAC;IAGF,OAAO,CACH,KAAC,YAAY;IACT,WAAW;;QAAX,WAAW;QACX,QAAQ,QACR,KAAK,EAAC,OAAO,EACb,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,UAAC,CAAC;YACR,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAA;QAChC,CAAC,EACD,WAAW,EAAE,iBAAU,aAAa,CAAC,WAAW,CAAE,EAClD,SAAS,EAAC,QAAQ,EAClB,cAAc,EAAC,uBAAuB,GACxC,CACL,CAAC;AACN,CAAC,CAAC","sourcesContent":["\n\nimport { createSolidEntityApi } from \"../../../redux/api/solidEntityApi\";\nimport { AutoComplete, AutoCompleteCompleteEvent } from \"primereact/autocomplete\";\nimport { useEffect, useState } from \"react\";\nimport qs from \"qs\";\n\nexport const SolidOneToManyFilterElement = ({\n value = [],\n updateInputs,\n index,\n fieldMetadata\n}: any) => {\n\n const entityApi = createSolidEntityApi(fieldMetadata.relationCoModelSingularName);\n const { useLazyGetSolidEntitiesQuery } = entityApi;\n const [triggerGetSolidEntities] = useLazyGetSolidEntitiesQuery();\n\n const [suggestions, setSuggestions] = useState<any[]>([]);\n\n const search = async (event: AutoCompleteCompleteEvent) => {\n const queryData = {\n offset: 0,\n limit: 20,\n filters: {\n [fieldMetadata?.relationModel?.userKeyField?.name]: {\n $containsi: event.query\n }\n }\n };\n\n const qsString = qs.stringify(queryData, { encodeValuesOnly: true });\n const response = await triggerGetSolidEntities(qsString);\n\n if (response.data) {\n setSuggestions(\n response.data.records.map((item: any) => ({\n label: item[fieldMetadata.relationModel.userKeyField.name],\n value: item.id\n }))\n );\n }\n };\n\n\n return (\n <AutoComplete\n // multiple\n dropdown\n field=\"label\"\n value={value}\n suggestions={suggestions}\n completeMethod={search}\n onChange={(e) => {\n updateInputs(index, e.value)\n }}\n placeholder={`Select ${fieldMetadata.displayName}`}\n className=\"w-full\"\n inputClassName=\"w-full p-inputtext-sm\"\n />\n );\n};"]}
@@ -0,0 +1,62 @@
1
+
2
+
3
+ import { createSolidEntityApi } from "../../../redux/api/solidEntityApi";
4
+ import { AutoComplete, AutoCompleteCompleteEvent } from "primereact/autocomplete";
5
+ import { useEffect, useState } from "react";
6
+ import qs from "qs";
7
+
8
+ export const SolidOneToManyFilterElement = ({
9
+ value = [],
10
+ updateInputs,
11
+ index,
12
+ fieldMetadata
13
+ }: any) => {
14
+
15
+ const entityApi = createSolidEntityApi(fieldMetadata.relationCoModelSingularName);
16
+ const { useLazyGetSolidEntitiesQuery } = entityApi;
17
+ const [triggerGetSolidEntities] = useLazyGetSolidEntitiesQuery();
18
+
19
+ const [suggestions, setSuggestions] = useState<any[]>([]);
20
+
21
+ const search = async (event: AutoCompleteCompleteEvent) => {
22
+ const queryData = {
23
+ offset: 0,
24
+ limit: 20,
25
+ filters: {
26
+ [fieldMetadata?.relationModel?.userKeyField?.name]: {
27
+ $containsi: event.query
28
+ }
29
+ }
30
+ };
31
+
32
+ const qsString = qs.stringify(queryData, { encodeValuesOnly: true });
33
+ const response = await triggerGetSolidEntities(qsString);
34
+
35
+ if (response.data) {
36
+ setSuggestions(
37
+ response.data.records.map((item: any) => ({
38
+ label: item[fieldMetadata.relationModel.userKeyField.name],
39
+ value: item.id
40
+ }))
41
+ );
42
+ }
43
+ };
44
+
45
+
46
+ return (
47
+ <AutoComplete
48
+ // multiple
49
+ dropdown
50
+ field="label"
51
+ value={value}
52
+ suggestions={suggestions}
53
+ completeMethod={search}
54
+ onChange={(e) => {
55
+ updateInputs(index, e.value)
56
+ }}
57
+ placeholder={`Select ${fieldMetadata.displayName}`}
58
+ className="w-full"
59
+ inputClassName="w-full p-inputtext-sm"
60
+ />
61
+ );
62
+ };
@@ -7,6 +7,7 @@ export declare enum InputTypes {
7
7
  SelectionStatic = "SelectionStatic",
8
8
  RelationManyToOne = "RelationManyToOne",
9
9
  RelationManyToMany = "RelationManyToMany",
10
+ RelationOneToMany = "RelationOneToMany",
10
11
  SelectionDynamic = "SelectionDynamic",
11
12
  Boolean = "Boolean"
12
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SolidVarInputsFilterElement.d.ts","sourceRoot":"","sources":["../../../../src/components/core/filter/SolidVarInputsFilterElement.tsx"],"names":[],"mappings":"AAWA,oBAAY,UAAU;IAClB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,eAAe,oBAAoB;IACnC,iBAAiB,sBAAsB;IACvC,kBAAkB,uBAAuB;IACzC,gBAAgB,qBAAqB;IACrC,OAAO,YAAY;CACtB;AAID,eAAO,MAAM,2BAA2B,mEAA6F,GAAG,4CAsLvI,CAAA"}
1
+ {"version":3,"file":"SolidVarInputsFilterElement.d.ts","sourceRoot":"","sources":["../../../../src/components/core/filter/SolidVarInputsFilterElement.tsx"],"names":[],"mappings":"AAYA,oBAAY,UAAU;IAClB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,eAAe,oBAAoB;IACnC,iBAAiB,sBAAsB;IACvC,kBAAkB,uBAAuB;IACzC,iBAAiB,sBAAsB;IACvC,gBAAgB,qBAAqB;IACrC,OAAO,YAAY;CACtB;AAID,eAAO,MAAM,2BAA2B,mEAA6F,GAAG,4CA8LvI,CAAA"}