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.
33 lines
886 B
33 lines
886 B
"use strict";
|
|
|
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = void 0;
|
|
|
|
var React = _interopRequireWildcard(require("react"));
|
|
|
|
var _treeUtil = require("../utils/treeUtil");
|
|
|
|
var _default = function _default(options, fieldNames) {
|
|
return React.useCallback(function (rawValues) {
|
|
var missingValues = [];
|
|
var existsValues = [];
|
|
rawValues.forEach(function (valueCell) {
|
|
var pathOptions = (0, _treeUtil.toPathOptions)(valueCell, options, fieldNames);
|
|
|
|
if (pathOptions.every(function (opt) {
|
|
return opt.option;
|
|
})) {
|
|
existsValues.push(valueCell);
|
|
} else {
|
|
missingValues.push(valueCell);
|
|
}
|
|
});
|
|
return [existsValues, missingValues];
|
|
}, [options, fieldNames]);
|
|
};
|
|
|
|
exports.default = _default; |