jsf.js_next_gen 4.0.0-beta-23 → 4.0.0
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/.nyc_output/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
- package/.nyc_output/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
- package/.nyc_output/processinfo/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
- package/.nyc_output/processinfo/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/README.md +7 -22
- package/dist/docs/assets/main.js +56 -52
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/assets/style.css +23 -0
- package/dist/docs/functions/faces.ajax.addOnError.html +6 -4
- package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -0
- package/dist/docs/functions/faces.ajax.request.html +7 -7
- package/dist/docs/functions/faces.ajax.response.html +0 -1
- package/dist/docs/functions/faces.push.close.html +4 -2
- package/dist/docs/functions/faces.push.init.html +19 -7
- package/dist/docs/functions/faces.push.open.html +4 -2
- package/dist/docs/functions/faces.util.chain.html +3 -3
- package/dist/docs/functions/myfaces.ab.html +9 -4
- package/dist/docs/functions/myfaces.onOnDomReady.html +72 -0
- package/dist/docs/index.html +7 -18
- package/dist/docs/modules/myfaces.html +3 -1
- package/dist/docs/variables/myfaces.oam.html +2 -1
- package/dist/window/faces-development.js +2147 -1779
- 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 +17 -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 +2156 -1777
- 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 +17 -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 +19 -18
- package/pom.xml +1 -1
- package/src/main/test.xml +23 -0
- package/src/main/typescript/@types/definitions/index.d.ts +24 -7
- package/src/main/typescript/api/_api.ts +79 -37
- package/src/main/typescript/api/jsf.ts +18 -0
- package/src/main/typescript/impl/AjaxImpl.ts +168 -78
- package/src/main/typescript/impl/PushImpl.ts +63 -38
- package/src/main/typescript/impl/core/Const.ts +52 -39
- package/src/main/typescript/impl/util/Assertions.ts +16 -8
- package/src/main/typescript/impl/util/AsyncQueue.ts +1 -1
- package/src/main/typescript/impl/util/AsyncRunnable.ts +4 -4
- package/src/main/typescript/impl/util/ExtDomQuery.ts +58 -45
- package/src/main/typescript/impl/util/FileUtils.ts +104 -0
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +89 -0
- package/src/main/typescript/impl/util/Lang.ts +30 -31
- 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 +25 -11
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +78 -32
- package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +10 -10
- package/src/main/typescript/impl/xhrCore/Response.ts +66 -49
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +202 -131
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +79 -166
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +80 -68
- package/src/main/typescript/myfaces/OamSubmit.ts +29 -13
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +19 -22
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +108 -1
- 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 -7
- package/src/main/typescript/test/xhrCore/EventTests.spec.ts +1 -1
- package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +5 -2
- 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 +158 -17
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +242 -11
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +39 -3
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +373 -35
- package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +43 -9
- package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +109 -0
- 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 +1 -1
- package/src/test/resources/jsf-development.js +1 -1
- package/src/tmp/test.html +12 -88
- package/target/api/_api.js +72 -31
- package/target/api/_api.js.map +1 -1
- package/target/api/jsf.js +11 -0
- 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 +144 -59
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/PushImpl.js +66 -35
- package/target/impl/PushImpl.js.map +1 -1
- package/target/impl/core/Const.js +51 -38
- 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/util/Assertions.js +12 -7
- package/target/impl/util/Assertions.js.map +1 -1
- package/target/impl/util/AsyncQueue.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +58 -40
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/FileUtils.js +96 -0
- package/target/impl/util/FileUtils.js.map +1 -0
- 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 +29 -30
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/util/URLCodec.js +77 -0
- package/target/impl/util/URLCodec.js.map +1 -0
- package/target/impl/util/XhrQueueController.js +82 -0
- package/target/impl/util/XhrQueueController.js.map +1 -0
- package/target/impl/xhrCore/ErrorData.js +10 -8
- package/target/impl/xhrCore/ErrorData.js.map +1 -1
- package/target/impl/xhrCore/EventData.js +1 -1
- 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 +70 -23
- package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
- package/target/impl/xhrCore/ResonseDataResolver.js +9 -9
- package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
- package/target/impl/xhrCore/Response.js +44 -29
- package/target/impl/xhrCore/Response.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +182 -116
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +68 -156
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrQueHandler.js +11 -0
- package/target/impl/xhrCore/XhrQueHandler.js.map +1 -0
- package/target/impl/xhrCore/XhrQueueController.js +62 -0
- package/target/impl/xhrCore/XhrQueueController.js.map +1 -0
- package/target/impl/xhrCore/XhrRequest.js +68 -59
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +23 -14
- package/target/myfaces/OamSubmit.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +16 -16
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js +76 -0
- package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js.map +1 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +925 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +1 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +112 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +1 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +100 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js +37 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
- package/target/test/impl/ImplTest.spec.js +2 -2
- package/target/test/impl/ImplTest.spec.js.map +1 -1
- package/target/test/impl/ImplTest_23.spec.js +2 -2
- package/target/test/impl/ImplTest_23.spec.js.map +1 -1
- package/target/test/myfaces/OnLoadSpec.js +57 -0
- package/target/test/myfaces/OnLoadSpec.js.map +1 -0
- package/target/test/xhrCore/EventTests.spec.js +1 -1
- package/target/test/xhrCore/EventTests.spec.js.map +1 -1
- package/target/test/xhrCore/FileUploadTest.spec.js +2 -1
- 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 +142 -10
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +217 -9
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +34 -2
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +308 -24
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest23.spec.js +38 -8
- package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js +128 -0
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +1 -0
- package/target/test/xhrCore/XhrFormDataTest.spec.js +57 -34
- 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
- package/.nyc_output/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
- package/.nyc_output/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
- package/.nyc_output/processinfo/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
- package/.nyc_output/processinfo/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
- package/target/types/index.js +0 -18
- package/target/types/index.js.map +0 -1
|
@@ -32,7 +32,6 @@ export interface IResponseProcessor {
|
|
|
32
32
|
*/
|
|
33
33
|
replaceHead(shadowHead: XMLQuery | DQ): void;
|
|
34
34
|
|
|
35
|
-
|
|
36
35
|
/**
|
|
37
36
|
* adds new elements to the head
|
|
38
37
|
*
|
|
@@ -40,6 +39,14 @@ export interface IResponseProcessor {
|
|
|
40
39
|
*/
|
|
41
40
|
addToHead(newElements: XMLQuery | DQ): void;
|
|
42
41
|
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* adds new elements to the head in a deferred manner
|
|
45
|
+
*
|
|
46
|
+
* @param newElements the elements which need addition
|
|
47
|
+
*/
|
|
48
|
+
addToHeadDeferred(newElements: XMLQuery | DQ): void;
|
|
49
|
+
|
|
43
50
|
/**
|
|
44
51
|
* replace the body
|
|
45
52
|
*
|
|
@@ -48,7 +55,7 @@ export interface IResponseProcessor {
|
|
|
48
55
|
replaceBody(shadowBody: XMLQuery | DQ): void;
|
|
49
56
|
|
|
50
57
|
/**
|
|
51
|
-
* Leaf Tag eval... process whatever is in the
|
|
58
|
+
* Leaf Tag eval... process whatever is in the evaluated cdata block
|
|
52
59
|
*
|
|
53
60
|
* @param node
|
|
54
61
|
*/
|
|
@@ -91,11 +98,11 @@ export interface IResponseProcessor {
|
|
|
91
98
|
attributes(node: XMLQuery): void;
|
|
92
99
|
|
|
93
100
|
/**
|
|
94
|
-
* replace the entire
|
|
101
|
+
* replace the entire viewRoot
|
|
95
102
|
* with shadowResponse
|
|
96
|
-
* @param
|
|
103
|
+
* @param shadowResponse
|
|
97
104
|
*/
|
|
98
|
-
replaceViewRoot(
|
|
105
|
+
replaceViewRoot(shadowResponse: XMLQuery | DQ): void;
|
|
99
106
|
|
|
100
107
|
/**
|
|
101
108
|
* jsf insert resolution
|
|
@@ -106,34 +113,34 @@ export interface IResponseProcessor {
|
|
|
106
113
|
insert(node: XMLQuery): void;
|
|
107
114
|
|
|
108
115
|
/**
|
|
109
|
-
* insert with before, after
|
|
116
|
+
* insert with before, after sub-tags
|
|
110
117
|
* @param node
|
|
111
118
|
*/
|
|
112
|
-
|
|
119
|
+
insertWithSubTags(node: XMLQuery);
|
|
113
120
|
|
|
114
121
|
/**
|
|
115
122
|
* process the viewState update, update the affected
|
|
116
|
-
* forms with their respective new
|
|
123
|
+
* forms with their respective new viewState values
|
|
117
124
|
*
|
|
118
125
|
*/
|
|
119
126
|
processViewState(node: XMLQuery): boolean;
|
|
120
127
|
|
|
121
128
|
/**
|
|
122
129
|
* process the viewState update, update the affected
|
|
123
|
-
* forms with their respective new
|
|
130
|
+
* forms with their respective new viewState values
|
|
124
131
|
*
|
|
125
132
|
*/
|
|
126
133
|
processClientWindow(node: XMLQuery): boolean;
|
|
127
134
|
|
|
128
135
|
|
|
129
136
|
/**
|
|
130
|
-
*
|
|
137
|
+
* Eval - all processed elements so far
|
|
131
138
|
* and executes the embedded scripts
|
|
132
139
|
*/
|
|
133
140
|
globalEval(): void;
|
|
134
141
|
|
|
135
142
|
/**
|
|
136
|
-
* fix the
|
|
143
|
+
* fix the viewStates of all processed forms
|
|
137
144
|
*/
|
|
138
145
|
fixViewStates(): void;
|
|
139
146
|
|
|
@@ -142,4 +149,11 @@ export interface IResponseProcessor {
|
|
|
142
149
|
* send last event
|
|
143
150
|
*/
|
|
144
151
|
done(): void;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* update internal state to
|
|
155
|
+
* check whether we still are in a named view root
|
|
156
|
+
* (can change after a navigation)
|
|
157
|
+
*/
|
|
158
|
+
updateNamedViewRootState();
|
|
145
159
|
}
|
|
@@ -16,18 +16,23 @@
|
|
|
16
16
|
|
|
17
17
|
import {Config, DomQuery, DQ} from "mona-dish";
|
|
18
18
|
import {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
$faces,
|
|
20
|
+
$nsp,
|
|
21
|
+
CTX_OPTIONS_DELAY,
|
|
22
|
+
CTX_OPTIONS_TIMEOUT,
|
|
23
|
+
DELAY_NONE,
|
|
21
24
|
EMPTY_FUNC,
|
|
22
25
|
EMPTY_STR,
|
|
23
|
-
ENCODED_URL,
|
|
24
|
-
|
|
26
|
+
ENCODED_URL, NAMED_VIEWROOT, NAMING_CONTAINER_ID,
|
|
27
|
+
P_VIEWSTATE,
|
|
25
28
|
REQ_TYPE_GET,
|
|
26
29
|
REQ_TYPE_POST
|
|
27
30
|
} from "../core/Const";
|
|
28
31
|
import {XhrFormData} from "./XhrFormData";
|
|
29
32
|
import {ExtLang} from "../util/Lang";
|
|
30
|
-
import {ExtConfig,
|
|
33
|
+
import {ExtConfig, ExtDomQuery} from "../util/ExtDomQuery";
|
|
34
|
+
import {Assertions} from "../util/Assertions";
|
|
35
|
+
|
|
31
36
|
|
|
32
37
|
/**
|
|
33
38
|
* Resolver functions for various aspects of the request data
|
|
@@ -37,7 +42,7 @@ import {ExtConfig, ExtDomquery} from "../util/ExtDomQuery";
|
|
|
37
42
|
*/
|
|
38
43
|
|
|
39
44
|
/**
|
|
40
|
-
* resolves the event handlers
|
|
45
|
+
* resolves the event handlers lazily
|
|
41
46
|
* so that if some decoration happens in between we can deal with it
|
|
42
47
|
*
|
|
43
48
|
* @param requestContext
|
|
@@ -45,6 +50,7 @@ import {ExtConfig, ExtDomquery} from "../util/ExtDomQuery";
|
|
|
45
50
|
* @param funcName
|
|
46
51
|
*/
|
|
47
52
|
export function resolveHandlerFunc(requestContext: Config, responseContext: Config, funcName: string) {
|
|
53
|
+
responseContext = responseContext || new Config({});
|
|
48
54
|
return responseContext.getIf(funcName)
|
|
49
55
|
.orElseLazy(() =>requestContext.getIf(funcName).value)
|
|
50
56
|
.orElse(EMPTY_FUNC).value;
|
|
@@ -67,20 +73,52 @@ export function resolveFinalUrl(sourceForm: DomQuery, formData: XhrFormData, aja
|
|
|
67
73
|
* it is either the id or the parent form of the element or an embedded form
|
|
68
74
|
* of the element
|
|
69
75
|
*
|
|
70
|
-
* @param requestCtx
|
|
71
76
|
* @param elem
|
|
72
77
|
* @param event
|
|
73
78
|
*/
|
|
74
|
-
export function resolveForm(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
export function resolveForm(elem: DQ, event: Event): DQ {
|
|
80
|
+
return ExtLang.getForm(elem.getAsElem(0).value, event);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function resolveViewId(form: DQ): string {
|
|
84
|
+
const viewState = form.querySelectorAll(`input[type='hidden'][name*='${$nsp(P_VIEWSTATE)}']`).id.orElse("").value;
|
|
85
|
+
const divider = $faces().separatorchar;
|
|
86
|
+
const viewId = viewState.split(divider, 2)[0];
|
|
87
|
+
const viewStateViewId = viewId.indexOf($nsp(P_VIEWSTATE)) === -1 ? viewId : "";
|
|
88
|
+
// myfaces specific, we in non portlet environments prepend the viewId
|
|
89
|
+
// even without being in a naming container, the other components ignore that
|
|
90
|
+
return form.id.value.indexOf(viewStateViewId) === 0 ? viewStateViewId : "";
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function resolveViewRootId(form: DQ): string {
|
|
94
|
+
const viewState = form.querySelectorAll(`input[type='hidden'][name*='${$nsp(P_VIEWSTATE)}']`).attr("name").orElse("").value;
|
|
95
|
+
const divider = $faces().separatorchar;
|
|
96
|
+
const viewId = viewState.split(divider, 2)[0];
|
|
97
|
+
//different to the identifier the form id is never prepended to the viewstate
|
|
98
|
+
return viewId.indexOf($nsp(P_VIEWSTATE)) === -1 ? viewId : "";
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* as per jsdoc before the request it must be ensured that every post argument
|
|
103
|
+
* is prefixed with the naming container id (there is an exception in mojarra with
|
|
104
|
+
* the element=element param, which we have to follow here as well.
|
|
105
|
+
* (inputs are prefixed by name anyway normally this only affects our standard parameters)
|
|
106
|
+
* @private
|
|
107
|
+
*/
|
|
108
|
+
export function resoveNamingContainerMapper(internalContext: Config): (key: string, value: any) => [string, any] {
|
|
109
|
+
const isNamedViewRoot = internalContext.getIf(NAMED_VIEWROOT).isPresent();
|
|
110
|
+
if(!isNamedViewRoot) {
|
|
111
|
+
return (key, value) => [key, value];
|
|
112
|
+
}
|
|
113
|
+
const partialId = internalContext.getIf(NAMING_CONTAINER_ID).value;
|
|
114
|
+
const SEP = $faces().separatorchar;
|
|
115
|
+
const prefix = partialId + SEP;
|
|
116
|
+
return (key: string, value: any) => (key.indexOf(prefix) == 0) ? [key, value] : [prefix + key, value];
|
|
79
117
|
}
|
|
80
118
|
|
|
81
119
|
export function resolveTimeout(options: Config): number {
|
|
82
120
|
let getCfg = ExtLang.getLocalOrGlobalConfig;
|
|
83
|
-
return options.getIf(
|
|
121
|
+
return options.getIf(CTX_OPTIONS_TIMEOUT).value ?? getCfg(options.value, CTX_OPTIONS_TIMEOUT, 0);
|
|
84
122
|
}
|
|
85
123
|
|
|
86
124
|
/**
|
|
@@ -89,18 +127,24 @@ export function resolveTimeout(options: Config): number {
|
|
|
89
127
|
* @param options ... the options object, in most cases it will host the delay value
|
|
90
128
|
*/
|
|
91
129
|
export function resolveDelay(options: Config): number {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
130
|
+
// null, 'none', or undefined will automatically be mapped to 0 aka no delay
|
|
131
|
+
// the config delay will be dropped not needed anymore, it does not really
|
|
132
|
+
// make sense anymore now that it is part of a local spec
|
|
133
|
+
let ret = options.getIf(CTX_OPTIONS_DELAY).orElse(0).value;
|
|
134
|
+
// if delay === none, no delay must be used, aka delay 0
|
|
135
|
+
ret = (DELAY_NONE === ret) ? 0 : ret;
|
|
136
|
+
// negative, or invalid values will automatically get a js exception
|
|
137
|
+
Assertions.assertDelay(ret);
|
|
138
|
+
return ret;
|
|
95
139
|
}
|
|
96
140
|
|
|
97
141
|
/**
|
|
98
|
-
* resolves the window
|
|
142
|
+
* resolves the window-id from various sources
|
|
99
143
|
*
|
|
100
144
|
* @param options
|
|
101
145
|
*/
|
|
102
146
|
export function resolveWindowId(options: Config) {
|
|
103
|
-
return options?.value?.windowId ??
|
|
147
|
+
return options?.value?.windowId ?? ExtDomQuery.windowId;
|
|
104
148
|
}
|
|
105
149
|
|
|
106
150
|
/**
|
|
@@ -108,19 +152,20 @@ export function resolveWindowId(options: Config) {
|
|
|
108
152
|
* browser save event resolution
|
|
109
153
|
* @param evt the event object
|
|
110
154
|
* (with a fallback for ie events if none is present)
|
|
155
|
+
* @deprecated soon will be removed
|
|
111
156
|
*/
|
|
112
157
|
export function getEventTarget(evt: Event): Element {
|
|
113
|
-
//ie6 and 7 fallback
|
|
158
|
+
// ie6 and 7 fallback
|
|
114
159
|
let finalEvent = evt;
|
|
115
|
-
|
|
160
|
+
/*
|
|
116
161
|
* evt source is defined in the jsf events
|
|
117
|
-
* seems like some component authors use our code
|
|
162
|
+
* seems like some component authors use our code,
|
|
118
163
|
* so we add it here see also
|
|
119
164
|
* https://issues.apache.org/jira/browse/MYFACES-2458
|
|
120
165
|
* not entirely a bug but makes sense to add this
|
|
121
|
-
* behavior. I
|
|
166
|
+
* behavior. I don´t use it that way but nevertheless it
|
|
122
167
|
* does not break anything so why not
|
|
123
|
-
|
|
168
|
+
*/
|
|
124
169
|
let t = finalEvent?.srcElement ?? finalEvent?.target ?? (<any>finalEvent)?.source;
|
|
125
170
|
while ((t) && (t.nodeType != 1)) {
|
|
126
171
|
t = t.parentNode;
|
|
@@ -137,14 +182,15 @@ export function getEventTarget(evt: Event): Element {
|
|
|
137
182
|
* @param opts
|
|
138
183
|
* @param el
|
|
139
184
|
*/
|
|
140
|
-
export function resolveDefaults(event: Event, opts:
|
|
185
|
+
export function resolveDefaults(event: Event, opts: Options | [[string, any]] , el: Element | string = null): any {
|
|
141
186
|
//deep copy the options, so that further transformations to not backfire into the callers
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
187
|
+
const elem = DQ.byId(el || <Element>event.target, true);
|
|
188
|
+
const options = new ExtConfig(opts).deepCopy as ExtConfig;
|
|
189
|
+
return {
|
|
190
|
+
options: options,
|
|
191
|
+
elem: elem,
|
|
192
|
+
elementId: elem.id.value,
|
|
193
|
+
windowId: resolveWindowId(options),
|
|
194
|
+
isResetValues: true === options.value?.resetValues
|
|
195
|
+
};
|
|
150
196
|
}
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
CTX_PARAM_SRC_FRM_ID,
|
|
26
26
|
SEL_RESPONSE_XML,
|
|
27
27
|
SOURCE,
|
|
28
|
-
|
|
28
|
+
HTML_TAG_FORM,
|
|
29
29
|
UPDATE_ELEMS,
|
|
30
30
|
UPDATE_FORMS,
|
|
31
31
|
DEFERRED_HEAD_INSERTS
|
|
@@ -45,7 +45,7 @@ import {ExtConfig} from "../util/ExtDomQuery";
|
|
|
45
45
|
*
|
|
46
46
|
* @param request the request hosting the responseXML
|
|
47
47
|
*
|
|
48
|
-
* Throws an error in case of non
|
|
48
|
+
* Throws an error in case of non-existent or wrong xml data
|
|
49
49
|
*
|
|
50
50
|
*/
|
|
51
51
|
export function resolveResponseXML(request: Config): XMLQuery {
|
|
@@ -56,8 +56,8 @@ export function resolveResponseXML(request: Config): XMLQuery {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
|
-
* Splits the incoming
|
|
60
|
-
* in an internal and an external
|
|
59
|
+
* Splits the incoming pass-through context apart
|
|
60
|
+
* in an internal and an external normalized context
|
|
61
61
|
* the internal one is just for our internal processing
|
|
62
62
|
*
|
|
63
63
|
* @param context the root context as associative array
|
|
@@ -83,10 +83,10 @@ export function resolveContexts(context: { [p: string]: any }): any {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
* fetches the source element out of our
|
|
86
|
+
* fetches the source element out of our contexts
|
|
87
87
|
*
|
|
88
|
-
* @param context the external context which
|
|
89
|
-
* @param internalContext internal
|
|
88
|
+
* @param context the external context which should host the source id
|
|
89
|
+
* @param internalContext internal pass-through fall back
|
|
90
90
|
*
|
|
91
91
|
*/
|
|
92
92
|
export function resolveSourceElement(context: Config, internalContext: Config): DQ {
|
|
@@ -106,9 +106,9 @@ export function resolveSourceForm(internalContext: Config, elem: DQ): DQ {
|
|
|
106
106
|
let sourceFormId = internalContext.getIf(CTX_PARAM_SRC_FRM_ID);
|
|
107
107
|
let sourceForm = new DQ(sourceFormId.isPresent() ? document.forms[sourceFormId.value] : null);
|
|
108
108
|
|
|
109
|
-
sourceForm = sourceForm.orElseLazy(() => elem.
|
|
110
|
-
.orElseLazy(() => elem.querySelectorAll(
|
|
111
|
-
.orElseLazy(() => DQ.querySelectorAll(
|
|
109
|
+
sourceForm = sourceForm.orElseLazy(() => elem.firstParent(HTML_TAG_FORM))
|
|
110
|
+
.orElseLazy(() => elem.querySelectorAll(HTML_TAG_FORM))
|
|
111
|
+
.orElseLazy(() => DQ.querySelectorAll(HTML_TAG_FORM));
|
|
112
112
|
|
|
113
113
|
return sourceForm;
|
|
114
114
|
}
|
|
@@ -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";
|
|
@@ -66,16 +66,17 @@ export module Response {
|
|
|
66
66
|
|
|
67
67
|
internalContext.assign(RESPONSE_XML).value = responseXML;
|
|
68
68
|
|
|
69
|
-
//we now process the partial tags, or in none given raise an error
|
|
70
|
-
responseXML.querySelectorAll(
|
|
69
|
+
// we now process the partial tags, or in none given raise an error
|
|
70
|
+
responseXML.querySelectorAll(XML_TAG_PARTIAL_RESP)
|
|
71
71
|
.each(item => processPartialTag(<XMLQuery>item, responseProcessor, internalContext));
|
|
72
72
|
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
//to wait until the document has caught up before
|
|
76
|
-
//doing any
|
|
77
|
-
//
|
|
78
|
-
//we maybe drop this deferred assignment in the future, but myfaces did it until now
|
|
73
|
+
// We now process the viewStates, client windows and the elements to be evaluated are delayed.
|
|
74
|
+
// The reason for this is that often it is better
|
|
75
|
+
// to wait until the document has caught up before
|
|
76
|
+
// doing any evaluations even on embedded scripts.
|
|
77
|
+
// Usually this does not matter, the client window comes in almost last always anyway
|
|
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
|
-
internalContext.assign(PARTIAL_ID).value = node.id;
|
|
92
|
-
const SEL_SUB_TAGS = [CMD_ERROR, CMD_REDIRECT, CMD_CHANGES].join(",");
|
|
93
92
|
|
|
94
|
-
|
|
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(",");
|
|
111
|
+
|
|
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
|
}
|
|
@@ -171,14 +188,14 @@ export module Response {
|
|
|
171
188
|
|
|
172
189
|
/**
|
|
173
190
|
* branch tag update. drill further down into the updates
|
|
174
|
-
* special case
|
|
175
|
-
* and the
|
|
191
|
+
* special case viewState in that case it is a leaf
|
|
192
|
+
* and the viewState must be processed
|
|
176
193
|
*
|
|
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) :
|
|
@@ -209,7 +226,7 @@ export module Response {
|
|
|
209
226
|
responseProcessor.addToHead(DQ.fromMarkup(cdataBlock))
|
|
210
227
|
break;
|
|
211
228
|
|
|
212
|
-
default://htmlItem replacement
|
|
229
|
+
default:// htmlItem replacement
|
|
213
230
|
responseProcessor.update(node, cdataBlock);
|
|
214
231
|
break;
|
|
215
232
|
}
|