jsf.js_next_gen 4.0.0-RC.22 → 4.0.0-RC.24

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.
@@ -6824,6 +6824,7 @@ var Response;
6824
6824
  // doing any evaluations even on embedded scripts.
6825
6825
  // Usually this does not matter, the client window comes in almost last always anyway
6826
6826
  // we maybe drop this deferred assignment in the future, but myfaces did it until now.
6827
+ responseProcessor.updateNamedViewRootState();
6827
6828
  responseProcessor.fixViewStates();
6828
6829
  responseProcessor.fixClientWindow();
6829
6830
  responseProcessor.globalEval();
@@ -6834,19 +6835,21 @@ var Response;
6834
6835
  * highest node partial-response from there the main operations are triggered
6835
6836
  */
6836
6837
  function processPartialTag(node, responseProcessor, internalContext) {
6837
- var _a, _b;
6838
- let namedAttr = node.attr(Const_1.XML_ATTR_NAMED_VIEWROOT);
6839
- // MyFaces.
6840
- // there are two differences here on how we determine the naming container scenario
6841
- // mojarra only partial reponse identifier, and if there is none we do not have any naming container
6842
- // myfaces either uses the reponse identifier
6843
- let namedViewRoot = namedAttr.isPresent() ? namedAttr.value === "true" : false;
6844
- if (!namedAttr.isPresent() && node.id) { // defauts fallback if namedViewRoot is not set, if node id is set
6845
- // it defaults to a naming container
6846
- namedViewRoot = !((_a = document === null || document === void 0 ? void 0 : document.head) === null || _a === void 0 ? void 0 : _a.id);
6847
- }
6848
- internalContext.assignIf(Const_1.PARTIAL_ID).value = (_b = node.id) !== null && _b !== void 0 ? _b : document === null || document === void 0 ? void 0 : document.head.id; // second case mojarra
6849
- internalContext.assignIf(Const_1.NAMED_VIEWROOT).value = namedViewRoot;
6838
+ /*
6839
+ https://javaee.github.io/javaserverfaces/docs/2.2/javadocs/web-partialresponse.html#ns_xsd
6840
+ The "partial-response" element is the root of the partial response information hierarchy,
6841
+ and contains nested elements for all possible elements that can exist in the response.
6842
+ This element must have an "id" attribute whose value is the return from calling getContainerClientId()
6843
+ on the UIViewRoot to which this response pertains.
6844
+ */
6845
+ // we can determine whether we are in a naming container scenario by checking whether the passed view id is present in the page
6846
+ // under or in body as identifier
6847
+ var _a;
6848
+ let partialId = (_a = node === null || node === void 0 ? void 0 : node.id) === null || _a === void 0 ? void 0 : _a.value;
6849
+ internalContext.assignIf(!!partialId, Const_1.PARTIAL_ID).value = partialId; // second case mojarra
6850
+ // there must be at least one container viewstate element resembling the viewroot that we know
6851
+ // this is named
6852
+ responseProcessor.updateNamedViewRootState();
6850
6853
  const SEL_SUB_TAGS = [Const_1.XML_TAG_ERROR, Const_1.XML_TAG_REDIRECT, Const_1.XML_TAG_CHANGES].join(",");
6851
6854
  // now we can process the main operations
6852
6855
  node.querySelectorAll(SEL_SUB_TAGS).each((node) => {
@@ -7241,7 +7244,7 @@ class ResponseProcessor {
7241
7244
  mona_dish_1.Stream.ofAssoc(this.internalContext.getIf(Const_1.APPLIED_VST).orElse({}).value)
7242
7245
  .each(([, value]) => {
7243
7246
  const namingContainerId = this.internalContext.getIf(Const_1.PARTIAL_ID);
7244
- const namedViewRoot = !!this.internalContext.getIf(Const_1.PARTIAL_ID).value;
7247
+ const namedViewRoot = !!this.internalContext.getIf(Const_1.NAMED_VIEWROOT).value;
7245
7248
  const affectedForms = this.getContainerForms(namingContainerId)
7246
7249
  .filter(affectedForm => this.isInExecuteOrRender(affectedForm));
7247
7250
  this.appendViewStateToForms(affectedForms, namedViewRoot, value.value, namingContainerId.orElse("").value);
@@ -7261,6 +7264,17 @@ class ResponseProcessor {
7261
7264
  this.appendClientWindowToForms(affectedForms, namedViewRoot, value.value, namingContainerId.orElse("").value);
7262
7265
  });
7263
7266
  }
7267
+ updateNamedViewRootState() {
7268
+ let partialId = this.internalContext.getIf(Const_1.PARTIAL_ID);
7269
+ let namedViewRoot = this.internalContext.getIf(Const_1.NAMED_VIEWROOT);
7270
+ if (partialId.isPresent() &&
7271
+ (namedViewRoot.isAbsent() ||
7272
+ !namedViewRoot.value)) {
7273
+ const SEP = (0, Const_1.$faces)().separatorchar;
7274
+ this.internalContext.assign(Const_1.NAMED_VIEWROOT).value = (!!document.getElementById(partialId.value)) || (0, mona_dish_1.DQ$)(`input[name*='${(0, Const_1.$nsp)(Const_1.P_VIEWSTATE)}']`)
7275
+ .filter(node => node.attr("name").value.indexOf(partialId.value + SEP) == 0).length > 0;
7276
+ }
7277
+ }
7264
7278
  /**
7265
7279
  * all processing done we can close the request and send the appropriate events
7266
7280
  */
Binary file
Binary file