first commit
This commit is contained in:
19
frontend/node_modules/rc-cascader/es/hooks/useMissingValues.js
generated
vendored
Normal file
19
frontend/node_modules/rc-cascader/es/hooks/useMissingValues.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import * as React from 'react';
|
||||
import { toPathOptions } from "../utils/treeUtil";
|
||||
export default function useMissingValues(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]);
|
||||
}
|
||||
Reference in New Issue
Block a user