impaktapps-ui-builder 0.0.409 → 0.0.411

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 (31) hide show
  1. package/dist/impaktapps-ui-builder.es.js +467 -258
  2. package/dist/impaktapps-ui-builder.es.js.map +1 -1
  3. package/dist/impaktapps-ui-builder.umd.js +13 -13
  4. package/dist/impaktapps-ui-builder.umd.js.map +1 -1
  5. package/dist/src/impaktapps-ui-builder/builder/build/buildBasicUiSchema.d.ts +4 -2
  6. package/dist/src/impaktapps-ui-builder/builder/build/buildTreeMap.d.ts +1 -0
  7. package/dist/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.d.ts +19 -0
  8. package/dist/src/impaktapps-ui-builder/builder/build/uischema/wrapperSection.d.ts +1 -1
  9. package/dist/src/impaktapps-ui-builder/builder/services/pageMaster.d.ts +2 -2
  10. package/dist/src/impaktapps-ui-builder/runtime/services/events.d.ts +7 -5
  11. package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +7 -8
  12. package/package.json +1 -1
  13. package/src/impaktapps-ui-builder/builder/build/buildBasicUiSchema.ts +9 -6
  14. package/src/impaktapps-ui-builder/builder/build/buildConfig.ts +0 -7
  15. package/src/impaktapps-ui-builder/builder/build/buildTreeMap.ts +58 -0
  16. package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +45 -49
  17. package/src/impaktapps-ui-builder/builder/build/buildWrapperSection.ts +16 -13
  18. package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +20 -8
  19. package/src/impaktapps-ui-builder/builder/build/uischema/card.ts +1 -1
  20. package/src/impaktapps-ui-builder/builder/build/uischema/coreSection.ts +19 -0
  21. package/src/impaktapps-ui-builder/builder/build/uischema/graph.ts +0 -1
  22. package/src/impaktapps-ui-builder/builder/build/uischema/wrapperSection.ts +1 -1
  23. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +24 -18
  24. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +19 -1
  25. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +2 -2
  26. package/src/impaktapps-ui-builder/builder/services/component.ts +55 -53
  27. package/src/impaktapps-ui-builder/builder/services/event.ts +5 -2
  28. package/src/impaktapps-ui-builder/builder/services/pageMaster.ts +5 -5
  29. package/src/impaktapps-ui-builder/runtime/services/downloadFile.ts +1 -1
  30. package/src/impaktapps-ui-builder/runtime/services/events.ts +129 -90
  31. package/src/impaktapps-ui-builder/runtime/services/service.ts +73 -45
@@ -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,15 @@ 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
+ pageDataProvider: any,
22
+ functionsProvider?: Record<string, any>
23
+ }
24
+ let pageData: any = false;
16
25
  export const extractEvents = (eventConfig: any) => {
17
26
  function extractsConfigEvents(eventConfigObj: any) {
18
27
  if (eventConfigObj.events) {
@@ -30,9 +39,15 @@ export const extractEvents = (eventConfig: any) => {
30
39
  return elem.eventType === "Success"
31
40
  })
32
41
  if (!(!!SuccessEvent) && event.eventType === "onLoad") {
42
+ if (!(!!event.events)) {
43
+ event.events = [];
44
+ }
33
45
  event.events.push({ Handler: "mergeFormdata", eventType: "Success", type: compType, lazyLoading: eventConfig.lazyLoading === "YES" ? true : false })
34
46
  }
35
47
  if (!(!!SuccessEvent) && (event.eventType === "onBack" || event.eventType === "onNext" || event.eventType === "onReset")) {
48
+ if (!(!!event.events)) {
49
+ event.events = [];
50
+ }
36
51
  event.events.push({ Handler: `${event.eventType}Handler`, eventType: "Success", type: compType, lazyLoading: eventConfig.lazyLoading === "YES" ? true : false })
37
52
  }
38
53
  eventGroups[event.eventType][eventConfigObj.name].push({ ...event, type: compType })
@@ -46,30 +61,38 @@ export const extractEvents = (eventConfig: any) => {
46
61
  }
47
62
  return eventGroups;
48
63
  };
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
- functionsProvider?: Record<string, any>
59
- }
60
64
  export default (funcParams: funcParamsProps) => {
61
65
  eventGroups = {}
62
- eventGroups = extractEvents(funcParams.config)
66
+ if (pageData) {
67
+ if ((!isEmpty(pageData)) && typeof pageData === "object") {
68
+ eventGroups = extractEvents(pageData?.config)
69
+ }
70
+ }
63
71
  let executeEventsParameters: handlersProps = {
64
72
  config: {}, componentName: "",
65
73
  store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
66
- serviceHolder: { downloadFile, download: doDownload ,...funcParams.functionsProvider}, eventGroups,
74
+ serviceHolder: { downloadFile, download: doDownload, ...funcParams.functionsProvider }, eventGroups,
67
75
  functionsProvider: funcParams.functionsProvider,
68
76
  };
69
77
  return {
70
78
  setPage: async function () {
71
- funcParams.store.setFormdata({});
72
- const demoData = await asyncOperation();
79
+ funcParams.store.setFormdata({})
80
+
81
+ const pageBasicDetailString = localStorage.getItem("pagemasterMetaData")
82
+ if (pageBasicDetailString) {
83
+ pageData = JSON.parse(pageBasicDetailString)
84
+ } else {
85
+ pageData = await funcParams.pageDataProvider();
86
+ localStorage.setItem("pagemasterMetaData", JSON.stringify({
87
+ schema: pageData?.schema,
88
+ uiSchema: pageData?.uiSchema, config: pageData?.config
89
+ }))
90
+ }
91
+ const config = pageData?.config;
92
+ const uiSchema = pageData?.uiSchema;
93
+ const schema = pageData?.schema ?? { type: "object", properties: {} };
94
+ eventGroups = {}
95
+ eventGroups = extractEvents(config);
73
96
  executeEventsParameters = {
74
97
  config: {}, componentName: "",
75
98
  store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
@@ -81,33 +104,48 @@ export default (funcParams: funcParamsProps) => {
81
104
  store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
82
105
  serviceHolder: this, eventGroups
83
106
  })
84
- const demoData2 = await asyncOperation();
85
107
  funcParams.store.setSchema(
86
108
  (pre: any) => {
87
109
  return {
88
- ...funcParams.schema, properties:
89
- { ...funcParams.schema.properties, ...pre.properties, }
110
+ ...schema, properties:
111
+ { ...schema.properties, ...pre.properties, }
90
112
  }
91
113
  }
92
114
  )
93
- funcParams.uiSchema.elements.push(notifyUiSchema);
94
- funcParams.store.setUiSchema(funcParams.uiSchema);
95
-
115
+ uiSchema.elements.push(notifyUiSchema);
116
+ funcParams.store.setUiSchema(uiSchema);
117
+
96
118
  },
97
- onClick: async function () {
98
- await this.callHandler("onClick")
119
+ onCellRenderer: (cellParams) => {
120
+ if (eventGroups.onCellRenderer) {
121
+ let finalResponse = {};
122
+ const path = funcParams.dynamicData?.tableButtonPath || funcParams?.dynamicData?.path?.split(".")[0];
123
+ for (const eventConfig of eventGroups?.onCellRenderer[path]) {
124
+ executeEventsParameters.store.functionParameters = cellParams
125
+ finalResponse = executeEvents({
126
+ ...executeEventsParameters,
127
+ config: eventConfig,
128
+ componentName: path
129
+ })
130
+ }
131
+ return finalResponse
132
+ }
133
+ return {}
134
+ },
135
+ onClick: function () {
136
+ this.callHandler("onClick")
99
137
  },
100
- onMount: async function () {
101
- await this.callHandler("onMount")
138
+ onMount: function () {
139
+ this.callHandler("onMount")
102
140
  },
103
- onFileDownload: async function () {
104
- await this.callHandler("onDownload")
141
+ onFileDownload: function () {
142
+ this.callHandler("onDownload")
105
143
  },
106
- onFileUpload: async function () {
107
- await this.callHandler("onUpload")
144
+ onFileUpload: function () {
145
+ this.callHandler("onUpload")
108
146
  },
109
- backHandler:function(){
110
- funcParams.store.navigate(-1)
147
+ backHandler: function () {
148
+ funcParams.store.navigate(-1)
111
149
  },
112
150
  onPaginationChange: async function (paginationValues) {
113
151
  const apiBody = [
@@ -126,7 +164,7 @@ export default (funcParams: funcParamsProps) => {
126
164
  { key: "searchValue", value: param.serachValue },
127
165
  { key: "currentValue", value: param.currentValue }
128
166
  ]
129
- const response = await this.updateConfigApiBody(param, apiBody);
167
+ const response = await this.updateConfigApiBody(param, apiBody);
130
168
  return response?.data;
131
169
  }
132
170
  },
@@ -196,7 +234,7 @@ export default (funcParams: funcParamsProps) => {
196
234
  if (eventGroups?.[eventType]?.[path] !== undefined) {
197
235
  for (const eventConfig of eventGroups?.[eventType]?.[path]) {
198
236
  executeEventsParameters.store.functionParameters = functionParameters
199
- await executeEvents({
237
+ executeEvents({
200
238
  ...executeEventsParameters,
201
239
  config: eventConfig,
202
240
  componentName: path
@@ -204,19 +242,9 @@ export default (funcParams: funcParamsProps) => {
204
242
  }
205
243
  }
206
244
  },
245
+
207
246
  downloadFile: downloadFile,
208
247
  download: doDownload,
209
248
  ...funcParams.functionsProvider
210
249
  };
211
250
  };
212
-
213
-
214
-
215
-
216
-
217
-
218
-
219
-
220
-
221
-
222
-