impaktapps-ui-builder 0.0.101-alpha.24 → 0.0.101-alpha.251

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 (31) hide show
  1. package/dist/impaktapps-ui-builder.es.js +557 -328
  2. package/dist/impaktapps-ui-builder.es.js.map +1 -1
  3. package/dist/impaktapps-ui-builder.umd.js +15 -15
  4. package/dist/impaktapps-ui-builder.umd.js.map +1 -1
  5. package/dist/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.d.ts +0 -10
  6. package/dist/src/impaktapps-ui-builder/builder/build/uischema/card.d.ts +3 -5
  7. package/dist/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.d.ts +6 -0
  8. package/dist/src/impaktapps-ui-builder/builder/services/component.d.ts +2 -0
  9. package/dist/src/impaktapps-ui-builder/builder/services/event.d.ts +8 -0
  10. package/package.json +1 -1
  11. package/src/impaktapps-ui-builder/builder/build/buildText.ts +21 -18
  12. package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +21 -29
  13. package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +87 -72
  14. package/src/impaktapps-ui-builder/builder/build/uischema/card.ts +11 -8
  15. package/src/impaktapps-ui-builder/builder/build/uischema/coreSection.ts +1 -60
  16. package/src/impaktapps-ui-builder/builder/build/uischema/eventSection.ts +2 -2
  17. package/src/impaktapps-ui-builder/builder/build/uischema/validationSections.ts +0 -52
  18. package/src/impaktapps-ui-builder/builder/build/uischema/valueTab.ts +0 -50
  19. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +25 -28
  20. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +46 -159
  21. package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/uiSchema.ts +23 -97
  22. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +15 -12
  23. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/uiSchema.ts +43 -259
  24. package/src/impaktapps-ui-builder/builder/services/component.ts +217 -56
  25. package/src/impaktapps-ui-builder/builder/services/event.ts +175 -58
  26. package/src/impaktapps-ui-builder/runtime/services/events.ts +8 -1
  27. package/src/impaktapps-ui-builder/runtime/services/service.ts +5 -111
  28. package/dist/src/impaktapps-ui-builder/builder/build/buildPdfViewer.d.ts +0 -1
  29. package/dist/src/impaktapps-ui-builder/builder/build/uischema/pdfViewer.d.ts +0 -19
  30. package/src/impaktapps-ui-builder/builder/build/buildPdfViewer.ts +0 -22
  31. package/src/impaktapps-ui-builder/builder/build/uischema/pdfViewer.ts +0 -18
@@ -10,54 +10,151 @@ import { ValueTab } from "../build/uischema/valueTab";
10
10
  import { ValidationSection } from "../build/uischema/validationSections";
11
11
  import { getFormdataFromSessionStorage, okHandler, saveFormdataInSessionStorage, saveHandler } from "./utils";
12
12
  const sectionLabels = {
13
- Select: ["Core", "Properties", "Value", "Event", "Style", "Validation"],
14
- MultipleSelect: ["Core", "Properties", "Value", "Event", "Style", "Validation"],
15
- Table: ["Core", "Components", "Properties", "Event", "Style", "Validation"],
16
- LeaderBoard: ["Core", "Components", "Properties", "Event", "Style", "Validation"],
13
+ Select: ["Core", "Properties", "Value", "Events", "Style", "Validation"],
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
17
  WrapperSection: ["Core", "Components", "Properties", "Style", "Validation"],
18
18
  TabSection: ["Core", "Components", "Properties", "Style", "Validation"],
19
- SpeedoMeter: ["Core", "Properties", "Event", "Style", "Validation"],
20
- card: ["Core", "Properties", "Event", "Style", "Validation"],
21
- UploadFile: ["Core", "Event", "Style", "Validation"],
22
- Graph: ["Core", "Properties", "Event", "Style", "Validation"],
23
- DownloadFile: ["Core", "Event", "Style", "Validation"],
24
- Box: ["Core", "Event", "Style", "Validation"],
25
- Properties: ["Core", "Properties", "Event", "Style", "Validation"],
26
- ProgressBarCard: ["Core", "Properties", "Event", "Style", "Validation"],
27
- RankCard: ["Core", "Properties", "Event", "Style", "Validation"],
28
- Slider: ["Core", "Components", "Event", "Style", "Validation"],
29
- Timer: ["Core", "Event", "Style", "Validation"],
30
- Rank: ["Core", "Event", "Style", "Validation"],
31
- Button: ["Core", "Properties", "Event", "Style", "Validation"],
19
+ SpeedoMeter: ["Core", "Properties", "Events", "Style", "Validation"],
20
+ card: ["Core", "Properties", "Events", "Style", "Validation"],
21
+ UploadFile: ["Core", "Events", "Style", "Validation"],
22
+ Graph: ["Core", "Properties", "Events", "Style", "Validation"],
23
+ DownloadFile: ["Core", "Events", "Style", "Validation"],
24
+ Box: ["Core", "Events", "Style", "Validation"],
25
+ Properties: ["Core", "Properties", "Events", "Style", "Validation"],
26
+ ProgressBarCard: ["Core", "Properties", "Events", "Style", "Validation"],
27
+ RankCard: ["Core", "Properties", "Events", "Style", "Validation"],
28
+ Slider: ["Core", "Components", "Events", "Style", "Validation"],
29
+ Timer: ["Core", "Events", "Style", "Validation"],
30
+ Rank: ["Core", "Events", "Style", "Validation"],
31
+ Button: ["Core", "Properties", "Events", "Style", "Validation"],
32
32
  Array: ["Core", "Components", "Validation"],
33
- Radio: ["Core", "Properties", "Event", "Style", "Validation"],
34
- Text: ["Core", "Properties", "Event", "Style", "Validation"],
35
- TextArea: ["Core", "Properties", "Event", "Style", "Validation"],
33
+ Radio: ["Core", "Properties", "Events", "Style", "Validation"],
34
+ Text: ["Core", "Properties", "Events", "Style", "Validation"],
35
+ TextArea: ["Core", "Properties", "Events", "Style", "Validation"],
36
36
  PopUp: ["Core", "Components", "Properties", "Style"],
37
- Stepper: ["Core", "Components", "Properties", "Event", "Style"],
38
- DataGrid: ["Core", "Components", "Properties", "Event", "Style"],
39
- InputSlider: ["Core", "Properties", "Event", "Style", "Validation"],
40
- TreeMap: ["Core", "Components", "Properties", "Event", "Style"],
37
+ Stepper: ["Core", "Components", "Properties", "Events", "Style"],
38
+ DataGrid: ["Core", "Components", "Properties", "Events", "Style"],
39
+ InputSlider: ["Core", "Properties", "Events", "Style", "Validation"],
40
+ TreeMap: ["Core", "Components", "Properties", "Events", "Style"],
41
41
  ColumnGroup: ["Core", "Components"],
42
- Thought: ["Core", "Properties", "Event", "Style", "Validation"]
42
+ Thought: ["Core", "Properties", "Events", "Style", "Validation"]
43
43
  }
44
44
 
45
- export function refreshPage (type: string, store: any) {
45
+ export function refreshPage(type: string, store: any) {
46
46
  const UiSchema = _.cloneDeep(componentBasicUiSchema(store.theme.myTheme))
47
+ const currentConfig = JSON.parse(sessionStorage.getItem("pageFormdata"));
47
48
  if (type) {
48
49
  const sectionUiSchema = {
49
50
  Core: CoreSection,
50
51
  Value: ValueTab,
51
52
  Style: StyleSection,
52
- Event: EventSection(store.theme.myTheme),
53
+ Events: EventSection(store.theme.myTheme),
53
54
  Components: TableSection(store.theme.myTheme),
54
55
  Properties: buildPropertiesSection(type),
55
56
  Validation: ValidationSection
56
57
  }
57
58
  const elements = sectionLabels[type]?.map(e => sectionUiSchema[e]);
58
- UiSchema.elements[0].config.main.tabLabels = sectionLabels[type] || ["Core", "Style", "Event", "Validation"];
59
+ UiSchema.elements[0].config.main.tabLabels = sectionLabels[type] || ["Core", "Style", "Events", "Validation"];
59
60
  UiSchema.elements[0].elements = elements || [CoreSection, StyleSection, EventSection(store.theme.myTheme), ValidationSection];
60
61
  }
62
+
63
+ // Get Widget Type of parent
64
+ const path = store.searchParams?.get("path");
65
+ const lastDotIndex = path.lastIndexOf('.')
66
+ const parentPath = path.slice(0,lastDotIndex)
67
+
68
+ const parentObj = _.get(currentConfig, parentPath)
69
+
70
+ if(parentObj?.type === "Table"){
71
+ UiSchema.elements[0].elements[0].elements[4] =
72
+ {
73
+ type: "Control",
74
+ scope: "#/properties/columnFormat",
75
+ options: {
76
+ widget: "SelectInputField",
77
+ },
78
+ config: {
79
+ layout: { xs: 6, sm: 6, md: 4, lg: 3 },
80
+ main: {
81
+ label: "Column Format",
82
+
83
+ },
84
+ },
85
+ };
86
+ UiSchema.elements[0].elements[0].elements[6] =
87
+ {
88
+ type: "Control",
89
+ scope: "#/properties/filteringOptions",
90
+ options: {
91
+ widget: "SelectInputField",
92
+ },
93
+ config: {
94
+ layout: { xs: 6, sm: 6, md: 4, lg: 3 },
95
+ main: {
96
+ label: "Filter Mode",
97
+ multiple: true
98
+ },
99
+ },
100
+ };
101
+ UiSchema.elements[0].elements[0].elements[5] =
102
+ {
103
+ type: "Control",
104
+ scope: "#/properties/enableFilter",
105
+ options: {
106
+ widget: "RadioInputField",
107
+ },
108
+ config: {
109
+ layout: { xs: 6, sm: 6, md: 4, lg: 3 },
110
+ main: {
111
+ label: "Enable Filter",
112
+ options: ["Yes", "No"],
113
+ },
114
+ },
115
+ },
116
+ UiSchema.elements[0].elements[0].elements[7] =
117
+ {
118
+ type: "Control",
119
+ scope: "#/properties/enableSorting",
120
+ options: {
121
+ widget: "RadioInputField",
122
+ },
123
+ config: {
124
+ layout: { xs: 6, sm: 6, md: 4, lg: 3 },
125
+ main: {
126
+ label: "Enable Sorting",
127
+ options: ["Yes", "No"],
128
+ },
129
+ },
130
+ },
131
+ UiSchema.elements[0].elements[0].elements[8] =
132
+ {
133
+ type: "Control",
134
+ scope: "#/properties/columnKey",
135
+ config: {
136
+ layout: { xs: 6, sm: 6, md: 4, lg: 3 },
137
+ main: {
138
+ label: "Column Key",
139
+ },
140
+ },
141
+ options: {
142
+ widget: "InputField",
143
+ },
144
+ },
145
+ UiSchema.elements[0].elements[0].elements[9] =
146
+ {
147
+ type: "Control",
148
+ scope: "#/properties/proc",
149
+ config: {
150
+ layout: { xs: 0, sm: 0, md: 4, lg: 0 },
151
+ },
152
+ options: {
153
+ widget: "EmptyBox",
154
+ },
155
+ };
156
+ }
157
+
61
158
  if (sessionStorage.getItem("copiedConfig") ) {
62
159
  this.ElementPathSetter(UiSchema);
63
160
  }
@@ -81,9 +178,38 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
81
178
  },
82
179
  getSchema: function () {
83
180
  const schema = _.cloneDeep(ComponentSchema);
84
- if (sessionStorage.getItem("copiedConfig") ) {
181
+ if (sessionStorage.getItem("copiedConfig")) {
85
182
  schema.properties.RemoveItemButton.disabled = false;
86
183
  }
184
+
185
+ const config = JSON.parse(sessionStorage.getItem("pageFormdata"));
186
+ const path = store.searchParams?.get("path");
187
+ const id = store.searchParams?.get("id")
188
+
189
+ let pathArray = [{label: config.name ?? "NewPage", path: `/PageMaster${id ? `?id=${id}` : ''}`}];
190
+
191
+ if (path) {
192
+ const pathArrayAll = path.split(".");
193
+ const arr: any = []
194
+ pathArrayAll.map((e: string, i: number) => {
195
+ if (i === 0) {
196
+ arr.push(e)
197
+ return;
198
+ }
199
+ arr.push(`${arr[i - 1]}.${e}`)
200
+ })
201
+
202
+
203
+ arr.map((e) => {
204
+ const data = _.get(config, e)
205
+ pathArray.push({
206
+ label: data?.name || data?.eventType || "NewComponent",
207
+ path: `/Component?path=${e}${id ? `&id=${id}` : ''}`
208
+ });
209
+ })
210
+ }
211
+
212
+ schema.properties.pageName.path = pathArray
87
213
  return schema;
88
214
  },
89
215
  okHandler: () => okHandler(store),
@@ -169,22 +295,22 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
169
295
  },
170
296
  deletePopUpComponent: function () {
171
297
  const rowId = dynamicData.path.split(".")[1];
172
- sessionStorage.setItem('rowId',rowId);
298
+ sessionStorage.setItem('rowId', rowId);
173
299
  store.updateDialog("popUpComponentSection");
174
300
  },
175
301
  deletePopUpEvent: function () {
176
302
  const rowId = dynamicData.path.split(".")[1];
177
- sessionStorage.setItem('rowId',rowId);
303
+ sessionStorage.setItem('rowId', rowId);
178
304
  store.updateDialog("popUpEventSection");
179
305
  },
180
306
 
181
- copyPasteElement: function(paramStore: any, setPage: any = this.setPage.bind(this) ){
307
+ copyPasteElement: function (paramStore: any, setPage: any = this.setPage.bind(this)) {
182
308
  const [actionType, elementType] = dynamicData.path.split('.').pop()?.split('_');
183
309
  actionType === "Copy" ? this.CopyElement(paramStore, elementType) : this.PasteElement(setPage, elementType);
184
310
  },
185
- CopyElement: function(paramStore: any = store, elementType: string){
186
- const schema = cloneDeep(paramStore.schema );
187
- const uiSchema = cloneDeep(paramStore.uiSchema );
311
+ CopyElement: function (paramStore: any = store, elementType: string) {
312
+ const schema = cloneDeep(paramStore.schema);
313
+ const uiSchema = cloneDeep(paramStore.uiSchema);
188
314
  schema.properties.RemoveItemButton.disabled = false;
189
315
 
190
316
  const rowId = dynamicData.path.split(".")[1];
@@ -194,11 +320,15 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
194
320
 
195
321
  this.ElementPathSetter(uiSchema,copiedFormData);
196
322
  sessionStorage.setItem('copiedConfig',JSON.stringify(copiedFormData));
323
+ store.setNotify({
324
+ SuccessMessage: `${elementType} Copied Successfully`,
325
+ Success: true,
326
+ })
197
327
  store.setSchema(schema);
198
328
  store.setUiSchema(uiSchema);
199
- },
200
- PasteElement: function( setPage: any , elementType: string){
201
- if (!sessionStorage.getItem("copiedConfig") ) {
329
+ },
330
+ PasteElement: function (setPage: any, elementType: string) {
331
+ if (!sessionStorage.getItem("copiedConfig")) {
202
332
  store.setNotify({
203
333
  FailMessage: "No item has been copied.",
204
334
  Fail: true,
@@ -206,41 +336,41 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
206
336
  return;
207
337
  }
208
338
  const pastedElementParentPath = store.searchParams?.get("path");
209
- if (!Array.isArray(store.formData.elements) ) {
339
+ if (!Array.isArray(store.formData.elements)) {
210
340
  store.formData.elements = []
211
341
  }
212
342
  if (!Array.isArray(store.formData.events)) {
213
343
  store.formData.events = []
214
344
  }
215
345
  saveFormdataInSessionStorage(store.ctx.core.data, pastedElementParentPath);
216
- const formData = getFormdataFromSessionStorage(pastedElementParentPath);
217
- const insertElementIndex = elementType === "Component" ? formData.elements.length : formData.events.length;
346
+ const formData = getFormdataFromSessionStorage(pastedElementParentPath);
347
+ const insertElementIndex = elementType === "Component" ? formData.elements.length : formData.events.length;
218
348
  const pastedElementPath = this.elementPathHandler(pastedElementParentPath, insertElementIndex, elementType);
219
349
 
220
350
  const copiedConfig = JSON.parse(sessionStorage.getItem("copiedConfig"));
221
351
  const notificationMessages = {
222
- Event: " The event cannot be integrated into the component section.",
223
- Component: "The component cannot be integrated into the event section."
352
+ Events: " The Events cannot be integrated into the component section.",
353
+ Component: "The component cannot be integrated into the Events section."
224
354
  };
225
- if(copiedConfig.Handler && elementType === "Component"){
355
+ if (copiedConfig.Handler && elementType === "Component") {
226
356
  store.setNotify({
227
- FailMessage: notificationMessages.Event,
357
+ FailMessage: notificationMessages.Events,
228
358
  Fail: true,
229
359
  });
230
360
  }
231
- else if(copiedConfig.name && elementType === "Event"){
361
+ else if(copiedConfig.name && elementType === "Events"){
232
362
  store.setNotify({
233
363
  FailMessage: notificationMessages.Component,
234
364
  Fail: true,
235
365
  });
236
366
  }
237
- else{
367
+ else {
238
368
  saveFormdataInSessionStorage(copiedConfig, pastedElementPath);
239
369
  setPage();
240
370
  }
241
- },
242
- RemoveItemButton: function(paramStore: any = store){
243
- const schema = cloneDeep(paramStore.schema );
371
+ },
372
+ RemoveItemButton: function (paramStore: any = store) {
373
+ const schema = cloneDeep(paramStore.schema);
244
374
  const uiSchema = cloneDeep(paramStore.uiSchema);
245
375
  schema.properties.RemoveItemButton.disabled = true;
246
376
  uiSchema.elements[2].elements[1].config.main.heading = `No element copied`;
@@ -248,15 +378,46 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
248
378
  store.setSchema(schema);
249
379
  store.setUiSchema(uiSchema);
250
380
  },
251
- elementPathHandler: function(parentPath: string, rowId: any, elementType: string){
252
- if(elementType === "Component"){
253
- return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
381
+ elementPathHandler: function (parentPath: string, rowId: any, elementType: string) {
382
+ if (elementType === "Component") {
383
+ return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
254
384
  }
255
- return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
385
+ return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
256
386
  },
257
- ElementPathSetter: function(uiSchema: any,copiedFormData?: any){
387
+ ElementPathSetter: function (uiSchema: any, copiedFormData?: any) {
258
388
  const formData = copiedFormData || JSON.parse(sessionStorage.getItem("copiedConfig"));
259
- uiSchema.elements[2].elements[1].config.main.heading = `Copied Path: ${formData.pageName}`;
389
+ if(uiSchema?.elements?.[1]?.elements?.[0]?.config?.main?.headerIcons){
390
+ uiSchema.elements[1].elements[0].config.main.headerIcons.elements[1].widget.config.main.tooltipMessage = `Copied Component: ${formData.name}`;
391
+ }
392
+ else if(uiSchema?.elements?.[0]?.elements?.[1]?.elements?.[0]?.config?.main?.headerIcons){
393
+ uiSchema.elements[0].elements[1].elements[0].config.main.headerIcons.elements[1].widget.config.main.tooltipMessage = `Copied Component: ${formData.name}`;
394
+ }
395
+
396
+
397
+ if(uiSchema?.elements?.[1]?.elements?.[1]?.config?.main?.headerIcons){
398
+ uiSchema.elements[1].elements[1].config.main.headerIcons.elements[1].widget.config.main.tooltipMessage = `Copied Event: ${formData.eventType}`;
399
+ }
400
+ else if(uiSchema?.elements?.[0]?.elements?.[1]?.config?.main?.headerIcons){
401
+ uiSchema.elements[0].elements[1].config.main.headerIcons.elements[1].widget.config.main.tooltipMessage = `Copied Component: ${formData.eventType}`;
402
+ }
403
+ },
404
+
405
+
406
+ onNavigatePopupYes: function() {
407
+ try{
408
+ store.navigate(sessionStorage.getItem("pendingNavigatePath"))
409
+ store.updateDialog(`pageNamepopup`)
410
+ }
411
+ catch(e){
412
+ store.updateDialog(`pageNamepopup`)
413
+ store.setNotify({
414
+ FailMessage: "Couldn't navigate page",
415
+ Fail: true,
416
+ })
417
+ }
418
+ },
419
+ onNavigatePopupNo: function() {
420
+ store.updateDialog(`pageNamepopup`)
260
421
  }
261
422
  }
262
423
  };