jsf.js_next_gen 4.0.0-RC.3 → 4.0.0-RC.30

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 (183) hide show
  1. package/dist/docs/assets/main.js +56 -52
  2. package/dist/docs/assets/style.css +23 -0
  3. package/dist/window/faces-development.js +2860 -2999
  4. package/dist/window/faces-development.js.br +0 -0
  5. package/dist/window/faces-development.js.gz +0 -0
  6. package/dist/window/faces-development.js.map +1 -1
  7. package/dist/window/faces.js +1 -1
  8. package/dist/window/faces.js.LICENSE.txt +0 -2
  9. package/dist/window/faces.js.br +0 -0
  10. package/dist/window/faces.js.gz +0 -0
  11. package/dist/window/faces.js.map +1 -1
  12. package/dist/window/jsf-development.js +2865 -3004
  13. package/dist/window/jsf-development.js.br +0 -0
  14. package/dist/window/jsf-development.js.gz +0 -0
  15. package/dist/window/jsf-development.js.map +1 -1
  16. package/dist/window/jsf.js +1 -1
  17. package/dist/window/jsf.js.LICENSE.txt +0 -2
  18. package/dist/window/jsf.js.br +0 -0
  19. package/dist/window/jsf.js.gz +0 -0
  20. package/dist/window/jsf.js.map +1 -1
  21. package/package.json +16 -16
  22. package/src/main/test.xml +23 -0
  23. package/src/main/typescript/@types/definitions/index.d.ts +12 -7
  24. package/src/main/typescript/api/_api.ts +4 -3
  25. package/src/main/typescript/impl/AjaxImpl.ts +125 -41
  26. package/src/main/typescript/impl/core/Const.ts +52 -41
  27. package/src/main/typescript/impl/util/Assertions.ts +16 -8
  28. package/src/main/typescript/impl/util/ExtDomQuery.ts +12 -4
  29. package/src/main/typescript/impl/util/HiddenInputBuilder.ts +89 -0
  30. package/src/main/typescript/impl/util/Lang.ts +9 -11
  31. package/src/main/typescript/impl/util/URLCodec.ts +71 -0
  32. package/src/main/typescript/impl/xhrCore/ErrorData.ts +15 -10
  33. package/src/main/typescript/impl/xhrCore/EventData.ts +2 -2
  34. package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +15 -1
  35. package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +69 -24
  36. package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +4 -4
  37. package/src/main/typescript/impl/xhrCore/Response.ts +55 -38
  38. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +173 -98
  39. package/src/main/typescript/impl/xhrCore/XhrFormData.ts +64 -158
  40. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +36 -21
  41. package/src/main/typescript/myfaces/OamSubmit.ts +29 -13
  42. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +1 -1
  43. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +72 -0
  44. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +40 -1
  45. package/src/main/typescript/test/impl/ImplTest.spec.ts +3 -3
  46. package/src/main/typescript/test/impl/ImplTest_23.spec.ts +3 -3
  47. package/src/main/typescript/test/xhrCore/EventTests.spec.ts +1 -1
  48. package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +2 -0
  49. package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +203 -0
  50. package/src/main/typescript/test/xhrCore/OamSubmitTest.spec.ts +177 -0
  51. package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +128 -15
  52. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +70 -3
  53. package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +39 -3
  54. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +372 -34
  55. package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +43 -9
  56. package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +67 -49
  57. package/src/main/typescript/test.xml +6 -0
  58. package/src/main/typescript/tsconfig.json +2 -2
  59. package/src/test/resources/jsf-development.js +1 -1
  60. package/src/tmp/test.html +12 -88
  61. package/target/api/_api.js +16 -29
  62. package/target/api/_api.js.map +1 -1
  63. package/target/api/faces.js +4 -4
  64. package/target/api/faces.js.map +1 -1
  65. package/target/api/jsf.js +9 -9
  66. package/target/api/jsf.js.map +1 -1
  67. package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
  68. package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
  69. package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
  70. package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
  71. package/target/impl/AjaxImpl.js +155 -89
  72. package/target/impl/AjaxImpl.js.map +1 -1
  73. package/target/impl/PushImpl.js +45 -48
  74. package/target/impl/PushImpl.js.map +1 -1
  75. package/target/impl/core/Const.js +52 -40
  76. package/target/impl/core/Const.js.map +1 -1
  77. package/target/impl/core/Context.js +10 -0
  78. package/target/impl/core/Context.js.map +1 -0
  79. package/target/impl/core/ImplTypes.js +9 -14
  80. package/target/impl/core/ImplTypes.js.map +1 -1
  81. package/target/impl/i18n/Messages.js +3 -4
  82. package/target/impl/i18n/Messages.js.map +1 -1
  83. package/target/impl/util/Assertions.js +20 -24
  84. package/target/impl/util/Assertions.js.map +1 -1
  85. package/target/impl/util/AsyncQueue.js +28 -36
  86. package/target/impl/util/AsyncQueue.js.map +1 -1
  87. package/target/impl/util/ExtDomQuery.js +153 -221
  88. package/target/impl/util/ExtDomQuery.js.map +1 -1
  89. package/target/impl/util/HiddenElementBuilder.js +7 -0
  90. package/target/impl/util/HiddenElementBuilder.js.map +1 -0
  91. package/target/impl/util/HiddenInputBuilder.js +79 -0
  92. package/target/impl/util/HiddenInputBuilder.js.map +1 -0
  93. package/target/impl/util/Lang.js +23 -32
  94. package/target/impl/util/Lang.js.map +1 -1
  95. package/target/impl/util/URLCodec.js +69 -0
  96. package/target/impl/util/URLCodec.js.map +1 -0
  97. package/target/impl/xhrCore/ErrorData.js +41 -64
  98. package/target/impl/xhrCore/ErrorData.js.map +1 -1
  99. package/target/impl/xhrCore/EventData.js +10 -13
  100. package/target/impl/xhrCore/EventData.js.map +1 -1
  101. package/target/impl/xhrCore/RequestContext.js +11 -0
  102. package/target/impl/xhrCore/RequestContext.js.map +1 -0
  103. package/target/impl/xhrCore/RequestDataResolver.js +71 -27
  104. package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
  105. package/target/impl/xhrCore/ResonseDataResolver.js +16 -16
  106. package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
  107. package/target/impl/xhrCore/Response.js +43 -28
  108. package/target/impl/xhrCore/Response.js.map +1 -1
  109. package/target/impl/xhrCore/ResponseProcessor.js +217 -162
  110. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  111. package/target/impl/xhrCore/XhrFormData.js +77 -199
  112. package/target/impl/xhrCore/XhrFormData.js.map +1 -1
  113. package/target/impl/xhrCore/XhrRequest.js +102 -103
  114. package/target/impl/xhrCore/XhrRequest.js.map +1 -1
  115. package/target/myfaces/OamSubmit.js +33 -24
  116. package/target/myfaces/OamSubmit.js.map +1 -1
  117. package/target/test/frameworkBase/LangTest.spec.js +46 -32
  118. package/target/test/frameworkBase/LangTest.spec.js.map +1 -1
  119. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +238 -228
  120. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
  121. package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js +45 -31
  122. package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js.map +1 -1
  123. package/target/test/frameworkBase/_ext/monadish/MappingProbes.js +24 -33
  124. package/target/test/frameworkBase/_ext/monadish/MappingProbes.js.map +1 -1
  125. package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js +8 -8
  126. package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js.map +1 -1
  127. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +31 -31
  128. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
  129. package/target/test/frameworkBase/_ext/monadish/StreamTest.spec.js +50 -48
  130. package/target/test/frameworkBase/_ext/monadish/StreamTest.spec.js.map +1 -1
  131. package/target/test/frameworkBase/_ext/shared/StandardInits.js +310 -132
  132. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  133. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +235 -22
  134. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
  135. package/target/test/impl/ImplTest.spec.js +32 -59
  136. package/target/test/impl/ImplTest.spec.js.map +1 -1
  137. package/target/test/impl/ImplTest_23.spec.js +32 -59
  138. package/target/test/impl/ImplTest_23.spec.js.map +1 -1
  139. package/target/test/impl/SeparatorCharsTest.spec.js +17 -17
  140. package/target/test/impl/SeparatorCharsTest.spec.js.map +1 -1
  141. package/target/test/myfaces/OamSubmit.spec.js +25 -25
  142. package/target/test/myfaces/OamSubmit.spec.js.map +1 -1
  143. package/target/test/queue/AsynchronousProbe.js +23 -29
  144. package/target/test/queue/AsynchronousProbe.js.map +1 -1
  145. package/target/test/queue/AsynchronousQueueTest.spec.js +39 -70
  146. package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
  147. package/target/test/xhrCore/EventTests.spec.js +43 -74
  148. package/target/test/xhrCore/EventTests.spec.js.map +1 -1
  149. package/target/test/xhrCore/FakeWebsocket.js +14 -16
  150. package/target/test/xhrCore/FakeWebsocket.js.map +1 -1
  151. package/target/test/xhrCore/FileUploadTest.spec.js +47 -77
  152. package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
  153. package/target/test/xhrCore/NamespacesRequestTest.spec.js +204 -0
  154. package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -0
  155. package/target/test/xhrCore/OamSubmitTest.spec.js +180 -0
  156. package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -0
  157. package/target/test/xhrCore/RequestParamsTest.spec.js +143 -72
  158. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  159. package/target/test/xhrCore/RequestTest.spec.js +173 -149
  160. package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
  161. package/target/test/xhrCore/RequestTest_23.spec.js +127 -142
  162. package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
  163. package/target/test/xhrCore/ResponseTest.spec.js +415 -100
  164. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  165. package/target/test/xhrCore/ResponseTest23.spec.js +152 -91
  166. package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
  167. package/target/test/xhrCore/ShadowDomTest.spec.js +30 -61
  168. package/target/test/xhrCore/ShadowDomTest.spec.js.map +1 -1
  169. package/target/test/xhrCore/WebsocketTest.js +60 -93
  170. package/target/test/xhrCore/WebsocketTest.js.map +1 -1
  171. package/target/test/xhrCore/XhrFormDataTest.spec.js +79 -30
  172. package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
  173. package/target/test-classes/.gz +0 -0
  174. package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
  175. package/target/test-classes/fileuploadtest.html +24 -0
  176. package/target/test-classes/jsf-development.js +3559 -0
  177. package/target/test-classes/jsf-development.js.br +0 -0
  178. package/target/test-classes/jsf-development.js.gz +0 -0
  179. package/target/test-classes/jsf-development.js.map +1 -0
  180. package/target/test-classes/jsf.js +3 -0
  181. package/target/test-classes/jsf.js.br +0 -0
  182. package/target/test-classes/jsf.js.gz +0 -0
  183. package/tmp.xml +36 -0
@@ -14,26 +14,18 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
18
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
19
- if (ar || !(i in from)) {
20
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
21
- ar[i] = from[i];
22
- }
23
- }
24
- return to.concat(ar || Array.prototype.slice.call(from));
25
- };
26
17
  Object.defineProperty(exports, "__esModule", { value: true });
27
18
  exports.ResponseProcessor = void 0;
28
- var mona_dish_1 = require("mona-dish");
29
- var AjaxImpl_1 = require("../AjaxImpl");
30
- var Assertions_1 = require("../util/Assertions");
31
- var ErrorData_1 = require("./ErrorData");
32
- var ImplTypes_1 = require("../core/ImplTypes");
33
- var EventData_1 = require("./EventData");
34
- var Const_1 = require("../core/Const");
19
+ const mona_dish_1 = require("mona-dish");
20
+ const AjaxImpl_1 = require("../AjaxImpl");
21
+ const Assertions_1 = require("../util/Assertions");
22
+ const ErrorData_1 = require("./ErrorData");
23
+ const ImplTypes_1 = require("../core/ImplTypes");
24
+ const EventData_1 = require("./EventData");
25
+ const Const_1 = require("../core/Const");
26
+ const ExtDomQuery_1 = require("../util/ExtDomQuery");
27
+ const HiddenInputBuilder_1 = require("../util/HiddenInputBuilder");
35
28
  var trim = mona_dish_1.Lang.trim;
36
- var ExtDomQuery_1 = require("../util/ExtDomQuery");
37
29
  /**
38
30
  * Response processor
39
31
  *
@@ -47,8 +39,8 @@ var ExtDomQuery_1 = require("../util/ExtDomQuery");
47
39
  * Note the response processor is stateful hence we bundle it in a class
48
40
  * to reduce code we keep references tot contexts in place
49
41
  */
50
- var ResponseProcessor = /** @class */ (function () {
51
- function ResponseProcessor(request, externalContext, internalContext) {
42
+ class ResponseProcessor {
43
+ constructor(request, externalContext, internalContext) {
52
44
  this.request = request;
53
45
  this.externalContext = externalContext;
54
46
  this.internalContext = internalContext;
@@ -58,25 +50,34 @@ var ResponseProcessor = /** @class */ (function () {
58
50
  * @param shadowDocument incoming shadow head data (aka cdata as xml reference or dom element)
59
51
  * the data incoming must represent the html representation of the head itself one way or the other
60
52
  */
61
- ResponseProcessor.prototype.replaceHead = function (shadowDocument) {
62
- var shadowHead = shadowDocument.querySelectorAll(Const_1.TAG_HEAD);
53
+ replaceHead(shadowDocument) {
54
+ const shadowHead = shadowDocument.querySelectorAll(Const_1.HTML_TAG_HEAD);
63
55
  if (!shadowHead.isPresent()) {
64
56
  return;
65
57
  }
66
- var oldHead = ExtDomQuery_1.ExtDomQuery.querySelectorAll(Const_1.TAG_HEAD);
67
- //delete all to avoid script and style overlays
68
- oldHead.querySelectorAll(Const_1.SEL_SCRIPTS_STYLES).delete();
69
- // we cannot replace new elements in the head, but we can eval the elements
70
- // eval means the scripts will get attached (eval script attach method)
71
- // but this is done by DomQuery not in this code
72
- this.storeForEval(shadowHead);
58
+ const head = ExtDomQuery_1.ExtDomQuery.querySelectorAll(Const_1.HTML_TAG_HEAD);
59
+ // full replace we delete everything
60
+ head.childNodes.delete();
61
+ this.addToHead(shadowHead);
62
+ //we copy the attributes as well (just in case myfaces introduces the id in head)
63
+ head.copyAttrs(shadowHead);
64
+ }
65
+ addToHead(shadowHead) {
66
+ const mappedHeadData = new ExtDomQuery_1.ExtDomQuery(shadowHead);
67
+ const scriptTags = [Const_1.HTML_TAG_SCRIPT];
68
+ const nonExecutables = mappedHeadData.filter(item => scriptTags.indexOf(item.tagName.orElse("").value) == -1);
69
+ nonExecutables.runHeadInserts(true);
73
70
  //incoming either the outer head tag or its children
74
- //shadowHead = (shadowHead.tagName.value === "HEAD") ? shadowHead.childNodes : shadowHead;
75
- //this.addToHead(shadowHead);
76
- };
77
- ResponseProcessor.prototype.addToHead = function (newElements) {
71
+ const nodesToAdd = (shadowHead.tagName.value === "HEAD") ? shadowHead.childNodes : shadowHead;
72
+ // this is stored for "post" processing
73
+ // after the rest of the "physical build up", head before body
74
+ const scriptElements = nodesToAdd.stream
75
+ .filter(item => scriptTags.indexOf(item.tagName.orElse("").value) != -1).collect(new mona_dish_1.DomQueryCollector());
76
+ this.addToHeadDeferred(scriptElements);
77
+ }
78
+ addToHeadDeferred(newElements) {
78
79
  this.internalContext.assign(Const_1.DEFERRED_HEAD_INSERTS).value.push(newElements);
79
- };
80
+ }
80
81
  /**
81
82
  * replaces the body in the expected manner
82
83
  * which means the entire body content is refreshed
@@ -85,327 +86,381 @@ var ResponseProcessor = /** @class */ (function () {
85
86
  *
86
87
  * @param shadowDocument .. an incoming shadow document hosting the new nodes
87
88
  */
88
- ResponseProcessor.prototype.replaceBody = function (shadowDocument) {
89
- var shadowBody = shadowDocument.querySelectorAll(Const_1.TAG_BODY);
89
+ replaceBody(shadowDocument) {
90
+ const shadowBody = shadowDocument.querySelectorAll(Const_1.HTML_TAG_BODY);
90
91
  if (!shadowBody.isPresent()) {
91
92
  return;
92
93
  }
93
- var shadowInnerHTML = shadowBody.html().value;
94
- var resultingBody = ExtDomQuery_1.ExtDomQuery.querySelectorAll(Const_1.TAG_BODY).html(shadowInnerHTML);
95
- var updateForms = resultingBody.querySelectorAll(Const_1.TAG_FORM);
94
+ const shadowInnerHTML = shadowBody.innerHTML;
95
+ const resultingBody = ExtDomQuery_1.ExtDomQuery.querySelectorAll(Const_1.HTML_TAG_BODY);
96
+ const updateForms = resultingBody.querySelectorAll(Const_1.HTML_TAG_FORM);
96
97
  // main difference, we cannot replace the body itself, but only its content
97
98
  // we need a separate step for post-processing the incoming
98
99
  // attributes, like classes, styles etc...
99
- resultingBody.copyAttrs(shadowBody);
100
+ resultingBody.html(shadowInnerHTML).copyAttrs(shadowBody);
101
+ this.externalContext.assign((0, Const_1.$nsp)(Const_1.P_RENDER_OVERRIDE)).value = "@all";
100
102
  this.storeForPostProcessing(updateForms, resultingBody);
101
- };
103
+ }
102
104
  /**
103
105
  * Leaf Tag eval... process whatever is in the eval cdata block
104
106
  *
105
107
  * @param node the node to eval
106
108
  */
107
- ResponseProcessor.prototype.eval = function (node) {
109
+ eval(node) {
108
110
  ExtDomQuery_1.ExtDomQuery.globalEval(node.cDATAAsString);
109
- };
111
+ }
110
112
  /**
111
113
  * processes an incoming error from the response
112
114
  * which is hosted under the &lt;error&gt; tag
113
115
  * @param node the node hosting the error in our response xml
114
116
  * @param node the node in the xml hosting the error message
115
117
  */
116
- ResponseProcessor.prototype.error = function (node) {
118
+ error(node) {
117
119
  /**
118
120
  * <error>
119
121
  * <error-name>String</error-name>
120
122
  * <error-message><![CDATA[message]]></error-message>
121
123
  * <error>
122
124
  */
123
- var mergedErrorData = new ExtDomQuery_1.ExtConfig({});
125
+ const mergedErrorData = new ExtDomQuery_1.ExtConfig({});
124
126
  mergedErrorData.assign(Const_1.SOURCE).value = this.externalContext.getIf(Const_1.P_PARTIAL_SOURCE).get(0).value;
125
127
  mergedErrorData.assign(Const_1.ERROR_NAME).value = node.querySelectorAll(Const_1.ERROR_NAME).textContent(Const_1.EMPTY_STR);
126
128
  mergedErrorData.assign(Const_1.ERROR_MESSAGE).value = node.querySelectorAll(Const_1.ERROR_MESSAGE).cDATAAsString;
127
- var hasResponseXML = this.internalContext.get(Const_1.RESPONSE_XML).isPresent();
129
+ const hasResponseXML = this.internalContext.get(Const_1.RESPONSE_XML).isPresent();
128
130
  //we now store the response xml also in the error data for further details
129
131
  mergedErrorData.assignIf(hasResponseXML, Const_1.RESPONSE_XML).value = this.internalContext.getIf(Const_1.RESPONSE_XML).value.get(0).value;
130
132
  // error post-processing and enrichment (standard messages from keys)
131
- var errorData = ErrorData_1.ErrorData.fromServerError(mergedErrorData);
133
+ const errorData = ErrorData_1.ErrorData.fromServerError(mergedErrorData);
132
134
  // we now trigger an internally stored onError function which might be an attached to the context
133
135
  // either we do not have an internal on error, or an on error has been based via params from the outside.
134
136
  // In both cases they are attached to our contexts
135
137
  this.triggerOnError(errorData);
136
138
  AjaxImpl_1.Implementation.sendError(errorData);
137
- };
139
+ }
138
140
  /**
139
141
  * process the redirect operation
140
142
  *
141
143
  * @param node
142
144
  */
143
- ResponseProcessor.prototype.redirect = function (node) {
145
+ redirect(node) {
144
146
  Assertions_1.Assertions.assertUrlExists(node);
145
- var redirectUrl = trim(node.attr(Const_1.ATTR_URL).value);
147
+ const redirectUrl = trim(node.attr(Const_1.ATTR_URL).value);
146
148
  if (redirectUrl != Const_1.EMPTY_STR) {
147
149
  window.location.href = redirectUrl;
148
150
  }
149
- };
151
+ }
150
152
  /**
151
153
  * processes the update operation and updates the node with the cdata block
152
154
  * @param node the xml response node hosting the update info
153
155
  * @param cdataBlock the cdata block with the new html code
154
156
  */
155
- ResponseProcessor.prototype.update = function (node, cdataBlock) {
156
- var result = ExtDomQuery_1.ExtDomQuery.byId(node.id.value, true).outerHTML(cdataBlock, false, false);
157
- var sourceForm = result === null || result === void 0 ? void 0 : result.parents(Const_1.TAG_FORM).orElseLazy(function () { return result.byTagName(Const_1.TAG_FORM, true); });
157
+ update(node, cdataBlock) {
158
+ const result = ExtDomQuery_1.ExtDomQuery.byId(node.id.value, true).outerHTML(cdataBlock, false, false);
159
+ const sourceForm = result === null || result === void 0 ? void 0 : result.firstParent(Const_1.HTML_TAG_FORM).orElseLazy(() => result.byTagName(Const_1.HTML_TAG_FORM, true));
158
160
  if (sourceForm) {
159
161
  this.storeForPostProcessing(sourceForm, result);
160
162
  }
161
- };
163
+ }
162
164
  /**
163
165
  * Delete handler, simply deletes the node referenced by the xml data
164
166
  * @param node
165
167
  */
166
- ResponseProcessor.prototype.delete = function (node) {
168
+ delete(node) {
167
169
  mona_dish_1.DQ.byId(node.id.value, true).delete();
168
- };
170
+ }
169
171
  /**
170
172
  * attributes leaf tag... process the attributes
171
173
  *
172
174
  * @param node
173
175
  */
174
- ResponseProcessor.prototype.attributes = function (node) {
175
- var elem = mona_dish_1.DQ.byId(node.id.value, true);
176
- node.byTagName(Const_1.TAG_ATTR).each(function (item) {
176
+ attributes(node) {
177
+ const elem = mona_dish_1.DQ.byId(node.id.value, true);
178
+ node.byTagName(Const_1.XML_TAG_ATTR).each((item) => {
177
179
  elem.attr(item.attr(Const_1.ATTR_NAME).value).value = item.attr(Const_1.ATTR_VALUE).value;
178
180
  });
179
- };
181
+ }
180
182
  /**
181
183
  * @param shadowDocument a shadow document which is needed for further processing
182
184
  */
183
- ResponseProcessor.prototype.replaceViewRoot = function (shadowDocument) {
185
+ replaceViewRoot(shadowDocument) {
184
186
  this.replaceHead(shadowDocument);
185
187
  this.replaceBody(shadowDocument);
186
- };
188
+ }
187
189
  /**
188
190
  * Insert handling, either before or after
189
191
  *
190
192
  * @param node
191
193
  */
192
- ResponseProcessor.prototype.insert = function (node) {
194
+ insert(node) {
193
195
  //let insertId = node.id; //not used atm
194
- var before = node.attr(Const_1.TAG_BEFORE);
195
- var after = node.attr(Const_1.TAG_AFTER);
196
- var insertNodes = mona_dish_1.DQ.fromMarkup(node.cDATAAsString);
196
+ const before = node.attr(Const_1.XML_TAG_BEFORE);
197
+ const after = node.attr(Const_1.XML_TAG_AFTER);
198
+ const insertNodes = mona_dish_1.DQ.fromMarkup(node.cDATAAsString);
197
199
  if (before.isPresent()) {
198
200
  mona_dish_1.DQ.byId(before.value, true).insertBefore(insertNodes);
199
201
  this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(insertNodes);
200
202
  }
201
203
  if (after.isPresent()) {
202
- var domQuery = mona_dish_1.DQ.byId(after.value, true);
204
+ const domQuery = mona_dish_1.DQ.byId(after.value, true);
203
205
  domQuery.insertAfter(insertNodes);
204
206
  this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(insertNodes);
205
207
  }
206
- };
208
+ }
207
209
  /**
208
210
  * Handler for the case &lt;insert <&lt; before id="...
209
211
  *
210
212
  * @param node the node hosting the insert data
211
213
  */
212
- ResponseProcessor.prototype.insertWithSubTags = function (node) {
213
- var _this = this;
214
- var before = node.querySelectorAll(Const_1.TAG_BEFORE);
215
- var after = node.querySelectorAll(Const_1.TAG_AFTER);
216
- before.each(function (item) {
217
- var insertId = item.attr(Const_1.ATTR_ID);
218
- var insertNodes = mona_dish_1.DQ.fromMarkup(item.cDATAAsString);
214
+ insertWithSubTags(node) {
215
+ const before = node.querySelectorAll(Const_1.XML_TAG_BEFORE);
216
+ const after = node.querySelectorAll(Const_1.XML_TAG_AFTER);
217
+ before.each(item => {
218
+ const insertId = item.attr(Const_1.ATTR_ID);
219
+ const insertNodes = mona_dish_1.DQ.fromMarkup(item.cDATAAsString);
219
220
  if (insertId.isPresent()) {
220
221
  mona_dish_1.DQ.byId(insertId.value, true).insertBefore(insertNodes);
221
- _this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(insertNodes);
222
+ this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(insertNodes);
222
223
  }
223
224
  });
224
- after.each(function (item) {
225
- var insertId = item.attr(Const_1.ATTR_ID);
226
- var insertNodes = mona_dish_1.DQ.fromMarkup(item.cDATAAsString);
225
+ after.each(item => {
226
+ const insertId = item.attr(Const_1.ATTR_ID);
227
+ const insertNodes = mona_dish_1.DQ.fromMarkup(item.cDATAAsString);
227
228
  if (insertId.isPresent()) {
228
229
  mona_dish_1.DQ.byId(insertId.value, true).insertAfter(insertNodes);
229
- _this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(insertNodes);
230
+ this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(insertNodes);
230
231
  }
231
232
  });
232
- };
233
+ }
233
234
  /**
234
235
  * Process the viewState update, update the affected
235
236
  * forms with their respective new viewState values
236
237
  *
237
238
  */
238
- ResponseProcessor.prototype.processViewState = function (node) {
239
+ processViewState(node) {
239
240
  if (ResponseProcessor.isViewStateNode(node)) {
240
- var state = node.cDATAAsString;
241
+ const state = node.cDATAAsString;
241
242
  this.internalContext.assign(Const_1.APPLIED_VST, node.id.value).value = new ImplTypes_1.StateHolder((0, Const_1.$nsp)(node.id.value), state);
242
243
  return true;
243
244
  }
244
245
  return false;
245
- };
246
- ResponseProcessor.prototype.processClientWindow = function (node) {
246
+ }
247
+ processClientWindow(node) {
247
248
  if (ResponseProcessor.isClientWindowNode(node)) {
248
- var state = node.cDATAAsString;
249
+ const state = node.cDATAAsString;
249
250
  this.internalContext.assign(Const_1.APPLIED_CLIENT_WINDOW, node.id.value).value = new ImplTypes_1.StateHolder((0, Const_1.$nsp)(node.id.value), state);
250
251
  return true;
251
252
  }
252
- };
253
+ }
253
254
  /**
254
255
  * generic global eval which runs the embedded css and scripts
255
256
  */
256
- ResponseProcessor.prototype.globalEval = function () {
257
+ globalEval() {
257
258
  // phase one, if we have head inserts, we build up those before going into the script eval phase
258
- var insertHeadElems = new (ExtDomQuery_1.ExtDomQuery.bind.apply(ExtDomQuery_1.ExtDomQuery, __spreadArray([void 0], this.internalContext.getIf(Const_1.DEFERRED_HEAD_INSERTS).value, false)))();
259
+ let insertHeadElems = new ExtDomQuery_1.ExtDomQuery(...this.internalContext.getIf(Const_1.DEFERRED_HEAD_INSERTS).value);
259
260
  insertHeadElems.runHeadInserts(true);
260
261
  // phase 2 we run a script eval on all updated elements in the body
261
- var updateElems = new (ExtDomQuery_1.ExtDomQuery.bind.apply(ExtDomQuery_1.ExtDomQuery, __spreadArray([void 0], this.internalContext.getIf(Const_1.UPDATE_ELEMS).value, false)))();
262
+ let updateElems = new ExtDomQuery_1.ExtDomQuery(...this.internalContext.getIf(Const_1.UPDATE_ELEMS).value);
262
263
  updateElems.runCss();
263
264
  // phase 3, we do the same for the css
264
265
  updateElems.runScripts();
265
- };
266
+ }
266
267
  /**
267
268
  * Postprocessing view state fixing
268
269
  * this appends basically the incoming view states to the forms.
269
270
  * It is called from outside after all forms have been processed basically
270
271
  * as last lifecycle step, before going into the next request.
271
272
  */
272
- ResponseProcessor.prototype.fixViewStates = function () {
273
- var _this = this;
273
+ fixViewStates() {
274
274
  mona_dish_1.Stream.ofAssoc(this.internalContext.getIf(Const_1.APPLIED_VST).orElse({}).value)
275
- .each(function (item) {
276
- var value = item[1];
277
- var nameSpace = mona_dish_1.DQ.byId(value.nameSpace, true).orElse(document.body);
278
- var affectedForms = nameSpace.byTagName(Const_1.TAG_FORM);
279
- var affectedForms2 = nameSpace.filter(function (item) { return item.tagName.orElse(Const_1.EMPTY_STR).value.toLowerCase() == Const_1.TAG_FORM; });
280
- _this.appendViewStateToForms(new mona_dish_1.DomQuery(affectedForms, affectedForms2), value.value);
275
+ .each(([, value]) => {
276
+ const namingContainerId = this.internalContext.getIf(Const_1.NAMING_CONTAINER_ID);
277
+ const namedViewRoot = !!this.internalContext.getIf(Const_1.NAMED_VIEWROOT).value;
278
+ const affectedForms = this.getContainerForms(namingContainerId)
279
+ .filter(affectedForm => this.isInExecuteOrRender(affectedForm));
280
+ this.appendViewStateToForms(affectedForms, namedViewRoot, value.value, namingContainerId.orElse("").value);
281
281
  });
282
- };
282
+ }
283
283
  /**
284
284
  * same as with view states before applies the incoming client windows as last step after the rest of the processing
285
285
  * is done.
286
286
  */
287
- ResponseProcessor.prototype.fixClientWindow = function () {
288
- var _this = this;
287
+ fixClientWindow() {
289
288
  mona_dish_1.Stream.ofAssoc(this.internalContext.getIf(Const_1.APPLIED_CLIENT_WINDOW).orElse({}).value)
290
- .each(function (item) {
291
- var value = item[1];
292
- var nameSpace = mona_dish_1.DQ.byId(value.nameSpace, true).orElse(document.body);
293
- var affectedForms = nameSpace.byTagName(Const_1.TAG_FORM);
294
- var affectedForms2 = nameSpace.filter(function (item) { return item.tagName.orElse(Const_1.EMPTY_STR).value.toLowerCase() == Const_1.TAG_FORM; });
295
- _this.appendClientWindowToForms(new mona_dish_1.DomQuery(affectedForms, affectedForms2), value.value);
289
+ .each(([, value]) => {
290
+ const namingContainerId = this.internalContext.getIf(Const_1.NAMING_CONTAINER_ID);
291
+ const namedViewRoot = !!this.internalContext.getIf(Const_1.NAMED_VIEWROOT).value;
292
+ const affectedForms = this.getContainerForms(namingContainerId)
293
+ .filter(affectedForm => this.isInExecuteOrRender(affectedForm));
294
+ this.appendClientWindowToForms(affectedForms, namedViewRoot, value.value, namingContainerId.orElse("").value);
296
295
  });
297
- };
296
+ }
297
+ updateNamedViewRootState() {
298
+ let partialId = this.internalContext.getIf(Const_1.NAMING_CONTAINER_ID);
299
+ let namedViewRoot = this.internalContext.getIf(Const_1.NAMED_VIEWROOT);
300
+ if (partialId.isPresent() &&
301
+ (namedViewRoot.isAbsent() ||
302
+ !namedViewRoot.value)) {
303
+ const SEP = (0, Const_1.$faces)().separatorchar;
304
+ 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)}']`)
305
+ .filter(node => node.attr("name").value.indexOf(partialId.value + SEP) == 0).length > 0;
306
+ }
307
+ }
298
308
  /**
299
309
  * all processing done we can close the request and send the appropriate events
300
310
  */
301
- ResponseProcessor.prototype.done = function () {
302
- var _this = this;
303
- var eventData = EventData_1.EventData.createFromRequest(this.request.value, this.externalContext, Const_1.SUCCESS);
311
+ done() {
312
+ const eventData = EventData_1.EventData.createFromRequest(this.request.value, this.externalContext, Const_1.SUCCESS);
304
313
  //because some frameworks might decorate them over the context in the response
305
- var eventHandler = this.externalContext.getIf(Const_1.ON_EVENT).orElseLazy(function () { return _this.internalContext.getIf(Const_1.ON_EVENT).value; }).orElse(Const_1.EMPTY_FUNC).value;
314
+ const eventHandler = this.externalContext.getIf(Const_1.ON_EVENT).orElseLazy(() => this.internalContext.getIf(Const_1.ON_EVENT).value).orElse(Const_1.EMPTY_FUNC).value;
306
315
  AjaxImpl_1.Implementation.sendEvent(eventData, eventHandler);
307
- };
316
+ }
308
317
  /**
309
318
  * proper viewState -> form assignment
310
319
  *
311
320
  * @param forms the forms to append the viewState to
312
321
  * @param viewState the final viewState
322
+ * @param namingContainerId
313
323
  */
314
- ResponseProcessor.prototype.appendViewStateToForms = function (forms, viewState) {
315
- this.assignState(forms, (0, Const_1.$nsp)(Const_1.SEL_VIEWSTATE_ELEM), viewState);
316
- };
324
+ appendViewStateToForms(forms, namedViewRoot, viewState, namingContainerId = "") {
325
+ this.assignState(forms, (0, Const_1.$nsp)(Const_1.SEL_VIEWSTATE_ELEM), namedViewRoot, viewState, namingContainerId);
326
+ }
317
327
  /**
318
328
  * proper clientWindow -> form assignment
319
329
  *
320
330
  * @param forms the forms to append the viewState to
321
331
  * @param clientWindow the final viewState
332
+ * @param namingContainerId
322
333
  */
323
- ResponseProcessor.prototype.appendClientWindowToForms = function (forms, clientWindow) {
324
- this.assignState(forms, (0, Const_1.$nsp)(Const_1.SEL_CLIENT_WINDOW_ELEM), clientWindow);
325
- };
334
+ appendClientWindowToForms(forms, namedViewRoot, clientWindow, namingContainerId = "") {
335
+ this.assignState(forms, (0, Const_1.$nsp)(Const_1.SEL_CLIENT_WINDOW_ELEM), namedViewRoot, clientWindow, namingContainerId);
336
+ }
326
337
  /**
327
338
  * generic append state which appends a certain state as hidden element to an existing set of forms
328
339
  *
329
340
  * @param forms the forms to append or change to
330
341
  * @param selector the selector for the state
342
+ * @param namedViewRoot if set to true, the name is also prefixed
331
343
  * @param state the state itself which needs to be assigned
332
344
  *
345
+ * @param namingContainerId
333
346
  * @private
334
347
  */
335
- ResponseProcessor.prototype.assignState = function (forms, selector, state) {
336
- forms.each(function (form) {
337
- var stateHolders = form.querySelectorAll(selector)
338
- .orElseLazy(function () { return ResponseProcessor.newViewStateElement(form); });
339
- stateHolders.attr("value").value = state;
348
+ assignState(forms, selector, namedViewRoot, state, namingContainerId) {
349
+ /**
350
+ * creates the viewState or client window id element
351
+ * @param form
352
+ */
353
+ const createAndAppendHiddenInput = (form) => {
354
+ return new HiddenInputBuilder_1.HiddenInputBuilder(selector)
355
+ .withNamingContainerId(namingContainerId)
356
+ .withParent(form)
357
+ .withNamedViewRoot(namedViewRoot)
358
+ .build();
359
+ };
360
+ forms.each(form => {
361
+ const hiddenInput = form.querySelectorAll(selector)
362
+ .orElseLazy(() => createAndAppendHiddenInput(form));
363
+ hiddenInput.val = state;
340
364
  });
341
- };
342
- /**
343
- * Helper to Create a new JSF ViewState Element
344
- *
345
- * @param parent, the parent node to attach the viewState element to
346
- * (usually a form node)
347
- */
348
- ResponseProcessor.newViewStateElement = function (parent) {
349
- var newViewState = mona_dish_1.DQ.fromMarkup((0, Const_1.$nsp)(Const_1.HTML_VIEWSTATE));
350
- newViewState.appendTo(parent);
351
- return newViewState;
352
- };
365
+ }
353
366
  /**
354
367
  * Stores certain aspects of the dom for later post-processing
355
368
  *
356
369
  * @param updateForms the update forms which should receive standardized internal jsf data
357
370
  * @param toBeEvaluated the resulting elements which should be evaluated
358
371
  */
359
- ResponseProcessor.prototype.storeForPostProcessing = function (updateForms, toBeEvaluated) {
372
+ storeForPostProcessing(updateForms, toBeEvaluated) {
360
373
  this.storeForUpdate(updateForms);
361
374
  this.storeForEval(toBeEvaluated);
362
- };
375
+ }
363
376
  /**
364
377
  * helper to store a given form for the update post-processing (viewState)
365
378
  *
366
379
  * @param updateForms the dom query object pointing to the forms which need to be updated
367
380
  */
368
- ResponseProcessor.prototype.storeForUpdate = function (updateForms) {
381
+ storeForUpdate(updateForms) {
369
382
  this.internalContext.assign(Const_1.UPDATE_FORMS).value.push(updateForms);
370
- };
383
+ }
371
384
  /**
372
385
  * same for eval (js and css)
373
386
  *
374
387
  * @param toBeEvaluated
375
388
  */
376
- ResponseProcessor.prototype.storeForEval = function (toBeEvaluated) {
389
+ storeForEval(toBeEvaluated) {
377
390
  this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(toBeEvaluated);
378
- };
391
+ }
379
392
  /**
380
393
  * check whether a given XMLQuery node is an explicit viewState node
381
394
  *
382
395
  * @param node the node to check
383
396
  * @returns if it is a viewState node
384
397
  */
385
- ResponseProcessor.isViewStateNode = function (node) {
386
- var _a, _b, _c, _d, _e, _f, _g;
387
- var separatorChar = ((_a = window === null || window === void 0 ? void 0 : window.faces) !== null && _a !== void 0 ? _a : window === null || window === void 0 ? void 0 : window.jsf).separatorchar;
388
- return "undefined" != typeof ((_b = node === null || node === void 0 ? void 0 : node.id) === null || _b === void 0 ? void 0 : _b.value) && (((_c = node === null || node === void 0 ? void 0 : node.id) === null || _c === void 0 ? void 0 : _c.value) == (0, Const_1.$nsp)(Const_1.P_VIEWSTATE) ||
389
- ((_e = (_d = node === null || node === void 0 ? void 0 : node.id) === null || _d === void 0 ? void 0 : _d.value) === null || _e === void 0 ? void 0 : _e.indexOf([separatorChar, (0, Const_1.$nsp)(Const_1.P_VIEWSTATE)].join(Const_1.EMPTY_STR))) != -1 ||
390
- ((_g = (_f = node === null || node === void 0 ? void 0 : node.id) === null || _f === void 0 ? void 0 : _f.value) === null || _g === void 0 ? void 0 : _g.indexOf([(0, Const_1.$nsp)(Const_1.P_VIEWSTATE), separatorChar].join(Const_1.EMPTY_STR))) != -1);
391
- };
398
+ static isViewStateNode(node) {
399
+ var _a, _b, _c, _d, _e, _f;
400
+ const SEP = (0, Const_1.$faces)().separatorchar;
401
+ return "undefined" != typeof ((_a = node === null || node === void 0 ? void 0 : node.id) === null || _a === void 0 ? void 0 : _a.value) && (((_b = node === null || node === void 0 ? void 0 : node.id) === null || _b === void 0 ? void 0 : _b.value) == (0, Const_1.$nsp)(Const_1.P_VIEWSTATE) ||
402
+ ((_d = (_c = node === null || node === void 0 ? void 0 : node.id) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.indexOf([SEP, (0, Const_1.$nsp)(Const_1.P_VIEWSTATE)].join(Const_1.EMPTY_STR))) != -1 ||
403
+ ((_f = (_e = node === null || node === void 0 ? void 0 : node.id) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.indexOf([(0, Const_1.$nsp)(Const_1.P_VIEWSTATE), SEP].join(Const_1.EMPTY_STR))) != -1);
404
+ }
392
405
  /**
393
406
  * incoming client window node also needs special processing
394
407
  *
395
408
  * @param node the node to check
396
409
  * @returns true of it ii
397
410
  */
398
- ResponseProcessor.isClientWindowNode = function (node) {
399
- var _a, _b, _c, _d, _e, _f, _g;
400
- var separatorChar = ((_a = window === null || window === void 0 ? void 0 : window.faces) !== null && _a !== void 0 ? _a : window === null || window === void 0 ? void 0 : window.jsf).separatorchar;
401
- return "undefined" != typeof ((_b = node === null || node === void 0 ? void 0 : node.id) === null || _b === void 0 ? void 0 : _b.value) && (((_c = node === null || node === void 0 ? void 0 : node.id) === null || _c === void 0 ? void 0 : _c.value) == (0, Const_1.$nsp)(Const_1.P_CLIENT_WINDOW) ||
402
- ((_e = (_d = node === null || node === void 0 ? void 0 : node.id) === null || _d === void 0 ? void 0 : _d.value) === null || _e === void 0 ? void 0 : _e.indexOf([separatorChar, (0, Const_1.$nsp)(Const_1.P_CLIENT_WINDOW)].join(Const_1.EMPTY_STR))) != -1 ||
403
- ((_g = (_f = node === null || node === void 0 ? void 0 : node.id) === null || _f === void 0 ? void 0 : _f.value) === null || _g === void 0 ? void 0 : _g.indexOf([(0, Const_1.$nsp)(Const_1.P_CLIENT_WINDOW), separatorChar].join(Const_1.EMPTY_STR))) != -1);
404
- };
405
- ResponseProcessor.prototype.triggerOnError = function (errorData) {
406
- this.externalContext.getIf(Const_1.ON_ERROR).orElse(this.internalContext.getIf(Const_1.ON_ERROR).value).orElse(Const_1.EMPTY_FUNC).value(errorData);
407
- };
408
- return ResponseProcessor;
409
- }());
411
+ static isClientWindowNode(node) {
412
+ var _a, _b, _c, _d, _e, _f;
413
+ const SEP = (0, Const_1.$faces)().separatorchar;
414
+ return "undefined" != typeof ((_a = node === null || node === void 0 ? void 0 : node.id) === null || _a === void 0 ? void 0 : _a.value) && (((_b = node === null || node === void 0 ? void 0 : node.id) === null || _b === void 0 ? void 0 : _b.value) == (0, Const_1.$nsp)(Const_1.P_CLIENT_WINDOW) ||
415
+ ((_d = (_c = node === null || node === void 0 ? void 0 : node.id) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.indexOf([SEP, (0, Const_1.$nsp)(Const_1.P_CLIENT_WINDOW)].join(Const_1.EMPTY_STR))) != -1 ||
416
+ ((_f = (_e = node === null || node === void 0 ? void 0 : node.id) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.indexOf([(0, Const_1.$nsp)(Const_1.P_CLIENT_WINDOW), SEP].join(Const_1.EMPTY_STR))) != -1);
417
+ }
418
+ triggerOnError(errorData) {
419
+ this.externalContext.getIf(Const_1.ON_ERROR).orElseLazy(() => this.internalContext.getIf(Const_1.ON_ERROR).value).orElse(Const_1.EMPTY_FUNC).value(errorData);
420
+ }
421
+ /**
422
+ * filters the forms according to being member of the "execute" or "render" cycle
423
+ * @param affectedForm
424
+ * @private
425
+ */
426
+ isInExecuteOrRender(affectedForm) {
427
+ const executes = this.externalContext.getIf((0, Const_1.$nsp)(Const_1.P_EXECUTE)).orElse("@none").value.split(/\s+/gi);
428
+ const renders = this.externalContext.getIf(Const_1.P_RENDER_OVERRIDE)
429
+ .orElseLazy(() => this.externalContext.getIf((0, Const_1.$nsp)(Const_1.P_RENDER)).value)
430
+ .orElse(Const_1.IDENT_NONE).value.split(/\s+/gi);
431
+ const executeAndRenders = executes.concat(...renders);
432
+ return mona_dish_1.LazyStream.of(...executeAndRenders).filter(nameOrId => {
433
+ if ([Const_1.IDENT_ALL, Const_1.IDENT_NONE].indexOf(nameOrId) != -1) {
434
+ return true;
435
+ }
436
+ const NAME_OR_ID = this.getNameOrIdSelector(nameOrId);
437
+ //either the form directly is in execute or render or one of its children or one of its parents
438
+ return affectedForm.matchesSelector(NAME_OR_ID) ||
439
+ affectedForm.querySelectorAll(NAME_OR_ID).isPresent() ||
440
+ affectedForm.firstParent(NAME_OR_ID).isPresent();
441
+ }).first().isPresent();
442
+ }
443
+ /**
444
+ * gets all forms under a single naming container id
445
+ * @param namingContainerId
446
+ * @private
447
+ */
448
+ getContainerForms(namingContainerId) {
449
+ if (namingContainerId.isPresent()) {
450
+ //naming container mode, all forms under naming container id must be processed
451
+ return (0, mona_dish_1.DQ$)(this.getNameOrIdSelector(namingContainerId.value))
452
+ // missing condition if the naming container is not present we have to
453
+ // use the body as fallback
454
+ .orElseLazy(() => mona_dish_1.DQ.byTagName(Const_1.HTML_TAG_BODY))
455
+ .byTagName(Const_1.HTML_TAG_FORM, true);
456
+ }
457
+ else {
458
+ return mona_dish_1.DQ.byTagName(Const_1.HTML_TAG_FORM);
459
+ }
460
+ }
461
+ getNameOrIdSelector(nameOrId) {
462
+ return `[id='${nameOrId}'], [name='${nameOrId}']`;
463
+ }
464
+ }
410
465
  exports.ResponseProcessor = ResponseProcessor;
411
466
  //# sourceMappingURL=ResponseProcessor.js.map