mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-05 05:29:01 +08:00
f0385d7c24
* feat: tree * refactor: select * refactor: select * refactor: select * refactor: vc-tree-select * refactor: tree-select * refactor: tree-select * feat: add showLeafIcon * refactor: remove lod vc-tree-select * feat: tree-select add tag-render * refactor: cascader * refactor: cascader * refactor: cascader * refactor: cascader * fix: maxTagmaxTagPlaceholder not work
27 lines
806 B
TypeScript
27 lines
806 B
TypeScript
import type { Ref } from 'vue';
|
|
import { computed } from 'vue';
|
|
import type { SingleValueType, DefaultOptionType, InternalFieldNames } from '../Cascader';
|
|
import { toPathOptions } from '../utils/treeUtil';
|
|
|
|
export default (
|
|
options: Ref<DefaultOptionType[]>,
|
|
fieldNames: Ref<InternalFieldNames>,
|
|
rawValues: Ref<SingleValueType[]>,
|
|
) => {
|
|
return computed(() => {
|
|
const missingValues: SingleValueType[] = [];
|
|
const existsValues: SingleValueType[] = [];
|
|
|
|
rawValues.value.forEach(valueCell => {
|
|
const pathOptions = toPathOptions(valueCell, options.value, fieldNames.value);
|
|
if (pathOptions.every(opt => opt.option)) {
|
|
existsValues.push(valueCell);
|
|
} else {
|
|
missingValues.push(valueCell);
|
|
}
|
|
});
|
|
|
|
return [existsValues, missingValues];
|
|
});
|
|
};
|