jsf.js_next_gen 4.0.0-beta-5 → 4.0.0-beta-6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/window/faces-development.js +1928 -2521
- package/dist/window/faces-development.js.br +0 -0
- package/dist/window/faces-development.js.gz +0 -0
- package/dist/window/faces-development.js.map +1 -1
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.br +0 -0
- package/dist/window/faces.js.gz +0 -0
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +1890 -2511
- package/dist/window/jsf-development.js.br +0 -0
- package/dist/window/jsf-development.js.gz +0 -0
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.br +0 -0
- package/dist/window/jsf.js.gz +0 -0
- package/dist/window/jsf.js.map +1 -1
- package/package.json +1 -1
- package/src/main/typescript/api/_api.ts +258 -0
- package/src/main/typescript/api/faces.ts +17 -245
- package/src/main/typescript/api/jsf.ts +24 -8
- package/src/main/typescript/impl/core/Const.ts +4 -2
- package/src/main/typescript/impl/util/ExtDomQuery.ts +12 -13
- package/src/main/typescript/impl/xhrCore/Response.ts +2 -2
- package/src/main/typescript/myfaces/OamSubmit.ts +6 -5
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +2 -0
- package/src/main/typescript/test/myfaces/OamSubmit.spec.ts +14 -23
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +20 -13
- package/src/main/typescript/tsconfig-typedoc.json +1 -1
- package/src/main/typescript/tsconfig.json +1 -2
- package/src/test/resources/jsf-development.js +1 -1
- package/target/api/Jsf.js +24 -11
- package/target/api/Jsf.js.map +1 -1
- package/target/api/_api.js +246 -0
- package/target/api/_api.js.map +1 -0
- package/target/api/_faces.js +251 -0
- package/target/api/_faces.js.map +1 -0
- package/target/api/faces.js +20 -247
- package/target/api/faces.js.map +1 -1
- package/target/impl/AjaxImpl.js +53 -61
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/PushImpl.js +38 -41
- package/target/impl/PushImpl.js.map +1 -1
- package/target/impl/core/Const.js +4 -2
- package/target/impl/core/Const.js.map +1 -1
- 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 +9 -18
- 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 +137 -210
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/Lang.js +21 -28
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/xhrCore/ErrorData.js +36 -61
- 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/RequestDataResolver.js +16 -19
- 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 +18 -18
- package/target/impl/xhrCore/Response.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +116 -130
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +68 -98
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +81 -91
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +20 -18
- 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 +160 -82
- 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 +235 -130
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js +162 -18
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
- package/target/test/impl/ImplTest.spec.js +34 -61
- package/target/test/impl/ImplTest.spec.js.map +1 -1
- package/target/test/impl/ImplTest_23.spec.js +35 -64
- package/target/test/impl/ImplTest_23.spec.js.map +1 -1
- package/target/test/impl/SeparatorCharsTest.spec.js +19 -19
- package/target/test/impl/SeparatorCharsTest.spec.js.map +1 -1
- package/target/test/myfaces/OamSubmit.spec.js +34 -41
- 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 +47 -78
- 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 +49 -80
- package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +39 -70
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +76 -113
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +100 -140
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +118 -87
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest23.spec.js +120 -89
- package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
- package/target/test/xhrCore/ShadowDomTest.spec.js +31 -62
- 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 +41 -15
- package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
- package/webpack.config.js +71 -0
- package/webpack.config.js.map +1 -0
package/package.json
CHANGED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/*! Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
3
|
+
* this work for additional information regarding copyright ownership.
|
|
4
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
5
|
+
* (the "License"); you may not use this file except in compliance with
|
|
6
|
+
* the License. You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import {Implementation} from "../impl/AjaxImpl";
|
|
17
|
+
import {PushImpl} from "../impl/PushImpl";
|
|
18
|
+
import {oam as _oam} from "../myfaces/OamSubmit";
|
|
19
|
+
import {$nsp} from "../impl/core/Const";
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
declare const window: any;
|
|
23
|
+
//we use modules to get a proper jsdoc and static/map structure in the calls
|
|
24
|
+
//as per spec requirement
|
|
25
|
+
export module faces {
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
/*
|
|
29
|
+
* Version of the implementation for the faces.ts.
|
|
30
|
+
* <p />
|
|
31
|
+
* as specified within the jsf specifications faces.html:
|
|
32
|
+
* <ul>
|
|
33
|
+
* <li>left two digits major release number</li>
|
|
34
|
+
* <li>middle two digits minor spec release number</li>
|
|
35
|
+
* <li>right two digits bug release number</li>
|
|
36
|
+
* </ul>
|
|
37
|
+
* @constant
|
|
38
|
+
*/
|
|
39
|
+
export var specversion = 400000;
|
|
40
|
+
/**
|
|
41
|
+
* Implementation version as specified within the jsf specification.
|
|
42
|
+
* <p />
|
|
43
|
+
* A number increased with every implementation version
|
|
44
|
+
* and reset by moving to a new spec release number
|
|
45
|
+
*
|
|
46
|
+
* @constant
|
|
47
|
+
*/
|
|
48
|
+
export var implversion = 0;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* SeparatorChar as defined by UINamingContainer.getNamingContainerSeparatorChar()
|
|
52
|
+
* @type {Char}
|
|
53
|
+
*/
|
|
54
|
+
export var separatorchar = getSeparatorChar();
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* This method is responsible for the return of a given project stage as defined
|
|
58
|
+
* by the jsf specification.
|
|
59
|
+
* <p/>
|
|
60
|
+
* Valid return values are:
|
|
61
|
+
* <ul>
|
|
62
|
+
* <li>"Production"</li>
|
|
63
|
+
* <li>"Development"</li>
|
|
64
|
+
* <li>"SystemTest"</li>
|
|
65
|
+
* <li>"UnitTest"</li>
|
|
66
|
+
* </li>
|
|
67
|
+
*
|
|
68
|
+
* @return {String} the current project state emitted by the server side method:
|
|
69
|
+
* <i>jakarta.faces.application.Application.getProjectStage()</i>
|
|
70
|
+
*/
|
|
71
|
+
export function getProjectStage(): string {
|
|
72
|
+
return Implementation.getProjectStage();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* collect and encode data for a given form element (must be of type form)
|
|
77
|
+
* find the jakarta.faces.ViewState element and encode its value as well!
|
|
78
|
+
* return a concatenated string of the encoded values!
|
|
79
|
+
*
|
|
80
|
+
* @throws an exception in case of the given element not being of type form!
|
|
81
|
+
* https://issues.apache.org/jira/browse/MYFACES-2110
|
|
82
|
+
*/
|
|
83
|
+
export function getViewState(formElement: Element | string): string {
|
|
84
|
+
return Implementation.getViewState(formElement);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* returns the window identifier for the given node / window
|
|
89
|
+
* @return the window identifier or null if none is found
|
|
90
|
+
* @param rootNode
|
|
91
|
+
*/
|
|
92
|
+
export function getClientWindow(rootNode?: Element | string): string {
|
|
93
|
+
return Implementation.getClientWindow(rootNode);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//private helper functions
|
|
97
|
+
function getSeparatorChar() {
|
|
98
|
+
return Implementation.getSeparatorChar();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
export module ajax {
|
|
103
|
+
"use strict";
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* this function has to send the ajax requests
|
|
107
|
+
*
|
|
108
|
+
* following requestInternal conditions must be met:
|
|
109
|
+
* <ul>
|
|
110
|
+
* <li> the requestInternal must be sent asynchronously! </li>
|
|
111
|
+
* <li> the requestInternal must be a POST!!! requestInternal </li>
|
|
112
|
+
* <li> the requestInternal url must be the form action attribute </li>
|
|
113
|
+
* <li> all requests must be queued with a client side requestInternal queue to ensure the requestInternal ordering!</li>
|
|
114
|
+
* </ul>
|
|
115
|
+
*
|
|
116
|
+
* @param {String|Node} element: any dom element no matter being it html or jsf, from which the event is emitted
|
|
117
|
+
* @param {EVENT} event: any javascript event supported by that object
|
|
118
|
+
* @param {Map} options : map of options being pushed into the ajax cycle
|
|
119
|
+
*/
|
|
120
|
+
export function request(element: Element, event?: Event, options?: Context) {
|
|
121
|
+
Implementation.request(element, event, options)
|
|
122
|
+
//Implementation.getInstance().requestInternal(element, event, options);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* response handler
|
|
127
|
+
* @param request the request object having triggered this response
|
|
128
|
+
* @param context the request context
|
|
129
|
+
*
|
|
130
|
+
* TODO add info on what can be in the context
|
|
131
|
+
*/
|
|
132
|
+
export function response(request: XMLHttpRequest, context?: Context) {
|
|
133
|
+
Implementation.response(request, context);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Adds an error handler to our global error queue.
|
|
138
|
+
* the error handler must be of the format <i>function errorListener(<errorData>)</i>
|
|
139
|
+
* with errorData being of following format:
|
|
140
|
+
* <ul>
|
|
141
|
+
* <li> errorData.type : "error"</li>
|
|
142
|
+
* <li> errorData.status : the error status message</li>
|
|
143
|
+
* <li> errorData.serverErrorName : the server error name in case of a server error</li>
|
|
144
|
+
* <li> errorData.serverErrorMessage : the server error message in case of a server error</li>
|
|
145
|
+
* <li> errorData.source : the issuing source element which triggered the requestInternal </li>
|
|
146
|
+
* <li> eventData.responseCode: the response code (aka http requestInternal response code, 401 etc...) </li>
|
|
147
|
+
* <li> eventData.responseText: the requestInternal response text </li>
|
|
148
|
+
* <li> eventData.responseXML: the requestInternal response xml </li>
|
|
149
|
+
* </ul>
|
|
150
|
+
*
|
|
151
|
+
* @param {function} errorListener error handler must be of the format <i>function errorListener(<errorData>)</i>
|
|
152
|
+
*/
|
|
153
|
+
export function addOnError(errorFunc: (data: ErrorData) => void) {
|
|
154
|
+
Implementation.addOnError(<any>errorFunc);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Adds a global event listener to the ajax event queue. The event listener must be a function
|
|
159
|
+
* of following format: <i>function eventListener(<eventData>)</i>
|
|
160
|
+
*
|
|
161
|
+
* @param {function} eventListener event must be of the format <i>function eventListener(<eventData>)</i>
|
|
162
|
+
*/
|
|
163
|
+
export function addOnEvent(eventFunc: (data: EventData) => void) {
|
|
164
|
+
Implementation.addOnEvent(<any>eventFunc);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export module util {
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* varargs function which executes a chain of code (functions or any other code)
|
|
172
|
+
*
|
|
173
|
+
* if any of the code returns false, the execution
|
|
174
|
+
* is terminated prematurely skipping the rest of the code!
|
|
175
|
+
*
|
|
176
|
+
* @param {DomNode} source, the callee object
|
|
177
|
+
* @param {Event} event, the event object of the callee event triggering this function
|
|
178
|
+
* @param funcs ... arbitrary array of functions or strings
|
|
179
|
+
* @returns true if the chain has succeeded false otherwise
|
|
180
|
+
*/
|
|
181
|
+
export function chain(source, event, ...funcs: Array<Function | string>): boolean {
|
|
182
|
+
return Implementation.chain(source, event, ...(funcs as EvalFuncs));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export module push {
|
|
187
|
+
/**
|
|
188
|
+
* @param {function} onopen The function to be invoked when the web socket is opened.
|
|
189
|
+
* @param {function} onmessage The function to be invoked when a message is received.
|
|
190
|
+
* @param {function} onclose The function to be invoked when the web socket is closed.
|
|
191
|
+
* @param {boolean} autoconnect Whether or not to immediately open the socket. Defaults to <code>false</code>.
|
|
192
|
+
*/
|
|
193
|
+
export function init(socketClientId: string,
|
|
194
|
+
uri: string,
|
|
195
|
+
channel: string,
|
|
196
|
+
onopen: Function,
|
|
197
|
+
onmessage: Function,
|
|
198
|
+
onclose: Function,
|
|
199
|
+
behaviorScripts: any,
|
|
200
|
+
autoconnect: boolean) {
|
|
201
|
+
PushImpl.init(socketClientId, uri, channel, onopen, onmessage, onclose, behaviorScripts, autoconnect);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Open the web socket on the given channel.
|
|
206
|
+
* @param {string} channel The name of the web socket channel.
|
|
207
|
+
* @throws {Error} When channel is unknown.
|
|
208
|
+
*/
|
|
209
|
+
export function open(socketClientId: string) {
|
|
210
|
+
PushImpl.open(socketClientId);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Close the web socket on the given channel.
|
|
215
|
+
* @param {string} channel The name of the web socket channel.
|
|
216
|
+
* @throws {Error} When channel is unknown.
|
|
217
|
+
*/
|
|
218
|
+
export function close(socketClientId: string) {
|
|
219
|
+
PushImpl.close(socketClientId);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export module myfaces {
|
|
226
|
+
/**
|
|
227
|
+
* AB function similar to mojarra and Primefaces
|
|
228
|
+
* not part of the spec but a convenience accessor method
|
|
229
|
+
* Code provided by Thomas Andraschko
|
|
230
|
+
*
|
|
231
|
+
* @param source the event source
|
|
232
|
+
* @param event the event
|
|
233
|
+
* @param eventName event name for java.jakarta.faces.behavior.evemnt
|
|
234
|
+
* @param execute execute list as passed down in faces.ajax.request
|
|
235
|
+
* @param render
|
|
236
|
+
* @param options
|
|
237
|
+
*/
|
|
238
|
+
export function ab(source: Element, event: Event, eventName: string, execute: string, render: string, options: Context = {}) {
|
|
239
|
+
if (eventName) {
|
|
240
|
+
options[$nsp("jakarta.faces.behavior.event")] = eventName;
|
|
241
|
+
}
|
|
242
|
+
if (execute) {
|
|
243
|
+
options["execute"] = execute;
|
|
244
|
+
}
|
|
245
|
+
if (render) {
|
|
246
|
+
options["render"] = render;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
(window?.faces ?? window.jsf).ajax.request(source, event, options);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* legacy oam functions
|
|
254
|
+
*/
|
|
255
|
+
export const oam = _oam;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
|
|
@@ -13,253 +13,25 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
16
|
///<reference types='../../types/typedefs'/>
|
|
17
|
+
"use strict";
|
|
18
|
+
declare const window: any;
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"use strict";
|
|
28
|
-
|
|
29
|
-
/*
|
|
30
|
-
* Version of the implementation for the faces.js.
|
|
31
|
-
* <p />
|
|
32
|
-
* as specified within the jsf specifications faces.html:
|
|
33
|
-
* <ul>
|
|
34
|
-
* <li>left two digits major release number</li>
|
|
35
|
-
* <li>middle two digits minor spec release number</li>
|
|
36
|
-
* <li>right two digits bug release number</li>
|
|
37
|
-
* </ul>
|
|
38
|
-
* @constant
|
|
39
|
-
*/
|
|
40
|
-
export var specversion = 400000;
|
|
41
|
-
/**
|
|
42
|
-
* Implementation version as specified within the jsf specification.
|
|
43
|
-
* <p />
|
|
44
|
-
* A number increased with every implementation version
|
|
45
|
-
* and reset by moving to a new spec release number
|
|
46
|
-
*
|
|
47
|
-
* @constant
|
|
48
|
-
*/
|
|
49
|
-
export var implversion = 0;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* SeparatorChar as defined by UINamingContainer.getNamingContainerSeparatorChar()
|
|
53
|
-
* @type {Char}
|
|
54
|
-
*/
|
|
55
|
-
export var separatorchar = getSeparatorChar();
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* This method is responsible for the return of a given project stage as defined
|
|
59
|
-
* by the jsf specification.
|
|
60
|
-
* <p/>
|
|
61
|
-
* Valid return values are:
|
|
62
|
-
* <ul>
|
|
63
|
-
* <li>"Production"</li>
|
|
64
|
-
* <li>"Development"</li>
|
|
65
|
-
* <li>"SystemTest"</li>
|
|
66
|
-
* <li>"UnitTest"</li>
|
|
67
|
-
* </li>
|
|
68
|
-
*
|
|
69
|
-
* @return {String} the current project state emitted by the server side method:
|
|
70
|
-
* <i>jakarta.faces.application.Application.getProjectStage()</i>
|
|
71
|
-
*/
|
|
72
|
-
export function getProjectStage(): string {
|
|
73
|
-
return Implementation.getProjectStage();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* collect and encode data for a given form element (must be of type form)
|
|
78
|
-
* find the jakarta.faces.ViewState element and encode its value as well!
|
|
79
|
-
* return a concatenated string of the encoded values!
|
|
80
|
-
*
|
|
81
|
-
* @throws an exception in case of the given element not being of type form!
|
|
82
|
-
* https://issues.apache.org/jira/browse/MYFACES-2110
|
|
83
|
-
*/
|
|
84
|
-
export function getViewState(formElement: Element | string): string {
|
|
85
|
-
return Implementation.getViewState(formElement);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* returns the window identifier for the given node / window
|
|
90
|
-
* @return the window identifier or null if none is found
|
|
91
|
-
* @param rootNode
|
|
92
|
-
*/
|
|
93
|
-
export function getClientWindow(rootNode?: Element | string): string {
|
|
94
|
-
return Implementation.getClientWindow(rootNode);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
//private helper functions
|
|
98
|
-
function getSeparatorChar() {
|
|
99
|
-
return Implementation.getSeparatorChar();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
export module ajax {
|
|
104
|
-
"use strict";
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* this function has to send the ajax requests
|
|
108
|
-
*
|
|
109
|
-
* following requestInternal conditions must be met:
|
|
110
|
-
* <ul>
|
|
111
|
-
* <li> the requestInternal must be sent asynchronously! </li>
|
|
112
|
-
* <li> the requestInternal must be a POST!!! requestInternal </li>
|
|
113
|
-
* <li> the requestInternal url must be the form action attribute </li>
|
|
114
|
-
* <li> all requests must be queued with a client side requestInternal queue to ensure the requestInternal ordering!</li>
|
|
115
|
-
* </ul>
|
|
116
|
-
*
|
|
117
|
-
* @param {String|Node} element: any dom element no matter being it html or jsf, from which the event is emitted
|
|
118
|
-
* @param {EVENT} event: any javascript event supported by that object
|
|
119
|
-
* @param {Map} options : map of options being pushed into the ajax cycle
|
|
120
|
-
*/
|
|
121
|
-
export function request(element: Element, event?: Event, options?: Context) {
|
|
122
|
-
Implementation.request(element, event, options)
|
|
123
|
-
//Implementation.getInstance().requestInternal(element, event, options);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* response handler
|
|
128
|
-
* @param request the request object having triggered this response
|
|
129
|
-
* @param context the request context
|
|
130
|
-
*
|
|
131
|
-
* TODO add info on what can be in the context
|
|
132
|
-
*/
|
|
133
|
-
export function response(request: XMLHttpRequest, context?: Context) {
|
|
134
|
-
Implementation.response(request, context);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Adds an error handler to our global error queue.
|
|
139
|
-
* the error handler must be of the format <i>function errorListener(<errorData>)</i>
|
|
140
|
-
* with errorData being of following format:
|
|
141
|
-
* <ul>
|
|
142
|
-
* <li> errorData.type : "error"</li>
|
|
143
|
-
* <li> errorData.status : the error status message</li>
|
|
144
|
-
* <li> errorData.serverErrorName : the server error name in case of a server error</li>
|
|
145
|
-
* <li> errorData.serverErrorMessage : the server error message in case of a server error</li>
|
|
146
|
-
* <li> errorData.source : the issuing source element which triggered the requestInternal </li>
|
|
147
|
-
* <li> eventData.responseCode: the response code (aka http requestInternal response code, 401 etc...) </li>
|
|
148
|
-
* <li> eventData.responseText: the requestInternal response text </li>
|
|
149
|
-
* <li> eventData.responseXML: the requestInternal response xml </li>
|
|
150
|
-
* </ul>
|
|
151
|
-
*
|
|
152
|
-
* @param {function} errorListener error handler must be of the format <i>function errorListener(<errorData>)</i>
|
|
153
|
-
*/
|
|
154
|
-
export function addOnError(errorFunc: (data: ErrorData) => void) {
|
|
155
|
-
Implementation.addOnError(<any>errorFunc);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Adds a global event listener to the ajax event queue. The event listener must be a function
|
|
160
|
-
* of following format: <i>function eventListener(<eventData>)</i>
|
|
161
|
-
*
|
|
162
|
-
* @param {function} eventListener event must be of the format <i>function eventListener(<eventData>)</i>
|
|
163
|
-
*/
|
|
164
|
-
export function addOnEvent(eventFunc: (data: EventData) => void) {
|
|
165
|
-
Implementation.addOnEvent(<any>eventFunc);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export module util {
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* varargs function which executes a chain of code (functions or any other code)
|
|
173
|
-
*
|
|
174
|
-
* if any of the code returns false, the execution
|
|
175
|
-
* is terminated prematurely skipping the rest of the code!
|
|
176
|
-
*
|
|
177
|
-
* @param {DomNode} source, the callee object
|
|
178
|
-
* @param {Event} event, the event object of the callee event triggering this function
|
|
179
|
-
* @param funcs ... arbitrary array of functions or strings
|
|
180
|
-
* @returns true if the chain has succeeded false otherwise
|
|
181
|
-
*/
|
|
182
|
-
export function chain(source, event, ...funcs: Array<Function | string>): boolean {
|
|
183
|
-
return Implementation.chain(source, event, ...(funcs as EvalFuncs));
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export module push {
|
|
188
|
-
/**
|
|
189
|
-
* @param {function} onopen The function to be invoked when the web socket is opened.
|
|
190
|
-
* @param {function} onmessage The function to be invoked when a message is received.
|
|
191
|
-
* @param {function} onclose The function to be invoked when the web socket is closed.
|
|
192
|
-
* @param {boolean} autoconnect Whether or not to immediately open the socket. Defaults to <code>false</code>.
|
|
193
|
-
*/
|
|
194
|
-
export function init(socketClientId: string,
|
|
195
|
-
uri: string,
|
|
196
|
-
channel: string,
|
|
197
|
-
onopen: Function,
|
|
198
|
-
onmessage: Function,
|
|
199
|
-
onclose: Function,
|
|
200
|
-
behaviorScripts: any,
|
|
201
|
-
autoconnect: boolean) {
|
|
202
|
-
PushImpl.init(socketClientId, uri, channel, onopen, onmessage, onclose, behaviorScripts, autoconnect);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Open the web socket on the given channel.
|
|
207
|
-
* @param {string} channel The name of the web socket channel.
|
|
208
|
-
* @throws {Error} When channel is unknown.
|
|
209
|
-
*/
|
|
210
|
-
export function open(socketClientId: string) {
|
|
211
|
-
PushImpl.open(socketClientId);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Close the web socket on the given channel.
|
|
216
|
-
* @param {string} channel The name of the web socket channel.
|
|
217
|
-
* @throws {Error} When channel is unknown.
|
|
218
|
-
*/
|
|
219
|
-
export function close(socketClientId: string) {
|
|
220
|
-
PushImpl.close(socketClientId);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
}
|
|
20
|
+
/**
|
|
21
|
+
* faces.js init layer which provides as per spec the proper
|
|
22
|
+
* window namespace if it does not exist already
|
|
23
|
+
*/
|
|
24
|
+
if(!window.faces) {
|
|
25
|
+
//we lazily load the code to prevent ram bloat
|
|
26
|
+
const faces = require("./_api").faces;
|
|
27
|
+
window['faces'] = (window as any)?.faces ?? faces;
|
|
224
28
|
}
|
|
29
|
+
if(!window?.myfaces?.ab) {
|
|
30
|
+
const myfaces = require("./_api").myfaces;
|
|
225
31
|
|
|
226
|
-
//
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* AB function similar to mojarra and Primefaces
|
|
231
|
-
* not part of the spec but a convenience accessor method
|
|
232
|
-
* Code provided by Thomas Andraschko
|
|
233
|
-
*
|
|
234
|
-
* @param source the event source
|
|
235
|
-
* @param event the event
|
|
236
|
-
* @param eventName event name for java.jakarta.faces.behavior.evemnt
|
|
237
|
-
* @param execute execute list as passed down in faces.ajax.request
|
|
238
|
-
* @param render
|
|
239
|
-
* @param options
|
|
240
|
-
*/
|
|
241
|
-
export function ab(source: Element, event: Event, eventName: string, execute: string, render: string, options: Context = {}) {
|
|
242
|
-
if (eventName) {
|
|
243
|
-
if(!(window as any)?.jsf) {
|
|
244
|
-
options["jakarta.faces.behavior.event"] = eventName;
|
|
245
|
-
} else {
|
|
246
|
-
options["javax.faces.behavior.event"] = eventName;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
if (execute) {
|
|
250
|
-
options["execute"] = execute;
|
|
251
|
-
}
|
|
252
|
-
if (render) {
|
|
253
|
-
options["render"] = render;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
faces.ajax.request(source, event, options);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* legacy oam functions
|
|
261
|
-
*/
|
|
262
|
-
export const oam = _oam;
|
|
32
|
+
//namespace might be extended is not exclusively reserved so we merge
|
|
33
|
+
window["myfaces"] = window?.myfaces ?? {};
|
|
34
|
+
Object.keys(myfaces).forEach(key => window.myfaces[key] = window.myfaces?.[key] ?? myfaces[key]);
|
|
263
35
|
}
|
|
264
|
-
|
|
265
|
-
|
|
36
|
+
export var faces = window.faces;
|
|
37
|
+
export var myfaces = window.myfaces;
|
|
@@ -13,19 +13,35 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
///<reference types='../../types/typedefs'/>
|
|
17
|
+
"use strict";
|
|
18
18
|
declare const window: any;
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* jsf.js
|
|
22
|
-
*
|
|
21
|
+
* jsf.js init layer which provides as per spec the proper
|
|
22
|
+
* window namespace if it does not exist already
|
|
23
|
+
* if this file is included then the code falls back with its namespaces
|
|
24
|
+
* on jsf2.3 or earlier level, for 4.0+ please include faces.js
|
|
23
25
|
*/
|
|
24
26
|
if(!window.jsf) {
|
|
25
|
-
|
|
26
|
-
delete window.faces;
|
|
27
|
-
}
|
|
27
|
+
const faces = require("./_api").faces;
|
|
28
28
|
window['jsf'] = (window as any)?.jsf ?? faces;
|
|
29
29
|
window.jsf.specversion = 230000;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
if(!window?.myfaces?.ab) {
|
|
32
|
+
const myfaces = require("./_api").myfaces;
|
|
33
|
+
//namespace might be extended is not exclusively reserved so we merge
|
|
34
|
+
window["myfaces"] = window?.myfaces ?? {};
|
|
35
|
+
if(!window?.myfaces?.ab) {
|
|
36
|
+
const myfaces = require("./_api").myfaces;
|
|
37
|
+
|
|
38
|
+
//namespace might be extended is not exclusively reserved so we merge
|
|
39
|
+
window["myfaces"] = window?.myfaces ?? {};
|
|
40
|
+
Object.keys(myfaces).forEach(key => window.myfaces[key] = window.myfaces?.[key] ?? myfaces[key]);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
alert("init")
|
|
45
|
+
|
|
46
|
+
export var jsf = window.jsf;
|
|
47
|
+
export var myfaces = window.myfaces;
|
|
@@ -179,10 +179,12 @@ declare const window: any;
|
|
|
179
179
|
* helper to remap the namespaces variables for 2.3
|
|
180
180
|
* from 2.3 to 4.0 every javax namespace has been changed
|
|
181
181
|
* to faces
|
|
182
|
+
* To take the compatibility layer out this method just has to be
|
|
183
|
+
* changed to a simple value passthrough
|
|
182
184
|
*/
|
|
183
185
|
|
|
184
|
-
export function $nsp(inputNamespace
|
|
185
|
-
if(!inputNamespace?.replace) {
|
|
186
|
+
export function $nsp(inputNamespace?: any): any {
|
|
187
|
+
if((!inputNamespace) || !inputNamespace?.replace) {
|
|
186
188
|
return inputNamespace;
|
|
187
189
|
}
|
|
188
190
|
return (!!window?.faces) ? inputNamespace.replace(/javax\.faces/gi,"jakarta.faces"): inputNamespace.replace(/jakarta\.faces/gi, "javax.faces");
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import {Config, IValueHolder, Optional, DomQuery, DQ, Stream, ArrayCollector} from "mona-dish";
|
|
17
17
|
import {$nsp, P_WINDOW_ID} from "../core/Const";
|
|
18
|
-
import {AssocArrayCollector} from "mona-dish/src/main/typescript/SourcesCollectors";
|
|
19
18
|
|
|
20
19
|
declare let window: any;
|
|
21
20
|
|
|
@@ -29,17 +28,16 @@ declare let window: any;
|
|
|
29
28
|
*/
|
|
30
29
|
const IS_FACES_SOURCE = (source?: string): boolean => {
|
|
31
30
|
//spec version smaller 4 we have to deal with the jsf namespace
|
|
32
|
-
|
|
33
|
-
// fallback into 2.3 api level
|
|
34
|
-
return source && !!(source?.search(/\/javax\.faces\.resource.*\/jsf\.js.*/) != -1 ||
|
|
35
|
-
source?.search(/\/jsf-development\.js.*/) != -1 ||
|
|
36
|
-
source?.search(/\/jsf-uncompressed\.js.*/) != -1 ||
|
|
37
|
-
source?.search(/\/jsf[^.]*\.js.*ln=javax.faces.*/gi) != -1);
|
|
38
|
-
}
|
|
31
|
+
|
|
39
32
|
return source && !!(source?.search(/\/jakarta\.faces\.resource.*\/faces\.js.*/) != -1 ||
|
|
40
33
|
source?.search(/\/faces-development\.js.*/) != -1 ||
|
|
41
34
|
source?.search(/\/faces-uncompressed\.js.*/) != -1 ||
|
|
42
|
-
source?.search(/\/faces[^.]*\.js.*ln=jakarta.faces.*/gi) != -1
|
|
35
|
+
source?.search(/\/faces[^.]*\.js.*ln=jakarta.faces.*/gi) != -1 ||
|
|
36
|
+
//fallback without check for jsf, that way we allow both bookmarks
|
|
37
|
+
source?.search(/\/javax\.faces\.resource.*\/jsf\.js.*/) != -1 ||
|
|
38
|
+
source?.search(/\/jsf-development\.js.*/) != -1 ||
|
|
39
|
+
source?.search(/\/jsf-uncompressed\.js.*/) != -1 ||
|
|
40
|
+
source?.search(/\/jsf[^.]*\.js.*ln=javax.faces.*/gi) != -1);
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
/**
|
|
@@ -51,10 +49,7 @@ const IS_FACES_SOURCE = (source?: string): boolean => {
|
|
|
51
49
|
* @constructor
|
|
52
50
|
*/
|
|
53
51
|
const IS_INTERNAL_SOURCE = (source: string): boolean => {
|
|
54
|
-
|
|
55
|
-
return source.search(/\/jsf[^.]*\.js.*ln=myfaces.testscripts.*/gi) != -1;
|
|
56
|
-
}
|
|
57
|
-
return source.search(/\/faces[^.]*\.js.*ln=myfaces.testscripts.*/gi) != -1;
|
|
52
|
+
return source.search(/\/faces[^.]*\.js.*ln=myfaces.testscripts.*/gi) != -1 || source.search(/\/jsf[^.]*\.js.*ln=myfaces.testscripts.*/gi) != -1;
|
|
58
53
|
}
|
|
59
54
|
|
|
60
55
|
|
|
@@ -188,6 +183,10 @@ export class ExtDomquery extends DQ {
|
|
|
188
183
|
|
|
189
184
|
export const ExtDQ = ExtDomquery;
|
|
190
185
|
|
|
186
|
+
/**
|
|
187
|
+
* in order to reduce the number of interception points for the fallbacks we add
|
|
188
|
+
* the namespace remapping straight to our config accessors
|
|
189
|
+
*/
|
|
191
190
|
export class ExtConfig extends Config {
|
|
192
191
|
|
|
193
192
|
constructor(root: any) {
|
|
@@ -47,8 +47,8 @@ export module Response {
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
* Standardized faces.
|
|
51
|
-
* this one is called straight from faces.
|
|
50
|
+
* Standardized faces.ts response
|
|
51
|
+
* this one is called straight from faces.ts.response
|
|
52
52
|
*
|
|
53
53
|
* The processing follows the spec by going for the responseXML
|
|
54
54
|
* and processing its tags
|
|
@@ -105,13 +105,14 @@ export module oam {
|
|
|
105
105
|
}
|
|
106
106
|
} catch (e) {
|
|
107
107
|
window?.console.error(e);
|
|
108
|
+
} finally {
|
|
109
|
+
form.attr(ATTR_TARGET).value = oldTarget;
|
|
110
|
+
Stream.ofAssoc(params).each((param: [string, any]) => {
|
|
111
|
+
myfaces.oam.clearHiddenInput(formName, param[0]);
|
|
112
|
+
});
|
|
113
|
+
myfaces.oam.clearHiddenInput(formName, `${formName}:_idcl`);
|
|
108
114
|
}
|
|
109
115
|
|
|
110
|
-
form.attr(ATTR_TARGET).value = oldTarget;
|
|
111
|
-
Stream.ofAssoc(params).each((param: [string, any]) => {
|
|
112
|
-
myfaces.oam.clearHiddenInput(formName, param[0]);
|
|
113
|
-
});
|
|
114
|
-
myfaces.oam.clearHiddenInput(formName, `${formName}:_idcl`);
|
|
115
116
|
});
|
|
116
117
|
return false;
|
|
117
118
|
};
|