bkui-vue 0.0.1-beta.81 → 0.0.1-beta.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/index.cjs.js +29 -29
  2. package/dist/index.esm.js +518 -255
  3. package/dist/index.umd.js +29 -29
  4. package/dist/style.css +1 -1
  5. package/lib/button/button.css +16 -11
  6. package/lib/button/button.d.ts +0 -10
  7. package/lib/button/button.less +28 -13
  8. package/lib/button/button.variable.css +16 -11
  9. package/lib/button/index.d.ts +1 -16
  10. package/lib/button/index.js +1 -1
  11. package/lib/cascader/cascader.d.ts +1 -1
  12. package/lib/cascader/index.d.ts +4 -4
  13. package/lib/input/input.css +4 -1
  14. package/lib/input/input.less +4 -1
  15. package/lib/input/input.variable.css +4 -1
  16. package/lib/loading/loading.css +4 -3
  17. package/lib/loading/loading.less +4 -3
  18. package/lib/loading/loading.variable.css +4 -3
  19. package/lib/pagination/index.js +1 -1
  20. package/lib/select/common.d.ts +4 -4
  21. package/lib/select/index.d.ts +563 -212
  22. package/lib/select/index.js +1 -1
  23. package/lib/select/option.d.ts +11 -4
  24. package/lib/select/select.css +31 -59
  25. package/lib/select/select.d.ts +168 -62
  26. package/lib/select/select.less +43 -51
  27. package/lib/select/select.variable.css +31 -59
  28. package/lib/select/selectTagInput.d.ts +71 -0
  29. package/lib/select/type.d.ts +9 -5
  30. package/lib/shared/index.js +1 -1
  31. package/lib/tab/index.d.ts +7 -7
  32. package/lib/tab/tab.d.ts +2 -2
  33. package/lib/table/index.d.ts +16 -5
  34. package/lib/table/index.js +1 -1
  35. package/lib/table/props.d.ts +4 -1
  36. package/lib/table/render.d.ts +1 -1
  37. package/lib/table/table.css +26 -7
  38. package/lib/table/table.d.ts +7 -2
  39. package/lib/table/table.less +29 -6
  40. package/lib/table/table.variable.css +26 -7
  41. package/lib/table/use-common.d.ts +4 -2
  42. package/lib/tag-input/index.d.ts +4 -4
  43. package/lib/tag-input/index.js +1 -1
  44. package/lib/tag-input/tag-input.d.ts +1 -1
  45. package/lib/transfer/index.js +1 -1
  46. package/lib/transfer/transfer.css +41 -60
  47. package/lib/transfer/transfer.less +55 -82
  48. package/lib/transfer/transfer.variable.css +41 -60
  49. package/lib/tree/index.js +1 -1
  50. package/package.json +1 -1
@@ -1 +1 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("lodash"),require("../directives"),require("../icon"),require("../loading"),require("../popover"));else if("function"==typeof define&&define.amd)define(["../shared","vue","lodash","../directives","../icon","../loading","../popover"],t);else{var r="object"==typeof exports?t(require("../shared"),require("vue"),require("lodash"),require("../directives"),require("../icon"),require("../loading"),require("../popover")):t(e["../shared"],e.vue,e.lodash,e["../directives"],e["../icon"],e["../loading"],e["../popover"]);for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(self,((e,t,r,a,n,o,l)=>(()=>{"use strict";var i={4061:e=>{e.exports=a},6870:e=>{e.exports=n},4870:e=>{e.exports=o},5537:e=>{e.exports=l},4212:t=>{t.exports=e},467:e=>{e.exports=r},748:e=>{e.exports=t}},s={};function u(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return i[e](r,r.exports,u),r.exports}u.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return u.d(t,{a:t}),t},u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var c={};return(()=>{u.r(c),u.d(c,{default:()=>L});var e=u(4212);function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}function a(e,t){if(e){if("string"==typeof e)return r(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)?r(e,t):void 0}}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||a(e)||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.")}()}var l=u(748),i=u(467),s=u(4061),d=u(6870),p=u(4870),f=u.n(p),g=u(5537),v=u.n(g),h=12,y=function(e){for(var t=e.length,r=0,a=0;a<t;a++)0!=(65280&e.charCodeAt(a))&&(r+=1),r+=1;return r};const m=(0,l.defineComponent)({name:"ListTagRender",props:{node:e.PropTypes.object,searchKey:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.arrayOf(e.PropTypes.string)]),displayKey:e.PropTypes.string,searchKeyword:e.PropTypes.string,tpl:{type:Function,default:null}},render:function(){var e=this,t=function(t){if(e.searchKeyword){var r=new RegExp("(".concat(e.searchKeyword,")"),"i");return t.replace(r,'<strong class="highlight-text">$1</strong>')}return t};if(this.tpl)return this.tpl(this.node,t,l.h,this);var r=this.node[this.displayKey];return(0,l.createVNode)("div",{class:"bk-selector-node"},[(0,l.createVNode)("span",{class:"text",innerHTML:t(r)},[r])])}}),b=(0,l.defineComponent)({name:"TagRender",props:{node:e.PropTypes.object,displayKey:e.PropTypes.string,tpl:{type:Function,default:null}},render:function(){return this.tpl?this.tpl(this.node,l.h,this):(0,l.createVNode)("div",{class:"tag"},[(0,l.createVNode)("span",{class:"text"},[this.node[this.displayKey]])])}}),T=(0,l.defineComponent)({name:"TagInput",directives:{bkTooltips:s.bkTooltips},props:{modelValue:e.PropTypes.arrayOf(e.PropTypes.string).def([]),placeholder:e.PropTypes.string.def("请输入并按 Enter 结束"),list:e.PropTypes.arrayOf(e.PropTypes.object).def([]),disabled:e.PropTypes.bool.def(!1),tooltipKey:e.PropTypes.string.def(""),saveKey:e.PropTypes.string.def("id"),displayKey:e.PropTypes.string.def("name"),hasDeleteIcon:e.PropTypes.bool.def(!1),clearable:e.PropTypes.bool.def(!0),trigger:e.PropTypes.commonType(["focus","search"]).def("search"),searchKey:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.arrayOf(e.PropTypes.string)]).def("name"),useGroup:e.PropTypes.bool.def(!1),allowCreate:e.PropTypes.bool.def(!1),maxData:e.PropTypes.number.def(-1),maxResult:e.PropTypes.number.def(10),contentMaxHeight:e.PropTypes.number.def(300),contentWidth:e.PropTypes.number.def(190),separator:e.PropTypes.string.def(""),allowNextFocus:e.PropTypes.bool.def(!0),allowAutoMatch:e.PropTypes.bool.def(!1),showClearOnlyHover:e.PropTypes.bool.def(!1),leftSpace:e.PropTypes.number.def(0),createTagValidator:{type:Function,default:null},filterCallback:{type:Function,default:null},tagTpl:{type:Function,default:null},tpl:{type:Function,default:null},pasteFn:{type:Function,default:null}},emits:["update:modelValue","change","select","blur","remove","removeAll"],setup:function(e,r){var s=r.emit,u=(0,l.reactive)({isEdit:!1,isHover:!1,focusItemIndex:e.allowCreate?-1:0}),c=(0,l.reactive)({isShow:!1,width:190,modifiers:[{name:"offset",options:{offset:[0,4]}}]}),d=function(e){var t=(0,l.reactive)({curPage:1,totalSize:0,totalPage:0,pageSize:e,isPageLoading:!1,curPageList:[],renderListPaged:[]});return{pageState:t,initPage:function(){var e,r,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.curPage=1,t.totalSize=a.length,t.totalPage=Math.ceil(t.totalSize/t.pageSize)||1;var n=[];if(t.pageSize>0)for(var l=0;l<t.totalSize;l+=t.pageSize)n.push(a.slice(l,l+t.pageSize));(e=t.renderListPaged).splice.apply(e,[0,t.renderListPaged.length].concat(n)),(r=t.curPageList).splice.apply(r,[0,t.curPageList.length].concat(o(t.renderListPaged[t.curPage-1]||[])))},pageChange:function(e){var r;t.curPage=e,(r=t.curPageList).splice.apply(r,[t.curPageList.length,0].concat(o(t.renderListPaged[t.curPage-1]||[]))),t.isPageLoading=!1}}}((0,l.toRefs)(e).maxResult),p=d.pageState,f=d.initPage,g=d.pageChange,v=(0,l.ref)(""),m=(0,l.ref)(null),b=(0,l.ref)(null),T=(0,l.ref)(null),L=(0,l.ref)(null),w=(0,l.ref)(null),P=(0,l.ref)(null),x=(0,l.ref)(null),I=(0,l.computed)((function(){return!e.disabled&&e.hasDeleteIcon})),S=(0,l.computed)((function(){return 1===e.maxData})),C=(0,l.computed)((function(){return 0===R.selectedTagList.length&&""===v.value&&!u.isEdit})),K=(0,l.computed)((function(){return e.clearable&&!e.disabled&&0!==R.selectedTagList.length&&(!e.showClearOnlyHover||u.isHover)})),V=(0,l.computed)((function(){return{"bk-tag-input-trigger":!0,active:u.isEdit,disabled:e.disabled}}));(0,l.watch)([function(){return o(e.modelValue)},function(){return o(e.list)}],(function(){F()})),(0,l.watch)(v,(0,i.debounce)((function(){var t=0!==p.curPageList.length,r=v.value;""!==r&&t||""===r&&"focus"===e.trigger&&t?c.isShow=!0:"focus"===e.trigger&&t||(c.isShow=!1)}),150)),(0,l.watch)((function(){return c.isShow}),(function(e){k(),e&&w.value&&((0,l.nextTick)((function(){w.value.scrollTop=0})),w.value.removeEventListener("scroll",N),w.value.addEventListener("scroll",N))}));var k=function(){var e,t,r=S.value?0:null===(e=L.value)||void 0===e?void 0:e.offsetLeft;c.modifiers=[{name:"offset",options:{offset:[r,4]}}],null===(t=P.value)||void 0===t||t.update()},N=function(){if(!p.isPageLoading&&0!==w.value.scrollTop){var e=w.value;if(e.scrollTop+e.offsetHeight>=e.scrollHeight){var t=p.curPage+1;t<=p.totalPage&&(p.isPageLoading=!0,setTimeout((function(){g(t)}),500))}}},A=function(){var e;return Array.from((null===(e=T.value)||void 0===e?void 0:e.childNodes)||[]).filter((function(e){return e.nodeType!==Node.TEXT_NODE}))},O=function(t){if(!e.disabled){if(null==t?void 0:t.target){var r=t.target.className;(r.indexOf("bk-tag-input-trigger")>-1||r.indexOf("tag-list")>-1)&&T.value.appendChild(L.value)}clearTimeout(x.value),S.value&&j.value.length&&(R.tagListCache=o(j.value),R.selectedTagListCache=o(R.selectedTagList),v.value=R.selectedTagListCache[0][e.saveKey],$(R.selectedTagList[0],0),H()),u.isEdit=!0,(0,l.nextTick)((function(){var t;null===(t=m.value)||void 0===t||t.focus(),"focus"===e.trigger&&0!==R.localList.length&&(q(),c.isShow?k():c.isShow=!0)}))}},R=(0,l.reactive)({localList:[],tagListCache:[],selectedTagList:[],selectedTagListCache:[]}),j=(0,l.computed)((function(){return R.selectedTagList.map((function(t){return t[e.saveKey]}))})),E=function(e){var t=(0,l.toRefs)(e),r=t.useGroup,a=t.saveKey,n=t.displayKey,i=t.list,s=(0,l.reactive)([]);return(0,l.watch)([r,a,n,i],(function(){var e=i.value;r.value&&(e=i.value.reduce((function(e,t){var r=[];return t.children&&(r=t.children.map((function(e){return Object.assign({group:{groupId:t[a.value],groupName:t[n.value]}},e)}))),e.concat(r)}),[])),s.splice.apply(s,[0,s.length].concat(o(e)))}),{immediate:!0,deep:!0}),s}(e),D=(0,l.computed)((function(){if(e.useGroup){var t={};return p.curPageList.forEach((function(e,r){e.__index__=r,t[e.group.groupId]||(t[e.group.groupId]={id:e.group.groupId,name:e.group.groupName,children:[]}),t[e.group.groupId].children.push(e)})),Object.keys(t).map((function(e){return t[e]}))}return p.curPageList})),F=function(){var t=e.saveKey,r=e.modelValue,a=e.displayKey,l=e.allowCreate,i=e.trigger;R.selectedTagList=[],R.localList=o(E),r.length&&(r.forEach((function(e){var r=R.localList.find((function(r){return e===r[t]}));if(void 0!==r)R.selectedTagList.push(r);else if(l&&!j.value.includes(e)){var o;R.selectedTagList.push((n(o={},t,e),n(o,a,e),o))}})),S.value||(R.localList=R.localList.filter((function(e){return!r.includes(e[t])})))),"focus"===i&&q()},q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=e.searchKey,a=e.filterCallback,n=t.toLowerCase(),o=[];if("function"==typeof a)o=a(n,r,R.localList)||[];else if(Array.isArray(r)){var l=r.map((function(e){return R.localList.filter((function(t){return-1!==t[e].toLowerCase().indexOf(n)}))}));o=Array.from(new Set(l.flat()))}else o=R.localList.filter((function(e){return-1!==e[r].toLowerCase().indexOf(n)}));f(o)};(0,l.onMounted)((function(){F()}));var z=function(){v.value=""},_=function(){if(S.value)return 0;var e=A().findIndex((function(e){return"tagInputItem"===e.id}));return e>=0?e:0},M=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t&&e){var a=t;r&&(a=t.nextElementSibling||null),t.parentNode.insertBefore(e,a)}},H=function(t){var r=e.maxData,a=e.trigger,n=e.allowCreate;if(-1===r||r>j.value.length){var o=((null==t?void 0:t.target)?t.target:v).value,l=y(o);l?(q(o),m.value.style.width="".concat(l*h,"px")):"focus"===a&&q()}else B(),v.value="",c.isShow=!1;u.isEdit=!0,u.focusItemIndex=n?-1:0},B=function(){x.value=setTimeout((function(){var t,r,n=v.value;if(z(),u.isEdit=!1,S.value){var o=(t=R.tagListCache,r=1,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a,n,o=[],l=!0,i=!1;try{for(r=r.call(e);!(l=(a=r.next()).done)&&(o.push(a.value),!t||o.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==r.return||r.return()}finally{if(i)throw n}}return o}}(t,r)||a(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];n&&n===o&&R.selectedTagListCache.length?W(R.selectedTagListCache[0],"select"):Z("remove")}else if(e.allowAutoMatch&&n){var l=p.curPageList.find((function(t){return Array.isArray(e.searchKey)?e.searchKey.map((function(e){return t[e]})).includes(n):t[e.searchKey]===n}));l?G(l,"select"):e.allowCreate&&G(n,"custom")}c.isShow=!1,s("blur",n,j.value)}),50)},G=function(e,t,r){null==r||r.stopPropagation(),e&&!e.disabled&&(S.value&&(R.tagListCache=[],R.selectedTagListCache=[],R.selectedTagList=[]),W(e,t),Z("select"),z(),c.isShow=!1)},Z=function(e){s("change",j.value),s(e),s("update:modelValue",j.value)},U=function(){var e=w.value.clientHeight,t=w.value.getBoundingClientRect().y;(0,l.nextTick)((function(){var r=w.value.querySelector(".bk-selector-actived");if(r){var a=r.clientHeight,n=r.getBoundingClientRect().y;n<t&&(w.value.scrollTop=w.value.scrollTop-(t-n));var o=n+a-t;o>e&&(w.value.scrollTop=w.value.scrollTop+o-e)}}))},W=function(r,a){if(!(R.selectedTagList.length>=e.maxData&&-1!==e.maxData)){var i,s=e.separator,u=e.saveKey,c=e.displayKey,d=e.createTagValidator,p=_(),f=1,g=!1,v=function(e){return"function"!=typeof d||d(e)},y=function(e){return R.localList.find((function(t){return t[u]===e}))};if("custom"===a)if(s){var b,T=r.split(s),w=(T=T.filter((function(e){return(null==e?void 0:e.trim())&&!j.value.includes(e)&&v(e)}))).map((function(e){var t;return y(e)||(n(t={},u,e),n(t,c,e),t)}));T.length&&((b=R.selectedTagList).splice.apply(b,[p,0].concat(o(w))),f=w.length,g=!0)}else{var P="object"===t(r);if(void 0!==(i=(i=P?r[u]:r.trim()).replace(/\s+/g,""))&&!j.value.includes(i)&&v(i)){var x,I=y(i)||(P?r:(n(x={},u,i),n(x,c,i),x));R.selectedTagList.splice(p,0,I),g=!0}}else r&&(void 0===(i=r[u])||j.value.includes(i)||(R.selectedTagList.splice(p,0,r),g=!0));g&&(0,l.nextTick)((function(){for(var t=1;t<=f;t++){var r=A()[p+t];M(r,L.value)}m.value.style.width="".concat(h,"px"),S.value||(e.allowNextFocus&&O(),R.localList=R.localList.filter((function(e){return!j.value.includes(e[u])})))}))}},$=function(t,r){R.selectedTagList.splice(r,1);var a=E.some((function(r){return r===t[e.saveKey]}));(e.allowCreate&&a||!e.allowCreate)&&!S.value&&R.localList.push(t)};return Object.assign(Object.assign(Object.assign(Object.assign({popoverProps:c},(0,l.toRefs)(u)),(0,l.toRefs)(R)),(0,l.toRefs)(p)),{isShowPlaceholder:C,isShowClear:K,curInputValue:v,formatList:E,renderList:D,showTagClose:I,tagInputRef:m,bkTagSelectorRef:b,tagListRef:T,tagInputItemRef:L,selectorListRef:w,popoverRef:P,triggerClass:V,focusInputTrigger:O,activeClass:function(t,r){var a={"bk-selector-actived":!1,"bk-selector-selected":j.value.includes(t[e.saveKey])};return e.useGroup?a["bk-selector-actived"]=t.__index__===u.focusItemIndex:a["bk-selector-actived"]=r===u.focusItemIndex,a},handleInput:H,handleFocus:function(){var t;c.width=S.value?null===(t=b.value)||void 0===t?void 0:t.clientWidth:e.contentWidth},handleBlur:B,handleTagSelected:G,handleTagRemove:function(e,t,r){null==r||r.stopPropagation(),$(e,t),z(),Z("remove"),m.value.style.width="".concat(h,"px")},handleClear:function(t){t.stopPropagation();var r=R.selectedTagList;R.selectedTagList=[];var a,n=E.filter((function(t){return r.some((function(r){return r[e.saveKey]===t[e.saveKey]}))}));(!e.allowCreate||0===n.length)&&e.allowCreate||S.value||(a=R.localList).push.apply(a,o(n)),Z("removeAll")},tagFocus:function(t){e.disabled||(M(L.value,t.currentTarget,!0),m.value.style.width="".concat(h,"px"),c.isShow&&k())},handleKeydown:function(t){if(!p.isPageLoading){var r=t.target.value,a=y(r),n=_(),o=A();switch(t.code){case"ArrowUp":if(t.preventDefault(),!c.isShow)return;u.focusItemIndex=u.focusItemIndex-1,u.focusItemIndex=u.focusItemIndex<0?-1:u.focusItemIndex,-1===u.focusItemIndex&&(u.focusItemIndex=p.curPageList.length-1),U();break;case"ArrowDown":if(t.preventDefault(),!c.isShow)return;u.focusItemIndex=u.focusItemIndex+1,u.focusItemIndex=u.focusItemIndex>p.curPageList.length-1?p.curPageList.length:u.focusItemIndex,u.focusItemIndex===p.curPageList.length&&(u.focusItemIndex=0),U();break;case"ArrowLeft":if(u.isEdit=!0,!a){if(n<1)return;M(L.value,o[n-1]),O()}break;case"ArrowRight":if(u.isEdit=!0,!a){if(n===o.length-1)return;M(o[n+1],L.value),O()}break;case"Enter":case"NumpadEnter":!e.allowCreate&&c.isShow||e.allowCreate&&u.focusItemIndex>=0&&c.isShow?G(p.curPageList[u.focusItemIndex],"select",t):e.allowCreate&&G(v.value,"custom",t),t.preventDefault();break;case"Backspace":0===n||v.value||function(t,r){var a=A();M(L.value,a[t-1]),R.selectedTagList.splice(t-1,1),O();var n=E.some((function(t){return t===r[e.saveKey]}));(e.allowCreate&&n||!e.allowCreate)&&!S.value&&R.localList.push(r),m.value="".concat(h,"px"),Z("remove")}(n,R.selectedTagList[n-1])}}},handlePaste:function(t){if(t.preventDefault(),S.value)return!1;var r=e.maxData,a=e.saveKey,l=e.pasteFn,i=t.clipboardData.getData("text"),s=l?l(i):function(t){var r=[];return t.split(";").forEach((function(t){if(t.match(/^[a-zA-Z][a-zA-Z_]+/g)){var a,o=t.match(/^[a-zA-Z][a-zA-Z_]+/g).join("");r.push((n(a={},e.saveKey,o),n(a,e.displayKey,o),a))}})),r}(i),u=s.map((function(e){return e[a]}));if(u.length){var c=A(),d=_(),p=R.localList.map((function(e){return e[a]}));if(u=u.filter((function(e){return(null==e?void 0:e.trim())&&!j.value.includes(e)&&p.includes(e)})),-1!==r){var f=R.selectedTagList.length;if(f<r){var g=r-f;u.length>g&&(u=o(u.slice(0,g)))}else u=[]}var v,y=R.localList.filter((function(e){return u.includes(e[a])}));u.length&&((v=R.selectedTagList).splice.apply(v,[d,0].concat(o(y))),M(L.value,c[d]),m.value.style.width="".concat(h,"px"),R.localList=R.localList.filter((function(e){return!u.includes(e[a])})),Z("select"),O())}}})},render:function(){var e=this;return(0,l.createVNode)("div",{class:"bk-tag-input",ref:"bkTagSelectorRef",onClick:this.focusInputTrigger,onMouseenter:function(){return e.isHover=!0},onMouseleave:function(){return e.isHover=!1}},[(0,l.createVNode)(v(),{ref:"popoverRef",theme:"light",trigger:"manual",placement:"bottom-start",arrow:!1,width:this.popoverProps.width,isShow:this.popoverProps.isShow,modifiers:this.popoverProps.modifiers},{default:function(){return(0,l.createVNode)("div",{class:e.triggerClass},[(0,l.createVNode)("ul",{class:"tag-list",ref:"tagListRef",style:{marginLeft:"".concat(e.leftSpace,"px")}},[e.selectedTagList.map((function(t,r){var a={boundary:"window",theme:"light",distance:12,content:t[e.tooltipKey],disabled:!e.tooltipKey};return(0,l.withDirectives)((0,l.createVNode)("li",{class:"tag-item",onClick:e.tagFocus},[(0,l.createVNode)(b,{node:t,tpl:e.tagTpl,displayKey:e.displayKey},null),e.showTagClose?(0,l.createVNode)(d.Error,{class:"remove-tag",onClick:e.handleTagRemove.bind(e,t,r)},null):null]),[[(0,l.resolveDirective)("bk-tooltips"),a]])})),(0,l.withDirectives)((0,l.createVNode)("li",{ref:"tagInputItemRef",id:"tagInputItem",class:"tag-input-item",role:"input"},[(0,l.withDirectives)((0,l.createVNode)("input",{type:"text",class:"tag-input",ref:"tagInputRef","onUpdate:modelValue":function(t){return e.curInputValue=t},onInput:e.handleInput,onFocus:e.handleFocus,onBlur:e.handleBlur,onKeydown:e.handleKeydown,onPaste:e.handlePaste},null),[[l.vModelText,e.curInputValue]])]),[[l.vShow,e.isEdit]])]),(0,l.withDirectives)((0,l.createVNode)("p",{class:"placeholder"},[e.placeholder]),[[l.vShow,e.isShowPlaceholder]]),e.isShowClear?(0,l.createVNode)(d.Close,{class:"clear-icon",onClick:e.handleClear},null):null])},content:function(){return(0,l.createVNode)("div",{class:"bk-selector-list"},[(0,l.createVNode)("ul",{ref:"selectorListRef",style:{"max-height":"".concat(e.contentMaxHeight,"px")},class:"outside-ul"},[e.useGroup?e.renderList.map((function(t){return(0,l.createVNode)("li",{class:"bk-selector-group-item"},[(0,l.createVNode)("span",{class:"group-name"},[t.name,(0,l.createTextVNode)(" ("),t.children.length,(0,l.createTextVNode)(")")]),(0,l.createVNode)("ul",{class:"bk-selector-group-list-item"},[t.children.map((function(t,r){return(0,l.createVNode)("li",{class:["bk-selector-list-item",{disabled:t.disabled},e.activeClass(t,r)],onClick:e.handleTagSelected.bind(e,t,"select")},[(0,l.createVNode)(m,{node:t,displayKey:e.displayKey,tpl:e.tpl,searchKey:e.searchKey,searchKeyword:e.curInputValue},null)])}))])])})):e.renderList.map((function(t,r){return(0,l.createVNode)("li",{class:["bk-selector-list-item",{disabled:t.disabled},e.activeClass(t,r)],onClick:e.handleTagSelected.bind(e,t,"select")},[(0,l.createVNode)(m,{node:t,displayKey:e.displayKey,tpl:e.tpl,searchKey:e.searchKey,searchKeyword:e.curInputValue},null)])})),e.isPageLoading?(0,l.createVNode)("li",{class:"bk-selector-list-item loading"},[(0,l.createVNode)(f(),{theme:"primary",size:p.BkLoadingSize.Small},null)]):null])])}})])}}),L=(0,e.withInstall)(T)})(),c})()));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("lodash"),require("../directives"),require("../icon"),require("../loading"),require("../popover"));else if("function"==typeof define&&define.amd)define(["../shared","vue","lodash","../directives","../icon","../loading","../popover"],t);else{var r="object"==typeof exports?t(require("../shared"),require("vue"),require("lodash"),require("../directives"),require("../icon"),require("../loading"),require("../popover")):t(e["../shared"],e.vue,e.lodash,e["../directives"],e["../icon"],e["../loading"],e["../popover"]);for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(self,((e,t,r,a,n,o,l)=>(()=>{"use strict";var i={4061:e=>{e.exports=a},6870:e=>{e.exports=n},4870:e=>{e.exports=o},5537:e=>{e.exports=l},4212:t=>{t.exports=e},467:e=>{e.exports=r},748:e=>{e.exports=t}},s={};function u(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return i[e](r,r.exports,u),r.exports}u.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return u.d(t,{a:t}),t},u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var c={};return(()=>{u.r(c),u.d(c,{default:()=>L});var e=u(4212);function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}function a(e,t){if(e){if("string"==typeof e)return r(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)?r(e,t):void 0}}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||a(e)||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.")}()}var l=u(748),i=u(467),s=u(4061),d=u(6870),p=u(4870),f=u.n(p),v=u(5537),g=u.n(v),h=12,y=function(e){for(var t=e.length,r=0,a=0;a<t;a++)0!=(65280&e.charCodeAt(a))&&(r+=1),r+=1;return r};const m=(0,l.defineComponent)({name:"ListTagRender",props:{node:e.PropTypes.object,searchKey:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.arrayOf(e.PropTypes.string)]),displayKey:e.PropTypes.string,searchKeyword:e.PropTypes.string,tpl:{type:Function,default:null}},render:function(){var e=this,t=function(t){if(e.searchKeyword){var r=new RegExp("(".concat(e.searchKeyword,")"),"i");return t.replace(r,'<strong class="highlight-text">$1</strong>')}return t};if(this.tpl)return this.tpl(this.node,t,l.h,this);var r=this.node[this.displayKey];return(0,l.createVNode)("div",{class:"bk-selector-node"},[(0,l.createVNode)("span",{class:"text",innerHTML:t(r)},[r])])}}),b=(0,l.defineComponent)({name:"TagRender",props:{node:e.PropTypes.object,displayKey:e.PropTypes.string,tpl:{type:Function,default:null}},render:function(){return this.tpl?this.tpl(this.node,l.h,this):(0,l.createVNode)("div",{class:"tag"},[(0,l.createVNode)("span",{class:"text"},[this.node[this.displayKey]])])}}),T=(0,l.defineComponent)({name:"TagInput",directives:{bkTooltips:s.bkTooltips},props:{modelValue:e.PropTypes.arrayOf(e.PropTypes.string).def([]),placeholder:e.PropTypes.string.def("请输入并按 Enter 结束"),list:e.PropTypes.arrayOf(e.PropTypes.object).def([]),disabled:e.PropTypes.bool.def(!1),tooltipKey:e.PropTypes.string.def(""),saveKey:e.PropTypes.string.def("id"),displayKey:e.PropTypes.string.def("name"),hasDeleteIcon:e.PropTypes.bool.def(!1),clearable:e.PropTypes.bool.def(!0),trigger:e.PropTypes.commonType(["focus","search"]).def("search"),searchKey:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.arrayOf(e.PropTypes.string)]).def("name"),useGroup:e.PropTypes.bool.def(!1),allowCreate:e.PropTypes.bool.def(!1),maxData:e.PropTypes.number.def(-1),maxResult:e.PropTypes.number.def(10),contentMaxHeight:e.PropTypes.number.def(300),contentWidth:e.PropTypes.number.def(190),separator:e.PropTypes.string.def(""),allowNextFocus:e.PropTypes.bool.def(!0),allowAutoMatch:e.PropTypes.bool.def(!1),showClearOnlyHover:e.PropTypes.bool.def(!1),leftSpace:e.PropTypes.number.def(0),createTagValidator:{type:Function,default:null},filterCallback:{type:Function,default:null},tagTpl:{type:Function,default:null},tpl:{type:Function,default:null},pasteFn:{type:Function,default:null}},emits:["update:modelValue","change","select","blur","remove","removeAll"],setup:function(e,r){var s=r.emit,u=(0,l.reactive)({isEdit:!1,isHover:!1,focusItemIndex:e.allowCreate?-1:0}),c=(0,l.reactive)({isShow:!1,width:190,modifiers:[{name:"offset",options:{offset:[0,4]}}]}),d=function(e){var t=(0,l.reactive)({curPage:1,totalSize:0,totalPage:0,pageSize:e,isPageLoading:!1,curPageList:[],renderListPaged:[]});return{pageState:t,initPage:function(){var e,r,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.curPage=1,t.totalSize=a.length,t.totalPage=Math.ceil(t.totalSize/t.pageSize)||1;var n=[];if(t.pageSize>0)for(var l=0;l<t.totalSize;l+=t.pageSize)n.push(a.slice(l,l+t.pageSize));(e=t.renderListPaged).splice.apply(e,[0,t.renderListPaged.length].concat(n)),(r=t.curPageList).splice.apply(r,[0,t.curPageList.length].concat(o(t.renderListPaged[t.curPage-1]||[])))},pageChange:function(e){var r;t.curPage=e,(r=t.curPageList).splice.apply(r,[t.curPageList.length,0].concat(o(t.renderListPaged[t.curPage-1]||[]))),t.isPageLoading=!1}}}((0,l.toRefs)(e).maxResult),p=d.pageState,f=d.initPage,v=d.pageChange,g=(0,l.ref)(""),m=(0,l.ref)(null),b=(0,l.ref)(null),T=(0,l.ref)(null),L=(0,l.ref)(null),w=(0,l.ref)(null),P=(0,l.ref)(null),x=(0,l.ref)(null),I=(0,l.computed)((function(){return!e.disabled&&e.hasDeleteIcon})),S=(0,l.computed)((function(){return 1===e.maxData})),C=(0,l.computed)((function(){return 0===R.selectedTagList.length&&""===g.value&&!u.isEdit})),K=(0,l.computed)((function(){return e.clearable&&!e.disabled&&0!==R.selectedTagList.length&&(!e.showClearOnlyHover||u.isHover)})),V=(0,l.computed)((function(){return{"bk-tag-input-trigger":!0,active:u.isEdit,disabled:e.disabled}}));(0,l.watch)([function(){return o(e.modelValue)},function(){return o(e.list)}],(function(){F()})),(0,l.watch)(g,(0,i.debounce)((function(){var t=0!==p.curPageList.length,r=g.value;""!==r&&t||""===r&&"focus"===e.trigger&&t?c.isShow=!0:"focus"===e.trigger&&t||(c.isShow=!1)}),150)),(0,l.watch)((function(){return c.isShow}),(function(e){k(),e&&w.value&&((0,l.nextTick)((function(){w.value.scrollTop=0})),w.value.removeEventListener("scroll",N),w.value.addEventListener("scroll",N))}));var k=function(){var e,t,r=S.value?0:null===(e=L.value)||void 0===e?void 0:e.offsetLeft;c.modifiers=[{name:"offset",options:{offset:[r,4]}}],null===(t=P.value)||void 0===t||t.update()},N=function(){if(!p.isPageLoading&&0!==w.value.scrollTop){var e=w.value;if(e.scrollTop+e.offsetHeight>=e.scrollHeight){var t=p.curPage+1;t<=p.totalPage&&(p.isPageLoading=!0,setTimeout((function(){v(t)}),500))}}},A=function(){var e;return Array.from((null===(e=T.value)||void 0===e?void 0:e.childNodes)||[]).filter((function(e){return e.nodeType!==Node.TEXT_NODE}))},O=function(t){if(!e.disabled){if(null==t?void 0:t.target){var r=t.target.className;(r.indexOf("bk-tag-input-trigger")>-1||r.indexOf("tag-list")>-1)&&T.value.appendChild(L.value)}clearTimeout(x.value),S.value&&j.value.length&&(R.tagListCache=o(j.value),R.selectedTagListCache=o(R.selectedTagList),g.value=R.selectedTagListCache[0][e.saveKey],$(R.selectedTagList[0],0),H()),u.isEdit=!0,(0,l.nextTick)((function(){var t;null===(t=m.value)||void 0===t||t.focus(),"focus"===e.trigger&&0!==R.localList.length&&(q(),c.isShow?k():c.isShow=!0)}))}},R=(0,l.reactive)({localList:[],tagListCache:[],selectedTagList:[],selectedTagListCache:[]}),j=(0,l.computed)((function(){return R.selectedTagList.map((function(t){return t[e.saveKey]}))})),E=function(e){var t=(0,l.toRefs)(e),r=t.useGroup,a=t.saveKey,n=t.displayKey,i=t.list,s=(0,l.reactive)([]);return(0,l.watch)([r,a,n,i],(function(){var e=i.value;r.value&&(e=i.value.reduce((function(e,t){var r=[];return t.children&&(r=t.children.map((function(e){return Object.assign({group:{groupId:t[a.value],groupName:t[n.value]}},e)}))),e.concat(r)}),[])),s.splice.apply(s,[0,s.length].concat(o(e)))}),{immediate:!0,deep:!0}),s}(e),D=(0,l.computed)((function(){if(e.useGroup){var t={};return p.curPageList.forEach((function(e,r){e.__index__=r,t[e.group.groupId]||(t[e.group.groupId]={id:e.group.groupId,name:e.group.groupName,children:[]}),t[e.group.groupId].children.push(e)})),Object.keys(t).map((function(e){return t[e]}))}return p.curPageList})),F=function(){var t=e.saveKey,r=e.modelValue,a=e.displayKey,l=e.allowCreate,i=e.trigger;R.selectedTagList=[],R.localList=o(E),r.length&&(r.forEach((function(e){var r=R.localList.find((function(r){return e===r[t]}));if(void 0!==r)R.selectedTagList.push(r);else if(l&&!j.value.includes(e)){var o;R.selectedTagList.push((n(o={},t,e),n(o,a,e),o))}})),S.value||(R.localList=R.localList.filter((function(e){return!r.includes(e[t])})))),"focus"===i&&q()},q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=e.searchKey,a=e.filterCallback,n=t.toLowerCase(),o=[];if("function"==typeof a)o=a(n,r,R.localList)||[];else if(Array.isArray(r)){var l=r.map((function(e){return R.localList.filter((function(t){return-1!==t[e].toLowerCase().indexOf(n)}))}));o=Array.from(new Set(l.flat()))}else o=R.localList.filter((function(e){return-1!==e[r].toLowerCase().indexOf(n)}));f(o)};(0,l.onMounted)((function(){F()}));var z=function(){g.value=""},_=function(){if(S.value)return 0;var e=A().findIndex((function(e){return"tagInputItem"===e.id}));return e>=0?e:0},M=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t&&e){var a=t;r&&(a=t.nextElementSibling||null),t.parentNode.insertBefore(e,a)}},H=function(t){var r=e.maxData,a=e.trigger,n=e.allowCreate;if(-1===r||r>j.value.length){var o=((null==t?void 0:t.target)?t.target:g).value,l=y(o);l?(q(o),m.value.style.width="".concat(l*h,"px")):"focus"===a&&q()}else B(),g.value="",c.isShow=!1;u.isEdit=!0,u.focusItemIndex=n?-1:0},B=function(){x.value=setTimeout((function(){var t,r,n=g.value;if(z(),u.isEdit=!1,S.value){var o=(t=R.tagListCache,r=1,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a,n,o=[],l=!0,i=!1;try{for(r=r.call(e);!(l=(a=r.next()).done)&&(o.push(a.value),!t||o.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==r.return||r.return()}finally{if(i)throw n}}return o}}(t,r)||a(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];n&&n===o&&R.selectedTagListCache.length?W(R.selectedTagListCache[0],"select"):Z("remove")}else if(e.allowAutoMatch&&n){var l=p.curPageList.find((function(t){return Array.isArray(e.searchKey)?e.searchKey.map((function(e){return t[e]})).includes(n):t[e.searchKey]===n}));l?G(l,"select"):e.allowCreate&&G(n,"custom")}c.isShow=!1,s("blur",n,j.value)}),50)},G=function(e,t,r){null==r||r.stopPropagation(),e&&!e.disabled&&(S.value&&(R.tagListCache=[],R.selectedTagListCache=[],R.selectedTagList=[]),W(e,t),Z("select"),z(),c.isShow=!1)},Z=function(e,t){s("change",j.value),s(e,t),s("update:modelValue",j.value)},U=function(){var e=w.value.clientHeight,t=w.value.getBoundingClientRect().y;(0,l.nextTick)((function(){var r=w.value.querySelector(".bk-selector-actived");if(r){var a=r.clientHeight,n=r.getBoundingClientRect().y;n<t&&(w.value.scrollTop=w.value.scrollTop-(t-n));var o=n+a-t;o>e&&(w.value.scrollTop=w.value.scrollTop+o-e)}}))},W=function(r,a){if(!(R.selectedTagList.length>=e.maxData&&-1!==e.maxData)){var i,s=e.separator,u=e.saveKey,c=e.displayKey,d=e.createTagValidator,p=_(),f=1,v=!1,g=function(e){return"function"!=typeof d||d(e)},y=function(e){return R.localList.find((function(t){return t[u]===e}))};if("custom"===a)if(s){var b,T=r.split(s),w=(T=T.filter((function(e){return(null==e?void 0:e.trim())&&!j.value.includes(e)&&g(e)}))).map((function(e){var t;return y(e)||(n(t={},u,e),n(t,c,e),t)}));T.length&&((b=R.selectedTagList).splice.apply(b,[p,0].concat(o(w))),f=w.length,v=!0)}else{var P="object"===t(r);if(void 0!==(i=(i=P?r[u]:r.trim()).replace(/\s+/g,""))&&!j.value.includes(i)&&g(i)){var x,I=y(i)||(P?r:(n(x={},u,i),n(x,c,i),x));R.selectedTagList.splice(p,0,I),v=!0}}else r&&(void 0===(i=r[u])||j.value.includes(i)||(R.selectedTagList.splice(p,0,r),v=!0));v&&(0,l.nextTick)((function(){for(var t=1;t<=f;t++){var r=A()[p+t];M(r,L.value)}m.value.style.width="".concat(h,"px"),S.value||(e.allowNextFocus&&O(),R.localList=R.localList.filter((function(e){return!j.value.includes(e[u])})))}))}},$=function(t,r){R.selectedTagList.splice(r,1);var a=E.some((function(r){return r===t[e.saveKey]}));(e.allowCreate&&a||!e.allowCreate)&&!S.value&&R.localList.push(t)};return Object.assign(Object.assign(Object.assign(Object.assign({popoverProps:c},(0,l.toRefs)(u)),(0,l.toRefs)(R)),(0,l.toRefs)(p)),{isShowPlaceholder:C,isShowClear:K,curInputValue:g,formatList:E,renderList:D,showTagClose:I,tagInputRef:m,bkTagSelectorRef:b,tagListRef:T,tagInputItemRef:L,selectorListRef:w,popoverRef:P,triggerClass:V,focusInputTrigger:O,activeClass:function(t,r){var a={"bk-selector-actived":!1,"bk-selector-selected":j.value.includes(t[e.saveKey])};return e.useGroup?a["bk-selector-actived"]=t.__index__===u.focusItemIndex:a["bk-selector-actived"]=r===u.focusItemIndex,a},handleInput:H,handleFocus:function(){var t;c.width=S.value?null===(t=b.value)||void 0===t?void 0:t.clientWidth:e.contentWidth},handleBlur:B,handleTagSelected:G,handleTagRemove:function(e,t,r){null==r||r.stopPropagation(),$(e,t),z(),Z("remove",e),m.value.style.width="".concat(h,"px")},handleClear:function(t){t.stopPropagation();var r=R.selectedTagList;R.selectedTagList=[];var a,n=E.filter((function(t){return r.some((function(r){return r[e.saveKey]===t[e.saveKey]}))}));(!e.allowCreate||0===n.length)&&e.allowCreate||S.value||(a=R.localList).push.apply(a,o(n)),Z("removeAll")},tagFocus:function(t){e.disabled||(M(L.value,t.currentTarget,!0),m.value.style.width="".concat(h,"px"),c.isShow&&k())},handleKeydown:function(t){if(!p.isPageLoading){var r=t.target.value,a=y(r),n=_(),o=A();switch(t.code){case"ArrowUp":if(t.preventDefault(),!c.isShow)return;u.focusItemIndex=u.focusItemIndex-1,u.focusItemIndex=u.focusItemIndex<0?-1:u.focusItemIndex,-1===u.focusItemIndex&&(u.focusItemIndex=p.curPageList.length-1),U();break;case"ArrowDown":if(t.preventDefault(),!c.isShow)return;u.focusItemIndex=u.focusItemIndex+1,u.focusItemIndex=u.focusItemIndex>p.curPageList.length-1?p.curPageList.length:u.focusItemIndex,u.focusItemIndex===p.curPageList.length&&(u.focusItemIndex=0),U();break;case"ArrowLeft":if(u.isEdit=!0,!a){if(n<1)return;M(L.value,o[n-1]),O()}break;case"ArrowRight":if(u.isEdit=!0,!a){if(n===o.length-1)return;M(o[n+1],L.value),O()}break;case"Enter":case"NumpadEnter":!e.allowCreate&&c.isShow||e.allowCreate&&u.focusItemIndex>=0&&c.isShow?G(p.curPageList[u.focusItemIndex],"select",t):e.allowCreate&&G(g.value,"custom",t),t.preventDefault();break;case"Backspace":0===n||g.value||function(t,r){var a=A();M(L.value,a[t-1]),R.selectedTagList.splice(t-1,1),O();var n=E.some((function(t){return t===r[e.saveKey]}));(e.allowCreate&&n||!e.allowCreate)&&!S.value&&R.localList.push(r),m.value="".concat(h,"px"),Z("remove")}(n,R.selectedTagList[n-1])}}},handlePaste:function(t){if(t.preventDefault(),S.value)return!1;var r=e.maxData,a=e.saveKey,l=e.pasteFn,i=t.clipboardData.getData("text"),s=l?l(i):function(t){var r=[];return t.split(";").forEach((function(t){if(t.match(/^[a-zA-Z][a-zA-Z_]+/g)){var a,o=t.match(/^[a-zA-Z][a-zA-Z_]+/g).join("");r.push((n(a={},e.saveKey,o),n(a,e.displayKey,o),a))}})),r}(i),u=s.map((function(e){return e[a]}));if(u.length){var c=A(),d=_(),p=R.localList.map((function(e){return e[a]}));if(u=u.filter((function(e){return(null==e?void 0:e.trim())&&!j.value.includes(e)&&p.includes(e)})),-1!==r){var f=R.selectedTagList.length;if(f<r){var v=r-f;u.length>v&&(u=o(u.slice(0,v)))}else u=[]}var g,y=R.localList.filter((function(e){return u.includes(e[a])}));u.length&&((g=R.selectedTagList).splice.apply(g,[d,0].concat(o(y))),M(L.value,c[d]),m.value.style.width="".concat(h,"px"),R.localList=R.localList.filter((function(e){return!u.includes(e[a])})),Z("select"),O())}}})},render:function(){var e=this;return(0,l.createVNode)("div",{class:"bk-tag-input",ref:"bkTagSelectorRef",onClick:this.focusInputTrigger,onMouseenter:function(){return e.isHover=!0},onMouseleave:function(){return e.isHover=!1}},[(0,l.createVNode)(g(),{ref:"popoverRef",theme:"light",trigger:"manual",placement:"bottom-start",arrow:!1,width:this.popoverProps.width,isShow:this.popoverProps.isShow,modifiers:this.popoverProps.modifiers},{default:function(){var t,r,a;return(0,l.createVNode)("div",{class:e.triggerClass},[(0,l.createVNode)("ul",{class:"tag-list",ref:"tagListRef",style:{marginLeft:"".concat(e.leftSpace,"px")}},[e.selectedTagList.map((function(t,r){var a={boundary:"window",theme:"light",distance:12,content:t[e.tooltipKey],disabled:!e.tooltipKey};return(0,l.withDirectives)((0,l.createVNode)("li",{class:"tag-item",onClick:e.tagFocus},[(0,l.createVNode)(b,{node:t,tpl:e.tagTpl,displayKey:e.displayKey},null),e.showTagClose?(0,l.createVNode)(d.Error,{class:"remove-tag",onClick:e.handleTagRemove.bind(e,t,r)},null):null]),[[(0,l.resolveDirective)("bk-tooltips"),a]])})),(0,l.withDirectives)((0,l.createVNode)("li",{ref:"tagInputItemRef",id:"tagInputItem",class:"tag-input-item",role:"input"},[(0,l.withDirectives)((0,l.createVNode)("input",{type:"text",class:"tag-input",ref:"tagInputRef","onUpdate:modelValue":function(t){return e.curInputValue=t},onInput:e.handleInput,onFocus:e.handleFocus,onBlur:e.handleBlur,onKeydown:e.handleKeydown,onPaste:e.handlePaste},null),[[l.vModelText,e.curInputValue]])]),[[l.vShow,e.isEdit]])]),(0,l.withDirectives)((0,l.createVNode)("p",{class:"placeholder"},[e.placeholder]),[[l.vShow,e.isShowPlaceholder]]),null!==(a=null===(r=null===(t=e.$slots)||void 0===t?void 0:t.suffix)||void 0===r?void 0:r.call(t))&&void 0!==a?a:e.isShowClear&&(0,l.createVNode)(d.Close,{class:"clear-icon",onClick:e.handleClear},null)])},content:function(){return(0,l.createVNode)("div",{class:"bk-selector-list"},[(0,l.createVNode)("ul",{ref:"selectorListRef",style:{"max-height":"".concat(e.contentMaxHeight,"px")},class:"outside-ul"},[e.useGroup?e.renderList.map((function(t){return(0,l.createVNode)("li",{class:"bk-selector-group-item"},[(0,l.createVNode)("span",{class:"group-name"},[t.name,(0,l.createTextVNode)(" ("),t.children.length,(0,l.createTextVNode)(")")]),(0,l.createVNode)("ul",{class:"bk-selector-group-list-item"},[t.children.map((function(t,r){return(0,l.createVNode)("li",{class:["bk-selector-list-item",{disabled:t.disabled},e.activeClass(t,r)],onClick:e.handleTagSelected.bind(e,t,"select")},[(0,l.createVNode)(m,{node:t,displayKey:e.displayKey,tpl:e.tpl,searchKey:e.searchKey,searchKeyword:e.curInputValue},null)])}))])])})):e.renderList.map((function(t,r){return(0,l.createVNode)("li",{class:["bk-selector-list-item",{disabled:t.disabled},e.activeClass(t,r)],onClick:e.handleTagSelected.bind(e,t,"select")},[(0,l.createVNode)(m,{node:t,displayKey:e.displayKey,tpl:e.tpl,searchKey:e.searchKey,searchKeyword:e.curInputValue},null)])})),e.isPageLoading?(0,l.createVNode)("li",{class:"bk-selector-list-item loading"},[(0,l.createVNode)(f(),{theme:"primary",size:p.BkLoadingSize.Small},null)]):null])])}})])}}),L=(0,e.withInstall)(T)})(),c})()));
@@ -343,13 +343,13 @@ declare const _default: import("vue").DefineComponent<{
343
343
  showClearOnlyHover: boolean;
344
344
  modelValue: string[];
345
345
  trigger: string;
346
+ allowCreate: boolean;
346
347
  searchKey: string | string[];
347
348
  displayKey: string;
348
349
  tooltipKey: string;
349
350
  saveKey: string;
350
351
  hasDeleteIcon: boolean;
351
352
  useGroup: boolean;
352
- allowCreate: boolean;
353
353
  maxData: number;
354
354
  maxResult: number;
355
355
  contentMaxHeight: number;
@@ -1 +1 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("../icon/"),require("../input"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../icon/","../input"],t);else{var r="object"==typeof exports?t(require("../shared"),require("vue"),require("../icon/"),require("../input")):t(e["../shared"],e.vue,e["../icon/"],e["../input"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,((e,t,r,n)=>(()=>{"use strict";var a={7685:e=>{e.exports=r},8133:e=>{e.exports=n},4212:t=>{t.exports=e},748:e=>{e.exports=t}},o={};function l(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return a[e](r,r.exports,l),r.exports}l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var r in t)l.o(t,r)&&!l.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};return(()=>{l.r(u),l.d(u,{default:()=>v});var e=l(4212);function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function r(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],l=!0,u=!1;try{for(r=r.call(e);!(l=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{l||null==r.return||r.return()}finally{if(u)throw a}}return o}}(e,t)||r(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||r(e)||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.")}()}var o=l(748),i=l(7685),s=l(8133),c=l.n(s);e.PropTypes.string,e.PropTypes.string,e.PropTypes.string,e.PropTypes.string,e.PropTypes.bool,e.PropTypes.bool,e.PropTypes.string,e.PropTypes.bool;const f=(0,o.defineComponent)({name:"Transfer",props:{title:{type:Array,default:function(){return[]}},extCls:{type:String,default:""},searchPlaceholder:{type:String,default:""},settingKey:{type:String,default:"id"},displayKey:{type:String,default:"value"},sortKey:{type:String,default:""},showOverflowTips:{type:Boolean,default:!1},searchable:{type:Boolean,default:!1},sortable:{type:Boolean,default:!1},sourceList:{type:Array,default:function(){return[]}},targetList:{type:Array,default:function(){return[]}},emptyContent:{type:Array,default:function(){return[]}}},emits:["change"],slots:["left-header","right-header","source-option","target-option","left-empty-content","right-empty-content"],setup:function(t,r){var l=r.emit,u=[],i=t.sortKey,s=t.sortable,c=(0,o.ref)(""),f=(0,o.ref)(null),v=(0,o.ref)([]),d=(0,o.ref)([]),p=(0,o.ref)(-1),h=(0,o.ref)(-1),y=(0,o.computed)((function(){return t.sourceList&&Array.isArray(t.sourceList)?-1!==t.sourceList.toString().indexOf("[object Object]"):"empty"})),g=(0,o.computed)((function(){return y.value?t.settingKey:"index"})),m=(0,o.computed)((function(){return y.value?t.displayKey:"value"})),b=(0,o.computed)((function(){return c.value?v.value.filter((function(t){return!(0,e.isEmpty)(t[m.value])&&String(t[m.value]).indexOf(c.value)>-1})):v.value}));(0,o.watch)((function(){return t.sourceList}),(function(){"empty"!==y.value&&(L(),w())}),{deep:!0}),(0,o.watch)((function(){return t.targetList}),(function(){L(),w()}),{deep:!0}),(0,o.watch)((function(){return[m.value,g.value]}),(function(){L()})),(0,o.watch)((function(){return t.sortKey}),(function(e){i=e,w()})),(0,o.watch)((function(){return t.sortable}),(function(e){s=e,w()}));var L=function(){"empty"!==y.value&&(y.value?S():x())},x=function(){if(!t.targetList.length||t.targetList.length>t.sourceList.length){for(var e,r=[],n=0;n<t.sourceList.length;n++)r.push({index:n,value:t.sourceList[n]});v.value=[].concat(r),(e=d.value).splice.apply(e,[0,d.value.length].concat([])),l("change",v.value,[],[])}else{for(var o=[],u=[],i=0;i<t.sourceList.length;i++)o.push({index:i,value:t.sourceList[i]});t.targetList.forEach((function(e){var t=o.find((function(t){return t.value===e}));t&&u.push(t)})),d.value=[].concat(u);var s=o.filter((function(e){return u.every((function(t){return t.index!==e.index}))}));v.value=a(s),l("change",v.value,a(N(d.value,!1)),[])}},S=function(){if(!t.targetList.length||t.targetList.length>t.sourceList.length){var e;(e=v.value).splice.apply(e,[0,v.value.length].concat(a(t.sourceList))),d.value=[],l("change",v.value,[],[])}else{var r=t.sourceList.filter((function(e){return t.targetList.every((function(t){return t!==e[g.value]}))})),n=[];t.sourceList.forEach((function(e){t.targetList.forEach((function(t){e[g.value]===t&&n.push(e)}))})),d.value=[].concat(n),v.value=a(r);var o=a(N(d.value));l("change",v.value,d.value,o)}},w=function(){var e=[];if(y.value)s||(i=""),e=a(t.sourceList);else{i=s?"index":"";for(var r=0;r<t.sourceList.length;r++)e.push({index:r,value:t.sourceList[r]})}if(i){var n=[];if(e.forEach((function(e){n.push(e[i])})),(u=[].concat(n)).length===t.sourceList.length){var o=a(v.value);v.value=a(T(o,i,u))}}},V=function(){var e=v.value,t=y.value?d.value:a(N(d.value,!1)),r=y.value?a(N(d.value)):[];l("change",e,t,r)},N=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=[];if(!e.length)return[];var o=a(e);return o.forEach((function(e){if(t)for(var a=0,o=Object.entries(e);a<o.length;a++){var l=n(o[a],2),u=l[0],i=l[1];u===g.value&&r.push(i)}else r.push(e.value)})),r},T=function(e,t,r){var n=r;return e.sort((function(e,r){return n.indexOf(e[t])-n.indexOf(r[t])>=0}))},A=function(e){v.value=v.value.filter((function(t){return t[g.value]!==e[g.value]}))};return"empty"!==y.value&&(y.value?S():x(),w()),{keyword:c,transferRef:f,dataList:v,allToRight:function(){p.value=-1;var e=b.value,r=d.value;e.forEach((function(e){r.push(e),A(e)})),u.length===t.sourceList.length?d.value=a(T(r,i,u)):d.value=a(r),V()},allToLeft:function(){h.value=-1;for(var e=d.value,r=v.value;e.length;){var n=e.shift();r.push(n),u.length===t.sourceList.length?v.value=a(T(r,i,u)):v.value=a(r)}V()},displayDataList:b,displayCode:m,leftHoverIndex:p,rightHoverIndex:h,handleItemMouseEvent:function(e,t,r,n){t.preventDefault(),t.stopPropagation();var a="over"===e?n:-1;r?p.value=a:h.value=a},handleItemClick:function(e,r,n){e.preventDefault(),e.stopPropagation(),n?p.value=-1:h.value=-1;var o=n?b.value[r]:d.value.splice(r,1)[0],l=n?d.value:v.value;l.push(o),n&&A(o);var s=u.length===t.sourceList.length?a(T(l,i,u)):a(l);n?d.value=a(s):v.value=a(s),V()},hasSelectedList:d}},render:function(){var e=this,t=this.$props,r=t.extCls,n=t.title,a=t.emptyContent,l=t.searchable,u=t.searchPlaceholder,s=function(t){var r,a,l="left-header"===t,u="".concat(l?null!==(r=n[0])&&void 0!==r?r:"左侧列表":null!==(a=n[1])&&void 0!==a?a:"右侧列表"),i=l?!e.dataList.length:!e.hasSelectedList.length;return e.$slots[t]?(0,o.createVNode)("div",{class:"slot-header"},[(0,o.createVNode)("div",{class:"slot-content"},[e.$slots[t]()])]):(0,o.createVNode)("div",{class:"header"},["".concat(u,"(共").concat(e.dataList.length,"条)"),(0,o.createVNode)("span",{class:{disabled:i},onClick:function(){return l&&e.dataList.length&&e.allToRight(),void(!l&&e.hasSelectedList.length&&e.allToLeft())}},[l?"全部添加":"清空"])])},f=function(t,r){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=n?e.leftHoverIndex:e.rightHoverIndex;return(0,o.createVNode)("div",{class:"item-content"},[(0,o.createVNode)("span",{class:"content-text",title:t[e.displayCode]},[t[e.displayCode]]),(0,o.createVNode)("span",{class:["icon-wrapper",r===a?"hover":""]},[n?(0,o.createVNode)(i.ArrowsRight,{class:"bk-icon"},null):(0,o.createVNode)(i.Error,{class:"bk-icon"},null)])])},v=function(t){var r="left"===t,n=r?e.displayDataList:e.hasSelectedList,u=r?"source-option":"target-option",i=r?"left-empty-content":"right-empty-content";return n.length?(0,o.createVNode)("ul",{class:["content",l&&r?"is-search":""]},[n.map((function(t,n){var a,l,i;return(0,o.createVNode)("li",{key:n,class:[e.$slots[u]?"custom-item":""],onClick:function(t){return e.handleItemClick(t,n,r)},onMouseover:function(t){return e.handleItemMouseEvent("over",t,r,n)},onMouseleave:function(t){return e.handleItemMouseEvent("leave",t,r,n)}},[null!==(i=null===(l=(a=e.$slots)[u])||void 0===l?void 0:l.call(a,t))&&void 0!==i?i:f(t,n,r)])}))]):function(t){var r,n="left-empty-content"===t,l=null!==(r=n?a[0]:a[1])&&void 0!==r?r:n?"无数据":"未选择任何项";return e.$slots[t]?(0,o.createVNode)("div",null,[e.$slots[t]()]):(0,o.createVNode)("div",{class:"empty"},[l])}(i)};return(0,o.createVNode)("div",{class:["bk-transfer",r],ref:"transferRef"},[(0,o.createVNode)("div",{class:"source-list"},[s("left-header"),l&&(0,o.createVNode)(c(),{modelValue:e.keyword,"onUpdate:modelValue":function(t){return e.keyword=t},class:"transfer-search-input",clearable:!0,placeholder:u||"请输入搜索关键字",type:"search","left-icon":"bk-icon icon-search"},null),v("left")]),(0,o.createVNode)("div",{class:"transfer"},null),(0,o.createVNode)("div",{class:"target-list"},[s("right-header"),v("right")])])}}),v=(0,e.withInstall)(f)})(),u})()));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("../icon/"),require("../input"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../icon/","../input"],t);else{var r="object"==typeof exports?t(require("../shared"),require("vue"),require("../icon/"),require("../input")):t(e["../shared"],e.vue,e["../icon/"],e["../input"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,((e,t,r,n)=>(()=>{"use strict";var a={7685:e=>{e.exports=r},8133:e=>{e.exports=n},4212:t=>{t.exports=e},748:e=>{e.exports=t}},o={};function u(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return a[e](r,r.exports,u),r.exports}u.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return u.d(t,{a:t}),t},u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return(()=>{u.r(l),u.d(l,{default:()=>v});var e=u(4212);function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function r(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],u=!0,l=!1;try{for(r=r.call(e);!(u=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);u=!0);}catch(e){l=!0,a=e}finally{try{u||null==r.return||r.return()}finally{if(l)throw a}}return o}}(e,t)||r(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||r(e)||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.")}()}var o=u(748),i=u(7685),s=u(8133),c=u.n(s);e.PropTypes.string,e.PropTypes.string,e.PropTypes.string,e.PropTypes.string,e.PropTypes.bool,e.PropTypes.bool,e.PropTypes.string,e.PropTypes.bool;const f=(0,o.defineComponent)({name:"Transfer",props:{title:{type:Array,default:function(){return[]}},extCls:{type:String,default:""},searchPlaceholder:{type:String,default:""},settingKey:{type:String,default:"id"},displayKey:{type:String,default:"value"},sortKey:{type:String,default:""},showOverflowTips:{type:Boolean,default:!1},searchable:{type:Boolean,default:!1},sortable:{type:Boolean,default:!1},sourceList:{type:Array,default:function(){return[]}},targetList:{type:Array,default:function(){return[]}},emptyContent:{type:Array,default:function(){return[]}}},emits:["change"],slots:["left-header","right-header","source-option","target-option","left-empty-content","right-empty-content"],setup:function(t,r){var u=r.emit,l=[],i=t.sortKey,s=t.sortable,c=(0,o.ref)(""),f=(0,o.ref)(null),v=(0,o.ref)([]),d=(0,o.ref)([]),p=(0,o.ref)(-1),h=(0,o.ref)(-1),y=(0,o.computed)((function(){return t.sourceList&&Array.isArray(t.sourceList)?-1!==t.sourceList.toString().indexOf("[object Object]"):"empty"})),g=(0,o.computed)((function(){return y.value?t.settingKey:"index"})),m=(0,o.computed)((function(){return y.value?t.displayKey:"value"})),b=(0,o.computed)((function(){return c.value?v.value.filter((function(t){return!(0,e.isEmpty)(t[m.value])&&String(t[m.value]).indexOf(c.value)>-1})):v.value}));(0,o.watch)((function(){return t.sourceList}),(function(){"empty"!==y.value&&(L(),w())}),{deep:!0}),(0,o.watch)((function(){return t.targetList}),(function(){L(),w()}),{deep:!0}),(0,o.watch)((function(){return[m.value,g.value]}),(function(){L()})),(0,o.watch)((function(){return t.sortKey}),(function(e){i=e,w()})),(0,o.watch)((function(){return t.sortable}),(function(e){s=e,w()}));var L=function(){"empty"!==y.value&&(y.value?S():x())},x=function(){if(!t.targetList.length||t.targetList.length>t.sourceList.length){for(var e,r=[],n=0;n<t.sourceList.length;n++)r.push({index:n,value:t.sourceList[n]});v.value=[].concat(r),(e=d.value).splice.apply(e,[0,d.value.length].concat([])),u("change",v.value,[],[])}else{for(var o=[],l=[],i=0;i<t.sourceList.length;i++)o.push({index:i,value:t.sourceList[i]});t.targetList.forEach((function(e){var t=o.find((function(t){return t.value===e}));t&&l.push(t)})),d.value=[].concat(l);var s=o.filter((function(e){return l.every((function(t){return t.index!==e.index}))}));v.value=a(s),u("change",v.value,a(T(d.value,!1)),[])}},S=function(){if(!t.targetList.length||t.targetList.length>t.sourceList.length){var e;(e=v.value).splice.apply(e,[0,v.value.length].concat(a(t.sourceList))),d.value=[],u("change",v.value,[],[])}else{var r=t.sourceList.filter((function(e){return t.targetList.every((function(t){return t!==e[g.value]}))})),n=[];t.sourceList.forEach((function(e){t.targetList.forEach((function(t){e[g.value]===t&&n.push(e)}))})),d.value=[].concat(n),v.value=a(r);var o=a(T(d.value));u("change",v.value,d.value,o)}},w=function(){var e=[];if(y.value)s||(i=""),e=a(t.sourceList);else{i=s?"index":"";for(var r=0;r<t.sourceList.length;r++)e.push({index:r,value:t.sourceList[r]})}if(i){var n=[];if(e.forEach((function(e){n.push(e[i])})),(l=[].concat(n)).length===t.sourceList.length){var o=a(v.value);v.value=a(N(o,i,l))}}},V=function(){var e=v.value,t=y.value?d.value:a(T(d.value,!1)),r=y.value?a(T(d.value)):[];u("change",e,t,r)},T=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=[];if(!e.length)return[];var o=a(e);return o.forEach((function(e){if(t)for(var a=0,o=Object.entries(e);a<o.length;a++){var u=n(o[a],2),l=u[0],i=u[1];l===g.value&&r.push(i)}else r.push(e.value)})),r},N=function(e,t,r){var n=r;return e.sort((function(e,r){return n.indexOf(e[t])-n.indexOf(r[t])>=0}))},A=function(e){v.value=v.value.filter((function(t){return t[g.value]!==e[g.value]}))};return"empty"!==y.value&&(y.value?S():x(),w()),{keyword:c,transferRef:f,dataList:v,allToRight:function(){p.value=-1;var e=b.value,r=d.value;e.forEach((function(e){r.push(e),A(e)})),l.length===t.sourceList.length?d.value=a(N(r,i,l)):d.value=a(r),V()},allToLeft:function(){h.value=-1;for(var e=d.value,r=v.value;e.length;){var n=e.shift();r.push(n),l.length===t.sourceList.length?v.value=a(N(r,i,l)):v.value=a(r)}V()},displayDataList:b,displayCode:m,leftHoverIndex:p,rightHoverIndex:h,handleItemMouseEvent:function(e,t,r,n){t.preventDefault(),t.stopPropagation();var a="over"===e?n:-1;r?p.value=a:h.value=a},handleItemClick:function(e,r,n){e.preventDefault(),e.stopPropagation(),n?p.value=-1:h.value=-1;var o=n?b.value[r]:d.value.splice(r,1)[0],u=n?d.value:v.value;u.push(o),n&&A(o);var s=l.length===t.sourceList.length?a(N(u,i,l)):a(u);n?d.value=a(s):v.value=a(s),V()},hasSelectedList:d}},render:function(){var e=this,t=this.$props,r=t.extCls,n=t.title,a=t.emptyContent,u=t.searchable,l=t.searchPlaceholder,s=function(t){var r,a,u="left-header"===t,l="".concat(u?null!==(r=n[0])&&void 0!==r?r:"左侧列表":null!==(a=n[1])&&void 0!==a?a:"右侧列表"),i=u?!e.dataList.length:!e.hasSelectedList.length;return e.$slots[t]?(0,o.createVNode)("div",{class:"slot-header"},[e.$slots[t]()]):(0,o.createVNode)("div",{class:"header"},["".concat(l,"(共").concat(e.dataList.length,"条)"),(0,o.createVNode)("span",{class:{disabled:i},onClick:function(){return u&&e.dataList.length&&e.allToRight(),void(!u&&e.hasSelectedList.length&&e.allToLeft())}},[u?"全部添加":"清空"])])},f=function(t,r){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=n?e.leftHoverIndex:e.rightHoverIndex;return(0,o.createVNode)("div",{class:"item-content"},[(0,o.createVNode)("span",{class:"content-text",title:t[e.displayCode]},[t[e.displayCode]]),(0,o.createVNode)("span",{class:["icon-wrapper",r===a?"hover":""]},[n?(0,o.createVNode)(i.ArrowsRight,{class:"bk-icon"},null):(0,o.createVNode)(i.Error,{class:"bk-icon"},null)])])},v=function(t){var r="left"===t,n=r?e.displayDataList:e.hasSelectedList,l=r?"source-option":"target-option",i=r?"left-empty-content":"right-empty-content";return n.length?(0,o.createVNode)("ul",{class:["content",u&&r?"is-search":""]},[n.map((function(t,n){var a,u,i;return(0,o.createVNode)("li",{key:n,class:[e.$slots[l]?"custom-item":""],onClick:function(t){return e.handleItemClick(t,n,r)},onMouseover:function(t){return e.handleItemMouseEvent("over",t,r,n)},onMouseleave:function(t){return e.handleItemMouseEvent("leave",t,r,n)}},[null!==(i=null===(u=(a=e.$slots)[l])||void 0===u?void 0:u.call(a,t))&&void 0!==i?i:f(t,n,r)])}))]):function(t){var r,n="left-empty-content"===t,u=null!==(r=n?a[0]:a[1])&&void 0!==r?r:n?"无数据":"未选择任何项";return e.$slots[t]?(0,o.createVNode)("div",null,[e.$slots[t]()]):(0,o.createVNode)("div",{class:"empty"},[u])}(i)};return(0,o.createVNode)("div",{class:["bk-transfer",r],ref:"transferRef"},[(0,o.createVNode)("div",{class:"source-list"},[s("left-header"),u&&(0,o.createVNode)(c(),{modelValue:e.keyword,"onUpdate:modelValue":function(t){return e.keyword=t},class:"transfer-search-input",clearable:!0,placeholder:l||"请输入搜索关键字",type:"search","left-icon":"bk-icon icon-search"},null),v("left")]),(0,o.createVNode)("div",{class:"transfer"},null),(0,o.createVNode)("div",{class:"target-list"},[s("right-header"),v("right")])])}}),v=(0,e.withInstall)(f)})(),l})()));
@@ -5,57 +5,46 @@
5
5
  /* 重点表示、强调、链接以及带有明确指示性 */
6
6
  /* 正常尺寸图标 */
7
7
  .bk-transfer {
8
- position: relative;
9
8
  display: flex;
10
- font-size: 14px;
11
- flex-direction: row;
12
9
  justify-content: center;
10
+ align-items: center;
11
+ font-size: 14px;
13
12
  }
14
13
  .bk-transfer .transfer {
15
- position: absolute;
16
- top: 50%;
17
- left: 50%;
18
14
  width: 30px;
19
15
  height: 30px;
16
+ margin: 0 2px;
20
17
  background: url('@bkui-vue/styles/images/transfer.png') no-repeat center center;
21
- transform: translate(-50%, -50%);
22
18
  }
23
19
  .bk-transfer .source-list,
24
20
  .bk-transfer .target-list {
21
+ flex: 1;
22
+ display: flex;
23
+ flex-direction: column;
25
24
  height: 400px;
26
25
  min-width: 200px;
27
26
  overflow: hidden;
28
27
  background-color: #fff;
29
28
  border: 1px solid #dde4eb;
30
29
  border-radius: 2px;
31
- flex: 1;
32
30
  }
33
31
  .bk-transfer .source-list .slot-header,
34
- .bk-transfer .target-list .slot-header {
35
- position: relative;
32
+ .bk-transfer .target-list .slot-header,
33
+ .bk-transfer .source-list .header,
34
+ .bk-transfer .target-list .header {
36
35
  height: 43px;
37
36
  padding: 0 20px;
38
- line-height: 43px;
39
37
  background-color: #fafbfd;
40
38
  border-bottom: 1px solid #dde4eb;
41
39
  }
42
- .bk-transfer .source-list .slot-header .slot-content,
43
- .bk-transfer .target-list .slot-header .slot-content {
44
- position: relative;
45
- }
46
40
  .bk-transfer .source-list .header,
47
41
  .bk-transfer .target-list .header {
48
- position: relative;
49
- height: 43px;
50
- padding: 0 20px;
51
- line-height: 43px;
52
- background-color: #fafbfd;
53
- border-bottom: 1px solid #dde4eb;
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: space-between;
54
45
  }
55
46
  .bk-transfer .source-list .header span,
56
47
  .bk-transfer .target-list .header span {
57
- position: absolute;
58
- right: 10px;
59
48
  font-size: 12px;
60
49
  color: #3a84ff;
61
50
  cursor: pointer;
@@ -65,39 +54,43 @@
65
54
  color: #c4c6cc;
66
55
  cursor: not-allowed;
67
56
  }
57
+ .bk-transfer .source-list .transfer-search-input,
58
+ .bk-transfer .target-list .transfer-search-input {
59
+ height: 36px;
60
+ border-bottom: 1px solid #f0f1f5;
61
+ border-width: 0 0 1px 0;
62
+ border-radius: 0;
63
+ outline: none;
64
+ }
65
+ .bk-transfer .source-list .transfer-search-input.is-focused,
66
+ .bk-transfer .target-list .transfer-search-input.is-focused {
67
+ box-shadow: none;
68
+ }
68
69
  .bk-transfer .source-list .empty,
69
70
  .bk-transfer .target-list .empty {
70
- position: relative;
71
- top: 40%;
72
- width: 100%;
71
+ flex: 1;
72
+ display: flex;
73
+ align-items: center;
74
+ justify-content: center;
75
+ padding-bottom: 30px;
73
76
  color: #c4c6cc;
74
- text-align: center;
75
77
  cursor: default;
76
78
  }
77
79
  .bk-transfer .source-list .content,
78
80
  .bk-transfer .target-list .content {
79
- position: relative;
80
- max-height: calc(100% - 50px);
81
- padding: 0;
81
+ flex: 1;
82
82
  margin: 6px 0;
83
83
  overflow-y: auto;
84
84
  }
85
- .bk-transfer .source-list .content.is-search,
86
- .bk-transfer .target-list .content.is-search {
87
- max-height: calc(100% - 86px);
88
- }
89
85
  .bk-transfer .source-list .content li.custom-item,
90
86
  .bk-transfer .target-list .content li.custom-item,
91
87
  .bk-transfer .source-list .content li .item-content,
92
88
  .bk-transfer .target-list .content li .item-content {
93
- position: relative;
94
89
  display: flex;
90
+ align-items: center;
95
91
  height: 40px;
96
92
  padding: 0 20px;
97
- line-height: 40px;
98
- list-style: none;
99
93
  cursor: pointer;
100
- align-items: center;
101
94
  }
102
95
  .bk-transfer .source-list .content li.custom-item:hover,
103
96
  .bk-transfer .target-list .content li.custom-item:hover,
@@ -110,23 +103,29 @@
110
103
  .bk-transfer .target-list .content li.custom-item .content-text,
111
104
  .bk-transfer .source-list .content li .item-content .content-text,
112
105
  .bk-transfer .target-list .content li .item-content .content-text {
106
+ flex: 1;
113
107
  overflow: hidden;
114
108
  text-overflow: ellipsis;
115
109
  white-space: nowrap;
116
- flex: 1;
117
110
  }
118
111
  .bk-transfer .source-list .content li.custom-item .icon-wrapper,
119
112
  .bk-transfer .target-list .content li.custom-item .icon-wrapper,
120
113
  .bk-transfer .source-list .content li .item-content .icon-wrapper,
121
114
  .bk-transfer .target-list .content li .item-content .icon-wrapper {
122
- display: none;
123
- flex: 22px 0 0;
115
+ visibility: hidden;
124
116
  }
125
117
  .bk-transfer .source-list .content li.custom-item .icon-wrapper.hover,
126
118
  .bk-transfer .target-list .content li.custom-item .icon-wrapper.hover,
127
119
  .bk-transfer .source-list .content li .item-content .icon-wrapper.hover,
128
120
  .bk-transfer .target-list .content li .item-content .icon-wrapper.hover {
129
- display: inline-block;
121
+ visibility: visible;
122
+ }
123
+ .bk-transfer .source-list .content li.custom-item .icon-wrapper .bk-icon,
124
+ .bk-transfer .target-list .content li.custom-item .icon-wrapper .bk-icon,
125
+ .bk-transfer .source-list .content li .item-content .icon-wrapper .bk-icon,
126
+ .bk-transfer .target-list .content li .item-content .icon-wrapper .bk-icon {
127
+ display: flex;
128
+ font-size: 22px;
130
129
  }
131
130
  .bk-transfer .source-list .content::-webkit-scrollbar,
132
131
  .bk-transfer .target-list .content::-webkit-scrollbar {
@@ -138,21 +137,3 @@
138
137
  background-color: #e6e9ea;
139
138
  border-radius: 2px;
140
139
  }
141
- .bk-transfer .source-list .content .bk-icon,
142
- .bk-transfer .target-list .content .bk-icon {
143
- font-size: 22px;
144
- }
145
- .bk-transfer .target-list {
146
- margin-left: 33px;
147
- }
148
- .bk-transfer .transfer-search-input {
149
- height: 36px;
150
- line-height: 34px;
151
- border: none;
152
- border-bottom: 1px solid #f0f1f5;
153
- outline: none;
154
- }
155
- .bk-transfer .transfer-search-input.is-focused {
156
- border-color: #f0f1f5;
157
- box-shadow: 0px 0px 3px 0px transparent;
158
- }
@@ -19,56 +19,44 @@
19
19
  @iconNormalSize: 22px;
20
20
 
21
21
  .@{bk-prefix}-transfer {
22
- position: relative;
23
22
  display: flex;
24
- font-size: 14px;
25
- flex-direction: row;
26
23
  justify-content: center;
24
+ align-items: center;
25
+ font-size: 14px;
27
26
 
28
27
  .transfer {
29
- position: absolute;
30
- top: 50%;
31
- left: 50%;
32
28
  width: 30px;
33
29
  height: 30px;
30
+ margin: 0 2px;
34
31
  background: url('@bkui-vue/styles/images/transfer.png') no-repeat center center;
35
- transform: translate(-50%, -50%);
36
32
  }
37
33
 
38
34
  .source-list,
39
35
  .target-list {
36
+ flex: 1;
37
+ display: flex;
38
+ flex-direction: column;
40
39
  height: 400px;
41
40
  min-width: 200px;
42
41
  overflow: hidden;
43
42
  background-color: #fff;
44
43
  border: 1px solid @borderInlineColor;
45
44
  border-radius: 2px;
46
- flex: 1;
47
45
 
48
- .slot-header {
49
- position: relative;
46
+ .slot-header,
47
+ .header {
50
48
  height: 43px;
51
49
  padding: 0 20px;
52
- line-height: 43px;
53
50
  background-color: @newGreyColor3;
54
51
  border-bottom: 1px solid @borderInlineColor;
55
-
56
- .slot-content {
57
- position: relative;
58
- }
59
52
  }
60
53
 
61
54
  .header {
62
- position: relative;
63
- height: 43px;
64
- padding: 0 20px;
65
- line-height: 43px;
66
- background-color: @newGreyColor3;
67
- border-bottom: 1px solid @borderInlineColor;
55
+ display: flex;
56
+ align-items: center;
57
+ justify-content: space-between;
68
58
 
69
59
  span {
70
- position: absolute;
71
- right: 10px;
72
60
  font-size: 12px;
73
61
  color: @newMainColor;
74
62
  cursor: pointer;
@@ -79,58 +67,64 @@
79
67
  }
80
68
  }
81
69
  }
70
+
71
+ .transfer-search-input {
72
+ height: 36px;
73
+ border-bottom: 1px solid @newGreyColor2;
74
+ border-width: 0 0 1px 0;
75
+ border-radius: 0;
76
+ outline: none;
77
+
78
+ &.is-focused {
79
+ box-shadow: none;
80
+ }
81
+ }
82
82
 
83
83
  .empty {
84
- position: relative;
85
- top: 40%;
86
- width: 100%;
84
+ flex: 1;
85
+ display: flex;
86
+ align-items: center;
87
+ justify-content: center;
88
+ padding-bottom: 30px;
87
89
  color: @newGreyColor;
88
- text-align: center;
89
90
  cursor: default;
90
91
  }
91
92
 
92
93
  .content {
93
- position: relative;
94
- max-height: calc(100% - 50px);
95
- padding: 0;
94
+ flex: 1;
96
95
  margin: 6px 0;
97
96
  overflow-y: auto;
98
97
 
99
- &.is-search {
100
- max-height: calc(100% - 86px);
101
- }
98
+ li.custom-item,
99
+ li .item-content {
100
+ display: flex;
101
+ align-items: center;
102
+ height: 40px;
103
+ padding: 0 20px;
104
+ cursor: pointer;
102
105
 
103
- li {
104
- &.custom-item,
105
- .item-content {
106
- position: relative;
107
- display: flex;
108
- height: 40px;
109
- padding: 0 20px;
110
- line-height: 40px;
111
- list-style: none;
112
- cursor: pointer;
113
- align-items: center;
114
-
115
- &:hover {
116
- color: @newMainColor;
117
- background-color: #eef6fe;
118
- }
106
+ &:hover {
107
+ color: @newMainColor;
108
+ background-color: #eef6fe;
109
+ }
119
110
 
120
- .content-text {
121
- overflow: hidden;
122
- text-overflow: ellipsis;
123
- white-space: nowrap;
124
- flex: 1;
125
- }
111
+ .content-text {
112
+ flex: 1;
113
+ overflow: hidden;
114
+ text-overflow: ellipsis;
115
+ white-space: nowrap;
116
+ }
126
117
 
127
- .icon-wrapper {
128
- display: none;
129
- flex: 22px 0 0;
118
+ .icon-wrapper {
119
+ visibility: hidden;
130
120
 
131
- &.hover {
132
- display: inline-block;
133
- }
121
+ &.hover {
122
+ visibility: visible;
123
+ }
124
+
125
+ .bk-icon {
126
+ display: flex;
127
+ font-size: @iconNormalSize;
134
128
  }
135
129
  }
136
130
  }
@@ -145,27 +139,6 @@
145
139
  background-color: #e6e9ea;
146
140
  border-radius: 2px;
147
141
  }
148
-
149
- .bk-icon {
150
- font-size: @iconNormalSize;
151
- }
152
- }
153
- }
154
-
155
- .target-list {
156
- margin-left: 33px;
157
- }
158
-
159
- .transfer-search-input {
160
- height: 36px;
161
- line-height: 34px;
162
- border: none;
163
- border-bottom: 1px solid @newGreyColor2;
164
- outline: none;
165
-
166
- &.is-focused {
167
- border-color: @newGreyColor2;
168
- box-shadow: 0px 0px 3px 0px transparent;
169
142
  }
170
143
  }
171
144
  }