From cd2a5d74c32dccc0dc7570e412b1fa5f2f6ac6bd Mon Sep 17 00:00:00 2001 From: tangjinzhou <21251118@zju.edu.cn> Date: Tue, 25 Dec 2018 19:46:08 +0800 Subject: [PATCH] Delete PropTypes.js --- components/vc-tree-select/src/PropTypes.js | 46 ---------------------- 1 file changed, 46 deletions(-) delete mode 100644 components/vc-tree-select/src/PropTypes.js diff --git a/components/vc-tree-select/src/PropTypes.js b/components/vc-tree-select/src/PropTypes.js deleted file mode 100644 index 2afe88e41..000000000 --- a/components/vc-tree-select/src/PropTypes.js +++ /dev/null @@ -1,46 +0,0 @@ -import PropTypes from '../../_util/vue-types' -import { isLabelInValue } from './util' - -const internalValProp = PropTypes.oneOfType([ - PropTypes.string, - PropTypes.number, -]) - -export function genArrProps (propType) { - return PropTypes.oneOfType([ - propType, - PropTypes.arrayOf(propType), - ]) -} - -/** - * Origin code check `multiple` is true when `treeCheckStrictly` & `labelInValue`. - * But in process logic is already cover to array. - * Check array is not necessary. Let's simplify this check logic. - */ -export function valueProp (...args) { - const [props, propName, Component] = args - - if (isLabelInValue(props)) { - const err = genArrProps(PropTypes.shape({ - label: PropTypes.node, - value: internalValProp, - }).loose)(...args) - if (err) { - return new Error( - `Invalid prop \`${propName}\` supplied to \`${Component}\`. ` + - `You should use { label: string, value: string | number } or [{ label: string, value: string | number }] instead.` - ) - } - return null - } - - const err = genArrProps(internalValProp)(...args) - if (err) { - return new Error( - `Invalid prop \`${propName}\` supplied to \`${Component}\`. ` + - `You should use string or [string] instead.` - ) - } - return null -}