impaktapps-ui-builder 1.0.120 → 1.0.122
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 +144 -166
- 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 +52 -37
|
@@ -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,20 +62,17 @@ 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 {
|
|
73
73
|
setPage: async function () {
|
|
74
74
|
funcParams.store.setAdditionalErrors([]);
|
|
75
|
-
funcParams.store.setFormdata((
|
|
76
|
-
...pre,
|
|
77
|
-
...(funcParams?.initFormData())
|
|
78
|
-
}));
|
|
75
|
+
funcParams.store.setFormdata(funcParams?.initFormData() || {});
|
|
79
76
|
funcParams.store.setSchema({ type: "object", properties: {} });
|
|
80
77
|
funcParams.store.newData = {};
|
|
81
78
|
eventGroups = {};
|
|
@@ -93,7 +90,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
93
90
|
config: {}, componentName: "",
|
|
94
91
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
95
92
|
functionsProvider: funcParams.functionsProvider,
|
|
96
|
-
serviceHolder: this, eventGroups, formDataHolder
|
|
93
|
+
serviceHolder: this, eventGroups, formDataHolder,
|
|
97
94
|
}
|
|
98
95
|
|
|
99
96
|
funcParams.store.setSchema(
|
|
@@ -104,29 +101,32 @@ export default (funcParams: funcParamsProps) => {
|
|
|
104
101
|
}
|
|
105
102
|
}
|
|
106
103
|
)
|
|
107
|
-
|
|
104
|
+
executeRefreshHandler({
|
|
108
105
|
config: {}, componentName: "",
|
|
109
106
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
110
|
-
serviceHolder: this, eventGroups, formDataHolder:
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
107
|
+
serviceHolder: this, eventGroups, formDataHolder: formDataHolder
|
|
108
|
+
}).then((e) => {
|
|
109
|
+
funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }))
|
|
110
|
+
uiSchema.elements.push(notifyUiSchema);
|
|
111
|
+
funcParams.store.setUiSchema(uiSchema);
|
|
112
|
+
});
|
|
115
113
|
},
|
|
116
114
|
onCellRenderer: (cellParams) => {
|
|
117
|
-
|
|
115
|
+
const cloneEventGroup = _.cloneDeep(eventGroups)
|
|
116
|
+
if (cloneEventGroup.onCellRenderer) {
|
|
118
117
|
let finalResponse = {};
|
|
119
118
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams?.dynamicData?.path?.split(".")[0];
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
119
|
+
if (cloneEventGroup?.onCellRenderer?.[path]) {
|
|
120
|
+
for (const eventConfig of cloneEventGroup?.onCellRenderer?.[path]) {
|
|
121
|
+
executeEventsParameters.store.functionParameters = cellParams
|
|
122
|
+
finalResponse = executeEvents({
|
|
123
|
+
...executeEventsParameters,
|
|
124
|
+
config: eventConfig,
|
|
125
|
+
componentName: path
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
return finalResponse
|
|
128
129
|
}
|
|
129
|
-
return finalResponse
|
|
130
130
|
}
|
|
131
131
|
return {}
|
|
132
132
|
},
|
|
@@ -168,7 +168,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
168
168
|
{ key: "sorting", value: paginationValues.sorting || [] },
|
|
169
169
|
{ key: "filters", value: paginationValues.tableColumnConfig || [] },
|
|
170
170
|
{ key: "globalFilter", value: paginationValues.globalFilter ?? '' },
|
|
171
|
-
{ key: "expandedRowIds", value: paginationValues.expandedRowIds ?? []}
|
|
171
|
+
{ key: "expandedRowIds", value: paginationValues.expandedRowIds ?? [] }
|
|
172
172
|
]
|
|
173
173
|
const response = await this.callExecuteEvents(paginationValues, apiBody, "onLoad");
|
|
174
174
|
return response?.data;
|
|
@@ -195,8 +195,12 @@ export default (funcParams: funcParamsProps) => {
|
|
|
195
195
|
await executeEvents({
|
|
196
196
|
...executeEventsParameters,
|
|
197
197
|
config: eventConfig,
|
|
198
|
-
componentName
|
|
198
|
+
componentName,
|
|
199
|
+
formDataHolder
|
|
199
200
|
})
|
|
201
|
+
if (eventConfig.Handler === "refresh") {
|
|
202
|
+
funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }));
|
|
203
|
+
}
|
|
200
204
|
}
|
|
201
205
|
}
|
|
202
206
|
}))
|
|
@@ -226,40 +230,51 @@ export default (funcParams: funcParamsProps) => {
|
|
|
226
230
|
},
|
|
227
231
|
onBack: async function (functionParameters) {
|
|
228
232
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
229
|
-
|
|
233
|
+
this.callHandler("onBack", functionParameters)
|
|
230
234
|
if (eventGroups?.["onBack"]?.[path] === undefined) {
|
|
231
235
|
functionParameters?.handleBack()
|
|
232
236
|
}
|
|
233
237
|
},
|
|
234
238
|
onNext: async function (functionParameters) {
|
|
235
239
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
236
|
-
|
|
240
|
+
this.callHandler("onNext", functionParameters)
|
|
237
241
|
if (eventGroups?.["onNext"]?.[path] === undefined) {
|
|
238
242
|
functionParameters?.handleNext()
|
|
239
243
|
}
|
|
240
244
|
},
|
|
241
245
|
onReset: async function (functionParameters) {
|
|
242
246
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
243
|
-
|
|
247
|
+
this.callHandler("onReset", functionParameters)
|
|
244
248
|
if (eventGroups?.["onReset"]?.[path] === undefined) {
|
|
245
249
|
functionParameters?.handleReset()
|
|
246
250
|
}
|
|
247
251
|
},
|
|
248
|
-
callHandler:
|
|
252
|
+
callHandler: function (eventType: string, functionParameters?: any) {
|
|
249
253
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[funcParams.dynamicData.path.split(".").length - 1];
|
|
250
254
|
if (eventGroups?.[eventType]?.[path] !== undefined) {
|
|
251
|
-
|
|
255
|
+
(eventGroups?.[eventType]?.[path].map((eventConfig) => {
|
|
252
256
|
executeEventsParameters.store.functionParameters = functionParameters
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
257
|
+
if (eventConfig.Handler === "refresh") {
|
|
258
|
+
executeEvents({
|
|
259
|
+
...executeEventsParameters,
|
|
260
|
+
config: eventConfig,
|
|
261
|
+
componentName: path,
|
|
262
|
+
formDataHolder: formDataHolder
|
|
263
|
+
}).then((res) => {
|
|
264
|
+
funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }));
|
|
265
|
+
});
|
|
266
|
+
} else {
|
|
267
|
+
executeEvents({
|
|
268
|
+
...executeEventsParameters,
|
|
269
|
+
config: eventConfig,
|
|
270
|
+
componentName: path
|
|
271
|
+
})
|
|
272
|
+
}
|
|
258
273
|
}))
|
|
259
274
|
}
|
|
260
275
|
},
|
|
261
276
|
downloadFile: downloadFile,
|
|
262
|
-
|
|
277
|
+
downloadFileFromUrl: downloadFileFromUrl,
|
|
263
278
|
...funcParams.functionsProvider
|
|
264
279
|
};
|
|
265
280
|
};
|