@schukai/monster 4.45.5 → 4.46.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/CHANGELOG.md +11 -0
- package/package.json +1 -1
- package/source/components/accessibility/locale-select.mjs +200 -200
- package/source/components/datatable/datatable.mjs +1283 -1283
- package/source/components/form/login.mjs +117 -20
- package/source/components/form/select.mjs +3012 -3012
- package/source/components/form/style/login.pcss +16 -1
- package/source/components/form/stylesheet/login.mjs +1 -1
- package/source/components/layout/slider.mjs +686 -686
- package/source/components/navigation/site-navigation.mjs +578 -578
- package/source/components/navigation/stylesheet/site-navigation.mjs +13 -6
- package/source/components/navigation/wizard-navigation.mjs +391 -391
- package/source/monster.mjs +1 -1
|
@@ -538,7 +538,7 @@ function getTranslations() {
|
|
|
538
538
|
messageSomethingWentWrong: "出了点问题,请稍后再试。",
|
|
539
539
|
messageThisFormIsNotConfigured: "此表单尚未配置。",
|
|
540
540
|
messagePasswordResetDisabled:
|
|
541
|
-
"
|
|
541
|
+
"此功能无法使用,因为您的帐户启用了二因素身份验证。请联系管理员。",
|
|
542
542
|
};
|
|
543
543
|
|
|
544
544
|
case "hi":
|
|
@@ -1039,6 +1039,63 @@ function getTranslations() {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
}
|
|
1041
1041
|
|
|
1042
|
+
/**
|
|
1043
|
+
* Normalize the result of a callback into a unified structure.
|
|
1044
|
+
*
|
|
1045
|
+
* Supported return types:
|
|
1046
|
+
* - undefined → no change
|
|
1047
|
+
* - string → transformed value
|
|
1048
|
+
* - false → valid=false
|
|
1049
|
+
* - { value?, valid?, message?, stop? } → structured result
|
|
1050
|
+
*
|
|
1051
|
+
* @private
|
|
1052
|
+
* @param {*} callbackResult
|
|
1053
|
+
* @param {string} currentValue
|
|
1054
|
+
* @return {{ value: string, valid: (boolean|undefined), message: (string|undefined), stop: boolean, raw: * }}
|
|
1055
|
+
*/
|
|
1056
|
+
function normalizeCallbackResult(callbackResult, currentValue) {
|
|
1057
|
+
const normalized = {
|
|
1058
|
+
value: currentValue,
|
|
1059
|
+
valid: undefined,
|
|
1060
|
+
message: undefined,
|
|
1061
|
+
stop: false,
|
|
1062
|
+
raw: callbackResult,
|
|
1063
|
+
};
|
|
1064
|
+
|
|
1065
|
+
if (callbackResult === undefined) {
|
|
1066
|
+
return normalized;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
if (typeof callbackResult === "string") {
|
|
1070
|
+
normalized.value = callbackResult;
|
|
1071
|
+
return normalized;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
if (callbackResult === false) {
|
|
1075
|
+
normalized.valid = false;
|
|
1076
|
+
return normalized;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
if (callbackResult && typeof callbackResult === "object") {
|
|
1080
|
+
if (Object.prototype.hasOwnProperty.call(callbackResult, "value")) {
|
|
1081
|
+
normalized.value = callbackResult.value;
|
|
1082
|
+
}
|
|
1083
|
+
if (Object.prototype.hasOwnProperty.call(callbackResult, "valid")) {
|
|
1084
|
+
normalized.valid = callbackResult.valid;
|
|
1085
|
+
}
|
|
1086
|
+
if (Object.prototype.hasOwnProperty.call(callbackResult, "message")) {
|
|
1087
|
+
normalized.message = callbackResult.message;
|
|
1088
|
+
}
|
|
1089
|
+
if (Object.prototype.hasOwnProperty.call(callbackResult, "stop")) {
|
|
1090
|
+
normalized.stop = Boolean(callbackResult.stop);
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
return normalized;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
return normalized;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1042
1099
|
/**
|
|
1043
1100
|
* @private
|
|
1044
1101
|
* @return {initEventHandler}
|
|
@@ -1129,11 +1186,30 @@ function initEventHandler() {
|
|
|
1129
1186
|
"input[name='username']",
|
|
1130
1187
|
).value;
|
|
1131
1188
|
|
|
1189
|
+
// New structured callback handling for username (backwards compatible)
|
|
1132
1190
|
const userCallback = this.getOption("callbacks.username");
|
|
1133
1191
|
if (isFunction(userCallback)) {
|
|
1134
|
-
const
|
|
1135
|
-
|
|
1136
|
-
username
|
|
1192
|
+
const result = normalizeCallbackResult(
|
|
1193
|
+
userCallback.call(this, username),
|
|
1194
|
+
username,
|
|
1195
|
+
);
|
|
1196
|
+
username = result.value;
|
|
1197
|
+
|
|
1198
|
+
// If callback explicitly marks invalid or wants to stop, handle immediately
|
|
1199
|
+
if (result.valid === false || result.stop === true) {
|
|
1200
|
+
const timeout = this.getOption("timeoutForMessage");
|
|
1201
|
+
const msg =
|
|
1202
|
+
result.message || this.getOption("labels.messageEmptyUserName");
|
|
1203
|
+
|
|
1204
|
+
this.setOption("classes.usernameInvalid", "invalid");
|
|
1205
|
+
this[loginButtonSymbol].setMessage(msg);
|
|
1206
|
+
this[loginButtonSymbol].showMessage(timeout);
|
|
1207
|
+
this[loginButtonSymbol].setState("failed", timeout);
|
|
1208
|
+
|
|
1209
|
+
setTimeout(() => {
|
|
1210
|
+
this.shadowRoot.querySelector("input[name='username']").focus();
|
|
1211
|
+
}, 0);
|
|
1212
|
+
return;
|
|
1137
1213
|
}
|
|
1138
1214
|
}
|
|
1139
1215
|
|
|
@@ -1281,16 +1357,39 @@ function initEventHandler() {
|
|
|
1281
1357
|
this[requestLinkButtonSymbol].setOption("actions.click", (event) => {
|
|
1282
1358
|
const emailElement = this.shadowRoot.querySelector("input[name='email']");
|
|
1283
1359
|
|
|
1284
|
-
// get
|
|
1360
|
+
// get email value and HTML validity
|
|
1285
1361
|
let mail = emailElement.value;
|
|
1286
1362
|
let valid = emailElement.checkValidity();
|
|
1287
1363
|
|
|
1364
|
+
const timeout = this.getOption("timeoutForMessage");
|
|
1365
|
+
|
|
1366
|
+
// New structured callback handling for forgotPassword (backwards compatible)
|
|
1288
1367
|
const mailCallback = this.getOption("callbacks.forgotPassword");
|
|
1289
1368
|
if (isFunction(mailCallback)) {
|
|
1290
|
-
const
|
|
1291
|
-
|
|
1292
|
-
mail
|
|
1293
|
-
|
|
1369
|
+
const result = normalizeCallbackResult(
|
|
1370
|
+
mailCallback.call(this, mail),
|
|
1371
|
+
mail,
|
|
1372
|
+
);
|
|
1373
|
+
|
|
1374
|
+
mail = result.value;
|
|
1375
|
+
|
|
1376
|
+
if (result.valid !== undefined) {
|
|
1377
|
+
valid = result.valid;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
if (result.valid === false || result.stop === true) {
|
|
1381
|
+
this.setOption("classes.emailInvalid", "invalid");
|
|
1382
|
+
|
|
1383
|
+
const msg =
|
|
1384
|
+
result.message ||
|
|
1385
|
+
(mail === "" || mail === null
|
|
1386
|
+
? this.getOption("labels.messageEmptyEmail")
|
|
1387
|
+
: this.getOption("labels.messageInvalidEmail"));
|
|
1388
|
+
|
|
1389
|
+
this[requestLinkButtonSymbol].setMessage(msg);
|
|
1390
|
+
this[requestLinkButtonSymbol].showMessage(timeout);
|
|
1391
|
+
this[requestLinkButtonSymbol].setState("failed", timeout);
|
|
1392
|
+
return;
|
|
1294
1393
|
}
|
|
1295
1394
|
}
|
|
1296
1395
|
|
|
@@ -1305,8 +1404,6 @@ function initEventHandler() {
|
|
|
1305
1404
|
this.setOption("classes.emailInvalid", "");
|
|
1306
1405
|
}
|
|
1307
1406
|
|
|
1308
|
-
const timeout = this.getOption("timeoutForMessage");
|
|
1309
|
-
|
|
1310
1407
|
if (msg !== null && msg !== undefined) {
|
|
1311
1408
|
this[requestLinkButtonSymbol].setMessage(msg);
|
|
1312
1409
|
this[requestLinkButtonSymbol].showMessage(timeout);
|
|
@@ -1337,11 +1434,11 @@ function initEventHandler() {
|
|
|
1337
1434
|
.fetch(url, options)
|
|
1338
1435
|
.then((response) => {
|
|
1339
1436
|
if (response.ok) {
|
|
1340
|
-
const
|
|
1341
|
-
this[requestLinkButtonSymbol].setState("successful",
|
|
1437
|
+
const timeoutSuccess = this.getOption("timeoutForSuccess");
|
|
1438
|
+
this[requestLinkButtonSymbol].setState("successful", timeoutSuccess);
|
|
1342
1439
|
setTimeout(() => {
|
|
1343
1440
|
this.openDigits();
|
|
1344
|
-
},
|
|
1441
|
+
}, timeoutSuccess);
|
|
1345
1442
|
} else {
|
|
1346
1443
|
if (response.status === 403) {
|
|
1347
1444
|
this[requestLinkButtonSymbol].setMessage(
|
|
@@ -1423,12 +1520,12 @@ function initEventHandler() {
|
|
|
1423
1520
|
.fetch(url, options)
|
|
1424
1521
|
.then((response) => {
|
|
1425
1522
|
if (response.ok) {
|
|
1426
|
-
const
|
|
1427
|
-
this[secondFactorButtonSymbol].setState("successful",
|
|
1523
|
+
const timeoutSuccess = this.getOption("timeoutForSuccess");
|
|
1524
|
+
this[secondFactorButtonSymbol].setState("successful", timeoutSuccess);
|
|
1428
1525
|
fireEvent(this, "second-factor-success");
|
|
1429
1526
|
setTimeout(() => {
|
|
1430
1527
|
this.openLoggedIn();
|
|
1431
|
-
},
|
|
1528
|
+
}, timeoutSuccess);
|
|
1432
1529
|
} else {
|
|
1433
1530
|
if (response.status === 403) {
|
|
1434
1531
|
this[secondFactorButtonSymbol].setMessage(
|
|
@@ -1505,14 +1602,14 @@ function initEventHandler() {
|
|
|
1505
1602
|
getWindow()
|
|
1506
1603
|
.fetch(url, options)
|
|
1507
1604
|
.then((response) => {
|
|
1508
|
-
const
|
|
1605
|
+
const timeoutSuccess = this.getOption("timeoutForSuccess");
|
|
1509
1606
|
|
|
1510
1607
|
if (response.ok) {
|
|
1511
|
-
this[digitsButtonSymbol].setState("successful",
|
|
1608
|
+
this[digitsButtonSymbol].setState("successful", timeoutSuccess);
|
|
1512
1609
|
fireEvent(this, "digits-success");
|
|
1513
1610
|
setTimeout(() => {
|
|
1514
1611
|
this.openLoggedIn();
|
|
1515
|
-
},
|
|
1612
|
+
}, timeoutSuccess);
|
|
1516
1613
|
} else {
|
|
1517
1614
|
if (response.status === 403) {
|
|
1518
1615
|
this[digitsButtonSymbol].setMessage(
|