jsf.js_next_gen 1.0.0-beta-17 → 1.0.0-beta-19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/functions/myfaces.ab.html +1 -0
- package/dist/docs/modules/myfaces.html +5 -0
- package/dist/docs/variables/myfaces.oam.html +50 -0
- package/dist/window/jsf-development.js +500 -205
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +2 -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 +1 -1
- package/remap.js +1 -1
- package/remap.js.map +1 -1
- package/remap.ts +1 -1
- package/src/main/typescript/api/Jsf.ts +8 -10
- package/src/main/typescript/impl/AjaxImpl.ts +85 -49
- package/src/main/typescript/impl/PushImpl.ts +16 -0
- package/src/main/typescript/impl/util/Assertions.ts +15 -0
- package/src/main/typescript/impl/util/AsyncQueue.ts +45 -17
- package/src/main/typescript/impl/util/AsyncRunnable.ts +5 -3
- package/src/main/typescript/impl/util/ExtDomQuery.ts +23 -8
- package/src/main/typescript/impl/util/IListener.ts +18 -0
- package/src/main/typescript/impl/xhrCore/ErrorData.ts +15 -0
- package/src/main/typescript/impl/xhrCore/EventData.ts +17 -2
- package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +15 -0
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +3 -3
- package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +3 -3
- package/src/main/typescript/impl/xhrCore/Response.ts +5 -6
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +31 -11
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +86 -90
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +34 -28
- package/src/main/typescript/myfaces/OamSubmit.ts +151 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +4 -0
- package/src/main/typescript/test/myfaces/OamSubmit.spec.ts +50 -0
- package/src/main/typescript/test/xhrCore/FakeWebsocket.ts +15 -0
- package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +15 -0
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +15 -0
- package/src/main/typescript/test/xhrCore/WebsocketTest.ts +15 -0
- package/target/api/Jsf.js +6 -5
- package/target/api/Jsf.js.map +1 -1
- package/target/impl/AjaxImpl.js +80 -39
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/PushImpl.js +17 -2
- package/target/impl/PushImpl.js.map +1 -1
- package/target/impl/util/Assertions.js +15 -0
- package/target/impl/util/Assertions.js.map +1 -1
- package/target/impl/util/AsyncQueue.js +28 -15
- package/target/impl/util/AsyncQueue.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +22 -7
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/IListener.js +3 -0
- package/target/impl/util/IListener.js.map +1 -0
- package/target/impl/xhrCore/ErrorData.js +15 -0
- package/target/impl/xhrCore/ErrorData.js.map +1 -1
- package/target/impl/xhrCore/EventData.js +17 -2
- package/target/impl/xhrCore/EventData.js.map +1 -1
- package/target/impl/xhrCore/RequestDataResolver.js +3 -3
- package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
- package/target/impl/xhrCore/ResonseDataResolver.js +3 -3
- package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
- package/target/impl/xhrCore/Response.js +5 -5
- package/target/impl/xhrCore/Response.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +31 -9
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +86 -88
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +32 -27
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +128 -0
- package/target/myfaces/OamSubmit.js.map +1 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +3 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/myfaces/OamSubmit.spec.js +46 -0
- package/target/test/myfaces/OamSubmit.spec.js.map +1 -0
- package/target/test/xhrCore/FakeWebsocket.js +15 -0
- package/target/test/xhrCore/FakeWebsocket.js.map +1 -1
- package/target/test/xhrCore/FileUploadTest.spec.js +15 -0
- package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +15 -0
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/WebsocketTest.js +15 -0
- package/target/test/xhrCore/WebsocketTest.js.map +1 -1
- package/webpack.config.js +0 -7
- package/webpack.config.js.map +1 -1
- package/webpack.config.ts +0 -7
- package/src/main/typescript/impl/util/ListenerQueue.ts +0 -3
package/package.json
CHANGED
package/remap.js
CHANGED
|
@@ -31,7 +31,7 @@ var option = {
|
|
|
31
31
|
//development
|
|
32
32
|
files: 'dist/**/*.js',
|
|
33
33
|
from: (buildStage == "-development") ? /jsf-development.js\.map/g : /jsf.js\.map/g,
|
|
34
|
-
to: "jsf".concat(buildStage, ".js.map\n//# sourceMappingURL=jsf").concat(buildStage, ".js.map.jsf?ln=
|
|
34
|
+
to: "jsf".concat(buildStage, ".js.map\n//# sourceMappingURL=jsf").concat(buildStage, ".js.map.jsf?ln=javax.faces")
|
|
35
35
|
};
|
|
36
36
|
try {
|
|
37
37
|
var result = replace.sync(option);
|
package/remap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remap.js","sourceRoot":"","sources":["remap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;GAKG;AAEH,2EAA2E;AAC3E,uDAAuD;AACvD,IAAM,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE3C,sCAAsC;AACtC,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,sCAAsC;AACtC,IAAM,UAAU,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;AACtE,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;AAEtD,IAAI,MAAM,GAAG;IACT,aAAa;IACb,KAAK,EAAE,cAAc;IACrB,IAAI,EAAE,CAAC,UAAU,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,cAAc;IAClF,EAAE,EAAE,aAAM,UAAU,8CAAoC,UAAU
|
|
1
|
+
{"version":3,"file":"remap.js","sourceRoot":"","sources":["remap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;GAKG;AAEH,2EAA2E;AAC3E,uDAAuD;AACvD,IAAM,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE3C,sCAAsC;AACtC,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,sCAAsC;AACtC,IAAM,UAAU,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;AACtE,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;AAEtD,IAAI,MAAM,GAAG;IACT,aAAa;IACb,KAAK,EAAE,cAAc;IACrB,IAAI,EAAE,CAAC,UAAU,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,cAAc;IAClF,EAAE,EAAE,aAAM,UAAU,8CAAoC,UAAU,+BAA4B;CACjG,CAAA;AAED,IAAI;IACA,IAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;CAC/C;AAAC,OAAO,KAAK,EAAE;IACZ,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;CAC3C"}
|
package/remap.ts
CHANGED
|
@@ -35,7 +35,7 @@ let option = {
|
|
|
35
35
|
//development
|
|
36
36
|
files: 'dist/**/*.js',
|
|
37
37
|
from: (buildStage == "-development") ? /jsf-development.js\.map/g : /jsf.js\.map/g,
|
|
38
|
-
to: `jsf${buildStage}.js.map\n//# sourceMappingURL=jsf${buildStage}.js.map.jsf?ln=
|
|
38
|
+
to: `jsf${buildStage}.js.map\n//# sourceMappingURL=jsf${buildStage}.js.map.jsf?ln=javax.faces`
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
try {
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
|
|
19
19
|
import {Implementation} from "../impl/AjaxImpl";
|
|
20
20
|
import {PushImpl} from "../impl/PushImpl";
|
|
21
|
+
import {oam as _oam} from "../myfaces/OamSubmit";
|
|
22
|
+
|
|
21
23
|
|
|
22
24
|
//declare const Implementation: any;
|
|
23
25
|
|
|
@@ -219,18 +221,9 @@ export module jsf {
|
|
|
219
221
|
}
|
|
220
222
|
|
|
221
223
|
}
|
|
222
|
-
|
|
223
|
-
//We hook the old namespace system into our npm system
|
|
224
|
-
//if ("undefined" == window.jsf) {
|
|
225
|
-
// window.jsf = jsf;
|
|
226
|
-
//}
|
|
227
|
-
|
|
228
|
-
|
|
229
224
|
}
|
|
230
225
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
//fullfill the window contract
|
|
226
|
+
//fullfill the window contract for the myfaces namespace
|
|
234
227
|
export module myfaces {
|
|
235
228
|
|
|
236
229
|
/**
|
|
@@ -258,6 +251,11 @@ export module myfaces {
|
|
|
258
251
|
|
|
259
252
|
jsf.ajax.request(source, event, options);
|
|
260
253
|
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* legacy oam functions
|
|
257
|
+
*/
|
|
258
|
+
export const oam = _oam;
|
|
261
259
|
}
|
|
262
260
|
|
|
263
261
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {IListener} from "./util/
|
|
17
|
+
import {IListener} from "./util/IListener";
|
|
18
18
|
import {Response} from "./xhrCore/Response";
|
|
19
19
|
import {XhrRequest} from "./xhrCore/XhrRequest";
|
|
20
20
|
import {AsynchronousQueue} from "./util/AsyncQueue";
|
|
@@ -95,6 +95,54 @@ enum BlockFilter {
|
|
|
95
95
|
* however a dedicated api makes sense for readability reasons
|
|
96
96
|
*/
|
|
97
97
|
export module Implementation {
|
|
98
|
+
/*
|
|
99
|
+
Small internal explanation, this code is optimized for readability
|
|
100
|
+
and cuts off a ton of old legacy code.
|
|
101
|
+
Aka older browsers are not supported anymore.
|
|
102
|
+
We use a self written helper library to keep the number of exernal
|
|
103
|
+
code dependencies down.
|
|
104
|
+
The library is called mona-dish and started as a small sideproject of mine
|
|
105
|
+
it provides following
|
|
106
|
+
|
|
107
|
+
a) Monad like structures for querying because this keeps the code denser and adds abstractions
|
|
108
|
+
that always was the strong point of jquery and it still is better in this regard than what ecmascript provides
|
|
109
|
+
|
|
110
|
+
b) Streams and lazystreams like java has, a pull like construct, ecmascript does not have anything like Lazystreams.
|
|
111
|
+
Another option would have been rxjs but that would have introduced a code dependency and probably more code. We might
|
|
112
|
+
move to RXJS if the need arises however. But for now I would rather stick with my small self grown library which works
|
|
113
|
+
quite well and where I can patch quickly (I have used it in several industrial projects, so it works well
|
|
114
|
+
and is heavily fortified by unit tests (140 testcases as time of writing this))
|
|
115
|
+
|
|
116
|
+
c) A neutral json like configuration which allows assignments of arbitrary values with reduce code which then can be
|
|
117
|
+
transformed into different data representations
|
|
118
|
+
|
|
119
|
+
examples:
|
|
120
|
+
internalCtx.assign(MYPARAM, CTX_PARAM_SRC_FRM_ID).value = form.id.value;
|
|
121
|
+
passes a value into context.MYPARAM.CTX_PARAM_SRC_FRM_ID
|
|
122
|
+
|
|
123
|
+
basically an abbreviation for
|
|
124
|
+
|
|
125
|
+
internalCtxt[MYPARAM] = internalCtxt?.[MYPARAM] ? internalCtxt[MYPARAM] : {};
|
|
126
|
+
internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = internalCtxt?.[MYPARAM][CTX_PARAM_SRC_FRM_ID] ? internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] : {};
|
|
127
|
+
internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = form.id.value;
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
internalCtx.assign(condition, MYPARAM, CTX_PARAM_SRC_FRM_ID).value = form.id.value;
|
|
131
|
+
passes a value into context.MYPARAM.CTX_PARAM_SRC_FRM_ID if condition === true otherwise it is ignored
|
|
132
|
+
|
|
133
|
+
abbreviates:
|
|
134
|
+
if(condition) {
|
|
135
|
+
internalCtxt[MYPARAM] = internalCtxt?.[MYPARAM] ? internalCtxt[MYPARAM] : {};
|
|
136
|
+
internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = internalCtxt?.[MYPARAM][CTX_PARAM_SRC_FRM_ID] ? internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] : {};
|
|
137
|
+
internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = form.id.value;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
d) Optional constructs, while under heavy debate we only use them lightly where the api requires it from mona-dish
|
|
142
|
+
|
|
143
|
+
Note the inclusion of this library uses a reduced build which only includes the part of it, which we really use
|
|
144
|
+
|
|
145
|
+
*/
|
|
98
146
|
|
|
99
147
|
import trim = Lang.trim;
|
|
100
148
|
import getMessage = ExtLang.getMessage;
|
|
@@ -170,8 +218,9 @@ export module Implementation {
|
|
|
170
218
|
|
|
171
219
|
return LazyStream.of(...funcs)
|
|
172
220
|
.map(func => resolveAndExecute(source, event, func))
|
|
173
|
-
// we use the return false == stop as an early stop
|
|
221
|
+
// we use the return false == stop as an early stop, onElem stops at the first false
|
|
174
222
|
.onElem((opResult: boolean) => opResult)
|
|
223
|
+
//last ensures we run until the first false is returned
|
|
175
224
|
.last().value;
|
|
176
225
|
}
|
|
177
226
|
|
|
@@ -208,17 +257,27 @@ export module Implementation {
|
|
|
208
257
|
|
|
209
258
|
Assertions.assertRequestIntegrity(options, elem);
|
|
210
259
|
|
|
211
|
-
|
|
260
|
+
/**
|
|
261
|
+
* fetch the parent form
|
|
262
|
+
*
|
|
263
|
+
* note we also add an override possibility here
|
|
264
|
+
* so that people can use dummy forms and work
|
|
265
|
+
* with detached objects
|
|
266
|
+
*/
|
|
267
|
+
const form: DQ = resolveForm(requestCtx, elem, resolvedEvent);
|
|
268
|
+
const formId = form.id.value;
|
|
269
|
+
const delay: number = resolveDelay(options);
|
|
270
|
+
const timeout: number = resolveTimeout(options);
|
|
212
271
|
|
|
272
|
+
requestCtx.assignIf(!!windowId, P_WINDOW_ID).value = windowId;
|
|
213
273
|
requestCtx.assign(CTX_PARAM_PASS_THR).value = filterPassthroughValues(options.value);
|
|
214
|
-
|
|
215
274
|
requestCtx.assignIf(!!resolvedEvent, CTX_PARAM_PASS_THR, P_EVT).value = resolvedEvent?.type;
|
|
216
275
|
|
|
217
276
|
/**
|
|
218
277
|
* ajax pass through context with the source
|
|
219
|
-
*
|
|
278
|
+
* onresolved Event and onerror Event
|
|
220
279
|
*/
|
|
221
|
-
requestCtx.assign(SOURCE).value = elementId
|
|
280
|
+
requestCtx.assign(SOURCE).value = elementId;
|
|
222
281
|
|
|
223
282
|
/**
|
|
224
283
|
* on resolvedEvent and onError...
|
|
@@ -232,30 +291,17 @@ export module Implementation {
|
|
|
232
291
|
* lets drag the myfaces config params also in
|
|
233
292
|
*/
|
|
234
293
|
requestCtx.assign(MYFACES).value = options.value?.myfaces;
|
|
235
|
-
/**
|
|
236
|
-
* fetch the parent form
|
|
237
|
-
*
|
|
238
|
-
* note we also add an override possibility here
|
|
239
|
-
* so that people can use dummy forms and work
|
|
240
|
-
* with detached objects
|
|
241
|
-
*/
|
|
242
|
-
let form: DQ = resolveForm(requestCtx, elem, resolvedEvent);
|
|
243
294
|
|
|
244
295
|
/**
|
|
245
296
|
* binding contract the javax.faces.source must be set
|
|
246
297
|
*/
|
|
247
|
-
requestCtx.assign(CTX_PARAM_PASS_THR, P_PARTIAL_SOURCE).value = elementId
|
|
298
|
+
requestCtx.assign(CTX_PARAM_PASS_THR, P_PARTIAL_SOURCE).value = elementId;
|
|
248
299
|
|
|
249
300
|
/**
|
|
250
301
|
* javax.faces.partial.ajax must be set to true
|
|
251
302
|
*/
|
|
252
303
|
requestCtx.assign(CTX_PARAM_PASS_THR, P_AJAX).value = true;
|
|
253
304
|
|
|
254
|
-
/**
|
|
255
|
-
* binding contract the javax.faces.source must be set
|
|
256
|
-
*/
|
|
257
|
-
requestCtx.assign(CTX_PARAM_PASS_THR, P_PARTIAL_SOURCE).value = elementId.value;
|
|
258
|
-
|
|
259
305
|
/**
|
|
260
306
|
* if resetValues is set to true
|
|
261
307
|
* then we have to set javax.faces.resetValues as well
|
|
@@ -265,27 +311,22 @@ export module Implementation {
|
|
|
265
311
|
*/
|
|
266
312
|
requestCtx.assignIf(isResetValues, CTX_PARAM_PASS_THR, P_RESET_VALUES).value = true;
|
|
267
313
|
|
|
268
|
-
//additional meta information to speed things up, note internal non jsf
|
|
269
|
-
//pass through options are stored under _mfInternal in the context
|
|
270
|
-
internalCtx.assign(CTX_PARAM_SRC_FRM_ID).value =
|
|
271
|
-
|
|
314
|
+
// additional meta information to speed things up, note internal non jsf
|
|
315
|
+
// pass through options are stored under _mfInternal in the context
|
|
316
|
+
internalCtx.assign(CTX_PARAM_SRC_FRM_ID).value = formId;
|
|
317
|
+
|
|
318
|
+
// mojarra compatibility, mojarra is sending the form id as well
|
|
319
|
+
// this is not documented behavior but can be determined by running
|
|
320
|
+
// mojarra under blackbox conditions.
|
|
321
|
+
// I assume it does the same as our formId_submit=1 so leaving it out
|
|
322
|
+
// won't hurt but for the sake of compatibility we are going to add it
|
|
323
|
+
requestCtx.assign(CTX_PARAM_PASS_THR, formId).value = formId;
|
|
324
|
+
internalCtx.assign(CTX_PARAM_SRC_CTL_ID).value = elementId;
|
|
272
325
|
internalCtx.assign(CTX_PARAM_TR_TYPE).value = REQ_TYPE_POST;
|
|
273
326
|
|
|
274
|
-
//mojarra compatibility, mojarra is sending the form id as well
|
|
275
|
-
//this is not documented behavior but can be determined by running
|
|
276
|
-
//mojarra under blackbox conditions
|
|
277
|
-
//i assume it does the same as our formId_submit=1 so leaving it out
|
|
278
|
-
//wont hurt but for the sake of compatibility we are going to add it
|
|
279
|
-
|
|
280
|
-
requestCtx.assign(CTX_PARAM_PASS_THR, form.id.value).value = form.id.value;
|
|
281
|
-
|
|
282
327
|
assignClientWindowId(form, requestCtx);
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
assignRender(options, requestCtx, form, elementId.value);
|
|
286
|
-
|
|
287
|
-
let delay: number = resolveDelay(options);
|
|
288
|
-
let timeout: number = resolveTimeout(options);
|
|
328
|
+
assignExecute(options, requestCtx, form, elementId);
|
|
329
|
+
assignRender(options, requestCtx, form, elementId);
|
|
289
330
|
|
|
290
331
|
//now we enqueue the request as asynchronous runnable into our request
|
|
291
332
|
//queue and let the queue take over the rest
|
|
@@ -308,7 +349,6 @@ export module Implementation {
|
|
|
308
349
|
* @param errorListener the error listener handler
|
|
309
350
|
*/
|
|
310
351
|
export function addOnError(errorListener: IListener<ErrorData>) {
|
|
311
|
-
/*error handling already done in the assert of the queue*/
|
|
312
352
|
errorQueue.push(errorListener);
|
|
313
353
|
}
|
|
314
354
|
|
|
@@ -318,7 +358,6 @@ export module Implementation {
|
|
|
318
358
|
* @param eventListener the event listener handler
|
|
319
359
|
*/
|
|
320
360
|
export function addOnEvent(eventListener: IListener<EventData>) {
|
|
321
|
-
/*error handling already done in the assert of the queue*/
|
|
322
361
|
eventQueue.push(eventListener);
|
|
323
362
|
}
|
|
324
363
|
|
|
@@ -480,7 +519,7 @@ export module Implementation {
|
|
|
480
519
|
|
|
481
520
|
/**
|
|
482
521
|
* this at the first sight looks like a weird construct, but we need to do it this way
|
|
483
|
-
* for testing, we cannot proxy addRequestToQueue from the testing frameworks directly
|
|
522
|
+
* for testing, we cannot proxy addRequestToQueue from the testing frameworks directly,
|
|
484
523
|
* but we need to keep it under unit tests.
|
|
485
524
|
*/
|
|
486
525
|
export let queueHandler = {
|
|
@@ -572,15 +611,12 @@ export module Implementation {
|
|
|
572
611
|
function remapDefaultConstants(targetConfig: Config, targetKey: string, userValues: string, issuingForm: DQ, issuingElementId: string): Config {
|
|
573
612
|
//a cleaner implementation of the transform list method
|
|
574
613
|
|
|
575
|
-
let iterValues = (userValues) ? trim(userValues).split(/\s+/gi) : [];
|
|
614
|
+
let iterValues: string[] = (userValues) ? trim(userValues).split(/\s+/gi) : [];
|
|
576
615
|
let ret = [];
|
|
577
|
-
let processed = {};
|
|
616
|
+
let processed: {[key: string]: boolean} = {};
|
|
578
617
|
|
|
579
|
-
//
|
|
580
|
-
//
|
|
581
|
-
//this is more readable than the old indexed based solution
|
|
582
|
-
//and not really slower because we had to build up the index in our old solution
|
|
583
|
-
//anyway
|
|
618
|
+
// in this case we do not use lazy stream because it wont bring any code reduction
|
|
619
|
+
// or speedup
|
|
584
620
|
for (let cnt = 0; cnt < iterValues.length; cnt++) {
|
|
585
621
|
//avoid doubles
|
|
586
622
|
if (iterValues[cnt] in processed) {
|
|
@@ -649,7 +685,7 @@ export module Implementation {
|
|
|
649
685
|
return (<Function>func).call(source, event) !== false;
|
|
650
686
|
} else {
|
|
651
687
|
//either a function or a string can be passed in case of a string we have to wrap it into another function
|
|
652
|
-
//it
|
|
688
|
+
//it is not a plain executable code but a definition
|
|
653
689
|
let sourceCode = trim(<string>func);
|
|
654
690
|
if (sourceCode.indexOf("function ") == 0) {
|
|
655
691
|
sourceCode = `return ${sourceCode} (event)`;
|
|
@@ -1,3 +1,19 @@
|
|
|
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
|
+
|
|
1
17
|
/**
|
|
2
18
|
* Typescript port of the jsf.push part in the myfaces implementation
|
|
3
19
|
*/
|
|
@@ -1,3 +1,18 @@
|
|
|
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
|
+
*/
|
|
1
16
|
import {Config, Lang, XMLQuery} from "mona-dish";
|
|
2
17
|
|
|
3
18
|
import {DQ} from "mona-dish";
|
|
@@ -1,3 +1,18 @@
|
|
|
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
|
+
*/
|
|
1
16
|
import {AsyncRunnable} from "./AsyncRunnable";
|
|
2
17
|
|
|
3
18
|
/**
|
|
@@ -6,7 +21,7 @@ import {AsyncRunnable} from "./AsyncRunnable";
|
|
|
6
21
|
*
|
|
7
22
|
* Every callback must be of async runnable
|
|
8
23
|
* which is sort of an extended promise which has
|
|
9
|
-
* added a
|
|
24
|
+
* added a dedicated cancel and start point
|
|
10
25
|
*
|
|
11
26
|
* This interface can be used as wrapper contract
|
|
12
27
|
* for normal promises if needed.
|
|
@@ -21,12 +36,15 @@ export class AsynchronousQueue<T extends AsyncRunnable<any>> {
|
|
|
21
36
|
constructor() {
|
|
22
37
|
}
|
|
23
38
|
|
|
39
|
+
/**
|
|
40
|
+
* simple is empty accessor, returns true if queue is empty atm
|
|
41
|
+
*/
|
|
24
42
|
get isEmpty(): boolean {
|
|
25
43
|
return !this.runnableQueue.length;
|
|
26
44
|
}
|
|
27
45
|
|
|
28
46
|
/**
|
|
29
|
-
*
|
|
47
|
+
* enqueues an element and starts the
|
|
30
48
|
* asynchronous work loop if not already running
|
|
31
49
|
*
|
|
32
50
|
* @param element the element to be queued and processed
|
|
@@ -46,15 +64,39 @@ export class AsynchronousQueue<T extends AsyncRunnable<any>> {
|
|
|
46
64
|
}
|
|
47
65
|
}
|
|
48
66
|
|
|
49
|
-
|
|
67
|
+
/**
|
|
68
|
+
* fetches the next element from the queue (first in first out order)
|
|
69
|
+
*/
|
|
70
|
+
dequeue(): T | undefined{
|
|
50
71
|
return this.runnableQueue.shift();
|
|
51
72
|
}
|
|
52
73
|
|
|
74
|
+
/**
|
|
75
|
+
* clears up all elements from the queue
|
|
76
|
+
*/
|
|
53
77
|
cleanup() {
|
|
54
78
|
this.currentlyRunning = null;
|
|
55
79
|
this.runnableQueue.length = 0;
|
|
56
80
|
}
|
|
57
81
|
|
|
82
|
+
/**
|
|
83
|
+
* cancels the currently running element and then cleans up the queue
|
|
84
|
+
* aka cancel the queue entirely
|
|
85
|
+
*/
|
|
86
|
+
cancel() {
|
|
87
|
+
try {
|
|
88
|
+
if (this.currentlyRunning) {
|
|
89
|
+
this.currentlyRunning.cancel();
|
|
90
|
+
}
|
|
91
|
+
} finally {
|
|
92
|
+
this.cleanup();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private callForNextElementToProcess() {
|
|
97
|
+
this.runEntry();
|
|
98
|
+
}
|
|
99
|
+
|
|
58
100
|
private appendElement(element: T) {
|
|
59
101
|
//only if the first element is added we start with a trigger
|
|
60
102
|
//otherwise a process already is running and not finished yet at that
|
|
@@ -88,18 +130,4 @@ export class AsynchronousQueue<T extends AsyncRunnable<any>> {
|
|
|
88
130
|
() => this.callForNextElementToProcess()
|
|
89
131
|
).start();
|
|
90
132
|
}
|
|
91
|
-
|
|
92
|
-
cancel() {
|
|
93
|
-
try {
|
|
94
|
-
if (this.currentlyRunning) {
|
|
95
|
-
this.currentlyRunning.cancel();
|
|
96
|
-
}
|
|
97
|
-
} finally {
|
|
98
|
-
this.cleanup();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
private callForNextElementToProcess() {
|
|
103
|
-
this.runEntry();
|
|
104
|
-
}
|
|
105
133
|
}
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
* Ever object in the asynchronous queue needs to implement this interface
|
|
20
20
|
*
|
|
21
21
|
* the usage should be similar as a Promise from the outside.
|
|
22
|
-
* but with a dedicated start point
|
|
22
|
+
* but with a dedicated start point. The problem why we cannot use
|
|
23
|
+
* promises here, is mostly related to the needed cancel functionality
|
|
24
|
+
* and that the queue expects a runnable as entry.
|
|
23
25
|
*
|
|
24
26
|
* from the implementation side it is mostly registering callbacks
|
|
25
27
|
* and calling them at the appropriate time.
|
|
@@ -36,8 +38,8 @@ export interface AsyncRunnable<T> {
|
|
|
36
38
|
cancel();
|
|
37
39
|
|
|
38
40
|
/**
|
|
39
|
-
* callback for then
|
|
40
|
-
* triggered when the
|
|
41
|
+
* callback for then functionality
|
|
42
|
+
* triggered when the async run is complete
|
|
41
43
|
*
|
|
42
44
|
* the async runnable must register the passed function
|
|
43
45
|
* and then triggers all the registered thens
|
|
@@ -1,5 +1,20 @@
|
|
|
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
|
+
*/
|
|
1
16
|
import {Config, IValueHolder, Optional, DomQuery, DQ} from "mona-dish";
|
|
2
|
-
import {
|
|
17
|
+
import {P_WINDOW_ID} from "../core/Const";
|
|
3
18
|
|
|
4
19
|
declare let window: any;
|
|
5
20
|
|
|
@@ -13,9 +28,9 @@ declare let window: any;
|
|
|
13
28
|
*/
|
|
14
29
|
const IS_JSF_SOURCE = (source?: string): boolean => {
|
|
15
30
|
return source && !!(source?.search(/\/javax\.faces\.resource.*\/jsf\.js.*/) != -1 ||
|
|
16
|
-
source?.search(/\/jsf
|
|
17
|
-
source?.search(/\/jsf
|
|
18
|
-
source?.search(/\/jsf[
|
|
31
|
+
source?.search(/\/jsf-development\.js.*/) != -1 ||
|
|
32
|
+
source?.search(/\/jsf-uncompressed\.js.*/) != -1 ||
|
|
33
|
+
source?.search(/\/jsf[^.]*\.js.*ln=javax.faces.*/gi) != -1);
|
|
19
34
|
}
|
|
20
35
|
|
|
21
36
|
/**
|
|
@@ -27,7 +42,7 @@ const IS_JSF_SOURCE = (source?: string): boolean => {
|
|
|
27
42
|
* @constructor
|
|
28
43
|
*/
|
|
29
44
|
const IS_INTERNAL_SOURCE = (source: string): boolean => {
|
|
30
|
-
return source.search(/\/jsf[
|
|
45
|
+
return source.search(/\/jsf[^.]*\.js.*ln=myfaces.testscripts.*/gi) != -1;
|
|
31
46
|
}
|
|
32
47
|
|
|
33
48
|
|
|
@@ -131,7 +146,7 @@ export class ExtDomquery extends DQ {
|
|
|
131
146
|
}
|
|
132
147
|
|
|
133
148
|
globalEval(code: string, nonce ?: string): DQ {
|
|
134
|
-
return super.globalEval(code, nonce ?? this.nonce);
|
|
149
|
+
return new ExtDomquery(super.globalEval(code, nonce ?? this.nonce));
|
|
135
150
|
}
|
|
136
151
|
|
|
137
152
|
/**
|
|
@@ -150,12 +165,12 @@ export class ExtDomquery extends DQ {
|
|
|
150
165
|
* byId producer
|
|
151
166
|
*
|
|
152
167
|
* @param selector id
|
|
168
|
+
* @param deep whether the search should go into embedded shadow dom elements
|
|
153
169
|
* @return a DomQuery containing the found elements
|
|
154
170
|
*/
|
|
155
171
|
static byId(selector: string | DomQuery | Element, deep = false): DomQuery {
|
|
156
172
|
const ret = DomQuery.byId(selector, deep);
|
|
157
|
-
|
|
158
|
-
return ret;
|
|
173
|
+
return new ExtDomquery(ret);
|
|
159
174
|
}
|
|
160
175
|
}
|
|
161
176
|
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
export interface IListener<T> {
|
|
17
|
+
(data: T): void;
|
|
18
|
+
}
|
|
@@ -1,3 +1,18 @@
|
|
|
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
|
+
*/
|
|
1
16
|
import {
|
|
2
17
|
EMPTY_STR,
|
|
3
18
|
ERROR_MESSAGE,
|
|
@@ -1,3 +1,18 @@
|
|
|
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
|
+
*/
|
|
1
16
|
import {Config, DQ} from "mona-dish";
|
|
2
17
|
import {BEGIN, CTX_PARAM_PASS_THR, EVENT, P_PARTIAL_SOURCE, SOURCE} from "../core/Const";
|
|
3
18
|
|
|
@@ -17,8 +32,8 @@ export class EventData {
|
|
|
17
32
|
eventData.status = name;
|
|
18
33
|
|
|
19
34
|
let sourceId: string = context.getIf(SOURCE)
|
|
20
|
-
.
|
|
21
|
-
.
|
|
35
|
+
.orElseLazy(() => context.getIf(P_PARTIAL_SOURCE).value)
|
|
36
|
+
.orElseLazy(() => context.getIf(CTX_PARAM_PASS_THR, P_PARTIAL_SOURCE).value).value;
|
|
22
37
|
if (sourceId) {
|
|
23
38
|
eventData.source = DQ.byId(sourceId, true).first().value.value;
|
|
24
39
|
}
|
|
@@ -1,3 +1,18 @@
|
|
|
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
|
+
*/
|
|
1
16
|
import {XMLQuery} from "mona-dish";
|
|
2
17
|
// noinspection TypeScriptPreferShortImport
|
|
3
18
|
import {DQ} from "mona-dish";
|
|
@@ -46,7 +46,7 @@ import {ExtDomquery} from "../util/ExtDomQuery";
|
|
|
46
46
|
*/
|
|
47
47
|
export function resolveHandlerFunc(requestContext: Config, responseContext: Config, funcName: string) {
|
|
48
48
|
return responseContext.getIf(funcName)
|
|
49
|
-
.
|
|
49
|
+
.orElseLazy(() =>requestContext.getIf(funcName).value)
|
|
50
50
|
.orElse(EMPTY_FUNC).value;
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -72,7 +72,7 @@ export function resolveFinalUrl(sourceForm: DomQuery, formData: XhrFormData, aja
|
|
|
72
72
|
* @param event
|
|
73
73
|
*/
|
|
74
74
|
export function resolveForm(requestCtx: Config, elem: DQ, event: Event): DQ {
|
|
75
|
-
const configId = requestCtx.value?.myfaces?.form ?? MF_NONE;
|
|
75
|
+
const configId = requestCtx.value?.myfaces?.form ?? MF_NONE;
|
|
76
76
|
return DQ
|
|
77
77
|
.byId(configId, true)
|
|
78
78
|
.orElseLazy(() => ExtLang.getForm(elem.getAsElem(0).value, event));
|
|
@@ -142,7 +142,7 @@ export function resolveDefaults(event: Event, opts: any = {}, el: Element | stri
|
|
|
142
142
|
const resolvedEvent = event,
|
|
143
143
|
options = new Config(opts).deepCopy,
|
|
144
144
|
elem = DQ.byId(el || <Element>resolvedEvent.target, true),
|
|
145
|
-
elementId = elem.id, requestCtx = new Config({}),
|
|
145
|
+
elementId = elem.id.value, requestCtx = new Config({}),
|
|
146
146
|
internalCtx = new Config({}), windowId = resolveWindowId(options),
|
|
147
147
|
isResetValues = true === options.value?.resetValues;
|
|
148
148
|
|