impaktapps-ui-builder 0.0.281 → 0.0.283

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.
@@ -1 +1,2 @@
1
1
  export declare const buildTable: (config: any, componentScope: string) => any;
2
+ export declare const buildLazyLoadingTable: (config: any, componentScope: string) => any;
@@ -0,0 +1,14 @@
1
+ declare const _default: {
2
+ type: string;
3
+ scope: string;
4
+ options: {
5
+ widget: string;
6
+ };
7
+ elements: any[];
8
+ config: {
9
+ main: {
10
+ columns: {};
11
+ };
12
+ };
13
+ };
14
+ export default _default;
@@ -1,7 +1,4 @@
1
- export declare const executeEvents: (config: any, componentName: string, store: any, dynamicData: any, userValue: any, service: any, serviceHolder: any, eventGroups?: any, parentEventOutput?: any) => Promise<{
2
- response: any;
3
- events: any;
4
- }>;
1
+ export declare const executeEvents: (config: any, componentName: string, store: any, dynamicData: any, userValue: any, service: any, serviceHolder: any, eventGroups?: any, parentEventOutput?: any) => Promise<any>;
5
2
  export declare function buildApiPayload(compConfig: any, body: any, headers: any, store: any, dynamicData: any, userValue: any, service: any): Promise<{
6
3
  body: any;
7
4
  headers: any;
@@ -11,6 +11,7 @@ interface funcParamsProps {
11
11
  declare const _default: (funcParams: funcParamsProps) => {
12
12
  setPage: () => Promise<void>;
13
13
  onClick: () => Promise<void>;
14
+ onPaginationChange: (paginationValues: any) => Promise<void>;
14
15
  onChange: () => Promise<void>;
15
16
  downloadFile: (obj: any) => void;
16
17
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "0.0.281",
3
+ "version": "0.0.283",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -1,13 +1,41 @@
1
1
  import Table from "./uischema/table";
2
2
  import _ from "lodash";
3
3
  import buildUiSchema from "./buildUiSchema";
4
+ import lazyLoadingTable from "./uischema/lazyLoadingTable";
4
5
 
5
- export const buildTable = (config:any,componentScope:string)=>{
6
- const table: any = _.cloneDeep(Table);
7
- table.scope = componentScope;
8
- if (config.style) {
9
- table.config.style = JSON.parse(config.style)
10
- }
11
- table.config.main.label = config.label;
12
- return table;
6
+ export const buildTable = (config: any, componentScope: string) => {
7
+ const table: any = _.cloneDeep(Table);
8
+ table.scope = componentScope;
9
+ if (config.style) {
10
+ table.config.style = JSON.parse(config.style)
11
+ }
12
+ if (config.SelectionAvailable) {
13
+ table.config.main.Selection = config.SelectionAvailable === "YES" ? true : false
14
+ };
15
+ if (config.ColumnResizingAvailable) {
16
+ table.config.main.disableColumnResizing = config.ColumnResizingAvailable === "YES" ? true : false
17
+ };
18
+ if (config.DragAvailable) {
19
+ table.config.main.enableDrag = config.DragAvailable === "YES" ? true : false
20
+ };
21
+ return table;
22
+ }
23
+
24
+ export const buildLazyLoadingTable = (config: any, componentScope: string) => {
25
+ const table: any = _.cloneDeep(lazyLoadingTable);
26
+ table.scope = componentScope;
27
+ if (config.style) {
28
+ table.config.style = JSON.parse(config.style)
29
+ }
30
+ if (config.SelectionAvailable) {
31
+ table.config.main.Selection = config.SelectionAvailable === "YES" ? true : false
32
+ };
33
+ if (config.ColumnResizingAvailable) {
34
+ table.config.main.disableColumnResizing = config.ColumnResizingAvailable === "YES" ? false : true
35
+ };
36
+ if (config.DragAvailable) {
37
+ table.config.main.enableDrag = config.DragAvailable === "YES" ? true : false
38
+ };
39
+ table.config.main.label = config.label;
40
+ return table;
13
41
  }
@@ -14,7 +14,7 @@ import { buildWrapperSection } from "./buildWrapperSection";
14
14
  import { buildTextField } from "./buildText";
15
15
  import { buildSelect } from "./buildSelect";
16
16
  import { buildButton } from "./buildButton";
17
- import { buildTable } from "./buildTable";
17
+ import { buildLazyLoadingTable, buildTable } from "./buildTable";
18
18
  import { buildLabel } from "./buildLabel";
19
19
  import { buildUploadFile } from "./buildUplaodFile";
20
20
  import { buildDownloadFile } from "./buildDownloadFile";
@@ -144,6 +144,10 @@ const buildUiSchema = (config: any) => {
144
144
  case "Table":
145
145
  elements = buildTable(config, componentScope);
146
146
  break;
147
+
148
+ case "LazyLoadingTable" :
149
+ elements = buildLazyLoadingTable(config, componentScope)
150
+ break;
147
151
  case "Box":
148
152
  elements = buildLabel(config, componentScope);
149
153
  break;
@@ -248,6 +248,14 @@ export const buildPropertiesSection = function (type: String) {
248
248
  getArrayControl("sectionLabels", "label"),
249
249
  ]
250
250
  }
251
+ else if(type === "Table"||type === "LazyLoadingTable"){
252
+ uiSchema.elements =[
253
+ getRadioInputField("SelectionAvailable","Selection Available",["YES","NO"]),
254
+ getRadioInputField("ColumnResizingAvailable","ColumnResizing Available",["YES","NO"]),
255
+ getRadioInputField("DragAvailable","Drag Available",["YES","NO"]),
256
+ EmptyBox
257
+ ]
258
+ }
251
259
  else if (type === "Radio") {
252
260
  uiSchema.elements = [
253
261
  getArrayControl("sectionLabels", "label", "Options Of Radio"),
@@ -18,6 +18,7 @@ export const CoreSection = {
18
18
  { title: "Date", const: "Date" },
19
19
  { title: "CheckBox", const: "CheckBox" },
20
20
  { title: "Table", const: "Table" },
21
+ { title: "Lazy Loading Table", const: "LazyLoadingTable" },
21
22
  { title: "Array", const: "Array" },
22
23
  { title: "Container", const: "WrapperSection" },
23
24
  { title: "Tabs", const: "TabSection" },
@@ -0,0 +1,14 @@
1
+ export default {
2
+ type: "Control",
3
+ scope: "#/properties/LazyLoadingTable",
4
+ options: {
5
+ widget: "LazyLoadingTable",
6
+ },
7
+ elements:[],
8
+ config: {
9
+ main: {
10
+ columns: {
11
+ },
12
+ },
13
+ },
14
+ };
@@ -106,6 +106,7 @@ export const componentBasicUiSchema: any = {
106
106
  { title: "Date", const: "Date" },
107
107
  { title: "CheckBox", const: "CheckBox" },
108
108
  { title: "Table", const: "Table" },
109
+ { title: "Lazy Loading Table", const: "LazyLoadingTable" },
109
110
  { title: "Array", const: "Array" },
110
111
  { title: "Container", const: "WrapperSection" },
111
112
  { title: "Tabs", const: "TabSection" },
@@ -9,11 +9,11 @@ import { StyleSection } from "../build/uischema/styleSection";
9
9
  import { TableSection } from "../build/uischema/tableSection";
10
10
  import { ValueTab } from "../build/uischema/valueTab";
11
11
  import { ValidationSection } from "../build/uischema/validationSections";
12
-
13
12
  const sectionLabels = {
14
13
  Select: ["Core", "Value", "style", "Event","Validation"],
15
14
  MultipleSelect: ["Core", "Value", "style", "Event","Validation"],
16
- Table: ["Core", "Components", "style", "Event","Validation"],
15
+ Table: ["Core", "Components", "Properties","style", "Event","Validation"],
16
+ LazyLoadingTable:["Core", "Components", "Properties", "style", "Event","Validation"],
17
17
  LeaderBoard: ["Core", "Components", "Properties", "style", "Event","Validation"],
18
18
  WrapperSection: ["Core", "Components","Properties", "style","Validation"],
19
19
  TabSection: ["Core", "Components", "Properties", "style","Validation"],
@@ -39,6 +39,7 @@ export default (
39
39
  }
40
40
  store.setUiSchema(uiSchema)
41
41
  },
42
+
42
43
  getFormData: Component(store, dynamicData).getFormdata,
43
44
  getUiSchema: async function () {
44
45
  return EventUiSchema;
@@ -54,6 +55,7 @@ export default (
54
55
  this.refreshPage(store.newData.Handler||store.formdata.Handler,store)
55
56
  }
56
57
  },
58
+
57
59
  saveHandler: Component(store, dynamicData).saveHandler,
58
60
  addEvent: async function () {
59
61
  const path = store.searchParams?.get("path");
@@ -12,6 +12,9 @@ export const executeEvents = async (
12
12
  const { response, events } = await executetOnLoadEvent(config, componentName,
13
13
  store, dynamicData, userValue,
14
14
  service, serviceHolder, eventGroups, parentEventOutput)
15
+ if (config.returnResponse) {
16
+ return response;
17
+ }
15
18
  LoadResponse = response;
16
19
  nextEvent = events;
17
20
  }
@@ -48,6 +51,9 @@ const executetOnLoadEvent = async (
48
51
  const { response } = await executeEventsHandler(config, componentName,
49
52
  store, dynamicData, userValue,
50
53
  service, serviceHolder, eventGroups, parentEventOutput)
54
+ if(config.returnResponse){
55
+ return {response}
56
+ }
51
57
  const SuccessEvent = config?.events.filter(e => e.eventType === "Success")
52
58
  const setEvent = SuccessEvent.length > 0 ? SuccessEvent : [{ Handler: "mergeFormdata", eventType: "Success", type: config.type }]
53
59
  return { response, events: setEvent };
@@ -124,6 +130,9 @@ async function executeApiEventHandler(apiHandlerConfig: any, componentName: stri
124
130
  body,
125
131
  headers && { headers: headers }
126
132
  );
133
+ if(apiHandlerConfig.returnResponse){
134
+ return {response}
135
+ }
127
136
  return { response, events: apiHandlerConfig?.events };;
128
137
  }
129
138
 
@@ -161,7 +170,6 @@ async function mergeFormdata(handlerResponse: any, componentName: string, eventC
161
170
  }
162
171
  }
163
172
  })
164
-
165
173
  }
166
174
  else if (eventConfig.type === "page") {
167
175
  store.setFormdata((pre: any) => { return { ...pre, ...handlerResponse?.data } })
@@ -180,15 +188,19 @@ async function mergeFormdata(handlerResponse: any, componentName: string, eventC
180
188
  const buildBodyFormat = (body: any[], formData: any, userValue: any) => {
181
189
  const finalBody = { ...userValue?.payload };
182
190
  body.map((elem) => {
183
- if (elem?.value?.startsWith("$userValue")) {
184
- const finalpath = elem.value.substring(11);
185
- finalBody[elem.key] = _.get(userValue, finalpath);;
186
- }
187
- else if (elem?.value?.startsWith("$")) {
188
- const finalpath = elem.value.substring(1);
189
- finalBody[elem.key] = _.get(formData, finalpath);;
190
- } else {
191
+ if (elem?.value !== "string") {
191
192
  finalBody[elem.key] = elem.value;
193
+ } else {
194
+ if (elem?.value?.startsWith("$userValue")) {
195
+ const finalpath = elem.value.substring(11);
196
+ finalBody[elem.key] = _.get(userValue, finalpath);;
197
+ }
198
+ else if (elem?.value?.startsWith("$")) {
199
+ const finalpath = elem.value.substring(1);
200
+ finalBody[elem.key] = _.get(formData, finalpath);;
201
+ } else {
202
+ finalBody[elem.key] = elem.value;
203
+ }
192
204
  }
193
205
  })
194
206
  return finalBody;
@@ -216,9 +228,6 @@ async function shouldEventExecute(config, componentName,
216
228
  return response
217
229
  }
218
230
  }
219
- // if(!response){
220
- // return {response:undefined,events:undefined};
221
- // }
222
231
  export async function buildApiPayload(compConfig: any, body: any, headers: any, store: any, dynamicData: any, userValue: any, service) {
223
232
  if (compConfig?.headers) {
224
233
  headers = buildHeadersFormat(compConfig.headers)
@@ -75,6 +75,31 @@ export default (funcParams: funcParamsProps) => {
75
75
  this, eventGroups)
76
76
  }
77
77
  },
78
+ onPaginationChange: async (paginationValues) => {
79
+ for (const eventConfig of eventGroups?.onLoad[paginationValues.path]) {
80
+ ;
81
+ const bodyValues = [
82
+ {key: "size",value: paginationValues.pagination.pageSize},
83
+ {key: "start",value: paginationValues.pagination.pageIndex * paginationValues.pagination.pageSize},
84
+ {key:"filters",value: paginationValues.columnFilters || []},
85
+ {key:"globalFilter",value: paginationValues.globalFilter ?? ''}
86
+ ]
87
+ if (eventConfig.body) {
88
+ eventConfig.returnResponse = true
89
+ eventConfig.body = [
90
+ ...eventConfig.body,
91
+ ...bodyValues
92
+ ]
93
+ } else {
94
+ eventConfig.returnResponse = true
95
+ eventConfig.body = bodyValues;
96
+ };
97
+ await executeEvents(
98
+ eventConfig, paginationValues.path,
99
+ funcParams.store, funcParams.dynamicData, funcParams.userValue, funcParams.service,
100
+ this, eventGroups)
101
+ }
102
+ },
78
103
  onChange: async function () {
79
104
  if (eventGroups.onChange) {
80
105
  const ChangeEventsKeysArray = Object.keys(eventGroups.onChange);