jsf.js_next_gen 4.0.0-beta-10 → 4.0.0-beta-12
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 +164 -49
- 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 +164 -49
- 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 +3 -3
- package/pom.xml +14 -0
- package/src/main/java/com/example/jsfs_js_ts/DecoratedFacesJS.java +80 -0
- package/src/main/java/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.java +54 -0
- package/src/main/typescript/impl/util/ExtDomQuery.ts +10 -6
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +0 -2
- package/target/api/{Jsf.js → jsf.js} +0 -0
- package/target/api/{Jsf.js.map → jsf.js.map} +0 -0
- package/target/impl/util/ExtDomQuery.js +10 -6
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +0 -2
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/src/main/java/com/example/jsfs_js_ts/JsfsJsTsApplication.java +0 -12
- package/target/api/_faces.js +0 -251
- package/target/api/_faces.js.map +0 -1
- package/target/classes/com/example/jsfs_js_ts/JsfsJsTsApplication.class +0 -0
- package/target/impl/util/ListenerQueue.js +0 -3
- package/target/impl/util/ListenerQueue.js.map +0 -1
- package/target/main/typescript/api/Jsf.js +0 -258
- package/target/main/typescript/api/Jsf.js.map +0 -1
- package/target/main/typescript/impl/AjaxImpl.js +0 -569
- package/target/main/typescript/impl/AjaxImpl.js.map +0 -1
- package/target/main/typescript/impl/PushImpl.js +0 -215
- package/target/main/typescript/impl/PushImpl.js.map +0 -1
- package/target/main/typescript/impl/core/Const.js +0 -135
- package/target/main/typescript/impl/core/Const.js.map +0 -1
- package/target/main/typescript/impl/core/ImplTypes.js +0 -43
- package/target/main/typescript/impl/core/ImplTypes.js.map +0 -1
- package/target/main/typescript/impl/i18n/Messages.js +0 -114
- package/target/main/typescript/impl/i18n/Messages.js.map +0 -1
- package/target/main/typescript/impl/util/Assertions.js +0 -90
- package/target/main/typescript/impl/util/Assertions.js.map +0 -1
- package/target/main/typescript/impl/util/AsyncQueue.js +0 -104
- package/target/main/typescript/impl/util/AsyncQueue.js.map +0 -1
- package/target/main/typescript/impl/util/AsyncRunnable.js +0 -18
- package/target/main/typescript/impl/util/AsyncRunnable.js.map +0 -1
- package/target/main/typescript/impl/util/ExtDomQuery.js +0 -129
- package/target/main/typescript/impl/util/ExtDomQuery.js.map +0 -1
- package/target/main/typescript/impl/util/Lang.js +0 -215
- package/target/main/typescript/impl/util/Lang.js.map +0 -1
- package/target/main/typescript/impl/util/ListenerQueue.js +0 -3
- package/target/main/typescript/impl/util/ListenerQueue.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/ErrorData.js +0 -89
- package/target/main/typescript/impl/xhrCore/ErrorData.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/EventData.js +0 -30
- package/target/main/typescript/impl/xhrCore/EventData.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/IResponseProcessor.js +0 -3
- package/target/main/typescript/impl/xhrCore/IResponseProcessor.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/RequestDataResolver.js +0 -143
- package/target/main/typescript/impl/xhrCore/RequestDataResolver.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/ResonseDataResolver.js +0 -103
- package/target/main/typescript/impl/xhrCore/ResonseDataResolver.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/Response.js +0 -167
- package/target/main/typescript/impl/xhrCore/Response.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/ResponseProcessor.js +0 -368
- package/target/main/typescript/impl/xhrCore/ResponseProcessor.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/XhrFormData.js +0 -272
- package/target/main/typescript/impl/xhrCore/XhrFormData.js.map +0 -1
- package/target/main/typescript/impl/xhrCore/XhrRequest.js +0 -281
- package/target/main/typescript/impl/xhrCore/XhrRequest.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.js +0 -293
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/LangTest.js +0 -89
- package/target/test/frameworkBase/_ext/monadish/LangTest.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/MappingTest.js +0 -39
- package/target/test/frameworkBase/_ext/monadish/MappingTest.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/MonadTest.js +0 -155
- package/target/test/frameworkBase/_ext/monadish/MonadTest.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/StreamTest.js +0 -176
- package/target/test/frameworkBase/_ext/monadish/StreamTest.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/XmlQueryTest.js +0 -1
- package/target/test/frameworkBase/_ext/monadish/XmlQueryTest.js.map +0 -1
- package/target/test/impl/ImplTest_23.spec_.js +0 -165
- package/target/test/impl/ImplTest_23.spec_.js.map +0 -1
- package/target/test/typescript/frameworkBase/LangTest.js +0 -112
- package/target/test/typescript/frameworkBase/LangTest.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/monadish/DomQueryTest.js +0 -293
- package/target/test/typescript/frameworkBase/_ext/monadish/DomQueryTest.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/monadish/LangTest.js +0 -89
- package/target/test/typescript/frameworkBase/_ext/monadish/LangTest.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/monadish/MappingProbes.js +0 -115
- package/target/test/typescript/frameworkBase/_ext/monadish/MappingProbes.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/monadish/MappingTest.js +0 -39
- package/target/test/typescript/frameworkBase/_ext/monadish/MappingTest.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/monadish/MonadTest.js +0 -155
- package/target/test/typescript/frameworkBase/_ext/monadish/MonadTest.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/monadish/StreamTest.js +0 -176
- package/target/test/typescript/frameworkBase/_ext/monadish/StreamTest.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/monadish/XmlQueryTest.js +0 -1
- package/target/test/typescript/frameworkBase/_ext/monadish/XmlQueryTest.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/shared/StandardInits.js +0 -264
- package/target/test/typescript/frameworkBase/_ext/shared/StandardInits.js.map +0 -1
- package/target/test/typescript/frameworkBase/_ext/shared/XmlResponses.js +0 -23
- package/target/test/typescript/frameworkBase/_ext/shared/XmlResponses.js.map +0 -1
- package/target/test/typescript/impl/ImplTest.js +0 -98
- package/target/test/typescript/impl/ImplTest.js.map +0 -1
- package/target/test/typescript/impl/SeparatorCharsTest.js +0 -72
- package/target/test/typescript/impl/SeparatorCharsTest.js.map +0 -1
- package/target/test/typescript/queue/AsynchronousProbe.js +0 -99
- package/target/test/typescript/queue/AsynchronousProbe.js.map +0 -1
- package/target/test/typescript/queue/AsynchronousQueueTest.js +0 -130
- package/target/test/typescript/queue/AsynchronousQueueTest.js.map +0 -1
- package/target/test/typescript/xhrCore/EventTests.js +0 -155
- package/target/test/typescript/xhrCore/EventTests.js.map +0 -1
- package/target/test/typescript/xhrCore/FakeWebsocket.js +0 -25
- package/target/test/typescript/xhrCore/FakeWebsocket.js.map +0 -1
- package/target/test/typescript/xhrCore/FileUploadTest.js +0 -166
- package/target/test/typescript/xhrCore/FileUploadTest.js.map +0 -1
- package/target/test/typescript/xhrCore/RequestParamsTest.js +0 -151
- package/target/test/typescript/xhrCore/RequestParamsTest.js.map +0 -1
- package/target/test/typescript/xhrCore/RequestTest.js +0 -318
- package/target/test/typescript/xhrCore/RequestTest.js.map +0 -1
- package/target/test/typescript/xhrCore/ResponseTest.js +0 -257
- package/target/test/typescript/xhrCore/ResponseTest.js.map +0 -1
- package/target/test/typescript/xhrCore/ShadowDomTest.js +0 -122
- package/target/test/typescript/xhrCore/ShadowDomTest.js.map +0 -1
- package/target/test/typescript/xhrCore/WebsocketTest.js +0 -182
- package/target/test/typescript/xhrCore/WebsocketTest.js.map +0 -1
- package/target/test/typescript/xhrCore/XhrFormDataTest.js +0 -58
- package/target/test/typescript/xhrCore/XhrFormDataTest.js.map +0 -1
- package/target/test-classes/.gz +0 -0
- package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
- package/target/test-classes/fileuploadtest.html +0 -24
- package/target/test-classes/jsf-development.js +0 -6781
- package/target/test-classes/jsf-development.js.br +0 -0
- package/target/test-classes/jsf-development.js.gz +0 -0
- package/target/test-classes/jsf-development.js.map +0 -1
- package/target/test-classes/jsf.js +0 -3
- package/target/test-classes/jsf.js.br +0 -0
- package/target/test-classes/jsf.js.gz +0 -0
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
3
|
-
* contributor license agreements. See the NOTICE file distributed with
|
|
4
|
-
* this work for additional information regarding copyright ownership.
|
|
5
|
-
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
6
|
-
* (the "License"); you may not use this file except in compliance with
|
|
7
|
-
* the License. You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
18
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
19
|
-
if (ar || !(i in from)) {
|
|
20
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
21
|
-
ar[i] = from[i];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.ResponseProcessor = void 0;
|
|
28
|
-
var mona_dish_1 = require("mona-dish");
|
|
29
|
-
var AjaxImpl_1 = require("../AjaxImpl");
|
|
30
|
-
var Assertions_1 = require("../util/Assertions");
|
|
31
|
-
var ErrorData_1 = require("./ErrorData");
|
|
32
|
-
var ImplTypes_1 = require("../core/ImplTypes");
|
|
33
|
-
var EventData_1 = require("./EventData");
|
|
34
|
-
var Const_1 = require("../core/Const");
|
|
35
|
-
var trim = mona_dish_1.Lang.trim;
|
|
36
|
-
/**
|
|
37
|
-
* Response processor
|
|
38
|
-
*
|
|
39
|
-
* Each XML tag is either a node or a leaf
|
|
40
|
-
* or both
|
|
41
|
-
*
|
|
42
|
-
* the processor provides a set of operations
|
|
43
|
-
* which are executed on a single leaf node per operation
|
|
44
|
-
* and present the core functionality of our response
|
|
45
|
-
*
|
|
46
|
-
* Note the response processor is stateful hence we bundle it in a class
|
|
47
|
-
* to reduce code we keep references tot contexts in place
|
|
48
|
-
*/
|
|
49
|
-
var ResponseProcessor = /** @class */ (function () {
|
|
50
|
-
function ResponseProcessor(request, externalContext, internalContext) {
|
|
51
|
-
this.request = request;
|
|
52
|
-
this.externalContext = externalContext;
|
|
53
|
-
this.internalContext = internalContext;
|
|
54
|
-
}
|
|
55
|
-
ResponseProcessor.prototype.replaceHead = function (shadowDocument) {
|
|
56
|
-
var shadowHead = shadowDocument.querySelectorAll(Const_1.TAG_HEAD);
|
|
57
|
-
if (!shadowHead.isPresent()) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
var oldHead = mona_dish_1.DQ.querySelectorAll(Const_1.TAG_HEAD);
|
|
61
|
-
//delete all to avoid script and style overlays
|
|
62
|
-
oldHead.querySelectorAll(Const_1.SEL_SCRIPTS_STYLES).delete();
|
|
63
|
-
this.storeForEval(shadowHead);
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* replaces the body in the expected manner
|
|
67
|
-
* which means the entire body content is refreshed
|
|
68
|
-
* however also the body attributes must be transferred
|
|
69
|
-
* keeping event handlers etc... in place
|
|
70
|
-
*
|
|
71
|
-
* @param shadowDocument .. an incoming shadow document hosting the new nodes
|
|
72
|
-
*/
|
|
73
|
-
ResponseProcessor.prototype.replaceBody = function (shadowDocument) {
|
|
74
|
-
var shadowBody = shadowDocument.querySelectorAll(Const_1.TAG_BODY);
|
|
75
|
-
if (!shadowBody.isPresent()) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
var shadowInnerHTML = shadowBody.html().value;
|
|
79
|
-
var resultingBody = mona_dish_1.DQ.querySelectorAll(Const_1.TAG_BODY).html(shadowInnerHTML);
|
|
80
|
-
var updateForms = resultingBody.querySelectorAll(Const_1.TAG_FORM);
|
|
81
|
-
resultingBody.copyAttrs(shadowBody);
|
|
82
|
-
this.storeForPostProcessing(updateForms, resultingBody);
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Leaf Tag eval... process whatever is in the evals cdata block
|
|
86
|
-
*
|
|
87
|
-
* @param node the node to eval
|
|
88
|
-
*/
|
|
89
|
-
ResponseProcessor.prototype.eval = function (node) {
|
|
90
|
-
mona_dish_1.DQ.globalEval(node.cDATAAsString);
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* processes an incoming error from the response
|
|
94
|
-
* which is hosted under the <error> tag
|
|
95
|
-
* @param node the node hosting the error in our response xml
|
|
96
|
-
* @param node the node in the xml hosting the error message
|
|
97
|
-
*/
|
|
98
|
-
ResponseProcessor.prototype.error = function (node) {
|
|
99
|
-
/**
|
|
100
|
-
* <error>
|
|
101
|
-
* <error-name>String</error-name>
|
|
102
|
-
* <error-message><![CDATA[message]]></error-message>
|
|
103
|
-
* <error>
|
|
104
|
-
*/
|
|
105
|
-
var mergedErrorData = new mona_dish_1.Config({});
|
|
106
|
-
mergedErrorData.assign(Const_1.SOURCE).value = this.externalContext.getIf(Const_1.P_PARTIAL_SOURCE).get(0).value;
|
|
107
|
-
mergedErrorData.assign(Const_1.ERROR_NAME).value = node.getIf(Const_1.ERROR_NAME).textContent(Const_1.EMPTY_STR);
|
|
108
|
-
mergedErrorData.assign(Const_1.ERROR_MESSAGE).value = node.getIf(Const_1.ERROR_MESSAGE).cDATAAsString;
|
|
109
|
-
var hasResponseXML = this.internalContext.get(Const_1.RESPONSE_XML).isPresent();
|
|
110
|
-
mergedErrorData.assignIf(hasResponseXML, Const_1.RESPONSE_XML).value = this.internalContext.getIf(Const_1.RESPONSE_XML).value.get(0).value;
|
|
111
|
-
var errorData = ErrorData_1.ErrorData.fromServerError(mergedErrorData);
|
|
112
|
-
this.externalContext.getIf(Const_1.ON_ERROR).orElse(this.internalContext.getIf(Const_1.ON_ERROR).value).orElse(Const_1.EMPTY_FUNC).value(errorData);
|
|
113
|
-
AjaxImpl_1.Implementation.sendError(errorData);
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* process the redirect operation
|
|
117
|
-
*
|
|
118
|
-
* @param node
|
|
119
|
-
*/
|
|
120
|
-
ResponseProcessor.prototype.redirect = function (node) {
|
|
121
|
-
Assertions_1.Assertions.assertUrlExists(node);
|
|
122
|
-
var redirectUrl = trim(node.attr(Const_1.ATTR_URL).value);
|
|
123
|
-
if (redirectUrl != Const_1.EMPTY_STR) {
|
|
124
|
-
window.location.href = redirectUrl;
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* processes the update operation and updates the node with the cdata block
|
|
129
|
-
* @param node the xml response node hosting the update info
|
|
130
|
-
* @param cdataBlock the cdata block with the new html code
|
|
131
|
-
*/
|
|
132
|
-
ResponseProcessor.prototype.update = function (node, cdataBlock) {
|
|
133
|
-
var result = mona_dish_1.DQ.byId(node.id.value, true).outerHTML(cdataBlock, false, false);
|
|
134
|
-
var sourceForm = result === null || result === void 0 ? void 0 : result.parents(Const_1.TAG_FORM).orElse(result.byTagName(Const_1.TAG_FORM, true));
|
|
135
|
-
if (sourceForm) {
|
|
136
|
-
this.storeForPostProcessing(sourceForm, result);
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
ResponseProcessor.prototype.delete = function (node) {
|
|
140
|
-
mona_dish_1.DQ.byId(node.id.value, true).delete();
|
|
141
|
-
};
|
|
142
|
-
/**
|
|
143
|
-
* attributes leaf tag... process the attributes
|
|
144
|
-
*
|
|
145
|
-
* @param node
|
|
146
|
-
*/
|
|
147
|
-
ResponseProcessor.prototype.attributes = function (node) {
|
|
148
|
-
var elem = mona_dish_1.DQ.byId(node.id.value, true);
|
|
149
|
-
node.byTagName(Const_1.TAG_ATTR).each(function (item) {
|
|
150
|
-
elem.attr(item.attr(Const_1.ATTR_NAME).value).value = item.attr(Const_1.ATTR_VALUE).value;
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* @param shadowDocument a shadow document which is needed for further processing
|
|
155
|
-
*/
|
|
156
|
-
ResponseProcessor.prototype.replaceViewRoot = function (shadowDocument) {
|
|
157
|
-
this.replaceHead(shadowDocument);
|
|
158
|
-
this.replaceBody(shadowDocument);
|
|
159
|
-
};
|
|
160
|
-
/**
|
|
161
|
-
* insert handling, either before or after
|
|
162
|
-
*
|
|
163
|
-
* @param node
|
|
164
|
-
*/
|
|
165
|
-
ResponseProcessor.prototype.insert = function (node) {
|
|
166
|
-
//let insertId = node.id; //not used atm
|
|
167
|
-
var before = node.attr(Const_1.TAG_BEFORE);
|
|
168
|
-
var after = node.attr(Const_1.TAG_AFTER);
|
|
169
|
-
var insertNodes = mona_dish_1.DQ.fromMarkup(node.cDATAAsString);
|
|
170
|
-
if (before.isPresent()) {
|
|
171
|
-
mona_dish_1.DQ.byId(before.value, true).insertBefore(insertNodes);
|
|
172
|
-
this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(insertNodes);
|
|
173
|
-
}
|
|
174
|
-
if (after.isPresent()) {
|
|
175
|
-
var domQuery = mona_dish_1.DQ.byId(after.value, true);
|
|
176
|
-
domQuery.insertAfter(insertNodes);
|
|
177
|
-
this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(insertNodes);
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
/**
|
|
181
|
-
* handler for the case <insert << before id="...
|
|
182
|
-
*
|
|
183
|
-
* @param node the node hosting the insert data
|
|
184
|
-
*/
|
|
185
|
-
ResponseProcessor.prototype.insertWithSubtags = function (node) {
|
|
186
|
-
var _this = this;
|
|
187
|
-
var before = node.querySelectorAll(Const_1.TAG_BEFORE);
|
|
188
|
-
var after = node.querySelectorAll(Const_1.TAG_AFTER);
|
|
189
|
-
before.each(function (item) {
|
|
190
|
-
var insertId = item.attr(Const_1.ATTR_ID);
|
|
191
|
-
var insertNodes = mona_dish_1.DQ.fromMarkup(item.cDATAAsString);
|
|
192
|
-
if (insertId.isPresent()) {
|
|
193
|
-
mona_dish_1.DQ.byId(insertId.value, true).insertBefore(insertNodes);
|
|
194
|
-
_this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(insertNodes);
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
after.each(function (item) {
|
|
198
|
-
var insertId = item.attr(Const_1.ATTR_ID);
|
|
199
|
-
var insertNodes = mona_dish_1.DQ.fromMarkup(item.cDATAAsString);
|
|
200
|
-
if (insertId.isPresent()) {
|
|
201
|
-
mona_dish_1.DQ.byId(insertId.value, true).insertAfter(insertNodes);
|
|
202
|
-
_this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(insertNodes);
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
};
|
|
206
|
-
/**
|
|
207
|
-
* process the viewState update, update the affected
|
|
208
|
-
* forms with their respective new viewstate values
|
|
209
|
-
*
|
|
210
|
-
*/
|
|
211
|
-
ResponseProcessor.prototype.processViewState = function (node) {
|
|
212
|
-
if (ResponseProcessor.isViewStateNode(node)) {
|
|
213
|
-
var state = node.cDATAAsString;
|
|
214
|
-
this.internalContext.assign(Const_1.APPLIED_VST, node.id.value).value = new ImplTypes_1.StateHolder(node.id.value, state);
|
|
215
|
-
return true;
|
|
216
|
-
}
|
|
217
|
-
return false;
|
|
218
|
-
};
|
|
219
|
-
ResponseProcessor.prototype.processClientWindow = function (node) {
|
|
220
|
-
if (ResponseProcessor.isClientWindowNode(node)) {
|
|
221
|
-
var state = node.cDATAAsString;
|
|
222
|
-
this.internalContext.assign(Const_1.APPLIED_CLIENT_WINDOW, node.id.value).value = new ImplTypes_1.StateHolder(node.id.value, state);
|
|
223
|
-
return true;
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
/**
|
|
227
|
-
* generic global eval which runs the embedded css and scripts
|
|
228
|
-
*/
|
|
229
|
-
ResponseProcessor.prototype.globalEval = function () {
|
|
230
|
-
var updateElems = new (mona_dish_1.DQ.bind.apply(mona_dish_1.DQ, __spreadArray([void 0], this.internalContext.getIf(Const_1.UPDATE_ELEMS).value, false)))();
|
|
231
|
-
updateElems.runCss();
|
|
232
|
-
updateElems.runScripts();
|
|
233
|
-
};
|
|
234
|
-
/**
|
|
235
|
-
* post processing viewstate fixing
|
|
236
|
-
*/
|
|
237
|
-
ResponseProcessor.prototype.fixViewStates = function () {
|
|
238
|
-
var _this = this;
|
|
239
|
-
mona_dish_1.Stream.ofAssoc(this.internalContext.getIf(Const_1.APPLIED_VST).orElse({}).value)
|
|
240
|
-
.each(function (item) {
|
|
241
|
-
var value = item[1];
|
|
242
|
-
var nameSpace = mona_dish_1.DQ.byId(value.nameSpace, true).orElse(document.body);
|
|
243
|
-
var affectedForms = nameSpace.byTagName(Const_1.TAG_FORM);
|
|
244
|
-
var affectedForms2 = nameSpace.filter(function (item) { return item.tagName.orElse(Const_1.EMPTY_STR).value.toLowerCase() == Const_1.TAG_FORM; });
|
|
245
|
-
_this.appendViewStateToForms(new mona_dish_1.DomQuery(affectedForms, affectedForms2), value.value);
|
|
246
|
-
});
|
|
247
|
-
};
|
|
248
|
-
ResponseProcessor.prototype.fixClientWindow = function () {
|
|
249
|
-
var _this = this;
|
|
250
|
-
mona_dish_1.Stream.ofAssoc(this.internalContext.getIf(Const_1.APPLIED_CLIENT_WINDOW).orElse({}).value)
|
|
251
|
-
.each(function (item) {
|
|
252
|
-
var value = item[1];
|
|
253
|
-
var nameSpace = mona_dish_1.DQ.byId(value.nameSpace, true).orElse(document.body);
|
|
254
|
-
var affectedForms = nameSpace.byTagName(Const_1.TAG_FORM);
|
|
255
|
-
var affectedForms2 = nameSpace.filter(function (item) { return item.tagName.orElse(Const_1.EMPTY_STR).value.toLowerCase() == Const_1.TAG_FORM; });
|
|
256
|
-
_this.appendClientWindowToForms(new mona_dish_1.DomQuery(affectedForms, affectedForms2), value.value);
|
|
257
|
-
});
|
|
258
|
-
};
|
|
259
|
-
/**
|
|
260
|
-
* all processing done we can close the request and send the appropriate events
|
|
261
|
-
*/
|
|
262
|
-
ResponseProcessor.prototype.done = function () {
|
|
263
|
-
var eventData = EventData_1.EventData.createFromRequest(this.request.value, this.externalContext, Const_1.SUCCESS);
|
|
264
|
-
//because some frameworks might decorate them over the context in the response
|
|
265
|
-
var eventHandler = this.externalContext.getIf(Const_1.ON_EVENT).orElse(this.internalContext.getIf(Const_1.ON_EVENT).value).orElse(Const_1.EMPTY_FUNC).value;
|
|
266
|
-
AjaxImpl_1.Implementation.sendEvent(eventData, eventHandler);
|
|
267
|
-
};
|
|
268
|
-
/**
|
|
269
|
-
* proper viewstate -> form assignment
|
|
270
|
-
*
|
|
271
|
-
* @param forms the forms to append the viewstate to
|
|
272
|
-
* @param viewState the final viewstate
|
|
273
|
-
*/
|
|
274
|
-
ResponseProcessor.prototype.appendViewStateToForms = function (forms, viewState) {
|
|
275
|
-
this.assignState(forms, Const_1.SEL_VIEWSTATE_ELEM, viewState);
|
|
276
|
-
};
|
|
277
|
-
/**
|
|
278
|
-
* proper clientwindow -> form assignment
|
|
279
|
-
*
|
|
280
|
-
* @param forms the forms to append the viewstate to
|
|
281
|
-
* @param clientWindow the final viewstate
|
|
282
|
-
*/
|
|
283
|
-
ResponseProcessor.prototype.appendClientWindowToForms = function (forms, clientWindow) {
|
|
284
|
-
this.assignState(forms, Const_1.SEL_CLIENT_WINDOW_ELEM, clientWindow);
|
|
285
|
-
};
|
|
286
|
-
/**
|
|
287
|
-
* generic append state which appends a certain state as hidden element to an existing set of forms
|
|
288
|
-
*
|
|
289
|
-
* @param forms the forms to append or change to
|
|
290
|
-
* @param selector the selector for the state
|
|
291
|
-
* @param state the state itself which needs to be assigned
|
|
292
|
-
*
|
|
293
|
-
* @private
|
|
294
|
-
*/
|
|
295
|
-
ResponseProcessor.prototype.assignState = function (forms, selector, state) {
|
|
296
|
-
forms.each(function (form) {
|
|
297
|
-
var stateHolders = form.querySelectorAll(selector)
|
|
298
|
-
.orElseLazy(function () { return ResponseProcessor.newViewStateElement(form); });
|
|
299
|
-
stateHolders.attr("value").value = state;
|
|
300
|
-
});
|
|
301
|
-
};
|
|
302
|
-
/**
|
|
303
|
-
* Helper to Create a new JSF ViewState Element
|
|
304
|
-
*
|
|
305
|
-
* @param parent, the parent node to attach the viewstate element to
|
|
306
|
-
* (usually a form node)
|
|
307
|
-
*/
|
|
308
|
-
ResponseProcessor.newViewStateElement = function (parent) {
|
|
309
|
-
var newViewState = mona_dish_1.DQ.fromMarkup(Const_1.HTML_VIEWSTATE);
|
|
310
|
-
newViewState.appendTo(parent);
|
|
311
|
-
return newViewState;
|
|
312
|
-
};
|
|
313
|
-
/**
|
|
314
|
-
* Stores certain aspects of the dom for later post processing
|
|
315
|
-
*
|
|
316
|
-
* @param updateForms the update forms which should receive standardized internal jsf data
|
|
317
|
-
* @param toBeEvaled the resulting elements which should be evaled
|
|
318
|
-
*/
|
|
319
|
-
ResponseProcessor.prototype.storeForPostProcessing = function (updateForms, toBeEvaled) {
|
|
320
|
-
this.storeForUpdate(updateForms);
|
|
321
|
-
this.storeForEval(toBeEvaled);
|
|
322
|
-
};
|
|
323
|
-
/**
|
|
324
|
-
* helper to store a given form for the update post processing (viewstate)
|
|
325
|
-
*
|
|
326
|
-
* @param updateForms the dom query object pointing to the forms which need to be updated
|
|
327
|
-
*/
|
|
328
|
-
ResponseProcessor.prototype.storeForUpdate = function (updateForms) {
|
|
329
|
-
this.internalContext.assign(Const_1.UPDATE_FORMS).value.push(updateForms);
|
|
330
|
-
};
|
|
331
|
-
/**
|
|
332
|
-
* same for eval (js and css)
|
|
333
|
-
*
|
|
334
|
-
* @param toBeEvaled
|
|
335
|
-
*/
|
|
336
|
-
ResponseProcessor.prototype.storeForEval = function (toBeEvaled) {
|
|
337
|
-
this.internalContext.assign(Const_1.UPDATE_ELEMS).value.push(toBeEvaled);
|
|
338
|
-
};
|
|
339
|
-
/**
|
|
340
|
-
* check whether a given XMLQuery node is an explicit viewstate node
|
|
341
|
-
*
|
|
342
|
-
* @param node the node to check
|
|
343
|
-
* @returns true of it ii
|
|
344
|
-
*/
|
|
345
|
-
ResponseProcessor.isViewStateNode = function (node) {
|
|
346
|
-
var _a, _b, _c, _d, _e, _f;
|
|
347
|
-
var separatorChar = window.jsf.separatorchar;
|
|
348
|
-
return "undefined" != typeof ((_a = node === null || node === void 0 ? void 0 : node.id) === null || _a === void 0 ? void 0 : _a.value) && (((_b = node === null || node === void 0 ? void 0 : node.id) === null || _b === void 0 ? void 0 : _b.value) == Const_1.P_VIEWSTATE ||
|
|
349
|
-
((_d = (_c = node === null || node === void 0 ? void 0 : node.id) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.indexOf([separatorChar, Const_1.P_VIEWSTATE].join(Const_1.EMPTY_STR))) != -1 ||
|
|
350
|
-
((_f = (_e = node === null || node === void 0 ? void 0 : node.id) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.indexOf([Const_1.P_VIEWSTATE, separatorChar].join(Const_1.EMPTY_STR))) != -1);
|
|
351
|
-
};
|
|
352
|
-
/**
|
|
353
|
-
* incoming client window node also needs special processing
|
|
354
|
-
*
|
|
355
|
-
* @param node the node to check
|
|
356
|
-
* @returns true of it ii
|
|
357
|
-
*/
|
|
358
|
-
ResponseProcessor.isClientWindowNode = function (node) {
|
|
359
|
-
var _a, _b, _c, _d, _e, _f;
|
|
360
|
-
var separatorChar = window.jsf.separatorchar;
|
|
361
|
-
return "undefined" != typeof ((_a = node === null || node === void 0 ? void 0 : node.id) === null || _a === void 0 ? void 0 : _a.value) && (((_b = node === null || node === void 0 ? void 0 : node.id) === null || _b === void 0 ? void 0 : _b.value) == Const_1.P_CLIENT_WINDOW ||
|
|
362
|
-
((_d = (_c = node === null || node === void 0 ? void 0 : node.id) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.indexOf([separatorChar, Const_1.P_CLIENT_WINDOW].join(Const_1.EMPTY_STR))) != -1 ||
|
|
363
|
-
((_f = (_e = node === null || node === void 0 ? void 0 : node.id) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.indexOf([Const_1.P_CLIENT_WINDOW, separatorChar].join(Const_1.EMPTY_STR))) != -1);
|
|
364
|
-
};
|
|
365
|
-
return ResponseProcessor;
|
|
366
|
-
}());
|
|
367
|
-
exports.ResponseProcessor = ResponseProcessor;
|
|
368
|
-
//# sourceMappingURL=ResponseProcessor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResponseProcessor.js","sourceRoot":"","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CAAC,KAAI,CAAC,CAAC;YAC5E,CAAA,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,0CAAE,KAAK,0CAAE,OAAO,CAAC,CAAC,mBAAW,EAAE,aAAa,CAAC,CAAC,IAAI,CAAC,iBAAS,CAAC,CAAC,KAAI,CAAC,CAAC,CAAC,CAAC;IACtF,CAAC;IAED;;;;;OAKG;IACY,oCAAkB,GAAjC,UAAkC,IAAc;;QAC5C,IAAI,aAAa,GAAS,MAAO,CAAC,GAAG,CAAC,aAAa,CAAC;QACpD,OAAO,WAAW,IAAI,OAAO,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,0CAAE,KAAK,CAAA,IAAI,CAAC,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,0CAAE,KAAK,KAAI,uBAAe;YAC/E,CAAA,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,0CAAE,KAAK,0CAAE,OAAO,CAAC,CAAC,aAAa,EAAE,uBAAe,CAAC,CAAC,IAAI,CAAC,iBAAS,CAAC,CAAC,KAAI,CAAC,CAAC;YAChF,CAAA,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,0CAAE,KAAK,0CAAE,OAAO,CAAC,CAAC,uBAAe,EAAE,aAAa,CAAC,CAAC,IAAI,CAAC,iBAAS,CAAC,CAAC,KAAI,CAAC,CAAC,CAAC,CAAC;IAC1F,CAAC;IAEL,wBAAC;AAAD,CAAC,AA1WD,IA0WC;AA1WY,8CAAiB"}
|
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
18
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
19
|
-
if (ar || !(i in from)) {
|
|
20
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
21
|
-
ar[i] = from[i];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.XhrFormData = void 0;
|
|
28
|
-
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
29
|
-
* contributor license agreements. See the NOTICE file distributed with
|
|
30
|
-
* this work for additional information regarding copyright ownership.
|
|
31
|
-
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
32
|
-
* (the "License"); you may not use this file except in compliance with
|
|
33
|
-
* the License. You may obtain a copy of the License at
|
|
34
|
-
*
|
|
35
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
36
|
-
*
|
|
37
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
38
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
39
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
40
|
-
* See the License for the specific language governing permissions and
|
|
41
|
-
* limitations under the License.
|
|
42
|
-
*/
|
|
43
|
-
var mona_dish_1 = require("mona-dish");
|
|
44
|
-
var mona_dish_2 = require("mona-dish");
|
|
45
|
-
var isString = mona_dish_1.Lang.isString;
|
|
46
|
-
var Const_1 = require("../core/Const");
|
|
47
|
-
/**
|
|
48
|
-
* A unified form data class
|
|
49
|
-
* which builds upon our configuration.
|
|
50
|
-
*
|
|
51
|
-
* We cannot use standard html5 forms everywhere
|
|
52
|
-
* due to api constraints on the HTML Form object in IE11
|
|
53
|
-
* and due to the url encoding constraint given by the jsf.js spec
|
|
54
|
-
*
|
|
55
|
-
* TODO not ideal. too many encoding calls
|
|
56
|
-
* probably only one needed and one overlay!
|
|
57
|
-
* the entire fileinput storing probably is redundant now
|
|
58
|
-
* that domquery has been fixed
|
|
59
|
-
*/
|
|
60
|
-
var XhrFormData = /** @class */ (function (_super) {
|
|
61
|
-
__extends(XhrFormData, _super);
|
|
62
|
-
/**
|
|
63
|
-
* data collector from a given form
|
|
64
|
-
*
|
|
65
|
-
* @param dataSource either a form as DomQuery object or an encoded url string
|
|
66
|
-
* @param partialIdsArray partial ids to collect, to reduce the data sent down
|
|
67
|
-
*/
|
|
68
|
-
function XhrFormData(dataSource, partialIdsArray, encode) {
|
|
69
|
-
if (encode === void 0) { encode = true; }
|
|
70
|
-
var _this = _super.call(this, {}) || this;
|
|
71
|
-
_this.dataSource = dataSource;
|
|
72
|
-
_this.partialIdsArray = partialIdsArray;
|
|
73
|
-
_this.encode = encode;
|
|
74
|
-
_this.fileInputs = {};
|
|
75
|
-
//a call to getViewState before must pass the encoded line
|
|
76
|
-
//a call from getViewState passes the form element as datasource
|
|
77
|
-
//so we have two call points
|
|
78
|
-
if (isString(dataSource)) {
|
|
79
|
-
_this.assignEncodedString(_this.dataSource);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
_this.handleFormSource();
|
|
83
|
-
}
|
|
84
|
-
return _this;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* generic application of ids
|
|
88
|
-
* @param executes
|
|
89
|
-
*/
|
|
90
|
-
XhrFormData.prototype.applyFileInputs = function () {
|
|
91
|
-
var _this = this;
|
|
92
|
-
var executes = [];
|
|
93
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
94
|
-
executes[_i] = arguments[_i];
|
|
95
|
-
}
|
|
96
|
-
var fetchInput = function (id) {
|
|
97
|
-
if (id == "@all") {
|
|
98
|
-
return mona_dish_2.DQ.querySelectorAllDeep("input[type='file']");
|
|
99
|
-
}
|
|
100
|
-
else if (id == "@form") {
|
|
101
|
-
return _this.dataSource.querySelectorAllDeep("input[type='file']");
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
var element = mona_dish_2.DQ.byId(id, true);
|
|
105
|
-
return _this.getFileInputs(element);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
var inputExists = function (item) {
|
|
109
|
-
return !!item.length;
|
|
110
|
-
};
|
|
111
|
-
var applyInput = function (item) {
|
|
112
|
-
_this.fileInputs[_this.resolveSubmitIdentifier(item.getAsElem(0).value)] = true;
|
|
113
|
-
};
|
|
114
|
-
mona_dish_1.LazyStream.of.apply(mona_dish_1.LazyStream, executes).map(fetchInput)
|
|
115
|
-
.filter(inputExists)
|
|
116
|
-
.each(applyInput);
|
|
117
|
-
};
|
|
118
|
-
XhrFormData.prototype.getFileInputs = function (rootElment) {
|
|
119
|
-
var _this = this;
|
|
120
|
-
var resolveFileInputs = function (item) {
|
|
121
|
-
var _a;
|
|
122
|
-
if (item.length == 1) {
|
|
123
|
-
if (item.tagName.get("booga").value.toLowerCase() == "input" &&
|
|
124
|
-
(((_a = item.attr("type")) === null || _a === void 0 ? void 0 : _a.value) || '').toLowerCase() == "file") {
|
|
125
|
-
return item;
|
|
126
|
-
}
|
|
127
|
-
return rootElment.querySelectorAllDeep("input[type='file']");
|
|
128
|
-
}
|
|
129
|
-
return _this.getFileInputs(item);
|
|
130
|
-
};
|
|
131
|
-
var itemExists = function (item) {
|
|
132
|
-
return !!(item === null || item === void 0 ? void 0 : item.length);
|
|
133
|
-
};
|
|
134
|
-
var ret = rootElment.lazyStream
|
|
135
|
-
.map(resolveFileInputs)
|
|
136
|
-
.filter(itemExists)
|
|
137
|
-
.collect(new mona_dish_1.DomQueryCollector());
|
|
138
|
-
return ret;
|
|
139
|
-
};
|
|
140
|
-
XhrFormData.prototype.handleFormSource = function () {
|
|
141
|
-
//encode and append the issuing item if not a partial ids array of ids is passed
|
|
142
|
-
/*
|
|
143
|
-
* Spec. 13.3.1
|
|
144
|
-
* Collect and encode input elements.
|
|
145
|
-
* Additionally the hidden element javax.faces.ViewState
|
|
146
|
-
* Enhancement partial page submit
|
|
147
|
-
*
|
|
148
|
-
*/
|
|
149
|
-
this.encodeSubmittableFields(this, this.dataSource, this.partialIdsArray);
|
|
150
|
-
if (this.getIf(Const_1.P_VIEWSTATE).isPresent()) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
this.applyViewState(this.dataSource);
|
|
154
|
-
};
|
|
155
|
-
/**
|
|
156
|
-
* special case viewstate handling
|
|
157
|
-
*
|
|
158
|
-
* @param form the form holding the viewstate value
|
|
159
|
-
*/
|
|
160
|
-
XhrFormData.prototype.applyViewState = function (form) {
|
|
161
|
-
var viewState = form.byId(Const_1.P_VIEWSTATE, true).inputValue;
|
|
162
|
-
this.appendIf(viewState.isPresent(), Const_1.P_VIEWSTATE).value = viewState.value;
|
|
163
|
-
};
|
|
164
|
-
/**
|
|
165
|
-
* assignes a url encoded string to this xhrFormData object
|
|
166
|
-
* as key value entry
|
|
167
|
-
* @param encoded
|
|
168
|
-
*/
|
|
169
|
-
XhrFormData.prototype.assignEncodedString = function (encoded) {
|
|
170
|
-
var keyValueEntries = decodeURIComponent(encoded).split(/&/gi);
|
|
171
|
-
this.assignString(keyValueEntries);
|
|
172
|
-
};
|
|
173
|
-
XhrFormData.prototype.assignString = function (keyValueEntries) {
|
|
174
|
-
var toMerge = new mona_dish_1.Config({});
|
|
175
|
-
mona_dish_2.Stream.of.apply(mona_dish_2.Stream, keyValueEntries).map(function (line) { return line.split(/=(.*)/gi); })
|
|
176
|
-
//special case of having keys without values
|
|
177
|
-
.map(function (keyVal) { var _a, _b; 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; })
|
|
178
|
-
.each(function (keyVal) {
|
|
179
|
-
var _a, _b;
|
|
180
|
-
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 : "";
|
|
181
|
-
});
|
|
182
|
-
//merge with overwrite but no append! (aka no double entries are allowed)
|
|
183
|
-
this.shallowMerge(toMerge);
|
|
184
|
-
};
|
|
185
|
-
// noinspection JSUnusedGlobalSymbols
|
|
186
|
-
/**
|
|
187
|
-
* @returns a Form data representation
|
|
188
|
-
*/
|
|
189
|
-
XhrFormData.prototype.toFormData = function () {
|
|
190
|
-
var _this = this;
|
|
191
|
-
var ret = new FormData();
|
|
192
|
-
mona_dish_1.LazyStream.of.apply(mona_dish_1.LazyStream, Object.keys(this.value)).filter(function (key) { return !(key in _this.fileInputs); })
|
|
193
|
-
.each(function (key) {
|
|
194
|
-
mona_dish_2.Stream.of.apply(mona_dish_2.Stream, _this.value[key]).each(function (item) { return ret.append(key, item); });
|
|
195
|
-
});
|
|
196
|
-
mona_dish_2.Stream.of.apply(mona_dish_2.Stream, Object.keys(this.fileInputs)).each(function (key) {
|
|
197
|
-
mona_dish_2.DQ.querySelectorAllDeep("[name='".concat(key, "'], [id=\"").concat(key, "\"]")).eachElem(function (elem) {
|
|
198
|
-
var _a;
|
|
199
|
-
var identifier = _this.resolveSubmitIdentifier(elem);
|
|
200
|
-
if (!((_a = elem === null || elem === void 0 ? void 0 : elem.files) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
201
|
-
ret.append(identifier, elem.value);
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
ret.append(identifier, elem.files[0]);
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
return ret;
|
|
208
|
-
};
|
|
209
|
-
XhrFormData.prototype.resolveSubmitIdentifier = function (elem) {
|
|
210
|
-
var _a;
|
|
211
|
-
var identifier = elem.name;
|
|
212
|
-
identifier = (((_a = elem === null || elem === void 0 ? void 0 : elem.name) !== null && _a !== void 0 ? _a : "").replace(/s+/gi, "") == "") ? elem.id : identifier;
|
|
213
|
-
return identifier;
|
|
214
|
-
};
|
|
215
|
-
/**
|
|
216
|
-
* returns an encoded string representation of our xhr form data
|
|
217
|
-
*
|
|
218
|
-
* @param defaultStr optional default value if nothing is there to encode
|
|
219
|
-
*/
|
|
220
|
-
XhrFormData.prototype.toString = function (defaultStr) {
|
|
221
|
-
var _this = this;
|
|
222
|
-
if (defaultStr === void 0) { defaultStr = Const_1.EMPTY_STR; }
|
|
223
|
-
if (this.isAbsent()) {
|
|
224
|
-
return defaultStr;
|
|
225
|
-
}
|
|
226
|
-
var entries = mona_dish_1.LazyStream.of.apply(mona_dish_1.LazyStream, Object.keys(this.value)).filter(function (key) { return _this.value.hasOwnProperty(key); })
|
|
227
|
-
.flatMap(function (key) { return mona_dish_2.Stream.of.apply(mona_dish_2.Stream, _this.value[key]).map(function (val) { return [key, val]; }).collect(new mona_dish_1.ArrayCollector()); })
|
|
228
|
-
.map(function (keyVal) {
|
|
229
|
-
return "".concat(encodeURIComponent(keyVal[0]), "=").concat(encodeURIComponent(keyVal[1]));
|
|
230
|
-
})
|
|
231
|
-
.collect(new mona_dish_1.ArrayCollector());
|
|
232
|
-
return entries.join("&");
|
|
233
|
-
};
|
|
234
|
-
/**
|
|
235
|
-
* determines fields to submit
|
|
236
|
-
* @param {Object} targetBuf - the target form buffer receiving the data
|
|
237
|
-
* @param {Node} parentItem - form element item is nested in
|
|
238
|
-
* @param {Array} partialIds - ids fo PPS
|
|
239
|
-
*/
|
|
240
|
-
XhrFormData.prototype.encodeSubmittableFields = function (targetBuf, parentItem, partialIds) {
|
|
241
|
-
var toEncode = null;
|
|
242
|
-
if (this.partialIdsArray && this.partialIdsArray.length) {
|
|
243
|
-
//in case of our myfaces reduced ppr we only
|
|
244
|
-
//only submit the partials
|
|
245
|
-
this._value = {};
|
|
246
|
-
toEncode = new (mona_dish_2.DQ.bind.apply(mona_dish_2.DQ, __spreadArray([void 0], this.partialIdsArray, false)))();
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
if (parentItem.isAbsent())
|
|
250
|
-
throw "NO_PARITEM";
|
|
251
|
-
toEncode = parentItem;
|
|
252
|
-
}
|
|
253
|
-
//lets encode the form elements
|
|
254
|
-
this.shallowMerge(toEncode.deepElements.encodeFormElement());
|
|
255
|
-
};
|
|
256
|
-
Object.defineProperty(XhrFormData.prototype, "isMultipartRequest", {
|
|
257
|
-
/**
|
|
258
|
-
* checks if the given datasource is a multipart request source
|
|
259
|
-
* multipart is only needed if one of the executes is a file input
|
|
260
|
-
* since file inputs are stateless, they fall out of the viewstate
|
|
261
|
-
* and need special handling
|
|
262
|
-
*/
|
|
263
|
-
get: function () {
|
|
264
|
-
return !!Object.keys(this.fileInputs).length;
|
|
265
|
-
},
|
|
266
|
-
enumerable: false,
|
|
267
|
-
configurable: true
|
|
268
|
-
});
|
|
269
|
-
return XhrFormData;
|
|
270
|
-
}(mona_dish_1.Config));
|
|
271
|
-
exports.XhrFormData = XhrFormData;
|
|
272
|
-
//# sourceMappingURL=XhrFormData.js.map
|