impaktapps-ui-builder 0.0.292 → 0.0.294

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.292",
3
+ "version": "0.0.294",
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
 
@@ -234,7 +234,7 @@ export const buildPropertiesSection = function (type: String) {
234
234
  getArrayControl("pieArcColors", "color"),
235
235
  ];
236
236
  } else if (type === "WrapperSection") {
237
- uiSchema.elements = [getRadioInputField("divider", "Divider", ["YES", "No"]), getRadioInputField("heading", "Page Heading", ["YES", "No"])]
237
+ uiSchema.elements = [getRadioInputField("divider", "Divider", ["YES", "No"]), EmptyBox]
238
238
  }
239
239
  else if (type === "TabSection") {
240
240
  uiSchema.elements = [
@@ -98,7 +98,7 @@ export const CoreSection = {
98
98
  scope: "#/properties/value",
99
99
 
100
100
  options: {
101
- widget: "MultipleSelect",
101
+ widget: "InputField",
102
102
  },
103
103
  config: {
104
104
  layout: {
@@ -132,7 +132,7 @@ export const OptionArray: any = {
132
132
  type: "Control",
133
133
  scope: "#/properties/label",
134
134
  options: {
135
- widget: "InputField",
135
+ widget: "SelectInputField",
136
136
  },
137
137
  config: {
138
138
  layout: {
@@ -58,12 +58,6 @@ export const ComponentSchema:any = {
58
58
  },
59
59
  value: {
60
60
  type: "string",
61
- oneOf: [
62
- { title: "3", const: "3" },
63
- { title: "5.5", const: "5.5" },
64
- { title: "8", const: "8" },
65
- { title: "12", const: "12" },
66
- ],
67
61
  },
68
62
  },
69
63
  },
@@ -212,12 +212,7 @@ export const componentBasicUiSchema: any = {
212
212
  },
213
213
  main: {
214
214
  label: "Screen Size",
215
- options: [
216
- { label: "Extra Small", value: "xs" },
217
- { label: "Small", value: "sm" },
218
- { label: "Medium", value: "md" },
219
- { label: "Large", value: "lg" },
220
- ],
215
+
221
216
  },
222
217
  },
223
218
  },
@@ -226,7 +221,7 @@ export const componentBasicUiSchema: any = {
226
221
  scope: "#/properties/value",
227
222
 
228
223
  options: {
229
- widget: "MultipleSelect",
224
+ widget: "InputField",
230
225
  },
231
226
  config: {
232
227
  layout: {
@@ -93,7 +93,7 @@ export default (funcParams: funcParamsProps) => {
93
93
  onPaginationChange: async function (paginationValues) {
94
94
  const apiBody = [
95
95
  { key: "size", value: paginationValues.pagination.pageSize },
96
- { key: "start", value: paginationValues.pagination.pageIndex * paginationValues.pagination.pageSize },
96
+ { key: "pageIndex", value: paginationValues.pagination.pageIndex },
97
97
  { key: "sorting", value: paginationValues.sorting || [] },
98
98
  { key: "filters", value: paginationValues.columnFilters || [] },
99
99
  { key: "globalFilter", value: paginationValues.globalFilter ?? '' }
@@ -1,7 +0,0 @@
1
- export declare const buildArraySchema: (config: any) => {
2
- type: string;
3
- items: {
4
- type: string;
5
- properties: {};
6
- };
7
- };