impaktapps-ui-builder 0.0.280 → 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.
- package/dist/impaktapps-ui-builder.es.js +149 -59
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +15 -15
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/dist/src/impaktapps-ui-builder/builder/build/buildTable.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildUiSchema.d.ts +5 -0
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/lazyLoadingTable.d.ts +14 -0
- package/dist/src/impaktapps-ui-builder/lib/index.d.ts +1 -1
- package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +1 -0
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildTable.ts +36 -8
- package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +65 -25
- package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +8 -0
- package/src/impaktapps-ui-builder/builder/build/uischema/coreSection.ts +1 -0
- package/src/impaktapps-ui-builder/builder/build/uischema/lazyLoadingTable.ts +14 -0
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +1 -0
- package/src/impaktapps-ui-builder/builder/services/component.ts +2 -2
- package/src/impaktapps-ui-builder/builder/services/event.ts +2 -0
- package/src/impaktapps-ui-builder/lib/index.ts +1 -1
- package/src/impaktapps-ui-builder/runtime/services/events.ts +15 -12
- package/src/impaktapps-ui-builder/runtime/services/service.ts +21 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildSchema.d.ts +0 -6
|
@@ -3,5 +3,10 @@ export declare let schema: {
|
|
|
3
3
|
properties: {};
|
|
4
4
|
required: any[];
|
|
5
5
|
};
|
|
6
|
+
export declare const buildSchema: (config: any, tableName?: string) => {
|
|
7
|
+
type: string;
|
|
8
|
+
properties: {};
|
|
9
|
+
required: any[];
|
|
10
|
+
};
|
|
6
11
|
declare const buildUiSchema: (config: any) => any;
|
|
7
12
|
export default buildUiSchema;
|
|
@@ -5,5 +5,5 @@ export { default as pageService } from "../runtime/services/service";
|
|
|
5
5
|
export { schema } from "../builder/build/buildUiSchema";
|
|
6
6
|
export { default as buildConfig } from "../builder/build/buildConfig";
|
|
7
7
|
export { default as buildUiSchema } from "../builder/build/buildUiSchema";
|
|
8
|
-
export {
|
|
8
|
+
export { buildSchema } from "../builder/build/buildUiSchema";
|
|
9
9
|
export { default as clearPreviousCache } from "../builder/services/clearLocalStorage";
|
|
@@ -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,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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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";
|
|
@@ -34,29 +34,78 @@ import { buildCheckbox } from "./buildCheckbox";
|
|
|
34
34
|
import { buildLineGraph } from "./buildLineGraph";
|
|
35
35
|
import { buildRadio } from "./buildRadio";
|
|
36
36
|
import { buildEmptyBox } from "./buildEmptyBox";
|
|
37
|
-
export let schema =
|
|
37
|
+
export let schema = {
|
|
38
38
|
type: "object",
|
|
39
39
|
properties: {},
|
|
40
40
|
required: []
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
|
|
43
|
+
function buildRule(configObj: any, tableName?: string) {
|
|
43
44
|
if (configObj.validation) {
|
|
44
45
|
configObj.validation.forEach((rule: any) => {
|
|
45
|
-
if (
|
|
46
|
-
schema.properties[
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
if (tableName) {
|
|
47
|
+
if (schema.properties?.[tableName]?.items?.properties) {
|
|
48
|
+
if (!schema.properties?.[tableName]?.items?.properties?.[configObj.name]) {
|
|
49
|
+
schema.properties[tableName].items.properties[configObj.name] = {};
|
|
50
|
+
}
|
|
51
|
+
if (rule.validationType === "required") {
|
|
52
|
+
schema.properties?.[tableName]?.items?.required.push(configObj.name)
|
|
53
|
+
} else {
|
|
54
|
+
schema.properties[tableName].items.properties[configObj.name]["type"] = "string"
|
|
55
|
+
schema.properties[tableName].items.properties[configObj.name][rule.validationType] =
|
|
56
|
+
isNaN(rule.validationValue) ?
|
|
57
|
+
rule.validationValue : Number(rule.validationValue)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
}
|
|
50
61
|
} else {
|
|
51
|
-
|
|
52
|
-
schema.properties[configObj.name]
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
|
|
63
|
+
if (!schema.properties[configObj.name]) {
|
|
64
|
+
schema.properties[configObj.name] = {};
|
|
65
|
+
}
|
|
66
|
+
if (rule.validationType === "required") {
|
|
67
|
+
schema.required.push(configObj.name)
|
|
68
|
+
} else {
|
|
69
|
+
schema.properties[configObj.name]["type"] = "string"
|
|
70
|
+
schema.properties[configObj.name][rule.validationType] =
|
|
71
|
+
isNaN(rule.validationValue) ?
|
|
72
|
+
rule.validationValue : Number(rule.validationValue)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
55
77
|
}
|
|
56
78
|
});
|
|
57
79
|
}
|
|
58
80
|
|
|
59
81
|
}
|
|
82
|
+
export const buildSchema = (config: any, tableName?: string) => {
|
|
83
|
+
buildRule(config, tableName);
|
|
84
|
+
if (config?.elements) {
|
|
85
|
+
|
|
86
|
+
if (config.type == "Table") {
|
|
87
|
+
if (!schema.properties[config.name]) {
|
|
88
|
+
schema.properties[config.name] = {
|
|
89
|
+
type: "array",
|
|
90
|
+
items: {
|
|
91
|
+
type: "object",
|
|
92
|
+
properties: {},
|
|
93
|
+
required: []
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
config.elements.map((e, elemInd) => {
|
|
98
|
+
buildSchema(e, config.name)
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
config.elements.map((e, elemInd) => {
|
|
103
|
+
buildSchema(e)
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return schema;
|
|
108
|
+
}
|
|
60
109
|
|
|
61
110
|
|
|
62
111
|
const buildUiSchema = (config: any) => {
|
|
@@ -75,48 +124,41 @@ const buildUiSchema = (config: any) => {
|
|
|
75
124
|
break;
|
|
76
125
|
case "Text":
|
|
77
126
|
elements = buildTextField(config, componentScope);
|
|
78
|
-
buildRule(config);
|
|
79
127
|
break;
|
|
80
128
|
case "TextArea":
|
|
81
129
|
elements = buildTextArea(config, componentScope)
|
|
82
|
-
buildRule(config);
|
|
83
130
|
break;
|
|
84
131
|
case "Date":
|
|
85
132
|
elements = buildDate(config, componentScope);
|
|
86
|
-
buildRule(config);
|
|
87
133
|
break;
|
|
88
134
|
case "Select":
|
|
89
135
|
elements = buildSelect(config, componentScope);
|
|
90
|
-
buildRule(config);
|
|
91
136
|
break;
|
|
92
137
|
case "Radio":
|
|
93
138
|
elements = buildRadio(config, componentScope);
|
|
94
|
-
buildRule(config);
|
|
95
139
|
break;
|
|
96
140
|
case "Button":
|
|
97
141
|
|
|
98
142
|
elements = buildButton(config, componentScope);
|
|
99
|
-
buildRule(config);
|
|
100
143
|
break;
|
|
101
144
|
case "Table":
|
|
102
145
|
elements = buildTable(config, componentScope);
|
|
103
|
-
buildRule(config);
|
|
104
146
|
break;
|
|
147
|
+
|
|
148
|
+
case "LazyLoadingTable" :
|
|
149
|
+
elements = buildLazyLoadingTable(config, componentScope)
|
|
150
|
+
break;
|
|
105
151
|
case "Box":
|
|
106
152
|
elements = buildLabel(config, componentScope);
|
|
107
|
-
buildRule(config);
|
|
108
153
|
break;
|
|
109
154
|
case "CheckBox":
|
|
110
155
|
elements = buildCheckbox(config, componentScope);
|
|
111
|
-
buildRule(config);
|
|
112
156
|
break;
|
|
113
157
|
case "UploadFile":
|
|
114
158
|
elements = buildUploadFile(config, componentScope);
|
|
115
|
-
buildRule(config);
|
|
116
159
|
break;
|
|
117
160
|
case "DownloadFile":
|
|
118
161
|
elements = buildDownloadFile(config, componentScope);
|
|
119
|
-
buildRule(config);
|
|
120
162
|
break;
|
|
121
163
|
case "EmptyBox":
|
|
122
164
|
elements = buildEmptyBox(config, componentScope);
|
|
@@ -165,7 +207,6 @@ const buildUiSchema = (config: any) => {
|
|
|
165
207
|
|
|
166
208
|
case "MultipleSelect":
|
|
167
209
|
elements = buildMultiSelect(config, componentScope);
|
|
168
|
-
buildRule(config);
|
|
169
210
|
break;
|
|
170
211
|
case "LeaderBoard":
|
|
171
212
|
elements = buildLeaderBoard(config);
|
|
@@ -204,7 +245,6 @@ const buildUiSchema = (config: any) => {
|
|
|
204
245
|
});
|
|
205
246
|
}
|
|
206
247
|
}
|
|
207
|
-
localStorage.setItem("libSchema", JSON.stringify(schema || {}))
|
|
208
248
|
return elements;
|
|
209
249
|
}
|
|
210
250
|
|
|
@@ -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" },
|
|
@@ -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",
|
|
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");
|
|
@@ -6,5 +6,5 @@ export {default as pageService} from "../runtime/services/service"
|
|
|
6
6
|
export { schema} from "../builder/build/buildUiSchema"
|
|
7
7
|
export {default as buildConfig} from "../builder/build/buildConfig"
|
|
8
8
|
export {default as buildUiSchema} from "../builder/build/buildUiSchema"
|
|
9
|
-
export {
|
|
9
|
+
export {buildSchema} from "../builder/build/buildUiSchema"
|
|
10
10
|
export {default as clearPreviousCache} from "../builder/services/clearLocalStorage"
|
|
@@ -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
|
|
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);
|