virtual-tree.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var runtime = require('../../../utils/vue/props/runtime.js');
  4. var typescript = require('../../../utils/typescript.js');
  5. var icon = require('../../../utils/vue/icon.js');
  6. var types = require('../../../utils/types.js');
  7. const ROOT_TREE_INJECTION_KEY = Symbol();
  8. const EMPTY_NODE = {
  9. key: -1,
  10. level: -1,
  11. data: {}
  12. };
  13. var TreeOptionsEnum = /* @__PURE__ */ ((TreeOptionsEnum2) => {
  14. TreeOptionsEnum2["KEY"] = "id";
  15. TreeOptionsEnum2["LABEL"] = "label";
  16. TreeOptionsEnum2["CHILDREN"] = "children";
  17. TreeOptionsEnum2["DISABLED"] = "disabled";
  18. TreeOptionsEnum2["CLASS"] = "";
  19. return TreeOptionsEnum2;
  20. })(TreeOptionsEnum || {});
  21. var SetOperationEnum = /* @__PURE__ */ ((SetOperationEnum2) => {
  22. SetOperationEnum2["ADD"] = "add";
  23. SetOperationEnum2["DELETE"] = "delete";
  24. return SetOperationEnum2;
  25. })(SetOperationEnum || {});
  26. const itemSize = {
  27. type: Number,
  28. default: 26
  29. };
  30. const treeProps = runtime.buildProps({
  31. data: {
  32. type: runtime.definePropType(Array),
  33. default: () => typescript.mutable([])
  34. },
  35. emptyText: {
  36. type: String
  37. },
  38. height: {
  39. type: Number,
  40. default: 200
  41. },
  42. props: {
  43. type: runtime.definePropType(Object),
  44. default: () => typescript.mutable({
  45. children: "children" /* CHILDREN */,
  46. label: "label" /* LABEL */,
  47. disabled: "disabled" /* DISABLED */,
  48. value: "id" /* KEY */,
  49. class: "" /* CLASS */
  50. })
  51. },
  52. highlightCurrent: Boolean,
  53. showCheckbox: Boolean,
  54. defaultCheckedKeys: {
  55. type: runtime.definePropType(Array),
  56. default: () => typescript.mutable([])
  57. },
  58. checkStrictly: Boolean,
  59. defaultExpandedKeys: {
  60. type: runtime.definePropType(Array),
  61. default: () => typescript.mutable([])
  62. },
  63. indent: {
  64. type: Number,
  65. default: 16
  66. },
  67. itemSize,
  68. icon: {
  69. type: icon.iconPropType
  70. },
  71. expandOnClickNode: {
  72. type: Boolean,
  73. default: true
  74. },
  75. checkOnClickNode: Boolean,
  76. checkOnClickLeaf: {
  77. type: Boolean,
  78. default: true
  79. },
  80. currentNodeKey: {
  81. type: runtime.definePropType([String, Number])
  82. },
  83. accordion: Boolean,
  84. filterMethod: {
  85. type: runtime.definePropType(Function)
  86. },
  87. perfMode: {
  88. type: Boolean,
  89. default: true
  90. },
  91. scrollbarAlwaysOn: Boolean
  92. });
  93. const treeNodeProps = runtime.buildProps({
  94. node: {
  95. type: runtime.definePropType(Object),
  96. default: () => typescript.mutable(EMPTY_NODE)
  97. },
  98. expanded: Boolean,
  99. checked: Boolean,
  100. indeterminate: Boolean,
  101. showCheckbox: Boolean,
  102. disabled: Boolean,
  103. current: Boolean,
  104. hiddenExpandIcon: Boolean,
  105. itemSize
  106. });
  107. const treeNodeContentProps = runtime.buildProps({
  108. node: {
  109. type: runtime.definePropType(Object),
  110. required: true
  111. }
  112. });
  113. const NODE_CLICK = "node-click";
  114. const NODE_DROP = "node-drop";
  115. const NODE_EXPAND = "node-expand";
  116. const NODE_COLLAPSE = "node-collapse";
  117. const CURRENT_CHANGE = "current-change";
  118. const NODE_CHECK = "check";
  119. const NODE_CHECK_CHANGE = "check-change";
  120. const NODE_CONTEXTMENU = "node-contextmenu";
  121. const treeEmits = {
  122. [NODE_CLICK]: (data, node, e) => data && node && e,
  123. [NODE_DROP]: (data, node, e) => data && node && e,
  124. [NODE_EXPAND]: (data, node) => data && node,
  125. [NODE_COLLAPSE]: (data, node) => data && node,
  126. [CURRENT_CHANGE]: (data, node) => data && node,
  127. [NODE_CHECK]: (data, checkedInfo) => data && checkedInfo,
  128. [NODE_CHECK_CHANGE]: (data, checked) => data && types.isBoolean(checked),
  129. [NODE_CONTEXTMENU]: (evt, data, node) => evt && data && node
  130. };
  131. const treeNodeEmits = {
  132. click: (node, e) => !!(node && e),
  133. drop: (node, e) => !!(node && e),
  134. toggle: (node) => !!node,
  135. check: (node, checked) => node && types.isBoolean(checked)
  136. };
  137. exports.CURRENT_CHANGE = CURRENT_CHANGE;
  138. exports.NODE_CHECK = NODE_CHECK;
  139. exports.NODE_CHECK_CHANGE = NODE_CHECK_CHANGE;
  140. exports.NODE_CLICK = NODE_CLICK;
  141. exports.NODE_COLLAPSE = NODE_COLLAPSE;
  142. exports.NODE_CONTEXTMENU = NODE_CONTEXTMENU;
  143. exports.NODE_DROP = NODE_DROP;
  144. exports.NODE_EXPAND = NODE_EXPAND;
  145. exports.ROOT_TREE_INJECTION_KEY = ROOT_TREE_INJECTION_KEY;
  146. exports.SetOperationEnum = SetOperationEnum;
  147. exports.TreeOptionsEnum = TreeOptionsEnum;
  148. exports.treeEmits = treeEmits;
  149. exports.treeNodeContentProps = treeNodeContentProps;
  150. exports.treeNodeEmits = treeNodeEmits;
  151. exports.treeNodeProps = treeNodeProps;
  152. exports.treeProps = treeProps;
  153. //# sourceMappingURL=virtual-tree.js.map