impaktapps-ui-builder 0.0.409-j → 0.0.409-l

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "0.0.409j",
3
+ "version": "0.0.409l",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -3,13 +3,6 @@ import _ from "lodash";
3
3
  export default (FormData: any) => {
4
4
  const formData = _.cloneDeep(FormData)
5
5
  let component: any = {};
6
- // if (formData?.layout) {
7
- // component.layout = createData(FormData?.layout, "layout");
8
- // delete formData.layout
9
- // }
10
- // if(!formData.type ){
11
- // component.type = "page";
12
- // }
13
6
  if (formData.pageName) {
14
7
  delete formData.pageName
15
8
  }
@@ -316,7 +316,53 @@ const buildUiSchema = (config: any) => {
316
316
  sizeMap[e.keyName] = e.value
317
317
  });
318
318
  }
319
- elements.elements = transformConfigToOutput(config, sizeMap)
319
+ function nodeProvider(element) {
320
+ if (element.type) {
321
+ return {
322
+ accessorKey: element.name,
323
+ type: element.columnFormat,
324
+ header: element.label || element.name,
325
+ size: sizeMap[element.name] || 180,
326
+ widget: buildUiSchema(element)
327
+
328
+ };
329
+ }
330
+ return {
331
+ accessorKey: element.name,
332
+ type: element.columnFormat,
333
+ header: element.label || element.name,
334
+ size: sizeMap[element.name] || 180,
335
+ }
336
+ }
337
+
338
+ function buildHierarchy(elements, parentName = null) {
339
+ const result = [];
340
+ for (const element of elements) {
341
+ if (element?.parent === parentName) {
342
+ const children = buildHierarchy(elements, element.name);
343
+ const node: any = nodeProvider(element)
344
+ if (children.length > 0) {
345
+ node.columns = children;
346
+ node.type = "group";
347
+ }
348
+ result.push(node);
349
+ }
350
+ }
351
+ return result;
352
+ }
353
+
354
+ function transformConfigToOutput(config) {
355
+ const output = [];
356
+ const hierarchy = buildHierarchy(config.elements, config.name);
357
+ for (const element of config.elements) {
358
+ const parentExists = config.elements.some(e => e.name === element.parent);
359
+ if (!parentExists && element.parent !== config.name) {
360
+ output.push(nodeProvider(element))
361
+ }
362
+ }
363
+ return [ ...hierarchy,...output,];
364
+ }
365
+ elements.elements = transformConfigToOutput(config)
320
366
  }
321
367
  else if (config.type == "Array") {
322
368
  elements.options.detail.elements = config.elements.map((e: any, elemInd: number) => {
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash";
2
- import { ComponentSchema } from "../elements/UiSchema/Component/schema";
2
+ import { ComponentSchema } from "../elements/UiSchema/Component/schema";
3
3
  import { componentBasicUiSchema } from "../elements/UiSchema/Component/uiSchema";
4
4
  import { CoreSection } from "../build/uischema/coreSection";
5
5
  import { EventSection } from "../build/uischema/eventSection";
@@ -10,57 +10,57 @@ import { ValueTab } from "../build/uischema/valueTab";
10
10
  import { ValidationSection } from "../build/uischema/validationSections";
11
11
  import { getFormdataFromLocalStorage, okHandler, saveFormdataInLocalStorage, saveHandler } from "./utils";
12
12
  const sectionLabels = {
13
- Select: ["Core", "Properties","Value", "style", "Event","Validation"],
14
- MultipleSelect: ["Core", "Properties","Value", "style", "Event","Validation"],
15
- Table: ["Core", "Components", "Properties","style", "Event","Validation"],
16
- LeaderBoard: ["Core", "Components", "Properties", "style", "Event","Validation"],
17
- WrapperSection: ["Core", "Components","Properties", "style","Validation"],
18
- TabSection: ["Core", "Components", "Properties", "style","Validation"],
19
- SpeedoMeter:["Core", "Properties", "style", "Event","Validation"],
20
- card:["Core", "Properties", "style", "Event","Validation"],
21
- UploadFile:["Core", "style", "Event","Validation"],
22
- Graph:["Core", "Properties", "style", "Event","Validation"],
23
- DownloadFile:["Core", "style", "Event","Validation"],
24
- Box: ["Core", "style", "Event","Validation"],
25
- Properties: ["Core", "Properties", "style", "Event","Validation"],
26
- ProgressBarCard: ["Core", "Properties", "style", "Event","Validation"],
27
- RankCard: ["Core", "Properties", "style", "Event","Validation"],
28
- Slider: ["Core", "Components", "style", "Event","Validation"],
29
- Timer: ["Core", "style", "Event","Validation"],
30
- Rank: ["Core","style", "Event","Validation"],
31
- Button: ["Core", "Properties", "style", "Event","Validation"],
32
- Array:["Core","Components","Validation"],
33
- Radio:["Core", "Properties", "style", "Event","Validation"],
34
- Text:["Core","Properties","style", "Event","Validation"],
35
- TextArea:["Core","Properties","style", "Event","Validation"],
36
- PopUp: ["Core", "Components","Properties", "style"],
37
- Stepper: ["Core", "Components","Properties","Event", "style"],
38
- DataGrid: ["Core", "Components","Properties","Event", "style"],
39
- InputSlider:["Core","Properties","style", "Event","Validation"],
40
- TreeMap:["Core", "Components","Properties","style", "Event"],
13
+ Select: ["Core", "Properties", "Value", "Event", "Style", "Validation"],
14
+ MultipleSelect: ["Core", "Properties", "Value", "Event", "Style", "Validation"],
15
+ Table: ["Core", "Components", "Properties", "Event", "Style", "Validation"],
16
+ LeaderBoard: ["Core", "Components", "Properties", "Event", "Style", "Validation"],
17
+ WrapperSection: ["Core", "Components", "Properties", "Style", "Validation"],
18
+ TabSection: ["Core", "Components", "Properties", "Style", "Validation"],
19
+ SpeedoMeter: ["Core", "Properties", "Event", "Style", "Validation"],
20
+ card: ["Core", "Properties", "Event", "Style", "Validation"],
21
+ UploadFile: ["Core", "Event", "Style", "Validation"],
22
+ Graph: ["Core", "Properties", "Event", "Style", "Validation"],
23
+ DownloadFile: ["Core", "Event", "Style", "Validation"],
24
+ Box: ["Core", "Event", "Style", "Validation"],
25
+ Properties: ["Core", "Properties", "Event", "Style", "Validation"],
26
+ ProgressBarCard: ["Core", "Properties", "Event", "Style", "Validation"],
27
+ RankCard: ["Core", "Properties", "Event", "Style", "Validation"],
28
+ Slider: ["Core", "Components", "Event", "Style", "Validation"],
29
+ Timer: ["Core", "Event", "Style", "Validation"],
30
+ Rank: ["Core", "Event", "Style", "Validation"],
31
+ Button: ["Core", "Properties", "Event", "Style", "Validation"],
32
+ Array: ["Core", "Components", "Validation"],
33
+ Radio: ["Core", "Properties", "Event", "Style", "Validation"],
34
+ Text: ["Core", "Properties", "Event", "Style", "Validation"],
35
+ TextArea: ["Core", "Properties", "Event", "Style", "Validation"],
36
+ PopUp: ["Core", "Components", "Properties", "Style"],
37
+ Stepper: ["Core", "Components", "Properties", "Event", "Style"],
38
+ DataGrid: ["Core", "Components", "Properties", "Event", "Style"],
39
+ InputSlider: ["Core", "Properties", "Event", "Style", "Validation"],
40
+ TreeMap: ["Core", "Components", "Properties", "Event", "Style",],
41
41
  }
42
42
 
43
43
 
44
44
 
45
- export const refreshPage = (type:string,store:any) => {
45
+ export const refreshPage = (type: string, store: any) => {
46
46
  const UiSchema = _.cloneDeep(componentBasicUiSchema)
47
- if(type){
48
- const sectionUiSchema = {
49
- Core: CoreSection,
50
- Value: ValueTab,
51
- style: StyleSection,
52
- Event: EventSection,
53
- Components: TableSection,
54
- Properties: buildPropertiesSection(type),
55
- Validation:ValidationSection
56
-
47
+ if (type) {
48
+ const sectionUiSchema = {
49
+ Core: CoreSection,
50
+ Value: ValueTab,
51
+ Style: StyleSection,
52
+ Event: EventSection,
53
+ Components: TableSection,
54
+ Properties: buildPropertiesSection(type),
55
+ Validation: ValidationSection
56
+
57
+ }
58
+ const elements = sectionLabels[type]?.map(e => sectionUiSchema[e]);
59
+ UiSchema.elements[1].config.main.tabLabels = sectionLabels[type] || ["Core", "style", "Event", "Validation"];
60
+ UiSchema.elements[1].elements = elements || [CoreSection, StyleSection, EventSection, ValidationSection];
61
+
57
62
  }
58
- const elements = sectionLabels[type]?.map(e => sectionUiSchema[e]);
59
- UiSchema.elements[1].config.main.tabLabels = sectionLabels[type] || ["Core", "style","Event","Validation"];
60
- UiSchema.elements[1].elements = elements || [CoreSection, StyleSection,EventSection,ValidationSection];
61
-
62
- }
63
- store.setUiSchema(UiSchema);
63
+ store.setUiSchema(UiSchema);
64
64
  }
65
65
 
66
66
  export default (store: any, dynamicData: any, submitHandler: any, service: any) => {
@@ -69,26 +69,26 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
69
69
  const formdata = await this.getFormdata();
70
70
  store.setFormdata(formdata);
71
71
  const schema = this.getSchema();
72
- store.setSchema(schema);
73
- this.refreshPage(formdata?.type, store);
74
-
72
+ store.setSchema(schema);
73
+ this.refreshPage(formdata?.type, store);
74
+
75
75
  },
76
- refreshPage:refreshPage,
76
+ refreshPage: refreshPage,
77
77
  getFormdata: function () {
78
78
  const path = store.searchParams?.get("path");
79
- return getFormdataFromLocalStorage(path)
79
+ return getFormdataFromLocalStorage(path)
80
80
  },
81
81
  getSchema: function () {
82
82
  return ComponentSchema;
83
83
  },
84
- okHandler:()=>okHandler(store),
85
- saveHandler: async ()=> await saveHandler(store,service,submitHandler,"PageMaster"),
84
+ okHandler: () => okHandler(store),
85
+ saveHandler: async () => await saveHandler(store, service, submitHandler, "PageMaster"),
86
86
  onChange: function () {
87
87
  if (
88
88
  store?.formData?.type !== store?.newData?.type &&
89
89
  store?.newData?.type !== undefined
90
90
  ) {
91
- this.refreshPage(store?.newData?.type,store);
91
+ this.refreshPage(store?.newData?.type, store);
92
92
  }
93
93
  },
94
94
  editComponents: function () {
@@ -1,3 +1,4 @@
1
+
1
2
  import _ from "lodash";
2
3
  import { handlersProps } from "./interface";
3
4
 
@@ -134,7 +135,7 @@ function executeInBuiltFunctionHandler(params: handlersProps) {
134
135
  function executeCustomHandler(params: handlersProps) {
135
136
  const makeFunc = eval(params.config.eventCode)
136
137
  if (params.config.isSync !== "Yes") {
137
- makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service, params.componentName).then((res) => res)
138
+ return makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service, params.componentName).then((res) => res)
138
139
  } else {
139
140
  const response = makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service, params.componentName)
140
141
  return response;
@@ -251,8 +251,3 @@ export default (funcParams: funcParamsProps) => {
251
251
  ...funcParams.functionsProvider
252
252
  };
253
253
  };
254
-
255
-
256
-
257
-
258
-