jsf.js_next_gen 4.0.0-RC.1 → 4.0.0-RC.11

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 (102) hide show
  1. package/dist/docs/assets/main.js +1 -1
  2. package/dist/docs/functions/faces.push.init.html +5 -1
  3. package/dist/docs/functions/myfaces.ab.html +2 -2
  4. package/dist/window/faces-development.js +403 -141
  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.br +0 -0
  10. package/dist/window/faces.js.gz +0 -0
  11. package/dist/window/faces.js.map +1 -1
  12. package/dist/window/jsf-development.js +414 -141
  13. package/dist/window/jsf-development.js.br +0 -0
  14. package/dist/window/jsf-development.js.gz +0 -0
  15. package/dist/window/jsf-development.js.map +1 -1
  16. package/dist/window/jsf.js +1 -1
  17. package/dist/window/jsf.js.br +0 -0
  18. package/dist/window/jsf.js.gz +0 -0
  19. package/dist/window/jsf.js.map +1 -1
  20. package/package.json +11 -11
  21. package/src/main/typescript/@types/definitions/index.d.ts +17 -2
  22. package/src/main/typescript/api/_api.ts +4 -2
  23. package/src/main/typescript/api/jsf.ts +18 -0
  24. package/src/main/typescript/impl/AjaxImpl.ts +22 -2
  25. package/src/main/typescript/impl/PushImpl.ts +38 -12
  26. package/src/main/typescript/impl/core/Const.ts +9 -5
  27. package/src/main/typescript/impl/util/Assertions.ts +14 -6
  28. package/src/main/typescript/impl/util/AsyncQueue.ts +1 -1
  29. package/src/main/typescript/impl/util/ExtDomQuery.ts +4 -1
  30. package/src/main/typescript/impl/util/Lang.ts +3 -3
  31. package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +8 -1
  32. package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +13 -3
  33. package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +1 -1
  34. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +92 -30
  35. package/src/main/typescript/impl/xhrCore/XhrFormData.ts +24 -12
  36. package/src/main/typescript/myfaces/OamSubmit.ts +15 -10
  37. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +1 -1
  38. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +40 -1
  39. package/src/main/typescript/test/xhrCore/OamSubmitTest.spec.ts +177 -0
  40. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +237 -8
  41. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +174 -10
  42. package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +8 -6
  43. package/src/main/typescript/test.xml +6 -0
  44. package/target/api/_api.js +3 -2
  45. package/target/api/_api.js.map +1 -1
  46. package/target/api/jsf.js +11 -0
  47. package/target/api/jsf.js.map +1 -1
  48. package/target/impl/AjaxImpl.js +18 -0
  49. package/target/impl/AjaxImpl.js.map +1 -1
  50. package/target/impl/PushImpl.js +44 -14
  51. package/target/impl/PushImpl.js.map +1 -1
  52. package/target/impl/core/Const.js +10 -8
  53. package/target/impl/core/Const.js.map +1 -1
  54. package/target/impl/util/Assertions.js +11 -6
  55. package/target/impl/util/Assertions.js.map +1 -1
  56. package/target/impl/util/AsyncQueue.js.map +1 -1
  57. package/target/impl/util/ExtDomQuery.js +3 -0
  58. package/target/impl/util/ExtDomQuery.js.map +1 -1
  59. package/target/impl/util/Lang.js +3 -3
  60. package/target/impl/util/Lang.js.map +1 -1
  61. package/target/impl/xhrCore/RequestDataResolver.js +11 -2
  62. package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
  63. package/target/impl/xhrCore/ResonseDataResolver.js +1 -1
  64. package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
  65. package/target/impl/xhrCore/ResponseProcessor.js +85 -24
  66. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  67. package/target/impl/xhrCore/XhrFormData.js +18 -7
  68. package/target/impl/xhrCore/XhrFormData.js.map +1 -1
  69. package/target/myfaces/OamSubmit.js +13 -11
  70. package/target/myfaces/OamSubmit.js.map +1 -1
  71. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +1 -1
  72. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
  73. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +37 -1
  74. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
  75. package/target/test/xhrCore/OamSubmitTest.spec.js +180 -0
  76. package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -0
  77. package/target/test/xhrCore/RequestTest.spec.js +214 -7
  78. package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
  79. package/target/test/xhrCore/ResponseTest.spec.js +139 -8
  80. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  81. package/target/test/xhrCore/ResponseTest23.spec.js +5 -5
  82. package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
  83. package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
  84. package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
  85. package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
  86. package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
  87. package/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +0 -4
  88. package/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +0 -4
  89. package/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst +0 -1
  90. package/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst +0 -1
  91. package/target/surefire-reports/TEST-com.example.jsfs_js_ts.JsfsJsTsApplicationTests.xml +0 -78
  92. package/target/surefire-reports/com.example.jsfs_js_ts.JsfsJsTsApplicationTests.txt +0 -7
  93. package/target/test-classes/.gz +0 -0
  94. package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
  95. package/target/test-classes/fileuploadtest.html +0 -24
  96. package/target/test-classes/jsf-development.js +0 -3559
  97. package/target/test-classes/jsf-development.js.br +0 -0
  98. package/target/test-classes/jsf-development.js.gz +0 -0
  99. package/target/test-classes/jsf-development.js.map +0 -1
  100. package/target/test-classes/jsf.js +0 -3
  101. package/target/test-classes/jsf.js.br +0 -0
  102. package/target/test-classes/jsf.js.gz +0 -0
@@ -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
  /**
@@ -632,6 +632,15 @@ class DomQuery {
632
632
  return this._querySelectorAll(selector);
633
633
  }
634
634
  }
635
+ closest(selector) {
636
+ // We could merge both methods, but for now this is more readable
637
+ if (selector.indexOf("/shadow/") != -1) {
638
+ return this._closestDeep(selector);
639
+ }
640
+ else {
641
+ return this._closest(selector);
642
+ }
643
+ }
635
644
  /**
636
645
  * core byId method
637
646
  * @param id the id to search for
@@ -866,6 +875,30 @@ class DomQuery {
866
875
  });
867
876
  return this;
868
877
  }
878
+ /**
879
+ * replace convenience function, replaces one or more elements with
880
+ * a set of elements passed as DomQuery
881
+ * @param toReplace the replaced nodes as reference (original node has been replaced)
882
+ */
883
+ replace(toReplace) {
884
+ this.each(item => {
885
+ let asElem = item.getAsElem(0).value;
886
+ let parent = asElem.parentElement;
887
+ let nextElement = asElem.nextElementSibling;
888
+ let previousElement = asElem.previousElementSibling;
889
+ if (nextElement != null) {
890
+ new DomQuery(nextElement).insertBefore(toReplace);
891
+ }
892
+ else if (previousElement) {
893
+ new DomQuery(previousElement).insertAfter(toReplace);
894
+ }
895
+ else {
896
+ new DomQuery(parent).append(toReplace);
897
+ }
898
+ item.delete();
899
+ });
900
+ return toReplace;
901
+ }
869
902
  /**
870
903
  * returns a new dom query containing only the first element max
871
904
  *
@@ -1049,28 +1082,57 @@ class DomQuery {
1049
1082
  return new DomQuery(func());
1050
1083
  }
1051
1084
  }
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);
1085
+ /**
1086
+ * find all parents in the hierarchy for which the selector matches
1087
+ * @param selector
1088
+ */
1089
+ allParents(selector) {
1090
+ let parent = this.parent();
1091
+ let ret = [];
1092
+ while (parent.isPresent()) {
1093
+ if (parent.matchesSelector(selector)) {
1094
+ ret.push(parent);
1060
1095
  }
1061
- };
1096
+ parent = parent.parent();
1097
+ }
1098
+ return new DomQuery(...ret);
1099
+ }
1100
+ /**
1101
+ * finds the first parent in the hierarchy for which the selector matches
1102
+ * @param selector
1103
+ */
1104
+ firstParent(selector) {
1105
+ let parent = this.parent();
1106
+ while (parent.isPresent()) {
1107
+ if (parent.matchesSelector(selector)) {
1108
+ return parent;
1109
+ }
1110
+ parent = parent.parent();
1111
+ }
1112
+ return DomQuery.absent;
1113
+ }
1114
+ /**
1115
+ * fetches all parents as long as the filter criterium matches
1116
+ * @param selector
1117
+ */
1118
+ parentsWhileMatch(selector) {
1119
+ const retArr = [];
1120
+ let parent = this.parent().filter(item => item.matchesSelector(selector));
1121
+ while (parent.isPresent()) {
1122
+ retArr.push(parent);
1123
+ parent = parent.parent().filter(item => item.matchesSelector(selector));
1124
+ }
1125
+ return new DomQuery(...retArr);
1126
+ }
1127
+ parent() {
1128
+ let ret = [];
1062
1129
  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
- }
1130
+ let parent = item.parentNode || item.host || item.shadowRoot;
1131
+ if (parent && ret.indexOf(parent) == -1) {
1132
+ ret.push(parent);
1071
1133
  }
1072
1134
  });
1073
- return new DomQuery(...retArr);
1135
+ return new DomQuery(...ret);
1074
1136
  }
1075
1137
  copyAttrs(sourceItem) {
1076
1138
  sourceItem.eachElem((sourceNode) => {
@@ -1184,7 +1246,7 @@ class DomQuery {
1184
1246
  let tagName = item.tagName;
1185
1247
  let itemType = ((_a = item === null || item === void 0 ? void 0 : item.type) !== null && _a !== void 0 ? _a : '').toLowerCase();
1186
1248
  if (tagName &&
1187
- eIgnoreC(tagName, "script") &&
1249
+ eqi(tagName, "script") &&
1188
1250
  allowedItemTypes.indexOf(itemType) != -1) {
1189
1251
  let src = item.getAttribute('src');
1190
1252
  if ('undefined' != typeof src
@@ -1270,36 +1332,30 @@ class DomQuery {
1270
1332
  return this;
1271
1333
  }
1272
1334
  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
1335
+ const execCss = (toReplace) => {
1336
+ const _toReplace = DomQuery.byId(toReplace);
1337
+ const tagName = _toReplace.tagName.orElse("").value;
1338
+ const head = DomQuery.byTagName("head");
1339
+ if (tagName && eqi(tagName, "link") && eqi(toReplace.getAttribute("rel"), "stylesheet")) {
1340
+ const rel = toReplace.getAttribute("rel");
1341
+ //if possible we are now replacing the existing elements where we reference this stylesheet
1342
+ const matches = head.querySelectorAll(`link[rel='stylesheet'][href='${rel}']`);
1343
+ if (matches.length) {
1344
+ matches.replace(_toReplace);
1298
1345
  }
1299
- else if (item.innerHTML) {
1300
- innerText.push(item.innerHTML);
1346
+ else {
1347
+ head.append(_toReplace);
1348
+ }
1349
+ }
1350
+ else if (tagName && eqi(tagName, "style")) {
1351
+ let innerText = _toReplace.innerHTML.replace(/\s+/gi, "");
1352
+ let styles = head.querySelectorAll("style");
1353
+ styles = styles.stream.filter(style => {
1354
+ return style.innerHTML.replace(/\s+/gi, "") == innerText;
1355
+ }).collect(new DomQueryCollector());
1356
+ if (!styles.length) { //already present
1357
+ head.append(_toReplace);
1301
1358
  }
1302
- applyStyle(item, innerText.join(""));
1303
1359
  }
1304
1360
  };
1305
1361
  const scriptElements = new DomQuery(this.filterSelector("link, style"), this.querySelectorAll("link, style"));
@@ -1480,12 +1536,17 @@ class DomQuery {
1480
1536
  elemType != ALLOWED_SUBMITTABLE_ELEMENTS.SUBMIT &&
1481
1537
  elemType != ALLOWED_SUBMITTABLE_ELEMENTS.IMAGE) && ((elemType != ALLOWED_SUBMITTABLE_ELEMENTS.CHECKBOX && elemType != ALLOWED_SUBMITTABLE_ELEMENTS.RADIO) ||
1482
1538
  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];
1539
+ let uploadedFiles = (_b = (_a = element.value) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.files;
1540
+ let filesArr = uploadedFiles !== null && uploadedFiles !== void 0 ? uploadedFiles : [];
1541
+ if (filesArr === null || filesArr === void 0 ? void 0 : filesArr.length) { //files can be empty but set
1542
+ // xhr level2, single multiple must be passes as they are
1543
+ target.assign(name).value = Array.from(filesArr);
1487
1544
  }
1488
1545
  else {
1546
+ if (!!uploadedFiles) { //we skip empty file elements i
1547
+ return;
1548
+ }
1549
+ //checkboxes etc.. need to be appended
1489
1550
  target.append(name).value = element.inputValue.value;
1490
1551
  }
1491
1552
  }
@@ -1730,6 +1791,47 @@ class DomQuery {
1730
1791
  }
1731
1792
  return foundNodes;
1732
1793
  }
1794
+ /**
1795
+ * query selector all on the existing dom queryX object
1796
+ *
1797
+ * @param selector the standard selector
1798
+ * @return a DomQuery with the results
1799
+ */
1800
+ _closest(selector) {
1801
+ var _a, _b;
1802
+ if (!((_a = this === null || this === void 0 ? void 0 : this.rootNode) === null || _a === void 0 ? void 0 : _a.length)) {
1803
+ return this;
1804
+ }
1805
+ let nodes = [];
1806
+ for (let cnt = 0; cnt < this.rootNode.length; cnt++) {
1807
+ if (!((_b = this.rootNode[cnt]) === null || _b === void 0 ? void 0 : _b.closest)) {
1808
+ continue;
1809
+ }
1810
+ let res = [this.rootNode[cnt].closest(selector)];
1811
+ nodes = nodes.concat(...res);
1812
+ }
1813
+ return new DomQuery(...nodes);
1814
+ }
1815
+ /*deep with a selector and a pseudo /shadow/ marker to break into the next level*/
1816
+ _closestDeep(selector) {
1817
+ var _a;
1818
+ if (!((_a = this === null || this === void 0 ? void 0 : this.rootNode) === null || _a === void 0 ? void 0 : _a.length)) {
1819
+ return this;
1820
+ }
1821
+ let foundNodes = new DomQuery(...this.rootNode);
1822
+ let selectors = selector.split(/\/shadow\//);
1823
+ for (let cnt2 = 0; cnt2 < selectors.length; cnt2++) {
1824
+ if (selectors[cnt2] == "") {
1825
+ continue;
1826
+ }
1827
+ let levelSelector = selectors[cnt2];
1828
+ foundNodes = foundNodes.closest(levelSelector);
1829
+ if (cnt2 < selectors.length - 1) {
1830
+ foundNodes = foundNodes.shadowRoot;
1831
+ }
1832
+ }
1833
+ return foundNodes;
1834
+ }
1733
1835
  // source: https:// developer.mozilla.org/en-US/docs/Web/API/Element/matches
1734
1836
  // code snippet license: https:// creativecommons.org/licenses/by-sa/2.5/
1735
1837
  /**
@@ -2510,6 +2612,9 @@ class Config extends Optional {
2510
2612
  */
2511
2613
  shallowMerge(other, overwrite = true, withAppend = false) {
2512
2614
  for (let key in other.value) {
2615
+ if ('undefined' == typeof key || null == key) {
2616
+ continue;
2617
+ }
2513
2618
  if (overwrite || !(key in this.value)) {
2514
2619
  if (!withAppend) {
2515
2620
  this.assign(key).value = other.getIf(key).value;
@@ -2711,7 +2816,7 @@ exports.Config = Config;
2711
2816
  * limitations under the License.
2712
2817
  */
2713
2818
  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;
2819
+ 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
2820
  const Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
2716
2821
  /**
2717
2822
  * special status of the datasource location pointer
@@ -3018,6 +3123,21 @@ class ArrayCollector {
3018
3123
  }
3019
3124
  }
3020
3125
  exports.ArrayCollector = ArrayCollector;
3126
+ /**
3127
+ * collects the values as inverse array
3128
+ */
3129
+ class InverseArrayCollector {
3130
+ constructor() {
3131
+ this.data = [];
3132
+ }
3133
+ collect(element) {
3134
+ this.data.unshift(element);
3135
+ }
3136
+ get finalValue() {
3137
+ return this.data;
3138
+ }
3139
+ }
3140
+ exports.InverseArrayCollector = InverseArrayCollector;
3021
3141
  /**
3022
3142
  * collects an tuple array stream into an assoc array with elements being collected into arrays
3023
3143
  *
@@ -3353,6 +3473,15 @@ exports.Stream = Stream;
3353
3473
  *
3354
3474
  */
3355
3475
  class LazyStream {
3476
+ static of(...values) {
3477
+ return new LazyStream(new SourcesCollectors_1.ArrayStreamDataSource(...values));
3478
+ }
3479
+ static ofAssoc(data) {
3480
+ return this.of(...Object.keys(data)).map(key => [key, data[key]]);
3481
+ }
3482
+ static ofStreamDataSource(value) {
3483
+ return new LazyStream(value);
3484
+ }
3356
3485
  constructor(parent) {
3357
3486
  this._limits = -1;
3358
3487
  /*
@@ -3363,15 +3492,6 @@ class LazyStream {
3363
3492
  this.pos = -1;
3364
3493
  this.dataSource = parent;
3365
3494
  }
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
3495
  hasNext() {
3376
3496
  if (this.isOverLimits()) {
3377
3497
  return false;
@@ -3907,12 +4027,13 @@ var faces;
3907
4027
  * @param channel the channel name/id
3908
4028
  * @param onopen The function to be invoked when the web socket is opened.
3909
4029
  * @param onmessage The function to be invoked when a message is received.
4030
+ * @param onerror The function to be invoked when an error occurs.
3910
4031
  * @param onclose The function to be invoked when the web socket is closed.
3911
4032
  * @param behaviors functions which are invoked whenever a message is received
3912
4033
  * @param autoConnect Whether or not to automatically open the socket. Defaults to <code>false</code>.
3913
4034
  */
3914
- function init(socketClientId, url, channel, onopen, onmessage, onclose, behaviors, autoConnect) {
3915
- PushImpl_1.PushImpl.init(socketClientId, url, channel, onopen, onmessage, onclose, behaviors, autoConnect);
4035
+ function init(socketClientId, url, channel, onopen, onmessage, onerror, onclose, behaviors, autoConnect) {
4036
+ PushImpl_1.PushImpl.init(socketClientId, url, channel, onopen, onmessage, onerror, onclose, behaviors, autoConnect);
3916
4037
  }
3917
4038
  push.init = init;
3918
4039
  /**
@@ -4030,7 +4151,9 @@ var BlockFilter;
4030
4151
  BlockFilter["myfaces"] = "myfaces";
4031
4152
  BlockFilter["delay"] = "delay";
4032
4153
  BlockFilter["timeout"] = "timeout";
4154
+ BlockFilter["resetValues"] = "resetValues";
4033
4155
  BlockFilter["windowId"] = "windowId";
4156
+ BlockFilter["params"] = "params";
4034
4157
  })(BlockFilter || (BlockFilter = {}));
4035
4158
  /**
4036
4159
  * Core Implementation
@@ -4196,7 +4319,11 @@ var Implementation;
4196
4319
  const delay = (0, RequestDataResolver_1.resolveDelay)(options);
4197
4320
  const timeout = (0, RequestDataResolver_1.resolveTimeout)(options);
4198
4321
  requestCtx.assignIf(!!windowId, Const_1.P_WINDOW_ID).value = windowId;
4322
+ // old non spec behavior will be removed after it is clear whether the removal breaks any code
4199
4323
  requestCtx.assign(Const_1.CTX_PARAM_PASS_THR).value = filterPassThroughValues(options.value);
4324
+ // spec conform behavior, all passthrough params must be under "passthrough
4325
+ const params = remapArrayToAssocArr(options.getIf(Const_1.CTX_PARAM_SPEC_PARAMS).orElse({}).value);
4326
+ requestCtx.getIf(Const_1.CTX_PARAM_PASS_THR).shallowMerge(new mona_dish_1.Config(params), true);
4200
4327
  requestCtx.assignIf(!!resolvedEvent, Const_1.CTX_PARAM_PASS_THR, Const_1.P_EVT).value = resolvedEvent === null || resolvedEvent === void 0 ? void 0 : resolvedEvent.type;
4201
4328
  /**
4202
4329
  * ajax pass through context with the source
@@ -4552,7 +4679,13 @@ var Implementation;
4552
4679
  * Filter the options given with a blacklist, so that only
4553
4680
  * the values required for pass-through are processed in the ajax request
4554
4681
  *
4682
+ * Note this is a bug carried over from the old implementation
4683
+ * the spec conform behavior is to use params for passthrough values
4684
+ * this will be removed soon, after it is cleared up wheter removing
4685
+ * it breaks any legacy code
4686
+ *
4555
4687
  * @param {Context} mappedOpts the options to be filtered
4688
+ * @deprecated
4556
4689
  */
4557
4690
  function filterPassThroughValues(mappedOpts) {
4558
4691
  //we now can use the full code reduction given by our stream api
@@ -4561,6 +4694,12 @@ var Implementation;
4561
4694
  .filter(item => !(item[0] in BlockFilter))
4562
4695
  .collect(new mona_dish_1.AssocArrayCollector());
4563
4696
  }
4697
+ function remapArrayToAssocArr(arrayedParams) {
4698
+ if (Array.isArray(arrayedParams)) {
4699
+ return mona_dish_1.Stream.of(...arrayedParams).collect(new mona_dish_1.AssocArrayCollector());
4700
+ }
4701
+ return arrayedParams;
4702
+ }
4564
4703
  function resolveGlobalConfig() {
4565
4704
  var _a, _b;
4566
4705
  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 : {};
@@ -4622,12 +4761,13 @@ exports.PushImpl = void 0;
4622
4761
  * Typescript port of the faces\.push part in the myfaces implementation
4623
4762
  */
4624
4763
  const Const_1 = __webpack_require__(/*! ./core/Const */ "./src/main/typescript/impl/core/Const.ts");
4764
+ const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
4625
4765
  /**
4626
4766
  * Implementation class for the push functionality
4627
4767
  */
4628
4768
  var PushImpl;
4629
4769
  (function (PushImpl) {
4630
- const URL_PROTOCOL = window.location.protocol.replace("http", "ws") + "//";
4770
+ const URL_PROTOCOL = mona_dish_1.DQ.global().location.protocol.replace("http", "ws") + "//";
4631
4771
  // we expose the member variables for testing purposes
4632
4772
  // they are not directly touched outside of tests
4633
4773
  /* socket map by token */
@@ -4652,14 +4792,15 @@ var PushImpl;
4652
4792
  * @param channel the channel name/id
4653
4793
  * @param onopen The function to be invoked when the web socket is opened.
4654
4794
  * @param onmessage The function to be invoked when a message is received.
4795
+ * @param onerror The function to be invoked when an error occurs.
4655
4796
  * @param onclose The function to be invoked when the web socket is closed.
4656
4797
  * @param behaviors functions which are invoked whenever a message is received
4657
4798
  * @param autoConnect Whether or not to automatically open the socket. Defaults to <code>false</code>.
4658
4799
  */
4659
- function init(socketClientId, url, channel, onopen, onmessage, onclose, behaviors, autoConnect) {
4660
- var _a;
4800
+ function init(socketClientId, url, channel, onopen, onmessage, onerror, onclose, behaviors, autoConnect) {
4801
+ var _a, _b, _c;
4661
4802
  onclose = resolveFunction(onclose);
4662
- if (!window.WebSocket) { // IE6-9.
4803
+ if (!mona_dish_1.DQ.global().WebSocket) { // IE6-9.
4663
4804
  onclose(-1, channel);
4664
4805
  return;
4665
4806
  }
@@ -4669,6 +4810,7 @@ var PushImpl;
4669
4810
  'channelToken': channelToken,
4670
4811
  'onopen': resolveFunction(onopen),
4671
4812
  'onmessage': resolveFunction(onmessage),
4813
+ 'onerror': resolveFunction(onerror),
4672
4814
  'onclose': onclose,
4673
4815
  'behaviors': behaviors,
4674
4816
  'autoconnect': autoConnect
@@ -4682,17 +4824,17 @@ var PushImpl;
4682
4824
  }
4683
4825
  }
4684
4826
  if (autoConnect) {
4685
- ((_a = window === null || window === void 0 ? void 0 : window.faces) !== null && _a !== void 0 ? _a : window === null || window === void 0 ? void 0 : window.jsf).push.open(socketClientId);
4827
+ ((_b = (_a = mona_dish_1.DQ.global()) === null || _a === void 0 ? void 0 : _a.faces) !== null && _b !== void 0 ? _b : (_c = mona_dish_1.DQ.global()) === null || _c === void 0 ? void 0 : _c.jsf).push.open(socketClientId);
4686
4828
  }
4687
4829
  }
4688
4830
  PushImpl.init = init;
4689
4831
  function open(socketClientId) {
4690
4832
  var _a;
4691
- getSocket((_a = PushImpl.components === null || PushImpl.components === void 0 ? void 0 : PushImpl.components[socketClientId]) === null || _a === void 0 ? void 0 : _a.channelToken).open();
4833
+ getSocket((_a = PushImpl.components[socketClientId]) === null || _a === void 0 ? void 0 : _a.channelToken).open();
4692
4834
  }
4693
4835
  PushImpl.open = open;
4694
4836
  function close(socketClientId) {
4695
- getSocket(PushImpl.components === null || PushImpl.components === void 0 ? void 0 : PushImpl.components[socketClientId].channelToken).close();
4837
+ getSocket(PushImpl.components[socketClientId].channelToken).close();
4696
4838
  }
4697
4839
  PushImpl.close = close;
4698
4840
  // Private helper classes
@@ -4722,28 +4864,53 @@ var PushImpl;
4722
4864
  }
4723
4865
  // noinspection JSUnusedLocalSymbols
4724
4866
  onopen(event) {
4867
+ var _a, _b;
4725
4868
  if (!this.reconnectAttempts) {
4726
4869
  let clientIds = PushImpl.clientIdsByTokens[this.channelToken];
4727
4870
  for (let i = clientIds.length - 1; i >= 0; i--) {
4728
4871
  let socketClientId = clientIds[i];
4729
- PushImpl.components[socketClientId]['onopen'](this.channel);
4872
+ (_b = (_a = PushImpl.components[socketClientId]) === null || _a === void 0 ? void 0 : _a['onopen']) === null || _b === void 0 ? void 0 : _b.call(_a, this.channel);
4730
4873
  }
4731
4874
  }
4732
4875
  this.reconnectAttempts = 0;
4733
4876
  }
4877
+ onerror(event) {
4878
+ var _a, _b;
4879
+ let message = JSON.parse(event.data);
4880
+ //TODO replace this with a more readable Stream code
4881
+ for (let i = PushImpl.clientIdsByTokens[this.channelToken].length - 1; i >= 0; i--) {
4882
+ let socketClientId = PushImpl.clientIdsByTokens[this.channelToken][i];
4883
+ if (document.getElementById(socketClientId)) {
4884
+ try {
4885
+ (_b = (_a = PushImpl.components[socketClientId]) === null || _a === void 0 ? void 0 : _a['onerror']) === null || _b === void 0 ? void 0 : _b.call(_a, message, this.channel, event);
4886
+ }
4887
+ catch (e) {
4888
+ //Ignore
4889
+ }
4890
+ }
4891
+ else {
4892
+ PushImpl.clientIdsByTokens[this.channelToken].splice(i, 1);
4893
+ }
4894
+ }
4895
+ if (PushImpl.clientIdsByTokens[this.channelToken].length == 0) {
4896
+ // tag disappeared
4897
+ this.close();
4898
+ }
4899
+ }
4734
4900
  onmmessage(event) {
4901
+ var _a, _b, _c;
4735
4902
  let message = JSON.parse(event.data);
4736
4903
  for (let i = PushImpl.clientIdsByTokens[this.channelToken].length - 1; i >= 0; i--) {
4737
4904
  let socketClientId = PushImpl.clientIdsByTokens[this.channelToken][i];
4738
4905
  if (document.getElementById(socketClientId)) {
4739
4906
  try {
4740
- PushImpl.components[socketClientId]['onmessage'](message, this.channel, event);
4907
+ (_b = (_a = PushImpl.components[socketClientId]) === null || _a === void 0 ? void 0 : _a['onmessage']) === null || _b === void 0 ? void 0 : _b.call(_a, message, this.channel, event);
4741
4908
  }
4742
4909
  catch (e) {
4743
4910
  //Ignore
4744
4911
  }
4745
- let behaviors = PushImpl.components[socketClientId]['behaviors'];
4746
- let functions = behaviors[message];
4912
+ let behaviors = (_c = PushImpl.components === null || PushImpl.components === void 0 ? void 0 : PushImpl.components[socketClientId]) === null || _c === void 0 ? void 0 : _c['behaviors'];
4913
+ let functions = behaviors === null || behaviors === void 0 ? void 0 : behaviors[message];
4747
4914
  if (functions && functions.length) {
4748
4915
  for (let j = 0; j < functions.length; j++) {
4749
4916
  try {
@@ -4765,6 +4932,7 @@ var PushImpl;
4765
4932
  }
4766
4933
  }
4767
4934
  onclose(event) {
4935
+ var _a, _b;
4768
4936
  if (!this.socket
4769
4937
  || (event.code == 1000 && event.reason == Const_1.REASON_EXPIRED)
4770
4938
  || (event.code == 1008)
@@ -4773,7 +4941,7 @@ var PushImpl;
4773
4941
  let clientIds = PushImpl.clientIdsByTokens[this.channelToken];
4774
4942
  for (let i = clientIds.length - 1; i >= 0; i--) {
4775
4943
  let socketClientId = clientIds[i];
4776
- PushImpl.components[socketClientId]['onclose'](event === null || event === void 0 ? void 0 : event.code, this === null || this === void 0 ? void 0 : this.channel, event);
4944
+ (_b = (_a = PushImpl.components === null || PushImpl.components === void 0 ? void 0 : PushImpl.components[socketClientId]) === null || _a === void 0 ? void 0 : _a['onclose']) === null || _b === void 0 ? void 0 : _b.call(_a, event === null || event === void 0 ? void 0 : event.code, this === null || this === void 0 ? void 0 : this.channel, event);
4777
4945
  }
4778
4946
  }
4779
4947
  else {
@@ -4795,12 +4963,13 @@ var PushImpl;
4795
4963
  this.socket.onopen = (event) => this.onopen(event);
4796
4964
  this.socket.onmessage = (event) => this.onmmessage(event);
4797
4965
  this.socket.onclose = (event) => this.onclose(event);
4966
+ this.socket.onerror = (event) => this.onerror(event);
4798
4967
  }
4799
4968
  }
4800
4969
  // Private static functions ---------------------------------------------------------------------------------------
4801
4970
  function getBaseURL(url) {
4802
4971
  if (url.indexOf("://") < 0) {
4803
- let base = window.location.hostname + ":" + window.location.port;
4972
+ let base = mona_dish_1.DQ.global().location.hostname + ":" + mona_dish_1.DQ.global().location.port;
4804
4973
  return URL_PROTOCOL + base + url;
4805
4974
  }
4806
4975
  else {
@@ -4825,7 +4994,7 @@ var PushImpl;
4825
4994
  }
4826
4995
  function resolveFunction(fn = () => {
4827
4996
  }) {
4828
- return ((typeof fn !== "function") && (fn = window[fn]), fn);
4997
+ return ((typeof fn !== "function") && (fn = mona_dish_1.DQ.global()[fn]), fn);
4829
4998
  }
4830
4999
  })(PushImpl = exports.PushImpl || (exports.PushImpl = {}));
4831
5000
 
@@ -4855,15 +5024,16 @@ var PushImpl;
4855
5024
  * limitations under the License.
4856
5025
  */
4857
5026
  Object.defineProperty(exports, "__esModule", ({ value: true }));
4858
- 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;
4859
- 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;
4860
- exports.$nsp = exports.UNKNOWN = exports.MAX_RECONNECT_ATTEMPTS = exports.RECONNECT_INTERVAL = exports.APPLIED_CLIENT_WINDOW = exports.APPLIED_VST = void 0;
5027
+ 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_EVT = 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.PARTIAL_ID = exports.P_PARTIAL_SOURCE = void 0;
5028
+ 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 = exports.CTX_PARAM_DELAY = exports.CTX_PARAM_SPEC_PARAMS = void 0;
5029
+ exports.$nsp = exports.UNKNOWN = exports.MAX_RECONNECT_ATTEMPTS = exports.RECONNECT_INTERVAL = exports.APPLIED_CLIENT_WINDOW = exports.APPLIED_VST = exports.REASON_EXPIRED = exports.MF_NONE = void 0;
4861
5030
  /*
4862
5031
  * [export const] constants
4863
5032
  */
4864
5033
  exports.P_PARTIAL_SOURCE = "jakarta.faces.source";
4865
5034
  exports.PARTIAL_ID = "partialId";
4866
5035
  exports.P_VIEWSTATE = "jakarta.faces.ViewState";
5036
+ exports.P_CLIENT_WINDOW = "jakarta.faces.ClientWindow";
4867
5037
  exports.P_VIEWROOT = "jakarta.faces.ViewRoot";
4868
5038
  exports.P_VIEWHEAD = "jakarta.faces.ViewHead";
4869
5039
  exports.P_VIEWBODY = "jakarta.faces.ViewBody";
@@ -4873,7 +5043,8 @@ exports.EMPTY_FUNC = Object.freeze(() => {
4873
5043
  });
4874
5044
  exports.EMPTY_STR = "";
4875
5045
  exports.EMPTY_MAP = Object.freeze({});
4876
- exports.HTML_VIEWSTATE = ["<input type='hidden'", "id='", exports.P_VIEWSTATE, "' name='", exports.P_VIEWSTATE, "' value='' />"].join(exports.EMPTY_STR);
5046
+ exports.HTML_VIEWSTATE = ["<input type='hidden'", "name='", exports.P_VIEWSTATE, "' value='' />"].join(exports.EMPTY_STR);
5047
+ exports.HTML_CLIENT_WINDOW = ["<input type='hidden'", "' name='", exports.P_CLIENT_WINDOW, "' value='' />"].join(exports.EMPTY_STR);
4877
5048
  /*internal identifiers for options*/
4878
5049
  exports.IDENT_ALL = "@all";
4879
5050
  exports.IDENT_NONE = "@none";
@@ -4883,7 +5054,6 @@ exports.P_AJAX = "jakarta.faces.partial.ajax";
4883
5054
  exports.P_EXECUTE = "jakarta.faces.partial.execute";
4884
5055
  exports.P_RENDER = "jakarta.faces.partial.render";
4885
5056
  exports.P_EVT = "jakarta.faces.partial.event";
4886
- exports.P_CLIENT_WINDOW = "jakarta.faces.ClientWindow";
4887
5057
  exports.P_RESET_VALUES = "jakarta.faces.partial.resetValues";
4888
5058
  exports.P_WINDOW_ID = "jakarta.faces.windowId";
4889
5059
  exports.P_BEHAVIOR_EVENT = "jakarta.faces.behavior.event";
@@ -4916,6 +5086,7 @@ exports.CTX_PARAM_SRC_FRM_ID = "_mfSourceFormId";
4916
5086
  exports.CTX_PARAM_SRC_CTL_ID = "_mfSourceControlId";
4917
5087
  exports.CTX_PARAM_TR_TYPE = "_mfTransportType";
4918
5088
  exports.CTX_PARAM_PASS_THR = "passThrgh";
5089
+ exports.CTX_PARAM_SPEC_PARAMS = "params";
4919
5090
  exports.CTX_PARAM_DELAY = "delay";
4920
5091
  exports.CTX_PARAM_TIMEOUT = "timeout";
4921
5092
  exports.CTX_PARAM_RST = "resetValues";
@@ -4935,9 +5106,9 @@ exports.URL_ENCODED = "application/x-www-form-urlencoded";
4935
5106
  exports.MULTIPART = "multipart/form-data";
4936
5107
  exports.NO_TIMEOUT = 0;
4937
5108
  exports.STD_ACCEPT = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
4938
- exports.TAG_HEAD = "head";
4939
- exports.TAG_FORM = "form";
4940
- exports.TAG_BODY = "body";
5109
+ exports.TAG_HEAD = "HEAD";
5110
+ exports.TAG_FORM = "FORM";
5111
+ exports.TAG_BODY = "BODY";
4941
5112
  exports.TAG_BEFORE = "before";
4942
5113
  exports.TAG_AFTER = "after";
4943
5114
  exports.TAG_ATTR = "attribute";
@@ -5189,10 +5360,8 @@ exports.Assertions = void 0;
5189
5360
  * limitations under the License.
5190
5361
  */
5191
5362
  const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
5192
- const Lang_1 = __webpack_require__(/*! ./Lang */ "./src/main/typescript/impl/util/Lang.ts");
5193
- var getMessage = Lang_1.ExtLang.getMessage;
5194
- var makeException = Lang_1.ExtLang.makeException;
5195
5363
  const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
5364
+ const Lang_1 = __webpack_require__(/*! ./Lang */ "./src/main/typescript/impl/util/Lang.ts");
5196
5365
  /**
5197
5366
  * a set of internal code assertions
5198
5367
  * which raise an error
@@ -5207,12 +5376,12 @@ var Assertions;
5207
5376
  assertFunction(options.getIf(Const_1.ON_EVENT).value);
5208
5377
  //improve the error messages if an empty elem is passed
5209
5378
  //Assertions.assertElementExists(elem);
5210
- assert(elem.isPresent(), getMessage("ERR_MUST_BE_PROVIDED1", "{0}: source must be provided or exist", "source element id"), "faces.ajax.request", "ArgNotSet");
5379
+ 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");
5211
5380
  }
5212
5381
  Assertions.assertRequestIntegrity = assertRequestIntegrity;
5213
5382
  function assertUrlExists(node) {
5214
5383
  if (node.attr(Const_1.ATTR_URL).isAbsent()) {
5215
- throw Assertions.raiseError(new Error(), getMessage("ERR_RED_URL", null, "processRedirect"), "processRedirect");
5384
+ throw Assertions.raiseError(new Error(), Lang_1.ExtLang.getMessage("ERR_RED_URL", null, "processRedirect"), "processRedirect");
5216
5385
  }
5217
5386
  }
5218
5387
  Assertions.assertUrlExists = assertUrlExists;
@@ -5241,7 +5410,7 @@ var Assertions;
5241
5410
  let finalName = name !== null && name !== void 0 ? name : Const_1.MALFORMEDXML;
5242
5411
  let finalMessage = message !== null && message !== void 0 ? message : Const_1.EMPTY_STR;
5243
5412
  //TODO clean up the messy makeException, this is a perfect case for encapsulation and sane defaults
5244
- return makeException(error, finalTitle, finalName, "Response", caller || ((arguments.caller) ? arguments.caller.toString() : "_raiseError"), finalMessage);
5413
+ return Lang_1.ExtLang.makeException(error, finalTitle, finalName, "Response", caller || ((arguments.caller) ? arguments.caller.toString() : "_raiseError"), finalMessage);
5245
5414
  }
5246
5415
  Assertions.raiseError = raiseError;
5247
5416
  /*
@@ -5264,6 +5433,13 @@ var Assertions;
5264
5433
  assertType(value, "function", msg, caller, title);
5265
5434
  }
5266
5435
  Assertions.assertFunction = assertFunction;
5436
+ function assertDelay(value) {
5437
+ if (!(value >= 0)) { // >= 0 abbreviation which covers all cases of non positive values,
5438
+ // including NaN and non numeric strings, no type equality is deliberate here,
5439
+ throw new Error("Invalid delay value: " + value);
5440
+ }
5441
+ }
5442
+ Assertions.assertDelay = assertDelay;
5267
5443
  })(Assertions = exports.Assertions || (exports.Assertions = {}));
5268
5444
 
5269
5445
 
@@ -5618,6 +5794,9 @@ class ExtDomQuery extends mona_dish_1.DQ {
5618
5794
  var _a, _b;
5619
5795
  return (_b = (_a = curScript.getAsElem(0).value) === null || _a === void 0 ? void 0 : _a.nonce) !== null && _b !== void 0 ? _b : curScript.attr("nonce").value;
5620
5796
  }
5797
+ filter(func) {
5798
+ return new ExtDomQuery(super.filter(func));
5799
+ }
5621
5800
  }
5622
5801
  exports.ExtDomQuery = ExtDomQuery;
5623
5802
  exports.ExtDQ = ExtDomQuery;
@@ -5856,7 +6035,7 @@ var ExtLang;
5856
6035
  */
5857
6036
  function getForm(elem, event) {
5858
6037
  let queryElem = new mona_dish_1.DQ(elem);
5859
- let eventTarget = new mona_dish_1.DQ((0, RequestDataResolver_1.getEventTarget)(event));
6038
+ let eventTarget = (event) ? new mona_dish_1.DQ((0, RequestDataResolver_1.getEventTarget)(event)) : mona_dish_1.DomQuery.absent;
5860
6039
  if (queryElem.isTag(Const_1.TAG_FORM)) {
5861
6040
  return queryElem;
5862
6041
  }
@@ -5868,9 +6047,9 @@ var ExtLang;
5868
6047
  return foundForm;
5869
6048
  }
5870
6049
  }
5871
- let form = queryElem.parents(Const_1.TAG_FORM)
6050
+ let form = queryElem.firstParent(Const_1.TAG_FORM)
5872
6051
  .orElseLazy(() => queryElem.byTagName(Const_1.TAG_FORM, true))
5873
- .orElseLazy(() => eventTarget.parents(Const_1.TAG_FORM))
6052
+ .orElseLazy(() => eventTarget.firstParent(Const_1.TAG_FORM))
5874
6053
  .orElseLazy(() => eventTarget.byTagName(Const_1.TAG_FORM))
5875
6054
  .first();
5876
6055
  assertFormExists(form);
@@ -6079,6 +6258,7 @@ const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-di
6079
6258
  const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
6080
6259
  const Lang_1 = __webpack_require__(/*! ../util/Lang */ "./src/main/typescript/impl/util/Lang.ts");
6081
6260
  const ExtDomQuery_1 = __webpack_require__(/*! ../util/ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
6261
+ const Assertions_1 = __webpack_require__(/*! ../util/Assertions */ "./src/main/typescript/impl/util/Assertions.ts");
6082
6262
  /**
6083
6263
  * Resolver functions for various aspects of the request data
6084
6264
  *
@@ -6141,7 +6321,15 @@ exports.resolveTimeout = resolveTimeout;
6141
6321
  function resolveDelay(options) {
6142
6322
  var _a;
6143
6323
  let getCfg = Lang_1.ExtLang.getLocalOrGlobalConfig;
6144
- return (_a = options.getIf(Const_1.CTX_PARAM_DELAY).value) !== null && _a !== void 0 ? _a : getCfg(options.value, Const_1.CTX_PARAM_DELAY, 0);
6324
+ // null or non undefined will automatically be mapped to 0 aka no delay
6325
+ let ret = (_a = options.getIf(Const_1.CTX_PARAM_DELAY).value) !== null && _a !== void 0 ? _a : getCfg(options.value, Const_1.CTX_PARAM_DELAY, 0);
6326
+ // if delay === none, no delay must be used, aka delay 0
6327
+ if ('none' === ret) {
6328
+ ret = 0;
6329
+ }
6330
+ // negative, or invalid values will automatically get a js exception
6331
+ Assertions_1.Assertions.assertDelay(ret);
6332
+ return ret;
6145
6333
  }
6146
6334
  exports.resolveDelay = resolveDelay;
6147
6335
  /**
@@ -6190,7 +6378,7 @@ exports.getEventTarget = getEventTarget;
6190
6378
  * @param opts
6191
6379
  * @param el
6192
6380
  */
6193
- function resolveDefaults(event, opts = {}, el = null) {
6381
+ function resolveDefaults(event, opts, el = null) {
6194
6382
  var _a;
6195
6383
  //deep copy the options, so that further transformations to not backfire into the callers
6196
6384
  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);
@@ -6300,7 +6488,7 @@ exports.resolveSourceElement = resolveSourceElement;
6300
6488
  function resolveSourceForm(internalContext, elem) {
6301
6489
  let sourceFormId = internalContext.getIf(Const_1.CTX_PARAM_SRC_FRM_ID);
6302
6490
  let sourceForm = new mona_dish_2.DQ(sourceFormId.isPresent() ? document.forms[sourceFormId.value] : null);
6303
- sourceForm = sourceForm.orElseLazy(() => elem.parents(Const_1.TAG_FORM))
6491
+ sourceForm = sourceForm.orElseLazy(() => elem.firstParent(Const_1.TAG_FORM))
6304
6492
  .orElseLazy(() => elem.querySelectorAll(Const_1.TAG_FORM))
6305
6493
  .orElseLazy(() => mona_dish_2.DQ.querySelectorAll(Const_1.TAG_FORM));
6306
6494
  return sourceForm;
@@ -6557,18 +6745,25 @@ class ResponseProcessor {
6557
6745
  if (!shadowHead.isPresent()) {
6558
6746
  return;
6559
6747
  }
6560
- let oldHead = ExtDomQuery_1.ExtDomQuery.querySelectorAll(Const_1.TAG_HEAD);
6561
- //delete all to avoid script and style overlays
6562
- oldHead.querySelectorAll(Const_1.SEL_SCRIPTS_STYLES).delete();
6563
- // we cannot replace new elements in the head, but we can eval the elements
6564
- // eval means the scripts will get attached (eval script attach method)
6565
- // but this is done by DomQuery not in this code
6566
- this.storeForEval(shadowHead);
6567
- //incoming either the outer head tag or its children
6568
- //shadowHead = (shadowHead.tagName.value === "HEAD") ? shadowHead.childNodes : shadowHead;
6569
- //this.addToHead(shadowHead);
6748
+ let head = ExtDomQuery_1.ExtDomQuery.querySelectorAll(Const_1.TAG_HEAD);
6749
+ // full replace we delete everything
6750
+ head.childNodes.delete();
6751
+ this.addToHead(shadowHead);
6570
6752
  }
6571
- addToHead(newElements) {
6753
+ addToHead(shadowHead) {
6754
+ const mappedHeadData = new ExtDomQuery_1.ExtDomQuery(shadowHead);
6755
+ const postProcessTags = ["STYLE", "LINK", "SCRIPT"];
6756
+ const nonExecutables = mappedHeadData.filter(item => postProcessTags.indexOf(item.tagName.orElse("").value) == -1);
6757
+ nonExecutables.runHeadInserts(true);
6758
+ //incoming either the outer head tag or its children
6759
+ const nodesToAdd = (shadowHead.tagName.value === "HEAD") ? shadowHead.childNodes : shadowHead;
6760
+ // this is stored for post processing
6761
+ // after the rest of the "pyhsical build up", head before body
6762
+ const evalElements = nodesToAdd.stream
6763
+ .filter(item => postProcessTags.indexOf(item.tagName.orElse("").value) != -1).collect(new mona_dish_1.DomQueryCollector());
6764
+ this.addToHeadDeferred(evalElements);
6765
+ }
6766
+ addToHeadDeferred(newElements) {
6572
6767
  this.internalContext.assign(Const_1.DEFERRED_HEAD_INSERTS).value.push(newElements);
6573
6768
  }
6574
6769
  /**
@@ -6648,7 +6843,7 @@ class ResponseProcessor {
6648
6843
  */
6649
6844
  update(node, cdataBlock) {
6650
6845
  let result = ExtDomQuery_1.ExtDomQuery.byId(node.id.value, true).outerHTML(cdataBlock, false, false);
6651
- let sourceForm = result === null || result === void 0 ? void 0 : result.parents(Const_1.TAG_FORM).orElseLazy(() => result.byTagName(Const_1.TAG_FORM, true));
6846
+ let sourceForm = result === null || result === void 0 ? void 0 : result.firstParent(Const_1.TAG_FORM).orElseLazy(() => result.byTagName(Const_1.TAG_FORM, true));
6652
6847
  if (sourceForm) {
6653
6848
  this.storeForPostProcessing(sourceForm, result);
6654
6849
  }
@@ -6766,10 +6961,11 @@ class ResponseProcessor {
6766
6961
  mona_dish_1.Stream.ofAssoc(this.internalContext.getIf(Const_1.APPLIED_VST).orElse({}).value)
6767
6962
  .each((item) => {
6768
6963
  let value = item[1];
6769
- let nameSpace = mona_dish_1.DQ.byId(value.nameSpace, true).orElse(document.body);
6770
- let affectedForms = nameSpace.byTagName(Const_1.TAG_FORM);
6771
- let affectedForms2 = nameSpace.filter(item => item.tagName.orElse(Const_1.EMPTY_STR).value.toLowerCase() == Const_1.TAG_FORM);
6772
- this.appendViewStateToForms(new mona_dish_1.DomQuery(affectedForms, affectedForms2), value.value);
6964
+ let namingContainerId = this.internalContext.getIf(Const_1.PARTIAL_ID);
6965
+ let affectedForms;
6966
+ affectedForms = this.getContainerForms(namingContainerId)
6967
+ .filter(affectedForm => this.executeOrRenderFilter(affectedForm));
6968
+ this.appendViewStateToForms(affectedForms, value.value);
6773
6969
  });
6774
6970
  }
6775
6971
  /**
@@ -6779,11 +6975,12 @@ class ResponseProcessor {
6779
6975
  fixClientWindow() {
6780
6976
  mona_dish_1.Stream.ofAssoc(this.internalContext.getIf(Const_1.APPLIED_CLIENT_WINDOW).orElse({}).value)
6781
6977
  .each((item) => {
6782
- let value = item[1];
6783
- let nameSpace = mona_dish_1.DQ.byId(value.nameSpace, true).orElse(document.body);
6784
- let affectedForms = nameSpace.byTagName(Const_1.TAG_FORM);
6785
- let affectedForms2 = nameSpace.filter(item => item.tagName.orElse(Const_1.EMPTY_STR).value.toLowerCase() == Const_1.TAG_FORM);
6786
- this.appendClientWindowToForms(new mona_dish_1.DomQuery(affectedForms, affectedForms2), value.value);
6978
+ const value = item[1];
6979
+ const namingContainerId = this.internalContext.getIf(Const_1.PARTIAL_ID);
6980
+ let affectedForms;
6981
+ affectedForms = this.getContainerForms(namingContainerId)
6982
+ .filter(affectedForm => this.executeOrRenderFilter(affectedForm));
6983
+ this.appendClientWindowToForms(affectedForms, value.value);
6787
6984
  });
6788
6985
  }
6789
6986
  /**
@@ -6825,7 +7022,11 @@ class ResponseProcessor {
6825
7022
  assignState(forms, selector, state) {
6826
7023
  forms.each((form) => {
6827
7024
  let stateHolders = form.querySelectorAll(selector)
6828
- .orElseLazy(() => ResponseProcessor.newViewStateElement(form));
7025
+ .orElseLazy(() => {
7026
+ return selector.indexOf("ViewState") != -1 ?
7027
+ ResponseProcessor.newViewStateElement(form) :
7028
+ ResponseProcessor.newClientWindowElement(form);
7029
+ });
6829
7030
  stateHolders.attr("value").value = state;
6830
7031
  });
6831
7032
  }
@@ -6836,9 +7037,20 @@ class ResponseProcessor {
6836
7037
  * (usually a form node)
6837
7038
  */
6838
7039
  static newViewStateElement(parent) {
6839
- let newViewState = mona_dish_1.DQ.fromMarkup((0, Const_1.$nsp)(Const_1.HTML_VIEWSTATE));
6840
- newViewState.appendTo(parent);
6841
- return newViewState;
7040
+ let newElement = mona_dish_1.DQ.fromMarkup((0, Const_1.$nsp)(Const_1.HTML_VIEWSTATE));
7041
+ newElement.appendTo(parent);
7042
+ return newElement;
7043
+ }
7044
+ /**
7045
+ * Helper to Create a new JSF ViewState Element
7046
+ *
7047
+ * @param parent, the parent node to attach the viewState element to
7048
+ * (usually a form node)
7049
+ */
7050
+ static newClientWindowElement(parent) {
7051
+ let newElement = mona_dish_1.DQ.fromMarkup((0, Const_1.$nsp)(Const_1.HTML_CLIENT_WINDOW));
7052
+ newElement.appendTo(parent);
7053
+ return newElement;
6842
7054
  }
6843
7055
  /**
6844
7056
  * Stores certain aspects of the dom for later post-processing
@@ -6895,6 +7107,43 @@ class ResponseProcessor {
6895
7107
  triggerOnError(errorData) {
6896
7108
  this.externalContext.getIf(Const_1.ON_ERROR).orElse(this.internalContext.getIf(Const_1.ON_ERROR).value).orElse(Const_1.EMPTY_FUNC).value(errorData);
6897
7109
  }
7110
+ /**
7111
+ * filters the forms according to being in the execute or render cycle
7112
+ * @param affectedForm
7113
+ * @private
7114
+ */
7115
+ executeOrRenderFilter(affectedForm) {
7116
+ let executes = this.externalContext.getIf((0, Const_1.$nsp)(Const_1.P_EXECUTE)).orElse("@none").value.split(/\s+/gi);
7117
+ let renders = this.externalContext.getIf((0, Const_1.$nsp)(Const_1.P_RENDER)).orElse("@none").value.split(/\s+/gi);
7118
+ let executeAndRenders = executes.concat(...renders);
7119
+ return mona_dish_1.LazyStream.of(...executeAndRenders).filter(nameOrId => {
7120
+ if (nameOrId == "@all") {
7121
+ return true;
7122
+ }
7123
+ if (nameOrId == "@none") {
7124
+ return true;
7125
+ }
7126
+ const nameOrIdSelector = `[id='${nameOrId}'], [name='#${nameOrId}']`;
7127
+ //either the form directly is in execute or render or one of its children or one of its parents
7128
+ return affectedForm.matchesSelector(nameOrIdSelector) ||
7129
+ affectedForm.querySelectorAll(nameOrIdSelector).isPresent() ||
7130
+ affectedForm.firstParent(nameOrIdSelector).isPresent();
7131
+ }).first().isPresent();
7132
+ }
7133
+ /**
7134
+ * gets all forms under a single naming container id
7135
+ * @param namingContainerId
7136
+ * @private
7137
+ */
7138
+ getContainerForms(namingContainerId) {
7139
+ if (namingContainerId.isPresent()) {
7140
+ //naming container mode, all forms under naming container id must be processed
7141
+ return mona_dish_1.DQ.byId(namingContainerId.value).orElse((0, mona_dish_1.DQ$)(`form[name='${namingContainerId.value}']`)).byTagName(Const_1.TAG_FORM, true);
7142
+ }
7143
+ else {
7144
+ return mona_dish_1.DQ.byTagName(Const_1.TAG_FORM);
7145
+ }
7146
+ }
6898
7147
  }
6899
7148
  exports.ResponseProcessor = ResponseProcessor;
6900
7149
 
@@ -6965,12 +7214,17 @@ class XhrFormData extends mona_dish_1.Config {
6965
7214
  //a call to getViewState before must pass the encoded line
6966
7215
  //a call from getViewState passes the form element as datasource,
6967
7216
  //so we have two call points
7217
+ // atm we basically encode twice, to keep the code leaner
7218
+ // this will be later optmized, practically elements
7219
+ // which are already covered by an external viewstate do not need
7220
+ // the encoding a second time, because they are overwritten by the viewstate again
6968
7221
  if (isString(dataSource)) {
6969
7222
  this.assignEncodedString(this.dataSource);
6970
7223
  }
6971
7224
  else {
6972
7225
  this.applyFormDataToConfig();
6973
7226
  }
7227
+ //now assign the external viewstate overrides
6974
7228
  if ('undefined' != typeof viewState) {
6975
7229
  this.assignEncodedString(viewState);
6976
7230
  }
@@ -6984,23 +7238,26 @@ class XhrFormData extends mona_dish_1.Config {
6984
7238
  * in our ajax request
6985
7239
  */
6986
7240
  postInit(...executes) {
6987
- let fetchInput = (id) => {
7241
+ let fetchFileInputs = (id) => {
7242
+ const INPUT_FILE = "input[type='file']";
6988
7243
  if (id == Const_1.IDENT_ALL) {
6989
- return mona_dish_1.DQ.querySelectorAllDeep("input[type='file']");
7244
+ return mona_dish_1.DQ.querySelectorAllDeep(INPUT_FILE);
6990
7245
  }
6991
7246
  else if (id == Const_1.IDENT_FORM) {
6992
- return this.dataSource.querySelectorAllDeep("input[type='file']");
7247
+ return this.dataSource.matchesSelector(INPUT_FILE) ?
7248
+ this.dataSource :
7249
+ this.dataSource.querySelectorAllDeep(INPUT_FILE);
6993
7250
  }
6994
7251
  else {
6995
7252
  let element = mona_dish_1.DQ.byId(id, true);
6996
- return this.getFileInputs(element);
7253
+ return element.matchesSelector(INPUT_FILE) ? element : this.getFileInputs(element);
6997
7254
  }
6998
7255
  };
6999
7256
  let inputExists = (item) => {
7000
7257
  return item.isPresent();
7001
7258
  };
7002
7259
  this.isMultipartRequest = mona_dish_1.LazyStream.of(...executes)
7003
- .map(fetchInput)
7260
+ .map(fetchFileInputs)
7004
7261
  .filter(inputExists)
7005
7262
  .first().isPresent();
7006
7263
  }
@@ -7038,8 +7295,8 @@ class XhrFormData extends mona_dish_1.Config {
7038
7295
  var _a, _b;
7039
7296
  return keyVal.length < 3 ? [(_a = keyVal === null || keyVal === void 0 ? void 0 : keyVal[0]) !== null && _a !== void 0 ? _a : [], (_b = keyVal === null || keyVal === void 0 ? void 0 : keyVal[1]) !== null && _b !== void 0 ? _b : []] : keyVal;
7040
7297
  }
7298
+ //TODO fix files...
7041
7299
  mona_dish_1.Stream.of(...keyValueEntries)
7042
- //split only the first =
7043
7300
  .map(line => splitToKeyVal(line))
7044
7301
  //special case of having keys without values
7045
7302
  .map(keyVal => fixKeyWithoutVal(keyVal))
@@ -7075,7 +7332,10 @@ class XhrFormData extends mona_dish_1.Config {
7075
7332
  }
7076
7333
  let entries = mona_dish_1.LazyStream.of(...Object.keys(this.value))
7077
7334
  .filter(key => this.value.hasOwnProperty(key))
7078
- .flatMap(key => mona_dish_1.Stream.of(...this.value[key]).map(val => [key, val]).collect(new mona_dish_1.ArrayCollector()))
7335
+ .flatMap(key => mona_dish_1.Stream.of(...this.value[key]).map(val => [key, val])
7336
+ //we cannot encode file elements that is handled by multipart requests anyway
7337
+ .filter(([, value]) => !(value instanceof ExtDomQuery_1.ExtDomQuery.global().File))
7338
+ .collect(new mona_dish_1.ArrayCollector()))
7079
7339
  .map(keyVal => {
7080
7340
  return `${encodeURIComponent(keyVal[0])}=${encodeURIComponent(keyVal[1])}`;
7081
7341
  })
@@ -7532,31 +7792,32 @@ var oam;
7532
7792
  }
7533
7793
  mona_dish_1.DQ.byId(element).delete();
7534
7794
  };
7535
- // noinspection JSUnusedGlobalSymbols
7795
+ // noinspection JSUnusedGlobalSymbols,JSUnusedLocalSymbols
7536
7796
  /**
7537
7797
  * does special form submit remapping
7538
7798
  * re-maps the issuing command link into something,
7539
- * a decode of the command link on the server can understand
7799
+ * the "decode" of the command link on the server can understand
7540
7800
  *
7541
7801
  * @param formName
7542
7802
  * @param linkId
7543
7803
  * @param target
7544
7804
  * @param params
7545
7805
  */
7546
- oam.submitForm = function (formName, linkId, target, params) {
7547
- var _a, _b, _c, _d;
7806
+ oam.submitForm = function (formName, linkId = null, target = null, params = {}) {
7807
+ var _a, _b, _c, _d, _e, _f;
7808
+ //handle a possible incoming null, not sure if this is used that way anywhere, but we allow it
7809
+ params = (!params) ? {} : params;
7548
7810
  let clearFn = 'clearFormHiddenParams_' + formName.replace(/-/g, '\$:').replace(/:/g, '_');
7549
7811
  (_a = window === null || window === void 0 ? void 0 : window[clearFn]) === null || _a === void 0 ? void 0 : _a.call(window, formName);
7550
7812
  //autoscroll code
7551
7813
  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)) {
7552
7814
  myfaces.oam.setHiddenInput(formName, 'autoScroll', window === null || window === void 0 ? void 0 : window.getScrolling());
7553
7815
  }
7554
- mona_dish_1.Stream.ofAssoc(params).each((param) => {
7555
- myfaces.oam.setHiddenInput(formName, param[0], param[1]);
7556
- });
7816
+ let paramsStream = Array.isArray(params) ? mona_dish_1.Stream.of(...params) : mona_dish_1.Stream.ofAssoc(params);
7817
+ paramsStream.each(([key, data]) => myfaces.oam.setHiddenInput(formName, key, data));
7557
7818
  //we call the namespaced function, to allow decoration, via a direct call we would
7558
- myfaces.oam.setHiddenInput(formName, `${formName}:_idcl`, linkId);
7559
- mona_dish_1.DQ.byId(document.forms[formName]).each(form => {
7819
+ myfaces.oam.setHiddenInput(formName, `${formName}:_idcl`, linkId !== null && linkId !== void 0 ? linkId : '');
7820
+ 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 => {
7560
7821
  var _a;
7561
7822
  const ATTR_TARGET = "target";
7562
7823
  const formElement = form.getAsElem(0).value;
@@ -7573,8 +7834,9 @@ var oam;
7573
7834
  }
7574
7835
  finally {
7575
7836
  form.attr(ATTR_TARGET).value = oldTarget;
7576
- mona_dish_1.Stream.ofAssoc(params).each((param) => {
7577
- myfaces.oam.clearHiddenInput(formName, param[0]);
7837
+ // noinspection JSUnusedLocalSymbols
7838
+ paramsStream.each(([key, data]) => {
7839
+ myfaces.oam.clearHiddenInput(formName, key);
7578
7840
  });
7579
7841
  myfaces.oam.clearHiddenInput(formName, `${formName}:_idcl`);
7580
7842
  }