jsf.js_next_gen 4.0.0-RC.30 → 4.0.0-RC.32
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/faces-development.js +253 -156
- package/dist/window/faces-development.js.br +0 -0
- package/dist/window/faces-development.js.gz +0 -0
- package/dist/window/faces-development.js.map +1 -1
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.br +0 -0
- package/dist/window/faces.js.gz +0 -0
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +253 -156
- package/dist/window/jsf-development.js.br +0 -0
- package/dist/window/jsf-development.js.gz +0 -0
- 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 +4 -4
- package/src/main/typescript/impl/AjaxImpl.ts +1 -1
- package/src/main/typescript/impl/util/FileUtils.ts +93 -0
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +72 -72
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +7 -10
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +1 -1
- package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +3 -2
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +34 -6
- package/target/impl/AjaxImpl.js +2 -2
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/util/FileUtils.js +87 -0
- package/target/impl/util/FileUtils.js.map +1 -0
- package/target/impl/util/URLCodec.js +9 -1
- package/target/impl/util/URLCodec.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +56 -65
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +3 -2
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +1 -1
- package/target/test/xhrCore/FileUploadTest.spec.js +1 -1
- package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +33 -3
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test-classes/jsf-development.js +1 -1
- package/src/main/typescript/impl/util/URLCodec.ts +0 -71
|
@@ -456,7 +456,7 @@ class DomQuery {
|
|
|
456
456
|
.reduce((accumulate, incoming) => accumulate + incoming, 0).value;
|
|
457
457
|
}
|
|
458
458
|
get asNodeArray() {
|
|
459
|
-
return [].concat(Stream_1.Stream.of(this.rootNode).filter(item => item != null).collect(new SourcesCollectors_1.ArrayCollector()));
|
|
459
|
+
return [].concat(Stream_1.Stream.of(...this.rootNode).filter(item => item != null).collect(new SourcesCollectors_1.ArrayCollector()));
|
|
460
460
|
}
|
|
461
461
|
static querySelectorAllDeep(selector) {
|
|
462
462
|
return new DomQuery(document).querySelectorAllDeep(selector);
|
|
@@ -1311,7 +1311,7 @@ class DomQuery {
|
|
|
1311
1311
|
let scriptElements = new DomQuery(this.filterSelector("script"), this.querySelectorAll("script"));
|
|
1312
1312
|
// script execution order by relative pos in their dom tree
|
|
1313
1313
|
scriptElements.stream
|
|
1314
|
-
.flatMap(item => Stream_1.Stream.of(item.values))
|
|
1314
|
+
.flatMap(item => Stream_1.Stream.of(...item.values))
|
|
1315
1315
|
.sort((node1, node2) => node1.compareDocumentPosition(node2) - 3) // preceding 2, following == 4)
|
|
1316
1316
|
.each(item => execScript(item));
|
|
1317
1317
|
evalCollectedScripts(finalScripts);
|
|
@@ -1366,7 +1366,7 @@ class DomQuery {
|
|
|
1366
1366
|
};
|
|
1367
1367
|
const scriptElements = new DomQuery(this.filterSelector("link, style"), this.querySelectorAll("link, style"));
|
|
1368
1368
|
scriptElements.stream
|
|
1369
|
-
.flatMap(item => Stream_1.Stream.of(item.values))
|
|
1369
|
+
.flatMap(item => Stream_1.Stream.of(...item.values))
|
|
1370
1370
|
.sort((node1, node2) => node1.compareDocumentPosition(node2) - 3)
|
|
1371
1371
|
.each(item => execCss(item));
|
|
1372
1372
|
return this;
|
|
@@ -2917,7 +2917,7 @@ exports.Config = Config;
|
|
|
2917
2917
|
* limitations under the License.
|
|
2918
2918
|
*/
|
|
2919
2919
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2920
|
-
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;
|
|
2920
|
+
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.MultiStreamDatasource = exports.ITERATION_STATUS = void 0;
|
|
2921
2921
|
const Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
|
|
2922
2922
|
/**
|
|
2923
2923
|
* special status of the datasource location pointer
|
|
@@ -2935,6 +2935,84 @@ var ITERATION_STATUS;
|
|
|
2935
2935
|
ITERATION_STATUS["EO_STRM"] = "__EO_STRM__";
|
|
2936
2936
|
ITERATION_STATUS["BEF_STRM"] = "___BEF_STRM__";
|
|
2937
2937
|
})(ITERATION_STATUS = exports.ITERATION_STATUS || (exports.ITERATION_STATUS = {}));
|
|
2938
|
+
class MultiStreamDatasource {
|
|
2939
|
+
constructor(first, ...strms) {
|
|
2940
|
+
this.first = first;
|
|
2941
|
+
this.selectedPos = 0;
|
|
2942
|
+
this.strms = [first].concat(...strms);
|
|
2943
|
+
this.activeStrm = this.strms[this.selectedPos];
|
|
2944
|
+
}
|
|
2945
|
+
current() {
|
|
2946
|
+
return this.activeStrm.current();
|
|
2947
|
+
}
|
|
2948
|
+
hasNext() {
|
|
2949
|
+
if (this.activeStrm.hasNext()) {
|
|
2950
|
+
return true;
|
|
2951
|
+
}
|
|
2952
|
+
if (this.selectedPos >= this.strms.length) {
|
|
2953
|
+
return false;
|
|
2954
|
+
}
|
|
2955
|
+
return this.findNextStrm() != -1;
|
|
2956
|
+
}
|
|
2957
|
+
findNextStrm() {
|
|
2958
|
+
let hasNext = false;
|
|
2959
|
+
let cnt = this.selectedPos;
|
|
2960
|
+
while (!hasNext && cnt < this.strms.length) {
|
|
2961
|
+
hasNext = this.strms[cnt].hasNext();
|
|
2962
|
+
if (!hasNext) {
|
|
2963
|
+
cnt++;
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
return hasNext ? cnt : -1;
|
|
2967
|
+
}
|
|
2968
|
+
lookAhead(cnt) {
|
|
2969
|
+
let posPtr = 1;
|
|
2970
|
+
let strmPos = this.selectedPos;
|
|
2971
|
+
let valueFound = null;
|
|
2972
|
+
if (this.strms[strmPos].lookAhead(cnt) != ITERATION_STATUS.EO_STRM) {
|
|
2973
|
+
//speedup
|
|
2974
|
+
return this.strms[strmPos].lookAhead(cnt);
|
|
2975
|
+
}
|
|
2976
|
+
for (let loop = posPtr; loop <= cnt; loop++) {
|
|
2977
|
+
if (!this.strms[strmPos]) {
|
|
2978
|
+
return ITERATION_STATUS.EO_STRM;
|
|
2979
|
+
}
|
|
2980
|
+
let val = (posPtr > 0) ? this.strms[strmPos].lookAhead(posPtr) : this.strms[strmPos].current();
|
|
2981
|
+
valueFound = val;
|
|
2982
|
+
if (val != ITERATION_STATUS.EO_STRM) {
|
|
2983
|
+
posPtr++;
|
|
2984
|
+
}
|
|
2985
|
+
else {
|
|
2986
|
+
if (strmPos >= this.strms.length) {
|
|
2987
|
+
return ITERATION_STATUS.EO_STRM;
|
|
2988
|
+
}
|
|
2989
|
+
strmPos++;
|
|
2990
|
+
posPtr = 1;
|
|
2991
|
+
loop--; //empty iteration
|
|
2992
|
+
}
|
|
2993
|
+
}
|
|
2994
|
+
return valueFound;
|
|
2995
|
+
}
|
|
2996
|
+
next() {
|
|
2997
|
+
if (this.activeStrm.hasNext()) {
|
|
2998
|
+
return this.activeStrm.next();
|
|
2999
|
+
}
|
|
3000
|
+
this.selectedPos = this.findNextStrm();
|
|
3001
|
+
if (this.selectedPos == -1) {
|
|
3002
|
+
return ITERATION_STATUS.EO_STRM;
|
|
3003
|
+
}
|
|
3004
|
+
this.activeStrm = this.strms[this.selectedPos];
|
|
3005
|
+
return this.activeStrm.next();
|
|
3006
|
+
}
|
|
3007
|
+
reset() {
|
|
3008
|
+
this.activeStrm = this.strms[0];
|
|
3009
|
+
this.selectedPos = 0;
|
|
3010
|
+
for (let cnt = 0; cnt < this.strms.length; cnt++) {
|
|
3011
|
+
this.strms[cnt].reset();
|
|
3012
|
+
}
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
exports.MultiStreamDatasource = MultiStreamDatasource;
|
|
2938
3016
|
/**
|
|
2939
3017
|
* defines a sequence of numbers for our stream input
|
|
2940
3018
|
*/
|
|
@@ -3390,6 +3468,15 @@ class Stream {
|
|
|
3390
3468
|
}
|
|
3391
3469
|
return new Stream(...value);
|
|
3392
3470
|
}
|
|
3471
|
+
current() {
|
|
3472
|
+
if (this.pos == -1) {
|
|
3473
|
+
return SourcesCollectors_1.ITERATION_STATUS.BEF_STRM;
|
|
3474
|
+
}
|
|
3475
|
+
if (this.pos >= this.value.length) {
|
|
3476
|
+
return SourcesCollectors_1.ITERATION_STATUS.EO_STRM;
|
|
3477
|
+
}
|
|
3478
|
+
return this.value[this.pos];
|
|
3479
|
+
}
|
|
3393
3480
|
limits(end) {
|
|
3394
3481
|
this._limits = end;
|
|
3395
3482
|
return this;
|
|
@@ -3399,9 +3486,8 @@ class Stream {
|
|
|
3399
3486
|
* @param toAppend
|
|
3400
3487
|
*/
|
|
3401
3488
|
concat(...toAppend) {
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
return Stream.of(this, ...toAppend).flatMap(item => item);
|
|
3489
|
+
let toConcat = [this].concat(toAppend);
|
|
3490
|
+
return Stream.of(...toConcat).flatMap(item => item);
|
|
3405
3491
|
}
|
|
3406
3492
|
onElem(fn) {
|
|
3407
3493
|
for (let cnt = 0; cnt < this.value.length && (this._limits == -1 || cnt < this._limits); cnt++) {
|
|
@@ -3433,7 +3519,7 @@ class Stream {
|
|
|
3433
3519
|
let ret = [];
|
|
3434
3520
|
this.each(item => {
|
|
3435
3521
|
let strmR = fn(item);
|
|
3436
|
-
ret = Array.isArray(strmR) ? ret.concat(strmR) : ret.concat(
|
|
3522
|
+
ret = Array.isArray(strmR) ? ret.concat(strmR) : ret.concat(strmR.value);
|
|
3437
3523
|
});
|
|
3438
3524
|
return Stream.of(...ret);
|
|
3439
3525
|
}
|
|
@@ -3623,7 +3709,8 @@ class LazyStream {
|
|
|
3623
3709
|
concat(...toAppend) {
|
|
3624
3710
|
//this.dataSource = new MultiStreamDatasource<T>(this, ... toAppend);
|
|
3625
3711
|
//return this;
|
|
3626
|
-
return LazyStream.
|
|
3712
|
+
return LazyStream.ofStreamDataSource(new SourcesCollectors_1.MultiStreamDatasource(this, toAppend));
|
|
3713
|
+
//return LazyStream.of(<IStream<T>>this, ...toAppend).flatMap(item => item);
|
|
3627
3714
|
}
|
|
3628
3715
|
nextFilter(fn) {
|
|
3629
3716
|
if (this.hasNext()) {
|
|
@@ -4231,7 +4318,7 @@ const ErrorData_1 = __webpack_require__(/*! ./xhrCore/ErrorData */ "./src/main/t
|
|
|
4231
4318
|
const Lang_1 = __webpack_require__(/*! ./util/Lang */ "./src/main/typescript/impl/util/Lang.ts");
|
|
4232
4319
|
const Const_1 = __webpack_require__(/*! ./core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
4233
4320
|
const RequestDataResolver_1 = __webpack_require__(/*! ./xhrCore/RequestDataResolver */ "./src/main/typescript/impl/xhrCore/RequestDataResolver.ts");
|
|
4234
|
-
const
|
|
4321
|
+
const FileUtils_1 = __webpack_require__(/*! ./util/FileUtils */ "./src/main/typescript/impl/util/FileUtils.ts");
|
|
4235
4322
|
/*
|
|
4236
4323
|
* allowed project stages
|
|
4237
4324
|
*/
|
|
@@ -4663,7 +4750,7 @@ var Implementation;
|
|
|
4663
4750
|
// fetch all non file input form elements
|
|
4664
4751
|
let formElements = element.deepElements.encodeFormElement();
|
|
4665
4752
|
// encode them! (file inputs are handled differently and are not part of the viewstate)
|
|
4666
|
-
return (0,
|
|
4753
|
+
return (0, FileUtils_1.encodeFormData)(formElements, (0, RequestDataResolver_1.resoveNamingContainerMapper)(dummyContext));
|
|
4667
4754
|
}
|
|
4668
4755
|
Implementation.getViewState = getViewState;
|
|
4669
4756
|
/**
|
|
@@ -6062,6 +6149,102 @@ class ExtConfig extends mona_dish_1.Config {
|
|
|
6062
6149
|
exports.ExtConfig = ExtConfig;
|
|
6063
6150
|
|
|
6064
6151
|
|
|
6152
|
+
/***/ }),
|
|
6153
|
+
|
|
6154
|
+
/***/ "./src/main/typescript/impl/util/FileUtils.ts":
|
|
6155
|
+
/*!****************************************************!*\
|
|
6156
|
+
!*** ./src/main/typescript/impl/util/FileUtils.ts ***!
|
|
6157
|
+
\****************************************************/
|
|
6158
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6159
|
+
|
|
6160
|
+
|
|
6161
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6162
|
+
exports.getFormInputsAsStream = exports.fixKeyWithoutVal = exports.resolveFiles = exports.decodeEncodedValues = exports.encodeFormData = void 0;
|
|
6163
|
+
const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
6164
|
+
const ExtDomQuery_1 = __webpack_require__(/*! ./ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
|
|
6165
|
+
const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
6166
|
+
/*
|
|
6167
|
+
* various routines for encoding and decoding url parameters
|
|
6168
|
+
* into configs and vice versa
|
|
6169
|
+
*/
|
|
6170
|
+
/**
|
|
6171
|
+
* encodes a given form data into a url encoded string
|
|
6172
|
+
* @param formData the form data config object
|
|
6173
|
+
* @param paramsMapper the params mapper
|
|
6174
|
+
* @param defaultStr a default string if nothing comes out of it
|
|
6175
|
+
*/
|
|
6176
|
+
function encodeFormData(formData, paramsMapper = (inStr, inVal) => [inStr, inVal], defaultStr = Const_1.EMPTY_STR) {
|
|
6177
|
+
if (formData.isAbsent()) {
|
|
6178
|
+
return defaultStr;
|
|
6179
|
+
}
|
|
6180
|
+
const assocValues = formData.value;
|
|
6181
|
+
const expandValueArrAndRename = key => mona_dish_1.Stream.of(...assocValues[key]).map(val => paramsMapper(key, val));
|
|
6182
|
+
const isPropertyKey = key => assocValues.hasOwnProperty(key);
|
|
6183
|
+
const isNotFile = ([, value]) => !(value instanceof ExtDomQuery_1.ExtDomQuery.global().File);
|
|
6184
|
+
const mapIntoUrlParam = keyVal => `${encodeURIComponent(keyVal[0])}=${encodeURIComponent(keyVal[1])}`;
|
|
6185
|
+
const entries = mona_dish_1.LazyStream.of(...Object.keys(assocValues))
|
|
6186
|
+
.filter(isPropertyKey)
|
|
6187
|
+
.flatMap(expandValueArrAndRename)
|
|
6188
|
+
//we cannot encode file elements that is handled by multipart requests anyway
|
|
6189
|
+
.filter(isNotFile)
|
|
6190
|
+
.map(mapIntoUrlParam)
|
|
6191
|
+
.collect(new mona_dish_1.ArrayCollector());
|
|
6192
|
+
return entries.join("&");
|
|
6193
|
+
}
|
|
6194
|
+
exports.encodeFormData = encodeFormData;
|
|
6195
|
+
/**
|
|
6196
|
+
* splits and decodes encoded values into strings containing of key=value
|
|
6197
|
+
* @param encoded encoded string
|
|
6198
|
+
*/
|
|
6199
|
+
function decodeEncodedValues(encoded) {
|
|
6200
|
+
const filterBlanks = item => !!(item || '').replace(/\s+/g, '');
|
|
6201
|
+
const splitKeyValuePair = line => {
|
|
6202
|
+
let index = line.indexOf("=");
|
|
6203
|
+
if (index == -1) {
|
|
6204
|
+
return [line];
|
|
6205
|
+
}
|
|
6206
|
+
return [line.substring(0, index), line.substring(index + 1)];
|
|
6207
|
+
};
|
|
6208
|
+
let requestParamEntries = decodeURIComponent(encoded).split(/&/gi);
|
|
6209
|
+
return mona_dish_1.Stream.of(...requestParamEntries)
|
|
6210
|
+
.filter(filterBlanks)
|
|
6211
|
+
.map(splitKeyValuePair);
|
|
6212
|
+
}
|
|
6213
|
+
exports.decodeEncodedValues = decodeEncodedValues;
|
|
6214
|
+
function resolveFiles(dataSource) {
|
|
6215
|
+
return dataSource
|
|
6216
|
+
.querySelectorAllDeep("input[type='file']")
|
|
6217
|
+
.stream
|
|
6218
|
+
.map(fileInput => [fileInput.name.value || fileInput.id.value, fileInput.filesFromElem(0)])
|
|
6219
|
+
.flatMap(([key, files]) => {
|
|
6220
|
+
return mona_dish_1.Stream.of(...files).map(file => [key, file]);
|
|
6221
|
+
});
|
|
6222
|
+
}
|
|
6223
|
+
exports.resolveFiles = resolveFiles;
|
|
6224
|
+
function fixKeyWithoutVal(keyVal) {
|
|
6225
|
+
var _a, _b;
|
|
6226
|
+
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;
|
|
6227
|
+
}
|
|
6228
|
+
exports.fixKeyWithoutVal = fixKeyWithoutVal;
|
|
6229
|
+
/**
|
|
6230
|
+
* gets all the inputs under the form parentItem
|
|
6231
|
+
* as stream
|
|
6232
|
+
* @param parentItem
|
|
6233
|
+
*/
|
|
6234
|
+
function getFormInputsAsStream(parentItem) {
|
|
6235
|
+
//encoded String
|
|
6236
|
+
const viewStateStr = (0, Const_1.$faces)().getViewState(parentItem.getAsElem(0).value);
|
|
6237
|
+
// we now need to decode it and then merge it into the target buf
|
|
6238
|
+
// which hosts already our overrides (aka do not override what is already there(
|
|
6239
|
+
// after that we need to deal with form elements on a separate level
|
|
6240
|
+
const standardInputs = decodeEncodedValues(viewStateStr);
|
|
6241
|
+
const fileInputs = resolveFiles(parentItem);
|
|
6242
|
+
const allInputs = standardInputs.concat(fileInputs);
|
|
6243
|
+
return allInputs;
|
|
6244
|
+
}
|
|
6245
|
+
exports.getFormInputsAsStream = getFormInputsAsStream;
|
|
6246
|
+
|
|
6247
|
+
|
|
6065
6248
|
/***/ }),
|
|
6066
6249
|
|
|
6067
6250
|
/***/ "./src/main/typescript/impl/util/HiddenInputBuilder.ts":
|
|
@@ -6365,84 +6548,6 @@ var ExtLang;
|
|
|
6365
6548
|
})(ExtLang = exports.ExtLang || (exports.ExtLang = {}));
|
|
6366
6549
|
|
|
6367
6550
|
|
|
6368
|
-
/***/ }),
|
|
6369
|
-
|
|
6370
|
-
/***/ "./src/main/typescript/impl/util/URLCodec.ts":
|
|
6371
|
-
/*!***************************************************!*\
|
|
6372
|
-
!*** ./src/main/typescript/impl/util/URLCodec.ts ***!
|
|
6373
|
-
\***************************************************/
|
|
6374
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6378
|
-
exports.decodeEncodedValues = exports.encodeFormData = exports.mergeKeyValueEntries = void 0;
|
|
6379
|
-
const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
6380
|
-
const ExtDomQuery_1 = __webpack_require__(/*! ./ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
|
|
6381
|
-
const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
6382
|
-
/*
|
|
6383
|
-
* various routines for encoding and decoding url parameters
|
|
6384
|
-
* into configs and vice versa
|
|
6385
|
-
*/
|
|
6386
|
-
/**
|
|
6387
|
-
* merges a list of key value entries into a target config
|
|
6388
|
-
* @param target the target receiving the key value entries
|
|
6389
|
-
* @param keyValueEntries a list of key value entries divided by =
|
|
6390
|
-
* @param paramsMapper a key value remapper
|
|
6391
|
-
*/
|
|
6392
|
-
function mergeKeyValueEntries(target, keyValueEntries, paramsMapper = (key, value) => [key, value]) {
|
|
6393
|
-
function splitToKeyVal(line) {
|
|
6394
|
-
return line.split(/=(.*)/gi);
|
|
6395
|
-
}
|
|
6396
|
-
function fixKeyWithoutVal(keyVal) {
|
|
6397
|
-
var _a, _b;
|
|
6398
|
-
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;
|
|
6399
|
-
}
|
|
6400
|
-
let toMerge = new ExtDomQuery_1.ExtConfig({});
|
|
6401
|
-
mona_dish_1.Stream.of(...keyValueEntries)
|
|
6402
|
-
.map(line => splitToKeyVal(line))
|
|
6403
|
-
//special case of having keys without values
|
|
6404
|
-
.map(keyVal => fixKeyWithoutVal(keyVal))
|
|
6405
|
-
.map(keyVal => paramsMapper(keyVal[0], keyVal[1]))
|
|
6406
|
-
.each(keyVal => {
|
|
6407
|
-
var _a, _b;
|
|
6408
|
-
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 : "";
|
|
6409
|
-
});
|
|
6410
|
-
target.shallowMerge(toMerge);
|
|
6411
|
-
}
|
|
6412
|
-
exports.mergeKeyValueEntries = mergeKeyValueEntries;
|
|
6413
|
-
/**
|
|
6414
|
-
* encodes a given form data into a url encoded string
|
|
6415
|
-
* @param formData the form data config object
|
|
6416
|
-
* @param paramsMapper the params mapper
|
|
6417
|
-
* @param defaultStr a default string if nothing comes out of it
|
|
6418
|
-
*/
|
|
6419
|
-
function encodeFormData(formData, paramsMapper = (inStr, inVal) => [inStr, inVal], defaultStr = Const_1.EMPTY_STR) {
|
|
6420
|
-
if (formData.isAbsent()) {
|
|
6421
|
-
return defaultStr;
|
|
6422
|
-
}
|
|
6423
|
-
let assocValues = formData.value;
|
|
6424
|
-
let entries = mona_dish_1.LazyStream.of(...Object.keys(assocValues))
|
|
6425
|
-
.filter(key => assocValues.hasOwnProperty(key))
|
|
6426
|
-
.flatMap(key => mona_dish_1.Stream.of(...assocValues[key]).map(val => paramsMapper(key, val)))
|
|
6427
|
-
//we cannot encode file elements that is handled by multipart requests anyway
|
|
6428
|
-
.filter(([, value]) => !(value instanceof ExtDomQuery_1.ExtDomQuery.global().File))
|
|
6429
|
-
.map(keyVal => `${encodeURIComponent(keyVal[0])}=${encodeURIComponent(keyVal[1])}`)
|
|
6430
|
-
.collect(new mona_dish_1.ArrayCollector());
|
|
6431
|
-
return entries.join("&");
|
|
6432
|
-
}
|
|
6433
|
-
exports.encodeFormData = encodeFormData;
|
|
6434
|
-
/**
|
|
6435
|
-
* splits and decodes encoded values into strings containing of key=value
|
|
6436
|
-
* @param encoded
|
|
6437
|
-
*/
|
|
6438
|
-
function decodeEncodedValues(encoded) {
|
|
6439
|
-
return decodeURIComponent(encoded).split(/&/gi)
|
|
6440
|
-
.filter(item => !!(item || '')
|
|
6441
|
-
.replace(/\s+/g, ''));
|
|
6442
|
-
}
|
|
6443
|
-
exports.decodeEncodedValues = decodeEncodedValues;
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
6551
|
/***/ }),
|
|
6447
6552
|
|
|
6448
6553
|
/***/ "./src/main/typescript/impl/xhrCore/ErrorData.ts":
|
|
@@ -7595,8 +7700,7 @@ exports.XhrFormData = void 0;
|
|
|
7595
7700
|
*/
|
|
7596
7701
|
const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
7597
7702
|
const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
7598
|
-
const
|
|
7599
|
-
const URLCodec_1 = __webpack_require__(/*! ../util/URLCodec */ "./src/main/typescript/impl/util/URLCodec.ts");
|
|
7703
|
+
const FileUtils_1 = __webpack_require__(/*! ../util/FileUtils */ "./src/main/typescript/impl/util/FileUtils.ts");
|
|
7600
7704
|
const defaultParamsMapper = (key, item) => [key, item];
|
|
7601
7705
|
/**
|
|
7602
7706
|
* A unified form data class
|
|
@@ -7606,9 +7710,10 @@ const defaultParamsMapper = (key, item) => [key, item];
|
|
|
7606
7710
|
* due to api constraints on the HTML Form object in IE11
|
|
7607
7711
|
* and due to the url encoding constraint given by the faces.js spec
|
|
7608
7712
|
*
|
|
7609
|
-
*
|
|
7610
|
-
*
|
|
7611
|
-
*
|
|
7713
|
+
*
|
|
7714
|
+
* internal storage format
|
|
7715
|
+
* every value is stored as an array
|
|
7716
|
+
* even scalar ones!
|
|
7612
7717
|
*/
|
|
7613
7718
|
class XhrFormData extends mona_dish_1.Config {
|
|
7614
7719
|
/**
|
|
@@ -7639,39 +7744,60 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7639
7744
|
* Additionally the hidden element jakarta.faces.ViewState
|
|
7640
7745
|
* Enhancement partial page submit
|
|
7641
7746
|
*/
|
|
7642
|
-
this.
|
|
7747
|
+
this.resolveRequestType(this.dataSource, executes);
|
|
7748
|
+
this.encodeSubmittableFields(this.dataSource, this.partialIds);
|
|
7643
7749
|
this.applyViewState(this.dataSource);
|
|
7644
|
-
|
|
7750
|
+
}
|
|
7751
|
+
/**
|
|
7752
|
+
* @returns a Form data representation, this is needed for file submits
|
|
7753
|
+
*/
|
|
7754
|
+
toFormData() {
|
|
7755
|
+
/*
|
|
7756
|
+
* expands key: [item1, item2]
|
|
7757
|
+
* to: [{key: item1}, {key, item2}]
|
|
7758
|
+
*/
|
|
7759
|
+
let expandAssocArray = ([key, item]) => mona_dish_1.Stream.of(...item).map(item => {
|
|
7760
|
+
return { key, item };
|
|
7761
|
+
});
|
|
7762
|
+
/*
|
|
7763
|
+
* remaps the incoming {key, value} tuples
|
|
7764
|
+
* to naming container prefixed keys and values
|
|
7765
|
+
*/
|
|
7766
|
+
let remapForNamingContainer = ({ key, item }) => {
|
|
7767
|
+
key = this.remapKeyForNamingContainer(key);
|
|
7768
|
+
return { key, item };
|
|
7769
|
+
};
|
|
7770
|
+
/*
|
|
7771
|
+
* collects everything into a FormData object
|
|
7772
|
+
*/
|
|
7773
|
+
let ret = new FormData();
|
|
7774
|
+
let collectFormData = ({ key, item }) => {
|
|
7775
|
+
ret.append(key, item);
|
|
7776
|
+
};
|
|
7777
|
+
mona_dish_1.Stream.ofAssoc(this.value)
|
|
7778
|
+
.flatMap(expandAssocArray)
|
|
7779
|
+
.map(remapForNamingContainer)
|
|
7780
|
+
.each(collectFormData);
|
|
7781
|
+
return ret;
|
|
7782
|
+
}
|
|
7783
|
+
/**
|
|
7784
|
+
* returns an encoded string representation of our xhr form data
|
|
7785
|
+
*
|
|
7786
|
+
* @param defaultStr optional default value if nothing is there to encode
|
|
7787
|
+
*/
|
|
7788
|
+
toString(defaultStr = Const_1.EMPTY_STR) {
|
|
7789
|
+
return (0, FileUtils_1.encodeFormData)(this, this.paramsMapper, defaultStr);
|
|
7645
7790
|
}
|
|
7646
7791
|
/**
|
|
7647
7792
|
* generic post init code, for now, this performs some post assign data post-processing
|
|
7648
7793
|
* @param executes the executable dom nodes which need to be processed into the form data, which we can send
|
|
7649
7794
|
* in our ajax request
|
|
7650
7795
|
*/
|
|
7651
|
-
resolveRequestType(executes) {
|
|
7652
|
-
if (!executes) {
|
|
7796
|
+
resolveRequestType(rootElement, executes) {
|
|
7797
|
+
if (!executes || executes.indexOf(Const_1.IDENT_NONE) != -1) {
|
|
7653
7798
|
return;
|
|
7654
7799
|
}
|
|
7655
|
-
|
|
7656
|
-
if (id == Const_1.IDENT_ALL) {
|
|
7657
|
-
let namingContainer = this.remapKeyForNamingContainer("");
|
|
7658
|
-
if (namingContainer.length) {
|
|
7659
|
-
namingContainer = namingContainer.substring(0, namingContainer.length - 1);
|
|
7660
|
-
return mona_dish_1.DQ.byId(namingContainer).isMultipartCandidate();
|
|
7661
|
-
}
|
|
7662
|
-
return mona_dish_1.DQ.byId(document.body).isMultipartCandidate();
|
|
7663
|
-
}
|
|
7664
|
-
else if (id == Const_1.IDENT_FORM) {
|
|
7665
|
-
return this.dataSource.isMultipartCandidate(true);
|
|
7666
|
-
}
|
|
7667
|
-
else {
|
|
7668
|
-
const element = mona_dish_1.DQ.byId(id, true);
|
|
7669
|
-
return element.isMultipartCandidate();
|
|
7670
|
-
}
|
|
7671
|
-
};
|
|
7672
|
-
this.isMultipartRequest = mona_dish_1.LazyStream.of(...executes)
|
|
7673
|
-
.filter(isMultiPartContainer)
|
|
7674
|
-
.first().isPresent();
|
|
7800
|
+
this.isMultipartRequest = rootElement.isMultipartCandidate(true);
|
|
7675
7801
|
}
|
|
7676
7802
|
/**
|
|
7677
7803
|
* special case view state handling
|
|
@@ -7686,52 +7812,22 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7686
7812
|
let viewState = viewStateElement.inputValue;
|
|
7687
7813
|
this.appendIf(viewState.isPresent(), this.remapKeyForNamingContainer(viewStateElement.name.value)).value = viewState.value;
|
|
7688
7814
|
}
|
|
7689
|
-
/**
|
|
7690
|
-
* @returns a Form data representation, this is needed for file submits
|
|
7691
|
-
*/
|
|
7692
|
-
toFormData() {
|
|
7693
|
-
let ret = new FormData();
|
|
7694
|
-
this.appendInputs(ret);
|
|
7695
|
-
return ret;
|
|
7696
|
-
}
|
|
7697
|
-
/**
|
|
7698
|
-
* returns an encoded string representation of our xhr form data
|
|
7699
|
-
*
|
|
7700
|
-
* @param defaultStr optional default value if nothing is there to encode
|
|
7701
|
-
*/
|
|
7702
|
-
toString(defaultStr = Const_1.EMPTY_STR) {
|
|
7703
|
-
return (0, URLCodec_1.encodeFormData)(this, this.paramsMapper, defaultStr);
|
|
7704
|
-
}
|
|
7705
7815
|
/**
|
|
7706
7816
|
* determines fields to submit
|
|
7707
7817
|
* @param {Object} targetBuf - the target form buffer receiving the data
|
|
7708
7818
|
* @param {Node} parentItem - form element item is nested in
|
|
7709
7819
|
* @param {Array} partialIds - ids fo PPS
|
|
7710
7820
|
*/
|
|
7711
|
-
encodeSubmittableFields(
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
let target = new ExtDomQuery_1.ExtConfig({});
|
|
7718
|
-
(0, URLCodec_1.mergeKeyValueEntries)(target, (0, URLCodec_1.decodeEncodedValues)(viewStateStr), this.paramsMapper);
|
|
7719
|
-
this.shallowMerge(target);
|
|
7821
|
+
encodeSubmittableFields(parentItem, partialIds) {
|
|
7822
|
+
const formInputs = (0, FileUtils_1.getFormInputsAsStream)(parentItem);
|
|
7823
|
+
formInputs
|
|
7824
|
+
.map(FileUtils_1.fixKeyWithoutVal)
|
|
7825
|
+
.map(([key, value]) => this.paramsMapper(key, value))
|
|
7826
|
+
.each(([key, value]) => this.append(key).value = value);
|
|
7720
7827
|
}
|
|
7721
7828
|
remapKeyForNamingContainer(key) {
|
|
7722
7829
|
return this.paramsMapper(key, "")[0];
|
|
7723
7830
|
}
|
|
7724
|
-
appendInputs(ret) {
|
|
7725
|
-
mona_dish_1.Stream.ofAssoc(this.value)
|
|
7726
|
-
.flatMap(([key, item]) => mona_dish_1.Stream.of(...item).map(item => {
|
|
7727
|
-
return { key, item };
|
|
7728
|
-
}))
|
|
7729
|
-
.map(({ key, item }) => {
|
|
7730
|
-
key = this.remapKeyForNamingContainer(key);
|
|
7731
|
-
return { key, item };
|
|
7732
|
-
})
|
|
7733
|
-
.each(({ key, item }) => ret.append(key, item));
|
|
7734
|
-
}
|
|
7735
7831
|
}
|
|
7736
7832
|
exports.XhrFormData = XhrFormData;
|
|
7737
7833
|
|
|
@@ -7779,6 +7875,7 @@ var failSaveExecute = Lang_1.ExtLang.failSaveExecute;
|
|
|
7779
7875
|
* a single ajax request into our queue
|
|
7780
7876
|
* and let the queue do the processing.
|
|
7781
7877
|
*
|
|
7878
|
+
*
|
|
7782
7879
|
*/
|
|
7783
7880
|
class XhrRequest {
|
|
7784
7881
|
/**
|
|
@@ -7826,7 +7923,7 @@ class XhrRequest {
|
|
|
7826
7923
|
let ignoreErr = failSaveExecute;
|
|
7827
7924
|
let xhrObject = this.xhrObject;
|
|
7828
7925
|
let executesArr = () => {
|
|
7829
|
-
return this.requestContext.getIf(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_EXECUTE).get(
|
|
7926
|
+
return this.requestContext.getIf(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_EXECUTE).get(Const_1.IDENT_NONE).value.split(/\s+/gi);
|
|
7830
7927
|
};
|
|
7831
7928
|
try {
|
|
7832
7929
|
// encoded we need to decode
|
|
@@ -7837,7 +7934,7 @@ class XhrRequest {
|
|
|
7837
7934
|
// whatever the formData object delivers
|
|
7838
7935
|
// the partialIdsArray arr is almost deprecated legacy code where we allowed to send a separate list of partial
|
|
7839
7936
|
// ids for reduced load and server processing, this will be removed soon, we can handle the same via execute
|
|
7840
|
-
// anyway TODO
|
|
7937
|
+
// anyway TODO reimplement the partial ids array, we still do not have it in jsf the way we need it
|
|
7841
7938
|
let formData = new XhrFormData_1.XhrFormData(this.sourceForm, (0, RequestDataResolver_1.resoveNamingContainerMapper)(this.internalContext), executesArr(), this.partialIdsArray);
|
|
7842
7939
|
this.contentType = formData.isMultipartRequest ? "undefined" : this.contentType;
|
|
7843
7940
|
// next step the pass through parameters are merged in for post params
|
|
Binary file
|
|
Binary file
|