UNPKG

@aplus-frontend/antdv

Version:

Vue basic component library maintained based on ant-design-vue

22 lines 772 B
import { computed } from 'vue'; import warning from '../../vc-util/warning'; export default function usePresets(presets, legacyRanges) { return computed(() => { if (presets === null || presets === void 0 ? void 0 : presets.value) { return presets.value; } if (legacyRanges === null || legacyRanges === void 0 ? void 0 : legacyRanges.value) { warning(false, '`ranges` is deprecated. Please use `presets` instead.'); const rangeLabels = Object.keys(legacyRanges.value); return rangeLabels.map(label => { const range = legacyRanges.value[label]; const newValues = typeof range === 'function' ? range() : range; return { label, value: newValues }; }); } return []; }); }