jsf.js_next_gen 4.0.0-RC.3 → 4.0.0-RC.30
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/docs/assets/main.js +56 -52
- package/dist/docs/assets/style.css +23 -0
- package/dist/window/faces-development.js +2860 -2999
- 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.LICENSE.txt +0 -2
- 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 +2865 -3004
- 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.LICENSE.txt +0 -2
- 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 +16 -16
- package/src/main/test.xml +23 -0
- package/src/main/typescript/@types/definitions/index.d.ts +12 -7
- package/src/main/typescript/api/_api.ts +4 -3
- package/src/main/typescript/impl/AjaxImpl.ts +125 -41
- package/src/main/typescript/impl/core/Const.ts +52 -41
- package/src/main/typescript/impl/util/Assertions.ts +16 -8
- package/src/main/typescript/impl/util/ExtDomQuery.ts +12 -4
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +89 -0
- package/src/main/typescript/impl/util/Lang.ts +9 -11
- package/src/main/typescript/impl/util/URLCodec.ts +71 -0
- package/src/main/typescript/impl/xhrCore/ErrorData.ts +15 -10
- package/src/main/typescript/impl/xhrCore/EventData.ts +2 -2
- package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +15 -1
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +69 -24
- package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +4 -4
- package/src/main/typescript/impl/xhrCore/Response.ts +55 -38
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +173 -98
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +64 -158
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +36 -21
- package/src/main/typescript/myfaces/OamSubmit.ts +29 -13
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +1 -1
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +72 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +40 -1
- package/src/main/typescript/test/impl/ImplTest.spec.ts +3 -3
- package/src/main/typescript/test/impl/ImplTest_23.spec.ts +3 -3
- package/src/main/typescript/test/xhrCore/EventTests.spec.ts +1 -1
- package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +2 -0
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +203 -0
- package/src/main/typescript/test/xhrCore/OamSubmitTest.spec.ts +177 -0
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +128 -15
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +70 -3
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +39 -3
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +372 -34
- package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +43 -9
- package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +67 -49
- package/src/main/typescript/test.xml +6 -0
- package/src/main/typescript/tsconfig.json +2 -2
- package/src/test/resources/jsf-development.js +1 -1
- package/src/tmp/test.html +12 -88
- package/target/api/_api.js +16 -29
- package/target/api/_api.js.map +1 -1
- package/target/api/faces.js +4 -4
- package/target/api/faces.js.map +1 -1
- package/target/api/jsf.js +9 -9
- package/target/api/jsf.js.map +1 -1
- package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
- package/target/impl/AjaxImpl.js +155 -89
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/PushImpl.js +45 -48
- package/target/impl/PushImpl.js.map +1 -1
- package/target/impl/core/Const.js +52 -40
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/core/Context.js +10 -0
- package/target/impl/core/Context.js.map +1 -0
- package/target/impl/core/ImplTypes.js +9 -14
- package/target/impl/core/ImplTypes.js.map +1 -1
- package/target/impl/i18n/Messages.js +3 -4
- package/target/impl/i18n/Messages.js.map +1 -1
- package/target/impl/util/Assertions.js +20 -24
- package/target/impl/util/Assertions.js.map +1 -1
- package/target/impl/util/AsyncQueue.js +28 -36
- package/target/impl/util/AsyncQueue.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +153 -221
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/HiddenElementBuilder.js +7 -0
- package/target/impl/util/HiddenElementBuilder.js.map +1 -0
- package/target/impl/util/HiddenInputBuilder.js +79 -0
- package/target/impl/util/HiddenInputBuilder.js.map +1 -0
- package/target/impl/util/Lang.js +23 -32
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/util/URLCodec.js +69 -0
- package/target/impl/util/URLCodec.js.map +1 -0
- package/target/impl/xhrCore/ErrorData.js +41 -64
- package/target/impl/xhrCore/ErrorData.js.map +1 -1
- package/target/impl/xhrCore/EventData.js +10 -13
- package/target/impl/xhrCore/EventData.js.map +1 -1
- package/target/impl/xhrCore/RequestContext.js +11 -0
- package/target/impl/xhrCore/RequestContext.js.map +1 -0
- package/target/impl/xhrCore/RequestDataResolver.js +71 -27
- package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
- package/target/impl/xhrCore/ResonseDataResolver.js +16 -16
- package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
- package/target/impl/xhrCore/Response.js +43 -28
- package/target/impl/xhrCore/Response.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +217 -162
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +77 -199
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +102 -103
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +33 -24
- package/target/myfaces/OamSubmit.js.map +1 -1
- package/target/test/frameworkBase/LangTest.spec.js +46 -32
- package/target/test/frameworkBase/LangTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +238 -228
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js +45 -31
- package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/MappingProbes.js +24 -33
- package/target/test/frameworkBase/_ext/monadish/MappingProbes.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js +8 -8
- package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +31 -31
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/StreamTest.spec.js +50 -48
- package/target/test/frameworkBase/_ext/monadish/StreamTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +310 -132
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js +235 -22
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
- package/target/test/impl/ImplTest.spec.js +32 -59
- package/target/test/impl/ImplTest.spec.js.map +1 -1
- package/target/test/impl/ImplTest_23.spec.js +32 -59
- package/target/test/impl/ImplTest_23.spec.js.map +1 -1
- package/target/test/impl/SeparatorCharsTest.spec.js +17 -17
- package/target/test/impl/SeparatorCharsTest.spec.js.map +1 -1
- package/target/test/myfaces/OamSubmit.spec.js +25 -25
- package/target/test/myfaces/OamSubmit.spec.js.map +1 -1
- package/target/test/queue/AsynchronousProbe.js +23 -29
- package/target/test/queue/AsynchronousProbe.js.map +1 -1
- package/target/test/queue/AsynchronousQueueTest.spec.js +39 -70
- package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
- package/target/test/xhrCore/EventTests.spec.js +43 -74
- package/target/test/xhrCore/EventTests.spec.js.map +1 -1
- package/target/test/xhrCore/FakeWebsocket.js +14 -16
- package/target/test/xhrCore/FakeWebsocket.js.map +1 -1
- package/target/test/xhrCore/FileUploadTest.spec.js +47 -77
- package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +204 -0
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -0
- package/target/test/xhrCore/OamSubmitTest.spec.js +180 -0
- package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -0
- package/target/test/xhrCore/RequestParamsTest.spec.js +143 -72
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +173 -149
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +127 -142
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +415 -100
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest23.spec.js +152 -91
- package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
- package/target/test/xhrCore/ShadowDomTest.spec.js +30 -61
- package/target/test/xhrCore/ShadowDomTest.spec.js.map +1 -1
- package/target/test/xhrCore/WebsocketTest.js +60 -93
- package/target/test/xhrCore/WebsocketTest.js.map +1 -1
- package/target/test/xhrCore/XhrFormDataTest.spec.js +79 -30
- package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -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 +24 -0
- package/target/test-classes/jsf-development.js +3559 -0
- 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 +1 -0
- package/target/test-classes/jsf.js +3 -0
- package/target/test-classes/jsf.js.br +0 -0
- package/target/test-classes/jsf.js.gz +0 -0
- package/tmp.xml +36 -0
|
@@ -20,23 +20,23 @@ import {ResponseProcessor} from "./ResponseProcessor";
|
|
|
20
20
|
import {IResponseProcessor} from "./IResponseProcessor";
|
|
21
21
|
import {
|
|
22
22
|
$nsp,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
XML_TAG_ATTRIBUTES,
|
|
24
|
+
XML_TAG_CHANGES,
|
|
25
|
+
XML_TAG_DELETE,
|
|
26
|
+
XML_TAG_ERROR,
|
|
27
|
+
XML_TAG_EVAL,
|
|
28
|
+
XML_TAG_EXTENSION,
|
|
29
|
+
XML_TAG_INSERT,
|
|
30
|
+
XML_TAG_REDIRECT,
|
|
31
|
+
XML_TAG_UPDATE, P_RESOURCE,
|
|
32
32
|
P_VIEWBODY,
|
|
33
33
|
P_VIEWHEAD,
|
|
34
34
|
P_VIEWROOT,
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
NAMING_CONTAINER_ID,
|
|
36
|
+
XML_TAG_PARTIAL_RESP,
|
|
37
37
|
RESPONSE_XML,
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
XML_TAG_AFTER,
|
|
39
|
+
XML_TAG_BEFORE, NAMED_VIEWROOT, XML_ATTR_NAMED_VIEWROOT, P_VIEWSTATE, $faces
|
|
40
40
|
} from "../core/Const";
|
|
41
41
|
import {resolveContexts, resolveResponseXML} from "./ResonseDataResolver";
|
|
42
42
|
import {ExtConfig} from "../util/ExtDomQuery";
|
|
@@ -67,7 +67,7 @@ export module Response {
|
|
|
67
67
|
internalContext.assign(RESPONSE_XML).value = responseXML;
|
|
68
68
|
|
|
69
69
|
// we now process the partial tags, or in none given raise an error
|
|
70
|
-
responseXML.querySelectorAll(
|
|
70
|
+
responseXML.querySelectorAll(XML_TAG_PARTIAL_RESP)
|
|
71
71
|
.each(item => processPartialTag(<XMLQuery>item, responseProcessor, internalContext));
|
|
72
72
|
|
|
73
73
|
// We now process the viewStates, client windows and the elements to be evaluated are delayed.
|
|
@@ -76,6 +76,7 @@ export module Response {
|
|
|
76
76
|
// doing any evaluations even on embedded scripts.
|
|
77
77
|
// Usually this does not matter, the client window comes in almost last always anyway
|
|
78
78
|
// we maybe drop this deferred assignment in the future, but myfaces did it until now.
|
|
79
|
+
responseProcessor.updateNamedViewRootState();
|
|
79
80
|
responseProcessor.fixViewStates();
|
|
80
81
|
responseProcessor.fixClientWindow();
|
|
81
82
|
responseProcessor.globalEval();
|
|
@@ -86,35 +87,51 @@ export module Response {
|
|
|
86
87
|
/**
|
|
87
88
|
* highest node partial-response from there the main operations are triggered
|
|
88
89
|
*/
|
|
89
|
-
|
|
90
|
+
function processPartialTag(node: XMLQuery, responseProcessor: IResponseProcessor, internalContext) {
|
|
90
91
|
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
|
|
93
|
+
/*
|
|
94
|
+
https://javaee.github.io/javaserverfaces/docs/2.2/javadocs/web-partialresponse.html#ns_xsd
|
|
95
|
+
The "partial-response" element is the root of the partial response information hierarchy,
|
|
96
|
+
and contains nested elements for all possible elements that can exist in the response.
|
|
97
|
+
This element must have an "id" attribute whose value is the return from calling getContainerClientId()
|
|
98
|
+
on the UIViewRoot to which this response pertains.
|
|
99
|
+
*/
|
|
100
|
+
// we can determine whether we are in a naming container scenario by checking whether the passed view id is present in the page
|
|
101
|
+
// under or in body as identifier
|
|
102
|
+
|
|
103
|
+
let partialId:string = node?.id?.value;
|
|
104
|
+
internalContext.assignIf(!!partialId, NAMING_CONTAINER_ID).value = partialId; // second case mojarra
|
|
105
|
+
|
|
106
|
+
// there must be at least one container viewstate element resembling the viewroot that we know
|
|
107
|
+
// this is named
|
|
108
|
+
responseProcessor.updateNamedViewRootState();
|
|
109
|
+
|
|
110
|
+
const SEL_SUB_TAGS = [XML_TAG_ERROR, XML_TAG_REDIRECT, XML_TAG_CHANGES].join(",");
|
|
93
111
|
|
|
94
112
|
// now we can process the main operations
|
|
95
113
|
node.querySelectorAll(SEL_SUB_TAGS).each((node: XMLQuery) => {
|
|
96
114
|
switch (node.tagName.value) {
|
|
97
|
-
case
|
|
115
|
+
case XML_TAG_ERROR:
|
|
98
116
|
responseProcessor.error(node);
|
|
99
117
|
break;
|
|
100
|
-
case
|
|
118
|
+
case XML_TAG_REDIRECT:
|
|
101
119
|
responseProcessor.redirect(node);
|
|
102
120
|
break;
|
|
103
|
-
case
|
|
121
|
+
case XML_TAG_CHANGES:
|
|
104
122
|
processChangesTag(node, responseProcessor);
|
|
105
123
|
break;
|
|
106
124
|
}
|
|
107
125
|
});
|
|
108
|
-
|
|
109
126
|
}
|
|
110
127
|
|
|
111
128
|
let processInsert = function (responseProcessor: IResponseProcessor, node: XMLQuery) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
129
|
+
// path1 insert after as child tags
|
|
130
|
+
if(node.querySelectorAll([XML_TAG_BEFORE, XML_TAG_AFTER].join(",")).length) {
|
|
131
|
+
responseProcessor.insertWithSubTags(node);
|
|
132
|
+
} else { // insert before after with id
|
|
133
|
+
responseProcessor.insert(node);
|
|
134
|
+
}
|
|
118
135
|
|
|
119
136
|
};
|
|
120
137
|
|
|
@@ -124,32 +141,32 @@ export module Response {
|
|
|
124
141
|
* @param node
|
|
125
142
|
* @param responseProcessor
|
|
126
143
|
*/
|
|
127
|
-
|
|
128
|
-
const ALLOWED_TAGS = [
|
|
144
|
+
function processChangesTag(node: XMLQuery, responseProcessor: IResponseProcessor): boolean {
|
|
145
|
+
const ALLOWED_TAGS = [XML_TAG_UPDATE, XML_TAG_EVAL, XML_TAG_INSERT, XML_TAG_DELETE, XML_TAG_ATTRIBUTES, XML_TAG_EXTENSION].join(", ");
|
|
129
146
|
node.querySelectorAll(ALLOWED_TAGS).each(
|
|
130
147
|
(node: XMLQuery) => {
|
|
131
148
|
switch (node.tagName.value) {
|
|
132
|
-
case
|
|
149
|
+
case XML_TAG_UPDATE:
|
|
133
150
|
processUpdateTag(node, responseProcessor);
|
|
134
151
|
break;
|
|
135
152
|
|
|
136
|
-
case
|
|
153
|
+
case XML_TAG_EVAL:
|
|
137
154
|
responseProcessor.eval(node);
|
|
138
155
|
break;
|
|
139
156
|
|
|
140
|
-
case
|
|
157
|
+
case XML_TAG_INSERT:
|
|
141
158
|
processInsert(responseProcessor, node);
|
|
142
159
|
break;
|
|
143
160
|
|
|
144
|
-
case
|
|
161
|
+
case XML_TAG_DELETE:
|
|
145
162
|
responseProcessor.delete(node);
|
|
146
163
|
break;
|
|
147
164
|
|
|
148
|
-
case
|
|
165
|
+
case XML_TAG_ATTRIBUTES:
|
|
149
166
|
responseProcessor.attributes(node);
|
|
150
167
|
break;
|
|
151
168
|
|
|
152
|
-
case
|
|
169
|
+
case XML_TAG_EXTENSION:
|
|
153
170
|
break;
|
|
154
171
|
}
|
|
155
172
|
}
|
|
@@ -177,8 +194,8 @@ export module Response {
|
|
|
177
194
|
* @param node
|
|
178
195
|
* @param responseProcessor
|
|
179
196
|
*/
|
|
180
|
-
|
|
181
|
-
|
|
197
|
+
function processUpdateTag(node: XMLQuery, responseProcessor: IResponseProcessor) {
|
|
198
|
+
// early state storing, if no state we perform a normal update cycle
|
|
182
199
|
if (!storeState(responseProcessor, node)) {
|
|
183
200
|
handleElementUpdate(node, responseProcessor);
|
|
184
201
|
}
|
|
@@ -190,7 +207,7 @@ export module Response {
|
|
|
190
207
|
* @param node
|
|
191
208
|
* @param responseProcessor
|
|
192
209
|
*/
|
|
193
|
-
|
|
210
|
+
function handleElementUpdate(node: XMLQuery, responseProcessor: IResponseProcessor) {
|
|
194
211
|
let cdataBlock = node.cDATAAsString;
|
|
195
212
|
switch (node.id.value) {
|
|
196
213
|
case $nsp(P_VIEWROOT) :
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {Config, DomQuery, DQ, Lang, Stream, XMLQuery} from "mona-dish";
|
|
17
|
+
import {Config, DomQuery, DomQueryCollector, DQ, DQ$, Lang, LazyStream, Stream, XMLQuery} from "mona-dish";
|
|
18
18
|
import {Implementation} from "../AjaxImpl";
|
|
19
19
|
import {Assertions} from "../util/Assertions";
|
|
20
20
|
import {IResponseProcessor} from "./IResponseProcessor";
|
|
@@ -23,6 +23,7 @@ import {StateHolder} from "../core/ImplTypes";
|
|
|
23
23
|
import {EventData} from "./EventData";
|
|
24
24
|
|
|
25
25
|
import {
|
|
26
|
+
$faces,
|
|
26
27
|
$nsp,
|
|
27
28
|
APPLIED_CLIENT_WINDOW,
|
|
28
29
|
APPLIED_VST,
|
|
@@ -30,32 +31,40 @@ import {
|
|
|
30
31
|
ATTR_NAME,
|
|
31
32
|
ATTR_URL,
|
|
32
33
|
ATTR_VALUE,
|
|
34
|
+
DEFERRED_HEAD_INSERTS,
|
|
33
35
|
EMPTY_FUNC,
|
|
34
36
|
EMPTY_STR,
|
|
35
37
|
ERROR_MESSAGE,
|
|
36
38
|
ERROR_NAME,
|
|
37
|
-
|
|
39
|
+
HTML_TAG_BODY,
|
|
40
|
+
HTML_TAG_FORM,
|
|
41
|
+
HTML_TAG_HEAD,
|
|
42
|
+
HTML_TAG_LINK,
|
|
43
|
+
HTML_TAG_SCRIPT,
|
|
44
|
+
HTML_TAG_STYLE, IDENT_ALL, IDENT_NONE, NAMED_VIEWROOT,
|
|
38
45
|
ON_ERROR,
|
|
39
|
-
ON_EVENT,
|
|
46
|
+
ON_EVENT,
|
|
47
|
+
P_CLIENT_WINDOW,
|
|
48
|
+
P_EXECUTE,
|
|
40
49
|
P_PARTIAL_SOURCE,
|
|
50
|
+
P_RENDER,
|
|
51
|
+
P_RENDER_OVERRIDE,
|
|
41
52
|
P_VIEWSTATE,
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
NAMING_CONTAINER_ID,
|
|
54
|
+
RESPONSE_XML,
|
|
55
|
+
SEL_CLIENT_WINDOW_ELEM,
|
|
44
56
|
SEL_VIEWSTATE_ELEM,
|
|
45
57
|
SOURCE,
|
|
46
58
|
SUCCESS,
|
|
47
|
-
TAG_AFTER,
|
|
48
|
-
TAG_ATTR,
|
|
49
|
-
TAG_BEFORE,
|
|
50
|
-
TAG_BODY,
|
|
51
|
-
TAG_FORM,
|
|
52
|
-
TAG_HEAD,
|
|
53
59
|
UPDATE_ELEMS,
|
|
54
60
|
UPDATE_FORMS,
|
|
55
|
-
|
|
61
|
+
XML_TAG_AFTER,
|
|
62
|
+
XML_TAG_ATTR,
|
|
63
|
+
XML_TAG_BEFORE
|
|
56
64
|
} from "../core/Const";
|
|
57
|
-
import trim = Lang.trim;
|
|
58
65
|
import {ExtConfig, ExtDomQuery} from "../util/ExtDomQuery";
|
|
66
|
+
import {HiddenInputBuilder} from "../util/HiddenInputBuilder";
|
|
67
|
+
import trim = Lang.trim;
|
|
59
68
|
|
|
60
69
|
|
|
61
70
|
/**
|
|
@@ -82,31 +91,38 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
82
91
|
* the data incoming must represent the html representation of the head itself one way or the other
|
|
83
92
|
*/
|
|
84
93
|
replaceHead(shadowDocument: XMLQuery | DQ) {
|
|
85
|
-
|
|
94
|
+
const shadowHead = shadowDocument.querySelectorAll(HTML_TAG_HEAD);
|
|
86
95
|
if (!shadowHead.isPresent()) {
|
|
87
96
|
return;
|
|
88
97
|
}
|
|
98
|
+
const head = ExtDomQuery.querySelectorAll(HTML_TAG_HEAD);
|
|
99
|
+
// full replace we delete everything
|
|
100
|
+
head.childNodes.delete();
|
|
101
|
+
this.addToHead(shadowHead);
|
|
102
|
+
//we copy the attributes as well (just in case myfaces introduces the id in head)
|
|
103
|
+
head.copyAttrs(shadowHead);
|
|
104
|
+
}
|
|
89
105
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
106
|
+
addToHead(shadowHead: XMLQuery | DQ) {
|
|
107
|
+
const mappedHeadData = new ExtDomQuery(shadowHead);
|
|
108
|
+
const scriptTags = [HTML_TAG_SCRIPT];
|
|
109
|
+
const nonExecutables = mappedHeadData.filter(item => scriptTags.indexOf(item.tagName.orElse("").value) == -1);
|
|
110
|
+
nonExecutables.runHeadInserts(true);
|
|
94
111
|
|
|
95
|
-
// we cannot replace new elements in the head, but we can eval the elements
|
|
96
|
-
// eval means the scripts will get attached (eval script attach method)
|
|
97
|
-
// but this is done by DomQuery not in this code
|
|
98
|
-
this.storeForEval(shadowHead);
|
|
99
112
|
//incoming either the outer head tag or its children
|
|
100
|
-
|
|
101
|
-
//this
|
|
113
|
+
const nodesToAdd = (shadowHead.tagName.value === "HEAD") ? shadowHead.childNodes : shadowHead;
|
|
114
|
+
// this is stored for "post" processing
|
|
115
|
+
// after the rest of the "physical build up", head before body
|
|
116
|
+
const scriptElements = nodesToAdd.stream
|
|
117
|
+
.filter(item => scriptTags.indexOf(item.tagName.orElse("").value) != -1).collect(new DomQueryCollector());
|
|
118
|
+
|
|
119
|
+
this.addToHeadDeferred(scriptElements);
|
|
102
120
|
}
|
|
103
121
|
|
|
104
|
-
|
|
122
|
+
addToHeadDeferred(newElements: XMLQuery | DQ) {
|
|
105
123
|
this.internalContext.assign(DEFERRED_HEAD_INSERTS).value.push(newElements);
|
|
106
124
|
}
|
|
107
125
|
|
|
108
|
-
|
|
109
|
-
|
|
110
126
|
/**
|
|
111
127
|
* replaces the body in the expected manner
|
|
112
128
|
* which means the entire body content is refreshed
|
|
@@ -117,21 +133,20 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
117
133
|
*/
|
|
118
134
|
replaceBody(shadowDocument: XMLQuery | DQ) {
|
|
119
135
|
|
|
120
|
-
|
|
136
|
+
const shadowBody = shadowDocument.querySelectorAll(HTML_TAG_BODY);
|
|
121
137
|
if (!shadowBody.isPresent()) {
|
|
122
138
|
return;
|
|
123
139
|
}
|
|
124
140
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
let updateForms = resultingBody.querySelectorAll(TAG_FORM);
|
|
141
|
+
const shadowInnerHTML: string = <string>shadowBody.innerHTML;
|
|
142
|
+
const resultingBody = <DQ>ExtDomQuery.querySelectorAll(HTML_TAG_BODY);
|
|
143
|
+
const updateForms = resultingBody.querySelectorAll(HTML_TAG_FORM);
|
|
129
144
|
|
|
130
145
|
// main difference, we cannot replace the body itself, but only its content
|
|
131
146
|
// we need a separate step for post-processing the incoming
|
|
132
147
|
// attributes, like classes, styles etc...
|
|
133
|
-
resultingBody.copyAttrs(shadowBody);
|
|
134
|
-
|
|
148
|
+
(resultingBody.html(shadowInnerHTML) as DQ).copyAttrs(shadowBody);
|
|
149
|
+
this.externalContext.assign($nsp(P_RENDER_OVERRIDE)).value = "@all";
|
|
135
150
|
this.storeForPostProcessing(updateForms, resultingBody);
|
|
136
151
|
}
|
|
137
152
|
|
|
@@ -158,18 +173,18 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
158
173
|
* <error>
|
|
159
174
|
*/
|
|
160
175
|
|
|
161
|
-
|
|
176
|
+
const mergedErrorData = new ExtConfig({});
|
|
162
177
|
mergedErrorData.assign(SOURCE).value = this.externalContext.getIf(P_PARTIAL_SOURCE).get(0).value;
|
|
163
178
|
mergedErrorData.assign(ERROR_NAME).value = node.querySelectorAll(ERROR_NAME).textContent(EMPTY_STR);
|
|
164
179
|
mergedErrorData.assign(ERROR_MESSAGE).value = node.querySelectorAll(ERROR_MESSAGE).cDATAAsString;
|
|
165
180
|
|
|
166
|
-
|
|
181
|
+
const hasResponseXML = this.internalContext.get(RESPONSE_XML).isPresent();
|
|
167
182
|
|
|
168
183
|
//we now store the response xml also in the error data for further details
|
|
169
184
|
mergedErrorData.assignIf(hasResponseXML, RESPONSE_XML).value = this.internalContext.getIf(RESPONSE_XML).value.get(0).value;
|
|
170
185
|
|
|
171
186
|
// error post-processing and enrichment (standard messages from keys)
|
|
172
|
-
|
|
187
|
+
const errorData = ErrorData.fromServerError(mergedErrorData);
|
|
173
188
|
|
|
174
189
|
// we now trigger an internally stored onError function which might be an attached to the context
|
|
175
190
|
// either we do not have an internal on error, or an on error has been based via params from the outside.
|
|
@@ -187,7 +202,7 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
187
202
|
redirect(node: XMLQuery) {
|
|
188
203
|
Assertions.assertUrlExists(node);
|
|
189
204
|
|
|
190
|
-
|
|
205
|
+
const redirectUrl = trim(node.attr(ATTR_URL).value);
|
|
191
206
|
if (redirectUrl != EMPTY_STR) {
|
|
192
207
|
window.location.href = redirectUrl;
|
|
193
208
|
}
|
|
@@ -199,8 +214,8 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
199
214
|
* @param cdataBlock the cdata block with the new html code
|
|
200
215
|
*/
|
|
201
216
|
update(node: XMLQuery, cdataBlock: string) {
|
|
202
|
-
|
|
203
|
-
|
|
217
|
+
const result = ExtDomQuery.byId(node.id.value, true).outerHTML(cdataBlock, false, false);
|
|
218
|
+
const sourceForm = result?.firstParent(HTML_TAG_FORM).orElseLazy(() => result.byTagName(HTML_TAG_FORM, true));
|
|
204
219
|
if (sourceForm) {
|
|
205
220
|
this.storeForPostProcessing(sourceForm, result);
|
|
206
221
|
}
|
|
@@ -220,9 +235,9 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
220
235
|
* @param node
|
|
221
236
|
*/
|
|
222
237
|
attributes(node: XMLQuery) {
|
|
223
|
-
|
|
238
|
+
const elem = DQ.byId(node.id.value, true);
|
|
224
239
|
|
|
225
|
-
node.byTagName(
|
|
240
|
+
node.byTagName(XML_TAG_ATTR).each((item: XMLQuery) => {
|
|
226
241
|
elem.attr(item.attr(ATTR_NAME).value).value = item.attr(ATTR_VALUE).value;
|
|
227
242
|
});
|
|
228
243
|
}
|
|
@@ -243,17 +258,16 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
243
258
|
insert(node: XMLQuery) {
|
|
244
259
|
//let insertId = node.id; //not used atm
|
|
245
260
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
let insertNodes = DQ.fromMarkup(<any>node.cDATAAsString);
|
|
261
|
+
const before = node.attr(XML_TAG_BEFORE);
|
|
262
|
+
const after = node.attr(XML_TAG_AFTER);
|
|
263
|
+
const insertNodes = DQ.fromMarkup(<any>node.cDATAAsString);
|
|
250
264
|
|
|
251
265
|
if (before.isPresent()) {
|
|
252
266
|
DQ.byId(before.value, true).insertBefore(insertNodes);
|
|
253
267
|
this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);
|
|
254
268
|
}
|
|
255
269
|
if (after.isPresent()) {
|
|
256
|
-
|
|
270
|
+
const domQuery = DQ.byId(after.value, true);
|
|
257
271
|
domQuery.insertAfter(insertNodes);
|
|
258
272
|
|
|
259
273
|
this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);
|
|
@@ -266,12 +280,12 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
266
280
|
* @param node the node hosting the insert data
|
|
267
281
|
*/
|
|
268
282
|
insertWithSubTags(node: XMLQuery) {
|
|
269
|
-
|
|
270
|
-
|
|
283
|
+
const before = node.querySelectorAll(XML_TAG_BEFORE);
|
|
284
|
+
const after = node.querySelectorAll(XML_TAG_AFTER);
|
|
271
285
|
|
|
272
286
|
before.each(item => {
|
|
273
|
-
|
|
274
|
-
|
|
287
|
+
const insertId = item.attr(ATTR_ID);
|
|
288
|
+
const insertNodes = DQ.fromMarkup(<any>item.cDATAAsString);
|
|
275
289
|
if (insertId.isPresent()) {
|
|
276
290
|
DQ.byId(insertId.value, true).insertBefore(insertNodes);
|
|
277
291
|
this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);
|
|
@@ -279,8 +293,8 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
279
293
|
});
|
|
280
294
|
|
|
281
295
|
after.each(item => {
|
|
282
|
-
|
|
283
|
-
|
|
296
|
+
const insertId = item.attr(ATTR_ID);
|
|
297
|
+
const insertNodes = DQ.fromMarkup(<any>item.cDATAAsString);
|
|
284
298
|
if (insertId.isPresent()) {
|
|
285
299
|
DQ.byId(insertId.value, true).insertAfter(insertNodes);
|
|
286
300
|
this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);
|
|
@@ -295,7 +309,7 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
295
309
|
*/
|
|
296
310
|
processViewState(node: XMLQuery): boolean {
|
|
297
311
|
if (ResponseProcessor.isViewStateNode(node)) {
|
|
298
|
-
|
|
312
|
+
const state = node.cDATAAsString;
|
|
299
313
|
this.internalContext.assign(APPLIED_VST, node.id.value).value = new StateHolder($nsp(node.id.value), state);
|
|
300
314
|
return true;
|
|
301
315
|
}
|
|
@@ -304,7 +318,7 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
304
318
|
|
|
305
319
|
processClientWindow(node: XMLQuery): boolean {
|
|
306
320
|
if (ResponseProcessor.isClientWindowNode(node)) {
|
|
307
|
-
|
|
321
|
+
const state = node.cDATAAsString;
|
|
308
322
|
this.internalContext.assign(APPLIED_CLIENT_WINDOW, node.id.value).value = new StateHolder($nsp(node.id.value), state);
|
|
309
323
|
return true;
|
|
310
324
|
}
|
|
@@ -333,40 +347,54 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
333
347
|
*/
|
|
334
348
|
fixViewStates() {
|
|
335
349
|
Stream.ofAssoc<StateHolder>(this.internalContext.getIf(APPLIED_VST).orElse({}).value)
|
|
336
|
-
.each((
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
350
|
+
.each(([, value]) => {
|
|
351
|
+
const namingContainerId = this.internalContext.getIf(NAMING_CONTAINER_ID);
|
|
352
|
+
const namedViewRoot = !!this.internalContext.getIf(NAMED_VIEWROOT).value
|
|
353
|
+
const affectedForms = this.getContainerForms(namingContainerId)
|
|
354
|
+
.filter(affectedForm => this.isInExecuteOrRender(affectedForm));
|
|
341
355
|
|
|
342
|
-
this.appendViewStateToForms(
|
|
356
|
+
this.appendViewStateToForms(affectedForms, namedViewRoot, value.value, namingContainerId.orElse("").value);
|
|
343
357
|
});
|
|
344
358
|
}
|
|
345
359
|
|
|
360
|
+
|
|
361
|
+
|
|
346
362
|
/**
|
|
347
363
|
* same as with view states before applies the incoming client windows as last step after the rest of the processing
|
|
348
364
|
* is done.
|
|
349
365
|
*/
|
|
350
366
|
fixClientWindow() {
|
|
351
367
|
Stream.ofAssoc<StateHolder>(this.internalContext.getIf(APPLIED_CLIENT_WINDOW).orElse({}).value)
|
|
352
|
-
.each((
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
368
|
+
.each(([, value]) => {
|
|
369
|
+
const namingContainerId = this.internalContext.getIf(NAMING_CONTAINER_ID);
|
|
370
|
+
const namedViewRoot = !!this.internalContext.getIf(NAMED_VIEWROOT).value;
|
|
371
|
+
const affectedForms = this.getContainerForms(namingContainerId)
|
|
372
|
+
.filter(affectedForm => this.isInExecuteOrRender(affectedForm));
|
|
357
373
|
|
|
358
|
-
this.appendClientWindowToForms(
|
|
374
|
+
this.appendClientWindowToForms(affectedForms, namedViewRoot, value.value, namingContainerId.orElse("").value);
|
|
359
375
|
});
|
|
360
376
|
}
|
|
361
377
|
|
|
378
|
+
updateNamedViewRootState() {
|
|
379
|
+
let partialId = this.internalContext.getIf(NAMING_CONTAINER_ID);
|
|
380
|
+
let namedViewRoot = this.internalContext.getIf(NAMED_VIEWROOT);
|
|
381
|
+
if(partialId.isPresent() &&
|
|
382
|
+
(namedViewRoot.isAbsent() ||
|
|
383
|
+
!namedViewRoot.value)) {
|
|
384
|
+
const SEP = $faces().separatorchar;
|
|
385
|
+
this.internalContext.assign(NAMED_VIEWROOT).value = (!!document.getElementById(partialId.value)) || DQ$(`input[name*='${$nsp(P_VIEWSTATE)}']`)
|
|
386
|
+
.filter(node => node.attr("name").value.indexOf(partialId.value + SEP) == 0).length > 0;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
362
390
|
/**
|
|
363
391
|
* all processing done we can close the request and send the appropriate events
|
|
364
392
|
*/
|
|
365
393
|
done() {
|
|
366
|
-
|
|
394
|
+
const eventData = EventData.createFromRequest(this.request.value, this.externalContext, SUCCESS);
|
|
367
395
|
|
|
368
396
|
//because some frameworks might decorate them over the context in the response
|
|
369
|
-
|
|
397
|
+
const eventHandler = this.externalContext.getIf(ON_EVENT).orElseLazy(() => this.internalContext.getIf(ON_EVENT).value).orElse(EMPTY_FUNC).value;
|
|
370
398
|
Implementation.sendEvent(eventData, eventHandler);
|
|
371
399
|
}
|
|
372
400
|
|
|
@@ -375,9 +403,10 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
375
403
|
*
|
|
376
404
|
* @param forms the forms to append the viewState to
|
|
377
405
|
* @param viewState the final viewState
|
|
406
|
+
* @param namingContainerId
|
|
378
407
|
*/
|
|
379
|
-
private appendViewStateToForms(forms: DQ, viewState: string) {
|
|
380
|
-
this.assignState(forms, $nsp(SEL_VIEWSTATE_ELEM), viewState);
|
|
408
|
+
private appendViewStateToForms(forms: DQ, namedViewRoot: boolean, viewState: string, namingContainerId = "") {
|
|
409
|
+
this.assignState(forms, $nsp(SEL_VIEWSTATE_ELEM), namedViewRoot, viewState, namingContainerId);
|
|
381
410
|
}
|
|
382
411
|
|
|
383
412
|
|
|
@@ -386,9 +415,10 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
386
415
|
*
|
|
387
416
|
* @param forms the forms to append the viewState to
|
|
388
417
|
* @param clientWindow the final viewState
|
|
418
|
+
* @param namingContainerId
|
|
389
419
|
*/
|
|
390
|
-
private appendClientWindowToForms(forms: DQ, clientWindow: string) {
|
|
391
|
-
this.assignState(forms, $nsp(SEL_CLIENT_WINDOW_ELEM), clientWindow);
|
|
420
|
+
private appendClientWindowToForms(forms: DQ, namedViewRoot: boolean, clientWindow: string, namingContainerId = "") {
|
|
421
|
+
this.assignState(forms, $nsp(SEL_CLIENT_WINDOW_ELEM), namedViewRoot, clientWindow, namingContainerId);
|
|
392
422
|
}
|
|
393
423
|
|
|
394
424
|
/**
|
|
@@ -396,31 +426,32 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
396
426
|
*
|
|
397
427
|
* @param forms the forms to append or change to
|
|
398
428
|
* @param selector the selector for the state
|
|
429
|
+
* @param namedViewRoot if set to true, the name is also prefixed
|
|
399
430
|
* @param state the state itself which needs to be assigned
|
|
400
431
|
*
|
|
432
|
+
* @param namingContainerId
|
|
401
433
|
* @private
|
|
402
434
|
*/
|
|
403
|
-
private assignState(forms: DQ,
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
435
|
+
private assignState(forms: DQ, selector: string, namedViewRoot: boolean, state: string, namingContainerId: string) {
|
|
436
|
+
/**
|
|
437
|
+
* creates the viewState or client window id element
|
|
438
|
+
* @param form
|
|
439
|
+
*/
|
|
440
|
+
const createAndAppendHiddenInput = (form: DomQuery) => {
|
|
441
|
+
return new HiddenInputBuilder(selector)
|
|
442
|
+
.withNamingContainerId(namingContainerId)
|
|
443
|
+
.withParent(form)
|
|
444
|
+
.withNamedViewRoot(namedViewRoot)
|
|
445
|
+
.build();
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
forms.each(form => {
|
|
449
|
+
const hiddenInput = form.querySelectorAll(selector)
|
|
450
|
+
.orElseLazy(() => createAndAppendHiddenInput(form));
|
|
451
|
+
hiddenInput.val = state;
|
|
409
452
|
});
|
|
410
453
|
}
|
|
411
454
|
|
|
412
|
-
/**
|
|
413
|
-
* Helper to Create a new JSF ViewState Element
|
|
414
|
-
*
|
|
415
|
-
* @param parent, the parent node to attach the viewState element to
|
|
416
|
-
* (usually a form node)
|
|
417
|
-
*/
|
|
418
|
-
private static newViewStateElement(parent: DQ): DQ {
|
|
419
|
-
let newViewState = DQ.fromMarkup($nsp(HTML_VIEWSTATE));
|
|
420
|
-
newViewState.appendTo(parent);
|
|
421
|
-
return newViewState;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
455
|
/**
|
|
425
456
|
* Stores certain aspects of the dom for later post-processing
|
|
426
457
|
*
|
|
@@ -457,10 +488,10 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
457
488
|
* @returns if it is a viewState node
|
|
458
489
|
*/
|
|
459
490
|
private static isViewStateNode(node: XMLQuery): boolean {
|
|
460
|
-
|
|
491
|
+
const SEP = $faces().separatorchar;
|
|
461
492
|
return "undefined" != typeof node?.id?.value && (node?.id?.value == $nsp(P_VIEWSTATE) ||
|
|
462
|
-
node?.id?.value?.indexOf([
|
|
463
|
-
node?.id?.value?.indexOf([$nsp(P_VIEWSTATE),
|
|
493
|
+
node?.id?.value?.indexOf([SEP, $nsp(P_VIEWSTATE)].join(EMPTY_STR)) != -1 ||
|
|
494
|
+
node?.id?.value?.indexOf([$nsp(P_VIEWSTATE), SEP].join(EMPTY_STR)) != -1);
|
|
464
495
|
}
|
|
465
496
|
|
|
466
497
|
/**
|
|
@@ -470,15 +501,59 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
470
501
|
* @returns true of it ii
|
|
471
502
|
*/
|
|
472
503
|
private static isClientWindowNode(node: XMLQuery): boolean {
|
|
473
|
-
|
|
504
|
+
const SEP = $faces().separatorchar;
|
|
474
505
|
return "undefined" != typeof node?.id?.value && (node?.id?.value == $nsp(P_CLIENT_WINDOW) ||
|
|
475
|
-
node?.id?.value?.indexOf([
|
|
476
|
-
node?.id?.value?.indexOf([$nsp(P_CLIENT_WINDOW),
|
|
506
|
+
node?.id?.value?.indexOf([SEP, $nsp(P_CLIENT_WINDOW)].join(EMPTY_STR)) != -1 ||
|
|
507
|
+
node?.id?.value?.indexOf([$nsp(P_CLIENT_WINDOW), SEP].join(EMPTY_STR)) != -1);
|
|
477
508
|
}
|
|
478
509
|
|
|
479
510
|
private triggerOnError(errorData: ErrorData) {
|
|
480
|
-
this.externalContext.getIf(ON_ERROR).
|
|
511
|
+
this.externalContext.getIf(ON_ERROR).orElseLazy(() => this.internalContext.getIf(ON_ERROR).value).orElse(EMPTY_FUNC).value(errorData);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* filters the forms according to being member of the "execute" or "render" cycle
|
|
516
|
+
* @param affectedForm
|
|
517
|
+
* @private
|
|
518
|
+
*/
|
|
519
|
+
private isInExecuteOrRender(affectedForm) {
|
|
520
|
+
const executes = this.externalContext.getIf($nsp(P_EXECUTE)).orElse("@none").value.split(/\s+/gi);
|
|
521
|
+
const renders = this.externalContext.getIf(P_RENDER_OVERRIDE)
|
|
522
|
+
.orElseLazy(() => this.externalContext.getIf($nsp(P_RENDER)).value)
|
|
523
|
+
.orElse(IDENT_NONE).value.split(/\s+/gi);
|
|
524
|
+
const executeAndRenders = executes.concat(...renders);
|
|
525
|
+
return LazyStream.of(...executeAndRenders).filter(nameOrId => {
|
|
526
|
+
if ([IDENT_ALL, IDENT_NONE].indexOf(nameOrId) != -1) {
|
|
527
|
+
return true;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
const NAME_OR_ID = this.getNameOrIdSelector(nameOrId);
|
|
531
|
+
//either the form directly is in execute or render or one of its children or one of its parents
|
|
532
|
+
return affectedForm.matchesSelector(NAME_OR_ID) ||
|
|
533
|
+
affectedForm.querySelectorAll(NAME_OR_ID).isPresent() ||
|
|
534
|
+
affectedForm.firstParent(NAME_OR_ID).isPresent();
|
|
535
|
+
}).first().isPresent();
|
|
481
536
|
}
|
|
482
537
|
|
|
538
|
+
/**
|
|
539
|
+
* gets all forms under a single naming container id
|
|
540
|
+
* @param namingContainerId
|
|
541
|
+
* @private
|
|
542
|
+
*/
|
|
543
|
+
private getContainerForms(namingContainerId: Config) {
|
|
544
|
+
if (namingContainerId.isPresent()) {
|
|
545
|
+
//naming container mode, all forms under naming container id must be processed
|
|
546
|
+
return DQ$(this.getNameOrIdSelector(namingContainerId.value))
|
|
547
|
+
// missing condition if the naming container is not present we have to
|
|
548
|
+
// use the body as fallback
|
|
549
|
+
.orElseLazy(() => DQ.byTagName(HTML_TAG_BODY))
|
|
550
|
+
.byTagName(HTML_TAG_FORM, true);
|
|
551
|
+
} else {
|
|
552
|
+
return DQ.byTagName(HTML_TAG_FORM);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
483
555
|
|
|
556
|
+
private getNameOrIdSelector(nameOrId) {
|
|
557
|
+
return `[id='${nameOrId}'], [name='${nameOrId}']`;
|
|
558
|
+
}
|
|
484
559
|
}
|