impaktapps-ui-builder 1.0.621 → 1.0.622
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 +2002 -897
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +15 -15
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/dist/src/impaktapps-ui-builder/builder/build/buildAreaGraph.d.ts +2 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildCamera.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildConfig.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildGroupButton.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildHierarchyChart.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildHorizontalLayout.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildImage.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildMetricCard.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildOTP_inputs.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildPdfViewer.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildPopover.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildStackBarLineGraph.d.ts +2 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildUiSchema.d.ts +2 -1
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/box.d.ts +4 -1
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.d.ts +1 -1
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/buttonGroup.d.ts +22 -0
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/card.d.ts +173 -171
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/eventSection.d.ts +18 -50
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/graph.d.ts +50 -4
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/hierarchyChart.d.ts +22 -0
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/horizontalLayout.d.ts +13 -0
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/metricCard.d.ts +17 -0
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/multiSelect.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/pdfViewer.d.ts +19 -0
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/selectInputField.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/tableSection.d.ts +15 -66
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/wrapperSection.d.ts +3 -1
- package/dist/src/impaktapps-ui-builder/builder/services/utils.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 +8 -4
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildAreaGraph.ts +66 -0
- package/src/impaktapps-ui-builder/builder/build/buildArray.ts +13 -0
- package/src/impaktapps-ui-builder/builder/build/buildCamera.ts +50 -0
- package/src/impaktapps-ui-builder/builder/build/buildCard.ts +10 -10
- package/src/impaktapps-ui-builder/builder/build/buildConfig.ts +23 -9
- package/src/impaktapps-ui-builder/builder/build/buildDate.ts +35 -13
- package/src/impaktapps-ui-builder/builder/build/buildDownloadFile.ts +7 -0
- package/src/impaktapps-ui-builder/builder/build/buildEmptyBox.ts +4 -0
- package/src/impaktapps-ui-builder/builder/build/buildFileInput.ts +42 -28
- package/src/impaktapps-ui-builder/builder/build/buildGroupButton.ts +24 -0
- package/src/impaktapps-ui-builder/builder/build/buildHierarchyChart.ts +35 -0
- package/src/impaktapps-ui-builder/builder/build/buildHorizontalBarGraph.ts +9 -3
- package/src/impaktapps-ui-builder/builder/build/buildHorizontalLayout.ts +15 -0
- package/src/impaktapps-ui-builder/builder/build/buildImage.ts +38 -0
- package/src/impaktapps-ui-builder/builder/build/buildLabel.ts +3 -0
- package/src/impaktapps-ui-builder/builder/build/buildLeaderboard.ts +3 -0
- package/src/impaktapps-ui-builder/builder/build/buildLineGraph.ts +9 -3
- package/src/impaktapps-ui-builder/builder/build/buildMetricCard.tsx +37 -0
- package/src/impaktapps-ui-builder/builder/build/buildMultiSelect.ts +9 -0
- package/src/impaktapps-ui-builder/builder/build/buildOTP_inputs.ts +44 -0
- package/src/impaktapps-ui-builder/builder/build/buildPdfViewer.ts +16 -0
- package/src/impaktapps-ui-builder/builder/build/buildPieGraph.ts +6 -3
- package/src/impaktapps-ui-builder/builder/build/buildPop.ts +1 -0
- package/src/impaktapps-ui-builder/builder/build/buildPopover.ts +40 -0
- package/src/impaktapps-ui-builder/builder/build/buildProgressBar.ts +31 -21
- package/src/impaktapps-ui-builder/builder/build/buildRadio.ts +10 -2
- package/src/impaktapps-ui-builder/builder/build/buildSelect.ts +9 -0
- package/src/impaktapps-ui-builder/builder/build/buildStackBarGraph.ts +9 -3
- package/src/impaktapps-ui-builder/builder/build/buildStackBarLineGraph.ts +72 -0
- package/src/impaktapps-ui-builder/builder/build/buildTabSection.ts +5 -0
- package/src/impaktapps-ui-builder/builder/build/buildTable.ts +21 -11
- package/src/impaktapps-ui-builder/builder/build/buildText.ts +9 -0
- package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +144 -124
- package/src/impaktapps-ui-builder/builder/build/buildUplaodFile.ts +6 -0
- package/src/impaktapps-ui-builder/builder/build/buildWrapperSection.ts +7 -2
- package/src/impaktapps-ui-builder/builder/build/uischema/box.ts +4 -1
- package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +315 -21
- package/src/impaktapps-ui-builder/builder/build/uischema/buttonGroup.ts +17 -0
- package/src/impaktapps-ui-builder/builder/build/uischema/card.ts +142 -169
- package/src/impaktapps-ui-builder/builder/build/uischema/coreSection.ts +74 -19
- package/src/impaktapps-ui-builder/builder/build/uischema/eventSection.ts +30 -54
- package/src/impaktapps-ui-builder/builder/build/uischema/file.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/uischema/graph.ts +37 -4
- package/src/impaktapps-ui-builder/builder/build/uischema/hierarchyChart.ts +13 -0
- package/src/impaktapps-ui-builder/builder/build/uischema/horizontalLayout.ts +11 -0
- package/src/impaktapps-ui-builder/builder/build/uischema/metricCard.ts +13 -0
- package/src/impaktapps-ui-builder/builder/build/uischema/multiSelect.ts +2 -0
- package/src/impaktapps-ui-builder/builder/build/uischema/pdfViewer.ts +18 -0
- package/src/impaktapps-ui-builder/builder/build/uischema/selectInputField.ts +2 -0
- package/src/impaktapps-ui-builder/builder/build/uischema/tableSection.ts +34 -60
- package/src/impaktapps-ui-builder/builder/build/uischema/wrapperSection.ts +3 -1
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +219 -75
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +61 -1
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/uiSchema.ts +94 -106
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +4 -3
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/uiSchema.ts +31 -55
- package/src/impaktapps-ui-builder/builder/services/component.ts +174 -86
- package/src/impaktapps-ui-builder/builder/services/event.ts +3 -0
- package/src/impaktapps-ui-builder/builder/services/pageMaster.ts +18 -15
- package/src/impaktapps-ui-builder/builder/services/utils.ts +15 -3
- package/src/impaktapps-ui-builder/lib/index.ts +10 -9
- package/src/impaktapps-ui-builder/runtime/services/downloadFile.ts +42 -22
- package/src/impaktapps-ui-builder/runtime/services/events.ts +9 -11
- package/src/impaktapps-ui-builder/runtime/services/service.ts +118 -158
|
@@ -1,32 +1,52 @@
|
|
|
1
|
-
export
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
let
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
export function downloadFile({ data, name }: { data: string; name: string }) {
|
|
2
|
+
const binary = window.atob(data);
|
|
3
|
+
const bytes = new Uint8Array(binary.length);
|
|
4
|
+
|
|
5
|
+
for (let i = 0; i < binary.length; i++) {
|
|
6
|
+
bytes[i] = binary.charCodeAt(i);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const extension = name.split(".").pop()?.toLowerCase();
|
|
10
|
+
const mimeMap: Record<string, string> = {
|
|
11
|
+
pdf: "application/pdf",
|
|
12
|
+
png: "image/png",
|
|
13
|
+
jpg: "image/jpeg",
|
|
14
|
+
jpeg: "image/jpeg",
|
|
15
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
16
|
+
csv: "text/csv",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const blob = new Blob([bytes], {
|
|
20
|
+
type: mimeMap[extension!] || "application/octet-stream",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const url = URL.createObjectURL(blob);
|
|
24
|
+
const a = document.createElement("a");
|
|
25
|
+
a.href = url;
|
|
26
|
+
a.download = name;
|
|
27
|
+
a.click();
|
|
14
28
|
|
|
15
29
|
URL.revokeObjectURL(url);
|
|
16
|
-
|
|
17
|
-
};
|
|
30
|
+
}
|
|
18
31
|
|
|
19
|
-
export const
|
|
20
|
-
|
|
32
|
+
export const downloadFileFromUrl = (response: any, service) => {
|
|
33
|
+
const url = new URL(response.path, service.defaults.baseURL);
|
|
21
34
|
if (response?.params) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
35
|
+
for (const [key, value] of Object.entries(response.params)) {
|
|
36
|
+
if (value == null) continue;
|
|
37
|
+
|
|
38
|
+
url.searchParams.append(
|
|
39
|
+
key,
|
|
40
|
+
Array.isArray(value) ? value.join(",") : String(value),
|
|
41
|
+
);
|
|
42
|
+
}
|
|
26
43
|
}
|
|
27
44
|
const link = document.createElement('a');
|
|
28
|
-
link.href = url;
|
|
45
|
+
link.href = url.toString();
|
|
46
|
+
link.download = "";
|
|
29
47
|
document.body.appendChild(link);
|
|
30
48
|
link.click();
|
|
31
49
|
link.parentNode.removeChild(link);
|
|
32
50
|
};
|
|
51
|
+
|
|
52
|
+
|
|
@@ -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
|
-
if (handlerResponse) {
|
|
196
|
+
if (handlerResponse?.data) {
|
|
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,
|
|
69
|
+
serviceHolder: { downloadFile, downloadFileFromUrl: downloadFileFromUrl, ...funcParams.functionsProvider }, eventGroups,
|
|
70
70
|
functionsProvider: funcParams.functionsProvider, formDataHolder
|
|
71
71
|
};
|
|
72
72
|
return {
|
|
@@ -80,129 +80,19 @@ export default (funcParams: funcParamsProps) => {
|
|
|
80
80
|
const config = pageData?.config;
|
|
81
81
|
const uiSchema = pageData?.uiSchema;
|
|
82
82
|
const event = new CustomEvent('pageNameChanged', {
|
|
83
|
-
detail: { pageName: config.label, hasBackIcon: true }
|
|
83
|
+
detail: { pageName: config.label, pageIconUrl: config.pageIconUrl, hasBackIcon: config.hasBackIcon === "NO" ? false : true }
|
|
84
84
|
});
|
|
85
85
|
window.dispatchEvent(event)
|
|
86
86
|
const theme = funcParams?.store?.theme?.myTheme;
|
|
87
|
-
uiSchema.elements.push(
|
|
88
|
-
{
|
|
89
|
-
type: "HorizontalLayout",
|
|
90
|
-
config: {
|
|
91
|
-
main: {
|
|
92
|
-
direction: "row",
|
|
93
|
-
},
|
|
94
|
-
style: {
|
|
95
|
-
flexDirection: "row",
|
|
96
|
-
position: "absolute",
|
|
97
|
-
bottom: 0,
|
|
98
|
-
height: "fit-content",
|
|
99
|
-
overflow: "hidden",
|
|
100
|
-
zIndex: 1000,
|
|
101
|
-
width: "inherit",
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
elements: [
|
|
105
|
-
{
|
|
106
|
-
type: "Control",
|
|
107
|
-
scope: "#/properties/FooterText",
|
|
108
|
-
options: {
|
|
109
|
-
widget: "Box",
|
|
110
|
-
},
|
|
111
|
-
config: {
|
|
112
|
-
main: {
|
|
113
|
-
heading: "Copywriter@ACT21.IO",
|
|
114
|
-
},
|
|
115
|
-
style: {
|
|
116
|
-
color: theme?.palette?.text?.disabled || "#AFAFAF",
|
|
117
|
-
fontSize: "11px",
|
|
118
|
-
textAlign: "center",
|
|
119
|
-
lineHeight: 2,
|
|
120
|
-
width: "fit-content",
|
|
121
|
-
left: "50%",
|
|
122
|
-
position: "relative",
|
|
123
|
-
margin: 0,
|
|
124
|
-
flexGrow: 1,
|
|
125
|
-
height: 0,
|
|
126
|
-
transform: "translate(-50%, 0%)",
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
type: "Control",
|
|
132
|
-
scope: "#/properties/FooterBackIcon",
|
|
133
|
-
options: {
|
|
134
|
-
widget: "Box",
|
|
135
|
-
},
|
|
136
|
-
config: {
|
|
137
|
-
main: {
|
|
138
|
-
iconName: "PrevIcon",
|
|
139
|
-
onClick: "backHandler",
|
|
140
|
-
width: "fit-content",
|
|
141
|
-
},
|
|
142
|
-
style: {
|
|
143
|
-
fill: theme?.palette?.primary?.main,
|
|
144
|
-
width: 20,
|
|
145
|
-
height: 0,
|
|
146
|
-
top: 0,
|
|
147
|
-
right: { xs: "12px", sm: "84px" },
|
|
148
|
-
position: "absolute",
|
|
149
|
-
fontSize: "12px",
|
|
150
|
-
cursor: "pointer",
|
|
151
|
-
":hover": {
|
|
152
|
-
fill: theme?.palette?.primary?.dark,
|
|
153
|
-
},
|
|
154
|
-
marginRight: "20px",
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
type: "Control",
|
|
160
|
-
scope: "#/properties/FooterBackHandlerText",
|
|
161
|
-
options: {
|
|
162
|
-
widget: "Box",
|
|
163
|
-
},
|
|
164
|
-
config: {
|
|
165
|
-
main: {
|
|
166
|
-
heading: "Previous Page",
|
|
167
|
-
onClick: "backHandler",
|
|
168
|
-
},
|
|
169
|
-
style: {
|
|
170
|
-
display: { xs: "none", sm: "flex" },
|
|
171
|
-
textAlign: "left",
|
|
172
|
-
lineHeight: 1,
|
|
173
|
-
height: 0,
|
|
174
|
-
width: "fit-content",
|
|
175
|
-
color: theme?.palette?.primary?.main,
|
|
176
|
-
fontSize: "12px",
|
|
177
|
-
cursor: "pointer",
|
|
178
|
-
marginLeft: "2px",
|
|
179
|
-
|
|
180
|
-
top: 3,
|
|
181
|
-
right: "12px",
|
|
182
|
-
position: "absolute",
|
|
183
|
-
":hover": {
|
|
184
|
-
color: theme?.palette?.primary?.dark,
|
|
185
|
-
},
|
|
186
|
-
marginRight: "4px",
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
],
|
|
191
|
-
}
|
|
192
|
-
);
|
|
193
87
|
const schema = pageData?.schema ?? { type: "object", properties: {} };
|
|
194
88
|
eventGroups = extractEvents(config);
|
|
195
89
|
executeEventsParameters = {
|
|
196
90
|
config: {}, componentName: "",
|
|
197
91
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
198
92
|
functionsProvider: funcParams.functionsProvider,
|
|
199
|
-
serviceHolder: this, eventGroups, formDataHolder
|
|
93
|
+
serviceHolder: this, eventGroups, formDataHolder,
|
|
200
94
|
}
|
|
201
|
-
|
|
202
|
-
config: {}, componentName: "",
|
|
203
|
-
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
204
|
-
serviceHolder: this, eventGroups, formDataHolder: {}
|
|
205
|
-
})
|
|
95
|
+
|
|
206
96
|
funcParams.store.setSchema(
|
|
207
97
|
(pre: any) => {
|
|
208
98
|
return {
|
|
@@ -211,23 +101,51 @@ export default (funcParams: funcParamsProps) => {
|
|
|
211
101
|
}
|
|
212
102
|
}
|
|
213
103
|
)
|
|
214
|
-
|
|
215
|
-
|
|
104
|
+
|
|
105
|
+
executeRefreshHandler({
|
|
106
|
+
config: {}, componentName: "",
|
|
107
|
+
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
108
|
+
serviceHolder: this, eventGroups, formDataHolder: formDataHolder
|
|
109
|
+
}).then((e) => {
|
|
110
|
+
funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }))
|
|
111
|
+
uiSchema.elements.push(notifyUiSchema);
|
|
112
|
+
funcParams.store.setUiSchema(uiSchema);
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
getStyle: () => {
|
|
116
|
+
const cloneEventGroup = _.cloneDeep(eventGroups)
|
|
117
|
+
if (cloneEventGroup.setStyle) {
|
|
118
|
+
let finalResponse = {};
|
|
119
|
+
const path = funcParams.dynamicData?.tableButtonPath || funcParams?.dynamicData.path?.split(".").pop();
|
|
120
|
+
if (cloneEventGroup?.setStyle?.[path]) {
|
|
121
|
+
for (const eventConfig of cloneEventGroup?.setStyle?.[path]) {
|
|
122
|
+
finalResponse = executeEvents({
|
|
123
|
+
...executeEventsParameters,
|
|
124
|
+
config: eventConfig,
|
|
125
|
+
componentName: path
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
return finalResponse
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return {}
|
|
216
132
|
},
|
|
217
133
|
onCellRenderer: (cellParams) => {
|
|
218
|
-
|
|
134
|
+
const cloneEventGroup = _.cloneDeep(eventGroups)
|
|
135
|
+
if (cloneEventGroup.onCellRenderer) {
|
|
219
136
|
let finalResponse = {};
|
|
220
137
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams?.dynamicData?.path?.split(".")[0];
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
138
|
+
if (cloneEventGroup?.onCellRenderer?.[path]) {
|
|
139
|
+
for (const eventConfig of cloneEventGroup?.onCellRenderer?.[path]) {
|
|
140
|
+
executeEventsParameters.store.functionParameters = cellParams
|
|
141
|
+
finalResponse = executeEvents({
|
|
142
|
+
...executeEventsParameters,
|
|
143
|
+
config: eventConfig,
|
|
144
|
+
componentName: path
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
return finalResponse
|
|
229
148
|
}
|
|
230
|
-
return finalResponse
|
|
231
149
|
}
|
|
232
150
|
return {}
|
|
233
151
|
},
|
|
@@ -240,6 +158,9 @@ export default (funcParams: funcParamsProps) => {
|
|
|
240
158
|
onFileDelete: async function () {
|
|
241
159
|
this.callHandler("onFileDelete")
|
|
242
160
|
},
|
|
161
|
+
onClose: function () {
|
|
162
|
+
this.callHandler("onClose")
|
|
163
|
+
},
|
|
243
164
|
onMount: function () {
|
|
244
165
|
this.callHandler("onMount")
|
|
245
166
|
},
|
|
@@ -268,11 +189,20 @@ export default (funcParams: funcParamsProps) => {
|
|
|
268
189
|
{ key: "pageIndex", value: paginationValues.pagination.pageIndex },
|
|
269
190
|
{ key: "sorting", value: paginationValues.sorting || [] },
|
|
270
191
|
{ key: "filters", value: paginationValues.tableColumnConfig || [] },
|
|
271
|
-
{ key: "globalFilter", value: paginationValues.globalFilter ?? '' }
|
|
192
|
+
{ key: "globalFilter", value: paginationValues.globalFilter ?? '' },
|
|
193
|
+
{ key: "parentIds", value: paginationValues.parentIds},
|
|
194
|
+
{ key: "isExpandAll", value: paginationValues.isExpandAll},
|
|
272
195
|
]
|
|
273
196
|
const response = await this.callExecuteEvents(paginationValues, apiBody, "onLoad");
|
|
274
197
|
return response?.data;
|
|
275
198
|
},
|
|
199
|
+
onNodeExpandChange: async function (param) {
|
|
200
|
+
const apiBody = [
|
|
201
|
+
{ key: "expandedNodeId", value: param.expandedNodeId }
|
|
202
|
+
]
|
|
203
|
+
const response = await this.callExecuteEvents(param, apiBody, "onNodeExpandChange");
|
|
204
|
+
return response?.data;
|
|
205
|
+
},
|
|
276
206
|
getSelectOptions: async function (param) {
|
|
277
207
|
if (param.serachValue !== "" && param.serachValue !== undefined) {
|
|
278
208
|
const apiBody = [
|
|
@@ -283,24 +213,38 @@ export default (funcParams: funcParamsProps) => {
|
|
|
283
213
|
return response?.data;
|
|
284
214
|
}
|
|
285
215
|
},
|
|
286
|
-
onChange:
|
|
287
|
-
if (eventGroups.onChange)
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
216
|
+
onChange: function () {
|
|
217
|
+
if (!eventGroups.onChange) return;
|
|
218
|
+
|
|
219
|
+
const ChangeEventsKeysArray = Object.keys(eventGroups.onChange);
|
|
220
|
+
|
|
221
|
+
const promises = ChangeEventsKeysArray.flatMap((componentName: string) => {
|
|
222
|
+
if (
|
|
223
|
+
funcParams.store?.formData[componentName] === funcParams.store.newData[componentName]
|
|
224
|
+
) {
|
|
225
|
+
return [];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return eventGroups.onChange[componentName].map(eventConfig =>
|
|
229
|
+
Promise.resolve(
|
|
230
|
+
executeEvents({
|
|
231
|
+
...executeEventsParameters,
|
|
232
|
+
config: eventConfig,
|
|
233
|
+
componentName,
|
|
234
|
+
formDataHolder
|
|
235
|
+
})
|
|
236
|
+
).then(() => {
|
|
237
|
+
if (!isEmpty(formDataHolder)) {
|
|
238
|
+
funcParams.store.setFormdata(pre => ({
|
|
239
|
+
...pre,
|
|
240
|
+
...formDataHolder
|
|
241
|
+
}));
|
|
300
242
|
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
}
|
|
243
|
+
})
|
|
244
|
+
);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
Promise.allSettled(promises);
|
|
304
248
|
},
|
|
305
249
|
callExecuteEvents: async function (paramValue, apiBody, eventType: string) {
|
|
306
250
|
let LastCallResponse = undefined;
|
|
@@ -326,40 +270,56 @@ export default (funcParams: funcParamsProps) => {
|
|
|
326
270
|
},
|
|
327
271
|
onBack: async function (functionParameters) {
|
|
328
272
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
329
|
-
|
|
273
|
+
this.callHandler("onBack", functionParameters)
|
|
330
274
|
if (eventGroups?.["onBack"]?.[path] === undefined) {
|
|
331
275
|
functionParameters?.handleBack()
|
|
332
276
|
}
|
|
333
277
|
},
|
|
334
278
|
onNext: async function (functionParameters) {
|
|
335
279
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
336
|
-
|
|
280
|
+
this.callHandler("onNext", functionParameters)
|
|
337
281
|
if (eventGroups?.["onNext"]?.[path] === undefined) {
|
|
338
282
|
functionParameters?.handleNext()
|
|
339
283
|
}
|
|
340
284
|
},
|
|
341
285
|
onReset: async function (functionParameters) {
|
|
342
286
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
343
|
-
|
|
287
|
+
this.callHandler("onReset", functionParameters)
|
|
344
288
|
if (eventGroups?.["onReset"]?.[path] === undefined) {
|
|
345
289
|
functionParameters?.handleReset()
|
|
346
290
|
}
|
|
347
291
|
},
|
|
348
|
-
callHandler:
|
|
349
|
-
const path =
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
292
|
+
callHandler: function (eventType: string, functionParameters?: any) {
|
|
293
|
+
const path =
|
|
294
|
+
funcParams.dynamicData?.tableButtonPath ||
|
|
295
|
+
funcParams.dynamicData.path.split(".").pop();
|
|
296
|
+
|
|
297
|
+
if (!eventGroups?.[eventType]?.[path]) return;
|
|
298
|
+
|
|
299
|
+
const promises = eventGroups[eventType][path].map(eventConfig => {
|
|
300
|
+
executeEventsParameters.store.functionParameters = functionParameters;
|
|
301
|
+
|
|
302
|
+
return Promise.resolve(
|
|
353
303
|
executeEvents({
|
|
354
304
|
...executeEventsParameters,
|
|
355
305
|
config: eventConfig,
|
|
356
|
-
componentName: path
|
|
306
|
+
componentName: path,
|
|
307
|
+
formDataHolder
|
|
357
308
|
})
|
|
358
|
-
|
|
359
|
-
|
|
309
|
+
).then(() => {
|
|
310
|
+
if (!isEmpty(formDataHolder)) {
|
|
311
|
+
funcParams.store.setFormdata(pre => ({
|
|
312
|
+
...pre,
|
|
313
|
+
...formDataHolder
|
|
314
|
+
}));
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
Promise.allSettled(promises);
|
|
360
320
|
},
|
|
361
321
|
downloadFile: downloadFile,
|
|
362
|
-
|
|
322
|
+
downloadFileFromUrl: downloadFileFromUrl,
|
|
363
323
|
...funcParams.functionsProvider
|
|
364
324
|
};
|
|
365
325
|
};
|