@solidstarters/solid-core-ui 1.1.31 → 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.
- package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeChangeHandler.d.ts +7 -0
- package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeChangeHandler.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeChangeHandler.js +17 -0
- package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeChangeHandler.js.map +1 -0
- package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeLoad.d.ts +7 -0
- package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeLoad.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeLoad.js +17 -0
- package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeLoad.js.map +1 -0
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.d.ts +3 -0
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.js +78 -0
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.js.map +1 -0
- package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
- package/dist/components/core/form/SolidFormView.js +58 -20
- package/dist/components/core/form/SolidFormView.js.map +1 -1
- package/dist/components/core/form/fields/SolidLongTextField.d.ts +2 -0
- package/dist/components/core/form/fields/SolidLongTextField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidLongTextField.js +32 -3
- package/dist/components/core/form/fields/SolidLongTextField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts +1 -3
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +19 -274
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
- package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyAutocompleteWidget.d.ts +3 -0
- package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyAutocompleteWidget.d.ts.map +1 -0
- package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyAutocompleteWidget.js +38 -0
- package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyAutocompleteWidget.js.map +1 -0
- package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyCheckboxWidget.d.ts +3 -0
- package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyCheckboxWidget.d.ts.map +1 -0
- package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyCheckboxWidget.js +48 -0
- package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyCheckboxWidget.js.map +1 -0
- package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.d.ts +2 -0
- package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.d.ts.map +1 -0
- package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.js +35 -0
- package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.js.map +1 -0
- package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.d.ts +6 -0
- package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.d.ts.map +1 -0
- package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.js +119 -0
- package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.js.map +1 -0
- package/dist/helpers/registry.d.ts +1 -1
- package/dist/helpers/registry.d.ts.map +1 -1
- package/dist/helpers/registry.js +19 -2
- package/dist/helpers/registry.js.map +1 -1
- package/package.json +1 -1
- package/src/components/core/extension/solid-core/emailTemplate/emailFormTypeChangeHandler.ts +18 -0
- package/src/components/core/extension/solid-core/emailTemplate/emailFormTypeLoad.ts +18 -0
- package/src/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.tsx +123 -0
- package/src/components/core/form/SolidFormView.tsx +62 -18
- package/src/components/core/form/fields/SolidLongTextField.tsx +79 -20
- package/src/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +20 -356
- package/src/components/core/form/fields/relations/widgets/SolidRelationManyToManyAutocompleteWidget.tsx +74 -0
- package/src/components/core/form/fields/relations/widgets/SolidRelationManyToManyCheckboxWidget.tsx +103 -0
- package/src/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.tsx +33 -0
- package/src/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.ts +64 -0
- package/src/helpers/registry.ts +21 -2
- package/src/types/solid-core.d.ts +14 -1
package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
38
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
39
|
+
if (ar || !(i in from)) {
|
|
40
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
41
|
+
ar[i] = from[i];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
45
|
+
};
|
|
46
|
+
import { useState } from "react";
|
|
47
|
+
import qs from "qs";
|
|
48
|
+
import { createSolidEntityApi } from "../../../../../../../redux/api/solidEntityApi";
|
|
49
|
+
export var useRelationEntityHandler = function (_a) {
|
|
50
|
+
var fieldContext = _a.fieldContext, formik = _a.formik, _b = _a.autoCompleteLimit, autoCompleteLimit = _b === void 0 ? 1000 : _b;
|
|
51
|
+
var fieldMetadata = fieldContext.fieldMetadata;
|
|
52
|
+
var fieldLayoutInfo = fieldContext.field;
|
|
53
|
+
var entityApi = createSolidEntityApi(fieldMetadata.relationCoModelSingularName);
|
|
54
|
+
var useLazyGetSolidEntitiesQuery = entityApi.useLazyGetSolidEntitiesQuery;
|
|
55
|
+
var triggerGetSolidEntities = useLazyGetSolidEntitiesQuery()[0];
|
|
56
|
+
var _c = useState([]), autoCompleteItems = _c[0], setAutoCompleteItems = _c[1];
|
|
57
|
+
var fetchRelationEntities = function (query, limit) {
|
|
58
|
+
if (query === void 0) { query = ""; }
|
|
59
|
+
if (limit === void 0) { limit = autoCompleteLimit; }
|
|
60
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
61
|
+
var queryData, autocompleteQs, response, data, mappedItems;
|
|
62
|
+
var _a;
|
|
63
|
+
var _b, _c;
|
|
64
|
+
return __generator(this, function (_d) {
|
|
65
|
+
switch (_d.label) {
|
|
66
|
+
case 0:
|
|
67
|
+
queryData = {
|
|
68
|
+
offset: 0,
|
|
69
|
+
limit: limit,
|
|
70
|
+
filters: (_a = {},
|
|
71
|
+
_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] = {
|
|
72
|
+
'$containsi': query
|
|
73
|
+
},
|
|
74
|
+
_a)
|
|
75
|
+
};
|
|
76
|
+
autocompleteQs = qs.stringify(queryData, { encodeValuesOnly: true });
|
|
77
|
+
return [4 /*yield*/, triggerGetSolidEntities(autocompleteQs)];
|
|
78
|
+
case 1:
|
|
79
|
+
response = _d.sent();
|
|
80
|
+
data = response.data;
|
|
81
|
+
if (data) {
|
|
82
|
+
mappedItems = data.records.map(function (item) {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
return ({
|
|
85
|
+
label: item[(_b = (_a = fieldMetadata === null || fieldMetadata === void 0 ? void 0 : fieldMetadata.relationModel) === null || _a === void 0 ? void 0 : _a.userKeyField) === null || _b === void 0 ? void 0 : _b.name],
|
|
86
|
+
value: item['id'],
|
|
87
|
+
original: item
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
setAutoCompleteItems(mappedItems);
|
|
91
|
+
}
|
|
92
|
+
return [2 /*return*/];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
var addNewRelation = function (values) {
|
|
98
|
+
var _a, _b;
|
|
99
|
+
var currentData = formik.values[fieldLayoutInfo.attrs.name] || [];
|
|
100
|
+
var jsonValues = Object.fromEntries(values.entries());
|
|
101
|
+
var newItem = {
|
|
102
|
+
label: jsonValues[(_b = (_a = fieldMetadata === null || fieldMetadata === void 0 ? void 0 : fieldMetadata.relationModel) === null || _a === void 0 ? void 0 : _a.userKeyField) === null || _b === void 0 ? void 0 : _b.name],
|
|
103
|
+
value: "new",
|
|
104
|
+
original: jsonValues,
|
|
105
|
+
};
|
|
106
|
+
formik.setFieldValue(fieldLayoutInfo.attrs.name, __spreadArray(__spreadArray([], currentData, true), [newItem], false));
|
|
107
|
+
// Optionally add to autocomplete list
|
|
108
|
+
setAutoCompleteItems(function (prev) {
|
|
109
|
+
var exists = prev.some(function (item) { return item.label === newItem.label; });
|
|
110
|
+
return exists ? prev : __spreadArray(__spreadArray([], prev, true), [newItem], false);
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
return {
|
|
114
|
+
autoCompleteItems: autoCompleteItems,
|
|
115
|
+
fetchRelationEntities: fetchRelationEntities,
|
|
116
|
+
addNewRelation: addNewRelation
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=useRelationEntityHandler.js.map
|
package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRelationEntityHandler.js","sourceRoot":"","sources":["../../../../../../../../src/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const registerExtensionComponent: (name: string, component: React.ComponentType<any
|
|
2
|
+
export declare const registerExtensionComponent: (name: string, component: React.ComponentType<any>, aliases?: string[]) => void;
|
|
3
3
|
export declare const registerExtensionFunction: (name: string, fn: (...args: any[]) => any) => void;
|
|
4
4
|
export declare const getExtensionComponent: (name: string) => React.ComponentType<any> | null;
|
|
5
5
|
export declare const getExtensionFunction: (name: string) => (...args: any[]) => any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/helpers/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/helpers/registry.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,eAAO,MAAM,0BAA0B,SAAU,MAAM,aAAa,MAAM,aAAa,CAAC,GAAG,CAAC,YAAW,MAAM,EAAE,SAO9G,CAAC;AAEF,eAAO,MAAM,yBAAyB,SAAU,MAAM,gBAAgB,GAAG,EAAE,KAAK,GAAG,SAGlF,CAAC;AAEF,eAAO,MAAM,qBAAqB,SAAU,MAAM,KAAG,MAAM,aAAa,CAAC,GAAG,CAAC,GAAG,IAwB/E,CAAC;AAEF,eAAO,MAAM,oBAAoB,SAAU,MAAM,eAhDT,GAAG,EAAE,KAAK,GAmDjD,CAAC"}
|
package/dist/helpers/registry.js
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
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
|
var extensionRegistry = {
|
|
3
8
|
components: {},
|
|
4
9
|
functions: {},
|
|
5
10
|
};
|
|
6
|
-
export var registerExtensionComponent = function (name, component) {
|
|
11
|
+
export var registerExtensionComponent = function (name, component, aliases) {
|
|
12
|
+
if (aliases === void 0) { aliases = []; }
|
|
7
13
|
// console.log(`registerExtensionComponent invoked... ${name}`);
|
|
8
14
|
extensionRegistry.components[name] = component;
|
|
15
|
+
for (var i = 0; i < aliases.length; i++) {
|
|
16
|
+
var alias = aliases[i];
|
|
17
|
+
extensionRegistry.components[alias] = component;
|
|
18
|
+
}
|
|
9
19
|
};
|
|
10
20
|
export var registerExtensionFunction = function (name, fn) {
|
|
11
21
|
// console.log(`registerExtensionFunction invoked... ${name}`);
|
|
@@ -37,7 +47,14 @@ export var getExtensionFunction = function (name) {
|
|
|
37
47
|
};
|
|
38
48
|
// Register all the dynamic widget & functions from inside solid-core-ui
|
|
39
49
|
// Common
|
|
40
|
-
registerExtensionComponent("CustomHtml", CustomHtml);
|
|
50
|
+
registerExtensionComponent("CustomHtml", CustomHtml, []);
|
|
51
|
+
registerExtensionComponent("SolidRelationManyToManyCheckboxWidget", SolidRelationManyToManyCheckboxWidget, ["checkbox"]);
|
|
52
|
+
registerExtensionComponent("SolidRelationManyToManyAutocompleteWidget", SolidRelationManyToManyAutocompleteWidget, ["autocomplete"]);
|
|
41
53
|
// ModuleMetadata
|
|
42
54
|
// ModelMetadata
|
|
55
|
+
// Email Template
|
|
56
|
+
registerExtensionFunction("emailFormTypeChangeHandler", hanldeEmailFormTypeChange);
|
|
57
|
+
registerExtensionFunction("emailFormTypeLoad", hanldeEmailFormTypeLoad);
|
|
58
|
+
// RoleMetadata
|
|
59
|
+
registerExtensionComponent("RolePermissionsManyToManyFieldWidget", RolePermissionsManyToManyFieldWidget, ["inputSwitch"]);
|
|
43
60
|
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/helpers/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAQvE,IAAM,iBAAiB,GAAsB;IACzC,UAAU,EAAE,EAAE;IACd,SAAS,EAAE,EAAE;CAChB,CAAC;AAEF,MAAM,CAAC,IAAM,0BAA0B,GAAG,UAAC,IAAY,EAAE,SAAmC;
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/helpers/registry.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,MAAM,iFAAiF,CAAC;AACxH,OAAO,uBAAuB,MAAM,wEAAwE,CAAC;AAC7G,OAAO,EAAE,oCAAoC,EAAE,MAAM,0FAA0F,CAAC;AAChJ,OAAO,EAAE,yCAAyC,EAAE,MAAM,2FAA2F,CAAC;AACtJ,OAAO,EAAE,qCAAqC,EAAE,MAAM,uFAAuF,CAAC;AAC9I,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAQvE,IAAM,iBAAiB,GAAsB;IACzC,UAAU,EAAE,EAAE;IACd,SAAS,EAAE,EAAE;CAChB,CAAC;AAEF,MAAM,CAAC,IAAM,0BAA0B,GAAG,UAAC,IAAY,EAAE,SAAmC,EAAE,OAAsB;IAAtB,wBAAA,EAAA,YAAsB;IAChH,gEAAgE;IAChE,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;IAC/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,IAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACzB,iBAAiB,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;KACnD;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,yBAAyB,GAAG,UAAC,IAAY,EAAE,EAA2B;IAC/E,+DAA+D;IAC/D,iBAAiB,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;AAC3C,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,qBAAqB,GAAG,UAAC,IAAY;IAC9C,IAAI,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QACpC,OAAO,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;KAC7C;IAED,OAAO,IAAI,CAAC;IAEZ,8EAA8E;IAE9E,4CAA4C;IAC5C,yBAAyB;IACzB,0EAA0E;IAC1E,+IAA+I;IAC/I,IAAI;IAEJ,QAAQ;IACR,+FAA+F;IAC/F,4FAA4F;IAC5F,oBAAoB;IACpB,wEAAwE;IACxE,IAAI;IAEJ,+BAA+B;IAC/B,qIAAqI;AACzI,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,oBAAoB,GAAG,UAAC,IAAY;IAC7C,sDAAsD;IACtD,OAAO,iBAAiB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC,CAAC;AAGF,wEAAwE;AACxE,SAAS;AACT,0BAA0B,CAAC,YAAY,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;AACzD,0BAA0B,CAAC,uCAAuC,EAAE,qCAAqC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;AACzH,0BAA0B,CAAC,2CAA2C,EAAE,yCAAyC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;AAGrI,iBAAiB;AAGjB,gBAAgB;AAGhB,iBAAiB;AACjB,yBAAyB,CAAC,4BAA4B,EAAE,yBAAyB,CAAC,CAAC;AACnF,yBAAyB,CAAC,mBAAmB,EAAE,uBAAuB,CAAC,CAAC;AAExE,eAAe;AACf,0BAA0B,CAAC,sCAAsC,EAAE,oCAAoC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SolidViewLayoutManager } from "@/components/core/common/SolidViewLayoutManager";
|
|
2
|
+
|
|
3
|
+
const hanldeEmailFormTypeChange = (event: any) => {
|
|
4
|
+
|
|
5
|
+
const { modifiedField, modifiedFieldValue, viewMetadata, } = event;
|
|
6
|
+
const layout = viewMetadata.layout;
|
|
7
|
+
if (modifiedField === 'type') {
|
|
8
|
+
const layoutManager = new SolidViewLayoutManager(layout);
|
|
9
|
+
const renderMode = modifiedFieldValue.value === 'text' ? 'longText' : 'richText';
|
|
10
|
+
layoutManager.updateNodeAttributes('body', { "renderMode": renderMode});
|
|
11
|
+
return {
|
|
12
|
+
layoutChanged: true,
|
|
13
|
+
dataChanged: false,
|
|
14
|
+
newLayout: layoutManager.getLayout(),
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export default hanldeEmailFormTypeChange;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SolidViewLayoutManager } from "@/components/core/common/SolidViewLayoutManager";
|
|
2
|
+
|
|
3
|
+
const hanldeEmailFormTypeLoad = (event: any) => {
|
|
4
|
+
|
|
5
|
+
const { formData, type, viewMetadata } = event;
|
|
6
|
+
const layout = viewMetadata.layout;
|
|
7
|
+
if (formData?.type && type === 'onFormLayoutLoad') {
|
|
8
|
+
const layoutManager = new SolidViewLayoutManager(layout);
|
|
9
|
+
const renderMode = formData.type === 'text' ? 'longText' : 'richText';
|
|
10
|
+
layoutManager.updateNodeAttributes('body', { "renderMode": renderMode});
|
|
11
|
+
return {
|
|
12
|
+
layoutChanged: true,
|
|
13
|
+
dataChanged: false,
|
|
14
|
+
newLayout: layoutManager.getLayout(),
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export default hanldeEmailFormTypeLoad;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { SolidRelationManyToManyFieldWidgetProps } from "@/types/solid-core";
|
|
3
|
+
import { capitalize } from "lodash";
|
|
4
|
+
import { Panel } from "primereact/panel";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
import { Button } from "primereact/button";
|
|
7
|
+
import { InputSwitch } from "primereact/inputswitch";
|
|
8
|
+
import { useRelationEntityHandler } from "@/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler";
|
|
9
|
+
import { InlineRelationEntityDialog } from "@/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog";
|
|
10
|
+
import { Checkbox } from "primereact/checkbox";
|
|
11
|
+
|
|
12
|
+
const groupByController = (items: any[]) => {
|
|
13
|
+
const grouped: { [key: string]: any[] } = {};
|
|
14
|
+
items.forEach((item) => {
|
|
15
|
+
const controllerName = item.label.split(".")[0];
|
|
16
|
+
if (!grouped[controllerName]) {
|
|
17
|
+
grouped[controllerName] = [];
|
|
18
|
+
}
|
|
19
|
+
grouped[controllerName].push(item);
|
|
20
|
+
});
|
|
21
|
+
return grouped;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const RolePermissionsManyToManyFieldWidget = ({ formik, fieldContext }: SolidRelationManyToManyFieldWidgetProps) => {
|
|
25
|
+
const fieldLayoutInfo = fieldContext.field;
|
|
26
|
+
|
|
27
|
+
const readOnlyPermission = fieldContext.readOnly;
|
|
28
|
+
const [visibleCreateDialog, setVisibleCreateDialog] = useState(false);
|
|
29
|
+
const { autoCompleteItems, fetchRelationEntities, addNewRelation } = useRelationEntityHandler({ fieldContext, formik });
|
|
30
|
+
const [visibleDialogs, setVisibleDialogs] = useState<{ [key: string]: boolean }>({});
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
fetchRelationEntities();
|
|
34
|
+
}, []);
|
|
35
|
+
|
|
36
|
+
const handleCheckboxChange = (e: any) => {
|
|
37
|
+
if (formik.values[fieldLayoutInfo.attrs.name].some((item: any) => item.value === e.value)) {
|
|
38
|
+
formik.setFieldValue(fieldLayoutInfo.attrs.name, formik.values[fieldLayoutInfo.attrs.name].filter((s: any) => s.value !== e.value));
|
|
39
|
+
} else {
|
|
40
|
+
formik.setFieldValue(fieldLayoutInfo.attrs.name, [...formik.values[fieldLayoutInfo.attrs.name], e]);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const getHeaderTemplate = (controllerName: string) => (options: any) => {
|
|
45
|
+
const className = `${options.className} justify-content-space-between`;
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div className={className}>
|
|
49
|
+
<div className="flex align-items-center gap-3">
|
|
50
|
+
<label className="form-field-label text-lg font-bold">
|
|
51
|
+
{controllerName}
|
|
52
|
+
</label>
|
|
53
|
+
{fieldContext.field.attrs.inlineCreate && (
|
|
54
|
+
<>
|
|
55
|
+
<Button
|
|
56
|
+
icon="pi pi-plus"
|
|
57
|
+
rounded
|
|
58
|
+
outlined
|
|
59
|
+
aria-label="Add"
|
|
60
|
+
type="button"
|
|
61
|
+
size="small"
|
|
62
|
+
onClick={() =>
|
|
63
|
+
setVisibleDialogs((prev) => ({
|
|
64
|
+
...prev,
|
|
65
|
+
[controllerName]: true,
|
|
66
|
+
}))
|
|
67
|
+
}
|
|
68
|
+
className="custom-add-button"
|
|
69
|
+
/>
|
|
70
|
+
<InlineRelationEntityDialog
|
|
71
|
+
visible={visibleCreateDialog}
|
|
72
|
+
setVisible={setVisibleCreateDialog}
|
|
73
|
+
fieldContext={fieldContext}
|
|
74
|
+
onCreate={addNewRelation}
|
|
75
|
+
/>
|
|
76
|
+
</>
|
|
77
|
+
)}
|
|
78
|
+
</div>
|
|
79
|
+
<div>{options.togglerElement}</div>
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const groupedEntities = groupByController(autoCompleteItems || []);
|
|
85
|
+
return (
|
|
86
|
+
<div>
|
|
87
|
+
{Object.keys(groupedEntities).map((controllerName) => (
|
|
88
|
+
<Panel toggleable headerTemplate={getHeaderTemplate(controllerName)} key={controllerName} className="mt-4">
|
|
89
|
+
<div className="formgrid grid">
|
|
90
|
+
{groupedEntities[controllerName].map((entity: any, i: number) => {
|
|
91
|
+
const isChecked = formik.values[fieldLayoutInfo.attrs.name].some((item: any) => item.value === entity.value);
|
|
92
|
+
return (
|
|
93
|
+
<div key={entity.label} className={`field col-6 flex gap-2 ${i >= 2 ? 'mt-3' : ''}`}>
|
|
94
|
+
<Checkbox
|
|
95
|
+
readOnly={readOnlyPermission}
|
|
96
|
+
inputId={entity.label}
|
|
97
|
+
checked={isChecked}
|
|
98
|
+
onChange={() => handleCheckboxChange(entity)}
|
|
99
|
+
/>
|
|
100
|
+
<label htmlFor={entity.label} className="form-field-label m-0"> {entity.label}</label>
|
|
101
|
+
</div>
|
|
102
|
+
)
|
|
103
|
+
})}
|
|
104
|
+
</div>
|
|
105
|
+
</Panel>
|
|
106
|
+
))}
|
|
107
|
+
{Object.keys(groupedEntities).map((controllerName) => (
|
|
108
|
+
<InlineRelationEntityDialog
|
|
109
|
+
key={`dialog-${controllerName}`}
|
|
110
|
+
visible={visibleDialogs[controllerName] || false}
|
|
111
|
+
setVisible={(visible: any) =>
|
|
112
|
+
setVisibleDialogs((prev) => ({
|
|
113
|
+
...prev,
|
|
114
|
+
[controllerName]: visible,
|
|
115
|
+
}))
|
|
116
|
+
}
|
|
117
|
+
fieldContext={fieldContext}
|
|
118
|
+
onCreate={addNewRelation}
|
|
119
|
+
/>
|
|
120
|
+
))}
|
|
121
|
+
</div>
|
|
122
|
+
)
|
|
123
|
+
};
|
|
@@ -37,7 +37,7 @@ import { OverlayPanel } from "primereact/overlaypanel";
|
|
|
37
37
|
import { SolidBreadcrumb } from "@/components/common/SolidBreadcrumb";
|
|
38
38
|
import { SolidUiEvent } from "@/types";
|
|
39
39
|
import { getExtensionComponent, getExtensionFunction } from "@/helpers/registry";
|
|
40
|
-
import { SolidFormWidgetProps } from "@/types/solid-core";
|
|
40
|
+
import { SolidFormWidgetProps, SolidLoadForm } from "@/types/solid-core";
|
|
41
41
|
import { SolidPasswordField } from "./fields/SolidPasswordField";
|
|
42
42
|
import { SolidEmailField } from "./fields/SolidEmailField";
|
|
43
43
|
import { Panel } from "primereact/panel";
|
|
@@ -417,17 +417,6 @@ const SolidFormView = (params: SolidFormViewProps) => {
|
|
|
417
417
|
isLoading: solidFormViewMetaDataIsLoading
|
|
418
418
|
} = useGetSolidViewLayoutQuery(formViewMetaDataQs);
|
|
419
419
|
|
|
420
|
-
useEffect(() => {
|
|
421
|
-
if (solidFormViewMetaData) {
|
|
422
|
-
setFormViewMetaData(solidFormViewMetaData);
|
|
423
|
-
if (params.customLayout) {
|
|
424
|
-
setFormViewLayout(params.customLayout);
|
|
425
|
-
} else {
|
|
426
|
-
setFormViewLayout(solidFormViewMetaData.data.solidView.layout);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}, [solidFormViewMetaData]);
|
|
430
|
-
|
|
431
420
|
useEffect(() => {
|
|
432
421
|
if (
|
|
433
422
|
isEntityCreateSuccess == true ||
|
|
@@ -579,11 +568,11 @@ const SolidFormView = (params: SolidFormViewProps) => {
|
|
|
579
568
|
|
|
580
569
|
// errorFields.length = 0;
|
|
581
570
|
};
|
|
582
|
-
useEffect(() => {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
}, [errorFields])
|
|
571
|
+
// useEffect(() => {
|
|
572
|
+
// if (errorFields?.length > 0) {
|
|
573
|
+
// showFieldError();
|
|
574
|
+
// }
|
|
575
|
+
// }, [errorFields])
|
|
587
576
|
|
|
588
577
|
// - - - - - - - - - - - -- - - - - - - - - - - - DATA here
|
|
589
578
|
// Fetch the actual data here.
|
|
@@ -625,10 +614,65 @@ const SolidFormView = (params: SolidFormViewProps) => {
|
|
|
625
614
|
}
|
|
626
615
|
}, [formViewDataQs])
|
|
627
616
|
|
|
617
|
+
useEffect(() => {
|
|
618
|
+
if (solidFormViewMetaData) {
|
|
619
|
+
let formLayout = solidFormViewMetaData;
|
|
620
|
+
const dynamicHeader = solidFormViewMetaData?.data?.solidView?.layout?.onFormLayoutLoad;
|
|
621
|
+
let DynamicFunctionComponent = null;
|
|
622
|
+
const event: SolidLoadForm = {
|
|
623
|
+
fieldsMetadata: solidFormViewMetaData,
|
|
624
|
+
formData: solidFormViewData?.data,
|
|
625
|
+
type: dynamicHeader,
|
|
626
|
+
viewMetadata: solidFormViewMetaData?.data?.solidView
|
|
627
|
+
}
|
|
628
|
+
if (dynamicHeader) {
|
|
629
|
+
DynamicFunctionComponent = getExtensionFunction(dynamicHeader);
|
|
630
|
+
if (DynamicFunctionComponent) {
|
|
631
|
+
const updatedFormLayout = DynamicFunctionComponent(event);
|
|
632
|
+
if (updatedFormLayout && updatedFormLayout?.layoutChanged && updatedFormLayout?.newLayout) {
|
|
633
|
+
const newFormLayout = {
|
|
634
|
+
...formLayout,
|
|
635
|
+
data : {
|
|
636
|
+
...formLayout.data,
|
|
637
|
+
solidView: {
|
|
638
|
+
...formLayout.data.solidView,
|
|
639
|
+
layout: updatedFormLayout.newLayout
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
formLayout = newFormLayout;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
setFormViewMetaData(formLayout);
|
|
648
|
+
if (params.customLayout) {
|
|
649
|
+
setFormViewLayout(params.customLayout);
|
|
650
|
+
} else {
|
|
651
|
+
setFormViewLayout(formLayout.data.solidView.layout);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}, [solidFormViewMetaData, solidFormViewData]);
|
|
628
655
|
|
|
629
656
|
useEffect(() => {
|
|
630
657
|
if (solidFormViewData) {
|
|
631
|
-
|
|
658
|
+
const dynamicHeader = solidFormViewMetaData?.data?.solidView?.layout?.onFormDataLoad;
|
|
659
|
+
let DynamicFunctionComponent = null;
|
|
660
|
+
let formViewData = solidFormViewData?.data;
|
|
661
|
+
const event: SolidLoadForm = {
|
|
662
|
+
fieldsMetadata: solidFormViewMetaData,
|
|
663
|
+
formData: solidFormViewData?.data,
|
|
664
|
+
type: dynamicHeader,
|
|
665
|
+
viewMetadata: solidFormViewMetaData?.data?.solidView
|
|
666
|
+
}
|
|
667
|
+
if (dynamicHeader) {
|
|
668
|
+
DynamicFunctionComponent = getExtensionFunction(dynamicHeader);
|
|
669
|
+
if (DynamicFunctionComponent) {
|
|
670
|
+
const updatedFormData = DynamicFunctionComponent(event);
|
|
671
|
+
if (updatedFormData && updatedFormData?.dataChanged && updatedFormData.newFormData)
|
|
672
|
+
formViewData = updatedFormData.newFormData;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
setInitialEntityData(formViewData);
|
|
632
676
|
}
|
|
633
677
|
}, [solidFormViewData]);
|
|
634
678
|
|
|
@@ -4,6 +4,8 @@ import { Message } from "primereact/message";
|
|
|
4
4
|
import * as Yup from 'yup';
|
|
5
5
|
import { Schema } from "yup";
|
|
6
6
|
import { FormikObject, ISolidField, SolidFieldProps } from "./ISolidField";
|
|
7
|
+
import { Editor } from "primereact/editor";
|
|
8
|
+
import { useState } from "react";
|
|
7
9
|
|
|
8
10
|
export class SolidLongTextField implements ISolidField {
|
|
9
11
|
|
|
@@ -59,6 +61,64 @@ export class SolidLongTextField implements ISolidField {
|
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
render(formik: FormikObject) {
|
|
64
|
+
const fieldLayoutInfo = this.fieldContext.field;
|
|
65
|
+
const className = fieldLayoutInfo.attrs?.className || 'field col-12';
|
|
66
|
+
return (
|
|
67
|
+
<>
|
|
68
|
+
{(!fieldLayoutInfo.attrs.renderMode ||fieldLayoutInfo.attrs.renderMode === 'longText') &&
|
|
69
|
+
<div className={className}>
|
|
70
|
+
{this.renderLongText(formik)}
|
|
71
|
+
</div>
|
|
72
|
+
}
|
|
73
|
+
{fieldLayoutInfo.attrs.renderMode === 'richText' &&
|
|
74
|
+
<div className={className}>
|
|
75
|
+
{this.renderRichText(formik)}
|
|
76
|
+
</div>
|
|
77
|
+
}
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
renderLongText(formik: FormikObject) {
|
|
83
|
+
const fieldMetadata = this.fieldContext.fieldMetadata;
|
|
84
|
+
const fieldLayoutInfo = this.fieldContext.field;
|
|
85
|
+
const className = fieldLayoutInfo.attrs?.className || 'field col-12';
|
|
86
|
+
const fieldLabel = fieldLayoutInfo.attrs.label ?? fieldMetadata.displayName;
|
|
87
|
+
const fieldDescription = fieldLayoutInfo.attrs.description ?? fieldMetadata.description;
|
|
88
|
+
const solidFormViewMetaData = this.fieldContext.solidFormViewMetaData;
|
|
89
|
+
const showFieldLabel = fieldLayoutInfo?.attrs?.showLabel;
|
|
90
|
+
const readOnlyPermission = this.fieldContext.readOnly;
|
|
91
|
+
|
|
92
|
+
const isFormFieldValid = (formik: any, fieldName: string) => formik.touched[fieldName] && formik.errors[fieldName];
|
|
93
|
+
|
|
94
|
+
const fieldDisabled = fieldLayoutInfo.attrs?.disabled;
|
|
95
|
+
const fieldReadonly = fieldLayoutInfo.attrs?.readonly;
|
|
96
|
+
|
|
97
|
+
const formDisabled = solidFormViewMetaData.data.solidView?.layout?.attrs?.disabled;
|
|
98
|
+
const formReadonly = solidFormViewMetaData.data.solidView?.layout?.attrs?.readonly;
|
|
99
|
+
return (
|
|
100
|
+
<div className="flex flex-column gap-2 mt-4">
|
|
101
|
+
{showFieldLabel != false &&
|
|
102
|
+
<label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
|
|
103
|
+
{fieldMetadata.required && <span className="text-red-500"> *</span>}
|
|
104
|
+
{/* {fieldDescription && <span>({fieldDescription}) </span>} */}
|
|
105
|
+
</label>
|
|
106
|
+
}
|
|
107
|
+
<InputTextarea
|
|
108
|
+
readOnly={formReadonly || fieldReadonly || readOnlyPermission}
|
|
109
|
+
disabled={formDisabled || fieldDisabled}
|
|
110
|
+
id={fieldLayoutInfo.attrs.name}
|
|
111
|
+
aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
|
|
112
|
+
onChange={formik.handleChange}
|
|
113
|
+
value={formik.values[fieldLayoutInfo.attrs.name] || ''}
|
|
114
|
+
rows={5}
|
|
115
|
+
cols={30}
|
|
116
|
+
/>
|
|
117
|
+
</div>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
renderRichText(formik: FormikObject) {
|
|
62
122
|
const fieldMetadata = this.fieldContext.fieldMetadata;
|
|
63
123
|
const fieldLayoutInfo = this.fieldContext.field;
|
|
64
124
|
const className = fieldLayoutInfo.attrs?.className || 'field col-12';
|
|
@@ -68,6 +128,8 @@ export class SolidLongTextField implements ISolidField {
|
|
|
68
128
|
const showFieldLabel = fieldLayoutInfo?.attrs?.showLabel;
|
|
69
129
|
const readOnlyPermission = this.fieldContext.readOnly;
|
|
70
130
|
|
|
131
|
+
const [text, setText] = useState();
|
|
132
|
+
|
|
71
133
|
const isFormFieldValid = (formik: any, fieldName: string) => formik.touched[fieldName] && formik.errors[fieldName];
|
|
72
134
|
|
|
73
135
|
const fieldDisabled = fieldLayoutInfo.attrs?.disabled;
|
|
@@ -78,31 +140,28 @@ export class SolidLongTextField implements ISolidField {
|
|
|
78
140
|
|
|
79
141
|
return (
|
|
80
142
|
<div className={className}>
|
|
81
|
-
<div className="
|
|
82
|
-
|
|
83
|
-
{
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
/>
|
|
99
|
-
</div>
|
|
143
|
+
<div className="flex flex-column gap-2 mt-4">
|
|
144
|
+
{showFieldLabel != false &&
|
|
145
|
+
<label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
|
|
146
|
+
{fieldMetadata.required && <span className="text-red-500"> *</span>}
|
|
147
|
+
{/* {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
|
|
148
|
+
</label>
|
|
149
|
+
}
|
|
150
|
+
<Editor
|
|
151
|
+
readOnly={formReadonly || fieldReadonly || readOnlyPermission}
|
|
152
|
+
disabled={formDisabled || fieldDisabled}
|
|
153
|
+
key={fieldLayoutInfo.attrs.name} // React will re-render the component whenever this value changes
|
|
154
|
+
id={fieldLayoutInfo.attrs.name}
|
|
155
|
+
value={formik.values[fieldLayoutInfo.attrs.name]}
|
|
156
|
+
onTextChange={e => formik.setFieldValue(fieldLayoutInfo.attrs.name, e.htmlValue)}
|
|
157
|
+
style={{ height: "320px" }}
|
|
158
|
+
/>
|
|
159
|
+
</div>
|
|
100
160
|
{isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
|
|
101
161
|
<div className="absolute mt-1">
|
|
102
162
|
<Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
|
|
103
163
|
</div>
|
|
104
164
|
)}
|
|
105
|
-
</div>
|
|
106
165
|
</div>
|
|
107
166
|
);
|
|
108
167
|
}
|