jsf.js_next_gen 4.0.1-beta.1 → 4.0.1-beta.3
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/README.md +6 -0
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/functions/myfaces.ab.html +1 -1
- package/dist/docs/functions/{myfaces.onOnDomReady.html → myfaces.onDomReady.html} +5 -5
- package/dist/docs/index.html +9 -0
- package/dist/docs/modules/myfaces.html +2 -2
- package/dist/docs/variables/myfaces.oam.html +1 -1
- package/dist/window/faces-development.js +1285 -1295
- 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 +1285 -1295
- 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 +5 -5
- package/plans for 4.0.1.txt +8 -0
- package/src/main/typescript/api/_api.ts +1 -1
- package/src/main/typescript/impl/AjaxImpl.ts +60 -44
- package/src/main/typescript/impl/core/Const.ts +5 -2
- package/src/main/typescript/impl/util/AsyncRunnable.ts +81 -6
- package/src/main/typescript/impl/util/ExtDomQuery.ts +7 -9
- package/src/main/typescript/impl/util/FileUtils.ts +26 -22
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +7 -3
- package/src/main/typescript/impl/util/Lang.ts +61 -4
- package/src/main/typescript/impl/util/XhrQueueController.ts +112 -0
- package/src/main/typescript/impl/xhrCore/EventData.ts +3 -3
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +12 -10
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +32 -19
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +51 -72
- package/src/main/typescript/myfaces/OamSubmit.ts +6 -6
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +179 -40
- package/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.ts +4 -4
- package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/blank.css +0 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.ts +921 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +108 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +3 -2
- package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/jakarta.faces.resource/faces.js.jsf +0 -0
- package/src/main/typescript/test/myfaces/OnLoadSpec.ts +52 -0
- package/src/main/typescript/test/queue/AsynchronousProbe.ts +5 -5
- package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +4 -3
- package/src/main/typescript/test/xhrCore/EventTests.spec.ts +28 -22
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +4 -4
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +2 -2
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +80 -6
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +6 -1
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +23 -22
- package/target/api/_api.js +2 -2
- package/target/api/_api.js.map +1 -1
- package/target/impl/AjaxImpl.js +48 -38
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/core/Const.js +7 -5
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/util/AsyncRunnable.js +60 -0
- package/target/impl/util/AsyncRunnable.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +8 -8
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/FileUtils.js +21 -20
- package/target/impl/util/FileUtils.js.map +1 -1
- package/target/impl/util/HiddenInputBuilder.js +7 -3
- package/target/impl/util/HiddenInputBuilder.js.map +1 -1
- package/target/impl/util/Lang.js +52 -1
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/xhrCore/EventData.js +2 -2
- package/target/impl/xhrCore/EventData.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +9 -7
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +29 -15
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +43 -64
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +5 -3
- package/target/myfaces/OamSubmit.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +138 -37
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +4 -4
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +3 -2
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/queue/AsynchronousQueueTest.spec.js +3 -3
- package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
- package/target/test/xhrCore/EventTests.spec.js +26 -19
- package/target/test/xhrCore/EventTests.spec.js.map +1 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +3 -3
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +73 -4
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +6 -0
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +22 -15
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/src/main/typescript/impl/util/AsyncQueue.ts +0 -133
- package/src/main/typescript/test/frameworkBase/_ext/monadish/StreamTest.spec.ts +0 -231
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {AsyncRunnable} from "../util/AsyncRunnable";
|
|
18
|
-
import {Config, DQ
|
|
17
|
+
import {AsyncRunnable, IAsyncRunnable} from "../util/AsyncRunnable";
|
|
18
|
+
import {Config, DQ} from "mona-dish";
|
|
19
19
|
import {Implementation} from "../AjaxImpl";
|
|
20
20
|
|
|
21
21
|
import {XhrFormData} from "./XhrFormData";
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
STATE_EVT_TIMEOUT,
|
|
42
42
|
STD_ACCEPT,
|
|
43
43
|
URL_ENCODED,
|
|
44
|
-
VAL_AJAX, IDENT_NONE
|
|
44
|
+
VAL_AJAX, IDENT_NONE, CTX_PARAM_SRC_FRM_ID, CTX_PARAM_SRC_CTL_ID, CTX_PARAM_PPS
|
|
45
45
|
} from "../core/Const";
|
|
46
46
|
import {
|
|
47
47
|
resolveFinalUrl,
|
|
@@ -54,6 +54,10 @@ import {ExtConfig} from "../util/ExtDomQuery";
|
|
|
54
54
|
/**
|
|
55
55
|
* Faces XHR Request Wrapper
|
|
56
56
|
* as AsyncRunnable for our Asynchronous queue
|
|
57
|
+
* This means from the outside the
|
|
58
|
+
* xhr request is similar to a Promise in a way
|
|
59
|
+
* that you can add then and catch and finally callbacks.
|
|
60
|
+
*
|
|
57
61
|
*
|
|
58
62
|
* The idea is that we basically just enqueue
|
|
59
63
|
* a single ajax request into our queue
|
|
@@ -62,60 +66,43 @@ import {ExtConfig} from "../util/ExtDomQuery";
|
|
|
62
66
|
*
|
|
63
67
|
*/
|
|
64
68
|
|
|
65
|
-
export class XhrRequest
|
|
69
|
+
export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
66
70
|
|
|
67
71
|
private responseContext: Config;
|
|
68
72
|
|
|
69
73
|
private stopProgress = false;
|
|
70
74
|
|
|
71
|
-
/**
|
|
72
|
-
* helper support so that we do not have to drag in Promise shims
|
|
73
|
-
*/
|
|
74
|
-
private catchFunctions: Array<Function> = [];
|
|
75
|
-
private thenFunctions: Array<Function> = [];
|
|
76
75
|
|
|
76
|
+
private xhrObject = new XMLHttpRequest();
|
|
77
77
|
/**
|
|
78
78
|
* Required Parameters
|
|
79
79
|
*
|
|
80
|
-
* @param source the issuing element
|
|
81
|
-
* @param sourceForm the form which is related to the issuing element
|
|
82
80
|
* @param requestContext the request context with all pass through values
|
|
83
|
-
*
|
|
84
|
-
* Optional Parameters
|
|
85
|
-
*
|
|
86
81
|
* @param internalContext internal context with internal info which is passed through, not used by the user
|
|
87
|
-
*
|
|
82
|
+
* Optional Parameters
|
|
88
83
|
* @param timeout optional xhr timeout
|
|
89
84
|
* @param ajaxType optional request type, default "POST"
|
|
90
85
|
* @param contentType optional content type, default "application/x-www-form-urlencoded"
|
|
91
|
-
* @param xhrObject optional xhr object which must fulfill the XMLHTTPRequest api, default XMLHttpRequest
|
|
92
86
|
*/
|
|
93
87
|
constructor(
|
|
94
|
-
private source: DQ,
|
|
95
|
-
private sourceForm: DQ,
|
|
96
88
|
private requestContext: ExtConfig,
|
|
97
89
|
private internalContext: Config,
|
|
98
|
-
private partialIdsArray = [],
|
|
99
90
|
private timeout = NO_TIMEOUT,
|
|
100
91
|
private ajaxType = REQ_TYPE_POST,
|
|
101
|
-
private contentType = URL_ENCODED
|
|
102
|
-
private xhrObject = new XMLHttpRequest()
|
|
92
|
+
private contentType = URL_ENCODED
|
|
103
93
|
) {
|
|
104
|
-
|
|
94
|
+
super();
|
|
105
95
|
// we omit promises here because we have to deal with cancel functionality,
|
|
106
96
|
// and promises to not provide that (yet) instead we have our async queue
|
|
107
97
|
// which uses an api internally, which is very close to promises
|
|
108
|
-
this.registerXhrCallbacks((data: any) =>
|
|
109
|
-
this.resolve(data)
|
|
110
|
-
}, (data: any) => {
|
|
111
|
-
this.reject(data)
|
|
112
|
-
});
|
|
98
|
+
this.registerXhrCallbacks((data: any) => this.resolve(data), (data: any) => this.reject(data));
|
|
113
99
|
}
|
|
114
100
|
|
|
115
|
-
start():
|
|
101
|
+
start(): IAsyncRunnable<XMLHttpRequest> {
|
|
116
102
|
|
|
117
103
|
let ignoreErr = failSaveExecute;
|
|
118
104
|
let xhrObject = this.xhrObject;
|
|
105
|
+
let sourceForm = DQ.byId(this.internalContext.getIf(CTX_PARAM_SRC_FRM_ID).value)
|
|
119
106
|
|
|
120
107
|
let executesArr = () => {
|
|
121
108
|
return this.requestContext.getIf(CTX_PARAM_REQ_PASS_THR, P_EXECUTE).get(IDENT_NONE).value.split(/\s+/gi);
|
|
@@ -130,15 +117,20 @@ export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
|
130
117
|
// whatever the formData object delivers
|
|
131
118
|
// the partialIdsArray arr is almost deprecated legacy code where we allowed to send a separate list of partial
|
|
132
119
|
// ids for reduced load and server processing, this will be removed soon, we can handle the same via execute
|
|
133
|
-
|
|
134
|
-
|
|
120
|
+
const executes = executesArr();
|
|
121
|
+
const partialIdsArray = this.internalContext.getIf(CTX_PARAM_PPS).value === true ? executes : [];
|
|
122
|
+
const formData: XhrFormData = new XhrFormData(
|
|
123
|
+
sourceForm,
|
|
124
|
+
resoveNamingContainerMapper(this.internalContext),
|
|
125
|
+
executes, partialIdsArray
|
|
126
|
+
);
|
|
135
127
|
|
|
136
128
|
this.contentType = formData.isMultipartRequest ? "undefined" : this.contentType;
|
|
137
129
|
|
|
138
130
|
// next step the pass through parameters are merged in for post params
|
|
139
131
|
this.requestContext.$nspEnabled = false;
|
|
140
|
-
|
|
141
|
-
|
|
132
|
+
const requestContext = this.requestContext;
|
|
133
|
+
const requestPassThroughParams = requestContext.getIf(CTX_PARAM_REQ_PASS_THR) as ExtConfig;
|
|
142
134
|
|
|
143
135
|
// we are turning off here the jsf, faces remapping because we are now dealing with
|
|
144
136
|
// pass-through parameters
|
|
@@ -149,6 +141,9 @@ export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
|
149
141
|
try {
|
|
150
142
|
formData.shallowMerge(requestPassThroughParams, true, true);
|
|
151
143
|
} finally {
|
|
144
|
+
// unfortunately as long as we support
|
|
145
|
+
// both namespaces we have to keep manual control
|
|
146
|
+
// on the key renaming before doing ops like deep copy
|
|
152
147
|
this.requestContext.$nspEnabled = true;
|
|
153
148
|
requestPassThroughParams.$nspEnabled = true;
|
|
154
149
|
}
|
|
@@ -156,15 +151,15 @@ export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
|
156
151
|
this.responseContext = requestPassThroughParams.deepCopy;
|
|
157
152
|
|
|
158
153
|
// we have to shift the internal passthroughs around to build up our response context
|
|
159
|
-
|
|
154
|
+
const responseContext = this.responseContext;
|
|
160
155
|
|
|
161
156
|
responseContext.assign(CTX_PARAM_MF_INTERNAL).value = this.internalContext.value;
|
|
162
157
|
|
|
163
|
-
// per spec the
|
|
158
|
+
// per spec the onEvent and onError handlers must be passed through to the response
|
|
164
159
|
responseContext.assign(ON_EVENT).value = requestContext.getIf(ON_EVENT).value;
|
|
165
160
|
responseContext.assign(ON_ERROR).value = requestContext.getIf(ON_ERROR).value;
|
|
166
161
|
|
|
167
|
-
xhrObject.open(this.ajaxType, resolveFinalUrl(
|
|
162
|
+
xhrObject.open(this.ajaxType, resolveFinalUrl(sourceForm, formData, this.ajaxType), true);
|
|
168
163
|
|
|
169
164
|
// adding timeout
|
|
170
165
|
this.timeout ? xhrObject.timeout = this.timeout : null;
|
|
@@ -194,40 +189,15 @@ export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
|
194
189
|
|
|
195
190
|
cancel() {
|
|
196
191
|
try {
|
|
192
|
+
// this causes onError to be called where the error
|
|
193
|
+
// handling takes over
|
|
197
194
|
this.xhrObject.abort();
|
|
198
195
|
} catch (e) {
|
|
199
196
|
this.handleError(e);
|
|
200
197
|
}
|
|
201
198
|
}
|
|
202
199
|
|
|
203
|
-
resolve(data: any) {
|
|
204
|
-
Stream.of(...this.thenFunctions).reduce((inputVal: any, thenFunc: any) => {
|
|
205
|
-
return thenFunc(inputVal);
|
|
206
|
-
}, data);
|
|
207
|
-
}
|
|
208
200
|
|
|
209
|
-
reject(data: any) {
|
|
210
|
-
Stream.of(...this.catchFunctions).reduce((inputVal: any, catchFunc: any) => {
|
|
211
|
-
return catchFunc(inputVal);
|
|
212
|
-
}, data);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
catch(func: (data: any) => any): AsyncRunnable<XMLHttpRequest> {
|
|
216
|
-
this.catchFunctions.push(func);
|
|
217
|
-
return this;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
finally(func: () => void): AsyncRunnable<XMLHttpRequest> {
|
|
221
|
-
// no ie11 support we probably are going to revert to shims for that one
|
|
222
|
-
this.catchFunctions.push(func);
|
|
223
|
-
this.thenFunctions.push(func);
|
|
224
|
-
return this;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
then(func: (data: any) => any): AsyncRunnable<XMLHttpRequest> {
|
|
228
|
-
this.thenFunctions.push(func);
|
|
229
|
-
return this;
|
|
230
|
-
}
|
|
231
201
|
|
|
232
202
|
/**
|
|
233
203
|
* attaches the internal event and processing
|
|
@@ -237,7 +207,7 @@ export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
|
237
207
|
* @param reject
|
|
238
208
|
*/
|
|
239
209
|
private registerXhrCallbacks(resolve: Consumer<any>, reject: Consumer<any>) {
|
|
240
|
-
|
|
210
|
+
const xhrObject = this.xhrObject;
|
|
241
211
|
|
|
242
212
|
xhrObject.onabort = () => {
|
|
243
213
|
this.onAbort(reject);
|
|
@@ -253,13 +223,17 @@ export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
|
253
223
|
};
|
|
254
224
|
xhrObject.onerror = (errorData: any) => {
|
|
255
225
|
|
|
256
|
-
// some browsers trigger an error when cancelling a request internally
|
|
226
|
+
// some browsers trigger an error when cancelling a request internally, or when
|
|
227
|
+
// cancel is called from outside
|
|
257
228
|
// in this case we simply ignore the request and clear up the queue, because
|
|
258
229
|
// it is not safe anymore to proceed with the current queue
|
|
259
230
|
// This bypasses a Safari issue where it keeps requests hanging after page unload
|
|
260
231
|
// and then triggers a cancel error on then instead of just stopping
|
|
261
232
|
// and clearing the code
|
|
262
233
|
if(this.isCancelledResponse(this.xhrObject)) {
|
|
234
|
+
/*
|
|
235
|
+
* this triggers the catch chain and after that finally
|
|
236
|
+
*/
|
|
263
237
|
reject();
|
|
264
238
|
this.stopProgress = true;
|
|
265
239
|
return;
|
|
@@ -307,14 +281,12 @@ export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
|
307
281
|
|
|
308
282
|
private handleMalFormedXML(resolve: Function) {
|
|
309
283
|
this.stopProgress = true;
|
|
310
|
-
|
|
284
|
+
const errorData = {
|
|
311
285
|
type: ERROR,
|
|
312
286
|
status: MALFORMEDXML,
|
|
313
287
|
responseCode: 200,
|
|
314
288
|
responseText: this.xhrObject?.responseText,
|
|
315
|
-
|
|
316
|
-
// it will be unremapped
|
|
317
|
-
source: this.source.id.value
|
|
289
|
+
source: this.internalContext.getIf(CTX_PARAM_SRC_CTL_ID).value
|
|
318
290
|
};
|
|
319
291
|
try {
|
|
320
292
|
this.handleError(errorData, true);
|
|
@@ -331,16 +303,22 @@ export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
|
331
303
|
if (this.stopProgress) {
|
|
332
304
|
return;
|
|
333
305
|
}
|
|
306
|
+
/**
|
|
307
|
+
* now call the then chain
|
|
308
|
+
*/
|
|
334
309
|
resolve(data);
|
|
335
310
|
}
|
|
336
311
|
|
|
337
312
|
private onError(errorData: any, reject: Consumer<any>) {
|
|
338
313
|
this.handleError(errorData);
|
|
314
|
+
/*
|
|
315
|
+
* this triggers the catch chain and after that finally
|
|
316
|
+
*/
|
|
339
317
|
reject();
|
|
340
318
|
}
|
|
341
319
|
|
|
342
320
|
private sendRequest(formData: XhrFormData) {
|
|
343
|
-
|
|
321
|
+
const isPost = this.ajaxType != REQ_TYPE_GET;
|
|
344
322
|
if (formData.isMultipartRequest) {
|
|
345
323
|
// in case of a multipart request we send in a formData object as body
|
|
346
324
|
this.xhrObject.send((isPost) ? formData.toFormData() : null);
|
|
@@ -354,7 +332,7 @@ export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
|
354
332
|
* other helpers
|
|
355
333
|
*/
|
|
356
334
|
private sendEvent(evtType: string) {
|
|
357
|
-
|
|
335
|
+
const eventData = EventData.createFromRequest(this.xhrObject, this.requestContext, evtType);
|
|
358
336
|
try {
|
|
359
337
|
// User code error, we might cover
|
|
360
338
|
// this in onError, but also we cannot swallow it.
|
|
@@ -366,14 +344,15 @@ export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
|
366
344
|
} catch (e) {
|
|
367
345
|
e.source = e?.source ?? this.requestContext.getIf(SOURCE).value;
|
|
368
346
|
this.handleError(e);
|
|
347
|
+
|
|
369
348
|
throw e;
|
|
370
349
|
}
|
|
371
350
|
}
|
|
372
351
|
|
|
373
352
|
private handleError(exception, responseFormatError: boolean = false) {
|
|
374
|
-
|
|
353
|
+
const errorData = (responseFormatError) ? ErrorData.fromHttpConnection(exception.source, exception.type, exception.status, exception.responseText, exception.responseCode, exception.status) : ErrorData.fromClient(exception);
|
|
354
|
+
const eventHandler = resolveHandlerFunc(this.requestContext, this.responseContext, ON_ERROR);
|
|
375
355
|
|
|
376
|
-
let eventHandler = resolveHandlerFunc(this.requestContext, this.responseContext, ON_ERROR);
|
|
377
356
|
Implementation.sendError(errorData, eventHandler);
|
|
378
357
|
}
|
|
379
358
|
}
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {DQ
|
|
17
|
+
import {DQ} from "mona-dish";
|
|
18
|
+
import {ExtLang} from "../impl/util/Lang";
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* legacy code to enable various aspects
|
|
@@ -28,6 +29,7 @@ import {DQ, Stream} from "mona-dish";
|
|
|
28
29
|
* we might move the code over in the future, but for now a straight 1:1 port suffices
|
|
29
30
|
*/
|
|
30
31
|
export module oam {
|
|
32
|
+
import ofAssoc = ExtLang.ofAssoc;
|
|
31
33
|
/**
|
|
32
34
|
* sets a hidden input field
|
|
33
35
|
* @param formName the formName
|
|
@@ -86,8 +88,8 @@ export module oam {
|
|
|
86
88
|
if (window?.myfaces?.core?.config?.autoScroll && (window as any)?.getScrolling) {
|
|
87
89
|
myfaces.oam.setHiddenInput(formName, 'autoScroll', (window as any)?.getScrolling());
|
|
88
90
|
}
|
|
89
|
-
let paramsStream:
|
|
90
|
-
paramsStream.
|
|
91
|
+
let paramsStream: Array<[string, any]> = Array.isArray(params) ? [...params] : ofAssoc(params);
|
|
92
|
+
paramsStream.forEach(([key, data]) => myfaces.oam.setHiddenInput(formName, key, data));
|
|
91
93
|
|
|
92
94
|
//we call the namespaced function, to allow decoration, via a direct call we would
|
|
93
95
|
myfaces.oam.setHiddenInput(formName, `${formName}:_idcl`, linkId ?? '');
|
|
@@ -102,8 +104,6 @@ export module oam {
|
|
|
102
104
|
(form.getAsElem(0).value as HTMLFormElement).setAttribute("target", target);
|
|
103
105
|
}
|
|
104
106
|
|
|
105
|
-
|
|
106
|
-
|
|
107
107
|
const result = formElement?.onsubmit?.(null);
|
|
108
108
|
|
|
109
109
|
try {
|
|
@@ -120,7 +120,7 @@ export module oam {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
// noinspection JSUnusedLocalSymbols
|
|
123
|
-
paramsStream.
|
|
123
|
+
paramsStream.forEach(([key, data]) => {
|
|
124
124
|
myfaces.oam.clearHiddenInput(formName, key);
|
|
125
125
|
});
|
|
126
126
|
myfaces.oam.clearHiddenInput(formName, `${formName}:_idcl`);
|