impaktapps-ui-builder 0.0.284 → 0.0.286
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 +214 -291
- 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/dist/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.d.ts +4 -4
- package/dist/src/impaktapps-ui-builder/builder/build/uischema/selectInputField.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/runtime/services/events.d.ts +2 -1
- package/dist/src/impaktapps-ui-builder/runtime/services/interface.d.ts +11 -0
- package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +1 -1
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildMultiSelect.ts +18 -16
- package/src/impaktapps-ui-builder/builder/build/buildSelect.ts +17 -14
- package/src/impaktapps-ui-builder/builder/build/buildTable.ts +3 -0
- package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +34 -20
- package/src/impaktapps-ui-builder/builder/build/uischema/selectInputField.ts +1 -1
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +36 -36
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/uiSchema.ts +1 -1
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/uiSchema.ts +10 -10
- package/src/impaktapps-ui-builder/builder/services/component.ts +2 -2
- package/src/impaktapps-ui-builder/builder/services/event.ts +2 -2
- package/src/impaktapps-ui-builder/runtime/services/events.ts +56 -135
- package/src/impaktapps-ui-builder/runtime/services/interface.ts +11 -0
- package/src/impaktapps-ui-builder/runtime/services/service.ts +54 -31
|
@@ -113,7 +113,7 @@ const PageMasterUiSchema = {
|
|
|
113
113
|
main: {
|
|
114
114
|
label: "Template",
|
|
115
115
|
programType: true,
|
|
116
|
-
options: [{
|
|
116
|
+
options: [{ label: "Basic Template", value: 1 }],
|
|
117
117
|
required: true
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -6085,34 +6085,34 @@ const componentBasicUiSchema = {
|
|
|
6085
6085
|
main: {
|
|
6086
6086
|
label: "Type",
|
|
6087
6087
|
options: [
|
|
6088
|
-
{
|
|
6089
|
-
{
|
|
6090
|
-
{
|
|
6091
|
-
{
|
|
6092
|
-
{
|
|
6093
|
-
{
|
|
6094
|
-
{
|
|
6095
|
-
{
|
|
6096
|
-
{
|
|
6097
|
-
{
|
|
6098
|
-
{
|
|
6099
|
-
{
|
|
6100
|
-
{
|
|
6101
|
-
{
|
|
6102
|
-
{
|
|
6103
|
-
{
|
|
6104
|
-
{
|
|
6105
|
-
{
|
|
6106
|
-
{
|
|
6107
|
-
{
|
|
6108
|
-
{
|
|
6109
|
-
{
|
|
6110
|
-
{
|
|
6111
|
-
{
|
|
6112
|
-
{
|
|
6113
|
-
{
|
|
6114
|
-
{
|
|
6115
|
-
{
|
|
6088
|
+
{ label: "Select", value: "Select" },
|
|
6089
|
+
{ label: "Date", value: "Date" },
|
|
6090
|
+
{ label: "CheckBox", value: "CheckBox" },
|
|
6091
|
+
{ label: "Table", value: "Table" },
|
|
6092
|
+
{ label: "Lazy Loading Table", value: "LazyLoadingTable" },
|
|
6093
|
+
{ label: "Array", value: "Array" },
|
|
6094
|
+
{ label: "Container", value: "WrapperSection" },
|
|
6095
|
+
{ label: "Tabs", value: "TabSection" },
|
|
6096
|
+
{ label: "Text", value: "Text" },
|
|
6097
|
+
{ label: "Radio", value: "Radio" },
|
|
6098
|
+
{ label: "Text Area", value: "TextArea" },
|
|
6099
|
+
{ label: "Button", value: "Button" },
|
|
6100
|
+
{ label: "Card", value: "card" },
|
|
6101
|
+
{ label: "Rank", value: "Rank" },
|
|
6102
|
+
{ label: "SpeedoMeter", value: "SpeedoMeter" },
|
|
6103
|
+
{ label: "ProgressBar", value: "ProgressBar" },
|
|
6104
|
+
{ label: "Graph", value: "Graph" },
|
|
6105
|
+
{ label: "Label", value: "Box" },
|
|
6106
|
+
{ label: "Upload File", value: "UploadFile" },
|
|
6107
|
+
{ label: "Download File", value: "DownloadFile" },
|
|
6108
|
+
{ label: "Empty Box", value: "EmptyBox" },
|
|
6109
|
+
{ label: "ProgressBar Card", value: "ProgressBarCard" },
|
|
6110
|
+
{ label: "Rank Card", value: "RankCard" },
|
|
6111
|
+
{ label: "Runner Boy Progress Bar", value: "RunnerBoyProgressBar" },
|
|
6112
|
+
{ label: "Slider", value: "Slider" },
|
|
6113
|
+
{ label: "Timer", value: "Timer" },
|
|
6114
|
+
{ label: "MultipleSelect", value: "MultipleSelect" },
|
|
6115
|
+
{ label: "LeaderBoard", value: "LeaderBoard" }
|
|
6116
6116
|
]
|
|
6117
6117
|
}
|
|
6118
6118
|
}
|
|
@@ -6193,10 +6193,10 @@ const componentBasicUiSchema = {
|
|
|
6193
6193
|
main: {
|
|
6194
6194
|
label: "Screen Size",
|
|
6195
6195
|
options: [
|
|
6196
|
-
{
|
|
6197
|
-
{
|
|
6198
|
-
{
|
|
6199
|
-
{
|
|
6196
|
+
{ label: "Extra Small", value: "xs" },
|
|
6197
|
+
{ label: "Small", value: "sm" },
|
|
6198
|
+
{ label: "Medium", value: "md" },
|
|
6199
|
+
{ label: "Large", value: "lg" }
|
|
6200
6200
|
]
|
|
6201
6201
|
}
|
|
6202
6202
|
}
|
|
@@ -6217,10 +6217,10 @@ const componentBasicUiSchema = {
|
|
|
6217
6217
|
main: {
|
|
6218
6218
|
label: "Value",
|
|
6219
6219
|
options: [
|
|
6220
|
-
{
|
|
6221
|
-
{
|
|
6222
|
-
{
|
|
6223
|
-
{
|
|
6220
|
+
{ label: "3", value: "3" },
|
|
6221
|
+
{ label: "5.5", value: "5.5" },
|
|
6222
|
+
{ label: "8", value: "8" },
|
|
6223
|
+
{ label: "12", value: "12" }
|
|
6224
6224
|
]
|
|
6225
6225
|
}
|
|
6226
6226
|
}
|
|
@@ -6870,8 +6870,8 @@ const buildPropertiesSection = function(type) {
|
|
|
6870
6870
|
} else if (type === "Box") {
|
|
6871
6871
|
const iconName = getInputField("value", "Value");
|
|
6872
6872
|
uiSchema.elements = [getSelectField("graphType", "Label Type", [
|
|
6873
|
-
{
|
|
6874
|
-
{
|
|
6873
|
+
{ label: "URL", value: "url" },
|
|
6874
|
+
{ label: "Heading", value: "heading" }
|
|
6875
6875
|
]), iconName];
|
|
6876
6876
|
} else if (type === "Button") {
|
|
6877
6877
|
const caption = getInputField("color", "Color");
|
|
@@ -6879,16 +6879,16 @@ const buildPropertiesSection = function(type) {
|
|
|
6879
6879
|
const iconName = getInputField("iconName", "Icon Name");
|
|
6880
6880
|
uiSchema.elements = [
|
|
6881
6881
|
getSelectField("buttonType", "Button Type", [
|
|
6882
|
-
{
|
|
6883
|
-
{
|
|
6884
|
-
{
|
|
6882
|
+
{ label: "Button With Text", value: "Button" },
|
|
6883
|
+
{ label: "Button With Icon", value: "IconButton" },
|
|
6884
|
+
{ label: "Button With Icon and Text", value: "ButtonWithIconAndText" }
|
|
6885
6885
|
]),
|
|
6886
6886
|
iconName,
|
|
6887
6887
|
size,
|
|
6888
6888
|
caption,
|
|
6889
6889
|
getSelectField("defaultStyle", "Default Style", [
|
|
6890
|
-
{
|
|
6891
|
-
{
|
|
6890
|
+
{ label: "Apply Default Style", value: "true" },
|
|
6891
|
+
{ label: "No Style", value: "false" }
|
|
6892
6892
|
]),
|
|
6893
6893
|
JSON.parse(JSON.stringify(EmptyBox))
|
|
6894
6894
|
];
|
|
@@ -6902,11 +6902,11 @@ const buildPropertiesSection = function(type) {
|
|
|
6902
6902
|
heading,
|
|
6903
6903
|
height,
|
|
6904
6904
|
getSelectField("graphType", "Graph Type", [
|
|
6905
|
-
{
|
|
6906
|
-
{
|
|
6907
|
-
{
|
|
6908
|
-
{
|
|
6909
|
-
{
|
|
6905
|
+
{ label: "Bar Graph", value: "BarGraph" },
|
|
6906
|
+
{ label: "Stack Bar Graph", value: "StackBarGraph" },
|
|
6907
|
+
{ label: "Line Graph", value: "LineGraph" },
|
|
6908
|
+
{ label: "Pie Graph", value: "PieGraph" },
|
|
6909
|
+
{ label: "Horizontal Bar Graph", value: "HorizontalBarGraph" }
|
|
6910
6910
|
]),
|
|
6911
6911
|
leftLabel,
|
|
6912
6912
|
bottomLabel,
|
|
@@ -6922,15 +6922,27 @@ const buildPropertiesSection = function(type) {
|
|
|
6922
6922
|
];
|
|
6923
6923
|
} else if (type === "Table" || type === "LazyLoadingTable") {
|
|
6924
6924
|
uiSchema.elements = [
|
|
6925
|
+
getRadioInputField("lazyLoading", "Lazy Loading", ["YES", "NO"]),
|
|
6925
6926
|
getRadioInputField("SelectionAvailable", "Selection Available", ["YES", "NO"]),
|
|
6926
6927
|
getRadioInputField("ColumnResizingAvailable", "ColumnResizing Available", ["YES", "NO"]),
|
|
6927
6928
|
getRadioInputField("DragAvailable", "Drag Available", ["YES", "NO"]),
|
|
6928
|
-
getInputField("selectKey", "Selection Key")
|
|
6929
|
+
getInputField("selectKey", "Selection Key"),
|
|
6930
|
+
EmptyBox
|
|
6929
6931
|
];
|
|
6930
6932
|
} else if (type === "Radio") {
|
|
6931
6933
|
uiSchema.elements = [
|
|
6932
6934
|
getArrayControl("sectionLabels", "label", "Options Of Radio")
|
|
6933
6935
|
];
|
|
6936
|
+
} else if (type === "Select") {
|
|
6937
|
+
uiSchema.elements = [
|
|
6938
|
+
getRadioInputField("lazyLoading", "Lazy Loading", ["YES", "NO"]),
|
|
6939
|
+
getRadioInputField("freeSolo", "FreeSolo", ["YES", "NO"])
|
|
6940
|
+
];
|
|
6941
|
+
} else if (type === "MultipleSelect") {
|
|
6942
|
+
uiSchema.elements = [
|
|
6943
|
+
getRadioInputField("lazyLoading", "Lazy Loading", ["YES", "NO"]),
|
|
6944
|
+
EmptyBox
|
|
6945
|
+
];
|
|
6934
6946
|
}
|
|
6935
6947
|
return uiSchema;
|
|
6936
6948
|
};
|
|
@@ -7153,8 +7165,8 @@ const ValidationSection = {
|
|
|
7153
7165
|
]
|
|
7154
7166
|
};
|
|
7155
7167
|
const sectionLabels = {
|
|
7156
|
-
Select: ["Core", "Value", "style", "Event", "Validation"],
|
|
7157
|
-
MultipleSelect: ["Core", "Value", "style", "Event", "Validation"],
|
|
7168
|
+
Select: ["Core", "Properties", "Value", "style", "Event", "Validation"],
|
|
7169
|
+
MultipleSelect: ["Core", "Properties", "Value", "style", "Event", "Validation"],
|
|
7158
7170
|
Table: ["Core", "Components", "Properties", "style", "Event", "Validation"],
|
|
7159
7171
|
LazyLoadingTable: ["Core", "Components", "Properties", "style", "Event", "Validation"],
|
|
7160
7172
|
LeaderBoard: ["Core", "Components", "Properties", "style", "Event", "Validation"],
|
|
@@ -8169,7 +8181,8 @@ var SelectInputField = {
|
|
|
8169
8181
|
},
|
|
8170
8182
|
main: {
|
|
8171
8183
|
label: "",
|
|
8172
|
-
type: "text"
|
|
8184
|
+
type: "text",
|
|
8185
|
+
freeSole: false
|
|
8173
8186
|
}
|
|
8174
8187
|
}
|
|
8175
8188
|
};
|
|
@@ -8177,10 +8190,13 @@ const buildSelect = (config, componentScope) => {
|
|
|
8177
8190
|
const selectInputField = _.cloneDeep(SelectInputField);
|
|
8178
8191
|
selectInputField.config.main.label = config.label;
|
|
8179
8192
|
if (config.value) {
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
selectInputField.config.main.
|
|
8193
|
+
selectInputField.config.main.options = config.value;
|
|
8194
|
+
}
|
|
8195
|
+
if (config.freeSolo) {
|
|
8196
|
+
selectInputField.config.main.freeSolo = config.freeSolo === "YES" ? true : false;
|
|
8197
|
+
}
|
|
8198
|
+
if (config.lazyLoading) {
|
|
8199
|
+
selectInputField.config.main.lazyLoading = config.lazyLoading === "YES" ? true : false;
|
|
8184
8200
|
}
|
|
8185
8201
|
if (config.layout) {
|
|
8186
8202
|
selectInputField.config.layout = createLayoutFormat(config.layout);
|
|
@@ -8278,6 +8294,9 @@ const buildTable = (config, componentScope) => {
|
|
|
8278
8294
|
if (config.style) {
|
|
8279
8295
|
table.config.style = JSON.parse(config.style);
|
|
8280
8296
|
}
|
|
8297
|
+
if (config.lazyLoading) {
|
|
8298
|
+
table.config.main.lazyLoading = config.lazyLoading === "YES" ? true : false;
|
|
8299
|
+
}
|
|
8281
8300
|
if (config.SelectionAvailable) {
|
|
8282
8301
|
table.config.main.Selection = config.SelectionAvailable === "YES" ? true : false;
|
|
8283
8302
|
}
|
|
@@ -8682,10 +8701,10 @@ const buildMultiSelect = (config, componentScope) => {
|
|
|
8682
8701
|
multipleSelect.config.layout = createLayoutFormat(config.layout);
|
|
8683
8702
|
}
|
|
8684
8703
|
if (config.value) {
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
multipleSelect.config.main.
|
|
8704
|
+
multipleSelect.config.main.options = config.value;
|
|
8705
|
+
}
|
|
8706
|
+
if (config.lazyLoading) {
|
|
8707
|
+
multipleSelect.config.main.lazyLoading = config.lazyLoading === "YES" ? true : false;
|
|
8689
8708
|
}
|
|
8690
8709
|
return multipleSelect;
|
|
8691
8710
|
};
|
|
@@ -9271,21 +9290,21 @@ const EventUiSchema = {
|
|
|
9271
9290
|
label: "Event Type",
|
|
9272
9291
|
type: "text",
|
|
9273
9292
|
options: [
|
|
9274
|
-
{
|
|
9275
|
-
{
|
|
9276
|
-
{
|
|
9277
|
-
{
|
|
9278
|
-
{
|
|
9279
|
-
{
|
|
9293
|
+
{ label: "Click Event", value: "onClick" },
|
|
9294
|
+
{ label: "onStart", value: "onStart" },
|
|
9295
|
+
{ label: "Load Event", value: "onLoad" },
|
|
9296
|
+
{ label: "Change Event", value: "onChange" },
|
|
9297
|
+
{ label: "Success", value: "Success" },
|
|
9298
|
+
{ label: "Fail", value: "Fail" }
|
|
9280
9299
|
]
|
|
9281
9300
|
}
|
|
9282
9301
|
}
|
|
9283
9302
|
},
|
|
9284
9303
|
getSelectField("Handler", "Handler", [
|
|
9285
|
-
{
|
|
9286
|
-
{
|
|
9287
|
-
{
|
|
9288
|
-
{
|
|
9304
|
+
{ label: "Custom", value: "custom" },
|
|
9305
|
+
{ label: "Api", value: "api" },
|
|
9306
|
+
{ label: "Inbuilt Function", value: "inBuiltFunction" },
|
|
9307
|
+
{ label: "Refresh", value: "refresh" }
|
|
9289
9308
|
])
|
|
9290
9309
|
]
|
|
9291
9310
|
},
|
|
@@ -9650,8 +9669,8 @@ var event = (store2, dynamicData2) => {
|
|
|
9650
9669
|
uiSchema.elements[1].elements[0].elements[2] = APISection;
|
|
9651
9670
|
} else if (handlerType === "inBuiltFunction") {
|
|
9652
9671
|
uiSchema.elements[1].elements[0].elements[2] = getSelectField("inBuiltFunctionType", "Function Name", [
|
|
9653
|
-
{
|
|
9654
|
-
{
|
|
9672
|
+
{ label: "RankProvider", value: "RankProvider" },
|
|
9673
|
+
{ label: "Download File", value: "downloadFile" }
|
|
9655
9674
|
]);
|
|
9656
9675
|
uiSchema.elements[1].elements[0].elements[3] = getTextArea("funcParametersCode", "Write Custom Code for Functions Parameter", true, { xs: 12, sm: 12, md: 6 });
|
|
9657
9676
|
} else if (handlerType === "refresh") {
|
|
@@ -9717,195 +9736,96 @@ const downloadFile = (obj) => {
|
|
|
9717
9736
|
URL.revokeObjectURL(url);
|
|
9718
9737
|
document.body.removeChild(link);
|
|
9719
9738
|
};
|
|
9720
|
-
const executeEvents = async (
|
|
9739
|
+
const executeEvents = async (params2) => {
|
|
9740
|
+
var _a, _b, _c;
|
|
9721
9741
|
let nextEvent = [];
|
|
9722
9742
|
let LoadResponse = null;
|
|
9723
|
-
|
|
9724
|
-
|
|
9725
|
-
config,
|
|
9726
|
-
componentName2,
|
|
9727
|
-
store2,
|
|
9728
|
-
dynamicData2,
|
|
9729
|
-
userValue2,
|
|
9730
|
-
service2,
|
|
9731
|
-
serviceHolder2,
|
|
9732
|
-
eventGroups2,
|
|
9733
|
-
parentEventOutput2
|
|
9734
|
-
);
|
|
9735
|
-
if (config.returnResponse) {
|
|
9736
|
-
return response2;
|
|
9737
|
-
}
|
|
9738
|
-
LoadResponse = response2;
|
|
9739
|
-
nextEvent = events;
|
|
9740
|
-
} else {
|
|
9741
|
-
if (!shouldEventExecute(
|
|
9742
|
-
config,
|
|
9743
|
-
componentName2,
|
|
9744
|
-
store2,
|
|
9745
|
-
dynamicData2,
|
|
9746
|
-
userValue2,
|
|
9747
|
-
service2,
|
|
9748
|
-
serviceHolder2,
|
|
9749
|
-
eventGroups2
|
|
9750
|
-
)) {
|
|
9743
|
+
try {
|
|
9744
|
+
if (!shouldEventExecute(params2)) {
|
|
9751
9745
|
return { response: void 0, events: void 0 };
|
|
9752
9746
|
}
|
|
9753
|
-
const
|
|
9754
|
-
config,
|
|
9755
|
-
componentName2,
|
|
9756
|
-
store2,
|
|
9757
|
-
dynamicData2,
|
|
9758
|
-
userValue2,
|
|
9759
|
-
service2,
|
|
9760
|
-
serviceHolder2,
|
|
9761
|
-
eventGroups2,
|
|
9762
|
-
parentEventOutput2
|
|
9763
|
-
);
|
|
9747
|
+
const response2 = await executeEventsHandler(params2);
|
|
9764
9748
|
LoadResponse = response2;
|
|
9765
|
-
|
|
9749
|
+
const SuccessEvent = (_a = params2.config) == null ? void 0 : _a.events.filter((e) => e.eventType === "Success");
|
|
9750
|
+
if (params2.config.returnNeeded) {
|
|
9751
|
+
return LoadResponse;
|
|
9752
|
+
}
|
|
9753
|
+
nextEvent = SuccessEvent;
|
|
9754
|
+
} catch (err) {
|
|
9755
|
+
const FailEvent = (_c = (_b = params2.config) == null ? void 0 : _b.events) == null ? void 0 : _c.filter((e) => e.eventType === "Fail");
|
|
9756
|
+
const setEvent = (FailEvent == null ? void 0 : FailEvent.length) > 0 ? FailEvent : [];
|
|
9757
|
+
nextEvent = setEvent;
|
|
9766
9758
|
}
|
|
9767
9759
|
if ((nextEvent == null ? void 0 : nextEvent.length) > 0) {
|
|
9768
9760
|
for (const actionConfig of nextEvent) {
|
|
9769
|
-
await executeEvents(
|
|
9770
|
-
}
|
|
9771
|
-
}
|
|
9772
|
-
};
|
|
9773
|
-
const executetOnLoadEvent = async (config, componentName2, store2, dynamicData2, userValue2, service2, serviceHolder2, eventGroups2, parentEventOutput2) => {
|
|
9774
|
-
try {
|
|
9775
|
-
if (!shouldEventExecute(
|
|
9776
|
-
config,
|
|
9777
|
-
componentName2,
|
|
9778
|
-
store2,
|
|
9779
|
-
dynamicData2,
|
|
9780
|
-
userValue2,
|
|
9781
|
-
service2,
|
|
9782
|
-
serviceHolder2,
|
|
9783
|
-
eventGroups2
|
|
9784
|
-
)) {
|
|
9785
|
-
return { response: void 0, events: void 0 };
|
|
9786
|
-
}
|
|
9787
|
-
const { response: response2 } = await executeEventsHandler(
|
|
9788
|
-
config,
|
|
9789
|
-
componentName2,
|
|
9790
|
-
store2,
|
|
9791
|
-
dynamicData2,
|
|
9792
|
-
userValue2,
|
|
9793
|
-
service2,
|
|
9794
|
-
serviceHolder2,
|
|
9795
|
-
eventGroups2,
|
|
9796
|
-
parentEventOutput2
|
|
9797
|
-
);
|
|
9798
|
-
if (config.returnResponse) {
|
|
9799
|
-
return { response: response2 };
|
|
9761
|
+
await executeEvents({ ...params2, config: actionConfig, parentEventOutput: LoadResponse });
|
|
9800
9762
|
}
|
|
9801
|
-
const SuccessEvent = config == null ? void 0 : config.events.filter((e) => e.eventType === "Success");
|
|
9802
|
-
const setEvent = SuccessEvent.length > 0 ? SuccessEvent : [{ Handler: "mergeFormdata", eventType: "Success", type: config.type }];
|
|
9803
|
-
return { response: response2, events: setEvent };
|
|
9804
|
-
} catch (err) {
|
|
9805
|
-
const FailEvent = config == null ? void 0 : config.events.filter((e) => e.eventType === "Fail");
|
|
9806
|
-
const setEvent = FailEvent.length > 0 ? FailEvent : [];
|
|
9807
|
-
return { response: void 0, events: setEvent };
|
|
9808
9763
|
}
|
|
9764
|
+
return LoadResponse;
|
|
9809
9765
|
};
|
|
9810
|
-
async function executeEventsHandler(
|
|
9811
|
-
if (config.Handler === "api") {
|
|
9812
|
-
return await executeApiEventHandler(
|
|
9813
|
-
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
dynamicData2,
|
|
9826
|
-
userValue2,
|
|
9827
|
-
service2,
|
|
9828
|
-
serviceHolder2,
|
|
9829
|
-
parentEventOutput2
|
|
9830
|
-
);
|
|
9831
|
-
} else if (config.Handler === "custom") {
|
|
9832
|
-
return await executeCustomHandler(
|
|
9833
|
-
config,
|
|
9834
|
-
componentName2,
|
|
9835
|
-
store2,
|
|
9836
|
-
dynamicData2,
|
|
9837
|
-
userValue2,
|
|
9838
|
-
service2,
|
|
9839
|
-
serviceHolder2,
|
|
9840
|
-
parentEventOutput2
|
|
9841
|
-
);
|
|
9842
|
-
} else if (config.Handler === "refresh") {
|
|
9843
|
-
return await executeRefreshHandler(
|
|
9844
|
-
config,
|
|
9845
|
-
componentName2,
|
|
9846
|
-
store2,
|
|
9847
|
-
dynamicData2,
|
|
9848
|
-
userValue2,
|
|
9849
|
-
service2,
|
|
9850
|
-
serviceHolder2,
|
|
9851
|
-
parentEventOutput2,
|
|
9852
|
-
eventGroups2
|
|
9766
|
+
async function executeEventsHandler(params2) {
|
|
9767
|
+
if (params2.config.Handler === "api") {
|
|
9768
|
+
return await executeApiEventHandler(params2);
|
|
9769
|
+
} else if (params2.config.Handler === "inBuiltFunction") {
|
|
9770
|
+
return await executeInBuiltFunctionHandler(params2);
|
|
9771
|
+
} else if (params2.config.Handler === "custom") {
|
|
9772
|
+
return await executeCustomHandler(params2);
|
|
9773
|
+
} else if (params2.config.Handler === "refresh") {
|
|
9774
|
+
return await executeRefreshHandler(params2);
|
|
9775
|
+
} else if (params2.config.Handler === "mergeFormdata") {
|
|
9776
|
+
return await mergeFormdata(
|
|
9777
|
+
params2.parentEventOutput,
|
|
9778
|
+
params2.componentName,
|
|
9779
|
+
params2.config,
|
|
9780
|
+
params2.store
|
|
9853
9781
|
);
|
|
9854
|
-
} else if (config.Handler === "mergeFormdata") {
|
|
9855
|
-
return await mergeFormdata(parentEventOutput2, componentName2, config, store2);
|
|
9856
9782
|
}
|
|
9857
9783
|
}
|
|
9858
|
-
async function executeRefreshHandler(
|
|
9859
|
-
const compToRefresh = getRefreshElements(
|
|
9860
|
-
for (const
|
|
9861
|
-
for (const compEventConfig of
|
|
9862
|
-
await executeEvents(
|
|
9784
|
+
async function executeRefreshHandler(params2) {
|
|
9785
|
+
const compToRefresh = getRefreshElements(params2.config, params2.eventGroups);
|
|
9786
|
+
for (const componentName of compToRefresh) {
|
|
9787
|
+
for (const compEventConfig of params2.eventGroups.onLoad[componentName]) {
|
|
9788
|
+
await executeEvents({ ...params2, config: compEventConfig });
|
|
9863
9789
|
}
|
|
9864
9790
|
}
|
|
9865
|
-
return { response: void 0, events: void 0 };
|
|
9866
9791
|
}
|
|
9867
|
-
async function executeApiEventHandler(
|
|
9868
|
-
|
|
9792
|
+
async function executeApiEventHandler(params2) {
|
|
9793
|
+
var _a;
|
|
9794
|
+
const initialBody = { ...(_a = params2.userValue) == null ? void 0 : _a.payload };
|
|
9869
9795
|
const initialHeaders = {
|
|
9870
9796
|
"X-Requested-With": "XMLHttpRequest",
|
|
9871
9797
|
"Access-Control-Allow-Origin": "*"
|
|
9872
9798
|
};
|
|
9873
|
-
const { body: body2, headers: headers2 } = await buildApiPayload(
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
apiHandlerConfig.path,
|
|
9799
|
+
const { body: body2, headers: headers2 } = await buildApiPayload(params2.config, initialBody, initialHeaders, params2.store, params2.dynamicData, params2.userValue, params2.service);
|
|
9800
|
+
const response2 = await params2.service[params2.config.method](
|
|
9801
|
+
params2.config.path,
|
|
9877
9802
|
body2,
|
|
9878
9803
|
headers2 && { headers: headers2 }
|
|
9879
9804
|
);
|
|
9880
|
-
|
|
9881
|
-
return { response: response2 };
|
|
9882
|
-
}
|
|
9883
|
-
return { response: response2, events: apiHandlerConfig == null ? void 0 : apiHandlerConfig.events };
|
|
9805
|
+
return response2;
|
|
9884
9806
|
}
|
|
9885
|
-
async function executeInBuiltFunctionHandler(
|
|
9807
|
+
async function executeInBuiltFunctionHandler(params) {
|
|
9886
9808
|
let parameter = {};
|
|
9887
|
-
if (
|
|
9888
|
-
const makeFunc = eval(
|
|
9889
|
-
parameter = makeFunc(store, dynamicData, userValue, parentEventOutput, service);
|
|
9809
|
+
if (params.config.funcParametersCode) {
|
|
9810
|
+
const makeFunc = eval(params.config.funcParametersCode);
|
|
9811
|
+
parameter = makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service);
|
|
9890
9812
|
}
|
|
9891
|
-
serviceHolder[
|
|
9892
|
-
return { response: void 0, events: refreshHandlerConfig == null ? void 0 : refreshHandlerConfig.events };
|
|
9813
|
+
params.serviceHolder[params.config.inBuiltFunctionType](parameter);
|
|
9893
9814
|
}
|
|
9894
|
-
async function executeCustomHandler(
|
|
9895
|
-
|
|
9896
|
-
const
|
|
9897
|
-
|
|
9898
|
-
return { response, events: customHandlerConfig == null ? void 0 : customHandlerConfig.events };
|
|
9815
|
+
async function executeCustomHandler(params) {
|
|
9816
|
+
const makeFunc = eval(params.config.eventCode);
|
|
9817
|
+
const response = await makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service, params.componentName);
|
|
9818
|
+
return response;
|
|
9899
9819
|
}
|
|
9900
|
-
async function mergeFormdata(handlerResponse,
|
|
9820
|
+
async function mergeFormdata(handlerResponse, componentName, eventConfig, store2) {
|
|
9901
9821
|
if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse) && handlerResponse)) {
|
|
9902
9822
|
store2.setSchema((pre) => {
|
|
9903
9823
|
return {
|
|
9904
9824
|
...pre,
|
|
9905
9825
|
properties: {
|
|
9906
9826
|
...pre.properties,
|
|
9907
|
-
[
|
|
9908
|
-
|
|
9827
|
+
[componentName]: {
|
|
9828
|
+
enum: handlerResponse.data
|
|
9909
9829
|
}
|
|
9910
9830
|
}
|
|
9911
9831
|
};
|
|
@@ -9915,11 +9835,12 @@ async function mergeFormdata(handlerResponse, componentName2, eventConfig, store
|
|
|
9915
9835
|
return { ...pre, ...handlerResponse == null ? void 0 : handlerResponse.data };
|
|
9916
9836
|
});
|
|
9917
9837
|
} else {
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9838
|
+
if (handlerResponse) {
|
|
9839
|
+
store2.setFormdata((pre) => {
|
|
9840
|
+
return { ...pre, [componentName]: handlerResponse };
|
|
9841
|
+
});
|
|
9842
|
+
}
|
|
9921
9843
|
}
|
|
9922
|
-
return { response: void 0, events: void 0 };
|
|
9923
9844
|
}
|
|
9924
9845
|
const buildBodyFormat = (body2, formData, userValue2) => {
|
|
9925
9846
|
const finalBody = { ...userValue2 == null ? void 0 : userValue2.payload };
|
|
@@ -9951,20 +9872,11 @@ const buildHeadersFormat = (headers2) => {
|
|
|
9951
9872
|
});
|
|
9952
9873
|
return headerObj;
|
|
9953
9874
|
};
|
|
9954
|
-
async function shouldEventExecute(
|
|
9955
|
-
var _a;
|
|
9956
|
-
const startEvent = (_a = config == null ? void 0 :
|
|
9875
|
+
async function shouldEventExecute(params2) {
|
|
9876
|
+
var _a, _b;
|
|
9877
|
+
const startEvent = (_b = (_a = params2.config) == null ? void 0 : _a.events) == null ? void 0 : _b.filter((e) => e.eventType === "onStart");
|
|
9957
9878
|
if ((startEvent == null ? void 0 : startEvent.length) > 0) {
|
|
9958
|
-
const { response: response2 } = await executeEventsHandler(
|
|
9959
|
-
startEvent[0],
|
|
9960
|
-
componentName2,
|
|
9961
|
-
store2,
|
|
9962
|
-
dynamicData2,
|
|
9963
|
-
userValue2,
|
|
9964
|
-
service2,
|
|
9965
|
-
serviceHolder2,
|
|
9966
|
-
eventGroups2
|
|
9967
|
-
);
|
|
9879
|
+
const { response: response2 } = await executeEventsHandler(params2);
|
|
9968
9880
|
return response2;
|
|
9969
9881
|
}
|
|
9970
9882
|
}
|
|
@@ -10013,6 +9925,7 @@ const extractEvents = (eventConfig) => {
|
|
|
10013
9925
|
function extractsConfigEvents(eventConfigObj) {
|
|
10014
9926
|
if (eventConfigObj.events) {
|
|
10015
9927
|
eventConfigObj.events.forEach((event2) => {
|
|
9928
|
+
var _a;
|
|
10016
9929
|
if (eventConfigObj.type) {
|
|
10017
9930
|
compType = eventConfigObj.type;
|
|
10018
9931
|
}
|
|
@@ -10022,6 +9935,12 @@ const extractEvents = (eventConfig) => {
|
|
|
10022
9935
|
if (!eventGroups[event2.eventType][eventConfigObj.name]) {
|
|
10023
9936
|
eventGroups[event2.eventType][eventConfigObj.name] = [];
|
|
10024
9937
|
}
|
|
9938
|
+
const SuccessEvent = (_a = event2 == null ? void 0 : event2.events) == null ? void 0 : _a.find((elem) => {
|
|
9939
|
+
return elem.eventType === "Success";
|
|
9940
|
+
});
|
|
9941
|
+
if (!!!SuccessEvent && event2.eventType === "onLoad") {
|
|
9942
|
+
event2.events.push({ Handler: "mergeFormdata", eventType: "Success", type: compType });
|
|
9943
|
+
}
|
|
10025
9944
|
eventGroups[event2.eventType][eventConfigObj.name].push({ ...event2, type: compType });
|
|
10026
9945
|
});
|
|
10027
9946
|
}
|
|
@@ -10033,21 +9952,36 @@ const extractEvents = (eventConfig) => {
|
|
|
10033
9952
|
return eventGroups;
|
|
10034
9953
|
};
|
|
10035
9954
|
var service = (funcParams) => {
|
|
9955
|
+
eventGroups = {};
|
|
9956
|
+
eventGroups = extractEvents(funcParams.config);
|
|
9957
|
+
let executeEventsParameters = {
|
|
9958
|
+
config: {},
|
|
9959
|
+
componentName: "",
|
|
9960
|
+
store: funcParams.store,
|
|
9961
|
+
dynamicData: funcParams.dynamicData,
|
|
9962
|
+
userValue: funcParams.userValue,
|
|
9963
|
+
service: funcParams.service,
|
|
9964
|
+
serviceHolder: void 0,
|
|
9965
|
+
eventGroups
|
|
9966
|
+
};
|
|
10036
9967
|
return {
|
|
10037
9968
|
setPage: async function() {
|
|
10038
9969
|
funcParams.store.setFormdata({});
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
funcParams.
|
|
10045
|
-
funcParams.
|
|
10046
|
-
|
|
10047
|
-
funcParams.service,
|
|
10048
|
-
this,
|
|
9970
|
+
executeEventsParameters = {
|
|
9971
|
+
config: {},
|
|
9972
|
+
componentName: "",
|
|
9973
|
+
store: funcParams.store,
|
|
9974
|
+
dynamicData: funcParams.dynamicData,
|
|
9975
|
+
userValue: funcParams.userValue,
|
|
9976
|
+
service: funcParams.service,
|
|
9977
|
+
serviceHolder: this,
|
|
10049
9978
|
eventGroups
|
|
10050
|
-
|
|
9979
|
+
};
|
|
9980
|
+
await executeEvents({
|
|
9981
|
+
...executeEventsParameters,
|
|
9982
|
+
config: { Handler: "refresh", eventType: "onPageRefresh" },
|
|
9983
|
+
componentName: "all"
|
|
9984
|
+
});
|
|
10051
9985
|
funcParams.store.setSchema(
|
|
10052
9986
|
(pre) => {
|
|
10053
9987
|
return {
|
|
@@ -10063,66 +9997,55 @@ var service = (funcParams) => {
|
|
|
10063
9997
|
var _a;
|
|
10064
9998
|
const path = ((_a = funcParams.dynamicData) == null ? void 0 : _a.tableButtonPath) || funcParams.dynamicData.path.split(".")[0];
|
|
10065
9999
|
for (const eventConfig of eventGroups == null ? void 0 : eventGroups.onClick[path]) {
|
|
10066
|
-
await executeEvents(
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
funcParams.userValue,
|
|
10072
|
-
funcParams.service,
|
|
10073
|
-
this,
|
|
10074
|
-
eventGroups
|
|
10075
|
-
);
|
|
10000
|
+
await executeEvents({
|
|
10001
|
+
...executeEventsParameters,
|
|
10002
|
+
config: eventConfig,
|
|
10003
|
+
componentName: path
|
|
10004
|
+
});
|
|
10076
10005
|
}
|
|
10077
10006
|
},
|
|
10078
10007
|
onPaginationChange: async (paginationValues) => {
|
|
10079
|
-
var _a;
|
|
10008
|
+
var _a, _b;
|
|
10080
10009
|
for (const eventConfig of eventGroups == null ? void 0 : eventGroups.onLoad[paginationValues.path]) {
|
|
10081
10010
|
const bodyValues = [
|
|
10082
10011
|
{ key: "size", value: paginationValues.pagination.pageSize },
|
|
10083
10012
|
{ key: "start", value: paginationValues.pagination.pageIndex * paginationValues.pagination.pageSize },
|
|
10013
|
+
{ key: "sorting", value: paginationValues.sorting || [] },
|
|
10084
10014
|
{ key: "filters", value: paginationValues.columnFilters || [] },
|
|
10085
10015
|
{ key: "globalFilter", value: (_a = paginationValues.globalFilter) != null ? _a : "" }
|
|
10086
10016
|
];
|
|
10087
10017
|
if (eventConfig.body) {
|
|
10088
|
-
eventConfig.returnResponse = true;
|
|
10089
10018
|
eventConfig.body = [
|
|
10090
10019
|
...eventConfig.body,
|
|
10091
10020
|
...bodyValues
|
|
10092
10021
|
];
|
|
10093
10022
|
} else {
|
|
10094
|
-
eventConfig.returnResponse = true;
|
|
10095
10023
|
eventConfig.body = bodyValues;
|
|
10096
10024
|
}
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
|
|
10025
|
+
const responseEvent = (_b = eventConfig == null ? void 0 : eventConfig.events) == null ? void 0 : _b.filter((elem) => {
|
|
10026
|
+
return elem.Handler !== "mergeFormdata";
|
|
10027
|
+
});
|
|
10028
|
+
eventConfig.events = responseEvent != null ? responseEvent : [];
|
|
10029
|
+
const data2 = await executeEvents({
|
|
10030
|
+
...executeEventsParameters,
|
|
10031
|
+
config: eventConfig,
|
|
10032
|
+
componentName: paginationValues.path
|
|
10033
|
+
});
|
|
10034
|
+
return data2;
|
|
10107
10035
|
}
|
|
10108
10036
|
},
|
|
10109
10037
|
onChange: async function() {
|
|
10110
10038
|
if (eventGroups.onChange) {
|
|
10111
10039
|
const ChangeEventsKeysArray = Object.keys(eventGroups.onChange);
|
|
10112
|
-
Promise.all(ChangeEventsKeysArray.map(async (
|
|
10040
|
+
Promise.all(ChangeEventsKeysArray.map(async (componentName) => {
|
|
10113
10041
|
var _a, _b;
|
|
10114
|
-
if (((_a = funcParams.store) == null ? void 0 : _a.formData[
|
|
10115
|
-
for (const eventConfig of eventGroups.onChange[
|
|
10116
|
-
await executeEvents(
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
funcParams.userValue,
|
|
10122
|
-
funcParams.service,
|
|
10123
|
-
this,
|
|
10124
|
-
eventGroups
|
|
10125
|
-
);
|
|
10042
|
+
if (((_a = funcParams.store) == null ? void 0 : _a.formData[componentName]) !== funcParams.store.newData[componentName] && ((_b = funcParams.store) == null ? void 0 : _b.newData[componentName]) !== void 0) {
|
|
10043
|
+
for (const eventConfig of eventGroups.onChange[componentName]) {
|
|
10044
|
+
await executeEvents({
|
|
10045
|
+
...executeEventsParameters,
|
|
10046
|
+
config: eventConfig,
|
|
10047
|
+
componentName
|
|
10048
|
+
});
|
|
10126
10049
|
}
|
|
10127
10050
|
}
|
|
10128
10051
|
}));
|