@makehq/forman-schema 1.12.0 → 1.12.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/dist/index.cjs +7 -4
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1056,6 +1056,9 @@ function processNestedDirective(field, nested, domain, result, context) {
|
|
|
1056
1056
|
}
|
|
1057
1057
|
|
|
1058
1058
|
// src/validator.ts
|
|
1059
|
+
function fieldAllowsCustomValue(field) {
|
|
1060
|
+
return field.mappable === true || field.editable === true;
|
|
1061
|
+
}
|
|
1059
1062
|
function hasPlaceholderNested(field) {
|
|
1060
1063
|
if (!isObject(field.options)) return false;
|
|
1061
1064
|
const placeholder = field.options.placeholder;
|
|
@@ -1678,7 +1681,7 @@ async function handlePathType(value, field, context) {
|
|
|
1678
1681
|
});
|
|
1679
1682
|
const selectedOption = selectableOptions.find((candidate) => candidate.value === levelSelectedValue);
|
|
1680
1683
|
if (!selectedOption) {
|
|
1681
|
-
if (optionsFromRPC) {
|
|
1684
|
+
if (optionsFromRPC && (context.roots[context.domain].allowDynamicValues || fieldAllowsCustomValue(field))) {
|
|
1682
1685
|
warnings.push({
|
|
1683
1686
|
domain: context.domain,
|
|
1684
1687
|
path: context.path.join("."),
|
|
@@ -1784,7 +1787,7 @@ async function handleSelectType(value, field, context) {
|
|
|
1784
1787
|
optionsOrGroups
|
|
1785
1788
|
);
|
|
1786
1789
|
if (!found) {
|
|
1787
|
-
(optionsFromRPC && context.roots[context.domain].allowDynamicValues ? warnings : errors).push({
|
|
1790
|
+
(optionsFromRPC && (context.roots[context.domain].allowDynamicValues || fieldAllowsCustomValue(field)) ? warnings : errors).push({
|
|
1788
1791
|
domain: context.domain,
|
|
1789
1792
|
path: context.path.join("."),
|
|
1790
1793
|
message: `Value '${singleValue}' not found in options.`
|
|
@@ -1792,7 +1795,7 @@ async function handleSelectType(value, field, context) {
|
|
|
1792
1795
|
hasUnresolvedValue = true;
|
|
1793
1796
|
}
|
|
1794
1797
|
}
|
|
1795
|
-
if (optionsFromRPC && context.roots[context.domain].allowDynamicValues && hasUnresolvedValue) {
|
|
1798
|
+
if (optionsFromRPC && (context.roots[context.domain].allowDynamicValues || fieldAllowsCustomValue(field)) && hasUnresolvedValue) {
|
|
1796
1799
|
context.roots[context.domain].fieldStates.push({
|
|
1797
1800
|
path: context.path,
|
|
1798
1801
|
state: { mode: "edit" }
|
|
@@ -1829,7 +1832,7 @@ async function handleSelectType(value, field, context) {
|
|
|
1829
1832
|
} else {
|
|
1830
1833
|
const item = findValueInSelectOptions(field, value, optionsOrGroups);
|
|
1831
1834
|
if (!item) {
|
|
1832
|
-
if (optionsFromRPC && context.roots[context.domain].allowDynamicValues) {
|
|
1835
|
+
if (optionsFromRPC && (context.roots[context.domain].allowDynamicValues || fieldAllowsCustomValue(field))) {
|
|
1833
1836
|
warnings.push({
|
|
1834
1837
|
domain: context.domain,
|
|
1835
1838
|
path: context.path.join("."),
|
package/dist/index.d.cts
CHANGED
|
@@ -53,6 +53,8 @@ type FormanSchemaField = {
|
|
|
53
53
|
disabled?: boolean;
|
|
54
54
|
/** Whether the field is mappable */
|
|
55
55
|
mappable?: boolean;
|
|
56
|
+
/** Whether the field allows custom (typed-in) values even when dynamic values are not allowed in the domain */
|
|
57
|
+
editable?: boolean;
|
|
56
58
|
/** Whether the user will be able to insert new lines in GUI (a textarea will be displayed instead of the text field) */
|
|
57
59
|
multiline?: boolean;
|
|
58
60
|
/** Whether the select field allows multiple values */
|
package/dist/index.d.ts
CHANGED
|
@@ -53,6 +53,8 @@ type FormanSchemaField = {
|
|
|
53
53
|
disabled?: boolean;
|
|
54
54
|
/** Whether the field is mappable */
|
|
55
55
|
mappable?: boolean;
|
|
56
|
+
/** Whether the field allows custom (typed-in) values even when dynamic values are not allowed in the domain */
|
|
57
|
+
editable?: boolean;
|
|
56
58
|
/** Whether the user will be able to insert new lines in GUI (a textarea will be displayed instead of the text field) */
|
|
57
59
|
multiline?: boolean;
|
|
58
60
|
/** Whether the select field allows multiple values */
|
package/dist/index.js
CHANGED
|
@@ -1027,6 +1027,9 @@ function processNestedDirective(field, nested, domain, result, context) {
|
|
|
1027
1027
|
}
|
|
1028
1028
|
|
|
1029
1029
|
// src/validator.ts
|
|
1030
|
+
function fieldAllowsCustomValue(field) {
|
|
1031
|
+
return field.mappable === true || field.editable === true;
|
|
1032
|
+
}
|
|
1030
1033
|
function hasPlaceholderNested(field) {
|
|
1031
1034
|
if (!isObject(field.options)) return false;
|
|
1032
1035
|
const placeholder = field.options.placeholder;
|
|
@@ -1649,7 +1652,7 @@ async function handlePathType(value, field, context) {
|
|
|
1649
1652
|
});
|
|
1650
1653
|
const selectedOption = selectableOptions.find((candidate) => candidate.value === levelSelectedValue);
|
|
1651
1654
|
if (!selectedOption) {
|
|
1652
|
-
if (optionsFromRPC) {
|
|
1655
|
+
if (optionsFromRPC && (context.roots[context.domain].allowDynamicValues || fieldAllowsCustomValue(field))) {
|
|
1653
1656
|
warnings.push({
|
|
1654
1657
|
domain: context.domain,
|
|
1655
1658
|
path: context.path.join("."),
|
|
@@ -1755,7 +1758,7 @@ async function handleSelectType(value, field, context) {
|
|
|
1755
1758
|
optionsOrGroups
|
|
1756
1759
|
);
|
|
1757
1760
|
if (!found) {
|
|
1758
|
-
(optionsFromRPC && context.roots[context.domain].allowDynamicValues ? warnings : errors).push({
|
|
1761
|
+
(optionsFromRPC && (context.roots[context.domain].allowDynamicValues || fieldAllowsCustomValue(field)) ? warnings : errors).push({
|
|
1759
1762
|
domain: context.domain,
|
|
1760
1763
|
path: context.path.join("."),
|
|
1761
1764
|
message: `Value '${singleValue}' not found in options.`
|
|
@@ -1763,7 +1766,7 @@ async function handleSelectType(value, field, context) {
|
|
|
1763
1766
|
hasUnresolvedValue = true;
|
|
1764
1767
|
}
|
|
1765
1768
|
}
|
|
1766
|
-
if (optionsFromRPC && context.roots[context.domain].allowDynamicValues && hasUnresolvedValue) {
|
|
1769
|
+
if (optionsFromRPC && (context.roots[context.domain].allowDynamicValues || fieldAllowsCustomValue(field)) && hasUnresolvedValue) {
|
|
1767
1770
|
context.roots[context.domain].fieldStates.push({
|
|
1768
1771
|
path: context.path,
|
|
1769
1772
|
state: { mode: "edit" }
|
|
@@ -1800,7 +1803,7 @@ async function handleSelectType(value, field, context) {
|
|
|
1800
1803
|
} else {
|
|
1801
1804
|
const item = findValueInSelectOptions(field, value, optionsOrGroups);
|
|
1802
1805
|
if (!item) {
|
|
1803
|
-
if (optionsFromRPC && context.roots[context.domain].allowDynamicValues) {
|
|
1806
|
+
if (optionsFromRPC && (context.roots[context.domain].allowDynamicValues || fieldAllowsCustomValue(field))) {
|
|
1804
1807
|
warnings.push({
|
|
1805
1808
|
domain: context.domain,
|
|
1806
1809
|
path: context.path.join("."),
|