jsf.js_next_gen 4.0.0-beta-23 → 4.0.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nyc_output/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
- package/.nyc_output/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
- package/.nyc_output/processinfo/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
- package/.nyc_output/processinfo/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/README.md +13 -21
- package/dist/docs/assets/main.js +56 -52
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/assets/style.css +23 -0
- package/dist/docs/functions/faces.ajax.addOnError.html +2 -0
- package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -0
- package/dist/docs/functions/faces.push.close.html +4 -2
- package/dist/docs/functions/faces.push.init.html +19 -7
- package/dist/docs/functions/faces.push.open.html +4 -2
- package/dist/docs/functions/myfaces.ab.html +9 -4
- package/dist/docs/functions/myfaces.onDomReady.html +72 -0
- package/dist/docs/index.html +16 -18
- package/dist/docs/modules/myfaces.html +3 -1
- package/dist/docs/variables/myfaces.oam.html +2 -1
- package/dist/window/faces-development.js +2846 -2085
- package/dist/window/faces-development.js.br +0 -0
- package/dist/window/faces-development.js.gz +0 -0
- package/dist/window/faces-development.js.map +1 -1
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.LICENSE.txt +17 -2
- package/dist/window/faces.js.br +0 -0
- package/dist/window/faces.js.gz +0 -0
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +2856 -2084
- package/dist/window/jsf-development.js.br +0 -0
- package/dist/window/jsf-development.js.gz +0 -0
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.LICENSE.txt +17 -2
- package/dist/window/jsf.js.br +0 -0
- package/dist/window/jsf.js.gz +0 -0
- package/dist/window/jsf.js.map +1 -1
- package/package.json +19 -18
- package/plans for 4.0.1.txt +8 -0
- package/src/main/test.xml +23 -0
- package/src/main/typescript/@types/definitions/index.d.ts +19 -2
- package/src/main/typescript/api/_api.ts +68 -25
- package/src/main/typescript/api/jsf.ts +18 -0
- package/src/main/typescript/impl/AjaxImpl.ts +204 -100
- package/src/main/typescript/impl/PushImpl.ts +63 -38
- package/src/main/typescript/impl/core/Const.ts +56 -40
- package/src/main/typescript/impl/util/Assertions.ts +16 -8
- package/src/main/typescript/impl/util/AsyncRunnable.ts +85 -10
- package/src/main/typescript/impl/util/ExtDomQuery.ts +65 -54
- package/src/main/typescript/impl/util/FileUtils.ts +108 -0
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +93 -0
- package/src/main/typescript/impl/util/Lang.ts +91 -35
- package/src/main/typescript/impl/util/XhrQueueController.ts +112 -0
- package/src/main/typescript/impl/xhrCore/ErrorData.ts +15 -10
- package/src/main/typescript/impl/xhrCore/EventData.ts +3 -3
- package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +25 -11
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +78 -32
- package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +10 -10
- package/src/main/typescript/impl/xhrCore/Response.ts +66 -49
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +211 -138
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +92 -166
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +111 -120
- package/src/main/typescript/myfaces/OamSubmit.ts +30 -14
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +163 -27
- 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 +111 -3
- package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +40 -1
- package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/jakarta.faces.resource/faces.js.jsf +0 -0
- package/src/main/typescript/test/impl/ImplTest.spec.ts +3 -3
- package/src/main/typescript/test/impl/ImplTest_23.spec.ts +3 -7
- package/src/main/typescript/test/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/FileUploadTest.spec.ts +5 -2
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +203 -0
- package/src/main/typescript/test/xhrCore/OamSubmitTest.spec.ts +177 -0
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +158 -17
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +320 -15
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +45 -4
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +374 -35
- package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +43 -9
- package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +109 -0
- package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +67 -49
- package/src/main/typescript/test.xml +6 -0
- package/src/main/typescript/tsconfig.json +1 -1
- package/src/test/resources/jsf-development.js +1 -1
- package/src/tmp/test.html +12 -88
- package/target/api/_api.js +63 -21
- package/target/api/_api.js.map +1 -1
- package/target/api/jsf.js +11 -0
- package/target/api/jsf.js.map +1 -1
- package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
- package/target/impl/AjaxImpl.js +177 -81
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/PushImpl.js +66 -35
- package/target/impl/PushImpl.js.map +1 -1
- package/target/impl/core/Const.js +54 -39
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/core/Context.js +10 -0
- package/target/impl/core/Context.js.map +1 -0
- package/target/impl/util/Assertions.js +12 -7
- package/target/impl/util/Assertions.js.map +1 -1
- package/target/impl/util/AsyncQueue.js.map +1 -1
- package/target/impl/util/AsyncRunnable.js +60 -0
- package/target/impl/util/AsyncRunnable.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +66 -48
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/FileUtils.js +97 -0
- package/target/impl/util/FileUtils.js.map +1 -0
- package/target/impl/util/HiddenElementBuilder.js +7 -0
- package/target/impl/util/HiddenElementBuilder.js.map +1 -0
- package/target/impl/util/HiddenInputBuilder.js +83 -0
- package/target/impl/util/HiddenInputBuilder.js.map +1 -0
- package/target/{types/index.js → impl/util/IAsyncRunnable.js} +11 -2
- package/target/impl/util/IAsyncRunnable.js.map +1 -0
- package/target/impl/util/Lang.js +81 -31
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/util/URLCodec.js +77 -0
- package/target/impl/util/URLCodec.js.map +1 -0
- package/target/impl/util/XhrQueueController.js +107 -0
- package/target/impl/util/XhrQueueController.js.map +1 -0
- package/target/impl/xhrCore/ErrorData.js +10 -8
- package/target/impl/xhrCore/ErrorData.js.map +1 -1
- package/target/impl/xhrCore/EventData.js +2 -2
- package/target/impl/xhrCore/EventData.js.map +1 -1
- package/target/impl/xhrCore/RequestContext.js +11 -0
- package/target/impl/xhrCore/RequestContext.js.map +1 -0
- package/target/impl/xhrCore/RequestDataResolver.js +70 -23
- package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
- package/target/impl/xhrCore/ResonseDataResolver.js +9 -9
- package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
- package/target/impl/xhrCore/Response.js +44 -29
- package/target/impl/xhrCore/Response.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +187 -119
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +82 -156
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrQueHandler.js +11 -0
- package/target/impl/xhrCore/XhrQueHandler.js.map +1 -0
- package/target/impl/xhrCore/XhrQueueController.js +62 -0
- package/target/impl/xhrCore/XhrQueueController.js.map +1 -0
- package/target/impl/xhrCore/XhrRequest.js +94 -106
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +25 -14
- package/target/myfaces/OamSubmit.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +124 -23
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js +76 -0
- package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js.map +1 -0
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +4 -4
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +925 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +1 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +112 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +1 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +103 -3
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js +37 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
- package/target/test/impl/ImplTest.spec.js +2 -2
- package/target/test/impl/ImplTest.spec.js.map +1 -1
- package/target/test/impl/ImplTest_23.spec.js +2 -2
- package/target/test/impl/ImplTest_23.spec.js.map +1 -1
- package/target/test/myfaces/OnLoadSpec.js +57 -0
- package/target/test/myfaces/OnLoadSpec.js.map +1 -0
- package/target/test/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/FileUploadTest.spec.js +2 -1
- package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +204 -0
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -0
- package/target/test/xhrCore/OamSubmitTest.spec.js +180 -0
- package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -0
- package/target/test/xhrCore/RequestParamsTest.spec.js +142 -10
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +288 -11
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +40 -2
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +315 -24
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest23.spec.js +38 -8
- package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js +128 -0
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +1 -0
- package/target/test/xhrCore/XhrFormDataTest.spec.js +57 -34
- package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
- package/target/test-classes/.gz +0 -0
- package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
- package/target/test-classes/fileuploadtest.html +24 -0
- package/target/test-classes/jsf-development.js +3559 -0
- package/target/test-classes/jsf-development.js.br +0 -0
- package/target/test-classes/jsf-development.js.gz +0 -0
- package/target/test-classes/jsf-development.js.map +1 -0
- package/target/test-classes/jsf.js +3 -0
- package/target/test-classes/jsf.js.br +0 -0
- package/target/test-classes/jsf.js.gz +0 -0
- package/tmp.xml +36 -0
- package/.nyc_output/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
- package/.nyc_output/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
- package/.nyc_output/processinfo/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
- package/.nyc_output/processinfo/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
- package/src/main/typescript/impl/util/AsyncQueue.ts +0 -133
- package/src/main/typescript/test/frameworkBase/_ext/monadish/StreamTest.spec.ts +0 -231
- package/target/types/index.js.map +0 -1
|
@@ -18,8 +18,10 @@ exports.XhrFormData = void 0;
|
|
|
18
18
|
*/
|
|
19
19
|
const mona_dish_1 = require("mona-dish");
|
|
20
20
|
const Const_1 = require("../core/Const");
|
|
21
|
-
|
|
22
|
-
const
|
|
21
|
+
const FileUtils_1 = require("../util/FileUtils");
|
|
22
|
+
const Lang_1 = require("../util/Lang");
|
|
23
|
+
var ofAssoc = Lang_1.ExtLang.ofAssoc;
|
|
24
|
+
const defaultParamsMapper = (key, item) => [key, item];
|
|
23
25
|
/**
|
|
24
26
|
* A unified form data class
|
|
25
27
|
* which builds upon our configuration.
|
|
@@ -28,22 +30,24 @@ const ExtDomQuery_1 = require("../util/ExtDomQuery");
|
|
|
28
30
|
* due to api constraints on the HTML Form object in IE11
|
|
29
31
|
* and due to the url encoding constraint given by the faces.js spec
|
|
30
32
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
33
|
+
*
|
|
34
|
+
* internal storage format
|
|
35
|
+
* every value is stored as an array
|
|
36
|
+
* even scalar ones!
|
|
34
37
|
*/
|
|
35
38
|
class XhrFormData extends mona_dish_1.Config {
|
|
36
39
|
/**
|
|
37
40
|
* data collector from a given form
|
|
38
41
|
*
|
|
39
42
|
* @param dataSource either a form as DomQuery object or an encoded url string
|
|
40
|
-
* @param
|
|
43
|
+
* @param paramsMapper a remapper for the params keys and values
|
|
41
44
|
* @param executes the executes id list for the elements to being processed
|
|
42
45
|
* @param partialIds partial ids to collect, to reduce the data sent down
|
|
43
46
|
*/
|
|
44
|
-
constructor(dataSource,
|
|
47
|
+
constructor(dataSource, paramsMapper = defaultParamsMapper, executes, partialIds) {
|
|
45
48
|
super({});
|
|
46
49
|
this.dataSource = dataSource;
|
|
50
|
+
this.paramsMapper = paramsMapper;
|
|
47
51
|
this.partialIds = partialIds;
|
|
48
52
|
/**
|
|
49
53
|
* Checks if the given datasource is a multipart request source
|
|
@@ -53,106 +57,51 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
53
57
|
* instead of an encoded string files cannot be sent that way
|
|
54
58
|
*/
|
|
55
59
|
this.isMultipartRequest = false;
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
this.assignEncodedString(viewState);
|
|
67
|
-
}
|
|
68
|
-
if (executes) {
|
|
69
|
-
this.postInit(...executes);
|
|
70
|
-
}
|
|
60
|
+
//encode and append the issuing item if not a partial ids array of ids is passed
|
|
61
|
+
/*
|
|
62
|
+
* Spec. 13.3.1
|
|
63
|
+
* Collect and encode input elements.
|
|
64
|
+
* Additionally the hidden element jakarta.faces.ViewState
|
|
65
|
+
* Enhancement partial page submit
|
|
66
|
+
*/
|
|
67
|
+
this.resolveRequestType(this.dataSource, executes);
|
|
68
|
+
this.encodeSubmittableFields(this.dataSource, this.partialIds);
|
|
69
|
+
this.applyViewState(this.dataSource);
|
|
71
70
|
}
|
|
72
71
|
/**
|
|
73
|
-
*
|
|
74
|
-
* @param executes
|
|
72
|
+
* @returns a Form data representation, this is needed for file submits
|
|
75
73
|
*/
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return this.getFileInputs(element);
|
|
74
|
+
toFormData() {
|
|
75
|
+
/*
|
|
76
|
+
* expands key: [item1, item2]
|
|
77
|
+
* to: [{key: key, value: item1}, {key: key, value: item2}]
|
|
78
|
+
*/
|
|
79
|
+
let expandValueArrays = ([key, item]) => {
|
|
80
|
+
if (Array.isArray(item)) {
|
|
81
|
+
return item.map(value => {
|
|
82
|
+
return { key, value };
|
|
83
|
+
});
|
|
87
84
|
}
|
|
85
|
+
return [{ key, value: item }];
|
|
88
86
|
};
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
/*
|
|
88
|
+
* remaps the incoming {key, value} tuples
|
|
89
|
+
* to naming container prefixed keys and values
|
|
90
|
+
*/
|
|
91
|
+
let remapForNamingContainer = ({ key, value }) => {
|
|
92
|
+
key = this.remapKeyForNamingContainer(key);
|
|
93
|
+
return { key, value };
|
|
91
94
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
applyViewState(form) {
|
|
103
|
-
let viewState = form.byId(Const_1.P_VIEWSTATE, true).inputValue;
|
|
104
|
-
this.appendIf(viewState.isPresent(), Const_1.P_VIEWSTATE).value = viewState.value;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* assigns an url encoded string to this xhrFormData object
|
|
108
|
-
* as key value entry
|
|
109
|
-
* @param encoded
|
|
110
|
-
*/
|
|
111
|
-
assignEncodedString(encoded) {
|
|
112
|
-
// this code filters out empty strings as key value pairs
|
|
113
|
-
let keyValueEntries = decodeURIComponent(encoded).split(/&/gi)
|
|
114
|
-
.filter(item => !!(item || '')
|
|
115
|
-
.replace(/\s+/g, ''));
|
|
116
|
-
this.assignString(keyValueEntries);
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* assign a set of key value pairs passed as array ['key=val1', 'key2=val2']
|
|
120
|
-
* @param keyValueEntries
|
|
121
|
-
*/
|
|
122
|
-
assignString(keyValueEntries) {
|
|
123
|
-
let toMerge = new ExtDomQuery_1.ExtConfig({});
|
|
124
|
-
function splitToKeyVal(line) {
|
|
125
|
-
return line.split(/=(.*)/gi);
|
|
126
|
-
}
|
|
127
|
-
function fixKeyWithoutVal(keyVal) {
|
|
128
|
-
var _a, _b;
|
|
129
|
-
return keyVal.length < 3 ? [(_a = keyVal === null || keyVal === void 0 ? void 0 : keyVal[0]) !== null && _a !== void 0 ? _a : [], (_b = keyVal === null || keyVal === void 0 ? void 0 : keyVal[1]) !== null && _b !== void 0 ? _b : []] : keyVal;
|
|
130
|
-
}
|
|
131
|
-
mona_dish_1.Stream.of(...keyValueEntries)
|
|
132
|
-
//split only the first =
|
|
133
|
-
.map(line => splitToKeyVal(line))
|
|
134
|
-
//special case of having keys without values
|
|
135
|
-
.map(keyVal => fixKeyWithoutVal(keyVal))
|
|
136
|
-
.each(keyVal => {
|
|
137
|
-
var _a, _b;
|
|
138
|
-
toMerge.append(keyVal[0]).value = (_b = (_a = keyVal === null || keyVal === void 0 ? void 0 : keyVal.splice(1)) === null || _a === void 0 ? void 0 : _a.join("")) !== null && _b !== void 0 ? _b : "";
|
|
139
|
-
});
|
|
140
|
-
//merge with overwrite but no append! (aka no double entries are allowed)
|
|
141
|
-
this.shallowMerge(toMerge);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* @returns a Form data representation, this is needed for file submits
|
|
145
|
-
*/
|
|
146
|
-
toFormData() {
|
|
147
|
-
let ret = new FormData();
|
|
148
|
-
this.appendInputs(ret);
|
|
149
|
-
return ret;
|
|
150
|
-
}
|
|
151
|
-
resolveSubmitIdentifier(elem) {
|
|
152
|
-
var _a;
|
|
153
|
-
let identifier = elem.name;
|
|
154
|
-
identifier = (((_a = elem === null || elem === void 0 ? void 0 : elem.name) !== null && _a !== void 0 ? _a : "").replace(/s+/gi, "") == "") ? elem.id : identifier;
|
|
155
|
-
return identifier;
|
|
95
|
+
/*
|
|
96
|
+
* collects everything into a FormData object
|
|
97
|
+
*/
|
|
98
|
+
return ofAssoc(this.value)
|
|
99
|
+
.flatMap(expandValueArrays)
|
|
100
|
+
.map(remapForNamingContainer)
|
|
101
|
+
.reduce((formData, { key, value }) => {
|
|
102
|
+
formData.append(key, value);
|
|
103
|
+
return formData;
|
|
104
|
+
}, new FormData());
|
|
156
105
|
}
|
|
157
106
|
/**
|
|
158
107
|
* returns an encoded string representation of our xhr form data
|
|
@@ -160,76 +109,53 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
160
109
|
* @param defaultStr optional default value if nothing is there to encode
|
|
161
110
|
*/
|
|
162
111
|
toString(defaultStr = Const_1.EMPTY_STR) {
|
|
163
|
-
|
|
164
|
-
return defaultStr;
|
|
165
|
-
}
|
|
166
|
-
let entries = mona_dish_1.LazyStream.of(...Object.keys(this.value))
|
|
167
|
-
.filter(key => this.value.hasOwnProperty(key))
|
|
168
|
-
.flatMap(key => mona_dish_1.Stream.of(...this.value[key]).map(val => [key, val]).collect(new mona_dish_1.ArrayCollector()))
|
|
169
|
-
.map(keyVal => {
|
|
170
|
-
return `${encodeURIComponent(keyVal[0])}=${encodeURIComponent(keyVal[1])}`;
|
|
171
|
-
})
|
|
172
|
-
.collect(new mona_dish_1.ArrayCollector());
|
|
173
|
-
return entries.join("&");
|
|
112
|
+
return (0, FileUtils_1.encodeFormData)(this, this.paramsMapper, defaultStr);
|
|
174
113
|
}
|
|
175
114
|
/**
|
|
176
|
-
*
|
|
177
|
-
* @param rootElement
|
|
178
|
-
* @
|
|
115
|
+
* generic post init code, for now, this performs some post assign data post-processing
|
|
116
|
+
* @param rootElement the root element which knows the request type (usually a form)
|
|
117
|
+
* @param executes the executable dom nodes which need to be processed into the form data, which we can send
|
|
118
|
+
* in our ajax request
|
|
179
119
|
*/
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return rootFileInputs.concat(childFileInputs);
|
|
120
|
+
resolveRequestType(rootElement, executes) {
|
|
121
|
+
if (!executes || executes.indexOf(Const_1.IDENT_NONE) != -1) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
this.isMultipartRequest = rootElement.isMultipartCandidate(true);
|
|
186
125
|
}
|
|
187
126
|
/**
|
|
188
|
-
*
|
|
189
|
-
*
|
|
127
|
+
* special case view state handling
|
|
128
|
+
*
|
|
129
|
+
* @param form the form holding the view state value
|
|
190
130
|
*/
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
/*
|
|
194
|
-
* Spec. 13.3.1
|
|
195
|
-
* Collect and encode input elements.
|
|
196
|
-
* Additionally the hidden element jakarta.faces.ViewState
|
|
197
|
-
* Enhancement partial page submit
|
|
198
|
-
*
|
|
199
|
-
*/
|
|
200
|
-
this.encodeSubmittableFields(this, this.dataSource, this.partialIds);
|
|
201
|
-
if (this.getIf(Const_1.P_VIEWSTATE).isPresent()) {
|
|
131
|
+
applyViewState(form) {
|
|
132
|
+
if (this.getIf((0, Const_1.$nsp)(Const_1.P_VIEWSTATE)).isPresent()) {
|
|
202
133
|
return;
|
|
203
134
|
}
|
|
204
|
-
|
|
135
|
+
let viewStateElement = form.querySelectorAllDeep(`[name*='${(0, Const_1.$nsp)(Const_1.P_VIEWSTATE)}'`);
|
|
136
|
+
let viewState = viewStateElement.inputValue;
|
|
137
|
+
this.appendIf(viewState.isPresent(), this.remapKeyForNamingContainer(viewStateElement.name.value)).value = viewState.value;
|
|
205
138
|
}
|
|
206
139
|
/**
|
|
207
140
|
* determines fields to submit
|
|
208
|
-
* @param {Object} targetBuf - the target form buffer receiving the data
|
|
209
141
|
* @param {Node} parentItem - form element item is nested in
|
|
210
142
|
* @param {Array} partialIds - ids fo PPS
|
|
211
143
|
*/
|
|
212
|
-
encodeSubmittableFields(
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
//lets encode the form elements
|
|
226
|
-
this.shallowMerge(toEncode.deepElements.encodeFormElement());
|
|
144
|
+
encodeSubmittableFields(parentItem, partialIds = []) {
|
|
145
|
+
const mergeIntoThis = ([key, value]) => this.append(key).value = value;
|
|
146
|
+
const namingContainerRemap = ([key, value]) => this.paramsMapper(key, value);
|
|
147
|
+
const remappedPartialIds = partialIds.map(partialId => this.remapKeyForNamingContainer(partialId));
|
|
148
|
+
const partialIdsFilter = ([key, value]) => (!remappedPartialIds.length || key.indexOf("@") == 0) ? true :
|
|
149
|
+
remappedPartialIds.indexOf(key) != -1;
|
|
150
|
+
let inputs = (0, FileUtils_1.getFormInputsAsArr)(parentItem);
|
|
151
|
+
inputs
|
|
152
|
+
.map(FileUtils_1.fixEmptyParameters)
|
|
153
|
+
.map(namingContainerRemap)
|
|
154
|
+
.filter(partialIdsFilter)
|
|
155
|
+
.forEach(mergeIntoThis);
|
|
227
156
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
.each(key => {
|
|
231
|
-
mona_dish_1.Stream.of(...this.value[key]).each(item => ret.append(key, item));
|
|
232
|
-
});
|
|
157
|
+
remapKeyForNamingContainer(key) {
|
|
158
|
+
return this.paramsMapper(key, "")[0];
|
|
233
159
|
}
|
|
234
160
|
}
|
|
235
161
|
exports.XhrFormData = XhrFormData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XhrFormData.js","sourceRoot":"","sources":["../../../src/main/typescript/impl/xhrCore/XhrFormData.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,
|
|
1
|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AAC,gBAAgB,CAAC;aACxB,OAAO,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC;IAEO,0BAA0B,CAAC,GAAW;QAC1C,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;CACJ;AAnID,kCAmIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XhrQueHandler.js","sourceRoot":"","sources":["../../../src/main/typescript/impl/xhrCore/XhrQueHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;EAOE;AAGF,MAAM,kBAAkB;CAEvB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*Queue ->
|
|
3
|
+
enqueue
|
|
4
|
+
-> no delay
|
|
5
|
+
-> push runnable into the queue
|
|
6
|
+
-> task running Y -> EOP
|
|
7
|
+
-> task running N -> trigger queue loop
|
|
8
|
+
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
let activeTimeout = null;
|
|
12
|
+
function debounce(runnable, timeout) {
|
|
13
|
+
if (!!activeTimeout) {
|
|
14
|
+
clearTimeout(activeTimeout);
|
|
15
|
+
}
|
|
16
|
+
if (timeout > 0) {
|
|
17
|
+
activeTimeout = setTimeout(() => {
|
|
18
|
+
try {
|
|
19
|
+
runnable();
|
|
20
|
+
}
|
|
21
|
+
finally {
|
|
22
|
+
clearTimeout(activeTimeout);
|
|
23
|
+
activeTimeout = null;
|
|
24
|
+
}
|
|
25
|
+
}, timeout);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
runnable();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
class XhrQueueController {
|
|
32
|
+
constructor() {
|
|
33
|
+
this.queue = [];
|
|
34
|
+
this.taskRunning = false;
|
|
35
|
+
document.body.addEventListener("xhrNext", () => this.next());
|
|
36
|
+
document.body.addEventListener("xhrClear", () => this.clear());
|
|
37
|
+
}
|
|
38
|
+
enqueue(request, timeOut) {
|
|
39
|
+
debounce(() => {
|
|
40
|
+
if (!this.taskRunning) {
|
|
41
|
+
this.signalTaskRunning();
|
|
42
|
+
request.start();
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
this.queue.push(request);
|
|
46
|
+
}
|
|
47
|
+
}, timeOut);
|
|
48
|
+
}
|
|
49
|
+
signalTaskRunning() {
|
|
50
|
+
this.taskRunning = true;
|
|
51
|
+
}
|
|
52
|
+
next() {
|
|
53
|
+
const next = this.queue.shift();
|
|
54
|
+
this.taskRunning = !!this.queue.length;
|
|
55
|
+
next === null || next === void 0 ? void 0 : next.start();
|
|
56
|
+
}
|
|
57
|
+
clear() {
|
|
58
|
+
this.queue.length = 0;
|
|
59
|
+
this.taskRunning = false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=XhrQueueController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XhrQueueController.js","sourceRoot":"","sources":["../../../src/main/typescript/impl/xhrCore/XhrQueueController.ts"],"names":[],"mappings":";AAAA;;;;;;;EAOE;;AAOF,IAAI,aAAa,GAAG,IAAI,CAAC;AACzB,SAAS,QAAQ,CAAC,QAAQ,EAAE,OAAO;IAC/B,IAAG,CAAC,CAAC,aAAa,EAAE;QAChB,YAAY,CAAC,aAAa,CAAC,CAAC;KAC/B;IACD,IAAG,OAAO,GAAG,CAAC,EAAE;QACZ,aAAa,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,IAAI;gBACJ,QAAQ,EAAE,CAAC;aACV;oBAAS;gBACN,YAAY,CAAC,aAAa,CAAC,CAAC;gBAC5B,aAAa,GAAG,IAAI,CAAC;aACxB;QACL,CAAC,EAAE,OAAO,CAAC,CAAC;KACf;SAAM;QACH,QAAQ,EAAE,CAAC;KACd;AACL,CAAC;AAED,MAAM,kBAAkB;IAIpB;QAHA,UAAK,GAAG,EAAE,CAAC;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