@wallarm-org/design-system 0.68.1 → 0.68.2-rc-fix-AS-1171-release.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.
|
@@ -14,14 +14,16 @@ export declare const isValueOfType: (value: string | number | boolean, type: Fie
|
|
|
14
14
|
* options. Only consulted when the current field doesn't define the value
|
|
15
15
|
* itself.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* relabelled from an unrelated field that happens to define the same
|
|
24
|
-
* (AS-1171).
|
|
17
|
+
* Borrowing is allowed only for a value that is *foreign* to the current field —
|
|
18
|
+
* one that fails the field's own type/allowlist validation. Such a value cannot
|
|
19
|
+
* have been entered into this field directly, so it was carried over from the
|
|
20
|
+
* field it came from (after a field change) and keeps that field's label
|
|
21
|
+
* (AS-1085, AS-1134). A value that is *valid* for the current field is a genuine
|
|
22
|
+
* user entry (e.g. `1` typed into the freeform `total_requests` field) and must
|
|
23
|
+
* never be relabelled from an unrelated field that happens to define the same
|
|
24
|
+
* value — even on untyped string/enum fields (AS-1171).
|
|
25
|
+
*
|
|
26
|
+
* An unknown field can't validate, so its values may always borrow.
|
|
25
27
|
*/
|
|
26
28
|
export declare const canBorrowCrossFieldLabel: (field: FieldMetadata | null | undefined, value: string | number | boolean | null | undefined) => boolean;
|
|
27
29
|
/** Find a field value option matching by label or value (case-insensitive) */
|
|
@@ -30,14 +30,10 @@ const isValueOfType = (value, type)=>{
|
|
|
30
30
|
return true;
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
const UNTYPED_FIELD_TYPES = new Set([
|
|
34
|
-
'string',
|
|
35
|
-
'enum'
|
|
36
|
-
]);
|
|
37
33
|
const canBorrowCrossFieldLabel = (field, value)=>{
|
|
38
34
|
if (null == value) return false;
|
|
39
|
-
if (!field
|
|
40
|
-
return
|
|
35
|
+
if (!field) return true;
|
|
36
|
+
return validateValueForField(field, value);
|
|
41
37
|
};
|
|
42
38
|
const findMatchingFieldValue = (fieldValues, text)=>fieldValues.find((v)=>v.label.toLowerCase() === text.toLowerCase() || String(v.value).toLowerCase() === text.toLowerCase());
|
|
43
39
|
const isValidFieldValue = (fieldValues, v)=>fieldValues.some((opt)=>opt.value === v || String(opt.value).toLowerCase() === String(v).toLowerCase());
|
package/package.json
CHANGED