jsf.js_next_gen 1.0.0-beta-14 → 1.0.0-beta-16
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.
- package/dist/window/jsf-development.js +358 -125
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.br +0 -0
- package/dist/window/jsf.js.gz +0 -0
- package/dist/window/jsf.js.map +1 -1
- package/package.json +5 -5
- package/src/main/typescript/api/Jsf.ts +2 -0
- package/src/main/typescript/impl/AjaxImpl.ts +37 -26
- package/src/main/typescript/impl/util/ExtDomQuery.ts +6 -4
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +23 -30
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +2 -0
- package/target/api/Jsf.js +1 -0
- package/target/api/Jsf.js.map +1 -1
- package/target/impl/AjaxImpl.js +32 -21
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +5 -4
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +20 -26
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +2 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
|
@@ -504,8 +504,12 @@ var DomQuery = /** @class */ (function () {
|
|
|
504
504
|
Object.defineProperty(DomQuery.prototype, "asArray", {
|
|
505
505
|
get: function () {
|
|
506
506
|
//filter not supported by IE11
|
|
507
|
-
return [].concat(Stream_1.LazyStream.of.apply(Stream_1.LazyStream, this.rootNode).filter(function (item) {
|
|
508
|
-
|
|
507
|
+
return [].concat(Stream_1.LazyStream.of.apply(Stream_1.LazyStream, this.rootNode).filter(function (item) {
|
|
508
|
+
return item != null;
|
|
509
|
+
})
|
|
510
|
+
.map(function (item) {
|
|
511
|
+
return DomQuery.byId(item);
|
|
512
|
+
}).collect(new SourcesCollectors_1.ArrayCollector()));
|
|
509
513
|
},
|
|
510
514
|
enumerable: false,
|
|
511
515
|
configurable: true
|
|
@@ -896,7 +900,8 @@ var DomQuery = /** @class */ (function () {
|
|
|
896
900
|
//code snippet license: https://creativecommons.org/licenses/by-sa/2.5/
|
|
897
901
|
DomQuery.prototype._mozMatchesSelector = function (toMatch, selector) {
|
|
898
902
|
var prot = toMatch;
|
|
899
|
-
var matchesSelector = prot.
|
|
903
|
+
var matchesSelector = prot.matches ||
|
|
904
|
+
prot.matchesSelector ||
|
|
900
905
|
prot.mozMatchesSelector ||
|
|
901
906
|
prot.msMatchesSelector ||
|
|
902
907
|
prot.oMatchesSelector ||
|
|
@@ -925,14 +930,19 @@ var DomQuery = /** @class */ (function () {
|
|
|
925
930
|
});
|
|
926
931
|
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], matched, false)))();
|
|
927
932
|
};
|
|
933
|
+
/**
|
|
934
|
+
* checks whether any item in this domQuery level matches the selector
|
|
935
|
+
* if there is one element only attached, as root the match is only
|
|
936
|
+
* performed on this element.
|
|
937
|
+
* @param selector
|
|
938
|
+
*/
|
|
928
939
|
DomQuery.prototype.matchesSelector = function (selector) {
|
|
929
940
|
var _this = this;
|
|
930
|
-
this.
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
return true;
|
|
941
|
+
var ret = this.lazyStream
|
|
942
|
+
.map(function (item) { return _this._mozMatchesSelector(item.getAsElem(0).value, selector); })
|
|
943
|
+
.filter(function (match) { return match; })
|
|
944
|
+
.first();
|
|
945
|
+
return ret.isPresent();
|
|
936
946
|
};
|
|
937
947
|
/**
|
|
938
948
|
* easy node traversal, you can pass
|
|
@@ -1618,6 +1628,19 @@ var DomQuery = /** @class */ (function () {
|
|
|
1618
1628
|
this.pos++;
|
|
1619
1629
|
return new DomQuery(this.values[this.pos]);
|
|
1620
1630
|
};
|
|
1631
|
+
DomQuery.prototype.lookAhead = function (cnt) {
|
|
1632
|
+
if (cnt === void 0) { cnt = 1; }
|
|
1633
|
+
if ((this.values.length - 1) < (this.pos + cnt)) {
|
|
1634
|
+
return SourcesCollectors_1.ITERATION_STATUS.EO_STRM;
|
|
1635
|
+
}
|
|
1636
|
+
return new DomQuery(this.values[this.pos + cnt]);
|
|
1637
|
+
};
|
|
1638
|
+
DomQuery.prototype.current = function () {
|
|
1639
|
+
if (this.pos == -1) {
|
|
1640
|
+
return SourcesCollectors_1.ITERATION_STATUS.BEF_STRM;
|
|
1641
|
+
}
|
|
1642
|
+
return new DomQuery(this.values[this.pos]);
|
|
1643
|
+
};
|
|
1621
1644
|
DomQuery.prototype.reset = function () {
|
|
1622
1645
|
this.pos = -1;
|
|
1623
1646
|
};
|
|
@@ -1740,6 +1763,24 @@ var DomQuery = /** @class */ (function () {
|
|
|
1740
1763
|
}
|
|
1741
1764
|
};
|
|
1742
1765
|
};
|
|
1766
|
+
/**
|
|
1767
|
+
* concats the elements of two Dom Queries into a single one
|
|
1768
|
+
* @param toAttach
|
|
1769
|
+
*/
|
|
1770
|
+
DomQuery.prototype.concat = function (toAttach, filterDoubles) {
|
|
1771
|
+
if (filterDoubles === void 0) { filterDoubles = true; }
|
|
1772
|
+
var ret = this.lazyStream.concat(toAttach.lazyStream).collect(new DomQueryCollector());
|
|
1773
|
+
//we now filter the doubles out
|
|
1774
|
+
if (!filterDoubles) {
|
|
1775
|
+
return ret;
|
|
1776
|
+
}
|
|
1777
|
+
var idx = {}; //ie11 does not support sets, we have to fake it
|
|
1778
|
+
return ret.lazyStream.filter(function (node) {
|
|
1779
|
+
var notFound = !(idx === null || idx === void 0 ? void 0 : idx[node.value.value.outerHTML]);
|
|
1780
|
+
idx[node.value.value.outerHTML] = true;
|
|
1781
|
+
return notFound;
|
|
1782
|
+
}).collect(new DomQueryCollector());
|
|
1783
|
+
};
|
|
1743
1784
|
DomQuery.absent = new DomQuery();
|
|
1744
1785
|
return DomQuery;
|
|
1745
1786
|
}());
|
|
@@ -2385,6 +2426,10 @@ var Config = /** @class */ (function (_super) {
|
|
|
2385
2426
|
return _super.call(this, root) || this;
|
|
2386
2427
|
}
|
|
2387
2428
|
Object.defineProperty(Config.prototype, "shallowCopy", {
|
|
2429
|
+
/**
|
|
2430
|
+
* shallow copy getter, copies only the first level, references the deeper nodes
|
|
2431
|
+
* in a shared manner
|
|
2432
|
+
*/
|
|
2388
2433
|
get: function () {
|
|
2389
2434
|
return new Config(Stream_1.Stream.ofAssoc(this.value).collect(new SourcesCollectors_1.AssocArrayCollector()));
|
|
2390
2435
|
},
|
|
@@ -2392,12 +2437,19 @@ var Config = /** @class */ (function (_super) {
|
|
|
2392
2437
|
configurable: true
|
|
2393
2438
|
});
|
|
2394
2439
|
Object.defineProperty(Config.prototype, "deepCopy", {
|
|
2440
|
+
/**
|
|
2441
|
+
* deep copy, copies all config nodes
|
|
2442
|
+
*/
|
|
2395
2443
|
get: function () {
|
|
2396
2444
|
return new Config(objAssign({}, this.value));
|
|
2397
2445
|
},
|
|
2398
2446
|
enumerable: false,
|
|
2399
2447
|
configurable: true
|
|
2400
2448
|
});
|
|
2449
|
+
/**
|
|
2450
|
+
* creates a config from an initial value or null
|
|
2451
|
+
* @param value
|
|
2452
|
+
*/
|
|
2401
2453
|
Config.fromNullable = function (value) {
|
|
2402
2454
|
return new Config(value);
|
|
2403
2455
|
};
|
|
@@ -2438,74 +2490,99 @@ var Config = /** @class */ (function (_super) {
|
|
|
2438
2490
|
*
|
|
2439
2491
|
* resulting in myConfig.foobaz == ["newValue, newValue2"]
|
|
2440
2492
|
*
|
|
2441
|
-
* @param
|
|
2493
|
+
* @param {string[]} accessPath
|
|
2442
2494
|
*/
|
|
2443
2495
|
Config.prototype.append = function () {
|
|
2444
|
-
var
|
|
2496
|
+
var accessPath = [];
|
|
2445
2497
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2446
|
-
|
|
2498
|
+
accessPath[_i] = arguments[_i];
|
|
2447
2499
|
}
|
|
2448
|
-
var noKeys =
|
|
2500
|
+
var noKeys = accessPath.length < 1;
|
|
2449
2501
|
if (noKeys) {
|
|
2450
2502
|
return;
|
|
2451
2503
|
}
|
|
2452
|
-
var lastKey =
|
|
2504
|
+
var lastKey = accessPath[accessPath.length - 1];
|
|
2453
2505
|
var currKey, finalKey = this.keyVal(lastKey);
|
|
2454
|
-
var pathExists = this.getIf.apply(this,
|
|
2455
|
-
this.buildPath(
|
|
2506
|
+
var pathExists = this.getIf.apply(this, accessPath).isPresent();
|
|
2507
|
+
this.buildPath(accessPath);
|
|
2456
2508
|
var finalKeyArrPos = this.arrayIndex(lastKey);
|
|
2457
2509
|
if (finalKeyArrPos > -1) {
|
|
2458
2510
|
throw Error("Append only possible on non array properties, use assign on indexed data");
|
|
2459
2511
|
}
|
|
2460
|
-
var value = this.getIf.apply(this,
|
|
2512
|
+
var value = this.getIf.apply(this, accessPath).value;
|
|
2461
2513
|
if (!Array.isArray(value)) {
|
|
2462
|
-
value = this.assign.apply(this,
|
|
2514
|
+
value = this.assign.apply(this, accessPath).value = [value];
|
|
2463
2515
|
}
|
|
2464
2516
|
if (pathExists) {
|
|
2465
2517
|
value.push({});
|
|
2466
2518
|
}
|
|
2467
2519
|
finalKeyArrPos = value.length - 1;
|
|
2468
|
-
var retVal = new ConfigEntry(
|
|
2520
|
+
var retVal = new ConfigEntry(accessPath.length == 1 ? this.value : this.getIf.apply(this, accessPath.slice(0, accessPath.length - 1)).value, lastKey, finalKeyArrPos);
|
|
2469
2521
|
return retVal;
|
|
2470
2522
|
};
|
|
2523
|
+
/**
|
|
2524
|
+
* appends to an existing entry (or extends into an array and appends)
|
|
2525
|
+
* if the condition is met
|
|
2526
|
+
* @param {boolean} condition
|
|
2527
|
+
* @param {string[]} accessPath
|
|
2528
|
+
*/
|
|
2471
2529
|
Config.prototype.appendIf = function (condition) {
|
|
2472
|
-
var
|
|
2530
|
+
var accessPath = [];
|
|
2473
2531
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
2474
|
-
|
|
2532
|
+
accessPath[_i - 1] = arguments[_i];
|
|
2475
2533
|
}
|
|
2476
2534
|
if (!condition) {
|
|
2477
2535
|
return { value: null };
|
|
2478
2536
|
}
|
|
2479
|
-
return this.append.apply(this,
|
|
2537
|
+
return this.append.apply(this, accessPath);
|
|
2480
2538
|
};
|
|
2539
|
+
/**
|
|
2540
|
+
* assings an new value on the given access path
|
|
2541
|
+
* @param accessPath
|
|
2542
|
+
*/
|
|
2481
2543
|
Config.prototype.assign = function () {
|
|
2482
|
-
var
|
|
2544
|
+
var accessPath = [];
|
|
2483
2545
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2484
|
-
|
|
2546
|
+
accessPath[_i] = arguments[_i];
|
|
2485
2547
|
}
|
|
2486
|
-
if (
|
|
2548
|
+
if (accessPath.length < 1) {
|
|
2487
2549
|
return;
|
|
2488
2550
|
}
|
|
2489
|
-
this.buildPath(
|
|
2490
|
-
var currKey = this.keyVal(
|
|
2491
|
-
var arrPos = this.arrayIndex(
|
|
2492
|
-
var retVal = new ConfigEntry(
|
|
2551
|
+
this.buildPath(accessPath);
|
|
2552
|
+
var currKey = this.keyVal(accessPath[accessPath.length - 1]);
|
|
2553
|
+
var arrPos = this.arrayIndex(accessPath[accessPath.length - 1]);
|
|
2554
|
+
var retVal = new ConfigEntry(accessPath.length == 1 ? this.value : this.getIf.apply(this, accessPath.slice(0, accessPath.length - 1)).value, currKey, arrPos);
|
|
2493
2555
|
return retVal;
|
|
2494
2556
|
};
|
|
2557
|
+
/**
|
|
2558
|
+
* assign a value if the condition is set to true, otherwise skip it
|
|
2559
|
+
*
|
|
2560
|
+
* @param condition the condition, the access accessPath into the config
|
|
2561
|
+
* @param accessPath
|
|
2562
|
+
*/
|
|
2495
2563
|
Config.prototype.assignIf = function (condition) {
|
|
2496
|
-
var
|
|
2564
|
+
var accessPath = [];
|
|
2497
2565
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
2498
|
-
|
|
2566
|
+
accessPath[_i - 1] = arguments[_i];
|
|
2499
2567
|
}
|
|
2500
|
-
return condition ? this.assign.apply(this,
|
|
2568
|
+
return condition ? this.assign.apply(this, accessPath) : { value: null };
|
|
2501
2569
|
};
|
|
2570
|
+
/**
|
|
2571
|
+
* get if the access path is present (get is reserved as getter with a default, on the current path)
|
|
2572
|
+
* TODO will be renamed to something more meaningful and deprecated, the name is ambigous
|
|
2573
|
+
* @param accessPath the access path
|
|
2574
|
+
*/
|
|
2502
2575
|
Config.prototype.getIf = function () {
|
|
2503
|
-
var
|
|
2576
|
+
var accessPath = [];
|
|
2504
2577
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2505
|
-
|
|
2578
|
+
accessPath[_i] = arguments[_i];
|
|
2506
2579
|
}
|
|
2507
|
-
return this.getClass().fromNullable(_super.prototype.getIf.apply(this,
|
|
2580
|
+
return this.getClass().fromNullable(_super.prototype.getIf.apply(this, accessPath).value);
|
|
2508
2581
|
};
|
|
2582
|
+
/**
|
|
2583
|
+
* gets the current node and if none is present returns a config with a default value
|
|
2584
|
+
* @param defaultVal
|
|
2585
|
+
*/
|
|
2509
2586
|
Config.prototype.get = function (defaultVal) {
|
|
2510
2587
|
return this.getClass().fromNullable(_super.prototype.get.call(this, defaultVal).value);
|
|
2511
2588
|
};
|
|
@@ -2516,6 +2593,9 @@ var Config = /** @class */ (function (_super) {
|
|
|
2516
2593
|
}
|
|
2517
2594
|
return this;
|
|
2518
2595
|
};
|
|
2596
|
+
/**
|
|
2597
|
+
* converts the entire config into a json object
|
|
2598
|
+
*/
|
|
2519
2599
|
Config.prototype.toJson = function () {
|
|
2520
2600
|
return JSON.stringify(this.value);
|
|
2521
2601
|
};
|
|
@@ -2528,9 +2608,9 @@ var Config = /** @class */ (function (_super) {
|
|
|
2528
2608
|
/**
|
|
2529
2609
|
* builds the config path
|
|
2530
2610
|
*
|
|
2531
|
-
* @param
|
|
2611
|
+
* @param accessPath a sequential array of accessPath containing either a key name or an array reference name[<index>]
|
|
2532
2612
|
*/
|
|
2533
|
-
Config.prototype.buildPath = function (
|
|
2613
|
+
Config.prototype.buildPath = function (accessPath) {
|
|
2534
2614
|
var val = this;
|
|
2535
2615
|
var parentVal = this.getClass().fromNullable(null);
|
|
2536
2616
|
var parentPos = -1;
|
|
@@ -2541,9 +2621,9 @@ var Config = /** @class */ (function (_super) {
|
|
|
2541
2621
|
arr.push({});
|
|
2542
2622
|
}
|
|
2543
2623
|
};
|
|
2544
|
-
for (var cnt = 0; cnt <
|
|
2545
|
-
var currKey = this.keyVal(
|
|
2546
|
-
var arrPos = this.arrayIndex(
|
|
2624
|
+
for (var cnt = 0; cnt < accessPath.length; cnt++) {
|
|
2625
|
+
var currKey = this.keyVal(accessPath[cnt]);
|
|
2626
|
+
var arrPos = this.arrayIndex(accessPath[cnt]);
|
|
2547
2627
|
if (currKey === "" && arrPos >= 0) {
|
|
2548
2628
|
val.setVal((val.value instanceof Array) ? val.value : []);
|
|
2549
2629
|
alloc(val.value, arrPos + 1);
|
|
@@ -2615,8 +2695,16 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2615
2695
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
2616
2696
|
};
|
|
2617
2697
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2618
|
-
exports.QueryFormStringCollector = exports.QueryFormDataCollector = exports.FormDataCollector = exports.AssocArrayCollector = exports.Run = exports.ArrayAssocArrayCollector = exports.ArrayCollector = exports.FlatMapStreamDataSource = exports.MappedStreamDataSource = exports.FilteredStreamDatasource = exports.ArrayStreamDataSource = exports.SequenceDataSource = void 0;
|
|
2698
|
+
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;
|
|
2619
2699
|
var Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
|
|
2700
|
+
/**
|
|
2701
|
+
* special status of the datasource location pointer
|
|
2702
|
+
*/
|
|
2703
|
+
var ITERATION_STATUS;
|
|
2704
|
+
(function (ITERATION_STATUS) {
|
|
2705
|
+
ITERATION_STATUS["EO_STRM"] = "__EO_STRM__";
|
|
2706
|
+
ITERATION_STATUS["BEF_STRM"] = "___BEF_STRM__";
|
|
2707
|
+
})(ITERATION_STATUS = exports.ITERATION_STATUS || (exports.ITERATION_STATUS = {}));
|
|
2620
2708
|
/**
|
|
2621
2709
|
* defines a sequence of numbers for our stream input
|
|
2622
2710
|
*/
|
|
@@ -2624,16 +2712,30 @@ var SequenceDataSource = /** @class */ (function () {
|
|
|
2624
2712
|
function SequenceDataSource(start, total) {
|
|
2625
2713
|
this.total = total;
|
|
2626
2714
|
this.start = start;
|
|
2627
|
-
this.value = start;
|
|
2715
|
+
this.value = start - 1;
|
|
2628
2716
|
}
|
|
2629
2717
|
SequenceDataSource.prototype.hasNext = function () {
|
|
2630
|
-
return this.value < this.total;
|
|
2718
|
+
return this.value < (this.total - 1);
|
|
2631
2719
|
};
|
|
2632
2720
|
SequenceDataSource.prototype.next = function () {
|
|
2633
|
-
|
|
2721
|
+
this.value++;
|
|
2722
|
+
return this.value <= (this.total - 1) ? this.value : ITERATION_STATUS.EO_STRM;
|
|
2723
|
+
};
|
|
2724
|
+
SequenceDataSource.prototype.lookAhead = function (cnt) {
|
|
2725
|
+
if (cnt === void 0) { cnt = 1; }
|
|
2726
|
+
if ((this.value + cnt) > this.total - 1) {
|
|
2727
|
+
return ITERATION_STATUS.EO_STRM;
|
|
2728
|
+
}
|
|
2729
|
+
else {
|
|
2730
|
+
return this.value + cnt;
|
|
2731
|
+
}
|
|
2634
2732
|
};
|
|
2635
2733
|
SequenceDataSource.prototype.reset = function () {
|
|
2636
|
-
this.value =
|
|
2734
|
+
this.value = this.start - 1;
|
|
2735
|
+
};
|
|
2736
|
+
SequenceDataSource.prototype.current = function () {
|
|
2737
|
+
//first condition current without initial call for next
|
|
2738
|
+
return (this.start - 1) ? ITERATION_STATUS.BEF_STRM : this.value;
|
|
2637
2739
|
};
|
|
2638
2740
|
return SequenceDataSource;
|
|
2639
2741
|
}());
|
|
@@ -2650,16 +2752,27 @@ var ArrayStreamDataSource = /** @class */ (function () {
|
|
|
2650
2752
|
this.dataPos = -1;
|
|
2651
2753
|
this.value = value;
|
|
2652
2754
|
}
|
|
2755
|
+
ArrayStreamDataSource.prototype.lookAhead = function (cnt) {
|
|
2756
|
+
if (cnt === void 0) { cnt = 1; }
|
|
2757
|
+
if ((this.dataPos + cnt) > this.value.length - 1) {
|
|
2758
|
+
return ITERATION_STATUS.EO_STRM;
|
|
2759
|
+
}
|
|
2760
|
+
return this.value[this.dataPos + cnt];
|
|
2761
|
+
};
|
|
2653
2762
|
ArrayStreamDataSource.prototype.hasNext = function () {
|
|
2654
2763
|
return this.value.length - 1 > this.dataPos;
|
|
2655
2764
|
};
|
|
2656
2765
|
ArrayStreamDataSource.prototype.next = function () {
|
|
2766
|
+
var _a;
|
|
2657
2767
|
this.dataPos++;
|
|
2658
|
-
return this.value[this.dataPos];
|
|
2768
|
+
return (_a = this === null || this === void 0 ? void 0 : this.value[this.dataPos]) !== null && _a !== void 0 ? _a : ITERATION_STATUS.EO_STRM;
|
|
2659
2769
|
};
|
|
2660
2770
|
ArrayStreamDataSource.prototype.reset = function () {
|
|
2661
2771
|
this.dataPos = -1;
|
|
2662
2772
|
};
|
|
2773
|
+
ArrayStreamDataSource.prototype.current = function () {
|
|
2774
|
+
return this.value[Math.max(0, this.dataPos)];
|
|
2775
|
+
};
|
|
2663
2776
|
return ArrayStreamDataSource;
|
|
2664
2777
|
}());
|
|
2665
2778
|
exports.ArrayStreamDataSource = ArrayStreamDataSource;
|
|
@@ -2671,7 +2784,11 @@ exports.ArrayStreamDataSource = ArrayStreamDataSource;
|
|
|
2671
2784
|
*/
|
|
2672
2785
|
var FilteredStreamDatasource = /** @class */ (function () {
|
|
2673
2786
|
function FilteredStreamDatasource(filterFunc, parent) {
|
|
2674
|
-
this.
|
|
2787
|
+
this._current = ITERATION_STATUS.BEF_STRM;
|
|
2788
|
+
// we have to add a filter idx because the external filter values might change over time, so
|
|
2789
|
+
// we cannot reset the state properly unless we do it from a snapshot
|
|
2790
|
+
this._filterIdx = {};
|
|
2791
|
+
this._unfilteredPos = 0;
|
|
2675
2792
|
this.filterFunc = filterFunc;
|
|
2676
2793
|
this.inputDataSource = parent;
|
|
2677
2794
|
}
|
|
@@ -2682,32 +2799,61 @@ var FilteredStreamDatasource = /** @class */ (function () {
|
|
|
2682
2799
|
* serve it via next
|
|
2683
2800
|
*/
|
|
2684
2801
|
FilteredStreamDatasource.prototype.hasNext = function () {
|
|
2685
|
-
|
|
2686
|
-
|
|
2802
|
+
var steps = 1;
|
|
2803
|
+
var found = false;
|
|
2804
|
+
var next;
|
|
2805
|
+
while (!found && (next = this.inputDataSource.lookAhead(steps)) != ITERATION_STATUS.EO_STRM) {
|
|
2687
2806
|
if (this.filterFunc(next)) {
|
|
2688
|
-
this.
|
|
2689
|
-
|
|
2807
|
+
this._filterIdx[this._unfilteredPos + steps] = true;
|
|
2808
|
+
found = true;
|
|
2690
2809
|
}
|
|
2691
2810
|
else {
|
|
2692
|
-
|
|
2811
|
+
steps++;
|
|
2693
2812
|
}
|
|
2694
2813
|
}
|
|
2695
|
-
return
|
|
2814
|
+
return found;
|
|
2696
2815
|
};
|
|
2697
2816
|
/**
|
|
2698
2817
|
* serve the next element
|
|
2699
2818
|
*/
|
|
2700
2819
|
FilteredStreamDatasource.prototype.next = function () {
|
|
2701
|
-
var
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2820
|
+
var _a, _b;
|
|
2821
|
+
var found = ITERATION_STATUS.EO_STRM;
|
|
2822
|
+
while (this.inputDataSource.hasNext()) {
|
|
2823
|
+
this._unfilteredPos++;
|
|
2824
|
+
var next = this.inputDataSource.next();
|
|
2825
|
+
//again here we cannot call the filter function twice, because its state might change, so if indexed, we have a decent snapshot, either has next or next can trigger
|
|
2826
|
+
//the snapshot
|
|
2827
|
+
if (next != ITERATION_STATUS.EO_STRM &&
|
|
2828
|
+
(((_b = (_a = this._filterIdx) === null || _a === void 0 ? void 0 : _a[this._unfilteredPos]) !== null && _b !== void 0 ? _b : false) || this.filterFunc(next))) {
|
|
2829
|
+
this._filterIdx[this._unfilteredPos] = true;
|
|
2830
|
+
found = next;
|
|
2831
|
+
break;
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
this._current = found;
|
|
2835
|
+
return found;
|
|
2836
|
+
};
|
|
2837
|
+
FilteredStreamDatasource.prototype.lookAhead = function (cnt) {
|
|
2838
|
+
var _a;
|
|
2839
|
+
if (cnt === void 0) { cnt = 1; }
|
|
2840
|
+
var lookupVal;
|
|
2841
|
+
for (var loop = 1; cnt > 0 && (lookupVal = this.inputDataSource.lookAhead(loop)) != ITERATION_STATUS.EO_STRM; loop++) {
|
|
2842
|
+
var inCache = (_a = this._filterIdx) === null || _a === void 0 ? void 0 : _a[this._unfilteredPos + loop];
|
|
2843
|
+
if (inCache || this.filterFunc(lookupVal)) {
|
|
2844
|
+
cnt--;
|
|
2845
|
+
this._filterIdx[this._unfilteredPos + loop] = true;
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
return lookupVal;
|
|
2849
|
+
};
|
|
2850
|
+
FilteredStreamDatasource.prototype.current = function () {
|
|
2851
|
+
return this._current;
|
|
2708
2852
|
};
|
|
2709
2853
|
FilteredStreamDatasource.prototype.reset = function () {
|
|
2710
|
-
this.
|
|
2854
|
+
this._current = ITERATION_STATUS.BEF_STRM;
|
|
2855
|
+
this._filterIdx = {};
|
|
2856
|
+
this._unfilteredPos = 0;
|
|
2711
2857
|
this.inputDataSource.reset();
|
|
2712
2858
|
};
|
|
2713
2859
|
return FilteredStreamDatasource;
|
|
@@ -2731,6 +2877,14 @@ var MappedStreamDataSource = /** @class */ (function () {
|
|
|
2731
2877
|
MappedStreamDataSource.prototype.reset = function () {
|
|
2732
2878
|
this.inputDataSource.reset();
|
|
2733
2879
|
};
|
|
2880
|
+
MappedStreamDataSource.prototype.current = function () {
|
|
2881
|
+
return this.mapFunc(this.inputDataSource.current());
|
|
2882
|
+
};
|
|
2883
|
+
MappedStreamDataSource.prototype.lookAhead = function (cnt) {
|
|
2884
|
+
if (cnt === void 0) { cnt = 1; }
|
|
2885
|
+
var lookAheadVal = this.inputDataSource.lookAhead(cnt);
|
|
2886
|
+
return (lookAheadVal == ITERATION_STATUS.EO_STRM) ? lookAheadVal : this.mapFunc(lookAheadVal);
|
|
2887
|
+
};
|
|
2734
2888
|
return MappedStreamDataSource;
|
|
2735
2889
|
}());
|
|
2736
2890
|
exports.MappedStreamDataSource = MappedStreamDataSource;
|
|
@@ -2739,38 +2893,84 @@ exports.MappedStreamDataSource = MappedStreamDataSource;
|
|
|
2739
2893
|
*/
|
|
2740
2894
|
var FlatMapStreamDataSource = /** @class */ (function () {
|
|
2741
2895
|
function FlatMapStreamDataSource(func, parent) {
|
|
2896
|
+
this.walkedDataSources = [];
|
|
2897
|
+
this._currPos = 0;
|
|
2742
2898
|
this.mapFunc = func;
|
|
2743
2899
|
this.inputDataSource = parent;
|
|
2744
2900
|
}
|
|
2745
2901
|
FlatMapStreamDataSource.prototype.hasNext = function () {
|
|
2746
|
-
return this.
|
|
2902
|
+
return this.resolveActiveHasNext() || this.resolveNextHasNext();
|
|
2747
2903
|
};
|
|
2748
|
-
FlatMapStreamDataSource.prototype.
|
|
2904
|
+
FlatMapStreamDataSource.prototype.resolveActiveHasNext = function () {
|
|
2749
2905
|
var next = false;
|
|
2750
2906
|
if (this.activeDataSource) {
|
|
2751
2907
|
next = this.activeDataSource.hasNext();
|
|
2752
2908
|
}
|
|
2753
2909
|
return next;
|
|
2754
2910
|
};
|
|
2755
|
-
FlatMapStreamDataSource.prototype.
|
|
2911
|
+
FlatMapStreamDataSource.prototype.lookAhead = function (cnt) {
|
|
2912
|
+
var _a;
|
|
2913
|
+
//easy access trial
|
|
2914
|
+
if ((this === null || this === void 0 ? void 0 : this.activeDataSource) && ((_a = this === null || this === void 0 ? void 0 : this.activeDataSource) === null || _a === void 0 ? void 0 : _a.lookAhead(cnt)) != ITERATION_STATUS.EO_STRM) {
|
|
2915
|
+
//this should coverr 95% of all accesses
|
|
2916
|
+
return this === null || this === void 0 ? void 0 : this.activeDataSource.lookAhead(cnt);
|
|
2917
|
+
}
|
|
2918
|
+
//slower method we have to look ahead forward one by one until we hit the end or
|
|
2919
|
+
//have to move on
|
|
2920
|
+
for (var lookAheadPos = 1, topLevelLookAhead = 1; lookAheadPos <= cnt; topLevelLookAhead++) {
|
|
2921
|
+
var foundItem = null;
|
|
2922
|
+
var item = this.inputDataSource.lookAhead(topLevelLookAhead);
|
|
2923
|
+
if (item === ITERATION_STATUS.EO_STRM) {
|
|
2924
|
+
return item;
|
|
2925
|
+
}
|
|
2926
|
+
var mapped = this.mapFunc(item);
|
|
2927
|
+
//it either comes in as datasource or as array
|
|
2928
|
+
var currentDataSource = this.toDatasource(mapped);
|
|
2929
|
+
//this is the inner loop which looks ahead on our flatmapped datasource
|
|
2930
|
+
//we need an inner counter, but every look ahead also increases our loop
|
|
2931
|
+
return currentDataSource.lookAhead(cnt);
|
|
2932
|
+
/* for(let flatmapLookAhead = 1; lookAheadPos <= cnt && foundItem != ITERATION_STATUS.EO_STRM; flatmapLookAhead++, lookAheadPos++) {
|
|
2933
|
+
foundItem = currentDataSource.lookAhead(flatmapLookAhead);
|
|
2934
|
+
if(lookAheadPos >= cnt) {
|
|
2935
|
+
return foundItem;
|
|
2936
|
+
}
|
|
2937
|
+
}*/
|
|
2938
|
+
}
|
|
2939
|
+
return ITERATION_STATUS.EO_STRM;
|
|
2940
|
+
};
|
|
2941
|
+
FlatMapStreamDataSource.prototype.toDatasource = function (mapped) {
|
|
2942
|
+
var ds = Array.isArray(mapped) ? new (ArrayStreamDataSource.bind.apply(ArrayStreamDataSource, __spreadArray([void 0], mapped, false)))() : mapped;
|
|
2943
|
+
this.walkedDataSources.push(ds);
|
|
2944
|
+
return ds;
|
|
2945
|
+
};
|
|
2946
|
+
FlatMapStreamDataSource.prototype.resolveNextHasNext = function () {
|
|
2756
2947
|
var next = false;
|
|
2757
2948
|
while (!next && this.inputDataSource.hasNext()) {
|
|
2758
2949
|
var mapped = this.mapFunc(this.inputDataSource.next());
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
}
|
|
2762
|
-
else {
|
|
2763
|
-
this.activeDataSource = mapped;
|
|
2764
|
-
}
|
|
2950
|
+
this.activeDataSource = this.toDatasource(mapped);
|
|
2951
|
+
;
|
|
2765
2952
|
next = this.activeDataSource.hasNext();
|
|
2766
2953
|
}
|
|
2767
2954
|
return next;
|
|
2768
2955
|
};
|
|
2769
2956
|
FlatMapStreamDataSource.prototype.next = function () {
|
|
2770
|
-
|
|
2957
|
+
if (this.hasNext()) {
|
|
2958
|
+
this._currPos++;
|
|
2959
|
+
return this.activeDataSource.next();
|
|
2960
|
+
}
|
|
2771
2961
|
};
|
|
2772
2962
|
FlatMapStreamDataSource.prototype.reset = function () {
|
|
2773
2963
|
this.inputDataSource.reset();
|
|
2964
|
+
this.walkedDataSources.forEach(function (ds) { return ds.reset(); });
|
|
2965
|
+
this.walkedDataSources = [];
|
|
2966
|
+
this._currPos = 0;
|
|
2967
|
+
this.activeDataSource = null;
|
|
2968
|
+
};
|
|
2969
|
+
FlatMapStreamDataSource.prototype.current = function () {
|
|
2970
|
+
if (!this.activeDataSource) {
|
|
2971
|
+
this.hasNext();
|
|
2972
|
+
}
|
|
2973
|
+
return this.activeDataSource.current();
|
|
2774
2974
|
};
|
|
2775
2975
|
return FlatMapStreamDataSource;
|
|
2776
2976
|
}());
|
|
@@ -3005,13 +3205,14 @@ var Stream = /** @class */ (function () {
|
|
|
3005
3205
|
};
|
|
3006
3206
|
Stream.prototype.each = function (fn) {
|
|
3007
3207
|
this.onElem(fn);
|
|
3208
|
+
this.reset();
|
|
3008
3209
|
};
|
|
3009
3210
|
Stream.prototype.map = function (fn) {
|
|
3010
3211
|
if (!fn) {
|
|
3011
3212
|
fn = function (inval) { return inval; };
|
|
3012
3213
|
}
|
|
3013
3214
|
var res = [];
|
|
3014
|
-
this.each(function (item
|
|
3215
|
+
this.each(function (item) {
|
|
3015
3216
|
res.push(fn(item));
|
|
3016
3217
|
});
|
|
3017
3218
|
return new (Stream.bind.apply(Stream, __spreadArray([void 0], res, false)))();
|
|
@@ -3044,14 +3245,17 @@ var Stream = /** @class */ (function () {
|
|
|
3044
3245
|
for (var cnt = offset; cnt < this.value.length && (this._limits == -1 || cnt < this._limits); cnt++) {
|
|
3045
3246
|
val1 = fn(val1, this.value[cnt]);
|
|
3046
3247
|
}
|
|
3248
|
+
this.reset();
|
|
3047
3249
|
return Monad_1.Optional.fromNullable(val1);
|
|
3048
3250
|
};
|
|
3049
3251
|
Stream.prototype.first = function () {
|
|
3252
|
+
this.reset();
|
|
3050
3253
|
return this.value && this.value.length ? Monad_1.Optional.fromNullable(this.value[0]) : Monad_1.Optional.absent;
|
|
3051
3254
|
};
|
|
3052
3255
|
Stream.prototype.last = function () {
|
|
3053
3256
|
//could be done via reduce, but is faster this way
|
|
3054
3257
|
var length = this._limits > 0 ? Math.min(this._limits, this.value.length) : this.value.length;
|
|
3258
|
+
this.reset();
|
|
3055
3259
|
return Monad_1.Optional.fromNullable(length ? this.value[length - 1] : null);
|
|
3056
3260
|
};
|
|
3057
3261
|
Stream.prototype.anyMatch = function (fn) {
|
|
@@ -3060,6 +3264,7 @@ var Stream = /** @class */ (function () {
|
|
|
3060
3264
|
return true;
|
|
3061
3265
|
}
|
|
3062
3266
|
}
|
|
3267
|
+
this.reset();
|
|
3063
3268
|
return false;
|
|
3064
3269
|
};
|
|
3065
3270
|
Stream.prototype.allMatch = function (fn) {
|
|
@@ -3072,6 +3277,7 @@ var Stream = /** @class */ (function () {
|
|
|
3072
3277
|
matches++;
|
|
3073
3278
|
}
|
|
3074
3279
|
}
|
|
3280
|
+
this.reset();
|
|
3075
3281
|
return matches == this.value.length;
|
|
3076
3282
|
};
|
|
3077
3283
|
Stream.prototype.noneMatch = function (fn) {
|
|
@@ -3081,6 +3287,7 @@ var Stream = /** @class */ (function () {
|
|
|
3081
3287
|
matches++;
|
|
3082
3288
|
}
|
|
3083
3289
|
}
|
|
3290
|
+
this.reset();
|
|
3084
3291
|
return matches == this.value.length;
|
|
3085
3292
|
};
|
|
3086
3293
|
Stream.prototype.sort = function (comparator) {
|
|
@@ -3089,6 +3296,7 @@ var Stream = /** @class */ (function () {
|
|
|
3089
3296
|
};
|
|
3090
3297
|
Stream.prototype.collect = function (collector) {
|
|
3091
3298
|
this.each(function (data) { return collector.collect(data); });
|
|
3299
|
+
this.reset();
|
|
3092
3300
|
return collector.finalValue;
|
|
3093
3301
|
};
|
|
3094
3302
|
//-- internally exposed methods needed for the interconnectivity
|
|
@@ -3104,6 +3312,13 @@ var Stream = /** @class */ (function () {
|
|
|
3104
3312
|
this.pos++;
|
|
3105
3313
|
return this.value[this.pos];
|
|
3106
3314
|
};
|
|
3315
|
+
Stream.prototype.lookAhead = function (cnt) {
|
|
3316
|
+
if (cnt === void 0) { cnt = 1; }
|
|
3317
|
+
if ((this.pos + cnt) >= this.value.length) {
|
|
3318
|
+
return SourcesCollectors_1.ITERATION_STATUS.EO_STRM;
|
|
3319
|
+
}
|
|
3320
|
+
return this.value[this.pos + cnt];
|
|
3321
|
+
};
|
|
3107
3322
|
Stream.prototype[Symbol.iterator] = function () {
|
|
3108
3323
|
var _this = this;
|
|
3109
3324
|
return {
|
|
@@ -3190,9 +3405,16 @@ var LazyStream = /** @class */ (function () {
|
|
|
3190
3405
|
this.pos++;
|
|
3191
3406
|
return next;
|
|
3192
3407
|
};
|
|
3408
|
+
LazyStream.prototype.lookAhead = function (cnt) {
|
|
3409
|
+
if (cnt === void 0) { cnt = 1; }
|
|
3410
|
+
return this.dataSource.lookAhead(cnt);
|
|
3411
|
+
};
|
|
3412
|
+
LazyStream.prototype.current = function () {
|
|
3413
|
+
return this.dataSource.current();
|
|
3414
|
+
};
|
|
3193
3415
|
LazyStream.prototype.reset = function () {
|
|
3194
3416
|
this.dataSource.reset();
|
|
3195
|
-
this.pos =
|
|
3417
|
+
this.pos = -1;
|
|
3196
3418
|
this._limits = -1;
|
|
3197
3419
|
};
|
|
3198
3420
|
/**
|
|
@@ -3228,6 +3450,7 @@ var LazyStream = /** @class */ (function () {
|
|
|
3228
3450
|
var t = this.next();
|
|
3229
3451
|
collector.collect(t);
|
|
3230
3452
|
}
|
|
3453
|
+
this.reset();
|
|
3231
3454
|
return collector.finalValue;
|
|
3232
3455
|
};
|
|
3233
3456
|
LazyStream.prototype.onElem = function (fn) {
|
|
@@ -3255,13 +3478,14 @@ var LazyStream = /** @class */ (function () {
|
|
|
3255
3478
|
this.stop();
|
|
3256
3479
|
}
|
|
3257
3480
|
}
|
|
3481
|
+
this.reset();
|
|
3258
3482
|
};
|
|
3259
3483
|
LazyStream.prototype.reduce = function (fn, startVal) {
|
|
3260
3484
|
if (startVal === void 0) { startVal = null; }
|
|
3261
3485
|
if (!this.hasNext()) {
|
|
3262
3486
|
return Monad_1.Optional.absent;
|
|
3263
3487
|
}
|
|
3264
|
-
var value1
|
|
3488
|
+
var value1;
|
|
3265
3489
|
var value2 = null;
|
|
3266
3490
|
if (startVal != null) {
|
|
3267
3491
|
value1 = startVal;
|
|
@@ -3279,6 +3503,7 @@ var LazyStream = /** @class */ (function () {
|
|
|
3279
3503
|
value2 = this.next();
|
|
3280
3504
|
value1 = fn(value1, value2);
|
|
3281
3505
|
}
|
|
3506
|
+
this.reset();
|
|
3282
3507
|
return Monad_1.Optional.fromNullable(value1);
|
|
3283
3508
|
};
|
|
3284
3509
|
LazyStream.prototype.last = function () {
|
|
@@ -3348,6 +3573,7 @@ var LazyStream = /** @class */ (function () {
|
|
|
3348
3573
|
}*/
|
|
3349
3574
|
LazyStream.prototype.stop = function () {
|
|
3350
3575
|
this.pos = this._limits + 1000000000;
|
|
3576
|
+
this._limits = 0;
|
|
3351
3577
|
};
|
|
3352
3578
|
LazyStream.prototype.isOverLimits = function () {
|
|
3353
3579
|
return this._limits != -1 && this.pos >= this._limits - 1;
|
|
@@ -3549,6 +3775,7 @@ exports.myfaces = exports.jsf = void 0;
|
|
|
3549
3775
|
///<reference types='../../types/typedefs'/>
|
|
3550
3776
|
var AjaxImpl_1 = __webpack_require__(/*! ../impl/AjaxImpl */ "./src/main/typescript/impl/AjaxImpl.ts");
|
|
3551
3777
|
var PushImpl_1 = __webpack_require__(/*! ../impl/PushImpl */ "./src/main/typescript/impl/PushImpl.ts");
|
|
3778
|
+
//declare const Implementation: any;
|
|
3552
3779
|
var jsf;
|
|
3553
3780
|
(function (jsf) {
|
|
3554
3781
|
"use strict";
|
|
@@ -3864,7 +4091,7 @@ var Implementation;
|
|
|
3864
4091
|
/**
|
|
3865
4092
|
* fetches the separator char from the given script tags
|
|
3866
4093
|
*
|
|
3867
|
-
* @return {
|
|
4094
|
+
* @return {string} the separator char for the given script tags
|
|
3868
4095
|
*/
|
|
3869
4096
|
function getSeparatorChar() {
|
|
3870
4097
|
var _a, _b, _c;
|
|
@@ -3911,30 +4138,17 @@ var Implementation;
|
|
|
3911
4138
|
* @param funcs
|
|
3912
4139
|
*/
|
|
3913
4140
|
function chain(source, event) {
|
|
4141
|
+
// we can use our lazy stream each functionality to run our chain here..
|
|
4142
|
+
// by passing a boolean as return value into the onElem call
|
|
4143
|
+
// we can stop early at the first false, just like the spec requests
|
|
3914
4144
|
var funcs = [];
|
|
3915
4145
|
for (var _i = 2; _i < arguments.length; _i++) {
|
|
3916
4146
|
funcs[_i - 2] = arguments[_i];
|
|
3917
4147
|
}
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
return (ret = ret && (func.call(source, event) !== false));
|
|
3923
|
-
}
|
|
3924
|
-
else {
|
|
3925
|
-
//either a function or a string can be passed in case of a string we have to wrap it into another function
|
|
3926
|
-
//it it is not a plain executable code but a definition
|
|
3927
|
-
var sourceCode = trim(func);
|
|
3928
|
-
if (sourceCode.indexOf("function ") == 0) {
|
|
3929
|
-
sourceCode = "return ".concat(sourceCode, " (event)");
|
|
3930
|
-
}
|
|
3931
|
-
return (ret = ret && (new Function("event", sourceCode).call(source, event) !== false));
|
|
3932
|
-
}
|
|
3933
|
-
};
|
|
3934
|
-
//we can use our stream each functionality to run our chain here..
|
|
3935
|
-
//the no return value == false stop stream functionality is handled by our resolveAndExecute
|
|
3936
|
-
mona_dish_1.Stream.of.apply(mona_dish_1.Stream, funcs).each(function (func) { return resolveAndExecute(func); });
|
|
3937
|
-
return ret;
|
|
4148
|
+
return mona_dish_1.LazyStream.of.apply(mona_dish_1.LazyStream, funcs).map(function (func) { return resolveAndExecute(source, event, func); })
|
|
4149
|
+
// we use the return false == stop as an early stop
|
|
4150
|
+
.onElem(function (opResult) { return opResult; })
|
|
4151
|
+
.last().value;
|
|
3938
4152
|
}
|
|
3939
4153
|
Implementation.chain = chain;
|
|
3940
4154
|
/**
|
|
@@ -4353,6 +4567,30 @@ var Implementation;
|
|
|
4353
4567
|
var _a, _b;
|
|
4354
4568
|
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 : {};
|
|
4355
4569
|
}
|
|
4570
|
+
/**
|
|
4571
|
+
* Private helper to execute a function or code fragment
|
|
4572
|
+
* @param source the source of the caller passed into the function as this
|
|
4573
|
+
* @param event an event which needs to be passed down into the function
|
|
4574
|
+
* @param func either a function or code fragment
|
|
4575
|
+
* @return a boolean value, if the passed function returns false, then the
|
|
4576
|
+
* caller is basically notified that the execution can now stop (JSF requirement for chain)
|
|
4577
|
+
* @private
|
|
4578
|
+
*/
|
|
4579
|
+
function resolveAndExecute(source, event, func) {
|
|
4580
|
+
if ("string" != typeof func) {
|
|
4581
|
+
//function is passed down as chain parameter, can be executed as is
|
|
4582
|
+
return func.call(source, event) !== false;
|
|
4583
|
+
}
|
|
4584
|
+
else {
|
|
4585
|
+
//either a function or a string can be passed in case of a string we have to wrap it into another function
|
|
4586
|
+
//it it is not a plain executable code but a definition
|
|
4587
|
+
var sourceCode = trim(func);
|
|
4588
|
+
if (sourceCode.indexOf("function ") == 0) {
|
|
4589
|
+
sourceCode = "return ".concat(sourceCode, " (event)");
|
|
4590
|
+
}
|
|
4591
|
+
return new Function("event", sourceCode).call(source, event) !== false;
|
|
4592
|
+
}
|
|
4593
|
+
}
|
|
4356
4594
|
})(Implementation = exports.Implementation || (exports.Implementation = {}));
|
|
4357
4595
|
|
|
4358
4596
|
|
|
@@ -5163,6 +5401,7 @@ var IS_JSF_SOURCE = function (source) {
|
|
|
5163
5401
|
var IS_INTERNAL_SOURCE = function (source) {
|
|
5164
5402
|
return source.search(/\/jsf[^\.]\.js.*ln\=myfaces.testscripts.*/gi) != -1;
|
|
5165
5403
|
};
|
|
5404
|
+
var ATTR_SRC = 'src';
|
|
5166
5405
|
/**
|
|
5167
5406
|
* Extension which adds implementation specific
|
|
5168
5407
|
* meta data to our dom query
|
|
@@ -5241,8 +5480,8 @@ var ExtDomquery = /** @class */ (function (_super) {
|
|
|
5241
5480
|
var nonceScript = mona_dish_1.DQ
|
|
5242
5481
|
.querySelectorAll("script[src], link[src]")
|
|
5243
5482
|
.lazyStream
|
|
5244
|
-
.filter(function (item) { return item.attr("nonce").value != null && item.attr(
|
|
5245
|
-
.map(function (item) { return IS_JSF_SOURCE(item.attr(
|
|
5483
|
+
.filter(function (item) { return item.attr("nonce").value != null && item.attr(ATTR_SRC) != null; })
|
|
5484
|
+
.map(function (item) { return IS_JSF_SOURCE(item.attr(ATTR_SRC).value); })
|
|
5246
5485
|
.first();
|
|
5247
5486
|
if (nonceScript.isPresent()) {
|
|
5248
5487
|
nonce.value = mona_dish_1.DomQuery.byId(nonceScript.value, true).attr("nonce").value;
|
|
@@ -5263,8 +5502,8 @@ var ExtDomquery = /** @class */ (function (_super) {
|
|
|
5263
5502
|
ExtDomquery.prototype.searchJsfJsFor = function (rexp) {
|
|
5264
5503
|
//perfect application for lazy stream
|
|
5265
5504
|
return mona_dish_1.DQ.querySelectorAll("script[src], link[src]").lazyStream
|
|
5266
|
-
.filter(function (item) { return IS_JSF_SOURCE(item.attr(
|
|
5267
|
-
.map(function (item) { return item.attr(
|
|
5505
|
+
.filter(function (item) { return IS_JSF_SOURCE(item.attr(ATTR_SRC).value); })
|
|
5506
|
+
.map(function (item) { return item.attr(ATTR_SRC).value.match(rexp); })
|
|
5268
5507
|
.filter(function (item) { return item != null && item.length > 1; })
|
|
5269
5508
|
.map(function (result) {
|
|
5270
5509
|
return decodeURIComponent(result[1]);
|
|
@@ -6567,12 +6806,10 @@ var XhrFormData = /** @class */ (function (_super) {
|
|
|
6567
6806
|
* @param dataSource either a form as DomQuery object or an encoded url string
|
|
6568
6807
|
* @param partialIdsArray partial ids to collect, to reduce the data sent down
|
|
6569
6808
|
*/
|
|
6570
|
-
function XhrFormData(dataSource, partialIdsArray
|
|
6571
|
-
if (encode === void 0) { encode = true; }
|
|
6809
|
+
function XhrFormData(dataSource, partialIdsArray) {
|
|
6572
6810
|
var _this = _super.call(this, {}) || this;
|
|
6573
6811
|
_this.dataSource = dataSource;
|
|
6574
6812
|
_this.partialIdsArray = partialIdsArray;
|
|
6575
|
-
_this.encode = encode;
|
|
6576
6813
|
_this.fileInputs = {};
|
|
6577
6814
|
//a call to getViewState before must pass the encoded line
|
|
6578
6815
|
//a call from getViewState passes the form element as datasource
|
|
@@ -6608,7 +6845,7 @@ var XhrFormData = /** @class */ (function (_super) {
|
|
|
6608
6845
|
}
|
|
6609
6846
|
};
|
|
6610
6847
|
var inputExists = function (item) {
|
|
6611
|
-
return
|
|
6848
|
+
return item.isPresent();
|
|
6612
6849
|
};
|
|
6613
6850
|
var applyInput = function (item) {
|
|
6614
6851
|
_this.fileInputs[_this.resolveSubmitIdentifier(item.getAsElem(0).value)] = true;
|
|
@@ -6618,25 +6855,11 @@ var XhrFormData = /** @class */ (function (_super) {
|
|
|
6618
6855
|
.each(applyInput);
|
|
6619
6856
|
};
|
|
6620
6857
|
XhrFormData.prototype.getFileInputs = function (rootElment) {
|
|
6621
|
-
var
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
(((_a = item.attr("type")) === null || _a === void 0 ? void 0 : _a.value) || '').toLowerCase() == "file") {
|
|
6627
|
-
return item;
|
|
6628
|
-
}
|
|
6629
|
-
return rootElment.querySelectorAllDeep("input[type='file']");
|
|
6630
|
-
}
|
|
6631
|
-
return _this.getFileInputs(item);
|
|
6632
|
-
};
|
|
6633
|
-
var itemExists = function (item) {
|
|
6634
|
-
return !!(item === null || item === void 0 ? void 0 : item.length);
|
|
6635
|
-
};
|
|
6636
|
-
var ret = rootElment.lazyStream
|
|
6637
|
-
.map(resolveFileInputs)
|
|
6638
|
-
.filter(itemExists)
|
|
6639
|
-
.collect(new mona_dish_1.DomQueryCollector());
|
|
6858
|
+
var rootFileInputs = rootElment
|
|
6859
|
+
.filter(function (elem) { return elem.matchesSelector("input[type='file']"); });
|
|
6860
|
+
var childFileInputs = rootElment
|
|
6861
|
+
.querySelectorAll("input[type='file']");
|
|
6862
|
+
var ret = rootFileInputs.concat(childFileInputs);
|
|
6640
6863
|
return ret;
|
|
6641
6864
|
};
|
|
6642
6865
|
XhrFormData.prototype.handleFormSource = function () {
|
|
@@ -6669,15 +6892,25 @@ var XhrFormData = /** @class */ (function (_super) {
|
|
|
6669
6892
|
* @param encoded
|
|
6670
6893
|
*/
|
|
6671
6894
|
XhrFormData.prototype.assignEncodedString = function (encoded) {
|
|
6895
|
+
//TODO reevaluate this method
|
|
6672
6896
|
//this code filters out empty strings as key value pairs
|
|
6673
|
-
var keyValueEntries = decodeURIComponent(encoded).split(/&/gi)
|
|
6897
|
+
var keyValueEntries = decodeURIComponent(encoded).split(/&/gi)
|
|
6898
|
+
.filter(function (item) { return !!(item || '')
|
|
6899
|
+
.replace(/\s+/g, ''); });
|
|
6674
6900
|
this.assignString(keyValueEntries);
|
|
6675
6901
|
};
|
|
6676
6902
|
XhrFormData.prototype.assignString = function (keyValueEntries) {
|
|
6677
6903
|
var toMerge = new mona_dish_1.Config({});
|
|
6678
|
-
|
|
6904
|
+
function splitToKeyVal(line) {
|
|
6905
|
+
return line.split(/=(.*)/gi);
|
|
6906
|
+
}
|
|
6907
|
+
function fixKeyWithoutVal(keyVal) {
|
|
6908
|
+
var _a, _b;
|
|
6909
|
+
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;
|
|
6910
|
+
}
|
|
6911
|
+
mona_dish_2.Stream.of.apply(mona_dish_2.Stream, keyValueEntries).map(function (line) { return splitToKeyVal(line); })
|
|
6679
6912
|
//special case of having keys without values
|
|
6680
|
-
.map(function (keyVal) {
|
|
6913
|
+
.map(function (keyVal) { return fixKeyWithoutVal(keyVal); })
|
|
6681
6914
|
.each(function (keyVal) {
|
|
6682
6915
|
var _a, _b;
|
|
6683
6916
|
toMerge.append(keyVal[0]).value = (_b = (_a = keyVal === null || keyVal === void 0 ? void 0 : keyVal.splice(1)) === null || _a === void 0 ? void 0 : _a.join("")) !== null && _b !== void 0 ? _b : "";
|