tree-select.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var vue = require('vue');
  4. var lodashUnified = require('lodash-unified');
  5. var index = require('../../select/index.js');
  6. var index$1 = require('../../tree/index.js');
  7. var select = require('./select.js');
  8. var tree = require('./tree.js');
  9. var cacheOptions = require('./cache-options.js');
  10. var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
  11. const _sfc_main = vue.defineComponent({
  12. name: "ElTreeSelect",
  13. inheritAttrs: false,
  14. props: {
  15. ...index.ElSelect.props,
  16. ...index$1.ElTree.props,
  17. cacheData: {
  18. type: Array,
  19. default: () => []
  20. }
  21. },
  22. setup(props, context) {
  23. const { slots, expose } = context;
  24. const select$1 = vue.ref();
  25. const tree$1 = vue.ref();
  26. const key = vue.computed(() => props.nodeKey || props.valueKey || "value");
  27. const selectProps = select.useSelect(props, context, { select: select$1, tree: tree$1, key });
  28. const { cacheOptions: cacheOptions$1, ...treeProps } = tree.useTree(props, context, {
  29. select: select$1,
  30. tree: tree$1,
  31. key
  32. });
  33. const methods = vue.reactive({});
  34. expose(methods);
  35. vue.onMounted(() => {
  36. Object.assign(methods, {
  37. ...lodashUnified.pick(tree$1.value, [
  38. "filter",
  39. "updateKeyChildren",
  40. "getCheckedNodes",
  41. "setCheckedNodes",
  42. "getCheckedKeys",
  43. "setCheckedKeys",
  44. "setChecked",
  45. "getHalfCheckedNodes",
  46. "getHalfCheckedKeys",
  47. "getCurrentKey",
  48. "getCurrentNode",
  49. "setCurrentKey",
  50. "setCurrentNode",
  51. "getNode",
  52. "remove",
  53. "append",
  54. "insertBefore",
  55. "insertAfter"
  56. ]),
  57. ...lodashUnified.pick(select$1.value, ["focus", "blur", "selectedLabel"])
  58. });
  59. });
  60. return () => vue.h(index.ElSelect, vue.reactive({
  61. ...selectProps,
  62. ref: (ref2) => select$1.value = ref2
  63. }), {
  64. ...slots,
  65. default: () => [
  66. vue.h(cacheOptions["default"], { data: cacheOptions$1.value }),
  67. vue.h(index$1.ElTree, vue.reactive({
  68. ...treeProps,
  69. ref: (ref2) => tree$1.value = ref2
  70. }))
  71. ]
  72. });
  73. }
  74. });
  75. var TreeSelect = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "tree-select.vue"]]);
  76. exports["default"] = TreeSelect;
  77. //# sourceMappingURL=tree-select.js.map