impaktapps-ui-builder 0.0.286 → 0.0.288

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.
@@ -43,8 +43,8 @@ export declare const APISection: {
43
43
  label: string;
44
44
  type: string;
45
45
  options: {
46
- title: string;
47
- const: string;
46
+ label: string;
47
+ value: string;
48
48
  }[];
49
49
  multiple?: undefined;
50
50
  };
@@ -114,7 +114,7 @@ export declare const APISectionSchema: {
114
114
  key: {
115
115
  type: string;
116
116
  };
117
- const: {
117
+ value: {
118
118
  type: string;
119
119
  };
120
120
  };
@@ -128,7 +128,7 @@ export declare const APISectionSchema: {
128
128
  key: {
129
129
  type: string;
130
130
  };
131
- const: {
131
+ value: {
132
132
  type: string;
133
133
  };
134
134
  };
@@ -19,8 +19,8 @@ export declare const CoreSection: {
19
19
  label: string;
20
20
  type: string;
21
21
  options: {
22
- title: string;
23
- const: string;
22
+ label: string;
23
+ value: string;
24
24
  }[];
25
25
  };
26
26
  };
@@ -89,8 +89,8 @@ export declare const CoreSection: {
89
89
  main: {
90
90
  label: string;
91
91
  options: {
92
- title: string;
93
- const: string;
92
+ label: string;
93
+ value: string;
94
94
  }[];
95
95
  };
96
96
  };
@@ -24,8 +24,8 @@ export declare const ValidationSection: {
24
24
  main: {
25
25
  label: string;
26
26
  options: {
27
- const: string;
28
- title: string;
27
+ value: string;
28
+ label: string;
29
29
  }[];
30
30
  };
31
31
  };
@@ -1,5 +1,6 @@
1
1
  import { handlersProps } from "./interface";
2
2
  export declare const executeEvents: (params: handlersProps) => Promise<any>;
3
+ export declare function executeRefreshHandler(params: handlersProps): Promise<void>;
3
4
  export declare function buildApiPayload(compConfig: any, body: any, headers: any, store: any, dynamicData: any, userValue: any, service: any): Promise<{
4
5
  body: any;
5
6
  headers: any;
@@ -12,7 +12,9 @@ declare const _default: (funcParams: funcParamsProps) => {
12
12
  setPage: () => Promise<void>;
13
13
  onClick: () => Promise<void>;
14
14
  onPaginationChange: (paginationValues: any) => Promise<any>;
15
+ getSelectOptions: (param: any) => Promise<any>;
15
16
  onChange: () => Promise<void>;
17
+ updateConfigApiBody: (paramValue: any, apiBody: any) => Promise<any>;
16
18
  downloadFile: (obj: any) => void;
17
19
  };
18
20
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "0.0.286",
3
+ "version": "0.0.288",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -16,10 +16,10 @@ export const APISection = {
16
16
  label: "Method",
17
17
  type: "text",
18
18
  options: [
19
- { title: "Get", const: "get" },
20
- { title: "Post", const: "post" },
21
- { title: "Delete", const: "delete" },
22
- { title: "Put", const: "put" },
19
+ { label: "Get", value: "get" },
20
+ { label: "Post", value: "post" },
21
+ { label: "Delete", value: "delete" },
22
+ { label: "Put", value: "put" },
23
23
  ],
24
24
  },
25
25
  },
@@ -155,7 +155,7 @@ export const APISectionSchema = {
155
155
  key: {
156
156
  type: "string",
157
157
  },
158
- const: {
158
+ value: {
159
159
  type: "string",
160
160
  },
161
161
  },
@@ -169,7 +169,7 @@ export const APISectionSchema = {
169
169
  key: {
170
170
  type: "string",
171
171
  },
172
- const: {
172
+ value: {
173
173
  type: "string",
174
174
  },
175
175
  },
@@ -14,34 +14,34 @@ export const CoreSection = {
14
14
  label: "Type",
15
15
  type: "text",
16
16
  options: [
17
- { title: "Select", const: "Select" },
18
- { title: "Date", const: "Date" },
19
- { title: "CheckBox", const: "CheckBox" },
20
- { title: "Table", const: "Table" },
21
- { title: "Lazy Loading Table", const: "LazyLoadingTable" },
22
- { title: "Array", const: "Array" },
23
- { title: "Container", const: "WrapperSection" },
24
- { title: "Tabs", const: "TabSection" },
25
- { title: "Text", const: "Text" },
26
- { title: "Text Area", const: "TextArea" },
27
- { title: "Button", const: "Button" },
28
- { title: "Card", const: "card" },
29
- { title: "Radio", const: "Radio" },
30
- { title: "Rank", const: "Rank" },
31
- { title: "SpeedoMeter", const: "SpeedoMeter" },
32
- { title: "ProgressBar", const: "ProgressBar" },
33
- { title: "Graph", const: "Graph" },
34
- { title: "Label", const: "Box" },
35
- { title: "Upload File", const: "UploadFile" },
36
- { title: "Download File", const: "DownloadFile" },
37
- { title: "Empty Box", const: "EmptyBox" },
38
- { title: "ProgressBar Card", const: "ProgressBarCard" },
39
- { title: "Rank Card", const: "RankCard" },
40
- { title: "Runner Boy Progress Bar", const: "RunnerBoyProgressBar" },
41
- { title: "Slider", const: "Slider" },
42
- { title: "Timer", const: "Timer" },
43
- { title: "MultipleSelect", const: "MultipleSelect" },
44
- { title: "LeaderBoard", const: "LeaderBoard" },],
17
+ { label: "Select", value: "Select" },
18
+ { label: "Date", value: "Date" },
19
+ { label: "CheckBox", value: "CheckBox" },
20
+ { label: "Table", value: "Table" },
21
+ { label: "Lazy Loading Table", value: "LazyLoadingTable" },
22
+ { label: "Array", value: "Array" },
23
+ { label: "Container", value: "WrapperSection" },
24
+ { label: "Tabs", value: "TabSection" },
25
+ { label: "Text", value: "Text" },
26
+ { label: "Text Area", value: "TextArea" },
27
+ { label: "Button", value: "Button" },
28
+ { label: "Card", value: "card" },
29
+ { label: "Radio", value: "Radio" },
30
+ { label: "Rank", value: "Rank" },
31
+ { label: "SpeedoMeter", value: "SpeedoMeter" },
32
+ { label: "ProgressBar", value: "ProgressBar" },
33
+ { label: "Graph", value: "Graph" },
34
+ { label: "Label", value: "Box" },
35
+ { label: "Upload File", value: "UploadFile" },
36
+ { label: "Download File", value: "DownloadFile" },
37
+ { label: "Empty Box", value: "EmptyBox" },
38
+ { label: "ProgressBar Card", value: "ProgressBarCard" },
39
+ { label: "Rank Card", value: "RankCard" },
40
+ { label: "Runner Boy Progress Bar", value: "RunnerBoyProgressBar" },
41
+ { label: "Slider", value: "Slider" },
42
+ { label: "Timer", value: "Timer" },
43
+ { label: "MultipleSelect", value: "MultipleSelect" },
44
+ { label: "LeaderBoard", value: "LeaderBoard" },],
45
45
  },
46
46
  },
47
47
  },
@@ -119,10 +119,10 @@ export const CoreSection = {
119
119
  main: {
120
120
  label: "Screen Size",
121
121
  options: [
122
- { title: "Extra Small", const: "xs" },
123
- { title: "Small", const: "sm" },
124
- { title: "Medium", const: "md" },
125
- { title: "Large", const: "lg" },
122
+ { label: "Extra Small", value: "xs" },
123
+ { label: "Small", value: "sm" },
124
+ { label: "Medium", value: "md" },
125
+ { label: "Large", value: "lg" },
126
126
  ],
127
127
  },
128
128
  },
@@ -144,10 +144,10 @@ export const CoreSection = {
144
144
  main: {
145
145
  label: "Value",
146
146
  options: [
147
- { title: "3", const: "3" },
148
- { title: "5.5", const: "5.5" },
149
- { title: "8", const: "8" },
150
- { title: "12", const: "12" },
147
+ { label: "3", value: "3" },
148
+ { label: "5.5", value: "5.5" },
149
+ { label: "8", value: "8" },
150
+ { label: "12", value: "12" },
151
151
  ],
152
152
  },
153
153
  },
@@ -27,10 +27,10 @@ export const ValidationSection = {
27
27
  main: {
28
28
  label: "Validation Type",
29
29
  options: [
30
- { const: "required", title: "Required" },
31
- { const: "minLength", title: "Minimum Length" },
32
- { const: "maxLength", title: "Maximum Length" },
33
- { const: "pattern", title: "Pattern" },
30
+ { value: "required", label: "Required" },
31
+ { value: "minLength", label: "Minimum Length" },
32
+ { value: "maxLength", label: "Maximum Length" },
33
+ { value: "pattern", label: "Pattern" },
34
34
  ]
35
35
  },
36
36
  },
@@ -6,16 +6,16 @@ export const executeEvents = async (
6
6
  params:handlersProps
7
7
  ) => {
8
8
  let nextEvent = [];
9
- let LoadResponse = null;
9
+ let finalResponse = null;
10
10
  try{
11
11
  if (!shouldEventExecute(params)) {
12
12
  return { response: undefined, events: undefined };
13
13
  }
14
14
  const response = await executeEventsHandler(params)
15
- LoadResponse = response;
15
+ finalResponse = response;
16
16
  const SuccessEvent = params.config?.events.filter(e => e.eventType === "Success");
17
17
  if(params.config.returnNeeded){
18
- return LoadResponse
18
+ return finalResponse
19
19
  }
20
20
  nextEvent = SuccessEvent;
21
21
  } catch (err) {
@@ -25,10 +25,10 @@ export const executeEvents = async (
25
25
  }
26
26
  if (nextEvent?.length > 0) {
27
27
  for (const actionConfig of nextEvent) {
28
- await executeEvents({...params,config:actionConfig,parentEventOutput:LoadResponse})
28
+ await executeEvents({...params,config:actionConfig,parentEventOutput:finalResponse})
29
29
  }
30
30
  }
31
- return LoadResponse;
31
+ return finalResponse;
32
32
  }
33
33
 
34
34
  async function executeEventsHandler(params:handlersProps) {
@@ -49,11 +49,11 @@ async function executeEventsHandler(params:handlersProps) {
49
49
  params.parentEventOutput, params.componentName, params.config, params.store)
50
50
  }
51
51
  }
52
- async function executeRefreshHandler(params:handlersProps) {
52
+ export async function executeRefreshHandler(params:handlersProps) {
53
53
  const compToRefresh: string[] = getRefreshElements(params.config, params.eventGroups)
54
54
  for (const componentName of compToRefresh) {
55
55
  for (const compEventConfig of params.eventGroups.onLoad[componentName]) {
56
- await executeEvents({...params,config:compEventConfig});
56
+ await executeEvents({...params,config:compEventConfig,componentName});
57
57
  }
58
58
  }
59
59
  }
@@ -94,7 +94,8 @@ async function mergeFormdata(handlerResponse: any, componentName: string, eventC
94
94
  return {
95
95
  ...pre, properties: {
96
96
  ...pre.properties, [componentName]: {
97
- enum: handlerResponse.data
97
+ ...pre.properties?.[componentName],
98
+ oneOf: handlerResponse.data
98
99
  }
99
100
  }
100
101
  }
@@ -145,8 +146,8 @@ const buildHeadersFormat = (headers: any[]) => {
145
146
  async function shouldEventExecute(params:handlersProps) {
146
147
  const startEvent = params.config?.events?.filter(e => e.eventType === "onStart");
147
148
  if (startEvent?.length > 0) {
148
- const { response } = await executeEventsHandler(params);
149
- return response
149
+ const response = await executeEventsHandler({...params,config:startEvent[0]});
150
+ return response;
150
151
  }
151
152
  }
152
153
 
@@ -1,6 +1,6 @@
1
1
  import _ from "lodash";
2
2
  import { downloadFile } from "./downloadFile";
3
- import { executeEvents } from "./events";
3
+ import { executeEvents, executeRefreshHandler } from "./events";
4
4
  import { handlersProps } from "./interface";
5
5
  let compType: string;
6
6
  let eventGroups: any = {};
@@ -29,10 +29,10 @@ export const extractEvents = (eventConfig: any) => {
29
29
  const SuccessEvent = event?.events?.find((elem) => {
30
30
  return elem.eventType === "Success"
31
31
  })
32
- if (!(!!SuccessEvent) && event.eventType === "onLoad" ) {
32
+ if (!(!!SuccessEvent) && event.eventType === "onLoad") {
33
33
  event.events.push({ Handler: "mergeFormdata", eventType: "Success", type: compType })
34
- }
35
- eventGroups[event.eventType][eventConfigObj.name].push({ ...event, type: compType })
34
+ }
35
+ eventGroups[event.eventType][eventConfigObj.name].push({ ...event, type: compType })
36
36
  });
37
37
  }
38
38
  }
@@ -69,12 +69,7 @@ export default (funcParams: funcParamsProps) => {
69
69
  store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
70
70
  serviceHolder: this, eventGroups
71
71
  }
72
- await executeEvents({
73
- ...executeEventsParameters,
74
- config: { Handler: "refresh", eventType: "onPageRefresh" },
75
- componentName: "all"
76
- })
77
-
72
+ await executeRefreshHandler(executeEventsParameters)
78
73
  funcParams.store.setSchema(
79
74
  (pre: any) => {
80
75
  return {
@@ -95,31 +90,23 @@ export default (funcParams: funcParamsProps) => {
95
90
  })
96
91
  }
97
92
  },
98
- onPaginationChange: async (paginationValues) => {
99
- for (const eventConfig of eventGroups?.onLoad[paginationValues.path]) {
100
- const bodyValues = [
101
- { key: "size", value: paginationValues.pagination.pageSize },
102
- { key: "start", value: paginationValues.pagination.pageIndex * paginationValues.pagination.pageSize },
103
- { key: "sorting", value: paginationValues.sorting || [] },
104
- { key: "filters", value: paginationValues.columnFilters || [] },
105
- { key: "globalFilter", value: paginationValues.globalFilter ?? '' }
93
+ onPaginationChange: async function (paginationValues) {
94
+ const apiBody = [
95
+ { key: "size", value: paginationValues.pagination.pageSize },
96
+ { key: "start", value: paginationValues.pagination.pageIndex * paginationValues.pagination.pageSize },
97
+ { key: "sorting", value: paginationValues.sorting || [] },
98
+ { key: "filters", value: paginationValues.columnFilters || [] },
99
+ { key: "globalFilter", value: paginationValues.globalFilter ?? '' }
100
+ ]
101
+ return await this.updateConfigApiBody(paginationValues, apiBody)
102
+ },
103
+ getSelectOptions: async function (param) {
104
+ if (param.serachValue !== "" && param.serachValue !== undefined) {
105
+ const apiBody = [
106
+ { key: "serachValue", value: param.serachValue },
107
+ { key: "currentValue", value: param.currentValue }
106
108
  ]
107
- if (eventConfig.body) {
108
- eventConfig.body = [
109
- ...eventConfig.body,
110
- ...bodyValues
111
- ]
112
- } else { eventConfig.body = bodyValues; };
113
- const responseEvent = eventConfig?.events?.filter((elem) => {
114
- return elem.Handler !== "mergeFormdata"
115
- })
116
- eventConfig.events = responseEvent??[]
117
- const data = await executeEvents({
118
- ...executeEventsParameters,
119
- config: eventConfig,
120
- componentName: paginationValues.path
121
- })
122
- return data;
109
+ return await this.updateConfigApiBody(param, apiBody)
123
110
  }
124
111
  },
125
112
  onChange: async function () {
@@ -141,6 +128,27 @@ export default (funcParams: funcParamsProps) => {
141
128
  }))
142
129
  }
143
130
  },
131
+ updateConfigApiBody: async function (paramValue, apiBody) {
132
+ let LastCallResponse = undefined;
133
+ for (const eventConfig of eventGroups?.onLoad[paramValue.path]) {
134
+ if (eventConfig.body) {
135
+ eventConfig.body = [
136
+ ...eventConfig.body,
137
+ ...apiBody
138
+ ]
139
+ } else { eventConfig.body = apiBody; };
140
+ const responseEvent = eventConfig?.events?.filter((elem) => {
141
+ return elem.Handler !== "mergeFormdata"
142
+ })
143
+ eventConfig.events = responseEvent ?? []
144
+ LastCallResponse = await executeEvents({
145
+ ...executeEventsParameters,
146
+ config: eventConfig,
147
+ componentName: paramValue.path
148
+ })
149
+ }
150
+ return LastCallResponse
151
+ },
144
152
  downloadFile: downloadFile
145
153
  };
146
154
  };