jsf.js_next_gen 4.0.0-RC.29 → 4.0.0-RC.30
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 +132 -155
- 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 +132 -155
- 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 +1 -1
- package/src/main/typescript/impl/AjaxImpl.ts +6 -2
- package/src/main/typescript/impl/util/URLCodec.ts +71 -0
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +1 -1
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +52 -165
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +4 -8
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +12 -6
- package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +67 -50
- package/src/test/resources/jsf-development.js +1 -1
- package/target/impl/AjaxImpl.js +6 -3
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/util/URLCodec.js +69 -0
- package/target/impl/util/URLCodec.js.map +1 -0
- package/target/impl/xhrCore/RequestDataResolver.js +1 -1
- package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +44 -148
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +3 -3
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +10 -5
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/XhrFormDataTest.spec.js +56 -34
- package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
|
@@ -4226,12 +4226,12 @@ const XhrRequest_1 = __webpack_require__(/*! ./xhrCore/XhrRequest */ "./src/main
|
|
|
4226
4226
|
const AsyncQueue_1 = __webpack_require__(/*! ./util/AsyncQueue */ "./src/main/typescript/impl/util/AsyncQueue.ts");
|
|
4227
4227
|
const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
4228
4228
|
const Assertions_1 = __webpack_require__(/*! ./util/Assertions */ "./src/main/typescript/impl/util/Assertions.ts");
|
|
4229
|
-
const XhrFormData_1 = __webpack_require__(/*! ./xhrCore/XhrFormData */ "./src/main/typescript/impl/xhrCore/XhrFormData.ts");
|
|
4230
4229
|
const ExtDomQuery_1 = __webpack_require__(/*! ./util/ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
|
|
4231
4230
|
const ErrorData_1 = __webpack_require__(/*! ./xhrCore/ErrorData */ "./src/main/typescript/impl/xhrCore/ErrorData.ts");
|
|
4232
4231
|
const Lang_1 = __webpack_require__(/*! ./util/Lang */ "./src/main/typescript/impl/util/Lang.ts");
|
|
4233
4232
|
const Const_1 = __webpack_require__(/*! ./core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
4234
4233
|
const RequestDataResolver_1 = __webpack_require__(/*! ./xhrCore/RequestDataResolver */ "./src/main/typescript/impl/xhrCore/RequestDataResolver.ts");
|
|
4234
|
+
const URLCodec_1 = __webpack_require__(/*! ./util/URLCodec */ "./src/main/typescript/impl/util/URLCodec.ts");
|
|
4235
4235
|
/*
|
|
4236
4236
|
* allowed project stages
|
|
4237
4237
|
*/
|
|
@@ -4657,10 +4657,13 @@ var Implementation;
|
|
|
4657
4657
|
if (!element.isTag(Const_1.HTML_TAG_FORM)) {
|
|
4658
4658
|
throw new Error(getMessage("ERR_VIEWSTATE"));
|
|
4659
4659
|
}
|
|
4660
|
+
// determine the naming container scenario
|
|
4660
4661
|
const dummyContext = new mona_dish_1.Config({});
|
|
4661
4662
|
assignNamingContainerData(dummyContext, mona_dish_1.DQ.byId(form));
|
|
4662
|
-
|
|
4663
|
-
|
|
4663
|
+
// fetch all non file input form elements
|
|
4664
|
+
let formElements = element.deepElements.encodeFormElement();
|
|
4665
|
+
// encode them! (file inputs are handled differently and are not part of the viewstate)
|
|
4666
|
+
return (0, URLCodec_1.encodeFormData)(formElements, (0, RequestDataResolver_1.resoveNamingContainerMapper)(dummyContext));
|
|
4664
4667
|
}
|
|
4665
4668
|
Implementation.getViewState = getViewState;
|
|
4666
4669
|
/**
|
|
@@ -6362,6 +6365,84 @@ var ExtLang;
|
|
|
6362
6365
|
})(ExtLang = exports.ExtLang || (exports.ExtLang = {}));
|
|
6363
6366
|
|
|
6364
6367
|
|
|
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
|
+
|
|
6365
6446
|
/***/ }),
|
|
6366
6447
|
|
|
6367
6448
|
/***/ "./src/main/typescript/impl/xhrCore/ErrorData.ts":
|
|
@@ -6609,7 +6690,7 @@ exports.resolveViewRootId = resolveViewRootId;
|
|
|
6609
6690
|
function resoveNamingContainerMapper(internalContext) {
|
|
6610
6691
|
const isNamedViewRoot = internalContext.getIf(Const_1.NAMED_VIEWROOT).isPresent();
|
|
6611
6692
|
if (!isNamedViewRoot) {
|
|
6612
|
-
return;
|
|
6693
|
+
return (key, value) => [key, value];
|
|
6613
6694
|
}
|
|
6614
6695
|
const partialId = internalContext.getIf(Const_1.NAMING_CONTAINER_ID).value;
|
|
6615
6696
|
const SEP = (0, Const_1.$faces)().separatorchar;
|
|
@@ -7514,8 +7595,8 @@ exports.XhrFormData = void 0;
|
|
|
7514
7595
|
*/
|
|
7515
7596
|
const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
7516
7597
|
const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
7517
|
-
var isString = mona_dish_1.Lang.isString;
|
|
7518
7598
|
const ExtDomQuery_1 = __webpack_require__(/*! ../util/ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
|
|
7599
|
+
const URLCodec_1 = __webpack_require__(/*! ../util/URLCodec */ "./src/main/typescript/impl/util/URLCodec.ts");
|
|
7519
7600
|
const defaultParamsMapper = (key, item) => [key, item];
|
|
7520
7601
|
/**
|
|
7521
7602
|
* A unified form data class
|
|
@@ -7534,11 +7615,11 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7534
7615
|
* data collector from a given form
|
|
7535
7616
|
*
|
|
7536
7617
|
* @param dataSource either a form as DomQuery object or an encoded url string
|
|
7537
|
-
* @param
|
|
7618
|
+
* @param paramsMapper a remapper for the params keys and values
|
|
7538
7619
|
* @param executes the executes id list for the elements to being processed
|
|
7539
7620
|
* @param partialIds partial ids to collect, to reduce the data sent down
|
|
7540
7621
|
*/
|
|
7541
|
-
constructor(dataSource, paramsMapper = defaultParamsMapper,
|
|
7622
|
+
constructor(dataSource, paramsMapper = defaultParamsMapper, executes, partialIds) {
|
|
7542
7623
|
super({});
|
|
7543
7624
|
this.dataSource = dataSource;
|
|
7544
7625
|
this.paramsMapper = paramsMapper;
|
|
@@ -7551,54 +7632,45 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7551
7632
|
* instead of an encoded string files cannot be sent that way
|
|
7552
7633
|
*/
|
|
7553
7634
|
this.isMultipartRequest = false;
|
|
7554
|
-
//
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
else {
|
|
7565
|
-
this.applyFormDataToConfig();
|
|
7566
|
-
}
|
|
7567
|
-
//now assign the external viewstate overrides
|
|
7568
|
-
if ('undefined' != typeof viewState) {
|
|
7569
|
-
this.assignEncodedString(viewState);
|
|
7570
|
-
}
|
|
7571
|
-
if (executes) {
|
|
7572
|
-
this.postInit(...executes);
|
|
7573
|
-
}
|
|
7635
|
+
//encode and append the issuing item if not a partial ids array of ids is passed
|
|
7636
|
+
/*
|
|
7637
|
+
* Spec. 13.3.1
|
|
7638
|
+
* Collect and encode input elements.
|
|
7639
|
+
* Additionally the hidden element jakarta.faces.ViewState
|
|
7640
|
+
* Enhancement partial page submit
|
|
7641
|
+
*/
|
|
7642
|
+
this.encodeSubmittableFields(this, this.dataSource, this.partialIds);
|
|
7643
|
+
this.applyViewState(this.dataSource);
|
|
7644
|
+
this.resolveRequestType(executes);
|
|
7574
7645
|
}
|
|
7575
7646
|
/**
|
|
7576
7647
|
* generic post init code, for now, this performs some post assign data post-processing
|
|
7577
7648
|
* @param executes the executable dom nodes which need to be processed into the form data, which we can send
|
|
7578
7649
|
* in our ajax request
|
|
7579
7650
|
*/
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7651
|
+
resolveRequestType(executes) {
|
|
7652
|
+
if (!executes) {
|
|
7653
|
+
return;
|
|
7654
|
+
}
|
|
7655
|
+
let isMultiPartContainer = (id) => {
|
|
7583
7656
|
if (id == Const_1.IDENT_ALL) {
|
|
7584
|
-
|
|
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();
|
|
7585
7663
|
}
|
|
7586
7664
|
else if (id == Const_1.IDENT_FORM) {
|
|
7587
|
-
return this.dataSource.
|
|
7588
|
-
this.dataSource :
|
|
7589
|
-
this.dataSource.querySelectorAllDeep(INPUT_FILE);
|
|
7665
|
+
return this.dataSource.isMultipartCandidate(true);
|
|
7590
7666
|
}
|
|
7591
7667
|
else {
|
|
7592
|
-
|
|
7593
|
-
return element.
|
|
7668
|
+
const element = mona_dish_1.DQ.byId(id, true);
|
|
7669
|
+
return element.isMultipartCandidate();
|
|
7594
7670
|
}
|
|
7595
7671
|
};
|
|
7596
|
-
let inputExists = (item) => {
|
|
7597
|
-
return item.isPresent();
|
|
7598
|
-
};
|
|
7599
7672
|
this.isMultipartRequest = mona_dish_1.LazyStream.of(...executes)
|
|
7600
|
-
.
|
|
7601
|
-
.filter(inputExists)
|
|
7673
|
+
.filter(isMultiPartContainer)
|
|
7602
7674
|
.first().isPresent();
|
|
7603
7675
|
}
|
|
7604
7676
|
/**
|
|
@@ -7607,50 +7679,14 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7607
7679
|
* @param form the form holding the view state value
|
|
7608
7680
|
*/
|
|
7609
7681
|
applyViewState(form) {
|
|
7682
|
+
if (this.getIf((0, Const_1.$nsp)(Const_1.P_VIEWSTATE)).isPresent()) {
|
|
7683
|
+
return;
|
|
7684
|
+
}
|
|
7610
7685
|
let viewStateElement = form.querySelectorAllDeep(`[name*='${(0, Const_1.$nsp)(Const_1.P_VIEWSTATE)}'`);
|
|
7611
7686
|
let viewState = viewStateElement.inputValue;
|
|
7612
|
-
// this.appendIf(viewState.isPresent(), P_VIEWSTATE).value = viewState.value;
|
|
7613
7687
|
this.appendIf(viewState.isPresent(), this.remapKeyForNamingContainer(viewStateElement.name.value)).value = viewState.value;
|
|
7614
7688
|
}
|
|
7615
7689
|
/**
|
|
7616
|
-
* assigns an url encoded string to this xhrFormData object
|
|
7617
|
-
* as key value entry
|
|
7618
|
-
* @param encoded
|
|
7619
|
-
*/
|
|
7620
|
-
assignEncodedString(encoded) {
|
|
7621
|
-
// this code filters out empty strings as key value pairs
|
|
7622
|
-
let keyValueEntries = decodeURIComponent(encoded).split(/&/gi)
|
|
7623
|
-
.filter(item => !!(item || '')
|
|
7624
|
-
.replace(/\s+/g, ''));
|
|
7625
|
-
this.assignString(keyValueEntries);
|
|
7626
|
-
}
|
|
7627
|
-
/**
|
|
7628
|
-
* assign a set of key value pairs passed as array ['key=val1', 'key2=val2']
|
|
7629
|
-
* @param keyValueEntries
|
|
7630
|
-
*/
|
|
7631
|
-
assignString(keyValueEntries) {
|
|
7632
|
-
let toMerge = new ExtDomQuery_1.ExtConfig({});
|
|
7633
|
-
function splitToKeyVal(line) {
|
|
7634
|
-
return line.split(/=(.*)/gi);
|
|
7635
|
-
}
|
|
7636
|
-
function fixKeyWithoutVal(keyVal) {
|
|
7637
|
-
var _a, _b;
|
|
7638
|
-
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;
|
|
7639
|
-
}
|
|
7640
|
-
mona_dish_1.Stream.of(...keyValueEntries)
|
|
7641
|
-
.map(line => splitToKeyVal(line))
|
|
7642
|
-
//special case of having keys without values
|
|
7643
|
-
.map(keyVal => fixKeyWithoutVal(keyVal))
|
|
7644
|
-
.map(keyVal => this.paramsMapper(keyVal[0], keyVal[1]))
|
|
7645
|
-
.each(keyVal => {
|
|
7646
|
-
var _a, _b;
|
|
7647
|
-
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 : "";
|
|
7648
|
-
});
|
|
7649
|
-
//merge with overwrite but no append! (aka no double entries are allowed)
|
|
7650
|
-
this.shallowMerge(toMerge);
|
|
7651
|
-
}
|
|
7652
|
-
/**
|
|
7653
|
-
* @param paramsMapper ... pre encode the params if needed, default is to map them 1:1
|
|
7654
7690
|
* @returns a Form data representation, this is needed for file submits
|
|
7655
7691
|
*/
|
|
7656
7692
|
toFormData() {
|
|
@@ -7658,60 +7694,13 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7658
7694
|
this.appendInputs(ret);
|
|
7659
7695
|
return ret;
|
|
7660
7696
|
}
|
|
7661
|
-
resolveSubmitIdentifier(elem) {
|
|
7662
|
-
var _a;
|
|
7663
|
-
let identifier = elem.name;
|
|
7664
|
-
identifier = (((_a = elem === null || elem === void 0 ? void 0 : elem.name) !== null && _a !== void 0 ? _a : "").replace(/s+/gi, "") == "") ? elem.id : identifier;
|
|
7665
|
-
return identifier;
|
|
7666
|
-
}
|
|
7667
7697
|
/**
|
|
7668
7698
|
* returns an encoded string representation of our xhr form data
|
|
7669
7699
|
*
|
|
7670
7700
|
* @param defaultStr optional default value if nothing is there to encode
|
|
7671
7701
|
*/
|
|
7672
7702
|
toString(defaultStr = Const_1.EMPTY_STR) {
|
|
7673
|
-
|
|
7674
|
-
return defaultStr;
|
|
7675
|
-
}
|
|
7676
|
-
let entries = mona_dish_1.LazyStream.of(...Object.keys(this.value))
|
|
7677
|
-
.filter(key => this.value.hasOwnProperty(key))
|
|
7678
|
-
.flatMap(key => mona_dish_1.Stream.of(...this.value[key]).map(val => this.paramsMapper(key, val)))
|
|
7679
|
-
//we cannot encode file elements that is handled by multipart requests anyway
|
|
7680
|
-
.filter(([, value]) => !(value instanceof ExtDomQuery_1.ExtDomQuery.global().File))
|
|
7681
|
-
.map(keyVal => `${encodeURIComponent(keyVal[0])}=${encodeURIComponent(keyVal[1])}`)
|
|
7682
|
-
.collect(new mona_dish_1.ArrayCollector());
|
|
7683
|
-
return entries.join("&");
|
|
7684
|
-
}
|
|
7685
|
-
/**
|
|
7686
|
-
* helper to fetch all file inputs from as given root element
|
|
7687
|
-
* @param rootElement
|
|
7688
|
-
* @private
|
|
7689
|
-
*/
|
|
7690
|
-
getFileInputs(rootElement) {
|
|
7691
|
-
const rootFileInputs = rootElement
|
|
7692
|
-
.filter(elem => elem.matchesSelector("input[type='file']"));
|
|
7693
|
-
const childFileInputs = rootElement
|
|
7694
|
-
.querySelectorAll("input[type='file']");
|
|
7695
|
-
return rootFileInputs.concat(childFileInputs);
|
|
7696
|
-
}
|
|
7697
|
-
/**
|
|
7698
|
-
* encode the given fields and apply the view state
|
|
7699
|
-
* @private
|
|
7700
|
-
*/
|
|
7701
|
-
applyFormDataToConfig() {
|
|
7702
|
-
//encode and append the issuing item if not a partial ids array of ids is passed
|
|
7703
|
-
/*
|
|
7704
|
-
* Spec. 13.3.1
|
|
7705
|
-
* Collect and encode input elements.
|
|
7706
|
-
* Additionally the hidden element jakarta.faces.ViewState
|
|
7707
|
-
* Enhancement partial page submit
|
|
7708
|
-
*
|
|
7709
|
-
*/
|
|
7710
|
-
this.encodeSubmittableFields(this, this.dataSource, this.partialIds);
|
|
7711
|
-
if (this.getIf((0, Const_1.$nsp)(Const_1.P_VIEWSTATE)).isPresent()) {
|
|
7712
|
-
return;
|
|
7713
|
-
}
|
|
7714
|
-
this.applyViewState(this.dataSource);
|
|
7703
|
+
return (0, URLCodec_1.encodeFormData)(this, this.paramsMapper, defaultStr);
|
|
7715
7704
|
}
|
|
7716
7705
|
/**
|
|
7717
7706
|
* determines fields to submit
|
|
@@ -7720,30 +7709,14 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7720
7709
|
* @param {Array} partialIds - ids fo PPS
|
|
7721
7710
|
*/
|
|
7722
7711
|
encodeSubmittableFields(targetBuf, parentItem, partialIds) {
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
if (parentItem.isAbsent())
|
|
7732
|
-
throw 'NO_PAR_ITEM';
|
|
7733
|
-
toEncode = parentItem;
|
|
7734
|
-
}
|
|
7735
|
-
//lets encode the form elements
|
|
7736
|
-
let formElements = toEncode.deepElements.encodeFormElement();
|
|
7737
|
-
const mapped = this.remapKeysForNamingCoontainer(formElements);
|
|
7738
|
-
this.shallowMerge(mapped);
|
|
7739
|
-
}
|
|
7740
|
-
remapKeysForNamingCoontainer(formElements) {
|
|
7741
|
-
let ret = new mona_dish_1.Config({});
|
|
7742
|
-
formElements.stream.map(([key, item]) => this.paramsMapper(key, item))
|
|
7743
|
-
.each(([key, item]) => {
|
|
7744
|
-
ret.assign(key).value = item;
|
|
7745
|
-
});
|
|
7746
|
-
return ret;
|
|
7712
|
+
//encoded String
|
|
7713
|
+
let viewStateStr = (0, Const_1.$faces)().getViewState(parentItem.getAsElem(0).value);
|
|
7714
|
+
// we now need to decode it and then merge it into the target buf
|
|
7715
|
+
// which hosts already our overrides (aka do not override what is already there(
|
|
7716
|
+
// after that we need to deal with form elements on a separate level
|
|
7717
|
+
let target = new ExtDomQuery_1.ExtConfig({});
|
|
7718
|
+
(0, URLCodec_1.mergeKeyValueEntries)(target, (0, URLCodec_1.decodeEncodedValues)(viewStateStr), this.paramsMapper);
|
|
7719
|
+
this.shallowMerge(target);
|
|
7747
7720
|
}
|
|
7748
7721
|
remapKeyForNamingContainer(key) {
|
|
7749
7722
|
return this.paramsMapper(key, "")[0];
|
|
@@ -7753,6 +7726,10 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7753
7726
|
.flatMap(([key, item]) => mona_dish_1.Stream.of(...item).map(item => {
|
|
7754
7727
|
return { key, item };
|
|
7755
7728
|
}))
|
|
7729
|
+
.map(({ key, item }) => {
|
|
7730
|
+
key = this.remapKeyForNamingContainer(key);
|
|
7731
|
+
return { key, item };
|
|
7732
|
+
})
|
|
7756
7733
|
.each(({ key, item }) => ret.append(key, item));
|
|
7757
7734
|
}
|
|
7758
7735
|
}
|
|
@@ -7852,8 +7829,6 @@ class XhrRequest {
|
|
|
7852
7829
|
return this.requestContext.getIf(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_EXECUTE).get("none").value.split(/\s+/gi);
|
|
7853
7830
|
};
|
|
7854
7831
|
try {
|
|
7855
|
-
let formElement = this.sourceForm.getAsElem(0).value;
|
|
7856
|
-
let viewState = (0, Const_1.$faces)().getViewState(formElement);
|
|
7857
7832
|
// encoded we need to decode
|
|
7858
7833
|
// We generated a base representation of the current form
|
|
7859
7834
|
// in case someone has overloaded the viewState with additional decorators we merge
|
|
@@ -7863,12 +7838,14 @@ class XhrRequest {
|
|
|
7863
7838
|
// the partialIdsArray arr is almost deprecated legacy code where we allowed to send a separate list of partial
|
|
7864
7839
|
// ids for reduced load and server processing, this will be removed soon, we can handle the same via execute
|
|
7865
7840
|
// anyway TODO remove the partial ids array
|
|
7866
|
-
let formData = new XhrFormData_1.XhrFormData(this.sourceForm, (0, RequestDataResolver_1.resoveNamingContainerMapper)(this.internalContext),
|
|
7841
|
+
let formData = new XhrFormData_1.XhrFormData(this.sourceForm, (0, RequestDataResolver_1.resoveNamingContainerMapper)(this.internalContext), executesArr(), this.partialIdsArray);
|
|
7867
7842
|
this.contentType = formData.isMultipartRequest ? "undefined" : this.contentType;
|
|
7868
7843
|
// next step the pass through parameters are merged in for post params
|
|
7869
7844
|
this.requestContext.$nspEnabled = false;
|
|
7870
7845
|
let requestContext = this.requestContext;
|
|
7871
7846
|
let requestPassThroughParams = requestContext.getIf(Const_1.CTX_PARAM_REQ_PASS_THR);
|
|
7847
|
+
// we are turning off here the jsf, faces remapping because we are now dealing with
|
|
7848
|
+
// pass-through parameters
|
|
7872
7849
|
requestPassThroughParams.$nspEnabled = false;
|
|
7873
7850
|
// this is an extension where we allow pass through parameters to be sent down additionally
|
|
7874
7851
|
// this can be used and is used in the impl to enrich the post request parameters with additional
|
|
Binary file
|
|
Binary file
|