UNPKG

element-plus

Version:

A Component Library for Vue 3

146 lines (145 loc) 3.67 kB
import { CHANGE_EVENT, UPDATE_MODEL_EVENT } from "../../../constants/event.mjs"; import { buildProps, definePropType } from "../../../utils/vue/props/runtime.mjs"; import { NOOP } from "../../../utils/functions.mjs"; import { computed } from "vue"; //#region ../../packages/components/cascader-panel/src/config.ts /** * @description node height for virtual scrolling */ const CASCADER_PANEL_ITEM_SIZE = 34; /** * @description menu height for virtual scrolling */ const CASCADER_PANEL_HEIGHT = 204; 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: () => ({}) }, /** * @description whether to enable virtual scrolling */ virtualScroll: Boolean, /** * @description node height for virtual scrolling */ itemSize: { type: Number, default: 34 }, /** * @description menu height for virtual scrolling */ height: { type: Number, default: 204 } }); 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, /** * @description when checked nodes change, whether to emit an array of node's path, if false, only emit the value of node. */ emitPath: true, /** * @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 }; /** * @deprecated Removed after 3.0.0, Use `CascaderPanelProps` instead. */ 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 })); }; //#endregion export { CASCADER_PANEL_HEIGHT, CASCADER_PANEL_ITEM_SIZE, CommonProps, DefaultProps, cascaderPanelEmits, cascaderPanelProps, useCascaderConfig }; //# sourceMappingURL=config.mjs.map