impaktapps-ui-builder 0.0.382-alpha.62 → 0.0.382-alpha.63
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 +68 -71
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +3 -3
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +96 -239
- package/src/impaktapps-ui-builder/runtime/services/events.ts +0 -239
- package/src/impaktapps-ui-builder/runtime/services/interface.ts +0 -12
- package/src/impaktapps-ui-builder/runtime/services/service.ts +0 -209
|
@@ -1,212 +1,3 @@
|
|
|
1
|
-
// import _, { isEmpty } from "lodash";
|
|
2
|
-
// import { doDownload, downloadFile } from "./downloadFile";
|
|
3
|
-
// import { executeEvents, executeRefreshHandler } from "./events";
|
|
4
|
-
// import { handlersProps } from "./interface";
|
|
5
|
-
// let compType: string;
|
|
6
|
-
// let eventGroups: any = {};
|
|
7
|
-
// const notifyUiSchema = {
|
|
8
|
-
// type: "Control",
|
|
9
|
-
// scope: "#/properties/notify",
|
|
10
|
-
// options: {
|
|
11
|
-
// widget: "Notify",
|
|
12
|
-
// },
|
|
13
|
-
// layout: 6,
|
|
14
|
-
// };
|
|
15
|
-
|
|
16
|
-
// export const extractEvents = (eventConfig: any) => {
|
|
17
|
-
// function extractsConfigEvents(eventConfigObj: any) {
|
|
18
|
-
// if (eventConfigObj.events) {
|
|
19
|
-
// eventConfigObj.events.forEach((event: any) => {
|
|
20
|
-
// if (eventConfigObj.type) {
|
|
21
|
-
// compType = eventConfigObj.type;
|
|
22
|
-
// }
|
|
23
|
-
// if (!eventGroups[event.eventType]) {
|
|
24
|
-
// eventGroups[event.eventType] = {};
|
|
25
|
-
// }
|
|
26
|
-
// if (!eventGroups[event.eventType][eventConfigObj.name]) {
|
|
27
|
-
// eventGroups[event.eventType][eventConfigObj.name] = [];
|
|
28
|
-
// }
|
|
29
|
-
// const SuccessEvent = event?.events?.find((elem) => {
|
|
30
|
-
// return elem.eventType === "Success"
|
|
31
|
-
// })
|
|
32
|
-
// if (!(!!SuccessEvent) && event.eventType === "onLoad") {
|
|
33
|
-
// event.events.push({ Handler: "mergeFormdata", eventType: "Success", type: compType, lazyLoading: eventConfig.lazyLoading === "YES" ? true : false })
|
|
34
|
-
// }
|
|
35
|
-
// if (!(!!SuccessEvent) && (event.eventType === "onBack" || event.eventType === "onNext"|| event.eventType === "onReset")) {
|
|
36
|
-
// event.events.push({ Handler: `${event.eventType}Handler`, eventType: "Success", type: compType, lazyLoading: eventConfig.lazyLoading === "YES" ? true : false })
|
|
37
|
-
// }
|
|
38
|
-
// eventGroups[event.eventType][eventConfigObj.name].push({ ...event, type: compType })
|
|
39
|
-
// });
|
|
40
|
-
// }
|
|
41
|
-
// }
|
|
42
|
-
|
|
43
|
-
// extractsConfigEvents(eventConfig)
|
|
44
|
-
// if (eventConfig?.elements) {
|
|
45
|
-
// eventConfig.elements.forEach(extractEvents);
|
|
46
|
-
// }
|
|
47
|
-
// return eventGroups;
|
|
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
|
-
// }
|
|
59
|
-
// export default (funcParams: funcParamsProps) => {
|
|
60
|
-
// eventGroups = {}
|
|
61
|
-
// eventGroups = extractEvents(funcParams.config)
|
|
62
|
-
// let executeEventsParameters: handlersProps = {
|
|
63
|
-
// config: {}, componentName: "",
|
|
64
|
-
// store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
65
|
-
// serviceHolder: { downloadFile,download:doDownload }, eventGroups
|
|
66
|
-
// };
|
|
67
|
-
// return {
|
|
68
|
-
// setPage: async function () {
|
|
69
|
-
// funcParams.store.setFormdata({});
|
|
70
|
-
// executeEventsParameters = {
|
|
71
|
-
// config: {}, componentName: "",
|
|
72
|
-
// store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
73
|
-
// serviceHolder: this, eventGroups
|
|
74
|
-
// }
|
|
75
|
-
// funcParams.store.setSchema(
|
|
76
|
-
// (pre: any) => {
|
|
77
|
-
// return {
|
|
78
|
-
// ...funcParams.schema, properties:
|
|
79
|
-
// { ...funcParams.schema.properties, ...pre.properties, }
|
|
80
|
-
// }
|
|
81
|
-
// }
|
|
82
|
-
// )
|
|
83
|
-
// funcParams.uiSchema.elements.push(notifyUiSchema);
|
|
84
|
-
// funcParams.store.setUiSchema(funcParams.uiSchema);
|
|
85
|
-
// await executeRefreshHandler({
|
|
86
|
-
// config: {}, componentName: "",
|
|
87
|
-
// store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
88
|
-
// serviceHolder: this, eventGroups
|
|
89
|
-
// })
|
|
90
|
-
// },
|
|
91
|
-
// onClick: async function () {
|
|
92
|
-
// await this.callHandler("onClick")
|
|
93
|
-
// },
|
|
94
|
-
// onFileDownload: async function () {
|
|
95
|
-
// await this.callHandler("onDownload")
|
|
96
|
-
// },
|
|
97
|
-
// onFileUpload: async function () {
|
|
98
|
-
// await this.callHandler("onUpload")
|
|
99
|
-
// },
|
|
100
|
-
// onPaginationChange: async function (paginationValues) {
|
|
101
|
-
// const apiBody = [
|
|
102
|
-
// { key: "size", value: paginationValues.pagination.pageSize },
|
|
103
|
-
// { key: "pageIndex", value: paginationValues.pagination.pageIndex },
|
|
104
|
-
// { key: "sorting", value: paginationValues.sorting || [] },
|
|
105
|
-
// { key: "filters", value: paginationValues.columnFilters || [] },
|
|
106
|
-
// { key: "globalFilter", value: paginationValues.globalFilter ?? '' }
|
|
107
|
-
// ]
|
|
108
|
-
// const response = await this.updateConfigApiBody(paginationValues, apiBody);
|
|
109
|
-
// return response?.data;
|
|
110
|
-
// },
|
|
111
|
-
// getSelectOptions: async function (param) {
|
|
112
|
-
// if (param.serachValue !== "" && param.serachValue !== undefined) {
|
|
113
|
-
// const apiBody = [
|
|
114
|
-
// { key: "searchValue", value: param.serachValue },
|
|
115
|
-
// { key: "currentValue", value: param.currentValue }
|
|
116
|
-
// ]
|
|
117
|
-
// return await this.updateConfigApiBody(param, apiBody)
|
|
118
|
-
// }
|
|
119
|
-
// },
|
|
120
|
-
// onChange: async function () {
|
|
121
|
-
// if (eventGroups.onChange) {
|
|
122
|
-
// funcParams.dynamicData?.setLoading(true);
|
|
123
|
-
// const ChangeEventsKeysArray = Object.keys(eventGroups.onChange);
|
|
124
|
-
// Promise.all(ChangeEventsKeysArray.map(async (componentName: string) => {
|
|
125
|
-
// if (
|
|
126
|
-
// funcParams.store?.formData[componentName] !== funcParams.store.newData[componentName] &&
|
|
127
|
-
// funcParams.store?.newData[componentName] !== undefined
|
|
128
|
-
// ) {
|
|
129
|
-
// for (const eventConfig of eventGroups.onChange[componentName]) {
|
|
130
|
-
// await executeEvents({
|
|
131
|
-
// ...executeEventsParameters,
|
|
132
|
-
// config: eventConfig,
|
|
133
|
-
// componentName
|
|
134
|
-
// })
|
|
135
|
-
// }
|
|
136
|
-
// }
|
|
137
|
-
// }))
|
|
138
|
-
// funcParams.dynamicData?.setLoading(false);
|
|
139
|
-
// }
|
|
140
|
-
// },
|
|
141
|
-
// updateConfigApiBody: async function (paramValue, apiBody) {
|
|
142
|
-
// let LastCallResponse = undefined;
|
|
143
|
-
// for (const eventConfig of eventGroups?.onLoad[paramValue.path]) {
|
|
144
|
-
// if (eventConfig.body) {
|
|
145
|
-
// eventConfig.body = [
|
|
146
|
-
// ...eventConfig.body,
|
|
147
|
-
// ...apiBody
|
|
148
|
-
// ]
|
|
149
|
-
// } else { eventConfig.body = apiBody; };
|
|
150
|
-
// const responseEvent = eventConfig?.events?.filter((elem) => {
|
|
151
|
-
// return elem.Handler !== "mergeFormdata"
|
|
152
|
-
// })
|
|
153
|
-
// eventConfig.events = responseEvent ?? []
|
|
154
|
-
// LastCallResponse = await executeEvents({
|
|
155
|
-
// ...executeEventsParameters,
|
|
156
|
-
// config: eventConfig,
|
|
157
|
-
// componentName: paramValue.path
|
|
158
|
-
// })
|
|
159
|
-
// }
|
|
160
|
-
// return LastCallResponse
|
|
161
|
-
// },
|
|
162
|
-
// onBack: async function (functionParameters) {
|
|
163
|
-
// const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
164
|
-
// await this.callHandler("onBack", functionParameters)
|
|
165
|
-
// if (eventGroups?.["onBack"]?.[path] === undefined) {
|
|
166
|
-
// functionParameters?.handleBack()
|
|
167
|
-
// }
|
|
168
|
-
// },
|
|
169
|
-
// onNext: async function (functionParameters) {
|
|
170
|
-
// const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
171
|
-
// await this.callHandler("onNext", functionParameters)
|
|
172
|
-
// if (eventGroups?.["onNext"]?.[path] === undefined) {
|
|
173
|
-
// functionParameters?.handleNext()
|
|
174
|
-
// }
|
|
175
|
-
// },
|
|
176
|
-
// backHandler:()=>{
|
|
177
|
-
// funcParams.store.navigate(-1)
|
|
178
|
-
// },
|
|
179
|
-
// onReset: async function (functionParameters) {
|
|
180
|
-
// const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
181
|
-
// await this.callHandler("onReset", functionParameters)
|
|
182
|
-
// if (eventGroups?.["onReset"]?.[path] === undefined) {
|
|
183
|
-
// functionParameters?.handleReset()
|
|
184
|
-
// }
|
|
185
|
-
// },
|
|
186
|
-
// callHandler: async function (eventType: string, functionParameters?: any) {
|
|
187
|
-
// const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
188
|
-
// if (eventGroups?.[eventType]?.[path] !== undefined) {
|
|
189
|
-
// for (const eventConfig of eventGroups?.[eventType]?.[path]) {
|
|
190
|
-
// executeEventsParameters.store.functionParameters = functionParameters
|
|
191
|
-
// await executeEvents({
|
|
192
|
-
// ...executeEventsParameters,
|
|
193
|
-
// config: eventConfig,
|
|
194
|
-
// componentName: path
|
|
195
|
-
// })
|
|
196
|
-
// }
|
|
197
|
-
// }
|
|
198
|
-
// },
|
|
199
|
-
// downloadFile: downloadFile,
|
|
200
|
-
// download:doDownload,
|
|
201
|
-
// };
|
|
202
|
-
// };
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
1
|
import _, { isEmpty } from "lodash";
|
|
211
2
|
import { doDownload, downloadFile } from "./downloadFile";
|
|
212
3
|
import { asyncOperation, executeEvents, executeRefreshHandler } from "./events";
|