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.
Files changed (23) hide show
  1. package/dist/impaktapps-ui-builder.es.js +225 -292
  2. package/dist/impaktapps-ui-builder.es.js.map +1 -1
  3. package/dist/impaktapps-ui-builder.umd.js +12 -12
  4. package/dist/impaktapps-ui-builder.umd.js.map +1 -1
  5. package/dist/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.d.ts +4 -4
  6. package/dist/src/impaktapps-ui-builder/builder/build/uischema/selectInputField.d.ts +1 -0
  7. package/dist/src/impaktapps-ui-builder/runtime/services/events.d.ts +2 -1
  8. package/dist/src/impaktapps-ui-builder/runtime/services/interface.d.ts +11 -0
  9. package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +1 -1
  10. package/package.json +1 -1
  11. package/src/impaktapps-ui-builder/builder/build/buildMultiSelect.ts +18 -16
  12. package/src/impaktapps-ui-builder/builder/build/buildSelect.ts +17 -14
  13. package/src/impaktapps-ui-builder/builder/build/buildTable.ts +9 -0
  14. package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +33 -19
  15. package/src/impaktapps-ui-builder/builder/build/uischema/selectInputField.ts +1 -1
  16. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +36 -36
  17. package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/uiSchema.ts +1 -1
  18. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/uiSchema.ts +10 -10
  19. package/src/impaktapps-ui-builder/builder/services/component.ts +2 -2
  20. package/src/impaktapps-ui-builder/builder/services/event.ts +2 -2
  21. package/src/impaktapps-ui-builder/runtime/services/events.ts +70 -137
  22. package/src/impaktapps-ui-builder/runtime/services/interface.ts +11 -0
  23. 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: [{ title: "Basic Template", const: 1 }],
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
- { title: "Select", const: "Select" },
6089
- { title: "Date", const: "Date" },
6090
- { title: "CheckBox", const: "CheckBox" },
6091
- { title: "Table", const: "Table" },
6092
- { title: "Lazy Loading Table", const: "LazyLoadingTable" },
6093
- { title: "Array", const: "Array" },
6094
- { title: "Container", const: "WrapperSection" },
6095
- { title: "Tabs", const: "TabSection" },
6096
- { title: "Text", const: "Text" },
6097
- { title: "Radio", const: "Radio" },
6098
- { title: "Text Area", const: "TextArea" },
6099
- { title: "Button", const: "Button" },
6100
- { title: "Card", const: "card" },
6101
- { title: "Rank", const: "Rank" },
6102
- { title: "SpeedoMeter", const: "SpeedoMeter" },
6103
- { title: "ProgressBar", const: "ProgressBar" },
6104
- { title: "Graph", const: "Graph" },
6105
- { title: "Label", const: "Box" },
6106
- { title: "Upload File", const: "UploadFile" },
6107
- { title: "Download File", const: "DownloadFile" },
6108
- { title: "Empty Box", const: "EmptyBox" },
6109
- { title: "ProgressBar Card", const: "ProgressBarCard" },
6110
- { title: "Rank Card", const: "RankCard" },
6111
- { title: "Runner Boy Progress Bar", const: "RunnerBoyProgressBar" },
6112
- { title: "Slider", const: "Slider" },
6113
- { title: "Timer", const: "Timer" },
6114
- { title: "MultipleSelect", const: "MultipleSelect" },
6115
- { title: "LeaderBoard", const: "LeaderBoard" }
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
- { title: "Extra Small", const: "xs" },
6197
- { title: "Small", const: "sm" },
6198
- { title: "Medium", const: "md" },
6199
- { title: "Large", const: "lg" }
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
- { title: "3", const: "3" },
6221
- { title: "5.5", const: "5.5" },
6222
- { title: "8", const: "8" },
6223
- { title: "12", const: "12" }
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
- { title: "URL", const: "url" },
6874
- { title: "Heading", const: "heading" }
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
- { title: "Button With Text", const: "Button" },
6883
- { title: "Button With Icon", const: "IconButton" },
6884
- { title: "Button With Icon and Text", const: "ButtonWithIconAndText" }
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
- { title: "Apply Default Style", const: "true" },
6891
- { title: "No Style", const: "false" }
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
- { title: "Bar Graph", const: "BarGraph" },
6906
- { title: "Stack Bar Graph", const: "StackBarGraph" },
6907
- { title: "Line Graph", const: "LineGraph" },
6908
- { title: "Pie Graph", const: "PieGraph" },
6909
- { title: "Horizontal Bar Graph", const: "HorizontalBarGraph" }
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
- const options = config.value.map((e) => {
8181
- return { title: e.label, const: e.value };
8182
- });
8183
- selectInputField.config.main.options = options;
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
- const options = config.value.map((e) => {
8680
- return { title: e.label, const: e.value };
8681
- });
8682
- multipleSelect.config.main.options = options != null ? options : [];
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
- { title: "Click Event", const: "onClick" },
9269
- { title: "onStart", const: "onStart" },
9270
- { title: "Load Event", const: "onLoad" },
9271
- { title: "Change Event", const: "onChange" },
9272
- { title: "Success", const: "Success" },
9273
- { title: "Fail", const: "Fail" }
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
- { title: "Custom", const: "custom" },
9280
- { title: "Api", const: "api" },
9281
- { title: "Inbuilt Function", const: "inBuiltFunction" },
9282
- { title: "Refresh", const: "refresh" }
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
- { title: "RankProvider", const: "RankProvider" },
9648
- { title: "Download File", const: "downloadFile" }
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 (config, componentName2, store2, dynamicData2, userValue2, service2, serviceHolder2, eventGroups2, parentEventOutput2) => {
9739
+ const executeEvents = async (params2) => {
9740
+ var _a, _b, _c;
9715
9741
  let nextEvent = [];
9716
9742
  let LoadResponse = null;
9717
- if (config.eventType === "onLoad") {
9718
- const { response: response2, events } = await executetOnLoadEvent(
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 { response: response2, events } = await executeEventsHandler(
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
- nextEvent = events;
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(actionConfig, componentName2, store2, dynamicData2, userValue2, service2, serviceHolder2, eventGroups2, LoadResponse);
9761
+ await executeEvents({ ...params2, config: actionConfig, parentEventOutput: LoadResponse });
9764
9762
  }
9765
9763
  }
9764
+ return LoadResponse;
9766
9765
  };
9767
- const executetOnLoadEvent = async (config, componentName2, store2, dynamicData2, userValue2, service2, serviceHolder2, eventGroups2, parentEventOutput2) => {
9768
- try {
9769
- if (!shouldEventExecute(
9770
- config,
9771
- componentName2,
9772
- store2,
9773
- dynamicData2,
9774
- userValue2,
9775
- service2,
9776
- serviceHolder2,
9777
- eventGroups2
9778
- )) {
9779
- return { response: void 0, events: void 0 };
9780
- }
9781
- const { response: response2 } = await executeEventsHandler(
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(refreshConfig, componentName2, store2, dynamicData2, userValue2, service2, serviceHolder2, parentEventOutput2, eventGroups2) {
9853
- const compToRefresh = getRefreshElements(refreshConfig, eventGroups2);
9854
- for (const componentName3 of compToRefresh) {
9855
- for (const compEventConfig of eventGroups2.onLoad[componentName3]) {
9856
- await executeEvents(compEventConfig, componentName3, store2, dynamicData2, userValue2, service2, serviceHolder2);
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(apiHandlerConfig, componentName2, store2, dynamicData2, userValue2, service2, serviceHolder2, parentEventOutput2) {
9862
- const initialBody = { ...userValue2 == null ? void 0 : userValue2.payload };
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(apiHandlerConfig, initialBody, initialHeaders, store2, dynamicData2, userValue2);
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
- response2 = await service2[apiHandlerConfig.method](
9870
- apiHandlerConfig.path,
9871
- body2,
9872
- headers2 && { headers: headers2 }
9873
- );
9874
- if (apiHandlerConfig.returnResponse) {
9875
- return { response: response2 };
9876
- }
9877
- return { response: response2, events: apiHandlerConfig == null ? void 0 : apiHandlerConfig.events };
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(refreshHandlerConfig, componentName, store, dynamicData, userValue, service, serviceHolder, parentEventOutput) {
9811
+ async function executeInBuiltFunctionHandler(params) {
9880
9812
  let parameter = {};
9881
- if (refreshHandlerConfig.funcParametersCode) {
9882
- const makeFunc = eval(refreshHandlerConfig.funcParametersCode);
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[refreshHandlerConfig.inBuiltFunctionType](parameter);
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(customHandlerConfig, componentName, store, dynamicData, userValue, service, serviceHolder, parentEventOutput) {
9889
- console.log(service);
9890
- const makeFunc = eval(customHandlerConfig.eventCode);
9891
- const response = await makeFunc(store, dynamicData, userValue, parentEventOutput, service, componentName);
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, componentName2, eventConfig, store2) {
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
- [componentName2]: {
9902
- oneOf: handlerResponse.data
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
- handlerResponse && store2.setFormdata((pre) => {
9913
- return { ...pre, [componentName2]: handlerResponse.data };
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(config, componentName2, store2, dynamicData2, userValue2, service2, serviceHolder2, eventGroups2) {
9949
- var _a;
9950
- const startEvent = (_a = config == null ? void 0 : config.events) == null ? void 0 : _a.filter((e) => e.eventType === "onStart");
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
- eventGroups = {};
10034
- eventGroups = extractEvents(funcParams.config);
10035
- await executeEvents(
10036
- { Handler: "refresh", eventType: "onPageRefresh" },
10037
- "all",
10038
- funcParams.store,
10039
- funcParams.dynamicData,
10040
- funcParams.userValue,
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
- eventConfig,
10062
- path,
10063
- funcParams.store,
10064
- funcParams.dynamicData,
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
- await executeEvents(
10092
- eventConfig,
10093
- paginationValues.path,
10094
- funcParams.store,
10095
- funcParams.dynamicData,
10096
- funcParams.userValue,
10097
- funcParams.service,
10098
- void 0,
10099
- eventGroups
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 (componentName2) => {
10044
+ Promise.all(ChangeEventsKeysArray.map(async (componentName) => {
10107
10045
  var _a, _b;
10108
- if (((_a = funcParams.store) == null ? void 0 : _a.formData[componentName2]) !== funcParams.store.newData[componentName2] && ((_b = funcParams.store) == null ? void 0 : _b.newData[componentName2]) !== void 0) {
10109
- for (const eventConfig of eventGroups.onChange[componentName2]) {
10110
- await executeEvents(
10111
- eventConfig,
10112
- componentName2,
10113
- funcParams.store,
10114
- funcParams.dynamicData,
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
  }));