impaktapps-ui-builder 0.0.347 → 0.0.348

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.
@@ -400,7 +400,7 @@ const PageMasterUiSchema = {
400
400
  variant: "contained",
401
401
  color: "info",
402
402
  type: "text",
403
- onClick: "savePageHandler",
403
+ onClick: "saveHandler",
404
404
  size: "small"
405
405
  },
406
406
  style: {
@@ -6372,7 +6372,7 @@ const componentBasicUiSchema = {
6372
6372
  variant: "contained",
6373
6373
  color: "info",
6374
6374
  type: "text",
6375
- onClick: "savePageHandler",
6375
+ onClick: "saveHandler",
6376
6376
  size: "small"
6377
6377
  },
6378
6378
  style: {
@@ -7311,34 +7311,8 @@ var Component = (store2, dynamicData2, submitHandler, service2) => {
7311
7311
  getSchema: function() {
7312
7312
  return ComponentSchema;
7313
7313
  },
7314
- okHandler: function() {
7315
- var _a;
7316
- const path = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
7317
- console.log(store2.ctx.core.errors);
7318
- if (_.isEmpty(store2.ctx.core.errors)) {
7319
- saveFormdataInLocalStorage(store2.ctx.core.data, path);
7320
- store2.navigate(-1);
7321
- store2.setNotify({
7322
- SuccessMessage: "Save Successfully",
7323
- Success: true
7324
- });
7325
- } else {
7326
- store2.setValidation("ValidateAndShow");
7327
- store2.setNotify({
7328
- Fail: true,
7329
- FailMessage: "Errors on Page"
7330
- });
7331
- }
7332
- },
7333
- savePageHandler: async () => {
7334
- var _a, _b;
7335
- const id = (_a = store2.searchParams) == null ? void 0 : _a.get("id");
7336
- const path = (_b = store2.searchParams) == null ? void 0 : _b.get("path");
7337
- saveFormdataInLocalStorage(store2.ctx.core.data, path);
7338
- const config = JSON.parse(localStorage.getItem("pageFormdata"));
7339
- const isSubmitted = await saveHandler(store2, service2, submitHandler, config);
7340
- navigation(store2, isSubmitted, `/PageMaster?id=${id}`);
7341
- },
7314
+ okHandler: () => okHandler(store2),
7315
+ saveHandler: async () => await saveHandler(store2, service2, submitHandler, "PageMaster"),
7342
7316
  onChange: function() {
7343
7317
  var _a, _b, _c, _d;
7344
7318
  if (((_a = store2 == null ? void 0 : store2.formData) == null ? void 0 : _a.type) !== ((_b = store2 == null ? void 0 : store2.newData) == null ? void 0 : _b.type) && ((_c = store2 == null ? void 0 : store2.newData) == null ? void 0 : _c.type) !== void 0) {
@@ -7415,19 +7389,22 @@ var Component = (store2, dynamicData2, submitHandler, service2) => {
7415
7389
  }
7416
7390
  };
7417
7391
  };
7418
- async function saveHandler(store2, service2, submitHandler, config) {
7419
- let isTrue = false;
7392
+ async function saveHandler(store2, service2, submitHandler, pageName) {
7393
+ var _a, _b;
7394
+ const id = (_a = store2.searchParams) == null ? void 0 : _a.get("id");
7395
+ const path = (_b = store2.searchParams) == null ? void 0 : _b.get("path");
7396
+ saveFormdataInLocalStorage(store2.ctx.core.data, path);
7397
+ const config = JSON.parse(localStorage.getItem("pageFormdata"));
7420
7398
  if (_.isEmpty(store2.ctx.core.errors)) {
7421
7399
  try {
7422
7400
  const saveReturn = await submitHandler(store2, service2, config);
7423
- isTrue = true;
7401
+ navigateHandler(store2, true, pageName ? `/${pageName}?id=${id}` : false);
7424
7402
  } catch (err) {
7425
- isTrue = false;
7403
+ navigateHandler(store2, false);
7426
7404
  }
7427
7405
  }
7428
- return isTrue;
7429
7406
  }
7430
- const navigation = (store2, isSubmitted, pageName) => {
7407
+ const navigateHandler = (store2, isSubmitted, pageName) => {
7431
7408
  if (isSubmitted) {
7432
7409
  localStorage.removeItem("pageFormdata");
7433
7410
  store2.navigate(pageName || -1);
@@ -7443,6 +7420,25 @@ const navigation = (store2, isSubmitted, pageName) => {
7443
7420
  });
7444
7421
  }
7445
7422
  };
7423
+ function okHandler(store2) {
7424
+ var _a;
7425
+ const path = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
7426
+ console.log(store2.ctx.core.errors);
7427
+ if (_.isEmpty(store2.ctx.core.errors)) {
7428
+ saveFormdataInLocalStorage(store2.ctx.core.data, path);
7429
+ store2.navigate(-1);
7430
+ store2.setNotify({
7431
+ SuccessMessage: "Save Successfully",
7432
+ Success: true
7433
+ });
7434
+ } else {
7435
+ store2.setValidation("ValidateAndShow");
7436
+ store2.setNotify({
7437
+ Fail: true,
7438
+ FailMessage: "Errors on Page"
7439
+ });
7440
+ }
7441
+ }
7446
7442
  var pageMaster = (funcParams) => {
7447
7443
  const { store: store2, dynamicData: dynamicData2, config, submitHandler, service: service2 } = funcParams;
7448
7444
  return {
@@ -7485,12 +7481,7 @@ var pageMaster = (funcParams) => {
7485
7481
  `/Component?path=${`elements[${response2 == null ? void 0 : response2.elements.length}]`}&id=${id}`
7486
7482
  );
7487
7483
  },
7488
- savePageHandler: async () => {
7489
- saveFormdataInLocalStorage(store2.ctx.core.data);
7490
- const config2 = JSON.parse(localStorage.getItem("pageFormdata"));
7491
- const isSubmitted = await saveHandler(store2, service2, submitHandler, config2);
7492
- navigation(store2, isSubmitted);
7493
- },
7484
+ saveHandler: async () => await saveHandler(store2, service2, submitHandler),
7494
7485
  Edit_Components: Component(store2, dynamicData2, submitHandler, service2).editComponents,
7495
7486
  Delete_Components: Component(store2, dynamicData2, submitHandler, service2).deleteComponents,
7496
7487
  eventAddHandler: function() {
@@ -7880,7 +7871,7 @@ const EventUiSchema = {
7880
7871
  variant: "contained",
7881
7872
  color: "info",
7882
7873
  type: "text",
7883
- onClick: "savePageHandler",
7874
+ onClick: "saveHandler",
7884
7875
  size: "small"
7885
7876
  },
7886
7877
  style: {
@@ -8124,22 +8115,14 @@ var event = (store2, dynamicData2, submitHandler, service2) => {
8124
8115
  getSchema: () => {
8125
8116
  return EventSchema;
8126
8117
  },
8127
- savePageHandler: async () => {
8128
- var _a, _b;
8129
- const id = (_a = store2.searchParams) == null ? void 0 : _a.get("id");
8130
- const path = (_b = store2.searchParams) == null ? void 0 : _b.get("path");
8131
- saveFormdataInLocalStorage(store2.ctx.core.data, path);
8132
- const config = JSON.parse(localStorage.getItem("pageFormdata"));
8133
- const isSubmitted = await saveHandler(store2, service2, submitHandler, config);
8134
- navigation(store2, isSubmitted, `/PageMaster?id=${id}`);
8135
- },
8118
+ okHandler: () => okHandler(store2),
8119
+ saveHandler: async () => await saveHandler(store2, service2, submitHandler, "PageMaster"),
8136
8120
  onChange: function() {
8137
8121
  var _a, _b, _c;
8138
8122
  if (((_a = store2 == null ? void 0 : store2.formData) == null ? void 0 : _a.Handler) !== ((_b = store2 == null ? void 0 : store2.newData) == null ? void 0 : _b.Handler) && ((_c = store2 == null ? void 0 : store2.newData) == null ? void 0 : _c.Handler) !== void 0) {
8139
8123
  this.refreshPage(store2.newData.Handler || store2.formdata.Handler, store2);
8140
8124
  }
8141
8125
  },
8142
- okHandler: Component(store2, dynamicData2, submitHandler, service2).okHandler,
8143
8126
  addEvent: function() {
8144
8127
  var _a, _b, _c;
8145
8128
  const path = (_a = store2.searchParams) == null ? void 0 : _a.get("path");