impaktapps-ui-builder 0.0.284 → 0.0.285
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 +220 -293
- 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 +70 -137
- 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,100 @@ 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(
|
|
9761
|
+
await executeEvents({ ...params2, config: actionConfig, parentEventOutput: LoadResponse });
|
|
9770
9762
|
}
|
|
9771
9763
|
}
|
|
9764
|
+
return LoadResponse;
|
|
9772
9765
|
};
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
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 };
|
|
9800
|
-
}
|
|
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
|
-
}
|
|
9809
|
-
};
|
|
9810
|
-
async function executeEventsHandler(config, componentName2, store2, dynamicData2, userValue2, service2, serviceHolder2, eventGroups2, parentEventOutput2) {
|
|
9811
|
-
if (config.Handler === "api") {
|
|
9812
|
-
return await executeApiEventHandler(
|
|
9813
|
-
config,
|
|
9814
|
-
componentName2,
|
|
9815
|
-
store2,
|
|
9816
|
-
dynamicData2,
|
|
9817
|
-
userValue2,
|
|
9818
|
-
service2
|
|
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
|
|
9819
9781
|
);
|
|
9820
|
-
} else if (config.Handler === "inBuiltFunction") {
|
|
9821
|
-
return await executeInBuiltFunctionHandler(
|
|
9822
|
-
config,
|
|
9823
|
-
componentName2,
|
|
9824
|
-
store2,
|
|
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
|
|
9853
|
-
);
|
|
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(
|
|
9799
|
+
const { body: body2, headers: headers2 } = await buildApiPayload(params2.config, initialBody, initialHeaders, params2.store, params2.dynamicData, params2.userValue, params2.service);
|
|
9874
9800
|
let response2;
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
return
|
|
9801
|
+
const dataJSON = await fetch(params2.config.path, {
|
|
9802
|
+
method: "POST",
|
|
9803
|
+
headers: {
|
|
9804
|
+
"Content-Type": "application/json"
|
|
9805
|
+
},
|
|
9806
|
+
body: JSON.stringify(body2)
|
|
9807
|
+
});
|
|
9808
|
+
response2 = await dataJSON.json();
|
|
9809
|
+
return response2;
|
|
9884
9810
|
}
|
|
9885
|
-
async function executeInBuiltFunctionHandler(
|
|
9811
|
+
async function executeInBuiltFunctionHandler(params) {
|
|
9886
9812
|
let parameter = {};
|
|
9887
|
-
if (
|
|
9888
|
-
const makeFunc = eval(
|
|
9889
|
-
parameter = makeFunc(store, dynamicData, userValue, parentEventOutput, service);
|
|
9813
|
+
if (params.config.funcParametersCode) {
|
|
9814
|
+
const makeFunc = eval(params.config.funcParametersCode);
|
|
9815
|
+
parameter = makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service);
|
|
9890
9816
|
}
|
|
9891
|
-
serviceHolder[
|
|
9892
|
-
return { response: void 0, events: refreshHandlerConfig == null ? void 0 : refreshHandlerConfig.events };
|
|
9817
|
+
params.serviceHolder[params.config.inBuiltFunctionType](parameter);
|
|
9893
9818
|
}
|
|
9894
|
-
async function executeCustomHandler(
|
|
9895
|
-
|
|
9896
|
-
const
|
|
9897
|
-
|
|
9898
|
-
return { response, events: customHandlerConfig == null ? void 0 : customHandlerConfig.events };
|
|
9819
|
+
async function executeCustomHandler(params) {
|
|
9820
|
+
const makeFunc = eval(params.config.eventCode);
|
|
9821
|
+
const response = await makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service, params.componentName);
|
|
9822
|
+
return response;
|
|
9899
9823
|
}
|
|
9900
|
-
async function mergeFormdata(handlerResponse,
|
|
9824
|
+
async function mergeFormdata(handlerResponse, componentName, eventConfig, store2) {
|
|
9901
9825
|
if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse) && handlerResponse)) {
|
|
9902
9826
|
store2.setSchema((pre) => {
|
|
9903
9827
|
return {
|
|
9904
9828
|
...pre,
|
|
9905
9829
|
properties: {
|
|
9906
9830
|
...pre.properties,
|
|
9907
|
-
[
|
|
9908
|
-
|
|
9831
|
+
[componentName]: {
|
|
9832
|
+
enum: handlerResponse.data
|
|
9909
9833
|
}
|
|
9910
9834
|
}
|
|
9911
9835
|
};
|
|
@@ -9915,11 +9839,12 @@ async function mergeFormdata(handlerResponse, componentName2, eventConfig, store
|
|
|
9915
9839
|
return { ...pre, ...handlerResponse == null ? void 0 : handlerResponse.data };
|
|
9916
9840
|
});
|
|
9917
9841
|
} else {
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9842
|
+
if (handlerResponse) {
|
|
9843
|
+
store2.setFormdata((pre) => {
|
|
9844
|
+
return { ...pre, [componentName]: handlerResponse };
|
|
9845
|
+
});
|
|
9846
|
+
}
|
|
9921
9847
|
}
|
|
9922
|
-
return { response: void 0, events: void 0 };
|
|
9923
9848
|
}
|
|
9924
9849
|
const buildBodyFormat = (body2, formData, userValue2) => {
|
|
9925
9850
|
const finalBody = { ...userValue2 == null ? void 0 : userValue2.payload };
|
|
@@ -9951,20 +9876,11 @@ const buildHeadersFormat = (headers2) => {
|
|
|
9951
9876
|
});
|
|
9952
9877
|
return headerObj;
|
|
9953
9878
|
};
|
|
9954
|
-
async function shouldEventExecute(
|
|
9955
|
-
var _a;
|
|
9956
|
-
const startEvent = (_a = config == null ? void 0 :
|
|
9879
|
+
async function shouldEventExecute(params2) {
|
|
9880
|
+
var _a, _b;
|
|
9881
|
+
const startEvent = (_b = (_a = params2.config) == null ? void 0 : _a.events) == null ? void 0 : _b.filter((e) => e.eventType === "onStart");
|
|
9957
9882
|
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
|
-
);
|
|
9883
|
+
const { response: response2 } = await executeEventsHandler(params2);
|
|
9968
9884
|
return response2;
|
|
9969
9885
|
}
|
|
9970
9886
|
}
|
|
@@ -10013,6 +9929,7 @@ const extractEvents = (eventConfig) => {
|
|
|
10013
9929
|
function extractsConfigEvents(eventConfigObj) {
|
|
10014
9930
|
if (eventConfigObj.events) {
|
|
10015
9931
|
eventConfigObj.events.forEach((event2) => {
|
|
9932
|
+
var _a;
|
|
10016
9933
|
if (eventConfigObj.type) {
|
|
10017
9934
|
compType = eventConfigObj.type;
|
|
10018
9935
|
}
|
|
@@ -10022,6 +9939,12 @@ const extractEvents = (eventConfig) => {
|
|
|
10022
9939
|
if (!eventGroups[event2.eventType][eventConfigObj.name]) {
|
|
10023
9940
|
eventGroups[event2.eventType][eventConfigObj.name] = [];
|
|
10024
9941
|
}
|
|
9942
|
+
const SuccessEvent = (_a = event2 == null ? void 0 : event2.events) == null ? void 0 : _a.find((elem) => {
|
|
9943
|
+
return elem.eventType === "Success";
|
|
9944
|
+
});
|
|
9945
|
+
if (!!!SuccessEvent && event2.eventType === "onLoad") {
|
|
9946
|
+
event2.events.push({ Handler: "mergeFormdata", eventType: "Success", type: compType });
|
|
9947
|
+
}
|
|
10025
9948
|
eventGroups[event2.eventType][eventConfigObj.name].push({ ...event2, type: compType });
|
|
10026
9949
|
});
|
|
10027
9950
|
}
|
|
@@ -10033,21 +9956,36 @@ const extractEvents = (eventConfig) => {
|
|
|
10033
9956
|
return eventGroups;
|
|
10034
9957
|
};
|
|
10035
9958
|
var service = (funcParams) => {
|
|
9959
|
+
eventGroups = {};
|
|
9960
|
+
eventGroups = extractEvents(funcParams.config);
|
|
9961
|
+
let executeEventsParameters = {
|
|
9962
|
+
config: {},
|
|
9963
|
+
componentName: "",
|
|
9964
|
+
store: funcParams.store,
|
|
9965
|
+
dynamicData: funcParams.dynamicData,
|
|
9966
|
+
userValue: funcParams.userValue,
|
|
9967
|
+
service: funcParams.service,
|
|
9968
|
+
serviceHolder: void 0,
|
|
9969
|
+
eventGroups
|
|
9970
|
+
};
|
|
10036
9971
|
return {
|
|
10037
9972
|
setPage: async function() {
|
|
10038
9973
|
funcParams.store.setFormdata({});
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
funcParams.
|
|
10045
|
-
funcParams.
|
|
10046
|
-
|
|
10047
|
-
funcParams.service,
|
|
10048
|
-
this,
|
|
9974
|
+
executeEventsParameters = {
|
|
9975
|
+
config: {},
|
|
9976
|
+
componentName: "",
|
|
9977
|
+
store: funcParams.store,
|
|
9978
|
+
dynamicData: funcParams.dynamicData,
|
|
9979
|
+
userValue: funcParams.userValue,
|
|
9980
|
+
service: funcParams.service,
|
|
9981
|
+
serviceHolder: this,
|
|
10049
9982
|
eventGroups
|
|
10050
|
-
|
|
9983
|
+
};
|
|
9984
|
+
await executeEvents({
|
|
9985
|
+
...executeEventsParameters,
|
|
9986
|
+
config: { Handler: "refresh", eventType: "onPageRefresh" },
|
|
9987
|
+
componentName: "all"
|
|
9988
|
+
});
|
|
10051
9989
|
funcParams.store.setSchema(
|
|
10052
9990
|
(pre) => {
|
|
10053
9991
|
return {
|
|
@@ -10063,66 +10001,55 @@ var service = (funcParams) => {
|
|
|
10063
10001
|
var _a;
|
|
10064
10002
|
const path = ((_a = funcParams.dynamicData) == null ? void 0 : _a.tableButtonPath) || funcParams.dynamicData.path.split(".")[0];
|
|
10065
10003
|
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
|
-
);
|
|
10004
|
+
await executeEvents({
|
|
10005
|
+
...executeEventsParameters,
|
|
10006
|
+
config: eventConfig,
|
|
10007
|
+
componentName: path
|
|
10008
|
+
});
|
|
10076
10009
|
}
|
|
10077
10010
|
},
|
|
10078
10011
|
onPaginationChange: async (paginationValues) => {
|
|
10079
|
-
var _a;
|
|
10012
|
+
var _a, _b;
|
|
10080
10013
|
for (const eventConfig of eventGroups == null ? void 0 : eventGroups.onLoad[paginationValues.path]) {
|
|
10081
10014
|
const bodyValues = [
|
|
10082
10015
|
{ key: "size", value: paginationValues.pagination.pageSize },
|
|
10083
10016
|
{ key: "start", value: paginationValues.pagination.pageIndex * paginationValues.pagination.pageSize },
|
|
10017
|
+
{ key: "sorting", value: paginationValues.sorting || [] },
|
|
10084
10018
|
{ key: "filters", value: paginationValues.columnFilters || [] },
|
|
10085
10019
|
{ key: "globalFilter", value: (_a = paginationValues.globalFilter) != null ? _a : "" }
|
|
10086
10020
|
];
|
|
10087
10021
|
if (eventConfig.body) {
|
|
10088
|
-
eventConfig.returnResponse = true;
|
|
10089
10022
|
eventConfig.body = [
|
|
10090
10023
|
...eventConfig.body,
|
|
10091
10024
|
...bodyValues
|
|
10092
10025
|
];
|
|
10093
10026
|
} else {
|
|
10094
|
-
eventConfig.returnResponse = true;
|
|
10095
10027
|
eventConfig.body = bodyValues;
|
|
10096
10028
|
}
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
|
|
10029
|
+
const responseEvent = (_b = eventConfig == null ? void 0 : eventConfig.events) == null ? void 0 : _b.filter((elem) => {
|
|
10030
|
+
return elem.Handler !== "mergeFormdata";
|
|
10031
|
+
});
|
|
10032
|
+
eventConfig.events = responseEvent != null ? responseEvent : [];
|
|
10033
|
+
const data2 = await executeEvents({
|
|
10034
|
+
...executeEventsParameters,
|
|
10035
|
+
config: eventConfig,
|
|
10036
|
+
componentName: paginationValues.path
|
|
10037
|
+
});
|
|
10038
|
+
return data2;
|
|
10107
10039
|
}
|
|
10108
10040
|
},
|
|
10109
10041
|
onChange: async function() {
|
|
10110
10042
|
if (eventGroups.onChange) {
|
|
10111
10043
|
const ChangeEventsKeysArray = Object.keys(eventGroups.onChange);
|
|
10112
|
-
Promise.all(ChangeEventsKeysArray.map(async (
|
|
10044
|
+
Promise.all(ChangeEventsKeysArray.map(async (componentName) => {
|
|
10113
10045
|
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
|
-
);
|
|
10046
|
+
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) {
|
|
10047
|
+
for (const eventConfig of eventGroups.onChange[componentName]) {
|
|
10048
|
+
await executeEvents({
|
|
10049
|
+
...executeEventsParameters,
|
|
10050
|
+
config: eventConfig,
|
|
10051
|
+
componentName
|
|
10052
|
+
});
|
|
10126
10053
|
}
|
|
10127
10054
|
}
|
|
10128
10055
|
}));
|