You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0 lines
6.8 KiB

1 month ago
  1. {"ast":null,"code":"import { defineComponent, ref, computed, reactive, onMounted, h } from 'vue';\nimport { pick } from 'lodash-unified';\nimport { ElSelect } from '../../select/index.mjs';\nimport { ElTree } from '../../tree/index.mjs';\nimport { useSelect } from './select.mjs';\nimport { useTree } from './tree.mjs';\nimport CacheOptions from './cache-options.mjs';\nimport _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';\nconst _sfc_main = defineComponent({\n name: \"ElTreeSelect\",\n inheritAttrs: false,\n props: {\n ...ElSelect.props,\n ...ElTree.props,\n cacheData: {\n type: Array,\n default: () => []\n }\n },\n setup(props, context) {\n const {\n slots,\n expose\n } = context;\n const select = ref();\n const tree = ref();\n const key = computed(() => props.nodeKey || props.valueKey || \"value\");\n const selectProps = useSelect(props, context, {\n select,\n tree,\n key\n });\n const {\n cacheOptions,\n ...treeProps\n } = useTree(props, context, {\n select,\n tree,\n key\n });\n const methods = reactive({});\n expose(methods);\n onMounted(() => {\n Object.assign(methods, {\n ...pick(tree.value, [\"filter\", \"updateKeyChildren\", \"getCheckedNodes\", \"setCheckedNodes\", \"getCheckedKeys\", \"setCheckedKeys\", \"setChecked\", \"getHalfCheckedNodes\", \"getHalfCheckedKeys\", \"getCurrentKey\", \"getCurrentNode\", \"setCurrentKey\", \"setCurrentNode\", \"getNode\", \"remove\", \"append\", \"insertBefore\", \"insertAfter\"]),\n ...pick(select.value, [\"focus\", \"blur\", \"selectedLabel\"])\n });\n });\n return () => h(ElSelect, reactive({\n ...selectProps,\n ref: ref2 => select.value = ref2\n }), {\n ...slots,\n default: () => [h(CacheOptions, {\n data: cacheOptions.value\n }), h(ElTree, reactive({\n ...treeProps,\n ref: ref2 => tree.value = ref2\n }))]\n });\n }\n});\nvar TreeSelect = /* @__PURE__ */_export_sfc(_sfc_main, [[\"__file\", \"tree-select.vue\"]]);\nexport { TreeSelect as default };","map":{"version":3,"names":["_sfc_main","defineComponent","name","inheritAttrs","props","ElSelect","ElTree","cacheData","type","Array","default","setup","context","slots","expose","select","ref","tree","key","computed","nodeKey","valueKey","selectProps","useSelect","cacheOptions","treeProps","useTree","methods","reactive","onMounted","Object","assign","pick","value","h","ref2","CacheOptions","data","TreeSelect","_export_sfc"],"sources":["../../../../../../packages/components/tree-select/src/tree-select.vue"],"sourcesContent":["<script lang=\"ts\">\n// @ts-nocheck\nimport { computed, defineComponent, h, onMounted, reactive, ref } from 'vue'\nimport { pick } from 'lodash-unified'\nimport ElSelect from '@element-plus/components/select'\nimport ElTree from '@element-plus/components/tree'\nimport { useSelect } from './select'\nimport { useTree } from './tree'\nimport CacheOptions from './cache-options'\n\nexport default defineComponent({\n name: 'ElTreeSelect',\n // disable `ElSelect` inherit current attrs\n inheritAttrs: false,\n props: {\n ...ElSelect.props,\n ...ElTree.props,\n /**\n * @description The cached data of the lazy node, the structure is the same as the data, used to get the label of the unloaded data\n */\n cacheData: {\n type: Array,\n default: () => [],\n },\n },\n setup(props, context) {\n const { slots, expose } = context\n\n const select = ref<InstanceType<typeof ElSelect>>()\n const tree = ref<InstanceType<typeof ElTree>>()\n\n const key = computed(() => props.nodeKey || props.valueKey || 'value')\n\n const selectProps = useSelect(props, context, { select, tree, key })\n const { cacheOptions, ...treeProps } = useTree(props, context, {\n select,\n tree,\n key,\n })\n\n // expose ElTree/ElSelect methods\n const methods = reactive({})\n expose(methods)\n onMounted(() => {\n Object.assign(methods, {\n