impaktapps-ui-builder 1.0.119 → 1.0.120
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 +180 -147
- 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 +1 -2
- package/dist/src/impaktapps-ui-builder/lib/index.d.ts +0 -1
- package/dist/src/impaktapps-ui-builder/runtime/services/downloadFile.d.ts +2 -5
- package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +3 -4
- 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 +115 -63
- package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +11 -6
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +14 -7
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +1 -3
- 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 +9 -10
- package/src/impaktapps-ui-builder/runtime/services/downloadFile.ts +18 -33
- package/src/impaktapps-ui-builder/runtime/services/events.ts +11 -9
- package/src/impaktapps-ui-builder/runtime/services/service.ts +38 -55
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _
|
|
1
|
+
import _ from "lodash";
|
|
2
2
|
import { handlersProps } from "./interface";
|
|
3
3
|
export const executeEvents = (params: handlersProps) => {
|
|
4
4
|
let nextEvent = [];
|
|
@@ -68,7 +68,8 @@ function executeEventsHandler(params: handlersProps) {
|
|
|
68
68
|
params.componentName,
|
|
69
69
|
params.config,
|
|
70
70
|
params.store,
|
|
71
|
-
params.
|
|
71
|
+
params.service,
|
|
72
|
+
params.formDataHolder
|
|
72
73
|
);
|
|
73
74
|
} else if (params.config.Handler === "onBackHandler") {
|
|
74
75
|
return params.store.functionParameters?.handleBack();
|
|
@@ -143,7 +144,8 @@ function executeCustomHandler(params: handlersProps) {
|
|
|
143
144
|
}
|
|
144
145
|
|
|
145
146
|
}
|
|
146
|
-
|
|
147
|
+
|
|
148
|
+
function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any, service: any, formDataHolder: any) {
|
|
147
149
|
if (eventConfig.type === "Select" && handlerResponse?.data) {
|
|
148
150
|
if (!_.isEmpty(handlerResponse?.data)) {
|
|
149
151
|
store.setSchema((pre) => {
|
|
@@ -176,28 +178,28 @@ function mergeFormdata(handlerResponse: any, componentName: string, eventConfig:
|
|
|
176
178
|
}
|
|
177
179
|
}
|
|
178
180
|
else if (eventConfig.type === "page") {
|
|
179
|
-
if (!(_.isEmpty(handlerResponse?.data) && handlerResponse?.data
|
|
181
|
+
if (!(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
|
|
180
182
|
store.newData = {
|
|
181
183
|
...store.newData,
|
|
182
184
|
...handlerResponse?.data
|
|
183
185
|
}
|
|
184
|
-
|
|
185
|
-
formDataHolder[e] = handlerResponse.data[e]
|
|
186
|
-
})
|
|
186
|
+
store.setFormdata((pre: any) => { return { ...pre, ...handlerResponse?.data } })
|
|
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 } });
|
|
193
194
|
}
|
|
194
195
|
}
|
|
195
196
|
else {
|
|
196
|
-
if (handlerResponse
|
|
197
|
+
if (handlerResponse) {
|
|
197
198
|
formDataHolder[componentName] = handlerResponse.data
|
|
199
|
+
store.setFormdata((pre) => { return { ...pre, ...formDataHolder } });
|
|
198
200
|
}
|
|
199
201
|
}
|
|
200
|
-
}
|
|
202
|
+
}
|
|
201
203
|
|
|
202
204
|
const buildBodyFormat = (body: any[], formData: any, userValue: any, store: any) => {
|
|
203
205
|
let finalBody = { ...userValue?.payload };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _, { isEmpty } from "lodash";
|
|
2
|
-
import {
|
|
2
|
+
import { doDownload, downloadFile } from "./downloadFile";
|
|
3
3
|
import { executeEvents, executeRefreshHandler } from "./events";
|
|
4
4
|
import { handlersProps } from "./interface";
|
|
5
5
|
let compType: string;
|
|
@@ -62,17 +62,20 @@ 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: doDownload, ...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(
|
|
75
|
+
funcParams.store.setFormdata((pre) => ({
|
|
76
|
+
...pre,
|
|
77
|
+
...(funcParams?.initFormData())
|
|
78
|
+
}));
|
|
76
79
|
funcParams.store.setSchema({ type: "object", properties: {} });
|
|
77
80
|
funcParams.store.newData = {};
|
|
78
81
|
eventGroups = {};
|
|
@@ -90,7 +93,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
90
93
|
config: {}, componentName: "",
|
|
91
94
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
92
95
|
functionsProvider: funcParams.functionsProvider,
|
|
93
|
-
serviceHolder: this, eventGroups, formDataHolder
|
|
96
|
+
serviceHolder: this, eventGroups, formDataHolder
|
|
94
97
|
}
|
|
95
98
|
|
|
96
99
|
funcParams.store.setSchema(
|
|
@@ -101,32 +104,29 @@ export default (funcParams: funcParamsProps) => {
|
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
106
|
)
|
|
104
|
-
executeRefreshHandler({
|
|
107
|
+
await executeRefreshHandler({
|
|
105
108
|
config: {}, componentName: "",
|
|
106
109
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
107
|
-
serviceHolder: this, eventGroups, formDataHolder:
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
});
|
|
110
|
+
serviceHolder: this, eventGroups, formDataHolder: {}
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
uiSchema.elements.push(notifyUiSchema);
|
|
114
|
+
funcParams.store.setUiSchema(uiSchema);
|
|
113
115
|
},
|
|
114
116
|
onCellRenderer: (cellParams) => {
|
|
115
|
-
|
|
116
|
-
if (cloneEventGroup.onCellRenderer) {
|
|
117
|
+
if (eventGroups.onCellRenderer) {
|
|
117
118
|
let finalResponse = {};
|
|
118
119
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams?.dynamicData?.path?.split(".")[0];
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
return finalResponse
|
|
120
|
+
|
|
121
|
+
for (const eventConfig of eventGroups?.onCellRenderer?.[path]) {
|
|
122
|
+
executeEventsParameters.store.functionParameters = cellParams
|
|
123
|
+
finalResponse = executeEvents({
|
|
124
|
+
...executeEventsParameters,
|
|
125
|
+
config: eventConfig,
|
|
126
|
+
componentName: path
|
|
127
|
+
})
|
|
129
128
|
}
|
|
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;
|
|
@@ -192,24 +192,11 @@ export default (funcParams: funcParamsProps) => {
|
|
|
192
192
|
funcParams.store?.newData[componentName] !== undefined
|
|
193
193
|
) {
|
|
194
194
|
for (const eventConfig of eventGroups.onChange[componentName]) {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
componentName,
|
|
201
|
-
formDataHolder: formDataHolder
|
|
202
|
-
})
|
|
203
|
-
if (!isEmpty(formDataHolder)) {
|
|
204
|
-
funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }));
|
|
205
|
-
}
|
|
206
|
-
} else {
|
|
207
|
-
await executeEvents({
|
|
208
|
-
...executeEventsParameters,
|
|
209
|
-
config: eventConfig,
|
|
210
|
-
componentName,
|
|
211
|
-
})
|
|
212
|
-
}
|
|
195
|
+
await executeEvents({
|
|
196
|
+
...executeEventsParameters,
|
|
197
|
+
config: eventConfig,
|
|
198
|
+
componentName
|
|
199
|
+
})
|
|
213
200
|
}
|
|
214
201
|
}
|
|
215
202
|
}))
|
|
@@ -239,44 +226,40 @@ export default (funcParams: funcParamsProps) => {
|
|
|
239
226
|
},
|
|
240
227
|
onBack: async function (functionParameters) {
|
|
241
228
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
242
|
-
this.callHandler("onBack", functionParameters)
|
|
229
|
+
await this.callHandler("onBack", functionParameters)
|
|
243
230
|
if (eventGroups?.["onBack"]?.[path] === undefined) {
|
|
244
231
|
functionParameters?.handleBack()
|
|
245
232
|
}
|
|
246
233
|
},
|
|
247
234
|
onNext: async function (functionParameters) {
|
|
248
235
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
249
|
-
this.callHandler("onNext", functionParameters)
|
|
236
|
+
await this.callHandler("onNext", functionParameters)
|
|
250
237
|
if (eventGroups?.["onNext"]?.[path] === undefined) {
|
|
251
238
|
functionParameters?.handleNext()
|
|
252
239
|
}
|
|
253
240
|
},
|
|
254
241
|
onReset: async function (functionParameters) {
|
|
255
242
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
256
|
-
this.callHandler("onReset", functionParameters)
|
|
243
|
+
await this.callHandler("onReset", functionParameters)
|
|
257
244
|
if (eventGroups?.["onReset"]?.[path] === undefined) {
|
|
258
245
|
functionParameters?.handleReset()
|
|
259
246
|
}
|
|
260
247
|
},
|
|
261
|
-
callHandler: function (eventType: string, functionParameters?: any) {
|
|
248
|
+
callHandler: async function (eventType: string, functionParameters?: any) {
|
|
262
249
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[funcParams.dynamicData.path.split(".").length - 1];
|
|
263
250
|
if (eventGroups?.[eventType]?.[path] !== undefined) {
|
|
264
|
-
(eventGroups?.[eventType]?.[path].map(
|
|
251
|
+
Promise.all(eventGroups?.[eventType]?.[path].map((eventConfig) => {
|
|
265
252
|
executeEventsParameters.store.functionParameters = functionParameters
|
|
266
|
-
|
|
253
|
+
executeEvents({
|
|
267
254
|
...executeEventsParameters,
|
|
268
255
|
config: eventConfig,
|
|
269
|
-
componentName: path
|
|
270
|
-
formDataHolder: formDataHolder
|
|
256
|
+
componentName: path
|
|
271
257
|
})
|
|
272
|
-
if (!isEmpty(formDataHolder)) {
|
|
273
|
-
funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }));
|
|
274
|
-
}
|
|
275
258
|
}))
|
|
276
259
|
}
|
|
277
260
|
},
|
|
278
261
|
downloadFile: downloadFile,
|
|
279
|
-
|
|
262
|
+
download: doDownload,
|
|
280
263
|
...funcParams.functionsProvider
|
|
281
264
|
};
|
|
282
265
|
};
|