impaktapps-ui-builder 0.0.409-n → 0.0.409-p
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 +125 -133
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +8 -8
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/dist/src/impaktapps-ui-builder/builder/build/buildBasicUiSchema.d.ts +4 -2
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/coreSection.d.ts +0 -30
- package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +8 -7
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildBasicUiSchema.ts +9 -6
- package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +26 -47
- package/src/impaktapps-ui-builder/builder/build/uischema/coreSection.ts +0 -22
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +1 -1
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +0 -23
- package/src/impaktapps-ui-builder/builder/services/component.ts +2 -1
- package/src/impaktapps-ui-builder/runtime/services/service.ts +88 -44
|
@@ -18,9 +18,6 @@ export declare const CoreSection: {
|
|
|
18
18
|
main: {
|
|
19
19
|
label: string;
|
|
20
20
|
type: string;
|
|
21
|
-
options?: undefined;
|
|
22
|
-
color?: undefined;
|
|
23
|
-
required?: undefined;
|
|
24
21
|
};
|
|
25
22
|
};
|
|
26
23
|
layout?: undefined;
|
|
@@ -42,33 +39,6 @@ export declare const CoreSection: {
|
|
|
42
39
|
main: {
|
|
43
40
|
label: string;
|
|
44
41
|
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;
|
|
72
42
|
};
|
|
73
43
|
};
|
|
74
44
|
layout?: undefined;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
export declare const extractEvents: (eventConfig: any) => any;
|
|
2
1
|
interface funcParamsProps {
|
|
3
2
|
store: any;
|
|
4
3
|
dynamicData: any;
|
|
5
|
-
config: any;
|
|
6
|
-
uiSchema: any;
|
|
7
|
-
schema: any;
|
|
8
4
|
service: any;
|
|
9
5
|
userValue: any;
|
|
6
|
+
functionsProvider?: Record<string, any>;
|
|
10
7
|
}
|
|
8
|
+
export declare const extractEvents: (eventConfig: any) => any;
|
|
11
9
|
declare const _default: (funcParams: funcParamsProps) => {
|
|
12
10
|
setPage: () => Promise<void>;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
onCellRenderer: (cellParams: any) => {};
|
|
12
|
+
onClick: () => void;
|
|
13
|
+
onMount: () => void;
|
|
14
|
+
onFileDownload: () => void;
|
|
15
|
+
onFileUpload: () => void;
|
|
16
|
+
backHandler: () => void;
|
|
16
17
|
onPaginationChange: (paginationValues: any) => Promise<any>;
|
|
17
18
|
getSelectOptions: (param: any) => Promise<any>;
|
|
18
19
|
onChange: () => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
export const buildBasicUiSchema = (config)=>{
|
|
2
|
-
return
|
|
1
|
+
export const buildBasicUiSchema = (config) => {
|
|
2
|
+
return {
|
|
3
3
|
"type": "HorizontalLayout",
|
|
4
|
-
pageName
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
pageName: config.name,
|
|
5
|
+
name: config.name,
|
|
6
|
+
accessorKey: config.name,
|
|
7
|
+
header: config.label || config.name,
|
|
8
|
+
"elements": []
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -289,7 +289,13 @@ const buildUiSchema = (config: any) => {
|
|
|
289
289
|
case "Timer":
|
|
290
290
|
elements = buildTimer(config, componentScope);
|
|
291
291
|
break;
|
|
292
|
-
|
|
292
|
+
case "ColumnGroup":
|
|
293
|
+
elements = {
|
|
294
|
+
accessorKey: config.name,
|
|
295
|
+
header: config.label || config.name,
|
|
296
|
+
elements: [],
|
|
297
|
+
}
|
|
298
|
+
break;
|
|
293
299
|
case "MultipleSelect":
|
|
294
300
|
elements = buildMultiSelect(config, componentScope);
|
|
295
301
|
break;
|
|
@@ -309,60 +315,33 @@ const buildUiSchema = (config: any) => {
|
|
|
309
315
|
if (config?.type === "LeaderBoard") {
|
|
310
316
|
return elements;
|
|
311
317
|
}
|
|
312
|
-
else if (config.type == "Table") {
|
|
318
|
+
else if (config.type == "Table" || config.type == "ColumnGroup") {
|
|
313
319
|
const sizeMap = {}
|
|
314
320
|
if (config.sizeHolder) {
|
|
315
321
|
config.sizeHolder.map((e, i) => {
|
|
316
322
|
sizeMap[e.keyName] = e.value
|
|
317
323
|
});
|
|
318
324
|
}
|
|
319
|
-
|
|
320
|
-
if (
|
|
325
|
+
elements.elements = config.elements.map((cellElem, elemInd) => {
|
|
326
|
+
if (cellElem.type) {
|
|
321
327
|
return {
|
|
322
|
-
accessorKey:
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
widget: buildUiSchema(
|
|
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);
|
|
328
|
+
accessorKey: cellElem.name,
|
|
329
|
+
header: cellElem.label || cellElem.name,
|
|
330
|
+
size: sizeMap[cellElem.name] || 180,
|
|
331
|
+
type: cellElem.columnFormat,
|
|
332
|
+
widget: cellElem.type != "ColumnGroup" ? buildUiSchema(cellElem) : undefined,
|
|
333
|
+
elements: cellElem.type == "ColumnGroup" ? cellElem.elements.map((childCellElem) => buildUiSchema(childCellElem)) : []
|
|
349
334
|
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
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))
|
|
335
|
+
} else {
|
|
336
|
+
return {
|
|
337
|
+
accessorKey: cellElem.name,
|
|
338
|
+
type: cellElem.columnFormat,
|
|
339
|
+
header: cellElem.label || cellElem.name,
|
|
340
|
+
size: sizeMap[cellElem.name] || 180
|
|
361
341
|
}
|
|
362
342
|
}
|
|
363
|
-
|
|
364
|
-
}
|
|
365
|
-
elements.elements = transformConfigToOutput(config)
|
|
343
|
+
|
|
344
|
+
})
|
|
366
345
|
}
|
|
367
346
|
else if (config.type == "Array") {
|
|
368
347
|
elements.options.detail.elements = config.elements.map((e: any, elemInd: number) => {
|
|
@@ -445,11 +424,11 @@ function buildHierarchy(elements, parentName = null, sizeMap) {
|
|
|
445
424
|
|
|
446
425
|
function transformConfigToOutput(config, sizeMap) {
|
|
447
426
|
const output = [];
|
|
448
|
-
const hierarchy = buildHierarchy(config.elements, config.name,schema);
|
|
427
|
+
const hierarchy = buildHierarchy(config.elements, config.name, schema);
|
|
449
428
|
for (const element of config.elements) {
|
|
450
429
|
const parentExists = config.elements.some(e => e.name === element.parent);
|
|
451
430
|
if (!parentExists && element.parent !== config.name) {
|
|
452
|
-
output.push(nodeProvider(element,sizeMap))
|
|
431
|
+
output.push(nodeProvider(element, sizeMap))
|
|
453
432
|
}
|
|
454
433
|
}
|
|
455
434
|
return [...hierarchy, ...output,];
|
|
@@ -54,28 +54,6 @@ 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
57
|
{
|
|
80
58
|
type: "Control",
|
|
81
59
|
scope: "#/properties/columnFormat",
|
|
@@ -41,8 +41,8 @@ export const ComponentSchema: any = {
|
|
|
41
41
|
{ title: "Upload File", const: "UploadFile" },
|
|
42
42
|
{ title: "Timer", const: "Timer" },
|
|
43
43
|
{ title: "Upload File", const: "UploadFile" },
|
|
44
|
-
|
|
45
44
|
{ title: "TreeMap", const: "TreeMap" },
|
|
45
|
+
{ title: "ColumnGroup", const: "ColumnGroup" },
|
|
46
46
|
]
|
|
47
47
|
},
|
|
48
48
|
columnFormat: {
|
|
@@ -148,29 +148,6 @@ export const componentBasicUiSchema: any = {
|
|
|
148
148
|
},
|
|
149
149
|
},
|
|
150
150
|
},
|
|
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
151
|
{
|
|
175
152
|
type: "Control",
|
|
176
153
|
scope: "#/properties/columnFormat",
|
|
@@ -37,7 +37,8 @@ const sectionLabels = {
|
|
|
37
37
|
Stepper: ["Core", "Components", "Properties", "Event", "Style"],
|
|
38
38
|
DataGrid: ["Core", "Components", "Properties", "Event", "Style"],
|
|
39
39
|
InputSlider: ["Core", "Properties", "Event", "Style", "Validation"],
|
|
40
|
-
TreeMap: ["Core", "Components", "Properties", "Event", "Style"
|
|
40
|
+
TreeMap: ["Core", "Components", "Properties", "Event", "Style"],
|
|
41
|
+
ColumnGroup: ["Core", "Components"]
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _, { isEmpty } from "lodash";
|
|
2
2
|
import { doDownload, downloadFile } from "./downloadFile";
|
|
3
|
-
import {
|
|
3
|
+
import { executeEvents, executeRefreshHandler } from "./events";
|
|
4
4
|
import { handlersProps } from "./interface";
|
|
5
5
|
let compType: string;
|
|
6
6
|
let eventGroups: any = {};
|
|
@@ -13,6 +13,14 @@ const notifyUiSchema = {
|
|
|
13
13
|
layout: 6,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
interface funcParamsProps {
|
|
17
|
+
store: any,
|
|
18
|
+
dynamicData: any,
|
|
19
|
+
service: any,
|
|
20
|
+
userValue: any,
|
|
21
|
+
functionsProvider?: Record<string, any>
|
|
22
|
+
}
|
|
23
|
+
|
|
16
24
|
export const extractEvents = (eventConfig: any) => {
|
|
17
25
|
function extractsConfigEvents(eventConfigObj: any) {
|
|
18
26
|
if (eventConfigObj.events) {
|
|
@@ -46,41 +54,53 @@ export const extractEvents = (eventConfig: any) => {
|
|
|
46
54
|
}
|
|
47
55
|
return eventGroups;
|
|
48
56
|
};
|
|
49
|
-
|
|
50
|
-
interface funcParamsProps {
|
|
51
|
-
store: any,
|
|
52
|
-
dynamicData: any,
|
|
53
|
-
config: any,
|
|
54
|
-
uiSchema: any,
|
|
55
|
-
schema: any,
|
|
56
|
-
service: any,
|
|
57
|
-
userValue: any,
|
|
58
|
-
}
|
|
59
57
|
export default (funcParams: funcParamsProps) => {
|
|
60
|
-
eventGroups = {}
|
|
61
|
-
eventGroups = extractEvents(funcParams.config)
|
|
62
58
|
let executeEventsParameters: handlersProps = {
|
|
63
59
|
config: {}, componentName: "",
|
|
64
60
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
65
|
-
serviceHolder: { downloadFile, download: doDownload }, eventGroups
|
|
61
|
+
serviceHolder: { downloadFile, download: doDownload, ...funcParams.functionsProvider }, eventGroups,
|
|
62
|
+
functionsProvider: funcParams.functionsProvider,
|
|
66
63
|
};
|
|
67
64
|
return {
|
|
68
65
|
setPage: async function () {
|
|
69
|
-
funcParams.store.setFormdata({})
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
funcParams.store.setFormdata({})
|
|
67
|
+
const data = JSON.stringify({
|
|
68
|
+
pageName: funcParams.store.pageName
|
|
69
|
+
});
|
|
70
|
+
let pageData;
|
|
71
|
+
const pageBasicDetailString = localStorage.getItem("pagemasterMetaData")
|
|
72
|
+
if (pageBasicDetailString) {
|
|
73
|
+
pageData = JSON.parse(pageBasicDetailString)
|
|
74
|
+
} else {
|
|
75
|
+
const pageId = await funcParams.service
|
|
76
|
+
.post("/page/getByName", data, {
|
|
77
|
+
headers: {
|
|
78
|
+
"Content-Type": "application/json",
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
const response = await funcParams.service.get(
|
|
82
|
+
`/page/getById?id=${pageId?.data?.id}`,
|
|
83
|
+
{
|
|
84
|
+
headers: {
|
|
85
|
+
"Content-Type": "application/json",
|
|
86
|
+
},
|
|
75
87
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
88
|
+
);
|
|
89
|
+
pageData = response.data;
|
|
90
|
+
localStorage.setItem("pagemasterMetaData", JSON.stringify({
|
|
91
|
+
schema: pageData?.schema,
|
|
92
|
+
uiSchema: pageData?.uiSchema, config: pageData?.config
|
|
93
|
+
}))
|
|
94
|
+
}
|
|
95
|
+
const config = pageData?.config;
|
|
96
|
+
const uiSchema = pageData?.uiSchema;
|
|
97
|
+
const schema = pageData?.schema ?? { type: "object", properties: {} };
|
|
98
|
+
eventGroups = {}
|
|
99
|
+
eventGroups = extractEvents(config);
|
|
81
100
|
executeEventsParameters = {
|
|
82
101
|
config: {}, componentName: "",
|
|
83
102
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
103
|
+
functionsProvider: funcParams.functionsProvider,
|
|
84
104
|
serviceHolder: this, eventGroups
|
|
85
105
|
}
|
|
86
106
|
await executeRefreshHandler({
|
|
@@ -88,15 +108,47 @@ export default (funcParams: funcParamsProps) => {
|
|
|
88
108
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
89
109
|
serviceHolder: this, eventGroups
|
|
90
110
|
})
|
|
111
|
+
funcParams.store.setSchema(
|
|
112
|
+
(pre: any) => {
|
|
113
|
+
return {
|
|
114
|
+
...schema, properties:
|
|
115
|
+
{ ...schema.properties, ...pre.properties, }
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
uiSchema.elements.push(notifyUiSchema);
|
|
120
|
+
funcParams.store.setUiSchema(uiSchema);
|
|
121
|
+
|
|
122
|
+
},
|
|
123
|
+
onCellRenderer: (cellParams) => {
|
|
124
|
+
let finalResponse = {};
|
|
125
|
+
// cellParams.spanRef.current.style.color = "yellow";
|
|
126
|
+
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
127
|
+
for (const eventConfig of eventGroups?.onCellRenderer[path]) {
|
|
128
|
+
executeEventsParameters.store.functionParameters = cellParams
|
|
129
|
+
finalResponse = executeEvents({
|
|
130
|
+
...executeEventsParameters,
|
|
131
|
+
config: eventConfig,
|
|
132
|
+
componentName: path
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
console.log("finalResponse >> >> >> ", finalResponse)
|
|
136
|
+
return finalResponse
|
|
137
|
+
},
|
|
138
|
+
onClick: function () {
|
|
139
|
+
this.callHandler("onClick")
|
|
140
|
+
},
|
|
141
|
+
onMount: function () {
|
|
142
|
+
this.callHandler("onMount")
|
|
91
143
|
},
|
|
92
|
-
|
|
93
|
-
|
|
144
|
+
onFileDownload: function () {
|
|
145
|
+
this.callHandler("onDownload")
|
|
94
146
|
},
|
|
95
|
-
|
|
96
|
-
|
|
147
|
+
onFileUpload: function () {
|
|
148
|
+
this.callHandler("onUpload")
|
|
97
149
|
},
|
|
98
|
-
|
|
99
|
-
|
|
150
|
+
backHandler: function () {
|
|
151
|
+
funcParams.store.navigate(-1)
|
|
100
152
|
},
|
|
101
153
|
onPaginationChange: async function (paginationValues) {
|
|
102
154
|
const apiBody = [
|
|
@@ -115,7 +167,8 @@ export default (funcParams: funcParamsProps) => {
|
|
|
115
167
|
{ key: "searchValue", value: param.serachValue },
|
|
116
168
|
{ key: "currentValue", value: param.currentValue }
|
|
117
169
|
]
|
|
118
|
-
|
|
170
|
+
const response = await this.updateConfigApiBody(param, apiBody);
|
|
171
|
+
return response?.data;
|
|
119
172
|
}
|
|
120
173
|
},
|
|
121
174
|
onChange: async function () {
|
|
@@ -184,7 +237,7 @@ export default (funcParams: funcParamsProps) => {
|
|
|
184
237
|
if (eventGroups?.[eventType]?.[path] !== undefined) {
|
|
185
238
|
for (const eventConfig of eventGroups?.[eventType]?.[path]) {
|
|
186
239
|
executeEventsParameters.store.functionParameters = functionParameters
|
|
187
|
-
|
|
240
|
+
executeEvents({
|
|
188
241
|
...executeEventsParameters,
|
|
189
242
|
config: eventConfig,
|
|
190
243
|
componentName: path
|
|
@@ -192,18 +245,9 @@ export default (funcParams: funcParamsProps) => {
|
|
|
192
245
|
}
|
|
193
246
|
}
|
|
194
247
|
},
|
|
248
|
+
|
|
195
249
|
downloadFile: downloadFile,
|
|
196
250
|
download: doDownload,
|
|
251
|
+
...funcParams.functionsProvider
|
|
197
252
|
};
|
|
198
253
|
};
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|