jsf.js_next_gen 4.0.0-RC.2 → 4.0.0-RC.21

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 (130) hide show
  1. package/dist/docs/assets/main.js +56 -52
  2. package/dist/docs/assets/style.css +23 -0
  3. package/dist/docs/functions/myfaces.ab.html +2 -2
  4. package/dist/window/faces-development.js +789 -306
  5. package/dist/window/faces-development.js.br +0 -0
  6. package/dist/window/faces-development.js.gz +0 -0
  7. package/dist/window/faces-development.js.map +1 -1
  8. package/dist/window/faces.js +1 -1
  9. package/dist/window/faces.js.LICENSE.txt +0 -2
  10. package/dist/window/faces.js.br +0 -0
  11. package/dist/window/faces.js.gz +0 -0
  12. package/dist/window/faces.js.map +1 -1
  13. package/dist/window/jsf-development.js +789 -306
  14. package/dist/window/jsf-development.js.br +0 -0
  15. package/dist/window/jsf-development.js.gz +0 -0
  16. package/dist/window/jsf-development.js.map +1 -1
  17. package/dist/window/jsf.js +1 -1
  18. package/dist/window/jsf.js.LICENSE.txt +0 -2
  19. package/dist/window/jsf.js.br +0 -0
  20. package/dist/window/jsf.js.gz +0 -0
  21. package/dist/window/jsf.js.map +1 -1
  22. package/package.json +16 -16
  23. package/src/main/test.xml +23 -0
  24. package/src/main/typescript/@types/definitions/index.d.ts +19 -2
  25. package/src/main/typescript/api/_api.ts +5 -4
  26. package/src/main/typescript/impl/AjaxImpl.ts +109 -37
  27. package/src/main/typescript/impl/core/Const.ts +48 -38
  28. package/src/main/typescript/impl/util/Assertions.ts +16 -8
  29. package/src/main/typescript/impl/util/AsyncQueue.ts +1 -1
  30. package/src/main/typescript/impl/util/ExtDomQuery.ts +12 -4
  31. package/src/main/typescript/impl/util/HiddenInputBuilder.ts +78 -0
  32. package/src/main/typescript/impl/util/Lang.ts +9 -11
  33. package/src/main/typescript/impl/xhrCore/ErrorData.ts +15 -10
  34. package/src/main/typescript/impl/xhrCore/EventData.ts +2 -2
  35. package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +8 -1
  36. package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +40 -22
  37. package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +4 -4
  38. package/src/main/typescript/impl/xhrCore/Response.ts +25 -25
  39. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +157 -98
  40. package/src/main/typescript/impl/xhrCore/XhrFormData.ts +4 -2
  41. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +24 -14
  42. package/src/main/typescript/myfaces/OamSubmit.ts +29 -13
  43. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +1 -1
  44. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +72 -0
  45. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +40 -1
  46. package/src/main/typescript/test/impl/ImplTest.spec.ts +3 -3
  47. package/src/main/typescript/test/impl/ImplTest_23.spec.ts +3 -3
  48. package/src/main/typescript/test/xhrCore/EventTests.spec.ts +1 -1
  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 +116 -9
  52. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +236 -11
  53. package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +39 -3
  54. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +368 -31
  55. package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +41 -7
  56. package/src/main/typescript/test.xml +6 -0
  57. package/src/main/typescript/tsconfig.json +1 -1
  58. package/src/tmp/test.html +12 -88
  59. package/target/api/_api.js +5 -4
  60. package/target/api/_api.js.map +1 -1
  61. package/target/impl/AjaxImpl.js +97 -26
  62. package/target/impl/AjaxImpl.js.map +1 -1
  63. package/target/impl/core/Const.js +48 -37
  64. package/target/impl/core/Const.js.map +1 -1
  65. package/target/impl/core/Context.js +10 -0
  66. package/target/impl/core/Context.js.map +1 -0
  67. package/target/impl/util/Assertions.js +12 -7
  68. package/target/impl/util/Assertions.js.map +1 -1
  69. package/target/impl/util/AsyncQueue.js.map +1 -1
  70. package/target/impl/util/ExtDomQuery.js +9 -2
  71. package/target/impl/util/ExtDomQuery.js.map +1 -1
  72. package/target/impl/util/HiddenElementBuilder.js +7 -0
  73. package/target/impl/util/HiddenElementBuilder.js.map +1 -0
  74. package/target/impl/util/HiddenInputBuilder.js +69 -0
  75. package/target/impl/util/HiddenInputBuilder.js.map +1 -0
  76. package/target/impl/util/Lang.js +8 -10
  77. package/target/impl/util/Lang.js.map +1 -1
  78. package/target/impl/xhrCore/ErrorData.js +10 -8
  79. package/target/impl/xhrCore/ErrorData.js.map +1 -1
  80. package/target/impl/xhrCore/EventData.js +1 -1
  81. package/target/impl/xhrCore/EventData.js.map +1 -1
  82. package/target/impl/xhrCore/RequestContext.js +11 -0
  83. package/target/impl/xhrCore/RequestContext.js.map +1 -0
  84. package/target/impl/xhrCore/RequestDataResolver.js +34 -15
  85. package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
  86. package/target/impl/xhrCore/ResonseDataResolver.js +3 -3
  87. package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
  88. package/target/impl/xhrCore/Response.js +13 -13
  89. package/target/impl/xhrCore/Response.js.map +1 -1
  90. package/target/impl/xhrCore/ResponseProcessor.js +136 -82
  91. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  92. package/target/impl/xhrCore/XhrFormData.js +4 -2
  93. package/target/impl/xhrCore/XhrFormData.js.map +1 -1
  94. package/target/impl/xhrCore/XhrRequest.js +20 -11
  95. package/target/impl/xhrCore/XhrRequest.js.map +1 -1
  96. package/target/myfaces/OamSubmit.js +23 -14
  97. package/target/myfaces/OamSubmit.js.map +1 -1
  98. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +1 -1
  99. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
  100. package/target/test/frameworkBase/_ext/shared/StandardInits.js +63 -0
  101. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  102. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +37 -1
  103. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
  104. package/target/test/impl/ImplTest.spec.js +2 -2
  105. package/target/test/impl/ImplTest.spec.js.map +1 -1
  106. package/target/test/impl/ImplTest_23.spec.js +2 -2
  107. package/target/test/impl/ImplTest_23.spec.js.map +1 -1
  108. package/target/test/xhrCore/EventTests.spec.js +1 -1
  109. package/target/test/xhrCore/EventTests.spec.js.map +1 -1
  110. package/target/test/xhrCore/NamespacesRequestTest.spec.js +203 -0
  111. package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -0
  112. package/target/test/xhrCore/OamSubmitTest.spec.js +180 -0
  113. package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -0
  114. package/target/test/xhrCore/RequestParamsTest.spec.js +101 -4
  115. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  116. package/target/test/xhrCore/RequestTest.spec.js +212 -9
  117. package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
  118. package/target/test/xhrCore/RequestTest_23.spec.js +34 -2
  119. package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
  120. package/target/test/xhrCore/ResponseTest.spec.js +303 -22
  121. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  122. package/target/test/xhrCore/ResponseTest23.spec.js +36 -6
  123. package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
  124. package/tmp.xml +36 -0
  125. package/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +0 -4
  126. package/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +0 -4
  127. package/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst +0 -1
  128. package/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst +0 -1
  129. package/target/surefire-reports/TEST-com.example.jsfs_js_ts.JsfsJsTsApplicationTests.xml +0 -78
  130. package/target/surefire-reports/com.example.jsfs_js_ts.JsfsJsTsApplicationTests.txt +0 -7
@@ -42,7 +42,7 @@ const SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./no
42
42
  const Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
43
43
  var trim = Lang_1.Lang.trim;
44
44
  var isString = Lang_1.Lang.isString;
45
- var eIgnoreC = Lang_1.Lang.equalsIgnoreCase;
45
+ var eqi = Lang_1.Lang.equalsIgnoreCase;
46
46
  const Global_1 = __webpack_require__(/*! ./Global */ "./node_modules/mona-dish/src/main/typescript/Global.ts");
47
47
  var objToArray = Lang_1.Lang.objToArray;
48
48
  /**
@@ -340,6 +340,12 @@ class DomQuery {
340
340
  set val(value) {
341
341
  this.inputValue.value = value;
342
342
  }
343
+ get nodeId() {
344
+ return this.id.value;
345
+ }
346
+ set nodeId(value) {
347
+ this.id.value = value;
348
+ }
343
349
  get checked() {
344
350
  return Stream_1.Stream.of(...this.values).allMatch(el => !!el.checked);
345
351
  }
@@ -632,6 +638,15 @@ class DomQuery {
632
638
  return this._querySelectorAll(selector);
633
639
  }
634
640
  }
641
+ closest(selector) {
642
+ // We could merge both methods, but for now this is more readable
643
+ if (selector.indexOf("/shadow/") != -1) {
644
+ return this._closestDeep(selector);
645
+ }
646
+ else {
647
+ return this._closest(selector);
648
+ }
649
+ }
635
650
  /**
636
651
  * core byId method
637
652
  * @param id the id to search for
@@ -866,6 +881,30 @@ class DomQuery {
866
881
  });
867
882
  return this;
868
883
  }
884
+ /**
885
+ * replace convenience function, replaces one or more elements with
886
+ * a set of elements passed as DomQuery
887
+ * @param toReplace the replaced nodes as reference (original node has been replaced)
888
+ */
889
+ replace(toReplace) {
890
+ this.each(item => {
891
+ let asElem = item.getAsElem(0).value;
892
+ let parent = asElem.parentElement;
893
+ let nextElement = asElem.nextElementSibling;
894
+ let previousElement = asElem.previousElementSibling;
895
+ if (nextElement != null) {
896
+ new DomQuery(nextElement).insertBefore(toReplace);
897
+ }
898
+ else if (previousElement) {
899
+ new DomQuery(previousElement).insertAfter(toReplace);
900
+ }
901
+ else {
902
+ new DomQuery(parent).append(toReplace);
903
+ }
904
+ item.delete();
905
+ });
906
+ return toReplace;
907
+ }
869
908
  /**
870
909
  * returns a new dom query containing only the first element max
871
910
  *
@@ -1049,28 +1088,57 @@ class DomQuery {
1049
1088
  return new DomQuery(func());
1050
1089
  }
1051
1090
  }
1052
- parents(tagName) {
1053
- const retSet = new Set();
1054
- const retArr = [];
1055
- const lowerTagName = tagName.toLowerCase();
1056
- let resolveItem = (item) => {
1057
- if ((item.tagName || "").toLowerCase() == lowerTagName && !retSet.has(item)) {
1058
- retSet.add(item);
1059
- retArr.push(item);
1091
+ /**
1092
+ * find all parents in the hierarchy for which the selector matches
1093
+ * @param selector
1094
+ */
1095
+ allParents(selector) {
1096
+ let parent = this.parent();
1097
+ let ret = [];
1098
+ while (parent.isPresent()) {
1099
+ if (parent.matchesSelector(selector)) {
1100
+ ret.push(parent);
1060
1101
  }
1061
- };
1102
+ parent = parent.parent();
1103
+ }
1104
+ return new DomQuery(...ret);
1105
+ }
1106
+ /**
1107
+ * finds the first parent in the hierarchy for which the selector matches
1108
+ * @param selector
1109
+ */
1110
+ firstParent(selector) {
1111
+ let parent = this.parent();
1112
+ while (parent.isPresent()) {
1113
+ if (parent.matchesSelector(selector)) {
1114
+ return parent;
1115
+ }
1116
+ parent = parent.parent();
1117
+ }
1118
+ return DomQuery.absent;
1119
+ }
1120
+ /**
1121
+ * fetches all parents as long as the filter criterium matches
1122
+ * @param selector
1123
+ */
1124
+ parentsWhileMatch(selector) {
1125
+ const retArr = [];
1126
+ let parent = this.parent().filter(item => item.matchesSelector(selector));
1127
+ while (parent.isPresent()) {
1128
+ retArr.push(parent);
1129
+ parent = parent.parent().filter(item => item.matchesSelector(selector));
1130
+ }
1131
+ return new DomQuery(...retArr);
1132
+ }
1133
+ parent() {
1134
+ let ret = [];
1062
1135
  this.eachElem((item) => {
1063
- var _a;
1064
- while (item.parentNode || item.host) {
1065
- item = (_a = item === null || item === void 0 ? void 0 : item.parentNode) !== null && _a !== void 0 ? _a : item === null || item === void 0 ? void 0 : item.host;
1066
- resolveItem(item);
1067
- // nested forms not possible, performance shortcut
1068
- if (tagName == "form" && retArr.length) {
1069
- return false;
1070
- }
1136
+ let parent = item.parentNode || item.host || item.shadowRoot;
1137
+ if (parent && ret.indexOf(parent) == -1) {
1138
+ ret.push(parent);
1071
1139
  }
1072
1140
  });
1073
- return new DomQuery(...retArr);
1141
+ return new DomQuery(...ret);
1074
1142
  }
1075
1143
  copyAttrs(sourceItem) {
1076
1144
  sourceItem.eachElem((sourceNode) => {
@@ -1184,7 +1252,7 @@ class DomQuery {
1184
1252
  let tagName = item.tagName;
1185
1253
  let itemType = ((_a = item === null || item === void 0 ? void 0 : item.type) !== null && _a !== void 0 ? _a : '').toLowerCase();
1186
1254
  if (tagName &&
1187
- eIgnoreC(tagName, "script") &&
1255
+ eqi(tagName, "script") &&
1188
1256
  allowedItemTypes.indexOf(itemType) != -1) {
1189
1257
  let src = item.getAttribute('src');
1190
1258
  if ('undefined' != typeof src
@@ -1270,36 +1338,30 @@ class DomQuery {
1270
1338
  return this;
1271
1339
  }
1272
1340
  runCss() {
1273
- const applyStyle = (item, style) => {
1274
- var _a, _b, _c, _d;
1275
- let newSS = document.createElement("style");
1276
- document.getElementsByTagName("head")[0].appendChild(newSS);
1277
- let styleSheet = (_a = newSS.sheet) !== null && _a !== void 0 ? _a : newSS.styleSheet;
1278
- newSS.setAttribute("rel", (_b = item.getAttribute("rel")) !== null && _b !== void 0 ? _b : "stylesheet");
1279
- newSS.setAttribute("type", (_c = item.getAttribute("type")) !== null && _c !== void 0 ? _c : "text/css");
1280
- if ((_d = styleSheet === null || styleSheet === void 0 ? void 0 : styleSheet.cssText) !== null && _d !== void 0 ? _d : false) {
1281
- styleSheet.cssText = style;
1282
- }
1283
- else {
1284
- newSS.appendChild(document.createTextNode(style));
1285
- }
1286
- }, execCss = (item) => {
1287
- const tagName = item.tagName;
1288
- if (tagName && eIgnoreC(tagName, "link") && eIgnoreC(item.getAttribute("type"), "text/css")) {
1289
- applyStyle(item, "@import url('" + item.getAttribute("href") + "');");
1290
- }
1291
- else if (tagName && eIgnoreC(tagName, "style") && eIgnoreC(item.getAttribute("type"), "text/css")) {
1292
- let innerText = [];
1293
- // compliant browsers know child nodes
1294
- let childNodes = Array.prototype.slice.call(item.childNodes);
1295
- if (childNodes) {
1296
- childNodes.forEach(child => innerText.push(child.innerHTML || child.data));
1297
- // non-compliant elements innerHTML
1341
+ const execCss = (toReplace) => {
1342
+ const _toReplace = DomQuery.byId(toReplace);
1343
+ const tagName = _toReplace.tagName.orElse("").value;
1344
+ const head = DomQuery.byTagName("head");
1345
+ if (tagName && eqi(tagName, "link") && eqi(toReplace.getAttribute("rel"), "stylesheet")) {
1346
+ const rel = toReplace.getAttribute("rel");
1347
+ //if possible we are now replacing the existing elements where we reference this stylesheet
1348
+ const matches = head.querySelectorAll(`link[rel='stylesheet'][href='${rel}']`);
1349
+ if (matches.length) {
1350
+ matches.replace(_toReplace);
1351
+ }
1352
+ else {
1353
+ head.append(_toReplace);
1298
1354
  }
1299
- else if (item.innerHTML) {
1300
- innerText.push(item.innerHTML);
1355
+ }
1356
+ else if (tagName && eqi(tagName, "style")) {
1357
+ let innerText = _toReplace.innerHTML.replace(/\s+/gi, "");
1358
+ let styles = head.querySelectorAll("style");
1359
+ styles = styles.stream.filter(style => {
1360
+ return style.innerHTML.replace(/\s+/gi, "") == innerText;
1361
+ }).collect(new DomQueryCollector());
1362
+ if (!styles.length) { //already present
1363
+ head.append(_toReplace);
1301
1364
  }
1302
- applyStyle(item, innerText.join(""));
1303
1365
  }
1304
1366
  };
1305
1367
  const scriptElements = new DomQuery(this.filterSelector("link, style"), this.querySelectorAll("link, style"));
@@ -1480,12 +1542,17 @@ class DomQuery {
1480
1542
  elemType != ALLOWED_SUBMITTABLE_ELEMENTS.SUBMIT &&
1481
1543
  elemType != ALLOWED_SUBMITTABLE_ELEMENTS.IMAGE) && ((elemType != ALLOWED_SUBMITTABLE_ELEMENTS.CHECKBOX && elemType != ALLOWED_SUBMITTABLE_ELEMENTS.RADIO) ||
1482
1544
  element.checked)) {
1483
- let files = (_b = (_a = element.value.value) === null || _a === void 0 ? void 0 : _a.files) !== null && _b !== void 0 ? _b : [];
1484
- if (files === null || files === void 0 ? void 0 : files.length) {
1485
- // xhr level2
1486
- target.append(name).value = files[0];
1545
+ let uploadedFiles = (_b = (_a = element.value) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.files;
1546
+ let filesArr = uploadedFiles !== null && uploadedFiles !== void 0 ? uploadedFiles : [];
1547
+ if (filesArr === null || filesArr === void 0 ? void 0 : filesArr.length) { //files can be empty but set
1548
+ // xhr level2, single multiple must be passes as they are
1549
+ target.assign(name).value = Array.from(filesArr);
1487
1550
  }
1488
1551
  else {
1552
+ if (!!uploadedFiles) { //we skip empty file elements i
1553
+ return;
1554
+ }
1555
+ //checkboxes etc.. need to be appended
1489
1556
  target.append(name).value = element.inputValue.value;
1490
1557
  }
1491
1558
  }
@@ -1730,6 +1797,47 @@ class DomQuery {
1730
1797
  }
1731
1798
  return foundNodes;
1732
1799
  }
1800
+ /**
1801
+ * query selector all on the existing dom queryX object
1802
+ *
1803
+ * @param selector the standard selector
1804
+ * @return a DomQuery with the results
1805
+ */
1806
+ _closest(selector) {
1807
+ var _a, _b;
1808
+ if (!((_a = this === null || this === void 0 ? void 0 : this.rootNode) === null || _a === void 0 ? void 0 : _a.length)) {
1809
+ return this;
1810
+ }
1811
+ let nodes = [];
1812
+ for (let cnt = 0; cnt < this.rootNode.length; cnt++) {
1813
+ if (!((_b = this.rootNode[cnt]) === null || _b === void 0 ? void 0 : _b.closest)) {
1814
+ continue;
1815
+ }
1816
+ let res = [this.rootNode[cnt].closest(selector)];
1817
+ nodes = nodes.concat(...res);
1818
+ }
1819
+ return new DomQuery(...nodes);
1820
+ }
1821
+ /*deep with a selector and a pseudo /shadow/ marker to break into the next level*/
1822
+ _closestDeep(selector) {
1823
+ var _a;
1824
+ if (!((_a = this === null || this === void 0 ? void 0 : this.rootNode) === null || _a === void 0 ? void 0 : _a.length)) {
1825
+ return this;
1826
+ }
1827
+ let foundNodes = new DomQuery(...this.rootNode);
1828
+ let selectors = selector.split(/\/shadow\//);
1829
+ for (let cnt2 = 0; cnt2 < selectors.length; cnt2++) {
1830
+ if (selectors[cnt2] == "") {
1831
+ continue;
1832
+ }
1833
+ let levelSelector = selectors[cnt2];
1834
+ foundNodes = foundNodes.closest(levelSelector);
1835
+ if (cnt2 < selectors.length - 1) {
1836
+ foundNodes = foundNodes.shadowRoot;
1837
+ }
1838
+ }
1839
+ return foundNodes;
1840
+ }
1733
1841
  // source: https:// developer.mozilla.org/en-US/docs/Web/API/Element/matches
1734
1842
  // code snippet license: https:// creativecommons.org/licenses/by-sa/2.5/
1735
1843
  /**
@@ -2134,7 +2242,7 @@ var Lang;
2134
2242
  * limitations under the License.
2135
2243
  */
2136
2244
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2137
- exports.Config = exports.ValueEmbedder = exports.Optional = exports.Monad = void 0;
2245
+ exports.Config = exports.CONFIG_ANY = exports.CONFIG_VALUE = exports.ValueEmbedder = exports.Optional = exports.Monad = void 0;
2138
2246
  /**
2139
2247
  * A module which keeps basic monadish like definitions in place without any sidedependencies to other modules.
2140
2248
  * Useful if you need the functions in another library to keep its dependencies down
@@ -2250,6 +2358,7 @@ class Optional extends Monad {
2250
2358
  * capabilites, unfortunately typesceript does not allow to have its own elvis operator
2251
2359
  * this is some syntactic sugar however which is quite useful*/
2252
2360
  getIf(...key) {
2361
+ key = this.preprocessKeys(...key);
2253
2362
  let currentPos = this;
2254
2363
  for (let cnt = 0; cnt < key.length; cnt++) {
2255
2364
  let currKey = this.keyVal(key[cnt]);
@@ -2378,6 +2487,23 @@ class Optional extends Monad {
2378
2487
  return Optional.absent;
2379
2488
  }
2380
2489
  }
2490
+ preprocessKeys(...keys) {
2491
+ return Stream_1.Stream.of(...keys)
2492
+ .flatMap(item => {
2493
+ return Stream_1.Stream.of(...item.split(/\]\s*\[/gi))
2494
+ .map(item => {
2495
+ item = item.replace(/^\s+|\s+$/g, "");
2496
+ if (item.indexOf("[") == -1 && item.indexOf("]") != -1) {
2497
+ item = "[" + item;
2498
+ }
2499
+ if (item.indexOf("]") == -1 && item.indexOf("[") != -1) {
2500
+ item = item + "]";
2501
+ }
2502
+ return item;
2503
+ });
2504
+ })
2505
+ .collect(new SourcesCollectors_1.ArrayCollector());
2506
+ }
2381
2507
  }
2382
2508
  exports.Optional = Optional;
2383
2509
  /*default value for absent*/
@@ -2469,6 +2595,9 @@ class ConfigEntry extends ValueEmbedder {
2469
2595
  }
2470
2596
  /*default value for absent*/
2471
2597
  ConfigEntry.absent = ConfigEntry.fromNullable(null);
2598
+ exports.CONFIG_VALUE = "__END_POINT__";
2599
+ exports.CONFIG_ANY = "__ANY_POINT__";
2600
+ const ALL_VALUES = "*";
2472
2601
  /**
2473
2602
  * Config, basically an optional wrapper for a json structure
2474
2603
  * (not sideeffect free, since we can alter the internal config state
@@ -2476,8 +2605,9 @@ ConfigEntry.absent = ConfigEntry.fromNullable(null);
2476
2605
  * since this would swallow a lot of performane and ram
2477
2606
  */
2478
2607
  class Config extends Optional {
2479
- constructor(root) {
2608
+ constructor(root, configDef) {
2480
2609
  super(root);
2610
+ this.configDef = configDef;
2481
2611
  }
2482
2612
  /**
2483
2613
  * shallow copy getter, copies only the first level, references the deeper nodes
@@ -2510,6 +2640,9 @@ class Config extends Optional {
2510
2640
  */
2511
2641
  shallowMerge(other, overwrite = true, withAppend = false) {
2512
2642
  for (let key in other.value) {
2643
+ if ('undefined' == typeof key || null == key) {
2644
+ continue;
2645
+ }
2513
2646
  if (overwrite || !(key in this.value)) {
2514
2647
  if (!withAppend) {
2515
2648
  this.assign(key).value = other.getIf(key).value;
@@ -2542,10 +2675,11 @@ class Config extends Optional {
2542
2675
  if (noKeys) {
2543
2676
  return;
2544
2677
  }
2678
+ this.assertAccessPath(...accessPath);
2545
2679
  let lastKey = accessPath[accessPath.length - 1];
2546
2680
  let currKey, finalKey = this.keyVal(lastKey);
2547
2681
  let pathExists = this.getIf(...accessPath).isPresent();
2548
- this.buildPath(accessPath);
2682
+ this.buildPath(...accessPath);
2549
2683
  let finalKeyArrPos = this.arrayIndex(lastKey);
2550
2684
  if (finalKeyArrPos > -1) {
2551
2685
  throw Error("Append only possible on non array properties, use assign on indexed data");
@@ -2581,7 +2715,8 @@ class Config extends Optional {
2581
2715
  if (accessPath.length < 1) {
2582
2716
  return;
2583
2717
  }
2584
- this.buildPath(accessPath);
2718
+ this.assertAccessPath(...accessPath);
2719
+ this.buildPath(...accessPath);
2585
2720
  let currKey = this.keyVal(accessPath[accessPath.length - 1]);
2586
2721
  let arrPos = this.arrayIndex(accessPath[accessPath.length - 1]);
2587
2722
  let retVal = new ConfigEntry(accessPath.length == 1 ? this.value : this.getIf.apply(this, accessPath.slice(0, accessPath.length - 1)).value, currKey, arrPos);
@@ -2602,6 +2737,7 @@ class Config extends Optional {
2602
2737
  * @param accessPath the access path
2603
2738
  */
2604
2739
  getIf(...accessPath) {
2740
+ this.assertAccessPath(...accessPath);
2605
2741
  return this.getClass().fromNullable(super.getIf.apply(this, accessPath).value);
2606
2742
  }
2607
2743
  /**
@@ -2630,12 +2766,67 @@ class Config extends Optional {
2630
2766
  setVal(val) {
2631
2767
  this._value = val;
2632
2768
  }
2769
+ /**
2770
+ * asserts the access path for a semy typed access
2771
+ * @param accessPath
2772
+ * @private
2773
+ */
2774
+ assertAccessPath(...accessPath) {
2775
+ var _a, _b;
2776
+ accessPath = this.preprocessKeys(...accessPath);
2777
+ if (!this.configDef) {
2778
+ //untyped
2779
+ return;
2780
+ }
2781
+ let currAccessPos = null;
2782
+ const ERR_ACCESS_PATH = "Access Path to config invalid";
2783
+ const ABSENT = "__ABSENT__";
2784
+ currAccessPos = this.configDef;
2785
+ for (let cnt = 0; cnt < accessPath.length; cnt++) {
2786
+ let currKey = this.keyVal(accessPath[cnt]);
2787
+ let arrPos = this.arrayIndex(accessPath[cnt]);
2788
+ //key index
2789
+ if (this.isArray(arrPos)) {
2790
+ if (currKey != "") {
2791
+ currAccessPos = (Array.isArray(currAccessPos)) ?
2792
+ Stream_1.Stream.of(...currAccessPos)
2793
+ .filter(item => { var _a; return !!((_a = item === null || item === void 0 ? void 0 : item[currKey]) !== null && _a !== void 0 ? _a : false); })
2794
+ .map(item => item === null || item === void 0 ? void 0 : item[currKey]).first() :
2795
+ Optional.fromNullable((_a = currAccessPos === null || currAccessPos === void 0 ? void 0 : currAccessPos[currKey]) !== null && _a !== void 0 ? _a : null);
2796
+ }
2797
+ else {
2798
+ currAccessPos = (Array.isArray(currAccessPos)) ?
2799
+ Stream_1.Stream.of(...currAccessPos)
2800
+ .filter(item => Array.isArray(item))
2801
+ .flatMap(item => Stream_1.Stream.of(...item)).first() : Optional.absent;
2802
+ }
2803
+ //we noe store either the current array or the filtered look ahead to go further
2804
+ }
2805
+ else {
2806
+ //we now have an array and go further with a singular key
2807
+ currAccessPos = (Array.isArray(currAccessPos)) ? Stream_1.Stream.of(...currAccessPos)
2808
+ .filter(item => { var _a; return !!((_a = item === null || item === void 0 ? void 0 : item[currKey]) !== null && _a !== void 0 ? _a : false); })
2809
+ .map(item => item === null || item === void 0 ? void 0 : item[currKey])
2810
+ .first() :
2811
+ Optional.fromNullable((_b = currAccessPos === null || currAccessPos === void 0 ? void 0 : currAccessPos[currKey]) !== null && _b !== void 0 ? _b : null);
2812
+ }
2813
+ if (!currAccessPos.isPresent()) {
2814
+ throw Error(ERR_ACCESS_PATH);
2815
+ }
2816
+ currAccessPos = currAccessPos.value;
2817
+ //no further testing needed, from this point onwards we are on our own
2818
+ if (currAccessPos == exports.CONFIG_ANY) {
2819
+ return;
2820
+ }
2821
+ }
2822
+ }
2633
2823
  /**
2634
2824
  * builds the config path
2635
2825
  *
2636
2826
  * @param accessPath a sequential array of accessPath containing either a key name or an array reference name[<index>]
2637
2827
  */
2638
- buildPath(accessPath) {
2828
+ buildPath(...accessPath) {
2829
+ accessPath = this.preprocessKeys(...accessPath);
2639
2830
  let val = this;
2640
2831
  let parentVal = this.getClass().fromNullable(null);
2641
2832
  let parentPos = -1;
@@ -2649,7 +2840,7 @@ class Config extends Optional {
2649
2840
  for (let cnt = 0; cnt < accessPath.length; cnt++) {
2650
2841
  let currKey = this.keyVal(accessPath[cnt]);
2651
2842
  let arrPos = this.arrayIndex(accessPath[cnt]);
2652
- if (currKey === "" && arrPos >= 0) {
2843
+ if (this.isArrayPos(currKey, arrPos)) {
2653
2844
  val.setVal((val.value instanceof Array) ? val.value : []);
2654
2845
  alloc(val.value, arrPos + 1);
2655
2846
  if (parentPos >= 0) {
@@ -2661,7 +2852,7 @@ class Config extends Optional {
2661
2852
  continue;
2662
2853
  }
2663
2854
  let tempVal = val.getIf(currKey);
2664
- if (arrPos == -1) {
2855
+ if (this.isNoArray(arrPos)) {
2665
2856
  if (tempVal.isAbsent()) {
2666
2857
  tempVal = this.getClass().fromNullable(val.value[currKey] = {});
2667
2858
  }
@@ -2681,6 +2872,15 @@ class Config extends Optional {
2681
2872
  }
2682
2873
  return this;
2683
2874
  }
2875
+ isNoArray(arrPos) {
2876
+ return arrPos == -1;
2877
+ }
2878
+ isArray(arrPos) {
2879
+ return !this.isNoArray(arrPos);
2880
+ }
2881
+ isArrayPos(currKey, arrPos) {
2882
+ return currKey === "" && arrPos >= 0;
2883
+ }
2684
2884
  }
2685
2885
  exports.Config = Config;
2686
2886
 
@@ -2711,7 +2911,7 @@ exports.Config = Config;
2711
2911
  * limitations under the License.
2712
2912
  */
2713
2913
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2714
- exports.QueryFormStringCollector = exports.QueryFormDataCollector = exports.FormDataCollector = exports.AssocArrayCollector = exports.Run = exports.ArrayAssocArrayCollector = exports.ArrayCollector = exports.FlatMapStreamDataSource = exports.MappedStreamDataSource = exports.FilteredStreamDatasource = exports.ArrayStreamDataSource = exports.SequenceDataSource = exports.ITERATION_STATUS = void 0;
2914
+ exports.QueryFormStringCollector = exports.QueryFormDataCollector = exports.FormDataCollector = exports.AssocArrayCollector = exports.Run = exports.ArrayAssocArrayCollector = exports.InverseArrayCollector = exports.ArrayCollector = exports.FlatMapStreamDataSource = exports.MappedStreamDataSource = exports.FilteredStreamDatasource = exports.ArrayStreamDataSource = exports.SequenceDataSource = exports.ITERATION_STATUS = void 0;
2715
2915
  const Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
2716
2916
  /**
2717
2917
  * special status of the datasource location pointer
@@ -3018,6 +3218,21 @@ class ArrayCollector {
3018
3218
  }
3019
3219
  }
3020
3220
  exports.ArrayCollector = ArrayCollector;
3221
+ /**
3222
+ * collects the values as inverse array
3223
+ */
3224
+ class InverseArrayCollector {
3225
+ constructor() {
3226
+ this.data = [];
3227
+ }
3228
+ collect(element) {
3229
+ this.data.unshift(element);
3230
+ }
3231
+ get finalValue() {
3232
+ return this.data;
3233
+ }
3234
+ }
3235
+ exports.InverseArrayCollector = InverseArrayCollector;
3021
3236
  /**
3022
3237
  * collects an tuple array stream into an assoc array with elements being collected into arrays
3023
3238
  *
@@ -3353,6 +3568,15 @@ exports.Stream = Stream;
3353
3568
  *
3354
3569
  */
3355
3570
  class LazyStream {
3571
+ static of(...values) {
3572
+ return new LazyStream(new SourcesCollectors_1.ArrayStreamDataSource(...values));
3573
+ }
3574
+ static ofAssoc(data) {
3575
+ return this.of(...Object.keys(data)).map(key => [key, data[key]]);
3576
+ }
3577
+ static ofStreamDataSource(value) {
3578
+ return new LazyStream(value);
3579
+ }
3356
3580
  constructor(parent) {
3357
3581
  this._limits = -1;
3358
3582
  /*
@@ -3363,15 +3587,6 @@ class LazyStream {
3363
3587
  this.pos = -1;
3364
3588
  this.dataSource = parent;
3365
3589
  }
3366
- static of(...values) {
3367
- return new LazyStream(new SourcesCollectors_1.ArrayStreamDataSource(...values));
3368
- }
3369
- static ofAssoc(data) {
3370
- return this.of(...Object.keys(data)).map(key => [key, data[key]]);
3371
- }
3372
- static ofStreamDataSource(value) {
3373
- return new LazyStream(value);
3374
- }
3375
3590
  hasNext() {
3376
3591
  if (this.isOverLimits()) {
3377
3592
  return false;
@@ -3652,7 +3867,7 @@ exports.XQ = XMLQuery;
3652
3867
 
3653
3868
 
3654
3869
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3655
- exports.QueryFormDataCollector = exports.FormDataCollector = exports.AssocArrayCollector = exports.ArrayCollector = exports.QueryFormStringCollector = exports.SequenceDataSource = exports.FlatMapStreamDataSource = exports.FilteredStreamDatasource = exports.MappedStreamDataSource = exports.ArrayStreamDataSource = exports.LazyStream = exports.Stream = exports.XQ = exports.XMLQuery = exports.ValueEmbedder = exports.Optional = exports.Monad = exports.Config = exports.Lang = exports.DQ$ = exports.DQ = exports.DomQueryCollector = exports.ElementAttribute = exports.DomQuery = void 0;
3870
+ exports.QueryFormDataCollector = exports.FormDataCollector = exports.AssocArrayCollector = exports.ArrayCollector = exports.QueryFormStringCollector = exports.SequenceDataSource = exports.FlatMapStreamDataSource = exports.FilteredStreamDatasource = exports.MappedStreamDataSource = exports.ArrayStreamDataSource = exports.LazyStream = exports.Stream = exports.XQ = exports.XMLQuery = exports.ValueEmbedder = exports.Optional = exports.Monad = exports.CONFIG_ANY = exports.CONFIG_VALUE = exports.Config = exports.Lang = exports.DQ$ = exports.DQ = exports.DomQueryCollector = exports.ElementAttribute = exports.DomQuery = void 0;
3656
3871
  /*!
3657
3872
  * Licensed to the Apache Software Foundation (ASF) under one
3658
3873
  * or more contributor license agreements. See the NOTICE file
@@ -3681,6 +3896,8 @@ var Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/mai
3681
3896
  Object.defineProperty(exports, "Lang", ({ enumerable: true, get: function () { return Lang_1.Lang; } }));
3682
3897
  var Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
3683
3898
  Object.defineProperty(exports, "Config", ({ enumerable: true, get: function () { return Monad_1.Config; } }));
3899
+ Object.defineProperty(exports, "CONFIG_VALUE", ({ enumerable: true, get: function () { return Monad_1.CONFIG_VALUE; } }));
3900
+ Object.defineProperty(exports, "CONFIG_ANY", ({ enumerable: true, get: function () { return Monad_1.CONFIG_ANY; } }));
3684
3901
  Object.defineProperty(exports, "Monad", ({ enumerable: true, get: function () { return Monad_1.Monad; } }));
3685
3902
  Object.defineProperty(exports, "Optional", ({ enumerable: true, get: function () { return Monad_1.Optional; } }));
3686
3903
  Object.defineProperty(exports, "ValueEmbedder", ({ enumerable: true, get: function () { return Monad_1.ValueEmbedder; } }));
@@ -3951,17 +4168,18 @@ var myfaces;
3951
4168
  * @param options
3952
4169
  */
3953
4170
  function ab(source, event, eventName, execute, render, options = {}) {
3954
- var _a;
4171
+ var _a, _b;
3955
4172
  if (eventName) {
3956
- options[(0, Const_1.$nsp)(Const_1.P_BEHAVIOR_EVENT)] = eventName;
4173
+ options[Const_1.CTX_OPTIONS_PARAMS] = (_a = options === null || options === void 0 ? void 0 : options[Const_1.CTX_OPTIONS_PARAMS]) !== null && _a !== void 0 ? _a : {};
4174
+ options[Const_1.CTX_OPTIONS_PARAMS][(0, Const_1.$nsp)(Const_1.P_BEHAVIOR_EVENT)] = eventName;
3957
4175
  }
3958
4176
  if (execute) {
3959
- options[Const_1.CTX_PARAM_EXECUTE] = execute;
4177
+ options[Const_1.CTX_OPTIONS_EXECUTE] = execute;
3960
4178
  }
3961
4179
  if (render) {
3962
4180
  options[Const_1.CTX_PARAM_RENDER] = render;
3963
4181
  }
3964
- ((_a = window === null || window === void 0 ? void 0 : window.faces) !== null && _a !== void 0 ? _a : window.jsf).ajax.request(source, event, options);
4182
+ ((_b = window === null || window === void 0 ? void 0 : window.faces) !== null && _b !== void 0 ? _b : window.jsf).ajax.request(source, event, options);
3965
4183
  }
3966
4184
  myfaces.ab = ab;
3967
4185
  /**
@@ -4031,7 +4249,9 @@ var BlockFilter;
4031
4249
  BlockFilter["myfaces"] = "myfaces";
4032
4250
  BlockFilter["delay"] = "delay";
4033
4251
  BlockFilter["timeout"] = "timeout";
4252
+ BlockFilter["resetValues"] = "resetValues";
4034
4253
  BlockFilter["windowId"] = "windowId";
4254
+ BlockFilter["params"] = "params";
4035
4255
  })(BlockFilter || (BlockFilter = {}));
4036
4256
  /**
4037
4257
  * Core Implementation
@@ -4183,7 +4403,9 @@ var Implementation;
4183
4403
  */
4184
4404
  function request(el, event, opts) {
4185
4405
  var _a, _b, _c;
4186
- const { resolvedEvent, options, elem, elementId, requestCtx, internalCtx, windowId, isResetValues } = (0, RequestDataResolver_1.resolveDefaults)(event, opts, el);
4406
+ const { options, elem, elementId, windowId, isResetValues } = (0, RequestDataResolver_1.resolveDefaults)(event, opts, el);
4407
+ const requestCtx = new ExtDomQuery_1.ExtConfig({});
4408
+ const internalCtx = new ExtDomQuery_1.ExtConfig({});
4187
4409
  Assertions_1.Assertions.assertRequestIntegrity(options, elem);
4188
4410
  /**
4189
4411
  * fetch the parent form
@@ -4192,18 +4414,30 @@ var Implementation;
4192
4414
  * so that people can use dummy forms and work
4193
4415
  * with detached objects
4194
4416
  */
4195
- const form = (0, RequestDataResolver_1.resolveForm)(requestCtx, elem, resolvedEvent);
4417
+ const form = (0, RequestDataResolver_1.resolveForm)(elem, event);
4418
+ const viewId = (0, RequestDataResolver_1.resolveViewId)(form);
4196
4419
  const formId = form.id.value;
4197
4420
  const delay = (0, RequestDataResolver_1.resolveDelay)(options);
4198
4421
  const timeout = (0, RequestDataResolver_1.resolveTimeout)(options);
4199
4422
  requestCtx.assignIf(!!windowId, Const_1.P_WINDOW_ID).value = windowId;
4200
- requestCtx.assign(Const_1.CTX_PARAM_PASS_THR).value = filterPassThroughValues(options.value);
4201
- requestCtx.assignIf(!!resolvedEvent, Const_1.CTX_PARAM_PASS_THR, Const_1.P_EVT).value = resolvedEvent === null || resolvedEvent === void 0 ? void 0 : resolvedEvent.type;
4423
+ // old non spec behavior will be removed after it is clear whether the removal breaks any code
4424
+ requestCtx.assign(Const_1.CTX_PARAM_REQ_PASS_THR).value = extractLegacyParams(options.value);
4425
+ // spec conform behavior, all passthrough params must be under "passthrough
4426
+ const params = remapArrayToAssocArr(options.getIf(Const_1.CTX_OPTIONS_PARAMS).orElse({}).value);
4427
+ //we turn off the remapping for the param merge, because we do not want to have
4428
+ //any namespacing to be remapped
4429
+ let ctxPassthrough = requestCtx.getIf(Const_1.CTX_PARAM_REQ_PASS_THR);
4430
+ ctxPassthrough.$nspEnabled = false;
4431
+ ctxPassthrough.shallowMerge(new mona_dish_1.Config(params), true);
4432
+ //now we turn it on again
4433
+ ctxPassthrough.$nspEnabled = true;
4434
+ requestCtx.assignIf(!!event, Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_EVT).value = event === null || event === void 0 ? void 0 : event.type;
4202
4435
  /**
4203
4436
  * ajax pass through context with the source
4204
4437
  * onresolved Event and onerror Event
4205
4438
  */
4206
4439
  requestCtx.assign(Const_1.SOURCE).value = elementId;
4440
+ requestCtx.assign(Const_1.VIEW_ID).value = viewId;
4207
4441
  /**
4208
4442
  * on resolvedEvent and onError...
4209
4443
  * those values will be traversed later on
@@ -4218,11 +4452,11 @@ var Implementation;
4218
4452
  /**
4219
4453
  * binding contract the jakarta.faces.source must be set
4220
4454
  */
4221
- requestCtx.assign(Const_1.CTX_PARAM_PASS_THR, Const_1.P_PARTIAL_SOURCE).value = elementId;
4455
+ requestCtx.assign(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_PARTIAL_SOURCE).value = elementId;
4222
4456
  /**
4223
4457
  * jakarta.faces.partial.ajax must be set to true
4224
4458
  */
4225
- requestCtx.assign(Const_1.CTX_PARAM_PASS_THR, Const_1.P_AJAX).value = true;
4459
+ requestCtx.assign(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_AJAX).value = true;
4226
4460
  /**
4227
4461
  * if resetValues is set to true
4228
4462
  * then we have to set jakarta.faces.resetValues as well
@@ -4230,7 +4464,7 @@ var Implementation;
4230
4464
  * the value has to be explicitly true, according to
4231
4465
  * the specs jsdoc
4232
4466
  */
4233
- requestCtx.assignIf(isResetValues, Const_1.CTX_PARAM_PASS_THR, Const_1.P_RESET_VALUES).value = true;
4467
+ requestCtx.assignIf(isResetValues, Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_RESET_VALUES).value = true;
4234
4468
  // additional meta information to speed things up, note internal non jsf
4235
4469
  // pass through options are stored under _mfInternal in the context
4236
4470
  internalCtx.assign(Const_1.CTX_PARAM_SRC_FRM_ID).value = formId;
@@ -4239,9 +4473,8 @@ var Implementation;
4239
4473
  // mojarra under blackbox conditions.
4240
4474
  // I assume it does the same as our formId_submit=1 so leaving it out
4241
4475
  // won't hurt but for the sake of compatibility we are going to add it
4242
- requestCtx.assign(Const_1.CTX_PARAM_PASS_THR, formId).value = formId;
4476
+ requestCtx.assign(Const_1.CTX_PARAM_REQ_PASS_THR, formId).value = formId;
4243
4477
  internalCtx.assign(Const_1.CTX_PARAM_SRC_CTL_ID).value = elementId;
4244
- internalCtx.assign(Const_1.CTX_PARAM_TR_TYPE).value = Const_1.REQ_TYPE_POST;
4245
4478
  assignClientWindowId(form, requestCtx);
4246
4479
  assignExecute(options, requestCtx, form, elementId);
4247
4480
  assignRender(options, requestCtx, form, elementId);
@@ -4414,7 +4647,7 @@ var Implementation;
4414
4647
  * because it makes it easier to detect bugs
4415
4648
  */
4416
4649
  let element = mona_dish_1.DQ.byId(form, true);
4417
- if (!element.isTag(Const_1.TAG_FORM)) {
4650
+ if (!element.isTag(Const_1.HTML_TAG_FORM)) {
4418
4651
  throw new Error(getMessage("ERR_VIEWSTATE"));
4419
4652
  }
4420
4653
  let formData = new XhrFormData_1.XhrFormData(element);
@@ -4452,7 +4685,7 @@ var Implementation;
4452
4685
  */
4453
4686
  function assignRender(requestOptions, targetContext, issuingForm, sourceElementId) {
4454
4687
  if (requestOptions.getIf(Const_1.CTX_PARAM_RENDER).isPresent()) {
4455
- remapDefaultConstants(targetContext.getIf(Const_1.CTX_PARAM_PASS_THR).get({}), Const_1.P_RENDER, requestOptions.getIf(Const_1.CTX_PARAM_RENDER).value, issuingForm, sourceElementId);
4688
+ remapDefaultConstants(targetContext.getIf(Const_1.CTX_PARAM_REQ_PASS_THR).get({}), Const_1.P_RENDER, requestOptions.getIf(Const_1.CTX_PARAM_RENDER).value, issuingForm, sourceElementId, targetContext.getIf(Const_1.VIEW_ID).value);
4456
4689
  }
4457
4690
  }
4458
4691
  /**
@@ -4468,16 +4701,16 @@ var Implementation;
4468
4701
  * @param sourceElementId the executing element triggering the faces.ajax.request (id of it)
4469
4702
  */
4470
4703
  function assignExecute(requestOptions, targetContext, issuingForm, sourceElementId) {
4471
- if (requestOptions.getIf(Const_1.CTX_PARAM_EXECUTE).isPresent()) {
4704
+ if (requestOptions.getIf(Const_1.CTX_OPTIONS_EXECUTE).isPresent()) {
4472
4705
  /*the options must be a blank delimited list of strings*/
4473
4706
  /*compliance with Mojarra which automatically adds @this to an execute
4474
4707
  * the spec rev 2.0a however states, if none is issued nothing at all should be sent down
4475
4708
  */
4476
- requestOptions.assign(Const_1.CTX_PARAM_EXECUTE).value = [requestOptions.getIf(Const_1.CTX_PARAM_EXECUTE).value, Const_1.IDENT_THIS].join(" ");
4477
- remapDefaultConstants(targetContext.getIf(Const_1.CTX_PARAM_PASS_THR).get({}), Const_1.P_EXECUTE, requestOptions.getIf(Const_1.CTX_PARAM_EXECUTE).value, issuingForm, sourceElementId);
4709
+ requestOptions.assign(Const_1.CTX_OPTIONS_EXECUTE).value = [requestOptions.getIf(Const_1.CTX_OPTIONS_EXECUTE).value, Const_1.IDENT_THIS].join(" ");
4710
+ remapDefaultConstants(targetContext.getIf(Const_1.CTX_PARAM_REQ_PASS_THR).get({}), Const_1.P_EXECUTE, requestOptions.getIf(Const_1.CTX_OPTIONS_EXECUTE).value, issuingForm, sourceElementId, targetContext.getIf(Const_1.VIEW_ID).value);
4478
4711
  }
4479
4712
  else {
4480
- targetContext.assign(Const_1.CTX_PARAM_PASS_THR, Const_1.P_EXECUTE).value = sourceElementId;
4713
+ targetContext.assign(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_EXECUTE).value = sourceElementId;
4481
4714
  }
4482
4715
  }
4483
4716
  /**
@@ -4487,16 +4720,15 @@ var Implementation;
4487
4720
  * @param targetContext the target context receiving the value
4488
4721
  */
4489
4722
  function assignClientWindowId(form, targetContext) {
4490
- var _a;
4491
- let clientWindow = ((_a = window === null || window === void 0 ? void 0 : window.faces) !== null && _a !== void 0 ? _a : window === null || window === void 0 ? void 0 : window.jsf).getClientWindow(form.getAsElem(0).value);
4723
+ let clientWindow = (0, Const_1.$faces)().getClientWindow(form.getAsElem(0).value);
4492
4724
  if (clientWindow) {
4493
- targetContext.assign(Const_1.CTX_PARAM_PASS_THR, Const_1.P_CLIENT_WINDOW).value = clientWindow;
4725
+ targetContext.assign(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_CLIENT_WINDOW).value = clientWindow;
4494
4726
  }
4495
4727
  }
4496
4728
  /**
4497
4729
  * transforms the user values to the expected one
4498
4730
  * with the proper none all form and this handling
4499
- * (note we also could use a simple string replace but then
4731
+ * (note we also could use a simple string replace, but then
4500
4732
  * we would have had double entries under some circumstances)
4501
4733
  *
4502
4734
  * there are several standardized constants which need a special treatment
@@ -4507,12 +4739,58 @@ var Implementation;
4507
4739
  * @param userValues the passed user values (aka input string which needs to be transformed)
4508
4740
  * @param issuingForm the form where the issuing element originates
4509
4741
  * @param issuingElementId the issuing element
4742
+ * @param rootNamingContainerId the naming container id ("" default if none is given)
4510
4743
  */
4511
- function remapDefaultConstants(targetConfig, targetKey, userValues, issuingForm, issuingElementId) {
4744
+ function remapDefaultConstants(targetConfig, targetKey, userValues, issuingForm, issuingElementId, rootNamingContainerId = "") {
4512
4745
  //a cleaner implementation of the transform list method
4746
+ const SEP = (0, Const_1.$faces)().separatorchar;
4513
4747
  let iterValues = (userValues) ? trim(userValues).split(/\s+/gi) : [];
4514
4748
  let ret = [];
4515
4749
  let processed = {};
4750
+ /**
4751
+ * remaps the client ids for the portlet case so that the server
4752
+ * can deal with them either prefixed ir not
4753
+ * also resolves the absolute id case (it was assumed the server does this, but
4754
+ * apparently the RI does not, so we have to follow the RI behavior here)
4755
+ * @param componentIdToTransform the componentId which needs post processing
4756
+ */
4757
+ const remapNamingContainer = componentIdToTransform => {
4758
+ // pattern :<anything> must be prepended by viewRoot if there is one,
4759
+ // otherwise we are in a not namespaced then only the id has to match
4760
+ const rootNamingContainerPrefix = (rootNamingContainerId.length) ? rootNamingContainerId + SEP : Const_1.EMPTY_STR;
4761
+ let formClientId = issuingForm.id.value;
4762
+ // nearest parent naming container relative to the form
4763
+ const nearestNamingContainer = formClientId.substring(0, formClientId.lastIndexOf(SEP));
4764
+ const nearestNamingContainerPrefix = (nearestNamingContainer.length) ? nearestNamingContainer + SEP : Const_1.EMPTY_STR;
4765
+ // Absolute search expressions, always start with SEP or the name of the root naming container
4766
+ const hasLeadingSep = componentIdToTransform.indexOf(SEP) === 0;
4767
+ const isAbsolutSearchExpr = hasLeadingSep || (rootNamingContainerId.length
4768
+ && componentIdToTransform.indexOf(rootNamingContainerPrefix) == 0);
4769
+ let finalIdentifier = "";
4770
+ if (isAbsolutSearchExpr) {
4771
+ //we cut off the leading sep if there is one
4772
+ componentIdToTransform = hasLeadingSep ? componentIdToTransform.substring(1) : componentIdToTransform;
4773
+ componentIdToTransform = componentIdToTransform.indexOf(rootNamingContainerPrefix) == 0 ? componentIdToTransform.substring(rootNamingContainerPrefix.length) : componentIdToTransform;
4774
+ //now we prepend either the prefix or "" from the cut-off string to get the final result
4775
+ finalIdentifier = [rootNamingContainerPrefix, componentIdToTransform].join(Const_1.EMPTY_STR);
4776
+ }
4777
+ else { //relative search according to the javadoc
4778
+ //we cut off the root naming container id from the form
4779
+ if (formClientId.indexOf(rootNamingContainerPrefix) == 0) {
4780
+ formClientId = formClientId.substring(rootNamingContainerPrefix.length);
4781
+ }
4782
+ //If prependId = true, the outer form id must be present in the id if same form
4783
+ let hasPrependId = componentIdToTransform.indexOf(formClientId) == 0;
4784
+ finalIdentifier = hasPrependId ?
4785
+ [rootNamingContainerPrefix, componentIdToTransform].join(Const_1.EMPTY_STR) :
4786
+ [nearestNamingContainerPrefix, componentIdToTransform].join(Const_1.EMPTY_STR);
4787
+ }
4788
+ // We need to double check because we have scenarios where we have a naming container
4789
+ // and no prepend (aka tobago testcase "must handle ':' in IDs properly", scenario 3,
4790
+ // in this case we return the component id, and be happy
4791
+ // we can roll a dom check here
4792
+ return (!!document.getElementById(finalIdentifier)) ? finalIdentifier : componentIdToTransform;
4793
+ };
4516
4794
  // in this case we do not use lazy stream because it wont bring any code reduction
4517
4795
  // or speedup
4518
4796
  for (let cnt = 0; cnt < iterValues.length; cnt++) {
@@ -4530,38 +4808,49 @@ var Implementation;
4530
4808
  return targetConfig;
4531
4809
  //@form pushes the issuing form id into our list
4532
4810
  case Const_1.IDENT_FORM:
4533
- ret.push(issuingForm.id.value);
4811
+ ret.push(remapNamingContainer(issuingForm.id.value));
4534
4812
  processed[issuingForm.id.value] = true;
4535
4813
  break;
4536
4814
  //@this is replaced with the current issuing element id
4537
4815
  case Const_1.IDENT_THIS:
4538
4816
  if (!(issuingElementId in processed)) {
4539
- ret.push(issuingElementId);
4817
+ ret.push(remapNamingContainer(issuingElementId));
4540
4818
  processed[issuingElementId] = true;
4541
4819
  }
4542
4820
  break;
4543
4821
  default:
4544
- ret.push(iterValues[cnt]);
4822
+ ret.push(remapNamingContainer(iterValues[cnt]));
4545
4823
  processed[iterValues[cnt]] = true;
4546
4824
  }
4547
4825
  }
4548
- //We now add the target as joined list
4549
4826
  targetConfig.assign(targetKey).value = ret.join(" ");
4550
4827
  return targetConfig;
4551
4828
  }
4552
4829
  /**
4553
4830
  * Filter the options given with a blacklist, so that only
4554
- * the values required for pass-through are processed in the ajax request
4831
+ * the values required for params-through are processed in the ajax request
4832
+ *
4833
+ * Note this is a bug carried over from the old implementation
4834
+ * the spec conform behavior is to use params for passthrough values
4835
+ * this will be removed soon, after it is cleared up whether removing
4836
+ * it breaks any legacy code
4555
4837
  *
4556
4838
  * @param {Context} mappedOpts the options to be filtered
4839
+ * @deprecated
4557
4840
  */
4558
- function filterPassThroughValues(mappedOpts) {
4841
+ function extractLegacyParams(mappedOpts) {
4559
4842
  //we now can use the full code reduction given by our stream api
4560
4843
  //to filter
4561
4844
  return mona_dish_1.Stream.ofAssoc(mappedOpts)
4562
4845
  .filter(item => !(item[0] in BlockFilter))
4563
4846
  .collect(new mona_dish_1.AssocArrayCollector());
4564
4847
  }
4848
+ function remapArrayToAssocArr(arrayedParams) {
4849
+ if (Array.isArray(arrayedParams)) {
4850
+ return mona_dish_1.Stream.of(...arrayedParams).collect(new mona_dish_1.AssocArrayCollector());
4851
+ }
4852
+ return arrayedParams;
4853
+ }
4565
4854
  function resolveGlobalConfig() {
4566
4855
  var _a, _b;
4567
4856
  return (_b = (_a = window === null || window === void 0 ? void 0 : window[Const_1.MYFACES]) === null || _a === void 0 ? void 0 : _a.config) !== null && _b !== void 0 ? _b : {};
@@ -4886,15 +5175,17 @@ var PushImpl;
4886
5175
  * limitations under the License.
4887
5176
  */
4888
5177
  Object.defineProperty(exports, "__esModule", ({ value: true }));
4889
- exports.CTX_PARAM_DELAY = exports.CTX_PARAM_PASS_THR = exports.CTX_PARAM_TR_TYPE = exports.CTX_PARAM_SRC_CTL_ID = exports.CTX_PARAM_SRC_FRM_ID = exports.CTX_PARAM_MF_INTERNAL = exports.TIMEOUT_EVENT = exports.CLIENT_ERROR = exports.SERVER_ERROR = exports.MALFORMEDXML = exports.EMPTY_RESPONSE = exports.HTTPERROR = exports.RESPONSE_XML = exports.RESPONSE_TEXT = exports.ERROR_MESSAGE = exports.ERROR_NAME = exports.STATUS = exports.SOURCE = exports.SUCCESS = exports.COMPLETE = exports.BEGIN = exports.ON_EVENT = exports.ON_ERROR = exports.EVENT = exports.ERROR = exports.WINDOW_ID = exports.CTX_PARAM_RENDER = exports.P_BEHAVIOR_EVENT = exports.P_WINDOW_ID = exports.P_RESET_VALUES = exports.P_CLIENT_WINDOW = exports.P_EVT = exports.P_RENDER = exports.P_EXECUTE = exports.P_AJAX = exports.IDENT_FORM = exports.IDENT_THIS = exports.IDENT_NONE = exports.IDENT_ALL = exports.HTML_VIEWSTATE = exports.EMPTY_MAP = exports.EMPTY_STR = exports.EMPTY_FUNC = exports.P_RESOURCE = exports.P_VIEWBODY = exports.P_VIEWHEAD = exports.P_VIEWROOT = exports.P_VIEWSTATE = exports.PARTIAL_ID = exports.P_PARTIAL_SOURCE = void 0;
4890
- exports.REASON_EXPIRED = exports.MF_NONE = exports.SEL_SCRIPTS_STYLES = exports.MYFACES = exports.DEFERRED_HEAD_INSERTS = exports.UPDATE_ELEMS = exports.UPDATE_FORMS = exports.CMD_REDIRECT = exports.CMD_EXTENSION = exports.CMD_ATTRIBUTES = exports.CMD_ERROR = exports.CMD_EVAL = exports.CMD_INSERT = exports.CMD_DELETE = exports.CMD_UPDATE = exports.CMD_CHANGES = exports.RESP_PARTIAL = exports.ATTR_ID = exports.ATTR_VALUE = exports.ATTR_NAME = exports.ATTR_URL = exports.ERR_NO_PARTIAL_RESPONSE = exports.PHASE_PROCESS_RESPONSE = exports.SEL_RESPONSE_XML = exports.SEL_CLIENT_WINDOW_ELEM = exports.SEL_VIEWSTATE_ELEM = exports.TAG_ATTR = exports.TAG_AFTER = exports.TAG_BEFORE = exports.TAG_BODY = exports.TAG_FORM = exports.TAG_HEAD = exports.STD_ACCEPT = exports.NO_TIMEOUT = exports.MULTIPART = exports.URL_ENCODED = exports.STATE_EVT_COMPLETE = exports.STATE_EVT_TIMEOUT = exports.STATE_EVT_BEGIN = exports.REQ_TYPE_POST = exports.REQ_TYPE_GET = exports.ENCODED_URL = exports.VAL_AJAX = exports.REQ_ACCEPT = exports.HEAD_FACES_REQ = exports.CONTENT_TYPE = exports.STAGE_DEVELOPMENT = exports.CTX_PARAM_EXECUTE = exports.CTX_PARAM_RST = exports.CTX_PARAM_TIMEOUT = void 0;
4891
- exports.$nsp = exports.UNKNOWN = exports.MAX_RECONNECT_ATTEMPTS = exports.RECONNECT_INTERVAL = exports.APPLIED_CLIENT_WINDOW = exports.APPLIED_VST = void 0;
5178
+ exports.DELAY_NONE = exports.CTX_OPTIONS_DELAY = exports.CTX_OPTIONS_PARAMS = exports.TIMEOUT_EVENT = exports.CLIENT_ERROR = exports.SERVER_ERROR = exports.MALFORMEDXML = exports.EMPTY_RESPONSE = exports.HTTPERROR = exports.RESPONSE_XML = exports.RESPONSE_TEXT = exports.ERROR_MESSAGE = exports.ERROR_NAME = exports.STATUS = exports.SOURCE = exports.SUCCESS = exports.COMPLETE = exports.BEGIN = exports.ON_EVENT = exports.ON_ERROR = exports.EVENT = exports.ERROR = exports.WINDOW_ID = exports.CTX_PARAM_RENDER = exports.P_BEHAVIOR_EVENT = exports.P_WINDOW_ID = exports.P_RESET_VALUES = exports.P_EVT = exports.P_RENDER_OVERRIDE = exports.P_RENDER = exports.P_EXECUTE = exports.P_AJAX = exports.IDENT_FORM = exports.IDENT_THIS = exports.IDENT_NONE = exports.IDENT_ALL = exports.HTML_CLIENT_WINDOW = exports.HTML_VIEWSTATE = exports.EMPTY_MAP = exports.EMPTY_STR = exports.EMPTY_FUNC = exports.P_RESOURCE = exports.P_VIEWBODY = exports.P_VIEWHEAD = exports.P_VIEWROOT = exports.P_CLIENT_WINDOW = exports.P_VIEWSTATE = exports.VIEW_ID = exports.PARTIAL_ID = exports.P_PARTIAL_SOURCE = void 0;
5179
+ exports.UPDATE_FORMS = exports.XML_TAG_ATTR = exports.XML_TAG_AFTER = exports.XML_TAG_BEFORE = exports.XML_TAG_REDIRECT = exports.XML_TAG_EXTENSION = exports.XML_TAG_ATTRIBUTES = exports.XML_TAG_ERROR = exports.XML_TAG_EVAL = exports.XML_TAG_INSERT = exports.XML_TAG_DELETE = exports.XML_TAG_UPDATE = exports.XML_TAG_CHANGES = exports.XML_TAG_PARTIAL_RESP = exports.ATTR_ID = exports.ATTR_VALUE = exports.ATTR_NAME = exports.ATTR_URL = exports.ERR_NO_PARTIAL_RESPONSE = exports.PHASE_PROCESS_RESPONSE = exports.SEL_RESPONSE_XML = exports.SEL_CLIENT_WINDOW_ELEM = exports.SEL_VIEWSTATE_ELEM = exports.HTML_TAG_STYLE = exports.HTML_TAG_SCRIPT = exports.HTML_TAG_LINK = exports.HTML_TAG_BODY = exports.HTML_TAG_FORM = exports.HTML_TAG_HEAD = exports.STD_ACCEPT = exports.NO_TIMEOUT = exports.MULTIPART = exports.URL_ENCODED = exports.STATE_EVT_COMPLETE = exports.STATE_EVT_TIMEOUT = exports.STATE_EVT_BEGIN = exports.REQ_TYPE_POST = exports.REQ_TYPE_GET = exports.ENCODED_URL = exports.VAL_AJAX = exports.REQ_ACCEPT = exports.HEAD_FACES_REQ = exports.CONTENT_TYPE = exports.CTX_PARAM_REQ_PASS_THR = exports.CTX_PARAM_SRC_CTL_ID = exports.CTX_PARAM_SRC_FRM_ID = exports.CTX_PARAM_MF_INTERNAL = exports.CTX_OPTIONS_EXECUTE = exports.CTX_OPTIONS_RESET = exports.CTX_OPTIONS_TIMEOUT = void 0;
5180
+ exports.$nsp = exports.$faces = exports.UNKNOWN = exports.MAX_RECONNECT_ATTEMPTS = exports.RECONNECT_INTERVAL = exports.APPLIED_CLIENT_WINDOW = exports.APPLIED_VST = exports.REASON_EXPIRED = exports.MF_NONE = exports.MYFACES = exports.DEFERRED_HEAD_INSERTS = exports.UPDATE_ELEMS = void 0;
4892
5181
  /*
4893
5182
  * [export const] constants
4894
5183
  */
4895
5184
  exports.P_PARTIAL_SOURCE = "jakarta.faces.source";
4896
5185
  exports.PARTIAL_ID = "partialId";
5186
+ exports.VIEW_ID = "myfaves.viewId";
4897
5187
  exports.P_VIEWSTATE = "jakarta.faces.ViewState";
5188
+ exports.P_CLIENT_WINDOW = "jakarta.faces.ClientWindow";
4898
5189
  exports.P_VIEWROOT = "jakarta.faces.ViewRoot";
4899
5190
  exports.P_VIEWHEAD = "jakarta.faces.ViewHead";
4900
5191
  exports.P_VIEWBODY = "jakarta.faces.ViewBody";
@@ -4904,7 +5195,8 @@ exports.EMPTY_FUNC = Object.freeze(() => {
4904
5195
  });
4905
5196
  exports.EMPTY_STR = "";
4906
5197
  exports.EMPTY_MAP = Object.freeze({});
4907
- exports.HTML_VIEWSTATE = ["<input type='hidden'", "id='", exports.P_VIEWSTATE, "' name='", exports.P_VIEWSTATE, "' value='' />"].join(exports.EMPTY_STR);
5198
+ exports.HTML_VIEWSTATE = ["<input type='hidden'", "name='", exports.P_VIEWSTATE, "' value='' />"].join(exports.EMPTY_STR);
5199
+ exports.HTML_CLIENT_WINDOW = ["<input type='hidden'", "' name='", exports.P_CLIENT_WINDOW, "' value='' />"].join(exports.EMPTY_STR);
4908
5200
  /*internal identifiers for options*/
4909
5201
  exports.IDENT_ALL = "@all";
4910
5202
  exports.IDENT_NONE = "@none";
@@ -4913,8 +5205,9 @@ exports.IDENT_FORM = "@form";
4913
5205
  exports.P_AJAX = "jakarta.faces.partial.ajax";
4914
5206
  exports.P_EXECUTE = "jakarta.faces.partial.execute";
4915
5207
  exports.P_RENDER = "jakarta.faces.partial.render";
5208
+ /*render override for viewbody or viewroot, in both cases an all is performed*/
5209
+ exports.P_RENDER_OVERRIDE = "_myfaces.rendeOverride";
4916
5210
  exports.P_EVT = "jakarta.faces.partial.event";
4917
- exports.P_CLIENT_WINDOW = "jakarta.faces.ClientWindow";
4918
5211
  exports.P_RESET_VALUES = "jakarta.faces.partial.resetValues";
4919
5212
  exports.P_WINDOW_ID = "jakarta.faces.windowId";
4920
5213
  exports.P_BEHAVIOR_EVENT = "jakarta.faces.behavior.event";
@@ -4942,16 +5235,16 @@ exports.MALFORMEDXML = "malformedXML";
4942
5235
  exports.SERVER_ERROR = "serverError";
4943
5236
  exports.CLIENT_ERROR = "clientError";
4944
5237
  exports.TIMEOUT_EVENT = "timeout";
4945
- exports.CTX_PARAM_MF_INTERNAL = "_mfInternal";
4946
- exports.CTX_PARAM_SRC_FRM_ID = "_mfSourceFormId";
4947
- exports.CTX_PARAM_SRC_CTL_ID = "_mfSourceControlId";
4948
- exports.CTX_PARAM_TR_TYPE = "_mfTransportType";
4949
- exports.CTX_PARAM_PASS_THR = "passThrgh";
4950
- exports.CTX_PARAM_DELAY = "delay";
4951
- exports.CTX_PARAM_TIMEOUT = "timeout";
4952
- exports.CTX_PARAM_RST = "resetValues";
4953
- exports.CTX_PARAM_EXECUTE = "execute";
4954
- exports.STAGE_DEVELOPMENT = "Development";
5238
+ exports.CTX_OPTIONS_PARAMS = "params";
5239
+ exports.CTX_OPTIONS_DELAY = "delay";
5240
+ exports.DELAY_NONE = 'none';
5241
+ exports.CTX_OPTIONS_TIMEOUT = "timeout";
5242
+ exports.CTX_OPTIONS_RESET = "resetValues";
5243
+ exports.CTX_OPTIONS_EXECUTE = "execute";
5244
+ exports.CTX_PARAM_MF_INTERNAL = "myfaces.internal";
5245
+ exports.CTX_PARAM_SRC_FRM_ID = "myfaces.source.formId";
5246
+ exports.CTX_PARAM_SRC_CTL_ID = "myfaces.source.controlId";
5247
+ exports.CTX_PARAM_REQ_PASS_THR = "myfaces.request.passThrough";
4955
5248
  exports.CONTENT_TYPE = "Content-Type";
4956
5249
  exports.HEAD_FACES_REQ = "Faces-Request";
4957
5250
  exports.REQ_ACCEPT = "Accept";
@@ -4966,12 +5259,12 @@ exports.URL_ENCODED = "application/x-www-form-urlencoded";
4966
5259
  exports.MULTIPART = "multipart/form-data";
4967
5260
  exports.NO_TIMEOUT = 0;
4968
5261
  exports.STD_ACCEPT = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
4969
- exports.TAG_HEAD = "head";
4970
- exports.TAG_FORM = "form";
4971
- exports.TAG_BODY = "body";
4972
- exports.TAG_BEFORE = "before";
4973
- exports.TAG_AFTER = "after";
4974
- exports.TAG_ATTR = "attribute";
5262
+ exports.HTML_TAG_HEAD = "HEAD";
5263
+ exports.HTML_TAG_FORM = "FORM";
5264
+ exports.HTML_TAG_BODY = "BODY";
5265
+ exports.HTML_TAG_LINK = "LINK";
5266
+ exports.HTML_TAG_SCRIPT = "SCRIPT";
5267
+ exports.HTML_TAG_STYLE = "STYLE";
4975
5268
  exports.SEL_VIEWSTATE_ELEM = "[name='" + exports.P_VIEWSTATE + "']";
4976
5269
  exports.SEL_CLIENT_WINDOW_ELEM = "[name='" + exports.P_CLIENT_WINDOW + "']";
4977
5270
  exports.SEL_RESPONSE_XML = "responseXML";
@@ -4982,29 +5275,31 @@ exports.ATTR_NAME = "name";
4982
5275
  exports.ATTR_VALUE = "value";
4983
5276
  exports.ATTR_ID = "id";
4984
5277
  /*partial response types*/
4985
- exports.RESP_PARTIAL = "partial-response";
5278
+ exports.XML_TAG_PARTIAL_RESP = "partial-response";
4986
5279
  /*partial commands*/
4987
- exports.CMD_CHANGES = "changes";
4988
- exports.CMD_UPDATE = "update";
4989
- exports.CMD_DELETE = "delete";
4990
- exports.CMD_INSERT = "insert";
4991
- exports.CMD_EVAL = "eval";
4992
- exports.CMD_ERROR = "error";
4993
- exports.CMD_ATTRIBUTES = "attributes";
4994
- exports.CMD_EXTENSION = "extension";
4995
- exports.CMD_REDIRECT = "redirect";
5280
+ exports.XML_TAG_CHANGES = "changes";
5281
+ exports.XML_TAG_UPDATE = "update";
5282
+ exports.XML_TAG_DELETE = "delete";
5283
+ exports.XML_TAG_INSERT = "insert";
5284
+ exports.XML_TAG_EVAL = "eval";
5285
+ exports.XML_TAG_ERROR = "error";
5286
+ exports.XML_TAG_ATTRIBUTES = "attributes";
5287
+ exports.XML_TAG_EXTENSION = "extension";
5288
+ exports.XML_TAG_REDIRECT = "redirect";
5289
+ exports.XML_TAG_BEFORE = "before";
5290
+ exports.XML_TAG_AFTER = "after";
5291
+ exports.XML_TAG_ATTR = "attribute";
4996
5292
  /*other constants*/
4997
- exports.UPDATE_FORMS = "_updateForms";
4998
- exports.UPDATE_ELEMS = "_updateElems";
5293
+ exports.UPDATE_FORMS = "myfaces.updateForms";
5294
+ exports.UPDATE_ELEMS = "myfaces.updateElems";
4999
5295
  //we want the head elements to be processed before we process the body
5000
5296
  //but after the inner html is done
5001
- exports.DEFERRED_HEAD_INSERTS = "_headElems";
5297
+ exports.DEFERRED_HEAD_INSERTS = "myfaces.headElems";
5002
5298
  exports.MYFACES = "myfaces";
5003
- exports.SEL_SCRIPTS_STYLES = "script, style, link";
5004
5299
  exports.MF_NONE = "__mf_none__";
5005
5300
  exports.REASON_EXPIRED = "Expired";
5006
- exports.APPLIED_VST = "appliedViewState";
5007
- exports.APPLIED_CLIENT_WINDOW = "appliedClientWindow";
5301
+ exports.APPLIED_VST = "myfaces.appliedViewState";
5302
+ exports.APPLIED_CLIENT_WINDOW = "myfaces.appliedClientWindow";
5008
5303
  exports.RECONNECT_INTERVAL = 500;
5009
5304
  exports.MAX_RECONNECT_ATTEMPTS = 25;
5010
5305
  exports.UNKNOWN = "UNKNOWN";
@@ -5015,6 +5310,11 @@ exports.UNKNOWN = "UNKNOWN";
5015
5310
  * To take the compatibility layer out this method just has to be
5016
5311
  * changed to a simple value passthrough
5017
5312
  */
5313
+ function $faces() {
5314
+ var _a;
5315
+ return ((_a = window === null || window === void 0 ? void 0 : window.faces) !== null && _a !== void 0 ? _a : window === null || window === void 0 ? void 0 : window.jsf);
5316
+ }
5317
+ exports.$faces = $faces;
5018
5318
  function $nsp(inputNamespace) {
5019
5319
  if ((!inputNamespace) || !(inputNamespace === null || inputNamespace === void 0 ? void 0 : inputNamespace.replace)) {
5020
5320
  return inputNamespace;
@@ -5220,10 +5520,8 @@ exports.Assertions = void 0;
5220
5520
  * limitations under the License.
5221
5521
  */
5222
5522
  const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
5223
- const Lang_1 = __webpack_require__(/*! ./Lang */ "./src/main/typescript/impl/util/Lang.ts");
5224
- var getMessage = Lang_1.ExtLang.getMessage;
5225
- var makeException = Lang_1.ExtLang.makeException;
5226
5523
  const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
5524
+ const Lang_1 = __webpack_require__(/*! ./Lang */ "./src/main/typescript/impl/util/Lang.ts");
5227
5525
  /**
5228
5526
  * a set of internal code assertions
5229
5527
  * which raise an error
@@ -5238,12 +5536,12 @@ var Assertions;
5238
5536
  assertFunction(options.getIf(Const_1.ON_EVENT).value);
5239
5537
  //improve the error messages if an empty elem is passed
5240
5538
  //Assertions.assertElementExists(elem);
5241
- assert(elem.isPresent(), getMessage("ERR_MUST_BE_PROVIDED1", "{0}: source must be provided or exist", "source element id"), "faces.ajax.request", "ArgNotSet");
5539
+ assert(elem.isPresent(), Lang_1.ExtLang.getMessage("ERR_MUST_BE_PROVIDED1", "{0}: source must be provided or exist", "source element id"), "faces.ajax.request", "ArgNotSet");
5242
5540
  }
5243
5541
  Assertions.assertRequestIntegrity = assertRequestIntegrity;
5244
5542
  function assertUrlExists(node) {
5245
5543
  if (node.attr(Const_1.ATTR_URL).isAbsent()) {
5246
- throw Assertions.raiseError(new Error(), getMessage("ERR_RED_URL", null, "processRedirect"), "processRedirect");
5544
+ throw Assertions.raiseError(new Error(), Lang_1.ExtLang.getMessage("ERR_RED_URL", null, "processRedirect"), "processRedirect");
5247
5545
  }
5248
5546
  }
5249
5547
  Assertions.assertUrlExists = assertUrlExists;
@@ -5254,7 +5552,7 @@ var Assertions;
5254
5552
  function assertValidXMLResponse(responseXML) {
5255
5553
  assert(!responseXML.isAbsent(), Const_1.EMPTY_RESPONSE, Const_1.PHASE_PROCESS_RESPONSE);
5256
5554
  assert(!responseXML.isXMLParserError(), responseXML.parserErrorText(Const_1.EMPTY_STR), Const_1.PHASE_PROCESS_RESPONSE);
5257
- assert(responseXML.querySelectorAll(Const_1.RESP_PARTIAL).isPresent(), Const_1.ERR_NO_PARTIAL_RESPONSE, Const_1.PHASE_PROCESS_RESPONSE);
5555
+ assert(responseXML.querySelectorAll(Const_1.XML_TAG_PARTIAL_RESP).isPresent(), Const_1.ERR_NO_PARTIAL_RESPONSE, Const_1.PHASE_PROCESS_RESPONSE);
5258
5556
  }
5259
5557
  Assertions.assertValidXMLResponse = assertValidXMLResponse;
5260
5558
  /**
@@ -5272,7 +5570,7 @@ var Assertions;
5272
5570
  let finalName = name !== null && name !== void 0 ? name : Const_1.MALFORMEDXML;
5273
5571
  let finalMessage = message !== null && message !== void 0 ? message : Const_1.EMPTY_STR;
5274
5572
  //TODO clean up the messy makeException, this is a perfect case for encapsulation and sane defaults
5275
- return makeException(error, finalTitle, finalName, "Response", caller || ((arguments.caller) ? arguments.caller.toString() : "_raiseError"), finalMessage);
5573
+ return Lang_1.ExtLang.makeException(error, finalTitle, finalName, "Response", caller || ((arguments.caller) ? arguments.caller.toString() : "_raiseError"), finalMessage);
5276
5574
  }
5277
5575
  Assertions.raiseError = raiseError;
5278
5576
  /*
@@ -5295,6 +5593,13 @@ var Assertions;
5295
5593
  assertType(value, "function", msg, caller, title);
5296
5594
  }
5297
5595
  Assertions.assertFunction = assertFunction;
5596
+ function assertDelay(value) {
5597
+ if (!(value >= 0)) { // >= 0 abbreviation which covers all cases of non positive values,
5598
+ // including NaN and non numeric strings, no type equality is deliberate here,
5599
+ throw new Error("Invalid delay value: " + value);
5600
+ }
5601
+ }
5602
+ Assertions.assertDelay = assertDelay;
5298
5603
  })(Assertions = exports.Assertions || (exports.Assertions = {}));
5299
5604
 
5300
5605
 
@@ -5610,8 +5915,8 @@ class ExtDomQuery extends mona_dish_1.DQ {
5610
5915
  return true;
5611
5916
  }
5612
5917
  let reference = element.attr("href")
5613
- .orElse(element.attr("src").value)
5614
- .orElse(element.attr("rel").value);
5918
+ .orElseLazy(() => element.attr("src").value)
5919
+ .orElseLazy(() => element.attr("rel").value);
5615
5920
  if (!reference.isPresent()) {
5616
5921
  return true;
5617
5922
  }
@@ -5649,6 +5954,9 @@ class ExtDomQuery extends mona_dish_1.DQ {
5649
5954
  var _a, _b;
5650
5955
  return (_b = (_a = curScript.getAsElem(0).value) === null || _a === void 0 ? void 0 : _a.nonce) !== null && _b !== void 0 ? _b : curScript.attr("nonce").value;
5651
5956
  }
5957
+ filter(func) {
5958
+ return new ExtDomQuery(super.filter(func));
5959
+ }
5652
5960
  }
5653
5961
  exports.ExtDomQuery = ExtDomQuery;
5654
5962
  exports.ExtDQ = ExtDomQuery;
@@ -5659,6 +5967,7 @@ exports.ExtDQ = ExtDomQuery;
5659
5967
  class ExtConfig extends mona_dish_1.Config {
5660
5968
  constructor(root) {
5661
5969
  super(root);
5970
+ this.$nspEnabled = true;
5662
5971
  }
5663
5972
  assignIf(condition, ...accessPath) {
5664
5973
  const accessPathMapped = this.remap(accessPath);
@@ -5715,12 +6024,93 @@ class ExtConfig extends mona_dish_1.Config {
5715
6024
  * @private returns an array of access paths with version remapped namespaces
5716
6025
  */
5717
6026
  remap(accessPath) {
6027
+ if (!this.$nspEnabled) {
6028
+ return accessPath;
6029
+ }
5718
6030
  return mona_dish_1.Stream.of(...accessPath).map(key => (0, Const_1.$nsp)(key)).collect(new mona_dish_1.ArrayCollector());
5719
6031
  }
5720
6032
  }
5721
6033
  exports.ExtConfig = ExtConfig;
5722
6034
 
5723
6035
 
6036
+ /***/ }),
6037
+
6038
+ /***/ "./src/main/typescript/impl/util/HiddenInputBuilder.ts":
6039
+ /*!*************************************************************!*\
6040
+ !*** ./src/main/typescript/impl/util/HiddenInputBuilder.ts ***!
6041
+ \*************************************************************/
6042
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6043
+
6044
+
6045
+ /*! Licensed to the Apache Software Foundation (ASF) under one or more
6046
+ * contributor license agreements. See the NOTICE file distributed with
6047
+ * this work for additional information regarding copyright ownership.
6048
+ * The ASF licenses this file to you under the Apache License, Version 2.0
6049
+ * (the "License"); you may not use this file except in compliance with
6050
+ * the License. You may obtain a copy of the License at
6051
+ *
6052
+ * http://www.apache.org/licenses/LICENSE-2.0
6053
+ *
6054
+ * Unless required by applicable law or agreed to in writing, software
6055
+ * distributed under the License is distributed on an "AS IS" BASIS,
6056
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6057
+ * See the License for the specific language governing permissions and
6058
+ * limitations under the License.
6059
+ *
6060
+ */
6061
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
6062
+ exports.HiddenInputBuilder = void 0;
6063
+ const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
6064
+ const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
6065
+ /**
6066
+ * Builder for hidden inputs.
6067
+ * ATM only ViewState and Client window
6068
+ * are supported (per spec)
6069
+ *
6070
+ * Improves readability in the response processor!
6071
+ */
6072
+ class HiddenInputBuilder {
6073
+ constructor(selector) {
6074
+ this.selector = selector;
6075
+ const isViewState = selector.indexOf((0, Const_1.$nsp)(Const_1.P_VIEWSTATE)) != -1;
6076
+ this.name = isViewState ? Const_1.P_VIEWSTATE : Const_1.P_CLIENT_WINDOW;
6077
+ this.template = isViewState ? Const_1.HTML_VIEWSTATE : Const_1.HTML_CLIENT_WINDOW;
6078
+ }
6079
+ withNamingContainerId(namingContainer) {
6080
+ this.namingContainerId = namingContainer;
6081
+ return this;
6082
+ }
6083
+ withParent(parent) {
6084
+ this.parent = parent;
6085
+ return this;
6086
+ }
6087
+ build() {
6088
+ var _a, _b, _c;
6089
+ const SEP = (0, Const_1.$faces)().separatorchar;
6090
+ let existingStates = (0, mona_dish_1.DQ$)(`[name*='${(0, Const_1.$nsp)(this.name)}']`);
6091
+ let cnt = existingStates.stream.map(state => {
6092
+ let ident = state.id.orElse("-1").value;
6093
+ ident = ident.substring(ident.lastIndexOf(SEP) + 1);
6094
+ return parseInt(ident);
6095
+ })
6096
+ .filter(item => !isNaN(item))
6097
+ .reduce((item1, item2) => Math.max(item1, item2), -1).value;
6098
+ //the maximum new ident is the current max + 1
6099
+ cnt++;
6100
+ const newElement = mona_dish_1.DQ.fromMarkup((0, Const_1.$nsp)(this.template));
6101
+ newElement.id.value = (((_a = this.namingContainerId) === null || _a === void 0 ? void 0 : _a.length) ?
6102
+ [this.namingContainerId, (0, Const_1.$nsp)(this.name), cnt] :
6103
+ [(0, Const_1.$nsp)(this.name), cnt]).join(SEP);
6104
+ //name must be prefixed with the naming container id as well according to the jsdocs
6105
+ newElement.name.value = ((_b = this.namingContainerId) === null || _b === void 0 ? void 0 : _b.length) ?
6106
+ [this.namingContainerId, (0, Const_1.$nsp)(this.name)].join(SEP) : (0, Const_1.$nsp)(this.name);
6107
+ (_c = this === null || this === void 0 ? void 0 : this.parent) === null || _c === void 0 ? void 0 : _c.append(newElement);
6108
+ return newElement;
6109
+ }
6110
+ }
6111
+ exports.HiddenInputBuilder = HiddenInputBuilder;
6112
+
6113
+
5724
6114
  /***/ }),
5725
6115
 
5726
6116
  /***/ "./src/main/typescript/impl/util/Lang.ts":
@@ -5745,8 +6135,6 @@ exports.ExtConfig = ExtConfig;
5745
6135
  * See the License for the specific language governing permissions and
5746
6136
  * limitations under the License.
5747
6137
  *
5748
- * todo replace singleton with module definition
5749
- *
5750
6138
  */
5751
6139
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5752
6140
  exports.ExtLang = void 0;
@@ -5887,22 +6275,22 @@ var ExtLang;
5887
6275
  */
5888
6276
  function getForm(elem, event) {
5889
6277
  let queryElem = new mona_dish_1.DQ(elem);
5890
- let eventTarget = new mona_dish_1.DQ((0, RequestDataResolver_1.getEventTarget)(event));
5891
- if (queryElem.isTag(Const_1.TAG_FORM)) {
6278
+ let eventTarget = (event) ? new mona_dish_1.DQ((0, RequestDataResolver_1.getEventTarget)(event)) : mona_dish_1.DomQuery.absent;
6279
+ if (queryElem.isTag(Const_1.HTML_TAG_FORM)) {
5892
6280
  return queryElem;
5893
6281
  }
5894
6282
  //html 5 for handling
5895
- if (queryElem.attr(Const_1.TAG_FORM).isPresent()) {
5896
- let formId = queryElem.attr(Const_1.TAG_FORM).value;
6283
+ if (queryElem.attr(Const_1.HTML_TAG_FORM).isPresent()) {
6284
+ let formId = queryElem.attr(Const_1.HTML_TAG_FORM).value;
5897
6285
  let foundForm = mona_dish_1.DQ.byId(formId, true);
5898
6286
  if (foundForm.isPresent()) {
5899
6287
  return foundForm;
5900
6288
  }
5901
6289
  }
5902
- let form = queryElem.parents(Const_1.TAG_FORM)
5903
- .orElseLazy(() => queryElem.byTagName(Const_1.TAG_FORM, true))
5904
- .orElseLazy(() => eventTarget.parents(Const_1.TAG_FORM))
5905
- .orElseLazy(() => eventTarget.byTagName(Const_1.TAG_FORM))
6290
+ let form = queryElem.firstParent(Const_1.HTML_TAG_FORM)
6291
+ .orElseLazy(() => queryElem.byTagName(Const_1.HTML_TAG_FORM, true))
6292
+ .orElseLazy(() => eventTarget.firstParent(Const_1.HTML_TAG_FORM))
6293
+ .orElseLazy(() => eventTarget.byTagName(Const_1.HTML_TAG_FORM))
5906
6294
  .first();
5907
6295
  assertFormExists(form);
5908
6296
  return form;
@@ -5985,13 +6373,15 @@ var ErrorType;
5985
6373
  * I will add deprecated myfaces backwards compatibility attributes as well
5986
6374
  */
5987
6375
  class ErrorData extends EventData_1.EventData {
5988
- constructor(source, errorName, errorMessage, responseText = null, responseXML = null, responseCode = "200", status = "UNKNOWN", type = ErrorType.CLIENT_ERROR) {
6376
+ constructor(source, errorName, errorMessage, responseText = null, responseXML = null, responseCode = "200", status = "", type = ErrorType.CLIENT_ERROR) {
5989
6377
  super();
5990
6378
  this.type = "error";
5991
- this.source = source;
5992
- this.type = "error";
6379
+ this.source = document.getElementById(source);
6380
+ this.sourceId = source;
6381
+ this.type = Const_1.ERROR;
5993
6382
  this.errorName = errorName;
5994
- this.message = this.errorMessage = errorMessage;
6383
+ //tck requires that the type is prefixed to the message itself (jsdoc also) in case of a server error
6384
+ this.message = this.errorMessage = (type == Const_1.SERVER_ERROR) ? type + ": " + errorMessage : errorMessage;
5995
6385
  this.responseCode = responseCode;
5996
6386
  this.responseText = responseText;
5997
6387
  this.status = status;
@@ -6002,10 +6392,10 @@ class ErrorData extends EventData_1.EventData {
6002
6392
  }
6003
6393
  }
6004
6394
  static fromClient(e) {
6005
- var _a, _b, _c;
6006
- return new ErrorData("client", (_a = e === null || e === void 0 ? void 0 : e.name) !== null && _a !== void 0 ? _a : '', (_b = e === null || e === void 0 ? void 0 : e.message) !== null && _b !== void 0 ? _b : '', (_c = e === null || e === void 0 ? void 0 : e.stack) !== null && _c !== void 0 ? _c : '');
6395
+ var _a, _b, _c, _d;
6396
+ return new ErrorData((_a = e === null || e === void 0 ? void 0 : e.source) !== null && _a !== void 0 ? _a : "client", (_b = e === null || e === void 0 ? void 0 : e.name) !== null && _b !== void 0 ? _b : Const_1.EMPTY_STR, (_c = e === null || e === void 0 ? void 0 : e.message) !== null && _c !== void 0 ? _c : Const_1.EMPTY_STR, (_d = e === null || e === void 0 ? void 0 : e.stack) !== null && _d !== void 0 ? _d : Const_1.EMPTY_STR);
6007
6397
  }
6008
- static fromHttpConnection(source, name, message, responseText, responseCode, status = 'UNKNOWN') {
6398
+ static fromHttpConnection(source, name, message, responseText, responseCode, status = Const_1.EMPTY_STR) {
6009
6399
  return new ErrorData(source, name, message, responseText, responseCode, `${responseCode}`, status, ErrorType.HTTP_ERROR);
6010
6400
  }
6011
6401
  static fromGeneric(context, errorCode, errorType = ErrorType.SERVER_ERROR) {
@@ -6019,7 +6409,7 @@ class ErrorData extends EventData_1.EventData {
6019
6409
  return new ErrorData(source, errorName, errorMessage, responseText, responseXML, errorCode + Const_1.EMPTY_STR, status, errorType);
6020
6410
  }
6021
6411
  static getMsg(context, param) {
6022
- return getMessage(context.getIf(param).orElse(Const_1.UNKNOWN).value);
6412
+ return getMessage(context.getIf(param).orElse(Const_1.EMPTY_STR).value);
6023
6413
  }
6024
6414
  static fromServerError(context) {
6025
6415
  return this.fromGeneric(context, -1);
@@ -6064,7 +6454,7 @@ class EventData {
6064
6454
  eventData.status = name;
6065
6455
  let sourceId = context.getIf(Const_1.SOURCE)
6066
6456
  .orElseLazy(() => context.getIf(Const_1.P_PARTIAL_SOURCE).value)
6067
- .orElseLazy(() => context.getIf(Const_1.CTX_PARAM_PASS_THR, Const_1.P_PARTIAL_SOURCE).value)
6457
+ .orElseLazy(() => context.getIf(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_PARTIAL_SOURCE).value)
6068
6458
  .value;
6069
6459
  if (sourceId) {
6070
6460
  eventData.source = mona_dish_1.DQ.byId(sourceId, true).first().value.value;
@@ -6105,11 +6495,12 @@ exports.EventData = EventData;
6105
6495
  * limitations under the License.
6106
6496
  */
6107
6497
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6108
- exports.resolveDefaults = exports.getEventTarget = exports.resolveWindowId = exports.resolveDelay = exports.resolveTimeout = exports.resolveForm = exports.resolveFinalUrl = exports.resolveTargetUrl = exports.resolveHandlerFunc = void 0;
6498
+ exports.resolveDefaults = exports.getEventTarget = exports.resolveWindowId = exports.resolveDelay = exports.resolveTimeout = exports.resolveViewId = exports.resolveForm = exports.resolveFinalUrl = exports.resolveTargetUrl = exports.resolveHandlerFunc = void 0;
6109
6499
  const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
6110
6500
  const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
6111
6501
  const Lang_1 = __webpack_require__(/*! ../util/Lang */ "./src/main/typescript/impl/util/Lang.ts");
6112
6502
  const ExtDomQuery_1 = __webpack_require__(/*! ../util/ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
6503
+ const Assertions_1 = __webpack_require__(/*! ../util/Assertions */ "./src/main/typescript/impl/util/Assertions.ts");
6113
6504
  /**
6114
6505
  * Resolver functions for various aspects of the request data
6115
6506
  *
@@ -6146,22 +6537,27 @@ exports.resolveFinalUrl = resolveFinalUrl;
6146
6537
  * it is either the id or the parent form of the element or an embedded form
6147
6538
  * of the element
6148
6539
  *
6149
- * @param requestCtx
6150
6540
  * @param elem
6151
6541
  * @param event
6152
6542
  */
6153
- function resolveForm(requestCtx, elem, event) {
6154
- var _a, _b, _c;
6155
- const configId = (_c = (_b = (_a = requestCtx.value) === null || _a === void 0 ? void 0 : _a.myfaces) === null || _b === void 0 ? void 0 : _b.form) !== null && _c !== void 0 ? _c : Const_1.MF_NONE;
6156
- return mona_dish_1.DQ
6157
- .byId(configId, true)
6158
- .orElseLazy(() => Lang_1.ExtLang.getForm(elem.getAsElem(0).value, event));
6543
+ function resolveForm(elem, event) {
6544
+ return Lang_1.ExtLang.getForm(elem.getAsElem(0).value, event);
6159
6545
  }
6160
6546
  exports.resolveForm = resolveForm;
6547
+ function resolveViewId(form) {
6548
+ const viewState = form.querySelectorAll(`input[type='hidden'][name*='${(0, Const_1.$nsp)(Const_1.P_VIEWSTATE)}']`).id.orElse("").value;
6549
+ const divider = (0, Const_1.$faces)().separatorchar;
6550
+ const viewId = viewState.split(divider, 2)[0];
6551
+ const viewStateViewId = viewId.indexOf((0, Const_1.$nsp)(Const_1.P_VIEWSTATE)) === -1 ? viewId : "";
6552
+ // myfaces specific, we in non portlet environments prepend the viewId
6553
+ // even without being in a naming container, the other components ignore that
6554
+ return form.id.value.indexOf(viewStateViewId) === 0 ? viewStateViewId : "";
6555
+ }
6556
+ exports.resolveViewId = resolveViewId;
6161
6557
  function resolveTimeout(options) {
6162
6558
  var _a;
6163
6559
  let getCfg = Lang_1.ExtLang.getLocalOrGlobalConfig;
6164
- return (_a = options.getIf(Const_1.CTX_PARAM_TIMEOUT).value) !== null && _a !== void 0 ? _a : getCfg(options.value, Const_1.CTX_PARAM_TIMEOUT, 0);
6560
+ return (_a = options.getIf(Const_1.CTX_OPTIONS_TIMEOUT).value) !== null && _a !== void 0 ? _a : getCfg(options.value, Const_1.CTX_OPTIONS_TIMEOUT, 0);
6165
6561
  }
6166
6562
  exports.resolveTimeout = resolveTimeout;
6167
6563
  /**
@@ -6170,9 +6566,15 @@ exports.resolveTimeout = resolveTimeout;
6170
6566
  * @param options ... the options object, in most cases it will host the delay value
6171
6567
  */
6172
6568
  function resolveDelay(options) {
6173
- var _a;
6174
- let getCfg = Lang_1.ExtLang.getLocalOrGlobalConfig;
6175
- return (_a = options.getIf(Const_1.CTX_PARAM_DELAY).value) !== null && _a !== void 0 ? _a : getCfg(options.value, Const_1.CTX_PARAM_DELAY, 0);
6569
+ // null, 'none', or undefined will automatically be mapped to 0 aka no delay
6570
+ // the config delay will be dropped not needed anymore, it does not really
6571
+ // make sense anymore now that it is part of a local spec
6572
+ let ret = options.getIf(Const_1.CTX_OPTIONS_DELAY).orElse(0).value;
6573
+ // if delay === none, no delay must be used, aka delay 0
6574
+ ret = (Const_1.DELAY_NONE === ret) ? 0 : ret;
6575
+ // negative, or invalid values will automatically get a js exception
6576
+ Assertions_1.Assertions.assertDelay(ret);
6577
+ return ret;
6176
6578
  }
6177
6579
  exports.resolveDelay = resolveDelay;
6178
6580
  /**
@@ -6221,11 +6623,18 @@ exports.getEventTarget = getEventTarget;
6221
6623
  * @param opts
6222
6624
  * @param el
6223
6625
  */
6224
- function resolveDefaults(event, opts = {}, el = null) {
6626
+ function resolveDefaults(event, opts, el = null) {
6225
6627
  var _a;
6226
6628
  //deep copy the options, so that further transformations to not backfire into the callers
6227
- const resolvedEvent = event, options = new ExtDomQuery_1.ExtConfig(opts).deepCopy, elem = mona_dish_1.DQ.byId(el || resolvedEvent.target, true), elementId = elem.id.value, requestCtx = new ExtDomQuery_1.ExtConfig({}), internalCtx = new ExtDomQuery_1.ExtConfig({}), windowId = resolveWindowId(options), isResetValues = true === ((_a = options.value) === null || _a === void 0 ? void 0 : _a.resetValues);
6228
- return { resolvedEvent, options, elem, elementId, requestCtx, internalCtx, windowId, isResetValues };
6629
+ const elem = mona_dish_1.DQ.byId(el || event.target, true);
6630
+ const options = new ExtDomQuery_1.ExtConfig(opts).deepCopy;
6631
+ return {
6632
+ options: options,
6633
+ elem: elem,
6634
+ elementId: elem.id.value,
6635
+ windowId: resolveWindowId(options),
6636
+ isResetValues: true === ((_a = options.value) === null || _a === void 0 ? void 0 : _a.resetValues)
6637
+ };
6229
6638
  }
6230
6639
  exports.resolveDefaults = resolveDefaults;
6231
6640
 
@@ -6331,9 +6740,9 @@ exports.resolveSourceElement = resolveSourceElement;
6331
6740
  function resolveSourceForm(internalContext, elem) {
6332
6741
  let sourceFormId = internalContext.getIf(Const_1.CTX_PARAM_SRC_FRM_ID);
6333
6742
  let sourceForm = new mona_dish_2.DQ(sourceFormId.isPresent() ? document.forms[sourceFormId.value] : null);
6334
- sourceForm = sourceForm.orElseLazy(() => elem.parents(Const_1.TAG_FORM))
6335
- .orElseLazy(() => elem.querySelectorAll(Const_1.TAG_FORM))
6336
- .orElseLazy(() => mona_dish_2.DQ.querySelectorAll(Const_1.TAG_FORM));
6743
+ sourceForm = sourceForm.orElseLazy(() => elem.firstParent(Const_1.HTML_TAG_FORM))
6744
+ .orElseLazy(() => elem.querySelectorAll(Const_1.HTML_TAG_FORM))
6745
+ .orElseLazy(() => mona_dish_2.DQ.querySelectorAll(Const_1.HTML_TAG_FORM));
6337
6746
  return sourceForm;
6338
6747
  }
6339
6748
  exports.resolveSourceForm = resolveSourceForm;
@@ -6395,7 +6804,7 @@ var Response;
6395
6804
  let responseProcessor = new ResponseProcessor_1.ResponseProcessor(req, externalContext, internalContext);
6396
6805
  internalContext.assign(Const_1.RESPONSE_XML).value = responseXML;
6397
6806
  // we now process the partial tags, or in none given raise an error
6398
- responseXML.querySelectorAll(Const_1.RESP_PARTIAL)
6807
+ responseXML.querySelectorAll(Const_1.XML_TAG_PARTIAL_RESP)
6399
6808
  .each(item => processPartialTag(item, responseProcessor, internalContext));
6400
6809
  // We now process the viewStates, client windows and the elements to be evaluated are delayed.
6401
6810
  // The reason for this is that often it is better
@@ -6414,17 +6823,17 @@ var Response;
6414
6823
  */
6415
6824
  function processPartialTag(node, responseProcessor, internalContext) {
6416
6825
  internalContext.assign(Const_1.PARTIAL_ID).value = node.id;
6417
- const SEL_SUB_TAGS = [Const_1.CMD_ERROR, Const_1.CMD_REDIRECT, Const_1.CMD_CHANGES].join(",");
6826
+ const SEL_SUB_TAGS = [Const_1.XML_TAG_ERROR, Const_1.XML_TAG_REDIRECT, Const_1.XML_TAG_CHANGES].join(",");
6418
6827
  // now we can process the main operations
6419
6828
  node.querySelectorAll(SEL_SUB_TAGS).each((node) => {
6420
6829
  switch (node.tagName.value) {
6421
- case Const_1.CMD_ERROR:
6830
+ case Const_1.XML_TAG_ERROR:
6422
6831
  responseProcessor.error(node);
6423
6832
  break;
6424
- case Const_1.CMD_REDIRECT:
6833
+ case Const_1.XML_TAG_REDIRECT:
6425
6834
  responseProcessor.redirect(node);
6426
6835
  break;
6427
- case Const_1.CMD_CHANGES:
6836
+ case Const_1.XML_TAG_CHANGES:
6428
6837
  processChangesTag(node, responseProcessor);
6429
6838
  break;
6430
6839
  }
@@ -6432,7 +6841,7 @@ var Response;
6432
6841
  }
6433
6842
  let processInsert = function (responseProcessor, node) {
6434
6843
  // path1 insert after as child tags
6435
- if (node.querySelectorAll([Const_1.TAG_BEFORE, Const_1.TAG_AFTER].join(",")).length) {
6844
+ if (node.querySelectorAll([Const_1.XML_TAG_BEFORE, Const_1.XML_TAG_AFTER].join(",")).length) {
6436
6845
  responseProcessor.insertWithSubTags(node);
6437
6846
  }
6438
6847
  else { // insert before after with id
@@ -6446,25 +6855,25 @@ var Response;
6446
6855
  * @param responseProcessor
6447
6856
  */
6448
6857
  function processChangesTag(node, responseProcessor) {
6449
- const ALLOWED_TAGS = [Const_1.CMD_UPDATE, Const_1.CMD_EVAL, Const_1.CMD_INSERT, Const_1.CMD_DELETE, Const_1.CMD_ATTRIBUTES, Const_1.CMD_EXTENSION].join(", ");
6858
+ const ALLOWED_TAGS = [Const_1.XML_TAG_UPDATE, Const_1.XML_TAG_EVAL, Const_1.XML_TAG_INSERT, Const_1.XML_TAG_DELETE, Const_1.XML_TAG_ATTRIBUTES, Const_1.XML_TAG_EXTENSION].join(", ");
6450
6859
  node.querySelectorAll(ALLOWED_TAGS).each((node) => {
6451
6860
  switch (node.tagName.value) {
6452
- case Const_1.CMD_UPDATE:
6861
+ case Const_1.XML_TAG_UPDATE:
6453
6862
  processUpdateTag(node, responseProcessor);
6454
6863
  break;
6455
- case Const_1.CMD_EVAL:
6864
+ case Const_1.XML_TAG_EVAL:
6456
6865
  responseProcessor.eval(node);
6457
6866
  break;
6458
- case Const_1.CMD_INSERT:
6867
+ case Const_1.XML_TAG_INSERT:
6459
6868
  processInsert(responseProcessor, node);
6460
6869
  break;
6461
- case Const_1.CMD_DELETE:
6870
+ case Const_1.XML_TAG_DELETE:
6462
6871
  responseProcessor.delete(node);
6463
6872
  break;
6464
- case Const_1.CMD_ATTRIBUTES:
6873
+ case Const_1.XML_TAG_ATTRIBUTES:
6465
6874
  responseProcessor.attributes(node);
6466
6875
  break;
6467
- case Const_1.CMD_EXTENSION:
6876
+ case Const_1.XML_TAG_EXTENSION:
6468
6877
  break;
6469
6878
  }
6470
6879
  });
@@ -6557,8 +6966,9 @@ const ErrorData_1 = __webpack_require__(/*! ./ErrorData */ "./src/main/typescrip
6557
6966
  const ImplTypes_1 = __webpack_require__(/*! ../core/ImplTypes */ "./src/main/typescript/impl/core/ImplTypes.ts");
6558
6967
  const EventData_1 = __webpack_require__(/*! ./EventData */ "./src/main/typescript/impl/xhrCore/EventData.ts");
6559
6968
  const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
6560
- var trim = mona_dish_1.Lang.trim;
6561
6969
  const ExtDomQuery_1 = __webpack_require__(/*! ../util/ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
6970
+ const HiddenInputBuilder_1 = __webpack_require__(/*! ../util/HiddenInputBuilder */ "./src/main/typescript/impl/util/HiddenInputBuilder.ts");
6971
+ var trim = mona_dish_1.Lang.trim;
6562
6972
  /**
6563
6973
  * Response processor
6564
6974
  *
@@ -6584,22 +6994,31 @@ class ResponseProcessor {
6584
6994
  * the data incoming must represent the html representation of the head itself one way or the other
6585
6995
  */
6586
6996
  replaceHead(shadowDocument) {
6587
- let shadowHead = shadowDocument.querySelectorAll(Const_1.TAG_HEAD);
6997
+ const shadowHead = shadowDocument.querySelectorAll(Const_1.HTML_TAG_HEAD);
6588
6998
  if (!shadowHead.isPresent()) {
6589
6999
  return;
6590
7000
  }
6591
- let oldHead = ExtDomQuery_1.ExtDomQuery.querySelectorAll(Const_1.TAG_HEAD);
6592
- //delete all to avoid script and style overlays
6593
- oldHead.querySelectorAll(Const_1.SEL_SCRIPTS_STYLES).delete();
6594
- // we cannot replace new elements in the head, but we can eval the elements
6595
- // eval means the scripts will get attached (eval script attach method)
6596
- // but this is done by DomQuery not in this code
6597
- this.storeForEval(shadowHead);
7001
+ const head = ExtDomQuery_1.ExtDomQuery.querySelectorAll(Const_1.HTML_TAG_HEAD);
7002
+ // full replace we delete everything
7003
+ head.childNodes.delete();
7004
+ this.addToHead(shadowHead);
7005
+ //we copy the attributes as well (just in case myfaces introduces the id in head)
7006
+ head.copyAttrs(shadowHead);
7007
+ }
7008
+ addToHead(shadowHead) {
7009
+ const mappedHeadData = new ExtDomQuery_1.ExtDomQuery(shadowHead);
7010
+ const scriptTags = [Const_1.HTML_TAG_SCRIPT];
7011
+ const nonExecutables = mappedHeadData.filter(item => scriptTags.indexOf(item.tagName.orElse("").value) == -1);
7012
+ nonExecutables.runHeadInserts(true);
6598
7013
  //incoming either the outer head tag or its children
6599
- //shadowHead = (shadowHead.tagName.value === "HEAD") ? shadowHead.childNodes : shadowHead;
6600
- //this.addToHead(shadowHead);
6601
- }
6602
- addToHead(newElements) {
7014
+ const nodesToAdd = (shadowHead.tagName.value === "HEAD") ? shadowHead.childNodes : shadowHead;
7015
+ // this is stored for "post" processing
7016
+ // after the rest of the "physical build up", head before body
7017
+ const scriptElements = nodesToAdd.stream
7018
+ .filter(item => scriptTags.indexOf(item.tagName.orElse("").value) != -1).collect(new mona_dish_1.DomQueryCollector());
7019
+ this.addToHeadDeferred(scriptElements);
7020
+ }
7021
+ addToHeadDeferred(newElements) {
6603
7022
  this.internalContext.assign(Const_1.DEFERRED_HEAD_INSERTS).value.push(newElements);
6604
7023
  }
6605
7024
  /**
@@ -6611,17 +7030,18 @@ class ResponseProcessor {
6611
7030
  * @param shadowDocument .. an incoming shadow document hosting the new nodes
6612
7031
  */
6613
7032
  replaceBody(shadowDocument) {
6614
- let shadowBody = shadowDocument.querySelectorAll(Const_1.TAG_BODY);
7033
+ const shadowBody = shadowDocument.querySelectorAll(Const_1.HTML_TAG_BODY);
6615
7034
  if (!shadowBody.isPresent()) {
6616
7035
  return;
6617
7036
  }
6618
- let shadowInnerHTML = shadowBody.html().value;
6619
- let resultingBody = ExtDomQuery_1.ExtDomQuery.querySelectorAll(Const_1.TAG_BODY).html(shadowInnerHTML);
6620
- let updateForms = resultingBody.querySelectorAll(Const_1.TAG_FORM);
7037
+ const shadowInnerHTML = shadowBody.innerHTML;
7038
+ const resultingBody = ExtDomQuery_1.ExtDomQuery.querySelectorAll(Const_1.HTML_TAG_BODY);
7039
+ const updateForms = resultingBody.querySelectorAll(Const_1.HTML_TAG_FORM);
6621
7040
  // main difference, we cannot replace the body itself, but only its content
6622
7041
  // we need a separate step for post-processing the incoming
6623
7042
  // attributes, like classes, styles etc...
6624
- resultingBody.copyAttrs(shadowBody);
7043
+ resultingBody.html(shadowInnerHTML).copyAttrs(shadowBody);
7044
+ this.externalContext.assign((0, Const_1.$nsp)(Const_1.P_RENDER_OVERRIDE)).value = "@all";
6625
7045
  this.storeForPostProcessing(updateForms, resultingBody);
6626
7046
  }
6627
7047
  /**
@@ -6645,15 +7065,15 @@ class ResponseProcessor {
6645
7065
  * <error-message><![CDATA[message]]></error-message>
6646
7066
  * <error>
6647
7067
  */
6648
- let mergedErrorData = new ExtDomQuery_1.ExtConfig({});
7068
+ const mergedErrorData = new ExtDomQuery_1.ExtConfig({});
6649
7069
  mergedErrorData.assign(Const_1.SOURCE).value = this.externalContext.getIf(Const_1.P_PARTIAL_SOURCE).get(0).value;
6650
7070
  mergedErrorData.assign(Const_1.ERROR_NAME).value = node.querySelectorAll(Const_1.ERROR_NAME).textContent(Const_1.EMPTY_STR);
6651
7071
  mergedErrorData.assign(Const_1.ERROR_MESSAGE).value = node.querySelectorAll(Const_1.ERROR_MESSAGE).cDATAAsString;
6652
- let hasResponseXML = this.internalContext.get(Const_1.RESPONSE_XML).isPresent();
7072
+ const hasResponseXML = this.internalContext.get(Const_1.RESPONSE_XML).isPresent();
6653
7073
  //we now store the response xml also in the error data for further details
6654
7074
  mergedErrorData.assignIf(hasResponseXML, Const_1.RESPONSE_XML).value = this.internalContext.getIf(Const_1.RESPONSE_XML).value.get(0).value;
6655
7075
  // error post-processing and enrichment (standard messages from keys)
6656
- let errorData = ErrorData_1.ErrorData.fromServerError(mergedErrorData);
7076
+ const errorData = ErrorData_1.ErrorData.fromServerError(mergedErrorData);
6657
7077
  // we now trigger an internally stored onError function which might be an attached to the context
6658
7078
  // either we do not have an internal on error, or an on error has been based via params from the outside.
6659
7079
  // In both cases they are attached to our contexts
@@ -6667,7 +7087,7 @@ class ResponseProcessor {
6667
7087
  */
6668
7088
  redirect(node) {
6669
7089
  Assertions_1.Assertions.assertUrlExists(node);
6670
- let redirectUrl = trim(node.attr(Const_1.ATTR_URL).value);
7090
+ const redirectUrl = trim(node.attr(Const_1.ATTR_URL).value);
6671
7091
  if (redirectUrl != Const_1.EMPTY_STR) {
6672
7092
  window.location.href = redirectUrl;
6673
7093
  }
@@ -6678,8 +7098,8 @@ class ResponseProcessor {
6678
7098
  * @param cdataBlock the cdata block with the new html code
6679
7099
  */
6680
7100
  update(node, cdataBlock) {
6681
- let result = ExtDomQuery_1.ExtDomQuery.byId(node.id.value, true).outerHTML(cdataBlock, false, false);
6682
- let sourceForm = result === null || result === void 0 ? void 0 : result.parents(Const_1.TAG_FORM).orElseLazy(() => result.byTagName(Const_1.TAG_FORM, true));
7101
+ const result = ExtDomQuery_1.ExtDomQuery.byId(node.id.value, true).outerHTML(cdataBlock, false, false);
7102
+ 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));
6683
7103
  if (sourceForm) {
6684
7104
  this.storeForPostProcessing(sourceForm, result);
6685
7105
  }
@@ -6697,8 +7117,8 @@ class ResponseProcessor {
6697
7117
  * @param node
6698
7118
  */
6699
7119
  attributes(node) {
6700
- let elem = mona_dish_1.DQ.byId(node.id.value, true);
6701
- node.byTagName(Const_1.TAG_ATTR).each((item) => {
7120
+ const elem = mona_dish_1.DQ.byId(node.id.value, true);
7121
+ node.byTagName(Const_1.XML_TAG_ATTR).each((item) => {
6702
7122
  elem.attr(item.attr(Const_1.ATTR_NAME).value).value = item.attr(Const_1.ATTR_VALUE).value;
6703
7123
  });
6704
7124
  }
@@ -6716,15 +7136,15 @@ class ResponseProcessor {
6716
7136
  */
6717
7137
  insert(node) {
6718
7138
  //let insertId = node.id; //not used atm
6719
- let before = node.attr(Const_1.TAG_BEFORE);
6720
- let after = node.attr(Const_1.TAG_AFTER);
6721
- let insertNodes = mona_dish_1.DQ.fromMarkup(node.cDATAAsString);
7139
+ const before = node.attr(Const_1.XML_TAG_BEFORE);
7140
+ const after = node.attr(Const_1.XML_TAG_AFTER);
7141
+ const insertNodes = mona_dish_1.DQ.fromMarkup(node.cDATAAsString);
6722
7142
  if (before.isPresent()) {
6723
7143
  mona_dish_1.DQ.byId(before.value, true).insertBefore(insertNodes);
6724
7144
  this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(insertNodes);
6725
7145
  }
6726
7146
  if (after.isPresent()) {
6727
- let domQuery = mona_dish_1.DQ.byId(after.value, true);
7147
+ const domQuery = mona_dish_1.DQ.byId(after.value, true);
6728
7148
  domQuery.insertAfter(insertNodes);
6729
7149
  this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(insertNodes);
6730
7150
  }
@@ -6735,19 +7155,19 @@ class ResponseProcessor {
6735
7155
  * @param node the node hosting the insert data
6736
7156
  */
6737
7157
  insertWithSubTags(node) {
6738
- let before = node.querySelectorAll(Const_1.TAG_BEFORE);
6739
- let after = node.querySelectorAll(Const_1.TAG_AFTER);
7158
+ const before = node.querySelectorAll(Const_1.XML_TAG_BEFORE);
7159
+ const after = node.querySelectorAll(Const_1.XML_TAG_AFTER);
6740
7160
  before.each(item => {
6741
- let insertId = item.attr(Const_1.ATTR_ID);
6742
- let insertNodes = mona_dish_1.DQ.fromMarkup(item.cDATAAsString);
7161
+ const insertId = item.attr(Const_1.ATTR_ID);
7162
+ const insertNodes = mona_dish_1.DQ.fromMarkup(item.cDATAAsString);
6743
7163
  if (insertId.isPresent()) {
6744
7164
  mona_dish_1.DQ.byId(insertId.value, true).insertBefore(insertNodes);
6745
7165
  this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(insertNodes);
6746
7166
  }
6747
7167
  });
6748
7168
  after.each(item => {
6749
- let insertId = item.attr(Const_1.ATTR_ID);
6750
- let insertNodes = mona_dish_1.DQ.fromMarkup(item.cDATAAsString);
7169
+ const insertId = item.attr(Const_1.ATTR_ID);
7170
+ const insertNodes = mona_dish_1.DQ.fromMarkup(item.cDATAAsString);
6751
7171
  if (insertId.isPresent()) {
6752
7172
  mona_dish_1.DQ.byId(insertId.value, true).insertAfter(insertNodes);
6753
7173
  this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(insertNodes);
@@ -6761,7 +7181,7 @@ class ResponseProcessor {
6761
7181
  */
6762
7182
  processViewState(node) {
6763
7183
  if (ResponseProcessor.isViewStateNode(node)) {
6764
- let state = node.cDATAAsString;
7184
+ const state = node.cDATAAsString;
6765
7185
  this.internalContext.assign(Const_1.APPLIED_VST, node.id.value).value = new ImplTypes_1.StateHolder((0, Const_1.$nsp)(node.id.value), state);
6766
7186
  return true;
6767
7187
  }
@@ -6769,7 +7189,7 @@ class ResponseProcessor {
6769
7189
  }
6770
7190
  processClientWindow(node) {
6771
7191
  if (ResponseProcessor.isClientWindowNode(node)) {
6772
- let state = node.cDATAAsString;
7192
+ const state = node.cDATAAsString;
6773
7193
  this.internalContext.assign(Const_1.APPLIED_CLIENT_WINDOW, node.id.value).value = new ImplTypes_1.StateHolder((0, Const_1.$nsp)(node.id.value), state);
6774
7194
  return true;
6775
7195
  }
@@ -6795,12 +7215,11 @@ class ResponseProcessor {
6795
7215
  */
6796
7216
  fixViewStates() {
6797
7217
  mona_dish_1.Stream.ofAssoc(this.internalContext.getIf(Const_1.APPLIED_VST).orElse({}).value)
6798
- .each((item) => {
6799
- let value = item[1];
6800
- let nameSpace = mona_dish_1.DQ.byId(value.nameSpace, true).orElse(document.body);
6801
- let affectedForms = nameSpace.byTagName(Const_1.TAG_FORM);
6802
- let affectedForms2 = nameSpace.filter(item => item.tagName.orElse(Const_1.EMPTY_STR).value.toLowerCase() == Const_1.TAG_FORM);
6803
- this.appendViewStateToForms(new mona_dish_1.DomQuery(affectedForms, affectedForms2), value.value);
7218
+ .each(([, value]) => {
7219
+ const namingContainerId = this.internalContext.getIf(Const_1.PARTIAL_ID);
7220
+ const affectedForms = this.getContainerForms(namingContainerId)
7221
+ .filter(affectedForm => this.isInExecuteOrRender(affectedForm));
7222
+ this.appendViewStateToForms(affectedForms, value.value, namingContainerId.orElse("").value);
6804
7223
  });
6805
7224
  }
6806
7225
  /**
@@ -6809,21 +7228,20 @@ class ResponseProcessor {
6809
7228
  */
6810
7229
  fixClientWindow() {
6811
7230
  mona_dish_1.Stream.ofAssoc(this.internalContext.getIf(Const_1.APPLIED_CLIENT_WINDOW).orElse({}).value)
6812
- .each((item) => {
6813
- let value = item[1];
6814
- let nameSpace = mona_dish_1.DQ.byId(value.nameSpace, true).orElse(document.body);
6815
- let affectedForms = nameSpace.byTagName(Const_1.TAG_FORM);
6816
- let affectedForms2 = nameSpace.filter(item => item.tagName.orElse(Const_1.EMPTY_STR).value.toLowerCase() == Const_1.TAG_FORM);
6817
- this.appendClientWindowToForms(new mona_dish_1.DomQuery(affectedForms, affectedForms2), value.value);
7231
+ .each(([, value]) => {
7232
+ const namingContainerId = this.internalContext.getIf(Const_1.PARTIAL_ID);
7233
+ const affectedForms = this.getContainerForms(namingContainerId)
7234
+ .filter(affectedForm => this.isInExecuteOrRender(affectedForm));
7235
+ this.appendClientWindowToForms(affectedForms, value.value, namingContainerId.orElse("").value);
6818
7236
  });
6819
7237
  }
6820
7238
  /**
6821
7239
  * all processing done we can close the request and send the appropriate events
6822
7240
  */
6823
7241
  done() {
6824
- let eventData = EventData_1.EventData.createFromRequest(this.request.value, this.externalContext, Const_1.SUCCESS);
7242
+ const eventData = EventData_1.EventData.createFromRequest(this.request.value, this.externalContext, Const_1.SUCCESS);
6825
7243
  //because some frameworks might decorate them over the context in the response
6826
- let eventHandler = this.externalContext.getIf(Const_1.ON_EVENT).orElseLazy(() => this.internalContext.getIf(Const_1.ON_EVENT).value).orElse(Const_1.EMPTY_FUNC).value;
7244
+ const eventHandler = this.externalContext.getIf(Const_1.ON_EVENT).orElseLazy(() => this.internalContext.getIf(Const_1.ON_EVENT).value).orElse(Const_1.EMPTY_FUNC).value;
6827
7245
  AjaxImpl_1.Implementation.sendEvent(eventData, eventHandler);
6828
7246
  }
6829
7247
  /**
@@ -6831,18 +7249,20 @@ class ResponseProcessor {
6831
7249
  *
6832
7250
  * @param forms the forms to append the viewState to
6833
7251
  * @param viewState the final viewState
7252
+ * @param namingContainerId
6834
7253
  */
6835
- appendViewStateToForms(forms, viewState) {
6836
- this.assignState(forms, (0, Const_1.$nsp)(Const_1.SEL_VIEWSTATE_ELEM), viewState);
7254
+ appendViewStateToForms(forms, viewState, namingContainerId = "") {
7255
+ this.assignState(forms, (0, Const_1.$nsp)(Const_1.SEL_VIEWSTATE_ELEM), viewState, namingContainerId);
6837
7256
  }
6838
7257
  /**
6839
7258
  * proper clientWindow -> form assignment
6840
7259
  *
6841
7260
  * @param forms the forms to append the viewState to
6842
7261
  * @param clientWindow the final viewState
7262
+ * @param namingContainerId
6843
7263
  */
6844
- appendClientWindowToForms(forms, clientWindow) {
6845
- this.assignState(forms, (0, Const_1.$nsp)(Const_1.SEL_CLIENT_WINDOW_ELEM), clientWindow);
7264
+ appendClientWindowToForms(forms, clientWindow, namingContainerId = "") {
7265
+ this.assignState(forms, (0, Const_1.$nsp)(Const_1.SEL_CLIENT_WINDOW_ELEM), clientWindow, namingContainerId);
6846
7266
  }
6847
7267
  /**
6848
7268
  * generic append state which appends a certain state as hidden element to an existing set of forms
@@ -6851,26 +7271,26 @@ class ResponseProcessor {
6851
7271
  * @param selector the selector for the state
6852
7272
  * @param state the state itself which needs to be assigned
6853
7273
  *
7274
+ * @param namingContainerId
6854
7275
  * @private
6855
7276
  */
6856
- assignState(forms, selector, state) {
6857
- forms.each((form) => {
6858
- let stateHolders = form.querySelectorAll(selector)
6859
- .orElseLazy(() => ResponseProcessor.newViewStateElement(form));
6860
- stateHolders.attr("value").value = state;
7277
+ assignState(forms, selector, state, namingContainerId) {
7278
+ /**
7279
+ * creates the viewState or client window id element
7280
+ * @param form
7281
+ */
7282
+ const createAndAppendHiddenInput = (form) => {
7283
+ return new HiddenInputBuilder_1.HiddenInputBuilder(selector)
7284
+ .withNamingContainerId(namingContainerId)
7285
+ .withParent(form)
7286
+ .build();
7287
+ };
7288
+ forms.each(form => {
7289
+ const hiddenInput = form.querySelectorAll(selector)
7290
+ .orElseLazy(() => createAndAppendHiddenInput(form));
7291
+ hiddenInput.val = state;
6861
7292
  });
6862
7293
  }
6863
- /**
6864
- * Helper to Create a new JSF ViewState Element
6865
- *
6866
- * @param parent, the parent node to attach the viewState element to
6867
- * (usually a form node)
6868
- */
6869
- static newViewStateElement(parent) {
6870
- let newViewState = mona_dish_1.DQ.fromMarkup((0, Const_1.$nsp)(Const_1.HTML_VIEWSTATE));
6871
- newViewState.appendTo(parent);
6872
- return newViewState;
6873
- }
6874
7294
  /**
6875
7295
  * Stores certain aspects of the dom for later post-processing
6876
7296
  *
@@ -6904,11 +7324,11 @@ class ResponseProcessor {
6904
7324
  * @returns if it is a viewState node
6905
7325
  */
6906
7326
  static isViewStateNode(node) {
6907
- var _a, _b, _c, _d, _e, _f, _g;
6908
- let 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;
6909
- 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) ||
6910
- ((_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 ||
6911
- ((_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);
7327
+ var _a, _b, _c, _d, _e, _f;
7328
+ const SEP = (0, Const_1.$faces)().separatorchar;
7329
+ 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) ||
7330
+ ((_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 ||
7331
+ ((_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);
6912
7332
  }
6913
7333
  /**
6914
7334
  * incoming client window node also needs special processing
@@ -6917,14 +7337,57 @@ class ResponseProcessor {
6917
7337
  * @returns true of it ii
6918
7338
  */
6919
7339
  static isClientWindowNode(node) {
6920
- var _a, _b, _c, _d, _e, _f, _g;
6921
- let 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;
6922
- 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) ||
6923
- ((_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 ||
6924
- ((_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);
7340
+ var _a, _b, _c, _d, _e, _f;
7341
+ const SEP = (0, Const_1.$faces)().separatorchar;
7342
+ 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) ||
7343
+ ((_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 ||
7344
+ ((_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);
6925
7345
  }
6926
7346
  triggerOnError(errorData) {
6927
- this.externalContext.getIf(Const_1.ON_ERROR).orElse(this.internalContext.getIf(Const_1.ON_ERROR).value).orElse(Const_1.EMPTY_FUNC).value(errorData);
7347
+ this.externalContext.getIf(Const_1.ON_ERROR).orElseLazy(() => this.internalContext.getIf(Const_1.ON_ERROR).value).orElse(Const_1.EMPTY_FUNC).value(errorData);
7348
+ }
7349
+ /**
7350
+ * filters the forms according to being member of the "execute" or "render" cycle
7351
+ * @param affectedForm
7352
+ * @private
7353
+ */
7354
+ isInExecuteOrRender(affectedForm) {
7355
+ const executes = this.externalContext.getIf((0, Const_1.$nsp)(Const_1.P_EXECUTE)).orElse("@none").value.split(/\s+/gi);
7356
+ const renders = this.externalContext.getIf(Const_1.P_RENDER_OVERRIDE)
7357
+ .orElseLazy(() => this.externalContext.getIf((0, Const_1.$nsp)(Const_1.P_RENDER)).value)
7358
+ .orElse(Const_1.IDENT_NONE).value.split(/\s+/gi);
7359
+ const executeAndRenders = executes.concat(...renders);
7360
+ return mona_dish_1.LazyStream.of(...executeAndRenders).filter(nameOrId => {
7361
+ if ([Const_1.IDENT_ALL, Const_1.IDENT_NONE].indexOf(nameOrId) != -1) {
7362
+ return true;
7363
+ }
7364
+ const NAME_OR_ID = this.getNameOrIdSelector(nameOrId);
7365
+ //either the form directly is in execute or render or one of its children or one of its parents
7366
+ return affectedForm.matchesSelector(NAME_OR_ID) ||
7367
+ affectedForm.querySelectorAll(NAME_OR_ID).isPresent() ||
7368
+ affectedForm.firstParent(NAME_OR_ID).isPresent();
7369
+ }).first().isPresent();
7370
+ }
7371
+ /**
7372
+ * gets all forms under a single naming container id
7373
+ * @param namingContainerId
7374
+ * @private
7375
+ */
7376
+ getContainerForms(namingContainerId) {
7377
+ if (namingContainerId.isPresent()) {
7378
+ //naming container mode, all forms under naming container id must be processed
7379
+ return (0, mona_dish_1.DQ$)(this.getNameOrIdSelector(namingContainerId.value))
7380
+ // missing condition if the naming container is not present we have to
7381
+ // use the body as fallback
7382
+ .orElseLazy(() => mona_dish_1.DQ.byTagName(Const_1.HTML_TAG_BODY))
7383
+ .byTagName(Const_1.HTML_TAG_FORM, true);
7384
+ }
7385
+ else {
7386
+ return mona_dish_1.DQ.byTagName(Const_1.HTML_TAG_FORM);
7387
+ }
7388
+ }
7389
+ getNameOrIdSelector(nameOrId) {
7390
+ return `[id='${nameOrId}'], [name='${nameOrId}']`;
6928
7391
  }
6929
7392
  }
6930
7393
  exports.ResponseProcessor = ResponseProcessor;
@@ -7049,8 +7512,10 @@ class XhrFormData extends mona_dish_1.Config {
7049
7512
  * @param form the form holding the view state value
7050
7513
  */
7051
7514
  applyViewState(form) {
7052
- let viewState = form.byId(Const_1.P_VIEWSTATE, true).inputValue;
7053
- this.appendIf(viewState.isPresent(), Const_1.P_VIEWSTATE).value = viewState.value;
7515
+ let viewStateElement = form.querySelectorAllDeep(`[name*='${Const_1.P_VIEWSTATE}'`);
7516
+ let viewState = viewStateElement.inputValue;
7517
+ // this.appendIf(viewState.isPresent(), P_VIEWSTATE).value = viewState.value;
7518
+ this.appendIf(viewState.isPresent(), viewStateElement.name.value).value = viewState.value;
7054
7519
  }
7055
7520
  /**
7056
7521
  * assigns an url encoded string to this xhrFormData object
@@ -7274,15 +7739,14 @@ class XhrRequest {
7274
7739
  });
7275
7740
  }
7276
7741
  start() {
7277
- var _a;
7278
7742
  let ignoreErr = failSaveExecute;
7279
7743
  let xhrObject = this.xhrObject;
7280
7744
  let executesArr = () => {
7281
- return this.requestContext.getIf(Const_1.CTX_PARAM_PASS_THR, Const_1.P_EXECUTE).get("none").value.split(/\s+/gi);
7745
+ return this.requestContext.getIf(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_EXECUTE).get("none").value.split(/\s+/gi);
7282
7746
  };
7283
7747
  try {
7284
7748
  let formElement = this.sourceForm.getAsElem(0).value;
7285
- let viewState = ((_a = window === null || window === void 0 ? void 0 : window.faces) !== null && _a !== void 0 ? _a : window === null || window === void 0 ? void 0 : window.jsf).getViewState(formElement);
7749
+ let viewState = (0, Const_1.$faces)().getViewState(formElement);
7286
7750
  // encoded we need to decode
7287
7751
  // We generated a base representation of the current form
7288
7752
  // in case someone has overloaded the viewState with additional decorators we merge
@@ -7295,13 +7759,21 @@ class XhrRequest {
7295
7759
  let formData = new XhrFormData_1.XhrFormData(this.sourceForm, viewState, executesArr(), this.partialIdsArray);
7296
7760
  this.contentType = formData.isMultipartRequest ? "undefined" : this.contentType;
7297
7761
  // next step the pass through parameters are merged in for post params
7762
+ this.requestContext.$nspEnabled = false;
7298
7763
  let requestContext = this.requestContext;
7299
- let passThroughParams = requestContext.getIf(Const_1.CTX_PARAM_PASS_THR);
7764
+ let requestPassThroughParams = requestContext.getIf(Const_1.CTX_PARAM_REQ_PASS_THR);
7765
+ requestPassThroughParams.$nspEnabled = false;
7300
7766
  // this is an extension where we allow pass through parameters to be sent down additionally
7301
7767
  // this can be used and is used in the impl to enrich the post request parameters with additional
7302
7768
  // information
7303
- formData.shallowMerge(passThroughParams, true, true);
7304
- this.responseContext = passThroughParams.deepCopy;
7769
+ try {
7770
+ formData.shallowMerge(requestPassThroughParams, true, true);
7771
+ }
7772
+ finally {
7773
+ this.requestContext.$nspEnabled = true;
7774
+ requestPassThroughParams.$nspEnabled = true;
7775
+ }
7776
+ this.responseContext = requestPassThroughParams.deepCopy;
7305
7777
  // we have to shift the internal passthroughs around to build up our response context
7306
7778
  let responseContext = this.responseContext;
7307
7779
  responseContext.assign(Const_1.CTX_PARAM_MF_INTERNAL).value = this.internalContext.value;
@@ -7419,7 +7891,7 @@ class XhrRequest {
7419
7891
  reject();
7420
7892
  }
7421
7893
  onSuccess(resolve) {
7422
- var _a, _b, _c;
7894
+ var _a, _b;
7423
7895
  this.sendEvent(Const_1.COMPLETE);
7424
7896
  // malformed responses always result in empty response xml
7425
7897
  // per spec a valid response cannot be empty
@@ -7427,7 +7899,7 @@ class XhrRequest {
7427
7899
  this.handleMalFormedXML(resolve);
7428
7900
  return;
7429
7901
  }
7430
- ((_b = window === null || window === void 0 ? void 0 : window.faces) !== null && _b !== void 0 ? _b : window.jsf).ajax.response(this.xhrObject, (_c = this.responseContext.value) !== null && _c !== void 0 ? _c : {});
7902
+ (0, Const_1.$faces)().ajax.response(this.xhrObject, (_b = this.responseContext.value) !== null && _b !== void 0 ? _b : {});
7431
7903
  }
7432
7904
  handleMalFormedXML(resolve) {
7433
7905
  var _a;
@@ -7437,9 +7909,9 @@ class XhrRequest {
7437
7909
  status: Const_1.MALFORMEDXML,
7438
7910
  responseCode: 200,
7439
7911
  responseText: (_a = this.xhrObject) === null || _a === void 0 ? void 0 : _a.responseText,
7440
- source: {
7441
- id: this.source.id.value
7442
- }
7912
+ // we remap the element just in case it gets replaced
7913
+ // it will be unremapped
7914
+ source: this.source.id.value
7443
7915
  };
7444
7916
  try {
7445
7917
  this.handleError(errorData, true);
@@ -7477,6 +7949,7 @@ class XhrRequest {
7477
7949
  * other helpers
7478
7950
  */
7479
7951
  sendEvent(evtType) {
7952
+ var _a;
7480
7953
  let eventData = EventData_1.EventData.createFromRequest(this.xhrObject, this.requestContext, evtType);
7481
7954
  try {
7482
7955
  // User code error, we might cover
@@ -7487,6 +7960,7 @@ class XhrRequest {
7487
7960
  AjaxImpl_1.Implementation.sendEvent(eventData, eventHandler);
7488
7961
  }
7489
7962
  catch (e) {
7963
+ e.source = (_a = e === null || e === void 0 ? void 0 : e.source) !== null && _a !== void 0 ? _a : this.requestContext.getIf(Const_1.SOURCE).value;
7490
7964
  this.handleError(e);
7491
7965
  throw e;
7492
7966
  }
@@ -7574,36 +8048,39 @@ var oam;
7574
8048
  }
7575
8049
  mona_dish_1.DQ.byId(element).delete();
7576
8050
  };
7577
- // noinspection JSUnusedGlobalSymbols
8051
+ // noinspection JSUnusedGlobalSymbols,JSUnusedLocalSymbols
7578
8052
  /**
7579
8053
  * does special form submit remapping
7580
8054
  * re-maps the issuing command link into something,
7581
- * a decode of the command link on the server can understand
8055
+ * the "decode" of the command link on the server can understand
7582
8056
  *
7583
8057
  * @param formName
7584
8058
  * @param linkId
7585
8059
  * @param target
7586
8060
  * @param params
7587
8061
  */
7588
- oam.submitForm = function (formName, linkId, target, params) {
7589
- var _a, _b, _c, _d;
8062
+ oam.submitForm = function (formName, linkId = null, target = null, params = {}) {
8063
+ var _a, _b, _c, _d, _e, _f;
8064
+ //handle a possible incoming null, not sure if this is used that way anywhere, but we allow it
8065
+ params = (!params) ? {} : params;
7590
8066
  let clearFn = 'clearFormHiddenParams_' + formName.replace(/-/g, '\$:').replace(/:/g, '_');
7591
8067
  (_a = window === null || window === void 0 ? void 0 : window[clearFn]) === null || _a === void 0 ? void 0 : _a.call(window, formName);
7592
8068
  //autoscroll code
7593
8069
  if (((_d = (_c = (_b = window === null || window === void 0 ? void 0 : window.myfaces) === null || _b === void 0 ? void 0 : _b.core) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.autoScroll) && (window === null || window === void 0 ? void 0 : window.getScrolling)) {
7594
8070
  myfaces.oam.setHiddenInput(formName, 'autoScroll', window === null || window === void 0 ? void 0 : window.getScrolling());
7595
8071
  }
7596
- mona_dish_1.Stream.ofAssoc(params).each((param) => {
7597
- myfaces.oam.setHiddenInput(formName, param[0], param[1]);
7598
- });
8072
+ let paramsStream = Array.isArray(params) ? mona_dish_1.Stream.of(...params) : mona_dish_1.Stream.ofAssoc(params);
8073
+ paramsStream.each(([key, data]) => myfaces.oam.setHiddenInput(formName, key, data));
7599
8074
  //we call the namespaced function, to allow decoration, via a direct call we would
7600
- myfaces.oam.setHiddenInput(formName, `${formName}:_idcl`, linkId);
7601
- mona_dish_1.DQ.byId(document.forms[formName]).each(form => {
8075
+ myfaces.oam.setHiddenInput(formName, `${formName}:_idcl`, linkId !== null && linkId !== void 0 ? linkId : '');
8076
+ mona_dish_1.DQ.byId((_f = (_e = document.forms) === null || _e === void 0 ? void 0 : _e[formName]) !== null && _f !== void 0 ? _f : document.getElementById(formName)).each(form => {
7602
8077
  var _a;
7603
8078
  const ATTR_TARGET = "target";
7604
8079
  const formElement = form.getAsElem(0).value;
7605
- const oldTarget = form.attr(ATTR_TARGET).value;
7606
- form.attr(ATTR_TARGET).value = target;
8080
+ const oldTarget = form.getAsElem(0).value.getAttribute("target");
8081
+ if (target != "null" && target) {
8082
+ form.getAsElem(0).value.setAttribute("target", target);
8083
+ }
7607
8084
  const result = (_a = formElement === null || formElement === void 0 ? void 0 : formElement.onsubmit) === null || _a === void 0 ? void 0 : _a.call(formElement, null);
7608
8085
  try {
7609
8086
  if ((!!result) || 'undefined' == typeof result) {
@@ -7614,9 +8091,15 @@ var oam;
7614
8091
  window === null || window === void 0 ? void 0 : window.console.error(e);
7615
8092
  }
7616
8093
  finally {
7617
- form.attr(ATTR_TARGET).value = oldTarget;
7618
- mona_dish_1.Stream.ofAssoc(params).each((param) => {
7619
- myfaces.oam.clearHiddenInput(formName, param[0]);
8094
+ if (oldTarget == null || oldTarget == "null") {
8095
+ form.getAsElem(0).value.removeAttribute("target");
8096
+ }
8097
+ else {
8098
+ form.getAsElem(0).value.setAttribute("target", oldTarget);
8099
+ }
8100
+ // noinspection JSUnusedLocalSymbols
8101
+ paramsStream.each(([key, data]) => {
8102
+ myfaces.oam.clearHiddenInput(formName, key);
7620
8103
  });
7621
8104
  myfaces.oam.clearHiddenInput(formName, `${formName}:_idcl`);
7622
8105
  }