impaktapps-ui-builder 0.0.409-h → 0.0.409-k

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.
@@ -18,6 +18,9 @@ export declare const CoreSection: {
18
18
  main: {
19
19
  label: string;
20
20
  type: string;
21
+ options?: undefined;
22
+ color?: undefined;
23
+ required?: undefined;
21
24
  };
22
25
  };
23
26
  layout?: undefined;
@@ -39,6 +42,33 @@ export declare const CoreSection: {
39
42
  main: {
40
43
  label: string;
41
44
  type?: undefined;
45
+ options?: undefined;
46
+ color?: undefined;
47
+ required?: undefined;
48
+ };
49
+ };
50
+ layout?: undefined;
51
+ } | {
52
+ type: string;
53
+ scope: string;
54
+ options: {
55
+ widget: string;
56
+ elementLabelProp?: undefined;
57
+ detail?: undefined;
58
+ };
59
+ config: {
60
+ layout: {
61
+ xs: number;
62
+ sm: number;
63
+ md: number;
64
+ lg: number;
65
+ };
66
+ main: {
67
+ label: string;
68
+ options: any[];
69
+ color: string;
70
+ required: boolean;
71
+ type?: undefined;
42
72
  };
43
73
  };
44
74
  layout?: undefined;
@@ -1,10 +1,9 @@
1
1
  import { handlersProps } from "./interface";
2
- export declare const executeEvents: (params: handlersProps) => any;
3
- export declare function getRefreshElements(eventConfig: any, eventGropus: any): string[];
4
- export declare function executeRefreshHandler(params: handlersProps): Promise<any[][]>;
5
- export declare function executeApiRequest(params: any): any;
6
- export declare function shouldEventExecute(params: handlersProps): any;
7
- export declare function buildApiPayload(compConfig: any, body: any, headers: any, store: any, dynamicData: any, userValue: any, service: any): {
2
+ export declare const executeEvents: (params: handlersProps) => Promise<any>;
3
+ export declare function executeRefreshHandler(params: handlersProps): Promise<void>;
4
+ export declare function buildApiPayload(compConfig: any, body: any, headers: any, store: any, dynamicData: any, userValue: any, service: any): Promise<{
8
5
  body: any;
9
6
  headers: any;
10
- };
7
+ }>;
8
+ export declare function getRefreshElements(eventConfig: any, eventGropus: any): string[];
9
+ export declare function asyncOperation(): Promise<unknown>;
@@ -1,19 +1,18 @@
1
+ export declare const extractEvents: (eventConfig: any) => any;
1
2
  interface funcParamsProps {
2
3
  store: any;
3
4
  dynamicData: any;
5
+ config: any;
6
+ uiSchema: any;
7
+ schema: any;
4
8
  service: any;
5
9
  userValue: any;
6
- functionsProvider?: Record<string, any>;
7
10
  }
8
- export declare const extractEvents: (eventConfig: any) => any;
9
11
  declare const _default: (funcParams: funcParamsProps) => {
10
12
  setPage: () => Promise<void>;
11
- onCellRenderer: (cellParams: any) => {};
12
- onClick: () => void;
13
- onMount: () => void;
14
- onFileDownload: () => void;
15
- onFileUpload: () => void;
16
- backHandler: () => void;
13
+ onClick: () => Promise<void>;
14
+ onFileDownload: () => Promise<void>;
15
+ onFileUpload: () => Promise<void>;
17
16
  onPaginationChange: (paginationValues: any) => Promise<any>;
18
17
  getSelectOptions: (param: any) => Promise<any>;
19
18
  onChange: () => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "0.0.409h",
3
+ "version": "0.0.409k",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -170,7 +170,7 @@ const buildUiSchema = (config: any) => {
170
170
  const componentScope = `#/properties/${config.name}`;
171
171
  switch (config.type) {
172
172
  case "TreeMap":
173
- elements = buildTreeMap(config,componentScope)
173
+ elements = buildTreeMap(config, componentScope)
174
174
  break;
175
175
  case "DateTime":
176
176
  elements = buildDateTime(config, componentScope);
@@ -316,23 +316,53 @@ const buildUiSchema = (config: any) => {
316
316
  sizeMap[e.keyName] = e.value
317
317
  });
318
318
  }
319
- elements.elements = config.elements.map((e, elemInd) => {
320
- if (e.type && e.type !== "date" && e.type !== "dateTime" && e.type !== "amount") {
319
+ function nodeProvider(element) {
320
+ if (element.type) {
321
321
  return {
322
- accessorKey: e.name,
323
- header: e.label || e.name,
324
- size: sizeMap[e.name] || 180,
325
- type: e.type,
326
- widget: buildUiSchema(e)
327
- }
322
+ accessorKey: element.name,
323
+ type: element.columnFormat,
324
+ header: element.label || element.name,
325
+ size: sizeMap[element.name] || 180,
326
+ widget: buildUiSchema(element)
327
+
328
+ };
328
329
  }
329
330
  return {
330
- type: e.type,
331
- accessorKey: e.name,
332
- header: e.label || e.name,
333
- size: sizeMap[e.name] || 180
331
+ accessorKey: element.name,
332
+ type: element.columnFormat,
333
+ header: element.label || element.name,
334
+ size: sizeMap[element.name] || 180,
334
335
  }
335
- })
336
+ }
337
+
338
+ function buildHierarchy(elements, parentName = null) {
339
+ const result = [];
340
+ for (const element of elements) {
341
+ if (element?.parent === parentName) {
342
+ const children = buildHierarchy(elements, element.name);
343
+ const node: any = nodeProvider(element)
344
+ if (children.length > 0) {
345
+ node.columns = children;
346
+ node.type = "group";
347
+ }
348
+ result.push(node);
349
+ }
350
+ }
351
+ return result;
352
+ }
353
+
354
+ function transformConfigToOutput(config) {
355
+ const output = [];
356
+ const hierarchy = buildHierarchy(config.elements, config.name);
357
+ for (const element of config.elements) {
358
+ const parentExists = config.elements.some(e => e.name === element.parent);
359
+ if (!parentExists && element.parent !== config.name) {
360
+ output.push(nodeProvider(element))
361
+ }
362
+ }
363
+ return [ ...hierarchy,...output,];
364
+ }
365
+ elements.elements = transformConfigToOutput(config)
336
366
  }
337
367
  else if (config.type == "Array") {
338
368
  elements.options.detail.elements = config.elements.map((e: any, elemInd: number) => {
@@ -378,9 +408,51 @@ export default buildUiSchema;
378
408
 
379
409
 
380
410
 
411
+ function nodeProvider(element, sizeMap) {
412
+ if (element.type) {
413
+ return {
414
+ accessorKey: element.name,
415
+ type: element.columnFormat,
416
+ header: element.label || element.name,
417
+ size: sizeMap[element.name] || 180,
418
+ widget: buildUiSchema(element)
381
419
 
420
+ };
421
+ }
422
+ return {
423
+ accessorKey: element.name,
424
+ type: element.columnFormat,
425
+ header: element.label || element.name,
426
+ size: sizeMap[element.name] || 180,
427
+ }
428
+ }
382
429
 
430
+ function buildHierarchy(elements, parentName = null, sizeMap) {
431
+ const result = [];
432
+ for (const element of elements) {
433
+ if (element?.parent === parentName) {
434
+ const children = buildHierarchy(elements, element.name, sizeMap);
435
+ const node: any = nodeProvider(element, sizeMap)
436
+ if (children.length > 0) {
437
+ node.columns = children;
438
+ node.type = "group";
439
+ }
440
+ result.push(node);
441
+ }
442
+ }
443
+ return result;
444
+ }
383
445
 
384
-
446
+ function transformConfigToOutput(config, sizeMap) {
447
+ const output = [];
448
+ const hierarchy = buildHierarchy(config.elements, config.name,schema);
449
+ for (const element of config.elements) {
450
+ const parentExists = config.elements.some(e => e.name === element.parent);
451
+ if (!parentExists && element.parent !== config.name) {
452
+ output.push(nodeProvider(element,sizeMap))
453
+ }
454
+ }
455
+ return [...hierarchy, ...output,];
456
+ }
385
457
 
386
458
 
@@ -54,6 +54,47 @@ export const CoreSection = {
54
54
  },
55
55
  },
56
56
  },
57
+ {
58
+ type: "Control",
59
+ scope: "#/properties/parent",
60
+
61
+ options: {
62
+ widget: "InputField",
63
+ },
64
+ config: {
65
+ layout: {
66
+ xs: 12,
67
+ sm: 12,
68
+ md: 6,
69
+ lg: 6,
70
+ },
71
+ main: {
72
+ label: "parent",
73
+ options: [],
74
+ color: "secondary",
75
+ required: true,
76
+ },
77
+ },
78
+ },
79
+ {
80
+ type: "Control",
81
+ scope: "#/properties/columnFormat",
82
+ options: {
83
+ widget: "SelectInputField",
84
+ },
85
+ config: {
86
+ layout: {
87
+ xs: 11,
88
+ sm: 11,
89
+ md: 5.5,
90
+ lg: 5.5,
91
+ },
92
+ main: {
93
+ label: "Column Format",
94
+
95
+ },
96
+ },
97
+ },
57
98
  {
58
99
  type: "Control",
59
100
  scope: "#/properties/proc",
@@ -4,7 +4,7 @@ export const ComponentSchema: any = {
4
4
  type: {
5
5
  // type: "string",
6
6
  oneOf: [
7
- { title: "AadharcardText", const: "AadharcardText"},
7
+ { title: "AadharcardText", const: "AadharcardText" },
8
8
  { title: "Array", const: "Array" },
9
9
  { title: "Button", const: "Button" },
10
10
  { title: "Card", const: "card" },
@@ -12,7 +12,7 @@ export const ComponentSchema: any = {
12
12
  { title: "Container", const: "WrapperSection" },
13
13
  { title: "DataGrid", const: "DataGrid" },
14
14
  { title: "Date", const: "Date" },
15
- { title: "DateTime", const: "DateTime"},
15
+ { title: "DateTime", const: "DateTime" },
16
16
  { title: "Download File", const: "DownloadFile" },
17
17
  { title: "Empty Box", const: "EmptyBox" },
18
18
  { title: "File", const: "FileInput" },
@@ -39,20 +39,25 @@ export const ComponentSchema: any = {
39
39
  { title: "Text Area", const: "TextArea" },
40
40
  { title: "Timer", const: "Timer" },
41
41
  { title: "Upload File", const: "UploadFile" },
42
- { title: "Text Area", const: "TextArea" },
43
42
  { title: "Timer", const: "Timer" },
44
43
  { title: "Upload File", const: "UploadFile" },
44
+
45
+ { title: "TreeMap", const: "TreeMap" },
46
+ ]
47
+ },
48
+ columnFormat: {
49
+ oneOf: [
45
50
  { title: "Date Column", const: "date" },
46
51
  { title: "DateTime Column", const: "dateTime" },
47
52
  { title: "Amount Column", const: "amount" },
48
- { title: "TreeMap", const: "TreeMap" },
49
53
  ]
50
54
  },
51
- orientation:{
55
+ orientation: {
52
56
  oneOf: [
53
- { title: "Horizontal", const: "horizontal" },
54
- { title: "Vertical", const: "vertical" },
55
- ]},
57
+ { title: "Horizontal", const: "horizontal" },
58
+ { title: "Vertical", const: "vertical" },
59
+ ]
60
+ },
56
61
  method: {
57
62
  type: "string",
58
63
  oneOf: [
@@ -78,7 +83,7 @@ export const ComponentSchema: any = {
78
83
  },
79
84
  value: {
80
85
  // type: "string",
81
-
86
+
82
87
  },
83
88
  },
84
89
  },
@@ -99,7 +104,7 @@ export const ComponentSchema: any = {
99
104
  },
100
105
  value: {
101
106
  // type: "string",
102
-
107
+
103
108
  },
104
109
  },
105
110
  },
@@ -181,8 +186,8 @@ export const ComponentSchema: any = {
181
186
  keyName: {
182
187
  type: "string",
183
188
  },
184
- value:{
185
- type:"string"
189
+ value: {
190
+ type: "string"
186
191
  }
187
192
  },
188
193
  },
@@ -272,9 +277,9 @@ export const ComponentSchema: any = {
272
277
  { title: "Horizontal Bar Graph", const: "HorizontalBarGraph" },
273
278
  ]
274
279
  },
275
- iconName:{
276
- type:"string",
277
- oneOf:[
280
+ iconName: {
281
+ type: "string",
282
+ oneOf: [
278
283
  { title: "Search Icon", const: "SearchIcon" },
279
284
  { title: "Edit Icon", const: "EditIcon" },
280
285
  { title: "Add Icon", const: "AddIcon" },
@@ -294,8 +299,8 @@ export const ComponentSchema: any = {
294
299
  { title: "Exception Icon", const: "ExceptionIcon" },
295
300
  ]
296
301
  },
297
- color:{
298
- type:"string",
302
+ color: {
303
+ type: "string",
299
304
  oneOf: [
300
305
  { title: "Primary", const: "primary" },
301
306
  { title: "Secondary", const: "secondary" },
@@ -309,6 +314,6 @@ export const ComponentSchema: any = {
309
314
  },
310
315
  label: { type: 'string' }
311
316
  },
312
-
313
- required: [ "name", ]
317
+
318
+ required: ["name",]
314
319
  };
@@ -149,6 +149,47 @@ export const componentBasicUiSchema: any = {
149
149
  },
150
150
  },
151
151
 
152
+ {
153
+ type: "Control",
154
+ scope: "#/properties/parent",
155
+
156
+ options: {
157
+ widget: "InputField",
158
+ },
159
+ config: {
160
+ layout: {
161
+ xs: 12,
162
+ sm: 12,
163
+ md: 6,
164
+ lg: 6,
165
+ },
166
+ main: {
167
+ label: "parent",
168
+ options: [],
169
+ color: "secondary",
170
+ required: true,
171
+ },
172
+ },
173
+ },
174
+ {
175
+ type: "Control",
176
+ scope: "#/properties/columnFormat",
177
+ options: {
178
+ widget: "SelectInputField",
179
+ },
180
+ config: {
181
+ layout: {
182
+ xs: 11,
183
+ sm: 11,
184
+ md: 5.5,
185
+ lg: 5.5,
186
+ },
187
+ main: {
188
+ label: "Column Format",
189
+
190
+ },
191
+ },
192
+ },
152
193
  {
153
194
  type: "Control",
154
195
  scope: "#/properties/proc",
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash";
2
- import { ComponentSchema } from "../elements/UiSchema/Component/schema";
2
+ import { ComponentSchema } from "../elements/UiSchema/Component/schema";
3
3
  import { componentBasicUiSchema } from "../elements/UiSchema/Component/uiSchema";
4
4
  import { CoreSection } from "../build/uischema/coreSection";
5
5
  import { EventSection } from "../build/uischema/eventSection";
@@ -10,57 +10,57 @@ import { ValueTab } from "../build/uischema/valueTab";
10
10
  import { ValidationSection } from "../build/uischema/validationSections";
11
11
  import { getFormdataFromLocalStorage, okHandler, saveFormdataInLocalStorage, saveHandler } from "./utils";
12
12
  const sectionLabels = {
13
- Select: ["Core", "Properties","Value", "style", "Event","Validation"],
14
- MultipleSelect: ["Core", "Properties","Value", "style", "Event","Validation"],
15
- Table: ["Core", "Components", "Properties","style", "Event","Validation"],
16
- LeaderBoard: ["Core", "Components", "Properties", "style", "Event","Validation"],
17
- WrapperSection: ["Core", "Components","Properties", "style","Validation"],
18
- TabSection: ["Core", "Components", "Properties", "style","Validation"],
19
- SpeedoMeter:["Core", "Properties", "style", "Event","Validation"],
20
- card:["Core", "Properties", "style", "Event","Validation"],
21
- UploadFile:["Core", "style", "Event","Validation"],
22
- Graph:["Core", "Properties", "style", "Event","Validation"],
23
- DownloadFile:["Core", "style", "Event","Validation"],
24
- Box: ["Core", "style", "Event","Validation"],
25
- Properties: ["Core", "Properties", "style", "Event","Validation"],
26
- ProgressBarCard: ["Core", "Properties", "style", "Event","Validation"],
27
- RankCard: ["Core", "Properties", "style", "Event","Validation"],
28
- Slider: ["Core", "Components", "style", "Event","Validation"],
29
- Timer: ["Core", "style", "Event","Validation"],
30
- Rank: ["Core","style", "Event","Validation"],
31
- Button: ["Core", "Properties", "style", "Event","Validation"],
32
- Array:["Core","Components","Validation"],
33
- Radio:["Core", "Properties", "style", "Event","Validation"],
34
- Text:["Core","Properties","style", "Event","Validation"],
35
- TextArea:["Core","Properties","style", "Event","Validation"],
36
- PopUp: ["Core", "Components","Properties", "style"],
37
- Stepper: ["Core", "Components","Properties","Event", "style"],
38
- DataGrid: ["Core", "Components","Properties","Event", "style"],
39
- InputSlider:["Core","Properties","style", "Event","Validation"],
40
- TreeMap:["Core", "Components","Properties","style", "Event"],
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"],
17
+ WrapperSection: ["Core", "Components", "Properties", "Style", "Validation"],
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"],
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"],
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",],
41
41
  }
42
42
 
43
43
 
44
44
 
45
- export const refreshPage = (type:string,store:any) => {
45
+ export const refreshPage = (type: string, store: any) => {
46
46
  const UiSchema = _.cloneDeep(componentBasicUiSchema)
47
- if(type){
48
- const sectionUiSchema = {
49
- Core: CoreSection,
50
- Value: ValueTab,
51
- style: StyleSection,
52
- Event: EventSection,
53
- Components: TableSection,
54
- Properties: buildPropertiesSection(type),
55
- Validation:ValidationSection
56
-
47
+ if (type) {
48
+ const sectionUiSchema = {
49
+ Core: CoreSection,
50
+ Value: ValueTab,
51
+ Style: StyleSection,
52
+ Event: EventSection,
53
+ Components: TableSection,
54
+ Properties: buildPropertiesSection(type),
55
+ Validation: ValidationSection
56
+
57
+ }
58
+ const elements = sectionLabels[type]?.map(e => sectionUiSchema[e]);
59
+ UiSchema.elements[1].config.main.tabLabels = sectionLabels[type] || ["Core", "style", "Event", "Validation"];
60
+ UiSchema.elements[1].elements = elements || [CoreSection, StyleSection, EventSection, ValidationSection];
61
+
57
62
  }
58
- const elements = sectionLabels[type]?.map(e => sectionUiSchema[e]);
59
- UiSchema.elements[1].config.main.tabLabels = sectionLabels[type] || ["Core", "style","Event","Validation"];
60
- UiSchema.elements[1].elements = elements || [CoreSection, StyleSection,EventSection,ValidationSection];
61
-
62
- }
63
- store.setUiSchema(UiSchema);
63
+ store.setUiSchema(UiSchema);
64
64
  }
65
65
 
66
66
  export default (store: any, dynamicData: any, submitHandler: any, service: any) => {
@@ -69,26 +69,26 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
69
69
  const formdata = await this.getFormdata();
70
70
  store.setFormdata(formdata);
71
71
  const schema = this.getSchema();
72
- store.setSchema(schema);
73
- this.refreshPage(formdata?.type, store);
74
-
72
+ store.setSchema(schema);
73
+ this.refreshPage(formdata?.type, store);
74
+
75
75
  },
76
- refreshPage:refreshPage,
76
+ refreshPage: refreshPage,
77
77
  getFormdata: function () {
78
78
  const path = store.searchParams?.get("path");
79
- return getFormdataFromLocalStorage(path)
79
+ return getFormdataFromLocalStorage(path)
80
80
  },
81
81
  getSchema: function () {
82
82
  return ComponentSchema;
83
83
  },
84
- okHandler:()=>okHandler(store),
85
- saveHandler: async ()=> await saveHandler(store,service,submitHandler,"PageMaster"),
84
+ okHandler: () => okHandler(store),
85
+ saveHandler: async () => await saveHandler(store, service, submitHandler, "PageMaster"),
86
86
  onChange: function () {
87
87
  if (
88
88
  store?.formData?.type !== store?.newData?.type &&
89
89
  store?.newData?.type !== undefined
90
90
  ) {
91
- this.refreshPage(store?.newData?.type,store);
91
+ this.refreshPage(store?.newData?.type, store);
92
92
  }
93
93
  },
94
94
  editComponents: function () {