jsf.js_next_gen 4.0.0-RC.34 → 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.
@@ -6158,7 +6158,7 @@ exports.ExtConfig = ExtConfig;
6158
6158
 
6159
6159
 
6160
6160
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6161
- exports.getFormInputsAsStream = exports.fixKeyWithoutVal = exports.resolveFiles = exports.decodeEncodedValues = exports.encodeFormData = void 0;
6161
+ exports.getFormInputsAsStream = exports.fixEmmptyParameters = exports.resolveFiles = exports.decodeEncodedValues = exports.encodeFormData = void 0;
6162
6162
  const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
6163
6163
  const ExtDomQuery_1 = __webpack_require__(/*! ./ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
6164
6164
  const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
@@ -6210,36 +6210,45 @@ function decodeEncodedValues(encoded) {
6210
6210
  .map(splitKeyValuePair);
6211
6211
  }
6212
6212
  exports.decodeEncodedValues = decodeEncodedValues;
6213
+ /**
6214
+ * gets all the input files and their corresponding file objects
6215
+ * @param dataSource
6216
+ */
6213
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)];
6214
6220
  return dataSource
6215
6221
  .querySelectorAllDeep("input[type='file']")
6216
6222
  .stream
6217
- .map(fileInput => [fileInput.name.value || fileInput.id.value, fileInput.filesFromElem(0)])
6218
- .flatMap(([key, files]) => {
6219
- return mona_dish_1.Stream.of(...files).map(file => [key, file]);
6220
- });
6223
+ .map(remapFileInput)
6224
+ .flatMap(expandFilesArr);
6221
6225
  }
6222
6226
  exports.resolveFiles = resolveFiles;
6223
- function fixKeyWithoutVal(keyVal) {
6227
+ function fixEmmptyParameters(keyVal) {
6224
6228
  var _a, _b;
6225
- 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);
6226
6230
  }
6227
- exports.fixKeyWithoutVal = fixKeyWithoutVal;
6231
+ exports.fixEmmptyParameters = fixEmmptyParameters;
6228
6232
  /**
6229
- * gets all the inputs under the form parentItem
6230
- * as stream
6233
+ * returns the decoded viewState from parentItem
6231
6234
  * @param parentItem
6232
6235
  */
6233
- function getFormInputsAsStream(parentItem) {
6234
- //encoded String
6236
+ function resolveViewState(parentItem) {
6235
6237
  const viewStateStr = (0, Const_1.$faces)().getViewState(parentItem.getAsElem(0).value);
6236
6238
  // we now need to decode it and then merge it into the target buf
6237
6239
  // which hosts already our overrides (aka do not override what is already there(
6238
6240
  // after that we need to deal with form elements on a separate level
6239
- const standardInputs = decodeEncodedValues(viewStateStr);
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);
6240
6250
  const fileInputs = resolveFiles(parentItem);
6241
- const allInputs = standardInputs.concat(fileInputs);
6242
- return allInputs;
6251
+ return standardInputs.concat(fileInputs);
6243
6252
  }
6244
6253
  exports.getFormInputsAsStream = getFormInputsAsStream;
6245
6254
 
@@ -7753,18 +7762,18 @@ class XhrFormData extends mona_dish_1.Config {
7753
7762
  toFormData() {
7754
7763
  /*
7755
7764
  * expands key: [item1, item2]
7756
- * to: [{key: item1}, {key, item2}]
7765
+ * to: [{key: key, value: item1}, {key: key, value: item2}]
7757
7766
  */
7758
- let expandAssocArray = ([key, item]) => mona_dish_1.Stream.of(...item).map(item => {
7759
- return { key, item };
7767
+ let expandAssocArray = ([key, item]) => mona_dish_1.Stream.of(...item).map(value => {
7768
+ return { key, value };
7760
7769
  });
7761
7770
  /*
7762
7771
  * remaps the incoming {key, value} tuples
7763
7772
  * to naming container prefixed keys and values
7764
7773
  */
7765
- let remapForNamingContainer = ({ key, item }) => {
7774
+ let remapForNamingContainer = ({ key, value }) => {
7766
7775
  key = this.remapKeyForNamingContainer(key);
7767
- return { key, item };
7776
+ return { key, value };
7768
7777
  };
7769
7778
  /*
7770
7779
  * collects everything into a FormData object
@@ -7814,10 +7823,12 @@ class XhrFormData extends mona_dish_1.Config {
7814
7823
  */
7815
7824
  encodeSubmittableFields(parentItem, partialIds) {
7816
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);
7817
7828
  formInputs
7818
- .map(FileUtils_1.fixKeyWithoutVal)
7819
- .map(([key, value]) => this.paramsMapper(key, value))
7820
- .each(([key, value]) => this.append(key).value = value);
7829
+ .map(FileUtils_1.fixEmmptyParameters)
7830
+ .map(namingContainerRemap)
7831
+ .each(mergeIntoThis);
7821
7832
  }
7822
7833
  remapKeyForNamingContainer(key) {
7823
7834
  return this.paramsMapper(key, "")[0];
Binary file
Binary file