impaktapps-ui-builder 0.0.348 → 0.0.350

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.
@@ -6391,97 +6391,6 @@ const componentBasicUiSchema = {
6391
6391
  }
6392
6392
  ]
6393
6393
  };
6394
- var buildConfig = (FormData) => {
6395
- const formData = _.cloneDeep(FormData);
6396
- let component = {};
6397
- if (formData.pageName) {
6398
- delete formData.pageName;
6399
- }
6400
- if (formData.eventsSelected) {
6401
- delete formData.eventsSelected;
6402
- }
6403
- if (formData.type === "Table" || formData.type === "WrapperSection" || formData.type === "TabSection") {
6404
- component.elements = formData.elements || [];
6405
- if (formData.elements) {
6406
- delete formData.elements;
6407
- }
6408
- }
6409
- component.events = formData.events || [];
6410
- if (formData.events) {
6411
- delete formData.events;
6412
- }
6413
- component = { ...formData, ...component };
6414
- return component;
6415
- };
6416
- const createLayoutFormat = (config) => {
6417
- if (_.isEmpty(config)) {
6418
- return {
6419
- xs: 11,
6420
- sm: 11,
6421
- md: 5.5,
6422
- lg: 5.5
6423
- };
6424
- }
6425
- let data2 = {};
6426
- config.map((e) => {
6427
- data2[e.key || "xs"] = +e.value || 5.5;
6428
- });
6429
- return data2;
6430
- };
6431
- const flatObjectValueInArray = (config) => {
6432
- const keyName = Object.keys(config[0])[0];
6433
- const data2 = config.map((e) => {
6434
- return e[keyName];
6435
- });
6436
- return data2;
6437
- };
6438
- const getNavigationHistory = (config, path) => {
6439
- if (path) {
6440
- let urlRoutes = config.name;
6441
- const pathArrayAll = path.split(".");
6442
- const arr = [];
6443
- pathArrayAll.map((e, i) => {
6444
- if (i === 0) {
6445
- arr.push(e);
6446
- return;
6447
- }
6448
- arr.push(`${arr[i - 1]}.${e}`);
6449
- });
6450
- arr.map((e) => {
6451
- const data2 = _.get(config, e);
6452
- if (data2) {
6453
- urlRoutes = urlRoutes + ` > ${(data2 == null ? void 0 : data2.name) || (data2 == null ? void 0 : data2.eventType)}`;
6454
- } else {
6455
- urlRoutes = urlRoutes + " > NewComponent";
6456
- }
6457
- });
6458
- return { pageName: urlRoutes };
6459
- }
6460
- return void 0;
6461
- };
6462
- const saveFormdataInLocalStorage = (formData, path) => {
6463
- let updatedFormdata;
6464
- if (path) {
6465
- const pageFormdata = getFormdataFromLocalStorage();
6466
- updatedFormdata = _.set(pageFormdata, path, buildConfig(formData));
6467
- } else {
6468
- updatedFormdata = buildConfig(formData);
6469
- }
6470
- localStorage.setItem("pageFormdata", JSON.stringify(updatedFormdata));
6471
- return updatedFormdata;
6472
- };
6473
- const getFormdataFromLocalStorage = (path) => {
6474
- const pageFormdata = localStorage.getItem("pageFormdata") ? JSON.parse(localStorage.getItem("pageFormdata")) : void 0;
6475
- let returnValue;
6476
- if (path) {
6477
- returnValue = _.get(pageFormdata, path);
6478
- returnValue = { ...returnValue, ...getNavigationHistory(pageFormdata, path) };
6479
- }
6480
- if (!returnValue) {
6481
- returnValue = getNavigationHistory(pageFormdata, path);
6482
- }
6483
- return returnValue || pageFormdata;
6484
- };
6485
6394
  const CoreSection = {
6486
6395
  type: "HorizontalLayout",
6487
6396
  elements: [
@@ -7249,6 +7158,150 @@ const ValidationSection = {
7249
7158
  }
7250
7159
  ]
7251
7160
  };
7161
+ var buildConfig = (FormData) => {
7162
+ const formData = _.cloneDeep(FormData);
7163
+ let component = {};
7164
+ if (formData.pageName) {
7165
+ delete formData.pageName;
7166
+ }
7167
+ if (formData.eventsSelected) {
7168
+ delete formData.eventsSelected;
7169
+ }
7170
+ if (formData.type === "Table" || formData.type === "WrapperSection" || formData.type === "TabSection") {
7171
+ component.elements = formData.elements || [];
7172
+ if (formData.elements) {
7173
+ delete formData.elements;
7174
+ }
7175
+ }
7176
+ component.events = formData.events || [];
7177
+ if (formData.events) {
7178
+ delete formData.events;
7179
+ }
7180
+ component = { ...formData, ...component };
7181
+ return component;
7182
+ };
7183
+ const createLayoutFormat = (config) => {
7184
+ if (_.isEmpty(config)) {
7185
+ return {
7186
+ xs: 11,
7187
+ sm: 11,
7188
+ md: 5.5,
7189
+ lg: 5.5
7190
+ };
7191
+ }
7192
+ let data2 = {};
7193
+ config.map((e) => {
7194
+ data2[e.key || "xs"] = +e.value || 5.5;
7195
+ });
7196
+ return data2;
7197
+ };
7198
+ const flatObjectValueInArray = (config) => {
7199
+ const keyName = Object.keys(config[0])[0];
7200
+ const data2 = config.map((e) => {
7201
+ return e[keyName];
7202
+ });
7203
+ return data2;
7204
+ };
7205
+ const clearFromLocalStorage = () => {
7206
+ localStorage.removeItem("pageFormdata");
7207
+ };
7208
+ const getNavigationHistory = (config, path) => {
7209
+ if (path) {
7210
+ let urlRoutes = config.name;
7211
+ const pathArrayAll = path.split(".");
7212
+ const arr = [];
7213
+ pathArrayAll.map((e, i) => {
7214
+ if (i === 0) {
7215
+ arr.push(e);
7216
+ return;
7217
+ }
7218
+ arr.push(`${arr[i - 1]}.${e}`);
7219
+ });
7220
+ arr.map((e) => {
7221
+ const data2 = _.get(config, e);
7222
+ if (data2) {
7223
+ urlRoutes = urlRoutes + ` > ${(data2 == null ? void 0 : data2.name) || (data2 == null ? void 0 : data2.eventType)}`;
7224
+ } else {
7225
+ urlRoutes = urlRoutes + " > NewComponent";
7226
+ }
7227
+ });
7228
+ return { pageName: urlRoutes };
7229
+ }
7230
+ return void 0;
7231
+ };
7232
+ const saveFormdataInLocalStorage = (formData, path) => {
7233
+ let updatedFormdata;
7234
+ if (path) {
7235
+ const pageFormdata = getFormdataFromLocalStorage();
7236
+ updatedFormdata = _.set(pageFormdata, path, buildConfig(formData));
7237
+ } else {
7238
+ updatedFormdata = buildConfig(formData);
7239
+ }
7240
+ localStorage.setItem("pageFormdata", JSON.stringify(updatedFormdata));
7241
+ return updatedFormdata;
7242
+ };
7243
+ const getFormdataFromLocalStorage = (path) => {
7244
+ const pageFormdata = localStorage.getItem("pageFormdata") ? JSON.parse(localStorage.getItem("pageFormdata")) : void 0;
7245
+ let returnValue;
7246
+ if (path) {
7247
+ returnValue = _.get(pageFormdata, path);
7248
+ returnValue = { ...returnValue, ...getNavigationHistory(pageFormdata, path) };
7249
+ }
7250
+ if (!returnValue) {
7251
+ returnValue = getNavigationHistory(pageFormdata, path);
7252
+ }
7253
+ return returnValue || pageFormdata;
7254
+ };
7255
+ async function saveHandler(store2, service2, submitHandler, pageName) {
7256
+ var _a, _b;
7257
+ const id = (_a = store2.searchParams) == null ? void 0 : _a.get("id");
7258
+ const path = (_b = store2.searchParams) == null ? void 0 : _b.get("path");
7259
+ saveFormdataInLocalStorage(store2.ctx.core.data, path);
7260
+ const config = JSON.parse(localStorage.getItem("pageFormdata"));
7261
+ if (_.isEmpty(store2.ctx.core.errors)) {
7262
+ try {
7263
+ const saveReturn = await submitHandler(store2, service2, config);
7264
+ navigateHandler(store2, true, pageName ? `/${pageName}?id=${id}` : pageName);
7265
+ } catch (err) {
7266
+ navigateHandler(store2, false);
7267
+ }
7268
+ }
7269
+ }
7270
+ const navigateHandler = (store2, isSubmitted, pageName) => {
7271
+ if (isSubmitted) {
7272
+ localStorage.removeItem("pageFormdata");
7273
+ store2.navigate(pageName || -1);
7274
+ store2.setNotify({
7275
+ SuccessMessage: "Submit Successfully",
7276
+ Success: true
7277
+ });
7278
+ } else {
7279
+ store2.setValidation("ValidateAndShow");
7280
+ store2.setNotify({
7281
+ Fail: true,
7282
+ FailMessage: "Errors on Page"
7283
+ });
7284
+ }
7285
+ };
7286
+ function okHandler(store2) {
7287
+ var _a;
7288
+ const path = (_a = store2.searchParams) == null ? void 0 : _a.get("path");
7289
+ console.log(store2.ctx.core.errors);
7290
+ if (_.isEmpty(store2.ctx.core.errors)) {
7291
+ saveFormdataInLocalStorage(store2.ctx.core.data, path);
7292
+ store2.navigate(-1);
7293
+ store2.setNotify({
7294
+ SuccessMessage: "Save Successfully",
7295
+ Success: true
7296
+ });
7297
+ } else {
7298
+ store2.setValidation("ValidateAndShow");
7299
+ store2.setNotify({
7300
+ Fail: true,
7301
+ FailMessage: "Errors on Page"
7302
+ });
7303
+ }
7304
+ }
7252
7305
  const sectionLabels = {
7253
7306
  Select: ["Core", "Properties", "Value", "style", "Event", "Validation"],
7254
7307
  MultipleSelect: ["Core", "Properties", "Value", "style", "Event", "Validation"],
@@ -7389,56 +7442,6 @@ var Component = (store2, dynamicData2, submitHandler, service2) => {
7389
7442
  }
7390
7443
  };
7391
7444
  };
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"));
7398
- if (_.isEmpty(store2.ctx.core.errors)) {
7399
- try {
7400
- const saveReturn = await submitHandler(store2, service2, config);
7401
- navigateHandler(store2, true, pageName ? `/${pageName}?id=${id}` : false);
7402
- } catch (err) {
7403
- navigateHandler(store2, false);
7404
- }
7405
- }
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
- }
7441
- }
7442
7445
  var pageMaster = (funcParams) => {
7443
7446
  const { store: store2, dynamicData: dynamicData2, config, submitHandler, service: service2 } = funcParams;
7444
7447
  return {
@@ -7481,7 +7484,7 @@ var pageMaster = (funcParams) => {
7481
7484
  `/Component?path=${`elements[${response2 == null ? void 0 : response2.elements.length}]`}&id=${id}`
7482
7485
  );
7483
7486
  },
7484
- saveHandler: async () => await saveHandler(store2, service2, submitHandler),
7487
+ saveHandler: async () => await saveHandler(store2, service2, submitHandler, "/PageMasterRecords"),
7485
7488
  Edit_Components: Component(store2, dynamicData2, submitHandler, service2).editComponents,
7486
7489
  Delete_Components: Component(store2, dynamicData2, submitHandler, service2).deleteComponents,
7487
7490
  eventAddHandler: function() {
@@ -10516,8 +10519,5 @@ const buildUiSchema = (config) => {
10516
10519
  }
10517
10520
  return elements;
10518
10521
  };
10519
- var clearLocalStorage = () => {
10520
- localStorage.removeItem("pageFormdata");
10521
- };
10522
- export { buildConfig, buildSchema, buildUiSchema, clearLocalStorage as clearPreviousCache, pageMaster, Component as pageMasterComponents, event as pageMasterEvents, service as pageService, schema };
10522
+ export { buildConfig, buildSchema, buildUiSchema, clearFromLocalStorage, pageMaster, Component as pageMasterComponents, event as pageMasterEvents, service as pageService, schema };
10523
10523
  //# sourceMappingURL=impaktapps-ui-builder.es.js.map