jsf.js_next_gen 4.0.0-RC.33 → 4.0.0-RC.35
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 +61 -76
- 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 +61 -76
- 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 +2 -2
- package/src/main/typescript/impl/util/FileUtils.ts +25 -14
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +17 -23
- package/src/main/typescript/test/impl/ImplTest_23.spec.ts +0 -4
- package/target/impl/util/FileUtils.js +24 -15
- package/target/impl/util/FileUtils.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +12 -15
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/test/impl/ImplTest_23.spec.js.map +1 -1
|
@@ -2936,6 +2936,13 @@ var ITERATION_STATUS;
|
|
|
2936
2936
|
ITERATION_STATUS["EO_STRM"] = "__EO_STRM__";
|
|
2937
2937
|
ITERATION_STATUS["BEF_STRM"] = "___BEF_STRM__";
|
|
2938
2938
|
})(ITERATION_STATUS = exports.ITERATION_STATUS || (exports.ITERATION_STATUS = {}));
|
|
2939
|
+
function calculateSkips(next_strm) {
|
|
2940
|
+
let pos = 1;
|
|
2941
|
+
while (next_strm.lookAhead(pos) != ITERATION_STATUS.EO_STRM) {
|
|
2942
|
+
pos++;
|
|
2943
|
+
}
|
|
2944
|
+
return --pos;
|
|
2945
|
+
}
|
|
2939
2946
|
class MultiStreamDatasource {
|
|
2940
2947
|
constructor(first, ...strms) {
|
|
2941
2948
|
this.first = first;
|
|
@@ -2966,33 +2973,22 @@ class MultiStreamDatasource {
|
|
|
2966
2973
|
}
|
|
2967
2974
|
return hasNext ? cnt : -1;
|
|
2968
2975
|
}
|
|
2969
|
-
lookAhead(cnt) {
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
//speedup
|
|
2975
|
-
return this.strms[strmPos].lookAhead(cnt);
|
|
2976
|
+
lookAhead(cnt = 1) {
|
|
2977
|
+
//lets clone
|
|
2978
|
+
const strms = this.strms.slice(this.selectedPos);
|
|
2979
|
+
if (!strms.length) {
|
|
2980
|
+
return ITERATION_STATUS.EO_STRM;
|
|
2976
2981
|
}
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
if (val != ITERATION_STATUS.EO_STRM) {
|
|
2984
|
-
posPtr++;
|
|
2985
|
-
}
|
|
2986
|
-
else {
|
|
2987
|
-
if (strmPos >= this.strms.length) {
|
|
2988
|
-
return ITERATION_STATUS.EO_STRM;
|
|
2989
|
-
}
|
|
2990
|
-
strmPos++;
|
|
2991
|
-
posPtr = 1;
|
|
2992
|
-
loop--; //empty iteration
|
|
2982
|
+
const all_strms = [...strms];
|
|
2983
|
+
while (all_strms.length) {
|
|
2984
|
+
let next_strm = all_strms.shift();
|
|
2985
|
+
let lookAhead = next_strm.lookAhead(cnt);
|
|
2986
|
+
if (lookAhead != ITERATION_STATUS.EO_STRM) {
|
|
2987
|
+
return lookAhead;
|
|
2993
2988
|
}
|
|
2989
|
+
cnt = cnt - calculateSkips(next_strm);
|
|
2994
2990
|
}
|
|
2995
|
-
return
|
|
2991
|
+
return ITERATION_STATUS.EO_STRM;
|
|
2996
2992
|
}
|
|
2997
2993
|
next() {
|
|
2998
2994
|
if (this.activeStrm.hasNext()) {
|
|
@@ -3207,29 +3203,13 @@ class FlatMapStreamDataSource {
|
|
|
3207
3203
|
}
|
|
3208
3204
|
lookAhead(cnt = 1) {
|
|
3209
3205
|
var _a;
|
|
3210
|
-
|
|
3211
|
-
if ((this === null || this === void 0 ? void 0 : this.activeDataSource) &&
|
|
3206
|
+
let lookAhead = (_a = this === null || this === void 0 ? void 0 : this.activeDataSource) === null || _a === void 0 ? void 0 : _a.lookAhead(cnt);
|
|
3207
|
+
if ((this === null || this === void 0 ? void 0 : this.activeDataSource) && lookAhead != ITERATION_STATUS.EO_STRM) {
|
|
3212
3208
|
//this should cover 95% of all cases
|
|
3213
|
-
return
|
|
3214
|
-
}
|
|
3215
|
-
/**
|
|
3216
|
-
* we only can determine how many elems datasource has by going up
|
|
3217
|
-
* (for now this suffices, however not ideal, we might have to introduce a numElements or so)
|
|
3218
|
-
* @param datasource
|
|
3219
|
-
*/
|
|
3220
|
-
function howManyElems(datasource) {
|
|
3221
|
-
let cnt = 1;
|
|
3222
|
-
while (datasource.lookAhead(cnt) !== ITERATION_STATUS.EO_STRM) {
|
|
3223
|
-
cnt++;
|
|
3224
|
-
}
|
|
3225
|
-
return cnt - 1;
|
|
3226
|
-
}
|
|
3227
|
-
function readjustSkip(dataSource) {
|
|
3228
|
-
let skippedElems = (dataSource) ? howManyElems(dataSource) : 0;
|
|
3229
|
-
cnt = cnt - skippedElems;
|
|
3209
|
+
return lookAhead;
|
|
3230
3210
|
}
|
|
3231
3211
|
if (this.activeDataSource) {
|
|
3232
|
-
|
|
3212
|
+
cnt -= calculateSkips(this.activeDataSource);
|
|
3233
3213
|
}
|
|
3234
3214
|
//the idea is basically to look into the streams sub-sequentially for a match
|
|
3235
3215
|
//after each stream we have to take into consideration that the skipCnt is
|
|
@@ -3255,9 +3235,8 @@ class FlatMapStreamDataSource {
|
|
|
3255
3235
|
}
|
|
3256
3236
|
//reduce the next lookahead by the number of elements
|
|
3257
3237
|
//we are now skipping in the current data source
|
|
3258
|
-
|
|
3238
|
+
cnt -= calculateSkips(currentDataSource);
|
|
3259
3239
|
}
|
|
3260
|
-
return ITERATION_STATUS.EO_STRM;
|
|
3261
3240
|
}
|
|
3262
3241
|
toDatasource(mapped) {
|
|
3263
3242
|
let ds = Array.isArray(mapped) ? new ArrayStreamDataSource(...mapped) : mapped;
|
|
@@ -6179,7 +6158,7 @@ exports.ExtConfig = ExtConfig;
|
|
|
6179
6158
|
|
|
6180
6159
|
|
|
6181
6160
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6182
|
-
exports.getFormInputsAsStream = exports.
|
|
6161
|
+
exports.getFormInputsAsStream = exports.fixEmmptyParameters = exports.resolveFiles = exports.decodeEncodedValues = exports.encodeFormData = void 0;
|
|
6183
6162
|
const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
6184
6163
|
const ExtDomQuery_1 = __webpack_require__(/*! ./ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
|
|
6185
6164
|
const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
@@ -6231,36 +6210,45 @@ function decodeEncodedValues(encoded) {
|
|
|
6231
6210
|
.map(splitKeyValuePair);
|
|
6232
6211
|
}
|
|
6233
6212
|
exports.decodeEncodedValues = decodeEncodedValues;
|
|
6213
|
+
/**
|
|
6214
|
+
* gets all the input files and their corresponding file objects
|
|
6215
|
+
* @param dataSource
|
|
6216
|
+
*/
|
|
6234
6217
|
function resolveFiles(dataSource) {
|
|
6218
|
+
const expandFilesArr = ([key, files]) => mona_dish_1.Stream.of(...files).map(file => [key, file]);
|
|
6219
|
+
const remapFileInput = fileInput => [fileInput.name.value || fileInput.id.value, fileInput.filesFromElem(0)];
|
|
6235
6220
|
return dataSource
|
|
6236
6221
|
.querySelectorAllDeep("input[type='file']")
|
|
6237
6222
|
.stream
|
|
6238
|
-
.map(
|
|
6239
|
-
.flatMap(
|
|
6240
|
-
return mona_dish_1.Stream.of(...files).map(file => [key, file]);
|
|
6241
|
-
});
|
|
6223
|
+
.map(remapFileInput)
|
|
6224
|
+
.flatMap(expandFilesArr);
|
|
6242
6225
|
}
|
|
6243
6226
|
exports.resolveFiles = resolveFiles;
|
|
6244
|
-
function
|
|
6227
|
+
function fixEmmptyParameters(keyVal) {
|
|
6245
6228
|
var _a, _b;
|
|
6246
|
-
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;
|
|
6229
|
+
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);
|
|
6247
6230
|
}
|
|
6248
|
-
exports.
|
|
6231
|
+
exports.fixEmmptyParameters = fixEmmptyParameters;
|
|
6249
6232
|
/**
|
|
6250
|
-
*
|
|
6251
|
-
* as stream
|
|
6233
|
+
* returns the decoded viewState from parentItem
|
|
6252
6234
|
* @param parentItem
|
|
6253
6235
|
*/
|
|
6254
|
-
function
|
|
6255
|
-
//encoded String
|
|
6236
|
+
function resolveViewState(parentItem) {
|
|
6256
6237
|
const viewStateStr = (0, Const_1.$faces)().getViewState(parentItem.getAsElem(0).value);
|
|
6257
6238
|
// we now need to decode it and then merge it into the target buf
|
|
6258
6239
|
// which hosts already our overrides (aka do not override what is already there(
|
|
6259
6240
|
// after that we need to deal with form elements on a separate level
|
|
6260
|
-
|
|
6241
|
+
return decodeEncodedValues(viewStateStr);
|
|
6242
|
+
}
|
|
6243
|
+
/**
|
|
6244
|
+
* gets all the inputs under the form parentItem
|
|
6245
|
+
* as stream
|
|
6246
|
+
* @param parentItem
|
|
6247
|
+
*/
|
|
6248
|
+
function getFormInputsAsStream(parentItem) {
|
|
6249
|
+
const standardInputs = resolveViewState(parentItem);
|
|
6261
6250
|
const fileInputs = resolveFiles(parentItem);
|
|
6262
|
-
|
|
6263
|
-
return allInputs;
|
|
6251
|
+
return standardInputs.concat(fileInputs);
|
|
6264
6252
|
}
|
|
6265
6253
|
exports.getFormInputsAsStream = getFormInputsAsStream;
|
|
6266
6254
|
|
|
@@ -7774,31 +7762,26 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7774
7762
|
toFormData() {
|
|
7775
7763
|
/*
|
|
7776
7764
|
* expands key: [item1, item2]
|
|
7777
|
-
* to: [{key: item1}, {key, item2}]
|
|
7765
|
+
* to: [{key: key, value: item1}, {key: key, value: item2}]
|
|
7778
7766
|
*/
|
|
7779
|
-
let expandAssocArray = ([key, item]) => mona_dish_1.Stream.of(...item).map(
|
|
7780
|
-
return { key,
|
|
7767
|
+
let expandAssocArray = ([key, item]) => mona_dish_1.Stream.of(...item).map(value => {
|
|
7768
|
+
return { key, value };
|
|
7781
7769
|
});
|
|
7782
7770
|
/*
|
|
7783
7771
|
* remaps the incoming {key, value} tuples
|
|
7784
7772
|
* to naming container prefixed keys and values
|
|
7785
7773
|
*/
|
|
7786
|
-
let remapForNamingContainer = ({ key,
|
|
7774
|
+
let remapForNamingContainer = ({ key, value }) => {
|
|
7787
7775
|
key = this.remapKeyForNamingContainer(key);
|
|
7788
|
-
return { key,
|
|
7776
|
+
return { key, value };
|
|
7789
7777
|
};
|
|
7790
7778
|
/*
|
|
7791
7779
|
* collects everything into a FormData object
|
|
7792
7780
|
*/
|
|
7793
|
-
|
|
7794
|
-
let collectFormData = ({ key, item }) => {
|
|
7795
|
-
ret.append(key, item);
|
|
7796
|
-
};
|
|
7797
|
-
mona_dish_1.Stream.ofAssoc(this.value)
|
|
7781
|
+
return mona_dish_1.Stream.ofAssoc(this.value)
|
|
7798
7782
|
.flatMap(expandAssocArray)
|
|
7799
7783
|
.map(remapForNamingContainer)
|
|
7800
|
-
.
|
|
7801
|
-
return ret;
|
|
7784
|
+
.collect(new mona_dish_1.FormDataCollector());
|
|
7802
7785
|
}
|
|
7803
7786
|
/**
|
|
7804
7787
|
* returns an encoded string representation of our xhr form data
|
|
@@ -7840,10 +7823,12 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7840
7823
|
*/
|
|
7841
7824
|
encodeSubmittableFields(parentItem, partialIds) {
|
|
7842
7825
|
const formInputs = (0, FileUtils_1.getFormInputsAsStream)(parentItem);
|
|
7826
|
+
const mergeIntoThis = ([key, value]) => this.append(key).value = value;
|
|
7827
|
+
const namingContainerRemap = ([key, value]) => this.paramsMapper(key, value);
|
|
7843
7828
|
formInputs
|
|
7844
|
-
.map(FileUtils_1.
|
|
7845
|
-
.map(
|
|
7846
|
-
.each(
|
|
7829
|
+
.map(FileUtils_1.fixEmmptyParameters)
|
|
7830
|
+
.map(namingContainerRemap)
|
|
7831
|
+
.each(mergeIntoThis);
|
|
7847
7832
|
}
|
|
7848
7833
|
remapKeyForNamingContainer(key) {
|
|
7849
7834
|
return this.paramsMapper(key, "")[0];
|
|
Binary file
|
|
Binary file
|