impaktapps-ui-builder 0.0.291 → 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.
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "0.0.291",
3
+ "version": "0.0.293",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -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
- case "LazyLoadingTable" :
149
- elements = buildLazyLoadingTable(config, componentScope)
150
- break;
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
- return elements;
287
+ }
288
+ return elements;
249
289
  }
250
290
 
251
291
 
@@ -103,7 +103,7 @@ export default (funcParams: funcParamsProps) => {
103
103
  getSelectOptions: async function (param) {
104
104
  if (param.serachValue !== "" && param.serachValue !== undefined) {
105
105
  const apiBody = [
106
- { key: "serachValue", value: param.serachValue },
106
+ { key: "searchValue", value: param.serachValue },
107
107
  { key: "currentValue", value: param.currentValue }
108
108
  ]
109
109
  return await this.updateConfigApiBody(param, apiBody)
@@ -1,7 +0,0 @@
1
- export declare const buildArraySchema: (config: any) => {
2
- type: string;
3
- items: {
4
- type: string;
5
- properties: {};
6
- };
7
- };