useMissingValues.js 559 B

1234567891011121314151617
  1. import { computed } from 'vue';
  2. import { toPathOptions } from '../utils/treeUtil';
  3. export default ((options, fieldNames, rawValues) => {
  4. return computed(() => {
  5. const missingValues = [];
  6. const existsValues = [];
  7. rawValues.value.forEach(valueCell => {
  8. const pathOptions = toPathOptions(valueCell, options.value, fieldNames.value);
  9. if (pathOptions.every(opt => opt.option)) {
  10. existsValues.push(valueCell);
  11. } else {
  12. missingValues.push(valueCell);
  13. }
  14. });
  15. return [existsValues, missingValues];
  16. });
  17. });