impaktapps-ui-builder 0.0.409-l → 0.0.409-m
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 +54 -95
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +11 -11
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/dist/src/impaktapps-ui-builder/runtime/services/events.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +7 -8
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/services/component.ts +1 -1
- package/src/impaktapps-ui-builder/runtime/services/events.ts +22 -8
- package/src/impaktapps-ui-builder/runtime/services/service.ts +44 -88
|
@@ -1,19 +1,18 @@
|
|
|
1
|
+
export declare const extractEvents: (eventConfig: any) => any;
|
|
1
2
|
interface funcParamsProps {
|
|
2
3
|
store: any;
|
|
3
4
|
dynamicData: any;
|
|
5
|
+
config: any;
|
|
6
|
+
uiSchema: any;
|
|
7
|
+
schema: any;
|
|
4
8
|
service: any;
|
|
5
9
|
userValue: any;
|
|
6
|
-
functionsProvider?: Record<string, any>;
|
|
7
10
|
}
|
|
8
|
-
export declare const extractEvents: (eventConfig: any) => any;
|
|
9
11
|
declare const _default: (funcParams: funcParamsProps) => {
|
|
10
12
|
setPage: () => Promise<void>;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
onFileDownload: () => void;
|
|
15
|
-
onFileUpload: () => void;
|
|
16
|
-
backHandler: () => void;
|
|
13
|
+
onClick: () => Promise<void>;
|
|
14
|
+
onFileDownload: () => Promise<void>;
|
|
15
|
+
onFileUpload: () => Promise<void>;
|
|
17
16
|
onPaginationChange: (paginationValues: any) => Promise<any>;
|
|
18
17
|
getSelectOptions: (param: any) => Promise<any>;
|
|
19
18
|
onChange: () => Promise<void>;
|
package/package.json
CHANGED
|
@@ -56,7 +56,7 @@ export const refreshPage = (type: string, store: any) => {
|
|
|
56
56
|
|
|
57
57
|
}
|
|
58
58
|
const elements = sectionLabels[type]?.map(e => sectionUiSchema[e]);
|
|
59
|
-
UiSchema.elements[1].config.main.tabLabels = sectionLabels[type] || ["Core", "
|
|
59
|
+
UiSchema.elements[1].config.main.tabLabels = sectionLabels[type] || ["Core", "Style", "Event", "Validation"];
|
|
60
60
|
UiSchema.elements[1].elements = elements || [CoreSection, StyleSection, EventSection, ValidationSection];
|
|
61
61
|
|
|
62
62
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import _ from "lodash";
|
|
1
|
+
import _, { cloneDeep } from "lodash";
|
|
3
2
|
import { handlersProps } from "./interface";
|
|
4
3
|
|
|
5
4
|
export const executeEvents = (params: handlersProps) => {
|
|
@@ -7,6 +6,7 @@ export const executeEvents = (params: handlersProps) => {
|
|
|
7
6
|
let finalResponse = null;
|
|
8
7
|
|
|
9
8
|
if (params.config.isSync !== "Yes") {
|
|
9
|
+
|
|
10
10
|
return shouldEventExecute(params)
|
|
11
11
|
.then((shouldExecute) => {
|
|
12
12
|
if (!shouldExecute) {
|
|
@@ -93,6 +93,7 @@ export function getRefreshElements(eventConfig: any, eventGropus: any) {
|
|
|
93
93
|
result.push(result[0]);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
+
console.log(result);
|
|
96
97
|
return result;
|
|
97
98
|
}
|
|
98
99
|
export function executeRefreshHandler(params: handlersProps) {
|
|
@@ -224,9 +225,13 @@ export function shouldEventExecute(params: handlersProps) {
|
|
|
224
225
|
const startEvent = params.config?.events?.filter(e => e.eventType === "onStart");
|
|
225
226
|
|
|
226
227
|
if (startEvent?.length > 0) {
|
|
227
|
-
|
|
228
|
-
return response
|
|
229
|
-
|
|
228
|
+
if (startEvent[0]?.isSync !== "Yes") {
|
|
229
|
+
return executeEventsHandler({ ...params, config: startEvent[0] }).then((response) => {
|
|
230
|
+
return response;
|
|
231
|
+
});
|
|
232
|
+
} else {
|
|
233
|
+
return executeEventsHandler({ ...params, config: startEvent[0] })
|
|
234
|
+
}
|
|
230
235
|
} else {
|
|
231
236
|
if (params.config.isSync !== "Yes") {
|
|
232
237
|
return Promise.resolve(true)
|
|
@@ -252,8 +257,17 @@ export function buildApiPayload(compConfig: any, body: any, headers: any, store:
|
|
|
252
257
|
if (compConfig.apiBody) {
|
|
253
258
|
const makeFunc = eval(compConfig.apiBody);
|
|
254
259
|
return { body: makeFunc(store, dynamicData, userValue, promiseChain.body), headers: promiseChain.headers };
|
|
255
|
-
// return result;
|
|
256
|
-
|
|
257
260
|
}
|
|
258
261
|
return promiseChain;
|
|
259
|
-
}
|
|
262
|
+
}
|
|
263
|
+
export function asyncOperation() {
|
|
264
|
+
return new Promise((resolve, reject) => {
|
|
265
|
+
setTimeout(() => {
|
|
266
|
+
const success = true;
|
|
267
|
+
if (success) {
|
|
268
|
+
resolve("Operation completed successfully!");
|
|
269
|
+
reject(new Error("Operation failed!"));
|
|
270
|
+
}
|
|
271
|
+
}, 50);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _, { isEmpty } from "lodash";
|
|
2
2
|
import { doDownload, downloadFile } from "./downloadFile";
|
|
3
|
-
import { executeEvents, executeRefreshHandler } from "./events";
|
|
3
|
+
import { asyncOperation, executeEvents, executeRefreshHandler } from "./events";
|
|
4
4
|
import { handlersProps } from "./interface";
|
|
5
5
|
let compType: string;
|
|
6
6
|
let eventGroups: any = {};
|
|
@@ -13,14 +13,6 @@ const notifyUiSchema = {
|
|
|
13
13
|
layout: 6,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
interface funcParamsProps {
|
|
17
|
-
store: any,
|
|
18
|
-
dynamicData: any,
|
|
19
|
-
service: any,
|
|
20
|
-
userValue: any,
|
|
21
|
-
functionsProvider?: Record<string, any>
|
|
22
|
-
}
|
|
23
|
-
|
|
24
16
|
export const extractEvents = (eventConfig: any) => {
|
|
25
17
|
function extractsConfigEvents(eventConfigObj: any) {
|
|
26
18
|
if (eventConfigObj.events) {
|
|
@@ -54,53 +46,41 @@ export const extractEvents = (eventConfig: any) => {
|
|
|
54
46
|
}
|
|
55
47
|
return eventGroups;
|
|
56
48
|
};
|
|
49
|
+
|
|
50
|
+
interface funcParamsProps {
|
|
51
|
+
store: any,
|
|
52
|
+
dynamicData: any,
|
|
53
|
+
config: any,
|
|
54
|
+
uiSchema: any,
|
|
55
|
+
schema: any,
|
|
56
|
+
service: any,
|
|
57
|
+
userValue: any,
|
|
58
|
+
}
|
|
57
59
|
export default (funcParams: funcParamsProps) => {
|
|
60
|
+
eventGroups = {}
|
|
61
|
+
eventGroups = extractEvents(funcParams.config)
|
|
58
62
|
let executeEventsParameters: handlersProps = {
|
|
59
63
|
config: {}, componentName: "",
|
|
60
64
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
61
|
-
serviceHolder: { downloadFile, download: doDownload
|
|
62
|
-
functionsProvider: funcParams.functionsProvider,
|
|
65
|
+
serviceHolder: { downloadFile, download: doDownload }, eventGroups
|
|
63
66
|
};
|
|
64
67
|
return {
|
|
65
68
|
setPage: async function () {
|
|
66
|
-
funcParams.store.setFormdata({})
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (pageBasicDetailString) {
|
|
73
|
-
pageData = JSON.parse(pageBasicDetailString)
|
|
74
|
-
} else {
|
|
75
|
-
const pageId = await funcParams.service
|
|
76
|
-
.post("/page/getByName", data, {
|
|
77
|
-
headers: {
|
|
78
|
-
"Content-Type": "application/json",
|
|
79
|
-
},
|
|
80
|
-
});
|
|
81
|
-
const response = await funcParams.service.get(
|
|
82
|
-
`/page/getById?id=${pageId?.data?.id}`,
|
|
83
|
-
{
|
|
84
|
-
headers: {
|
|
85
|
-
"Content-Type": "application/json",
|
|
86
|
-
},
|
|
69
|
+
funcParams.store.setFormdata({});
|
|
70
|
+
funcParams.store.setSchema(
|
|
71
|
+
(pre: any) => {
|
|
72
|
+
return {
|
|
73
|
+
...funcParams.schema, properties:
|
|
74
|
+
{ ...funcParams.schema.properties, ...pre.properties, }
|
|
87
75
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}))
|
|
94
|
-
}
|
|
95
|
-
const config = pageData?.config;
|
|
96
|
-
const uiSchema = pageData?.uiSchema;
|
|
97
|
-
const schema = pageData?.schema ?? { type: "object", properties: {} };
|
|
98
|
-
eventGroups = {}
|
|
99
|
-
eventGroups = extractEvents(config);
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
funcParams.uiSchema.elements.push(notifyUiSchema);
|
|
79
|
+
funcParams.store.setUiSchema(funcParams.uiSchema);
|
|
80
|
+
await asyncOperation()
|
|
100
81
|
executeEventsParameters = {
|
|
101
82
|
config: {}, componentName: "",
|
|
102
83
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
103
|
-
functionsProvider: funcParams.functionsProvider,
|
|
104
84
|
serviceHolder: this, eventGroups
|
|
105
85
|
}
|
|
106
86
|
await executeRefreshHandler({
|
|
@@ -108,47 +88,15 @@ export default (funcParams: funcParamsProps) => {
|
|
|
108
88
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
109
89
|
serviceHolder: this, eventGroups
|
|
110
90
|
})
|
|
111
|
-
funcParams.store.setSchema(
|
|
112
|
-
(pre: any) => {
|
|
113
|
-
return {
|
|
114
|
-
...schema, properties:
|
|
115
|
-
{ ...schema.properties, ...pre.properties, }
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
)
|
|
119
|
-
uiSchema.elements.push(notifyUiSchema);
|
|
120
|
-
funcParams.store.setUiSchema(uiSchema);
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
onCellRenderer: (cellParams) => {
|
|
124
|
-
let finalResponse = {};
|
|
125
|
-
// cellParams.spanRef.current.style.color = "yellow";
|
|
126
|
-
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
127
|
-
for (const eventConfig of eventGroups?.onCellRenderer[path]) {
|
|
128
|
-
executeEventsParameters.store.functionParameters = cellParams
|
|
129
|
-
finalResponse = executeEvents({
|
|
130
|
-
...executeEventsParameters,
|
|
131
|
-
config: eventConfig,
|
|
132
|
-
componentName: path
|
|
133
|
-
})
|
|
134
|
-
}
|
|
135
|
-
console.log("finalResponse >> >> >> ", finalResponse)
|
|
136
|
-
return finalResponse
|
|
137
|
-
},
|
|
138
|
-
onClick: function () {
|
|
139
|
-
this.callHandler("onClick")
|
|
140
|
-
},
|
|
141
|
-
onMount: function () {
|
|
142
|
-
this.callHandler("onMount")
|
|
143
91
|
},
|
|
144
|
-
|
|
145
|
-
this.callHandler("
|
|
92
|
+
onClick: async function () {
|
|
93
|
+
await this.callHandler("onClick")
|
|
146
94
|
},
|
|
147
|
-
|
|
148
|
-
this.callHandler("
|
|
95
|
+
onFileDownload: async function () {
|
|
96
|
+
await this.callHandler("onDownload")
|
|
149
97
|
},
|
|
150
|
-
|
|
151
|
-
|
|
98
|
+
onFileUpload: async function () {
|
|
99
|
+
await this.callHandler("onUpload")
|
|
152
100
|
},
|
|
153
101
|
onPaginationChange: async function (paginationValues) {
|
|
154
102
|
const apiBody = [
|
|
@@ -167,8 +115,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
167
115
|
{ key: "searchValue", value: param.serachValue },
|
|
168
116
|
{ key: "currentValue", value: param.currentValue }
|
|
169
117
|
]
|
|
170
|
-
|
|
171
|
-
return response?.data;
|
|
118
|
+
return await this.updateConfigApiBody(param, apiBody)
|
|
172
119
|
}
|
|
173
120
|
},
|
|
174
121
|
onChange: async function () {
|
|
@@ -237,7 +184,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
237
184
|
if (eventGroups?.[eventType]?.[path] !== undefined) {
|
|
238
185
|
for (const eventConfig of eventGroups?.[eventType]?.[path]) {
|
|
239
186
|
executeEventsParameters.store.functionParameters = functionParameters
|
|
240
|
-
|
|
187
|
+
await executeEvents({
|
|
241
188
|
...executeEventsParameters,
|
|
242
189
|
config: eventConfig,
|
|
243
190
|
componentName: path
|
|
@@ -245,9 +192,18 @@ export default (funcParams: funcParamsProps) => {
|
|
|
245
192
|
}
|
|
246
193
|
}
|
|
247
194
|
},
|
|
248
|
-
|
|
249
195
|
downloadFile: downloadFile,
|
|
250
196
|
download: doDownload,
|
|
251
|
-
...funcParams.functionsProvider
|
|
252
197
|
};
|
|
253
198
|
};
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|