impaktapps-ui-builder 0.0.383 → 0.0.382456
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 +395 -55
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +14 -14
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/dist/src/impaktapps-ui-builder/builder/build/buildDataGrid.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildPop.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildStepper.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/runtime/services/downloadFile.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +5 -0
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildButton.ts +2 -0
- package/src/impaktapps-ui-builder/builder/build/buildDataGrid.ts +51 -0
- package/src/impaktapps-ui-builder/builder/build/buildFileInput.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildPop.ts +43 -0
- package/src/impaktapps-ui-builder/builder/build/buildRadio.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildStepper.ts +45 -0
- package/src/impaktapps-ui-builder/builder/build/buildTable.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +28 -8
- package/src/impaktapps-ui-builder/builder/build/buildWrapperSection.ts +7 -0
- package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +109 -1
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +43 -0
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +7 -3
- package/src/impaktapps-ui-builder/builder/services/component.ts +3 -0
- package/src/impaktapps-ui-builder/builder/services/event.ts +1 -0
- package/src/impaktapps-ui-builder/builder/services/utils.ts +1 -1
- package/src/impaktapps-ui-builder/runtime/services/downloadFile.ts +22 -7
- package/src/impaktapps-ui-builder/runtime/services/events.ts +26 -5
- package/src/impaktapps-ui-builder/runtime/services/service.ts +52 -35
|
@@ -44,9 +44,18 @@ async function executeEventsHandler(params: handlersProps) {
|
|
|
44
44
|
}
|
|
45
45
|
else if (params.config.Handler === "mergeFormdata") {
|
|
46
46
|
const result = await mergeFormdata(
|
|
47
|
-
params.parentEventOutput, params.componentName, params.config, params.store,params.service)
|
|
47
|
+
params.parentEventOutput, params.componentName, params.config, params.store, params.service)
|
|
48
48
|
return result;
|
|
49
49
|
}
|
|
50
|
+
else if (params.config.Handler === "onBackHandler") {
|
|
51
|
+
return params.store.functionParameters?.handleBack()
|
|
52
|
+
}
|
|
53
|
+
else if (params.config.Handler === "onNextHandler") {
|
|
54
|
+
return params.store.functionParameters?.handleNext()
|
|
55
|
+
}
|
|
56
|
+
else if (params.config.Handler === "onResetHandler") {
|
|
57
|
+
return params.store.functionParameters?.handleReset()
|
|
58
|
+
}
|
|
50
59
|
}
|
|
51
60
|
export async function executeRefreshHandler(params: handlersProps) {
|
|
52
61
|
const compToRefresh: string[] = getRefreshElements(params.config, params.eventGroups)
|
|
@@ -87,7 +96,7 @@ async function executeCustomHandler(params: handlersProps) {
|
|
|
87
96
|
return response;
|
|
88
97
|
}
|
|
89
98
|
|
|
90
|
-
async function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any,service:any) {
|
|
99
|
+
async function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any, service: any) {
|
|
91
100
|
if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
|
|
92
101
|
store.setSchema((pre) => {
|
|
93
102
|
return {
|
|
@@ -108,7 +117,7 @@ async function mergeFormdata(handlerResponse: any, componentName: string, eventC
|
|
|
108
117
|
...pre.properties?.[componentName],
|
|
109
118
|
type: "array",
|
|
110
119
|
items: {
|
|
111
|
-
oneOf: handlerResponse
|
|
120
|
+
oneOf: handlerResponse?.data
|
|
112
121
|
}
|
|
113
122
|
}
|
|
114
123
|
}
|
|
@@ -123,7 +132,7 @@ async function mergeFormdata(handlerResponse: any, componentName: string, eventC
|
|
|
123
132
|
else {
|
|
124
133
|
if (handlerResponse) {
|
|
125
134
|
store.setFormdata((pre) => { return { ...pre, [componentName]: eventConfig.lazyLoading ? handlerResponse.data.data : handlerResponse.data } });
|
|
126
|
-
const demoData =
|
|
135
|
+
const demoData = await asyncOperation();
|
|
127
136
|
}
|
|
128
137
|
}
|
|
129
138
|
}
|
|
@@ -165,7 +174,7 @@ async function shouldEventExecute(params: handlersProps) {
|
|
|
165
174
|
if (startEvent?.length > 0) {
|
|
166
175
|
const response = await executeEventsHandler({ ...params, config: startEvent[0] });
|
|
167
176
|
return response;
|
|
168
|
-
}else{
|
|
177
|
+
} else {
|
|
169
178
|
return true
|
|
170
179
|
}
|
|
171
180
|
}
|
|
@@ -203,3 +212,15 @@ export function getRefreshElements(eventConfig: any, eventGropus: any) {
|
|
|
203
212
|
return result;
|
|
204
213
|
}
|
|
205
214
|
|
|
215
|
+
|
|
216
|
+
function asyncOperation() {
|
|
217
|
+
return new Promise((resolve, reject) => {
|
|
218
|
+
setTimeout(() => {
|
|
219
|
+
const success = true;
|
|
220
|
+
if (success) {
|
|
221
|
+
resolve("Operation completed successfully!");
|
|
222
|
+
reject(new Error("Operation failed!"));
|
|
223
|
+
}
|
|
224
|
+
}, 50);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _ from "lodash";
|
|
2
|
-
import { downloadFile } from "./downloadFile";
|
|
1
|
+
import _, { isEmpty } from "lodash";
|
|
2
|
+
import { doDownload, downloadFile } from "./downloadFile";
|
|
3
3
|
import { executeEvents, executeRefreshHandler } from "./events";
|
|
4
4
|
import { handlersProps } from "./interface";
|
|
5
5
|
let compType: string;
|
|
@@ -30,7 +30,10 @@ export const extractEvents = (eventConfig: any) => {
|
|
|
30
30
|
return elem.eventType === "Success"
|
|
31
31
|
})
|
|
32
32
|
if (!(!!SuccessEvent) && event.eventType === "onLoad") {
|
|
33
|
-
event.events.push({ Handler: "mergeFormdata", eventType: "Success", type: compType,lazyLoading:eventConfig.lazyLoading==="YES"?true:false })
|
|
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 })
|
|
34
37
|
}
|
|
35
38
|
eventGroups[event.eventType][eventConfigObj.name].push({ ...event, type: compType })
|
|
36
39
|
});
|
|
@@ -59,7 +62,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
59
62
|
let executeEventsParameters: handlersProps = {
|
|
60
63
|
config: {}, componentName: "",
|
|
61
64
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
62
|
-
serviceHolder: {downloadFile}, eventGroups
|
|
65
|
+
serviceHolder: { downloadFile,download:doDownload }, eventGroups
|
|
63
66
|
};
|
|
64
67
|
return {
|
|
65
68
|
setPage: async function () {
|
|
@@ -76,54 +79,33 @@ export default (funcParams: funcParamsProps) => {
|
|
|
76
79
|
{ ...funcParams.schema.properties, ...pre.properties, }
|
|
77
80
|
}
|
|
78
81
|
}
|
|
79
|
-
|
|
82
|
+
)
|
|
80
83
|
funcParams.uiSchema.elements.push(notifyUiSchema);
|
|
81
84
|
funcParams.store.setUiSchema(funcParams.uiSchema);
|
|
82
|
-
await executeRefreshHandler(
|
|
85
|
+
await executeRefreshHandler({
|
|
83
86
|
config: {}, componentName: "",
|
|
84
87
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
85
88
|
serviceHolder: this, eventGroups
|
|
86
89
|
})
|
|
87
90
|
},
|
|
88
91
|
onClick: async function () {
|
|
89
|
-
|
|
90
|
-
for (const eventConfig of eventGroups?.onClick[path]) {
|
|
91
|
-
await executeEvents({
|
|
92
|
-
...executeEventsParameters,
|
|
93
|
-
config: eventConfig,
|
|
94
|
-
componentName: path
|
|
95
|
-
})
|
|
96
|
-
}
|
|
92
|
+
await this.callHandler("onClick")
|
|
97
93
|
},
|
|
98
|
-
onFileDownload:async ()
|
|
99
|
-
|
|
100
|
-
for (const eventConfig of eventGroups?.onDownload[path]) {
|
|
101
|
-
await executeEvents({
|
|
102
|
-
...executeEventsParameters,
|
|
103
|
-
config: eventConfig,
|
|
104
|
-
componentName: path
|
|
105
|
-
})
|
|
106
|
-
}
|
|
94
|
+
onFileDownload: async function () {
|
|
95
|
+
await this.callHandler("onDownload")
|
|
107
96
|
},
|
|
108
|
-
onFileUpload:async ()
|
|
109
|
-
|
|
110
|
-
for (const eventConfig of eventGroups?.onUpload[path]) {
|
|
111
|
-
await executeEvents({
|
|
112
|
-
...executeEventsParameters,
|
|
113
|
-
config: eventConfig,
|
|
114
|
-
componentName: path
|
|
115
|
-
})
|
|
116
|
-
}
|
|
97
|
+
onFileUpload: async function () {
|
|
98
|
+
await this.callHandler("onUpload")
|
|
117
99
|
},
|
|
118
100
|
onPaginationChange: async function (paginationValues) {
|
|
119
101
|
const apiBody = [
|
|
120
102
|
{ key: "size", value: paginationValues.pagination.pageSize },
|
|
121
|
-
{ key: "pageIndex", value: paginationValues.pagination.pageIndex
|
|
103
|
+
{ key: "pageIndex", value: paginationValues.pagination.pageIndex },
|
|
122
104
|
{ key: "sorting", value: paginationValues.sorting || [] },
|
|
123
105
|
{ key: "filters", value: paginationValues.columnFilters || [] },
|
|
124
106
|
{ key: "globalFilter", value: paginationValues.globalFilter ?? '' }
|
|
125
107
|
]
|
|
126
|
-
const response =
|
|
108
|
+
const response = await this.updateConfigApiBody(paginationValues, apiBody);
|
|
127
109
|
return response?.data;
|
|
128
110
|
},
|
|
129
111
|
getSelectOptions: async function (param) {
|
|
@@ -175,7 +157,42 @@ export default (funcParams: funcParamsProps) => {
|
|
|
175
157
|
}
|
|
176
158
|
return LastCallResponse
|
|
177
159
|
},
|
|
178
|
-
|
|
160
|
+
onBack: async function (functionParameters) {
|
|
161
|
+
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
162
|
+
await this.callHandler("onBack", functionParameters)
|
|
163
|
+
if (eventGroups?.["onBack"]?.[path] === undefined) {
|
|
164
|
+
functionParameters?.handleBack()
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
onNext: async function (functionParameters) {
|
|
168
|
+
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
169
|
+
await this.callHandler("onNext", functionParameters)
|
|
170
|
+
if (eventGroups?.["onNext"]?.[path] === undefined) {
|
|
171
|
+
functionParameters?.handleNext()
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
onReset: async function (functionParameters) {
|
|
175
|
+
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
176
|
+
await this.callHandler("onReset", functionParameters)
|
|
177
|
+
if (eventGroups?.["onReset"]?.[path] === undefined) {
|
|
178
|
+
functionParameters?.handleReset()
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
callHandler: async function (eventType: string, functionParameters?: any) {
|
|
182
|
+
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
183
|
+
if (eventGroups?.[eventType]?.[path] !== undefined) {
|
|
184
|
+
for (const eventConfig of eventGroups?.[eventType]?.[path]) {
|
|
185
|
+
executeEventsParameters.store.functionParameters = functionParameters
|
|
186
|
+
await executeEvents({
|
|
187
|
+
...executeEventsParameters,
|
|
188
|
+
config: eventConfig,
|
|
189
|
+
componentName: path
|
|
190
|
+
})
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
downloadFile: downloadFile,
|
|
195
|
+
download:doDownload,
|
|
179
196
|
};
|
|
180
197
|
};
|
|
181
198
|
|