impaktapps-ui-builder 1.0.120 → 1.0.121
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 +143 -162
- 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/builder/build/buildUiSchema.d.ts +2 -1
- package/dist/src/impaktapps-ui-builder/lib/index.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/runtime/services/downloadFile.d.ts +5 -2
- package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +4 -3
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildCard.ts +3 -3
- package/src/impaktapps-ui-builder/builder/build/buildTable.ts +12 -9
- package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +63 -115
- package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +6 -6
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +7 -6
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +3 -1
- package/src/impaktapps-ui-builder/builder/services/component.ts +1 -1
- package/src/impaktapps-ui-builder/builder/services/pageMaster.ts +14 -14
- package/src/impaktapps-ui-builder/lib/index.ts +10 -9
- package/src/impaktapps-ui-builder/runtime/services/downloadFile.ts +33 -18
- package/src/impaktapps-ui-builder/runtime/services/events.ts +8 -10
- package/src/impaktapps-ui-builder/runtime/services/service.ts +51 -33
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _ from "lodash";
|
|
1
|
+
import _, { isObject, mapKeys } from "lodash";
|
|
2
2
|
import { handlersProps } from "./interface";
|
|
3
3
|
export const executeEvents = (params: handlersProps) => {
|
|
4
4
|
let nextEvent = [];
|
|
@@ -68,8 +68,7 @@ function executeEventsHandler(params: handlersProps) {
|
|
|
68
68
|
params.componentName,
|
|
69
69
|
params.config,
|
|
70
70
|
params.store,
|
|
71
|
-
params.
|
|
72
|
-
params.formDataHolder
|
|
71
|
+
params.formDataHolder,
|
|
73
72
|
);
|
|
74
73
|
} else if (params.config.Handler === "onBackHandler") {
|
|
75
74
|
return params.store.functionParameters?.handleBack();
|
|
@@ -144,8 +143,7 @@ function executeCustomHandler(params: handlersProps) {
|
|
|
144
143
|
}
|
|
145
144
|
|
|
146
145
|
}
|
|
147
|
-
|
|
148
|
-
function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any, service: any, formDataHolder: any) {
|
|
146
|
+
function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any, formDataHolder: any) {
|
|
149
147
|
if (eventConfig.type === "Select" && handlerResponse?.data) {
|
|
150
148
|
if (!_.isEmpty(handlerResponse?.data)) {
|
|
151
149
|
store.setSchema((pre) => {
|
|
@@ -178,28 +176,28 @@ function mergeFormdata(handlerResponse: any, componentName: string, eventConfig:
|
|
|
178
176
|
}
|
|
179
177
|
}
|
|
180
178
|
else if (eventConfig.type === "page") {
|
|
181
|
-
if (!(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
|
|
179
|
+
if (!(_.isEmpty(handlerResponse?.data) && handlerResponse?.data && isObject(handlerResponse.data))) {
|
|
182
180
|
store.newData = {
|
|
183
181
|
...store.newData,
|
|
184
182
|
...handlerResponse?.data
|
|
185
183
|
}
|
|
186
|
-
|
|
184
|
+
Object.keys(handlerResponse.data).forEach((e) => {
|
|
185
|
+
formDataHolder[e] = handlerResponse.data[e]
|
|
186
|
+
})
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
else if (eventConfig.type === "Table" && eventConfig.lazyLoading) {
|
|
190
190
|
if (handlerResponse && handlerResponse?.data) {
|
|
191
191
|
formDataHolder[componentName] = handlerResponse.data?.data
|
|
192
192
|
formDataHolder[`${componentName}_RowCount`] = handlerResponse.data?.meta?.totalRowCount
|
|
193
|
-
store.setFormdata((pre) => { return { ...pre, ...formDataHolder } });
|
|
194
193
|
}
|
|
195
194
|
}
|
|
196
195
|
else {
|
|
197
196
|
if (handlerResponse) {
|
|
198
197
|
formDataHolder[componentName] = handlerResponse.data
|
|
199
|
-
store.setFormdata((pre) => { return { ...pre, ...formDataHolder } });
|
|
200
198
|
}
|
|
201
199
|
}
|
|
202
|
-
}
|
|
200
|
+
};
|
|
203
201
|
|
|
204
202
|
const buildBodyFormat = (body: any[], formData: any, userValue: any, store: any) => {
|
|
205
203
|
let finalBody = { ...userValue?.payload };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _, { isEmpty } from "lodash";
|
|
2
|
-
import {
|
|
2
|
+
import { downloadFileFromUrl, downloadFile } from "./downloadFile";
|
|
3
3
|
import { executeEvents, executeRefreshHandler } from "./events";
|
|
4
4
|
import { handlersProps } from "./interface";
|
|
5
5
|
let compType: string;
|
|
@@ -62,11 +62,11 @@ export const extractEvents = (eventConfig: any) => {
|
|
|
62
62
|
return eventGroups;
|
|
63
63
|
};
|
|
64
64
|
export default (funcParams: funcParamsProps) => {
|
|
65
|
-
const formDataHolder = {}
|
|
65
|
+
const formDataHolder = {};
|
|
66
66
|
let executeEventsParameters: handlersProps = {
|
|
67
67
|
config: {}, componentName: "",
|
|
68
68
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
69
|
-
serviceHolder: { downloadFile, download:
|
|
69
|
+
serviceHolder: { downloadFile, download: downloadFileFromUrl, ...funcParams.functionsProvider }, eventGroups,
|
|
70
70
|
functionsProvider: funcParams.functionsProvider, formDataHolder
|
|
71
71
|
};
|
|
72
72
|
return {
|
|
@@ -93,7 +93,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
93
93
|
config: {}, componentName: "",
|
|
94
94
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
95
95
|
functionsProvider: funcParams.functionsProvider,
|
|
96
|
-
serviceHolder: this, eventGroups, formDataHolder
|
|
96
|
+
serviceHolder: this, eventGroups, formDataHolder,
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
funcParams.store.setSchema(
|
|
@@ -104,29 +104,32 @@ export default (funcParams: funcParamsProps) => {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
)
|
|
107
|
-
|
|
107
|
+
executeRefreshHandler({
|
|
108
108
|
config: {}, componentName: "",
|
|
109
109
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
110
|
-
serviceHolder: this, eventGroups, formDataHolder:
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
serviceHolder: this, eventGroups, formDataHolder: formDataHolder
|
|
111
|
+
}).then((e) => {
|
|
112
|
+
funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }))
|
|
113
|
+
uiSchema.elements.push(notifyUiSchema);
|
|
114
|
+
funcParams.store.setUiSchema(uiSchema);
|
|
115
|
+
});
|
|
115
116
|
},
|
|
116
117
|
onCellRenderer: (cellParams) => {
|
|
117
|
-
|
|
118
|
+
const cloneEventGroup = _.cloneDeep(eventGroups)
|
|
119
|
+
if (cloneEventGroup.onCellRenderer) {
|
|
118
120
|
let finalResponse = {};
|
|
119
121
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams?.dynamicData?.path?.split(".")[0];
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
if (cloneEventGroup?.onCellRenderer?.[path]) {
|
|
123
|
+
for (const eventConfig of cloneEventGroup?.onCellRenderer?.[path]) {
|
|
124
|
+
executeEventsParameters.store.functionParameters = cellParams
|
|
125
|
+
finalResponse = executeEvents({
|
|
126
|
+
...executeEventsParameters,
|
|
127
|
+
config: eventConfig,
|
|
128
|
+
componentName: path
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
return finalResponse
|
|
128
132
|
}
|
|
129
|
-
return finalResponse
|
|
130
133
|
}
|
|
131
134
|
return {}
|
|
132
135
|
},
|
|
@@ -168,7 +171,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
168
171
|
{ key: "sorting", value: paginationValues.sorting || [] },
|
|
169
172
|
{ key: "filters", value: paginationValues.tableColumnConfig || [] },
|
|
170
173
|
{ key: "globalFilter", value: paginationValues.globalFilter ?? '' },
|
|
171
|
-
{ key: "expandedRowIds", value: paginationValues.expandedRowIds ?? []}
|
|
174
|
+
{ key: "expandedRowIds", value: paginationValues.expandedRowIds ?? [] }
|
|
172
175
|
]
|
|
173
176
|
const response = await this.callExecuteEvents(paginationValues, apiBody, "onLoad");
|
|
174
177
|
return response?.data;
|
|
@@ -195,8 +198,12 @@ export default (funcParams: funcParamsProps) => {
|
|
|
195
198
|
await executeEvents({
|
|
196
199
|
...executeEventsParameters,
|
|
197
200
|
config: eventConfig,
|
|
198
|
-
componentName
|
|
201
|
+
componentName,
|
|
202
|
+
formDataHolder
|
|
199
203
|
})
|
|
204
|
+
if (eventConfig.Handler === "refresh") {
|
|
205
|
+
funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }));
|
|
206
|
+
}
|
|
200
207
|
}
|
|
201
208
|
}
|
|
202
209
|
}))
|
|
@@ -226,40 +233,51 @@ export default (funcParams: funcParamsProps) => {
|
|
|
226
233
|
},
|
|
227
234
|
onBack: async function (functionParameters) {
|
|
228
235
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
229
|
-
|
|
236
|
+
this.callHandler("onBack", functionParameters)
|
|
230
237
|
if (eventGroups?.["onBack"]?.[path] === undefined) {
|
|
231
238
|
functionParameters?.handleBack()
|
|
232
239
|
}
|
|
233
240
|
},
|
|
234
241
|
onNext: async function (functionParameters) {
|
|
235
242
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
236
|
-
|
|
243
|
+
this.callHandler("onNext", functionParameters)
|
|
237
244
|
if (eventGroups?.["onNext"]?.[path] === undefined) {
|
|
238
245
|
functionParameters?.handleNext()
|
|
239
246
|
}
|
|
240
247
|
},
|
|
241
248
|
onReset: async function (functionParameters) {
|
|
242
249
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
243
|
-
|
|
250
|
+
this.callHandler("onReset", functionParameters)
|
|
244
251
|
if (eventGroups?.["onReset"]?.[path] === undefined) {
|
|
245
252
|
functionParameters?.handleReset()
|
|
246
253
|
}
|
|
247
254
|
},
|
|
248
|
-
callHandler:
|
|
255
|
+
callHandler: function (eventType: string, functionParameters?: any) {
|
|
249
256
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[funcParams.dynamicData.path.split(".").length - 1];
|
|
250
257
|
if (eventGroups?.[eventType]?.[path] !== undefined) {
|
|
251
|
-
|
|
258
|
+
(eventGroups?.[eventType]?.[path].map((eventConfig) => {
|
|
252
259
|
executeEventsParameters.store.functionParameters = functionParameters
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
260
|
+
if (eventConfig.Handler === "refresh") {
|
|
261
|
+
executeEvents({
|
|
262
|
+
...executeEventsParameters,
|
|
263
|
+
config: eventConfig,
|
|
264
|
+
componentName: path,
|
|
265
|
+
formDataHolder: formDataHolder
|
|
266
|
+
}).then((res) => {
|
|
267
|
+
funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }));
|
|
268
|
+
});
|
|
269
|
+
} else {
|
|
270
|
+
executeEvents({
|
|
271
|
+
...executeEventsParameters,
|
|
272
|
+
config: eventConfig,
|
|
273
|
+
componentName: path
|
|
274
|
+
})
|
|
275
|
+
}
|
|
258
276
|
}))
|
|
259
277
|
}
|
|
260
278
|
},
|
|
261
279
|
downloadFile: downloadFile,
|
|
262
|
-
|
|
280
|
+
downloadFileFromUrl: downloadFileFromUrl,
|
|
263
281
|
...funcParams.functionsProvider
|
|
264
282
|
};
|
|
265
283
|
};
|