impaktapps-ui-builder 0.0.346 → 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,47 +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
- if (isSubmitted) {
7341
- localStorage.removeItem("pageFormdata");
7342
- store2.navigate(`/PageMaster?id=${id}`);
7343
- store2.setNotify({
7344
- SuccessMessage: "Submit Successfully",
7345
- Success: true
7346
- });
7347
- } else {
7348
- store2.setValidation("ValidateAndShow");
7349
- store2.setNotify({
7350
- Fail: true,
7351
- FailMessage: "Errors on Page"
7352
- });
7353
- }
7354
- },
7314
+ okHandler: () => okHandler(store2),
7315
+ saveHandler: async () => await saveHandler(store2, service2, submitHandler, "PageMaster"),
7355
7316
  onChange: function() {
7356
7317
  var _a, _b, _c, _d;
7357
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) {
@@ -7428,17 +7389,55 @@ var Component = (store2, dynamicData2, submitHandler, service2) => {
7428
7389
  }
7429
7390
  };
7430
7391
  };
7431
- async function saveHandler(store2, service2, submitHandler, config) {
7432
- 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"));
7433
7398
  if (_.isEmpty(store2.ctx.core.errors)) {
7434
7399
  try {
7435
7400
  const saveReturn = await submitHandler(store2, service2, config);
7436
- isTrue = true;
7401
+ navigateHandler(store2, true, pageName ? `/${pageName}?id=${id}` : false);
7437
7402
  } catch (err) {
7438
- isTrue = false;
7403
+ navigateHandler(store2, false);
7439
7404
  }
7440
7405
  }
7441
- return isTrue;
7406
+ }
7407
+ const navigateHandler = (store2, isSubmitted, pageName) => {
7408
+ if (isSubmitted) {
7409
+ localStorage.removeItem("pageFormdata");
7410
+ store2.navigate(pageName || -1);
7411
+ store2.setNotify({
7412
+ SuccessMessage: "Submit Successfully",
7413
+ Success: true
7414
+ });
7415
+ } else {
7416
+ store2.setValidation("ValidateAndShow");
7417
+ store2.setNotify({
7418
+ Fail: true,
7419
+ FailMessage: "Errors on Page"
7420
+ });
7421
+ }
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
+ }
7442
7441
  }
7443
7442
  var pageMaster = (funcParams) => {
7444
7443
  const { store: store2, dynamicData: dynamicData2, config, submitHandler, service: service2 } = funcParams;
@@ -7482,25 +7481,7 @@ var pageMaster = (funcParams) => {
7482
7481
  `/Component?path=${`elements[${response2 == null ? void 0 : response2.elements.length}]`}&id=${id}`
7483
7482
  );
7484
7483
  },
7485
- savePageHandler: async () => {
7486
- saveFormdataInLocalStorage(store2.ctx.core.data);
7487
- const config2 = JSON.parse(localStorage.getItem("pageFormdata"));
7488
- const isSubmitted = await saveHandler(store2, service2, submitHandler, config2);
7489
- if (isSubmitted) {
7490
- localStorage.removeItem("pageFormdata");
7491
- store2.navigate("/PageMasterRecords");
7492
- store2.setNotify({
7493
- SuccessMessage: "Submit Successfully",
7494
- Success: true
7495
- });
7496
- } else {
7497
- store2.setValidation("ValidateAndShow");
7498
- store2.setNotify({
7499
- Fail: true,
7500
- FailMessage: "Errors on Page"
7501
- });
7502
- }
7503
- },
7484
+ saveHandler: async () => await saveHandler(store2, service2, submitHandler),
7504
7485
  Edit_Components: Component(store2, dynamicData2, submitHandler, service2).editComponents,
7505
7486
  Delete_Components: Component(store2, dynamicData2, submitHandler, service2).deleteComponents,
7506
7487
  eventAddHandler: function() {
@@ -7890,7 +7871,7 @@ const EventUiSchema = {
7890
7871
  variant: "contained",
7891
7872
  color: "info",
7892
7873
  type: "text",
7893
- onClick: "savePageHandler",
7874
+ onClick: "saveHandler",
7894
7875
  size: "small"
7895
7876
  },
7896
7877
  style: {
@@ -8134,35 +8115,14 @@ var event = (store2, dynamicData2, submitHandler, service2) => {
8134
8115
  getSchema: () => {
8135
8116
  return EventSchema;
8136
8117
  },
8137
- savePageHandler: async () => {
8138
- var _a, _b;
8139
- const id = (_a = store2.searchParams) == null ? void 0 : _a.get("id");
8140
- const path = (_b = store2.searchParams) == null ? void 0 : _b.get("path");
8141
- saveFormdataInLocalStorage(store2.ctx.core.data, path);
8142
- const config = JSON.parse(localStorage.getItem("pageFormdata"));
8143
- const isSubmitted = await saveHandler(store2, service2, submitHandler, config);
8144
- if (isSubmitted) {
8145
- localStorage.removeItem("pageFormdata");
8146
- store2.navigate(`/PageMaster?id=${id}`);
8147
- store2.setNotify({
8148
- SuccessMessage: "Submit Successfully",
8149
- Success: true
8150
- });
8151
- } else {
8152
- store2.setValidation("ValidateAndShow");
8153
- store2.setNotify({
8154
- Fail: true,
8155
- FailMessage: "Errors on Page"
8156
- });
8157
- }
8158
- },
8118
+ okHandler: () => okHandler(store2),
8119
+ saveHandler: async () => await saveHandler(store2, service2, submitHandler, "PageMaster"),
8159
8120
  onChange: function() {
8160
8121
  var _a, _b, _c;
8161
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) {
8162
8123
  this.refreshPage(store2.newData.Handler || store2.formdata.Handler, store2);
8163
8124
  }
8164
8125
  },
8165
- okHandler: Component(store2, dynamicData2, submitHandler, service2).okHandler,
8166
8126
  addEvent: function() {
8167
8127
  var _a, _b, _c;
8168
8128
  const path = (_a = store2.searchParams) == null ? void 0 : _a.get("path");