useMissingValues.js 607 B

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