impaktapps-ui-builder 0.0.281 → 0.0.282

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;
@@ -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.282",
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");
@@ -161,7 +161,9 @@ async function mergeFormdata(handlerResponse: any, componentName: string, eventC
161
161
  }
162
162
  }
163
163
  })
164
-
164
+ }
165
+ else if (eventConfig.type === "LazyLoadingTable") {
166
+ store.setFormdata((pre) => { return { ...pre, [`${componentName}Backend`]: handlerResponse } });
165
167
  }
166
168
  else if (eventConfig.type === "page") {
167
169
  store.setFormdata((pre: any) => { return { ...pre, ...handlerResponse?.data } })
@@ -180,15 +182,19 @@ async function mergeFormdata(handlerResponse: any, componentName: string, eventC
180
182
  const buildBodyFormat = (body: any[], formData: any, userValue: any) => {
181
183
  const finalBody = { ...userValue?.payload };
182
184
  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 {
185
+ if (elem?.value !== "string") {
191
186
  finalBody[elem.key] = elem.value;
187
+ } else {
188
+ if (elem?.value?.startsWith("$userValue")) {
189
+ const finalpath = elem.value.substring(11);
190
+ finalBody[elem.key] = _.get(userValue, finalpath);;
191
+ }
192
+ else if (elem?.value?.startsWith("$")) {
193
+ const finalpath = elem.value.substring(1);
194
+ finalBody[elem.key] = _.get(formData, finalpath);;
195
+ } else {
196
+ finalBody[elem.key] = elem.value;
197
+ }
192
198
  }
193
199
  })
194
200
  return finalBody;
@@ -216,9 +222,6 @@ async function shouldEventExecute(config, componentName,
216
222
  return response
217
223
  }
218
224
  }
219
- // if(!response){
220
- // return {response:undefined,events:undefined};
221
- // }
222
225
  export async function buildApiPayload(compConfig: any, body: any, headers: any, store: any, dynamicData: any, userValue: any, service) {
223
226
  if (compConfig?.headers) {
224
227
  headers = buildHeadersFormat(compConfig.headers)
@@ -75,6 +75,27 @@ 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.body = [
89
+ ...eventConfig.body,
90
+ ...bodyValues
91
+ ]
92
+ } else { eventConfig.body = bodyValues; };
93
+ await executeEvents(
94
+ eventConfig, paginationValues.path,
95
+ funcParams.store, funcParams.dynamicData, funcParams.userValue, funcParams.service,
96
+ this, eventGroups)
97
+ }
98
+ },
78
99
  onChange: async function () {
79
100
  if (eventGroups.onChange) {
80
101
  const ChangeEventsKeysArray = Object.keys(eventGroups.onChange);