impaktapps-ui-builder 0.0.283 → 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 +225 -292
- 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 +9 -0
- package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +33 -19
- 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"]),
|
|
6929
|
+
getInputField("selectKey", "Selection Key"),
|
|
6928
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
|
}
|
|
@@ -8287,6 +8306,9 @@ const buildTable = (config, componentScope) => {
|
|
|
8287
8306
|
if (config.DragAvailable) {
|
|
8288
8307
|
table.config.main.enableDrag = config.DragAvailable === "YES" ? true : false;
|
|
8289
8308
|
}
|
|
8309
|
+
if (config.selectKey) {
|
|
8310
|
+
table.config.main.selectKey = config.selectKey;
|
|
8311
|
+
}
|
|
8290
8312
|
return table;
|
|
8291
8313
|
};
|
|
8292
8314
|
const buildLazyLoadingTable = (config, componentScope) => {
|
|
@@ -8304,6 +8326,9 @@ const buildLazyLoadingTable = (config, componentScope) => {
|
|
|
8304
8326
|
if (config.DragAvailable) {
|
|
8305
8327
|
table.config.main.enableDrag = config.DragAvailable === "YES" ? true : false;
|
|
8306
8328
|
}
|
|
8329
|
+
if (config.selectKey) {
|
|
8330
|
+
table.config.main.selectKey = config.selectKey;
|
|
8331
|
+
}
|
|
8307
8332
|
table.config.main.label = config.label;
|
|
8308
8333
|
return table;
|
|
8309
8334
|
};
|
|
@@ -8676,10 +8701,10 @@ const buildMultiSelect = (config, componentScope) => {
|
|
|
8676
8701
|
multipleSelect.config.layout = createLayoutFormat(config.layout);
|
|
8677
8702
|
}
|
|
8678
8703
|
if (config.value) {
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
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;
|
|
8683
8708
|
}
|
|
8684
8709
|
return multipleSelect;
|
|
8685
8710
|
};
|
|
@@ -9265,21 +9290,21 @@ const EventUiSchema = {
|
|
|
9265
9290
|
label: "Event Type",
|
|
9266
9291
|
type: "text",
|
|
9267
9292
|
options: [
|
|
9268
|
-
{
|
|
9269
|
-
{
|
|
9270
|
-
{
|
|
9271
|
-
{
|
|
9272
|
-
{
|
|
9273
|
-
{
|
|
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" }
|
|
9274
9299
|
]
|
|
9275
9300
|
}
|
|
9276
9301
|
}
|
|
9277
9302
|
},
|
|
9278
9303
|
getSelectField("Handler", "Handler", [
|
|
9279
|
-
{
|
|
9280
|
-
{
|
|
9281
|
-
{
|
|
9282
|
-
{
|
|
9304
|
+
{ label: "Custom", value: "custom" },
|
|
9305
|
+
{ label: "Api", value: "api" },
|
|
9306
|
+
{ label: "Inbuilt Function", value: "inBuiltFunction" },
|
|
9307
|
+
{ label: "Refresh", value: "refresh" }
|
|
9283
9308
|
])
|
|
9284
9309
|
]
|
|
9285
9310
|
},
|
|
@@ -9644,8 +9669,8 @@ var event = (store2, dynamicData2) => {
|
|
|
9644
9669
|
uiSchema.elements[1].elements[0].elements[2] = APISection;
|
|
9645
9670
|
} else if (handlerType === "inBuiltFunction") {
|
|
9646
9671
|
uiSchema.elements[1].elements[0].elements[2] = getSelectField("inBuiltFunctionType", "Function Name", [
|
|
9647
|
-
{
|
|
9648
|
-
{
|
|
9672
|
+
{ label: "RankProvider", value: "RankProvider" },
|
|
9673
|
+
{ label: "Download File", value: "downloadFile" }
|
|
9649
9674
|
]);
|
|
9650
9675
|
uiSchema.elements[1].elements[0].elements[3] = getTextArea("funcParametersCode", "Write Custom Code for Functions Parameter", true, { xs: 12, sm: 12, md: 6 });
|
|
9651
9676
|
} else if (handlerType === "refresh") {
|
|
@@ -9711,195 +9736,100 @@ const downloadFile = (obj) => {
|
|
|
9711
9736
|
URL.revokeObjectURL(url);
|
|
9712
9737
|
document.body.removeChild(link);
|
|
9713
9738
|
};
|
|
9714
|
-
const executeEvents = async (
|
|
9739
|
+
const executeEvents = async (params2) => {
|
|
9740
|
+
var _a, _b, _c;
|
|
9715
9741
|
let nextEvent = [];
|
|
9716
9742
|
let LoadResponse = null;
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
config,
|
|
9720
|
-
componentName2,
|
|
9721
|
-
store2,
|
|
9722
|
-
dynamicData2,
|
|
9723
|
-
userValue2,
|
|
9724
|
-
service2,
|
|
9725
|
-
serviceHolder2,
|
|
9726
|
-
eventGroups2,
|
|
9727
|
-
parentEventOutput2
|
|
9728
|
-
);
|
|
9729
|
-
if (config.returnResponse) {
|
|
9730
|
-
return response2;
|
|
9731
|
-
}
|
|
9732
|
-
LoadResponse = response2;
|
|
9733
|
-
nextEvent = events;
|
|
9734
|
-
} else {
|
|
9735
|
-
if (!shouldEventExecute(
|
|
9736
|
-
config,
|
|
9737
|
-
componentName2,
|
|
9738
|
-
store2,
|
|
9739
|
-
dynamicData2,
|
|
9740
|
-
userValue2,
|
|
9741
|
-
service2,
|
|
9742
|
-
serviceHolder2,
|
|
9743
|
-
eventGroups2
|
|
9744
|
-
)) {
|
|
9743
|
+
try {
|
|
9744
|
+
if (!shouldEventExecute(params2)) {
|
|
9745
9745
|
return { response: void 0, events: void 0 };
|
|
9746
9746
|
}
|
|
9747
|
-
const
|
|
9748
|
-
config,
|
|
9749
|
-
componentName2,
|
|
9750
|
-
store2,
|
|
9751
|
-
dynamicData2,
|
|
9752
|
-
userValue2,
|
|
9753
|
-
service2,
|
|
9754
|
-
serviceHolder2,
|
|
9755
|
-
eventGroups2,
|
|
9756
|
-
parentEventOutput2
|
|
9757
|
-
);
|
|
9747
|
+
const response2 = await executeEventsHandler(params2);
|
|
9758
9748
|
LoadResponse = response2;
|
|
9759
|
-
|
|
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;
|
|
9760
9758
|
}
|
|
9761
9759
|
if ((nextEvent == null ? void 0 : nextEvent.length) > 0) {
|
|
9762
9760
|
for (const actionConfig of nextEvent) {
|
|
9763
|
-
await executeEvents(
|
|
9761
|
+
await executeEvents({ ...params2, config: actionConfig, parentEventOutput: LoadResponse });
|
|
9764
9762
|
}
|
|
9765
9763
|
}
|
|
9764
|
+
return LoadResponse;
|
|
9766
9765
|
};
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
config,
|
|
9783
|
-
componentName2,
|
|
9784
|
-
store2,
|
|
9785
|
-
dynamicData2,
|
|
9786
|
-
userValue2,
|
|
9787
|
-
service2,
|
|
9788
|
-
serviceHolder2,
|
|
9789
|
-
eventGroups2,
|
|
9790
|
-
parentEventOutput2
|
|
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
|
|
9791
9781
|
);
|
|
9792
|
-
if (config.returnResponse) {
|
|
9793
|
-
return { response: response2 };
|
|
9794
|
-
}
|
|
9795
|
-
const SuccessEvent = config == null ? void 0 : config.events.filter((e) => e.eventType === "Success");
|
|
9796
|
-
const setEvent = SuccessEvent.length > 0 ? SuccessEvent : [{ Handler: "mergeFormdata", eventType: "Success", type: config.type }];
|
|
9797
|
-
return { response: response2, events: setEvent };
|
|
9798
|
-
} catch (err) {
|
|
9799
|
-
const FailEvent = config == null ? void 0 : config.events.filter((e) => e.eventType === "Fail");
|
|
9800
|
-
const setEvent = FailEvent.length > 0 ? FailEvent : [];
|
|
9801
|
-
return { response: void 0, events: setEvent };
|
|
9802
|
-
}
|
|
9803
|
-
};
|
|
9804
|
-
async function executeEventsHandler(config, componentName2, store2, dynamicData2, userValue2, service2, serviceHolder2, eventGroups2, parentEventOutput2) {
|
|
9805
|
-
if (config.Handler === "api") {
|
|
9806
|
-
return await executeApiEventHandler(
|
|
9807
|
-
config,
|
|
9808
|
-
componentName2,
|
|
9809
|
-
store2,
|
|
9810
|
-
dynamicData2,
|
|
9811
|
-
userValue2,
|
|
9812
|
-
service2
|
|
9813
|
-
);
|
|
9814
|
-
} else if (config.Handler === "inBuiltFunction") {
|
|
9815
|
-
return await executeInBuiltFunctionHandler(
|
|
9816
|
-
config,
|
|
9817
|
-
componentName2,
|
|
9818
|
-
store2,
|
|
9819
|
-
dynamicData2,
|
|
9820
|
-
userValue2,
|
|
9821
|
-
service2,
|
|
9822
|
-
serviceHolder2,
|
|
9823
|
-
parentEventOutput2
|
|
9824
|
-
);
|
|
9825
|
-
} else if (config.Handler === "custom") {
|
|
9826
|
-
return await executeCustomHandler(
|
|
9827
|
-
config,
|
|
9828
|
-
componentName2,
|
|
9829
|
-
store2,
|
|
9830
|
-
dynamicData2,
|
|
9831
|
-
userValue2,
|
|
9832
|
-
service2,
|
|
9833
|
-
serviceHolder2,
|
|
9834
|
-
parentEventOutput2
|
|
9835
|
-
);
|
|
9836
|
-
} else if (config.Handler === "refresh") {
|
|
9837
|
-
return await executeRefreshHandler(
|
|
9838
|
-
config,
|
|
9839
|
-
componentName2,
|
|
9840
|
-
store2,
|
|
9841
|
-
dynamicData2,
|
|
9842
|
-
userValue2,
|
|
9843
|
-
service2,
|
|
9844
|
-
serviceHolder2,
|
|
9845
|
-
parentEventOutput2,
|
|
9846
|
-
eventGroups2
|
|
9847
|
-
);
|
|
9848
|
-
} else if (config.Handler === "mergeFormdata") {
|
|
9849
|
-
return await mergeFormdata(parentEventOutput2, componentName2, config, store2);
|
|
9850
9782
|
}
|
|
9851
9783
|
}
|
|
9852
|
-
async function executeRefreshHandler(
|
|
9853
|
-
const compToRefresh = getRefreshElements(
|
|
9854
|
-
for (const
|
|
9855
|
-
for (const compEventConfig of
|
|
9856
|
-
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 });
|
|
9857
9789
|
}
|
|
9858
9790
|
}
|
|
9859
|
-
return { response: void 0, events: void 0 };
|
|
9860
9791
|
}
|
|
9861
|
-
async function executeApiEventHandler(
|
|
9862
|
-
|
|
9792
|
+
async function executeApiEventHandler(params2) {
|
|
9793
|
+
var _a;
|
|
9794
|
+
const initialBody = { ...(_a = params2.userValue) == null ? void 0 : _a.payload };
|
|
9863
9795
|
const initialHeaders = {
|
|
9864
9796
|
"X-Requested-With": "XMLHttpRequest",
|
|
9865
9797
|
"Access-Control-Allow-Origin": "*"
|
|
9866
9798
|
};
|
|
9867
|
-
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);
|
|
9868
9800
|
let response2;
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
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;
|
|
9878
9810
|
}
|
|
9879
|
-
async function executeInBuiltFunctionHandler(
|
|
9811
|
+
async function executeInBuiltFunctionHandler(params) {
|
|
9880
9812
|
let parameter = {};
|
|
9881
|
-
if (
|
|
9882
|
-
const makeFunc = eval(
|
|
9883
|
-
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);
|
|
9884
9816
|
}
|
|
9885
|
-
serviceHolder[
|
|
9886
|
-
return { response: void 0, events: refreshHandlerConfig == null ? void 0 : refreshHandlerConfig.events };
|
|
9817
|
+
params.serviceHolder[params.config.inBuiltFunctionType](parameter);
|
|
9887
9818
|
}
|
|
9888
|
-
async function executeCustomHandler(
|
|
9889
|
-
|
|
9890
|
-
const
|
|
9891
|
-
|
|
9892
|
-
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;
|
|
9893
9823
|
}
|
|
9894
|
-
async function mergeFormdata(handlerResponse,
|
|
9824
|
+
async function mergeFormdata(handlerResponse, componentName, eventConfig, store2) {
|
|
9895
9825
|
if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse) && handlerResponse)) {
|
|
9896
9826
|
store2.setSchema((pre) => {
|
|
9897
9827
|
return {
|
|
9898
9828
|
...pre,
|
|
9899
9829
|
properties: {
|
|
9900
9830
|
...pre.properties,
|
|
9901
|
-
[
|
|
9902
|
-
|
|
9831
|
+
[componentName]: {
|
|
9832
|
+
enum: handlerResponse.data
|
|
9903
9833
|
}
|
|
9904
9834
|
}
|
|
9905
9835
|
};
|
|
@@ -9909,11 +9839,12 @@ async function mergeFormdata(handlerResponse, componentName2, eventConfig, store
|
|
|
9909
9839
|
return { ...pre, ...handlerResponse == null ? void 0 : handlerResponse.data };
|
|
9910
9840
|
});
|
|
9911
9841
|
} else {
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
|
|
9842
|
+
if (handlerResponse) {
|
|
9843
|
+
store2.setFormdata((pre) => {
|
|
9844
|
+
return { ...pre, [componentName]: handlerResponse };
|
|
9845
|
+
});
|
|
9846
|
+
}
|
|
9915
9847
|
}
|
|
9916
|
-
return { response: void 0, events: void 0 };
|
|
9917
9848
|
}
|
|
9918
9849
|
const buildBodyFormat = (body2, formData, userValue2) => {
|
|
9919
9850
|
const finalBody = { ...userValue2 == null ? void 0 : userValue2.payload };
|
|
@@ -9945,20 +9876,11 @@ const buildHeadersFormat = (headers2) => {
|
|
|
9945
9876
|
});
|
|
9946
9877
|
return headerObj;
|
|
9947
9878
|
};
|
|
9948
|
-
async function shouldEventExecute(
|
|
9949
|
-
var _a;
|
|
9950
|
-
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");
|
|
9951
9882
|
if ((startEvent == null ? void 0 : startEvent.length) > 0) {
|
|
9952
|
-
const { response: response2 } = await executeEventsHandler(
|
|
9953
|
-
startEvent[0],
|
|
9954
|
-
componentName2,
|
|
9955
|
-
store2,
|
|
9956
|
-
dynamicData2,
|
|
9957
|
-
userValue2,
|
|
9958
|
-
service2,
|
|
9959
|
-
serviceHolder2,
|
|
9960
|
-
eventGroups2
|
|
9961
|
-
);
|
|
9883
|
+
const { response: response2 } = await executeEventsHandler(params2);
|
|
9962
9884
|
return response2;
|
|
9963
9885
|
}
|
|
9964
9886
|
}
|
|
@@ -10007,6 +9929,7 @@ const extractEvents = (eventConfig) => {
|
|
|
10007
9929
|
function extractsConfigEvents(eventConfigObj) {
|
|
10008
9930
|
if (eventConfigObj.events) {
|
|
10009
9931
|
eventConfigObj.events.forEach((event2) => {
|
|
9932
|
+
var _a;
|
|
10010
9933
|
if (eventConfigObj.type) {
|
|
10011
9934
|
compType = eventConfigObj.type;
|
|
10012
9935
|
}
|
|
@@ -10016,6 +9939,12 @@ const extractEvents = (eventConfig) => {
|
|
|
10016
9939
|
if (!eventGroups[event2.eventType][eventConfigObj.name]) {
|
|
10017
9940
|
eventGroups[event2.eventType][eventConfigObj.name] = [];
|
|
10018
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
|
+
}
|
|
10019
9948
|
eventGroups[event2.eventType][eventConfigObj.name].push({ ...event2, type: compType });
|
|
10020
9949
|
});
|
|
10021
9950
|
}
|
|
@@ -10027,21 +9956,36 @@ const extractEvents = (eventConfig) => {
|
|
|
10027
9956
|
return eventGroups;
|
|
10028
9957
|
};
|
|
10029
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
|
+
};
|
|
10030
9971
|
return {
|
|
10031
9972
|
setPage: async function() {
|
|
10032
9973
|
funcParams.store.setFormdata({});
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
funcParams.
|
|
10039
|
-
funcParams.
|
|
10040
|
-
|
|
10041
|
-
funcParams.service,
|
|
10042
|
-
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,
|
|
10043
9982
|
eventGroups
|
|
10044
|
-
|
|
9983
|
+
};
|
|
9984
|
+
await executeEvents({
|
|
9985
|
+
...executeEventsParameters,
|
|
9986
|
+
config: { Handler: "refresh", eventType: "onPageRefresh" },
|
|
9987
|
+
componentName: "all"
|
|
9988
|
+
});
|
|
10045
9989
|
funcParams.store.setSchema(
|
|
10046
9990
|
(pre) => {
|
|
10047
9991
|
return {
|
|
@@ -10057,66 +10001,55 @@ var service = (funcParams) => {
|
|
|
10057
10001
|
var _a;
|
|
10058
10002
|
const path = ((_a = funcParams.dynamicData) == null ? void 0 : _a.tableButtonPath) || funcParams.dynamicData.path.split(".")[0];
|
|
10059
10003
|
for (const eventConfig of eventGroups == null ? void 0 : eventGroups.onClick[path]) {
|
|
10060
|
-
await executeEvents(
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
funcParams.userValue,
|
|
10066
|
-
funcParams.service,
|
|
10067
|
-
this,
|
|
10068
|
-
eventGroups
|
|
10069
|
-
);
|
|
10004
|
+
await executeEvents({
|
|
10005
|
+
...executeEventsParameters,
|
|
10006
|
+
config: eventConfig,
|
|
10007
|
+
componentName: path
|
|
10008
|
+
});
|
|
10070
10009
|
}
|
|
10071
10010
|
},
|
|
10072
10011
|
onPaginationChange: async (paginationValues) => {
|
|
10073
|
-
var _a;
|
|
10012
|
+
var _a, _b;
|
|
10074
10013
|
for (const eventConfig of eventGroups == null ? void 0 : eventGroups.onLoad[paginationValues.path]) {
|
|
10075
10014
|
const bodyValues = [
|
|
10076
10015
|
{ key: "size", value: paginationValues.pagination.pageSize },
|
|
10077
10016
|
{ key: "start", value: paginationValues.pagination.pageIndex * paginationValues.pagination.pageSize },
|
|
10017
|
+
{ key: "sorting", value: paginationValues.sorting || [] },
|
|
10078
10018
|
{ key: "filters", value: paginationValues.columnFilters || [] },
|
|
10079
10019
|
{ key: "globalFilter", value: (_a = paginationValues.globalFilter) != null ? _a : "" }
|
|
10080
10020
|
];
|
|
10081
10021
|
if (eventConfig.body) {
|
|
10082
|
-
eventConfig.returnResponse = true;
|
|
10083
10022
|
eventConfig.body = [
|
|
10084
10023
|
...eventConfig.body,
|
|
10085
10024
|
...bodyValues
|
|
10086
10025
|
];
|
|
10087
10026
|
} else {
|
|
10088
|
-
eventConfig.returnResponse = true;
|
|
10089
10027
|
eventConfig.body = bodyValues;
|
|
10090
10028
|
}
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
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;
|
|
10101
10039
|
}
|
|
10102
10040
|
},
|
|
10103
10041
|
onChange: async function() {
|
|
10104
10042
|
if (eventGroups.onChange) {
|
|
10105
10043
|
const ChangeEventsKeysArray = Object.keys(eventGroups.onChange);
|
|
10106
|
-
Promise.all(ChangeEventsKeysArray.map(async (
|
|
10044
|
+
Promise.all(ChangeEventsKeysArray.map(async (componentName) => {
|
|
10107
10045
|
var _a, _b;
|
|
10108
|
-
if (((_a = funcParams.store) == null ? void 0 : _a.formData[
|
|
10109
|
-
for (const eventConfig of eventGroups.onChange[
|
|
10110
|
-
await executeEvents(
|
|
10111
|
-
|
|
10112
|
-
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
funcParams.userValue,
|
|
10116
|
-
funcParams.service,
|
|
10117
|
-
this,
|
|
10118
|
-
eventGroups
|
|
10119
|
-
);
|
|
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
|
+
});
|
|
10120
10053
|
}
|
|
10121
10054
|
}
|
|
10122
10055
|
}));
|