impaktapps-ui-builder 0.0.310 → 0.0.312
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 +64 -3
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +5 -5
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/dist/src/impaktapps-ui-builder/builder/build/buildFileInput.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +2 -0
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildFileInput.ts +35 -0
- package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +4 -0
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +1 -0
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +2 -0
- package/src/impaktapps-ui-builder/runtime/services/events.ts +4 -3
- package/src/impaktapps-ui-builder/runtime/services/service.ts +20 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const buildFileInput: (config: any, componentScope: any) => any;
|
|
@@ -11,6 +11,8 @@ interface funcParamsProps {
|
|
|
11
11
|
declare const _default: (funcParams: funcParamsProps) => {
|
|
12
12
|
setPage: () => Promise<void>;
|
|
13
13
|
onClick: () => Promise<void>;
|
|
14
|
+
onFileDownload: () => Promise<void>;
|
|
15
|
+
onFileUpload: () => Promise<void>;
|
|
14
16
|
onPaginationChange: (paginationValues: any) => Promise<any>;
|
|
15
17
|
getSelectOptions: (param: any) => Promise<any>;
|
|
16
18
|
onChange: () => Promise<void>;
|
package/package.json
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
import { createLayoutFormat } from "./buildConfig";
|
|
3
|
+
|
|
4
|
+
const FileInput = {
|
|
5
|
+
type: "Control",
|
|
6
|
+
scope: "#/properties/docAggrementCopy",
|
|
7
|
+
options: {
|
|
8
|
+
widget: "FileInput",
|
|
9
|
+
},
|
|
10
|
+
config: {
|
|
11
|
+
layout: 11.5,
|
|
12
|
+
main: {
|
|
13
|
+
required: false,
|
|
14
|
+
onUpload: "onFileUpload",
|
|
15
|
+
onDownload:"onFileDownload",
|
|
16
|
+
label:"Aggrement Copy"
|
|
17
|
+
// iconStyleDefault:true,
|
|
18
|
+
},
|
|
19
|
+
style: {
|
|
20
|
+
backgroundColor: "none",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
export const buildFileInput = (config,componentScope) => {
|
|
25
|
+
const box: any = _.cloneDeep(FileInput);
|
|
26
|
+
box.scope = componentScope;
|
|
27
|
+
box.config.main.heading = config.label
|
|
28
|
+
if(config.layout){
|
|
29
|
+
box.config.layout = createLayoutFormat(config.layout)
|
|
30
|
+
}
|
|
31
|
+
if (config.style) {
|
|
32
|
+
box.config.style = JSON.parse(config.style)
|
|
33
|
+
}
|
|
34
|
+
return box;
|
|
35
|
+
}
|
|
@@ -33,6 +33,7 @@ import { buildRadio } from "./buildRadio";
|
|
|
33
33
|
import { buildEmptyBox } from "./buildEmptyBox";
|
|
34
34
|
import { buildArray } from "./buildArray";
|
|
35
35
|
import { buildAdhaarField, buildPanField } from "./buildAadharCard";
|
|
36
|
+
import { buildFileInput } from "./buildFileInput";
|
|
36
37
|
export let schema = {
|
|
37
38
|
type: "object",
|
|
38
39
|
properties: {},
|
|
@@ -163,6 +164,9 @@ const buildUiSchema = (config: any) => {
|
|
|
163
164
|
let elements: any = {};
|
|
164
165
|
const componentScope = `#/properties/${config.name}`;
|
|
165
166
|
switch (config.type) {
|
|
167
|
+
case "FileInput":
|
|
168
|
+
elements = buildFileInput(config, componentScope);
|
|
169
|
+
break;
|
|
166
170
|
case "AadharcardText":
|
|
167
171
|
elements = buildAdhaarField(config, componentScope);
|
|
168
172
|
break;
|
|
@@ -13,6 +13,7 @@ export const ComponentSchema: any = {
|
|
|
13
13
|
{ title: "Date", const: "Date" },
|
|
14
14
|
{ title: "Download File", const: "DownloadFile" },
|
|
15
15
|
{ title: "Empty Box", const: "EmptyBox" },
|
|
16
|
+
{ title: "File", const: "FileInput" },
|
|
16
17
|
{ title: "Graph", const: "Graph" },
|
|
17
18
|
{ title: "Label", const: "Box" },
|
|
18
19
|
{ title: "LeaderBoard", const: "LeaderBoard" },
|
|
@@ -41,6 +41,8 @@ export const EventSchema = {
|
|
|
41
41
|
{ title: "Click Event", const: "onClick" },
|
|
42
42
|
{ title: "onStart", const: "onStart" },
|
|
43
43
|
{ title: "Load Event", const: "onLoad" },
|
|
44
|
+
{ title: "File Upload Event", const: "onUpload" },
|
|
45
|
+
{ title: "File Download Event", const: "onDownload" },
|
|
44
46
|
{ title: "Change Event", const: "onChange" },
|
|
45
47
|
{ title: "Success", const: "Success" },
|
|
46
48
|
{ title: "Fail", const: "Fail" }
|
|
@@ -42,8 +42,8 @@ async function executeEventsHandler(params: handlersProps) {
|
|
|
42
42
|
return await executeRefreshHandler(params)
|
|
43
43
|
}
|
|
44
44
|
else if (params.config.Handler === "mergeFormdata") {
|
|
45
|
-
const result = mergeFormdata(
|
|
46
|
-
params.parentEventOutput, params.componentName, params.config, params.store)
|
|
45
|
+
const result = await mergeFormdata(
|
|
46
|
+
params.parentEventOutput, params.componentName, params.config, params.store,params.service)
|
|
47
47
|
return result;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -86,7 +86,7 @@ async function executeCustomHandler(params: handlersProps) {
|
|
|
86
86
|
return response;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any) {
|
|
89
|
+
async function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any,service:any) {
|
|
90
90
|
if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
|
|
91
91
|
store.setSchema((pre) => {
|
|
92
92
|
return {
|
|
@@ -122,6 +122,7 @@ function mergeFormdata(handlerResponse: any, componentName: string, eventConfig:
|
|
|
122
122
|
else {
|
|
123
123
|
if (handlerResponse) {
|
|
124
124
|
store.setFormdata((pre) => { return { ...pre, [componentName]: eventConfig.lazyLoading ? handlerResponse.data.data : handlerResponse.data } });
|
|
125
|
+
const demoData = await service.get("https://jsonplaceholder.typicode.com/posts/1");
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
}
|
|
@@ -70,7 +70,6 @@ export default (funcParams: funcParamsProps) => {
|
|
|
70
70
|
serviceHolder: this, eventGroups
|
|
71
71
|
}
|
|
72
72
|
funcParams.store.setSchema(
|
|
73
|
-
// funcParams.schema
|
|
74
73
|
(pre: any) => {
|
|
75
74
|
return {
|
|
76
75
|
...funcParams.schema, properties:
|
|
@@ -85,10 +84,6 @@ export default (funcParams: funcParamsProps) => {
|
|
|
85
84
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
86
85
|
serviceHolder: this, eventGroups
|
|
87
86
|
})
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
87
|
},
|
|
93
88
|
onClick: async function () {
|
|
94
89
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
@@ -100,6 +95,26 @@ export default (funcParams: funcParamsProps) => {
|
|
|
100
95
|
})
|
|
101
96
|
}
|
|
102
97
|
},
|
|
98
|
+
onFileDownload:async () =>{
|
|
99
|
+
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
100
|
+
for (const eventConfig of eventGroups?.onFileDownload[path]) {
|
|
101
|
+
await executeEvents({
|
|
102
|
+
...executeEventsParameters,
|
|
103
|
+
config: eventConfig,
|
|
104
|
+
componentName: path
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
onFileUpload:async () =>{
|
|
109
|
+
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
110
|
+
for (const eventConfig of eventGroups?.onFileUpload[path]) {
|
|
111
|
+
await executeEvents({
|
|
112
|
+
...executeEventsParameters,
|
|
113
|
+
config: eventConfig,
|
|
114
|
+
componentName: path
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
},
|
|
103
118
|
onPaginationChange: async function (paginationValues) {
|
|
104
119
|
const apiBody = [
|
|
105
120
|
{ key: "size", value: paginationValues.pagination.pageSize },
|