impaktapps-ui-builder 0.0.409-j → 0.0.409-l
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.
- package/dist/impaktapps-ui-builder.es.js +71 -73
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +12 -12
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildConfig.ts +0 -7
- package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +47 -1
- package/src/impaktapps-ui-builder/builder/services/component.ts +54 -54
- package/src/impaktapps-ui-builder/runtime/services/events.ts +2 -1
- package/src/impaktapps-ui-builder/runtime/services/service.ts +0 -5
package/package.json
CHANGED
|
@@ -3,13 +3,6 @@ import _ from "lodash";
|
|
|
3
3
|
export default (FormData: any) => {
|
|
4
4
|
const formData = _.cloneDeep(FormData)
|
|
5
5
|
let component: any = {};
|
|
6
|
-
// if (formData?.layout) {
|
|
7
|
-
// component.layout = createData(FormData?.layout, "layout");
|
|
8
|
-
// delete formData.layout
|
|
9
|
-
// }
|
|
10
|
-
// if(!formData.type ){
|
|
11
|
-
// component.type = "page";
|
|
12
|
-
// }
|
|
13
6
|
if (formData.pageName) {
|
|
14
7
|
delete formData.pageName
|
|
15
8
|
}
|
|
@@ -316,7 +316,53 @@ const buildUiSchema = (config: any) => {
|
|
|
316
316
|
sizeMap[e.keyName] = e.value
|
|
317
317
|
});
|
|
318
318
|
}
|
|
319
|
-
|
|
319
|
+
function nodeProvider(element) {
|
|
320
|
+
if (element.type) {
|
|
321
|
+
return {
|
|
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
|
+
};
|
|
329
|
+
}
|
|
330
|
+
return {
|
|
331
|
+
accessorKey: element.name,
|
|
332
|
+
type: element.columnFormat,
|
|
333
|
+
header: element.label || element.name,
|
|
334
|
+
size: sizeMap[element.name] || 180,
|
|
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)
|
|
320
366
|
}
|
|
321
367
|
else if (config.type == "Array") {
|
|
322
368
|
elements.options.detail.elements = config.elements.map((e: any, elemInd: number) => {
|
|
@@ -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", "
|
|
14
|
-
MultipleSelect: ["Core", "Properties","Value", "
|
|
15
|
-
Table: ["Core", "Components",
|
|
16
|
-
LeaderBoard: ["Core", "Components", "Properties", "
|
|
17
|
-
WrapperSection: ["Core", "Components","Properties", "
|
|
18
|
-
TabSection: ["Core", "Components", "Properties", "
|
|
19
|
-
SpeedoMeter:["Core", "Properties", "
|
|
20
|
-
card:["Core", "Properties", "
|
|
21
|
-
UploadFile:["Core",
|
|
22
|
-
Graph:["Core", "Properties", "
|
|
23
|
-
DownloadFile:["Core",
|
|
24
|
-
Box: ["Core", "
|
|
25
|
-
Properties: ["Core", "Properties", "
|
|
26
|
-
ProgressBarCard: ["Core", "Properties", "
|
|
27
|
-
RankCard: ["Core", "Properties", "
|
|
28
|
-
Slider: ["Core", "Components", "
|
|
29
|
-
Timer: ["Core", "
|
|
30
|
-
Rank: ["Core","
|
|
31
|
-
Button: ["Core", "Properties", "
|
|
32
|
-
Array:["Core","Components","Validation"],
|
|
33
|
-
Radio:["Core", "Properties", "
|
|
34
|
-
Text:["Core","Properties","
|
|
35
|
-
TextArea:["Core","Properties","
|
|
36
|
-
PopUp: ["Core", "Components","Properties", "
|
|
37
|
-
Stepper: ["Core", "Components","Properties","Event", "
|
|
38
|
-
DataGrid: ["Core", "Components","Properties","Event", "
|
|
39
|
-
InputSlider:["Core","Properties","
|
|
40
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 () {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
import _ from "lodash";
|
|
2
3
|
import { handlersProps } from "./interface";
|
|
3
4
|
|
|
@@ -134,7 +135,7 @@ function executeInBuiltFunctionHandler(params: handlersProps) {
|
|
|
134
135
|
function executeCustomHandler(params: handlersProps) {
|
|
135
136
|
const makeFunc = eval(params.config.eventCode)
|
|
136
137
|
if (params.config.isSync !== "Yes") {
|
|
137
|
-
makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service, params.componentName).then((res) => res)
|
|
138
|
+
return makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service, params.componentName).then((res) => res)
|
|
138
139
|
} else {
|
|
139
140
|
const response = makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service, params.componentName)
|
|
140
141
|
return response;
|