impaktapps-ui-builder 0.0.276 → 0.0.278

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 (32) hide show
  1. package/dist/impaktapps-ui-builder.es.js +2474 -2353
  2. package/dist/impaktapps-ui-builder.es.js.map +1 -1
  3. package/dist/impaktapps-ui-builder.umd.js +11 -11
  4. package/dist/impaktapps-ui-builder.umd.js.map +1 -1
  5. package/dist/src/impaktapps-ui-builder/builder/build/buildButton.d.ts +1 -0
  6. package/dist/src/impaktapps-ui-builder/builder/build/buildEmptyBox.d.ts +1 -0
  7. package/dist/src/impaktapps-ui-builder/builder/build/buildUiSchema.d.ts +5 -0
  8. package/dist/src/impaktapps-ui-builder/builder/build/uischema/apiSection.d.ts +3 -0
  9. package/dist/src/impaktapps-ui-builder/builder/build/uischema/button.d.ts +1 -0
  10. package/dist/src/impaktapps-ui-builder/builder/build/uischema/coreSection.d.ts +6 -20
  11. package/dist/src/impaktapps-ui-builder/builder/build/uischema/graph.d.ts +1 -0
  12. package/dist/src/impaktapps-ui-builder/builder/build/uischema/validationSections.d.ts +25 -2
  13. package/dist/src/impaktapps-ui-builder/lib/index.d.ts +1 -0
  14. package/dist/src/impaktapps-ui-builder/runtime/services/events.d.ts +4 -1
  15. package/package.json +1 -1
  16. package/src/impaktapps-ui-builder/builder/build/buildButton.ts +6 -1
  17. package/src/impaktapps-ui-builder/builder/build/buildEmptyBox.ts +11 -0
  18. package/src/impaktapps-ui-builder/builder/build/buildLineGraph.ts +2 -2
  19. package/src/impaktapps-ui-builder/builder/build/buildSchema.ts +1 -3
  20. package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +43 -34
  21. package/src/impaktapps-ui-builder/builder/build/uischema/apiSection.ts +2 -0
  22. package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +27 -1
  23. package/src/impaktapps-ui-builder/builder/build/uischema/button.ts +2 -1
  24. package/src/impaktapps-ui-builder/builder/build/uischema/coreSection.ts +10 -2
  25. package/src/impaktapps-ui-builder/builder/build/uischema/graph.ts +1 -0
  26. package/src/impaktapps-ui-builder/builder/build/uischema/speedoMeter.ts +1 -1
  27. package/src/impaktapps-ui-builder/builder/build/uischema/validationSections.ts +52 -39
  28. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +7 -1
  29. package/src/impaktapps-ui-builder/builder/services/pageMaster.ts +2 -0
  30. package/src/impaktapps-ui-builder/lib/index.ts +1 -0
  31. package/src/impaktapps-ui-builder/runtime/services/events.ts +35 -88
  32. package/src/impaktapps-ui-builder/runtime/services/service.ts +18 -11
@@ -225,7 +225,7 @@ export const componentBasicUiSchema: any = {
225
225
  scope: "#/properties/value",
226
226
 
227
227
  options: {
228
- widget: "InputField",
228
+ widget: "MultipleSelect",
229
229
  },
230
230
  config: {
231
231
  layout: {
@@ -236,6 +236,12 @@ export const componentBasicUiSchema: any = {
236
236
  },
237
237
  main: {
238
238
  label: "Value",
239
+ options: [
240
+ { label: "3", value: "3" },
241
+ { label: "5.5", value: "5.5" },
242
+ { label: "8", value: "8" },
243
+ { label: "12", value: "12" },
244
+ ],
239
245
  },
240
246
  },
241
247
  },
@@ -3,6 +3,7 @@ import { PageMasterUiSchema } from "../elements/UiSchema/PageMaster/uiSchema";
3
3
  import _ from "lodash";
4
4
  import Component from "./component";
5
5
  import { getFormdataFromLocalStorage, saveFormdataInLocalStorage } from "./saveHandler";
6
+ import { schema } from "../build/buildUiSchema";
6
7
 
7
8
  interface funcParamsProps {
8
9
  store: any,
@@ -52,6 +53,7 @@ export default (funcParams:funcParamsProps) => {
52
53
  );
53
54
  },
54
55
  submitPageHandler: async function () {
56
+ console.log(schema)
55
57
  submitHandler(store,funcParams.service)
56
58
  .then((saveReturn: any) => {
57
59
  localStorage.removeItem("pageFormdata")
@@ -3,6 +3,7 @@ export {default as pageMaster} from "../builder/services/pageMaster"
3
3
  export {default as pageMasterEvents} from "../builder/services/event"
4
4
  export {default as pageMasterComponents} from "../builder/services/component"
5
5
  export {default as pageService} from "../runtime/services/service"
6
+ export { schema} from "../builder/build/buildUiSchema"
6
7
  export {default as buildConfig} from "../builder/build/buildConfig"
7
8
  export {default as buildUiSchema} from "../builder/build/buildUiSchema"
8
9
  export {default as buildSchema} from "../builder/build/buildSchema"
@@ -16,6 +16,11 @@ export const executeEvents = async (
16
16
  nextEvent = events;
17
17
  }
18
18
  else {
19
+ if (!shouldEventExecute(config, componentName,
20
+ store, dynamicData, userValue,
21
+ service, serviceHolder, eventGroups)) {
22
+ return { response: undefined, events: undefined };
23
+ }
19
24
  const { response, events } = await executeEventsHandler(config, componentName,
20
25
  store, dynamicData, userValue,
21
26
  service, serviceHolder, eventGroups, parentEventOutput)
@@ -35,14 +40,10 @@ const executetOnLoadEvent = async (
35
40
  ) => {
36
41
 
37
42
  try {
38
- const startEvent = config?.events.filter(e => e.eventType === "onStart");
39
- if(startEvent.length > 0){
40
- const { response } = await executeEventsHandler(config, componentName,
41
- store, dynamicData, userValue,
42
- service, serviceHolder, eventGroups, parentEventOutput);
43
- if(response){
44
- return;
45
- }
43
+ if (!shouldEventExecute(config, componentName,
44
+ store, dynamicData, userValue,
45
+ service, serviceHolder, eventGroups)) {
46
+ return { response: undefined, events: undefined };
46
47
  }
47
48
  const { response } = await executeEventsHandler(config, componentName,
48
49
  store, dynamicData, userValue,
@@ -141,20 +142,21 @@ async function executeInBuiltFunctionHandler(refreshHandlerConfig: any, componen
141
142
  async function executeCustomHandler(customHandlerConfig: any, componentName: string,
142
143
  store: any, dynamicData: any, userValue: any,
143
144
  service: any, serviceHolder: any, parentEventOutput?: any) {
144
- console.log(service)
145
- const makeFunc = eval(customHandlerConfig.eventCode)
146
- const response = await makeFunc(store, dynamicData, userValue, parentEventOutput, service,componentName);
145
+ console.log(service)
146
+ const makeFunc = eval(customHandlerConfig.eventCode)
147
+ const response = await makeFunc(store, dynamicData, userValue, parentEventOutput, service, componentName);
147
148
  return { response: response, events: customHandlerConfig?.events };
148
149
  }
149
150
 
150
151
  async function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any) {
151
-
152
- if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse)&&handlerResponse)) {
152
+
153
+ if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse) && handlerResponse)) {
153
154
  store.setSchema((pre) => {
154
155
  return {
155
156
  ...pre, properties: {
156
157
  ...pre.properties, [componentName]: {
157
- enum: handlerResponse.data
158
+ // ...pre?.properties?. [componentName],
159
+ oneOf: handlerResponse.data
158
160
  }
159
161
  }
160
162
  }
@@ -203,12 +205,24 @@ const buildHeadersFormat = (headers: any[]) => {
203
205
  return headerObj;
204
206
  }
205
207
 
206
-
208
+ async function shouldEventExecute(config, componentName,
209
+ store, dynamicData, userValue,
210
+ service, serviceHolder, eventGroups) {
211
+ const startEvent = config?.events?.filter(e => e.eventType === "onStart");
212
+ if (startEvent?.length > 0) {
213
+ const { response } = await executeEventsHandler(startEvent[0], componentName,
214
+ store, dynamicData, userValue,
215
+ service, serviceHolder, eventGroups);
216
+ return response
217
+ }
218
+ }
219
+ // if(!response){
220
+ // return {response:undefined,events:undefined};
221
+ // }
207
222
  export async function buildApiPayload(compConfig: any, body: any, headers: any, store: any, dynamicData: any, userValue: any, service) {
208
223
  if (compConfig?.headers) {
209
- headers = {
210
- headers: buildHeadersFormat(compConfig.headers)
211
- }
224
+ headers = buildHeadersFormat(compConfig.headers)
225
+
212
226
  }
213
227
  if (compConfig.body) {
214
228
  body = { ...buildBodyFormat(compConfig.body, store.newData || store?.ctx?.core?.data || store.formData, userValue) };
@@ -228,81 +242,14 @@ export function getRefreshElements(eventConfig: any, eventGropus: any) {
228
242
  result = eventConfig.refreshElements.map((e) => {
229
243
  return e.value
230
244
  })
231
-
245
+
232
246
  } else {
233
247
  if (eventGropus?.onLoad) {
234
248
  result = Object.keys(eventGropus?.onLoad)
235
- // const firstElem = result.shift();
236
- result.push(result[0]);
249
+ result.push(result[0]);
237
250
  }
238
251
  }
252
+ console.log(result);
239
253
  return result;
240
254
  }
241
255
 
242
-
243
-
244
- // const changeServerToFormData = async (res) => {
245
- // // store.formData = res?.data?.payload?.config?.features?.rule?.id;
246
- // const Api =
247
- // "/master/getDetailById?masterName=com.act21.hyperform3.entity.master.rule.Rule&id=" +
248
- // res?.data?.payload?.config?.features?.rule?.id;
249
-
250
- // const data = await service.get(Api).then((response: any) => {
251
- // const reportData = res?.data?.payload?.config?.features?.Reports?.names?.map(
252
- // (elem: any) => {
253
- // if (typeof elem === "string" || typeof elem === "number") {
254
- // return { label: elem, value: elem };
255
- // }
256
- // return elem;
257
- // }
258
- // );
259
- // const newData = {
260
- // id: res.data.payload.id,
261
- // name: res.data.payload.name,
262
- // program: JSON.stringify(res.data.payload.program),
263
- // startDate: res.data.payload.startDate,
264
- // endDate: res.data.payload.endDate,
265
- // downloadWorkflowFile:
266
- // res.data.payload.config.features.workflow.externalFileName,
267
- // uploadWorkflowFileId:
268
- // res.data.payload.config.features.workflow.externalDataId,
269
- // processDefKey1:
270
- // res.data.payload.config.features.workflow.processDefKey,
271
- // downloadInvoiceFile:
272
- // res.data.payload.config.features.invoice.externalFileName,
273
- // uploadInvoiceFileId:
274
- // res.data.payload.config.features.invoice.externalDataId,
275
- // invoiceEnabled: res.data.payload.config.features.invoice.enabled,
276
- // groupId: response?.data?.payload?.groupId,
277
- // project: response?.data?.payload?.artifactId,
278
- // version: response?.data?.payload?.version,
279
- // reportNames: reportData,
280
- // clawbackEnabled: res.data.payload.config.features.Clawback.enabled,
281
- // loadTimeout: res.data.payload.config.features?.timeouts?.loadTimeOut,
282
- // computeTimeout:
283
- // res.data.payload.config.features?.timeouts?.computeTimeOut,
284
- // adjustments: res.data.payload.config.features?.Adjustments,
285
- // };
286
- // return newData;
287
- // });
288
- // return data;
289
- // };
290
- // const action = store.searchParams?.get("id");
291
- // console.log(action)
292
- // if (action) {
293
- // const Api =
294
- // "/master/getDetailById?masterName=com.act21.hyperform3.entity.program.ProgramCycleStaging";
295
- // await service
296
- // .get(`${Api}&id=${action}`)
297
- // .then(async (res) => {
298
- // console.log("response", res)
299
- // const newData = await changeServerToFormData(res);
300
- // store.setFormdata((pre)=>{return {...pre,...newData}});
301
- // })
302
- // .catch(() => {});
303
- // }
304
-
305
-
306
-
307
-
308
-
@@ -3,7 +3,7 @@ import { downloadFile } from "./downloadFile";
3
3
  import { executeEvents } from "./events";
4
4
  let compType: string;
5
5
  let eventGroups: any = {};
6
- const notifyUiSchema = {
6
+ const notifyUiSchema = {
7
7
  type: "Control",
8
8
  scope: "#/properties/notify",
9
9
  options: {
@@ -37,7 +37,7 @@ export const extractEvents = (eventConfig: any) => {
37
37
  };
38
38
 
39
39
  interface funcParamsProps {
40
- store: any,
40
+ store: any,
41
41
  dynamicData: any,
42
42
  config: any,
43
43
  uiSchema: any,
@@ -45,25 +45,32 @@ interface funcParamsProps {
45
45
  service: any,
46
46
  userValue: any,
47
47
  }
48
- export default (funcParams:funcParamsProps) => {
48
+ export default (funcParams: funcParamsProps) => {
49
49
  return {
50
50
  setPage: async function () {
51
51
  funcParams.store.setFormdata({});
52
52
  eventGroups = {}
53
53
  eventGroups = extractEvents(funcParams.config)
54
54
  await executeEvents(
55
- { Handler: "refresh",eventType:"onPageRefresh"}, "all",
55
+ { Handler: "refresh", eventType: "onPageRefresh" }, "all",
56
56
  funcParams.store, funcParams.dynamicData, funcParams.userValue, funcParams.service,
57
57
  this, eventGroups)
58
- // funcParams.store.setSchema(JSON.parse(localStorage.getItem("schemaDemo")))
59
- funcParams.uiSchema.elements.push(notifyUiSchema);
60
- funcParams.store.setUiSchema(funcParams.uiSchema);
58
+ funcParams.store.setSchema(
59
+ (pre:any) => {
60
+ return {
61
+ ...funcParams.schema, properties:
62
+ { ...funcParams.schema.properties, ...pre.properties, }
63
+ }
64
+ })
65
+ funcParams.uiSchema.elements.push(notifyUiSchema);
66
+ funcParams.store.setUiSchema(funcParams.uiSchema);
61
67
  },
62
68
  onClick: async function () {
63
69
  const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
64
70
  for (const eventConfig of eventGroups?.onClick[path]) {
65
- await executeEvents(
66
- eventConfig, path,
71
+
72
+ await executeEvents(
73
+ eventConfig, path,
67
74
  funcParams.store, funcParams.dynamicData, funcParams.userValue, funcParams.service,
68
75
  this, eventGroups)
69
76
  }
@@ -79,8 +86,8 @@ export default (funcParams:funcParamsProps) => {
79
86
  for (const eventConfig of eventGroups.onChange[componentName]) {
80
87
  await executeEvents(
81
88
  eventConfig, componentName,
82
- funcParams.store, funcParams.dynamicData, funcParams.userValue, funcParams.service,
83
- this, eventGroups)
89
+ funcParams.store, funcParams.dynamicData, funcParams.userValue, funcParams.service,
90
+ this, eventGroups)
84
91
  }
85
92
  }
86
93
  }))