impaktapps-ui-builder 0.0.409-m → 0.0.409-o
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 +104 -57
- 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/runtime/services/service.d.ts +8 -7
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/services/event.ts +3 -1
- package/src/impaktapps-ui-builder/runtime/services/service.ts +88 -44
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
export declare const extractEvents: (eventConfig: any) => any;
|
|
2
1
|
interface funcParamsProps {
|
|
3
2
|
store: any;
|
|
4
3
|
dynamicData: any;
|
|
5
|
-
config: any;
|
|
6
|
-
uiSchema: any;
|
|
7
|
-
schema: any;
|
|
8
4
|
service: any;
|
|
9
5
|
userValue: any;
|
|
6
|
+
functionsProvider?: Record<string, any>;
|
|
10
7
|
}
|
|
8
|
+
export declare const extractEvents: (eventConfig: any) => any;
|
|
11
9
|
declare const _default: (funcParams: funcParamsProps) => {
|
|
12
10
|
setPage: () => Promise<void>;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
onCellRenderer: (cellParams: any) => {};
|
|
12
|
+
onClick: () => void;
|
|
13
|
+
onMount: () => void;
|
|
14
|
+
onFileDownload: () => void;
|
|
15
|
+
onFileUpload: () => void;
|
|
16
|
+
backHandler: () => void;
|
|
16
17
|
onPaginationChange: (paginationValues: any) => Promise<any>;
|
|
17
18
|
getSelectOptions: (param: any) => Promise<any>;
|
|
18
19
|
onChange: () => Promise<void>;
|
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import { APISection } from "../build/uischema/apiSection";
|
|
|
6
6
|
import { getRadioInputField, getSelectField, getTextArea } from "../build/uischema/buildPropertiesSection";
|
|
7
7
|
import { refreshSectionUiSchema } from "../build/uischema/refresh";
|
|
8
8
|
import _ from "lodash";
|
|
9
|
+
import emptyBox from "../build/uischema/emptyBox";
|
|
9
10
|
|
|
10
11
|
export default (
|
|
11
12
|
store: any,
|
|
@@ -28,7 +29,8 @@ export default (
|
|
|
28
29
|
if (handlerType) {
|
|
29
30
|
if (handlerType === "custom") {
|
|
30
31
|
uiSchema.elements[1].elements[0].elements[2] = getRadioInputField("isSync","Run in Sync",["Yes","No"])
|
|
31
|
-
uiSchema.elements[1].elements[0].elements[3] =
|
|
32
|
+
uiSchema.elements[1].elements[0].elements[3] = emptyBox;
|
|
33
|
+
uiSchema.elements[1].elements[0].elements[4] = getTextArea("eventCode", "Write Custom Code", false)
|
|
32
34
|
schema.required = ["eventType", "Handler", "eventCode"]
|
|
33
35
|
|
|
34
36
|
} else if (handlerType === "api") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _, { isEmpty } from "lodash";
|
|
2
2
|
import { doDownload, downloadFile } from "./downloadFile";
|
|
3
|
-
import {
|
|
3
|
+
import { executeEvents, executeRefreshHandler } from "./events";
|
|
4
4
|
import { handlersProps } from "./interface";
|
|
5
5
|
let compType: string;
|
|
6
6
|
let eventGroups: any = {};
|
|
@@ -13,6 +13,14 @@ const notifyUiSchema = {
|
|
|
13
13
|
layout: 6,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
interface funcParamsProps {
|
|
17
|
+
store: any,
|
|
18
|
+
dynamicData: any,
|
|
19
|
+
service: any,
|
|
20
|
+
userValue: any,
|
|
21
|
+
functionsProvider?: Record<string, any>
|
|
22
|
+
}
|
|
23
|
+
|
|
16
24
|
export const extractEvents = (eventConfig: any) => {
|
|
17
25
|
function extractsConfigEvents(eventConfigObj: any) {
|
|
18
26
|
if (eventConfigObj.events) {
|
|
@@ -46,41 +54,53 @@ export const extractEvents = (eventConfig: any) => {
|
|
|
46
54
|
}
|
|
47
55
|
return eventGroups;
|
|
48
56
|
};
|
|
49
|
-
|
|
50
|
-
interface funcParamsProps {
|
|
51
|
-
store: any,
|
|
52
|
-
dynamicData: any,
|
|
53
|
-
config: any,
|
|
54
|
-
uiSchema: any,
|
|
55
|
-
schema: any,
|
|
56
|
-
service: any,
|
|
57
|
-
userValue: any,
|
|
58
|
-
}
|
|
59
57
|
export default (funcParams: funcParamsProps) => {
|
|
60
|
-
eventGroups = {}
|
|
61
|
-
eventGroups = extractEvents(funcParams.config)
|
|
62
58
|
let executeEventsParameters: handlersProps = {
|
|
63
59
|
config: {}, componentName: "",
|
|
64
60
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
65
|
-
serviceHolder: { downloadFile, download: doDownload }, eventGroups
|
|
61
|
+
serviceHolder: { downloadFile, download: doDownload, ...funcParams.functionsProvider }, eventGroups,
|
|
62
|
+
functionsProvider: funcParams.functionsProvider,
|
|
66
63
|
};
|
|
67
64
|
return {
|
|
68
65
|
setPage: async function () {
|
|
69
|
-
funcParams.store.setFormdata({})
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
funcParams.store.setFormdata({})
|
|
67
|
+
const data = JSON.stringify({
|
|
68
|
+
pageName: funcParams.store.pageName
|
|
69
|
+
});
|
|
70
|
+
let pageData;
|
|
71
|
+
const pageBasicDetailString = localStorage.getItem("pagemasterMetaData")
|
|
72
|
+
if (pageBasicDetailString) {
|
|
73
|
+
pageData = JSON.parse(pageBasicDetailString)
|
|
74
|
+
} else {
|
|
75
|
+
const pageId = await funcParams.service
|
|
76
|
+
.post("/page/getByName", data, {
|
|
77
|
+
headers: {
|
|
78
|
+
"Content-Type": "application/json",
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
const response = await funcParams.service.get(
|
|
82
|
+
`/page/getById?id=${pageId?.data?.id}`,
|
|
83
|
+
{
|
|
84
|
+
headers: {
|
|
85
|
+
"Content-Type": "application/json",
|
|
86
|
+
},
|
|
75
87
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
88
|
+
);
|
|
89
|
+
pageData = response.data;
|
|
90
|
+
localStorage.setItem("pagemasterMetaData", JSON.stringify({
|
|
91
|
+
schema: pageData?.schema,
|
|
92
|
+
uiSchema: pageData?.uiSchema, config: pageData?.config
|
|
93
|
+
}))
|
|
94
|
+
}
|
|
95
|
+
const config = pageData?.config;
|
|
96
|
+
const uiSchema = pageData?.uiSchema;
|
|
97
|
+
const schema = pageData?.schema ?? { type: "object", properties: {} };
|
|
98
|
+
eventGroups = {}
|
|
99
|
+
eventGroups = extractEvents(config);
|
|
81
100
|
executeEventsParameters = {
|
|
82
101
|
config: {}, componentName: "",
|
|
83
102
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
103
|
+
functionsProvider: funcParams.functionsProvider,
|
|
84
104
|
serviceHolder: this, eventGroups
|
|
85
105
|
}
|
|
86
106
|
await executeRefreshHandler({
|
|
@@ -88,15 +108,47 @@ export default (funcParams: funcParamsProps) => {
|
|
|
88
108
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
89
109
|
serviceHolder: this, eventGroups
|
|
90
110
|
})
|
|
111
|
+
funcParams.store.setSchema(
|
|
112
|
+
(pre: any) => {
|
|
113
|
+
return {
|
|
114
|
+
...schema, properties:
|
|
115
|
+
{ ...schema.properties, ...pre.properties, }
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
uiSchema.elements.push(notifyUiSchema);
|
|
120
|
+
funcParams.store.setUiSchema(uiSchema);
|
|
121
|
+
|
|
122
|
+
},
|
|
123
|
+
onCellRenderer: (cellParams) => {
|
|
124
|
+
let finalResponse = {};
|
|
125
|
+
// cellParams.spanRef.current.style.color = "yellow";
|
|
126
|
+
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
127
|
+
for (const eventConfig of eventGroups?.onCellRenderer[path]) {
|
|
128
|
+
executeEventsParameters.store.functionParameters = cellParams
|
|
129
|
+
finalResponse = executeEvents({
|
|
130
|
+
...executeEventsParameters,
|
|
131
|
+
config: eventConfig,
|
|
132
|
+
componentName: path
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
console.log("finalResponse >> >> >> ", finalResponse)
|
|
136
|
+
return finalResponse
|
|
137
|
+
},
|
|
138
|
+
onClick: function () {
|
|
139
|
+
this.callHandler("onClick")
|
|
140
|
+
},
|
|
141
|
+
onMount: function () {
|
|
142
|
+
this.callHandler("onMount")
|
|
91
143
|
},
|
|
92
|
-
|
|
93
|
-
|
|
144
|
+
onFileDownload: function () {
|
|
145
|
+
this.callHandler("onDownload")
|
|
94
146
|
},
|
|
95
|
-
|
|
96
|
-
|
|
147
|
+
onFileUpload: function () {
|
|
148
|
+
this.callHandler("onUpload")
|
|
97
149
|
},
|
|
98
|
-
|
|
99
|
-
|
|
150
|
+
backHandler: function () {
|
|
151
|
+
funcParams.store.navigate(-1)
|
|
100
152
|
},
|
|
101
153
|
onPaginationChange: async function (paginationValues) {
|
|
102
154
|
const apiBody = [
|
|
@@ -115,7 +167,8 @@ export default (funcParams: funcParamsProps) => {
|
|
|
115
167
|
{ key: "searchValue", value: param.serachValue },
|
|
116
168
|
{ key: "currentValue", value: param.currentValue }
|
|
117
169
|
]
|
|
118
|
-
|
|
170
|
+
const response = await this.updateConfigApiBody(param, apiBody);
|
|
171
|
+
return response?.data;
|
|
119
172
|
}
|
|
120
173
|
},
|
|
121
174
|
onChange: async function () {
|
|
@@ -184,7 +237,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
184
237
|
if (eventGroups?.[eventType]?.[path] !== undefined) {
|
|
185
238
|
for (const eventConfig of eventGroups?.[eventType]?.[path]) {
|
|
186
239
|
executeEventsParameters.store.functionParameters = functionParameters
|
|
187
|
-
|
|
240
|
+
executeEvents({
|
|
188
241
|
...executeEventsParameters,
|
|
189
242
|
config: eventConfig,
|
|
190
243
|
componentName: path
|
|
@@ -192,18 +245,9 @@ export default (funcParams: funcParamsProps) => {
|
|
|
192
245
|
}
|
|
193
246
|
}
|
|
194
247
|
},
|
|
248
|
+
|
|
195
249
|
downloadFile: downloadFile,
|
|
196
250
|
download: doDownload,
|
|
251
|
+
...funcParams.functionsProvider
|
|
197
252
|
};
|
|
198
253
|
};
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|