You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
InternshipProject/node_modules/rc-cascader/es/hooks/useMissingValues.js

20 lines
620 B

import * as React from 'react';
import { toPathOptions } from '../utils/treeUtil';
export default (function (options, fieldNames) {
return React.useCallback(function (rawValues) {
var missingValues = [];
var existsValues = [];
rawValues.forEach(function (valueCell) {
var pathOptions = toPathOptions(valueCell, options, fieldNames);
if (pathOptions.every(function (opt) {
return opt.option;
})) {
existsValues.push(valueCell);
} else {
missingValues.push(valueCell);
}
});
return [existsValues, missingValues];
}, [options, fieldNames]);
});