impaktapps-ui-builder 0.0.412 → 0.0.591
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 +2170 -1539
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +14 -14
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/dist/src/impaktapps-ui-builder/builder/build/buildBasicUiSchema.d.ts +1 -1
- package/dist/src/impaktapps-ui-builder/builder/build/buildConfig.d.ts +1 -1
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/apiSection.d.ts +35 -2
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/box.d.ts +2 -2
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.d.ts +18 -0
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/button.d.ts +1 -6
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/card.d.ts +10 -12
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/coreSection.d.ts +15 -0
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/eventSection.d.ts +71 -122
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/file.d.ts +6 -6
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/graph.d.ts +4 -106
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/leaderBoard.d.ts +58 -45
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/table.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/tableSection.d.ts +74 -99
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/validationSections.d.ts +17 -2
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/valueTab.d.ts +17 -2
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/wrapperSection.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/services/component.d.ts +4 -2
- package/dist/src/impaktapps-ui-builder/builder/services/event.d.ts +2 -1
- package/dist/src/impaktapps-ui-builder/builder/services/pageMaster.d.ts +3 -1
- package/dist/src/impaktapps-ui-builder/runtime/services/events.d.ts +1 -1
- package/dist/src/impaktapps-ui-builder/runtime/services/interface.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +2 -1
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildBasicUiSchema.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildConfig.ts +5 -5
- package/src/impaktapps-ui-builder/builder/build/buildDate.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildFileInput.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildHorizontalBarGraph.ts +7 -2
- package/src/impaktapps-ui-builder/builder/build/buildPieGraph.ts +13 -2
- package/src/impaktapps-ui-builder/builder/build/buildRadio.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildSchema.ts +0 -1
- package/src/impaktapps-ui-builder/builder/build/buildStackBarGraph.ts +1 -5
- package/src/impaktapps-ui-builder/builder/build/buildTable.ts +17 -1
- package/src/impaktapps-ui-builder/builder/build/buildTreeMap.ts +3 -0
- package/src/impaktapps-ui-builder/builder/build/buildWrapperSection.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/uischema/apiSection.ts +50 -27
- package/src/impaktapps-ui-builder/builder/build/uischema/box.ts +3 -2
- package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +86 -73
- package/src/impaktapps-ui-builder/builder/build/uischema/button.ts +2 -7
- package/src/impaktapps-ui-builder/builder/build/uischema/card.ts +88 -90
- package/src/impaktapps-ui-builder/builder/build/uischema/coreSection.ts +30 -47
- package/src/impaktapps-ui-builder/builder/build/uischema/dateInputField.ts +3 -13
- package/src/impaktapps-ui-builder/builder/build/uischema/emptyBox.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/uischema/eventSection.ts +34 -56
- package/src/impaktapps-ui-builder/builder/build/uischema/file.ts +2 -12
- package/src/impaktapps-ui-builder/builder/build/uischema/graph.ts +7 -118
- package/src/impaktapps-ui-builder/builder/build/uischema/leaderBoard.ts +82 -72
- package/src/impaktapps-ui-builder/builder/build/uischema/multiSelect.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/uischema/refresh.ts +15 -11
- package/src/impaktapps-ui-builder/builder/build/uischema/selectInputField.ts +1 -6
- package/src/impaktapps-ui-builder/builder/build/uischema/table.ts +5 -7
- package/src/impaktapps-ui-builder/builder/build/uischema/tableSection.ts +85 -101
- package/src/impaktapps-ui-builder/builder/build/uischema/textInputField.ts +1 -6
- package/src/impaktapps-ui-builder/builder/build/uischema/validationSections.ts +12 -12
- package/src/impaktapps-ui-builder/builder/build/uischema/valueTab.ts +13 -13
- package/src/impaktapps-ui-builder/builder/build/uischema/wrapperSection.ts +1 -0
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +0 -2
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +355 -165
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/schema.ts +1 -1
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/uiSchema.ts +533 -315
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +1 -0
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/uiSchema.ts +397 -264
- package/src/impaktapps-ui-builder/builder/services/component.ts +26 -9
- package/src/impaktapps-ui-builder/builder/services/event.ts +17 -7
- package/src/impaktapps-ui-builder/builder/services/pageMaster.ts +19 -3
- package/src/impaktapps-ui-builder/builder/services/utils.ts +0 -1
- package/src/impaktapps-ui-builder/runtime/services/events.ts +31 -18
- package/src/impaktapps-ui-builder/runtime/services/interface.ts +1 -0
- package/src/impaktapps-ui-builder/runtime/services/service.ts +134 -15
|
@@ -44,21 +44,20 @@ const sectionLabels = {
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
export const refreshPage = (type: string, store: any) => {
|
|
47
|
-
const UiSchema = _.cloneDeep(componentBasicUiSchema)
|
|
47
|
+
const UiSchema = _.cloneDeep(componentBasicUiSchema(store.theme.myTheme))
|
|
48
48
|
if (type) {
|
|
49
49
|
const sectionUiSchema = {
|
|
50
50
|
Core: CoreSection,
|
|
51
51
|
Value: ValueTab,
|
|
52
52
|
Style: StyleSection,
|
|
53
|
-
Event: EventSection,
|
|
54
|
-
Components: TableSection,
|
|
53
|
+
Event: EventSection(store.theme.myTheme),
|
|
54
|
+
Components: TableSection(store.theme.myTheme),
|
|
55
55
|
Properties: buildPropertiesSection(type),
|
|
56
56
|
Validation: ValidationSection
|
|
57
|
-
|
|
58
57
|
}
|
|
59
58
|
const elements = sectionLabels[type]?.map(e => sectionUiSchema[e]);
|
|
60
59
|
UiSchema.elements[1].config.main.tabLabels = sectionLabels[type] || ["Core", "Style", "Event", "Validation"];
|
|
61
|
-
UiSchema.elements[1].elements = elements || [CoreSection, StyleSection, EventSection, ValidationSection];
|
|
60
|
+
UiSchema.elements[1].elements = elements || [CoreSection, StyleSection, EventSection(store.theme.myTheme), ValidationSection];
|
|
62
61
|
|
|
63
62
|
}
|
|
64
63
|
store.setUiSchema(UiSchema);
|
|
@@ -107,20 +106,28 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
|
|
|
107
106
|
store.navigate(`/Component?path=${`elements[${rowId}]`}&id=${id}`)
|
|
108
107
|
}
|
|
109
108
|
},
|
|
110
|
-
deleteComponents: function () {
|
|
109
|
+
deleteComponents: function (shouldUpdateDialog: boolean = true) {
|
|
111
110
|
const path = store.searchParams?.get("path");
|
|
112
|
-
const rowId =
|
|
111
|
+
const rowId = localStorage.getItem('rowId');
|
|
113
112
|
store.formData.elements.splice(rowId, 1);
|
|
114
113
|
const response = saveFormdataInLocalStorage(store.ctx.core.data, path)
|
|
115
114
|
const data = path ? _.get(response, path) : response;
|
|
116
115
|
store.setFormdata(data);
|
|
116
|
+
if (shouldUpdateDialog) {
|
|
117
|
+
store.updateDialog("popUpComponentSection");
|
|
118
|
+
}
|
|
119
|
+
localStorage.removeItem('rowId');
|
|
117
120
|
},
|
|
118
|
-
deleteEvent: function () {
|
|
121
|
+
deleteEvent: function (shouldUpdateDialog: boolean = true) {
|
|
119
122
|
const path = store.searchParams?.get("path");
|
|
120
|
-
const rowId =
|
|
123
|
+
const rowId = localStorage.getItem('rowId');
|
|
121
124
|
store.formData.events.splice(rowId, 1);
|
|
122
125
|
const response = saveFormdataInLocalStorage(store.ctx.core.data, path)
|
|
123
126
|
store.setFormdata(_.get(response, path));
|
|
127
|
+
if (shouldUpdateDialog) {
|
|
128
|
+
store.updateDialog("popUpEventSection")
|
|
129
|
+
}
|
|
130
|
+
localStorage.removeItem('rowId');
|
|
124
131
|
},
|
|
125
132
|
widgetAddClickHandler: function () {
|
|
126
133
|
if (!Array.isArray(store.formData.elements)) {
|
|
@@ -155,6 +162,16 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
|
|
|
155
162
|
backHandler: function () {
|
|
156
163
|
store.navigate(-1)
|
|
157
164
|
},
|
|
165
|
+
deletePopUpComponent: function () {
|
|
166
|
+
const rowId = dynamicData.path.split(".")[1];
|
|
167
|
+
localStorage.setItem('rowId', rowId);
|
|
168
|
+
store.updateDialog("popUpComponentSection");
|
|
169
|
+
},
|
|
170
|
+
deletePopUpEvent: function () {
|
|
171
|
+
const rowId = dynamicData.path.split(".")[1];
|
|
172
|
+
localStorage.setItem('rowId', rowId);
|
|
173
|
+
store.updateDialog("popUpEventSection");
|
|
174
|
+
},
|
|
158
175
|
}
|
|
159
176
|
};
|
|
160
177
|
|
|
@@ -24,17 +24,18 @@ export default (
|
|
|
24
24
|
this.refreshPage(formdata.Handler, store)
|
|
25
25
|
},
|
|
26
26
|
refreshPage: (handlerType: any, store: any) => {
|
|
27
|
-
const uiSchema = _.cloneDeep(EventUiSchema);
|
|
27
|
+
const uiSchema = _.cloneDeep(EventUiSchema(store.theme.myTheme));
|
|
28
28
|
const schema: any = _.cloneDeep(EventSchema)
|
|
29
29
|
if (handlerType) {
|
|
30
30
|
if (handlerType === "custom") {
|
|
31
31
|
uiSchema.elements[1].elements[0].elements[2] = getRadioInputField("isSync","Run in Sync",["Yes","No"])
|
|
32
|
-
uiSchema.elements[
|
|
33
|
-
uiSchema.elements[1].elements[0].elements[
|
|
32
|
+
// uiSchema.elements[0].elements[0].elements[3] = emptyBox;
|
|
33
|
+
uiSchema.elements[1].elements[0].elements[3] = getTextArea("eventCode", "Write Custom Code", false)
|
|
34
34
|
schema.required = ["eventType", "Handler", "eventCode"]
|
|
35
35
|
|
|
36
36
|
} else if (handlerType === "api") {
|
|
37
|
-
uiSchema.elements[1].elements[0].elements[2] =
|
|
37
|
+
uiSchema.elements[1].elements[0].elements[2] = emptyBox;
|
|
38
|
+
uiSchema.elements[1].elements[0].elements[3] = APISection;
|
|
38
39
|
schema.required = ["eventType", "Handler", "method", "path"]
|
|
39
40
|
} else if (handlerType === "inBuiltFunction") {
|
|
40
41
|
uiSchema.elements[1].elements[0].elements[2] = getSelectField("inBuiltFunctionType", "Function Name", [
|
|
@@ -42,10 +43,11 @@ export default (
|
|
|
42
43
|
{ label: "Download File", value: "downloadFile" },
|
|
43
44
|
{ label: "Download Blob File", value: "downloadBlobFile" }
|
|
44
45
|
])
|
|
45
|
-
uiSchema.elements[1].elements[0].elements[3] = getTextArea("funcParametersCode", "Write Custom Code for Functions Parameter", true
|
|
46
|
+
uiSchema.elements[1].elements[0].elements[3] = getTextArea("funcParametersCode", "Write Custom Code for Functions Parameter", true);
|
|
46
47
|
schema.required = ["eventType", "Handler", "inBuiltFunctionType"]
|
|
47
48
|
} else if (handlerType === "refresh") {
|
|
48
|
-
uiSchema.elements[1].elements[0].elements[2] =
|
|
49
|
+
uiSchema.elements[1].elements[0].elements[2] = emptyBox;
|
|
50
|
+
uiSchema.elements[1].elements[0].elements[3] = refreshSectionUiSchema;
|
|
49
51
|
schema.properties.refreshElements.required = ["value"]
|
|
50
52
|
schema.properties.refreshElements.items.required = ["value"]
|
|
51
53
|
schema.required = ["eventType", "Handler", "refreshElements"]
|
|
@@ -99,9 +101,17 @@ export default (
|
|
|
99
101
|
this.setPage()
|
|
100
102
|
|
|
101
103
|
},
|
|
102
|
-
deleteEvent:
|
|
104
|
+
deleteEvent: async function () {
|
|
105
|
+
await Component(store, dynamicData, submitHandler, service).deleteEvent(false);
|
|
106
|
+
store.updateDialog("popUpEvent");
|
|
107
|
+
},
|
|
103
108
|
backHandler: function () {
|
|
104
109
|
store.navigate(-1)
|
|
105
110
|
},
|
|
111
|
+
deletePopUpEvent: function(){
|
|
112
|
+
const rowId = dynamicData.path.split(".")[1];
|
|
113
|
+
localStorage.setItem('rowId',rowId);
|
|
114
|
+
store.updateDialog("popUpEvent");
|
|
115
|
+
}
|
|
106
116
|
}
|
|
107
117
|
};
|
|
@@ -34,7 +34,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
34
34
|
return config
|
|
35
35
|
},
|
|
36
36
|
getUiSchema: function () {
|
|
37
|
-
return PageMasterUiSchema;
|
|
37
|
+
return PageMasterUiSchema(store.theme.myTheme);
|
|
38
38
|
},
|
|
39
39
|
getSchema: () => {
|
|
40
40
|
return PageMasterSchema;
|
|
@@ -62,7 +62,11 @@ export default (funcParams: funcParamsProps) => {
|
|
|
62
62
|
},
|
|
63
63
|
saveHandler: async () => await saveHandler(store, service, submitHandler),
|
|
64
64
|
Edit_Components: Component(store, dynamicData, submitHandler, service).editComponents,
|
|
65
|
-
|
|
65
|
+
|
|
66
|
+
Delete_Components: async function() {
|
|
67
|
+
await Component(store, dynamicData, submitHandler, service).deleteComponents(false);
|
|
68
|
+
store.updateDialog("popUpPageMasterComponent");
|
|
69
|
+
},
|
|
66
70
|
eventAddHandler: function () {
|
|
67
71
|
const id = store.searchParams?.get("id");
|
|
68
72
|
if (!Array.isArray(store.formData.events)) {
|
|
@@ -80,10 +84,22 @@ export default (funcParams: funcParamsProps) => {
|
|
|
80
84
|
store.navigate(`/ComponentEvents?path=${finalPath}&id=${id}`)
|
|
81
85
|
},
|
|
82
86
|
deleteEvent: function () {
|
|
83
|
-
const rowId =
|
|
87
|
+
const rowId = localStorage.getItem('rowId');
|
|
84
88
|
store.formData.events.splice(rowId, 1);
|
|
85
89
|
const response = saveFormdataInLocalStorage(store.ctx.core.data)
|
|
86
90
|
store.setFormdata(response);
|
|
91
|
+
store.updateDialog("popUpPageMasterEvent");
|
|
92
|
+
localStorage.removeItem('rowId');
|
|
93
|
+
},
|
|
94
|
+
deletePopUpComponent: function(){
|
|
95
|
+
const rowId = dynamicData.path.split(".")[1];
|
|
96
|
+
localStorage.setItem('rowId',rowId);
|
|
97
|
+
store.updateDialog("popUpPageMasterComponent");
|
|
98
|
+
},
|
|
99
|
+
deletePopUpEvent: function(){
|
|
100
|
+
const rowId = dynamicData.path.split(".")[1];
|
|
101
|
+
localStorage.setItem('rowId',rowId);
|
|
102
|
+
store.updateDialog("popUpPageMasterEvent");
|
|
87
103
|
},
|
|
88
104
|
}
|
|
89
105
|
};
|
|
@@ -91,7 +91,6 @@ export const navigateHandler = (store, isSubmitted, pageName?: string | boolean)
|
|
|
91
91
|
|
|
92
92
|
export function okHandler(store) {
|
|
93
93
|
const path = store.searchParams?.get("path");
|
|
94
|
-
console.log(store.ctx.core.errors)
|
|
95
94
|
if (_.isEmpty(store.ctx.core.errors)) {
|
|
96
95
|
saveFormdataInLocalStorage(store.ctx.core.data, path)
|
|
97
96
|
store.navigate(-1)
|
|
@@ -51,7 +51,7 @@ export const executeEvents = (params: handlersProps) => {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
return finalResponse;
|
|
54
|
-
}
|
|
54
|
+
}
|
|
55
55
|
|
|
56
56
|
function executeEventsHandler(params: handlersProps) {
|
|
57
57
|
if (params.config.Handler === "api") {
|
|
@@ -68,7 +68,8 @@ function executeEventsHandler(params: handlersProps) {
|
|
|
68
68
|
params.componentName,
|
|
69
69
|
params.config,
|
|
70
70
|
params.store,
|
|
71
|
-
params.service
|
|
71
|
+
params.service,
|
|
72
|
+
params.formDataHolder
|
|
72
73
|
);
|
|
73
74
|
} else if (params.config.Handler === "onBackHandler") {
|
|
74
75
|
return params.store.functionParameters?.handleBack();
|
|
@@ -92,18 +93,20 @@ export function getRefreshElements(eventConfig: any, eventGropus: any) {
|
|
|
92
93
|
result.push(result[0]);
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
|
-
console.log(result);
|
|
96
96
|
return result;
|
|
97
97
|
}
|
|
98
|
-
export function executeRefreshHandler(params: handlersProps) {
|
|
98
|
+
export async function executeRefreshHandler(params: handlersProps) {
|
|
99
99
|
const compToRefresh: string[] = getRefreshElements(params.config, params.eventGroups);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
return Promise.allSettled(compToRefresh.map(componentName => {
|
|
101
|
+
const eventConfigs = params.eventGroups.onLoad[componentName];
|
|
102
|
+
if (!eventConfigs) {
|
|
103
|
+
return Promise.resolve();
|
|
104
|
+
}
|
|
105
|
+
return Promise.allSettled(eventConfigs.map(compEventConfig => {
|
|
103
106
|
return executeEvents({ ...params, config: compEventConfig, componentName });
|
|
104
107
|
}));
|
|
105
|
-
}))
|
|
106
|
-
}
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
107
110
|
export function executeApiRequest(params: any) {
|
|
108
111
|
const initialBody = { ...params.userValue?.payload };
|
|
109
112
|
const initialHeaders = {
|
|
@@ -143,7 +146,7 @@ function executeCustomHandler(params: handlersProps) {
|
|
|
143
146
|
|
|
144
147
|
}
|
|
145
148
|
|
|
146
|
-
function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any, service: any) {
|
|
149
|
+
function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any, service: any, formDataHolder: any) {
|
|
147
150
|
if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
|
|
148
151
|
store.setSchema((pre) => {
|
|
149
152
|
return {
|
|
@@ -173,17 +176,22 @@ function mergeFormdata(handlerResponse: any, componentName: string, eventConfig:
|
|
|
173
176
|
}
|
|
174
177
|
else if (eventConfig.type === "page") {
|
|
175
178
|
if (!(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
|
|
179
|
+
store.newData = {
|
|
180
|
+
...store.newData,
|
|
181
|
+
...handlerResponse?.data
|
|
182
|
+
}
|
|
176
183
|
store.setFormdata((pre: any) => { return { ...pre, ...handlerResponse?.data } })
|
|
177
184
|
}
|
|
178
185
|
}
|
|
179
186
|
else {
|
|
180
187
|
if (handlerResponse) {
|
|
181
|
-
|
|
188
|
+
formDataHolder[componentName] = handlerResponse.data
|
|
189
|
+
store.setFormdata((pre) => { return { ...pre, ...formDataHolder } });
|
|
182
190
|
}
|
|
183
191
|
}
|
|
184
192
|
}
|
|
185
193
|
|
|
186
|
-
const buildBodyFormat = (body: any[], formData: any, userValue: any) => {
|
|
194
|
+
const buildBodyFormat = (body: any[], formData: any, userValue: any, store: any) => {
|
|
187
195
|
let finalBody = { ...userValue?.payload };
|
|
188
196
|
body.map((elem) => {
|
|
189
197
|
if (typeof elem?.value !== "string") {
|
|
@@ -192,6 +200,15 @@ const buildBodyFormat = (body: any[], formData: any, userValue: any) => {
|
|
|
192
200
|
if (elem?.value?.startsWith("$userValue")) {
|
|
193
201
|
const finalpath = elem.value.substring(11);
|
|
194
202
|
finalBody[elem.key] = _.get(userValue, finalpath);;
|
|
203
|
+
} else if (elem?.value?.startsWith("$urlParams")) {
|
|
204
|
+
const finalpath = elem.value.substring(11);
|
|
205
|
+
const value = store?.searchParams?.get(finalpath);
|
|
206
|
+
finalBody[elem.key] = value;
|
|
207
|
+
}
|
|
208
|
+
else if (elem?.value?.startsWith("$local")) {
|
|
209
|
+
const finalpath = elem.value.substring(7);
|
|
210
|
+
const value = JSON.parse(localStorage.getItem(finalpath) || '""')
|
|
211
|
+
finalBody[elem.key] = value;
|
|
195
212
|
}
|
|
196
213
|
else if (elem?.value?.startsWith("$")) {
|
|
197
214
|
const finalpath = elem.value.substring(1);
|
|
@@ -245,14 +262,10 @@ export function buildApiPayload(compConfig: any, body: any, headers: any, store:
|
|
|
245
262
|
if (compConfig?.headers) {
|
|
246
263
|
headers = buildHeadersFormat(compConfig.headers);
|
|
247
264
|
}
|
|
248
|
-
|
|
249
265
|
if (compConfig.body) {
|
|
250
|
-
body = { ...buildBodyFormat(compConfig.body, store.newData || store?.ctx?.core?.data || store.formData, userValue) };
|
|
266
|
+
body = { ...buildBodyFormat(compConfig.body, store.newData || store?.ctx?.core?.data || store.formData, userValue, store) };
|
|
251
267
|
}
|
|
252
|
-
|
|
253
268
|
const promiseChain = { body, headers };
|
|
254
|
-
|
|
255
|
-
|
|
256
269
|
if (compConfig.apiBody) {
|
|
257
270
|
const makeFunc = eval(compConfig.apiBody);
|
|
258
271
|
return { body: makeFunc(store, dynamicData, userValue, promiseChain.body), headers: promiseChain.headers };
|
|
@@ -269,4 +282,4 @@ export function asyncOperation() {
|
|
|
269
282
|
}
|
|
270
283
|
}, 50);
|
|
271
284
|
});
|
|
272
|
-
}
|
|
285
|
+
}
|
|
@@ -12,7 +12,7 @@ const notifyUiSchema = {
|
|
|
12
12
|
},
|
|
13
13
|
layout: 6,
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
let formDataHolder = {}
|
|
16
16
|
interface funcParamsProps {
|
|
17
17
|
store: any,
|
|
18
18
|
dynamicData: any,
|
|
@@ -54,7 +54,6 @@ export const extractEvents = (eventConfig: any) => {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
|
|
58
57
|
extractsConfigEvents(eventConfig)
|
|
59
58
|
if (eventConfig?.elements) {
|
|
60
59
|
eventConfig.elements.forEach(extractEvents);
|
|
@@ -72,12 +71,12 @@ export default (funcParams: funcParamsProps) => {
|
|
|
72
71
|
config: {}, componentName: "",
|
|
73
72
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
74
73
|
serviceHolder: { downloadFile, download: doDownload, ...funcParams.functionsProvider }, eventGroups,
|
|
75
|
-
functionsProvider: funcParams.functionsProvider,
|
|
74
|
+
functionsProvider: funcParams.functionsProvider, formDataHolder
|
|
76
75
|
};
|
|
77
76
|
return {
|
|
78
77
|
setPage: async function () {
|
|
79
|
-
funcParams.store.setFormdata({})
|
|
80
|
-
|
|
78
|
+
funcParams.store.setFormdata({});
|
|
79
|
+
funcParams.store.newData = {};
|
|
81
80
|
const pageBasicDetailString = localStorage.getItem("pagemasterMetaData")
|
|
82
81
|
if (pageBasicDetailString) {
|
|
83
82
|
pageData = JSON.parse(pageBasicDetailString)
|
|
@@ -90,6 +89,118 @@ export default (funcParams: funcParamsProps) => {
|
|
|
90
89
|
}
|
|
91
90
|
const config = pageData?.config;
|
|
92
91
|
const uiSchema = pageData?.uiSchema;
|
|
92
|
+
const event = new CustomEvent('pageNameChanged', {
|
|
93
|
+
detail: { pageName: config.label }
|
|
94
|
+
});
|
|
95
|
+
window.dispatchEvent(event)
|
|
96
|
+
const theme = funcParams?.store?.theme?.myTheme;
|
|
97
|
+
uiSchema.elements.push(
|
|
98
|
+
|
|
99
|
+
{
|
|
100
|
+
type: "HorizontalLayout",
|
|
101
|
+
config: {
|
|
102
|
+
main: {
|
|
103
|
+
direction: 'row'
|
|
104
|
+
},
|
|
105
|
+
style: {
|
|
106
|
+
flexDirection: "row",
|
|
107
|
+
position: "absolute",
|
|
108
|
+
bottom: 0,
|
|
109
|
+
marginBottom: '-8px',
|
|
110
|
+
height: 'fit-content',
|
|
111
|
+
overflow: 'hidden',
|
|
112
|
+
zIndex: 1000,
|
|
113
|
+
width: 'inherit'
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
elements: [
|
|
117
|
+
{
|
|
118
|
+
|
|
119
|
+
type: "Control",
|
|
120
|
+
scope: "#/properties/FooterText",
|
|
121
|
+
options: {
|
|
122
|
+
widget: "Box",
|
|
123
|
+
},
|
|
124
|
+
config: {
|
|
125
|
+
main: {
|
|
126
|
+
heading: "Copywriter@ACT21.IO"
|
|
127
|
+
},
|
|
128
|
+
style: {
|
|
129
|
+
color: theme?.palette?.text.disabled || "#AFAFAF",
|
|
130
|
+
fontSize: '12px',
|
|
131
|
+
textAlign: 'center',
|
|
132
|
+
lineHeight: 1,
|
|
133
|
+
width: 'fit-content',
|
|
134
|
+
left: '50%',
|
|
135
|
+
position: 'relative',
|
|
136
|
+
margin: 0,
|
|
137
|
+
flexGrow: 1,
|
|
138
|
+
height: 0
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
type: "Control",
|
|
144
|
+
scope: "#/properties/backIcon",
|
|
145
|
+
options: {
|
|
146
|
+
widget: "Box",
|
|
147
|
+
},
|
|
148
|
+
config: {
|
|
149
|
+
main: {
|
|
150
|
+
iconName: 'PrevIcon',
|
|
151
|
+
onClick: "backHandler",
|
|
152
|
+
width: 'fit-content',
|
|
153
|
+
},
|
|
154
|
+
style: {
|
|
155
|
+
fill: theme.palette.primary.main,
|
|
156
|
+
width: 20,
|
|
157
|
+
height: 0,
|
|
158
|
+
margin: 0,
|
|
159
|
+
top: 0,
|
|
160
|
+
right: '82px',
|
|
161
|
+
position: 'absolute',
|
|
162
|
+
fontSize: '12px',
|
|
163
|
+
cursor: 'pointer',
|
|
164
|
+
':hover': {
|
|
165
|
+
fill: theme.palette.primary.dark,
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
type: "Control",
|
|
172
|
+
scope: "#/properties/text",
|
|
173
|
+
|
|
174
|
+
options: {
|
|
175
|
+
widget: "Box",
|
|
176
|
+
},
|
|
177
|
+
config: {
|
|
178
|
+
main: {
|
|
179
|
+
heading: "Previous Page",
|
|
180
|
+
onClick: "backHandler"
|
|
181
|
+
},
|
|
182
|
+
style: {
|
|
183
|
+
textAlign: 'left',
|
|
184
|
+
lineHeight: 1,
|
|
185
|
+
height: 0,
|
|
186
|
+
width: 'fit-content',
|
|
187
|
+
color: theme.palette.primary.main,
|
|
188
|
+
fontSize: "12px",
|
|
189
|
+
cursor: 'pointer',
|
|
190
|
+
marginLeft: '2px',
|
|
191
|
+
marginRight: 0,
|
|
192
|
+
top: 3,
|
|
193
|
+
right: '12px',
|
|
194
|
+
position: 'absolute',
|
|
195
|
+
':hover': {
|
|
196
|
+
color: theme.palette.primary.dark,
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
);
|
|
93
204
|
const schema = pageData?.schema ?? { type: "object", properties: {} };
|
|
94
205
|
eventGroups = {}
|
|
95
206
|
eventGroups = extractEvents(config);
|
|
@@ -97,12 +208,12 @@ export default (funcParams: funcParamsProps) => {
|
|
|
97
208
|
config: {}, componentName: "",
|
|
98
209
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
99
210
|
functionsProvider: funcParams.functionsProvider,
|
|
100
|
-
serviceHolder: this, eventGroups
|
|
211
|
+
serviceHolder: this, eventGroups, formDataHolder
|
|
101
212
|
}
|
|
102
213
|
await executeRefreshHandler({
|
|
103
214
|
config: {}, componentName: "",
|
|
104
215
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
105
|
-
serviceHolder: this, eventGroups
|
|
216
|
+
serviceHolder: this, eventGroups, formDataHolder
|
|
106
217
|
})
|
|
107
218
|
funcParams.store.setSchema(
|
|
108
219
|
(pre: any) => {
|
|
@@ -114,7 +225,6 @@ export default (funcParams: funcParamsProps) => {
|
|
|
114
225
|
)
|
|
115
226
|
uiSchema.elements.push(notifyUiSchema);
|
|
116
227
|
funcParams.store.setUiSchema(uiSchema);
|
|
117
|
-
|
|
118
228
|
},
|
|
119
229
|
onCellRenderer: (cellParams) => {
|
|
120
230
|
if (eventGroups.onCellRenderer) {
|
|
@@ -147,6 +257,16 @@ export default (funcParams: funcParamsProps) => {
|
|
|
147
257
|
backHandler: function () {
|
|
148
258
|
funcParams.store.navigate(-1)
|
|
149
259
|
},
|
|
260
|
+
onRowMovement: async function (paginationValues) {
|
|
261
|
+
const apiBody = [
|
|
262
|
+
{ key: "direction", value: paginationValues.rowMovement.direction },
|
|
263
|
+
{ key: "movedRowId", value: paginationValues.rowMovement.movedRowId },
|
|
264
|
+
{ key: "targetRowId", value: paginationValues.rowMovement.targetRowId || [] }
|
|
265
|
+
]
|
|
266
|
+
await this.callExecuteEvents({ path: paginationValues?.path }, apiBody, "onRowMovement");
|
|
267
|
+
const response = await this.callExecuteEvents({ path: paginationValues?.path }, apiBody, "onLoad");
|
|
268
|
+
return response?.data;
|
|
269
|
+
},
|
|
150
270
|
onPaginationChange: async function (paginationValues) {
|
|
151
271
|
const apiBody = [
|
|
152
272
|
{ key: "size", value: paginationValues.pagination.pageSize },
|
|
@@ -155,7 +275,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
155
275
|
{ key: "filters", value: paginationValues.columnFilters || [] },
|
|
156
276
|
{ key: "globalFilter", value: paginationValues.globalFilter ?? '' }
|
|
157
277
|
]
|
|
158
|
-
const response = await this.
|
|
278
|
+
const response = await this.callExecuteEvents(paginationValues, apiBody, "onLoad");
|
|
159
279
|
return response?.data;
|
|
160
280
|
},
|
|
161
281
|
getSelectOptions: async function (param) {
|
|
@@ -164,7 +284,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
164
284
|
{ key: "searchValue", value: param.serachValue },
|
|
165
285
|
{ key: "currentValue", value: param.currentValue }
|
|
166
286
|
]
|
|
167
|
-
const response = await this.
|
|
287
|
+
const response = await this.callExecuteEvents(param, apiBody);
|
|
168
288
|
return response?.data;
|
|
169
289
|
}
|
|
170
290
|
},
|
|
@@ -187,9 +307,9 @@ export default (funcParams: funcParamsProps) => {
|
|
|
187
307
|
}))
|
|
188
308
|
}
|
|
189
309
|
},
|
|
190
|
-
|
|
310
|
+
callExecuteEvents: async function (paramValue, apiBody, eventType: string) {
|
|
191
311
|
let LastCallResponse = undefined;
|
|
192
|
-
for (const eventConfig of eventGroups?.
|
|
312
|
+
for (const eventConfig of eventGroups?.[eventType]?.[paramValue.path]) {
|
|
193
313
|
if (eventConfig.body) {
|
|
194
314
|
eventConfig.body = [
|
|
195
315
|
...eventConfig.body,
|
|
@@ -232,17 +352,16 @@ export default (funcParams: funcParamsProps) => {
|
|
|
232
352
|
callHandler: async function (eventType: string, functionParameters?: any) {
|
|
233
353
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
234
354
|
if (eventGroups?.[eventType]?.[path] !== undefined) {
|
|
235
|
-
|
|
355
|
+
Promise.all(eventGroups?.[eventType]?.[path].map((eventConfig) => {
|
|
236
356
|
executeEventsParameters.store.functionParameters = functionParameters
|
|
237
357
|
executeEvents({
|
|
238
358
|
...executeEventsParameters,
|
|
239
359
|
config: eventConfig,
|
|
240
360
|
componentName: path
|
|
241
361
|
})
|
|
242
|
-
}
|
|
362
|
+
}))
|
|
243
363
|
}
|
|
244
364
|
},
|
|
245
|
-
|
|
246
365
|
downloadFile: downloadFile,
|
|
247
366
|
download: doDownload,
|
|
248
367
|
...funcParams.functionsProvider
|