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