@schukai/monster 3.107.0 → 3.108.1
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/CHANGELOG.md +19 -0
- package/package.json +1 -1
- package/source/components/datatable/filter.mjs +21 -10
- package/source/components/datatable/save-button.mjs +18 -12
- package/source/components/form/select.mjs +2236 -2248
- package/source/components/form/tree-select.mjs +369 -370
- package/source/data/buildmap.mjs +1 -1
- package/source/data/datasource/server/restapi.mjs +3 -3
- package/source/data/transformer.mjs +34 -1
- package/source/dom/updater.mjs +858 -854
- package/source/i18n/internal.mjs +103 -109
- package/source/i18n/map/languages.mjs +1 -3
- package/source/monster.mjs +1 -0
- package/source/types/global.mjs +45 -46
- package/source/types/version.mjs +1 -1
- package/test/cases/monster.mjs +1 -1
- package/test/web/test.html +2 -2
- package/test/web/tests.js +478 -149
package/source/i18n/internal.mjs
CHANGED
@@ -12,120 +12,115 @@
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
13
13
|
*/
|
14
14
|
|
15
|
-
import {Formatter} from "./formatter.mjs";
|
16
|
-
import {getLocaleOfDocument} from "../dom/locale.mjs";
|
17
|
-
import {Translations} from "./translations.mjs";
|
15
|
+
import { Formatter } from "./formatter.mjs";
|
16
|
+
import { getLocaleOfDocument } from "../dom/locale.mjs";
|
17
|
+
import { Translations } from "./translations.mjs";
|
18
18
|
|
19
|
-
export {getInternalLocalizationMessage};
|
19
|
+
export { getInternalLocalizationMessage };
|
20
20
|
|
21
21
|
let internalTranslations = null;
|
22
22
|
getInternalTranslations();
|
23
23
|
|
24
|
-
|
25
24
|
function getInternalTranslations() {
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
internalTranslations = translation;
|
124
|
-
|
125
|
-
return translation
|
25
|
+
if (internalTranslations) {
|
26
|
+
return internalTranslations;
|
27
|
+
}
|
28
|
+
|
29
|
+
let locale = "en";
|
30
|
+
try {
|
31
|
+
let locale = getLocaleOfDocument();
|
32
|
+
} catch (error) {}
|
33
|
+
|
34
|
+
let messages = {};
|
35
|
+
|
36
|
+
switch (locale.language) {
|
37
|
+
case "de":
|
38
|
+
messages = {
|
39
|
+
"the-response-does-not-contain-an-accepted-status": `Der Server hat die Anfrage nicht akzeptiert (Status \${status}).`,
|
40
|
+
"the-response-does-not-contain-a-valid-json": `Die Antwort des Servers ist kein gültiges JSON (actual=\${actual}).`,
|
41
|
+
};
|
42
|
+
break;
|
43
|
+
case "es":
|
44
|
+
messages = {
|
45
|
+
"the-response-does-not-contain-an-accepted-status": `El servidor no ha aceptado la solicitud (Estado \${status}).`,
|
46
|
+
"the-response-does-not-contain-a-valid-json": `La respuesta del servidor no es un JSON válido (actual=\${actual}).`,
|
47
|
+
};
|
48
|
+
break;
|
49
|
+
case "zh":
|
50
|
+
messages = {
|
51
|
+
"the-response-does-not-contain-an-accepted-status": `服务器未接受请求(状态 \${status})。`,
|
52
|
+
"the-response-does-not-contain-a-valid-json": `服务器响应不是有效的JSON(实际=\${actual})。`,
|
53
|
+
};
|
54
|
+
break;
|
55
|
+
case "fr":
|
56
|
+
messages = {
|
57
|
+
"the-response-does-not-contain-an-accepted-status": `Le serveur n'a pas accepté la demande (Statut \${status}).`,
|
58
|
+
"the-response-does-not-contain-a-valid-json": `La réponse du serveur n'est pas un JSON valide (actuel=\${actual}).`,
|
59
|
+
};
|
60
|
+
break;
|
61
|
+
case "it":
|
62
|
+
messages = {
|
63
|
+
"the-response-does-not-contain-an-accepted-status": `Il server non ha accettato la richiesta (Stato \${status}).`,
|
64
|
+
"the-response-does-not-contain-a-valid-json": `La risposta del server non è un JSON valido (attuale=\${actual}).`,
|
65
|
+
};
|
66
|
+
break;
|
67
|
+
case "nl":
|
68
|
+
messages = {
|
69
|
+
"the-response-does-not-contain-an-accepted-status": `De server heeft het verzoek niet geaccepteerd (Status \${status}).`,
|
70
|
+
"the-response-does-not-contain-a-valid-json": `De serverrespons is geen geldige JSON (actueel=\${actual}).`,
|
71
|
+
};
|
72
|
+
break;
|
73
|
+
case "sv":
|
74
|
+
messages = {
|
75
|
+
"the-response-does-not-contain-an-accepted-status": `Servern accepterade inte begäran (Status \${status}).`,
|
76
|
+
"the-response-does-not-contain-a-valid-json": `Serverns svar är inte en giltig JSON (faktisk=\${actual}).`,
|
77
|
+
};
|
78
|
+
break;
|
79
|
+
case "pl":
|
80
|
+
messages = {
|
81
|
+
"the-response-does-not-contain-an-accepted-status": `Serwer nie zaakceptował żądania (Status \${status}).`,
|
82
|
+
"the-response-does-not-contain-a-valid-json": `Odpowiedź serwera nie jest prawidłowym JSON-em (aktualne=\${actual}).`,
|
83
|
+
};
|
84
|
+
break;
|
85
|
+
case "da":
|
86
|
+
messages = {
|
87
|
+
"the-response-does-not-contain-an-accepted-status": `Serveren accepterede ikke forespørgslen (Status \${status}).`,
|
88
|
+
"the-response-does-not-contain-a-valid-json": `Serverens svar er ikke en gyldig JSON (aktuel=\${actual}).`,
|
89
|
+
};
|
90
|
+
break;
|
91
|
+
case "fi":
|
92
|
+
messages = {
|
93
|
+
"the-response-does-not-contain-an-accepted-status": `Palvelin ei hyväksynyt pyyntöä (Tila \${status}).`,
|
94
|
+
"the-response-does-not-contain-a-valid-json": `Palvelimen vastaus ei ole kelvollinen JSON (todellinen=\${actual}).`,
|
95
|
+
};
|
96
|
+
break;
|
97
|
+
case "no":
|
98
|
+
messages = {
|
99
|
+
"the-response-does-not-contain-an-accepted-status": `Serveren aksepterte ikke forespørselen (Status \${status}).`,
|
100
|
+
"the-response-does-not-contain-a-valid-json": `Serverens respons er ikke en gyldig JSON (faktisk=\${actual}).`,
|
101
|
+
};
|
102
|
+
break;
|
103
|
+
case "cs":
|
104
|
+
messages = {
|
105
|
+
"the-response-does-not-contain-an-accepted-status": `Server nepřijal požadavek (Stav \${status}).`,
|
106
|
+
"the-response-does-not-contain-a-valid-json": `Odpověď serveru není platný JSON (skutečný=\${actual}).`,
|
107
|
+
};
|
108
|
+
break;
|
109
|
+
default: // English
|
110
|
+
messages = {
|
111
|
+
"the-response-does-not-contain-an-accepted-status": `The server did not accept the request (Status \${status}).`,
|
112
|
+
"the-response-does-not-contain-a-valid-json": `The server response is not a valid JSON (actual=\${actual}).`,
|
113
|
+
};
|
114
|
+
}
|
115
|
+
|
116
|
+
const translation = new Translations(locale);
|
117
|
+
translation.assignTranslations(messages);
|
118
|
+
|
119
|
+
internalTranslations = translation;
|
120
|
+
|
121
|
+
return translation;
|
126
122
|
}
|
127
123
|
|
128
|
-
|
129
124
|
/**
|
130
125
|
* Returns the internal localization message.
|
131
126
|
* @param message
|
@@ -133,7 +128,6 @@ function getInternalTranslations() {
|
|
133
128
|
*/
|
134
129
|
|
135
130
|
function getInternalLocalizationMessage(message) {
|
136
|
-
|
137
|
-
|
138
|
-
|
131
|
+
const formatter = new Formatter({}, getInternalTranslations());
|
132
|
+
return formatter.format(message);
|
139
133
|
}
|
package/source/monster.mjs
CHANGED
@@ -199,6 +199,7 @@ export * from "./types/queue.mjs";
|
|
199
199
|
export * from "./types/noderecursiveiterator.mjs";
|
200
200
|
export * from "./i18n/time-ago.mjs";
|
201
201
|
export * from "./i18n/formatter.mjs";
|
202
|
+
export * from "./i18n/internal.mjs";
|
202
203
|
export * from "./i18n/locale.mjs";
|
203
204
|
export * from "./i18n/provider.mjs";
|
204
205
|
export * from "./i18n/providers/fetch.mjs";
|
package/source/types/global.mjs
CHANGED
@@ -13,12 +13,12 @@
|
|
13
13
|
*/
|
14
14
|
|
15
15
|
import {
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
validateFunction,
|
17
|
+
validateObject,
|
18
|
+
validateString,
|
19
19
|
} from "./validate.mjs";
|
20
20
|
|
21
|
-
export {getGlobal, getGlobalObject, getGlobalFunction};
|
21
|
+
export { getGlobal, getGlobalObject, getGlobalFunction };
|
22
22
|
|
23
23
|
/**
|
24
24
|
* @type {object}
|
@@ -31,40 +31,39 @@ let globalReference;
|
|
31
31
|
* @throws {Error} unsupported environment.
|
32
32
|
*/
|
33
33
|
(function () {
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
if (typeof globalThis === "object") {
|
35
|
+
globalReference = globalThis;
|
36
|
+
return;
|
37
|
+
}
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
39
|
+
if (typeof self !== "undefined") {
|
40
|
+
globalReference = self;
|
41
|
+
return;
|
42
|
+
} else if (typeof window !== "undefined") {
|
43
|
+
globalReference = window;
|
44
|
+
return;
|
45
|
+
}
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
Object.defineProperty(Object.prototype, "__monster__", {
|
48
|
+
get: function () {
|
49
|
+
return this;
|
50
|
+
},
|
51
|
+
configurable: true,
|
52
|
+
});
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
if (typeof __monster__ === "object") {
|
55
|
+
__monster__.globalThis = __monster__;
|
56
|
+
delete Object.prototype.__monster__;
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
globalReference = globalThis;
|
59
|
+
return;
|
60
|
+
}
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
}
|
62
|
+
try {
|
63
|
+
globalReference = Function("return this")();
|
64
|
+
} catch (e) {}
|
66
65
|
|
67
|
-
|
66
|
+
throw new Error("unsupported environment.");
|
68
67
|
})();
|
69
68
|
|
70
69
|
/**
|
@@ -77,7 +76,7 @@ let globalReference;
|
|
77
76
|
* @return {object} globalThis
|
78
77
|
*/
|
79
78
|
function getGlobal() {
|
80
|
-
|
79
|
+
return globalReference;
|
81
80
|
}
|
82
81
|
|
83
82
|
/**
|
@@ -112,12 +111,12 @@ function getGlobal() {
|
|
112
111
|
* @throws {TypeError} value is not a string
|
113
112
|
*/
|
114
113
|
function getGlobalObject(name) {
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
114
|
+
validateString(name);
|
115
|
+
const o = globalReference?.[name];
|
116
|
+
if (typeof o === "undefined")
|
117
|
+
throw new Error(`the object ${name} is not defined`);
|
118
|
+
validateObject(o);
|
119
|
+
return o;
|
121
120
|
}
|
122
121
|
|
123
122
|
/**
|
@@ -150,11 +149,11 @@ function getGlobalObject(name) {
|
|
150
149
|
* @throws {TypeError} value is not a string
|
151
150
|
*/
|
152
151
|
function getGlobalFunction(name) {
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
152
|
+
validateString(name);
|
153
|
+
const f = globalReference?.[name];
|
154
|
+
if (typeof f === "undefined") {
|
155
|
+
throw new Error(`the function ${name} is not defined`);
|
156
|
+
}
|
157
|
+
validateFunction(f);
|
158
|
+
return f;
|
160
159
|
}
|
package/source/types/version.mjs
CHANGED
package/test/cases/monster.mjs
CHANGED
package/test/web/test.html
CHANGED
@@ -9,8 +9,8 @@
|
|
9
9
|
</head>
|
10
10
|
<body>
|
11
11
|
<div id="headline" style="display: flex;align-items: center;justify-content: center;flex-direction: column;">
|
12
|
-
<h1 style='margin-bottom: 0.1em;'>Monster 3.
|
13
|
-
<div id="lastupdate" style='font-size:0.7em'>last update
|
12
|
+
<h1 style='margin-bottom: 0.1em;'>Monster 3.107.0</h1>
|
13
|
+
<div id="lastupdate" style='font-size:0.7em'>last update Di 11. Feb 14:09:24 CET 2025</div>
|
14
14
|
</div>
|
15
15
|
<div id="mocha-errors"
|
16
16
|
style="color: red;font-weight: bold;display: flex;align-items: center;justify-content: center;flex-direction: column;margin:20px;"></div>
|