This commit is contained in:
2026-05-25 17:08:18 +08:00
parent df501f6151
commit f1259b71b5
9178 changed files with 1626125 additions and 0 deletions
@@ -0,0 +1,21 @@
import { conductCheck } from "@rc-component/tree/es/utils/conductUtil";
import * as React from 'react';
import { toPathKeys } from "../utils/commonUtil";
export default function useValues(multiple, rawValues, getPathKeyEntities, getValueByKeyPath, getMissingValues) {
// Fill `rawValues` with checked conduction values
return React.useMemo(() => {
const [existValues, missingValues] = getMissingValues(rawValues);
if (!multiple || !rawValues.length) {
return [existValues, [], missingValues];
}
const keyPathValues = toPathKeys(existValues);
const keyPathEntities = getPathKeyEntities();
const {
checkedKeys,
halfCheckedKeys
} = conductCheck(keyPathValues, true, keyPathEntities);
// Convert key back to value cells
return [getValueByKeyPath(checkedKeys), getValueByKeyPath(halfCheckedKeys), missingValues];
}, [multiple, rawValues, getPathKeyEntities, getValueByKeyPath, getMissingValues]);
}