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.
@@ -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
- onClick: () => Promise<void>;
14
- onFileDownload: () => Promise<void>;
15
- onFileUpload: () => Promise<void>;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "0.0.409m",
3
+ "version": "0.0.409o",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -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] = getTextArea("eventCode", "Write Custom Code", false)
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 { asyncOperation, executeEvents, executeRefreshHandler } from "./events";
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
- funcParams.store.setSchema(
71
- (pre: any) => {
72
- return {
73
- ...funcParams.schema, properties:
74
- { ...funcParams.schema.properties, ...pre.properties, }
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
- funcParams.uiSchema.elements.push(notifyUiSchema);
79
- funcParams.store.setUiSchema(funcParams.uiSchema);
80
- await asyncOperation()
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
- onClick: async function () {
93
- await this.callHandler("onClick")
144
+ onFileDownload: function () {
145
+ this.callHandler("onDownload")
94
146
  },
95
- onFileDownload: async function () {
96
- await this.callHandler("onDownload")
147
+ onFileUpload: function () {
148
+ this.callHandler("onUpload")
97
149
  },
98
- onFileUpload: async function () {
99
- await this.callHandler("onUpload")
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
- return await this.updateConfigApiBody(param, apiBody)
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
- await executeEvents({
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
-