jsf.js_next_gen 4.0.4-beta.5 → 4.0.4-beta.6

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.
@@ -6856,16 +6856,26 @@ exports.EventData = void 0;
6856
6856
  const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
6857
6857
  const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
6858
6858
  class EventData {
6859
- static createFromRequest(request, context, /*event name*/ name) {
6859
+ static createFromRequest(request, internalContext, context, /*event name*/ name) {
6860
6860
  let eventData = new EventData();
6861
+ let internalSource = "_internal._source";
6861
6862
  eventData.type = Const_1.EVENT;
6862
6863
  eventData.status = name;
6863
- let sourceId = context.getIf(Const_1.SOURCE)
6864
- .orElseLazy(() => context.getIf(Const_1.P_AJAX_SOURCE).value)
6865
- .orElseLazy(() => context.getIf(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_AJAX_SOURCE).value)
6866
- .value;
6867
- if (sourceId) {
6868
- eventData.source = mona_dish_1.DQ.byId(sourceId, true).first().value.value;
6864
+ eventData.source = internalContext.getIf("_source", "_element").value;
6865
+ // this fixes the issue that the source element is not present anymore at done
6866
+ // at page transitions
6867
+ if (!eventData.source) {
6868
+ let sourceId = context.getIf(Const_1.SOURCE)
6869
+ .orElseLazy(() => context.getIf(Const_1.P_AJAX_SOURCE).value)
6870
+ .orElseLazy(() => context.getIf(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_AJAX_SOURCE).value)
6871
+ .value;
6872
+ if (sourceId) {
6873
+ eventData.source = mona_dish_1.DQ.byId(sourceId, true).first().value.value;
6874
+ }
6875
+ if (eventData.source) {
6876
+ //we store the event source for later references
6877
+ internalContext.assign("_source", "_element").value = eventData.source;
6878
+ }
6869
6879
  }
6870
6880
  if (name !== Const_1.BEGIN) {
6871
6881
  eventData.responseCode = request === null || request === void 0 ? void 0 : request.status;
@@ -7704,7 +7714,7 @@ class ResponseProcessor {
7704
7714
  * all processing done we can close the request and send the appropriate events
7705
7715
  */
7706
7716
  done() {
7707
- const eventData = EventData_1.EventData.createFromRequest(this.request.value, this.externalContext, Const_1.SUCCESS);
7717
+ const eventData = EventData_1.EventData.createFromRequest(this.request.value, this.internalContext, this.externalContext, Const_1.SUCCESS);
7708
7718
  //because some frameworks might decorate them over the context in the response
7709
7719
  const eventHandler = this.externalContext.getIf(Const_1.ON_EVENT).orElseLazy(() => this.internalContext.getIf(Const_1.ON_EVENT).value).orElse(Const_1.EMPTY_FUNC).value;
7710
7720
  AjaxImpl_1.Implementation.sendEvent(eventData, eventHandler);
@@ -8409,7 +8419,7 @@ class XhrRequest extends AsyncRunnable_1.AsyncRunnable {
8409
8419
  */
8410
8420
  sendEvent(evtType) {
8411
8421
  var _a;
8412
- const eventData = EventData_1.EventData.createFromRequest(this.xhrObject, this.requestContext, evtType);
8422
+ const eventData = EventData_1.EventData.createFromRequest(this.xhrObject, this.internalContext, this.requestContext, evtType);
8413
8423
  try {
8414
8424
  // User code error, we might cover
8415
8425
  // this in onError, but also we cannot swallow it.