bkui-vue 0.0.1-beta.466 → 0.0.1-beta.468

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 (260) hide show
  1. package/dist/index.cjs.js +20 -20
  2. package/dist/index.esm.js +3255 -3254
  3. package/dist/index.umd.js +20 -20
  4. package/lib/affix/index.js +335 -1
  5. package/lib/alert/alert.d.ts +5 -5
  6. package/lib/alert/index.d.ts +9 -9
  7. package/lib/alert/index.js +276 -1
  8. package/lib/animate-number/index.js +219 -1
  9. package/lib/backtop/index.js +252 -1
  10. package/lib/badge/index.js +293 -1
  11. package/lib/breadcrumb/index.js +311 -1
  12. package/lib/button/index.js +388 -1
  13. package/lib/card/index.js +356 -1
  14. package/lib/cascader/cascader.d.ts +4 -4
  15. package/lib/cascader/index.d.ts +12 -12
  16. package/lib/cascader/index.js +2075 -2
  17. package/lib/checkbox/index.js +536 -1
  18. package/lib/code-diff/code-diff.d.ts +7 -7
  19. package/lib/code-diff/index.d.ts +9 -9
  20. package/lib/code-diff/index.js +5535 -1
  21. package/lib/collapse/collapse-panel.d.ts +5 -5
  22. package/lib/collapse/index.d.ts +5 -5
  23. package/lib/collapse/index.js +589 -1
  24. package/lib/collapse/props.d.ts +2 -2
  25. package/lib/collapse-transition/index.js +234 -1
  26. package/lib/color-picker/index.js +2701 -1
  27. package/lib/components.js +781 -1
  28. package/lib/config-provider/index.js +377 -1
  29. package/lib/container/index.js +390 -1
  30. package/lib/date-picker/base/month-table.d.ts +1 -1
  31. package/lib/date-picker/base/year-table.d.ts +1 -1
  32. package/lib/date-picker/date-picker.d.ts +4 -4
  33. package/lib/date-picker/index.d.ts +9 -9
  34. package/lib/date-picker/index.js +5537 -1
  35. package/lib/date-picker/panel/date.d.ts +1 -1
  36. package/lib/date-picker/panel/time-range.d.ts +4 -4
  37. package/lib/date-picker/panel/time.d.ts +5 -5
  38. package/lib/date-picker/props.d.ts +1 -1
  39. package/lib/date-picker/time-picker.d.ts +4 -4
  40. package/lib/dialog/dialog.d.ts +16 -16
  41. package/lib/dialog/index.d.ts +31 -31
  42. package/lib/dialog/index.js +1322 -2
  43. package/lib/dialog/props.d.ts +6 -6
  44. package/lib/directives/index.js +1357 -2
  45. package/lib/dist.index.js +179 -1
  46. package/lib/divider/divider.d.ts +6 -6
  47. package/lib/divider/index.d.ts +12 -12
  48. package/lib/divider/index.js +226 -1
  49. package/lib/divider/props.d.ts +2 -2
  50. package/lib/dropdown/dropdown.d.ts +5 -5
  51. package/lib/dropdown/index.d.ts +9 -9
  52. package/lib/dropdown/index.js +392 -1
  53. package/lib/exception/index.js +423 -1
  54. package/lib/fixed-navbar/index.js +210 -1
  55. package/lib/form/index.js +995 -1
  56. package/lib/hooks.js +133 -1
  57. package/lib/icon/angle-double-down-line.js +541 -1
  58. package/lib/icon/angle-double-left-line.js +541 -1
  59. package/lib/icon/angle-double-left.js +541 -1
  60. package/lib/icon/angle-double-right-line.js +541 -1
  61. package/lib/icon/angle-double-right.js +541 -1
  62. package/lib/icon/angle-double-up-line.js +541 -1
  63. package/lib/icon/angle-down-fill.js +541 -1
  64. package/lib/icon/angle-down-line.js +541 -1
  65. package/lib/icon/angle-down.js +541 -1
  66. package/lib/icon/angle-left.js +541 -1
  67. package/lib/icon/angle-right.js +541 -1
  68. package/lib/icon/angle-up-fill.js +541 -1
  69. package/lib/icon/angle-up.js +541 -1
  70. package/lib/icon/archive-fill.js +541 -1
  71. package/lib/icon/arrows-left.js +541 -1
  72. package/lib/icon/arrows-right.js +541 -1
  73. package/lib/icon/audio-fill.js +541 -1
  74. package/lib/icon/bk.js +541 -1
  75. package/lib/icon/circle.js +541 -1
  76. package/lib/icon/close-line.js +541 -1
  77. package/lib/icon/close.js +541 -1
  78. package/lib/icon/code.js +541 -1
  79. package/lib/icon/cog-shape.js +541 -1
  80. package/lib/icon/collapse-left.js +541 -1
  81. package/lib/icon/copy-shape.js +541 -1
  82. package/lib/icon/copy.js +541 -1
  83. package/lib/icon/data-shape.js +541 -1
  84. package/lib/icon/del.js +541 -1
  85. package/lib/icon/doc-fill.js +541 -1
  86. package/lib/icon/done.js +541 -1
  87. package/lib/icon/down-shape.js +541 -1
  88. package/lib/icon/down-small.js +541 -1
  89. package/lib/icon/edit-line.js +541 -1
  90. package/lib/icon/ellipsis.js +541 -1
  91. package/lib/icon/enlarge-line.js +541 -1
  92. package/lib/icon/error.js +541 -1
  93. package/lib/icon/excel-fill.js +541 -1
  94. package/lib/icon/exclamation-circle-shape.js +541 -1
  95. package/lib/icon/eye.js +541 -1
  96. package/lib/icon/filliscreen-line.js +541 -1
  97. package/lib/icon/fix-line.js +541 -1
  98. package/lib/icon/fix-shape.js +541 -1
  99. package/lib/icon/folder-open.js +541 -1
  100. package/lib/icon/folder-shape-open.js +541 -1
  101. package/lib/icon/folder-shape.js +541 -1
  102. package/lib/icon/folder.js +541 -1
  103. package/lib/icon/funnel.js +541 -1
  104. package/lib/icon/help-document-fill.js +541 -1
  105. package/lib/icon/help-fill.js +541 -1
  106. package/lib/icon/help.js +541 -1
  107. package/lib/icon/image-fill.js +563 -1
  108. package/lib/icon/img-error.js +563 -1
  109. package/lib/icon/img-placehoulder.js +563 -1
  110. package/lib/icon/index.js +2337 -1
  111. package/lib/icon/info-line.js +563 -1
  112. package/lib/icon/info.js +563 -1
  113. package/lib/icon/left-shape.js +563 -1
  114. package/lib/icon/left-turn-line.js +563 -1
  115. package/lib/icon/narrow-line.js +563 -1
  116. package/lib/icon/original.js +563 -1
  117. package/lib/icon/pdf-fill.js +563 -1
  118. package/lib/icon/play-shape.js +563 -1
  119. package/lib/icon/plus.js +563 -1
  120. package/lib/icon/ppt-fill.js +563 -1
  121. package/lib/icon/qq.js +563 -1
  122. package/lib/icon/right-shape.js +563 -1
  123. package/lib/icon/right-turn-line.js +563 -1
  124. package/lib/icon/search.js +563 -1
  125. package/lib/icon/share.js +563 -1
  126. package/lib/icon/spinner.js +563 -1
  127. package/lib/icon/success.js +563 -1
  128. package/lib/icon/switcher-loading.js +563 -1
  129. package/lib/icon/text-file.js +563 -1
  130. package/lib/icon/text-fill.js +563 -1
  131. package/lib/icon/transfer.js +563 -1
  132. package/lib/icon/tree-application-shape.js +563 -1
  133. package/lib/icon/unfull-screen.js +563 -1
  134. package/lib/icon/unvisible.js +563 -1
  135. package/lib/icon/up-shape.js +563 -1
  136. package/lib/icon/upload.js +563 -1
  137. package/lib/icon/video-fill.js +563 -1
  138. package/lib/icon/warn.js +563 -1
  139. package/lib/icon/weixin-pro.js +563 -1
  140. package/lib/icon/weixin.js +563 -1
  141. package/lib/image/image-viewer.d.ts +1 -1
  142. package/lib/image/image.d.ts +1 -1
  143. package/lib/image/index.d.ts +3 -3
  144. package/lib/image/index.js +944 -1
  145. package/lib/index.js +195 -1
  146. package/lib/info-box/index.js +1508 -2
  147. package/lib/input/index.d.ts +9 -9
  148. package/lib/input/index.js +963 -1
  149. package/lib/input/input.d.ts +7 -7
  150. package/lib/link/index.js +219 -1
  151. package/lib/loading/index.d.ts +4 -4
  152. package/lib/loading/index.js +434 -1
  153. package/lib/loading/loading.d.ts +3 -3
  154. package/lib/locale/index.js +489 -1
  155. package/lib/menu/index.js +776 -1
  156. package/lib/message/index.js +1744 -2
  157. package/lib/message/messageConstructor.d.ts +1 -1
  158. package/lib/modal/index.d.ts +15 -15
  159. package/lib/modal/index.js +397 -1
  160. package/lib/modal/modal.d.ts +6 -6
  161. package/lib/modal/props.mixin.d.ts +2 -2
  162. package/lib/navigation/index.d.ts +3 -3
  163. package/lib/navigation/index.js +423 -1
  164. package/lib/navigation/navigation.d.ts +1 -1
  165. package/lib/notify/index.js +437 -1
  166. package/lib/notify/notifyConstructor.d.ts +2 -2
  167. package/lib/overflow-title/components/overflow-title.d.ts +5 -5
  168. package/lib/overflow-title/index.d.ts +9 -9
  169. package/lib/overflow-title/index.js +547 -1
  170. package/lib/overflow-title/props.d.ts +4 -4
  171. package/lib/pagination/index.js +987 -1
  172. package/lib/plugin-popover/index.js +4022 -1
  173. package/lib/plugins/index.js +130 -1
  174. package/lib/pop-confirm/index.js +365 -1
  175. package/lib/popover/index.d.ts +9 -9
  176. package/lib/popover/index.js +4028 -1
  177. package/lib/popover/popover.d.ts +5 -5
  178. package/lib/popover/props.d.ts +2 -2
  179. package/lib/popover2/index.js +171 -1
  180. package/lib/preset.js +164 -1
  181. package/lib/process/index.js +1143 -2
  182. package/lib/progress/index.d.ts +3 -3
  183. package/lib/progress/index.js +476 -1
  184. package/lib/progress/progress.d.ts +1 -1
  185. package/lib/radio/index.js +611 -1
  186. package/lib/rate/index.js +348 -1
  187. package/lib/rate/star.d.ts +1 -1
  188. package/lib/resize-layout/index.d.ts +15 -15
  189. package/lib/resize-layout/index.js +482 -1
  190. package/lib/resize-layout/resize-layout.d.ts +7 -7
  191. package/lib/search-select/index.d.ts +15 -15
  192. package/lib/search-select/index.js +2999 -2
  193. package/lib/search-select/input.d.ts +1 -1
  194. package/lib/search-select/search-select.d.ts +5 -5
  195. package/lib/search-select/selected.d.ts +1 -1
  196. package/lib/select/index.d.ts +61 -61
  197. package/lib/select/index.js +2531 -2
  198. package/lib/select/select.d.ts +26 -26
  199. package/lib/select/selectTagInput.d.ts +5 -5
  200. package/lib/shared/index.js +2713 -1
  201. package/lib/shared/vue-types.d.ts +11 -11
  202. package/lib/sideslider/index.d.ts +13 -13
  203. package/lib/sideslider/index.js +1043 -2
  204. package/lib/sideslider/sideslider.d.ts +6 -6
  205. package/lib/slider/index.js +1667 -2
  206. package/lib/steps/index.d.ts +6 -6
  207. package/lib/steps/index.js +1212 -2
  208. package/lib/steps/steps.d.ts +2 -2
  209. package/lib/swiper/index.js +350 -1
  210. package/lib/switcher/index.js +323 -1
  211. package/lib/tab/index.d.ts +19 -19
  212. package/lib/tab/index.js +918 -1
  213. package/lib/tab/props.d.ts +8 -8
  214. package/lib/tab/tab-nav.d.ts +5 -5
  215. package/lib/tab/tab-panel.d.ts +6 -6
  216. package/lib/tab/tab.d.ts +6 -6
  217. package/lib/table/components/table-column.d.ts +7 -7
  218. package/lib/table/index.d.ts +36 -36
  219. package/lib/table/index.js +6388 -1
  220. package/lib/table/plugins/body-empty.d.ts +1 -1
  221. package/lib/table/props.d.ts +9 -9
  222. package/lib/table/table.d.ts +11 -11
  223. package/lib/table-column/index.d.ts +13 -13
  224. package/lib/table-column/index.js +801 -1
  225. package/lib/tag/index.d.ts +9 -9
  226. package/lib/tag/index.js +300 -1
  227. package/lib/tag/tag.d.ts +5 -5
  228. package/lib/tag-input/index.d.ts +9 -9
  229. package/lib/tag-input/index.js +1757 -1
  230. package/lib/tag-input/tag-input.d.ts +5 -5
  231. package/lib/tag-input/tag-props.d.ts +2 -2
  232. package/lib/time-picker/index.d.ts +9 -9
  233. package/lib/time-picker/index.js +142 -1
  234. package/lib/timeline/index.js +297 -1
  235. package/lib/transfer/index.d.ts +3 -3
  236. package/lib/transfer/index.js +764 -1
  237. package/lib/transfer/transfer.d.ts +1 -1
  238. package/lib/tree/constant.d.ts +2 -1
  239. package/lib/tree/index.d.ts +6 -6
  240. package/lib/tree/index.js +2608 -1
  241. package/lib/tree/tree.d.ts +2 -2
  242. package/lib/upload/index.d.ts +4 -4
  243. package/lib/upload/index.js +3257 -2
  244. package/lib/upload/upload.d.ts +1 -1
  245. package/lib/virtual-render/index.d.ts +3 -3
  246. package/lib/virtual-render/index.js +790 -1
  247. package/lib/virtual-render/virtual-render.d.ts +1 -1
  248. package/package.json +1 -1
  249. package/lib/cascader/index.js.LICENSE.txt +0 -1
  250. package/lib/dialog/index.js.LICENSE.txt +0 -1
  251. package/lib/directives/index.js.LICENSE.txt +0 -14
  252. package/lib/info-box/index.js.LICENSE.txt +0 -1
  253. package/lib/message/index.js.LICENSE.txt +0 -6
  254. package/lib/process/index.js.LICENSE.txt +0 -1
  255. package/lib/search-select/index.js.LICENSE.txt +0 -1
  256. package/lib/select/index.js.LICENSE.txt +0 -1
  257. package/lib/sideslider/index.js.LICENSE.txt +0 -1
  258. package/lib/slider/index.js.LICENSE.txt +0 -1
  259. package/lib/steps/index.js.LICENSE.txt +0 -1
  260. package/lib/upload/index.js.LICENSE.txt +0 -1
package/lib/tab/index.js CHANGED
@@ -1 +1,918 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue-types"),require("vue"),require("../directives"),require("../icon/"));else if("function"==typeof define&&define.amd)define(["../shared","vue-types","vue","../directives","../icon/"],t);else{var a="object"==typeof exports?t(require("../shared"),require("vue-types"),require("vue"),require("../directives"),require("../icon/")):t(e["../shared"],e["vue-types"],e.vue,e["../directives"],e["../icon/"]);for(var r in a)("object"==typeof exports?exports:e)[r]=a[r]}}(self,((e,t,a,r,n)=>(()=>{"use strict";var o={4061:e=>{e.exports=r},7685:e=>{e.exports=n},4212:t=>{t.exports=e},748:e=>{e.exports=a},210:e=>{e.exports=t}},s={};function i(e){var t=s[e];if(void 0!==t)return t.exports;var a=s[e]={exports:{}};return o[e](a,a.exports,i),a.exports}i.d=(e,t)=>{for(var a in t)i.o(t,a)&&!i.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return(()=>{i.r(l),i.d(l,{BkTab:()=>T,BkTabPanel:()=>m,PositionEnum:()=>t,SortTypeEnum:()=>n,default:()=>P});var e,t,a=i(4212),r=i(210);!function(e){e.CARD="card",e.BORDER_CARD="border-card",e.UNBORDER_CARD="unborder-card",e.CARD_TAB="card-tab",e.CARD_GRID="card-grid"}(e||(e={})),function(e){e.LEFT="left",e.RIGHT="right",e.TOP="top"}(t||(t={}));var n,o=(0,r.toType)("position",{}).def(t.TOP);!function(e){e.REPLACE="replace",e.INSERT="insert"}(n||(n={}));var s=(0,r.toType)("sortType",{}).def(n.REPLACE),c={tabAdd:{type:Function,default:function(){return{}}},tabChange:{type:Function,default:function(e){return e}},tabRemove:{type:Function,default:function(e){return e}},tabSort:{type:Function,default:function(){return{}}},tabDrag:{type:Function,default:function(){return{}}}},p={name:a.PropTypes.oneOfType([a.PropTypes.number,a.PropTypes.string]).def(""),label:a.PropTypes.string||a.PropTypes.func,tips:a.PropTypes.string,closable:a.PropTypes.bool,visible:a.PropTypes.bool.def(!0),disabled:a.PropTypes.bool,sortable:a.PropTypes.bool,renderDirective:(0,a.renderDirectiveType)(),panel:a.PropTypes.string||a.PropTypes.func},d={active:a.PropTypes.oneOfType([a.PropTypes.number,a.PropTypes.string]).def(""),type:(0,r.toType)("type",{}).def(e.BORDER_CARD),tabPosition:o,closable:Boolean,addable:Boolean,sortable:Boolean,sortType:s,labelHeight:a.PropTypes.number.def(50),scrollStep:a.PropTypes.number.def(200),extCls:a.PropTypes.string.def(""),validateActive:a.PropTypes.bool.def(!0),showHeader:a.PropTypes.bool.def(!0),changeOnHover:a.PropTypes.bool.def(!1),changeOnHoverDelay:a.PropTypes.number.def(1e3),activeBarSize:a.PropTypes.number.def(2),activeBarColor:a.PropTypes.string.def("#3a84ff")},u=Object.assign({active:a.PropTypes.oneOfType([a.PropTypes.number,a.PropTypes.string]).def(""),type:(0,r.toType)("type",{}).def(e.BORDER_CARD),activeBarColor:a.PropTypes.string.def("#3a84ff"),activeBarSize:a.PropTypes.number.def(2),panels:{type:Array,default:function(){return[]}},tabPosition:o,closable:Boolean,addable:Boolean,sortable:Boolean,sortType:s,labelHeight:a.PropTypes.number.def(50),scrollStep:a.PropTypes.number.def(200),validateActive:a.PropTypes.bool.def(!0),changeOnHover:a.PropTypes.bool.def(!1),changeOnHoverDelay:a.PropTypes.number.def(1e3)},c);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,r=new Array(t);a<t;a++)r[a]=e[a];return r}var v=i(748),b=i(4061),y=i(7685);const h=(0,v.defineComponent)({name:"TabNav",directives:{bkTooltips:b.bkTooltips},props:u,setup:function(a){var r=(0,v.ref)(null),n=(0,v.computed)((function(){var n={width:0,height:0,bottom:0,left:0};if(!r.value)return n;if([t.LEFT,t.RIGHT].includes(a.tabPosition)){var o=r.value,s=o.clientHeight,i=o.offsetTop,l={width:"".concat(a.activeBarSize,"px"),height:"".concat(s,"px"),top:"".concat(i,"px"),background:a.activeBarColor};return a.tabPosition===t.LEFT?l.right=0:l.left=0,l}if(a.type===e.UNBORDER_CARD){var c=r.value,p=c.clientWidth,d=c.offsetLeft;return{width:"".concat(p,"px"),height:"".concat(a.activeBarSize,"px"),left:"".concat(d,"px"),bottom:0,background:a.activeBarColor}}return n})),o=(0,v.computed)((function(){if(!Array.isArray(a.panels)||!a.panels.length)return[];var e=[],t=!1;return a.panels.filter((function(r,n){if(!r.props)return null;var o=r.props,s=o.name,i=o.label,l=o.closable,c=o.visible,p=o.disabled,d=o.sortable,u=o.tips;return!!c&&(a.active===s&&(t=!0),e.push({name:s,closable:l,visible:c,disabled:p,sortable:d,tips:u,tabLabel:function(e){return r.slots.label?(0,v.h)(r.slots.label):[void 0,""].includes(e)?"选项卡".concat(n+1):"string"==typeof e?e:"function"==typeof e?(0,v.h)(e):e}(i)}),!0)})),!t&&a.validateActive&&a.panels[0].props&&a.tabChange(a.panels[0].props.name),e})),s=(0,v.ref)(-1),i=(0,v.ref)(-1),l=(0,v.ref)(""),c=function(e,t){return e===t},p={handleTabAdd:function(e){a.tabAdd(e)},dragstart:function(e,t){i.value=e,l.value=a.guid,Object.assign(t.dataTransfer,{effectAllowed:"move"}),a.tabDrag(e,t)},dragenter:function(e){c(l.value,a.guid)&&(s.value=e)},dragend:function(){s.value=-1,i.value=-1,l.value=null},drop:function(e,t){if(!c(l.value,a.guid))return!1;a.tabSort(i.value,e,t)},handleTabChange:function(e){a.tabChange(e)},handleTabRemove:function(e,t){a.tabRemove(e,t)}};return Object.assign(Object.assign({},p),{activeRef:r,activeBarStyle:n,navs:o,dragenterIndex:s,dragStartIndex:i,draggingEle:l,guid:Math.random().toString(16).substr(4)+Math.random().toString(16).substr(4)})},render:function(){var t,r,n,o=this,s=this.active,i=this.closable,l=this.addable,c=this.sortable,p=this.sortType,d=this.labelHeight,u=this.dragstart,f=this.dragenter,b=this.dragend,h=this.drop,g="function"==typeof this.$slots.setting?(0,v.createVNode)("div",{class:(0,a.resolveClassName)("tab-header-setting")},[this.$slots.setting()]):null,m=(n=[],"function"==typeof o.$slots.add?n.push(null===(r=(t=o.$slots).add)||void 0===r?void 0:r.call(t,v.h)):l&&n.push((0,v.createVNode)("div",{onClick:o.handleTabAdd},[(0,v.createVNode)(y.Plus,{style:"display:flex;",width:26,height:26},null)])),n.length?(0,v.createVNode)("div",{class:(0,a.resolveClassName)("tab-header-operation")},[n.map((function(e,t){return(0,v.createVNode)("div",{class:(0,a.resolveClassName)("tab-header-item"),key:t},[e])}))]):null);return(0,v.createVNode)("div",{style:{lineHeight:"".concat(d,"px")},class:(0,a.resolveClassName)("tab-header")},[(0,v.createVNode)("div",{class:[(0,a.resolveClassName)("tab-header-nav"),m||g?"tab-header-auto":""]},[o.type===e.UNBORDER_CARD?(0,v.createVNode)("div",{style:o.activeBarStyle,class:(0,a.resolveClassName)("tab-header-active-bar")},null):"",o.navs.map((function(e,t){if(!e)return null;var r,n=e.name,l=e.disabled,d=e.tabLabel,g=function(e,t){return!l&&(e||t)};return(0,v.withDirectives)((0,v.createVNode)("div",{key:n,onClick:function(){return!l&&o.handleTabChange(n)},draggable:g(e.sortable,c),onDragstart:function(e){return u(t,e)},ref:s===n?"activeRef":"",onDragenter:function(e){e.preventDefault(),f(t)},onDragleave:function(e){e.preventDefault()},onDragover:function(e){e.preventDefault()},onDragend:function(e){e.preventDefault(),b()},onDrop:function(e){e.preventDefault(),h(t,p)},class:(r=[(0,a.resolveClassName)("tab-header-item")],l&&r.push((0,a.resolveClassName)("tab-header--disabled")),s===n&&r.push((0,a.resolveClassName)("tab-header--active")),r.join(" "))},[(0,v.createVNode)("div",null,[d]),g(e.closable,i)?(0,v.createVNode)("span",{class:(0,a.resolveClassName)("tab-header--close"),onClick:function(){return o.handleTabRemove(t,e)}},[(0,v.createVNode)(y.Close,null,null)]):""]),[[(0,v.resolveDirective)("bk-tooltips"),{content:e.tips,disabled:!e.tips}]])}))]),m,g])}}),g=(0,v.defineComponent)({name:"Tab",components:{TabNav:h},props:d,emits:["add-panel","tab-change","remove-panel","sort-change","on-drag-tab","add","change","remove","update:active","sort","drag"],setup:function(e,t){var a=t.slots,r=t.emit,o=(0,v.ref)(!1),s=(0,v.ref)([]),i=(0,v.getCurrentInstance)(),l=function e(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return(t.children||[]).forEach((function(t){var r=t.type;"TabPanel"===(r=r.name||r)&&t.component?a.push(t.component):r!==v.Fragment&&"template"!==r||e(t,a)})),a},c=function(){if(a.default){var e=i.subTree.children[1].children;if(!e)return;var t=e[0],r=l(t);r.length!==s.value.length&&(s.value=r)}};(0,v.onMounted)((function(){c(),o.value=!0,(0,v.onUpdated)((function(){c()}))}));var p={tabAdd:function(e){r("add",{e}),r("add-panel",{e})},tabChange:function(e){r("change",e),r("tab-change",e),r("update:active",e)},tabRemove:function(e,t){r("remove",e,t),r("remove-panel",e,t)},tabSort:function(e,t,a){var o,i=s.value;if(a===n.INSERT)if(e<t)i.splice(t+1,0,s[e]),i.splice(e,1);else{if(!(e>t))return!1;i.splice(t,0,s[e]),i.splice(e+1,1)}else{var l=i[t];i[t]=i[e],i[e]=l}s.value=function(e){if(Array.isArray(e))return f(e)}(o=i)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(o)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?f(e,t):void 0}}(o)||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.")}(),r("sort",e,t,a),r("sort-change",e,t,a)},tabDrag:function(e,t){r("drag",e,t),r("on-drag-tab",e,t)}};return Object.assign(Object.assign({},p),{isMounted:o,panels:s})},render:function(){var r,n,o,s,i,l=this;return(0,v.createVNode)("div",{class:(i=[(0,a.resolveClassName)("tab"),l.extCls],l.tabPosition===t.TOP?i.push((0,a.resolveClassName)("tab--".concat(l.tabPosition)),(0,a.resolveClassName)("tab--".concat(l.type))):(i.push((0,a.resolveClassName)("tab--".concat(l.tabPosition))),l.type===e.CARD_TAB&&i.push((0,a.resolveClassName)("tab--vertical-tab"))),i)},[(o=l.panels,s={panels:o,active:l.active,type:l.type,closable:l.closable,addable:l.addable,sortable:l.sortable,sortType:l.sortType,labelHeight:l.labelHeight,scrollStep:l.scrollStep,validateActive:l.validateActive,changeOnHover:l.changeOnHover,changeOnHoverDelay:l.changeOnHoverDelay,tabPosition:l.tabPosition,activeBarSize:l.activeBarSize,activeBarColor:l.activeBarColor,tabAdd:l.tabAdd,tabChange:l.tabChange,tabRemove:l.tabRemove,tabSort:l.tabSort,tabDrag:l.tabDrag},o&&Array.isArray(o)?(0,v.createVNode)(h,s,l.$slots):null),(0,v.createVNode)("div",{class:(0,a.resolveClassName)("tab-content")},[null===(n=(r=this.$slots).default)||void 0===n?void 0:n.call(r)])])}}),m=(0,v.defineComponent)({name:"TabPanel",props:p,render:function(){var e=this,t=this.name===this.$parent.active;return(0,v.withDirectives)((0,v.createVNode)("div",{ref:"content",class:(0,a.resolveClassName)("tab-panel")},[!e.visible||"if"===e.renderDirective&&!t?null:"function"==typeof e.panel?e.panel(v.h):"function"==typeof e.$slots.default?e.$slots.default(null):"function"==typeof e.$slots.panel?e.$slots.panel(null):null]),[[v.vShow,t]])}});var T=(0,a.withInstallProps)(g,{TabPanel:m});const P=T})(),l})()));
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("../shared"), require("vue-types"), require("vue"), require("../directives"), require("../icon/"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define(["../shared", "vue-types", "vue", "../directives", "../icon/"], factory);
6
+ else {
7
+ var a = typeof exports === 'object' ? factory(require("../shared"), require("vue-types"), require("vue"), require("../directives"), require("../icon/")) : factory(root["../shared"], root["vue-types"], root["vue"], root["../directives"], root["../icon/"]);
8
+ for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9
+ }
10
+ })(self, (__WEBPACK_EXTERNAL_MODULE__4212__, __WEBPACK_EXTERNAL_MODULE__210__, __WEBPACK_EXTERNAL_MODULE__748__, __WEBPACK_EXTERNAL_MODULE__4061__, __WEBPACK_EXTERNAL_MODULE__7685__) => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ var __webpack_modules__ = ({
14
+
15
+ /***/ 4061:
16
+ /***/ ((module) => {
17
+
18
+ module.exports = __WEBPACK_EXTERNAL_MODULE__4061__;
19
+
20
+ /***/ }),
21
+
22
+ /***/ 7685:
23
+ /***/ ((module) => {
24
+
25
+ module.exports = __WEBPACK_EXTERNAL_MODULE__7685__;
26
+
27
+ /***/ }),
28
+
29
+ /***/ 4212:
30
+ /***/ ((module) => {
31
+
32
+ module.exports = __WEBPACK_EXTERNAL_MODULE__4212__;
33
+
34
+ /***/ }),
35
+
36
+ /***/ 748:
37
+ /***/ ((module) => {
38
+
39
+ module.exports = __WEBPACK_EXTERNAL_MODULE__748__;
40
+
41
+ /***/ }),
42
+
43
+ /***/ 210:
44
+ /***/ ((module) => {
45
+
46
+ module.exports = __WEBPACK_EXTERNAL_MODULE__210__;
47
+
48
+ /***/ })
49
+
50
+ /******/ });
51
+ /************************************************************************/
52
+ /******/ // The module cache
53
+ /******/ var __webpack_module_cache__ = {};
54
+ /******/
55
+ /******/ // The require function
56
+ /******/ function __webpack_require__(moduleId) {
57
+ /******/ // Check if module is in cache
58
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
59
+ /******/ if (cachedModule !== undefined) {
60
+ /******/ return cachedModule.exports;
61
+ /******/ }
62
+ /******/ // Create a new module (and put it into the cache)
63
+ /******/ var module = __webpack_module_cache__[moduleId] = {
64
+ /******/ // no module.id needed
65
+ /******/ // no module.loaded needed
66
+ /******/ exports: {}
67
+ /******/ };
68
+ /******/
69
+ /******/ // Execute the module function
70
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
71
+ /******/
72
+ /******/ // Return the exports of the module
73
+ /******/ return module.exports;
74
+ /******/ }
75
+ /******/
76
+ /************************************************************************/
77
+ /******/ /* webpack/runtime/define property getters */
78
+ /******/ (() => {
79
+ /******/ // define getter functions for harmony exports
80
+ /******/ __webpack_require__.d = (exports, definition) => {
81
+ /******/ for(var key in definition) {
82
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
83
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
84
+ /******/ }
85
+ /******/ }
86
+ /******/ };
87
+ /******/ })();
88
+ /******/
89
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
90
+ /******/ (() => {
91
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
92
+ /******/ })();
93
+ /******/
94
+ /******/ /* webpack/runtime/make namespace object */
95
+ /******/ (() => {
96
+ /******/ // define __esModule on exports
97
+ /******/ __webpack_require__.r = (exports) => {
98
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
99
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
100
+ /******/ }
101
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
102
+ /******/ };
103
+ /******/ })();
104
+ /******/
105
+ /************************************************************************/
106
+ var __webpack_exports__ = {};
107
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
108
+ (() => {
109
+ // ESM COMPAT FLAG
110
+ __webpack_require__.r(__webpack_exports__);
111
+
112
+ // EXPORTS
113
+ __webpack_require__.d(__webpack_exports__, {
114
+ BkTab: () => (/* binding */ BkTab),
115
+ BkTabPanel: () => (/* reexport */ tab_panel),
116
+ PositionEnum: () => (/* reexport */ PositionEnum),
117
+ SortTypeEnum: () => (/* reexport */ SortTypeEnum),
118
+ "default": () => (/* binding */ src)
119
+ });
120
+
121
+ // EXTERNAL MODULE: external "../shared"
122
+ var external_shared_ = __webpack_require__(4212);
123
+ // EXTERNAL MODULE: external "vue-types"
124
+ var external_vue_types_ = __webpack_require__(210);
125
+ ;// CONCATENATED MODULE: ../../packages/tab/src/props.ts
126
+
127
+
128
+ var TabTypeEnum;
129
+ (function (TabTypeEnum) {
130
+ TabTypeEnum["CARD"] = "card";
131
+ TabTypeEnum["BORDER_CARD"] = "border-card";
132
+ TabTypeEnum["UNBORDER_CARD"] = "unborder-card";
133
+ TabTypeEnum["CARD_TAB"] = "card-tab";
134
+ TabTypeEnum["CARD_GRID"] = "card-grid";
135
+ })(TabTypeEnum || (TabTypeEnum = {}));
136
+ var PositionEnum;
137
+ (function (PositionEnum) {
138
+ PositionEnum["LEFT"] = "left";
139
+ PositionEnum["RIGHT"] = "right";
140
+ PositionEnum["TOP"] = "top";
141
+ })(PositionEnum || (PositionEnum = {}));
142
+ var TabPositionType = (0,external_vue_types_.toType)('position', {}).def(PositionEnum.TOP);
143
+ var SortTypeEnum;
144
+ (function (SortTypeEnum) {
145
+ SortTypeEnum["REPLACE"] = "replace";
146
+ SortTypeEnum["INSERT"] = "insert";
147
+ })(SortTypeEnum || (SortTypeEnum = {}));
148
+ var SortTypeUnion = (0,external_vue_types_.toType)('sortType', {}).def(SortTypeEnum.REPLACE);
149
+ var tabNavEventProps = {
150
+ tabAdd: {
151
+ type: Function,
152
+ "default": function _default() {
153
+ return {};
154
+ }
155
+ },
156
+ tabChange: {
157
+ type: Function,
158
+ "default": function _default(name) {
159
+ return name;
160
+ }
161
+ },
162
+ tabRemove: {
163
+ type: Function,
164
+ "default": function _default(name) {
165
+ return name;
166
+ }
167
+ },
168
+ tabSort: {
169
+ type: Function,
170
+ "default": function _default() {
171
+ return {};
172
+ }
173
+ // default: (dragTabIndex: number, dropTabIndex: number, sortType: string):
174
+ // {dragTabIndex: number, dropTabIndex: number, sortType: string} => ({ dragTabIndex, dropTabIndex, sortType }),
175
+ },
176
+
177
+ tabDrag: {
178
+ type: Function,
179
+ "default": function _default() {
180
+ return {};
181
+ }
182
+ }
183
+ };
184
+ var tabEventProps = {
185
+ add: {
186
+ type: Function,
187
+ "default": function _default() {
188
+ return {};
189
+ }
190
+ },
191
+ change: {
192
+ type: Function,
193
+ "default": function _default() {
194
+ return {};
195
+ }
196
+ },
197
+ remove: {
198
+ type: Function,
199
+ "default": function _default() {
200
+ return {};
201
+ }
202
+ },
203
+ sort: {
204
+ type: Function,
205
+ "default": function _default() {
206
+ return {};
207
+ }
208
+ },
209
+ drag: {
210
+ type: Function,
211
+ "default": function _default() {
212
+ return {};
213
+ }
214
+ }
215
+ // ...TabNavEventProps,
216
+ };
217
+
218
+ var tabPanelProps = {
219
+ name: external_shared_.PropTypes.oneOfType([external_shared_.PropTypes.number, external_shared_.PropTypes.string]).def(''),
220
+ label: external_shared_.PropTypes.string || external_shared_.PropTypes.func,
221
+ tips: external_shared_.PropTypes.string,
222
+ closable: external_shared_.PropTypes.bool,
223
+ visible: external_shared_.PropTypes.bool.def(true),
224
+ disabled: external_shared_.PropTypes.bool,
225
+ sortable: external_shared_.PropTypes.bool,
226
+ renderDirective: (0,external_shared_.renderDirectiveType)(),
227
+ panel: external_shared_.PropTypes.string || external_shared_.PropTypes.func
228
+ };
229
+ var tabProps = {
230
+ active: external_shared_.PropTypes.oneOfType([external_shared_.PropTypes.number, external_shared_.PropTypes.string]).def(''),
231
+ type: (0,external_vue_types_.toType)('type', {}).def(TabTypeEnum.BORDER_CARD),
232
+ tabPosition: TabPositionType,
233
+ closable: Boolean,
234
+ addable: Boolean,
235
+ sortable: Boolean,
236
+ sortType: SortTypeUnion,
237
+ labelHeight: external_shared_.PropTypes.number.def(50),
238
+ scrollStep: external_shared_.PropTypes.number.def(200),
239
+ extCls: external_shared_.PropTypes.string.def(''),
240
+ validateActive: external_shared_.PropTypes.bool.def(true),
241
+ showHeader: external_shared_.PropTypes.bool.def(true),
242
+ changeOnHover: external_shared_.PropTypes.bool.def(false),
243
+ changeOnHoverDelay: external_shared_.PropTypes.number.def(1000),
244
+ activeBarSize: external_shared_.PropTypes.number.def(2),
245
+ activeBarColor: external_shared_.PropTypes.string.def('#3a84ff')
246
+ };
247
+ var tabNavProps = Object.assign({
248
+ active: external_shared_.PropTypes.oneOfType([external_shared_.PropTypes.number, external_shared_.PropTypes.string]).def(''),
249
+ type: (0,external_vue_types_.toType)('type', {}).def(TabTypeEnum.BORDER_CARD),
250
+ activeBarColor: external_shared_.PropTypes.string.def('#3a84ff'),
251
+ activeBarSize: external_shared_.PropTypes.number.def(2),
252
+ panels: {
253
+ type: Array,
254
+ "default": function _default() {
255
+ return [];
256
+ }
257
+ },
258
+ tabPosition: TabPositionType,
259
+ closable: Boolean,
260
+ addable: Boolean,
261
+ sortable: Boolean,
262
+ sortType: SortTypeUnion,
263
+ labelHeight: external_shared_.PropTypes.number.def(50),
264
+ scrollStep: external_shared_.PropTypes.number.def(200),
265
+ validateActive: external_shared_.PropTypes.bool.def(true),
266
+ changeOnHover: external_shared_.PropTypes.bool.def(false),
267
+ changeOnHoverDelay: external_shared_.PropTypes.number.def(1000)
268
+ }, tabNavEventProps);
269
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
270
+ function _arrayLikeToArray(arr, len) {
271
+ if (len == null || len > arr.length) len = arr.length;
272
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
273
+ return arr2;
274
+ }
275
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
276
+
277
+ function _arrayWithoutHoles(arr) {
278
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
279
+ }
280
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/iterableToArray.js
281
+ function _iterableToArray(iter) {
282
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
283
+ }
284
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
285
+
286
+ function _unsupportedIterableToArray(o, minLen) {
287
+ if (!o) return;
288
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
289
+ var n = Object.prototype.toString.call(o).slice(8, -1);
290
+ if (n === "Object" && o.constructor) n = o.constructor.name;
291
+ if (n === "Map" || n === "Set") return Array.from(o);
292
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
293
+ }
294
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
295
+ function _nonIterableSpread() {
296
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
297
+ }
298
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
299
+
300
+
301
+
302
+
303
+ function _toConsumableArray(arr) {
304
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
305
+ }
306
+ // EXTERNAL MODULE: external "vue"
307
+ var external_vue_ = __webpack_require__(748);
308
+ // EXTERNAL MODULE: external "../directives"
309
+ var external_directives_ = __webpack_require__(4061);
310
+ // EXTERNAL MODULE: external "../icon/"
311
+ var _ = __webpack_require__(7685);
312
+ ;// CONCATENATED MODULE: ../../packages/tab/src/tab-nav.tsx
313
+
314
+ /*
315
+ * Tencent is pleased to support the open source community by making
316
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
317
+ *
318
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
319
+ *
320
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
321
+ *
322
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
323
+ *
324
+ * ---------------------------------------------------
325
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
326
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
327
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
328
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
329
+ *
330
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
331
+ * the Software.
332
+ *
333
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
334
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
335
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
336
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
337
+ * IN THE SOFTWARE.
338
+ */
339
+
340
+
341
+
342
+
343
+
344
+ /* harmony default export */ const tab_nav = ((0,external_vue_.defineComponent)({
345
+ name: 'TabNav',
346
+ directives: {
347
+ bkTooltips: external_directives_.bkTooltips
348
+ },
349
+ props: tabNavProps,
350
+ setup: function setup(props) {
351
+ var activeRef = (0,external_vue_.ref)(null);
352
+ var activeBarStyle = (0,external_vue_.computed)(function () {
353
+ var initStyle = {
354
+ width: 0,
355
+ height: 0,
356
+ bottom: 0,
357
+ left: 0
358
+ };
359
+ if (!activeRef.value) {
360
+ return initStyle;
361
+ }
362
+ if ([PositionEnum.LEFT, PositionEnum.RIGHT].includes(props.tabPosition)) {
363
+ var _activeRef$value = activeRef.value,
364
+ clientHeight = _activeRef$value.clientHeight,
365
+ offsetTop = _activeRef$value.offsetTop;
366
+ var style = {
367
+ width: "".concat(props.activeBarSize, "px"),
368
+ height: "".concat(clientHeight, "px"),
369
+ top: "".concat(offsetTop, "px"),
370
+ background: props.activeBarColor
371
+ };
372
+ if (props.tabPosition === PositionEnum.LEFT) {
373
+ style.right = 0;
374
+ } else {
375
+ style.left = 0;
376
+ }
377
+ return style;
378
+ }
379
+ if (props.type === TabTypeEnum.UNBORDER_CARD) {
380
+ var _activeRef$value2 = activeRef.value,
381
+ clientWidth = _activeRef$value2.clientWidth,
382
+ offsetLeft = _activeRef$value2.offsetLeft;
383
+ return {
384
+ width: "".concat(clientWidth, "px"),
385
+ height: "".concat(props.activeBarSize, "px"),
386
+ left: "".concat(offsetLeft, "px"),
387
+ bottom: 0,
388
+ background: props.activeBarColor
389
+ };
390
+ }
391
+ return initStyle;
392
+ });
393
+ var navs = (0,external_vue_.computed)(function () {
394
+ if (!Array.isArray(props.panels) || !props.panels.length) {
395
+ return [];
396
+ }
397
+ var list = [];
398
+ var hasFindActive = false;
399
+ props.panels.filter(function (item, index) {
400
+ if (!item.props) {
401
+ return null;
402
+ }
403
+ var _item$props = item.props,
404
+ name = _item$props.name,
405
+ label = _item$props.label,
406
+ closable = _item$props.closable,
407
+ visible = _item$props.visible,
408
+ disabled = _item$props.disabled,
409
+ sortable = _item$props.sortable,
410
+ tips = _item$props.tips;
411
+ if (!visible) {
412
+ return false;
413
+ }
414
+ if (props.active === name) {
415
+ hasFindActive = true;
416
+ }
417
+ var renderLabel = function renderLabel(label) {
418
+ if (item.slots.label) {
419
+ return (0,external_vue_.h)(item.slots.label);
420
+ }
421
+ if ([undefined, ''].includes(label)) {
422
+ return "\u9009\u9879\u5361".concat(index + 1);
423
+ }
424
+ if (typeof label === 'string') {
425
+ return label;
426
+ }
427
+ if (typeof label === 'function') {
428
+ return (0,external_vue_.h)(label);
429
+ }
430
+ return label;
431
+ };
432
+ list.push({
433
+ name: name,
434
+ closable: closable,
435
+ visible: visible,
436
+ disabled: disabled,
437
+ sortable: sortable,
438
+ tips: tips,
439
+ tabLabel: renderLabel(label)
440
+ });
441
+ return true;
442
+ });
443
+ if (!hasFindActive && props.validateActive) {
444
+ props.panels[0].props && props.tabChange(props.panels[0].props.name);
445
+ }
446
+ return list;
447
+ });
448
+ var dragenterIndex = (0,external_vue_.ref)(-1);
449
+ var dragStartIndex = (0,external_vue_.ref)(-1);
450
+ var draggingEle = (0,external_vue_.ref)('');
451
+ var distinctRoots = function distinctRoots(el1, el2) {
452
+ return el1 === el2;
453
+ };
454
+ var methods = {
455
+ /**
456
+ * @description 判断拖动的元素是否是在同一个tab。
457
+ * 使用guid,相比 el1.parentNode === el2.parentNode 判断,性能要高
458
+ * @param e {event} 触发的元素
459
+ * @return {boolean}
460
+ */
461
+ handleTabAdd: function handleTabAdd(e) {
462
+ props.tabAdd(e);
463
+ },
464
+ dragstart: function dragstart(index, $event) {
465
+ dragStartIndex.value = index;
466
+ draggingEle.value = props.guid;
467
+ // 拖动鼠标效果
468
+ Object.assign($event.dataTransfer, {
469
+ effectAllowed: 'move'
470
+ });
471
+ // $event.dataTransfer.setData('text/plain', index)
472
+ props.tabDrag(index, $event);
473
+ },
474
+ dragenter: function dragenter(index) {
475
+ // 缓存目标元素索引,方便添加样式
476
+ if (distinctRoots(draggingEle.value, props.guid)) {
477
+ dragenterIndex.value = index;
478
+ }
479
+ },
480
+ dragend: function dragend() {
481
+ dragenterIndex.value = -1;
482
+ dragStartIndex.value = -1;
483
+ draggingEle.value = null;
484
+ },
485
+ drop: function drop(index, sortType) {
486
+ // 不是同一个tab,返回——暂时不支持跨tab拖动
487
+ if (!distinctRoots(draggingEle.value, props.guid)) {
488
+ return false;
489
+ }
490
+ props.tabSort(dragStartIndex.value, index, sortType);
491
+ },
492
+ handleTabChange: function handleTabChange(name) {
493
+ props.tabChange(name);
494
+ },
495
+ handleTabRemove: function handleTabRemove(index, panel) {
496
+ props.tabRemove(index, panel);
497
+ }
498
+ };
499
+ return Object.assign(Object.assign({}, methods), {
500
+ activeRef: activeRef,
501
+ activeBarStyle: activeBarStyle,
502
+ navs: navs,
503
+ dragenterIndex: dragenterIndex,
504
+ dragStartIndex: dragStartIndex,
505
+ draggingEle: draggingEle,
506
+ guid: Math.random().toString(16).substr(4) + Math.random().toString(16).substr(4)
507
+ });
508
+ },
509
+ render: function render() {
510
+ var _this = this;
511
+ var active = this.active,
512
+ closable = this.closable,
513
+ addable = this.addable,
514
+ sortable = this.sortable,
515
+ sortType = this.sortType,
516
+ labelHeight = this.labelHeight,
517
+ dragstart = this.dragstart,
518
+ dragenter = this.dragenter,
519
+ dragend = this.dragend,
520
+ drop = this.drop;
521
+ var renderNavs = function renderNavs() {
522
+ return _this.navs.map(function (item, index) {
523
+ if (!item) {
524
+ return null;
525
+ }
526
+ var name = item.name,
527
+ disabled = item.disabled,
528
+ tabLabel = item.tabLabel;
529
+ var getNavItemClass = function getNavItemClass() {
530
+ var classNames = [(0,external_shared_.resolveClassName)('tab-header-item')];
531
+ if (disabled) {
532
+ classNames.push((0,external_shared_.resolveClassName)('tab-header--disabled'));
533
+ }
534
+ if (active === name) {
535
+ classNames.push((0,external_shared_.resolveClassName)('tab-header--active'));
536
+ }
537
+ return classNames.join(' ');
538
+ };
539
+ var getValue = function getValue(curentValue, parentValue) {
540
+ return !disabled && (curentValue || parentValue);
541
+ };
542
+ return (0,external_vue_.withDirectives)((0,external_vue_.createVNode)("div", {
543
+ "key": name,
544
+ "onClick": function onClick() {
545
+ return !disabled && _this.handleTabChange(name);
546
+ },
547
+ "draggable": getValue(item.sortable, sortable),
548
+ "onDragstart": function onDragstart(e) {
549
+ return dragstart(index, e);
550
+ },
551
+ "ref": active === name ? 'activeRef' : '',
552
+ "onDragenter": function onDragenter(e) {
553
+ e.preventDefault();
554
+ dragenter(index);
555
+ },
556
+ "onDragleave": function onDragleave(e) {
557
+ e.preventDefault();
558
+ },
559
+ "onDragover": function onDragover(e) {
560
+ e.preventDefault();
561
+ },
562
+ "onDragend": function onDragend(e) {
563
+ e.preventDefault();
564
+ dragend();
565
+ },
566
+ "onDrop": function onDrop(e) {
567
+ e.preventDefault();
568
+ drop(index, sortType);
569
+ },
570
+ "class": getNavItemClass()
571
+ }, [(0,external_vue_.createVNode)("div", null, [tabLabel]), getValue(item.closable, closable) ? (0,external_vue_.createVNode)("span", {
572
+ "class": (0,external_shared_.resolveClassName)('tab-header--close'),
573
+ "onClick": function onClick() {
574
+ return _this.handleTabRemove(index, item);
575
+ }
576
+ }, [(0,external_vue_.createVNode)(_.Close, null, null)]) : '']), [[(0,external_vue_.resolveDirective)("bk-tooltips"), {
577
+ content: item.tips,
578
+ disabled: !item.tips
579
+ }]]);
580
+ });
581
+ };
582
+ var renderOperation = function renderOperation() {
583
+ var _a, _b;
584
+ var list = [];
585
+ if (typeof _this.$slots.add === 'function') {
586
+ list.push((_b = (_a = _this.$slots).add) === null || _b === void 0 ? void 0 : _b.call(_a, external_vue_.h));
587
+ } else if (addable) {
588
+ list.push((0,external_vue_.createVNode)("div", {
589
+ "onClick": _this.handleTabAdd
590
+ }, [(0,external_vue_.createVNode)(_.Plus, {
591
+ "style": "display:flex;",
592
+ "width": 26,
593
+ "height": 26
594
+ }, null)]));
595
+ }
596
+ if (list.length) {
597
+ return (0,external_vue_.createVNode)("div", {
598
+ "class": (0,external_shared_.resolveClassName)('tab-header-operation')
599
+ }, [list.map(function (item, index) {
600
+ return (0,external_vue_.createVNode)("div", {
601
+ "class": (0,external_shared_.resolveClassName)('tab-header-item'),
602
+ "key": index
603
+ }, [item]);
604
+ })]);
605
+ }
606
+ return null;
607
+ };
608
+ var renderActiveBar = function renderActiveBar() {
609
+ if (_this.type === TabTypeEnum.UNBORDER_CARD) {
610
+ return (0,external_vue_.createVNode)("div", {
611
+ "style": _this.activeBarStyle,
612
+ "class": (0,external_shared_.resolveClassName)('tab-header-active-bar')
613
+ }, null);
614
+ }
615
+ return '';
616
+ };
617
+ var setting = typeof this.$slots.setting === 'function' ? (0,external_vue_.createVNode)("div", {
618
+ "class": (0,external_shared_.resolveClassName)('tab-header-setting')
619
+ }, [this.$slots.setting()]) : null;
620
+ var operations = renderOperation();
621
+ return (0,external_vue_.createVNode)("div", {
622
+ "style": {
623
+ lineHeight: "".concat(labelHeight, "px")
624
+ },
625
+ "class": (0,external_shared_.resolveClassName)('tab-header')
626
+ }, [(0,external_vue_.createVNode)("div", {
627
+ "class": [(0,external_shared_.resolveClassName)('tab-header-nav'), operations || setting ? 'tab-header-auto' : '']
628
+ }, [renderActiveBar(), renderNavs()]), operations, setting]);
629
+ }
630
+ }));
631
+ ;// CONCATENATED MODULE: ../../packages/tab/src/tab.tsx
632
+
633
+
634
+ /*
635
+ * Tencent is pleased to support the open source community by making
636
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
637
+ *
638
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
639
+ *
640
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
641
+ *
642
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
643
+ *
644
+ * ---------------------------------------------------
645
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
646
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
647
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
648
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
649
+ *
650
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
651
+ * the Software.
652
+ *
653
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
654
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
655
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
656
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
657
+ * IN THE SOFTWARE.
658
+ */
659
+
660
+
661
+
662
+
663
+ /* harmony default export */ const tab = ((0,external_vue_.defineComponent)({
664
+ name: 'Tab',
665
+ components: {
666
+ TabNav: tab_nav
667
+ },
668
+ props: tabProps,
669
+ emits: [
670
+ // 兼容老方法
671
+ 'add-panel', 'tab-change', 'remove-panel', 'sort-change', 'on-drag-tab',
672
+ // 新方法
673
+ 'add', 'change', 'remove', 'update:active', 'sort', 'drag'],
674
+ setup: function setup(_props, _ref) {
675
+ var slots = _ref.slots,
676
+ emit = _ref.emit;
677
+ var isMounted = (0,external_vue_.ref)(false);
678
+ var panels = (0,external_vue_.ref)([]);
679
+ var instance = (0,external_vue_.getCurrentInstance)();
680
+ // 动态插入tabPanel
681
+ var getPaneInstanceFromSlot = function getPaneInstanceFromSlot(vnode) {
682
+ var panelInstanceList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
683
+ var children = vnode.children;
684
+ (children || []).forEach(function (node) {
685
+ var type = node.type;
686
+ type = type.name || type;
687
+ if (type === 'TabPanel' && node.component) {
688
+ panelInstanceList.push(node.component);
689
+ } else if (type === external_vue_.Fragment || type === 'template') {
690
+ getPaneInstanceFromSlot(node, panelInstanceList);
691
+ }
692
+ });
693
+ return panelInstanceList;
694
+ };
695
+ var setPanelInstances = function setPanelInstances() {
696
+ if (slots["default"]) {
697
+ var children = instance.subTree.children[1].children;
698
+ if (!children) return;
699
+ var content = children[0];
700
+ var panelInstanceList = getPaneInstanceFromSlot(content);
701
+ var isChanged = panelInstanceList.length !== panels.value.length;
702
+ if (isChanged) {
703
+ panels.value = panelInstanceList;
704
+ }
705
+ }
706
+ };
707
+ (0,external_vue_.onMounted)(function () {
708
+ /* 如果是列表模式,直接渲染
709
+ if (props.panels?.length) {
710
+ panels.value = props.panels;
711
+ return;
712
+ }
713
+ */
714
+ setPanelInstances();
715
+ isMounted.value = true;
716
+ (0,external_vue_.onUpdated)(function () {
717
+ setPanelInstances();
718
+ });
719
+ });
720
+ var methods = {
721
+ tabAdd: function tabAdd(e) {
722
+ emit('add', {
723
+ e: e
724
+ });
725
+ emit('add-panel', {
726
+ e: e
727
+ });
728
+ },
729
+ tabChange: function tabChange(name) {
730
+ // emit('xxx') 会调用onXxx函数, 所以不必在主动调用onXxx函数了
731
+ emit('change', name);
732
+ emit('tab-change', name);
733
+ emit('update:active', name);
734
+ },
735
+ tabRemove: function tabRemove(index, panel) {
736
+ // emit('xxx') 会调用onXxx函数, 所以不必在主动调用onXxx函数了
737
+ emit('remove', index, panel);
738
+ emit('remove-panel', index, panel);
739
+ },
740
+ tabSort: function tabSort(dragTabIndex, dropTabIndex, sortType) {
741
+ var list = panels.value;
742
+ // 如果是插队模式
743
+ if (sortType === SortTypeEnum.INSERT) {
744
+ if (dragTabIndex < dropTabIndex) {
745
+ list.splice(dropTabIndex + 1, 0, panels[dragTabIndex]);
746
+ list.splice(dragTabIndex, 1);
747
+ } else if (dragTabIndex > dropTabIndex) {
748
+ list.splice(dropTabIndex, 0, panels[dragTabIndex]);
749
+ list.splice(dragTabIndex + 1, 1);
750
+ } else {
751
+ return false;
752
+ }
753
+ } else {
754
+ var swap = list[dropTabIndex];
755
+ list[dropTabIndex] = list[dragTabIndex];
756
+ list[dragTabIndex] = swap;
757
+ }
758
+ panels.value = _toConsumableArray(list);
759
+ // emit('xxx') 会调用onXxx函数, 所以不必在主动调用onXxx函数了
760
+ emit('sort', dragTabIndex, dropTabIndex, sortType);
761
+ emit('sort-change', dragTabIndex, dropTabIndex, sortType);
762
+ },
763
+ tabDrag: function tabDrag(dragTabIndex, dragEvent) {
764
+ // emit('xxx') 会调用onXxx函数, 所以不必在主动调用onXxx函数了
765
+ emit('drag', dragTabIndex, dragEvent);
766
+ emit('on-drag-tab', dragTabIndex, dragEvent);
767
+ }
768
+ };
769
+ return Object.assign(Object.assign({}, methods), {
770
+ isMounted: isMounted,
771
+ panels: panels
772
+ });
773
+ },
774
+ render: function render() {
775
+ var _this = this;
776
+ var _a, _b;
777
+ var getTabBoxClass = function getTabBoxClass() {
778
+ var arr = [(0,external_shared_.resolveClassName)('tab'), _this.extCls];
779
+ if (_this.tabPosition === PositionEnum.TOP) {
780
+ arr.push((0,external_shared_.resolveClassName)("tab--".concat(_this.tabPosition)), (0,external_shared_.resolveClassName)("tab--".concat(_this.type)));
781
+ } else {
782
+ arr.push((0,external_shared_.resolveClassName)("tab--".concat(_this.tabPosition)));
783
+ if (_this.type === TabTypeEnum.CARD_TAB) {
784
+ arr.push((0,external_shared_.resolveClassName)('tab--vertical-tab'));
785
+ }
786
+ }
787
+ return arr;
788
+ };
789
+ var getTabHeader = function getTabHeader() {
790
+ var panels = _this.panels,
791
+ active = _this.active,
792
+ type = _this.type,
793
+ closable = _this.closable,
794
+ addable = _this.addable,
795
+ sortable = _this.sortable,
796
+ sortType = _this.sortType,
797
+ labelHeight = _this.labelHeight,
798
+ scrollStep = _this.scrollStep,
799
+ validateActive = _this.validateActive,
800
+ changeOnHover = _this.changeOnHover,
801
+ changeOnHoverDelay = _this.changeOnHoverDelay,
802
+ tabPosition = _this.tabPosition,
803
+ activeBarSize = _this.activeBarSize,
804
+ activeBarColor = _this.activeBarColor,
805
+ tabAdd = _this.tabAdd,
806
+ tabChange = _this.tabChange,
807
+ tabRemove = _this.tabRemove,
808
+ tabSort = _this.tabSort,
809
+ tabDrag = _this.tabDrag;
810
+ var props = {
811
+ panels: panels,
812
+ active: active,
813
+ type: type,
814
+ closable: closable,
815
+ addable: addable,
816
+ sortable: sortable,
817
+ sortType: sortType,
818
+ labelHeight: labelHeight,
819
+ scrollStep: scrollStep,
820
+ validateActive: validateActive,
821
+ changeOnHover: changeOnHover,
822
+ changeOnHoverDelay: changeOnHoverDelay,
823
+ tabPosition: tabPosition,
824
+ activeBarSize: activeBarSize,
825
+ activeBarColor: activeBarColor,
826
+ // function
827
+ tabAdd: tabAdd,
828
+ tabChange: tabChange,
829
+ tabRemove: tabRemove,
830
+ tabSort: tabSort,
831
+ tabDrag: tabDrag
832
+ };
833
+ if (!panels || !Array.isArray(panels)) {
834
+ return null;
835
+ }
836
+ return (0,external_vue_.createVNode)(tab_nav, props, _this.$slots);
837
+ };
838
+ return (0,external_vue_.createVNode)("div", {
839
+ "class": getTabBoxClass()
840
+ }, [getTabHeader(), (0,external_vue_.createVNode)("div", {
841
+ "class": (0,external_shared_.resolveClassName)('tab-content')
842
+ }, [(_b = (_a = this.$slots)["default"]) === null || _b === void 0 ? void 0 : _b.call(_a)])]);
843
+ }
844
+ }));
845
+ ;// CONCATENATED MODULE: ../../packages/tab/src/tab-panel.tsx
846
+
847
+ /*
848
+ * Tencent is pleased to support the open source community by making
849
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
850
+ *
851
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
852
+ *
853
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
854
+ *
855
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
856
+ *
857
+ * ---------------------------------------------------
858
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
859
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
860
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
861
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
862
+ *
863
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
864
+ * the Software.
865
+ *
866
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
867
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
868
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
869
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
870
+ * IN THE SOFTWARE.
871
+ */
872
+
873
+
874
+
875
+ /* harmony default export */ const tab_panel = ((0,external_vue_.defineComponent)({
876
+ name: 'TabPanel',
877
+ props: tabPanelProps,
878
+ render: function render() {
879
+ var _this = this;
880
+ var active = this.name === this.$parent.active;
881
+ var getContent = function getContent() {
882
+ // 不渲染
883
+ if (!_this.visible || _this.renderDirective === 'if' && !active) {
884
+ return null;
885
+ }
886
+ if (typeof _this.panel === 'function') {
887
+ return _this.panel(external_vue_.h);
888
+ }
889
+ if (typeof _this.$slots["default"] === 'function') {
890
+ return _this.$slots["default"](null);
891
+ }
892
+ if (typeof _this.$slots.panel === 'function') {
893
+ return _this.$slots.panel(null);
894
+ }
895
+ return null;
896
+ };
897
+ return (0,external_vue_.withDirectives)((0,external_vue_.createVNode)("div", {
898
+ "ref": "content",
899
+ "class": (0,external_shared_.resolveClassName)('tab-panel')
900
+ }, [getContent()]), [[external_vue_.vShow, active]]);
901
+ }
902
+ }));
903
+ ;// CONCATENATED MODULE: ../../packages/tab/src/index.ts
904
+
905
+
906
+
907
+
908
+ var BkTab = (0,external_shared_.withInstallProps)(tab, {
909
+ TabPanel: tab_panel
910
+ });
911
+
912
+ /* harmony default export */ const src = (BkTab);
913
+ })();
914
+
915
+ /******/ return __webpack_exports__;
916
+ /******/ })()
917
+ ;
918
+ });