impaktapps-ui-builder 0.0.285 → 0.0.287

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.
@@ -9785,7 +9785,7 @@ async function executeRefreshHandler(params2) {
9785
9785
  const compToRefresh = getRefreshElements(params2.config, params2.eventGroups);
9786
9786
  for (const componentName of compToRefresh) {
9787
9787
  for (const compEventConfig of params2.eventGroups.onLoad[componentName]) {
9788
- await executeEvents({ ...params2, config: compEventConfig });
9788
+ await executeEvents({ ...params2, config: compEventConfig, componentName });
9789
9789
  }
9790
9790
  }
9791
9791
  }
@@ -9797,15 +9797,11 @@ async function executeApiEventHandler(params2) {
9797
9797
  "Access-Control-Allow-Origin": "*"
9798
9798
  };
9799
9799
  const { body: body2, headers: headers2 } = await buildApiPayload(params2.config, initialBody, initialHeaders, params2.store, params2.dynamicData, params2.userValue, params2.service);
9800
- let response2;
9801
- const dataJSON = await fetch(params2.config.path, {
9802
- method: "POST",
9803
- headers: {
9804
- "Content-Type": "application/json"
9805
- },
9806
- body: JSON.stringify(body2)
9807
- });
9808
- response2 = await dataJSON.json();
9800
+ const response2 = await params2.service[params2.config.method](
9801
+ params2.config.path,
9802
+ body2,
9803
+ headers2 && { headers: headers2 }
9804
+ );
9809
9805
  return response2;
9810
9806
  }
9811
9807
  async function executeInBuiltFunctionHandler(params) {
@@ -9824,12 +9820,14 @@ async function executeCustomHandler(params) {
9824
9820
  async function mergeFormdata(handlerResponse, componentName, eventConfig, store2) {
9825
9821
  if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse) && handlerResponse)) {
9826
9822
  store2.setSchema((pre) => {
9823
+ var _a;
9827
9824
  return {
9828
9825
  ...pre,
9829
9826
  properties: {
9830
9827
  ...pre.properties,
9831
9828
  [componentName]: {
9832
- enum: handlerResponse.data
9829
+ ...(_a = pre.properties) == null ? void 0 : _a[componentName],
9830
+ oneOf: handlerResponse.data
9833
9831
  }
9834
9832
  }
9835
9833
  };
@@ -9880,7 +9878,7 @@ async function shouldEventExecute(params2) {
9880
9878
  var _a, _b;
9881
9879
  const startEvent = (_b = (_a = params2.config) == null ? void 0 : _a.events) == null ? void 0 : _b.filter((e) => e.eventType === "onStart");
9882
9880
  if ((startEvent == null ? void 0 : startEvent.length) > 0) {
9883
- const { response: response2 } = await executeEventsHandler(params2);
9881
+ const response2 = await executeEventsHandler({ ...params2, config: startEvent[0] });
9884
9882
  return response2;
9885
9883
  }
9886
9884
  }
@@ -9981,11 +9979,7 @@ var service = (funcParams) => {
9981
9979
  serviceHolder: this,
9982
9980
  eventGroups
9983
9981
  };
9984
- await executeEvents({
9985
- ...executeEventsParameters,
9986
- config: { Handler: "refresh", eventType: "onPageRefresh" },
9987
- componentName: "all"
9988
- });
9982
+ await executeRefreshHandler(executeEventsParameters);
9989
9983
  funcParams.store.setSchema(
9990
9984
  (pre) => {
9991
9985
  return {
@@ -10008,34 +10002,24 @@ var service = (funcParams) => {
10008
10002
  });
10009
10003
  }
10010
10004
  },
10011
- onPaginationChange: async (paginationValues) => {
10012
- var _a, _b;
10013
- for (const eventConfig of eventGroups == null ? void 0 : eventGroups.onLoad[paginationValues.path]) {
10014
- const bodyValues = [
10015
- { key: "size", value: paginationValues.pagination.pageSize },
10016
- { key: "start", value: paginationValues.pagination.pageIndex * paginationValues.pagination.pageSize },
10017
- { key: "sorting", value: paginationValues.sorting || [] },
10018
- { key: "filters", value: paginationValues.columnFilters || [] },
10019
- { key: "globalFilter", value: (_a = paginationValues.globalFilter) != null ? _a : "" }
10005
+ onPaginationChange: async function(paginationValues) {
10006
+ var _a;
10007
+ const apiBody = [
10008
+ { key: "size", value: paginationValues.pagination.pageSize },
10009
+ { key: "start", value: paginationValues.pagination.pageIndex * paginationValues.pagination.pageSize },
10010
+ { key: "sorting", value: paginationValues.sorting || [] },
10011
+ { key: "filters", value: paginationValues.columnFilters || [] },
10012
+ { key: "globalFilter", value: (_a = paginationValues.globalFilter) != null ? _a : "" }
10013
+ ];
10014
+ return await this.updateConfigApiBody(paginationValues, apiBody);
10015
+ },
10016
+ getSelectOptions: async function(param) {
10017
+ if (param.serachValue !== "" && param.serachValue !== void 0) {
10018
+ const apiBody = [
10019
+ { key: "serachValue", value: param.serachValue },
10020
+ { key: "currentValue", value: param.currentValue }
10020
10021
  ];
10021
- if (eventConfig.body) {
10022
- eventConfig.body = [
10023
- ...eventConfig.body,
10024
- ...bodyValues
10025
- ];
10026
- } else {
10027
- eventConfig.body = bodyValues;
10028
- }
10029
- const responseEvent = (_b = eventConfig == null ? void 0 : eventConfig.events) == null ? void 0 : _b.filter((elem) => {
10030
- return elem.Handler !== "mergeFormdata";
10031
- });
10032
- eventConfig.events = responseEvent != null ? responseEvent : [];
10033
- const data2 = await executeEvents({
10034
- ...executeEventsParameters,
10035
- config: eventConfig,
10036
- componentName: paginationValues.path
10037
- });
10038
- return data2;
10022
+ return await this.updateConfigApiBody(param, apiBody);
10039
10023
  }
10040
10024
  },
10041
10025
  onChange: async function() {
@@ -10055,6 +10039,30 @@ var service = (funcParams) => {
10055
10039
  }));
10056
10040
  }
10057
10041
  },
10042
+ updateConfigApiBody: async function(paramValue, apiBody) {
10043
+ var _a;
10044
+ let LastCallResponse = void 0;
10045
+ for (const eventConfig of eventGroups == null ? void 0 : eventGroups.onLoad[paramValue.path]) {
10046
+ if (eventConfig.body) {
10047
+ eventConfig.body = [
10048
+ ...eventConfig.body,
10049
+ ...apiBody
10050
+ ];
10051
+ } else {
10052
+ eventConfig.body = apiBody;
10053
+ }
10054
+ const responseEvent = (_a = eventConfig == null ? void 0 : eventConfig.events) == null ? void 0 : _a.filter((elem) => {
10055
+ return elem.Handler !== "mergeFormdata";
10056
+ });
10057
+ eventConfig.events = responseEvent != null ? responseEvent : [];
10058
+ LastCallResponse = await executeEvents({
10059
+ ...executeEventsParameters,
10060
+ config: eventConfig,
10061
+ componentName: paramValue.path
10062
+ });
10063
+ }
10064
+ return LastCallResponse;
10065
+ },
10058
10066
  downloadFile
10059
10067
  };
10060
10068
  };