jsf.js_next_gen 1.0.0-beta-19 → 1.0.0-beta-20

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 (47) hide show
  1. package/README.md +5 -2
  2. package/dist/docs/index.html +5 -2
  3. package/dist/window/jsf-development.js +51 -74
  4. package/dist/window/jsf-development.js.map +1 -1
  5. package/dist/window/jsf.js +1 -1
  6. package/dist/window/jsf.js.br +0 -0
  7. package/dist/window/jsf.js.gz +0 -0
  8. package/dist/window/jsf.js.map +1 -1
  9. package/package.json +1 -1
  10. package/src/main/typescript/myfaces/OamSubmit.ts +49 -81
  11. package/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.ts +0 -5
  12. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +4 -4
  13. package/src/main/typescript/test/impl/SeparatorCharsTest.spec.ts +0 -1
  14. package/src/main/typescript/test/myfaces/OamSubmit.spec.ts +107 -16
  15. package/src/main/typescript/tsconfig.json +1 -0
  16. package/target/myfaces/OamSubmit.js +50 -73
  17. package/target/myfaces/OamSubmit.js.map +1 -1
  18. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +24 -1
  19. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
  20. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +0 -5
  21. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
  22. package/target/test/frameworkBase/_ext/shared/StandardInits.js +32 -6
  23. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  24. package/target/test/impl/ImplTest.spec.js +24 -1
  25. package/target/test/impl/ImplTest.spec.js.map +1 -1
  26. package/target/test/impl/SeparatorCharsTest.spec.js +24 -2
  27. package/target/test/impl/SeparatorCharsTest.spec.js.map +1 -1
  28. package/target/test/myfaces/OamSubmit.spec.js +92 -13
  29. package/target/test/myfaces/OamSubmit.spec.js.map +1 -1
  30. package/target/test/queue/AsynchronousQueueTest.spec.js +24 -1
  31. package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
  32. package/target/test/xhrCore/EventTests.spec.js +24 -1
  33. package/target/test/xhrCore/EventTests.spec.js.map +1 -1
  34. package/target/test/xhrCore/FileUploadTest.spec.js +24 -1
  35. package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
  36. package/target/test/xhrCore/RequestParamsTest.spec.js +24 -1
  37. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  38. package/target/test/xhrCore/RequestTest.spec.js +24 -1
  39. package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
  40. package/target/test/xhrCore/ResponseTest.spec.js +24 -1
  41. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  42. package/target/test/xhrCore/ShadowDomTest.spec.js +24 -1
  43. package/target/test/xhrCore/ShadowDomTest.spec.js.map +1 -1
  44. package/target/test/xhrCore/WebsocketTest.js +24 -1
  45. package/target/test/xhrCore/WebsocketTest.js.map +1 -1
  46. package/target/test/xhrCore/XhrFormDataTest.spec.js +24 -1
  47. package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
package/README.md CHANGED
@@ -34,8 +34,11 @@ where I just ran a set of 20 integration tests on macro scale.
34
34
  ## Status
35
35
 
36
36
  ATM I am function complete, and the code
37
- can be tested (alpha stage)
38
- I probably will make a release before 2020.
37
+ can be tested (final beta stages)
38
+ I probably will make a release before 2022.
39
+ It has been testing in MyFaces Tobago now for a year
40
+ and atm is being integrated into MyFaces as new
41
+ JS codebase.
39
42
 
40
43
 
41
44
  ## Usage
@@ -44,8 +44,11 @@ where I just ran a set of 20 integration tests on macro scale.</p>
44
44
  <h2>Status</h2>
45
45
  </a>
46
46
  <p>ATM I am function complete, and the code
47
- can be tested (alpha stage)
48
- I probably will make a release before 2020.</p>
47
+ can be tested (final beta stages)
48
+ I probably will make a release before 2022.
49
+ It has been testing in MyFaces Tobago now for a year
50
+ and atm is being integrated into MyFaces as new
51
+ JS codebase.</p>
49
52
 
50
53
  <a href="#usage" id="usage" style="color: inherit; text-decoration: none;">
51
54
  <h2>Usage</h2>
@@ -7489,7 +7489,7 @@ exports.XhrRequest = XhrRequest;
7489
7489
  /*!**************************************************!*\
7490
7490
  !*** ./src/main/typescript/myfaces/OamSubmit.ts ***!
7491
7491
  \**************************************************/
7492
- /***/ ((__unused_webpack_module, exports) => {
7492
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
7493
7493
 
7494
7494
 
7495
7495
  /* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -7509,52 +7509,49 @@ exports.XhrRequest = XhrRequest;
7509
7509
  */
7510
7510
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7511
7511
  exports.oam = void 0;
7512
+ var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
7513
+ //TODO add unit tests to check all this here that it works just as before
7512
7514
  var oam;
7513
7515
  (function (oam) {
7514
7516
  /**
7515
7517
  * sets a hidden input field
7516
- * @param formname the formName
7518
+ * @param formName the formName
7517
7519
  * @param name the hidden field
7518
7520
  * @param value the value to be rendered
7519
7521
  */
7520
- oam.setHiddenInput = function (formname, name, value) {
7521
- var form = document.forms[formname];
7522
- if (typeof form == 'undefined') {
7523
- form = document.getElementById(formname);
7524
- }
7525
- if (typeof form.elements[name] != 'undefined' && (form.elements[name].nodeName == 'INPUT' || form.elements[name].nodeName == 'input')) {
7526
- form.elements[name].value = value;
7527
- }
7528
- else {
7529
- var newInput = document.createElement('input');
7530
- newInput.setAttribute('type', 'hidden');
7531
- newInput.setAttribute('id', name);
7532
- newInput.setAttribute('name', name);
7533
- newInput.setAttribute('value', value);
7534
- form.appendChild(newInput);
7535
- }
7522
+ oam.setHiddenInput = function (formName, name, value) {
7523
+ mona_dish_1.DQ.byId(document.forms[formName])
7524
+ .each(function (form) {
7525
+ var input = form.querySelectorAll("input[type='hidden'][name='".concat(name, "']"));
7526
+ if (input.isPresent()) {
7527
+ input.inputValue.value = value;
7528
+ }
7529
+ else {
7530
+ var newInput = mona_dish_1.DQ.fromMarkup("<input type='hidden' id='".concat(name, "' name='").concat(name, "'>"));
7531
+ newInput.inputValue.value = value;
7532
+ newInput.appendTo(form);
7533
+ }
7534
+ });
7536
7535
  };
7537
7536
  /**
7538
7537
  * clears a hidden input field
7539
7538
  *
7540
- * @param formname formName for the input
7539
+ * @param formName formName for the input
7541
7540
  * @param name the name of the input field
7542
7541
  */
7543
- oam.clearHiddenInput = function (formname, name) {
7544
- var form = document.forms[formname];
7545
- if (typeof form == 'undefined') {
7546
- form = document.getElementById(formname);
7547
- }
7548
- var hInput = form.elements[name];
7549
- if (typeof hInput != 'undefined') {
7550
- form.removeChild(hInput);
7542
+ oam.clearHiddenInput = function (formName, name) {
7543
+ var _a, _b, _c;
7544
+ var element = (_c = (_b = (_a = document.forms) === null || _a === void 0 ? void 0 : _a[formName]) === null || _b === void 0 ? void 0 : _b.elements) === null || _c === void 0 ? void 0 : _c[name];
7545
+ if (!element) {
7546
+ return;
7551
7547
  }
7548
+ mona_dish_1.DQ.byId(element).delete();
7552
7549
  };
7553
7550
  // noinspection JSUnusedGlobalSymbols
7554
7551
  /**
7555
7552
  * does special form submit remapping
7556
- * remaps the issuing command link into something
7557
- * the decode of the command link on the server can understand
7553
+ * re-maps the issuing command link into something,
7554
+ * a decode of the command link on the server can understand
7558
7555
  *
7559
7556
  * @param formName
7560
7557
  * @param linkId
@@ -7562,59 +7559,39 @@ var oam;
7562
7559
  * @param params
7563
7560
  */
7564
7561
  oam.submitForm = function (formName, linkId, target, params) {
7565
- var _a, _b;
7562
+ var _a, _b, _c, _d;
7566
7563
  var clearFn = 'clearFormHiddenParams_' + formName.replace(/-/g, '\$:').replace(/:/g, '_');
7567
- if (typeof window[clearFn] == 'function') {
7568
- window[clearFn](formName);
7569
- }
7570
- var form = document.forms[formName];
7571
- if (typeof form == 'undefined') {
7572
- form = document.getElementById(formName);
7573
- }
7564
+ (_a = window === null || window === void 0 ? void 0 : window[clearFn]) === null || _a === void 0 ? void 0 : _a.call(window, formName);
7574
7565
  //autoscroll code
7575
- if (((_b = (_a = window === null || window === void 0 ? void 0 : window.myfaces) === null || _a === void 0 ? void 0 : _a.core) === null || _b === void 0 ? void 0 : _b.config.autoScroll) && typeof (window === null || window === void 0 ? void 0 : window.getScrolling) != 'undefined') {
7566
+ 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)) {
7576
7567
  myfaces.oam.setHiddenInput(formName, 'autoScroll', window === null || window === void 0 ? void 0 : window.getScrolling());
7577
7568
  }
7578
- var oldTarget = form.target;
7579
- if (target != null) {
7580
- form.target = target;
7581
- }
7582
- if ((typeof params != 'undefined') && params != null) {
7583
- for (var i = 0, param = void 0; (param = params[i]); i++) {
7584
- myfaces.oam.setHiddenInput(formName, param[0], param[1]);
7585
- }
7586
- }
7587
- myfaces.oam.setHiddenInput(formName, formName + ':' + '_idcl', linkId);
7588
- if (form.onsubmit) {
7589
- var result = form.onsubmit();
7590
- if ((typeof result == 'undefined') || result) {
7591
- try {
7592
- form.submit();
7593
- }
7594
- catch (e) {
7595
- if (window.console) {
7596
- console.error(e);
7597
- }
7598
- }
7599
- }
7600
- }
7601
- else {
7569
+ mona_dish_1.Stream.ofAssoc(params).each(function (param) {
7570
+ myfaces.oam.setHiddenInput(formName, param[0], param[1]);
7571
+ });
7572
+ //we call the namespaced function, to allow decoration, via a direct call we would
7573
+ myfaces.oam.setHiddenInput(formName, "".concat(formName, ":_idcl"), linkId);
7574
+ mona_dish_1.DQ.byId(document.forms[formName]).each(function (form) {
7575
+ var _a;
7576
+ var ATTR_TARGET = "target";
7577
+ var formElement = form.getAsElem(0).value;
7578
+ var oldTarget = form.attr(ATTR_TARGET).value;
7579
+ form.attr(ATTR_TARGET).value = target;
7580
+ var result = (_a = formElement === null || formElement === void 0 ? void 0 : formElement.onsubmit) === null || _a === void 0 ? void 0 : _a.call(formElement, null);
7602
7581
  try {
7603
- form.submit();
7604
- }
7605
- catch (e) {
7606
- if (window.console) {
7607
- console.error(e);
7582
+ if ((!!result) || 'undefined' == typeof result) {
7583
+ formElement.submit();
7608
7584
  }
7609
7585
  }
7610
- }
7611
- form.target = oldTarget;
7612
- if ((typeof params != 'undefined') && params != null) {
7613
- for (var i = 0, param = void 0; (param = params[i]); i++) {
7614
- myfaces.oam.clearHiddenInput(formName, param[0], param[1]);
7586
+ catch (e) {
7587
+ window === null || window === void 0 ? void 0 : window.console.error(e);
7615
7588
  }
7616
- }
7617
- myfaces.oam.clearHiddenInput(formName, formName + ':' + '_idcl', linkId);
7589
+ form.attr(ATTR_TARGET).value = oldTarget;
7590
+ mona_dish_1.Stream.ofAssoc(params).each(function (param) {
7591
+ myfaces.oam.clearHiddenInput(formName, param[0]);
7592
+ });
7593
+ myfaces.oam.clearHiddenInput(formName, "".concat(formName, ":_idcl"));
7594
+ });
7618
7595
  return false;
7619
7596
  };
7620
7597
  })(oam = exports.oam || (exports.oam = {}));