impaktapps-ui-builder 1.0.113 → 1.0.114
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 +138 -170
- 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 -12
- package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +63 -115
- package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +6 -11
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +7 -14
- 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 +10 -10
- package/src/impaktapps-ui-builder/runtime/services/service.ts +44 -28
|
@@ -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,30 @@ 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
|
+
const keys = Object.keys(handlerResponse.data)
|
|
185
|
+
keys.map((e) => {
|
|
186
|
+
formDataHolder[e] = { ...formDataHolder, [e]: handlerResponse.data[e] }
|
|
187
|
+
})
|
|
188
|
+
|
|
187
189
|
}
|
|
188
190
|
}
|
|
189
191
|
else if (eventConfig.type === "Table" && eventConfig.lazyLoading) {
|
|
190
192
|
if (handlerResponse && handlerResponse?.data) {
|
|
191
193
|
formDataHolder[componentName] = handlerResponse.data?.data
|
|
192
194
|
formDataHolder[`${componentName}_RowCount`] = handlerResponse.data?.meta?.totalRowCount
|
|
193
|
-
store.setFormdata((pre) => { return { ...pre, ...formDataHolder } });
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
else {
|
|
197
198
|
if (handlerResponse) {
|
|
198
199
|
formDataHolder[componentName] = handlerResponse.data
|
|
199
|
-
store.setFormdata((pre) => { return { ...pre, ...formDataHolder } });
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
}
|
|
202
|
+
};
|
|
203
203
|
|
|
204
204
|
const buildBodyFormat = (body: any[], formData: any, userValue: any, store: any) => {
|
|
205
205
|
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 {
|
|
@@ -90,7 +90,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
90
90
|
config: {}, componentName: "",
|
|
91
91
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
92
92
|
functionsProvider: funcParams.functionsProvider,
|
|
93
|
-
serviceHolder: this, eventGroups, formDataHolder
|
|
93
|
+
serviceHolder: this, eventGroups, formDataHolder,
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
funcParams.store.setSchema(
|
|
@@ -104,26 +104,28 @@ export default (funcParams: funcParamsProps) => {
|
|
|
104
104
|
await executeRefreshHandler({
|
|
105
105
|
config: {}, componentName: "",
|
|
106
106
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
107
|
-
serviceHolder: this, eventGroups, formDataHolder:
|
|
107
|
+
serviceHolder: this, eventGroups, formDataHolder: formDataHolder
|
|
108
108
|
})
|
|
109
|
-
|
|
109
|
+
funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }))
|
|
110
110
|
uiSchema.elements.push(notifyUiSchema);
|
|
111
111
|
funcParams.store.setUiSchema(uiSchema);
|
|
112
112
|
},
|
|
113
113
|
onCellRenderer: (cellParams) => {
|
|
114
|
-
|
|
114
|
+
const cloneEventGroup = _.cloneDeep(eventGroups)
|
|
115
|
+
if (cloneEventGroup.onCellRenderer) {
|
|
115
116
|
let finalResponse = {};
|
|
116
117
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams?.dynamicData?.path?.split(".")[0];
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
118
|
+
if (cloneEventGroup?.onCellRenderer?.[path]) {
|
|
119
|
+
for (const eventConfig of cloneEventGroup?.onCellRenderer?.[path]) {
|
|
120
|
+
executeEventsParameters.store.functionParameters = cellParams
|
|
121
|
+
finalResponse = executeEvents({
|
|
122
|
+
...executeEventsParameters,
|
|
123
|
+
config: eventConfig,
|
|
124
|
+
componentName: path
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
return finalResponse
|
|
125
128
|
}
|
|
126
|
-
return finalResponse
|
|
127
129
|
}
|
|
128
130
|
return {}
|
|
129
131
|
},
|
|
@@ -165,7 +167,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
165
167
|
{ key: "sorting", value: paginationValues.sorting || [] },
|
|
166
168
|
{ key: "filters", value: paginationValues.tableColumnConfig || [] },
|
|
167
169
|
{ key: "globalFilter", value: paginationValues.globalFilter ?? '' },
|
|
168
|
-
{ key: "expandedRowIds", value: paginationValues.expandedRowIds ?? []}
|
|
170
|
+
{ key: "expandedRowIds", value: paginationValues.expandedRowIds ?? [] }
|
|
169
171
|
]
|
|
170
172
|
const response = await this.callExecuteEvents(paginationValues, apiBody, "onLoad");
|
|
171
173
|
return response?.data;
|
|
@@ -194,6 +196,9 @@ export default (funcParams: funcParamsProps) => {
|
|
|
194
196
|
config: eventConfig,
|
|
195
197
|
componentName
|
|
196
198
|
})
|
|
199
|
+
if (eventConfig.Handler === "refresh") {
|
|
200
|
+
funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }));
|
|
201
|
+
}
|
|
197
202
|
}
|
|
198
203
|
}
|
|
199
204
|
}))
|
|
@@ -223,40 +228,51 @@ export default (funcParams: funcParamsProps) => {
|
|
|
223
228
|
},
|
|
224
229
|
onBack: async function (functionParameters) {
|
|
225
230
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
226
|
-
|
|
231
|
+
this.callHandler("onBack", functionParameters)
|
|
227
232
|
if (eventGroups?.["onBack"]?.[path] === undefined) {
|
|
228
233
|
functionParameters?.handleBack()
|
|
229
234
|
}
|
|
230
235
|
},
|
|
231
236
|
onNext: async function (functionParameters) {
|
|
232
237
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
233
|
-
|
|
238
|
+
this.callHandler("onNext", functionParameters)
|
|
234
239
|
if (eventGroups?.["onNext"]?.[path] === undefined) {
|
|
235
240
|
functionParameters?.handleNext()
|
|
236
241
|
}
|
|
237
242
|
},
|
|
238
243
|
onReset: async function (functionParameters) {
|
|
239
244
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
240
|
-
|
|
245
|
+
this.callHandler("onReset", functionParameters)
|
|
241
246
|
if (eventGroups?.["onReset"]?.[path] === undefined) {
|
|
242
247
|
functionParameters?.handleReset()
|
|
243
248
|
}
|
|
244
249
|
},
|
|
245
|
-
callHandler:
|
|
250
|
+
callHandler: function (eventType: string, functionParameters?: any) {
|
|
246
251
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[funcParams.dynamicData.path.split(".").length - 1];
|
|
247
252
|
if (eventGroups?.[eventType]?.[path] !== undefined) {
|
|
248
|
-
|
|
253
|
+
(eventGroups?.[eventType]?.[path].map((eventConfig) => {
|
|
249
254
|
executeEventsParameters.store.functionParameters = functionParameters
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
+
if (eventConfig.Handler === "refresh") {
|
|
256
|
+
executeEvents({
|
|
257
|
+
...executeEventsParameters,
|
|
258
|
+
config: eventConfig,
|
|
259
|
+
componentName: path,
|
|
260
|
+
formDataHolder: formDataHolder
|
|
261
|
+
}).then((res) => {
|
|
262
|
+
funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }));
|
|
263
|
+
});
|
|
264
|
+
} else {
|
|
265
|
+
executeEvents({
|
|
266
|
+
...executeEventsParameters,
|
|
267
|
+
config: eventConfig,
|
|
268
|
+
componentName: path
|
|
269
|
+
})
|
|
270
|
+
}
|
|
255
271
|
}))
|
|
256
272
|
}
|
|
257
273
|
},
|
|
258
274
|
downloadFile: downloadFile,
|
|
259
|
-
|
|
275
|
+
downloadFileFromUrl: downloadFileFromUrl,
|
|
260
276
|
...funcParams.functionsProvider
|
|
261
277
|
};
|
|
262
278
|
};
|