Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed validation error message for min/max #1058

Merged
merged 5 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"/packages/sandbox_next"
],
"node": "18",
"buildCommand": "build-libs"
"buildCommand": false
}
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Changelog
- 6.6.0
- Optimizations for rendering and export utils (PR #1054) (issue #342)
- Add JsonLogic Export for SwitchCase (PR #1013)
- Add support of `tooltip` for operator config (PR #1011) (issue #261)
- Optimizations (PR #1054) (issue #342)
- Removed `optimizeRenderWithInternals` from `settings` (PR #1054)
- Fixed `TreeStore` - 2nd arg `action` can be undefined (PR #1054) (issue #1056)
- Fixed import of negative number in SpEL (PR #1054) (issue #1055)
- Fixed validation error message for min/max (PR #1058) (issue #1057)
- 6.5.2
- Updated dependencies. `@babel/runtime` is now dep for core package (PR #1051) (issue #964)
- 6.5.1
Expand Down
2 changes: 1 addition & 1 deletion packages/antd/scripts/build-npm.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
rm -rf ./lib # old name
rm -rf ./cjs
rm -rf ./esm
rm -rf ./css

babel --extensions ".tsx,.jsx,.ts,.js" -d ./cjs ./modules
#find ./cjs -name "*.js" -exec sed -i.bak "s+antd/es/+antd/lib/+g" {} +
Expand All @@ -11,5 +10,6 @@ ESM=1 babel --extensions ".tsx,.jsx,.ts,.js" -d ./esm ./modules
cp ./modules/index.d.ts ./cjs/index.d.ts
cp ./modules/index.d.ts ./esm/index.d.ts

rm -rf ./css
sass -I node_modules -I ../../node_modules styles/:css/ --no-source-map --style=expanded
cp ./styles/* ./css
2 changes: 1 addition & 1 deletion packages/bootstrap/scripts/build-npm.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
rm -rf ./lib # old name
rm -rf ./cjs
rm -rf ./esm
rm -rf ./css

babel -d ./cjs ./modules
ESM=1 babel -d ./esm ./modules
cp ./modules/index.d.ts ./cjs/index.d.ts
cp ./modules/index.d.ts ./esm/index.d.ts

rm -rf ./css
sass -I node_modules -I ../../node_modules styles/:css/ --no-source-map --style=expanded
cp ./styles/* ./css
1 change: 1 addition & 0 deletions packages/core/modules/i18n/validation/constains.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ export const ITEM_POSITION_ROOT = "ITEM_POSITION_ROOT";
export const ITEM_POSITION_WITH_INDEX_PATH = "ITEM_POSITION_WITH_INDEX_PATH";
export const ITEM_POSITION_IN_CASE = "ITEM_POSITION_IN_CASE";

export const _CONTEXT_MIN_MAX = "range";
6 changes: 4 additions & 2 deletions packages/core/modules/i18n/validation/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ export const translations = {
[constants.INCORRECT_VALUE_TYPE]: "Value should have type {{wType}}, but got value of type {{valueType}}",
[constants.INCORRECT_VALUE_JS_TYPE]: "Value should have JS type {{jsType}}, but got value of type {{valueTypeof}}",
[constants.VALUE_LENGTH_CONSTRAINT_FAIL]: "Value {{value}} should have max length {{fieldSettings.maxLength}} but got {{length}}",
[constants.VALUE_MIN_CONSTRAINT_FAIL]: "Value {{value}} should be from {{fieldSettings.min}} to {{fieldSettings.max}}",
[constants.VALUE_MAX_CONSTRAINT_FAIL]: "Value {{value}} should be from {{fieldSettings.min}} to {{fieldSettings.max}}",
[constants.VALUE_MIN_CONSTRAINT_FAIL]: "Value {{value}} should be greater than or equal to {{fieldSettings.min}}",
[constants.VALUE_MIN_CONSTRAINT_FAIL+"_"+constants._CONTEXT_MIN_MAX]: "Value {{value}} should be from {{fieldSettings.min}} to {{fieldSettings.max}}",
[constants.VALUE_MAX_CONSTRAINT_FAIL]: "Value {{value}} should be less than or equal to {{fieldSettings.max}}",
[constants.VALUE_MAX_CONSTRAINT_FAIL+"_"+constants._CONTEXT_MIN_MAX]: "Value {{value}} should be from {{fieldSettings.min}} to {{fieldSettings.max}}",
[constants.NO_CONFIG_FOR_FIELD_VALUE]: "No config for field {{field}}",
[constants.CANT_COMPARE_FIELD_WITH_ITSELF]: "Can't compare field {{field}} with itself",
[constants.CANT_COMPARE_FIELD_WITH_FIELD]: "Can't compare field {{leftField}} with {{rightField}}",
Expand Down
5 changes: 3 additions & 2 deletions packages/core/modules/utils/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -879,11 +879,12 @@ const validateNormalValue = (field, value, valueSrc, valueType, asyncListValues,
});
}
// validate min/max
const minMaxContext = fieldSettings.min != undefined && fieldSettings.max != undefined ? constants._CONTEXT_MIN_MAX : undefined;
if (fieldSettings.min != null && value < fieldSettings.min) {
fixedValue = canFix ? fieldSettings.min : value;
allErrors.push({
key: constants.VALUE_MIN_CONSTRAINT_FAIL,
args: { value, fieldSettings },
args: { value, fieldSettings, context: minMaxContext },
fixed: canFix,
fixedFrom: canFix ? value : undefined,
fixedTo: canFix ? fixedValue : undefined,
Expand All @@ -893,7 +894,7 @@ const validateNormalValue = (field, value, valueSrc, valueType, asyncListValues,
fixedValue = canFix ? fieldSettings.max : value;
allErrors.push({
key: constants.VALUE_MAX_CONSTRAINT_FAIL,
args: { value, fieldSettings },
args: { value, fieldSettings, context: minMaxContext },
fixed: canFix,
fixedFrom: canFix ? value : undefined,
fixedTo: canFix ? fixedValue : undefined,
Expand Down
2 changes: 1 addition & 1 deletion packages/fluent/scripts/build-npm.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
rm -rf ./lib # old name
rm -rf ./cjs
rm -rf ./esm
rm -rf ./css

babel -d ./cjs ./modules
ESM=1 babel -d ./esm ./modules
cp ./modules/index.d.ts ./cjs/index.d.ts
cp ./modules/index.d.ts ./esm/index.d.ts

rm -rf ./css
sass -I node_modules -I ../../node_modules styles/:css/ --no-source-map --style=expanded
cp ./styles/* ./css
2 changes: 1 addition & 1 deletion packages/material/scripts/build-npm.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
rm -rf ./lib # old name
rm -rf ./cjs
rm -rf ./esm
rm -rf ./css

babel -d ./cjs ./modules
ESM=1 babel -d ./esm ./modules
cp ./modules/index.d.ts ./cjs/index.d.ts
cp ./modules/index.d.ts ./esm/index.d.ts

rm -rf ./css
sass -I node_modules -I ../../node_modules styles/:css/ --no-source-map --style=expanded
cp ./styles/* ./css
2 changes: 1 addition & 1 deletion packages/mui/scripts/build-npm.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
rm -rf ./lib # old name
rm -rf ./cjs
rm -rf ./esm
rm -rf ./css

babel -d ./cjs ./modules
ESM=1 babel -d ./esm ./modules
cp ./modules/index.d.ts ./cjs/index.d.ts
cp ./modules/index.d.ts ./esm/index.d.ts

rm -rf ./css
sass -I node_modules -I ../../node_modules styles/:css/ --no-source-map --style=expanded
cp ./styles/* ./css
2 changes: 1 addition & 1 deletion packages/ui/scripts/build-npm.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
rm -rf ./lib # old name
rm -rf ./cjs
rm -rf ./esm
rm -rf ./css

babel -d ./cjs ./modules
ESM=1 babel -d ./esm ./modules
cp ./modules/index.d.ts ./cjs/index.d.ts
cp ./modules/index.d.ts ./esm/index.d.ts

rm -rf ./css
sass styles/:css/ --no-source-map --style=expanded
cp ./styles/* ./css