impaktapps-ui-builder 0.0.382460 → 1.0.1

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 (45) hide show
  1. package/dist/impaktapps-ui-builder.es.js +1273 -1115
  2. package/dist/impaktapps-ui-builder.es.js.map +1 -1
  3. package/dist/impaktapps-ui-builder.umd.js +16 -16
  4. package/dist/impaktapps-ui-builder.umd.js.map +1 -1
  5. package/dist/src/impaktapps-ui-builder/builder/build/uischema/apiSection.d.ts +62 -59
  6. package/dist/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.d.ts +17 -21
  7. package/dist/src/impaktapps-ui-builder/builder/build/uischema/card.d.ts +10 -2
  8. package/dist/src/impaktapps-ui-builder/builder/build/uischema/coreSection.d.ts +23 -32
  9. package/dist/src/impaktapps-ui-builder/builder/build/uischema/eventSection.d.ts +26 -33
  10. package/dist/src/impaktapps-ui-builder/builder/build/uischema/refresh.d.ts +52 -38
  11. package/dist/src/impaktapps-ui-builder/builder/build/uischema/styleSection.d.ts +7 -8
  12. package/dist/src/impaktapps-ui-builder/builder/build/uischema/table.d.ts +1 -0
  13. package/dist/src/impaktapps-ui-builder/builder/build/uischema/tableSection.d.ts +29 -33
  14. package/dist/src/impaktapps-ui-builder/builder/build/uischema/validationSections.d.ts +6 -0
  15. package/dist/src/impaktapps-ui-builder/builder/build/uischema/valueTab.d.ts +56 -36
  16. package/dist/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.d.ts +6 -0
  17. package/dist/src/impaktapps-ui-builder/builder/services/component.d.ts +2 -0
  18. package/dist/src/impaktapps-ui-builder/builder/services/event.d.ts +8 -0
  19. package/dist/src/impaktapps-ui-builder/builder/services/utils.d.ts +1 -1
  20. package/package.json +1 -1
  21. package/src/impaktapps-ui-builder/builder/build/buildAadharCard.ts +2 -0
  22. package/src/impaktapps-ui-builder/builder/build/buildConfig.ts +6 -1
  23. package/src/impaktapps-ui-builder/builder/build/buildText.ts +21 -18
  24. package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +39 -27
  25. package/src/impaktapps-ui-builder/builder/build/uischema/apiSection.ts +111 -96
  26. package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +113 -61
  27. package/src/impaktapps-ui-builder/builder/build/uischema/card.ts +8 -4
  28. package/src/impaktapps-ui-builder/builder/build/uischema/coreSection.ts +108 -88
  29. package/src/impaktapps-ui-builder/builder/build/uischema/eventSection.ts +39 -17
  30. package/src/impaktapps-ui-builder/builder/build/uischema/refresh.ts +44 -44
  31. package/src/impaktapps-ui-builder/builder/build/uischema/styleSection.ts +9 -13
  32. package/src/impaktapps-ui-builder/builder/build/uischema/table.ts +1 -0
  33. package/src/impaktapps-ui-builder/builder/build/uischema/tableSection.ts +40 -18
  34. package/src/impaktapps-ui-builder/builder/build/uischema/validationSections.ts +73 -2
  35. package/src/impaktapps-ui-builder/builder/build/uischema/valueTab.ts +63 -45
  36. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +50 -44
  37. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +232 -309
  38. package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/uiSchema.ts +166 -224
  39. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +15 -12
  40. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/uiSchema.ts +147 -205
  41. package/src/impaktapps-ui-builder/builder/services/component.ts +228 -57
  42. package/src/impaktapps-ui-builder/builder/services/event.ts +182 -66
  43. package/src/impaktapps-ui-builder/builder/services/utils.ts +2 -2
  44. package/src/impaktapps-ui-builder/runtime/services/events.ts +32 -21
  45. package/src/impaktapps-ui-builder/runtime/services/service.ts +18 -29
@@ -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[1].config.main.tabLabels = sectionLabels[type] || ["Core", "Style", "Event", "Validation"];
59
- UiSchema.elements[1].elements = elements || [CoreSection, StyleSection, EventSection(store.theme.myTheme), ValidationSection];
59
+ UiSchema.elements[0].config.main.tabLabels = sectionLabels[type] || ["Core", "Style", "Events", "Validation"];
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,13 +181,42 @@ 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),
90
- saveHandler: async () => await saveHandler(store, service, submitHandler, "PageMaster"),
219
+ saveHandler: async () => await saveHandler(store, service, submitHandler),
91
220
  onChange: function () {
92
221
  if (
93
222
  store?.formData?.type !== store?.newData?.type &&
@@ -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,34 +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
- const formData = getFormdataFromSessionStorage(pastedElementParentPath);
210
- const insertElementIndex = elementType === "Component" ? formData.elements.length : formData.events.length;
342
+ if (!Array.isArray(store.formData.elements)) {
343
+ store.formData.elements = []
344
+ }
345
+ if (!Array.isArray(store.formData.events)) {
346
+ store.formData.events = []
347
+ }
348
+ saveFormdataInSessionStorage(store.ctx.core.data, pastedElementParentPath);
349
+ const formData = getFormdataFromSessionStorage(pastedElementParentPath);
350
+ const insertElementIndex = elementType === "Component" ? formData.elements.length : formData.events.length;
211
351
  const pastedElementPath = this.elementPathHandler(pastedElementParentPath, insertElementIndex, elementType);
212
352
 
213
353
  const copiedConfig = JSON.parse(sessionStorage.getItem("copiedConfig"));
214
354
  const notificationMessages = {
215
- Event: " The event cannot be integrated into the component section.",
216
- 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."
217
357
  };
218
- if(copiedConfig.Handler && elementType === "Component"){
358
+ if (copiedConfig.Handler && elementType === "Component") {
219
359
  store.setNotify({
220
- FailMessage: notificationMessages.Event,
360
+ FailMessage: notificationMessages.Events,
221
361
  Fail: true,
222
362
  });
223
363
  }
224
- else if(copiedConfig.name && elementType === "Event"){
364
+ else if(copiedConfig.name && elementType === "Events"){
225
365
  store.setNotify({
226
366
  FailMessage: notificationMessages.Component,
227
367
  Fail: true,
228
368
  });
229
369
  }
230
- else{
370
+ else {
231
371
  saveFormdataInSessionStorage(copiedConfig, pastedElementPath);
232
372
  setPage();
233
373
  }
234
- },
235
- RemoveItemButton: function(paramStore: any = store){
236
- const schema = cloneDeep(paramStore.schema );
374
+ },
375
+ RemoveItemButton: function (paramStore: any = store) {
376
+ const schema = cloneDeep(paramStore.schema);
237
377
  const uiSchema = cloneDeep(paramStore.uiSchema);
238
378
  schema.properties.RemoveItemButton.disabled = true;
239
379
  uiSchema.elements[2].elements[1].config.main.heading = `No element copied`;
@@ -241,15 +381,46 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
241
381
  store.setSchema(schema);
242
382
  store.setUiSchema(uiSchema);
243
383
  },
244
- elementPathHandler: function(parentPath: string, rowId: any, elementType: string){
245
- if(elementType === "Component"){
246
- 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}]`;
247
387
  }
248
- return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
388
+ return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
249
389
  },
250
- ElementPathSetter: function(uiSchema: any,copiedFormData?: any){
390
+ ElementPathSetter: function (uiSchema: any, copiedFormData?: any) {
251
391
  const formData = copiedFormData || JSON.parse(sessionStorage.getItem("copiedConfig"));
252
- 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`)
253
424
  }
254
425
  }
255
426
  };