bkui-vue 0.0.2-beta.82 → 0.0.2-beta.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/dist/index.cjs.js +135 -161
  2. package/dist/index.esm.js +16449 -19088
  3. package/dist/index.umd.js +135 -161
  4. package/dist/style.css +1 -1
  5. package/dist/style.variable.css +1 -1
  6. package/lib/affix/index.js +321 -1
  7. package/lib/alert/index.js +214 -1
  8. package/lib/animate-number/index.js +155 -1
  9. package/lib/backtop/index.js +188 -1
  10. package/lib/badge/index.js +235 -1
  11. package/lib/breadcrumb/index.js +309 -1
  12. package/lib/button/index.js +321 -1
  13. package/lib/card/index.js +285 -1
  14. package/lib/cascader/index.js +2036 -2
  15. package/lib/checkbox/index.js +542 -1
  16. package/lib/code-diff/index.js +5501 -1
  17. package/lib/collapse/index.js +570 -1
  18. package/lib/collapse-transition/index.js +177 -1
  19. package/lib/color-picker/index.js +2665 -1
  20. package/lib/components.js +530 -1
  21. package/lib/config-provider/index.js +365 -1
  22. package/lib/container/index.js +391 -1
  23. package/lib/date-picker/index.js +5555 -1
  24. package/lib/dialog/index.js +975 -2
  25. package/lib/directives/index.js +1375 -2
  26. package/lib/dist.index.js +87 -1
  27. package/lib/divider/index.js +169 -1
  28. package/lib/dropdown/index.js +369 -1
  29. package/lib/exception/index.js +385 -1
  30. package/lib/fixed-navbar/index.js +154 -1
  31. package/lib/form/index.js +952 -1
  32. package/lib/hooks.js +73 -1
  33. package/lib/icon/angle-double-down-line.js +191 -1
  34. package/lib/icon/angle-double-left-line.js +191 -1
  35. package/lib/icon/angle-double-left.js +191 -1
  36. package/lib/icon/angle-double-right-line.js +191 -1
  37. package/lib/icon/angle-double-right.js +191 -1
  38. package/lib/icon/angle-double-up-line.js +191 -1
  39. package/lib/icon/angle-down-fill.js +191 -1
  40. package/lib/icon/angle-down-line.js +191 -1
  41. package/lib/icon/angle-down.js +191 -1
  42. package/lib/icon/angle-left.js +191 -1
  43. package/lib/icon/angle-right.js +191 -1
  44. package/lib/icon/angle-up-fill.js +191 -1
  45. package/lib/icon/angle-up.js +191 -1
  46. package/lib/icon/archive-fill.js +191 -1
  47. package/lib/icon/arrows-left.js +191 -1
  48. package/lib/icon/arrows-right.js +191 -1
  49. package/lib/icon/assistant.js +191 -1
  50. package/lib/icon/audio-fill.js +191 -1
  51. package/lib/icon/bk.js +191 -1
  52. package/lib/icon/circle.js +191 -1
  53. package/lib/icon/close-line.js +191 -1
  54. package/lib/icon/close.js +191 -1
  55. package/lib/icon/code.js +191 -1
  56. package/lib/icon/cog-shape.js +191 -1
  57. package/lib/icon/collapse-left.js +191 -1
  58. package/lib/icon/copy-shape.js +191 -1
  59. package/lib/icon/copy.js +191 -1
  60. package/lib/icon/data-shape.js +191 -1
  61. package/lib/icon/del.js +191 -1
  62. package/lib/icon/doc-fill.js +191 -1
  63. package/lib/icon/done.js +191 -1
  64. package/lib/icon/down-shape.js +191 -1
  65. package/lib/icon/down-small.js +191 -1
  66. package/lib/icon/edit-line.js +191 -1
  67. package/lib/icon/ellipsis.js +191 -1
  68. package/lib/icon/enlarge-line.js +191 -1
  69. package/lib/icon/error.js +191 -1
  70. package/lib/icon/excel-fill.js +191 -1
  71. package/lib/icon/exclamation-circle-shape.js +191 -1
  72. package/lib/icon/eye.js +191 -1
  73. package/lib/icon/filliscreen-line.js +191 -1
  74. package/lib/icon/fix-line.js +191 -1
  75. package/lib/icon/fix-shape.js +191 -1
  76. package/lib/icon/folder-open.js +191 -1
  77. package/lib/icon/folder-shape-open.js +191 -1
  78. package/lib/icon/folder-shape.js +191 -1
  79. package/lib/icon/folder.js +191 -1
  80. package/lib/icon/funnel.js +191 -1
  81. package/lib/icon/help-document-fill.js +191 -1
  82. package/lib/icon/help-fill.js +191 -1
  83. package/lib/icon/help.js +191 -1
  84. package/lib/icon/image-fill.js +276 -1
  85. package/lib/icon/img-error.js +276 -1
  86. package/lib/icon/img-placehoulder.js +276 -1
  87. package/lib/icon/index.js +2399 -1
  88. package/lib/icon/info-line.js +276 -1
  89. package/lib/icon/info.js +276 -1
  90. package/lib/icon/left-shape.js +276 -1
  91. package/lib/icon/left-turn-line.js +276 -1
  92. package/lib/icon/narrow-line.js +276 -1
  93. package/lib/icon/original.js +276 -1
  94. package/lib/icon/pdf-fill.js +276 -1
  95. package/lib/icon/play-shape.js +276 -1
  96. package/lib/icon/plus.js +276 -1
  97. package/lib/icon/ppt-fill.js +276 -1
  98. package/lib/icon/qq.js +276 -1
  99. package/lib/icon/right-shape.js +276 -1
  100. package/lib/icon/right-turn-line.js +276 -1
  101. package/lib/icon/search.js +276 -1
  102. package/lib/icon/share.js +276 -1
  103. package/lib/icon/spinner.js +276 -1
  104. package/lib/icon/success.js +276 -1
  105. package/lib/icon/switcher-loading.js +276 -1
  106. package/lib/icon/text-file.js +276 -1
  107. package/lib/icon/text-fill.js +276 -1
  108. package/lib/icon/transfer.js +276 -1
  109. package/lib/icon/tree-application-shape.js +276 -1
  110. package/lib/icon/unfull-screen.js +276 -1
  111. package/lib/icon/unvisible.js +276 -1
  112. package/lib/icon/up-shape.js +276 -1
  113. package/lib/icon/upload.js +276 -1
  114. package/lib/icon/video-fill.js +276 -1
  115. package/lib/icon/warn.js +276 -1
  116. package/lib/icon/weixin-pro.js +276 -1
  117. package/lib/icon/weixin.js +276 -1
  118. package/lib/image/index.js +641 -1
  119. package/lib/index.js +97 -1
  120. package/lib/info-box/index.js +1165 -2
  121. package/lib/input/index.js +1218 -2
  122. package/lib/link/index.js +160 -1
  123. package/lib/loading/index.js +381 -1
  124. package/lib/locale/index.js +465 -1
  125. package/lib/menu/index.js +724 -1
  126. package/lib/message/index.js +1795 -2
  127. package/lib/modal/index.js +396 -1
  128. package/lib/navigation/index.js +367 -1
  129. package/lib/notify/index.js +397 -1
  130. package/lib/overflow-title/index.js +461 -1
  131. package/lib/pagination/index.js +880 -1
  132. package/lib/plugin-popover/index.js +4089 -1
  133. package/lib/plugins/index.js +63 -1
  134. package/lib/pop-confirm/index.js +273 -1
  135. package/lib/popover/index.js +4097 -1
  136. package/lib/popover2/index.js +107 -1
  137. package/lib/preset.js +93 -1
  138. package/lib/process/index.js +759 -2
  139. package/lib/progress/index.js +431 -1
  140. package/lib/radio/index.js +627 -1
  141. package/lib/rate/index.js +338 -1
  142. package/lib/resize-layout/index.js +429 -1
  143. package/lib/search-select/index.js +2729 -2
  144. package/lib/search-select/search-select.css +1 -3
  145. package/lib/search-select/search-select.less +1 -3
  146. package/lib/search-select/search-select.variable.css +1 -3
  147. package/lib/select/index.js +2251 -2
  148. package/lib/shared/index.js +2873 -1
  149. package/lib/sideslider/index.js +714 -2
  150. package/lib/slider/index.js +1291 -2
  151. package/lib/steps/index.js +825 -2
  152. package/lib/swiper/index.js +336 -1
  153. package/lib/switcher/index.js +277 -1
  154. package/lib/tab/index.js +914 -1
  155. package/lib/table/index.js +6421 -1
  156. package/lib/table/plugins/use-column-resize.d.ts +1 -1
  157. package/lib/table-column/index.js +763 -1
  158. package/lib/tag/index.js +233 -1
  159. package/lib/tag-input/index.js +1660 -1
  160. package/lib/tag-input/tag-input.d.ts +2 -14
  161. package/lib/time-picker/index.js +71 -1
  162. package/lib/timeline/index.js +241 -1
  163. package/lib/transfer/index.js +673 -1
  164. package/lib/tree/index.js +2686 -1
  165. package/lib/upload/index.js +2874 -2
  166. package/lib/virtual-render/index.js +865 -1
  167. package/package.json +13 -2
  168. package/lib/cascader/index.js.LICENSE.txt +0 -1
  169. package/lib/dialog/index.js.LICENSE.txt +0 -1
  170. package/lib/directives/index.js.LICENSE.txt +0 -14
  171. package/lib/info-box/index.js.LICENSE.txt +0 -1
  172. package/lib/input/index.js.LICENSE.txt +0 -1
  173. package/lib/message/index.js.LICENSE.txt +0 -6
  174. package/lib/process/index.js.LICENSE.txt +0 -1
  175. package/lib/search-select/index.js.LICENSE.txt +0 -1
  176. package/lib/select/index.js.LICENSE.txt +0 -1
  177. package/lib/sideslider/index.js.LICENSE.txt +0 -1
  178. package/lib/slider/index.js.LICENSE.txt +0 -1
  179. package/lib/steps/index.js.LICENSE.txt +0 -1
  180. package/lib/upload/index.js.LICENSE.txt +0 -1
package/lib/tree/index.js CHANGED
@@ -1 +1,2686 @@
1
- import*as e from"../shared";import*as n from"vue";import*as t from"../config-provider";import*as r from"../virtual-render";import*as o from"vue-types";import*as i from"../exception";import*as a from"../checkbox";import*as l from"../icon";var c={8022:(e,n,t)=>{var r=t(4481),o=t(6426),i=o;i.v1=r,i.v4=o,e.exports=i},8725:e=>{for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")}},9157:e=>{var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var t=new Uint8Array(16);e.exports=function(){return n(t),t}}else{var r=new Array(16);e.exports=function(){for(var e,n=0;n<16;n++)0==(3&n)&&(e=4294967296*Math.random()),r[n]=e>>>((3&n)<<3)&255;return r}}},4481:(e,n,t)=>{var r,o,i=t(9157),a=t(8725),l=0,c=0;e.exports=function(e,n,t){var u=n&&t||0,d=n||[],s=(e=e||{}).node||r,f=void 0!==e.clockseq?e.clockseq:o;if(null==s||null==f){var p=i();null==s&&(s=r=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==f&&(f=o=16383&(p[6]<<8|p[7]))}var v=void 0!==e.msecs?e.msecs:(new Date).getTime(),y=void 0!==e.nsecs?e.nsecs:c+1,h=v-l+(y-c)/1e4;if(h<0&&void 0===e.clockseq&&(f=f+1&16383),(h<0||v>l)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");l=v,c=y,o=f;var N=(1e4*(268435455&(v+=122192928e5))+y)%4294967296;d[u++]=N>>>24&255,d[u++]=N>>>16&255,d[u++]=N>>>8&255,d[u++]=255&N;var _=v/4294967296*1e4&268435455;d[u++]=_>>>8&255,d[u++]=255&_,d[u++]=_>>>24&15|16,d[u++]=_>>>16&255,d[u++]=f>>>8|128,d[u++]=255&f;for(var E=0;E<6;++E)d[u+E]=s[E];return n||a(d)}},6426:(e,n,t)=>{var r=t(9157),o=t(8725);e.exports=function(e,n,t){var i=n&&t||0;"string"==typeof e&&(n="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||r)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,n)for(var l=0;l<16;++l)n[i+l]=a[l];return n||o(a)}}},u={};function d(e){var n=u[e];if(void 0!==n)return n.exports;var t=u[e]={exports:{}};return c[e](t,t.exports,d),t.exports}d.d=(e,n)=>{for(var t in n)d.o(n,t)&&!d.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},d.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n);var s={};(()=>{d.d(s,{Z:()=>$});const c=(u={PropTypes:()=>e.PropTypes,debounce:()=>e.debounce,resolveClassName:()=>e.resolveClassName,withInstall:()=>e.withInstall},f={},d.d(f,u),f);var u,f;const p=(e=>{var n={};return d.d(n,e),n})({computed:()=>n.computed,createVNode:()=>n.createVNode,defineComponent:()=>n.defineComponent,h:()=>n.h,nextTick:()=>n.nextTick,onMounted:()=>n.onMounted,onUnmounted:()=>n.onUnmounted,reactive:()=>n.reactive,ref:()=>n.ref,toRef:()=>n.toRef,watch:()=>n.watch}),v=(e=>{var n={};return d.d(n,e),n})({usePrefix:()=>t.usePrefix}),y=(e=>{var n={};return d.d(n,e),n})({default:()=>r.default});function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function N(e,n,t){return(n=function(e){var n=function(e,n){if("object"!==h(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!==h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===h(n)?n:String(n)}(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var _,E,S;!function(e){e.NODE_CLICK="nodeClick",e.NODE_COLLAPSE="nodeCollapse",e.NODE_EXPAND="nodeExpand",e.NODE_CHECKED="nodeChecked",e.NODE_DRAG_START="nodeDragStart",e.NODE_DRAG_OVER="nodeDragOver",e.NODE_DRAG_LEAVE="nodeDragLeave",e.NODE_DROP="nodeDrop"}(S||(S={}));var g,I=function(){return!0},T=(N(_={},S.NODE_CLICK,I),N(_,S.NODE_COLLAPSE,I),N(_,S.NODE_EXPAND,I),N(_,S.NODE_CHECKED,I),N(_,S.NODE_DRAG_START,I),N(_,S.NODE_DRAG_OVER,I),N(_,S.NODE_DRAG_LEAVE,I),N(_,S.NODE_DROP,I),_);!function(e){e.DEPTH="__depth",e.INDEX="__index",e.UUID="__uuid",e.PARENT="__parent",e.HAS_CHILD="__has_child",e.PATH="__path",e.IS_ROOT="__is_root",e.ORDER="__order",e.IS_OPEN="__is_open",e.IS_CHECKED="__is_checked",e.IS_SELECTED="__is_selected",e.IS_ASYNC_INIT="__is_async_init",e.IS_MATCH="__is_match",e.IS_NULL="__IS_NULL",e.IS_CACHED="__is_cached",e.IS_ASYNC="__is_async",e.IS_LOADING="__is_loading",e.TREE_NODE_ATTR="__attr__",e.IS_INDETERMINATE="__is_indeterminate"}(g||(g={}));var A,m=(N(E={},g.IS_OPEN,"isOpen"),N(E,g.IS_SELECTED,"selected"),N(E,g.IS_MATCH,"isMatch"),N(E,g.HAS_CHILD,"hasChild"),N(E,g.IS_CHECKED,"checked"),N(E,g.IS_ASYNC,"async"),N(E,g.IS_LOADING,"loading"),N(E,g.IS_ROOT,"isRoot"),E);!function(e){e.CLICK="click",e.SELECTED="selected",e.EXPAND="expand",e.COLLAPSE="collapse"}(A||(A={}));const C=(e=>{var n={};return d.d(n,e),n})({string:()=>o.string,toType:()=>o.toType});var P,D,O;!function(e){e.ONCE="once",e.EVERY="every"}(P||(P={})),function(e){e.FUZZY="fuzzy",e.FULL="full"}(D||(D={})),function(e){e.TREE="tree",e.LIST="list"}(O||(O={}));var b={data:c.PropTypes.arrayOf(c.PropTypes.any).def([]),label:c.PropTypes.oneOfType([c.PropTypes.func.def(void 0),c.PropTypes.string.def("label")]),nodeKey:c.PropTypes.string.def(void 0),children:c.PropTypes.string.def("children"),indent:c.PropTypes.number.def(18),lineHeight:c.PropTypes.number.def(32),height:c.PropTypes.number,levelLine:c.PropTypes.oneOfType([c.PropTypes.bool.def(!1),c.PropTypes.func.def(void 0),c.PropTypes.string.def("1px dashed #c3cdd7")]).def(!1),virtualRender:c.PropTypes.bool.def(!1),prefixIcon:c.PropTypes.oneOfType([c.PropTypes.func.def((function(){})),c.PropTypes.bool.def(!1)]).def(!0),async:c.PropTypes.shape({callback:c.PropTypes.func.def(void 0),cache:c.PropTypes.bool.def(!0),deepAutoOpen:(0,C.toType)("columnType",{}).def(P.ONCE)}),offsetLeft:c.PropTypes.number.def(5),search:c.PropTypes.oneOfType([c.PropTypes.shape({value:c.PropTypes.oneOfType([c.PropTypes.number,c.PropTypes.string,c.PropTypes.bool]).def(""),match:c.PropTypes.oneOfType([(0,C.string)(),c.PropTypes.func]).def(D.FUZZY),resultType:(0,C.string)().def(O.TREE),showChildNodes:c.PropTypes.bool.def(!0)}),c.PropTypes.string,c.PropTypes.number,c.PropTypes.bool]).def(void 0),emptyText:c.PropTypes.string.def("没有数据"),draggable:c.PropTypes.bool.def(!1),disableDrag:c.PropTypes.func,disableDrop:c.PropTypes.func,dragSort:c.PropTypes.bool.def(!1),selectable:c.PropTypes.oneOfType([c.PropTypes.bool,c.PropTypes.func]).def(!0),disabledFolderSelectable:c.PropTypes.bool.def(!1),showCheckbox:c.PropTypes.bool.def(!1),checked:c.PropTypes.arrayOf(c.PropTypes.any).def([]),showNodeTypeIcon:c.PropTypes.bool.def(!0),selected:c.PropTypes.oneOfType([c.PropTypes.string,c.PropTypes.number,c.PropTypes.object]).def([]),autoCheckChildren:c.PropTypes.bool.def(!0),autoOpenParentNode:c.PropTypes.bool.def(!0),expandAll:c.PropTypes.bool.def(!1),nodeContentAction:c.PropTypes.oneOfType([c.PropTypes.arrayOf((0,C.toType)("nodeContentActionType",{}).def(A.CLICK)),c.PropTypes.func.def((function(){return["selected"]}))]).def(["selected","expand","click"]),keepSlotData:c.PropTypes.bool.def(!1)};const L=(e=>{var n={};return d.d(n,e),n})({default:()=>i.default}),R=(e=>{var n={};return d.d(n,e),n})({default:()=>a.default}),x=(e=>{var n={};return d.d(n,e),n})({DownShape:()=>l.DownShape,Folder:()=>l.Folder,FolderShapeOpen:()=>l.FolderShapeOpen,RightShape:()=>l.RightShape,Spinner:()=>l.Spinner,TextFile:()=>l.TextFile}),k=function(e,n){var t=function(n){return e.schema.get(n)},r=function(e,n){var r;return null===(r=t(e))||void 0===r?void 0:r[n]},o=function(n,r,o,i){e.schema.has(n)?e.schema.set(n,Object.assign({},t(n),N({},r,o))):console.warn("node is not in schema, please check",i,n)},i=function(n){return e.data.find((function(e){return l(e)===n}))},a=function(e){return r(e,g.PATH)},l=function(e){return r(e,g.UUID)},c=function(e){return r(e,g.IS_OPEN)},u=function(e){return r(e,g.HAS_CHILD)},d=function(e){return r(e,g.IS_MATCH)},s=function(e){return r(e,g.IS_CHECKED)},f=function(e){return r(r(e,g.PARENT),g.UUID)},p=function(e){return r(e,g.PARENT)},v=function(n,t){var o=e.data.find((function(e){return l(e)===n}));return r(o,t)},y=function(e){return"string"==typeof e?v(e,g.IS_ROOT):r(e,g.IS_ROOT)},_=function(e){return"object"===h(e)?c(e):"string"==typeof e&&v(e,g.IS_OPEN)},E=function(e){var n;return N(n={},m[g.IS_LOADING],r(e,g.IS_LOADING)),N(n,m[g.HAS_CHILD],u(e)),N(n,m[g.IS_MATCH],d(e)),N(n,m[g.IS_CHECKED],s(e)),N(n,m[g.IS_OPEN],c(e)),N(n,m[g.IS_ROOT],y(e)),N(n,"fullPath",r(e,g.PATH)),N(n,"uuid",l(e)),N(n,"parent",r(e,g.PARENT)),N(n,"parentId",l(r(e,g.PARENT))),n};return{getSchemaVal:t,getNodeAttr:r,getNodeId:l,getNodeParentId:f,getParentNodeData:function(e){return y(e)?N({},n.children,n.data):p(e)},getNodePathById:function(n){var t=e.data.find((function(e){return l(e)===n}));return a(t)},getNodeAttrById:v,getNodeParentIdById:function(n){var t=e.data.find((function(e){return l(e)===n}));return f(t)},getParentNodeAttr:function(e,n){return r(r(e,g.PARENT),n)},getParentNode:p,setNodeAttr:o,setNodeAttrById:function(e,n,t){Array.isArray(e)?Array.prototype.forEach.call(e,(function(r){return o(i(r),n,t,e)})):o(i(e),n,t,e)},getNodePath:a,isRootNode:y,isNodeOpened:c,hasChildNode:u,isItemOpen:_,isNodeChecked:s,isNodeMatched:d,isNodeLoading:function(e){return r(e,g.IS_LOADING)},checkNodeIsOpen:function(e){return y(e)||_(e)||function(e){return _(r(e,g.PARENT))}(e)},getSourceNodeByPath:function(e,t){var r=e.split("-").reduce((function(e,t){var r=Number(t);return Array.isArray(e)?e[r]:e[n.children][r]}),n.data);return t&&Object.assign(r,N({},g.UUID,t)),r},getSourceNodeByUID:function(n){return e.data.find((function(e){return l(e)===n}))},isMatchedNode:function(e){return r(e,g.IS_MATCH)},resolveScopedSlotParam:E,setTreeNodeLoading:function(e,n){o(e,g.IS_LOADING,n)},extendNodeAttr:function(e){return Object.assign({},e,N({},g.TREE_NODE_ATTR,E(e)))},getChildNodes:function(e){var t;return null!==(t=e[n.children])&&void 0!==t?t:[]},extendNodeScopedData:function(e){return{data:e,attributes:E(e)}}}};function w(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var H="1px dashed #c3cdd7",U=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[],a=e[n];return"boolean"==typeof a?a?r:o:V(t,e,n,i)},V=function(e,n,t){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=n[t];if("string"==typeof i)return"object"===h(e)&&null!==e?(Object.prototype.hasOwnProperty.call(e,i)||console.error("cannot find node label with key ".concat(i)),e[i]):i;if("function"==typeof i){var a=i.apply(void 0,[e].concat(function(e){if(Array.isArray(e))return w(e)}(r=o)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||function(e,n){if(e){if("string"==typeof e)return w(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?w(e,n):void 0}}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()));return"string"==typeof a?a:void console.error("props label with function return value is not string, please check and return string")}},j=function(e,n){return V(e,n,"label")},M=function(e,n){return{"--level-line":U(n,"levelLine",e,H,null,["tree"]),"--lineHeight":"".concat(n.lineHeight,"px"),"--indent":"".concat(n.indent,"px"),"--offset-left":"".concat(n.offsetLeft,"px")}},K=function(e,n,t){var r,o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=null===(r=t.schema.get(e))||void 0===r?void 0:r[g.DEPTH];return o?Object.assign({"--depth":i},"function"==typeof n.levelLine?{"--level-line":U(n,"levelLine",e,H,null,["node"])}:{}):{}},G=function(e,n,t){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=n.get(e)||{};return{"is-root":o.__is_root,"bk-tree-node":!0,"is-open":o.__is_open,"is-virtual-render":t.virtualRender,"level-line":t.levelLine&&r}},F=function(e,n){var t=n.get(e)||{};return N({"is-checked":t.__is_checked,"is-selected":t.__is_selected,"node-folder":e.is_folder,"node-leaf":e.is_leaf},(0,c.resolveClassName)("node-row"),!0)},Y=function(e){return null==e?{__IS_NULL:!0}:e},B=function e(n,t,r){return Array.isArray(t)?t.some((function(t){return e(n,t,r)})):"string"==typeof t||"number"==typeof t?t===r:n===t};const X=function(e,n){var t=k(n,e),r=t.setNodeAttr,o=t.getNodePath,i=t.getNodeAttr,a=t.resolveScopedSlotParam,l=t.setTreeNodeLoading,c=function(n,t){if("object"===h(n)&&null!==n){r(t,g.IS_OPEN,!0);var i=Array.isArray(n)?n:[n];return function(e,n,t,r,o){!function(e,n,t,r){var o=e.split("-").reduce((function(e,n){var r=Number(n);return Array.isArray(e)?e[r]:e[t][r]}),n);Object.assign(o,r||{})}(e,n,t,N({},r,o))}(o(t),e.data,e.children,e.children,i),Promise.resolve(n)}return Promise.resolve(n)},u=function(n){var t=e.async||{},o=t.callback,u=void 0===o?null:o,d=t.cache,s=void 0===d||d;if("function"==typeof u&&i(n,g.IS_ASYNC)){if(r(n,g.IS_ASYNC_INIT,!0),!i(n,g.IS_CACHED)){r(n,g.IS_CACHED,s);var f=a(n),p=u(n,(function(e){return c(e,n)}),f);if("object"===h(p)&&null!==p)return l(n,!0),p instanceof Promise?Promise.resolve(p.then((function(e){return c(e,n)})).catch((function(e){return console.error("load remote data error:",e)})).finally((function(){l(n,!1),r(n,g.IS_CACHED,!0)}))):(c(p,n),l(n,!1),Promise.resolve(!0))}return Promise.resolve(!0)}return Promise.resolve(!0)};return{asyncNodeClick:u,deepAutoOpen:function e(){var t=n.data.filter((function(e){return i(e,g.IS_ASYNC)&&e[m[g.IS_OPEN]]&&!i(e,g.IS_ASYNC_INIT)}));t.length&&Promise.all(t.map((function(e){return u(e)}))).then((function(){e()})).catch((function(e){console.warn(e)}))}}},z=function(e,n,t,r,o){var i=e.selected,a=k(t,e),l=a.setNodeAttr,c=a.setNodeAttrById,u=a.getNodePath,d=a.getSchemaVal,s=a.getNodeAttr,f=a.getNodeId,y=a.getChildNodes,_=a.isRootNode,E=a.hasChildNode,I=a.isItemOpen,T=a.isNodeOpened,A=a.isNodeLoading,m=a.isNodeChecked,C=a.getParentNode,P=a.resolveScopedSlotParam,D=a.extendNodeAttr,O=a.extendNodeScopedData,b=(0,v.usePrefix)().resolveClassName,L=o.registerNextLoop,w=X(e,t),H=w.asyncNodeClick,U=w.deepAutoOpen,V=function(e){if("string"==typeof e)return e;if("object"===h(e)&&null!==e){if(e.__v_isVNode)return e;var n=e.node,t=e.className,r=e.text,o=e.style;return(0,p.h)(n,{class:t,style:o},r)}return null},M=function(t){if(n.slots.nodeAction)return n.slots.nodeAction(ae(t));var r=null;return A(t)?function(e){var t,r,o;return(null!==(o=null===(r=(t=n.slots).nodeLoading)||void 0===r?void 0:r.call(t,ae(e)))&&void 0!==o?o:A(e))?(0,p.createVNode)(x.Spinner,null,null):""}(t):"function"==typeof e.prefixIcon&&"default"!==(r=e.prefixIcon(ae(t),"node_action"))?V(r):("default"===r||"boolean"==typeof e.prefixIcon&&e.prefixIcon)&&(E(t)||t.async||!e.autoCheckChildren)?I(t)?(0,p.createVNode)(x.DownShape,{class:b("node-prefix")},null):(0,p.createVNode)(x.RightShape,{class:b("node-prefix")},null):null},B=function(t){if(!e.showNodeTypeIcon)return null;if(n.slots.nodeType)return n.slots.nodeType(ae(t));var r=null;return"function"==typeof e.prefixIcon&&"default"!==(r=e.prefixIcon(ae(t),"node_type"))?V(r):"default"===r||"boolean"==typeof e.prefixIcon&&e.prefixIcon?_(t)||E(t)?function(e){return I(e)?(0,p.createVNode)(x.FolderShapeOpen,{class:[b("tree-icon"),b("node-prefix")]},null):(0,p.createVNode)(x.Folder,{class:[b("tree-icon"),b("node-prefix")]},null)}(t):(0,p.createVNode)(x.TextFile,{class:[b("tree-icon"),b("node-prefix")]},null):null},z=function e(n,t){var r=C(n);if(r){var o=t||(y(r)||[]).some((function(e){return m(e)}));l(r,g.IS_CHECKED,o),l(r,g.IS_INDETERMINATE,(y(r)||[]).some((function(e){return!m(e)}))),_(r)||e(r,t)}},Z=function e(n,t,r){y(n).forEach((function(n){Array.isArray(t)?t.forEach((function(e,t){l(n,e,r[t])})):l(n,t,r),e(n,t,r)}))},J=function(e,r){l(e,g.IS_CHECKED,!!r),Z(e,[g.IS_CHECKED,g.IS_INDETERMINATE],[!!r,!1]),z(e,r),n.emit(S.NODE_CHECKED,t.data.filter((function(e){return m(e)})),t.data.filter((function(e){return q(e)})))},q=function(e){return m(e)&&s(e,g.IS_INDETERMINATE)},$=function(n){return e.showCheckbox?(0,p.createVNode)(R.default,{size:"small",modelValue:m(n),indeterminate:q(n),onChange:function(e){return J(n,!!e)}},null):null},W=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=null===t?!I(e):!!t;if(i||Z(e,g.IS_OPEN,i),l(e,g.IS_OPEN,i),o){var a=I(e)?S.NODE_EXPAND:S.NODE_COLLAPSE;n.emit(a,e,P(e),d(e),r)}},Q=function(e,n,t){Array.isArray(e)?e.forEach((function(e){return l(Y(e),n,t)})):l(Y(e),n,t)},ee=function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];ne(e,g.IS_OPEN,n,t&&n)},ne=function e(n,t,r){var o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=Y(n);if(!i[g.IS_NULL]){var a=Array.isArray(t)?t:[t],l=Array.isArray(r)?r:[r];if(o){if(a.forEach((function(e,n){return Q(i,e,l[n])})),!_(i)){var c=C(i);a.forEach((function(n,t){s(c,n)!==r&&e(c,n,l[t],o)}))}}else a.forEach((function(e,n){return Q(i,e,l[n])}))}},te=function(e,n){I(e)?W(e,!1,n):H(e).finally((function(){s(e,g.IS_LOADING)?L("setNodeOpenedAfterLoading",{type:"once",fn:function(){return W(e,!0,n)}}):W(e,!0,n)}))},re=function n(r){var o,a=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],u=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],d=Array.isArray(r)?r:[r];if(d.length){var v=Y(d[0]);"string"!=typeof v&&"number"!=typeof v&&"symbol"!==h(v)||(v=null!==(o=t.data.find((function(e){return f(e)===v})))&&void 0!==o?o:N({},g.IS_NULL,!0)),v[g.IS_NULL]||(!e.selectable||"function"==typeof e.selectable&&!e.selectable(r)||e.disabledFolderSelectable&&!0===v.is_folder?console.warn("props.selectable is false or undefined, please set selectable with true"):(null!=i&&c(i,g.IS_SELECTED,!a),e.selected&&e.selected!==i&&c(e.selected,g.IS_SELECTED,!a),l(v,g.IS_SELECTED,a),i=f(v),u&&1===d.length&&ee(v,!0,!0),s(v,g.IS_ASYNC)&&H(v).then((function(){(0,p.nextTick)((function(){d.shift(),n(d,a,u)}))}))))}},oe=function(n){if(!e.levelLine)return null;var r=s(n,g.DEPTH)+1;return new Array(r).fill("").map((function(e,n){return n})).filter((function(e){return function(e,n){if(_(n))return!1;var r=u(n),o="".concat(r).split("-").slice(0,e+1);if(o.join("-")===r)return!0;var i=o.pop(),a=parseInt(i,10);o.push("".concat(a+1));var l=o.join("-");return t.data.some((function(e){return u(e)===l}))}(e,n)})).filter((function(e){return e>0})).map((function(e){return(0,p.createVNode)("span",{class:"node-virtual-line",style:(n=r-e,{"--depth":n})},null);var n}))},ie=function(t){var r,o,i,a;return n.slots.node?null===(o=(r=n.slots).node)||void 0===o?void 0:o.call(r,ae(t)):n.slots.default?null===(a=(i=n.slots).default)||void 0===a?void 0:a.call(i,O(t)):[j(t,e)]},ae=function(n){return e.keepSlotData?O(n):D(n)};return{renderTreeNode:function(r){var o,i,a=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return(0,p.createVNode)("div",{"data-tree-node":f(r),key:f(r),class:F(r,t.schema)},[(0,p.createVNode)("div",{class:G(r,t.schema,e,a),style:K(r,e,t,a),onClick:function(t){return function(t,r){var o,i=(o=t,"function"==typeof e.nodeContentAction?Reflect.apply(e.nodeContentAction,void 0,[{node:o}]):"string"==typeof e.nodeContentAction?[e.nodeContentAction]:Array.isArray(e.nodeContentAction)?e.nodeContentAction:["selected","expand","click"]);if(i.includes("selected")&&re(t,!0,!1),i.includes("expand")&&(T(t)||te(t,r)),i.includes("collapse")&&T(t)&&te(t,r),i.includes("click")){var a=S.NODE_CLICK;n.emit(a,t,P(t),d(t),r)}}(r,t)}},[(0,p.createVNode)("div",{class:[b("node-action")],onClick:function(e){return function(e,n){e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),te(n,e)}(e,r)}},[M(r)]),(0,p.createVNode)("div",{class:b("node-content")},[[$(r),B(r)],(0,p.createVNode)("span",{class:b("node-text")},[ie(r)]),null===(i=(o=n.slots).nodeAppend)||void 0===i?void 0:i.call(o,ae(r))]),a&&oe(r)])])},handleTreeNodeClick:te,deepAutoOpen:U,asyncNodeClick:H,setNodeAction:Q,setNodeOpened:W,setSelect:re,setOpen:ee,setNodeAttribute:ne}};var Z=d(8022),J=void 0;const q=(0,p.defineComponent)({name:"Tree",props:b,emits:T,setup:function(e,n){var t=function(e){var n,t=function(){var n,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=e.data,i=e.children,a=[],l=[],c=0,u=new WeakMap;function d(e,n,t,r){if(null!=e&&u.has(e)){var o=u.get(e);Object.prototype.hasOwnProperty.call(o,n)&&"function"==typeof r&&Reflect.apply(r,self,[o,n,t,e])&&(Object.assign(o,N({},n,t)),d(o[g.PARENT],n,t,r))}}function s(n){var t=null;return"string"==typeof e.nodeKey&&(t=n[e.nodeKey]||(0,Z.v4)()),t||n[g.UUID]||(0,Z.v4)()}var f=(N(n={},g.IS_OPEN,(function(){return!!e.expandAll})),N(n,g.IS_CHECKED,(function(){return!1})),N(n,g.IS_MATCH,(function(){return!1})),N(n,g.IS_SELECTED,(function(n,t){return B(n,e.selected,t)})),N(n,g.IS_CACHED,(function(){return!1})),N(n,g.IS_ASYNC,(function(){return null})),N(n,g.IS_LOADING,(function(){return!1})),n);function p(e,n,t){var o,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,a=i;void 0===i&&"function"==typeof f[t]&&(a=f[t](n,e));var l=m[t];if(Object.prototype.hasOwnProperty.call(n,l))return n[l];var c=null!==(o=null==r?void 0:r.get(n))&&void 0!==o?o:void 0,u=void 0;return c&&(u=c[t]),null==u&&(u=a),u}function v(n,t){if(!e.selectable)return!1;var r=B(t,e.selected,n);return p(n,t,g.IS_SELECTED,r)}function y(e,n,t){var r,o=p(e,n,g.IS_OPEN),i=!u.has(t)||(null===(r=u.get(t))||void 0===r?void 0:r[g.IS_OPEN]);return o&&i}function _(n,t){if(!e.showCheckbox)return!1;var r=B(n,e.checked,t);return p(t,n,g.IS_CHECKED,r)}function E(e){var n;return!(null!==(n=null==e?void 0:e[g.IS_OPEN])&&void 0!==n&&n)}function S(n,t,r,o){return n[g.IS_INDETERMINATE]=(o[e.children]||[]).some((function(e){var n,t;return!(null!==(t=null===(n=u.get(e))||void 0===n?void 0:n[g.IS_CHECKED])&&void 0!==t&&t)})),!0}return function n(t){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,S=t.length,I=0;I<S;I++){var T=t[I];if(Array.isArray(T))n(T,r,o,f);else if("object"===h(T)&&null!==T){var A,m=null!==f?"".concat(f,"-").concat(I):"".concat(I),C="".concat(s(T)),P=!!(T[i]||[]).length,D=p(C,T,g.IS_OPEN);e.autoOpenParentNode?D&&d(o,g.IS_OPEN,!0,E):D=y(C,T,o);var O=_(T,C);O&&a.push(T),u.set(T,(N(A={},g.DEPTH,r),N(A,g.INDEX,I),N(A,g.UUID,C),N(A,g.PARENT,o),N(A,g.HAS_CHILD,P),N(A,g.PATH,m),N(A,g.IS_ROOT,null===o),N(A,g.ORDER,c),N(A,g.IS_SELECTED,v(C,T)),N(A,g.IS_MATCH,p(C,T,g.IS_MATCH)),N(A,g.IS_OPEN,D),N(A,g.IS_CHECKED,O),N(A,g.IS_CACHED,p(C,T,g.IS_CACHED)),N(A,g.IS_ASYNC,p(C,T,g.IS_ASYNC)),N(A,g.IS_LOADING,p(C,T,g.IS_LOADING)),N(A,g.IS_INDETERMINATE,!1),A)),c+=1,l.push(T),Object.prototype.hasOwnProperty.call(T,i)&&n(T[i]||[],r+1,T,m)}}}(null!=t?t:o),e.showCheckbox&&(null==a||a.forEach((function(e){d(e,g.IS_CHECKED,!0,S)}))),[l,u]},r=t(),o=new Map,i=[],a=[],l=(0,p.reactive)({data:r[0],schema:r[1],levelLineSchema:{}}),c=X(e,l),u=c.asyncNodeClick,d=c.deepAutoOpen,s=function(e,n){(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&o.has(e)&&o.delete(e),o.set(e,n)},f=function(e){var n,t=function(e){return"function"==typeof e?{type:"loop",fn:e}:"object"===h(e)&&"string"==typeof e.type&&"function"==typeof e.fn?e:(console.error("loop event error",e),null)}(e);return null!==t&&Reflect.apply(t.fn,J,[]),null!==(n=null==t?void 0:t.type)&&void 0!==n?n:"once"};return(0,p.watch)((function(){return[e.data]}),(function(n){var r,i,a=t(n,l.schema);l.data=a[0],l.schema=a[1],(null===(r=e.async)||void 0===r?void 0:r.callback)&&"every"===(null===(i=e.async)||void 0===i?void 0:i.deepAutoOpen)&&d(),Array.from(o.keys()).forEach((function(e){var n=o.get(e);if(Array.isArray(n)){var t=[];n.forEach((function(e,n){"once"===f(e)&&t.unshift(n)})),t.length&&t.forEach((function(e){return n.splice(e,1)})),0===n.length&&o.delete(e)}else"once"===f(n)&&o.delete(e)}))}),{deep:!0}),e.selectable&&(0,p.onMounted)((function(){(0,p.watch)((function(){return e.selected}),(function(e){a.length=0,i.forEach((function(n){Reflect.apply(n,J,[e]),a.push((function(){return Reflect.apply(n,J,[e])}))})),s("afterSelectWatch",a)}),{immediate:!0})})),(null===(n=e.async)||void 0===n?void 0:n.callback)&&d(),{flatData:l,asyncNodeClick:u,deepAutoOpen:d,afterDataUpdate:function(e){s("afterDataUpdate",e)},registerNextLoop:s,onSelected:function(e){i.push(e)}}}(e),r=t.flatData,o=t.onSelected,i=t.registerNextLoop,a=k(r,e),l=a.checkNodeIsOpen,u=a.isRootNode,d=a.isNodeOpened,s=a.isNodeChecked,f=a.isNodeMatched,_=a.hasChildNode,E=a.getNodePath,I=function(e){var n,t=(0,p.toRef)(e,"search"),r=null!==(n=e.search)&&void 0!==n?n:{},o=r.resultType,i=void 0===o?"tree":o,a=r.showChildNodes,l=void 0===a||a,c=function(e){return["string","number","boolean"].includes(h(e))},u=function(e,n){return e===n},d=function(e,n){return new RegExp("".concat(e),"i").test("".concat(n))},s=function(e,n){return Reflect.apply(e,void 0,n)},f=void 0===t.value||!1===t.value,v=(0,p.computed)((function(){if(!1===t.value)return!1;if(c(t.value))return"".concat(t.value).length>0;var e=t.value.value;return"".concat(void 0===e?"":e).length>0})),y=(0,p.computed)((function(){return"tree"===i}));return{searchFn:function(e,n){if(f)return!0;if(c(t.value))return 0!=="".concat(t.value).length&&s(d,[t.value,e,n]);var r=t.value,o=r.value,i=void 0===o?"":o,a=r.match,l=void 0===a?"fuzzy":a,p="function"==typeof l?l:"fuzzy"===l?d:u;return 0!=="".concat(i).length&&s(p,[i,e,n])},refSearch:t,isSearchActive:v,isSearchDisabled:f,resultType:i,isTreeUI:y,showChildNodes:l}}(e),T=I.searchFn,A=I.isSearchActive,C=I.refSearch,P=I.isSearchDisabled,D=I.isTreeUI,O=I.showChildNodes,b=(0,p.reactive)([]),R=(0,p.computed)((function(){return r.data.filter((function(e){return function(e){return A.value?O?l(e)&&(f(e)||b.some((function(n){var t;return 0===(null!==(t=E(e))&&void 0!==t?t:"").indexOf(n)}))):l(e)&&f(e):l(e)}(e)}))})),x=z(e,n,r,0,{registerNextLoop:i}),w=x.renderTreeNode,H=x.handleTreeNodeClick,U=x.setNodeOpened,V=x.setOpen,K=x.setNodeAction,G=x.setSelect,F=x.asyncNodeClick,q=x.setNodeAttribute,$=(0,c.debounce)(120,(function(){b.length=0,r.data.forEach((function(n){var t=T(j(n,e),n);t&&b.push(E(n)),q(n,[g.IS_MATCH],[t],D.value&&t)}))}));P||(0,p.watch)([C],(function(){$()}),{deep:!0,immediate:!0});var W=(0,p.ref)();o((function(n){G(n,!0,e.autoOpenParentNode)})),n.expose({handleTreeNodeClick:H,isNodeChecked:s,isRootNode:u,isNodeOpened:d,isNodeMatched:f,hasChildNode:_,setOpen:V,setChecked:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];K(Y(e),g.IS_CHECKED,n)},setNodeAction:K,setNodeOpened:U,setSelect:G,asyncNodeClick:F,getData:function(){return r}});var Q=function(e,n){var t=n.slots;return{renderEmpty:function(n){var r,o;return(0,p.createVNode)(L.default,{scene:"part",type:n},{default:function(){return[null!==(o=null===(r=t.default)||void 0===r?void 0:r.call(t))&&void 0!==o?o:e.emptyText]}})}}}(e,n),ee=Q.renderEmpty;!function(e,n,t,r){var o=k(r,e),i=o.getSourceNodeByUID,a=o.getParentNodeData,l=o.getNodeParentIdById,c=o.extendNodeAttr,u=o.getNodeAttrById,d=o.getNodePathById,s=o.isRootNode,f=(0,v.usePrefix)().resolveClassName,y=(0,p.computed)((function(){return"function"==typeof e.disableDrag})),h=(0,p.computed)((function(){return"function"==typeof e.disableDrop})),N="",_=function(e){return e.target.closest("[data-tree-node]")},E=function(e){var n,t=null===(n=null==e?void 0:e.dataset)||void 0===n?void 0:n.treeNode;return i(t)},I=function e(n){_(n).removeEventListener("mouseup",e)},T=function(n){var t=_(n),r=E(t);!1===r.draggable||y.value&&e.disableDrag(r)?t.classList.add("".concat(f("tree-drag-disabled"))):(t.setAttribute("draggable","true"),t.addEventListener("mouseup",I))},A=function(t){t.preventDefault();var r=_(t),o=c(E(r));if(n.emit(S.NODE_DRAG_OVER,t,r,o),h.value&&(null==e?void 0:e.disableDrop(o)))return t.dataTransfer.effectAllowed="move",t.dataTransfer.dropEffect="none",void r.classList.add("".concat(f("tree-drop-disabled")));r.classList.add("".concat(f("tree-drop-active")));var i=t.dataTransfer.getData("node-id");i=N;var a=r.getAttribute("data-tree-node"),l=P(i,a)?"move":"none";t.dataTransfer.effectAllowed=l,t.dataTransfer.dropEffect=l},m=function(e){e.dataTransfer.effectAllowed="move",e.dataTransfer.dropEffect="move";var t=_(e);e.dataTransfer.setData("text/plain","");var r=t.getAttribute("data-tree-node");N=r,e.dataTransfer.setData("node-id",r),n.emit(S.NODE_DRAG_START,e,t)},C=function(t){t.preventDefault(),t.stopPropagation();var r=_(t);r.classList.remove("".concat(f("tree-drop-active")),"".concat(f("tree-drop-disabled")));var o=c(E(r));if(!h.value||!e.disableDrop(o)){var i=N,a=r.getAttribute("data-tree-node");Reflect.apply(e.dragSort?D:O,void 0,[i,a]),n.emit(S.NODE_DROP,t,r,o)}},P=function(e,n){var t=d(e),r=d(n);return l(e)===l(n)||-1===t.indexOf(r)&&-1===r.indexOf(t)},D=function(n,t){if(P(n,t)){var r=JSON.parse(JSON.stringify(i(n))),o=JSON.parse(JSON.stringify(i(t))),l=a(n),c=a(t),d=u(n,g.INDEX),s=u(t,g.INDEX);null==l||l[e.children].splice(d,1,o),null==c||c[e.children].splice(s,1,r)}},O=function(n,t){var r=i(n),o=i(t),a=null;if(s(n))a=e.data;else{var c=l(n);if(null!=c){a=i(c);var d=u(n,g.INDEX);null==a||a[e.children].splice(d,1)}}o[e.children]||(o[e.children]=[]),o[e.children].unshift(r)},b=function(e){e.preventDefault();var t=_(e);t.classList.remove("".concat(f("tree-drop-active")),"".concat(f("tree-drop-disabled"))),n.emit(S.NODE_DRAG_LEAVE,e,t)};(0,p.onMounted)((function(){if(e.draggable&&t.value){var n=t.value.$el;n.addEventListener("mousedown",T),n.addEventListener("dragstart",m),n.addEventListener("dragover",A),n.addEventListener("dragleave",b),n.addEventListener("drop",C)}})),(0,p.onUnmounted)((function(){if(e.draggable&&t.value){var n=t.value.$el;n.removeEventListener("mousedown",T),n.removeEventListener("dragstart",m),n.removeEventListener("dragover",A),n.removeEventListener("dragleave",b),n.removeEventListener("drop",C)}}))}(e,n,W,r);var ne=(0,v.usePrefix)().resolveClassName;return function(){return(0,p.createVNode)(y.default,{class:ne("tree"),style:M(null,e),list:R.value,lineHeight:e.lineHeight,height:e.height,enabled:e.virtualRender,rowKey:g.UUID,keepAlive:!0,contentClassName:ne("container"),throttleDelay:0,ref:W},{default:function(e){return function(e){var t,r,o;if(e.length)return e.map((function(e){return w(e,!A.value||D.value)}));var i=A.value?"search-empty":"empty";return null!==(o=null===(r=(t=n.slots).empty)||void 0===r?void 0:r.call(t))&&void 0!==o?o:ee(i)}(e.data||[])}})}}}),$=(0,c.withInstall)(q)})();var f=s.Z;export{f as default};
1
+ import * as __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__ from "../shared";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "vue";
3
+ import * as __WEBPACK_EXTERNAL_MODULE__config_provider_9d0186d9__ from "../config-provider";
4
+ import * as __WEBPACK_EXTERNAL_MODULE__virtual_render_2d1a77c9__ from "../virtual-render";
5
+ import * as __WEBPACK_EXTERNAL_MODULE_vue_types_22de060a__ from "vue-types";
6
+ import * as __WEBPACK_EXTERNAL_MODULE__exception_12c197e0__ from "../exception";
7
+ import * as __WEBPACK_EXTERNAL_MODULE__checkbox_a57bcb84__ from "../checkbox";
8
+ import * as __WEBPACK_EXTERNAL_MODULE__icon_85385c3e__ from "../icon";
9
+ /******/ var __webpack_modules__ = ({
10
+
11
+ /***/ 8022:
12
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
13
+
14
+ var v1 = __webpack_require__(4481);
15
+ var v4 = __webpack_require__(6426);
16
+
17
+ var uuid = v4;
18
+ uuid.v1 = v1;
19
+ uuid.v4 = v4;
20
+
21
+ module.exports = uuid;
22
+
23
+
24
+ /***/ }),
25
+
26
+ /***/ 8725:
27
+ /***/ ((module) => {
28
+
29
+ /**
30
+ * Convert array of 16 byte values to UUID string format of the form:
31
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
32
+ */
33
+ var byteToHex = [];
34
+ for (var i = 0; i < 256; ++i) {
35
+ byteToHex[i] = (i + 0x100).toString(16).substr(1);
36
+ }
37
+
38
+ function bytesToUuid(buf, offset) {
39
+ var i = offset || 0;
40
+ var bth = byteToHex;
41
+ // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
42
+ return ([
43
+ bth[buf[i++]], bth[buf[i++]],
44
+ bth[buf[i++]], bth[buf[i++]], '-',
45
+ bth[buf[i++]], bth[buf[i++]], '-',
46
+ bth[buf[i++]], bth[buf[i++]], '-',
47
+ bth[buf[i++]], bth[buf[i++]], '-',
48
+ bth[buf[i++]], bth[buf[i++]],
49
+ bth[buf[i++]], bth[buf[i++]],
50
+ bth[buf[i++]], bth[buf[i++]]
51
+ ]).join('');
52
+ }
53
+
54
+ module.exports = bytesToUuid;
55
+
56
+
57
+ /***/ }),
58
+
59
+ /***/ 9157:
60
+ /***/ ((module) => {
61
+
62
+ // Unique ID creation requires a high quality random # generator. In the
63
+ // browser this is a little complicated due to unknown quality of Math.random()
64
+ // and inconsistent support for the `crypto` API. We do the best we can via
65
+ // feature-detection
66
+
67
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto
68
+ // implementation. Also, find the complete implementation of crypto on IE11.
69
+ var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
70
+ (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
71
+
72
+ if (getRandomValues) {
73
+ // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
74
+ var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
75
+
76
+ module.exports = function whatwgRNG() {
77
+ getRandomValues(rnds8);
78
+ return rnds8;
79
+ };
80
+ } else {
81
+ // Math.random()-based (RNG)
82
+ //
83
+ // If all else fails, use Math.random(). It's fast, but is of unspecified
84
+ // quality.
85
+ var rnds = new Array(16);
86
+
87
+ module.exports = function mathRNG() {
88
+ for (var i = 0, r; i < 16; i++) {
89
+ if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
90
+ rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
91
+ }
92
+
93
+ return rnds;
94
+ };
95
+ }
96
+
97
+
98
+ /***/ }),
99
+
100
+ /***/ 4481:
101
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
102
+
103
+ var rng = __webpack_require__(9157);
104
+ var bytesToUuid = __webpack_require__(8725);
105
+
106
+ // **`v1()` - Generate time-based UUID**
107
+ //
108
+ // Inspired by https://github.com/LiosK/UUID.js
109
+ // and http://docs.python.org/library/uuid.html
110
+
111
+ var _nodeId;
112
+ var _clockseq;
113
+
114
+ // Previous uuid creation time
115
+ var _lastMSecs = 0;
116
+ var _lastNSecs = 0;
117
+
118
+ // See https://github.com/uuidjs/uuid for API details
119
+ function v1(options, buf, offset) {
120
+ var i = buf && offset || 0;
121
+ var b = buf || [];
122
+
123
+ options = options || {};
124
+ var node = options.node || _nodeId;
125
+ var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
126
+
127
+ // node and clockseq need to be initialized to random values if they're not
128
+ // specified. We do this lazily to minimize issues related to insufficient
129
+ // system entropy. See #189
130
+ if (node == null || clockseq == null) {
131
+ var seedBytes = rng();
132
+ if (node == null) {
133
+ // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
134
+ node = _nodeId = [
135
+ seedBytes[0] | 0x01,
136
+ seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]
137
+ ];
138
+ }
139
+ if (clockseq == null) {
140
+ // Per 4.2.2, randomize (14 bit) clockseq
141
+ clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
142
+ }
143
+ }
144
+
145
+ // UUID timestamps are 100 nano-second units since the Gregorian epoch,
146
+ // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
147
+ // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
148
+ // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
149
+ var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
150
+
151
+ // Per 4.2.1.2, use count of uuid's generated during the current clock
152
+ // cycle to simulate higher resolution clock
153
+ var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
154
+
155
+ // Time since last uuid creation (in msecs)
156
+ var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
157
+
158
+ // Per 4.2.1.2, Bump clockseq on clock regression
159
+ if (dt < 0 && options.clockseq === undefined) {
160
+ clockseq = clockseq + 1 & 0x3fff;
161
+ }
162
+
163
+ // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
164
+ // time interval
165
+ if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
166
+ nsecs = 0;
167
+ }
168
+
169
+ // Per 4.2.1.2 Throw error if too many uuids are requested
170
+ if (nsecs >= 10000) {
171
+ throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
172
+ }
173
+
174
+ _lastMSecs = msecs;
175
+ _lastNSecs = nsecs;
176
+ _clockseq = clockseq;
177
+
178
+ // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
179
+ msecs += 12219292800000;
180
+
181
+ // `time_low`
182
+ var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
183
+ b[i++] = tl >>> 24 & 0xff;
184
+ b[i++] = tl >>> 16 & 0xff;
185
+ b[i++] = tl >>> 8 & 0xff;
186
+ b[i++] = tl & 0xff;
187
+
188
+ // `time_mid`
189
+ var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
190
+ b[i++] = tmh >>> 8 & 0xff;
191
+ b[i++] = tmh & 0xff;
192
+
193
+ // `time_high_and_version`
194
+ b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
195
+ b[i++] = tmh >>> 16 & 0xff;
196
+
197
+ // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
198
+ b[i++] = clockseq >>> 8 | 0x80;
199
+
200
+ // `clock_seq_low`
201
+ b[i++] = clockseq & 0xff;
202
+
203
+ // `node`
204
+ for (var n = 0; n < 6; ++n) {
205
+ b[i + n] = node[n];
206
+ }
207
+
208
+ return buf ? buf : bytesToUuid(b);
209
+ }
210
+
211
+ module.exports = v1;
212
+
213
+
214
+ /***/ }),
215
+
216
+ /***/ 6426:
217
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
218
+
219
+ var rng = __webpack_require__(9157);
220
+ var bytesToUuid = __webpack_require__(8725);
221
+
222
+ function v4(options, buf, offset) {
223
+ var i = buf && offset || 0;
224
+
225
+ if (typeof(options) == 'string') {
226
+ buf = options === 'binary' ? new Array(16) : null;
227
+ options = null;
228
+ }
229
+ options = options || {};
230
+
231
+ var rnds = options.random || (options.rng || rng)();
232
+
233
+ // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
234
+ rnds[6] = (rnds[6] & 0x0f) | 0x40;
235
+ rnds[8] = (rnds[8] & 0x3f) | 0x80;
236
+
237
+ // Copy bytes to buffer, if provided
238
+ if (buf) {
239
+ for (var ii = 0; ii < 16; ++ii) {
240
+ buf[i + ii] = rnds[ii];
241
+ }
242
+ }
243
+
244
+ return buf || bytesToUuid(rnds);
245
+ }
246
+
247
+ module.exports = v4;
248
+
249
+
250
+ /***/ })
251
+
252
+ /******/ });
253
+ /************************************************************************/
254
+ /******/ // The module cache
255
+ /******/ var __webpack_module_cache__ = {};
256
+ /******/
257
+ /******/ // The require function
258
+ /******/ function __webpack_require__(moduleId) {
259
+ /******/ // Check if module is in cache
260
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
261
+ /******/ if (cachedModule !== undefined) {
262
+ /******/ return cachedModule.exports;
263
+ /******/ }
264
+ /******/ // Create a new module (and put it into the cache)
265
+ /******/ var module = __webpack_module_cache__[moduleId] = {
266
+ /******/ // no module.id needed
267
+ /******/ // no module.loaded needed
268
+ /******/ exports: {}
269
+ /******/ };
270
+ /******/
271
+ /******/ // Execute the module function
272
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
273
+ /******/
274
+ /******/ // Return the exports of the module
275
+ /******/ return module.exports;
276
+ /******/ }
277
+ /******/
278
+ /************************************************************************/
279
+ /******/ /* webpack/runtime/define property getters */
280
+ /******/ (() => {
281
+ /******/ // define getter functions for harmony exports
282
+ /******/ __webpack_require__.d = (exports, definition) => {
283
+ /******/ for(var key in definition) {
284
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
285
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
286
+ /******/ }
287
+ /******/ }
288
+ /******/ };
289
+ /******/ })();
290
+ /******/
291
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
292
+ /******/ (() => {
293
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
294
+ /******/ })();
295
+ /******/
296
+ /************************************************************************/
297
+ var __webpack_exports__ = {};
298
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
299
+ (() => {
300
+
301
+ // EXPORTS
302
+ __webpack_require__.d(__webpack_exports__, {
303
+ Z: () => (/* binding */ src)
304
+ });
305
+
306
+ ;// CONCATENATED MODULE: external "../shared"
307
+ var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
308
+ var y = x => () => x
309
+ const external_shared_namespaceObject = x({ ["PropTypes"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.PropTypes, ["debounce"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.debounce, ["resolveClassName"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.resolveClassName, ["withInstall"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.withInstall });
310
+ ;// CONCATENATED MODULE: external "vue"
311
+ var external_vue_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
312
+ var external_vue_y = x => () => x
313
+ const external_vue_namespaceObject = external_vue_x({ ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["h"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.h, ["nextTick"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.nextTick, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["onUnmounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onUnmounted, ["reactive"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.reactive, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["toRef"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.toRef, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch });
314
+ ;// CONCATENATED MODULE: external "../config-provider"
315
+ var external_config_provider_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
316
+ var external_config_provider_y = x => () => x
317
+ const external_config_provider_namespaceObject = external_config_provider_x({ ["usePrefix"]: () => __WEBPACK_EXTERNAL_MODULE__config_provider_9d0186d9__.usePrefix });
318
+ ;// CONCATENATED MODULE: external "../virtual-render"
319
+ var external_virtual_render_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
320
+ var external_virtual_render_y = x => () => x
321
+ const external_virtual_render_namespaceObject = external_virtual_render_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE__virtual_render_2d1a77c9__["default"] });
322
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/typeof.js
323
+ function _typeof(obj) {
324
+ "@babel/helpers - typeof";
325
+
326
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
327
+ return typeof obj;
328
+ } : function (obj) {
329
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
330
+ }, _typeof(obj);
331
+ }
332
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
333
+
334
+ function _toPrimitive(input, hint) {
335
+ if (_typeof(input) !== "object" || input === null) return input;
336
+ var prim = input[Symbol.toPrimitive];
337
+ if (prim !== undefined) {
338
+ var res = prim.call(input, hint || "default");
339
+ if (_typeof(res) !== "object") return res;
340
+ throw new TypeError("@@toPrimitive must return a primitive value.");
341
+ }
342
+ return (hint === "string" ? String : Number)(input);
343
+ }
344
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
345
+
346
+
347
+ function _toPropertyKey(arg) {
348
+ var key = _toPrimitive(arg, "string");
349
+ return _typeof(key) === "symbol" ? key : String(key);
350
+ }
351
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
352
+
353
+ function _defineProperty(obj, key, value) {
354
+ key = _toPropertyKey(key);
355
+ if (key in obj) {
356
+ Object.defineProperty(obj, key, {
357
+ value: value,
358
+ enumerable: true,
359
+ configurable: true,
360
+ writable: true
361
+ });
362
+ } else {
363
+ obj[key] = value;
364
+ }
365
+ return obj;
366
+ }
367
+ ;// CONCATENATED MODULE: ../../packages/tree/src/constant.ts
368
+
369
+ var _TreeEmitEventsType, _NODE_SOURCE_ATTRS;
370
+ /*
371
+ * Tencent is pleased to support the open source community by making
372
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
373
+ *
374
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
375
+ *
376
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
377
+ *
378
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
379
+ *
380
+ * ---------------------------------------------------
381
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
382
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
383
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
384
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
385
+ *
386
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
387
+ * the Software.
388
+ *
389
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
390
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
391
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
392
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
393
+ * IN THE SOFTWARE.
394
+ */
395
+ var EVENTS;
396
+ (function (EVENTS) {
397
+ EVENTS["NODE_CLICK"] = "nodeClick";
398
+ EVENTS["NODE_COLLAPSE"] = "nodeCollapse";
399
+ EVENTS["NODE_EXPAND"] = "nodeExpand";
400
+ EVENTS["NODE_CHECKED"] = "nodeChecked";
401
+ EVENTS["NODE_DRAG_START"] = "nodeDragStart";
402
+ EVENTS["NODE_DRAG_OVER"] = "nodeDragOver";
403
+ EVENTS["NODE_DRAG_LEAVE"] = "nodeDragLeave";
404
+ EVENTS["NODE_DROP"] = "nodeDrop";
405
+ })(EVENTS || (EVENTS = {}));
406
+ var EMPTY = function EMPTY() {
407
+ return true;
408
+ };
409
+ var TreeEmitEventsType = (_TreeEmitEventsType = {}, _defineProperty(_TreeEmitEventsType, EVENTS.NODE_CLICK, EMPTY), _defineProperty(_TreeEmitEventsType, EVENTS.NODE_COLLAPSE, EMPTY), _defineProperty(_TreeEmitEventsType, EVENTS.NODE_EXPAND, EMPTY), _defineProperty(_TreeEmitEventsType, EVENTS.NODE_CHECKED, EMPTY), _defineProperty(_TreeEmitEventsType, EVENTS.NODE_DRAG_START, EMPTY), _defineProperty(_TreeEmitEventsType, EVENTS.NODE_DRAG_OVER, EMPTY), _defineProperty(_TreeEmitEventsType, EVENTS.NODE_DRAG_LEAVE, EMPTY), _defineProperty(_TreeEmitEventsType, EVENTS.NODE_DROP, EMPTY), _TreeEmitEventsType);
410
+ /**
411
+ * 节点扩展属性
412
+ */
413
+ // eslint-disable-next-line @typescript-eslint/naming-convention
414
+ var NODE_ATTRIBUTES;
415
+ (function (NODE_ATTRIBUTES) {
416
+ NODE_ATTRIBUTES["DEPTH"] = "__depth";
417
+ NODE_ATTRIBUTES["INDEX"] = "__index";
418
+ NODE_ATTRIBUTES["UUID"] = "__uuid";
419
+ NODE_ATTRIBUTES["PARENT"] = "__parent";
420
+ NODE_ATTRIBUTES["HAS_CHILD"] = "__has_child";
421
+ NODE_ATTRIBUTES["PATH"] = "__path";
422
+ NODE_ATTRIBUTES["IS_ROOT"] = "__is_root";
423
+ NODE_ATTRIBUTES["ORDER"] = "__order";
424
+ NODE_ATTRIBUTES["IS_OPEN"] = "__is_open";
425
+ NODE_ATTRIBUTES["IS_CHECKED"] = "__is_checked";
426
+ NODE_ATTRIBUTES["IS_SELECTED"] = "__is_selected";
427
+ NODE_ATTRIBUTES["IS_ASYNC_INIT"] = "__is_async_init";
428
+ NODE_ATTRIBUTES["IS_MATCH"] = "__is_match";
429
+ NODE_ATTRIBUTES["IS_NULL"] = "__IS_NULL";
430
+ NODE_ATTRIBUTES["IS_CACHED"] = "__is_cached";
431
+ NODE_ATTRIBUTES["IS_ASYNC"] = "__is_async";
432
+ NODE_ATTRIBUTES["IS_LOADING"] = "__is_loading";
433
+ NODE_ATTRIBUTES["TREE_NODE_ATTR"] = "__attr__";
434
+ NODE_ATTRIBUTES["IS_INDETERMINATE"] = "__is_indeterminate";
435
+ })(NODE_ATTRIBUTES || (NODE_ATTRIBUTES = {}));
436
+ var NODE_SOURCE_ATTRS = (_NODE_SOURCE_ATTRS = {}, _defineProperty(_NODE_SOURCE_ATTRS, NODE_ATTRIBUTES.IS_OPEN, 'isOpen'), _defineProperty(_NODE_SOURCE_ATTRS, NODE_ATTRIBUTES.IS_SELECTED, 'selected'), _defineProperty(_NODE_SOURCE_ATTRS, NODE_ATTRIBUTES.IS_MATCH, 'isMatch'), _defineProperty(_NODE_SOURCE_ATTRS, NODE_ATTRIBUTES.HAS_CHILD, 'hasChild'), _defineProperty(_NODE_SOURCE_ATTRS, NODE_ATTRIBUTES.IS_CHECKED, 'checked'), _defineProperty(_NODE_SOURCE_ATTRS, NODE_ATTRIBUTES.IS_ASYNC, 'async'), _defineProperty(_NODE_SOURCE_ATTRS, NODE_ATTRIBUTES.IS_LOADING, 'loading'), _defineProperty(_NODE_SOURCE_ATTRS, NODE_ATTRIBUTES.IS_ROOT, 'isRoot'), _NODE_SOURCE_ATTRS);
437
+ /**
438
+ * 节点点击可执行行为配置
439
+ */
440
+ var NodeContentActionEnum;
441
+ (function (NodeContentActionEnum) {
442
+ NodeContentActionEnum["CLICK"] = "click";
443
+ NodeContentActionEnum["SELECTED"] = "selected";
444
+ NodeContentActionEnum["EXPAND"] = "expand";
445
+ NodeContentActionEnum["COLLAPSE"] = "collapse";
446
+ })(NodeContentActionEnum || (NodeContentActionEnum = {}));
447
+ ;// CONCATENATED MODULE: external "vue-types"
448
+ var external_vue_types_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
449
+ var external_vue_types_y = x => () => x
450
+ const external_vue_types_namespaceObject = external_vue_types_x({ ["string"]: () => __WEBPACK_EXTERNAL_MODULE_vue_types_22de060a__.string, ["toType"]: () => __WEBPACK_EXTERNAL_MODULE_vue_types_22de060a__.toType });
451
+ ;// CONCATENATED MODULE: ../../packages/tree/src/props.ts
452
+
453
+
454
+
455
+ var ColumnTypeEnum;
456
+ (function (ColumnTypeEnum) {
457
+ ColumnTypeEnum["ONCE"] = "once";
458
+ ColumnTypeEnum["EVERY"] = "every";
459
+ })(ColumnTypeEnum || (ColumnTypeEnum = {}));
460
+ var TreeSearchMatchEnum;
461
+ (function (TreeSearchMatchEnum) {
462
+ TreeSearchMatchEnum["FUZZY"] = "fuzzy";
463
+ TreeSearchMatchEnum["FULL"] = "full";
464
+ })(TreeSearchMatchEnum || (TreeSearchMatchEnum = {}));
465
+ var TreeSearchResultEnum;
466
+ (function (TreeSearchResultEnum) {
467
+ TreeSearchResultEnum["TREE"] = "tree";
468
+ TreeSearchResultEnum["LIST"] = "list";
469
+ })(TreeSearchResultEnum || (TreeSearchResultEnum = {}));
470
+ var treeProps = {
471
+ /**
472
+ * 渲染列表
473
+ */
474
+ data: external_shared_namespaceObject.PropTypes.arrayOf(external_shared_namespaceObject.PropTypes.any).def([]),
475
+ /**
476
+ * 指定节点标签为节点对象的某个属性值
477
+ */
478
+ label: external_shared_namespaceObject.PropTypes.oneOfType([external_shared_namespaceObject.PropTypes.func.def(undefined), external_shared_namespaceObject.PropTypes.string.def('label')]),
479
+ /**
480
+ * 每个树节点用来作为唯一标识的属性,此标识应该是唯一的
481
+ * 如果设置系统会默认自动生成唯一id
482
+ */
483
+ nodeKey: external_shared_namespaceObject.PropTypes.string.def(undefined),
484
+ /**
485
+ * 子节点 Key, 用于读取子节点
486
+ * 默认 children
487
+ */
488
+ children: external_shared_namespaceObject.PropTypes.string.def('children'),
489
+ /**
490
+ * 相邻级节点间的水平缩进,单位为像素
491
+ */
492
+ indent: external_shared_namespaceObject.PropTypes.number.def(18),
493
+ /**
494
+ * 设置行高
495
+ */
496
+ lineHeight: external_shared_namespaceObject.PropTypes.number.def(32),
497
+ /**
498
+ * 设置树形组件高度
499
+ * 在设置 virtualRender=true时,请指定高度,避免组件自动计算高度导致多次渲染
500
+ */
501
+ height: external_shared_namespaceObject.PropTypes.number,
502
+ /**
503
+ * 设置层级连线
504
+ */
505
+ levelLine: external_shared_namespaceObject.PropTypes.oneOfType([external_shared_namespaceObject.PropTypes.bool.def(false), external_shared_namespaceObject.PropTypes.func.def(undefined), external_shared_namespaceObject.PropTypes.string.def('1px dashed #c3cdd7')]).def(false),
506
+ /**
507
+ * 是否开启虚拟滚动
508
+ * 默认虚拟滚动是开启的,数据量大的情况下有利于性能优化,可以通过设置 virtualRender = false 关闭虚拟滚动
509
+ */
510
+ virtualRender: external_shared_namespaceObject.PropTypes.bool.def(false),
511
+ /**
512
+ * 当前节点标识图标
513
+ * 默认 true
514
+ */
515
+ prefixIcon: external_shared_namespaceObject.PropTypes.oneOfType([external_shared_namespaceObject.PropTypes.func.def(function () {}), external_shared_namespaceObject.PropTypes.bool.def(false)]).def(true),
516
+ /**
517
+ * 异步加载节点数据配置
518
+ * @param callback 请求数据回调函数,函数返回 Promise
519
+ * @param cache 是否缓存请求结果,默认为True,只有在第一次才会发起请求,若设置为false则每次都会发起请求
520
+ */
521
+ async: external_shared_namespaceObject.PropTypes.shape({
522
+ /**
523
+ * 点击节点需要执行的异步函数
524
+ * 返回 Promise
525
+ */
526
+ callback: external_shared_namespaceObject.PropTypes.func.def(undefined),
527
+ /**
528
+ * 是否缓存异步请求结果
529
+ * true 只在第一次点击请求异步函数
530
+ * false 每次点击都执行异步函数
531
+ */
532
+ cache: external_shared_namespaceObject.PropTypes.bool.def(true),
533
+ /**
534
+ * 异步请求节点是否自动展开
535
+ * 可选值:once 只在初始化是执行一次
536
+ * every 每次数据更新都执行
537
+ */
538
+ deepAutoOpen: (0,external_vue_types_namespaceObject.toType)('columnType', {}).def(ColumnTypeEnum.ONCE)
539
+ }),
540
+ /**
541
+ * 每个节点偏移左侧距离
542
+ */
543
+ offsetLeft: external_shared_namespaceObject.PropTypes.number.def(5),
544
+ /**
545
+ * 搜索配置
546
+ * 可以为一个配置项 SearchOption
547
+ * 或者直接为一个字符串,如果直接为字符串则模糊匹配此值
548
+ */
549
+ search: external_shared_namespaceObject.PropTypes.oneOfType([external_shared_namespaceObject.PropTypes.shape({
550
+ /**
551
+ * 需要匹配的值
552
+ * */
553
+ value: external_shared_namespaceObject.PropTypes.oneOfType([external_shared_namespaceObject.PropTypes.number, external_shared_namespaceObject.PropTypes.string, external_shared_namespaceObject.PropTypes.bool]).def(''),
554
+ /**
555
+ * 匹配方式
556
+ * 支持模糊匹配(fuzzy) || 完全匹配(full)
557
+ * 默认 模糊匹配(fuzzy)
558
+ * 支持自定义匹配函数 (searchValue, itemText, item) => true || false
559
+ */
560
+ match: external_shared_namespaceObject.PropTypes.oneOfType([(0,external_vue_types_namespaceObject.string)(), external_shared_namespaceObject.PropTypes.func]).def(TreeSearchMatchEnum.FUZZY),
561
+ /**
562
+ * 搜索结果如何展示
563
+ * 显示为 tree || list
564
+ * 默认 tree
565
+ */
566
+ resultType: (0,external_vue_types_namespaceObject.string)().def(TreeSearchResultEnum.TREE),
567
+ /**
568
+ * 是否显示匹配项的子节点
569
+ */
570
+ showChildNodes: external_shared_namespaceObject.PropTypes.bool.def(true)
571
+ }), external_shared_namespaceObject.PropTypes.string, external_shared_namespaceObject.PropTypes.number, external_shared_namespaceObject.PropTypes.bool]).def(undefined),
572
+ emptyText: external_shared_namespaceObject.PropTypes.string.def('没有数据'),
573
+ draggable: external_shared_namespaceObject.PropTypes.bool.def(false),
574
+ disableDrag: external_shared_namespaceObject.PropTypes.func,
575
+ disableDrop: external_shared_namespaceObject.PropTypes.func,
576
+ /**
577
+ * 节点拖拽时可交换位置(开启拖拽可交换位置后将不支持改变层级)
578
+ */
579
+ dragSort: external_shared_namespaceObject.PropTypes.bool.def(false),
580
+ /**
581
+ * 节点是否可以选中
582
+ */
583
+ selectable: external_shared_namespaceObject.PropTypes.oneOfType([external_shared_namespaceObject.PropTypes.bool, external_shared_namespaceObject.PropTypes.func]).def(true),
584
+ disabledFolderSelectable: external_shared_namespaceObject.PropTypes.bool.def(false),
585
+ /**
586
+ * 是否支持多选
587
+ */
588
+ showCheckbox: external_shared_namespaceObject.PropTypes.bool.def(false),
589
+ checked: external_shared_namespaceObject.PropTypes.arrayOf(external_shared_namespaceObject.PropTypes.any).def([]),
590
+ /**
591
+ * 是否显示节点类型Icon
592
+ */
593
+ showNodeTypeIcon: external_shared_namespaceObject.PropTypes.bool.def(true),
594
+ /**
595
+ * 默认选中的节点id,selectable为false时无效
596
+ */
597
+ selected: external_shared_namespaceObject.PropTypes.oneOfType([external_shared_namespaceObject.PropTypes.string, external_shared_namespaceObject.PropTypes.number, external_shared_namespaceObject.PropTypes.object]).def([]),
598
+ /**
599
+ * 是否自动检查当前节点是否有子节点
600
+ * 节点前面的展开收起Icon会根据判定值做改变
601
+ * 如果需要自已控制,请设置为false
602
+ */
603
+ autoCheckChildren: external_shared_namespaceObject.PropTypes.bool.def(true),
604
+ /**
605
+ * 如果设置了某一个叶子节点状态为展开,是否自动展开所有父级节点
606
+ * 默认为true,如果设置为false,则每层状态需要自己控制
607
+ */
608
+ autoOpenParentNode: external_shared_namespaceObject.PropTypes.bool.def(true),
609
+ /**
610
+ * 默认是否展开所有节点
611
+ */
612
+ expandAll: external_shared_namespaceObject.PropTypes.bool.def(false),
613
+ /**
614
+ * 节点内容点击行为
615
+ * 此处配置每个节点除了展开\收起箭头之外的内容块时的行为
616
+ * 默认为 ['selected', 'expand', 'click'],点击内容块为选中当前节点
617
+ */
618
+ nodeContentAction: external_shared_namespaceObject.PropTypes.oneOfType([external_shared_namespaceObject.PropTypes.arrayOf((0,external_vue_types_namespaceObject.toType)('nodeContentActionType', {}).def(NodeContentActionEnum.CLICK)), external_shared_namespaceObject.PropTypes.func.def(function () {
619
+ return ['selected'];
620
+ })]).def(['selected', 'expand', 'click']),
621
+ /**
622
+ * 是否作用域插槽抛出参数是否保持源数据的引用
623
+ * 如果设置为true,则作用域插槽参数格式为: { data: node, attributes: {} }
624
+ * 如果设置为false,则作用域插槽参数格式为: { ...node, ...attributes }
625
+ * attributes 为节点内置属性,包含节点是否展开,是否选中,是否有子节点等等
626
+ */
627
+ keepSlotData: external_shared_namespaceObject.PropTypes.bool.def(false)
628
+ };
629
+ ;// CONCATENATED MODULE: external "../exception"
630
+ var external_exception_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
631
+ var external_exception_y = x => () => x
632
+ const external_exception_namespaceObject = external_exception_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE__exception_12c197e0__["default"] });
633
+ ;// CONCATENATED MODULE: ../../packages/tree/src/use-empty.tsx
634
+
635
+ /*
636
+ * Tencent is pleased to support the open source community by making
637
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
638
+ *
639
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
640
+ *
641
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
642
+ *
643
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
644
+ *
645
+ * ---------------------------------------------------
646
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
647
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
648
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
649
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
650
+ *
651
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
652
+ * the Software.
653
+ *
654
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
655
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
656
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
657
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
658
+ * IN THE SOFTWARE.
659
+ */
660
+
661
+ /* harmony default export */ const use_empty = (function (props, _ref) {
662
+ var slots = _ref.slots;
663
+ return {
664
+ renderEmpty: function renderEmpty(type) {
665
+ var _slots$default, _slots$default2;
666
+ return (0,external_vue_namespaceObject.createVNode)(external_exception_namespaceObject["default"], {
667
+ "scene": "part",
668
+ "type": type
669
+ }, {
670
+ "default": function _default() {
671
+ return [(_slots$default = (_slots$default2 = slots["default"]) === null || _slots$default2 === void 0 ? void 0 : _slots$default2.call(slots)) !== null && _slots$default !== void 0 ? _slots$default : props.emptyText];
672
+ }
673
+ });
674
+ }
675
+ };
676
+ });
677
+ ;// CONCATENATED MODULE: external "../checkbox"
678
+ var external_checkbox_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
679
+ var external_checkbox_y = x => () => x
680
+ const external_checkbox_namespaceObject = external_checkbox_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE__checkbox_a57bcb84__["default"] });
681
+ ;// CONCATENATED MODULE: external "../icon"
682
+ var external_icon_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
683
+ var external_icon_y = x => () => x
684
+ const external_icon_namespaceObject = external_icon_x({ ["DownShape"]: () => __WEBPACK_EXTERNAL_MODULE__icon_85385c3e__.DownShape, ["Folder"]: () => __WEBPACK_EXTERNAL_MODULE__icon_85385c3e__.Folder, ["FolderShapeOpen"]: () => __WEBPACK_EXTERNAL_MODULE__icon_85385c3e__.FolderShapeOpen, ["RightShape"]: () => __WEBPACK_EXTERNAL_MODULE__icon_85385c3e__.RightShape, ["Spinner"]: () => __WEBPACK_EXTERNAL_MODULE__icon_85385c3e__.Spinner, ["TextFile"]: () => __WEBPACK_EXTERNAL_MODULE__icon_85385c3e__.TextFile });
685
+ ;// CONCATENATED MODULE: ../../packages/tree/src/use-node-attribute.tsx
686
+
687
+
688
+ /*
689
+ * Tencent is pleased to support the open source community by making
690
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
691
+ *
692
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
693
+ *
694
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
695
+ *
696
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
697
+ *
698
+ * ---------------------------------------------------
699
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
700
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
701
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
702
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
703
+ *
704
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
705
+ * the Software.
706
+ *
707
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
708
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
709
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
710
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
711
+ * IN THE SOFTWARE.
712
+ */
713
+
714
+ /* harmony default export */ const use_node_attribute = (function (flatData, props) {
715
+ /**
716
+ * 获取Schema中指定的对象值
717
+ * @param key
718
+ * @returns
719
+ */
720
+ var getSchemaVal = function getSchemaVal(node) {
721
+ return flatData.schema.get(node);
722
+ };
723
+ /**
724
+ * 获取节点属性
725
+ * @param node 当前节点
726
+ * @param attr 节点属性
727
+ * @returns
728
+ */
729
+ var getNodeAttr = function getNodeAttr(node, attr) {
730
+ var _getSchemaVal;
731
+ return (_getSchemaVal = getSchemaVal(node)) === null || _getSchemaVal === void 0 ? void 0 : _getSchemaVal[attr];
732
+ };
733
+ /**
734
+ * 设置节点属性
735
+ * @param node 指定节点
736
+ * @param attr 节点属性
737
+ * @param val 属性值
738
+ * @returns
739
+ */
740
+ var setNodeAttr = function setNodeAttr(node, attr, val, id) {
741
+ if (!flatData.schema.has(node)) {
742
+ console.warn('node is not in schema, please check', id, node);
743
+ return;
744
+ }
745
+ flatData.schema.set(node, Object.assign({}, getSchemaVal(node), _defineProperty({}, attr, val)));
746
+ };
747
+ var getNodeById = function getNodeById(id) {
748
+ return flatData.data.find(function (item) {
749
+ return getNodeId(item) === id;
750
+ });
751
+ };
752
+ var setNodeAttrById = function setNodeAttrById(id, attr, val) {
753
+ if (Array.isArray(id)) {
754
+ Array.prototype.forEach.call(id, function (item) {
755
+ return setNodeAttr(getNodeById(item), attr, val, id);
756
+ });
757
+ return;
758
+ }
759
+ setNodeAttr(getNodeById(id), attr, val, id);
760
+ };
761
+ var getNodePath = function getNodePath(node) {
762
+ return getNodeAttr(node, NODE_ATTRIBUTES.PATH);
763
+ };
764
+ var getNodeId = function getNodeId(node) {
765
+ return getNodeAttr(node, NODE_ATTRIBUTES.UUID);
766
+ };
767
+ var isNodeOpened = function isNodeOpened(node) {
768
+ return getNodeAttr(node, NODE_ATTRIBUTES.IS_OPEN);
769
+ };
770
+ var hasChildNode = function hasChildNode(node) {
771
+ return getNodeAttr(node, NODE_ATTRIBUTES.HAS_CHILD);
772
+ };
773
+ var isNodeMatched = function isNodeMatched(node) {
774
+ return getNodeAttr(node, NODE_ATTRIBUTES.IS_MATCH);
775
+ };
776
+ var isNodeChecked = function isNodeChecked(node) {
777
+ return getNodeAttr(node, NODE_ATTRIBUTES.IS_CHECKED);
778
+ };
779
+ var getNodeParentId = function getNodeParentId(node) {
780
+ return getNodeAttr(getNodeAttr(node, NODE_ATTRIBUTES.PARENT), NODE_ATTRIBUTES.UUID);
781
+ };
782
+ var isNodeLoading = function isNodeLoading(node) {
783
+ return getNodeAttr(node, NODE_ATTRIBUTES.IS_LOADING);
784
+ };
785
+ var getParentNode = function getParentNode(node) {
786
+ return getNodeAttr(node, NODE_ATTRIBUTES.PARENT);
787
+ };
788
+ var isMatchedNode = function isMatchedNode(node) {
789
+ return getNodeAttr(node, NODE_ATTRIBUTES.IS_MATCH);
790
+ };
791
+ var getNodeAttrById = function getNodeAttrById(id, attr) {
792
+ var target = flatData.data.find(function (item) {
793
+ return getNodeId(item) === id;
794
+ });
795
+ return getNodeAttr(target, attr);
796
+ };
797
+ var isRootNode = function isRootNode(node) {
798
+ if (typeof node === 'string') {
799
+ return getNodeAttrById(node, NODE_ATTRIBUTES.IS_ROOT);
800
+ }
801
+ return getNodeAttr(node, NODE_ATTRIBUTES.IS_ROOT);
802
+ };
803
+ var getNodeParentIdById = function getNodeParentIdById(id) {
804
+ var target = flatData.data.find(function (item) {
805
+ return getNodeId(item) === id;
806
+ });
807
+ return getNodeParentId(target);
808
+ };
809
+ var getNodePathById = function getNodePathById(id) {
810
+ var target = flatData.data.find(function (item) {
811
+ return getNodeId(item) === id;
812
+ });
813
+ return getNodePath(target);
814
+ };
815
+ var setTreeNodeLoading = function setTreeNodeLoading(node, value) {
816
+ setNodeAttr(node, NODE_ATTRIBUTES.IS_LOADING, value);
817
+ };
818
+ // const deleteNodeSchema = (id: string) => (flatData.schema as Map<string, any>).delete(id);
819
+ /**
820
+ * 判定指定节点是否为展开状态
821
+ * @param item 节点或者节点 UUID
822
+ * @returns
823
+ */
824
+ var isItemOpen = function isItemOpen(item) {
825
+ if (_typeof(item) === 'object') {
826
+ return isNodeOpened(item);
827
+ }
828
+ if (typeof item === 'string') {
829
+ return getNodeAttrById(item, NODE_ATTRIBUTES.IS_OPEN);
830
+ }
831
+ return false;
832
+ };
833
+ var getParentNodeAttr = function getParentNodeAttr(node, attrName) {
834
+ return getNodeAttr(getNodeAttr(node, NODE_ATTRIBUTES.PARENT), attrName);
835
+ };
836
+ var isParentNodeOpened = function isParentNodeOpened(node) {
837
+ return isItemOpen(getNodeAttr(node, NODE_ATTRIBUTES.PARENT));
838
+ };
839
+ /**
840
+ * 过滤当前状态为Open的节点
841
+ * 页面展示只会展示Open的节点
842
+ * @param item
843
+ * @returns
844
+ */
845
+ var checkNodeIsOpen = function checkNodeIsOpen(node) {
846
+ return isRootNode(node) || isItemOpen(node) || isParentNodeOpened(node);
847
+ };
848
+ /**
849
+ * 根据节点path返回源数据中节点信息
850
+ * @param path
851
+ * @returns
852
+ */
853
+ var getSourceNodeByPath = function getSourceNodeByPath(path, uid) {
854
+ var paths = path.split('-');
855
+ var target = paths.reduce(function (pre, nodeIndex) {
856
+ var index = Number(nodeIndex);
857
+ return Array.isArray(pre) ? pre[index] : pre[props.children][index];
858
+ }, props.data);
859
+ if (uid) {
860
+ Object.assign(target, _defineProperty({}, NODE_ATTRIBUTES.UUID, uid));
861
+ }
862
+ return target;
863
+ };
864
+ var getChildNodes = function getChildNodes(node) {
865
+ var _node$props$children;
866
+ return (_node$props$children = node[props.children]) !== null && _node$props$children !== void 0 ? _node$props$children : [];
867
+ };
868
+ var getSourceNodeByUID = function getSourceNodeByUID(uid) {
869
+ return flatData.data.find(function (item) {
870
+ return getNodeId(item) === uid;
871
+ });
872
+ };
873
+ var getParentNodeData = function getParentNodeData(node) {
874
+ if (isRootNode(node)) {
875
+ return _defineProperty({}, props.children, props.data);
876
+ }
877
+ return getParentNode(node);
878
+ };
879
+ /**
880
+ * 处理scoped slot 透传数据
881
+ * @param item 当前节点数据
882
+ * @returns
883
+ */
884
+ var resolveScopedSlotParam = function resolveScopedSlotParam(item) {
885
+ var _ref2;
886
+ return _ref2 = {}, _defineProperty(_ref2, NODE_SOURCE_ATTRS[NODE_ATTRIBUTES.IS_LOADING], getNodeAttr(item, NODE_ATTRIBUTES.IS_LOADING)), _defineProperty(_ref2, NODE_SOURCE_ATTRS[NODE_ATTRIBUTES.HAS_CHILD], hasChildNode(item)), _defineProperty(_ref2, NODE_SOURCE_ATTRS[NODE_ATTRIBUTES.IS_MATCH], isNodeMatched(item)), _defineProperty(_ref2, NODE_SOURCE_ATTRS[NODE_ATTRIBUTES.IS_CHECKED], isNodeChecked(item)), _defineProperty(_ref2, NODE_SOURCE_ATTRS[NODE_ATTRIBUTES.IS_OPEN], isNodeOpened(item)), _defineProperty(_ref2, NODE_SOURCE_ATTRS[NODE_ATTRIBUTES.IS_ROOT], isRootNode(item)), _defineProperty(_ref2, "fullPath", getNodeAttr(item, NODE_ATTRIBUTES.PATH)), _defineProperty(_ref2, "uuid", getNodeId(item)), _defineProperty(_ref2, "parent", getNodeAttr(item, NODE_ATTRIBUTES.PARENT)), _defineProperty(_ref2, "parentId", getNodeId(getNodeAttr(item, NODE_ATTRIBUTES.PARENT))), _ref2;
887
+ };
888
+ var extendNodeAttr = function extendNodeAttr(item) {
889
+ return Object.assign({}, item, _defineProperty({}, NODE_ATTRIBUTES.TREE_NODE_ATTR, resolveScopedSlotParam(item)));
890
+ };
891
+ var extendNodeScopedData = function extendNodeScopedData(item) {
892
+ return {
893
+ data: item,
894
+ attributes: resolveScopedSlotParam(item)
895
+ };
896
+ };
897
+ return {
898
+ getSchemaVal: getSchemaVal,
899
+ getNodeAttr: getNodeAttr,
900
+ getNodeId: getNodeId,
901
+ getNodeParentId: getNodeParentId,
902
+ getParentNodeData: getParentNodeData,
903
+ getNodePathById: getNodePathById,
904
+ getNodeAttrById: getNodeAttrById,
905
+ getNodeParentIdById: getNodeParentIdById,
906
+ getParentNodeAttr: getParentNodeAttr,
907
+ getParentNode: getParentNode,
908
+ setNodeAttr: setNodeAttr,
909
+ setNodeAttrById: setNodeAttrById,
910
+ getNodePath: getNodePath,
911
+ isRootNode: isRootNode,
912
+ isNodeOpened: isNodeOpened,
913
+ hasChildNode: hasChildNode,
914
+ isItemOpen: isItemOpen,
915
+ isNodeChecked: isNodeChecked,
916
+ isNodeMatched: isNodeMatched,
917
+ isNodeLoading: isNodeLoading,
918
+ checkNodeIsOpen: checkNodeIsOpen,
919
+ getSourceNodeByPath: getSourceNodeByPath,
920
+ getSourceNodeByUID: getSourceNodeByUID,
921
+ isMatchedNode: isMatchedNode,
922
+ resolveScopedSlotParam: resolveScopedSlotParam,
923
+ setTreeNodeLoading: setTreeNodeLoading,
924
+ extendNodeAttr: extendNodeAttr,
925
+ getChildNodes: getChildNodes,
926
+ extendNodeScopedData: extendNodeScopedData
927
+ };
928
+ });
929
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
930
+ function _arrayLikeToArray(arr, len) {
931
+ if (len == null || len > arr.length) len = arr.length;
932
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
933
+ return arr2;
934
+ }
935
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
936
+
937
+ function _arrayWithoutHoles(arr) {
938
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
939
+ }
940
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/iterableToArray.js
941
+ function _iterableToArray(iter) {
942
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
943
+ }
944
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
945
+
946
+ function _unsupportedIterableToArray(o, minLen) {
947
+ if (!o) return;
948
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
949
+ var n = Object.prototype.toString.call(o).slice(8, -1);
950
+ if (n === "Object" && o.constructor) n = o.constructor.name;
951
+ if (n === "Map" || n === "Set") return Array.from(o);
952
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
953
+ }
954
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
955
+ function _nonIterableSpread() {
956
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
957
+ }
958
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
959
+
960
+
961
+
962
+
963
+ function _toConsumableArray(arr) {
964
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
965
+ }
966
+ ;// CONCATENATED MODULE: ../../packages/tree/src/util.ts
967
+
968
+
969
+
970
+ var _this = undefined;
971
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
972
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
973
+ /*
974
+ * Tencent is pleased to support the open source community by making
975
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
976
+ *
977
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
978
+ *
979
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
980
+ *
981
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
982
+ *
983
+ * ---------------------------------------------------
984
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
985
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
986
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
987
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
988
+ *
989
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
990
+ * the Software.
991
+ *
992
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
993
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
994
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
995
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
996
+ * IN THE SOFTWARE.
997
+ */
998
+
999
+
1000
+ var DEFAULT_LEVLE_LINE = '1px dashed #c3cdd7';
1001
+ /**
1002
+ * 获取配置项可为Bool|String|Function类型,如果为Bool则配置默认值
1003
+ * @param props
1004
+ * @param key
1005
+ * @param item
1006
+ * @param defaultTrueValue
1007
+ * @param defaultFalseValue
1008
+ * @returns
1009
+ */
1010
+ var getPropsOneOfBoolValueWithDefault = function getPropsOneOfBoolValueWithDefault(props, key) {
1011
+ var item = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1012
+ var defaultTrueValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
1013
+ var defaultFalseValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
1014
+ var args = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : [];
1015
+ var prop = props[key];
1016
+ if (typeof prop === 'boolean') {
1017
+ return prop ? defaultTrueValue : defaultFalseValue;
1018
+ }
1019
+ return getStringOrFuncStr(item, props, key, args);
1020
+ };
1021
+ /**
1022
+ * 处理Props中用户给定的配置项(返回值为String或者Function)
1023
+ * @param item 当前渲染数据(当item为Object时,返回当前Object中通过Props指定Key的Value,否则返回Props中指定的值)
1024
+ * @param props Props
1025
+ * @param key 配置项关键字
1026
+ * @param args 其他参数
1027
+ * @returns
1028
+ */
1029
+ var getStringOrFuncStr = function getStringOrFuncStr(item, props, key) {
1030
+ var args = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
1031
+ var value = props[key];
1032
+ if (typeof value === 'string') {
1033
+ if (_typeof(item) === 'object' && item !== null) {
1034
+ if (!Object.prototype.hasOwnProperty.call(item, value)) {
1035
+ console.error("cannot find node label with key ".concat(value));
1036
+ }
1037
+ return item[value];
1038
+ }
1039
+ return value;
1040
+ }
1041
+ if (typeof value === 'function') {
1042
+ var txt = value.apply(_this, [item].concat(_toConsumableArray(args)));
1043
+ if (typeof txt === 'string') {
1044
+ return txt;
1045
+ }
1046
+ console.error('props label with function return value is not string, please check and return string');
1047
+ return undefined;
1048
+ }
1049
+ return undefined;
1050
+ };
1051
+ /**
1052
+ * 获取当前节点显示Label
1053
+ * @param item 当前节点
1054
+ * @param props Props
1055
+ */
1056
+ var getLabel = function getLabel(item, props) {
1057
+ return getStringOrFuncStr(item, props, 'label');
1058
+ };
1059
+ /**
1060
+ * 根据Props获取Tree样式设置
1061
+ * @param item
1062
+ * @param props
1063
+ * @returns
1064
+ */
1065
+ var getTreeStyle = function getTreeStyle(item, props) {
1066
+ // 处理Props回调函数,参数 [tree] 表示 levelLine 回调参数第二个,此次渲染请求为Tree外层样式
1067
+ var levelLine = getPropsOneOfBoolValueWithDefault(props, 'levelLine', item, DEFAULT_LEVLE_LINE, null, ['tree']);
1068
+ return {
1069
+ '--level-line': levelLine,
1070
+ '--lineHeight': "".concat(props.lineHeight, "px"),
1071
+ '--indent': "".concat(props.indent, "px"),
1072
+ '--offset-left': "".concat(props.offsetLeft, "px")
1073
+ };
1074
+ };
1075
+ /**
1076
+ * 获取节点样式配置
1077
+ * @param item
1078
+ * @param props
1079
+ * @returns
1080
+ */
1081
+ var getNodeItemStyle = function getNodeItemStyle(item, props, flatData) {
1082
+ var _schema$get;
1083
+ var showTree = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
1084
+ var schema = flatData.schema;
1085
+ var depth = (_schema$get = schema.get(item)) === null || _schema$get === void 0 ? void 0 : _schema$get[NODE_ATTRIBUTES.DEPTH];
1086
+ if (showTree) {
1087
+ return _objectSpread({
1088
+ '--depth': depth
1089
+ }, typeof props.levelLine === 'function' ? {
1090
+ '--level-line': getPropsOneOfBoolValueWithDefault(props, 'levelLine', item, DEFAULT_LEVLE_LINE, null, ['node'])
1091
+ } : {});
1092
+ }
1093
+ return {};
1094
+ };
1095
+ /**
1096
+ * 获取当前渲染节点Class List
1097
+ * @param item
1098
+ * @returns
1099
+ */
1100
+ var getNodeItemClass = function getNodeItemClass(item, schema, props) {
1101
+ var showTree = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
1102
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1103
+ var _ref = schema.get(item) || {},
1104
+ __is_root = _ref.__is_root,
1105
+ __is_open = _ref.__is_open;
1106
+ return {
1107
+ 'is-root': __is_root,
1108
+ 'bk-tree-node': true,
1109
+ 'is-open': __is_open,
1110
+ 'is-virtual-render': props.virtualRender,
1111
+ 'level-line': props.levelLine && showTree
1112
+ };
1113
+ };
1114
+ /**
1115
+ * 获取当前渲染节点Class List
1116
+ * @param item
1117
+ * @returns
1118
+ */
1119
+ var getNodeRowClass = function getNodeRowClass(item, schema) {
1120
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1121
+ var _ref2 = schema.get(item) || {},
1122
+ __is_checked = _ref2.__is_checked,
1123
+ __is_selected = _ref2.__is_selected;
1124
+ return _defineProperty({
1125
+ 'is-checked': __is_checked,
1126
+ 'is-selected': __is_selected,
1127
+ 'node-folder': item.is_folder,
1128
+ 'node-leaf': item.is_leaf
1129
+ }, (0,external_shared_namespaceObject.resolveClassName)('node-row'), true);
1130
+ };
1131
+ /**
1132
+ * 根据路径更新指定节点Child-Data
1133
+ * @param path 节点路径
1134
+ * @param treeData Tree Data
1135
+ * @param childKey Child Key
1136
+ * @param nodekey 节点key
1137
+ * @param nodeValue 节点值
1138
+ */
1139
+ var updateTreeNode = function updateTreeNode(path, treeData, childKey, nodekey, nodeValue) {
1140
+ assignTreeNode(path, treeData, childKey, _defineProperty({}, nodekey, nodeValue));
1141
+ };
1142
+ /**
1143
+ * 根据路径更新指定节点Child-Data
1144
+ * @param path 节点路径
1145
+ * @param treeData Tree Data
1146
+ * @param childKey Child Key
1147
+ * @param assignVal value
1148
+ */
1149
+ var assignTreeNode = function assignTreeNode(path, treeData, childKey, assignVal) {
1150
+ var paths = path.split('-');
1151
+ var targetNode = paths.reduce(function (pre, nodeIndex) {
1152
+ var index = Number(nodeIndex);
1153
+ return Array.isArray(pre) ? pre[index] : pre[childKey][index];
1154
+ }, treeData);
1155
+ Object.assign(targetNode, assignVal || {});
1156
+ };
1157
+ var resolveNodeItem = function resolveNodeItem(node) {
1158
+ if (node === undefined || node === null) {
1159
+ return {
1160
+ __IS_NULL: true
1161
+ };
1162
+ }
1163
+ return node;
1164
+ };
1165
+ var resolvePropIsMatched = function resolvePropIsMatched(node, prop, id) {
1166
+ if (Array.isArray(prop)) {
1167
+ return prop.some(function (item) {
1168
+ return resolvePropIsMatched(node, item, id);
1169
+ });
1170
+ }
1171
+ if (typeof prop === 'string' || typeof prop === 'number') {
1172
+ return prop === id;
1173
+ }
1174
+ return node === prop;
1175
+ };
1176
+ ;// CONCATENATED MODULE: ../../packages/tree/src/use-node-async.tsx
1177
+
1178
+ /*
1179
+ * Tencent is pleased to support the open source community by making
1180
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
1181
+ *
1182
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1183
+ *
1184
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
1185
+ *
1186
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
1187
+ *
1188
+ * ---------------------------------------------------
1189
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1190
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1191
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1192
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1193
+ *
1194
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1195
+ * the Software.
1196
+ *
1197
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1198
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1199
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1200
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1201
+ * IN THE SOFTWARE.
1202
+ */
1203
+
1204
+
1205
+
1206
+ /* harmony default export */ const use_node_async = (function (props, flatData) {
1207
+ var _useNodeAttribute = use_node_attribute(flatData, props),
1208
+ setNodeAttr = _useNodeAttribute.setNodeAttr,
1209
+ getNodePath = _useNodeAttribute.getNodePath,
1210
+ getNodeAttr = _useNodeAttribute.getNodeAttr,
1211
+ resolveScopedSlotParam = _useNodeAttribute.resolveScopedSlotParam,
1212
+ setTreeNodeLoading = _useNodeAttribute.setTreeNodeLoading;
1213
+ /**
1214
+ * 处理异步加载节点数据返回结果
1215
+ * @param resp 异步请求返回结果
1216
+ * @param item 当前节点
1217
+ */
1218
+ var setNodeRemoteLoad = function setNodeRemoteLoad(resp, item) {
1219
+ if (_typeof(resp) === 'object' && resp !== null) {
1220
+ setNodeAttr(item, NODE_ATTRIBUTES.IS_OPEN, true);
1221
+ var nodeValue = Array.isArray(resp) ? resp : [resp];
1222
+ updateTreeNode(getNodePath(item), props.data, props.children, props.children, nodeValue);
1223
+ return Promise.resolve(resp);
1224
+ }
1225
+ return Promise.resolve(resp);
1226
+ };
1227
+ var asyncNodeClick = function asyncNodeClick(item) {
1228
+ var _ref = props.async || {},
1229
+ _ref$callback = _ref.callback,
1230
+ callback = _ref$callback === void 0 ? null : _ref$callback,
1231
+ _ref$cache = _ref.cache,
1232
+ cache = _ref$cache === void 0 ? true : _ref$cache;
1233
+ /** 如果是异步请求加载 */
1234
+ if (typeof callback === 'function' && getNodeAttr(item, NODE_ATTRIBUTES.IS_ASYNC)) {
1235
+ /** 用于注释当前节点是否已经初始化过 */
1236
+ setNodeAttr(item, NODE_ATTRIBUTES.IS_ASYNC_INIT, true);
1237
+ if (!getNodeAttr(item, NODE_ATTRIBUTES.IS_CACHED)) {
1238
+ setNodeAttr(item, NODE_ATTRIBUTES.IS_CACHED, cache);
1239
+ var dataAttr = resolveScopedSlotParam(item);
1240
+ var callbackResult = callback(item, function (resp) {
1241
+ return setNodeRemoteLoad(resp, item);
1242
+ }, dataAttr);
1243
+ if (_typeof(callbackResult) === 'object' && callbackResult !== null) {
1244
+ setTreeNodeLoading(item, true);
1245
+ if (callbackResult instanceof Promise) {
1246
+ return Promise.resolve(callbackResult.then(function (resp) {
1247
+ return setNodeRemoteLoad(resp, item);
1248
+ })["catch"](function (err) {
1249
+ return console.error('load remote data error:', err);
1250
+ })["finally"](function () {
1251
+ setTreeNodeLoading(item, false);
1252
+ setNodeAttr(item, NODE_ATTRIBUTES.IS_CACHED, true);
1253
+ }));
1254
+ }
1255
+ setNodeRemoteLoad(callbackResult, item);
1256
+ setTreeNodeLoading(item, false);
1257
+ return Promise.resolve(true);
1258
+ }
1259
+ }
1260
+ return Promise.resolve(true);
1261
+ }
1262
+ return Promise.resolve(true);
1263
+ };
1264
+ var deepAutoOpen = function deepAutoOpen() {
1265
+ /** 过滤节点为异步加载 & 默认为展开 & 没有初始化过的节点 */
1266
+ var autoOpenNodes = flatData.data.filter(function (item) {
1267
+ return getNodeAttr(item, NODE_ATTRIBUTES.IS_ASYNC) && item[NODE_SOURCE_ATTRS[NODE_ATTRIBUTES.IS_OPEN]] && !getNodeAttr(item, NODE_ATTRIBUTES.IS_ASYNC_INIT);
1268
+ });
1269
+ if (autoOpenNodes.length) {
1270
+ Promise.all(autoOpenNodes.map(function (item) {
1271
+ return asyncNodeClick(item);
1272
+ })).then(function () {
1273
+ deepAutoOpen();
1274
+ })["catch"](function (err) {
1275
+ console.warn(err);
1276
+ });
1277
+ }
1278
+ };
1279
+ return {
1280
+ asyncNodeClick: asyncNodeClick,
1281
+ deepAutoOpen: deepAutoOpen
1282
+ };
1283
+ });
1284
+ ;// CONCATENATED MODULE: ../../packages/tree/src/use-node-action.tsx
1285
+
1286
+
1287
+ var use_node_action_this = undefined;
1288
+
1289
+ /*
1290
+ * Tencent is pleased to support the open source community by making
1291
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
1292
+ *
1293
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1294
+ *
1295
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
1296
+ *
1297
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
1298
+ *
1299
+ * ---------------------------------------------------
1300
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1301
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1302
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1303
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1304
+ *
1305
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1306
+ * the Software.
1307
+ *
1308
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1309
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1310
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1311
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1312
+ * IN THE SOFTWARE.
1313
+ */
1314
+
1315
+
1316
+
1317
+
1318
+
1319
+
1320
+
1321
+
1322
+ /* harmony default export */ const use_node_action = (function (props, ctx, flatData, _renderData, initOption) {
1323
+ // const checkedNodes = [];
1324
+ var selectedNodeId = props.selected;
1325
+ var _useNodeAttribute = use_node_attribute(flatData, props),
1326
+ setNodeAttr = _useNodeAttribute.setNodeAttr,
1327
+ setNodeAttrById = _useNodeAttribute.setNodeAttrById,
1328
+ getNodePath = _useNodeAttribute.getNodePath,
1329
+ getSchemaVal = _useNodeAttribute.getSchemaVal,
1330
+ getNodeAttr = _useNodeAttribute.getNodeAttr,
1331
+ getNodeId = _useNodeAttribute.getNodeId,
1332
+ getChildNodes = _useNodeAttribute.getChildNodes,
1333
+ isRootNode = _useNodeAttribute.isRootNode,
1334
+ hasChildNode = _useNodeAttribute.hasChildNode,
1335
+ isItemOpen = _useNodeAttribute.isItemOpen,
1336
+ isNodeOpened = _useNodeAttribute.isNodeOpened,
1337
+ isNodeLoading = _useNodeAttribute.isNodeLoading,
1338
+ isNodeChecked = _useNodeAttribute.isNodeChecked,
1339
+ getParentNode = _useNodeAttribute.getParentNode,
1340
+ resolveScopedSlotParam = _useNodeAttribute.resolveScopedSlotParam,
1341
+ extendNodeAttr = _useNodeAttribute.extendNodeAttr,
1342
+ extendNodeScopedData = _useNodeAttribute.extendNodeScopedData;
1343
+ var _usePrefix = (0,external_config_provider_namespaceObject.usePrefix)(),
1344
+ resolveClassName = _usePrefix.resolveClassName;
1345
+ var registerNextLoop = initOption.registerNextLoop;
1346
+ var _useNodeAsync = use_node_async(props, flatData),
1347
+ asyncNodeClick = _useNodeAsync.asyncNodeClick,
1348
+ deepAutoOpen = _useNodeAsync.deepAutoOpen;
1349
+ /**
1350
+ * 根据当前节点状态获取节点类型Icon
1351
+ * @param item
1352
+ * @returns
1353
+ */
1354
+ var getRootIcon = function getRootIcon(item) {
1355
+ return isItemOpen(item) ? (0,external_vue_namespaceObject.createVNode)(external_icon_namespaceObject.FolderShapeOpen, {
1356
+ "class": [resolveClassName('tree-icon'), resolveClassName('node-prefix')]
1357
+ }, null) : (0,external_vue_namespaceObject.createVNode)(external_icon_namespaceObject.Folder, {
1358
+ "class": [resolveClassName('tree-icon'), resolveClassName('node-prefix')]
1359
+ }, null);
1360
+ };
1361
+ /**
1362
+ * 渲染动态设置的节点样式
1363
+ * @param val
1364
+ * @returns
1365
+ */
1366
+ var renderPrefixVal = function renderPrefixVal(val) {
1367
+ if (typeof val === 'string') {
1368
+ return val;
1369
+ }
1370
+ if (_typeof(val) === 'object' && val !== null) {
1371
+ if (val.__v_isVNode) {
1372
+ return val;
1373
+ }
1374
+ var node = val.node,
1375
+ className = val.className,
1376
+ text = val.text,
1377
+ style = val.style;
1378
+ return (0,external_vue_namespaceObject.h)(node, {
1379
+ "class": className,
1380
+ style: style
1381
+ }, text);
1382
+ }
1383
+ return null;
1384
+ };
1385
+ var getLoadingIcon = function getLoadingIcon(item) {
1386
+ var _ctx$slots$nodeLoadin, _ctx$slots$nodeLoadin2, _ctx$slots;
1387
+ return ((_ctx$slots$nodeLoadin = (_ctx$slots$nodeLoadin2 = (_ctx$slots = ctx.slots).nodeLoading) === null || _ctx$slots$nodeLoadin2 === void 0 ? void 0 : _ctx$slots$nodeLoadin2.call(_ctx$slots, getScopedSlotData(item))) !== null && _ctx$slots$nodeLoadin !== void 0 ? _ctx$slots$nodeLoadin : isNodeLoading(item)) ? (0,external_vue_namespaceObject.createVNode)(external_icon_namespaceObject.Spinner, null, null) : '';
1388
+ };
1389
+ /**
1390
+ * 根据节点状态获取节点操作Icon
1391
+ * @param item
1392
+ * @returns
1393
+ */
1394
+ var getActionIcon = function getActionIcon(item) {
1395
+ if (ctx.slots.nodeAction) {
1396
+ return ctx.slots.nodeAction(getScopedSlotData(item));
1397
+ }
1398
+ var prefixFnVal = null;
1399
+ if (isNodeLoading(item)) {
1400
+ return getLoadingIcon(item);
1401
+ }
1402
+ if (typeof props.prefixIcon === 'function') {
1403
+ prefixFnVal = props.prefixIcon(getScopedSlotData(item), 'node_action');
1404
+ if (prefixFnVal !== 'default') {
1405
+ return renderPrefixVal(prefixFnVal);
1406
+ }
1407
+ }
1408
+ if (prefixFnVal === 'default' || typeof props.prefixIcon === 'boolean' && props.prefixIcon) {
1409
+ if (hasChildNode(item) || item.async || !props.autoCheckChildren) {
1410
+ return isItemOpen(item) ? (0,external_vue_namespaceObject.createVNode)(external_icon_namespaceObject.DownShape, {
1411
+ "class": resolveClassName('node-prefix')
1412
+ }, null) : (0,external_vue_namespaceObject.createVNode)(external_icon_namespaceObject.RightShape, {
1413
+ "class": resolveClassName('node-prefix')
1414
+ }, null);
1415
+ }
1416
+ }
1417
+ return null;
1418
+ };
1419
+ /**
1420
+ * 获取节点类型Icon
1421
+ * @param item
1422
+ * @returns
1423
+ */
1424
+ var getNodePrefixIcon = function getNodePrefixIcon(item) {
1425
+ if (!props.showNodeTypeIcon) {
1426
+ return null;
1427
+ }
1428
+ if (ctx.slots.nodeType) {
1429
+ return ctx.slots.nodeType(getScopedSlotData(item));
1430
+ }
1431
+ var prefixFnVal = null;
1432
+ if (typeof props.prefixIcon === 'function') {
1433
+ prefixFnVal = props.prefixIcon(getScopedSlotData(item), 'node_type');
1434
+ if (prefixFnVal !== 'default') {
1435
+ return renderPrefixVal(prefixFnVal);
1436
+ }
1437
+ }
1438
+ if (prefixFnVal === 'default' || typeof props.prefixIcon === 'boolean' && props.prefixIcon) {
1439
+ return isRootNode(item) || hasChildNode(item) ? getRootIcon(item) : (0,external_vue_namespaceObject.createVNode)(external_icon_namespaceObject.TextFile, {
1440
+ "class": [resolveClassName('tree-icon'), resolveClassName('node-prefix')]
1441
+ }, null);
1442
+ }
1443
+ return null;
1444
+ };
1445
+ var updateParentChecked = function updateParentChecked(item, isChecked) {
1446
+ var parent = getParentNode(item);
1447
+ if (parent) {
1448
+ var isNeedChecked = isChecked ? isChecked : (getChildNodes(parent) || []).some(function (node) {
1449
+ return isNodeChecked(node);
1450
+ });
1451
+ setNodeAttr(parent, NODE_ATTRIBUTES.IS_CHECKED, isNeedChecked);
1452
+ setNodeAttr(parent, NODE_ATTRIBUTES.IS_INDETERMINATE, (getChildNodes(parent) || []).some(function (node) {
1453
+ return !isNodeChecked(node);
1454
+ }));
1455
+ if (!isRootNode(parent)) {
1456
+ updateParentChecked(parent, isChecked);
1457
+ }
1458
+ }
1459
+ };
1460
+ var deepUpdateChildNode = function deepUpdateChildNode(node, attr, value) {
1461
+ getChildNodes(node).forEach(function (chid) {
1462
+ if (Array.isArray(attr)) {
1463
+ attr.forEach(function (val, index) {
1464
+ setNodeAttr(chid, val, value[index]);
1465
+ });
1466
+ } else {
1467
+ setNodeAttr(chid, attr, value);
1468
+ }
1469
+ deepUpdateChildNode(chid, attr, value);
1470
+ });
1471
+ };
1472
+ var handleNodeItemCheckboxChange = function handleNodeItemCheckboxChange(item, value) {
1473
+ setNodeAttr(item, NODE_ATTRIBUTES.IS_CHECKED, !!value);
1474
+ deepUpdateChildNode(item, [NODE_ATTRIBUTES.IS_CHECKED, NODE_ATTRIBUTES.IS_INDETERMINATE], [!!value, false]);
1475
+ updateParentChecked(item, value);
1476
+ ctx.emit(EVENTS.NODE_CHECKED, flatData.data.filter(function (t) {
1477
+ return isNodeChecked(t);
1478
+ }), flatData.data.filter(function (t) {
1479
+ return isIndeterminate(t);
1480
+ }));
1481
+ };
1482
+ var isIndeterminate = function isIndeterminate(item) {
1483
+ return isNodeChecked(item) && getNodeAttr(item, NODE_ATTRIBUTES.IS_INDETERMINATE);
1484
+ };
1485
+ var getCheckboxRender = function getCheckboxRender(item) {
1486
+ if (!props.showCheckbox) {
1487
+ return null;
1488
+ }
1489
+ return (0,external_vue_namespaceObject.createVNode)(external_checkbox_namespaceObject["default"], {
1490
+ "size": "small",
1491
+ "modelValue": isNodeChecked(item),
1492
+ "indeterminate": isIndeterminate(item),
1493
+ "onChange": function onChange(val) {
1494
+ return handleNodeItemCheckboxChange(item, !!val);
1495
+ }
1496
+ }, null);
1497
+ };
1498
+ /**
1499
+ * 设置指定节点是否展开
1500
+ * @param item
1501
+ * @param isOpen
1502
+ */
1503
+ var setNodeOpened = function setNodeOpened(item) {
1504
+ var isOpen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1505
+ var e = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1506
+ var fireEmit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
1507
+ var newVal = isOpen === null ? !isItemOpen(item) : !!isOpen;
1508
+ /**
1509
+ * 在收起节点时需要重置当前节点的所有叶子节点状态为 __isOpen = false
1510
+ * 如果是需要点击当前节点展开所有叶子节点此处也可以打开
1511
+ */
1512
+ if (!newVal) {
1513
+ deepUpdateChildNode(item, NODE_ATTRIBUTES.IS_OPEN, newVal);
1514
+ }
1515
+ setNodeAttr(item, NODE_ATTRIBUTES.IS_OPEN, newVal);
1516
+ if (fireEmit) {
1517
+ var emitEvent = isItemOpen(item) ? EVENTS.NODE_EXPAND : EVENTS.NODE_COLLAPSE;
1518
+ ctx.emit(emitEvent, item, resolveScopedSlotParam(item), getSchemaVal(item), e);
1519
+ }
1520
+ };
1521
+ /**
1522
+ * 设置指定节点行为 checked isOpen
1523
+ * @param args
1524
+ * @param action
1525
+ * @param value
1526
+ * @returns
1527
+ */
1528
+ var setNodeAction = function setNodeAction(args, action, value) {
1529
+ if (Array.isArray(args)) {
1530
+ args.forEach(function (node) {
1531
+ return setNodeAttr(resolveNodeItem(node), action, value);
1532
+ });
1533
+ return;
1534
+ }
1535
+ setNodeAttr(resolveNodeItem(args), action, value);
1536
+ };
1537
+ /**
1538
+ * 指定节点展开
1539
+ * @param item 节点数据 | Node Id
1540
+ * @param isOpen 是否展开
1541
+ * @param autoOpenParents 如果是 isOpen = true,是否自动设置所有父级展开
1542
+ * @returns
1543
+ */
1544
+ var setOpen = function setOpen(item) {
1545
+ var isOpen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1546
+ var autoOpenParents = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1547
+ setNodeAttribute(item, NODE_ATTRIBUTES.IS_OPEN, isOpen, autoOpenParents && isOpen);
1548
+ };
1549
+ /**
1550
+ * 递归处理当前节点以及父级节点属性值
1551
+ * @param node 指定节点
1552
+ * @param attrName 属性名称
1553
+ * @param value 属性值
1554
+ * @param loopParent 是否需要递归更新父级
1555
+ */
1556
+ var setNodeAttribute = function setNodeAttribute(node, attrName, value) {
1557
+ var loopParent = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
1558
+ var resolvedItem = resolveNodeItem(node);
1559
+ if (resolvedItem[NODE_ATTRIBUTES.IS_NULL]) {
1560
+ return;
1561
+ }
1562
+ var attrNames = Array.isArray(attrName) ? attrName : [attrName];
1563
+ var values = Array.isArray(value) ? value : [value];
1564
+ if (loopParent) {
1565
+ attrNames.forEach(function (name, index) {
1566
+ return setNodeAction(resolvedItem, name, values[index]);
1567
+ });
1568
+ if (!isRootNode(resolvedItem)) {
1569
+ var parent = getParentNode(resolvedItem);
1570
+ attrNames.forEach(function (name, index) {
1571
+ var parentVal = getNodeAttr(parent, name);
1572
+ if (parentVal !== value) {
1573
+ setNodeAttribute(parent, name, values[index], loopParent);
1574
+ }
1575
+ });
1576
+ }
1577
+ } else {
1578
+ attrNames.forEach(function (name, index) {
1579
+ return setNodeAction(resolvedItem, name, values[index]);
1580
+ });
1581
+ }
1582
+ };
1583
+ /**
1584
+ * 节点点击
1585
+ * @param item
1586
+ */
1587
+ var handleTreeNodeClick = function handleTreeNodeClick(item, e) {
1588
+ var isOpen = isItemOpen(item);
1589
+ if (isOpen) {
1590
+ setNodeOpened(item, false, e);
1591
+ return;
1592
+ }
1593
+ /** 如果是异步请求加载 */
1594
+ asyncNodeClick(item)["finally"](function () {
1595
+ if (getNodeAttr(item, NODE_ATTRIBUTES.IS_LOADING)) {
1596
+ registerNextLoop('setNodeOpenedAfterLoading', {
1597
+ type: 'once',
1598
+ fn: function fn() {
1599
+ return setNodeOpened(item, true, e);
1600
+ }
1601
+ });
1602
+ } else {
1603
+ setNodeOpened(item, true, e);
1604
+ }
1605
+ });
1606
+ };
1607
+ /**
1608
+ * 点击树形节点展开、收起图标处理事件
1609
+ * @param e 鼠标事件
1610
+ * @param node 当前节点
1611
+ */
1612
+ var handleNodeActionClick = function handleNodeActionClick(e, node) {
1613
+ e.stopImmediatePropagation();
1614
+ e.stopPropagation();
1615
+ e.preventDefault();
1616
+ handleTreeNodeClick(node, e);
1617
+ };
1618
+ var setSelect = function setSelect(nodes) {
1619
+ var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1620
+ var autoOpen = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
1621
+ var nodeList = Array.isArray(nodes) ? nodes : [nodes];
1622
+ if (!nodeList.length) {
1623
+ return;
1624
+ }
1625
+ var resolvedItem = resolveNodeItem(nodeList[0]);
1626
+ if (typeof resolvedItem === 'string' || typeof resolvedItem === 'number' || _typeof(resolvedItem) === 'symbol') {
1627
+ var _flatData$data$find;
1628
+ resolvedItem = (_flatData$data$find = flatData.data.find(function (item) {
1629
+ return getNodeId(item) === resolvedItem;
1630
+ })) !== null && _flatData$data$find !== void 0 ? _flatData$data$find : _defineProperty({}, NODE_ATTRIBUTES.IS_NULL, true);
1631
+ }
1632
+ if (resolvedItem[NODE_ATTRIBUTES.IS_NULL]) {
1633
+ return;
1634
+ }
1635
+ if (!props.selectable || typeof props.selectable === 'function' && !props.selectable(nodes) || props.disabledFolderSelectable && resolvedItem.is_folder === true) {
1636
+ console.warn('props.selectable is false or undefined, please set selectable with true');
1637
+ return;
1638
+ }
1639
+ if (selectedNodeId !== null && selectedNodeId !== undefined) {
1640
+ setNodeAttrById(selectedNodeId, NODE_ATTRIBUTES.IS_SELECTED, !selected);
1641
+ }
1642
+ if (props.selected && props.selected !== selectedNodeId) {
1643
+ setNodeAttrById(props.selected, NODE_ATTRIBUTES.IS_SELECTED, !selected);
1644
+ }
1645
+ setNodeAttr(resolvedItem, NODE_ATTRIBUTES.IS_SELECTED, selected);
1646
+ selectedNodeId = getNodeId(resolvedItem);
1647
+ /**
1648
+ * 如果设置了自动展开
1649
+ * 判定长度是为了处理异步节点,如果当前设置selected的节点为多级异步节点
1650
+ * 此时需要一层一层展开所有数据,只需要在最后一次执行setOpen即可
1651
+ */
1652
+ if (autoOpen && nodeList.length === 1) {
1653
+ setOpen(resolvedItem, true, true);
1654
+ }
1655
+ /**
1656
+ * 处理异步节点多层级展开选中
1657
+ */
1658
+ if (getNodeAttr(resolvedItem, NODE_ATTRIBUTES.IS_ASYNC)) {
1659
+ asyncNodeClick(resolvedItem).then(function () {
1660
+ (0,external_vue_namespaceObject.nextTick)(function () {
1661
+ nodeList.shift();
1662
+ setSelect(nodeList, selected, autoOpen);
1663
+ });
1664
+ });
1665
+ }
1666
+ };
1667
+ var resolveNodeAction = function resolveNodeAction(node) {
1668
+ if (typeof props.nodeContentAction === 'function') {
1669
+ return Reflect.apply(props.nodeContentAction, use_node_action_this, [{
1670
+ node: node
1671
+ }]);
1672
+ }
1673
+ if (typeof props.nodeContentAction === 'string') {
1674
+ return [props.nodeContentAction];
1675
+ }
1676
+ if (Array.isArray(props.nodeContentAction)) {
1677
+ return props.nodeContentAction;
1678
+ }
1679
+ return ['selected', 'expand', 'click'];
1680
+ };
1681
+ /**
1682
+ * 点击节点事件
1683
+ * @param item
1684
+ */
1685
+ var handleNodeContentClick = function handleNodeContentClick(item, e) {
1686
+ var nodeActions = resolveNodeAction(item);
1687
+ if (nodeActions.includes('selected')) {
1688
+ setSelect(item, true, false);
1689
+ }
1690
+ if (nodeActions.includes('expand')) {
1691
+ if (!isNodeOpened(item)) {
1692
+ handleTreeNodeClick(item, e);
1693
+ }
1694
+ }
1695
+ if (nodeActions.includes('collapse')) {
1696
+ if (isNodeOpened(item)) {
1697
+ handleTreeNodeClick(item, e);
1698
+ }
1699
+ }
1700
+ if (nodeActions.includes('click')) {
1701
+ var eventName = EVENTS.NODE_CLICK;
1702
+ ctx.emit(eventName, item, resolveScopedSlotParam(item), getSchemaVal(item), e);
1703
+ }
1704
+ };
1705
+ /**
1706
+ * 用于判定当前节点需要展示的连线
1707
+ * 当前指定的depth需不需要展示连线
1708
+ * @param depth 当前需要判定的depth
1709
+ * @param node 当前节点
1710
+ * @returns
1711
+ */
1712
+ var filterNextNode = function filterNextNode(depth, node) {
1713
+ if (isRootNode(node)) {
1714
+ return false;
1715
+ }
1716
+ var nodepath = getNodePath(node);
1717
+ var paths = "".concat(nodepath).split('-').slice(0, depth + 1);
1718
+ var currentPath = paths.join('-');
1719
+ // 如果是判定当前节点,则必须要有一条线
1720
+ if (currentPath === nodepath) {
1721
+ return true;
1722
+ }
1723
+ var lastLevel = paths.pop();
1724
+ var nextLevel = parseInt(lastLevel, 10);
1725
+ paths.push("".concat(nextLevel + 1));
1726
+ var nextNodePath = paths.join('-');
1727
+ return flatData.data.some(function (val) {
1728
+ return getNodePath(val) === nextNodePath;
1729
+ });
1730
+ };
1731
+ /**
1732
+ * 获取层级连线
1733
+ * @param node 节点
1734
+ * @returns
1735
+ */
1736
+ var getVirtualLines = function getVirtualLines(node) {
1737
+ if (!props.levelLine) {
1738
+ return null;
1739
+ }
1740
+ var getNodeLineStyle = function getNodeLineStyle(dpth) {
1741
+ return {
1742
+ '--depth': dpth
1743
+ };
1744
+ };
1745
+ var maxDeep = getNodeAttr(node, NODE_ATTRIBUTES.DEPTH) + 1;
1746
+ return new Array(maxDeep).fill('').map(function (_, index) {
1747
+ return index;
1748
+ }).filter(function (depth) {
1749
+ return filterNextNode(depth, node);
1750
+ }).filter(function (depth) {
1751
+ return depth > 0;
1752
+ })
1753
+ // @ts-ignore:next-line
1754
+ .map(function (index) {
1755
+ return (0,external_vue_namespaceObject.createVNode)("span", {
1756
+ "class": "node-virtual-line",
1757
+ "style": getNodeLineStyle(maxDeep - index)
1758
+ }, null);
1759
+ });
1760
+ };
1761
+ var renderNodeSlots = function renderNodeSlots(item) {
1762
+ if (ctx.slots.node) {
1763
+ var _ctx$slots$node, _ctx$slots2;
1764
+ return (_ctx$slots$node = (_ctx$slots2 = ctx.slots).node) === null || _ctx$slots$node === void 0 ? void 0 : _ctx$slots$node.call(_ctx$slots2, getScopedSlotData(item));
1765
+ }
1766
+ if (ctx.slots["default"]) {
1767
+ var _ctx$slots$default, _ctx$slots3;
1768
+ return (_ctx$slots$default = (_ctx$slots3 = ctx.slots)["default"]) === null || _ctx$slots$default === void 0 ? void 0 : _ctx$slots$default.call(_ctx$slots3, extendNodeScopedData(item));
1769
+ }
1770
+ return [getLabel(item, props)];
1771
+ };
1772
+ var getScopedSlotData = function getScopedSlotData(item) {
1773
+ if (props.keepSlotData) {
1774
+ return extendNodeScopedData(item);
1775
+ }
1776
+ return extendNodeAttr(item);
1777
+ };
1778
+ /**
1779
+ * 渲染节点函数
1780
+ * @param item 当前节点
1781
+ * @param showTree 是否展示为树形结构
1782
+ */
1783
+ var renderTreeNode = function renderTreeNode(item) {
1784
+ var _ctx$slots$nodeAppend, _ctx$slots4;
1785
+ var showTree = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1786
+ return (0,external_vue_namespaceObject.createVNode)("div", {
1787
+ "data-tree-node": getNodeId(item),
1788
+ "key": getNodeId(item),
1789
+ "class": getNodeRowClass(item, flatData.schema)
1790
+ }, [(0,external_vue_namespaceObject.createVNode)("div", {
1791
+ "class": getNodeItemClass(item, flatData.schema, props, showTree),
1792
+ "style": getNodeItemStyle(item, props, flatData, showTree),
1793
+ "onClick": function onClick(e) {
1794
+ return handleNodeContentClick(item, e);
1795
+ }
1796
+ }, [(0,external_vue_namespaceObject.createVNode)("div", {
1797
+ "class": [resolveClassName('node-action')],
1798
+ "onClick": function onClick(e) {
1799
+ return handleNodeActionClick(e, item);
1800
+ }
1801
+ }, [getActionIcon(item)]), (0,external_vue_namespaceObject.createVNode)("div", {
1802
+ "class": resolveClassName('node-content')
1803
+ }, [[getCheckboxRender(item), getNodePrefixIcon(item)], (0,external_vue_namespaceObject.createVNode)("span", {
1804
+ "class": resolveClassName('node-text')
1805
+ }, [renderNodeSlots(item)]), (_ctx$slots$nodeAppend = (_ctx$slots4 = ctx.slots).nodeAppend) === null || _ctx$slots$nodeAppend === void 0 ? void 0 : _ctx$slots$nodeAppend.call(_ctx$slots4, getScopedSlotData(item))]), showTree && getVirtualLines(item)])]);
1806
+ };
1807
+ return {
1808
+ renderTreeNode: renderTreeNode,
1809
+ handleTreeNodeClick: handleTreeNodeClick,
1810
+ deepAutoOpen: deepAutoOpen,
1811
+ asyncNodeClick: asyncNodeClick,
1812
+ setNodeAction: setNodeAction,
1813
+ setNodeOpened: setNodeOpened,
1814
+ setSelect: setSelect,
1815
+ setOpen: setOpen,
1816
+ setNodeAttribute: setNodeAttribute
1817
+ };
1818
+ });
1819
+ ;// CONCATENATED MODULE: ../../packages/tree/src/use-node-drag.tsx
1820
+ var use_node_drag_this = undefined;
1821
+ /*
1822
+ * Tencent is pleased to support the open source community by making
1823
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
1824
+ *
1825
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1826
+ *
1827
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
1828
+ *
1829
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
1830
+ *
1831
+ * ---------------------------------------------------
1832
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1833
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1834
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1835
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1836
+ *
1837
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1838
+ * the Software.
1839
+ *
1840
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1841
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1842
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1843
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1844
+ * IN THE SOFTWARE.
1845
+ */
1846
+
1847
+
1848
+
1849
+
1850
+ /* harmony default export */ const use_node_drag = (function (props, ctx, root, flatData) {
1851
+ var _useNodeAttribute = use_node_attribute(flatData, props),
1852
+ getSourceNodeByUID = _useNodeAttribute.getSourceNodeByUID,
1853
+ getParentNodeData = _useNodeAttribute.getParentNodeData,
1854
+ getNodeParentIdById = _useNodeAttribute.getNodeParentIdById,
1855
+ extendNodeAttr = _useNodeAttribute.extendNodeAttr,
1856
+ getNodeAttrById = _useNodeAttribute.getNodeAttrById,
1857
+ getNodePathById = _useNodeAttribute.getNodePathById,
1858
+ isRootNode = _useNodeAttribute.isRootNode;
1859
+ var _usePrefix = (0,external_config_provider_namespaceObject.usePrefix)(),
1860
+ resolveClassName = _usePrefix.resolveClassName;
1861
+ var isNeedCheckDraggable = (0,external_vue_namespaceObject.computed)(function () {
1862
+ return typeof props.disableDrag === 'function';
1863
+ });
1864
+ var isNeedCheckDroppable = (0,external_vue_namespaceObject.computed)(function () {
1865
+ return typeof props.disableDrop === 'function';
1866
+ });
1867
+ var dragNodeId = '';
1868
+ var getTargetTreeNode = function getTargetTreeNode(e) {
1869
+ var target = e.target;
1870
+ return target.closest('[data-tree-node]');
1871
+ };
1872
+ var getNodeByTargetTreeNode = function getNodeByTargetTreeNode(targetNode) {
1873
+ var _targetNode$dataset;
1874
+ var uid = targetNode === null || targetNode === void 0 || (_targetNode$dataset = targetNode.dataset) === null || _targetNode$dataset === void 0 ? void 0 : _targetNode$dataset.treeNode;
1875
+ return getSourceNodeByUID(uid);
1876
+ };
1877
+ var handleTreeNodeMouseup = function handleTreeNodeMouseup(e) {
1878
+ var targetNode = getTargetTreeNode(e);
1879
+ targetNode.removeEventListener('mouseup', handleTreeNodeMouseup);
1880
+ };
1881
+ var handleTreeNodeMousedown = function handleTreeNodeMousedown(e) {
1882
+ var targetNode = getTargetTreeNode(e);
1883
+ var data = getNodeByTargetTreeNode(targetNode);
1884
+ if (data.draggable === false || isNeedCheckDraggable.value && props.disableDrag(data)) {
1885
+ targetNode.classList.add("".concat(resolveClassName('tree-drag-disabled')));
1886
+ return;
1887
+ }
1888
+ targetNode.setAttribute('draggable', 'true');
1889
+ targetNode.addEventListener('mouseup', handleTreeNodeMouseup);
1890
+ };
1891
+ var handleTreeNodeDragover = function handleTreeNodeDragover(e) {
1892
+ e.preventDefault();
1893
+ var targetNode = getTargetTreeNode(e);
1894
+ var data = extendNodeAttr(getNodeByTargetTreeNode(targetNode));
1895
+ ctx.emit(EVENTS.NODE_DRAG_OVER, e, targetNode, data);
1896
+ if (isNeedCheckDroppable.value && props !== null && props !== void 0 && props.disableDrop(data)) {
1897
+ e.dataTransfer.effectAllowed = 'move';
1898
+ e.dataTransfer.dropEffect = 'none';
1899
+ targetNode.classList.add("".concat(resolveClassName('tree-drop-disabled')));
1900
+ return;
1901
+ }
1902
+ targetNode.classList.add("".concat(resolveClassName('tree-drop-active')));
1903
+ var sourceNodeId = e.dataTransfer.getData('node-id');
1904
+ sourceNodeId = dragNodeId;
1905
+ var targetNodeId = targetNode.getAttribute('data-tree-node');
1906
+ var transferEffect = isNodeSortable(sourceNodeId, targetNodeId) ? 'move' : 'none';
1907
+ e.dataTransfer.effectAllowed = transferEffect;
1908
+ e.dataTransfer.dropEffect = transferEffect;
1909
+ };
1910
+ var handleTreeNodeDragStart = function handleTreeNodeDragStart(e) {
1911
+ e.dataTransfer.effectAllowed = 'move';
1912
+ e.dataTransfer.dropEffect = 'move';
1913
+ var targetNode = getTargetTreeNode(e);
1914
+ e.dataTransfer.setData('text/plain', '');
1915
+ var nodeId = targetNode.getAttribute('data-tree-node');
1916
+ dragNodeId = nodeId;
1917
+ e.dataTransfer.setData('node-id', nodeId);
1918
+ ctx.emit(EVENTS.NODE_DRAG_START, e, targetNode);
1919
+ };
1920
+ var handleTreeNodeDrop = function handleTreeNodeDrop(e) {
1921
+ /** firefox的drop事件必须调用preventDefault()和stopPropagation(), 否则会自动重定向 */
1922
+ e.preventDefault();
1923
+ e.stopPropagation();
1924
+ var targetNode = getTargetTreeNode(e);
1925
+ targetNode.classList.remove("".concat(resolveClassName('tree-drop-active')), "".concat(resolveClassName('tree-drop-disabled')));
1926
+ var data = extendNodeAttr(getNodeByTargetTreeNode(targetNode));
1927
+ if (isNeedCheckDroppable.value && props.disableDrop(data)) {
1928
+ return;
1929
+ }
1930
+ var sourceNodeId = dragNodeId; // e.dataTransfer.getData('node-id');
1931
+ var targetNodeId = targetNode.getAttribute('data-tree-node');
1932
+ Reflect.apply(props.dragSort ? dragSortData : dragAsChildNode, use_node_drag_this, [sourceNodeId, targetNodeId]);
1933
+ ctx.emit(EVENTS.NODE_DROP, e, targetNode, data);
1934
+ };
1935
+ var isNodeSortable = function isNodeSortable(sourceId, targetId) {
1936
+ var sourcePath = getNodePathById(sourceId);
1937
+ var targetPath = getNodePathById(targetId);
1938
+ // if (!sourcePath || targetPath) {
1939
+ // return false;
1940
+ // }
1941
+ var sourceParentNodeId = getNodeParentIdById(sourceId);
1942
+ var targetParentNode = getNodeParentIdById(targetId);
1943
+ if (sourceParentNodeId === targetParentNode) {
1944
+ return true;
1945
+ }
1946
+ return sourcePath.indexOf(targetPath) === -1 && targetPath.indexOf(sourcePath) === -1;
1947
+ };
1948
+ var dragSortData = function dragSortData(sourceId, targetId) {
1949
+ if (!isNodeSortable(sourceId, targetId)) {
1950
+ return;
1951
+ }
1952
+ var sourceNodeData = JSON.parse(JSON.stringify(getSourceNodeByUID(sourceId)));
1953
+ var targetNodeData = JSON.parse(JSON.stringify(getSourceNodeByUID(targetId)));
1954
+ var sourceNodeParent = getParentNodeData(sourceId);
1955
+ var targetNodeParent = getParentNodeData(targetId);
1956
+ var sourceNodeIndex = getNodeAttrById(sourceId, NODE_ATTRIBUTES.INDEX);
1957
+ var targetNodeIndex = getNodeAttrById(targetId, NODE_ATTRIBUTES.INDEX);
1958
+ sourceNodeParent === null || sourceNodeParent === void 0 ? void 0 : sourceNodeParent[props.children].splice(sourceNodeIndex, 1, targetNodeData);
1959
+ targetNodeParent === null || targetNodeParent === void 0 ? void 0 : targetNodeParent[props.children].splice(targetNodeIndex, 1, sourceNodeData);
1960
+ };
1961
+ var dragAsChildNode = function dragAsChildNode(sourceNodeId, targetNodeId) {
1962
+ var sourceNodeData = getSourceNodeByUID(sourceNodeId);
1963
+ var targetNodeData = getSourceNodeByUID(targetNodeId);
1964
+ var parentNode = null;
1965
+ if (isRootNode(sourceNodeId)) {
1966
+ parentNode = props.data;
1967
+ } else {
1968
+ var sourceNodeParentId = getNodeParentIdById(sourceNodeId);
1969
+ if (sourceNodeParentId !== undefined && sourceNodeParentId !== null) {
1970
+ var _parentNode;
1971
+ parentNode = getSourceNodeByUID(sourceNodeParentId);
1972
+ var sourceNodeIndex = getNodeAttrById(sourceNodeId, NODE_ATTRIBUTES.INDEX);
1973
+ (_parentNode = parentNode) === null || _parentNode === void 0 ? void 0 : _parentNode[props.children].splice(sourceNodeIndex, 1);
1974
+ }
1975
+ }
1976
+ if (!targetNodeData[props.children]) {
1977
+ targetNodeData[props.children] = [];
1978
+ }
1979
+ targetNodeData[props.children].unshift(sourceNodeData);
1980
+ };
1981
+ var handleTreeNodeDragLeave = function handleTreeNodeDragLeave(e) {
1982
+ e.preventDefault();
1983
+ var targetNode = getTargetTreeNode(e);
1984
+ targetNode.classList.remove("".concat(resolveClassName('tree-drop-active')), "".concat(resolveClassName('tree-drop-disabled')));
1985
+ ctx.emit(EVENTS.NODE_DRAG_LEAVE, e, targetNode);
1986
+ };
1987
+ (0,external_vue_namespaceObject.onMounted)(function () {
1988
+ if (props.draggable && root.value) {
1989
+ var rootTree = root.value.$el;
1990
+ rootTree.addEventListener('mousedown', handleTreeNodeMousedown);
1991
+ rootTree.addEventListener('dragstart', handleTreeNodeDragStart);
1992
+ rootTree.addEventListener('dragover', handleTreeNodeDragover);
1993
+ rootTree.addEventListener('dragleave', handleTreeNodeDragLeave);
1994
+ rootTree.addEventListener('drop', handleTreeNodeDrop);
1995
+ }
1996
+ });
1997
+ (0,external_vue_namespaceObject.onUnmounted)(function () {
1998
+ if (props.draggable && root.value) {
1999
+ var rootTree = root.value.$el;
2000
+ rootTree.removeEventListener('mousedown', handleTreeNodeMousedown);
2001
+ rootTree.removeEventListener('dragstart', handleTreeNodeDragStart);
2002
+ rootTree.removeEventListener('dragover', handleTreeNodeDragover);
2003
+ rootTree.removeEventListener('dragleave', handleTreeNodeDragLeave);
2004
+ rootTree.removeEventListener('drop', handleTreeNodeDrop);
2005
+ }
2006
+ });
2007
+ });
2008
+ ;// CONCATENATED MODULE: ../../packages/tree/src/use-search.tsx
2009
+
2010
+ var use_search_this = undefined;
2011
+ /*
2012
+ * Tencent is pleased to support the open source community by making
2013
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
2014
+ *
2015
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
2016
+ *
2017
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
2018
+ *
2019
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
2020
+ *
2021
+ * ---------------------------------------------------
2022
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
2023
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
2024
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
2025
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2026
+ *
2027
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
2028
+ * the Software.
2029
+ *
2030
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
2031
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2032
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
2033
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2034
+ * IN THE SOFTWARE.
2035
+ */
2036
+
2037
+ /* harmony default export */ const use_search = (function (props) {
2038
+ var _props$search;
2039
+ var refSearch = (0,external_vue_namespaceObject.toRef)(props, 'search');
2040
+ var _ref = (_props$search = props.search) !== null && _props$search !== void 0 ? _props$search : {},
2041
+ _ref$resultType = _ref.resultType,
2042
+ resultType = _ref$resultType === void 0 ? 'tree' : _ref$resultType,
2043
+ _ref$showChildNodes = _ref.showChildNodes,
2044
+ showChildNodes = _ref$showChildNodes === void 0 ? true : _ref$showChildNodes;
2045
+ var isCommonType = function isCommonType(val) {
2046
+ return ['string', 'number', 'boolean'].includes(_typeof(val));
2047
+ };
2048
+ var exactMath = function exactMath(matchValue, itemValue) {
2049
+ return matchValue === itemValue;
2050
+ };
2051
+ var regMatch = function regMatch(matchValue, itemValue) {
2052
+ return new RegExp("".concat(matchValue), 'i').test("".concat(itemValue));
2053
+ };
2054
+ var matchFn = function matchFn(match, args) {
2055
+ return Reflect.apply(match, use_search_this, args);
2056
+ };
2057
+ var isSearchDisabled = refSearch.value === undefined || refSearch.value === false;
2058
+ var searchFn = function searchFn(itemValue, item) {
2059
+ if (isSearchDisabled) {
2060
+ return true;
2061
+ }
2062
+ if (isCommonType(refSearch.value)) {
2063
+ if ("".concat(refSearch.value).length === 0) {
2064
+ return false;
2065
+ }
2066
+ return matchFn(regMatch, [refSearch.value, itemValue, item]);
2067
+ }
2068
+ var _refSearch$value = refSearch.value,
2069
+ _refSearch$value$valu = _refSearch$value.value,
2070
+ value = _refSearch$value$valu === void 0 ? '' : _refSearch$value$valu,
2071
+ _refSearch$value$matc = _refSearch$value.match,
2072
+ match = _refSearch$value$matc === void 0 ? 'fuzzy' : _refSearch$value$matc;
2073
+ var defultMatch = match === 'fuzzy' ? regMatch : exactMath;
2074
+ var matchCallback = typeof match === 'function' ? match : defultMatch;
2075
+ if ("".concat(value).length === 0) {
2076
+ return false;
2077
+ }
2078
+ return matchFn(matchCallback, [value, itemValue, item]);
2079
+ };
2080
+ var isSearchActive = (0,external_vue_namespaceObject.computed)(function () {
2081
+ if (refSearch.value === false) {
2082
+ return false;
2083
+ }
2084
+ if (isCommonType(refSearch.value)) {
2085
+ return "".concat(refSearch.value).length > 0;
2086
+ }
2087
+ var _refSearch$value$valu2 = refSearch.value.value,
2088
+ value = _refSearch$value$valu2 === void 0 ? '' : _refSearch$value$valu2;
2089
+ return "".concat(value).length > 0;
2090
+ });
2091
+ /**
2092
+ * 索索结果展示为Tree
2093
+ */
2094
+ var isTreeUI = (0,external_vue_namespaceObject.computed)(function () {
2095
+ return resultType === 'tree';
2096
+ });
2097
+ return {
2098
+ searchFn: searchFn,
2099
+ refSearch: refSearch,
2100
+ isSearchActive: isSearchActive,
2101
+ isSearchDisabled: isSearchDisabled,
2102
+ resultType: resultType,
2103
+ isTreeUI: isTreeUI,
2104
+ showChildNodes: showChildNodes
2105
+ };
2106
+ });
2107
+ // EXTERNAL MODULE: ../../node_modules/uuid/index.js
2108
+ var uuid = __webpack_require__(8022);
2109
+ ;// CONCATENATED MODULE: ../../packages/tree/src/use-tree-init.tsx
2110
+
2111
+
2112
+ var use_tree_init_this = undefined;
2113
+ /*
2114
+ * Tencent is pleased to support the open source community by making
2115
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
2116
+ *
2117
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
2118
+ *
2119
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
2120
+ *
2121
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
2122
+ *
2123
+ * ---------------------------------------------------
2124
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
2125
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
2126
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
2127
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2128
+ *
2129
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
2130
+ * the Software.
2131
+ *
2132
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
2133
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2134
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
2135
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2136
+ * IN THE SOFTWARE.
2137
+ */
2138
+
2139
+
2140
+
2141
+
2142
+
2143
+ /* harmony default export */ const use_tree_init = (function (props) {
2144
+ var _props$async3;
2145
+ /**
2146
+ * 扁平化当前数据
2147
+ * @param treeData 树形结构数据
2148
+ * @param cachedSchema 缓存数据
2149
+ * @returns
2150
+ */
2151
+ var getFlatdata = function getFlatdata() {
2152
+ var _cachedDefaultVal;
2153
+ var treeData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
2154
+ var cachedSchema = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
2155
+ var data = props.data,
2156
+ children = props.children;
2157
+ var checkedList = [];
2158
+ var outputData = [];
2159
+ var order = 0;
2160
+ var treeSchema = new WeakMap();
2161
+ /**
2162
+ * 递归更新节点属性
2163
+ * @param node 当前节点
2164
+ * @param attrName 需要更新的节点属性名称
2165
+ * @param attrValue 需要更新的节点属性值
2166
+ * @param callFn 回调函数
2167
+ * @returns
2168
+ */
2169
+ function loopUpdateNodeAttr(node, attrName, attrValue, callFn) {
2170
+ if (node === undefined || node === null) {
2171
+ return;
2172
+ }
2173
+ if (treeSchema.has(node)) {
2174
+ var target = treeSchema.get(node);
2175
+ if (Object.prototype.hasOwnProperty.call(target, attrName)) {
2176
+ if (typeof callFn === 'function' && Reflect.apply(callFn, self, [target, attrName, attrValue, node])) {
2177
+ Object.assign(target, _defineProperty({}, attrName, attrValue));
2178
+ loopUpdateNodeAttr(target[NODE_ATTRIBUTES.PARENT], attrName, attrValue, callFn);
2179
+ }
2180
+ }
2181
+ }
2182
+ }
2183
+ function getUid(item) {
2184
+ var uid = null;
2185
+ if (typeof props.nodeKey === 'string') {
2186
+ uid = item[props.nodeKey] || (0,uuid.v4)();
2187
+ }
2188
+ return uid || item[NODE_ATTRIBUTES.UUID] || (0,uuid.v4)();
2189
+ }
2190
+ /**
2191
+ * 默认设置
2192
+ * 如果传入数据没有设置相关属性值
2193
+ * 这里会自动生成
2194
+ */
2195
+ var cachedDefaultVal = (_cachedDefaultVal = {}, _defineProperty(_cachedDefaultVal, NODE_ATTRIBUTES.IS_OPEN, function () {
2196
+ return !!props.expandAll;
2197
+ }), _defineProperty(_cachedDefaultVal, NODE_ATTRIBUTES.IS_CHECKED, function () {
2198
+ return false;
2199
+ }), _defineProperty(_cachedDefaultVal, NODE_ATTRIBUTES.IS_MATCH, function () {
2200
+ return false;
2201
+ }), _defineProperty(_cachedDefaultVal, NODE_ATTRIBUTES.IS_SELECTED, function (node, uuid) {
2202
+ return resolvePropIsMatched(node, props.selected, uuid);
2203
+ }), _defineProperty(_cachedDefaultVal, NODE_ATTRIBUTES.IS_CACHED, function () {
2204
+ return false;
2205
+ }), _defineProperty(_cachedDefaultVal, NODE_ATTRIBUTES.IS_ASYNC, function () {
2206
+ return null;
2207
+ }), _defineProperty(_cachedDefaultVal, NODE_ATTRIBUTES.IS_LOADING, function () {
2208
+ return false;
2209
+ }), _cachedDefaultVal);
2210
+ /**
2211
+ * 根据Props设置和已缓存数据解析当前节点对应属性值
2212
+ * @param uuid 当前节点id
2213
+ * @param node 当前节点
2214
+ * @param cachedAttr 当前节点属性名称
2215
+ * @param defVal 默认值
2216
+ */
2217
+ function getCachedTreeNodeAttr(uuid, node, cachedAttr) {
2218
+ var _cachedSchema$get;
2219
+ var defVal = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
2220
+ var defaultValue = defVal;
2221
+ // 设置默认值
2222
+ if (defVal === undefined && typeof cachedDefaultVal[cachedAttr] === 'function') {
2223
+ defaultValue = cachedDefaultVal[cachedAttr](node, uuid);
2224
+ }
2225
+ // 通过映射配置,检查当前数据是否设置相关属性值
2226
+ // 如果传入数据设置了相关属性值,则返回传入数据设置值
2227
+ var sourceAttr = NODE_SOURCE_ATTRS[cachedAttr];
2228
+ if (Object.prototype.hasOwnProperty.call(node, sourceAttr)) {
2229
+ return node[sourceAttr];
2230
+ }
2231
+ // 判断是缓存数据是否已经处理过此属性
2232
+ // 在数据改变时,如果缓存数据没有处理过此属性,则返回默认值
2233
+ var cached = (_cachedSchema$get = cachedSchema === null || cachedSchema === void 0 ? void 0 : cachedSchema.get(node)) !== null && _cachedSchema$get !== void 0 ? _cachedSchema$get : undefined;
2234
+ var result = undefined;
2235
+ if (cached) {
2236
+ result = cached[cachedAttr];
2237
+ }
2238
+ // 处理默认值
2239
+ if (result === undefined || result === null) {
2240
+ result = defaultValue;
2241
+ }
2242
+ return result;
2243
+ }
2244
+ /**
2245
+ * 当前节点是否是选中状态
2246
+ * @param uuid 当前节点id
2247
+ * @param node 当前节点
2248
+ * @returns
2249
+ */
2250
+ function isCachedTreeNodeSelected(uuid, node) {
2251
+ if (!props.selectable) {
2252
+ return false;
2253
+ }
2254
+ var isMatch = resolvePropIsMatched(node, props.selected, uuid);
2255
+ return getCachedTreeNodeAttr(uuid, node, NODE_ATTRIBUTES.IS_SELECTED, isMatch);
2256
+ }
2257
+ function isNodeOpend(uuid, item, parent) {
2258
+ var _treeSchema$get;
2259
+ var isItemOpened = getCachedTreeNodeAttr(uuid, item, NODE_ATTRIBUTES.IS_OPEN);
2260
+ var isParentOpened = treeSchema.has(parent) ? (_treeSchema$get = treeSchema.get(parent)) === null || _treeSchema$get === void 0 ? void 0 : _treeSchema$get[NODE_ATTRIBUTES.IS_OPEN] : true;
2261
+ return isItemOpened && isParentOpened;
2262
+ }
2263
+ function isCheckedNode(node, uuid) {
2264
+ if (!props.showCheckbox) {
2265
+ return false;
2266
+ }
2267
+ var isMatch = resolvePropIsMatched(node, props.checked, uuid);
2268
+ return getCachedTreeNodeAttr(uuid, node, NODE_ATTRIBUTES.IS_CHECKED, isMatch);
2269
+ }
2270
+ function validateIsOpenLoopFn(targetAttr) {
2271
+ var _targetAttr$NODE_ATTR;
2272
+ return !((_targetAttr$NODE_ATTR = targetAttr === null || targetAttr === void 0 ? void 0 : targetAttr[NODE_ATTRIBUTES.IS_OPEN]) !== null && _targetAttr$NODE_ATTR !== void 0 ? _targetAttr$NODE_ATTR : false);
2273
+ }
2274
+ function loopUpdateCheckedEvent(target, _attrName, _attrValue, node) {
2275
+ target[NODE_ATTRIBUTES.IS_INDETERMINATE] = (node[props.children] || []).some(function (child) {
2276
+ var _treeSchema$get$NODE_, _treeSchema$get2;
2277
+ return !((_treeSchema$get$NODE_ = (_treeSchema$get2 = treeSchema.get(child)) === null || _treeSchema$get2 === void 0 ? void 0 : _treeSchema$get2[NODE_ATTRIBUTES.IS_CHECKED]) !== null && _treeSchema$get$NODE_ !== void 0 ? _treeSchema$get$NODE_ : false);
2278
+ });
2279
+ return true;
2280
+ }
2281
+ function flatten(array) {
2282
+ var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2283
+ var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
2284
+ var path = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
2285
+ var arrLength = array.length;
2286
+ for (var i = 0; i < arrLength; i++) {
2287
+ var item = array[i];
2288
+ if (Array.isArray(item)) {
2289
+ flatten(item, depth, parent, path);
2290
+ } else {
2291
+ if (_typeof(item) === 'object' && item !== null) {
2292
+ var _treeSchema$set;
2293
+ var currentPath = path !== null ? "".concat(path, "-").concat(i) : "".concat(i);
2294
+ var uuid = "".concat(getUid(item));
2295
+ var hasChildren = !!(item[children] || []).length;
2296
+ /**
2297
+ * 当前节点设置是否为展开状态
2298
+ */
2299
+ var isOpened = getCachedTreeNodeAttr(uuid, item, NODE_ATTRIBUTES.IS_OPEN);
2300
+ /**
2301
+ * 如果初始化发现当前属性为展开或者选中 & 设置了 autoOpenParentNode = true
2302
+ * 此时需要设置当前节点的所有父级节点都为展开状态
2303
+ */
2304
+ if (props.autoOpenParentNode) {
2305
+ isOpened && loopUpdateNodeAttr(parent, NODE_ATTRIBUTES.IS_OPEN, true, validateIsOpenLoopFn);
2306
+ } else {
2307
+ /**
2308
+ * 如果没有设置自动展开所有父级
2309
+ * 此时需要判定当前节点是否可以展开状态需要同时判定父级是否展开
2310
+ * 如果父级不是展开状态,此节点不能展示,应该也是关闭状态,只有当父级展开时,此节点才为展开状态
2311
+ */
2312
+ isOpened = isNodeOpend(uuid, item, parent);
2313
+ }
2314
+ var isChecked = isCheckedNode(item, uuid);
2315
+ if (isChecked) {
2316
+ checkedList.push(item);
2317
+ }
2318
+ treeSchema.set(item, (_treeSchema$set = {}, _defineProperty(_treeSchema$set, NODE_ATTRIBUTES.DEPTH, depth), _defineProperty(_treeSchema$set, NODE_ATTRIBUTES.INDEX, i), _defineProperty(_treeSchema$set, NODE_ATTRIBUTES.UUID, uuid), _defineProperty(_treeSchema$set, NODE_ATTRIBUTES.PARENT, parent), _defineProperty(_treeSchema$set, NODE_ATTRIBUTES.HAS_CHILD, hasChildren), _defineProperty(_treeSchema$set, NODE_ATTRIBUTES.PATH, currentPath), _defineProperty(_treeSchema$set, NODE_ATTRIBUTES.IS_ROOT, parent === null), _defineProperty(_treeSchema$set, NODE_ATTRIBUTES.ORDER, order), _defineProperty(_treeSchema$set, NODE_ATTRIBUTES.IS_SELECTED, isCachedTreeNodeSelected(uuid, item)), _defineProperty(_treeSchema$set, NODE_ATTRIBUTES.IS_MATCH, getCachedTreeNodeAttr(uuid, item, NODE_ATTRIBUTES.IS_MATCH)), _defineProperty(_treeSchema$set, NODE_ATTRIBUTES.IS_OPEN, isOpened), _defineProperty(_treeSchema$set, NODE_ATTRIBUTES.IS_CHECKED, isChecked), _defineProperty(_treeSchema$set, NODE_ATTRIBUTES.IS_CACHED, getCachedTreeNodeAttr(uuid, item, NODE_ATTRIBUTES.IS_CACHED)), _defineProperty(_treeSchema$set, NODE_ATTRIBUTES.IS_ASYNC, getCachedTreeNodeAttr(uuid, item, NODE_ATTRIBUTES.IS_ASYNC)), _defineProperty(_treeSchema$set, NODE_ATTRIBUTES.IS_LOADING, getCachedTreeNodeAttr(uuid, item, NODE_ATTRIBUTES.IS_LOADING)), _defineProperty(_treeSchema$set, NODE_ATTRIBUTES.IS_INDETERMINATE, false), _treeSchema$set));
2319
+ order += 1;
2320
+ outputData.push(item);
2321
+ if (Object.prototype.hasOwnProperty.call(item, children)) {
2322
+ flatten(item[children] || [], depth + 1, item, currentPath);
2323
+ }
2324
+ }
2325
+ }
2326
+ }
2327
+ }
2328
+ flatten(treeData !== null && treeData !== void 0 ? treeData : data);
2329
+ if (props.showCheckbox) {
2330
+ checkedList === null || checkedList === void 0 ? void 0 : checkedList.forEach(function (value) {
2331
+ loopUpdateNodeAttr(value, NODE_ATTRIBUTES.IS_CHECKED, true, loopUpdateCheckedEvent);
2332
+ });
2333
+ }
2334
+ return [outputData, treeSchema];
2335
+ };
2336
+ var formatData = getFlatdata();
2337
+ var nextLoopEvents = new Map();
2338
+ var afterSelectEvents = [];
2339
+ var afterSelectWatch = [];
2340
+ /**
2341
+ * 扁平化数据
2342
+ * schema: 需要展示连线时,用于计算连线高度
2343
+ */
2344
+ var flatData = (0,external_vue_namespaceObject.reactive)({
2345
+ data: formatData[0],
2346
+ schema: formatData[1],
2347
+ levelLineSchema: {}
2348
+ });
2349
+ var _useNodeAsync = use_node_async(props, flatData),
2350
+ asyncNodeClick = _useNodeAsync.asyncNodeClick,
2351
+ deepAutoOpen = _useNodeAsync.deepAutoOpen;
2352
+ /**
2353
+ * 抛出缓存函数,用于注册selected watch
2354
+ * @param event
2355
+ */
2356
+ var onSelected = function onSelected(event) {
2357
+ afterSelectEvents.push(event);
2358
+ };
2359
+ var registerNextLoop = function registerNextLoop(key, event) {
2360
+ var reset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
2361
+ if (reset && nextLoopEvents.has(key)) {
2362
+ nextLoopEvents["delete"](key);
2363
+ }
2364
+ nextLoopEvents.set(key, event);
2365
+ };
2366
+ var resolveEventOption = function resolveEventOption(event) {
2367
+ if (typeof event === 'function') {
2368
+ return {
2369
+ type: 'loop',
2370
+ fn: event
2371
+ };
2372
+ }
2373
+ if (_typeof(event) === 'object' && typeof event.type === 'string' && typeof event.fn === 'function') {
2374
+ return event;
2375
+ }
2376
+ console.error('loop event error', event);
2377
+ return null;
2378
+ };
2379
+ var executeFn = function executeFn(event) {
2380
+ var _resoveEvent$type;
2381
+ var resoveEvent = resolveEventOption(event);
2382
+ if (resoveEvent !== null) {
2383
+ Reflect.apply(resoveEvent.fn, use_tree_init_this, []);
2384
+ }
2385
+ return (_resoveEvent$type = resoveEvent === null || resoveEvent === void 0 ? void 0 : resoveEvent.type) !== null && _resoveEvent$type !== void 0 ? _resoveEvent$type : 'once';
2386
+ };
2387
+ var executeNextEvent = function executeNextEvent() {
2388
+ Array.from(nextLoopEvents.keys()).forEach(function (key) {
2389
+ var target = nextLoopEvents.get(key);
2390
+ if (Array.isArray(target)) {
2391
+ var clearList = [];
2392
+ target.forEach(function (event, index) {
2393
+ var result = executeFn(event);
2394
+ if (result === 'once') {
2395
+ clearList.unshift(index);
2396
+ }
2397
+ });
2398
+ if (clearList.length) {
2399
+ clearList.forEach(function (index) {
2400
+ return target.splice(index, 1);
2401
+ });
2402
+ }
2403
+ if (target.length === 0) {
2404
+ nextLoopEvents["delete"](key);
2405
+ }
2406
+ } else {
2407
+ var result = executeFn(target);
2408
+ if (result === 'once') {
2409
+ nextLoopEvents["delete"](key);
2410
+ }
2411
+ }
2412
+ });
2413
+ };
2414
+ /**
2415
+ * 监听组件配置Data改变
2416
+ */
2417
+ (0,external_vue_namespaceObject.watch)(function () {
2418
+ return [props.data];
2419
+ }, function (newData) {
2420
+ var _props$async, _props$async2;
2421
+ var formatData = getFlatdata(newData, flatData.schema);
2422
+ flatData.data = formatData[0];
2423
+ flatData.schema = formatData[1];
2424
+ if ((_props$async = props.async) !== null && _props$async !== void 0 && _props$async.callback && ((_props$async2 = props.async) === null || _props$async2 === void 0 ? void 0 : _props$async2.deepAutoOpen) === 'every') {
2425
+ deepAutoOpen();
2426
+ }
2427
+ /**
2428
+ * 执行缓存下来的周期函数
2429
+ * 保证data改变之后执行相关操作
2430
+ */
2431
+ executeNextEvent();
2432
+ }, {
2433
+ deep: true
2434
+ });
2435
+ if (props.selectable) {
2436
+ (0,external_vue_namespaceObject.onMounted)(function () {
2437
+ (0,external_vue_namespaceObject.watch)(function () {
2438
+ return props.selected;
2439
+ }, function (newData) {
2440
+ // console.log('watch selected changed');
2441
+ afterSelectWatch.length = 0;
2442
+ afterSelectEvents.forEach(function (event) {
2443
+ Reflect.apply(event, use_tree_init_this, [newData]);
2444
+ /**
2445
+ * selected设置生效有可能会在props.data 改变之前
2446
+ * 此时需要缓存当前执行函数,保证在watch data change 之后执行
2447
+ */
2448
+ afterSelectWatch.push(function () {
2449
+ return Reflect.apply(event, use_tree_init_this, [newData]);
2450
+ });
2451
+ });
2452
+ registerNextLoop('afterSelectWatch', afterSelectWatch);
2453
+ }, {
2454
+ immediate: true
2455
+ });
2456
+ });
2457
+ }
2458
+ var afterDataUpdate = function afterDataUpdate(callFn) {
2459
+ registerNextLoop('afterDataUpdate', callFn);
2460
+ };
2461
+ /** 如果设置了异步请求 */
2462
+ if ((_props$async3 = props.async) !== null && _props$async3 !== void 0 && _props$async3.callback) {
2463
+ deepAutoOpen();
2464
+ }
2465
+ return {
2466
+ flatData: flatData,
2467
+ asyncNodeClick: asyncNodeClick,
2468
+ deepAutoOpen: deepAutoOpen,
2469
+ afterDataUpdate: afterDataUpdate,
2470
+ registerNextLoop: registerNextLoop,
2471
+ onSelected: onSelected
2472
+ };
2473
+ });
2474
+ ;// CONCATENATED MODULE: ../../packages/tree/src/tree.tsx
2475
+
2476
+ /*
2477
+ * Tencent is pleased to support the open source community by making
2478
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
2479
+ *
2480
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
2481
+ *
2482
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
2483
+ *
2484
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
2485
+ *
2486
+ * ---------------------------------------------------
2487
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
2488
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
2489
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
2490
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2491
+ *
2492
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
2493
+ * the Software.
2494
+ *
2495
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
2496
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2497
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
2498
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2499
+ * IN THE SOFTWARE.
2500
+ */
2501
+
2502
+
2503
+
2504
+
2505
+
2506
+
2507
+
2508
+
2509
+
2510
+
2511
+
2512
+
2513
+
2514
+ /* harmony default export */ const tree = ((0,external_vue_namespaceObject.defineComponent)({
2515
+ name: 'Tree',
2516
+ props: treeProps,
2517
+ emits: TreeEmitEventsType,
2518
+ setup: function setup(props, ctx) {
2519
+ var _useTreeInit = use_tree_init(props),
2520
+ flatData = _useTreeInit.flatData,
2521
+ onSelected = _useTreeInit.onSelected,
2522
+ registerNextLoop = _useTreeInit.registerNextLoop;
2523
+ var _useNodeAttribute = use_node_attribute(flatData, props),
2524
+ checkNodeIsOpen = _useNodeAttribute.checkNodeIsOpen,
2525
+ isRootNode = _useNodeAttribute.isRootNode,
2526
+ isNodeOpened = _useNodeAttribute.isNodeOpened,
2527
+ isNodeChecked = _useNodeAttribute.isNodeChecked,
2528
+ isNodeMatched = _useNodeAttribute.isNodeMatched,
2529
+ hasChildNode = _useNodeAttribute.hasChildNode,
2530
+ getNodePath = _useNodeAttribute.getNodePath;
2531
+ var _useSearch = use_search(props),
2532
+ searchFn = _useSearch.searchFn,
2533
+ isSearchActive = _useSearch.isSearchActive,
2534
+ refSearch = _useSearch.refSearch,
2535
+ isSearchDisabled = _useSearch.isSearchDisabled,
2536
+ isTreeUI = _useSearch.isTreeUI,
2537
+ showChildNodes = _useSearch.showChildNodes;
2538
+ var matchedNodePath = (0,external_vue_namespaceObject.reactive)([]);
2539
+ var filterFn = function filterFn(item) {
2540
+ if (isSearchActive.value) {
2541
+ if (showChildNodes) {
2542
+ return checkNodeIsOpen(item) && (isNodeMatched(item) || matchedNodePath.some(function (path) {
2543
+ var _getNodePath;
2544
+ return ((_getNodePath = getNodePath(item)) !== null && _getNodePath !== void 0 ? _getNodePath : '').indexOf(path) === 0;
2545
+ }));
2546
+ }
2547
+ return checkNodeIsOpen(item) && isNodeMatched(item);
2548
+ }
2549
+ return checkNodeIsOpen(item);
2550
+ };
2551
+ // 计算当前需要渲染的节点信息
2552
+ var renderData = (0,external_vue_namespaceObject.computed)(function () {
2553
+ return flatData.data.filter(function (item) {
2554
+ return filterFn(item);
2555
+ });
2556
+ });
2557
+ var _useNodeAction = use_node_action(props, ctx, flatData, renderData, {
2558
+ registerNextLoop: registerNextLoop
2559
+ }),
2560
+ renderTreeNode = _useNodeAction.renderTreeNode,
2561
+ handleTreeNodeClick = _useNodeAction.handleTreeNodeClick,
2562
+ setNodeOpened = _useNodeAction.setNodeOpened,
2563
+ setOpen = _useNodeAction.setOpen,
2564
+ setNodeAction = _useNodeAction.setNodeAction,
2565
+ setSelect = _useNodeAction.setSelect,
2566
+ asyncNodeClick = _useNodeAction.asyncNodeClick,
2567
+ setNodeAttribute = _useNodeAction.setNodeAttribute;
2568
+ var handleSearch = (0,external_shared_namespaceObject.debounce)(120, function () {
2569
+ matchedNodePath.length = 0;
2570
+ flatData.data.forEach(function (item) {
2571
+ var isMatch = searchFn(getLabel(item, props), item);
2572
+ if (isMatch) {
2573
+ matchedNodePath.push(getNodePath(item));
2574
+ }
2575
+ setNodeAttribute(item, [NODE_ATTRIBUTES.IS_MATCH], [isMatch], isTreeUI.value && isMatch);
2576
+ });
2577
+ });
2578
+ if (!isSearchDisabled) {
2579
+ (0,external_vue_namespaceObject.watch)([refSearch], function () {
2580
+ handleSearch();
2581
+ }, {
2582
+ deep: true,
2583
+ immediate: true
2584
+ });
2585
+ }
2586
+ var root = (0,external_vue_namespaceObject.ref)();
2587
+ /**
2588
+ * 设置指定节点是否选中
2589
+ * @param item Node item | Node Id
2590
+ * @param checked
2591
+ */
2592
+ var setChecked = function setChecked(item) {
2593
+ var checked = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2594
+ setNodeAction(resolveNodeItem(item), NODE_ATTRIBUTES.IS_CHECKED, checked);
2595
+ };
2596
+ onSelected(function (newData) {
2597
+ setSelect(newData, true, props.autoOpenParentNode);
2598
+ });
2599
+ var getData = function getData() {
2600
+ return flatData;
2601
+ };
2602
+ ctx.expose({
2603
+ handleTreeNodeClick: handleTreeNodeClick,
2604
+ isNodeChecked: isNodeChecked,
2605
+ isRootNode: isRootNode,
2606
+ isNodeOpened: isNodeOpened,
2607
+ isNodeMatched: isNodeMatched,
2608
+ hasChildNode: hasChildNode,
2609
+ setOpen: setOpen,
2610
+ setChecked: setChecked,
2611
+ setNodeAction: setNodeAction,
2612
+ setNodeOpened: setNodeOpened,
2613
+ setSelect: setSelect,
2614
+ asyncNodeClick: asyncNodeClick,
2615
+ getData: getData
2616
+ });
2617
+ var _useEmpty = use_empty(props, ctx),
2618
+ renderEmpty = _useEmpty.renderEmpty;
2619
+ use_node_drag(props, ctx, root, flatData);
2620
+ var renderTreeContent = function renderTreeContent(scopedData) {
2621
+ var _ctx$slots$empty, _ctx$slots$empty2, _ctx$slots;
2622
+ if (scopedData.length) {
2623
+ return scopedData.map(function (d) {
2624
+ return renderTreeNode(d, !isSearchActive.value || isTreeUI.value);
2625
+ });
2626
+ }
2627
+ var emptyType = isSearchActive.value ? 'search-empty' : 'empty';
2628
+ return (_ctx$slots$empty = (_ctx$slots$empty2 = (_ctx$slots = ctx.slots).empty) === null || _ctx$slots$empty2 === void 0 ? void 0 : _ctx$slots$empty2.call(_ctx$slots)) !== null && _ctx$slots$empty !== void 0 ? _ctx$slots$empty : renderEmpty(emptyType);
2629
+ };
2630
+ var _usePrefix = (0,external_config_provider_namespaceObject.usePrefix)(),
2631
+ resolveClassName = _usePrefix.resolveClassName;
2632
+ return function () {
2633
+ return (0,external_vue_namespaceObject.createVNode)(external_virtual_render_namespaceObject["default"], {
2634
+ "class": resolveClassName('tree'),
2635
+ "style": getTreeStyle(null, props),
2636
+ "list": renderData.value,
2637
+ "lineHeight": props.lineHeight,
2638
+ "height": props.height,
2639
+ "enabled": props.virtualRender,
2640
+ "rowKey": NODE_ATTRIBUTES.UUID,
2641
+ "keepAlive": true,
2642
+ "contentClassName": resolveClassName('container'),
2643
+ "throttleDelay": 0,
2644
+ "ref": root
2645
+ }, {
2646
+ "default": function _default(scoped) {
2647
+ return renderTreeContent(scoped.data || []);
2648
+ }
2649
+ });
2650
+ };
2651
+ }
2652
+ }));
2653
+ ;// CONCATENATED MODULE: ../../packages/tree/src/index.ts
2654
+ /*
2655
+ * Tencent is pleased to support the open source community by making
2656
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
2657
+ *
2658
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
2659
+ *
2660
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
2661
+ *
2662
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
2663
+ *
2664
+ * ---------------------------------------------------
2665
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
2666
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
2667
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
2668
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2669
+ *
2670
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
2671
+ * the Software.
2672
+ *
2673
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
2674
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2675
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
2676
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2677
+ * IN THE SOFTWARE.
2678
+ */
2679
+
2680
+
2681
+ var BkTree = (0,external_shared_namespaceObject.withInstall)(tree);
2682
+ /* harmony default export */ const src = (BkTree);
2683
+ })();
2684
+
2685
+ var __webpack_exports__default = __webpack_exports__.Z;
2686
+ export { __webpack_exports__default as default };