@atscript/ui 0.1.198 → 0.1.199
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/dist/form/validate.cjs +4 -3
- package/dist/form/validate.mjs +4 -3
- package/package.json +1 -1
package/dist/form/validate.cjs
CHANGED
|
@@ -61,8 +61,9 @@ const serverManagedPlugin = (ctx, def, value) => {
|
|
|
61
61
|
};
|
|
62
62
|
/**
|
|
63
63
|
* A required value-help picker left unpicked — absent, `null` (its ×), or `""`
|
|
64
|
-
* for a string foreign key (never a key
|
|
65
|
-
*
|
|
64
|
+
* for a string foreign key (never a key, unless its own `@meta.default` is
|
|
65
|
+
* `''`: its "none"; a `@ui.valueHelp` binding on a plain string column takes
|
|
66
|
+
* `""`, as the server does) — fails with code `REQUIRED`
|
|
66
67
|
* and its `@expect.message`, else the code's text ("Must not be empty"), as
|
|
67
68
|
* `@meta.required` reports a missing value (a number field may not carry
|
|
68
69
|
* `@meta.required`). A `@meta.required` field keeps the validator's own rule
|
|
@@ -82,7 +83,7 @@ function missingPickPlugin(pickers) {
|
|
|
82
83
|
if (value !== void 0 && value !== null && value !== "") return void 0;
|
|
83
84
|
if (!pickers.has(def) || def.optional || def.metadata.has("meta.required")) return void 0;
|
|
84
85
|
if (value === "") {
|
|
85
|
-
if (!(def.type.designType === "string") || !require_extract_ref.isForeignKey(def)) return
|
|
86
|
+
if (!(def.type.designType === "string") || def.metadata.get("meta.default") === "" || !require_extract_ref.isForeignKey(def)) return;
|
|
86
87
|
}
|
|
87
88
|
const custom = def.metadata.get(require_annotation_keys.EXPECT_MESSAGE);
|
|
88
89
|
ctx.error(custom || _atscript_typescript_utils.VALIDATOR_MESSAGES.REQUIRED, void 0, void 0, {
|
package/dist/form/validate.mjs
CHANGED
|
@@ -61,8 +61,9 @@ const serverManagedPlugin = (ctx, def, value) => {
|
|
|
61
61
|
};
|
|
62
62
|
/**
|
|
63
63
|
* A required value-help picker left unpicked — absent, `null` (its ×), or `""`
|
|
64
|
-
* for a string foreign key (never a key
|
|
65
|
-
*
|
|
64
|
+
* for a string foreign key (never a key, unless its own `@meta.default` is
|
|
65
|
+
* `''`: its "none"; a `@ui.valueHelp` binding on a plain string column takes
|
|
66
|
+
* `""`, as the server does) — fails with code `REQUIRED`
|
|
66
67
|
* and its `@expect.message`, else the code's text ("Must not be empty"), as
|
|
67
68
|
* `@meta.required` reports a missing value (a number field may not carry
|
|
68
69
|
* `@meta.required`). A `@meta.required` field keeps the validator's own rule
|
|
@@ -82,7 +83,7 @@ function missingPickPlugin(pickers) {
|
|
|
82
83
|
if (value !== void 0 && value !== null && value !== "") return void 0;
|
|
83
84
|
if (!pickers.has(def) || def.optional || def.metadata.has("meta.required")) return void 0;
|
|
84
85
|
if (value === "") {
|
|
85
|
-
if (!(def.type.designType === "string") || !isForeignKey(def)) return
|
|
86
|
+
if (!(def.type.designType === "string") || def.metadata.get("meta.default") === "" || !isForeignKey(def)) return;
|
|
86
87
|
}
|
|
87
88
|
const custom = def.metadata.get(EXPECT_MESSAGE);
|
|
88
89
|
ctx.error(custom || VALIDATOR_MESSAGES.REQUIRED, void 0, void 0, {
|