UNPKG

element-plus

Version:

A Component Library for Vue 3

118 lines (115 loc) 3.22 kB
import { computed } from 'vue'; import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs'; import { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '../../../constants/event.mjs'; import { NOOP } from '@vue/shared'; const CommonProps = buildProps({ /** * @description specify which key of node object is used as the node's value */ modelValue: { type: definePropType([Number, String, Array, Object]) }, /** * @description data of the options, the key of `value` and `label` can be customize by `CascaderProps`. */ options: { type: definePropType(Array), default: () => [] }, /** * @description configuration options, see the following `CascaderProps` table. */ props: { type: definePropType(Object), default: () => ({}) } }); const DefaultProps = { /** * @description trigger mode of expanding options */ expandTrigger: "click", /** * @description whether multiple selection is enabled */ multiple: false, /** * @description whether checked state of a node not affects its parent and child nodes */ checkStrictly: false, // whether all nodes can be selected /** * @description when checked nodes change, whether to emit an array of node's path, if false, only emit the value of node. */ emitPath: true, // wether to emit an array of all levels value in which node is located /** * @description whether to dynamic load child nodes, use with `lazyload` attribute */ lazy: false, /** * @description method for loading child nodes data, only works when `lazy` is true */ lazyLoad: NOOP, /** * @description specify which key of node object is used as the node's value */ value: "value", /** * @description specify which key of node object is used as the node's label */ label: "label", /** * @description specify which key of node object is used as the node's children */ children: "children", /** * @description specify which key of node object is used as the node's leaf */ leaf: "leaf", /** * @description specify which key of node object is used as the node's disabled */ disabled: "disabled", /** * @description hover threshold of expanding options */ hoverThreshold: 500, /** * @description whether to check or uncheck node when clicking on the node */ checkOnClickNode: false, /** * @description whether to check or uncheck node when clicking on leaf node (last children). */ checkOnClickLeaf: true, /** * @description whether to show the radio or checkbox prefix */ showPrefix: true }; const cascaderPanelProps = buildProps({ ...CommonProps, border: { type: Boolean, default: true }, renderLabel: { type: Function } }); const emitChangeFn = (value) => true; const cascaderPanelEmits = { [UPDATE_MODEL_EVENT]: emitChangeFn, [CHANGE_EVENT]: emitChangeFn, close: () => true, "expand-change": (value) => value }; const useCascaderConfig = (props) => { return computed(() => ({ ...DefaultProps, ...props.props })); }; export { CommonProps, DefaultProps, cascaderPanelEmits, cascaderPanelProps, useCascaderConfig }; //# sourceMappingURL=config.mjs.map