swoop-common 2.2.204 → 2.2.205
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/rendering/schema/formSchemaTypes.d.ts +1 -0
- package/dist/rendering/schema/generate/jsonSchemaGenerate.js +3 -3
- package/dist/rendering/schema/generate/uiSchemaGenerate.js +2 -2
- package/dist/rendering/schema/util.d.ts +1 -1
- package/dist/rendering/schema/util.js +3 -1
- package/package.json +1 -1
|
@@ -17,9 +17,9 @@ export const generateJsonSchema = (formSchema, stage, onlyEditableFields) => {
|
|
|
17
17
|
.includes(stage))
|
|
18
18
|
return;
|
|
19
19
|
const fieldSchema = defaultConverter(s, stage);
|
|
20
|
-
built.properties[generateFieldId(s.name)] = fieldSchema;
|
|
20
|
+
built.properties[generateFieldId(s.name, s.fieldId)] = fieldSchema;
|
|
21
21
|
if (s.required && s.fieldType !== "boolean")
|
|
22
|
-
built.required.push(generateFieldId(s.name));
|
|
22
|
+
built.required.push(generateFieldId(s.name, s.fieldId));
|
|
23
23
|
});
|
|
24
24
|
return built;
|
|
25
25
|
}
|
|
@@ -43,7 +43,7 @@ const defaultConverter = (field, stage, omitTitle, isChild) => {
|
|
|
43
43
|
: undefined;
|
|
44
44
|
const properties = {};
|
|
45
45
|
for (const child of (_d = (_c = field.objectOptions) === null || _c === void 0 ? void 0 : _c.properties) !== null && _d !== void 0 ? _d : []) {
|
|
46
|
-
const fieldId = generateFieldId(child.name);
|
|
46
|
+
const fieldId = generateFieldId(child.name, child.fieldId);
|
|
47
47
|
properties[fieldId] = defaultConverter(child, stage, false, true);
|
|
48
48
|
if (child.required && child.fieldType != "boolean")
|
|
49
49
|
requiredFields.push(fieldId);
|
|
@@ -13,7 +13,7 @@ export const generateUiSchema = (formSchema, stage, onlyEditableFields) => {
|
|
|
13
13
|
};
|
|
14
14
|
const uiFieldSchemaFromFieldDefinition = (field, path = []) => {
|
|
15
15
|
var _a;
|
|
16
|
-
const scope = ["#", ...path, "properties", generateFieldId(field.name)].join("/");
|
|
16
|
+
const scope = ["#", ...path, "properties", generateFieldId(field.name, field.fieldId)].join("/");
|
|
17
17
|
if (field.fieldType !== "object" || getAllTypes().find((t => t.name === field.fieldType))) {
|
|
18
18
|
const uiElem = Object.assign({ type: "Control", scope }, (field.fieldType === "radio" && { options: { format: "radio" } }));
|
|
19
19
|
return uiElem;
|
|
@@ -25,7 +25,7 @@ const uiFieldSchemaFromFieldDefinition = (field, path = []) => {
|
|
|
25
25
|
elements: children.map((child) => uiFieldSchemaFromFieldDefinition(child, [
|
|
26
26
|
...path,
|
|
27
27
|
"properties",
|
|
28
|
-
generateFieldId(field.name),
|
|
28
|
+
generateFieldId(field.name, field.fieldId),
|
|
29
29
|
])),
|
|
30
30
|
};
|
|
31
31
|
return group;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function generateFieldId(name: string): string;
|
|
1
|
+
export declare function generateFieldId(name: string, fieldId?: string): string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// Helper function to generate field ID from name
|
|
2
|
-
export function generateFieldId(name) {
|
|
2
|
+
export function generateFieldId(name, fieldId) {
|
|
3
|
+
if (fieldId)
|
|
4
|
+
return fieldId;
|
|
3
5
|
if (!name)
|
|
4
6
|
return `field_${Date.now()}_${Math.floor(Math.random() * 1000)}`;
|
|
5
7
|
return toCamelCase(name);
|