impaktapps-ui-builder 0.0.409-p → 0.0.409-q

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.
@@ -1,6 +1,7 @@
1
1
  interface funcParamsProps {
2
2
  store: any;
3
3
  dynamicData: any;
4
+ pageConfigProvider: any;
4
5
  submitHandler: any;
5
6
  service: any;
6
7
  }
@@ -3,6 +3,7 @@ interface funcParamsProps {
3
3
  dynamicData: any;
4
4
  service: any;
5
5
  userValue: any;
6
+ pageDataProvider: any;
6
7
  functionsProvider?: Record<string, any>;
7
8
  }
8
9
  export declare const extractEvents: (eventConfig: any) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "0.0.409p",
3
+ "version": "0.0.409q",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -8,12 +8,12 @@ import { getFormdataFromLocalStorage, saveFormdataInLocalStorage, saveHandler }
8
8
  interface funcParamsProps {
9
9
  store: any,
10
10
  dynamicData: any,
11
-
11
+ pageConfigProvider: any,
12
12
  submitHandler: any,
13
13
  service: any
14
14
  }
15
15
  export default (funcParams: funcParamsProps) => {
16
- const { store, dynamicData, submitHandler, service } = funcParams
16
+ const { store, dynamicData, submitHandler, service } = funcParams
17
17
  return {
18
18
  setPage: async function () {
19
19
  const formdata = await this.getFormdata();
@@ -25,12 +25,7 @@ export default (funcParams: funcParamsProps) => {
25
25
  },
26
26
  getFormdata: async function () {
27
27
  const id = store.searchParams?.get("id");
28
- let config: any = {};
29
- if (id) {
30
- await service.get(`/page/getById?id=${id}`).then((res: any) => {
31
- config = res.data?.config;
32
- });
33
- }
28
+ let config: any = await funcParams.pageConfigProvider()
34
29
  const formData = getFormdataFromLocalStorage()
35
30
  if (formData) {
36
31
  return formData;
@@ -58,7 +53,7 @@ export default (funcParams: funcParamsProps) => {
58
53
  store.navigate(
59
54
  `/Component?path=${`elements[${response?.elements.length}]`}&id=${id}`
60
55
  );
61
- }else{
56
+ } else {
62
57
  store.navigate(
63
58
  `/Component?path=${`elements[${response?.elements.length}]`}`
64
59
  );
@@ -18,6 +18,7 @@ interface funcParamsProps {
18
18
  dynamicData: any,
19
19
  service: any,
20
20
  userValue: any,
21
+ pageDataProvider: any,
21
22
  functionsProvider?: Record<string, any>
22
23
  }
23
24
 
@@ -64,29 +65,13 @@ export default (funcParams: funcParamsProps) => {
64
65
  return {
65
66
  setPage: async function () {
66
67
  funcParams.store.setFormdata({})
67
- const data = JSON.stringify({
68
- pageName: funcParams.store.pageName
69
- });
68
+
70
69
  let pageData;
71
70
  const pageBasicDetailString = localStorage.getItem("pagemasterMetaData")
72
71
  if (pageBasicDetailString) {
73
72
  pageData = JSON.parse(pageBasicDetailString)
74
73
  } 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
- },
87
- }
88
- );
89
- pageData = response.data;
74
+ pageData = funcParams.pageDataProvider();
90
75
  localStorage.setItem("pagemasterMetaData", JSON.stringify({
91
76
  schema: pageData?.schema,
92
77
  uiSchema: pageData?.uiSchema, config: pageData?.config
@@ -121,19 +106,20 @@ export default (funcParams: funcParamsProps) => {
121
106
 
122
107
  },
123
108
  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
- })
109
+ if (eventGroups.onCellRenderer) {
110
+ let finalResponse = {};
111
+ const path = funcParams.dynamicData?.tableButtonPath || funcParams?.dynamicData?.path?.split(".")[0];
112
+ for (const eventConfig of eventGroups?.onCellRenderer[path]) {
113
+ executeEventsParameters.store.functionParameters = cellParams
114
+ finalResponse = executeEvents({
115
+ ...executeEventsParameters,
116
+ config: eventConfig,
117
+ componentName: path
118
+ })
119
+ }
120
+ return finalResponse
134
121
  }
135
- console.log("finalResponse >> >> >> ", finalResponse)
136
- return finalResponse
122
+ return {}
137
123
  },
138
124
  onClick: function () {
139
125
  this.callHandler("onClick")
@@ -237,7 +223,7 @@ export default (funcParams: funcParamsProps) => {
237
223
  if (eventGroups?.[eventType]?.[path] !== undefined) {
238
224
  for (const eventConfig of eventGroups?.[eventType]?.[path]) {
239
225
  executeEventsParameters.store.functionParameters = functionParameters
240
- executeEvents({
226
+ executeEvents({
241
227
  ...executeEventsParameters,
242
228
  config: eventConfig,
243
229
  componentName: path