impaktapps-ui-builder 0.0.393-alpha.2 → 0.0.393-alpha.20
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/impaktapps-ui-builder.es.js +9 -5
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +4 -4
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +37 -5
- package/src/impaktapps-ui-builder/runtime/services/service.ts +32 -7
package/package.json
CHANGED
|
@@ -66,14 +66,24 @@ function buildRule(configObj: any, tableName?: string, arrayHolderName?: boolean
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
}
|
|
69
|
+
}
|
|
70
|
+
else if ((configObj.type === "Select" || configObj.type === "MultipleSelect") && configObj.value?.length >= 0) {
|
|
70
71
|
if (configObj.type === "Select") {
|
|
72
|
+
let oneOfOptions = configObj.value && configObj.value.length > 0
|
|
73
|
+
? configObj.value.map((e) => ({ const: e.value, title: e.label }))
|
|
74
|
+
: [{ const: "", title: "No options available" }];
|
|
75
|
+
|
|
71
76
|
schema.properties[configObj.name] = {
|
|
72
|
-
oneOf:
|
|
73
|
-
|
|
74
|
-
})
|
|
75
|
-
}
|
|
77
|
+
oneOf: oneOfOptions
|
|
78
|
+
};
|
|
76
79
|
}
|
|
80
|
+
// if (configObj.type === "Select") {
|
|
81
|
+
// schema.properties[configObj.name] = {
|
|
82
|
+
// oneOf: configObj.value.map((e) => {
|
|
83
|
+
// return { const: e.value, title: e.label }
|
|
84
|
+
// })
|
|
85
|
+
// }
|
|
86
|
+
// }
|
|
77
87
|
else if (configObj.type === "MultipleSelect") {
|
|
78
88
|
schema.properties[configObj.name] = {
|
|
79
89
|
items: {
|
|
@@ -84,6 +94,28 @@ function buildRule(configObj: any, tableName?: string, arrayHolderName?: boolean
|
|
|
84
94
|
}
|
|
85
95
|
}
|
|
86
96
|
}
|
|
97
|
+
// else if ((configObj.type === "Select" || configObj.type === "MultipleSelect") && configObj.value?.length >= 0) {
|
|
98
|
+
|
|
99
|
+
// if (configObj.type === "Select") {
|
|
100
|
+
// schema.properties[configObj.name] = {
|
|
101
|
+
// oneOf: configObj.value.length > 0
|
|
102
|
+
// ? configObj.value.map((e) => {
|
|
103
|
+
// return { const: e.value, title: e.label };
|
|
104
|
+
// })
|
|
105
|
+
// : [{ const: "", title: "" }]
|
|
106
|
+
// };
|
|
107
|
+
// } else if (configObj.type === "MultipleSelect") {
|
|
108
|
+
// schema.properties[configObj.name] = {
|
|
109
|
+
// items: {
|
|
110
|
+
// oneOf: configObj.value.length > 0
|
|
111
|
+
// ? configObj.value.map((e) => {
|
|
112
|
+
// return { const: e.value, title: e.label };
|
|
113
|
+
// })
|
|
114
|
+
// : [{ const: "", title: "" }]
|
|
115
|
+
// }
|
|
116
|
+
// };
|
|
117
|
+
// }
|
|
118
|
+
// }
|
|
87
119
|
if (configObj.validation) {
|
|
88
120
|
configObj.validation.forEach((rule: any) => {
|
|
89
121
|
if (tableName) {
|
|
@@ -73,14 +73,39 @@ export default (funcParams: funcParamsProps) => {
|
|
|
73
73
|
serviceHolder: this, eventGroups
|
|
74
74
|
}
|
|
75
75
|
funcParams.store.setSchema(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
funcParams.schema
|
|
76
|
+
(pre: any) => {
|
|
77
|
+
return {
|
|
78
|
+
...funcParams.schema, properties:
|
|
79
|
+
{ ...pre.properties,...funcParams.schema.properties,}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
83
82
|
)
|
|
83
|
+
// funcParams.store.setSchema(
|
|
84
|
+
// (pre: any) => {
|
|
85
|
+
// const updatedProperties: any = {};
|
|
86
|
+
|
|
87
|
+
// const mergedProperties = {
|
|
88
|
+
// ...pre.properties,
|
|
89
|
+
// ...funcParams.schema.properties,
|
|
90
|
+
// };
|
|
91
|
+
|
|
92
|
+
// Object.keys(mergedProperties).forEach(propertyName => {
|
|
93
|
+
// const schemaProperty = funcParams.schema.properties[propertyName];
|
|
94
|
+
|
|
95
|
+
// if (schemaProperty && (schemaProperty.type === "Select" || schemaProperty.type === "MultipleSelect")) {
|
|
96
|
+
// if (schemaProperty.oneOf && schemaProperty.oneOf.length === 1 && schemaProperty.oneOf[0].const === "") {
|
|
97
|
+
// return;
|
|
98
|
+
// }
|
|
99
|
+
// }
|
|
100
|
+
// updatedProperties[propertyName] = schemaProperty;
|
|
101
|
+
// });
|
|
102
|
+
|
|
103
|
+
// return {
|
|
104
|
+
// ...funcParams.schema,
|
|
105
|
+
// properties: updatedProperties,
|
|
106
|
+
// };
|
|
107
|
+
// }
|
|
108
|
+
// );
|
|
84
109
|
funcParams.uiSchema.elements.push(notifyUiSchema);
|
|
85
110
|
funcParams.store.setUiSchema(funcParams.uiSchema);
|
|
86
111
|
await executeRefreshHandler({
|