element-plus
Version:
A Component Library for Vue 3
1 lines • 5.43 kB
Source Map (JSON)
{"version":3,"file":"tree.mjs","names":[],"sources":["../../../../../../packages/components/tree/src/tree.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n iconPropType,\n isBoolean,\n} from '@element-plus/utils'\n\nimport type { ComponentInternalInstance, PropType } from 'vue'\nimport type { EmitFn } from '@element-plus/utils'\nimport type Node from './model/node'\nimport type {\n AllowDragFunction,\n AllowDropFunction,\n CheckedInfo,\n NodeDropType,\n RenderContentFunction,\n TreeComponentProps,\n TreeData,\n} from './tree.type'\n\nexport const treeProps = buildProps({\n data: {\n type: definePropType<TreeData>(Array),\n default: () => [],\n },\n emptyText: {\n type: String,\n },\n renderAfterExpand: {\n type: Boolean,\n default: true,\n },\n nodeKey: String,\n checkStrictly: Boolean,\n defaultExpandAll: Boolean,\n expandOnClickNode: {\n type: Boolean,\n default: true,\n },\n checkOnClickNode: Boolean,\n checkOnClickLeaf: {\n type: Boolean,\n default: true,\n },\n checkDescendants: Boolean,\n autoExpandParent: {\n type: Boolean,\n default: true,\n },\n defaultCheckedKeys: {\n type: Array as PropType<TreeComponentProps['defaultCheckedKeys']>,\n },\n defaultExpandedKeys: {\n type: Array as PropType<TreeComponentProps['defaultExpandedKeys']>,\n },\n currentNodeKey: {\n type: [String, Number] as PropType<string | number>,\n },\n renderContent: {\n type: definePropType<RenderContentFunction>(Function),\n },\n showCheckbox: Boolean,\n draggable: Boolean,\n allowDrag: {\n type: definePropType<AllowDragFunction>(Function),\n },\n allowDrop: {\n type: definePropType<AllowDropFunction>(Function),\n },\n props: {\n type: Object as PropType<TreeComponentProps['props']>,\n default: () => ({\n children: 'children',\n label: 'label',\n disabled: 'disabled',\n }),\n },\n lazy: Boolean,\n highlightCurrent: Boolean,\n load: {\n type: Function as PropType<TreeComponentProps['load']>,\n },\n filterNodeMethod: {\n type: Function as PropType<TreeComponentProps['filterNodeMethod']>,\n },\n accordion: Boolean,\n indent: {\n type: Number,\n default: 18,\n },\n icon: {\n type: iconPropType,\n },\n} as const)\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\nexport const treeEmits = {\n 'check-change': (data: any, checked: boolean, indeterminate: boolean) =>\n data && isBoolean(checked) && isBoolean(indeterminate),\n 'current-change': (data: any | null, node: Node | null) => true,\n 'node-click': (\n data: any,\n node: Node,\n nodeInstance: ComponentInternalInstance | null,\n evt: MouseEvent\n ) => data && node && evt instanceof Event,\n 'node-contextmenu': (\n evt: Event,\n data: any,\n node: Node,\n nodeInstance: ComponentInternalInstance | null\n ) => evt instanceof Event && data && node,\n 'node-collapse': (\n data: any,\n node: Node,\n nodeInstance: ComponentInternalInstance | null\n ) => data && node,\n 'node-expand': (\n data: any,\n node: Node,\n nodeInstance: ComponentInternalInstance | null\n ) => data && node,\n check: (data: any, checkedInfo: CheckedInfo) => data && checkedInfo,\n 'node-drag-start': (node: Node, evt: DragEvent) => node && evt,\n 'node-drag-end': (\n draggingNode: Node,\n dropNode: Node | null,\n dropType: NodeDropType,\n evt: DragEvent\n ) => draggingNode && evt,\n 'node-drop': (\n draggingNode: Node,\n dropNode: Node,\n dropType: Exclude<NodeDropType, 'none'>,\n evt: DragEvent\n ) => draggingNode && dropNode && evt,\n 'node-drag-leave': (draggingNode: Node, oldDropNode: Node, evt: DragEvent) =>\n draggingNode && oldDropNode && evt,\n 'node-drag-enter': (draggingNode: Node, dropNode: Node, evt: DragEvent) =>\n draggingNode && dropNode && evt,\n 'node-drag-over': (draggingNode: Node, dropNode: Node, evt: DragEvent) =>\n draggingNode && dropNode && evt,\n}\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\nexport type TreeEmits = EmitFn<typeof treeEmits>\n"],"mappings":";;;;;AAoBA,MAAa,YAAY,WAAW;CAClC,MAAM;EACJ,MAAM,eAAyB,MAAM;EACrC,eAAe,EAAE;EAClB;CACD,WAAW,EACT,MAAM,QACP;CACD,mBAAmB;EACjB,MAAM;EACN,SAAS;EACV;CACD,SAAS;CACT,eAAe;CACf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