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