impaktapps-ui-builder 0.0.404 → 0.0.406

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.404",
3
+ "version": "0.0.406",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -10,10 +10,10 @@ export default (FormData: any) => {
10
10
  // if(!formData.type ){
11
11
  // component.type = "page";
12
12
  // }
13
- if(formData.pageName){
13
+ if (formData.pageName) {
14
14
  delete formData.pageName
15
15
  }
16
- if(formData.eventsSelected){
16
+ if (formData.eventsSelected) {
17
17
  delete formData.eventsSelected
18
18
  }
19
19
  if (formData.type === "Table" ||
@@ -25,7 +25,7 @@ export default (FormData: any) => {
25
25
  delete formData.elements
26
26
  }
27
27
  }
28
- component.events = formData.events||[];
28
+ component.events = formData.events || [];
29
29
  if (formData.events) {
30
30
  delete formData.events
31
31
  }
@@ -34,7 +34,7 @@ export default (FormData: any) => {
34
34
  };
35
35
 
36
36
  export const createLayoutFormat = (config: any[]) => {
37
- if(_.isEmpty(config)){
37
+ if (_.isEmpty(config)) {
38
38
  return {
39
39
  xs: 11,
40
40
  sm: 11,
@@ -43,14 +43,17 @@ export const createLayoutFormat = (config: any[]) => {
43
43
  }
44
44
  }
45
45
  let data: any = {};
46
- config.map((e:any)=>{
47
- data[e.key||"xs"] = +e.value||5.5
46
+ config.map((e: any) => {
47
+ data[e.key || "xs"] = +e.value || 5.5
48
48
  })
49
49
  return data;
50
50
  };
51
- export const flatObjectValueInArray = (config:any[])=>{
51
+ export const flatObjectValueInArray = (config: any[]) => {
52
+ if (config[0].length < 1) {
53
+ return
54
+ }
52
55
  const keyName = Object.keys(config[0])[0]
53
- const data = config.map((e)=>{
56
+ const data = config.map((e) => {
54
57
  return e[keyName]
55
58
  })
56
59
  return data;
@@ -1,27 +1,26 @@
1
1
  import { createLayoutFormat, flatObjectValueInArray } from "./buildConfig";
2
2
  import { PieGraph } from "./uischema/graph";
3
3
  import _ from "lodash";
4
- // flatObjectValueInArray
5
- export const buildPieGraph = (config,componentScope) =>{
6
- const pieGraph: any = _.cloneDeep(PieGraph);
7
- if (config.layout) {
8
- pieGraph.config.layout = createLayoutFormat(config.layout);
9
- }
10
- if (config.height) {
11
- pieGraph.config.style.containerStyle.height = config.height;
12
- }
13
- if (config.legendHide) {
14
- pieGraph.config.main.legendAvailabe = config.legendHide==="YES"?false:true;
15
- }
16
- pieGraph.scope = componentScope;
17
- pieGraph.config.main.header = config.heading;
18
-
19
- if(config.legendLabels){
20
- pieGraph.config.main.tooltipDataKey = flatObjectValueInArray(config.legendLabels);
21
- }
22
-
23
- if(config.pieArcColors){
24
- pieGraph.config.style.pieStyle.colorRange = flatObjectValueInArray(config.pieArcColors);
25
- }
26
- return pieGraph;
4
+ export const buildPieGraph = (config, componentScope) => {
5
+ const pieGraph: any = _.cloneDeep(PieGraph);
6
+ if (config.layout) {
7
+ pieGraph.config.layout = createLayoutFormat(config.layout);
8
+ }
9
+ if (config.height) {
10
+ pieGraph.config.style.containerStyle.height = config.height;
11
+ }
12
+ if (config.legendHide) {
13
+ pieGraph.config.main.legendAvailabe = config.legendHide === "YES" ? false : true;
14
+ }
15
+ pieGraph.scope = componentScope;
16
+ pieGraph.config.main.header = config.heading;
17
+
18
+ if (config.legendLabels) {
19
+ pieGraph.config.main.tooltipDataKey = flatObjectValueInArray(config.legendLabels);
20
+ }
21
+
22
+ if (config.pieArcColors) {
23
+ pieGraph.config.style.pieStyle.colorRange = flatObjectValueInArray(config.pieArcColors);
24
+ }
25
+ return pieGraph;
27
26
  }
@@ -305,25 +305,25 @@ const buildUiSchema = (config: any) => {
305
305
  else if (config.type == "Table") {
306
306
  const sizeMap = {}
307
307
  if (config.sizeHolder) {
308
- config.sizeHolder.map((e, i) => {
308
+ config.sizeHolder.map((e, i) => {
309
309
  sizeMap[e.keyName] = e.value
310
310
  });
311
311
  }
312
312
  elements.elements = config.elements.map((e, elemInd) => {
313
- if (e.type) {
313
+ if (e.type && e.type !== "date" && e.type !== "dateTime" && e.type !== "amount") {
314
314
  return {
315
315
  accessorKey: e.name,
316
316
  header: e.label || e.name,
317
- size: sizeMap[e.name]|| 180,
318
- type:e.type,
317
+ size: sizeMap[e.name] || 180,
318
+ type: e.type,
319
319
  widget: buildUiSchema(e)
320
320
  }
321
321
  }
322
322
  return {
323
- type:e.type,
323
+ type: e.type,
324
324
  accessorKey: e.name,
325
325
  header: e.label || e.name,
326
- size: sizeMap[e.name]|| 180
326
+ size: sizeMap[e.name] || 180
327
327
  }
328
328
  })
329
329
  }
@@ -134,7 +134,7 @@ export const LineGraph = {
134
134
  leftLabel: "Incentive",
135
135
  gridHidden: true,
136
136
  numHidden: false,
137
- tooltipDataKey: ["MAMA New Project", "Second", "Third"],
137
+ tooltipDataKey: ["First", "Second", "Third"],
138
138
  axisLeft: true,
139
139
  axisBottom: true,
140
140
  hideLeftAxisLine: false,