impaktapps-ui-builder 0.0.292 → 0.0.293
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 +70 -9
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +13 -13
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/dist/src/impaktapps-ui-builder/builder/build/buildUiSchema.d.ts +1 -1
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +61 -21
- package/dist/src/impaktapps-ui-builder/builder/build/schema/arraySchemaBuilder.d.ts +0 -7
|
@@ -3,7 +3,7 @@ export declare let schema: {
|
|
|
3
3
|
properties: {};
|
|
4
4
|
required: any[];
|
|
5
5
|
};
|
|
6
|
-
export declare const buildSchema: (config: any, tableName?: string) => {
|
|
6
|
+
export declare const buildSchema: (config: any, tableName?: string, isArrayType?: boolean) => {
|
|
7
7
|
type: string;
|
|
8
8
|
properties: {};
|
|
9
9
|
required: any[];
|
package/package.json
CHANGED
|
@@ -25,28 +25,65 @@ import { buildRollAndDice } from "./buildRollAndDice";
|
|
|
25
25
|
import { buildTimer } from "./buildTimer";
|
|
26
26
|
import { buildMultiSelect } from "./buildMultiSelect";
|
|
27
27
|
import { buildBasicUiSchema } from "./buildBasicUiSchema";
|
|
28
|
-
import { buildArraySchema } from "./schema/arraySchemaBuilder";
|
|
29
|
-
import { buildArray } from "./buildArray";
|
|
30
|
-
import { getTextArea } from "./uischema/buildPropertiesSection";
|
|
31
28
|
import { buildTextArea } from "./buildTextArea";
|
|
32
29
|
import { buildSlider } from "./buildSlider";
|
|
33
30
|
import { buildCheckbox } from "./buildCheckbox";
|
|
34
31
|
import { buildLineGraph } from "./buildLineGraph";
|
|
35
32
|
import { buildRadio } from "./buildRadio";
|
|
36
33
|
import { buildEmptyBox } from "./buildEmptyBox";
|
|
34
|
+
import { buildArray } from "./buildArray";
|
|
37
35
|
export let schema = {
|
|
38
36
|
type: "object",
|
|
39
37
|
properties: {},
|
|
40
38
|
required: []
|
|
41
39
|
};
|
|
42
|
-
|
|
43
|
-
function buildRule(configObj: any, tableName?: string) {
|
|
40
|
+
//MultipleSelect
|
|
41
|
+
function buildRule(configObj: any, tableName?: string, arrayHolderName?: boolean) {
|
|
42
|
+
if (arrayHolderName) {
|
|
43
|
+
if (schema.properties?.[tableName]?.items?.properties) {
|
|
44
|
+
if (!schema.properties?.[tableName]?.items?.properties?.[configObj.name]) {
|
|
45
|
+
schema.properties[tableName].items.properties[configObj.name] = {};
|
|
46
|
+
if (configObj.type === "Select" || configObj.value?.length > 0) {
|
|
47
|
+
schema.properties[tableName].items.properties[configObj.name] = {
|
|
48
|
+
oneOf: configObj.value.map((e) => {
|
|
49
|
+
return { const: e.value, title: e.label }
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else if (configObj.type === "MultipleSelect" || configObj.value?.length > 0) {
|
|
54
|
+
schema.properties[tableName].items.properties[configObj.name] = {
|
|
55
|
+
items: {
|
|
56
|
+
oneOf: configObj.value.map((e) => {
|
|
57
|
+
return { const: e.value, title: e.label }
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
44
65
|
if (configObj.validation) {
|
|
45
66
|
configObj.validation.forEach((rule: any) => {
|
|
46
67
|
if (tableName) {
|
|
47
68
|
if (schema.properties?.[tableName]?.items?.properties) {
|
|
48
69
|
if (!schema.properties?.[tableName]?.items?.properties?.[configObj.name]) {
|
|
49
70
|
schema.properties[tableName].items.properties[configObj.name] = {};
|
|
71
|
+
if (configObj.type === "Select" || configObj.value?.length > 0) {
|
|
72
|
+
schema.properties[tableName].items.properties[configObj.name] = {
|
|
73
|
+
oneOf: configObj.value.map((e) => {
|
|
74
|
+
return { const: e.value, title: e.label }
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else if (configObj.type === "MultipleSelect" || configObj.value?.length > 0) {
|
|
79
|
+
schema.properties[tableName].items.properties[configObj.name] = {
|
|
80
|
+
items: {
|
|
81
|
+
oneOf: configObj.value.map((e) => {
|
|
82
|
+
return { const: e.value, title: e.label }
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
50
87
|
}
|
|
51
88
|
if (rule.validationType === "required") {
|
|
52
89
|
schema.properties?.[tableName]?.items?.required.push(configObj.name)
|
|
@@ -59,7 +96,6 @@ function buildRule(configObj: any, tableName?: string) {
|
|
|
59
96
|
|
|
60
97
|
}
|
|
61
98
|
} else {
|
|
62
|
-
|
|
63
99
|
if (!schema.properties[configObj.name]) {
|
|
64
100
|
schema.properties[configObj.name] = {};
|
|
65
101
|
}
|
|
@@ -71,19 +107,16 @@ function buildRule(configObj: any, tableName?: string) {
|
|
|
71
107
|
isNaN(rule.validationValue) ?
|
|
72
108
|
rule.validationValue : Number(rule.validationValue)
|
|
73
109
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
110
|
}
|
|
78
111
|
});
|
|
79
112
|
}
|
|
80
113
|
|
|
114
|
+
|
|
81
115
|
}
|
|
82
|
-
export const buildSchema = (config: any, tableName?: string) => {
|
|
83
|
-
buildRule(config, tableName);
|
|
116
|
+
export const buildSchema = (config: any, tableName?: string, isArrayType?: boolean) => {
|
|
117
|
+
buildRule(config, tableName, isArrayType);
|
|
84
118
|
if (config?.elements) {
|
|
85
|
-
|
|
86
|
-
if (config.type == "Table") {
|
|
119
|
+
if (config.type == "Table" || config.type == "Array") {
|
|
87
120
|
if (!schema.properties[config.name]) {
|
|
88
121
|
schema.properties[config.name] = {
|
|
89
122
|
type: "array",
|
|
@@ -95,7 +128,7 @@ export const buildSchema = (config: any, tableName?: string) => {
|
|
|
95
128
|
}
|
|
96
129
|
}
|
|
97
130
|
config.elements.map((e, elemInd) => {
|
|
98
|
-
buildSchema(e, config.name)
|
|
131
|
+
buildSchema(e, config.name, config.type === "Array" ? true : false)
|
|
99
132
|
})
|
|
100
133
|
}
|
|
101
134
|
else {
|
|
@@ -144,10 +177,12 @@ const buildUiSchema = (config: any) => {
|
|
|
144
177
|
case "Table":
|
|
145
178
|
elements = buildTable(config, componentScope);
|
|
146
179
|
break;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
180
|
+
case "Array":
|
|
181
|
+
elements = buildArray(config, componentScope);
|
|
182
|
+
break;
|
|
183
|
+
case "LazyLoadingTable":
|
|
184
|
+
elements = buildLazyLoadingTable(config, componentScope)
|
|
185
|
+
break;
|
|
151
186
|
case "Box":
|
|
152
187
|
elements = buildLabel(config, componentScope);
|
|
153
188
|
break;
|
|
@@ -239,13 +274,18 @@ const buildUiSchema = (config: any) => {
|
|
|
239
274
|
}
|
|
240
275
|
})
|
|
241
276
|
}
|
|
242
|
-
else {
|
|
243
|
-
elements.elements = config.elements.map((e: any, elemInd: number) => {
|
|
277
|
+
else if (config.type == "Array") {
|
|
278
|
+
elements.options.detail.elements = config.elements.map((e: any, elemInd: number) => {
|
|
244
279
|
return buildUiSchema(e)
|
|
245
280
|
});
|
|
246
281
|
}
|
|
282
|
+
else {
|
|
283
|
+
elements.elements = config.elements.map((e: any, elemInd: number) => {
|
|
284
|
+
return buildUiSchema(e)
|
|
285
|
+
});
|
|
247
286
|
}
|
|
248
|
-
|
|
287
|
+
}
|
|
288
|
+
return elements;
|
|
249
289
|
}
|
|
250
290
|
|
|
251
291
|
|