impaktapps-ui-builder 0.0.275 → 0.0.277
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 +2641 -2247
- 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/builder/build/buildButton.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildConfig.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildEmptyBox.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildLineGraph.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildRadio.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildSchema.d.ts +6 -0
- package/dist/src/impaktapps-ui-builder/builder/build/buildUiSchema.d.ts +5 -4
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/apiSection.d.ts +3 -0
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/button.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/cardSlider.d.ts +1 -6
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/coreSection.d.ts +6 -20
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/graph.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/leaderBoard.d.ts +8 -1
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/speedoMeter.d.ts +9 -3
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/validationSections.d.ts +54 -0
- package/dist/src/impaktapps-ui-builder/lib/index.d.ts +2 -0
- package/dist/src/impaktapps-ui-builder/runtime/services/events.d.ts +4 -1
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildButton.ts +6 -1
- package/src/impaktapps-ui-builder/builder/build/buildCard.ts +14 -7
- package/src/impaktapps-ui-builder/builder/build/buildConfig.ts +10 -0
- package/src/impaktapps-ui-builder/builder/build/buildEmptyBox.ts +11 -0
- package/src/impaktapps-ui-builder/builder/build/buildHorizontalBarGraph.ts +4 -2
- package/src/impaktapps-ui-builder/builder/build/buildLineGraph.ts +28 -21
- package/src/impaktapps-ui-builder/builder/build/buildPieGraph.ts +12 -16
- package/src/impaktapps-ui-builder/builder/build/buildRadio.ts +35 -0
- package/src/impaktapps-ui-builder/builder/build/buildSchema.ts +32 -0
- package/src/impaktapps-ui-builder/builder/build/buildSpeedoMeter.ts +21 -8
- package/src/impaktapps-ui-builder/builder/build/buildStackBarGraph.ts +2 -1
- package/src/impaktapps-ui-builder/builder/build/buildTimer.ts +2 -1
- package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +60 -44
- package/src/impaktapps-ui-builder/builder/build/uischema/apiSection.ts +2 -0
- package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +79 -45
- package/src/impaktapps-ui-builder/builder/build/uischema/button.ts +2 -1
- package/src/impaktapps-ui-builder/builder/build/uischema/cardSlider.ts +1 -1
- package/src/impaktapps-ui-builder/builder/build/uischema/coreSection.ts +11 -2
- package/src/impaktapps-ui-builder/builder/build/uischema/graph.ts +1 -0
- package/src/impaktapps-ui-builder/builder/build/uischema/leaderBoard.ts +4 -1
- package/src/impaktapps-ui-builder/builder/build/uischema/speedoMeter.ts +5 -4
- package/src/impaktapps-ui-builder/builder/build/uischema/validationSections.ts +88 -0
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +41 -0
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +9 -2
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/uiSchema.ts +1 -0
- package/src/impaktapps-ui-builder/builder/services/component.ts +27 -24
- package/src/impaktapps-ui-builder/builder/services/pageMaster.ts +2 -0
- package/src/impaktapps-ui-builder/lib/index.ts +2 -0
- package/src/impaktapps-ui-builder/runtime/services/events.ts +37 -8
- package/src/impaktapps-ui-builder/runtime/services/service.ts +18 -10
|
@@ -104,6 +104,7 @@ export const EventUiSchema: any = {
|
|
|
104
104
|
type: "text",
|
|
105
105
|
options: [
|
|
106
106
|
{ label: "Click Event", value: "onClick" },
|
|
107
|
+
{ label: "onStart", value: "onStart" },
|
|
107
108
|
{ label: "Load Event", value: "onLoad" },
|
|
108
109
|
{ label: "Change Event", value: "onChange" },
|
|
109
110
|
{ label: "Success", value: "Success" },
|
|
@@ -8,29 +8,31 @@ import { buildPropertiesSection } from "../build/uischema/buildPropertiesSection
|
|
|
8
8
|
import { StyleSection } from "../build/uischema/styleSection";
|
|
9
9
|
import { TableSection } from "../build/uischema/tableSection";
|
|
10
10
|
import { ValueTab } from "../build/uischema/valueTab";
|
|
11
|
+
import { ValidationSection } from "../build/uischema/validationSections";
|
|
11
12
|
|
|
12
13
|
const sectionLabels = {
|
|
13
|
-
Select: ["Core", "Value", "style", "Event"],
|
|
14
|
-
MultipleSelect: ["Core", "Value", "style", "Event"],
|
|
15
|
-
Table: ["Core", "Components", "style", "Event"],
|
|
16
|
-
LeaderBoard: ["Core", "Components", "Properties", "style", "Event"],
|
|
17
|
-
WrapperSection: ["Core", "Components","Properties", "style"],
|
|
18
|
-
TabSection: ["Core", "Components", "Properties", "style"],
|
|
19
|
-
SpeedoMeter:["Core", "Properties", "style", "Event"],
|
|
20
|
-
card:["Core", "Properties", "style", "Event"],
|
|
21
|
-
UploadFile:["Core", "style", "Event"],
|
|
22
|
-
Graph:["Core", "Properties", "style", "Event"],
|
|
23
|
-
DownloadFile:["Core", "style", "Event"],
|
|
24
|
-
Box: ["Core", "Properties", "style", "Event"],
|
|
25
|
-
Properties: ["Core", "Properties", "style", "Event"],
|
|
26
|
-
ProgressBarCard: ["Core", "Properties", "style", "Event"],
|
|
27
|
-
RankCard: ["Core", "Properties", "style", "Event"],
|
|
28
|
-
Slider: ["Core", "Components","Properties", "style", "Event"],
|
|
29
|
-
Timer: ["Core", "Properties", "style", "Event"],
|
|
30
|
-
Rank: ["Core", "Properties", "style", "Event"],
|
|
31
|
-
Button: ["Core", "Properties", "style", "Event"],
|
|
32
|
-
Array:["Core","Components",],
|
|
33
|
-
|
|
14
|
+
Select: ["Core", "Value", "style", "Event","Validation"],
|
|
15
|
+
MultipleSelect: ["Core", "Value", "style", "Event","Validation"],
|
|
16
|
+
Table: ["Core", "Components", "style", "Event","Validation"],
|
|
17
|
+
LeaderBoard: ["Core", "Components", "Properties", "style", "Event","Validation"],
|
|
18
|
+
WrapperSection: ["Core", "Components","Properties", "style","Validation"],
|
|
19
|
+
TabSection: ["Core", "Components", "Properties", "style","Validation"],
|
|
20
|
+
SpeedoMeter:["Core", "Properties", "style", "Event","Validation"],
|
|
21
|
+
card:["Core", "Properties", "style", "Event","Validation"],
|
|
22
|
+
UploadFile:["Core", "style", "Event","Validation"],
|
|
23
|
+
Graph:["Core", "Properties", "style", "Event","Validation"],
|
|
24
|
+
DownloadFile:["Core", "style", "Event","Validation"],
|
|
25
|
+
Box: ["Core", "Properties", "style", "Event","Validation"],
|
|
26
|
+
Properties: ["Core", "Properties", "style", "Event","Validation"],
|
|
27
|
+
ProgressBarCard: ["Core", "Properties", "style", "Event","Validation"],
|
|
28
|
+
RankCard: ["Core", "Properties", "style", "Event","Validation"],
|
|
29
|
+
Slider: ["Core", "Components","Properties", "style", "Event","Validation"],
|
|
30
|
+
Timer: ["Core", "Properties", "style", "Event","Validation"],
|
|
31
|
+
Rank: ["Core", "Properties", "style", "Event","Validation"],
|
|
32
|
+
Button: ["Core", "Properties", "style", "Event","Validation"],
|
|
33
|
+
Array:["Core","Components","Validation"],
|
|
34
|
+
Radio:["Core", "Properties", "style", "Event","Validation"],
|
|
35
|
+
Text:["Core", "Event","Validation"]
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
export const refreshPage = (type:string,store:any) => {
|
|
@@ -42,12 +44,13 @@ export const refreshPage = (type:string,store:any) => {
|
|
|
42
44
|
style: StyleSection,
|
|
43
45
|
Event: EventSection,
|
|
44
46
|
Components: TableSection,
|
|
45
|
-
Properties: buildPropertiesSection(type)
|
|
47
|
+
Properties: buildPropertiesSection(type),
|
|
48
|
+
Validation:ValidationSection
|
|
46
49
|
|
|
47
50
|
}
|
|
48
51
|
const elements = sectionLabels[type]?.map(e => sectionUiSchema[e]);
|
|
49
|
-
UiSchema.elements[1].config.main.tabLabels = sectionLabels[type] || ["Core", "style","Event"];
|
|
50
|
-
UiSchema.elements[1].elements = elements || [CoreSection, StyleSection,EventSection];
|
|
52
|
+
UiSchema.elements[1].config.main.tabLabels = sectionLabels[type] || ["Core", "style","Event","Validation"];
|
|
53
|
+
UiSchema.elements[1].elements = elements || [CoreSection, StyleSection,EventSection,ValidationSection];
|
|
51
54
|
|
|
52
55
|
}
|
|
53
56
|
store.setUiSchema(UiSchema);
|
|
@@ -3,6 +3,7 @@ import { PageMasterUiSchema } from "../elements/UiSchema/PageMaster/uiSchema";
|
|
|
3
3
|
import _ from "lodash";
|
|
4
4
|
import Component from "./component";
|
|
5
5
|
import { getFormdataFromLocalStorage, saveFormdataInLocalStorage } from "./saveHandler";
|
|
6
|
+
import { schema } from "../build/buildUiSchema";
|
|
6
7
|
|
|
7
8
|
interface funcParamsProps {
|
|
8
9
|
store: any,
|
|
@@ -52,6 +53,7 @@ export default (funcParams:funcParamsProps) => {
|
|
|
52
53
|
);
|
|
53
54
|
},
|
|
54
55
|
submitPageHandler: async function () {
|
|
56
|
+
console.log(schema)
|
|
55
57
|
submitHandler(store,funcParams.service)
|
|
56
58
|
.then((saveReturn: any) => {
|
|
57
59
|
localStorage.removeItem("pageFormdata")
|
|
@@ -3,6 +3,8 @@ export {default as pageMaster} from "../builder/services/pageMaster"
|
|
|
3
3
|
export {default as pageMasterEvents} from "../builder/services/event"
|
|
4
4
|
export {default as pageMasterComponents} from "../builder/services/component"
|
|
5
5
|
export {default as pageService} from "../runtime/services/service"
|
|
6
|
+
export { schema} from "../builder/build/buildUiSchema"
|
|
6
7
|
export {default as buildConfig} from "../builder/build/buildConfig"
|
|
7
8
|
export {default as buildUiSchema} from "../builder/build/buildUiSchema"
|
|
9
|
+
export {default as buildSchema} from "../builder/build/buildSchema"
|
|
8
10
|
export {default as clearPreviousCache} from "../builder/services/clearLocalStorage"
|
|
@@ -16,6 +16,11 @@ export const executeEvents = async (
|
|
|
16
16
|
nextEvent = events;
|
|
17
17
|
}
|
|
18
18
|
else {
|
|
19
|
+
if (!shouldEventExecute(config, componentName,
|
|
20
|
+
store, dynamicData, userValue,
|
|
21
|
+
service, serviceHolder, eventGroups)) {
|
|
22
|
+
return { response: undefined, events: undefined };
|
|
23
|
+
}
|
|
19
24
|
const { response, events } = await executeEventsHandler(config, componentName,
|
|
20
25
|
store, dynamicData, userValue,
|
|
21
26
|
service, serviceHolder, eventGroups, parentEventOutput)
|
|
@@ -35,6 +40,11 @@ const executetOnLoadEvent = async (
|
|
|
35
40
|
) => {
|
|
36
41
|
|
|
37
42
|
try {
|
|
43
|
+
if (!shouldEventExecute(config, componentName,
|
|
44
|
+
store, dynamicData, userValue,
|
|
45
|
+
service, serviceHolder, eventGroups)) {
|
|
46
|
+
return { response: undefined, events: undefined };
|
|
47
|
+
}
|
|
38
48
|
const { response } = await executeEventsHandler(config, componentName,
|
|
39
49
|
store, dynamicData, userValue,
|
|
40
50
|
service, serviceHolder, eventGroups, parentEventOutput)
|
|
@@ -132,17 +142,20 @@ async function executeInBuiltFunctionHandler(refreshHandlerConfig: any, componen
|
|
|
132
142
|
async function executeCustomHandler(customHandlerConfig: any, componentName: string,
|
|
133
143
|
store: any, dynamicData: any, userValue: any,
|
|
134
144
|
service: any, serviceHolder: any, parentEventOutput?: any) {
|
|
145
|
+
console.log(service)
|
|
135
146
|
const makeFunc = eval(customHandlerConfig.eventCode)
|
|
136
|
-
makeFunc(store, dynamicData, userValue, parentEventOutput, service);
|
|
137
|
-
return { response:
|
|
147
|
+
const response = await makeFunc(store, dynamicData, userValue, parentEventOutput, service, componentName);
|
|
148
|
+
return { response: response, events: customHandlerConfig?.events };
|
|
138
149
|
}
|
|
139
150
|
|
|
140
151
|
async function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any) {
|
|
141
|
-
|
|
152
|
+
|
|
153
|
+
if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse) && handlerResponse)) {
|
|
142
154
|
store.setSchema((pre) => {
|
|
143
155
|
return {
|
|
144
156
|
...pre, properties: {
|
|
145
157
|
...pre.properties, [componentName]: {
|
|
158
|
+
// ...pre?.properties?. [componentName],
|
|
146
159
|
enum: handlerResponse.data
|
|
147
160
|
}
|
|
148
161
|
}
|
|
@@ -192,12 +205,24 @@ const buildHeadersFormat = (headers: any[]) => {
|
|
|
192
205
|
return headerObj;
|
|
193
206
|
}
|
|
194
207
|
|
|
195
|
-
|
|
208
|
+
async function shouldEventExecute(config, componentName,
|
|
209
|
+
store, dynamicData, userValue,
|
|
210
|
+
service, serviceHolder, eventGroups) {
|
|
211
|
+
const startEvent = config?.events?.filter(e => e.eventType === "onStart");
|
|
212
|
+
if (startEvent?.length > 0) {
|
|
213
|
+
const { response } = await executeEventsHandler(startEvent[0], componentName,
|
|
214
|
+
store, dynamicData, userValue,
|
|
215
|
+
service, serviceHolder, eventGroups);
|
|
216
|
+
return response
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// if(!response){
|
|
220
|
+
// return {response:undefined,events:undefined};
|
|
221
|
+
// }
|
|
196
222
|
export async function buildApiPayload(compConfig: any, body: any, headers: any, store: any, dynamicData: any, userValue: any, service) {
|
|
197
223
|
if (compConfig?.headers) {
|
|
198
|
-
headers =
|
|
199
|
-
|
|
200
|
-
}
|
|
224
|
+
headers = buildHeadersFormat(compConfig.headers)
|
|
225
|
+
|
|
201
226
|
}
|
|
202
227
|
if (compConfig.body) {
|
|
203
228
|
body = { ...buildBodyFormat(compConfig.body, store.newData || store?.ctx?.core?.data || store.formData, userValue) };
|
|
@@ -217,10 +242,14 @@ export function getRefreshElements(eventConfig: any, eventGropus: any) {
|
|
|
217
242
|
result = eventConfig.refreshElements.map((e) => {
|
|
218
243
|
return e.value
|
|
219
244
|
})
|
|
245
|
+
|
|
220
246
|
} else {
|
|
221
247
|
if (eventGropus?.onLoad) {
|
|
222
248
|
result = Object.keys(eventGropus?.onLoad)
|
|
249
|
+
result.push(result[0]);
|
|
223
250
|
}
|
|
224
251
|
}
|
|
252
|
+
console.log(result);
|
|
225
253
|
return result;
|
|
226
|
-
}
|
|
254
|
+
}
|
|
255
|
+
|
|
@@ -3,7 +3,7 @@ import { downloadFile } from "./downloadFile";
|
|
|
3
3
|
import { executeEvents } from "./events";
|
|
4
4
|
let compType: string;
|
|
5
5
|
let eventGroups: any = {};
|
|
6
|
-
const notifyUiSchema =
|
|
6
|
+
const notifyUiSchema = {
|
|
7
7
|
type: "Control",
|
|
8
8
|
scope: "#/properties/notify",
|
|
9
9
|
options: {
|
|
@@ -37,7 +37,7 @@ export const extractEvents = (eventConfig: any) => {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
interface funcParamsProps {
|
|
40
|
-
|
|
40
|
+
store: any,
|
|
41
41
|
dynamicData: any,
|
|
42
42
|
config: any,
|
|
43
43
|
uiSchema: any,
|
|
@@ -45,24 +45,32 @@ interface funcParamsProps {
|
|
|
45
45
|
service: any,
|
|
46
46
|
userValue: any,
|
|
47
47
|
}
|
|
48
|
-
export default (funcParams:funcParamsProps) => {
|
|
48
|
+
export default (funcParams: funcParamsProps) => {
|
|
49
49
|
return {
|
|
50
50
|
setPage: async function () {
|
|
51
51
|
funcParams.store.setFormdata({});
|
|
52
52
|
eventGroups = {}
|
|
53
53
|
eventGroups = extractEvents(funcParams.config)
|
|
54
54
|
await executeEvents(
|
|
55
|
-
{ Handler: "refresh",eventType:"onPageRefresh"}, "all",
|
|
55
|
+
{ Handler: "refresh", eventType: "onPageRefresh" }, "all",
|
|
56
56
|
funcParams.store, funcParams.dynamicData, funcParams.userValue, funcParams.service,
|
|
57
57
|
this, eventGroups)
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
funcParams.store.setSchema(
|
|
59
|
+
(pre:any) => {
|
|
60
|
+
return {
|
|
61
|
+
...funcParams.schema, properties:
|
|
62
|
+
{ ...funcParams.schema.properties, ...pre.properties, }
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
funcParams.uiSchema.elements.push(notifyUiSchema);
|
|
66
|
+
funcParams.store.setUiSchema(funcParams.uiSchema);
|
|
60
67
|
},
|
|
61
68
|
onClick: async function () {
|
|
62
69
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
63
70
|
for (const eventConfig of eventGroups?.onClick[path]) {
|
|
64
|
-
|
|
65
|
-
|
|
71
|
+
|
|
72
|
+
await executeEvents(
|
|
73
|
+
eventConfig, path,
|
|
66
74
|
funcParams.store, funcParams.dynamicData, funcParams.userValue, funcParams.service,
|
|
67
75
|
this, eventGroups)
|
|
68
76
|
}
|
|
@@ -78,8 +86,8 @@ export default (funcParams:funcParamsProps) => {
|
|
|
78
86
|
for (const eventConfig of eventGroups.onChange[componentName]) {
|
|
79
87
|
await executeEvents(
|
|
80
88
|
eventConfig, componentName,
|
|
81
|
-
|
|
82
|
-
|
|
89
|
+
funcParams.store, funcParams.dynamicData, funcParams.userValue, funcParams.service,
|
|
90
|
+
this, eventGroups)
|
|
83
91
|
}
|
|
84
92
|
}
|
|
85
93
|
}))
|