impaktapps-ui-builder 0.0.101-alpha.27 → 0.0.101-alpha.273

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 (32) hide show
  1. package/dist/impaktapps-ui-builder.es.js +491 -272
  2. package/dist/impaktapps-ui-builder.es.js.map +1 -1
  3. package/dist/impaktapps-ui-builder.umd.js +17 -17
  4. package/dist/impaktapps-ui-builder.umd.js.map +1 -1
  5. package/dist/src/impaktapps-ui-builder/builder/build/uischema/card.d.ts +5 -1
  6. package/dist/src/impaktapps-ui-builder/builder/build/uischema/table.d.ts +1 -0
  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 +38 -30
  13. package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +1 -1
  14. package/src/impaktapps-ui-builder/builder/build/uischema/card.ts +7 -4
  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/table.ts +1 -0
  18. package/src/impaktapps-ui-builder/builder/build/uischema/validationSections.ts +0 -52
  19. package/src/impaktapps-ui-builder/builder/build/uischema/valueTab.ts +0 -50
  20. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +33 -28
  21. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +28 -165
  22. package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/uiSchema.ts +23 -97
  23. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +15 -12
  24. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/uiSchema.ts +43 -259
  25. package/src/impaktapps-ui-builder/builder/services/component.ts +220 -56
  26. package/src/impaktapps-ui-builder/builder/services/event.ts +175 -58
  27. package/src/impaktapps-ui-builder/runtime/services/events.ts +8 -1
  28. package/src/impaktapps-ui-builder/runtime/services/service.ts +19 -122
  29. package/dist/src/impaktapps-ui-builder/builder/build/buildPdfViewer.d.ts +0 -1
  30. package/dist/src/impaktapps-ui-builder/builder/build/uischema/pdfViewer.d.ts +0 -19
  31. package/src/impaktapps-ui-builder/builder/build/buildPdfViewer.ts +0 -22
  32. package/src/impaktapps-ui-builder/builder/build/uischema/pdfViewer.ts +0 -18
@@ -10,54 +10,154 @@ 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/elementType",
149
+ options: {
150
+ widget: "SelectInputField",
151
+ },
152
+ config: {
153
+ layout: { xs: 6, sm: 6, md: 4, lg: 3 },
154
+ main: {
155
+ label: "Element Type",
156
+ },
157
+ },
158
+ }
159
+ }
160
+
61
161
  if (sessionStorage.getItem("copiedConfig") ) {
62
162
  this.ElementPathSetter(UiSchema);
63
163
  }
@@ -81,9 +181,38 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
81
181
  },
82
182
  getSchema: function () {
83
183
  const schema = _.cloneDeep(ComponentSchema);
84
- if (sessionStorage.getItem("copiedConfig") ) {
184
+ if (sessionStorage.getItem("copiedConfig")) {
85
185
  schema.properties.RemoveItemButton.disabled = false;
86
186
  }
187
+
188
+ const config = JSON.parse(sessionStorage.getItem("pageFormdata"));
189
+ const path = store.searchParams?.get("path");
190
+ const id = store.searchParams?.get("id")
191
+
192
+ let pathArray = [{label: config.name ?? "NewPage", path: `/PageMaster${id ? `?id=${id}` : ''}`}];
193
+
194
+ if (path) {
195
+ const pathArrayAll = path.split(".");
196
+ const arr: any = []
197
+ pathArrayAll.map((e: string, i: number) => {
198
+ if (i === 0) {
199
+ arr.push(e)
200
+ return;
201
+ }
202
+ arr.push(`${arr[i - 1]}.${e}`)
203
+ })
204
+
205
+
206
+ arr.map((e) => {
207
+ const data = _.get(config, e)
208
+ pathArray.push({
209
+ label: data?.name || data?.eventType || "NewComponent",
210
+ path: `/Component?path=${e}${id ? `&id=${id}` : ''}`
211
+ });
212
+ })
213
+ }
214
+
215
+ schema.properties.pageName.path = pathArray
87
216
  return schema;
88
217
  },
89
218
  okHandler: () => okHandler(store),
@@ -169,22 +298,22 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
169
298
  },
170
299
  deletePopUpComponent: function () {
171
300
  const rowId = dynamicData.path.split(".")[1];
172
- sessionStorage.setItem('rowId',rowId);
301
+ sessionStorage.setItem('rowId', rowId);
173
302
  store.updateDialog("popUpComponentSection");
174
303
  },
175
304
  deletePopUpEvent: function () {
176
305
  const rowId = dynamicData.path.split(".")[1];
177
- sessionStorage.setItem('rowId',rowId);
306
+ sessionStorage.setItem('rowId', rowId);
178
307
  store.updateDialog("popUpEventSection");
179
308
  },
180
309
 
181
- copyPasteElement: function(paramStore: any, setPage: any = this.setPage.bind(this) ){
310
+ copyPasteElement: function (paramStore: any, setPage: any = this.setPage.bind(this)) {
182
311
  const [actionType, elementType] = dynamicData.path.split('.').pop()?.split('_');
183
312
  actionType === "Copy" ? this.CopyElement(paramStore, elementType) : this.PasteElement(setPage, elementType);
184
313
  },
185
- CopyElement: function(paramStore: any = store, elementType: string){
186
- const schema = cloneDeep(paramStore.schema );
187
- const uiSchema = cloneDeep(paramStore.uiSchema );
314
+ CopyElement: function (paramStore: any = store, elementType: string) {
315
+ const schema = cloneDeep(paramStore.schema);
316
+ const uiSchema = cloneDeep(paramStore.uiSchema);
188
317
  schema.properties.RemoveItemButton.disabled = false;
189
318
 
190
319
  const rowId = dynamicData.path.split(".")[1];
@@ -194,11 +323,15 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
194
323
 
195
324
  this.ElementPathSetter(uiSchema,copiedFormData);
196
325
  sessionStorage.setItem('copiedConfig',JSON.stringify(copiedFormData));
326
+ store.setNotify({
327
+ SuccessMessage: `${elementType} Copied Successfully`,
328
+ Success: true,
329
+ })
197
330
  store.setSchema(schema);
198
331
  store.setUiSchema(uiSchema);
199
- },
200
- PasteElement: function( setPage: any , elementType: string){
201
- if (!sessionStorage.getItem("copiedConfig") ) {
332
+ },
333
+ PasteElement: function (setPage: any, elementType: string) {
334
+ if (!sessionStorage.getItem("copiedConfig")) {
202
335
  store.setNotify({
203
336
  FailMessage: "No item has been copied.",
204
337
  Fail: true,
@@ -206,41 +339,41 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
206
339
  return;
207
340
  }
208
341
  const pastedElementParentPath = store.searchParams?.get("path");
209
- if (!Array.isArray(store.formData.elements) ) {
342
+ if (!Array.isArray(store.formData.elements)) {
210
343
  store.formData.elements = []
211
344
  }
212
345
  if (!Array.isArray(store.formData.events)) {
213
346
  store.formData.events = []
214
347
  }
215
348
  saveFormdataInSessionStorage(store.ctx.core.data, pastedElementParentPath);
216
- const formData = getFormdataFromSessionStorage(pastedElementParentPath);
217
- const insertElementIndex = elementType === "Component" ? formData.elements.length : formData.events.length;
349
+ const formData = getFormdataFromSessionStorage(pastedElementParentPath);
350
+ const insertElementIndex = elementType === "Component" ? formData.elements.length : formData.events.length;
218
351
  const pastedElementPath = this.elementPathHandler(pastedElementParentPath, insertElementIndex, elementType);
219
352
 
220
353
  const copiedConfig = JSON.parse(sessionStorage.getItem("copiedConfig"));
221
354
  const notificationMessages = {
222
- Event: " The event cannot be integrated into the component section.",
223
- Component: "The component cannot be integrated into the event section."
355
+ Events: " The Events cannot be integrated into the component section.",
356
+ Component: "The component cannot be integrated into the Events section."
224
357
  };
225
- if(copiedConfig.Handler && elementType === "Component"){
358
+ if (copiedConfig.Handler && elementType === "Component") {
226
359
  store.setNotify({
227
- FailMessage: notificationMessages.Event,
360
+ FailMessage: notificationMessages.Events,
228
361
  Fail: true,
229
362
  });
230
363
  }
231
- else if(copiedConfig.name && elementType === "Event"){
364
+ else if(copiedConfig.name && elementType === "Events"){
232
365
  store.setNotify({
233
366
  FailMessage: notificationMessages.Component,
234
367
  Fail: true,
235
368
  });
236
369
  }
237
- else{
370
+ else {
238
371
  saveFormdataInSessionStorage(copiedConfig, pastedElementPath);
239
372
  setPage();
240
373
  }
241
- },
242
- RemoveItemButton: function(paramStore: any = store){
243
- const schema = cloneDeep(paramStore.schema );
374
+ },
375
+ RemoveItemButton: function (paramStore: any = store) {
376
+ const schema = cloneDeep(paramStore.schema);
244
377
  const uiSchema = cloneDeep(paramStore.uiSchema);
245
378
  schema.properties.RemoveItemButton.disabled = true;
246
379
  uiSchema.elements[2].elements[1].config.main.heading = `No element copied`;
@@ -248,15 +381,46 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
248
381
  store.setSchema(schema);
249
382
  store.setUiSchema(uiSchema);
250
383
  },
251
- elementPathHandler: function(parentPath: string, rowId: any, elementType: string){
252
- if(elementType === "Component"){
253
- return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
384
+ elementPathHandler: function (parentPath: string, rowId: any, elementType: string) {
385
+ if (elementType === "Component") {
386
+ return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
254
387
  }
255
- return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
388
+ return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
256
389
  },
257
- ElementPathSetter: function(uiSchema: any,copiedFormData?: any){
390
+ ElementPathSetter: function (uiSchema: any, copiedFormData?: any) {
258
391
  const formData = copiedFormData || JSON.parse(sessionStorage.getItem("copiedConfig"));
259
- uiSchema.elements[2].elements[1].config.main.heading = `Copied Path: ${formData.pageName}`;
392
+ if(uiSchema?.elements?.[1]?.elements?.[0]?.config?.main?.headerIcons){
393
+ uiSchema.elements[1].elements[0].config.main.headerIcons.elements[1].widget.config.main.tooltipMessage = `Copied Component: ${formData.name}`;
394
+ }
395
+ else if(uiSchema?.elements?.[0]?.elements?.[1]?.elements?.[0]?.config?.main?.headerIcons){
396
+ uiSchema.elements[0].elements[1].elements[0].config.main.headerIcons.elements[1].widget.config.main.tooltipMessage = `Copied Component: ${formData.name}`;
397
+ }
398
+
399
+
400
+ if(uiSchema?.elements?.[1]?.elements?.[1]?.config?.main?.headerIcons){
401
+ uiSchema.elements[1].elements[1].config.main.headerIcons.elements[1].widget.config.main.tooltipMessage = `Copied Event: ${formData.eventType}`;
402
+ }
403
+ else if(uiSchema?.elements?.[0]?.elements?.[1]?.config?.main?.headerIcons){
404
+ uiSchema.elements[0].elements[1].config.main.headerIcons.elements[1].widget.config.main.tooltipMessage = `Copied Component: ${formData.eventType}`;
405
+ }
406
+ },
407
+
408
+
409
+ onNavigatePopupYes: function() {
410
+ try{
411
+ store.navigate(sessionStorage.getItem("pendingNavigatePath"))
412
+ store.updateDialog(`pageNamepopup`)
413
+ }
414
+ catch(e){
415
+ store.updateDialog(`pageNamepopup`)
416
+ store.setNotify({
417
+ FailMessage: "Couldn't navigate page",
418
+ Fail: true,
419
+ })
420
+ }
421
+ },
422
+ onNavigatePopupNo: function() {
423
+ store.updateDialog(`pageNamepopup`)
260
424
  }
261
425
  }
262
426
  };