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
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsf.js_next_gen",
|
|
3
|
-
"version": "4.0.0
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "A next generation typescript reimplementation of jsf.js",
|
|
5
5
|
"main": "dist/window/faces.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"doc": "npx typedoc --tsconfig src/main/typescript/tsconfig-typedoc.json",
|
|
8
|
-
"test": "env TS_NODE_PROJECT=./src/main/typescript/tsconfig.json mocha",
|
|
9
|
-
"coverage": "env TS_NODE_PROJECT=./src/
|
|
8
|
+
"test": "cross-env TS_NODE_PROJECT=./src/main/typescript/tsconfig.json mocha",
|
|
9
|
+
"coverage": "cross-env TS_NODE_PROJECT=./src/main/typescript/tsconfig.json nyc --reporter=html --reporter=text mocha",
|
|
10
10
|
"build-production": "webpack --mode production --env FILE_NAME=jsf && ts-node ./remap.ts --production",
|
|
11
11
|
"build-development": "webpack --mode development --env FILE_NAME=jsf-development && ts-node ./remap.ts --development",
|
|
12
12
|
"build": "npm run doc && npm run build-development && npm run build-production",
|
|
@@ -21,33 +21,34 @@
|
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
24
|
-
"@types/chai": "^4.3.
|
|
25
|
-
"@types/mocha": "^10.0.
|
|
26
|
-
"@types/node": "^18.
|
|
24
|
+
"@types/chai": "^4.3.4",
|
|
25
|
+
"@types/mocha": "^10.0.1",
|
|
26
|
+
"@types/node": "^18.14.2",
|
|
27
27
|
"@types/sinon": "^10.0.13",
|
|
28
28
|
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
|
29
|
-
"chai": "^4.3.
|
|
29
|
+
"chai": "^4.3.7",
|
|
30
30
|
"compression-webpack-plugin": "^10.0.0",
|
|
31
|
+
"cross-env": "^7.0.3",
|
|
31
32
|
"html-webpack-plugin": "^5.5.0",
|
|
32
33
|
"http-server": "^14.1.1",
|
|
33
|
-
"jsdom": "^
|
|
34
|
+
"jsdom": "^21.1.0",
|
|
34
35
|
"jsdom-global": "^3.0.2",
|
|
35
|
-
"mocha": "^10.
|
|
36
|
-
"npm-check-updates": "^16.
|
|
36
|
+
"mocha": "^10.2.0",
|
|
37
|
+
"npm-check-updates": "^16.7.10",
|
|
37
38
|
"nyc": "^15.1.0",
|
|
38
39
|
"replace-in-file": "^6.3.5",
|
|
39
|
-
"rxjs": "^7.
|
|
40
|
-
"sinon": "^
|
|
40
|
+
"rxjs": "^7.8.0",
|
|
41
|
+
"sinon": "^15.0.1",
|
|
41
42
|
"terser-webpack-plugin": "^5.3.6",
|
|
42
|
-
"ts-loader": "^9.4.
|
|
43
|
+
"ts-loader": "^9.4.2",
|
|
43
44
|
"ts-node": "^10.9.1",
|
|
44
|
-
"typedoc": "^0.23.
|
|
45
|
-
"typescript": "^4.
|
|
46
|
-
"webpack": "^5.
|
|
47
|
-
"webpack-cli": "^
|
|
45
|
+
"typedoc": "^0.23.26",
|
|
46
|
+
"typescript": "^4.9.5",
|
|
47
|
+
"webpack": "^5.75.0",
|
|
48
|
+
"webpack-cli": "^5.0.1",
|
|
48
49
|
"webpack-dev-server": "^4.11.1"
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|
|
51
|
-
"mona-dish": "0.
|
|
52
|
+
"mona-dish": "^0.26.0"
|
|
52
53
|
}
|
|
53
54
|
}
|
package/pom.xml
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<partial-response id="viewroot_1">
|
|
2
|
+
<changes>
|
|
3
|
+
<update id="panel2"><![CDATA[
|
|
4
|
+
<div id="panel2">
|
|
5
|
+
after update
|
|
6
|
+
<form id="form2" name="form2" method="post" action="booga2"
|
|
7
|
+
><a href="#" id="form2:link" name="form2:link"></a>
|
|
8
|
+
<input type="hidden" name="form2_SUBMIT" value="1"/></form>
|
|
9
|
+
</div>
|
|
10
|
+
]]>
|
|
11
|
+
</update>
|
|
12
|
+
<update id="panel3"><![CDATA[
|
|
13
|
+
<div id="panel3">
|
|
14
|
+
after update
|
|
15
|
+
<form id="form3" name="form3" method="post" action="booga3"
|
|
16
|
+
><a href="#" id="form3:link" name="form3:link"></a>
|
|
17
|
+
</form>
|
|
18
|
+
</div>
|
|
19
|
+
]]>
|
|
20
|
+
</update>
|
|
21
|
+
<update id="j_id__v_0:jakarta.faces.ViewState:1"><![CDATA[booga_after_update]]></update>
|
|
22
|
+
</changes>
|
|
23
|
+
</partial-response>
|
|
@@ -23,9 +23,24 @@
|
|
|
23
23
|
declare global {
|
|
24
24
|
|
|
25
25
|
type Consumer<T> = (s?: T) => void;
|
|
26
|
+
type Tuple<V,K> = [V, K];
|
|
27
|
+
type Tuples<V,K> = [Tuple<V, K>];
|
|
26
28
|
type AssocArr<T> = { [key: string]: T };
|
|
27
29
|
type EvalFuncs = Array<Function | string>;
|
|
28
|
-
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
type Options = {
|
|
33
|
+
render ?: string,
|
|
34
|
+
execute ?: string, //space separated list of client ids
|
|
35
|
+
onevent ?: Function, // event handler callback
|
|
36
|
+
onerror ?: Function, // error handler callback
|
|
37
|
+
params ?: AssocArr<any>, // passthrough params
|
|
38
|
+
delay ?: number, // delay in milliseconds
|
|
39
|
+
resetValues ?: boolean, // if set to true jakarta.faces.partial.resetValues is sent
|
|
40
|
+
/* @deprecated non-spec conform fallback behavior that anything can be passed and is used as passthrough */
|
|
41
|
+
[key: string]: any
|
|
42
|
+
}
|
|
43
|
+
|
|
29
44
|
type Context = AssocArr<any>;
|
|
30
45
|
type ElemDef = Element | string;
|
|
31
46
|
|
|
@@ -35,10 +50,10 @@ declare global {
|
|
|
35
50
|
* <li> errorData.status : the error status message</li>
|
|
36
51
|
* <li> errorData.serverErrorName : the server error name in case of a server error</li>
|
|
37
52
|
* <li> errorData.serverErrorMessage : the server error message in case of a server error</li>
|
|
38
|
-
* <li> errorData.source : the issuing source element which triggered the
|
|
39
|
-
* <li> eventData.responseCode: the response code (aka http
|
|
40
|
-
* <li> eventData.responseText: the
|
|
41
|
-
* <li> eventData.responseXML: the
|
|
53
|
+
* <li> errorData.source : the issuing source element which triggered the request </li>
|
|
54
|
+
* <li> eventData.responseCode: the response code (aka http request response code, 401 etc...) </li>
|
|
55
|
+
* <li> eventData.responseText: the response text </li>
|
|
56
|
+
* <li> eventData.responseXML: the response xml </li>
|
|
42
57
|
* </ul>
|
|
43
58
|
*/
|
|
44
59
|
interface IErrorData {
|
|
@@ -63,7 +78,7 @@ declare global {
|
|
|
63
78
|
}
|
|
64
79
|
|
|
65
80
|
interface Ajax {
|
|
66
|
-
request(element: Element, event?: Event, options?:
|
|
81
|
+
request(element: Element, event?: Event, options?: Options): void;
|
|
67
82
|
response(request: XMLHttpRequest, context?: Context): void;
|
|
68
83
|
}
|
|
69
84
|
|
|
@@ -106,7 +121,7 @@ declare global {
|
|
|
106
121
|
interface OAM {
|
|
107
122
|
clearHiddenInput(formName: string, name: string): void;
|
|
108
123
|
setHiddenInput(formName: string, name: string, value: string): void;
|
|
109
|
-
submitForm(formName: string, linkId
|
|
124
|
+
submitForm(formName: string, linkId?: string |null, target?: string | null, params?: AssocArr<any> |Tuples<string, any> | null): boolean;
|
|
110
125
|
}
|
|
111
126
|
|
|
112
127
|
interface MyFacesAPI {
|
|
@@ -119,6 +134,8 @@ declare global {
|
|
|
119
134
|
};
|
|
120
135
|
}
|
|
121
136
|
|
|
137
|
+
|
|
138
|
+
|
|
122
139
|
/*
|
|
123
140
|
* Global namespaces type definitions
|
|
124
141
|
*/
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import {Implementation} from "../impl/AjaxImpl";
|
|
17
17
|
import {PushImpl} from "../impl/PushImpl";
|
|
18
18
|
import {oam as _oam} from "../myfaces/OamSubmit";
|
|
19
|
-
import {$nsp,
|
|
19
|
+
import {$nsp, CTX_OPTIONS_EXECUTE, CTX_OPTIONS_PARAMS, CTX_PARAM_RENDER, P_BEHAVIOR_EVENT} from "../impl/core/Const";
|
|
20
20
|
import {ErrorData} from "../impl/xhrCore/ErrorData";
|
|
21
21
|
import {EventData} from "../impl/xhrCore/EventData";
|
|
22
22
|
|
|
@@ -49,14 +49,14 @@ export module faces {
|
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* SeparatorChar as defined by facesContext.getNamingContainerSeparatorChar()
|
|
52
|
-
* @type {Char}
|
|
53
52
|
*/
|
|
54
|
-
export var separatorchar = getSeparatorChar();
|
|
53
|
+
export var separatorchar: string = getSeparatorChar();
|
|
55
54
|
|
|
55
|
+
// noinspection JSUnusedGlobalSymbols
|
|
56
56
|
/**
|
|
57
57
|
* Context Path as defined externalContext.requestContextPath
|
|
58
58
|
*/
|
|
59
|
-
export var contextpath = '#{facesContext.externalContext.requestContextPath}';
|
|
59
|
+
export var contextpath: string = '#{facesContext.externalContext.requestContextPath}';
|
|
60
60
|
// we do not have a fallback here, for now
|
|
61
61
|
|
|
62
62
|
/**
|
|
@@ -99,7 +99,7 @@ export module faces {
|
|
|
99
99
|
return Implementation.getClientWindow(rootNode);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
//private helper functions
|
|
102
|
+
// private helper functions
|
|
103
103
|
function getSeparatorChar(): string {
|
|
104
104
|
const sep = '#{facesContext.namingContainerSeparatorChar}';
|
|
105
105
|
//We now enable standalone mode, the separator char was not mapped we make a fallback to 2.3 behavior
|
|
@@ -117,19 +117,19 @@ export module faces {
|
|
|
117
117
|
/**
|
|
118
118
|
* this function has to send the ajax requests
|
|
119
119
|
*
|
|
120
|
-
* following
|
|
120
|
+
* following request conditions must be met:
|
|
121
121
|
* <ul>
|
|
122
|
-
* <li> the
|
|
123
|
-
* <li> the
|
|
124
|
-
* <li> the
|
|
125
|
-
* <li> all requests must be queued with a client side
|
|
122
|
+
* <li> the request must be sent asynchronously! </li>
|
|
123
|
+
* <li> the request must be a POST!!! request </li>
|
|
124
|
+
* <li> the request url must be the form action attribute </li>
|
|
125
|
+
* <li> all requests must be queued with a client side request queue to ensure the request ordering!</li>
|
|
126
126
|
* </ul>
|
|
127
127
|
*
|
|
128
128
|
* @param {String|Node} element: any dom element no matter being it html or jsf, from which the event is emitted
|
|
129
129
|
* @param {EVENT} event: any javascript event supported by that object
|
|
130
130
|
* @param {Map} options : map of options being pushed into the ajax cycle
|
|
131
131
|
*/
|
|
132
|
-
export function request(element: Element, event?: Event, options?:
|
|
132
|
+
export function request(element: Element, event?: Event, options?: Options): void {
|
|
133
133
|
Implementation.request(element, event, options)
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -138,7 +138,6 @@ export module faces {
|
|
|
138
138
|
* @param request the request object having triggered this response
|
|
139
139
|
* @param context the request context
|
|
140
140
|
*
|
|
141
|
-
* TODO add info on what can be in the context
|
|
142
141
|
*/
|
|
143
142
|
export function response(request: XMLHttpRequest, context?: Context): void {
|
|
144
143
|
Implementation.response(request, context);
|
|
@@ -153,13 +152,13 @@ export module faces {
|
|
|
153
152
|
* <li> errorData.status : the error status message</li>
|
|
154
153
|
* <li> errorData.serverErrorName : the server error name in case of a server error</li>
|
|
155
154
|
* <li> errorData.serverErrorMessage : the server error message in case of a server error</li>
|
|
156
|
-
* <li> errorData.source : the issuing source element which triggered the
|
|
157
|
-
* <li> eventData.responseCode: the response code (aka http
|
|
158
|
-
* <li> eventData.responseText: the
|
|
159
|
-
* <li> eventData.responseXML: the
|
|
155
|
+
* <li> errorData.source : the issuing source element which triggered the request </li>
|
|
156
|
+
* <li> eventData.responseCode: the response code (aka http request response code, 401 etc...) </li>
|
|
157
|
+
* <li> eventData.responseText: the request response text </li>
|
|
158
|
+
* <li> eventData.responseXML: the request response xml </li>
|
|
160
159
|
* </ul>
|
|
161
160
|
*
|
|
162
|
-
* @param
|
|
161
|
+
* @param errorFunc error handler must be of the format <i>function errorListener(<errorData>)</i>
|
|
163
162
|
*/
|
|
164
163
|
export function addOnError(errorFunc: (data: ErrorData) => void): void {
|
|
165
164
|
Implementation.addOnError(<any>errorFunc);
|
|
@@ -169,7 +168,7 @@ export module faces {
|
|
|
169
168
|
* Adds a global event listener to the ajax event queue. The event listener must be a function
|
|
170
169
|
* of following format: <i>function eventListener(<eventData>)</i>
|
|
171
170
|
*
|
|
172
|
-
* @param
|
|
171
|
+
* @param eventFunc event must be of the format <i>function eventListener(<eventData>)</i>
|
|
173
172
|
*/
|
|
174
173
|
export function addOnEvent(eventFunc: (data: EventData) => void): void {
|
|
175
174
|
Implementation.addOnEvent(<any>eventFunc);
|
|
@@ -184,38 +183,44 @@ export module faces {
|
|
|
184
183
|
* if any of the code returns false, the execution
|
|
185
184
|
* is terminated prematurely skipping the rest of the code!
|
|
186
185
|
*
|
|
187
|
-
* @param {
|
|
186
|
+
* @param {HTMLElement | String} source, the callee object
|
|
188
187
|
* @param {Event} event, the event object of the callee event triggering this function
|
|
189
188
|
* @param funcs ... arbitrary array of functions or strings
|
|
190
189
|
* @returns true if the chain has succeeded false otherwise
|
|
191
190
|
*/
|
|
192
|
-
export function chain(source, event, ...funcs: Array<Function | string>): boolean {
|
|
191
|
+
export function chain(source: HTMLElement | string, event: Event | null, ...funcs: Array<Function | string>): boolean {
|
|
193
192
|
return Implementation.chain(source, event, ...(funcs as EvalFuncs));
|
|
194
193
|
}
|
|
195
194
|
}
|
|
196
195
|
|
|
197
196
|
export module push {
|
|
198
197
|
/**
|
|
199
|
-
* @param
|
|
200
|
-
* @param
|
|
201
|
-
* @param
|
|
202
|
-
* @param
|
|
198
|
+
* @param socketClientId the sockets client identifier
|
|
199
|
+
* @param url the uri to reach the socket
|
|
200
|
+
* @param channel the channel name/id
|
|
201
|
+
* @param onopen The function to be invoked when the web socket is opened.
|
|
202
|
+
* @param onmessage The function to be invoked when a message is received.
|
|
203
|
+
* @param onerror The function to be invoked when an error occurs.
|
|
204
|
+
* @param onclose The function to be invoked when the web socket is closed.
|
|
205
|
+
* @param behaviors functions which are invoked whenever a message is received
|
|
206
|
+
* @param autoConnect Whether or not to automatically open the socket. Defaults to <code>false</code>.
|
|
203
207
|
*/
|
|
204
208
|
export function init(socketClientId: string,
|
|
205
|
-
|
|
209
|
+
url: string,
|
|
206
210
|
channel: string,
|
|
207
211
|
onopen: Function,
|
|
208
212
|
onmessage: Function,
|
|
213
|
+
onerror: Function,
|
|
209
214
|
onclose: Function,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
PushImpl.init(socketClientId,
|
|
215
|
+
behaviors: any,
|
|
216
|
+
autoConnect: boolean): void {
|
|
217
|
+
PushImpl.init(socketClientId, url, channel, onopen, onmessage, onerror, onclose, behaviors, autoConnect);
|
|
213
218
|
}
|
|
214
219
|
|
|
215
220
|
/**
|
|
216
221
|
* Open the web socket on the given channel.
|
|
217
|
-
* @param
|
|
218
|
-
* @throws
|
|
222
|
+
* @param socketClientId The name of the web socket channel.
|
|
223
|
+
* @throws Error is thrown, if the channel is unknown.
|
|
219
224
|
*/
|
|
220
225
|
export function open(socketClientId: string): void {
|
|
221
226
|
PushImpl.open(socketClientId);
|
|
@@ -223,8 +228,8 @@ export module faces {
|
|
|
223
228
|
|
|
224
229
|
/**
|
|
225
230
|
* Close the web socket on the given channel.
|
|
226
|
-
* @param
|
|
227
|
-
* @throws
|
|
231
|
+
* @param socketClientId The id of the web socket client.
|
|
232
|
+
* @throws Error is thrown, if the channel is unknown.
|
|
228
233
|
*/
|
|
229
234
|
export function close(socketClientId: string): void {
|
|
230
235
|
PushImpl.close(socketClientId);
|
|
@@ -243,15 +248,16 @@ export module myfaces {
|
|
|
243
248
|
* @param event the event
|
|
244
249
|
* @param eventName event name for java.jakarta.faces.behavior.evemnt
|
|
245
250
|
* @param execute execute list as passed down in faces.ajax.request
|
|
246
|
-
* @param render
|
|
247
|
-
* @param options
|
|
251
|
+
* @param render the render list as string
|
|
252
|
+
* @param options the options which need to be mered in
|
|
248
253
|
*/
|
|
249
|
-
export function ab(source: Element, event: Event, eventName: string, execute: string, render: string, options:
|
|
254
|
+
export function ab(source: Element, event: Event, eventName: string, execute: string, render: string, options: Options = {}): void {
|
|
250
255
|
if (eventName) {
|
|
251
|
-
options[
|
|
256
|
+
options[CTX_OPTIONS_PARAMS] = options?.[CTX_OPTIONS_PARAMS] ?? {};
|
|
257
|
+
options[CTX_OPTIONS_PARAMS][$nsp(P_BEHAVIOR_EVENT)] = eventName;
|
|
252
258
|
}
|
|
253
259
|
if (execute) {
|
|
254
|
-
options[
|
|
260
|
+
options[CTX_OPTIONS_EXECUTE] = execute;
|
|
255
261
|
}
|
|
256
262
|
if (render) {
|
|
257
263
|
options[CTX_PARAM_RENDER] = render;
|
|
@@ -260,6 +266,42 @@ export module myfaces {
|
|
|
260
266
|
(window?.faces ?? window.jsf).ajax.request(source, event, options);
|
|
261
267
|
}
|
|
262
268
|
|
|
269
|
+
|
|
270
|
+
const onReadyChain: Array<() => void> = [];
|
|
271
|
+
let readyStateListener = null;
|
|
272
|
+
// noinspection JSUnusedGlobalSymbols
|
|
273
|
+
/**
|
|
274
|
+
* Helper function in the myfaces namespace to handle document ready properly for the load case
|
|
275
|
+
* the ajax case, does not need proper treatment, since it is deferred anyway.
|
|
276
|
+
* Used by command script as helper function!
|
|
277
|
+
*
|
|
278
|
+
* @param executionFunc the function to be executed upon ready
|
|
279
|
+
*/
|
|
280
|
+
export function onOnDomReady(executionFunc: () => void) {
|
|
281
|
+
if(document.readyState !== "complete") {
|
|
282
|
+
onReadyChain.push(executionFunc);
|
|
283
|
+
if(!readyStateListener) {
|
|
284
|
+
readyStateListener = () => {
|
|
285
|
+
window.removeEventListener("DOMContentLoaded", readyStateListener);
|
|
286
|
+
readyStateListener = null;
|
|
287
|
+
try {
|
|
288
|
+
onReadyChain.forEach(func => func());
|
|
289
|
+
} finally {
|
|
290
|
+
//done we clear now the ready chain
|
|
291
|
+
onReadyChain.length = 0;
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
window.addEventListener("DOMContentLoaded", readyStateListener);
|
|
295
|
+
}
|
|
296
|
+
} else {
|
|
297
|
+
if(readyStateListener) {
|
|
298
|
+
readyStateListener();
|
|
299
|
+
}
|
|
300
|
+
executionFunc();
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
}
|
|
304
|
+
|
|
263
305
|
/**
|
|
264
306
|
* legacy oam functions
|
|
265
307
|
*/
|
|
@@ -26,6 +26,24 @@ if(!window?.jsf) {
|
|
|
26
26
|
(window as any)['jsf'] = window?.jsf ?? faces;
|
|
27
27
|
window.jsf.specversion = 230000;
|
|
28
28
|
delete window.jsf.contextpath;
|
|
29
|
+
|
|
30
|
+
let faces4Init = faces.push.init;
|
|
31
|
+
/*
|
|
32
|
+
* we shim back the breaking api change from 3.0 to 4.0
|
|
33
|
+
* onerror is gone
|
|
34
|
+
*/
|
|
35
|
+
faces.push.init = (socketClientId: string,
|
|
36
|
+
url: string,
|
|
37
|
+
channel: string,
|
|
38
|
+
onopen: Function,
|
|
39
|
+
onmessage: Function,
|
|
40
|
+
// no on error api change for 4.0
|
|
41
|
+
//onerror: Function,
|
|
42
|
+
onclose: Function,
|
|
43
|
+
behaviors: any,
|
|
44
|
+
autoConnect: boolean) => {
|
|
45
|
+
faces4Init(socketClientId, url, channel, onopen, onmessage, null, onclose, behaviors, autoConnect);
|
|
46
|
+
}
|
|
29
47
|
}
|
|
30
48
|
if(!window?.myfaces?.ab) {
|
|
31
49
|
const myfaces = require("./_api").myfaces;
|