indicator-ui 0.0.72 → 0.0.74
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.js
CHANGED
|
@@ -8482,7 +8482,7 @@ const getValidateFunResponse = (value, fun) => {
|
|
|
8482
8482
|
}
|
|
8483
8483
|
return { status: res, message: '' };
|
|
8484
8484
|
};
|
|
8485
|
-
const getValidateFun = (validationProps,
|
|
8485
|
+
const getValidateFun = ({ validationProps, keyWay, value, schemeRequired, addError, removeError, }) => {
|
|
8486
8486
|
return () => {
|
|
8487
8487
|
let required = schemeRequired;
|
|
8488
8488
|
let fun = () => true;
|
|
@@ -8506,20 +8506,34 @@ const getValidateFun = (validationProps, value, keyWay, schemeRequired, removeEr
|
|
|
8506
8506
|
};
|
|
8507
8507
|
const getOnBlurValidation = (schema, additionProps, keyWay) => {
|
|
8508
8508
|
const props = schema.props.onBlurValidation || schema.props.onChangeValidation;
|
|
8509
|
-
if (props) {
|
|
8509
|
+
if (props || props.required) {
|
|
8510
8510
|
const value = additionProps.getValue(keyWay);
|
|
8511
|
-
return getValidateFun(
|
|
8511
|
+
return getValidateFun({
|
|
8512
|
+
validationProps: props,
|
|
8513
|
+
value: value,
|
|
8514
|
+
keyWay: keyWay,
|
|
8515
|
+
schemeRequired: schema.props.required || false,
|
|
8516
|
+
removeError: additionProps.removeErrorField,
|
|
8517
|
+
addError: additionProps.addErrorField
|
|
8518
|
+
});
|
|
8512
8519
|
}
|
|
8513
8520
|
return undefined;
|
|
8514
8521
|
};
|
|
8515
8522
|
const getOnChangeValidation = (schema, additionProps, keyWay) => {
|
|
8516
8523
|
let props = schema.props.onChangeValidation;
|
|
8517
8524
|
if (!props && schema.props.required === true) {
|
|
8518
|
-
props = { fun: (
|
|
8525
|
+
props = { fun: () => true };
|
|
8519
8526
|
}
|
|
8520
8527
|
if (props) {
|
|
8521
8528
|
const value = additionProps.getValue(keyWay);
|
|
8522
|
-
return getValidateFun(
|
|
8529
|
+
return getValidateFun({
|
|
8530
|
+
validationProps: props,
|
|
8531
|
+
value: value,
|
|
8532
|
+
keyWay: keyWay,
|
|
8533
|
+
schemeRequired: schema.props.required || false,
|
|
8534
|
+
removeError: additionProps.removeOnChangeErrorField,
|
|
8535
|
+
addError: additionProps.addOnChangeErrorField
|
|
8536
|
+
});
|
|
8523
8537
|
}
|
|
8524
8538
|
return undefined;
|
|
8525
8539
|
};
|
|
@@ -9591,7 +9605,7 @@ function SelectField({ value, onChange, options = [], placeholder, isError, sear
|
|
|
9591
9605
|
setOptionsState(options);
|
|
9592
9606
|
}, [options]);
|
|
9593
9607
|
const handleChange = (data) => {
|
|
9594
|
-
optionsCacheRef.current = optionsState.filter(item => data.includes(item.value));
|
|
9608
|
+
optionsCacheRef.current = data.length > 0 ? optionsState.filter(item => data.includes(item.value)) : optionsState;
|
|
9595
9609
|
if (data.length === 0 && required) {
|
|
9596
9610
|
let newValue;
|
|
9597
9611
|
if (Array.isArray(value)) {
|
|
@@ -9600,7 +9614,7 @@ function SelectField({ value, onChange, options = [], placeholder, isError, sear
|
|
|
9600
9614
|
else {
|
|
9601
9615
|
newValue = value;
|
|
9602
9616
|
}
|
|
9603
|
-
onChange && onChange([newValue || optionsState[0]]);
|
|
9617
|
+
onChange && onChange([newValue || optionsState[0].value]);
|
|
9604
9618
|
}
|
|
9605
9619
|
else {
|
|
9606
9620
|
if (data.length > 1 && !multiple) {
|