jsf.js_next_gen 4.0.0-RC.31 → 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 +66 -58
- 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 +66 -58
- 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/util/FileUtils.ts +45 -18
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +37 -54
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +3 -7
- package/target/impl/util/FileUtils.js +35 -12
- package/target/impl/util/FileUtils.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +31 -46
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
|
@@ -6159,7 +6159,7 @@ exports.ExtConfig = ExtConfig;
|
|
|
6159
6159
|
|
|
6160
6160
|
|
|
6161
6161
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6162
|
-
exports.fixKeyWithoutVal = exports.resolveFiles = exports.decodeEncodedValues = exports.encodeFormData = void 0;
|
|
6162
|
+
exports.getFormInputsAsStream = exports.fixKeyWithoutVal = exports.resolveFiles = exports.decodeEncodedValues = exports.encodeFormData = void 0;
|
|
6163
6163
|
const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
6164
6164
|
const ExtDomQuery_1 = __webpack_require__(/*! ./ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
|
|
6165
6165
|
const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
@@ -6177,13 +6177,17 @@ function encodeFormData(formData, paramsMapper = (inStr, inVal) => [inStr, inVal
|
|
|
6177
6177
|
if (formData.isAbsent()) {
|
|
6178
6178
|
return defaultStr;
|
|
6179
6179
|
}
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
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)
|
|
6184
6188
|
//we cannot encode file elements that is handled by multipart requests anyway
|
|
6185
|
-
.filter(
|
|
6186
|
-
.map(
|
|
6189
|
+
.filter(isNotFile)
|
|
6190
|
+
.map(mapIntoUrlParam)
|
|
6187
6191
|
.collect(new mona_dish_1.ArrayCollector());
|
|
6188
6192
|
return entries.join("&");
|
|
6189
6193
|
}
|
|
@@ -6193,16 +6197,18 @@ exports.encodeFormData = encodeFormData;
|
|
|
6193
6197
|
* @param encoded encoded string
|
|
6194
6198
|
*/
|
|
6195
6199
|
function decodeEncodedValues(encoded) {
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
.replace(/\s+/g, ''))
|
|
6199
|
-
.map(line => {
|
|
6200
|
+
const filterBlanks = item => !!(item || '').replace(/\s+/g, '');
|
|
6201
|
+
const splitKeyValuePair = line => {
|
|
6200
6202
|
let index = line.indexOf("=");
|
|
6201
6203
|
if (index == -1) {
|
|
6202
6204
|
return [line];
|
|
6203
6205
|
}
|
|
6204
6206
|
return [line.substring(0, index), line.substring(index + 1)];
|
|
6205
|
-
}
|
|
6207
|
+
};
|
|
6208
|
+
let requestParamEntries = decodeURIComponent(encoded).split(/&/gi);
|
|
6209
|
+
return mona_dish_1.Stream.of(...requestParamEntries)
|
|
6210
|
+
.filter(filterBlanks)
|
|
6211
|
+
.map(splitKeyValuePair);
|
|
6206
6212
|
}
|
|
6207
6213
|
exports.decodeEncodedValues = decodeEncodedValues;
|
|
6208
6214
|
function resolveFiles(dataSource) {
|
|
@@ -6220,6 +6226,23 @@ function fixKeyWithoutVal(keyVal) {
|
|
|
6220
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;
|
|
6221
6227
|
}
|
|
6222
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;
|
|
6223
6246
|
|
|
6224
6247
|
|
|
6225
6248
|
/***/ }),
|
|
@@ -7677,7 +7700,6 @@ exports.XhrFormData = void 0;
|
|
|
7677
7700
|
*/
|
|
7678
7701
|
const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
7679
7702
|
const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
7680
|
-
const ExtDomQuery_1 = __webpack_require__(/*! ../util/ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
|
|
7681
7703
|
const FileUtils_1 = __webpack_require__(/*! ../util/FileUtils */ "./src/main/typescript/impl/util/FileUtils.ts");
|
|
7682
7704
|
const defaultParamsMapper = (key, item) => [key, item];
|
|
7683
7705
|
/**
|
|
@@ -7688,9 +7710,6 @@ const defaultParamsMapper = (key, item) => [key, item];
|
|
|
7688
7710
|
* due to api constraints on the HTML Form object in IE11
|
|
7689
7711
|
* and due to the url encoding constraint given by the faces.js spec
|
|
7690
7712
|
*
|
|
7691
|
-
* probably only one needed and one overlay!
|
|
7692
|
-
* the entire file input storing probably is redundant now
|
|
7693
|
-
* that dom query has been fixed
|
|
7694
7713
|
*
|
|
7695
7714
|
* internal storage format
|
|
7696
7715
|
* every value is stored as an array
|
|
@@ -7729,40 +7748,15 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7729
7748
|
this.encodeSubmittableFields(this.dataSource, this.partialIds);
|
|
7730
7749
|
this.applyViewState(this.dataSource);
|
|
7731
7750
|
}
|
|
7732
|
-
/**
|
|
7733
|
-
* generic post init code, for now, this performs some post assign data post-processing
|
|
7734
|
-
* @param executes the executable dom nodes which need to be processed into the form data, which we can send
|
|
7735
|
-
* in our ajax request
|
|
7736
|
-
*/
|
|
7737
|
-
resolveRequestType(rootElement, executes) {
|
|
7738
|
-
if (!executes || executes.indexOf(Const_1.IDENT_NONE) != -1) {
|
|
7739
|
-
return;
|
|
7740
|
-
}
|
|
7741
|
-
this.isMultipartRequest = rootElement.isMultipartCandidate(true);
|
|
7742
|
-
}
|
|
7743
|
-
/**
|
|
7744
|
-
* special case view state handling
|
|
7745
|
-
*
|
|
7746
|
-
* @param form the form holding the view state value
|
|
7747
|
-
*/
|
|
7748
|
-
applyViewState(form) {
|
|
7749
|
-
if (this.getIf((0, Const_1.$nsp)(Const_1.P_VIEWSTATE)).isPresent()) {
|
|
7750
|
-
return;
|
|
7751
|
-
}
|
|
7752
|
-
let viewStateElement = form.querySelectorAllDeep(`[name*='${(0, Const_1.$nsp)(Const_1.P_VIEWSTATE)}'`);
|
|
7753
|
-
let viewState = viewStateElement.inputValue;
|
|
7754
|
-
this.appendIf(viewState.isPresent(), this.remapKeyForNamingContainer(viewStateElement.name.value)).value = viewState.value;
|
|
7755
|
-
}
|
|
7756
7751
|
/**
|
|
7757
7752
|
* @returns a Form data representation, this is needed for file submits
|
|
7758
7753
|
*/
|
|
7759
7754
|
toFormData() {
|
|
7760
|
-
let ret = new FormData();
|
|
7761
7755
|
/*
|
|
7762
7756
|
* expands key: [item1, item2]
|
|
7763
7757
|
* to: [{key: item1}, {key, item2}]
|
|
7764
7758
|
*/
|
|
7765
|
-
let
|
|
7759
|
+
let expandAssocArray = ([key, item]) => mona_dish_1.Stream.of(...item).map(item => {
|
|
7766
7760
|
return { key, item };
|
|
7767
7761
|
});
|
|
7768
7762
|
/*
|
|
@@ -7776,11 +7770,12 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7776
7770
|
/*
|
|
7777
7771
|
* collects everything into a FormData object
|
|
7778
7772
|
*/
|
|
7773
|
+
let ret = new FormData();
|
|
7779
7774
|
let collectFormData = ({ key, item }) => {
|
|
7780
7775
|
ret.append(key, item);
|
|
7781
7776
|
};
|
|
7782
7777
|
mona_dish_1.Stream.ofAssoc(this.value)
|
|
7783
|
-
.flatMap(
|
|
7778
|
+
.flatMap(expandAssocArray)
|
|
7784
7779
|
.map(remapForNamingContainer)
|
|
7785
7780
|
.each(collectFormData);
|
|
7786
7781
|
return ret;
|
|
@@ -7793,6 +7788,30 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7793
7788
|
toString(defaultStr = Const_1.EMPTY_STR) {
|
|
7794
7789
|
return (0, FileUtils_1.encodeFormData)(this, this.paramsMapper, defaultStr);
|
|
7795
7790
|
}
|
|
7791
|
+
/**
|
|
7792
|
+
* generic post init code, for now, this performs some post assign data post-processing
|
|
7793
|
+
* @param executes the executable dom nodes which need to be processed into the form data, which we can send
|
|
7794
|
+
* in our ajax request
|
|
7795
|
+
*/
|
|
7796
|
+
resolveRequestType(rootElement, executes) {
|
|
7797
|
+
if (!executes || executes.indexOf(Const_1.IDENT_NONE) != -1) {
|
|
7798
|
+
return;
|
|
7799
|
+
}
|
|
7800
|
+
this.isMultipartRequest = rootElement.isMultipartCandidate(true);
|
|
7801
|
+
}
|
|
7802
|
+
/**
|
|
7803
|
+
* special case view state handling
|
|
7804
|
+
*
|
|
7805
|
+
* @param form the form holding the view state value
|
|
7806
|
+
*/
|
|
7807
|
+
applyViewState(form) {
|
|
7808
|
+
if (this.getIf((0, Const_1.$nsp)(Const_1.P_VIEWSTATE)).isPresent()) {
|
|
7809
|
+
return;
|
|
7810
|
+
}
|
|
7811
|
+
let viewStateElement = form.querySelectorAllDeep(`[name*='${(0, Const_1.$nsp)(Const_1.P_VIEWSTATE)}'`);
|
|
7812
|
+
let viewState = viewStateElement.inputValue;
|
|
7813
|
+
this.appendIf(viewState.isPresent(), this.remapKeyForNamingContainer(viewStateElement.name.value)).value = viewState.value;
|
|
7814
|
+
}
|
|
7796
7815
|
/**
|
|
7797
7816
|
* determines fields to submit
|
|
7798
7817
|
* @param {Object} targetBuf - the target form buffer receiving the data
|
|
@@ -7800,22 +7819,11 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7800
7819
|
* @param {Array} partialIds - ids fo PPS
|
|
7801
7820
|
*/
|
|
7802
7821
|
encodeSubmittableFields(parentItem, partialIds) {
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
// we now need to decode it and then merge it into the target buf
|
|
7806
|
-
// which hosts already our overrides (aka do not override what is already there(
|
|
7807
|
-
// after that we need to deal with form elements on a separate level
|
|
7808
|
-
const keyValueEntries = (0, FileUtils_1.decodeEncodedValues)(viewStateStr);
|
|
7809
|
-
const fileEntries = (0, FileUtils_1.resolveFiles)(parentItem);
|
|
7810
|
-
const concatted = keyValueEntries.concat(fileEntries);
|
|
7811
|
-
const formData = new ExtDomQuery_1.ExtConfig({});
|
|
7812
|
-
concatted
|
|
7822
|
+
const formInputs = (0, FileUtils_1.getFormInputsAsStream)(parentItem);
|
|
7823
|
+
formInputs
|
|
7813
7824
|
.map(FileUtils_1.fixKeyWithoutVal)
|
|
7814
|
-
.map(
|
|
7815
|
-
.each((
|
|
7816
|
-
formData.append(entry[0]).value = entry[1];
|
|
7817
|
-
});
|
|
7818
|
-
this.shallowMerge(formData, true, true);
|
|
7825
|
+
.map(([key, value]) => this.paramsMapper(key, value))
|
|
7826
|
+
.each(([key, value]) => this.append(key).value = value);
|
|
7819
7827
|
}
|
|
7820
7828
|
remapKeyForNamingContainer(key) {
|
|
7821
7829
|
return this.paramsMapper(key, "")[0];
|
|
Binary file
|
|
Binary file
|