docs: annotate all shared frontend modules in Chinese
This commit is contained in:
1 parent
2be21c1c62
commit
408f8e5c98
55 files changed
+349
No files matched your search
@@ -1,3 +1,4 @@
|
||||
/** 商品自定义字段协议适配、默认值与提交前校验;服务端仍负责最终字段与规则校验。 */
|
||||
function e(e) {
|
||||
return e && typeof e == `object` && !Array.isArray(e) ? e : null;
|
||||
}
|
||||
@@ -7,6 +8,7 @@ function t(e) {
|
||||
function n(e) {
|
||||
return e === !0 || e === 1 || e === `1`;
|
||||
}
|
||||
// 下拉选项兼容对象数组、纯值数组及逗号/换行分隔字符串,最终统一为 value/label。
|
||||
function r(n) {
|
||||
return (
|
||||
Array.isArray(n)
|
||||
@@ -33,6 +35,10 @@ function r(n) {
|
||||
)
|
||||
.filter((e) => e.value !== ``);
|
||||
}
|
||||
/**
|
||||
* 将后端 PCRE 风格 regexpr 的可表达部分转换为 JS RegExp。
|
||||
* 不支持的高级构造标记 patternServerOnly,不能假装浏览器已经完成等价验证。
|
||||
*/
|
||||
function i(e) {
|
||||
let n = t(e).trim();
|
||||
if (!n) return {};
|
||||
@@ -44,6 +50,7 @@ function i(e) {
|
||||
"{": `}`,
|
||||
"<": `>`,
|
||||
};
|
||||
// 识别 /.../i、{...} 等包围符,跳过转义字符并处理成对分隔符的嵌套。
|
||||
if (/[^a-zA-Z0-9\\\s\0]/.test(i)) {
|
||||
let e = a[i] ?? i,
|
||||
t = 1,
|
||||
@@ -82,6 +89,7 @@ function i(e) {
|
||||
patternFlags: s || void 0,
|
||||
patternServerOnly: !0,
|
||||
};
|
||||
// 逐字符翻译锚点、扩展空白模式和非捕获/非贪婪约定;字符组内不执行这些改写。
|
||||
let c = ``,
|
||||
l = !1;
|
||||
for (let e = 0; e < n.length; e++) {
|
||||
@@ -140,6 +148,7 @@ function i(e) {
|
||||
patternFlags: s || void 0,
|
||||
};
|
||||
}
|
||||
/** 只保留当前组件支持的字段类型,id 去重;未知类型不生成一个错误的可提交控件。 */
|
||||
function a(a) {
|
||||
let o = e(a),
|
||||
s = Array.isArray(a) ? a : Array.isArray(o?.data) ? o.data : [],
|
||||
@@ -180,11 +189,13 @@ function a(a) {
|
||||
}
|
||||
return c.filter((e, t, n) => n.findIndex((t) => t.id === e.id) === t);
|
||||
}
|
||||
// explain 仅用于说明,不进入提交模型;其他类型初始为空,由控件和校验共同处理。
|
||||
function o(e) {
|
||||
return Object.fromEntries(
|
||||
e.filter((e) => e.kind !== `explain`).map((e) => [e.id, (e.kind, ``)]),
|
||||
);
|
||||
}
|
||||
/** 逐字段检查必填、选项值和可本地执行的正则;布尔字段按后端约定归一为 "1"/空串。 */
|
||||
function s(e, t) {
|
||||
for (let n of e) {
|
||||
if (n.kind === `explain`) continue;
|
||||
|
||||
Reference in new issue
Block a user