impaktapps-ui-builder 0.0.412 → 0.0.592-alpha.1

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.
Files changed (79) hide show
  1. package/dist/impaktapps-ui-builder.es.js +2348 -1644
  2. package/dist/impaktapps-ui-builder.es.js.map +1 -1
  3. package/dist/impaktapps-ui-builder.umd.js +15 -15
  4. package/dist/impaktapps-ui-builder.umd.js.map +1 -1
  5. package/dist/src/impaktapps-ui-builder/builder/build/buildBasicUiSchema.d.ts +1 -1
  6. package/dist/src/impaktapps-ui-builder/builder/build/buildCard.d.ts +1 -1
  7. package/dist/src/impaktapps-ui-builder/builder/build/buildConfig.d.ts +1 -1
  8. package/dist/src/impaktapps-ui-builder/builder/build/buildUiSchema.d.ts +1 -1
  9. package/dist/src/impaktapps-ui-builder/builder/build/uischema/apiSection.d.ts +35 -2
  10. package/dist/src/impaktapps-ui-builder/builder/build/uischema/box.d.ts +2 -2
  11. package/dist/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.d.ts +20 -0
  12. package/dist/src/impaktapps-ui-builder/builder/build/uischema/button.d.ts +1 -6
  13. package/dist/src/impaktapps-ui-builder/builder/build/uischema/card.d.ts +106 -87
  14. package/dist/src/impaktapps-ui-builder/builder/build/uischema/coreSection.d.ts +15 -0
  15. package/dist/src/impaktapps-ui-builder/builder/build/uischema/eventSection.d.ts +71 -122
  16. package/dist/src/impaktapps-ui-builder/builder/build/uischema/file.d.ts +6 -6
  17. package/dist/src/impaktapps-ui-builder/builder/build/uischema/graph.d.ts +4 -106
  18. package/dist/src/impaktapps-ui-builder/builder/build/uischema/leaderBoard.d.ts +58 -45
  19. package/dist/src/impaktapps-ui-builder/builder/build/uischema/table.d.ts +1 -0
  20. package/dist/src/impaktapps-ui-builder/builder/build/uischema/tableSection.d.ts +74 -99
  21. package/dist/src/impaktapps-ui-builder/builder/build/uischema/validationSections.d.ts +17 -2
  22. package/dist/src/impaktapps-ui-builder/builder/build/uischema/valueTab.d.ts +17 -2
  23. package/dist/src/impaktapps-ui-builder/builder/build/uischema/wrapperSection.d.ts +1 -0
  24. package/dist/src/impaktapps-ui-builder/builder/services/component.d.ts +4 -2
  25. package/dist/src/impaktapps-ui-builder/builder/services/event.d.ts +2 -1
  26. package/dist/src/impaktapps-ui-builder/builder/services/pageMaster.d.ts +3 -1
  27. package/dist/src/impaktapps-ui-builder/runtime/services/events.d.ts +1 -1
  28. package/dist/src/impaktapps-ui-builder/runtime/services/interface.d.ts +1 -0
  29. package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +2 -1
  30. package/package.json +1 -1
  31. package/src/impaktapps-ui-builder/builder/build/buildBasicUiSchema.ts +1 -1
  32. package/src/impaktapps-ui-builder/builder/build/buildCard.ts +6 -6
  33. package/src/impaktapps-ui-builder/builder/build/buildConfig.ts +5 -5
  34. package/src/impaktapps-ui-builder/builder/build/buildDate.ts +1 -1
  35. package/src/impaktapps-ui-builder/builder/build/buildFileInput.ts +1 -1
  36. package/src/impaktapps-ui-builder/builder/build/buildHorizontalBarGraph.ts +7 -2
  37. package/src/impaktapps-ui-builder/builder/build/buildPieGraph.ts +13 -2
  38. package/src/impaktapps-ui-builder/builder/build/buildProgressBar.ts +1 -1
  39. package/src/impaktapps-ui-builder/builder/build/buildRadio.ts +1 -1
  40. package/src/impaktapps-ui-builder/builder/build/buildSchema.ts +0 -1
  41. package/src/impaktapps-ui-builder/builder/build/buildStackBarGraph.ts +1 -5
  42. package/src/impaktapps-ui-builder/builder/build/buildTable.ts +17 -1
  43. package/src/impaktapps-ui-builder/builder/build/buildTreeMap.ts +3 -0
  44. package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +7 -7
  45. package/src/impaktapps-ui-builder/builder/build/buildWrapperSection.ts +1 -1
  46. package/src/impaktapps-ui-builder/builder/build/uischema/apiSection.ts +50 -27
  47. package/src/impaktapps-ui-builder/builder/build/uischema/box.ts +3 -2
  48. package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +100 -70
  49. package/src/impaktapps-ui-builder/builder/build/uischema/button.ts +2 -7
  50. package/src/impaktapps-ui-builder/builder/build/uischema/card.ts +114 -74
  51. package/src/impaktapps-ui-builder/builder/build/uischema/coreSection.ts +30 -47
  52. package/src/impaktapps-ui-builder/builder/build/uischema/dateInputField.ts +4 -14
  53. package/src/impaktapps-ui-builder/builder/build/uischema/emptyBox.ts +1 -1
  54. package/src/impaktapps-ui-builder/builder/build/uischema/eventSection.ts +34 -56
  55. package/src/impaktapps-ui-builder/builder/build/uischema/file.ts +2 -12
  56. package/src/impaktapps-ui-builder/builder/build/uischema/graph.ts +7 -118
  57. package/src/impaktapps-ui-builder/builder/build/uischema/leaderBoard.ts +78 -69
  58. package/src/impaktapps-ui-builder/builder/build/uischema/multiSelect.ts +1 -1
  59. package/src/impaktapps-ui-builder/builder/build/uischema/refresh.ts +15 -11
  60. package/src/impaktapps-ui-builder/builder/build/uischema/selectInputField.ts +1 -6
  61. package/src/impaktapps-ui-builder/builder/build/uischema/table.ts +5 -7
  62. package/src/impaktapps-ui-builder/builder/build/uischema/tableSection.ts +85 -101
  63. package/src/impaktapps-ui-builder/builder/build/uischema/textInputField.ts +1 -6
  64. package/src/impaktapps-ui-builder/builder/build/uischema/validationSections.ts +12 -12
  65. package/src/impaktapps-ui-builder/builder/build/uischema/valueTab.ts +13 -13
  66. package/src/impaktapps-ui-builder/builder/build/uischema/wrapperSection.ts +1 -0
  67. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +0 -2
  68. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +346 -172
  69. package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/schema.ts +1 -1
  70. package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/uiSchema.ts +540 -315
  71. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +1 -0
  72. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/uiSchema.ts +388 -264
  73. package/src/impaktapps-ui-builder/builder/services/component.ts +26 -9
  74. package/src/impaktapps-ui-builder/builder/services/event.ts +42 -6
  75. package/src/impaktapps-ui-builder/builder/services/pageMaster.ts +19 -3
  76. package/src/impaktapps-ui-builder/builder/services/utils.ts +0 -1
  77. package/src/impaktapps-ui-builder/runtime/services/events.ts +31 -18
  78. package/src/impaktapps-ui-builder/runtime/services/interface.ts +1 -0
  79. package/src/impaktapps-ui-builder/runtime/services/service.ts +135 -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 = dynamicData.path.split(".")[1];
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 = dynamicData.path.split(".")[1];
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,28 +24,56 @@ 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[1].elements[0].elements[3] = emptyBox;
32
+ uiSchema.elements[1].elements[0].elements[3] = {
33
+ type: "Control",
34
+ scope: "#/properties/emptyBox",
35
+ options: {
36
+ widget: "EmptyBox",
37
+ },
38
+
39
+ config: {
40
+ layout: { xs: 0, sm: 6, md: 0, lg: 0 },
41
+ main: {},
42
+ style:{}
43
+ },
44
+ };
33
45
  uiSchema.elements[1].elements[0].elements[4] = getTextArea("eventCode", "Write Custom Code", false)
34
46
  schema.required = ["eventType", "Handler", "eventCode"]
35
47
 
36
48
  } else if (handlerType === "api") {
37
- uiSchema.elements[1].elements[0].elements[2] = APISection;
49
+ uiSchema.elements[1].elements[0].elements[2] = emptyBox;
50
+ uiSchema.elements[1].elements[0].elements[3] = APISection;
38
51
  schema.required = ["eventType", "Handler", "method", "path"]
39
52
  } else if (handlerType === "inBuiltFunction") {
53
+
40
54
  uiSchema.elements[1].elements[0].elements[2] = getSelectField("inBuiltFunctionType", "Function Name", [
41
55
  { label: "RankProvider", value: "RankProvider" },
42
56
  { label: "Download File", value: "downloadFile" },
43
57
  { label: "Download Blob File", value: "downloadBlobFile" }
44
58
  ])
45
- uiSchema.elements[1].elements[0].elements[3] = getTextArea("funcParametersCode", "Write Custom Code for Functions Parameter", true, { xs: 12, sm: 12, md: 6 });
59
+ uiSchema.elements[1].elements[0].elements[3] = {
60
+ type: "Control",
61
+ scope: "#/properties/emptyBox",
62
+ options: {
63
+ widget: "EmptyBox",
64
+ },
65
+
66
+ config: {
67
+ layout: { xs: 6, sm: 6, md: 0, lg: 0 },
68
+ main: {},
69
+ style:{}
70
+ },
71
+ };
72
+ uiSchema.elements[1].elements[0].elements[4] = getTextArea("funcParametersCode", "Write Custom Code for Functions Parameter", true);
46
73
  schema.required = ["eventType", "Handler", "inBuiltFunctionType"]
47
74
  } else if (handlerType === "refresh") {
48
- uiSchema.elements[1].elements[0].elements[2] = refreshSectionUiSchema;
75
+ uiSchema.elements[1].elements[0].elements[2] = emptyBox;
76
+ uiSchema.elements[1].elements[0].elements[3] = refreshSectionUiSchema;
49
77
  schema.properties.refreshElements.required = ["value"]
50
78
  schema.properties.refreshElements.items.required = ["value"]
51
79
  schema.required = ["eventType", "Handler", "refreshElements"]
@@ -99,9 +127,17 @@ export default (
99
127
  this.setPage()
100
128
 
101
129
  },
102
- deleteEvent: Component(store, dynamicData, submitHandler, service).deleteEvent,
130
+ deleteEvent: async function () {
131
+ await Component(store, dynamicData, submitHandler, service).deleteEvent(false);
132
+ store.updateDialog("popUpEvent");
133
+ },
103
134
  backHandler: function () {
104
135
  store.navigate(-1)
105
136
  },
137
+ deletePopUpEvent: function(){
138
+ const rowId = dynamicData.path.split(".")[1];
139
+ localStorage.setItem('rowId',rowId);
140
+ store.updateDialog("popUpEvent");
141
+ }
106
142
  }
107
143
  };
@@ -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
- Delete_Components: Component(store, dynamicData, submitHandler, service).deleteComponents,
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 = dynamicData.path.split(".")[1];
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
- return Promise.all(compToRefresh.map(componentName => {
102
- return Promise.all(params.eventGroups.onLoad[componentName].map(compEventConfig => {
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
- store.setFormdata((pre) => { return { ...pre, [componentName]: eventConfig.lazyLoading ? handlerResponse?.data?.data : handlerResponse.data } });
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
+ }
@@ -9,4 +9,5 @@ export interface handlersProps {
9
9
  eventGroups?: any,
10
10
  parentEventOutput?: any,
11
11
  functionsProvider?:Record<string,any>
12
+ formDataHolder?:Record<string,any>
12
13
  }
@@ -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,119 @@ 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: {xs: '12px', sm: '84px'},
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
+ display: {xs: 'none', sm: "flex"},
184
+ textAlign: 'left',
185
+ lineHeight: 1,
186
+ height: 0,
187
+ width: 'fit-content',
188
+ color: theme.palette.primary.main,
189
+ fontSize: "12px",
190
+ cursor: 'pointer',
191
+ marginLeft: '2px',
192
+ marginRight: 0,
193
+ top: 3,
194
+ right: '12px',
195
+ position: 'absolute',
196
+ ':hover': {
197
+ color: theme.palette.primary.dark,
198
+ }
199
+ }
200
+ },
201
+ },
202
+ ]
203
+ }
204
+ );
93
205
  const schema = pageData?.schema ?? { type: "object", properties: {} };
94
206
  eventGroups = {}
95
207
  eventGroups = extractEvents(config);
@@ -97,12 +209,12 @@ export default (funcParams: funcParamsProps) => {
97
209
  config: {}, componentName: "",
98
210
  store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
99
211
  functionsProvider: funcParams.functionsProvider,
100
- serviceHolder: this, eventGroups
212
+ serviceHolder: this, eventGroups, formDataHolder
101
213
  }
102
214
  await executeRefreshHandler({
103
215
  config: {}, componentName: "",
104
216
  store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
105
- serviceHolder: this, eventGroups
217
+ serviceHolder: this, eventGroups, formDataHolder
106
218
  })
107
219
  funcParams.store.setSchema(
108
220
  (pre: any) => {
@@ -114,7 +226,6 @@ export default (funcParams: funcParamsProps) => {
114
226
  )
115
227
  uiSchema.elements.push(notifyUiSchema);
116
228
  funcParams.store.setUiSchema(uiSchema);
117
-
118
229
  },
119
230
  onCellRenderer: (cellParams) => {
120
231
  if (eventGroups.onCellRenderer) {
@@ -147,6 +258,16 @@ export default (funcParams: funcParamsProps) => {
147
258
  backHandler: function () {
148
259
  funcParams.store.navigate(-1)
149
260
  },
261
+ onRowMovement: async function (paginationValues) {
262
+ const apiBody = [
263
+ { key: "direction", value: paginationValues.rowMovement.direction },
264
+ { key: "movedRowId", value: paginationValues.rowMovement.movedRowId },
265
+ { key: "targetRowId", value: paginationValues.rowMovement.targetRowId || [] }
266
+ ]
267
+ await this.callExecuteEvents({ path: paginationValues?.path }, apiBody, "onRowMovement");
268
+ const response = await this.callExecuteEvents({ path: paginationValues?.path }, apiBody, "onLoad");
269
+ return response?.data;
270
+ },
150
271
  onPaginationChange: async function (paginationValues) {
151
272
  const apiBody = [
152
273
  { key: "size", value: paginationValues.pagination.pageSize },
@@ -155,7 +276,7 @@ export default (funcParams: funcParamsProps) => {
155
276
  { key: "filters", value: paginationValues.columnFilters || [] },
156
277
  { key: "globalFilter", value: paginationValues.globalFilter ?? '' }
157
278
  ]
158
- const response = await this.updateConfigApiBody(paginationValues, apiBody);
279
+ const response = await this.callExecuteEvents(paginationValues, apiBody, "onLoad");
159
280
  return response?.data;
160
281
  },
161
282
  getSelectOptions: async function (param) {
@@ -164,7 +285,7 @@ export default (funcParams: funcParamsProps) => {
164
285
  { key: "searchValue", value: param.serachValue },
165
286
  { key: "currentValue", value: param.currentValue }
166
287
  ]
167
- const response = await this.updateConfigApiBody(param, apiBody);
288
+ const response = await this.callExecuteEvents(param, apiBody);
168
289
  return response?.data;
169
290
  }
170
291
  },
@@ -187,9 +308,9 @@ export default (funcParams: funcParamsProps) => {
187
308
  }))
188
309
  }
189
310
  },
190
- updateConfigApiBody: async function (paramValue, apiBody) {
311
+ callExecuteEvents: async function (paramValue, apiBody, eventType: string) {
191
312
  let LastCallResponse = undefined;
192
- for (const eventConfig of eventGroups?.onLoad[paramValue.path]) {
313
+ for (const eventConfig of eventGroups?.[eventType]?.[paramValue.path]) {
193
314
  if (eventConfig.body) {
194
315
  eventConfig.body = [
195
316
  ...eventConfig.body,
@@ -232,17 +353,16 @@ export default (funcParams: funcParamsProps) => {
232
353
  callHandler: async function (eventType: string, functionParameters?: any) {
233
354
  const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
234
355
  if (eventGroups?.[eventType]?.[path] !== undefined) {
235
- for (const eventConfig of eventGroups?.[eventType]?.[path]) {
356
+ Promise.all(eventGroups?.[eventType]?.[path].map((eventConfig) => {
236
357
  executeEventsParameters.store.functionParameters = functionParameters
237
358
  executeEvents({
238
359
  ...executeEventsParameters,
239
360
  config: eventConfig,
240
361
  componentName: path
241
362
  })
242
- }
363
+ }))
243
364
  }
244
365
  },
245
-
246
366
  downloadFile: downloadFile,
247
367
  download: doDownload,
248
368
  ...funcParams.functionsProvider