impaktapps-ui-builder 1.0.201 → 1.0.202

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 (80) hide show
  1. package/dist/impaktapps-ui-builder.es.js +1103 -298
  2. package/dist/impaktapps-ui-builder.es.js.map +1 -1
  3. package/dist/impaktapps-ui-builder.umd.js +13 -13
  4. package/dist/impaktapps-ui-builder.umd.js.map +1 -1
  5. package/dist/src/impaktapps-ui-builder/builder/build/buildAreaGraph.d.ts +2 -0
  6. package/dist/src/impaktapps-ui-builder/builder/build/buildCamera.d.ts +1 -0
  7. package/dist/src/impaktapps-ui-builder/builder/build/buildConfig.d.ts +1 -0
  8. package/dist/src/impaktapps-ui-builder/builder/build/buildGroupButton.d.ts +1 -0
  9. package/dist/src/impaktapps-ui-builder/builder/build/buildHierarchyChart.d.ts +1 -0
  10. package/dist/src/impaktapps-ui-builder/builder/build/buildOTP_inputs.d.ts +1 -0
  11. package/dist/src/impaktapps-ui-builder/builder/build/buildPdfViewer.d.ts +1 -0
  12. package/dist/src/impaktapps-ui-builder/builder/build/buildPopover.d.ts +1 -0
  13. package/dist/src/impaktapps-ui-builder/builder/build/buildStackBarLineGraph.d.ts +2 -0
  14. package/dist/src/impaktapps-ui-builder/builder/build/uischema/box.d.ts +1 -0
  15. package/dist/src/impaktapps-ui-builder/builder/build/uischema/buttonGroup.d.ts +22 -0
  16. package/dist/src/impaktapps-ui-builder/builder/build/uischema/card.d.ts +173 -197
  17. package/dist/src/impaktapps-ui-builder/builder/build/uischema/graph.d.ts +25 -5
  18. package/dist/src/impaktapps-ui-builder/builder/build/uischema/hierarchyChart.d.ts +22 -0
  19. package/dist/src/impaktapps-ui-builder/builder/build/uischema/multiSelect.d.ts +1 -0
  20. package/dist/src/impaktapps-ui-builder/builder/build/uischema/pdfViewer.d.ts +19 -0
  21. package/dist/src/impaktapps-ui-builder/builder/build/uischema/selectInputField.d.ts +1 -0
  22. package/dist/src/impaktapps-ui-builder/builder/build/uischema/tableSection.d.ts +1 -1
  23. package/dist/src/impaktapps-ui-builder/builder/build/uischema/wrapperSection.d.ts +3 -1
  24. package/dist/src/impaktapps-ui-builder/builder/services/utils.d.ts +2 -1
  25. package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +3 -0
  26. package/package.json +1 -1
  27. package/src/impaktapps-ui-builder/builder/build/buildAreaGraph.ts +22 -14
  28. package/src/impaktapps-ui-builder/builder/build/buildArray.ts +10 -6
  29. package/src/impaktapps-ui-builder/builder/build/buildCamera.ts +50 -0
  30. package/src/impaktapps-ui-builder/builder/build/buildCard.ts +10 -10
  31. package/src/impaktapps-ui-builder/builder/build/buildConfig.ts +19 -7
  32. package/src/impaktapps-ui-builder/builder/build/buildDate.ts +32 -16
  33. package/src/impaktapps-ui-builder/builder/build/buildDownloadFile.ts +6 -0
  34. package/src/impaktapps-ui-builder/builder/build/buildEmptyBox.ts +4 -0
  35. package/src/impaktapps-ui-builder/builder/build/buildFileInput.ts +42 -43
  36. package/src/impaktapps-ui-builder/builder/build/buildGroupButton.ts +24 -0
  37. package/src/impaktapps-ui-builder/builder/build/buildHierarchyChart.ts +35 -0
  38. package/src/impaktapps-ui-builder/builder/build/buildHorizontalBarGraph.ts +3 -3
  39. package/src/impaktapps-ui-builder/builder/build/buildImage.ts +6 -3
  40. package/src/impaktapps-ui-builder/builder/build/buildLineGraph.ts +3 -3
  41. package/src/impaktapps-ui-builder/builder/build/buildMetricCard.tsx +2 -2
  42. package/src/impaktapps-ui-builder/builder/build/buildMultiSelect.ts +9 -0
  43. package/src/impaktapps-ui-builder/builder/build/buildOTP_inputs.ts +44 -0
  44. package/src/impaktapps-ui-builder/builder/build/buildPdfViewer.ts +16 -0
  45. package/src/impaktapps-ui-builder/builder/build/buildPieGraph.ts +3 -3
  46. package/src/impaktapps-ui-builder/builder/build/buildPop.ts +1 -0
  47. package/src/impaktapps-ui-builder/builder/build/buildPopover.ts +40 -0
  48. package/src/impaktapps-ui-builder/builder/build/buildProgressBar.ts +31 -21
  49. package/src/impaktapps-ui-builder/builder/build/buildRadio.ts +6 -0
  50. package/src/impaktapps-ui-builder/builder/build/buildSelect.ts +9 -0
  51. package/src/impaktapps-ui-builder/builder/build/buildStackBarGraph.ts +3 -3
  52. package/src/impaktapps-ui-builder/builder/build/buildStackBarLineGraph.ts +72 -0
  53. package/src/impaktapps-ui-builder/builder/build/buildTabSection.ts +2 -0
  54. package/src/impaktapps-ui-builder/builder/build/buildTable.ts +4 -3
  55. package/src/impaktapps-ui-builder/builder/build/buildText.ts +9 -0
  56. package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +37 -0
  57. package/src/impaktapps-ui-builder/builder/build/buildUplaodFile.ts +6 -0
  58. package/src/impaktapps-ui-builder/builder/build/buildWrapperSection.ts +7 -2
  59. package/src/impaktapps-ui-builder/builder/build/uischema/box.ts +2 -1
  60. package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +237 -22
  61. package/src/impaktapps-ui-builder/builder/build/uischema/buttonGroup.ts +17 -0
  62. package/src/impaktapps-ui-builder/builder/build/uischema/card.ts +142 -188
  63. package/src/impaktapps-ui-builder/builder/build/uischema/coreSection.ts +0 -1
  64. package/src/impaktapps-ui-builder/builder/build/uischema/graph.ts +22 -6
  65. package/src/impaktapps-ui-builder/builder/build/uischema/hierarchyChart.ts +13 -0
  66. package/src/impaktapps-ui-builder/builder/build/uischema/metricCard.ts +1 -1
  67. package/src/impaktapps-ui-builder/builder/build/uischema/multiSelect.ts +2 -0
  68. package/src/impaktapps-ui-builder/builder/build/uischema/pdfViewer.ts +18 -0
  69. package/src/impaktapps-ui-builder/builder/build/uischema/selectInputField.ts +2 -0
  70. package/src/impaktapps-ui-builder/builder/build/uischema/tableSection.ts +5 -6
  71. package/src/impaktapps-ui-builder/builder/build/uischema/wrapperSection.ts +3 -1
  72. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +89 -2
  73. package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/uiSchema.ts +17 -0
  74. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +3 -4
  75. package/src/impaktapps-ui-builder/builder/services/component.ts +149 -107
  76. package/src/impaktapps-ui-builder/builder/services/event.ts +3 -0
  77. package/src/impaktapps-ui-builder/builder/services/pageMaster.ts +4 -1
  78. package/src/impaktapps-ui-builder/builder/services/utils.ts +15 -3
  79. package/src/impaktapps-ui-builder/runtime/services/downloadFile.ts +6 -7
  80. package/src/impaktapps-ui-builder/runtime/services/service.ts +34 -5
@@ -8,47 +8,52 @@ 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, okHandler, saveFormdataInSessionStorage, saveHandler } 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"],
15
- Table: ["Core", "Components", "Properties", "Events", "Style", "Validation"],
16
- LeaderBoard: ["Core", "Components", "Properties", "Events", "Style", "Validation"],
17
- WrapperSection: ["Core", "Components", "Properties", "Style", "Validation"],
18
- HorizontalLayout: ["Core", "Components", "Properties", "Style", "Validation"],
19
- TabSection: ["Core", "Components", "Properties", "Style", "Validation"],
20
- SpeedoMeter: ["Core", "Properties", "Events", "Style", "Validation"],
15
+ Table: ["Core", "Components", "Properties", "Events", "Style",],
16
+ LeaderBoard: ["Core", "Components", "Properties", "Events", "Style",],
17
+ WrapperSection: ["Core", "Components", "Properties", "Style",],
18
+ HorizontalLayout: ["Core", "Components", "Properties", "Style",],
19
+ TabSection: ["Core", "Components", "TabTitles", "Properties", "Style", "Validation"],
20
+ SpeedoMeter: ["Core", "Properties", "Events", "Style",],
21
21
  card: ["Core", "Properties", "Events", "Style", "Validation"],
22
22
  UploadFile: ["Core", "Events", "Style", "Validation"],
23
23
  Graph: ["Core", "Properties", "Events", "Style", "Validation"],
24
24
  DownloadFile: ["Core", "Events", "Style", "Validation"],
25
- Box: ["Core", "Properties" , "Events", "Style", "Validation"],
25
+ Box: ["Core", "Properties", "Events", "Style", "Validation"],
26
26
  Properties: ["Core", "Properties", "Events", "Style", "Validation"],
27
- ProgressBarCard: ["Core", "Properties", "Events", "Style", "Validation"],
28
- RankCard: ["Core", "Properties", "Events", "Style", "Validation"],
27
+ ProgressBarCard: ["Core", "Properties", "Events", "Style"],
28
+ ProgressBar: ["Core", "Properties", "Events", "Style",],
29
+ RankCard: ["Core", "Properties", "Events", "Style",],
29
30
  MetricCard: ["Core", "Properties", "Events", "Style", "Validation"],
31
+ HierarchyChart: ["Core","Components","Properties", "Events", "Style", "Validation"],
30
32
  Slider: ["Core", "Components", "Events", "Style", "Validation"],
31
- Timer: ["Core", "Events", "Style", "Validation"],
32
- Rank: ["Core", "Events", "Style", "Validation"],
33
+ Timer: ["Core", "Events", "Style",],
34
+ Rank: ["Core", "Events", "Style",],
33
35
  Button: ["Core", "Properties", "Events", "Style", "Validation"],
34
- Array: ["Core", "Components", "Properties","Events","Validation"],
36
+ ButtonGroup: ["Core", "Components", "Properties", "Events", "Style", "Validation"],
37
+ Array: ["Core", "Components", "Properties", "Events", "Style", "Validation"],
35
38
  Radio: ["Core", "Properties", "Events", "Style", "Validation"],
36
39
  Text: ["Core", "Properties", "Events", "Style", "Validation"],
37
40
  TextArea: ["Core", "Properties", "Events", "Style", "Validation"],
38
- PopUp: ["Core", "Components", "Properties", "Style"],
41
+ PopUp: ["Core", "Components", "Properties", "Events", "Style"],
42
+ PopOver: ["Core", "Components", "Properties", "Style"],
43
+ PdfViewer: ["Core", "Properties", "Style"],
39
44
  Stepper: ["Core", "Components", "Properties", "Events", "Style"],
40
45
  DataGrid: ["Core", "Components", "Properties", "Events", "Style"],
41
46
  InputSlider: ["Core", "Properties", "Events", "Style", "Validation"],
42
47
  TreeMap: ["Core", "Components", "Properties", "Events", "Style"],
43
48
  ColumnGroup: ["Core", "Components"],
44
- Thought: ["Core", "Properties", "Events", "Style", "Validation"],
49
+ Thought: ["Core", "Properties", "Events", "Style",],
45
50
  Date: ["Core", "Properties", "Events", "Style", "Validation"],
46
51
  DateTime: ["Core", "Properties", "Events", "Style", "Validation"],
47
- Image: ["Core", "Properties","Style"],
48
- FileInput: ["Core","Properties","Events", "Style", "Validation"],
49
-
52
+ Image: ["Core", "Properties", "Events", "Style"],
53
+ FileInput: ["Core", "Properties", "Events", "Style", "Validation"],
54
+ Camera: ["Core", "Properties", "Events", "Style", "Validation"],
55
+ OTP_Input: ["Core", "Properties", "Events", "Style", "Validation"],
50
56
  }
51
-
52
57
  export function refreshPage(type: string, store: any) {
53
58
  const UiSchema = _.cloneDeep(componentBasicUiSchema(store.theme.myTheme))
54
59
  const currentConfig = JSON.parse(sessionStorage.getItem("pageFormdata"));
@@ -59,6 +64,7 @@ export function refreshPage(type: string, store: any) {
59
64
  Style: StyleSection,
60
65
  Events: EventSection(store.theme.myTheme),
61
66
  Components: TableSection(store.theme.myTheme),
67
+ TabTitles: TableSection(store.theme.myTheme, "tabLabelElements"),
62
68
  Properties: buildPropertiesSection(type),
63
69
  Validation: ValidationSection
64
70
  }
@@ -70,12 +76,12 @@ export function refreshPage(type: string, store: any) {
70
76
  // Get Widget Type of parent
71
77
  const path = store.searchParams?.get("path");
72
78
  const lastDotIndex = path.lastIndexOf('.')
73
- const parentPath = path.slice(0,lastDotIndex)
79
+ const parentPath = path.slice(0, lastDotIndex)
74
80
 
75
81
  const parentObj = _.get(currentConfig, parentPath)
76
82
 
77
- if(parentObj?.type === "Table" || parentObj?.type === "ColumnGroup"){
78
- UiSchema.elements[0].elements[0].elements[4] =
83
+ if (parentObj?.type === "Table" || parentObj?.type === "ColumnGroup") {
84
+ UiSchema.elements[0].elements[0].elements[4] =
79
85
  {
80
86
  type: "Control",
81
87
  scope: "#/properties/columnFormat",
@@ -90,7 +96,7 @@ export function refreshPage(type: string, store: any) {
90
96
  },
91
97
  },
92
98
  };
93
- UiSchema.elements[0].elements[0].elements[6] =
99
+ UiSchema.elements[0].elements[0].elements[6] =
94
100
  {
95
101
  type: "Control",
96
102
  scope: "#/properties/filteringOptions",
@@ -105,7 +111,7 @@ export function refreshPage(type: string, store: any) {
105
111
  },
106
112
  },
107
113
  };
108
- UiSchema.elements[0].elements[0].elements[5] =
114
+ UiSchema.elements[0].elements[0].elements[5] =
109
115
  {
110
116
  type: "Control",
111
117
  scope: "#/properties/enableFilter",
@@ -120,49 +126,49 @@ export function refreshPage(type: string, store: any) {
120
126
  },
121
127
  },
122
128
  },
123
- UiSchema.elements[0].elements[0].elements[7] =
124
- {
125
- type: "Control",
126
- scope: "#/properties/enableSorting",
127
- options: {
128
- widget: "RadioInputField",
129
- },
130
- config: {
131
- layout: { xs: 6, sm: 6, md: 4, lg: 3 },
132
- main: {
133
- label: "Enable Sorting",
134
- options: ["Yes", "No"],
129
+ UiSchema.elements[0].elements[0].elements[7] =
130
+ {
131
+ type: "Control",
132
+ scope: "#/properties/enableSorting",
133
+ options: {
134
+ widget: "RadioInputField",
135
135
  },
136
- },
137
- },
138
- UiSchema.elements[0].elements[0].elements[8] =
139
- {
140
- type: "Control",
141
- scope: "#/properties/columnKey",
142
- config: {
143
- layout: { xs: 6, sm: 6, md: 4, lg: 3 },
144
- main: {
145
- label: "Column Key",
136
+ config: {
137
+ layout: { xs: 6, sm: 6, md: 4, lg: 3 },
138
+ main: {
139
+ label: "Enable Sorting",
140
+ options: ["Yes", "No"],
141
+ },
146
142
  },
147
143
  },
148
- options: {
149
- widget: "InputField",
150
- },
151
- },
152
- UiSchema.elements[0].elements[0].elements[9] =
153
- {
154
- type: "Control",
155
- scope: "#/properties/elementType",
156
- options: {
157
- widget: "SelectInputField",
158
- },
159
- config: {
160
- layout: { xs: 6, sm: 6, md: 4, lg: 3 },
161
- main: {
162
- label: "Element Type",
144
+ UiSchema.elements[0].elements[0].elements[8] =
145
+ {
146
+ type: "Control",
147
+ scope: "#/properties/columnKey",
148
+ config: {
149
+ layout: { xs: 6, sm: 6, md: 4, lg: 3 },
150
+ main: {
151
+ label: "Column Key",
152
+ },
153
+ },
154
+ options: {
155
+ widget: "InputField",
163
156
  },
164
157
  },
165
- }
158
+ UiSchema.elements[0].elements[0].elements[9] =
159
+ {
160
+ type: "Control",
161
+ scope: "#/properties/elementType",
162
+ options: {
163
+ widget: "SelectInputField",
164
+ },
165
+ config: {
166
+ layout: { xs: 6, sm: 6, md: 4, lg: 3 },
167
+ main: {
168
+ label: "Element Type",
169
+ },
170
+ },
171
+ }
166
172
  UiSchema.elements[0].elements[0].elements[10] = {
167
173
  type: "Control",
168
174
  scope: "#/properties/dateFormat",
@@ -187,8 +193,8 @@ export function refreshPage(type: string, store: any) {
187
193
  },
188
194
  }
189
195
  }
190
- if(parentObj?.type === "LeaderBoard"){
191
- UiSchema.elements[0].elements[0].elements[4] =
196
+ if (parentObj?.type === "LeaderBoard") {
197
+ UiSchema.elements[0].elements[0].elements[4] =
192
198
  {
193
199
  type: "Control",
194
200
  scope: "#/properties/columnFormat",
@@ -204,7 +210,7 @@ export function refreshPage(type: string, store: any) {
204
210
  };
205
211
  }
206
212
 
207
- if (sessionStorage.getItem("copiedConfig") ) {
213
+ if (sessionStorage.getItem("copiedConfig")) {
208
214
  this.ElementPathSetter(UiSchema);
209
215
  }
210
216
  store.setUiSchema(UiSchema);
@@ -230,33 +236,33 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
230
236
  if (sessionStorage.getItem("copiedConfig")) {
231
237
  schema.properties.RemoveItemButton.disabled = false;
232
238
  }
233
-
239
+
234
240
  const config = JSON.parse(sessionStorage.getItem("pageFormdata"));
235
241
  const path = store.searchParams?.get("path");
236
242
  const id = store.searchParams?.get("id")
237
243
 
238
- let pathArray = [{label: config.name ?? "NewPage", path: `/PageMaster${id ? `?id=${id}` : ''}`}];
244
+ let pathArray = [{ label: config.name ?? "NewPage", path: `/PageMaster${id ? `?id=${id}` : ''}` }];
239
245
 
240
246
  if (path) {
241
- const pathArrayAll = path.split(".");
242
- const arr: any = []
243
- pathArrayAll.map((e: string, i: number) => {
244
- if (i === 0) {
245
- arr.push(e)
246
- return;
247
- }
248
- arr.push(`${arr[i - 1]}.${e}`)
249
- })
247
+ const pathArrayAll = path.split(".");
248
+ const arr: any = []
249
+ pathArrayAll.map((e: string, i: number) => {
250
+ if (i === 0) {
251
+ arr.push(e)
252
+ return;
253
+ }
254
+ arr.push(`${arr[i - 1]}.${e}`)
255
+ })
250
256
 
251
257
 
252
- arr.map((e) => {
253
- const data = _.get(config, e)
254
- pathArray.push({
255
- label: data?.name || data?.eventType || "NewComponent",
256
- path: `/Component?path=${e}${id ? `&id=${id}` : ''}`
257
- });
258
- })
259
- }
258
+ arr.map((e) => {
259
+ const data = _.get(config, e)
260
+ pathArray.push({
261
+ label: data?.name || data?.eventType || "NewComponent",
262
+ path: `/Component?path=${e}${id ? `&id=${id}` : ''}`
263
+ });
264
+ })
265
+ }
260
266
 
261
267
  schema.properties.pageName.path = pathArray
262
268
  return schema;
@@ -272,13 +278,19 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
272
278
  }
273
279
  },
274
280
  editComponents: function () {
281
+
282
+ if (validateAndShowErrors(store)) return;
275
283
  const rowId = dynamicData.path.split(".")[1];
276
284
  const path = store.searchParams?.get("path");
277
285
  const id = store.searchParams?.get("id");
278
286
  saveFormdataInSessionStorage(store.ctx.core.data, path)
279
287
  if (path) {
280
- const path = store.searchParams?.get("path");
281
- const finalPath = `${path}.elements[${rowId}]`
288
+ let finalPath = `${path}`;
289
+ if (dynamicData?.path?.startsWith("tabLabel")) {
290
+ finalPath = `${finalPath}.tabLabelElements[${rowId}]`
291
+ } else {
292
+ finalPath = `${finalPath}.elements[${rowId}]`
293
+ }
282
294
  store.searchParams.set("path", finalPath)
283
295
  store.setSearchParams(store.searchParams)
284
296
  this.setPage()
@@ -289,7 +301,12 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
289
301
  deleteComponents: function (shouldUpdateDialog: boolean = true) {
290
302
  const path = store.searchParams?.get("path");
291
303
  const rowId = sessionStorage.getItem('rowId');
292
- store.formData.elements.splice(rowId, 1);
304
+ const isTabLabelElements = sessionStorage.getItem('isTabLabelElements') === "true";
305
+ if (isTabLabelElements) {
306
+ store.formData.tabLabelElements.splice(rowId, 1);
307
+ } else {
308
+ store.formData.elements.splice(rowId, 1);
309
+ }
293
310
  const response = saveFormdataInSessionStorage(store.ctx.core.data, path)
294
311
  const data = path ? _.get(response, path) : response;
295
312
  store.setFormdata(data);
@@ -297,6 +314,7 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
297
314
  store.updateDialog("popUpComponentSection");
298
315
  }
299
316
  sessionStorage.removeItem('rowId');
317
+ sessionStorage.removeItem('isTabLabelElements');
300
318
  },
301
319
  deleteEvent: function (shouldUpdateDialog: boolean = true) {
302
320
  const path = store.searchParams?.get("path");
@@ -310,18 +328,29 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
310
328
  sessionStorage.removeItem('rowId');
311
329
  },
312
330
  widgetAddClickHandler: function () {
331
+
332
+ if (validateAndShowErrors(store)) return;
313
333
  if (!Array.isArray(store.formData.elements)) {
314
334
  store.formData.elements = []
315
335
  }
336
+ if (!Array.isArray(store.formData.tabLabelElements)) {
337
+ store.formData.tabLabelElements = []
338
+ }
316
339
  const path = store.searchParams?.get("path");
317
340
  saveFormdataInSessionStorage(store.ctx.core.data, path)
318
- const finalPath = `${path}.elements[${store.formData.elements.length}]`
341
+ let finalPath = `${path}`;
342
+ if (dynamicData.path.startsWith("tabLabel")) {
343
+ finalPath = `${finalPath}.tabLabelElements[${store.formData.tabLabelElements.length}]`
344
+ } else {
345
+ finalPath = `${finalPath}.elements[${store.formData.elements.length}]`
346
+ }
319
347
  store.searchParams.set("path", finalPath)
320
348
  store.setSearchParams(store.searchParams)
321
349
  this.setPage()
322
350
 
323
351
  },
324
352
  eventEditHandler: function () {
353
+ if (validateAndShowErrors(store)) return;
325
354
  const rowId = dynamicData.path.split(".")[1];
326
355
  const path = store.searchParams?.get("path");
327
356
  const id = store.searchParams?.get("id");
@@ -330,6 +359,7 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
330
359
  store.navigate(`/ComponentEvents?path=${finalPath}&id=${id}`)
331
360
  },
332
361
  eventAddHandler: function () {
362
+ if (validateAndShowErrors(store)) return;
333
363
  const path = store.searchParams?.get("path");
334
364
  const id = store.searchParams?.get("id");
335
365
  if (!Array.isArray(store.formData.events)) {
@@ -345,6 +375,7 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
345
375
  deletePopUpComponent: function () {
346
376
  const rowId = dynamicData.path.split(".")[1];
347
377
  sessionStorage.setItem('rowId', rowId);
378
+ sessionStorage.setItem('isTabLabelElements', dynamicData.path.startsWith("tabLabel") ? "true" : "false");
348
379
  store.updateDialog("popUpComponentSection");
349
380
  },
350
381
  deletePopUpEvent: function () {
@@ -367,8 +398,8 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
367
398
  const copiedElementPath = this.elementPathHandler(parentPathOfCopiedComponent, rowId, elementType);
368
399
  const copiedFormData = getFormdataFromSessionStorage(copiedElementPath);
369
400
 
370
- this.ElementPathSetter(uiSchema,copiedFormData);
371
- sessionStorage.setItem('copiedConfig',JSON.stringify(copiedFormData));
401
+ this.ElementPathSetter(uiSchema, copiedFormData);
402
+ sessionStorage.setItem('copiedConfig', JSON.stringify(copiedFormData));
372
403
  store.setNotify({
373
404
  SuccessMessage: `${elementType} Copied Successfully`,
374
405
  Success: true,
@@ -391,9 +422,17 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
391
422
  if (!Array.isArray(store.formData.events)) {
392
423
  store.formData.events = []
393
424
  }
425
+ if (!Array.isArray(store.formData.tabLabelElements)) {
426
+ store.formData.tabLabelElements = []
427
+ }
394
428
  saveFormdataInSessionStorage(store.ctx.core.data, pastedElementParentPath);
395
429
  const formData = getFormdataFromSessionStorage(pastedElementParentPath);
396
- const insertElementIndex = elementType === "Component" ? formData.elements.length : formData.events.length;
430
+ const currentLength = {
431
+ "TabsComponent": formData.tabLabelElements.length,
432
+ "Component": formData.elements.length,
433
+ "Events": formData.events.length
434
+ };
435
+ const insertElementIndex = currentLength[elementType] || 0;
397
436
  const pastedElementPath = this.elementPathHandler(pastedElementParentPath, insertElementIndex, elementType);
398
437
 
399
438
  const copiedConfig = JSON.parse(sessionStorage.getItem("copiedConfig"));
@@ -407,7 +446,7 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
407
446
  Fail: true,
408
447
  });
409
448
  }
410
- else if(copiedConfig.name && elementType === "Events"){
449
+ else if (copiedConfig.name && elementType === "Events") {
411
450
  store.setNotify({
412
451
  FailMessage: notificationMessages.Component,
413
452
  Fail: true,
@@ -430,34 +469,37 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
430
469
  elementPathHandler: function (parentPath: string, rowId: any, elementType: string) {
431
470
  if (elementType === "Component") {
432
471
  return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
472
+ }
473
+ if(elementType === "TabsComponent"){
474
+ return `${parentPath}.tabLabelElements[${rowId}]`
433
475
  }
434
476
  return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
435
477
  },
436
478
  ElementPathSetter: function (uiSchema: any, copiedFormData?: any) {
437
479
  const formData = copiedFormData || JSON.parse(sessionStorage.getItem("copiedConfig"));
438
- if(uiSchema?.elements?.[1]?.elements?.[0]?.config?.main?.headerIcons){
439
- uiSchema.elements[1].elements[0].config.main.headerIcons.elements[1].widget.config.main.tooltipMessage = `Copied Component: ${formData.name}`;
480
+ if (uiSchema?.elements?.[1]?.elements?.[0]?.config?.main?.headerIcons) {
481
+ uiSchema.elements[1].elements[0].config.main.headerIcons.elements[1].widget.config.main.tooltipMessage = `Copied Component: ${formData.name}`;
440
482
  }
441
- else if(uiSchema?.elements?.[0]?.elements?.[1]?.elements?.[0]?.config?.main?.headerIcons){
442
- uiSchema.elements[0].elements[1].elements[0].config.main.headerIcons.elements[1].widget.config.main.tooltipMessage = `Copied Component: ${formData.name}`;
483
+ else if (uiSchema?.elements?.[0]?.elements?.[1]?.elements?.[0]?.config?.main?.headerIcons) {
484
+ uiSchema.elements[0].elements[1].elements[0].config.main.headerIcons.elements[1].widget.config.main.tooltipMessage = `Copied Component: ${formData.name}`;
443
485
  }
444
486
 
445
-
446
- if(uiSchema?.elements?.[1]?.elements?.[1]?.config?.main?.headerIcons){
447
- uiSchema.elements[1].elements[1].config.main.headerIcons.elements[1].widget.config.main.tooltipMessage = `Copied Event: ${formData.eventType}`;
487
+
488
+ if (uiSchema?.elements?.[1]?.elements?.[1]?.config?.main?.headerIcons) {
489
+ uiSchema.elements[1].elements[1].config.main.headerIcons.elements[1].widget.config.main.tooltipMessage = `Copied Event: ${formData.eventType}`;
448
490
  }
449
- else if(uiSchema?.elements?.[0]?.elements?.[1]?.config?.main?.headerIcons){
450
- uiSchema.elements[0].elements[1].config.main.headerIcons.elements[1].widget.config.main.tooltipMessage = `Copied Component: ${formData.eventType}`;
491
+ else if (uiSchema?.elements?.[0]?.elements?.[1]?.config?.main?.headerIcons) {
492
+ uiSchema.elements[0].elements[1].config.main.headerIcons.elements[1].widget.config.main.tooltipMessage = `Copied Component: ${formData.eventType}`;
451
493
  }
452
494
  },
453
495
 
454
-
455
- onNavigatePopupYes: function() {
456
- try{
496
+
497
+ onNavigatePopupYes: function () {
498
+ try {
457
499
  store.navigate(sessionStorage.getItem("pendingNavigatePath"))
458
500
  store.updateDialog(`pageNamepopup`)
459
501
  }
460
- catch(e){
502
+ catch (e) {
461
503
  store.updateDialog(`pageNamepopup`)
462
504
  store.setNotify({
463
505
  FailMessage: "Couldn't navigate page",
@@ -465,8 +507,8 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
465
507
  })
466
508
  }
467
509
  },
468
- onNavigatePopupNo: function() {
469
- store.updateDialog(`pageNamepopup`)
510
+ onNavigatePopupNo: function () {
511
+ store.updateDialog(`pageNamepopup`)
470
512
  }
471
513
  }
472
514
  };
@@ -6,6 +6,7 @@ import {
6
6
  saveFormdataInSessionStorage,
7
7
  saveHandler,
8
8
  getFormdataFromSessionStorage,
9
+ validateAndShowErrors,
9
10
  } from "./utils";
10
11
  import { APISection } from "../build/uischema/apiSection";
11
12
  import {
@@ -210,6 +211,7 @@ export default (
210
211
  }
211
212
  },
212
213
  addEvent: function () {
214
+ if (validateAndShowErrors(store)) return;
213
215
  const path = store.searchParams?.get("path");
214
216
  if (!Array.isArray(store.formData.events)) {
215
217
  store.formData.events = [];
@@ -221,6 +223,7 @@ export default (
221
223
  this.setPage();
222
224
  },
223
225
  editEvent: function () {
226
+ if (validateAndShowErrors(store)) return;
224
227
  const rowId = dynamicData.path.split(".")[1];
225
228
  const path = store.searchParams?.get("path");
226
229
  saveFormdataInSessionStorage(store.ctx.core.data, path);
@@ -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, saveFormdataInSessionStorage, saveHandler } from "./utils";
5
+ import { getFormdataFromSessionStorage, validateAndShowErrors, saveFormdataInSessionStorage, saveHandler } from "./utils";
6
6
 
7
7
 
8
8
  interface funcParamsProps {
@@ -52,6 +52,7 @@ export default (funcParams: funcParamsProps) => {
52
52
  store.navigate("/PageMasterRecords");
53
53
  },
54
54
  onAddClickHandler: function () {
55
+ if (validateAndShowErrors(store)) return;
55
56
  const id = store.searchParams?.get("id");
56
57
  if (!Array.isArray(store.formData.elements)) {
57
58
  store.formData.elements = []
@@ -76,6 +77,7 @@ export default (funcParams: funcParamsProps) => {
76
77
  store.updateDialog("popUpPageMasterComponent");
77
78
  },
78
79
  eventAddHandler: function () {
80
+ if (validateAndShowErrors(store)) return;
79
81
  const id = store.searchParams?.get("id");
80
82
  if (!Array.isArray(store.formData.events)) {
81
83
  store.formData.events = []
@@ -85,6 +87,7 @@ export default (funcParams: funcParamsProps) => {
85
87
  store.navigate(`/ComponentEvents?path=${finalPath}&id=${id}`)
86
88
  },
87
89
  editEvent: function () {
90
+ if (validateAndShowErrors(store)) return;
88
91
  const rowId = dynamicData.path.split(".")[1];
89
92
  const id = store.searchParams?.get("id");
90
93
  saveFormdataInSessionStorage(store.ctx.core.data)
@@ -5,6 +5,16 @@ const clearFromSessionStorage = () => {
5
5
  sessionStorage.removeItem("pageFormdata")
6
6
  }
7
7
  export default clearFromSessionStorage;
8
+
9
+ export const validateAndShowErrors = (store: any): boolean => {
10
+ if (_.isEmpty(store.ctx.core.errors)) return false;
11
+ store.setValidation("ValidateAndShow");
12
+ store.setNotify({
13
+ Fail: true,
14
+ FailMessage: "Error on Page"
15
+ });
16
+ return true;
17
+ };
8
18
  export const getNavigationHistory = (config: any, path: string | undefined) => {
9
19
  if (path) {
10
20
  let urlRoutes: string = config.name;
@@ -67,12 +77,14 @@ export async function saveHandler(store, service, submitHandler) {
67
77
  const saveReturn = await submitHandler(store, service, config);
68
78
  navigateHandler(store, true,"/PageMasterRecords")
69
79
  } catch (err) {
70
- navigateHandler(store, false)
80
+ navigateHandler(store, false, undefined, err.message);
71
81
  }
82
+ }else{
83
+ navigateHandler(store, false)
72
84
  }
73
85
  }
74
86
 
75
- export const navigateHandler = (store, isSubmitted, pageName?: string | boolean) => {
87
+ export const navigateHandler = (store, isSubmitted,pageName?: string | boolean, errorMessage?: string) => {
76
88
  if (isSubmitted) {
77
89
  sessionStorage.removeItem("pageFormdata");
78
90
  store.navigate(pageName || -1)
@@ -84,7 +96,7 @@ export const navigateHandler = (store, isSubmitted, pageName?: string | boolean)
84
96
  store.setValidation("ValidateAndShow");
85
97
  store.setNotify({
86
98
  Fail: true,
87
- FailMessage: "Errors on Page"
99
+ FailMessage: errorMessage || "Errors on Page"
88
100
  });
89
101
  }
90
102
  };
@@ -30,15 +30,14 @@ export function downloadFile({ data, name }: { data: string; name: string }) {
30
30
  }
31
31
 
32
32
  export const downloadFileFromUrl = (response: any, service) => {
33
- let url = `${service.defaults.baseURL}/${response.path}`;
33
+ let url = new URL(response.path, service.defaults.baseURL);
34
34
  if (response?.params) {
35
- const keysArray = Object.keys(response?.params);
36
- keysArray.map((e, i) => {
37
- url = url + `${i === 0 ? "?" : "&"}${e}=${response?.params[e]}`
38
- })
39
- };
35
+ Object.keys(response.params).forEach((key) => {
36
+ url.searchParams.append(key, response.params[key]);
37
+ });
38
+ }
40
39
  const link = document.createElement('a');
41
- link.href = url;
40
+ link.href = url.toString();
42
41
  document.body.appendChild(link);
43
42
  link.click();
44
43
  link.parentNode.removeChild(link);