impaktapps-ui-builder 0.0.382 → 0.0.384-alpha.0
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 +56 -394
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +14 -14
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/dist/src/impaktapps-ui-builder/runtime/services/downloadFile.d.ts +0 -1
- package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +0 -5
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildFileInput.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildRadio.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildTable.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +8 -28
- package/src/impaktapps-ui-builder/builder/build/buildWrapperSection.ts +0 -7
- package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +1 -109
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +0 -43
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +3 -7
- package/src/impaktapps-ui-builder/builder/services/component.ts +0 -3
- package/src/impaktapps-ui-builder/builder/services/event.ts +0 -1
- package/src/impaktapps-ui-builder/builder/services/utils.ts +1 -1
- package/src/impaktapps-ui-builder/runtime/services/downloadFile.ts +7 -22
- package/src/impaktapps-ui-builder/runtime/services/events.ts +6 -27
- package/src/impaktapps-ui-builder/runtime/services/service.ts +35 -52
- package/dist/src/impaktapps-ui-builder/builder/build/buildDataGrid.d.ts +0 -1
- package/dist/src/impaktapps-ui-builder/builder/build/buildPop.d.ts +0 -1
- package/dist/src/impaktapps-ui-builder/builder/build/buildStepper.d.ts +0 -1
- package/src/impaktapps-ui-builder/builder/build/buildDataGrid.ts +0 -51
- package/src/impaktapps-ui-builder/builder/build/buildPop.ts +0 -43
- package/src/impaktapps-ui-builder/builder/build/buildStepper.ts +0 -45
|
@@ -17,11 +17,6 @@ declare const _default: (funcParams: funcParamsProps) => {
|
|
|
17
17
|
getSelectOptions: (param: any) => Promise<any>;
|
|
18
18
|
onChange: () => Promise<void>;
|
|
19
19
|
updateConfigApiBody: (paramValue: any, apiBody: any) => Promise<any>;
|
|
20
|
-
onBack: (functionParameters: any) => Promise<void>;
|
|
21
|
-
onNext: (functionParameters: any) => Promise<void>;
|
|
22
|
-
onReset: (functionParameters: any) => Promise<void>;
|
|
23
|
-
callHandler: (eventType: string, functionParameters?: any) => Promise<void>;
|
|
24
20
|
downloadFile: (obj: any) => void;
|
|
25
|
-
download: (response: any, service: any) => void;
|
|
26
21
|
};
|
|
27
22
|
export default _default;
|
package/package.json
CHANGED
|
@@ -24,7 +24,7 @@ const FileInput = {
|
|
|
24
24
|
export const buildFileInput = (config,componentScope) => {
|
|
25
25
|
const box: any = _.cloneDeep(FileInput);
|
|
26
26
|
box.scope = componentScope;
|
|
27
|
-
box.config.main.
|
|
27
|
+
box.config.main.heading = config.label
|
|
28
28
|
if(config.layout){
|
|
29
29
|
box.config.layout = createLayoutFormat(config.layout)
|
|
30
30
|
}
|
|
@@ -21,7 +21,7 @@ const RadioUiSchema = {
|
|
|
21
21
|
export const buildRadio = (config,componentScope) => {
|
|
22
22
|
const Radio: any = _.cloneDeep(RadioUiSchema);
|
|
23
23
|
Radio.scope = componentScope;
|
|
24
|
-
Radio.config.main.
|
|
24
|
+
Radio.config.main.heading = config.label
|
|
25
25
|
if(config.layout){
|
|
26
26
|
Radio.config.layout = createLayoutFormat(config.layout)
|
|
27
27
|
}
|
|
@@ -16,7 +16,7 @@ export const buildTable = (config: any, componentScope: string) => {
|
|
|
16
16
|
table.config.main.Selection = config.SelectionAvailable === "YES" ? true : false
|
|
17
17
|
};
|
|
18
18
|
if (config.ColumnResizingAvailable) {
|
|
19
|
-
table.config.main.disableColumnResizing = config.ColumnResizingAvailable === "YES" ?
|
|
19
|
+
table.config.main.disableColumnResizing = config.ColumnResizingAvailable === "YES" ? true : false
|
|
20
20
|
};
|
|
21
21
|
if (config.DragAvailable) {
|
|
22
22
|
table.config.main.enableDrag = config.DragAvailable === "YES" ? true : false
|
|
@@ -34,9 +34,6 @@ import { buildEmptyBox } from "./buildEmptyBox";
|
|
|
34
34
|
import { buildArray } from "./buildArray";
|
|
35
35
|
import { buildAdhaarField, buildPanField } from "./buildAadharCard";
|
|
36
36
|
import { buildFileInput } from "./buildFileInput";
|
|
37
|
-
import { buildStepper } from "./buildStepper";
|
|
38
|
-
import { buildPopUp } from "./buildPop";
|
|
39
|
-
import { buildDataGrid } from "./buildDataGrid";
|
|
40
37
|
export let schema = {
|
|
41
38
|
type: "object",
|
|
42
39
|
properties: {},
|
|
@@ -67,14 +64,14 @@ function buildRule(configObj: any, tableName?: string, arrayHolderName?: boolean
|
|
|
67
64
|
}
|
|
68
65
|
}
|
|
69
66
|
} else if ((configObj.type === "Select" || configObj.type === "MultipleSelect") && configObj.value?.length > 0) {
|
|
70
|
-
if (configObj.type === "Select") {
|
|
67
|
+
if (configObj.type === "Select" ) {
|
|
71
68
|
schema.properties[configObj.name] = {
|
|
72
69
|
oneOf: configObj.value.map((e) => {
|
|
73
70
|
return { const: e.value, title: e.label }
|
|
74
71
|
})
|
|
75
72
|
}
|
|
76
73
|
}
|
|
77
|
-
else if (configObj.type === "MultipleSelect") {
|
|
74
|
+
else if (configObj.type === "MultipleSelect" ) {
|
|
78
75
|
schema.properties[configObj.name] = {
|
|
79
76
|
items: {
|
|
80
77
|
oneOf: configObj.value.map((e) => {
|
|
@@ -167,30 +164,21 @@ const buildUiSchema = (config: any) => {
|
|
|
167
164
|
let elements: any = {};
|
|
168
165
|
const componentScope = `#/properties/${config.name}`;
|
|
169
166
|
switch (config.type) {
|
|
170
|
-
case "DataGrid":
|
|
171
|
-
elements = buildDataGrid(config, componentScope);
|
|
172
|
-
break;
|
|
173
|
-
case "Stepper":
|
|
174
|
-
elements = buildStepper(config, componentScope);
|
|
175
|
-
break;
|
|
176
|
-
case "PopUp":
|
|
177
|
-
elements = buildPopUp(config, componentScope);
|
|
178
|
-
break;
|
|
179
167
|
case "FileInput":
|
|
180
168
|
elements = buildFileInput(config, componentScope);
|
|
181
169
|
break;
|
|
182
170
|
case "AadharcardText":
|
|
183
171
|
elements = buildAdhaarField(config, componentScope);
|
|
184
172
|
break;
|
|
185
|
-
|
|
173
|
+
case "PanCardText":
|
|
186
174
|
elements = buildPanField(config, componentScope);
|
|
187
175
|
break;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
176
|
+
case "TabSection":
|
|
177
|
+
elements = buildTabSection(config, componentScope);
|
|
178
|
+
break;
|
|
191
179
|
case "RunnerBoyProgressBar":
|
|
192
180
|
elements = RunnerBoyProgressbar(config, componentScope);
|
|
193
|
-
|
|
181
|
+
break;
|
|
194
182
|
case "WrapperSection":
|
|
195
183
|
elements = buildWrapperSection(config, componentScope);
|
|
196
184
|
break;
|
|
@@ -299,25 +287,17 @@ const buildUiSchema = (config: any) => {
|
|
|
299
287
|
return elements;
|
|
300
288
|
}
|
|
301
289
|
else if (config.type == "Table") {
|
|
302
|
-
const sizeMap = {}
|
|
303
|
-
if (config.sizeHolder) {
|
|
304
|
-
config.sizeHolder.map((e, i) => {
|
|
305
|
-
sizeMap[e.keyName] = e.value
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
290
|
elements.elements = config.elements.map((e, elemInd) => {
|
|
309
291
|
if (e.type) {
|
|
310
292
|
return {
|
|
311
293
|
accessorKey: e.name,
|
|
312
294
|
header: e.label || e.name,
|
|
313
|
-
size: sizeMap[e.name]|| 180,
|
|
314
295
|
widget: buildUiSchema(e)
|
|
315
296
|
}
|
|
316
297
|
}
|
|
317
298
|
return {
|
|
318
299
|
accessorKey: e.name,
|
|
319
|
-
header: e.label || e.name
|
|
320
|
-
size: sizeMap[e.name]|| 180
|
|
300
|
+
header: e.label || e.name
|
|
321
301
|
}
|
|
322
302
|
})
|
|
323
303
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createLayoutFormat } from "./buildConfig";
|
|
2
1
|
import WrapperSection from "./uischema/wrapperSection";
|
|
3
2
|
import _ from "lodash";
|
|
4
3
|
|
|
@@ -6,11 +5,5 @@ export const buildWrapperSection = (config,componentScope) =>{
|
|
|
6
5
|
const wrapper: any = _.cloneDeep(WrapperSection);
|
|
7
6
|
wrapper.config.main.label = config.label;
|
|
8
7
|
wrapper.config.main.divider = config.divider === "YES" ? true : false;
|
|
9
|
-
if (config.style) {
|
|
10
|
-
wrapper.config.style = JSON.parse(config.style)
|
|
11
|
-
}
|
|
12
|
-
if (config.layout) {
|
|
13
|
-
wrapper.config.layout = createLayoutFormat(config.layout)
|
|
14
|
-
}
|
|
15
8
|
return wrapper;
|
|
16
9
|
}
|
|
@@ -19,61 +19,6 @@ const EmptyBox = {
|
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
|
-
const cardLayout = {
|
|
23
|
-
type: "Control",
|
|
24
|
-
scope: "#/properties/cardLayout",
|
|
25
|
-
layout: 11.5,
|
|
26
|
-
options: {
|
|
27
|
-
detail: {
|
|
28
|
-
type: "HorizontalLayout",
|
|
29
|
-
elements: [
|
|
30
|
-
{
|
|
31
|
-
type: "Control",
|
|
32
|
-
scope: "#/properties/key",
|
|
33
|
-
options: {
|
|
34
|
-
widget: "SelectInputField",
|
|
35
|
-
},
|
|
36
|
-
config: {
|
|
37
|
-
layout: {
|
|
38
|
-
xs: 11,
|
|
39
|
-
sm: 11,
|
|
40
|
-
md: 5.5,
|
|
41
|
-
lg: 5.5,
|
|
42
|
-
},
|
|
43
|
-
main: {
|
|
44
|
-
label: "Screen Size",
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
type: "Control",
|
|
51
|
-
scope: "#/properties/value",
|
|
52
|
-
|
|
53
|
-
options: {
|
|
54
|
-
widget: "InputField",
|
|
55
|
-
},
|
|
56
|
-
config: {
|
|
57
|
-
layout: {
|
|
58
|
-
xs: 11,
|
|
59
|
-
sm: 11,
|
|
60
|
-
md: 5.5,
|
|
61
|
-
lg: 5.5,
|
|
62
|
-
},
|
|
63
|
-
main: {
|
|
64
|
-
label: "Value",
|
|
65
|
-
type:"number",
|
|
66
|
-
// freeSolo:true,
|
|
67
|
-
helperText:'Number should be in range of 0 to 12',
|
|
68
|
-
errorMessage:"Number Can't be greater than 12 and can't be less than 0.",
|
|
69
|
-
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
22
|
const getArrayControl = (parentScope: string, childScope: string, childLabel?: string,) => {
|
|
78
23
|
return {
|
|
79
24
|
type: "Control",
|
|
@@ -108,27 +53,7 @@ const getArrayControl = (parentScope: string, childScope: string, childLabel?: s
|
|
|
108
53
|
},
|
|
109
54
|
},
|
|
110
55
|
}
|
|
111
|
-
}
|
|
112
|
-
const sizeHolder = getArrayControl("sizeHolder", "keyName", "Component Name");
|
|
113
|
-
sizeHolder.options.detail.elements[1] = {
|
|
114
|
-
type: "Control",
|
|
115
|
-
scope: `#/properties/value`,
|
|
116
|
-
|
|
117
|
-
options: {
|
|
118
|
-
widget: "InputField",
|
|
119
|
-
},
|
|
120
|
-
config: {
|
|
121
|
-
layout: {
|
|
122
|
-
xs: 11,
|
|
123
|
-
sm: 11,
|
|
124
|
-
md: 5.5,
|
|
125
|
-
lg: 5.5,
|
|
126
|
-
},
|
|
127
|
-
main: {
|
|
128
|
-
label: "Size",
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
};
|
|
56
|
+
}
|
|
132
57
|
const getInputField = (scope: String, label: String) => {
|
|
133
58
|
return {
|
|
134
59
|
type: "Control",
|
|
@@ -235,38 +160,6 @@ const GraphSection = {
|
|
|
235
160
|
export const buildPropertiesSection = function (type: String) {
|
|
236
161
|
let uiSchema = _.cloneDeep(GraphSection);
|
|
237
162
|
switch (type) {
|
|
238
|
-
case "DataGrid":
|
|
239
|
-
uiSchema.elements = [
|
|
240
|
-
getRadioInputField("divider", "Use Header divider", ["YES", "NO"]),
|
|
241
|
-
getInputField("elevation", "Card Elevation"),
|
|
242
|
-
getInputField("height", "Grid height"),
|
|
243
|
-
getInputField("justifyContent", "justifyContent"),
|
|
244
|
-
cardLayout,
|
|
245
|
-
]
|
|
246
|
-
break;
|
|
247
|
-
case "Stepper":
|
|
248
|
-
uiSchema.elements = [
|
|
249
|
-
getRadioInputField("resetButton", "Reset Button", ["YES", "NO"]),
|
|
250
|
-
getRadioInputField("defaultButtonAvailable", "Use Default Buttons ", ["YES", "NO"]),
|
|
251
|
-
getInputField("resetText", "Reset Text"),
|
|
252
|
-
getInputField("completeText", "Complete Text"),
|
|
253
|
-
getSelectField("orientation", "Orientation Type", [
|
|
254
|
-
{ label: "Horizontal", value: "horizontal" },
|
|
255
|
-
{ label: "Vertical", value: "vertical" },
|
|
256
|
-
]),
|
|
257
|
-
|
|
258
|
-
getArrayControl("sectionLabels", "label")
|
|
259
|
-
|
|
260
|
-
]
|
|
261
|
-
break;
|
|
262
|
-
case "PopUp":
|
|
263
|
-
uiSchema.elements = [
|
|
264
|
-
getRadioInputField("fullScreen", "FullScreen", ["YES", "NO"]),
|
|
265
|
-
getRadioInputField("fullWidth", "FullWidth", ["YES", "NO"]),
|
|
266
|
-
getInputField("maxWidth", "Max. Width"),
|
|
267
|
-
EmptyBox
|
|
268
|
-
]
|
|
269
|
-
break;
|
|
270
163
|
case "Text":
|
|
271
164
|
uiSchema.elements = [
|
|
272
165
|
getInputField("placeholder", "Placeholder"),
|
|
@@ -376,7 +269,6 @@ export const buildPropertiesSection = function (type: String) {
|
|
|
376
269
|
getRadioInputField("downloadAllData", "Download All Data", ["YES", "NO"]),
|
|
377
270
|
getInputField("selectKey", "Selection Key"),
|
|
378
271
|
getArrayControl("Table_Download_Keys_Name", "KeyName", "Table Key Name"),
|
|
379
|
-
sizeHolder
|
|
380
272
|
]
|
|
381
273
|
break;
|
|
382
274
|
case "Radio":
|
|
@@ -10,7 +10,6 @@ export const ComponentSchema: any = {
|
|
|
10
10
|
{ title: "Card", const: "card" },
|
|
11
11
|
{ title: "CheckBox", const: "CheckBox" },
|
|
12
12
|
{ title: "Container", const: "WrapperSection" },
|
|
13
|
-
{ title: "DataGrid", const: "DataGrid" },
|
|
14
13
|
{ title: "Date", const: "Date" },
|
|
15
14
|
{ title: "Download File", const: "DownloadFile" },
|
|
16
15
|
{ title: "Empty Box", const: "EmptyBox" },
|
|
@@ -20,13 +19,11 @@ export const ComponentSchema: any = {
|
|
|
20
19
|
{ title: "LeaderBoard", const: "LeaderBoard" },
|
|
21
20
|
{ title: "MultipleSelect", const: "MultipleSelect" },
|
|
22
21
|
{ title: "PanCardText", const: "PanCardText" },
|
|
23
|
-
{ title: "Popup Container", const: "PopUp" },
|
|
24
22
|
{ title: "ProgressBar", const: "ProgressBar" },
|
|
25
23
|
{ title: "ProgressBar Card", const: "ProgressBarCard" },
|
|
26
24
|
{ title: "Select", const: "Select" },
|
|
27
25
|
{ title: "Slider", const: "Slider" },
|
|
28
26
|
{ title: "SpeedoMeter", const: "SpeedoMeter" },
|
|
29
|
-
{ title: "Stepper Container", const: "Stepper" },
|
|
30
27
|
{ title: "Radio", const: "Radio" },
|
|
31
28
|
{ title: "Rank", const: "Rank" },
|
|
32
29
|
{ title: "Rank Card", const: "RankCard" },
|
|
@@ -38,11 +35,6 @@ export const ComponentSchema: any = {
|
|
|
38
35
|
{ title: "Timer", const: "Timer" },
|
|
39
36
|
{ title: "Upload File", const: "UploadFile" },]
|
|
40
37
|
},
|
|
41
|
-
orientation:{
|
|
42
|
-
oneOf: [
|
|
43
|
-
{ title: "Horizontal", const: "horizontal" },
|
|
44
|
-
{ title: "Vertical", const: "vertical" },
|
|
45
|
-
]},
|
|
46
38
|
method: {
|
|
47
39
|
type: "string",
|
|
48
40
|
oneOf: [
|
|
@@ -73,27 +65,6 @@ export const ComponentSchema: any = {
|
|
|
73
65
|
},
|
|
74
66
|
},
|
|
75
67
|
},
|
|
76
|
-
cardLayout: {
|
|
77
|
-
type: "array",
|
|
78
|
-
items: {
|
|
79
|
-
type: "object",
|
|
80
|
-
properties: {
|
|
81
|
-
key: {
|
|
82
|
-
type: "string",
|
|
83
|
-
oneOf: [
|
|
84
|
-
{ title: "Extra Small", const: "xs" },
|
|
85
|
-
{ title: "Small", const: "sm" },
|
|
86
|
-
{ title: "Medium", const: "md" },
|
|
87
|
-
{ title: "Large", const: "lg" },
|
|
88
|
-
],
|
|
89
|
-
},
|
|
90
|
-
value: {
|
|
91
|
-
// type: "string",
|
|
92
|
-
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
68
|
value: {
|
|
98
69
|
type: "array",
|
|
99
70
|
items: {
|
|
@@ -163,20 +134,6 @@ export const ComponentSchema: any = {
|
|
|
163
134
|
},
|
|
164
135
|
},
|
|
165
136
|
},
|
|
166
|
-
sizeHolder: {
|
|
167
|
-
type: "array",
|
|
168
|
-
items: {
|
|
169
|
-
type: "object",
|
|
170
|
-
properties: {
|
|
171
|
-
keyName: {
|
|
172
|
-
type: "string",
|
|
173
|
-
},
|
|
174
|
-
value:{
|
|
175
|
-
type:"string"
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
137
|
legendLabels: {
|
|
181
138
|
type: "array",
|
|
182
139
|
items: {
|
|
@@ -39,15 +39,12 @@ export const EventSchema = {
|
|
|
39
39
|
type: "string",
|
|
40
40
|
oneOf: [
|
|
41
41
|
{ title: "Click Event", const: "onClick" },
|
|
42
|
-
{ title: "Load Event", const: "onLoad" },
|
|
43
|
-
{ title: "Change Event", const: "onChange" },
|
|
44
|
-
{ title: "Success", const: "Success" },
|
|
45
42
|
{ title: "onStart", const: "onStart" },
|
|
46
|
-
|
|
43
|
+
{ title: "Load Event", const: "onLoad" },
|
|
47
44
|
{ title: "File Upload Event", const: "onUpload" },
|
|
48
|
-
{ title: "Back Event", const: "onBack" },
|
|
49
|
-
{ title: "Next Event", const: "onNext" },
|
|
50
45
|
{ title: "File Download Event", const: "onDownload" },
|
|
46
|
+
{ title: "Change Event", const: "onChange" },
|
|
47
|
+
{ title: "Success", const: "Success" },
|
|
51
48
|
{ title: "Fail", const: "Fail" }
|
|
52
49
|
]
|
|
53
50
|
},
|
|
@@ -65,7 +62,6 @@ export const EventSchema = {
|
|
|
65
62
|
oneOf: [
|
|
66
63
|
{ title: "RankProvider", const: "RankProvider" },
|
|
67
64
|
{ title: "Download File", const: "downloadFile" },
|
|
68
|
-
{ title: "Download", const: "download" }
|
|
69
65
|
]
|
|
70
66
|
},
|
|
71
67
|
body: {
|
|
@@ -33,9 +33,6 @@ const sectionLabels = {
|
|
|
33
33
|
Radio:["Core", "Properties", "style", "Event","Validation"],
|
|
34
34
|
Text:["Core","Properties","style", "Event","Validation"],
|
|
35
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
36
|
}
|
|
40
37
|
|
|
41
38
|
|
|
@@ -36,7 +36,6 @@ export default (
|
|
|
36
36
|
uiSchema.elements[1].elements[0].elements[2] = getSelectField("inBuiltFunctionType", "Function Name", [
|
|
37
37
|
{ label: "RankProvider", value: "RankProvider" },
|
|
38
38
|
{ label: "Download File", value: "downloadFile" },
|
|
39
|
-
{ label: "Download Blob File", value: "downloadBlobFile" }
|
|
40
39
|
])
|
|
41
40
|
uiSchema.elements[1].elements[0].elements[3] = getTextArea("funcParametersCode", "Write Custom Code for Functions Parameter", true, { xs: 12, sm: 12, md: 6 });
|
|
42
41
|
schema.required = ["eventType", "Handler", "inBuiltFunctionType"]
|
|
@@ -65,7 +65,7 @@ export async function saveHandler(store, service, submitHandler, pageName?: stri
|
|
|
65
65
|
if (_.isEmpty(store.ctx.core.errors)) {
|
|
66
66
|
try {
|
|
67
67
|
const saveReturn = await submitHandler(store, service, config);
|
|
68
|
-
navigateHandler(store, true, pageName ? `/${pageName}?id=${id}` : "/PageMasterRecords")
|
|
68
|
+
navigateHandler(store, true, pageName ? `/${pageName}?id=${saveReturn.id}` : "/PageMasterRecords")
|
|
69
69
|
} catch (err) {
|
|
70
70
|
navigateHandler(store, false)
|
|
71
71
|
}
|
|
@@ -1,32 +1,17 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const downloadFile = (obj: any) => {
|
|
2
2
|
const typeArr = obj.name.split(".");
|
|
3
3
|
const data = obj.data;
|
|
4
4
|
const finalData = window.atob(data);
|
|
5
|
-
let file;
|
|
6
|
-
file = new File([finalData],
|
|
7
|
-
|
|
5
|
+
let file ;
|
|
6
|
+
file = new File([finalData], typeArr[typeArr.length - 1] );
|
|
7
|
+
|
|
8
8
|
const url = URL.createObjectURL(file);
|
|
9
9
|
const link = document.createElement("a");
|
|
10
|
-
link.href = typeArr[typeArr.length - 1] === 'pdf' ?
|
|
10
|
+
link.href = typeArr[typeArr.length - 1] === 'pdf' ?'data:application/octet-stream;base64,' + data: url;
|
|
11
11
|
link.download = `${obj.name}`;
|
|
12
12
|
document.body.appendChild(link);
|
|
13
13
|
link.click();
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
URL.revokeObjectURL(url);
|
|
16
16
|
document.body.removeChild(link);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const doDownload = (response: any, service) => {
|
|
20
|
-
let url = `${service.defaults.baseURL}/${response.path}`;
|
|
21
|
-
if (response?.params) {
|
|
22
|
-
const keysArray = Object.keys(response?.params);
|
|
23
|
-
keysArray.map((e, i) => {
|
|
24
|
-
url = url + `${i === 0?"?":"&"}${e}=${response?.params[e]}`
|
|
25
|
-
})
|
|
26
|
-
}
|
|
27
|
-
const link = document.createElement('a');
|
|
28
|
-
link.href = url;
|
|
29
|
-
document.body.appendChild(link);
|
|
30
|
-
link.click();
|
|
31
|
-
link.parentNode.removeChild(link);
|
|
32
|
-
};
|
|
17
|
+
};
|
|
@@ -44,18 +44,9 @@ async function executeEventsHandler(params: handlersProps) {
|
|
|
44
44
|
}
|
|
45
45
|
else if (params.config.Handler === "mergeFormdata") {
|
|
46
46
|
const result = await mergeFormdata(
|
|
47
|
-
params.parentEventOutput, params.componentName, params.config, params.store,
|
|
47
|
+
params.parentEventOutput, params.componentName, params.config, params.store,params.service)
|
|
48
48
|
return result;
|
|
49
49
|
}
|
|
50
|
-
else if (params.config.Handler === "onBackHandler") {
|
|
51
|
-
return params.store.functionParameters?.handleBack()
|
|
52
|
-
}
|
|
53
|
-
else if (params.config.Handler === "onNextHandler") {
|
|
54
|
-
return params.store.functionParameters?.handleNext()
|
|
55
|
-
}
|
|
56
|
-
else if (params.config.Handler === "onResetHandler") {
|
|
57
|
-
return params.store.functionParameters?.handleReset()
|
|
58
|
-
}
|
|
59
50
|
}
|
|
60
51
|
export async function executeRefreshHandler(params: handlersProps) {
|
|
61
52
|
const compToRefresh: string[] = getRefreshElements(params.config, params.eventGroups)
|
|
@@ -87,7 +78,7 @@ async function executeInBuiltFunctionHandler(params: handlersProps) {
|
|
|
87
78
|
const makeFunc = eval(params.config.funcParametersCode)
|
|
88
79
|
parameter = makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service);
|
|
89
80
|
}
|
|
90
|
-
params.serviceHolder[params.config.inBuiltFunctionType](parameter
|
|
81
|
+
params.serviceHolder[params.config.inBuiltFunctionType](parameter)
|
|
91
82
|
}
|
|
92
83
|
|
|
93
84
|
async function executeCustomHandler(params: handlersProps) {
|
|
@@ -96,7 +87,7 @@ async function executeCustomHandler(params: handlersProps) {
|
|
|
96
87
|
return response;
|
|
97
88
|
}
|
|
98
89
|
|
|
99
|
-
async function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any,
|
|
90
|
+
async function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any,service:any) {
|
|
100
91
|
if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
|
|
101
92
|
store.setSchema((pre) => {
|
|
102
93
|
return {
|
|
@@ -117,7 +108,7 @@ async function mergeFormdata(handlerResponse: any, componentName: string, eventC
|
|
|
117
108
|
...pre.properties?.[componentName],
|
|
118
109
|
type: "array",
|
|
119
110
|
items: {
|
|
120
|
-
oneOf: handlerResponse
|
|
111
|
+
oneOf: handlerResponse.data
|
|
121
112
|
}
|
|
122
113
|
}
|
|
123
114
|
}
|
|
@@ -132,7 +123,7 @@ async function mergeFormdata(handlerResponse: any, componentName: string, eventC
|
|
|
132
123
|
else {
|
|
133
124
|
if (handlerResponse) {
|
|
134
125
|
store.setFormdata((pre) => { return { ...pre, [componentName]: eventConfig.lazyLoading ? handlerResponse.data.data : handlerResponse.data } });
|
|
135
|
-
const demoData =
|
|
126
|
+
const demoData = await service.get("https://jsonplaceholder.typicode.com/posts/1");
|
|
136
127
|
}
|
|
137
128
|
}
|
|
138
129
|
}
|
|
@@ -174,7 +165,7 @@ async function shouldEventExecute(params: handlersProps) {
|
|
|
174
165
|
if (startEvent?.length > 0) {
|
|
175
166
|
const response = await executeEventsHandler({ ...params, config: startEvent[0] });
|
|
176
167
|
return response;
|
|
177
|
-
}
|
|
168
|
+
}else{
|
|
178
169
|
return true
|
|
179
170
|
}
|
|
180
171
|
}
|
|
@@ -212,15 +203,3 @@ export function getRefreshElements(eventConfig: any, eventGropus: any) {
|
|
|
212
203
|
return result;
|
|
213
204
|
}
|
|
214
205
|
|
|
215
|
-
|
|
216
|
-
function asyncOperation() {
|
|
217
|
-
return new Promise((resolve, reject) => {
|
|
218
|
-
setTimeout(() => {
|
|
219
|
-
const success = true;
|
|
220
|
-
if (success) {
|
|
221
|
-
resolve("Operation completed successfully!");
|
|
222
|
-
reject(new Error("Operation failed!"));
|
|
223
|
-
}
|
|
224
|
-
}, 50);
|
|
225
|
-
});
|
|
226
|
-
}
|