jsf.js_next_gen 4.0.0-RC.22 → 4.0.0-RC.25
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 +117 -33
- 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 +117 -33
- 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/AjaxImpl.ts +31 -3
- package/src/main/typescript/impl/core/Const.ts +1 -1
- package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +7 -0
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +28 -1
- package/src/main/typescript/impl/xhrCore/Response.ts +31 -26
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +16 -4
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +40 -18
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +17 -8
- package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +2 -0
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +8 -8
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +6 -5
- package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +2 -2
- package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +1 -0
- package/target/impl/AjaxImpl.js +19 -1
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/core/Const.js +2 -2
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/xhrCore/RequestDataResolver.js +28 -1
- package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
- package/target/impl/xhrCore/Response.js +16 -13
- package/target/impl/xhrCore/Response.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +14 -3
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +31 -12
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +1 -1
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/test/xhrCore/FileUploadTest.spec.js +1 -0
- package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +8 -7
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +6 -3
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest23.spec.js +2 -2
- package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
- package/target/test/xhrCore/XhrFormDataTest.spec.js +1 -0
- package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
|
@@ -2760,6 +2760,12 @@ class Config extends Optional {
|
|
|
2760
2760
|
toJson() {
|
|
2761
2761
|
return JSON.stringify(this.value);
|
|
2762
2762
|
}
|
|
2763
|
+
/**
|
|
2764
|
+
* returns the first config level as streeam
|
|
2765
|
+
*/
|
|
2766
|
+
get stream() {
|
|
2767
|
+
return Stream_1.Stream.of(...Object.keys(this.value)).map(key => [key, this.value[key]]);
|
|
2768
|
+
}
|
|
2763
2769
|
getClass() {
|
|
2764
2770
|
return Config;
|
|
2765
2771
|
}
|
|
@@ -4478,6 +4484,7 @@ var Implementation;
|
|
|
4478
4484
|
assignClientWindowId(form, requestCtx);
|
|
4479
4485
|
assignExecute(options, requestCtx, form, elementId);
|
|
4480
4486
|
assignRender(options, requestCtx, form, elementId);
|
|
4487
|
+
assignNamingContainerData(internalCtx, form);
|
|
4481
4488
|
//now we enqueue the request as asynchronous runnable into our request
|
|
4482
4489
|
//queue and let the queue take over the rest
|
|
4483
4490
|
Implementation.queueHandler.addRequestToQueue(elem, form, requestCtx, internalCtx, delay, timeout);
|
|
@@ -4650,7 +4657,9 @@ var Implementation;
|
|
|
4650
4657
|
if (!element.isTag(Const_1.HTML_TAG_FORM)) {
|
|
4651
4658
|
throw new Error(getMessage("ERR_VIEWSTATE"));
|
|
4652
4659
|
}
|
|
4653
|
-
|
|
4660
|
+
const dummyContext = new mona_dish_1.Config({});
|
|
4661
|
+
assignNamingContainerData(dummyContext, mona_dish_1.DQ.byId(form));
|
|
4662
|
+
let formData = new XhrFormData_1.XhrFormData(element, (0, RequestDataResolver_1.resoveNamingContainerMapper)(dummyContext));
|
|
4654
4663
|
return formData.toString();
|
|
4655
4664
|
}
|
|
4656
4665
|
Implementation.getViewState = getViewState;
|
|
@@ -4725,6 +4734,21 @@ var Implementation;
|
|
|
4725
4734
|
targetContext.assign(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_CLIENT_WINDOW).value = clientWindow;
|
|
4726
4735
|
}
|
|
4727
4736
|
}
|
|
4737
|
+
/**
|
|
4738
|
+
* determines the current naming container
|
|
4739
|
+
* and assigns it internally
|
|
4740
|
+
*
|
|
4741
|
+
* @param internalContext
|
|
4742
|
+
* @param formElement
|
|
4743
|
+
* @private
|
|
4744
|
+
*/
|
|
4745
|
+
function assignNamingContainerData(internalContext, formElement) {
|
|
4746
|
+
const viewRootId = (0, RequestDataResolver_1.resolveViewRootId)(formElement);
|
|
4747
|
+
if (!!viewRootId) {
|
|
4748
|
+
internalContext.assign(Const_1.NAMED_VIEWROOT).value = true;
|
|
4749
|
+
internalContext.assign(Const_1.NAMING_CONTAINER_ID).value = viewRootId;
|
|
4750
|
+
}
|
|
4751
|
+
}
|
|
4728
4752
|
/**
|
|
4729
4753
|
* transforms the user values to the expected one
|
|
4730
4754
|
* with the proper none all form and this handling
|
|
@@ -5175,7 +5199,7 @@ var PushImpl;
|
|
|
5175
5199
|
* limitations under the License.
|
|
5176
5200
|
*/
|
|
5177
5201
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5178
|
-
exports.CTX_OPTIONS_PARAMS = exports.TIMEOUT_EVENT = exports.CLIENT_ERROR = exports.SERVER_ERROR = exports.MALFORMEDXML = exports.EMPTY_RESPONSE = exports.HTTPERROR = exports.RESPONSE_XML = exports.RESPONSE_TEXT = exports.ERROR_MESSAGE = exports.ERROR_NAME = exports.STATUS = exports.SOURCE = exports.SUCCESS = exports.COMPLETE = exports.BEGIN = exports.ON_EVENT = exports.ON_ERROR = exports.EVENT = exports.ERROR = exports.WINDOW_ID = exports.CTX_PARAM_RENDER = exports.P_BEHAVIOR_EVENT = exports.P_WINDOW_ID = exports.P_RESET_VALUES = exports.P_EVT = exports.P_RENDER_OVERRIDE = exports.P_RENDER = exports.P_EXECUTE = exports.P_AJAX = exports.IDENT_FORM = exports.IDENT_THIS = exports.IDENT_NONE = exports.IDENT_ALL = exports.HTML_CLIENT_WINDOW = exports.HTML_VIEWSTATE = exports.EMPTY_MAP = exports.EMPTY_STR = exports.EMPTY_FUNC = exports.P_RESOURCE = exports.P_VIEWBODY = exports.P_VIEWHEAD = exports.P_VIEWROOT = exports.P_CLIENT_WINDOW = exports.P_VIEWSTATE = exports.VIEW_ID = exports.
|
|
5202
|
+
exports.CTX_OPTIONS_PARAMS = exports.TIMEOUT_EVENT = exports.CLIENT_ERROR = exports.SERVER_ERROR = exports.MALFORMEDXML = exports.EMPTY_RESPONSE = exports.HTTPERROR = exports.RESPONSE_XML = exports.RESPONSE_TEXT = exports.ERROR_MESSAGE = exports.ERROR_NAME = exports.STATUS = exports.SOURCE = exports.SUCCESS = exports.COMPLETE = exports.BEGIN = exports.ON_EVENT = exports.ON_ERROR = exports.EVENT = exports.ERROR = exports.WINDOW_ID = exports.CTX_PARAM_RENDER = exports.P_BEHAVIOR_EVENT = exports.P_WINDOW_ID = exports.P_RESET_VALUES = exports.P_EVT = exports.P_RENDER_OVERRIDE = exports.P_RENDER = exports.P_EXECUTE = exports.P_AJAX = exports.IDENT_FORM = exports.IDENT_THIS = exports.IDENT_NONE = exports.IDENT_ALL = exports.HTML_CLIENT_WINDOW = exports.HTML_VIEWSTATE = exports.EMPTY_MAP = exports.EMPTY_STR = exports.EMPTY_FUNC = exports.P_RESOURCE = exports.P_VIEWBODY = exports.P_VIEWHEAD = exports.P_VIEWROOT = exports.P_CLIENT_WINDOW = exports.P_VIEWSTATE = exports.VIEW_ID = exports.NAMING_CONTAINER_ID = exports.P_PARTIAL_SOURCE = exports.NAMED_VIEWROOT = exports.XML_ATTR_NAMED_VIEWROOT = void 0;
|
|
5179
5203
|
exports.XML_TAG_AFTER = exports.XML_TAG_BEFORE = exports.XML_TAG_REDIRECT = exports.XML_TAG_EXTENSION = exports.XML_TAG_ATTRIBUTES = exports.XML_TAG_ERROR = exports.XML_TAG_EVAL = exports.XML_TAG_INSERT = exports.XML_TAG_DELETE = exports.XML_TAG_UPDATE = exports.XML_TAG_CHANGES = exports.XML_TAG_PARTIAL_RESP = exports.ATTR_ID = exports.ATTR_VALUE = exports.ATTR_NAME = exports.ATTR_URL = exports.ERR_NO_PARTIAL_RESPONSE = exports.PHASE_PROCESS_RESPONSE = exports.SEL_RESPONSE_XML = exports.SEL_CLIENT_WINDOW_ELEM = exports.SEL_VIEWSTATE_ELEM = exports.HTML_TAG_STYLE = exports.HTML_TAG_SCRIPT = exports.HTML_TAG_LINK = exports.HTML_TAG_BODY = exports.HTML_TAG_FORM = exports.HTML_TAG_HEAD = exports.STD_ACCEPT = exports.NO_TIMEOUT = exports.MULTIPART = exports.URL_ENCODED = exports.STATE_EVT_COMPLETE = exports.STATE_EVT_TIMEOUT = exports.STATE_EVT_BEGIN = exports.REQ_TYPE_POST = exports.REQ_TYPE_GET = exports.ENCODED_URL = exports.VAL_AJAX = exports.REQ_ACCEPT = exports.HEAD_FACES_REQ = exports.CONTENT_TYPE = exports.CTX_PARAM_REQ_PASS_THR = exports.CTX_PARAM_SRC_CTL_ID = exports.CTX_PARAM_SRC_FRM_ID = exports.CTX_PARAM_MF_INTERNAL = exports.CTX_OPTIONS_EXECUTE = exports.CTX_OPTIONS_RESET = exports.CTX_OPTIONS_TIMEOUT = exports.DELAY_NONE = exports.CTX_OPTIONS_DELAY = void 0;
|
|
5180
5204
|
exports.$nsp = exports.$faces = exports.UNKNOWN = exports.MAX_RECONNECT_ATTEMPTS = exports.RECONNECT_INTERVAL = exports.APPLIED_CLIENT_WINDOW = exports.APPLIED_VST = exports.REASON_EXPIRED = exports.MF_NONE = exports.MYFACES = exports.DEFERRED_HEAD_INSERTS = exports.UPDATE_ELEMS = exports.UPDATE_FORMS = exports.XML_TAG_ATTR = void 0;
|
|
5181
5205
|
/*
|
|
@@ -5184,7 +5208,7 @@ exports.$nsp = exports.$faces = exports.UNKNOWN = exports.MAX_RECONNECT_ATTEMPTS
|
|
|
5184
5208
|
exports.XML_ATTR_NAMED_VIEWROOT = "namedViewRoot";
|
|
5185
5209
|
exports.NAMED_VIEWROOT = "namedViewRoot";
|
|
5186
5210
|
exports.P_PARTIAL_SOURCE = "jakarta.faces.source";
|
|
5187
|
-
exports.
|
|
5211
|
+
exports.NAMING_CONTAINER_ID = "myfaces.partialId";
|
|
5188
5212
|
exports.VIEW_ID = "myfaces.viewId";
|
|
5189
5213
|
exports.P_VIEWSTATE = "jakarta.faces.ViewState";
|
|
5190
5214
|
exports.P_CLIENT_WINDOW = "jakarta.faces.ClientWindow";
|
|
@@ -6507,7 +6531,7 @@ exports.EventData = EventData;
|
|
|
6507
6531
|
* limitations under the License.
|
|
6508
6532
|
*/
|
|
6509
6533
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6510
|
-
exports.resolveDefaults = exports.getEventTarget = exports.resolveWindowId = exports.resolveDelay = exports.resolveTimeout = exports.resolveViewId = exports.resolveForm = exports.resolveFinalUrl = exports.resolveTargetUrl = exports.resolveHandlerFunc = void 0;
|
|
6534
|
+
exports.resolveDefaults = exports.getEventTarget = exports.resolveWindowId = exports.resolveDelay = exports.resolveTimeout = exports.resoveNamingContainerMapper = exports.resolveViewRootId = exports.resolveViewId = exports.resolveForm = exports.resolveFinalUrl = exports.resolveTargetUrl = exports.resolveHandlerFunc = void 0;
|
|
6511
6535
|
const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
6512
6536
|
const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
6513
6537
|
const Lang_1 = __webpack_require__(/*! ../util/Lang */ "./src/main/typescript/impl/util/Lang.ts");
|
|
@@ -6528,6 +6552,7 @@ const Assertions_1 = __webpack_require__(/*! ../util/Assertions */ "./src/main/t
|
|
|
6528
6552
|
* @param funcName
|
|
6529
6553
|
*/
|
|
6530
6554
|
function resolveHandlerFunc(requestContext, responseContext, funcName) {
|
|
6555
|
+
responseContext = responseContext || new mona_dish_1.Config({});
|
|
6531
6556
|
return responseContext.getIf(funcName)
|
|
6532
6557
|
.orElseLazy(() => requestContext.getIf(funcName).value)
|
|
6533
6558
|
.orElse(Const_1.EMPTY_FUNC).value;
|
|
@@ -6566,6 +6591,32 @@ function resolveViewId(form) {
|
|
|
6566
6591
|
return form.id.value.indexOf(viewStateViewId) === 0 ? viewStateViewId : "";
|
|
6567
6592
|
}
|
|
6568
6593
|
exports.resolveViewId = resolveViewId;
|
|
6594
|
+
function resolveViewRootId(form) {
|
|
6595
|
+
const viewState = form.querySelectorAll(`input[type='hidden'][name*='${(0, Const_1.$nsp)(Const_1.P_VIEWSTATE)}']`).attr("name").orElse("").value;
|
|
6596
|
+
const divider = (0, Const_1.$faces)().separatorchar;
|
|
6597
|
+
const viewId = viewState.split(divider, 2)[0];
|
|
6598
|
+
//different to the identifier the form id is never prepended to the viewstate
|
|
6599
|
+
return viewId.indexOf((0, Const_1.$nsp)(Const_1.P_VIEWSTATE)) === -1 ? viewId : "";
|
|
6600
|
+
}
|
|
6601
|
+
exports.resolveViewRootId = resolveViewRootId;
|
|
6602
|
+
/**
|
|
6603
|
+
* as per jsdoc before the request it must be ensured that every post argument
|
|
6604
|
+
* is prefixed with the naming container id (there is an exception in mojarra with
|
|
6605
|
+
* the element=element param, which we have to follow here as well.
|
|
6606
|
+
* (inputs are prefixed by name anyway normally this only affects our standard parameters)
|
|
6607
|
+
* @private
|
|
6608
|
+
*/
|
|
6609
|
+
function resoveNamingContainerMapper(internalContext) {
|
|
6610
|
+
const isNamedViewRoot = internalContext.getIf(Const_1.NAMED_VIEWROOT).isPresent();
|
|
6611
|
+
if (!isNamedViewRoot) {
|
|
6612
|
+
return;
|
|
6613
|
+
}
|
|
6614
|
+
const partialId = internalContext.getIf(Const_1.NAMING_CONTAINER_ID).value;
|
|
6615
|
+
const SEP = (0, Const_1.$faces)().separatorchar;
|
|
6616
|
+
const prefix = partialId + SEP;
|
|
6617
|
+
return (key, value) => (key.indexOf(prefix) == 0) ? [key, value] : [prefix + key, value];
|
|
6618
|
+
}
|
|
6619
|
+
exports.resoveNamingContainerMapper = resoveNamingContainerMapper;
|
|
6569
6620
|
function resolveTimeout(options) {
|
|
6570
6621
|
var _a;
|
|
6571
6622
|
let getCfg = Lang_1.ExtLang.getLocalOrGlobalConfig;
|
|
@@ -6824,6 +6875,7 @@ var Response;
|
|
|
6824
6875
|
// doing any evaluations even on embedded scripts.
|
|
6825
6876
|
// Usually this does not matter, the client window comes in almost last always anyway
|
|
6826
6877
|
// we maybe drop this deferred assignment in the future, but myfaces did it until now.
|
|
6878
|
+
responseProcessor.updateNamedViewRootState();
|
|
6827
6879
|
responseProcessor.fixViewStates();
|
|
6828
6880
|
responseProcessor.fixClientWindow();
|
|
6829
6881
|
responseProcessor.globalEval();
|
|
@@ -6834,19 +6886,21 @@ var Response;
|
|
|
6834
6886
|
* highest node partial-response from there the main operations are triggered
|
|
6835
6887
|
*/
|
|
6836
6888
|
function processPartialTag(node, responseProcessor, internalContext) {
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
internalContext.assignIf(Const_1.
|
|
6849
|
-
|
|
6889
|
+
/*
|
|
6890
|
+
https://javaee.github.io/javaserverfaces/docs/2.2/javadocs/web-partialresponse.html#ns_xsd
|
|
6891
|
+
The "partial-response" element is the root of the partial response information hierarchy,
|
|
6892
|
+
and contains nested elements for all possible elements that can exist in the response.
|
|
6893
|
+
This element must have an "id" attribute whose value is the return from calling getContainerClientId()
|
|
6894
|
+
on the UIViewRoot to which this response pertains.
|
|
6895
|
+
*/
|
|
6896
|
+
// we can determine whether we are in a naming container scenario by checking whether the passed view id is present in the page
|
|
6897
|
+
// under or in body as identifier
|
|
6898
|
+
var _a;
|
|
6899
|
+
let partialId = (_a = node === null || node === void 0 ? void 0 : node.id) === null || _a === void 0 ? void 0 : _a.value;
|
|
6900
|
+
internalContext.assignIf(!!partialId, Const_1.NAMING_CONTAINER_ID).value = partialId; // second case mojarra
|
|
6901
|
+
// there must be at least one container viewstate element resembling the viewroot that we know
|
|
6902
|
+
// this is named
|
|
6903
|
+
responseProcessor.updateNamedViewRootState();
|
|
6850
6904
|
const SEL_SUB_TAGS = [Const_1.XML_TAG_ERROR, Const_1.XML_TAG_REDIRECT, Const_1.XML_TAG_CHANGES].join(",");
|
|
6851
6905
|
// now we can process the main operations
|
|
6852
6906
|
node.querySelectorAll(SEL_SUB_TAGS).each((node) => {
|
|
@@ -7240,8 +7294,8 @@ class ResponseProcessor {
|
|
|
7240
7294
|
fixViewStates() {
|
|
7241
7295
|
mona_dish_1.Stream.ofAssoc(this.internalContext.getIf(Const_1.APPLIED_VST).orElse({}).value)
|
|
7242
7296
|
.each(([, value]) => {
|
|
7243
|
-
const namingContainerId = this.internalContext.getIf(Const_1.
|
|
7244
|
-
const namedViewRoot = !!this.internalContext.getIf(Const_1.
|
|
7297
|
+
const namingContainerId = this.internalContext.getIf(Const_1.NAMING_CONTAINER_ID);
|
|
7298
|
+
const namedViewRoot = !!this.internalContext.getIf(Const_1.NAMED_VIEWROOT).value;
|
|
7245
7299
|
const affectedForms = this.getContainerForms(namingContainerId)
|
|
7246
7300
|
.filter(affectedForm => this.isInExecuteOrRender(affectedForm));
|
|
7247
7301
|
this.appendViewStateToForms(affectedForms, namedViewRoot, value.value, namingContainerId.orElse("").value);
|
|
@@ -7254,13 +7308,24 @@ class ResponseProcessor {
|
|
|
7254
7308
|
fixClientWindow() {
|
|
7255
7309
|
mona_dish_1.Stream.ofAssoc(this.internalContext.getIf(Const_1.APPLIED_CLIENT_WINDOW).orElse({}).value)
|
|
7256
7310
|
.each(([, value]) => {
|
|
7257
|
-
const namingContainerId = this.internalContext.getIf(Const_1.
|
|
7311
|
+
const namingContainerId = this.internalContext.getIf(Const_1.NAMING_CONTAINER_ID);
|
|
7258
7312
|
const namedViewRoot = !!this.internalContext.getIf(Const_1.NAMED_VIEWROOT).value;
|
|
7259
7313
|
const affectedForms = this.getContainerForms(namingContainerId)
|
|
7260
7314
|
.filter(affectedForm => this.isInExecuteOrRender(affectedForm));
|
|
7261
7315
|
this.appendClientWindowToForms(affectedForms, namedViewRoot, value.value, namingContainerId.orElse("").value);
|
|
7262
7316
|
});
|
|
7263
7317
|
}
|
|
7318
|
+
updateNamedViewRootState() {
|
|
7319
|
+
let partialId = this.internalContext.getIf(Const_1.NAMING_CONTAINER_ID);
|
|
7320
|
+
let namedViewRoot = this.internalContext.getIf(Const_1.NAMED_VIEWROOT);
|
|
7321
|
+
if (partialId.isPresent() &&
|
|
7322
|
+
(namedViewRoot.isAbsent() ||
|
|
7323
|
+
!namedViewRoot.value)) {
|
|
7324
|
+
const SEP = (0, Const_1.$faces)().separatorchar;
|
|
7325
|
+
this.internalContext.assign(Const_1.NAMED_VIEWROOT).value = (!!document.getElementById(partialId.value)) || (0, mona_dish_1.DQ$)(`input[name*='${(0, Const_1.$nsp)(Const_1.P_VIEWSTATE)}']`)
|
|
7326
|
+
.filter(node => node.attr("name").value.indexOf(partialId.value + SEP) == 0).length > 0;
|
|
7327
|
+
}
|
|
7328
|
+
}
|
|
7264
7329
|
/**
|
|
7265
7330
|
* all processing done we can close the request and send the appropriate events
|
|
7266
7331
|
*/
|
|
@@ -7451,6 +7516,7 @@ const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-di
|
|
|
7451
7516
|
const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
7452
7517
|
var isString = mona_dish_1.Lang.isString;
|
|
7453
7518
|
const ExtDomQuery_1 = __webpack_require__(/*! ../util/ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
|
|
7519
|
+
const defaultParamsMapper = (key, item) => [key, item];
|
|
7454
7520
|
/**
|
|
7455
7521
|
* A unified form data class
|
|
7456
7522
|
* which builds upon our configuration.
|
|
@@ -7472,9 +7538,10 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7472
7538
|
* @param executes the executes id list for the elements to being processed
|
|
7473
7539
|
* @param partialIds partial ids to collect, to reduce the data sent down
|
|
7474
7540
|
*/
|
|
7475
|
-
constructor(dataSource, viewState, executes, partialIds) {
|
|
7541
|
+
constructor(dataSource, paramsMapper = defaultParamsMapper, viewState, executes, partialIds) {
|
|
7476
7542
|
super({});
|
|
7477
7543
|
this.dataSource = dataSource;
|
|
7544
|
+
this.paramsMapper = paramsMapper;
|
|
7478
7545
|
this.partialIds = partialIds;
|
|
7479
7546
|
/**
|
|
7480
7547
|
* Checks if the given datasource is a multipart request source
|
|
@@ -7540,10 +7607,10 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7540
7607
|
* @param form the form holding the view state value
|
|
7541
7608
|
*/
|
|
7542
7609
|
applyViewState(form) {
|
|
7543
|
-
let viewStateElement = form.querySelectorAllDeep(`[name*='${Const_1.P_VIEWSTATE}'`);
|
|
7610
|
+
let viewStateElement = form.querySelectorAllDeep(`[name*='${(0, Const_1.$nsp)(Const_1.P_VIEWSTATE)}'`);
|
|
7544
7611
|
let viewState = viewStateElement.inputValue;
|
|
7545
7612
|
// this.appendIf(viewState.isPresent(), P_VIEWSTATE).value = viewState.value;
|
|
7546
|
-
this.appendIf(viewState.isPresent(), viewStateElement.name.value).value = viewState.value;
|
|
7613
|
+
this.appendIf(viewState.isPresent(), this.remapKeyForNamingContainer(viewStateElement.name.value)).value = viewState.value;
|
|
7547
7614
|
}
|
|
7548
7615
|
/**
|
|
7549
7616
|
* assigns an url encoded string to this xhrFormData object
|
|
@@ -7570,11 +7637,11 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7570
7637
|
var _a, _b;
|
|
7571
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;
|
|
7572
7639
|
}
|
|
7573
|
-
//TODO fix files...
|
|
7574
7640
|
mona_dish_1.Stream.of(...keyValueEntries)
|
|
7575
7641
|
.map(line => splitToKeyVal(line))
|
|
7576
7642
|
//special case of having keys without values
|
|
7577
7643
|
.map(keyVal => fixKeyWithoutVal(keyVal))
|
|
7644
|
+
.map(keyVal => this.paramsMapper(keyVal[0], keyVal[1]))
|
|
7578
7645
|
.each(keyVal => {
|
|
7579
7646
|
var _a, _b;
|
|
7580
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 : "";
|
|
@@ -7583,6 +7650,7 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7583
7650
|
this.shallowMerge(toMerge);
|
|
7584
7651
|
}
|
|
7585
7652
|
/**
|
|
7653
|
+
* @param paramsMapper ... pre encode the params if needed, default is to map them 1:1
|
|
7586
7654
|
* @returns a Form data representation, this is needed for file submits
|
|
7587
7655
|
*/
|
|
7588
7656
|
toFormData() {
|
|
@@ -7607,10 +7675,12 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7607
7675
|
}
|
|
7608
7676
|
let entries = mona_dish_1.LazyStream.of(...Object.keys(this.value))
|
|
7609
7677
|
.filter(key => this.value.hasOwnProperty(key))
|
|
7610
|
-
.flatMap(key => mona_dish_1.Stream.of(...this.value[key])
|
|
7678
|
+
.flatMap(key => mona_dish_1.Stream.of(...this.value[key])
|
|
7679
|
+
.map(val => {
|
|
7680
|
+
return this.paramsMapper(key, val);
|
|
7681
|
+
}))
|
|
7611
7682
|
//we cannot encode file elements that is handled by multipart requests anyway
|
|
7612
7683
|
.filter(([, value]) => !(value instanceof ExtDomQuery_1.ExtDomQuery.global().File))
|
|
7613
|
-
.collect(new mona_dish_1.ArrayCollector()))
|
|
7614
7684
|
.map(keyVal => {
|
|
7615
7685
|
return `${encodeURIComponent(keyVal[0])}=${encodeURIComponent(keyVal[1])}`;
|
|
7616
7686
|
})
|
|
@@ -7643,7 +7713,7 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7643
7713
|
*
|
|
7644
7714
|
*/
|
|
7645
7715
|
this.encodeSubmittableFields(this, this.dataSource, this.partialIds);
|
|
7646
|
-
if (this.getIf(Const_1.P_VIEWSTATE).isPresent()) {
|
|
7716
|
+
if (this.getIf((0, Const_1.$nsp)(Const_1.P_VIEWSTATE)).isPresent()) {
|
|
7647
7717
|
return;
|
|
7648
7718
|
}
|
|
7649
7719
|
this.applyViewState(this.dataSource);
|
|
@@ -7668,13 +7738,27 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7668
7738
|
toEncode = parentItem;
|
|
7669
7739
|
}
|
|
7670
7740
|
//lets encode the form elements
|
|
7671
|
-
|
|
7741
|
+
let formElements = toEncode.deepElements.encodeFormElement();
|
|
7742
|
+
const mapped = this.remapKeysForNamingCoontainer(formElements);
|
|
7743
|
+
this.shallowMerge(mapped);
|
|
7744
|
+
}
|
|
7745
|
+
remapKeysForNamingCoontainer(formElements) {
|
|
7746
|
+
let ret = new mona_dish_1.Config({});
|
|
7747
|
+
formElements.stream.map(([key, item]) => this.paramsMapper(key, item))
|
|
7748
|
+
.each(([key, item]) => {
|
|
7749
|
+
ret.assign(key).value = item;
|
|
7750
|
+
});
|
|
7751
|
+
return ret;
|
|
7752
|
+
}
|
|
7753
|
+
remapKeyForNamingContainer(key) {
|
|
7754
|
+
return this.paramsMapper(key, "")[0];
|
|
7672
7755
|
}
|
|
7673
7756
|
appendInputs(ret) {
|
|
7674
|
-
mona_dish_1.Stream.
|
|
7675
|
-
.
|
|
7676
|
-
|
|
7677
|
-
})
|
|
7757
|
+
mona_dish_1.Stream.ofAssoc(this.value)
|
|
7758
|
+
.flatMap(([key, item]) => mona_dish_1.Stream.of(...item).map(item => {
|
|
7759
|
+
return { key, item };
|
|
7760
|
+
}))
|
|
7761
|
+
.each(({ key, item }) => ret.append(key, item));
|
|
7678
7762
|
}
|
|
7679
7763
|
}
|
|
7680
7764
|
exports.XhrFormData = XhrFormData;
|
|
@@ -7784,7 +7868,7 @@ class XhrRequest {
|
|
|
7784
7868
|
// the partialIdsArray arr is almost deprecated legacy code where we allowed to send a separate list of partial
|
|
7785
7869
|
// ids for reduced load and server processing, this will be removed soon, we can handle the same via execute
|
|
7786
7870
|
// anyway TODO remove the partial ids array
|
|
7787
|
-
let formData = new XhrFormData_1.XhrFormData(this.sourceForm, viewState, executesArr(), this.partialIdsArray);
|
|
7871
|
+
let formData = new XhrFormData_1.XhrFormData(this.sourceForm, (0, RequestDataResolver_1.resoveNamingContainerMapper)(this.internalContext), viewState, executesArr(), this.partialIdsArray);
|
|
7788
7872
|
this.contentType = formData.isMultipartRequest ? "undefined" : this.contentType;
|
|
7789
7873
|
// next step the pass through parameters are merged in for post params
|
|
7790
7874
|
this.requestContext.$nspEnabled = false;
|
|
Binary file
|
|
Binary file
|