impaktapps-ui-builder 1.0.312 → 1.0.321

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.
Files changed (33) hide show
  1. package/dist/impaktapps-ui-builder.es.js +233 -148
  2. package/dist/impaktapps-ui-builder.es.js.map +1 -1
  3. package/dist/impaktapps-ui-builder.umd.js +7 -14
  4. package/dist/impaktapps-ui-builder.umd.js.map +1 -1
  5. package/dist/src/impaktapps-ui-builder/builder/build/buildPdfViewer.d.ts +1 -0
  6. package/dist/src/impaktapps-ui-builder/builder/build/buildStackBarLineGraph.d.ts +2 -0
  7. package/dist/src/impaktapps-ui-builder/builder/build/uischema/graph.d.ts +25 -0
  8. package/dist/src/impaktapps-ui-builder/builder/build/uischema/pdfViewer.d.ts +19 -0
  9. package/dist/src/impaktapps-ui-builder/builder/build/uischema/tableSection.d.ts +1 -1
  10. package/dist/src/impaktapps-ui-builder/builder/services/component.d.ts +1 -1
  11. package/dist/src/impaktapps-ui-builder/builder/services/event.d.ts +1 -1
  12. package/dist/src/impaktapps-ui-builder/builder/services/utils.d.ts +1 -7
  13. package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +1 -0
  14. package/package.json +1 -1
  15. package/src/impaktapps-ui-builder/builder/build/buildAreaGraph.ts +3 -3
  16. package/src/impaktapps-ui-builder/builder/build/buildConfig.ts +11 -7
  17. package/src/impaktapps-ui-builder/builder/build/buildPdfViewer.ts +16 -0
  18. package/src/impaktapps-ui-builder/builder/build/buildPop.ts +1 -0
  19. package/src/impaktapps-ui-builder/builder/build/buildStackBarLineGraph.ts +72 -0
  20. package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +13 -0
  21. package/src/impaktapps-ui-builder/builder/build/buildWrapperSection.ts +1 -0
  22. package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +30 -21
  23. package/src/impaktapps-ui-builder/builder/build/uischema/coreSection.ts +0 -1
  24. package/src/impaktapps-ui-builder/builder/build/uischema/graph.ts +16 -0
  25. package/src/impaktapps-ui-builder/builder/build/uischema/pdfViewer.ts +18 -0
  26. package/src/impaktapps-ui-builder/builder/build/uischema/tableSection.ts +5 -6
  27. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +13 -6
  28. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +2 -3
  29. package/src/impaktapps-ui-builder/builder/services/component.ts +43 -38
  30. package/src/impaktapps-ui-builder/builder/services/event.ts +2 -8
  31. package/src/impaktapps-ui-builder/builder/services/pageMaster.ts +1 -7
  32. package/src/impaktapps-ui-builder/builder/services/utils.ts +6 -79
  33. package/src/impaktapps-ui-builder/runtime/services/service.ts +5 -3
@@ -40,7 +40,7 @@ export const ComponentSchema: any = {
40
40
  { title: "Rank", const: "Rank" },
41
41
  { title: "Rank Card", const: "RankCard" },
42
42
  { title: "Metric Card", const: "MetricCard" },
43
- { title: "Runner Boy", const: "RunnerBoyProgressBar" },
43
+ { title: "Bow and Arrow", const: "RunnerBoyProgressBar" },
44
44
  { title: "Table", const: "Table" },
45
45
  { title: "Tabs", const: "TabSection" },
46
46
  { title: "Text", const: "Text" },
@@ -49,6 +49,7 @@ export const ComponentSchema: any = {
49
49
  { title: "Upload", const: "UploadFile" },
50
50
  { title: "Tree ", const: "TreeMap" },
51
51
  { title: "Thought of the day", const: "Thought" },
52
+ { title: "PDF", const: "PdfViewer" }
52
53
  ],
53
54
  },
54
55
  elementType: {
@@ -102,35 +103,35 @@ export const ComponentSchema: any = {
102
103
  { title: "Standard", const: "standard" },
103
104
  ],
104
105
  },
105
- positionVertical:{
106
+ positionVertical: {
106
107
  oneOf: [
107
108
  { title: "Top", const: "top" },
108
109
  { title: "Center", const: "center" },
109
110
  { title: "Bottom", const: "bottom" }
110
111
  ],
111
112
  },
112
- positionHorizontal:{
113
+ positionHorizontal: {
113
114
  oneOf: [
114
115
  { title: "Left", const: "left" },
115
116
  { title: "Center", const: "center" },
116
117
  { title: "Right", const: "right" }
117
118
  ],
118
119
  },
119
- contentVertical:{
120
+ contentVertical: {
120
121
  oneOf: [
121
122
  { title: "Top", const: "top" },
122
123
  { title: "Center", const: "center" },
123
124
  { title: "Bottom", const: "bottom" }
124
125
  ],
125
126
  },
126
- contentHorizontal:{
127
+ contentHorizontal: {
127
128
  oneOf: [
128
129
  { title: "Left", const: "left" },
129
130
  { title: "Center", const: "center" },
130
131
  { title: "Right", const: "right" }
131
132
  ],
132
133
  },
133
- toolTipPosition:{
134
+ toolTipPosition: {
134
135
  oneOf: [
135
136
  { title: "Top", const: "top" },
136
137
  { title: "Left", const: "left" },
@@ -440,6 +441,7 @@ export const ComponentSchema: any = {
440
441
  const: "HorizontalStackBarGraph",
441
442
  },
442
443
  { title: "Area Graph", const: "AreaGraph" },
444
+ { title: "StackBar And Line Graph", const: "StackBarLineGraph" },
443
445
  ],
444
446
  },
445
447
  iconName: {
@@ -493,6 +495,11 @@ export const ComponentSchema: any = {
493
495
  { title: "Detail Icon", const: "DetailIcon" },
494
496
  { title: "Report View Icon", const: "ReportViewIcon" },
495
497
  { title: "Payout", const: "Payout" },
498
+ { title: "Info Outlined", const: "InfoOutlinedIcon" },
499
+ { title: "Territory Add", const: "TerritoryAdd" },
500
+ { title: "Territory Edit", const: "TerritoryEdit" },
501
+ { title: "Territory Delete", const: "TerritoryDelete" },
502
+ { title: "Git Compare", const: "GitCompare" },
496
503
  ],
497
504
  },
498
505
  color: {
@@ -1,5 +1,3 @@
1
- import { title } from "process";
2
-
3
1
  export const EventSchema = {
4
2
  type: "object",
5
3
  properties: {
@@ -55,8 +53,9 @@ export const EventSchema = {
55
53
  { title: "Row Movement", const: "onRowMovement" },
56
54
  { title: "Download", const: "onDownload" },
57
55
  { title: "Fail", const: "Fail" },
56
+ { title: "onClose", const: "onClose" },
58
57
  { title: "Key Down", const: "onKeyDown" },
59
- { title: "Set Style", const: "setStyle" },
58
+ { title: "Set Style", const: "setStyle" },
60
59
 
61
60
  ]
62
61
  },
@@ -8,7 +8,7 @@ import { StyleSection } from "../build/uischema/styleSection";
8
8
  import { TableSection } from "../build/uischema/tableSection";
9
9
  import { ValueTab } from "../build/uischema/valueTab";
10
10
  import { ValidationSection } from "../build/uischema/validationSections";
11
- import { getFormdataFromSessionStorage, validateAndShowErrors, okHandler, saveFormdataInSessionStorage, saveHandler, doesScopeNameExist, initialiseScopeKey, addToScopeKey } from "./utils";
11
+ import { getFormdataFromSessionStorage, validateAndShowErrors, okHandler, saveFormdataInSessionStorage, saveHandler } from "./utils";
12
12
  const sectionLabels = {
13
13
  Select: ["Core", "Properties", "Value", "Events", "Style", "Validation"],
14
14
  MultipleSelect: ["Core", "Properties", "Value", "Events", "Style", "Validation"],
@@ -16,7 +16,7 @@ const sectionLabels = {
16
16
  LeaderBoard: ["Core", "Components", "Properties", "Events", "Style",],
17
17
  WrapperSection: ["Core", "Components", "Properties", "Style",],
18
18
  HorizontalLayout: ["Core", "Components", "Properties", "Style",],
19
- TabSection: ["Core", "Components", "Properties", "Style", "Validation"],
19
+ TabSection: ["Core", "Components", "TabTitles", "Properties", "Style", "Validation"],
20
20
  SpeedoMeter: ["Core", "Properties", "Events", "Style",],
21
21
  card: ["Core", "Properties", "Events", "Style", "Validation"],
22
22
  UploadFile: ["Core", "Events", "Style", "Validation"],
@@ -37,8 +37,9 @@ const sectionLabels = {
37
37
  Radio: ["Core", "Properties", "Events", "Style", "Validation"],
38
38
  Text: ["Core", "Properties", "Events", "Style", "Validation"],
39
39
  TextArea: ["Core", "Properties", "Events", "Style", "Validation"],
40
- PopUp: ["Core", "Components", "Properties", "Style"],
40
+ PopUp: ["Core", "Components", "Properties", "Events", "Style"],
41
41
  PopOver: ["Core", "Components", "Properties", "Style"],
42
+ PdfViewer: ["Core", "Properties", "Style"],
42
43
  Stepper: ["Core", "Components", "Properties", "Events", "Style"],
43
44
  DataGrid: ["Core", "Components", "Properties", "Events", "Style"],
44
45
  InputSlider: ["Core", "Properties", "Events", "Style", "Validation"],
@@ -52,8 +53,7 @@ const sectionLabels = {
52
53
  Camera: ["Core", "Properties", "Events", "Style", "Validation"],
53
54
  OTP_Input: ["Core", "Properties", "Events", "Style", "Validation"],
54
55
  }
55
-
56
- export function refreshPage(type: string, store: any, formdata?: any) {
56
+ export function refreshPage(type: string, store: any) {
57
57
  const UiSchema = _.cloneDeep(componentBasicUiSchema(store.theme.myTheme))
58
58
  const currentConfig = JSON.parse(sessionStorage.getItem("pageFormdata"));
59
59
  if (type) {
@@ -63,13 +63,11 @@ export function refreshPage(type: string, store: any, formdata?: any) {
63
63
  Style: StyleSection,
64
64
  Events: EventSection(store.theme.myTheme),
65
65
  Components: TableSection(store.theme.myTheme),
66
+ TabTitles: TableSection(store.theme.myTheme, "tabLabelElements"),
66
67
  Properties: buildPropertiesSection(type),
67
68
  Validation: ValidationSection
68
69
  }
69
70
  const elements = sectionLabels[type]?.map(e => sectionUiSchema[e]);
70
- if (!formdata?.style) {
71
- store.setFormdata((prev) => ({ ...prev, style: "{\n}" }));
72
- }
73
71
  UiSchema.elements[0].config.main.tabLabels = sectionLabels[type] || ["Core", "Style", "Events", "Validation"];
74
72
  UiSchema.elements[0].elements = elements || [CoreSection, StyleSection, EventSection(store.theme.myTheme), ValidationSection];
75
73
  }
@@ -217,17 +215,6 @@ export function refreshPage(type: string, store: any, formdata?: any) {
217
215
  store.setUiSchema(UiSchema);
218
216
  }
219
217
 
220
- const debouncedScopeNameValidator = _.debounce((store: any, newName: string) => {
221
- if (doesScopeNameExist(newName)) {
222
- store.setValidation("ValidateAndShow");
223
- store.setNotify({
224
- Fail: true,
225
- FailMessage: `Name "${newName}" already exists. Please use a unique name.`
226
- });
227
- }
228
- }, 400);
229
-
230
-
231
218
  export default (store: any, dynamicData: any, submitHandler: any, service: any) => {
232
219
  return {
233
220
  setPage: async function () {
@@ -235,7 +222,7 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
235
222
  store.setFormdata(formdata);
236
223
  const schema = this.getSchema();
237
224
  store.setSchema(schema);
238
- this.refreshPage(formdata?.type, store,formdata);
225
+ this.refreshPage(formdata?.type, store);
239
226
 
240
227
  },
241
228
  refreshPage: refreshPage,
@@ -279,9 +266,7 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
279
266
  schema.properties.pageName.path = pathArray
280
267
  return schema;
281
268
  },
282
- okHandler: () => {
283
- okHandler(store);
284
- },
269
+ okHandler: () => okHandler(store),
285
270
  saveHandler: async () => await saveHandler(store, service, submitHandler),
286
271
  onChange: function () {
287
272
  if (
@@ -290,12 +275,6 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
290
275
  ) {
291
276
  this.refreshPage(store?.newData?.type, store);
292
277
  }
293
- if (
294
- store?.formData?.name !== store?.newData?.name &&
295
- store?.newData?.name !== undefined
296
- ) {
297
- debouncedScopeNameValidator(store, store.newData.name);
298
- }
299
278
  },
300
279
  editComponents: function () {
301
280
 
@@ -304,11 +283,13 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
304
283
  const path = store.searchParams?.get("path");
305
284
  const id = store.searchParams?.get("id");
306
285
  saveFormdataInSessionStorage(store.ctx.core.data, path)
307
-
308
- addToScopeKey(store.ctx.core.data.name);
309
286
  if (path) {
310
- const path = store.searchParams?.get("path");
311
- const finalPath = `${path}.elements[${rowId}]`
287
+ let finalPath = `${path}`;
288
+ if (dynamicData?.path?.startsWith("tabLabel")) {
289
+ finalPath = `${finalPath}.tabLabelElements[${rowId}]`
290
+ } else {
291
+ finalPath = `${finalPath}.elements[${rowId}]`
292
+ }
312
293
  store.searchParams.set("path", finalPath)
313
294
  store.setSearchParams(store.searchParams)
314
295
  this.setPage()
@@ -319,7 +300,12 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
319
300
  deleteComponents: function (shouldUpdateDialog: boolean = true) {
320
301
  const path = store.searchParams?.get("path");
321
302
  const rowId = sessionStorage.getItem('rowId');
322
- store.formData.elements.splice(rowId, 1);
303
+ const isTabLabelElements = sessionStorage.getItem('isTabLabelElements') === "true";
304
+ if (isTabLabelElements) {
305
+ store.formData.tabLabelElements.splice(rowId, 1);
306
+ } else {
307
+ store.formData.elements.splice(rowId, 1);
308
+ }
323
309
  const response = saveFormdataInSessionStorage(store.ctx.core.data, path)
324
310
  const data = path ? _.get(response, path) : response;
325
311
  store.setFormdata(data);
@@ -327,6 +313,7 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
327
313
  store.updateDialog("popUpComponentSection");
328
314
  }
329
315
  sessionStorage.removeItem('rowId');
316
+ sessionStorage.removeItem('isTabLabelElements');
330
317
  },
331
318
  deleteEvent: function (shouldUpdateDialog: boolean = true) {
332
319
  const path = store.searchParams?.get("path");
@@ -345,11 +332,17 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
345
332
  if (!Array.isArray(store.formData.elements)) {
346
333
  store.formData.elements = []
347
334
  }
335
+ if (!Array.isArray(store.formData.tabLabelElements)) {
336
+ store.formData.tabLabelElements = []
337
+ }
348
338
  const path = store.searchParams?.get("path");
349
339
  saveFormdataInSessionStorage(store.ctx.core.data, path)
350
- addToScopeKey(store.ctx.core.data.name);
351
-
352
- const finalPath = `${path}.elements[${store.formData.elements.length}]`
340
+ let finalPath = `${path}`;
341
+ if (dynamicData.path.startsWith("tabLabel")) {
342
+ finalPath = `${finalPath}.tabLabelElements[${store.formData.tabLabelElements.length}]`
343
+ } else {
344
+ finalPath = `${finalPath}.elements[${store.formData.elements.length}]`
345
+ }
353
346
  store.searchParams.set("path", finalPath)
354
347
  store.setSearchParams(store.searchParams)
355
348
  this.setPage()
@@ -381,6 +374,7 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
381
374
  deletePopUpComponent: function () {
382
375
  const rowId = dynamicData.path.split(".")[1];
383
376
  sessionStorage.setItem('rowId', rowId);
377
+ sessionStorage.setItem('isTabLabelElements', dynamicData.path.startsWith("tabLabel") ? "true" : "false");
384
378
  store.updateDialog("popUpComponentSection");
385
379
  },
386
380
  deletePopUpEvent: function () {
@@ -427,9 +421,17 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
427
421
  if (!Array.isArray(store.formData.events)) {
428
422
  store.formData.events = []
429
423
  }
424
+ if (!Array.isArray(store.formData.tabLabelElements)) {
425
+ store.formData.tabLabelElements = []
426
+ }
430
427
  saveFormdataInSessionStorage(store.ctx.core.data, pastedElementParentPath);
431
428
  const formData = getFormdataFromSessionStorage(pastedElementParentPath);
432
- const insertElementIndex = elementType === "Component" ? formData.elements.length : formData.events.length;
429
+ const currentLength = {
430
+ "TabsComponent": formData.tabLabelElements.length,
431
+ "Component": formData.elements.length,
432
+ "Events": formData.events.length
433
+ };
434
+ const insertElementIndex = currentLength[elementType] || 0;
433
435
  const pastedElementPath = this.elementPathHandler(pastedElementParentPath, insertElementIndex, elementType);
434
436
 
435
437
  const copiedConfig = JSON.parse(sessionStorage.getItem("copiedConfig"));
@@ -466,6 +468,9 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
466
468
  elementPathHandler: function (parentPath: string, rowId: any, elementType: string) {
467
469
  if (elementType === "Component") {
468
470
  return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
471
+ }
472
+ if(elementType === "TabsComponent"){
473
+ return `${parentPath}.tabLabelElements[${rowId}]`
469
474
  }
470
475
  return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
471
476
  },
@@ -32,9 +32,9 @@ export default (
32
32
  const schema = await this.getSchema();
33
33
  console.log("SettingSchema>>",schema)
34
34
  store.setSchema(schema);
35
- this.refreshPage(formdata.Handler, store,formdata);
35
+ this.refreshPage(formdata.Handler, store);
36
36
  },
37
- refreshPage: (handlerType: any, store: any, formdata?: any) => {
37
+ refreshPage: (handlerType: any, store: any) => {
38
38
  const uiSchema = _.cloneDeep(EventUiSchema(store.theme.myTheme));
39
39
  const schema: any = _.cloneDeep(EventSchema);
40
40
  if (handlerType) {
@@ -62,9 +62,6 @@ export default (
62
62
  "Write Custom Code",
63
63
  false
64
64
  );
65
- if (!formdata?.eventCode) {
66
- store.setFormdata((prev) => ({ ...prev, eventCode: "async (store, dynamicData, user, parentEventOutput, service, componentName) => {\n\n\n}" }));
67
- }
68
65
  schema.required = ["eventType", "Handler", "eventCode"];
69
66
  } else if (handlerType === "api") {
70
67
  uiSchema.elements[0].elements[0].elements[2] = emptyBox("emptyBox", {
@@ -74,9 +71,6 @@ export default (
74
71
  lg: 6,
75
72
  });
76
73
  uiSchema.elements[0].elements[0].elements[3] = APISection;
77
- if (!formdata?.apiBody) {
78
- store.setFormdata((prev) => ({ ...prev, apiBody: "(store, dynamicData, user, body, service) => {\n\n\n}" }));
79
- }
80
74
  schema.required = ["eventType", "Handler", "method", "path"];
81
75
  } else if (handlerType === "inBuiltFunction") {
82
76
  uiSchema.elements[0].elements[0].elements[2] = getSelectField(
@@ -2,7 +2,7 @@ import { PageMasterSchema } from "../elements/UiSchema/PageMaster/schema";
2
2
  import { PageMasterUiSchema } from "../elements/UiSchema/PageMaster/uiSchema";
3
3
  import _ from "lodash";
4
4
  import Component from "./component";
5
- import { getFormdataFromSessionStorage, validateAndShowErrors, saveFormdataInSessionStorage, saveHandler, initialiseScopeKey, addToScopeKey } from "./utils";
5
+ import { getFormdataFromSessionStorage, validateAndShowErrors, saveFormdataInSessionStorage, saveHandler } from "./utils";
6
6
 
7
7
 
8
8
  interface funcParamsProps {
@@ -22,7 +22,6 @@ export default (funcParams: funcParamsProps) => {
22
22
  const schema = await this.getSchema();
23
23
  store.setSchema(schema);
24
24
  store.setUiSchema(uiSchema);
25
- initialiseScopeKey();
26
25
  },
27
26
  getFormdata: async function () {
28
27
  const id = store.searchParams?.get("id");
@@ -50,7 +49,6 @@ export default (funcParams: funcParamsProps) => {
50
49
  },
51
50
  backHandler: () => {
52
51
  sessionStorage.removeItem("pageFormdata")
53
- sessionStorage.removeItem("scopeKey")
54
52
  store.navigate("/PageMasterRecords");
55
53
  },
56
54
  onAddClickHandler: function () {
@@ -60,8 +58,6 @@ export default (funcParams: funcParamsProps) => {
60
58
  store.formData.elements = []
61
59
  }
62
60
  const response = saveFormdataInSessionStorage(store.ctx.core.data)
63
- addToScopeKey(store.ctx.core.data.name);
64
-
65
61
  if (id) {
66
62
  store.navigate(
67
63
  `/Component?path=${`elements[${response?.elements.length}]`}&id=${id}`
@@ -87,7 +83,6 @@ export default (funcParams: funcParamsProps) => {
87
83
  store.formData.events = []
88
84
  }
89
85
  saveFormdataInSessionStorage(store.ctx.core.data)
90
- addToScopeKey(store.ctx.core.data.name);
91
86
  const finalPath = `events[${store.formData.events.length}]`
92
87
  store.navigate(`/ComponentEvents?path=${finalPath}&id=${id}`)
93
88
  },
@@ -96,7 +91,6 @@ export default (funcParams: funcParamsProps) => {
96
91
  const rowId = dynamicData.path.split(".")[1];
97
92
  const id = store.searchParams?.get("id");
98
93
  saveFormdataInSessionStorage(store.ctx.core.data)
99
- addToScopeKey(store.ctx.core.data.name);
100
94
  const finalPath = `events[${rowId}]`
101
95
  store.navigate(`/ComponentEvents?path=${finalPath}&id=${id}`)
102
96
  },
@@ -67,86 +67,15 @@ export const getFormdataFromSessionStorage = (path?: string) => {
67
67
 
68
68
  }
69
69
 
70
- export const collectScopeNames = (config: any, scopeMap: Record<string, boolean> = {}): Record<string, boolean> => {
71
- if (!config || typeof config !== "object") return scopeMap;
72
-
73
- if (Array.isArray(config)) {
74
- config.forEach((item) => collectScopeNames(item, scopeMap));
75
- return scopeMap;
76
- }
77
- if (config.name) {
78
- scopeMap[config.name] = true;
79
- }
80
- if (Array.isArray(config.elements)) {
81
- collectScopeNames(config.elements, scopeMap);
82
- }
83
- return scopeMap;
84
- }
85
-
86
- export const initialiseScopeKey = () => {
87
- const config = sessionStorage.getItem("pageFormdata")
88
- ? JSON.parse(sessionStorage.getItem("pageFormdata"))
89
- : undefined;
90
-
91
- const names = config ? collectScopeNames(config) : {};
92
- sessionStorage.setItem("scopeKey", JSON.stringify(names));
93
- }
94
-
95
- export const getScopeKey = (): Record<string, boolean> => {
96
- const raw = sessionStorage.getItem("scopeKey");
97
- return raw ? JSON.parse(raw) : {};
98
- }
99
-
100
- export const addToScopeKey = (name: string) => {
101
- if (!name) return;
102
- const scopeKey = getScopeKey();
103
- scopeKey[name] = true;
104
- sessionStorage.setItem("scopeKey", JSON.stringify(scopeKey));
105
- }
106
-
107
- export const doesScopeNameExist = (name: string): boolean => {
108
- if (!name) return false;
109
- const scopeKey = getScopeKey();
110
- return !!scopeKey[name];
111
- }
112
-
113
- export const findDuplicateScopeNames = (config: any): string[] => {
114
- const scopeNameCount: Record<string, number> = {};
115
-
116
- const traverse = (currentNode: any) => {
117
- if (!currentNode || typeof currentNode !== "object") return;
118
- if (Array.isArray(currentNode)) {
119
- currentNode.forEach(traverse);
120
- return;
121
- }
122
- if (currentNode.name) {
123
- scopeNameCount[currentNode.name] = (scopeNameCount[currentNode.name] || 0) + 1;
124
- }
125
- if (Array.isArray(currentNode.elements)) traverse(currentNode.elements);
126
- };
127
- traverse(config);
128
- return Object.keys(scopeNameCount).filter((name) => scopeNameCount[name] > 1);
129
- }
130
-
131
- export async function saveHandler(store: any, service: any, submitHandler: any) {
70
+ export async function saveHandler(store, service, submitHandler) {
71
+ const id = store.searchParams?.get("id");
132
72
  const path = store.searchParams?.get("path");
133
73
  saveFormdataInSessionStorage(store.ctx.core.data, path);
134
74
  const config = JSON.parse(sessionStorage.getItem("pageFormdata"));
135
-
136
- const duplicates = findDuplicateScopeNames(config);
137
- if (duplicates.length > 0) {
138
- store.setValidation("ValidateAndShow");
139
- store.setNotify({
140
- Fail: true,
141
- FailMessage: `Duplicate names found: ${duplicates.join(", ")}`
142
- });
143
- return;
144
- }
145
-
146
75
  if (_.isEmpty(store.ctx.core.errors)) {
147
76
  try {
148
77
  const saveReturn = await submitHandler(store, service, config);
149
- navigateHandler(store, true, "/PageMasterRecords")
78
+ navigateHandler(store, true,"/PageMasterRecords")
150
79
  } catch (err) {
151
80
  navigateHandler(store, false, undefined, err.message);
152
81
  }
@@ -155,10 +84,9 @@ export async function saveHandler(store: any, service: any, submitHandler: any)
155
84
  }
156
85
  }
157
86
 
158
- export const navigateHandler = (store: any, isSubmitted: boolean, pageName?: string | boolean, errorMessage?: string) => {
87
+ export const navigateHandler = (store, isSubmitted,pageName?: string | boolean, errorMessage?: string) => {
159
88
  if (isSubmitted) {
160
89
  sessionStorage.removeItem("pageFormdata");
161
- sessionStorage.removeItem("scopeKey");
162
90
  store.navigate(pageName || -1)
163
91
  store.setNotify({
164
92
  SuccessMessage: "Submit Successfully",
@@ -173,11 +101,10 @@ export const navigateHandler = (store: any, isSubmitted: boolean, pageName?: str
173
101
  }
174
102
  };
175
103
 
176
- export function okHandler(store: any) {
104
+ export function okHandler(store) {
177
105
  const path = store.searchParams?.get("path");
178
106
  if (_.isEmpty(store.ctx.core.errors)) {
179
- saveFormdataInSessionStorage(store.ctx.core.data, path);
180
- addToScopeKey(store.ctx.core.data.name);
107
+ saveFormdataInSessionStorage(store.ctx.core.data, path)
181
108
  store.navigate(-1)
182
109
  store.setNotify({
183
110
  SuccessMessage: "Save Successfully",
@@ -116,7 +116,7 @@ export default (funcParams: funcParamsProps) => {
116
116
  const cloneEventGroup = _.cloneDeep(eventGroups)
117
117
  if (cloneEventGroup.setStyle) {
118
118
  let finalResponse = {};
119
- const path = funcParams.dynamicData?.tableButtonPath || funcParams?.dynamicData?.path?.split(".")[0];
119
+ const path = funcParams.dynamicData?.tableButtonPath || funcParams?.dynamicData.path?.split(".").pop();
120
120
  if (cloneEventGroup?.setStyle?.[path]) {
121
121
  for (const eventConfig of cloneEventGroup?.setStyle?.[path]) {
122
122
  finalResponse = executeEvents({
@@ -158,6 +158,9 @@ export default (funcParams: funcParamsProps) => {
158
158
  onFileDelete: async function () {
159
159
  this.callHandler("onFileDelete")
160
160
  },
161
+ onClose: function () {
162
+ this.callHandler("onClose")
163
+ },
161
164
  onMount: function () {
162
165
  this.callHandler("onMount")
163
166
  },
@@ -209,8 +212,7 @@ export default (funcParams: funcParamsProps) => {
209
212
 
210
213
  const promises = ChangeEventsKeysArray.flatMap((componentName: string) => {
211
214
  if (
212
- funcParams.store?.formData[componentName] === funcParams.store.newData[componentName] ||
213
- funcParams.store?.newData[componentName] === undefined
215
+ funcParams.store?.formData[componentName] === funcParams.store.newData[componentName]
214
216
  ) {
215
217
  return [];
216
218
  }