impaktapps-ui-builder 0.0.382-alpha.335 → 0.0.382-alpha.337

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.
@@ -1319,7 +1319,7 @@ var lodash = { exports: {} };
1319
1319
  }
1320
1320
  var runInContext = function runInContext2(context) {
1321
1321
  context = context == null ? root : _2.defaults(root.Object(), context, _2.pick(root, contextProps));
1322
- var Array2 = context.Array, Date = context.Date, Error = context.Error, Function2 = context.Function, Math = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String = context.String, TypeError = context.TypeError;
1322
+ var Array2 = context.Array, Date = context.Date, Error2 = context.Error, Function2 = context.Function, Math = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String = context.String, TypeError = context.TypeError;
1323
1323
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
1324
1324
  var coreJsData = context["__core-js_shared__"];
1325
1325
  var funcToString = funcProto.toString;
@@ -1804,7 +1804,7 @@ var lodash = { exports: {} };
1804
1804
  if (typeof func != "function") {
1805
1805
  throw new TypeError(FUNC_ERROR_TEXT);
1806
1806
  }
1807
- return setTimeout(function() {
1807
+ return setTimeout2(function() {
1808
1808
  func.apply(undefined$1, args);
1809
1809
  }, wait);
1810
1810
  }
@@ -3635,7 +3635,7 @@ var lodash = { exports: {} };
3635
3635
  return object[key];
3636
3636
  }
3637
3637
  var setData = shortOut(baseSetData);
3638
- var setTimeout = ctxSetTimeout || function(func, wait) {
3638
+ var setTimeout2 = ctxSetTimeout || function(func, wait) {
3639
3639
  return root.setTimeout(func, wait);
3640
3640
  };
3641
3641
  var setToString = shortOut(baseSetToString);
@@ -4427,7 +4427,7 @@ var lodash = { exports: {} };
4427
4427
  }
4428
4428
  function leadingEdge(time) {
4429
4429
  lastInvokeTime = time;
4430
- timerId = setTimeout(timerExpired, wait);
4430
+ timerId = setTimeout2(timerExpired, wait);
4431
4431
  return leading ? invokeFunc(time) : result2;
4432
4432
  }
4433
4433
  function remainingWait(time) {
@@ -4443,7 +4443,7 @@ var lodash = { exports: {} };
4443
4443
  if (shouldInvoke(time)) {
4444
4444
  return trailingEdge(time);
4445
4445
  }
4446
- timerId = setTimeout(timerExpired, remainingWait(time));
4446
+ timerId = setTimeout2(timerExpired, remainingWait(time));
4447
4447
  }
4448
4448
  function trailingEdge(time) {
4449
4449
  timerId = undefined$1;
@@ -4474,12 +4474,12 @@ var lodash = { exports: {} };
4474
4474
  }
4475
4475
  if (maxing) {
4476
4476
  clearTimeout(timerId);
4477
- timerId = setTimeout(timerExpired, wait);
4477
+ timerId = setTimeout2(timerExpired, wait);
4478
4478
  return invokeFunc(lastCallTime);
4479
4479
  }
4480
4480
  }
4481
4481
  if (timerId === undefined$1) {
4482
- timerId = setTimeout(timerExpired, wait);
4482
+ timerId = setTimeout2(timerExpired, wait);
4483
4483
  }
4484
4484
  return result2;
4485
4485
  }
@@ -4722,7 +4722,7 @@ var lodash = { exports: {} };
4722
4722
  }
4723
4723
  function isNative(value) {
4724
4724
  if (isMaskable(value)) {
4725
- throw new Error(CORE_ERROR_TEXT);
4725
+ throw new Error2(CORE_ERROR_TEXT);
4726
4726
  }
4727
4727
  return baseIsNative(value);
4728
4728
  }
@@ -5263,7 +5263,7 @@ var lodash = { exports: {} };
5263
5263
  if (!variable) {
5264
5264
  source = "with (obj) {\n" + source + "\n}\n";
5265
5265
  } else if (reForbiddenIdentifierChars.test(variable)) {
5266
- throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
5266
+ throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
5267
5267
  }
5268
5268
  source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
5269
5269
  source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
@@ -5382,7 +5382,7 @@ var lodash = { exports: {} };
5382
5382
  try {
5383
5383
  return apply(func, undefined$1, args);
5384
5384
  } catch (e) {
5385
- return isError(e) ? e : new Error(e);
5385
+ return isError(e) ? e : new Error2(e);
5386
5386
  }
5387
5387
  });
5388
5388
  var bindAll = flatRest(function(object, methodNames) {
@@ -8878,7 +8878,6 @@ const executeEvents = async (params2) => {
8878
8878
  var _a, _b, _c;
8879
8879
  let nextEvent = [];
8880
8880
  let finalResponse = null;
8881
- let accumulatedData = {};
8882
8881
  try {
8883
8882
  const shouldExecute = await shouldEventExecute(params2);
8884
8883
  if (!shouldExecute) {
@@ -8886,16 +8885,6 @@ const executeEvents = async (params2) => {
8886
8885
  }
8887
8886
  const response2 = await executeEventsHandler(params2);
8888
8887
  finalResponse = response2;
8889
- if (params2.config.Handler === "mergeFormdata") {
8890
- const data2 = await mergeFormdata(
8891
- params2.parentEventOutput,
8892
- params2.componentName,
8893
- params2.config,
8894
- params2.store,
8895
- params2.service
8896
- );
8897
- accumulatedData = { ...accumulatedData, ...data2 };
8898
- }
8899
8888
  const SuccessEvent = (_a = params2.config) == null ? void 0 : _a.events.filter((e) => e.eventType === "Success");
8900
8889
  nextEvent = SuccessEvent;
8901
8890
  } catch (err) {
@@ -8905,28 +8894,30 @@ const executeEvents = async (params2) => {
8905
8894
  }
8906
8895
  if ((nextEvent == null ? void 0 : nextEvent.length) > 0) {
8907
8896
  for (const actionConfig of nextEvent) {
8908
- const result = await executeEvents({ ...params2, config: actionConfig, parentEventOutput: finalResponse });
8909
- accumulatedData = { ...accumulatedData, ...result };
8897
+ await executeEvents({ ...params2, config: actionConfig, parentEventOutput: finalResponse });
8910
8898
  }
8911
8899
  }
8912
- params2.store.setFormdata((pre) => ({ ...pre, ...accumulatedData }));
8913
8900
  return finalResponse;
8914
8901
  };
8915
8902
  async function executeEventsHandler(params2) {
8916
8903
  var _a, _b, _c;
8917
8904
  if (params2.config.Handler === "api") {
8918
- const res = await executeApiEventHandler(params2);
8919
- return res;
8905
+ return await executeApiEventHandler(params2);
8920
8906
  } else if (params2.config.Handler === "inBuiltFunction") {
8921
8907
  return await executeInBuiltFunctionHandler(params2);
8922
8908
  } else if (params2.config.Handler === "custom") {
8923
- const res = await executeCustomHandler(params2);
8924
- return res;
8909
+ return await executeCustomHandler(params2);
8925
8910
  } else if (params2.config.Handler === "refresh") {
8926
- const res = await executeRefreshHandler(params2);
8927
- return res;
8911
+ return await executeRefreshHandler(params2);
8928
8912
  } else if (params2.config.Handler === "mergeFormdata") {
8929
- return params2.parentEventOutput;
8913
+ const result = await mergeFormdata(
8914
+ params2.parentEventOutput,
8915
+ params2.componentName,
8916
+ params2.config,
8917
+ params2.store,
8918
+ params2.service
8919
+ );
8920
+ return result;
8930
8921
  } else if (params2.config.Handler === "onBackHandler") {
8931
8922
  return (_a = params2.store.functionParameters) == null ? void 0 : _a.handleBack();
8932
8923
  } else if (params2.config.Handler === "onNextHandler") {
@@ -8972,35 +8963,51 @@ async function executeCustomHandler(params) {
8972
8963
  return response;
8973
8964
  }
8974
8965
  async function mergeFormdata(handlerResponse, componentName, eventConfig, store2, service2) {
8975
- var _a, _b;
8976
- let accumulatedData = {};
8977
8966
  if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse == null ? void 0 : handlerResponse.data) && (handlerResponse == null ? void 0 : handlerResponse.data))) {
8978
- accumulatedData = {
8979
- [componentName]: {
8980
- ...(_a = store2.schema.properties) == null ? void 0 : _a[componentName],
8981
- oneOf: handlerResponse.data
8982
- }
8983
- };
8967
+ store2.setSchema((pre) => {
8968
+ var _a;
8969
+ return {
8970
+ ...pre,
8971
+ properties: {
8972
+ ...pre.properties,
8973
+ [componentName]: {
8974
+ ...(_a = pre.properties) == null ? void 0 : _a[componentName],
8975
+ oneOf: handlerResponse.data
8976
+ }
8977
+ }
8978
+ };
8979
+ });
8984
8980
  } else if (eventConfig.type === "MultipleSelect" && !(_.isEmpty(handlerResponse == null ? void 0 : handlerResponse.data) && (handlerResponse == null ? void 0 : handlerResponse.data))) {
8985
- accumulatedData = {
8986
- [componentName]: {
8987
- ...(_b = store2.schema.properties) == null ? void 0 : _b[componentName],
8988
- type: "array",
8989
- items: {
8990
- oneOf: handlerResponse == null ? void 0 : handlerResponse.data
8981
+ store2.setSchema((pre) => {
8982
+ var _a;
8983
+ return {
8984
+ ...pre,
8985
+ properties: {
8986
+ ...pre.properties,
8987
+ [componentName]: {
8988
+ ...(_a = pre.properties) == null ? void 0 : _a[componentName],
8989
+ type: "array",
8990
+ items: {
8991
+ oneOf: handlerResponse == null ? void 0 : handlerResponse.data
8992
+ }
8993
+ }
8991
8994
  }
8992
- }
8993
- };
8995
+ };
8996
+ });
8994
8997
  } else if (eventConfig.type === "page") {
8995
8998
  if (!(_.isEmpty(handlerResponse == null ? void 0 : handlerResponse.data) && (handlerResponse == null ? void 0 : handlerResponse.data))) {
8996
- accumulatedData = { ...handlerResponse == null ? void 0 : handlerResponse.data };
8999
+ store2.setFormdata((pre) => {
9000
+ return { ...pre, ...handlerResponse == null ? void 0 : handlerResponse.data };
9001
+ });
8997
9002
  }
8998
9003
  } else {
8999
9004
  if (handlerResponse) {
9000
- accumulatedData = { [componentName]: eventConfig.lazyLoading ? handlerResponse.data.data : handlerResponse.data };
9005
+ store2.setFormdata((pre) => {
9006
+ return { ...pre, [componentName]: eventConfig.lazyLoading ? handlerResponse.data.data : handlerResponse.data };
9007
+ });
9008
+ await asyncOperation();
9001
9009
  }
9002
9010
  }
9003
- return accumulatedData;
9004
9011
  }
9005
9012
  const buildBodyFormat = (body2, formData, userValue2) => {
9006
9013
  const finalBody = { ...userValue2 == null ? void 0 : userValue2.payload };
@@ -9056,20 +9063,32 @@ async function buildApiPayload(compConfig, body, headers, store, dynamicData, us
9056
9063
  }
9057
9064
  return { body, headers };
9058
9065
  }
9059
- function getRefreshElements(eventConfig, eventGroups2) {
9066
+ function getRefreshElements(eventConfig, eventGropus) {
9060
9067
  var _a;
9061
9068
  let result = [];
9062
9069
  if (((_a = eventConfig == null ? void 0 : eventConfig.refreshElements) == null ? void 0 : _a.length) > 0) {
9063
- result = eventConfig.refreshElements.map((e) => e.value);
9070
+ result = eventConfig.refreshElements.map((e) => {
9071
+ return e.value;
9072
+ });
9064
9073
  } else {
9065
- if (eventGroups2 == null ? void 0 : eventGroups2.onLoad) {
9066
- result = Object.keys(eventGroups2 == null ? void 0 : eventGroups2.onLoad);
9074
+ if (eventGropus == null ? void 0 : eventGropus.onLoad) {
9075
+ result = Object.keys(eventGropus == null ? void 0 : eventGropus.onLoad);
9067
9076
  result.push(result[0]);
9068
9077
  }
9069
9078
  }
9070
9079
  console.log(result);
9071
9080
  return result;
9072
9081
  }
9082
+ function asyncOperation() {
9083
+ return new Promise((resolve, reject) => {
9084
+ setTimeout(() => {
9085
+ {
9086
+ resolve("Operation completed successfully!");
9087
+ reject(new Error("Operation failed!"));
9088
+ }
9089
+ }, 50);
9090
+ });
9091
+ }
9073
9092
  let compType;
9074
9093
  let eventGroups = {};
9075
9094
  const notifyUiSchema = {
@@ -9179,7 +9198,9 @@ var service = (funcParams) => {
9179
9198
  });
9180
9199
  },
9181
9200
  onClick: async function() {
9201
+ alert("Loading");
9182
9202
  await this.callHandler("onClick");
9203
+ alert("end");
9183
9204
  },
9184
9205
  onFileDownload: async function() {
9185
9206
  await this.callHandler("onDownload");