bkui-vue 0.0.1-beta.195 → 0.0.1-beta.197
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 +62 -60
- package/dist/index.esm.js +1552 -198
- package/dist/index.umd.js +62 -60
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/components.d.ts +1 -0
- package/lib/components.js +1 -1
- package/lib/icon/index.js +1 -1
- package/lib/process/index.d.ts +2 -2
- package/lib/process/index.js +1 -1
- package/lib/process/process.css +13 -0
- package/lib/process/process.less +17 -0
- package/lib/process/process.variable.css +13 -0
- package/lib/search-select/index.d.ts +681 -0
- package/lib/search-select/index.js +1 -0
- package/lib/search-select/input.d.ts +85 -0
- package/lib/search-select/menu.css +145 -0
- package/lib/search-select/menu.d.ts +83 -0
- package/lib/search-select/menu.less +134 -0
- package/lib/search-select/menu.variable.css +145 -0
- package/lib/search-select/search-select.css +426 -0
- package/lib/search-select/search-select.d.ts +273 -0
- package/lib/search-select/search-select.less +227 -0
- package/lib/search-select/search-select.variable.css +539 -0
- package/lib/search-select/selected.css +21 -0
- package/lib/search-select/selected.d.ts +137 -0
- package/lib/search-select/selected.less +24 -0
- package/lib/search-select/selected.variable.css +21 -0
- package/lib/search-select/utils.d.ts +79 -0
- package/lib/styles/index.d.ts +1 -0
- package/lib/styles/mixins/animate.css +21 -0
- package/lib/tag-input/common.d.ts +4 -1
- package/lib/tag-input/index.d.ts +353 -377
- package/lib/tag-input/index.js +1 -1
- package/lib/tag-input/tag-input.d.ts +172 -178
- package/lib/tag-input/tag-props.d.ts +82 -79
- package/lib/timeline/index.d.ts +2 -2
- package/lib/upload/index.d.ts +7 -7
- package/lib/upload/upload.d.ts +2 -2
- package/lib/volar.components.d.ts +1 -0
- package/package.json +2 -3
- package/lib/icon/image-fill.js +0 -1
package/lib/tag-input/index.js
CHANGED
@@ -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),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},withValidate:{type:Boolean,default:!0},popoverProps:Object},emits:["update:modelValue","change","select","blur","remove","removeAll"],setup:function(r,s){var u=s.emit,c=(0,e.useFormItem)(),d=(0,l.reactive)({isEdit:!1,isHover:!1,focusItemIndex:r.allowCreate?-1:0}),p=(0,l.reactive)(Object.assign({isShow:!1,width:190,modifiers:[{name:"offset",options:{offset:[0,4]}}]},r.popoverProps)),f=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)(r).maxResult),v=f.pageState,g=f.initPage,m=f.pageChange,b=(0,l.ref)(""),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.ref)(null),S=(0,l.ref)(null),C=(0,l.computed)((function(){return!r.disabled&&r.hasDeleteIcon})),K=(0,l.computed)((function(){return 1===r.maxData})),k=(0,l.computed)((function(){return 0===E.selectedTagList.length&&""===b.value&&!d.isEdit})),V=(0,l.computed)((function(){return r.clearable&&!r.disabled&&0!==E.selectedTagList.length&&(!r.showClearOnlyHover||d.isHover)})),N=(0,l.computed)((function(){return{"bk-tag-input-trigger":!0,active:d.isEdit,disabled:r.disabled}}));(0,l.watch)([function(){return r.modelValue},function(){return r.list}],(function(){var e;(0,l.nextTick)((function(){M()})),r.withValidate&&(null===(e=null==c?void 0:c.validate)||void 0===e||e.call(c,"change"))})),(0,l.watch)(b,(0,i.debounce)((function(){var e=0!==v.curPageList.length,t=b.value;""!==t&&e||""===t&&"focus"===r.trigger&&e?p.isShow=!0:"focus"===r.trigger&&e||(p.isShow=!1)}),150)),(0,l.watch)((function(){return p.isShow}),(function(e){O(),e&&x.value&&((0,l.nextTick)((function(){x.value.scrollTop=0})),x.value.removeEventListener("scroll",R),x.value.addEventListener("scroll",R))}));var O=function(){var e,t,r=K.value?0:null===(e=P.value)||void 0===e?void 0:e.offsetLeft;p.modifiers=[{name:"offset",options:{offset:[r,4]}}],null===(t=I.value)||void 0===t||t.update()},R=function(){if(!v.isPageLoading&&0!==x.value.scrollTop){var e=x.value;if(e.scrollTop+e.offsetHeight>=e.scrollHeight){var t=v.curPage+1;t<=v.totalPage&&(v.isPageLoading=!0,setTimeout((function(){m(t)}),500))}}},j=function(){var e;return Array.from((null===(e=w.value)||void 0===e?void 0:e.childNodes)||[]).filter((function(e){return e.nodeType!==Node.TEXT_NODE}))},A=function(e){if(!r.disabled){if(null==e?void 0:e.target){var t=e.target.className;(t.indexOf("bk-tag-input-trigger")>-1||t.indexOf("tag-list")>-1)&&w.value.appendChild(P.value)}clearTimeout(S.value),K.value&&D.value.length&&(E.tagListCache=o(D.value),E.selectedTagListCache=o(E.selectedTagList),b.value=E.selectedTagListCache[0][r.saveKey],J(E.selectedTagList[0],0),G()),d.isEdit=!0,(0,l.nextTick)((function(){var e;null===(e=T.value)||void 0===e||e.focus(),"focus"===r.trigger&&0!==E.localList.length&&(_(),p.isShow?O():p.isShow=!0)}))}},E=(0,l.reactive)({localList:[],tagListCache:[],selectedTagList:[],selectedTagListCache:[]}),D=(0,l.computed)((function(){return E.selectedTagList.map((function(e){return e[r.saveKey]}))})),F=function(e){var t=(0,l.toRefs)(e),r=t.useGroup,a=t.saveKey,n=t.displayKey,o=t.list,i=(0,l.ref)([]);return(0,l.watch)([r,a,n,o],(function(){i.value=[];var e=(0,l.markRaw)(o.value);r.value&&(e=e.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)}),[])),i.value=e}),{immediate:!0}),i}(r),q=(0,l.computed)((function(){if(r.useGroup){var e={};return v.curPageList.forEach((function(t,r){t.__index__=r,e[t.group.groupId]||(e[t.group.groupId]={id:t.group.groupId,name:t.group.groupName,children:[]}),e[t.group.groupId].children.push(t)})),Object.keys(e).map((function(t){return e[t]}))}return v.curPageList})),M=function(){var e=r.saveKey,t=r.modelValue,a=r.displayKey,o=r.allowCreate,l=r.trigger;E.selectedTagList=[],E.localList=F.value,t.length&&(t.forEach((function(t){var r=E.localList.find((function(r){return t===r[e]}));if(void 0!==r)E.selectedTagList.push(r);else if(o&&!D.value.includes(t)){var l;E.selectedTagList.push((n(l={},e,t),n(l,a,t),l))}})),K.value||(E.localList=E.localList.filter((function(r){return!t.includes(r[e])})))),"focus"===l&&_()},_=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=r.searchKey,a=r.filterCallback,n=e.toLowerCase(),o=[];if("function"==typeof a)o=a(n,t,E.localList)||[];else if(Array.isArray(t)){var l=t.map((function(e){return E.localList.filter((function(t){return-1!==t[e].toLowerCase().indexOf(n)}))}));o=Array.from(new Set(l.flat()))}else o=E.localList.filter((function(e){return-1!==e[t].toLowerCase().indexOf(n)}));g(o)};(0,l.onMounted)((function(){M()}));var z=function(){b.value=""},H=function(){if(K.value)return 0;var e=j().findIndex((function(e){return"tagInputItem"===e.id}));return e>=0?e:0},B=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)}},G=function(e){var t=r.maxData,a=r.trigger,n=r.allowCreate;if(-1===t||t>D.value.length){var o=((null==e?void 0:e.target)?e.target:b).value,l=y(o);l?(_(o),T.value.style.width="".concat(l*h,"px")):"focus"===a&&_()}else U(),b.value="",p.isShow=!1;d.isEdit=!0,d.focusItemIndex=n?-1:0},U=function(){S.value=setTimeout((function(){var e,t,n,o=b.value;if(z(),d.isEdit=!1,K.value){var l=(t=E.tagListCache,n=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,n)||a(t,n)||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];o&&o===l&&E.selectedTagListCache.length?X(E.selectedTagListCache[0],"select"):$("remove")}else if(r.allowAutoMatch&&o){var i=v.curPageList.find((function(e){return Array.isArray(r.searchKey)?r.searchKey.map((function(t){return e[t]})).includes(o):e[r.searchKey]===o}));i?W(i,"select"):r.allowCreate&&W(o,"custom")}p.isShow=!1,u("blur",o,D.value),null===(e=null==c?void 0:c.validate)||void 0===e||e.call(c,"blur")}),200)},W=function(e,t,r){null==r||r.stopPropagation(),e&&!e.disabled&&(K.value&&(E.tagListCache=[],E.selectedTagListCache=[],E.selectedTagList=[]),X(e,t),$("select"),z(),p.isShow=!1)},$=function(e,t){u("change",D.value),u(e,t),u("update:modelValue",D.value)},Z=function(){var e=x.value.clientHeight,t=x.value.getBoundingClientRect().y;(0,l.nextTick)((function(){var r=x.value.querySelector(".bk-selector-actived");if(r){var a=r.clientHeight,n=r.getBoundingClientRect().y;n<t&&(x.value.scrollTop=x.value.scrollTop-(t-n));var o=n+a-t;o>e&&(x.value.scrollTop=x.value.scrollTop+o-e)}}))},X=function(e,a){if(!(E.selectedTagList.length>=r.maxData&&-1!==r.maxData)){var i,s=r.separator,u=r.saveKey,c=r.displayKey,d=r.createTagValidator,p=H(),f=1,v=!1,g=function(e){return"function"!=typeof d||d(e)},y=function(e){return E.localList.find((function(t){return t[u]===e}))};if("custom"===a)if(s){var m,b=e.split(s),L=(b=b.filter((function(e){return(null==e?void 0:e.trim())&&!D.value.includes(e)&&g(e)}))).map((function(e){var t;return y(e)||(n(t={},u,e),n(t,c,e),t)}));b.length&&((m=E.selectedTagList).splice.apply(m,[p,0].concat(o(L))),f=L.length,v=!0)}else{var w="object"===t(e);if(void 0!==(i=(i=w?e[u]:e.trim()).replace(/\s+/g,""))&&!D.value.includes(i)&&g(i)){var x,I=y(i)||(w?e:(n(x={},u,i),n(x,c,i),x));E.selectedTagList.splice(p,0,I),v=!0}}else e&&(void 0===(i=e[u])||D.value.includes(i)||(E.selectedTagList.splice(p,0,e),v=!0));v&&(0,l.nextTick)((function(){for(var e=1;e<=f;e++){var t=j()[p+e];B(t,P.value)}T.value.style.width="".concat(h,"px"),K.value||(r.allowNextFocus&&A(),E.localList=E.localList.filter((function(e){return!D.value.includes(e[u])})))}))}},J=function(e,t){E.selectedTagList.splice(t,1);var a=F.value.some((function(t){return t===e[r.saveKey]}));(r.allowCreate&&a||!r.allowCreate)&&!K.value&&E.localList.push(e)};return Object.assign(Object.assign(Object.assign(Object.assign({popoverProps:p},(0,l.toRefs)(d)),(0,l.toRefs)(E)),(0,l.toRefs)(v)),{isShowPlaceholder:k,isShowClear:V,curInputValue:b,formatList:F,renderList:q,showTagClose:C,tagInputRef:T,bkTagSelectorRef:L,tagListRef:w,tagInputItemRef:P,selectorListRef:x,popoverRef:I,triggerClass:N,focusInputTrigger:A,activeClass:function(e,t){var a={"bk-selector-actived":!1,"bk-selector-selected":D.value.includes(e[r.saveKey])};return r.useGroup?a["bk-selector-actived"]=e.__index__===d.focusItemIndex:a["bk-selector-actived"]=t===d.focusItemIndex,a},handleInput:G,handleFocus:function(){var e;p.width=K.value?null===(e=L.value)||void 0===e?void 0:e.clientWidth:r.contentWidth},handleBlur:U,handleTagSelected:W,handleTagRemove:function(e,t,r){null==r||r.stopPropagation(),J(e,t),z(),$("remove",e),T.value.style.width="".concat(h,"px")},handleClear:function(e){e.stopPropagation();var t=E.selectedTagList;E.selectedTagList=[];var a,n=F.value.filter((function(e){return t.some((function(t){return t[r.saveKey]===e[r.saveKey]}))}));(!r.allowCreate||0===n.length)&&r.allowCreate||K.value||(a=E.localList).push.apply(a,o(n)),$("removeAll")},tagFocus:function(e){r.disabled||(B(P.value,e.currentTarget,!0),T.value.style.width="".concat(h,"px"),p.isShow&&O())},handleKeydown:function(e){if(!v.isPageLoading){var t=e.target.value,a=y(t),n=H(),o=j();switch(e.code){case"ArrowUp":if(e.preventDefault(),!p.isShow)return;d.focusItemIndex=d.focusItemIndex-1,d.focusItemIndex=d.focusItemIndex<0?-1:d.focusItemIndex,-1===d.focusItemIndex&&(d.focusItemIndex=v.curPageList.length-1),Z();break;case"ArrowDown":if(e.preventDefault(),!p.isShow)return;d.focusItemIndex=d.focusItemIndex+1,d.focusItemIndex=d.focusItemIndex>v.curPageList.length-1?v.curPageList.length:d.focusItemIndex,d.focusItemIndex===v.curPageList.length&&(d.focusItemIndex=0),Z();break;case"ArrowLeft":if(d.isEdit=!0,!a){if(n<1)return;B(P.value,o[n-1]),A()}break;case"ArrowRight":if(d.isEdit=!0,!a){if(n===o.length-1)return;B(o[n+1],P.value),A()}break;case"Enter":case"NumpadEnter":!r.allowCreate&&p.isShow||r.allowCreate&&d.focusItemIndex>=0&&p.isShow?W(v.curPageList[d.focusItemIndex],"select",e):r.allowCreate&&W(b.value,"custom",e),e.preventDefault();break;case"Backspace":0===n||b.value||function(e,t){var a=j();B(P.value,a[e-1]),E.selectedTagList.splice(e-1,1),A();var n=F.value.some((function(e){return e===t[r.saveKey]}));(r.allowCreate&&n||!r.allowCreate)&&!K.value&&E.localList.push(t),T.value="".concat(h,"px"),$("remove")}(n,E.selectedTagList[n-1])}}},handlePaste:function(e){if(e.preventDefault(),K.value)return!1;var t=r.maxData,a=r.saveKey,l=r.displayKey,i=r.pasteFn,s=r.allowCreate,u=e.clipboardData.getData("text"),c=i?i(u):function(e){var t=[],a=e.split(";"),o=/^[a-zA-Z][a-zA-Z_]*/g;return a.forEach((function(e){var a=e.match(o);if(a){var l,i=a.join("");t.push((n(l={},r.saveKey,i),n(l,r.displayKey,i),l))}})),t}(u),d=c.map((function(e){return e[a]}));if(d.length){var p=j(),f=H(),v=E.localList.map((function(e){return e[a]}));if(d=d.filter((function(e){var t=(null==e?void 0:e.trim())&&!D.value.includes(e);return s?t:t&&v.includes(e)})),-1!==t){var g=E.selectedTagList.length;if(g<t){var y=t-g;d.length>y&&(d=o(d.slice(0,y)))}else d=[]}var m,b=s?d.map((function(e){var t,r=E.localList.find((function(t){return t[a]===e}));return null!=r?r:(n(t={},a,e),n(t,l,e),t)})):E.localList.filter((function(e){return d.includes(e[a])}));d.length&&((m=E.selectedTagList).splice.apply(m,[f,0].concat(o(b))),B(P.value,p[f]),T.value.style.width="".concat(h,"px"),E.localList=E.localList.filter((function(e){return!d.includes(e[a])})),$("select"),A())}}})},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(),(0,l.mergeProps)({ref:"popoverRef",theme:"light",trigger:"manual",placement:"bottom-start","content-cls":"bk-tag-input-popover-content",arrow:!1},this.popoverProps),{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.renderList.map((function(t,r){return e.useGroup?(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)])}))])]):(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},withValidate:{type:Boolean,default:!0},popoverProps:{type:Object,default:function(){return{}}}},emits:["update:modelValue","change","select","blur","remove","removeAll"],setup:function(r,s){var u=s.emit,c=(0,e.useFormItem)(),d=(0,l.reactive)({isEdit:!1,isHover:!1,focusItemIndex:r.allowCreate?-1:0}),p=(0,l.reactive)(Object.assign({isShow:!1,width:190,modifiers:[{name:"offset",options:{offset:[0,4]}}]},r.popoverProps)),f=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)(r).maxResult),v=f.pageState,g=f.initPage,m=f.pageChange,b=(0,l.ref)(""),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.ref)(null),C=(0,l.ref)(null),S=(0,l.computed)((function(){return!r.disabled&&r.hasDeleteIcon})),K=(0,l.computed)((function(){return 1===r.maxData})),k=(0,l.computed)((function(){return 0===O.selectedTagList.length&&""===b.value&&!d.isEdit})),V=(0,l.computed)((function(){return r.clearable&&!r.disabled&&0!==O.selectedTagList.length&&(!r.showClearOnlyHover||d.isHover)})),N=(0,l.computed)((function(){return{"bk-tag-input-trigger":!0,active:d.isEdit,disabled:r.disabled}})),O=(0,l.reactive)({localList:[],tagListCache:[],selectedTagList:[],selectedTagListCache:[]}),R=(0,l.computed)((function(){return O.selectedTagList.map((function(e){return e[r.saveKey]}))})),j=function(e){var t=(0,l.toRefs)(e),r=t.useGroup,a=t.saveKey,n=t.displayKey,o=t.list,i=(0,l.ref)([]),s=(0,l.ref)({});return(0,l.watch)([r,a,n,o],(function(){i.value=[];var e=(0,l.markRaw)(o.value);r.value&&(e=e.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)}),[])),i.value=e,s.value=e.reduce((function(e,t){return e[t[a.value]]=t,e}),{})}),{immediate:!0}),{flatList:i,saveKeyMap:s}}(r),A=j.flatList,E=j.saveKeyMap,D=(0,l.computed)((function(){if(r.useGroup){var e={};return v.curPageList.forEach((function(t,r){t.__index__=r,e[t.group.groupId]||(e[t.group.groupId]={id:t.group.groupId,name:t.group.groupName,children:[]}),e[t.group.groupId].children.push(t)})),Object.keys(e).map((function(t){return e[t]}))}return v.curPageList}));(0,l.watch)([function(){return A.value}],(function(){(0,l.nextTick)((function(){z()}))})),(0,l.watch)((function(){return r.modelValue}),(function(e){var t,a,n;n=e,(a=R.value).length===n.length&&n.every((function(e,t){return a[t]===e}))||((0,l.nextTick)((function(){z()})),r.withValidate&&(null===(t=null==c?void 0:c.validate)||void 0===t||t.call(c,"change")))})),(0,l.watch)(b,(0,i.debounce)((function(){var e=0!==v.curPageList.length,t=b.value;""!==t&&e||""===t&&"focus"===r.trigger&&e?p.isShow=!0:"focus"===r.trigger&&e||(p.isShow=!1)}),150)),(0,l.watch)((function(){return p.isShow}),(function(e){F(),e&&x.value&&((0,l.nextTick)((function(){x.value.scrollTop=0})),x.value.removeEventListener("scroll",M),x.value.addEventListener("scroll",M))})),(0,l.onMounted)((function(){z()}));var F=function(){var e,t,r=K.value?0:null===(e=P.value)||void 0===e?void 0:e.offsetLeft;p.modifiers=[{name:"offset",options:{offset:[r,4]}}],null===(t=I.value)||void 0===t||t.update()},M=function(){if(!v.isPageLoading&&0!==x.value.scrollTop){var e=x.value;if(e.scrollTop+e.offsetHeight>=e.scrollHeight){var t=v.curPage+1;t<=v.totalPage&&(v.isPageLoading=!0,setTimeout((function(){m(t)}),500))}}},q=function(){var e;return Array.from((null===(e=w.value)||void 0===e?void 0:e.childNodes)||[]).filter((function(e){return e.nodeType!==Node.TEXT_NODE}))},_=function(e){if(!r.disabled){if(null==e?void 0:e.target){var t=e.target.className;(t.indexOf("bk-tag-input-trigger")>-1||t.indexOf("tag-list")>-1)&&w.value.appendChild(P.value)}clearTimeout(C.value),K.value&&R.value.length&&(O.tagListCache=o(R.value),O.selectedTagListCache=o(O.selectedTagList),b.value=O.selectedTagListCache[0][r.saveKey],Y(O.selectedTagList[0],0),W()),d.isEdit=!0,(0,l.nextTick)((function(){var e;null===(e=T.value)||void 0===e||e.focus(),"focus"===r.trigger&&0!==O.localList.length&&(H(),p.isShow?F():p.isShow=!0)}))}},z=function(){var e=r.saveKey,t=r.modelValue,a=r.displayKey,o=r.allowCreate,l=r.trigger;if(O.selectedTagList=[],O.localList=A.value,t.length){var i={};O.selectedTagList=t.map((function(t){var r,l=E.value[t];return i[t]=1,!l&&o?(n(r={},e,t),n(r,a,t),r):l})).filter((function(e){return e})),K.value||(O.localList=O.localList.filter((function(t){return!i[t[e]]})))}"focus"===l&&H()},H=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=r.searchKey,a=r.filterCallback,n=e.toLowerCase().trim();if(""!==n){var o=[];o="function"==typeof a?a(n,t,O.localList)||[]:Array.isArray(t)?O.localList.filter((function(e){return t.some((function(t){return e[t].toLowerCase().indexOf(n)>-1}))})):O.localList.filter((function(e){return e[t].toLowerCase().indexOf(n)>-1})),g(o)}else g(O.localList)},B=function(){b.value=""},G=function(){if(K.value)return 0;var e=q().findIndex((function(e){return"tagInputItem"===e.id}));return e>=0?e:0},U=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)}},W=function(e){var t=r.maxData,a=r.trigger,n=r.allowCreate;if(-1===t||t>R.value.length){var o=((null==e?void 0:e.target)?e.target:b).value,l=y(o);l?(H(o),T.value.style.width="".concat(l*h,"px")):"focus"===a&&H()}else $(),b.value="",p.isShow=!1;d.isEdit=!0,d.focusItemIndex=n?-1:0},$=function(){C.value=setTimeout((function(){var e,t,n,o=b.value;if(B(),d.isEdit=!1,K.value){var l=(t=O.tagListCache,n=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,n)||a(t,n)||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];o&&o===l&&O.selectedTagListCache.length?Q(O.selectedTagListCache[0],"select"):X("remove")}else if(r.allowAutoMatch&&o){var i=v.curPageList.find((function(e){return Array.isArray(r.searchKey)?r.searchKey.map((function(t){return e[t]})).includes(o):e[r.searchKey]===o}));i?Z(i,"select"):r.allowCreate&&Z(o,"custom")}p.isShow=!1,u("blur",o,R.value),null===(e=null==c?void 0:c.validate)||void 0===e||e.call(c,"blur")}),200)},Z=function(e,t,r){null==r||r.stopPropagation(),e&&!e.disabled&&(K.value&&(O.tagListCache=[],O.selectedTagListCache=[],O.selectedTagList=[]),Q(e,t),X("select"),B(),p.isShow=!1)},X=function(e,t){u("change",R.value),u(e,t),u("update:modelValue",R.value)},J=function(){var e=x.value.clientHeight,t=x.value.getBoundingClientRect().y;(0,l.nextTick)((function(){var r=x.value.querySelector(".bk-selector-actived");if(r){var a=r.clientHeight,n=r.getBoundingClientRect().y;n<t&&(x.value.scrollTop=x.value.scrollTop-(t-n));var o=n+a-t;o>e&&(x.value.scrollTop=x.value.scrollTop+o-e)}}))},Q=function(e,a){if(!(O.selectedTagList.length>=r.maxData&&-1!==r.maxData)){var i,s=r.separator,u=r.saveKey,c=r.displayKey,d=r.createTagValidator,p=G(),f=1,v=!1,g=function(e){return"function"!=typeof d||d(e)};if("custom"===a)if(s){var y,m=e.split(s),b=(m=m.filter((function(e){return(null==e?void 0:e.trim())&&!R.value.includes(e)&&g(e)}))).map((function(e){var t;return E.value[e]||(n(t={},u,e),n(t,c,e),t)}));m.length&&((y=O.selectedTagList).splice.apply(y,[p,0].concat(o(b))),f=b.length,v=!0)}else{var L="object"===t(e);if(void 0!==(i=(i=L?e[u]:e.trim()).replace(/\s+/g,""))&&!R.value.includes(i)&&g(i)){var w,x=E.value[i]||(L?e:(n(w={},u,i),n(w,c,i),w));O.selectedTagList.splice(p,0,x),v=!0}}else e&&(void 0===(i=e[u])||R.value.includes(i)||(O.selectedTagList.splice(p,0,e),v=!0));v&&(0,l.nextTick)((function(){for(var e=1;e<=f;e++){var t=q()[p+e];U(t,P.value)}if(T.value.style.width="".concat(h,"px"),!K.value){r.allowNextFocus&&_();var a=R.value.reduce((function(e,t){return e[t]=1,e}),{});O.localList=O.localList.filter((function(e){return!a[e[u]]}))}}))}},Y=function(e,t){O.selectedTagList.splice(t,1);var a=E.value[e[r.saveKey]];(r.allowCreate&&a||!r.allowCreate)&&!K.value&&O.localList.push(e)};return Object.assign(Object.assign(Object.assign(Object.assign({popoverProps:p},(0,l.toRefs)(d)),(0,l.toRefs)(O)),(0,l.toRefs)(v)),{isShowPlaceholder:k,isShowClear:V,curInputValue:b,renderList:D,showTagClose:S,tagInputRef:T,bkTagSelectorRef:L,tagListRef:w,tagInputItemRef:P,selectorListRef:x,popoverRef:I,triggerClass:N,focusInputTrigger:_,activeClass:function(e,t){var a={"bk-selector-actived":!1,"bk-selector-selected":R.value.includes(e[r.saveKey])};return r.useGroup?a["bk-selector-actived"]=e.__index__===d.focusItemIndex:a["bk-selector-actived"]=t===d.focusItemIndex,a},handleInput:W,handleFocus:function(){var e;p.width=K.value?null===(e=L.value)||void 0===e?void 0:e.clientWidth:r.contentWidth},handleBlur:$,handleTagSelected:Z,handleTagRemove:function(e,t,r){null==r||r.stopPropagation(),Y(e,t),B(),X("remove",e),T.value.style.width="".concat(h,"px")},handleClear:function(e){e.stopPropagation();var t=O.selectedTagList;O.selectedTagList=[];var a,n=t.filter((function(e){return E.value[e[r.saveKey]]}));(!r.allowCreate||0===n.length)&&r.allowCreate||K.value||(a=O.localList).push.apply(a,o(n)),X("removeAll")},tagFocus:function(e){r.disabled||(U(P.value,e.currentTarget,!0),T.value.style.width="".concat(h,"px"),p.isShow&&F())},handleKeydown:function(e){if(!v.isPageLoading){var t=e.target.value,a=y(t),n=G(),o=q();switch(e.code){case"ArrowUp":if(e.preventDefault(),!p.isShow)return;d.focusItemIndex=d.focusItemIndex-1,d.focusItemIndex=d.focusItemIndex<0?-1:d.focusItemIndex,-1===d.focusItemIndex&&(d.focusItemIndex=v.curPageList.length-1),J();break;case"ArrowDown":if(e.preventDefault(),!p.isShow)return;d.focusItemIndex=d.focusItemIndex+1,d.focusItemIndex=d.focusItemIndex>v.curPageList.length-1?v.curPageList.length:d.focusItemIndex,d.focusItemIndex===v.curPageList.length&&(d.focusItemIndex=0),J();break;case"ArrowLeft":if(d.isEdit=!0,!a){if(n<1)return;U(P.value,o[n-1]),_()}break;case"ArrowRight":if(d.isEdit=!0,!a){if(n===o.length-1)return;U(o[n+1],P.value),_()}break;case"Enter":case"NumpadEnter":!r.allowCreate&&p.isShow||r.allowCreate&&d.focusItemIndex>=0&&p.isShow?Z(v.curPageList[d.focusItemIndex],"select",e):r.allowCreate&&Z(b.value,"custom",e),e.preventDefault();break;case"Backspace":0===n||b.value||function(e,t){var a=q();U(P.value,a[e-1]),O.selectedTagList.splice(e-1,1),_();var n=E.value[t[r.saveKey]];(r.allowCreate&&n||!r.allowCreate)&&!K.value&&O.localList.push(t),T.value="".concat(h,"px"),X("remove")}(n,O.selectedTagList[n-1])}}},handlePaste:function(e){if(e.preventDefault(),K.value)return!1;var t=r.maxData,a=r.saveKey,l=r.displayKey,i=r.pasteFn,s=r.allowCreate,u=e.clipboardData.getData("text"),c=i?i(u):function(e){var t=[],a=e.split(";"),o=/^[a-zA-Z][a-zA-Z_]*/g;return a.forEach((function(e){var a=e.match(o);if(a){var l,i=a.join("");t.push((n(l={},r.saveKey,i),n(l,r.displayKey,i),l))}})),t}(u),d=c.map((function(e){return e[a]}));if(d.length){var p=q(),f=G(),v=O.localList.map((function(e){return e[a]}));if(d=d.filter((function(e){var t=(null==e?void 0:e.trim())&&!R.value.includes(e);return s?t:t&&v.includes(e)})),-1!==t){var g=O.selectedTagList.length;if(g<t){var y=t-g;d.length>y&&(d=o(d.slice(0,y)))}else d=[]}var m,b=s?d.map((function(e){var t,r=O.localList.find((function(t){return t[a]===e}));return null!=r?r:(n(t={},a,e),n(t,l,e),t)})):O.localList.filter((function(e){return d.includes(e[a])}));d.length&&((m=O.selectedTagList).splice.apply(m,[f,0].concat(o(b))),U(P.value,p[f]),T.value.style.width="".concat(h,"px"),O.localList=O.localList.filter((function(e){return!d.includes(e[a])})),X("select"),_())}}})},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(),(0,l.mergeProps)({ref:"popoverRef",theme:"light",trigger:"manual",placement:"bottom-start","content-cls":"bk-tag-input-popover-content",arrow:!1},this.popoverProps),{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.renderList.map((function(t,r){return e.useGroup?(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)])}))])]):(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})()));
|
@@ -138,90 +138,92 @@ declare const _default: import("vue").DefineComponent<{
|
|
138
138
|
type: BooleanConstructor;
|
139
139
|
default: boolean;
|
140
140
|
};
|
141
|
-
popoverProps:
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
141
|
+
popoverProps: {
|
142
|
+
type: import("vue").PropType<Partial<Readonly<import("vue").ExtractPropTypes<{
|
143
|
+
onAfterHidden: FunctionConstructor;
|
144
|
+
onAfterShow: FunctionConstructor;
|
145
|
+
contentCls: import("vue-types").VueTypeValidableDef<string> & {
|
146
|
+
default: string;
|
147
|
+
} & {
|
148
|
+
default: string;
|
149
|
+
};
|
150
|
+
isShow: import("vue-types").VueTypeValidableDef<boolean> & {
|
151
|
+
default: boolean;
|
152
|
+
} & {
|
153
|
+
default: boolean;
|
154
|
+
};
|
155
|
+
always: import("vue-types").VueTypeValidableDef<boolean> & {
|
156
|
+
default: boolean;
|
157
|
+
} & {
|
158
|
+
default: boolean;
|
159
|
+
};
|
160
|
+
disabled: import("vue-types").VueTypeValidableDef<boolean> & {
|
161
|
+
default: boolean;
|
162
|
+
} & {
|
163
|
+
default: boolean;
|
164
|
+
};
|
165
|
+
width: import("vue-types").VueTypeDef<string | number> & {
|
166
|
+
default: string | number;
|
167
|
+
};
|
168
|
+
height: import("vue-types").VueTypeDef<string | number> & {
|
169
|
+
default: string | number;
|
170
|
+
};
|
171
|
+
content: import("vue-types").VueTypeDef<string | number> & {
|
172
|
+
default: string | number;
|
173
|
+
};
|
174
|
+
transition: import("vue-types").VueTypeValidableDef<string> & {
|
175
|
+
default: string;
|
176
|
+
} & {
|
177
|
+
default: string;
|
178
|
+
};
|
179
|
+
placement: import("vue-types").VueTypeDef<string> & {
|
180
|
+
default: string;
|
181
|
+
};
|
182
|
+
theme: import("vue-types").VueTypeValidableDef<string> & {
|
183
|
+
default: string;
|
184
|
+
} & {
|
185
|
+
default: string;
|
186
|
+
};
|
187
|
+
handleFirstUpdate: {
|
188
|
+
type: import("vue").PropType<import("@bkui-vue/shared").OnFirstUpdateFnType>;
|
189
|
+
default: () => void;
|
190
|
+
};
|
191
|
+
trigger: import("vue-types").VueTypeValidableDef<string> & {
|
192
|
+
default: string;
|
193
|
+
} & {
|
194
|
+
default: string;
|
195
|
+
};
|
196
|
+
arrow: import("vue-types").VueTypeValidableDef<boolean> & {
|
197
|
+
default: boolean;
|
198
|
+
} & {
|
199
|
+
default: boolean;
|
200
|
+
};
|
201
|
+
modifiers: import("vue-types").VueTypeValidableDef<unknown[]> & {
|
202
|
+
default: () => unknown[];
|
203
|
+
} & {
|
204
|
+
default: () => unknown[];
|
205
|
+
};
|
206
|
+
boundary: import("vue-types").VueTypeDef<string | HTMLElement>;
|
207
|
+
fixOnBoundary: import("vue-types").VueTypeValidableDef<boolean> & {
|
208
|
+
default: boolean;
|
209
|
+
} & {
|
210
|
+
default: boolean;
|
211
|
+
};
|
212
|
+
zIndex: import("vue-types").VueTypeValidableDef<number> & {
|
213
|
+
default: number;
|
214
|
+
} & {
|
215
|
+
default: number;
|
216
|
+
};
|
217
|
+
stopBehaviors: import("vue-types").VueTypeDef<string | string[]> & {
|
218
|
+
default: string | (() => string[]);
|
219
|
+
};
|
220
|
+
}>>>>;
|
221
|
+
default: () => {};
|
222
|
+
};
|
220
223
|
}, {
|
221
224
|
isShowPlaceholder: import("vue").ComputedRef<boolean>;
|
222
225
|
isShowClear: import("vue").ComputedRef<boolean>;
|
223
226
|
curInputValue: Ref<string>;
|
224
|
-
formatList: Ref<any[]>;
|
225
227
|
renderList: import("vue").ComputedRef<any[]>;
|
226
228
|
showTagClose: import("vue").ComputedRef<boolean>;
|
227
229
|
tagInputRef: any;
|
@@ -264,26 +266,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
264
266
|
isHover: Ref<boolean>;
|
265
267
|
focusItemIndex: Ref<number>;
|
266
268
|
popoverProps: {
|
267
|
-
placement: string;
|
268
|
-
modifiers: unknown[];
|
269
|
-
zIndex: number;
|
270
|
-
content: string | number;
|
271
|
-
disabled: boolean;
|
272
|
-
trigger: string;
|
273
|
-
arrow: boolean;
|
274
|
-
theme: string;
|
275
|
-
width: string | number;
|
276
|
-
height: string | number;
|
277
269
|
isShow: boolean;
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
onAfterShow?: Function;
|
286
|
-
boundary?: string | HTMLElement;
|
270
|
+
width: number;
|
271
|
+
modifiers: {
|
272
|
+
name: string;
|
273
|
+
options: {
|
274
|
+
offset: number[];
|
275
|
+
};
|
276
|
+
}[];
|
287
277
|
};
|
288
278
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "blur" | "change" | "update:modelValue" | "remove" | "removeAll")[], "select" | "blur" | "change" | "update:modelValue" | "remove" | "removeAll", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
289
279
|
modelValue: import("vue-types").VueTypeDef<string[]> & {
|
@@ -424,85 +414,88 @@ declare const _default: import("vue").DefineComponent<{
|
|
424
414
|
type: BooleanConstructor;
|
425
415
|
default: boolean;
|
426
416
|
};
|
427
|
-
popoverProps:
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
417
|
+
popoverProps: {
|
418
|
+
type: import("vue").PropType<Partial<Readonly<import("vue").ExtractPropTypes<{
|
419
|
+
onAfterHidden: FunctionConstructor;
|
420
|
+
onAfterShow: FunctionConstructor;
|
421
|
+
contentCls: import("vue-types").VueTypeValidableDef<string> & {
|
422
|
+
default: string;
|
423
|
+
} & {
|
424
|
+
default: string;
|
425
|
+
};
|
426
|
+
isShow: import("vue-types").VueTypeValidableDef<boolean> & {
|
427
|
+
default: boolean;
|
428
|
+
} & {
|
429
|
+
default: boolean;
|
430
|
+
};
|
431
|
+
always: import("vue-types").VueTypeValidableDef<boolean> & {
|
432
|
+
default: boolean;
|
433
|
+
} & {
|
434
|
+
default: boolean;
|
435
|
+
};
|
436
|
+
disabled: import("vue-types").VueTypeValidableDef<boolean> & {
|
437
|
+
default: boolean;
|
438
|
+
} & {
|
439
|
+
default: boolean;
|
440
|
+
};
|
441
|
+
width: import("vue-types").VueTypeDef<string | number> & {
|
442
|
+
default: string | number;
|
443
|
+
};
|
444
|
+
height: import("vue-types").VueTypeDef<string | number> & {
|
445
|
+
default: string | number;
|
446
|
+
};
|
447
|
+
content: import("vue-types").VueTypeDef<string | number> & {
|
448
|
+
default: string | number;
|
449
|
+
};
|
450
|
+
transition: import("vue-types").VueTypeValidableDef<string> & {
|
451
|
+
default: string;
|
452
|
+
} & {
|
453
|
+
default: string;
|
454
|
+
};
|
455
|
+
placement: import("vue-types").VueTypeDef<string> & {
|
456
|
+
default: string;
|
457
|
+
};
|
458
|
+
theme: import("vue-types").VueTypeValidableDef<string> & {
|
459
|
+
default: string;
|
460
|
+
} & {
|
461
|
+
default: string;
|
462
|
+
};
|
463
|
+
handleFirstUpdate: {
|
464
|
+
type: import("vue").PropType<import("@bkui-vue/shared").OnFirstUpdateFnType>;
|
465
|
+
default: () => void;
|
466
|
+
};
|
467
|
+
trigger: import("vue-types").VueTypeValidableDef<string> & {
|
468
|
+
default: string;
|
469
|
+
} & {
|
470
|
+
default: string;
|
471
|
+
};
|
472
|
+
arrow: import("vue-types").VueTypeValidableDef<boolean> & {
|
473
|
+
default: boolean;
|
474
|
+
} & {
|
475
|
+
default: boolean;
|
476
|
+
};
|
477
|
+
modifiers: import("vue-types").VueTypeValidableDef<unknown[]> & {
|
478
|
+
default: () => unknown[];
|
479
|
+
} & {
|
480
|
+
default: () => unknown[];
|
481
|
+
};
|
482
|
+
boundary: import("vue-types").VueTypeDef<string | HTMLElement>;
|
483
|
+
fixOnBoundary: import("vue-types").VueTypeValidableDef<boolean> & {
|
484
|
+
default: boolean;
|
485
|
+
} & {
|
486
|
+
default: boolean;
|
487
|
+
};
|
488
|
+
zIndex: import("vue-types").VueTypeValidableDef<number> & {
|
489
|
+
default: number;
|
490
|
+
} & {
|
491
|
+
default: number;
|
492
|
+
};
|
493
|
+
stopBehaviors: import("vue-types").VueTypeDef<string | string[]> & {
|
494
|
+
default: string | (() => string[]);
|
495
|
+
};
|
496
|
+
}>>>>;
|
497
|
+
default: () => {};
|
498
|
+
};
|
506
499
|
}>> & {
|
507
500
|
onBlur?: (...args: any[]) => any;
|
508
501
|
onChange?: (...args: any[]) => any;
|
@@ -549,5 +542,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
549
542
|
[key: string]: any;
|
550
543
|
}>;
|
551
544
|
pasteFn: (value: string) => any[];
|
545
|
+
popoverProps: {};
|
552
546
|
}>;
|
553
547
|
export default _default;
|