bkui-vue 0.0.1-beta.26 → 0.0.1-beta.29

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/lib/tag/tag.css CHANGED
@@ -1,5 +1,6 @@
1
1
  .bk-tag {
2
- display: inline-block;
2
+ display: inline-flex;
3
+ align-items: center;
3
4
  height: 22px;
4
5
  padding: 0 10px;
5
6
  margin: 2px 6px 2px 0px;
@@ -75,17 +76,22 @@
75
76
  background: #3a84ff;
76
77
  opacity: 1;
77
78
  }
79
+ .bk-tag .bk-tag-text {
80
+ flex: 1;
81
+ overflow: hidden;
82
+ text-overflow: ellipsis;
83
+ white-space: nowrap;
84
+ }
78
85
  .bk-tag .bk-tag-icon {
79
- display: inline-block;
86
+ flex-shrink: 0;
80
87
  margin-right: 4px;
81
88
  font-size: 14px;
82
89
  line-height: 0;
83
90
  }
84
91
  .bk-tag .bk-tag-close {
85
- display: inline-block;
92
+ flex-shrink: 0;
86
93
  margin-left: 4px;
87
94
  font-size: 12px;
88
95
  line-height: 0;
89
- vertical-align: 1px;
90
96
  cursor: pointer;
91
97
  }
package/lib/tag/tag.less CHANGED
@@ -22,7 +22,8 @@
22
22
  @themeSelectors: success, info, warning, danger;
23
23
 
24
24
  .bk-tag {
25
- display: inline-block;
25
+ display: inline-flex;
26
+ align-items: center;
26
27
  height: 22px;
27
28
  padding: 0 10px;
28
29
  margin: 2px 6px 2px 0px;
@@ -88,19 +89,25 @@
88
89
  }
89
90
  }
90
91
 
92
+ .bk-tag-text {
93
+ flex: 1;
94
+ overflow: hidden;
95
+ text-overflow: ellipsis;
96
+ white-space: nowrap;
97
+ }
98
+
91
99
  .bk-tag-icon {
92
- display: inline-block;
100
+ flex-shrink: 0;
93
101
  margin-right: 4px;
94
102
  font-size: 14px;
95
103
  line-height: 0;
96
104
  }
97
105
 
98
106
  .bk-tag-close {
99
- display: inline-block;
107
+ flex-shrink: 0;
100
108
  margin-left: 4px;
101
109
  font-size: 12px;
102
110
  line-height: 0;
103
- vertical-align: 1px;
104
111
  cursor: pointer;
105
112
  }
106
113
  }
@@ -92,7 +92,8 @@
92
92
  --table-row-hover-bg-color: #f5f7fa;
93
93
  }
94
94
  .bk-tag {
95
- display: inline-block;
95
+ display: inline-flex;
96
+ align-items: center;
96
97
  height: 22px;
97
98
  padding: 0 10px;
98
99
  margin: 2px 6px 2px 0px;
@@ -168,17 +169,22 @@
168
169
  background: var(--primary-color);
169
170
  opacity: 1;
170
171
  }
172
+ .bk-tag .bk-tag-text {
173
+ flex: 1;
174
+ overflow: hidden;
175
+ text-overflow: ellipsis;
176
+ white-space: nowrap;
177
+ }
171
178
  .bk-tag .bk-tag-icon {
172
- display: inline-block;
179
+ flex-shrink: 0;
173
180
  margin-right: 4px;
174
181
  font-size: 14px;
175
182
  line-height: 0;
176
183
  }
177
184
  .bk-tag .bk-tag-close {
178
- display: inline-block;
185
+ flex-shrink: 0;
179
186
  margin-left: 4px;
180
187
  font-size: 12px;
181
188
  line-height: 0;
182
- vertical-align: 1px;
183
189
  cursor: pointer;
184
190
  }
@@ -0,0 +1,24 @@
1
+ import { Ref } from 'vue';
2
+ import type { TagProps } from './tag-props';
3
+ export declare const INPUT_MIN_WIDTH = 12;
4
+ export declare function useDebouncedRef<T>(value: any, delay?: number): Ref<T>;
5
+ export declare function usePage(pageSize: Ref<number>): {
6
+ pageState: {
7
+ curPage: number;
8
+ totalSize: number;
9
+ totalPage: number;
10
+ pageSize: number;
11
+ isPageLoading: boolean;
12
+ curPageList: any[];
13
+ renderListPaged: any[];
14
+ };
15
+ initPage: (allList?: any[]) => void;
16
+ pageChange: (page: number) => void;
17
+ };
18
+ export declare function useFlatList(props: TagProps): any[];
19
+ /**
20
+ * 获取字符长度,汉字两个字节
21
+ * @param str 需要计算长度的字符
22
+ * @returns 字符长度
23
+ */
24
+ export declare const getCharLength: (str: string) => number;
@@ -0,0 +1,2 @@
1
+ import TagInput from './tag-input';
2
+ export default TagInput;
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("../directives"),require("../icon"),require("../loading"),require("../popover"),require("../shared")):"function"==typeof define&&define.amd?define(["exports","vue","../directives","../icon","../loading","../popover","../shared"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).bkuiVue={},e.Vue,e.Directives,e["@bkui-vue/icon/icons"],e.Loading,e.Popover,e.Shared)}(this,(function(e,t,r,o,a,n,l){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(a),u=i(n);function c(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var p={exports:{}};!function(e){function t(r){return e.exports=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},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(p);var d=c(p.exports),f={exports:{}},g={exports:{}};!function(e){e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports}(g);var v={exports:{}};!function(e){e.exports=function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,a,n=[],l=!0,i=!1;try{for(r=r.call(e);!(l=(o=r.next()).done)&&(n.push(o.value),!t||n.length!==t);l=!0);}catch(e){i=!0,a=e}finally{try{l||null==r.return||r.return()}finally{if(i)throw a}}return n}},e.exports.__esModule=!0,e.exports.default=e.exports}(v);var h={exports:{}},y={exports:{}};!function(e){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o},e.exports.__esModule=!0,e.exports.default=e.exports}(y),function(e){var t=y.exports;e.exports=function(e,r){if(e){if("string"==typeof e)return t(e,r);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?t(e,r):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports}(h);var m={exports:{}};!function(e){e.exports=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.")},e.exports.__esModule=!0,e.exports.default=e.exports}(m),function(e){var t=g.exports,r=v.exports,o=h.exports,a=m.exports;e.exports=function(e,n){return t(e)||r(e,n)||o(e,n)||a()},e.exports.__esModule=!0,e.exports.default=e.exports}(f);var x=c(f.exports),T={exports:{}};!function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}(T);var b=c(T.exports),L={exports:{}},w={exports:{}};!function(e){var t=y.exports;e.exports=function(e){if(Array.isArray(e))return t(e)},e.exports.__esModule=!0,e.exports.default=e.exports}(w);var P={exports:{}};!function(e){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports}(P);var I={exports:{}};!function(e){e.exports=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.")},e.exports.__esModule=!0,e.exports.default=e.exports}(I),function(e){var t=w.exports,r=P.exports,o=h.exports,a=I.exports;e.exports=function(e){return t(e)||r(e)||o(e)||a()},e.exports.__esModule=!0,e.exports.default=e.exports}(L);var C=c(L.exports),S=12;var K=function(e){for(var t=e.length,r=0,o=0;o<t;o++)0!=(65280&e.charCodeAt(o))&&(r+=1),r+=1;return r},k=t.defineComponent({name:"ListTagRender",props:{node:l.PropTypes.object,searchKey:l.PropTypes.oneOfType([l.PropTypes.string,l.PropTypes.arrayOf(l.PropTypes.string)]),displayKey:l.PropTypes.string,searchKeyword:l.PropTypes.string,tpl:{type:Function,default:null}},render:function(){var e=this,r=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,r,t.h,this);var o=this.node[this.displayKey];return t.createVNode("div",{class:"bk-selector-node"},[t.createVNode("span",{class:"text",innerHTML:r(o)},[o])])}}),V=t.defineComponent({name:"TagRender",props:{node:l.PropTypes.object,displayKey:l.PropTypes.string,tpl:{type:Function,default:null}},render:function(){return this.tpl?this.tpl(this.node,t.h,this):t.createVNode("div",{class:"tag"},[t.createVNode("span",{class:"text"},[this.node[this.displayKey]])])}}),_=t.defineComponent({name:"BkTagInput",directives:{bkTooltips:r.bkTooltips},props:{modelValue:l.PropTypes.arrayOf(l.PropTypes.string).def([]),placeholder:l.PropTypes.string.def("请输入并按 Enter 结束"),list:l.PropTypes.arrayOf(l.PropTypes.object).def([]),disabled:l.PropTypes.bool.def(!1),tooltipKey:l.PropTypes.string.def(""),saveKey:l.PropTypes.string.def("id"),displayKey:l.PropTypes.string.def("name"),hasDeleteIcon:l.PropTypes.bool.def(!1),clearable:l.PropTypes.bool.def(!0),trigger:l.PropTypes.commonType(["focus","search"]).def("search"),searchKey:l.PropTypes.oneOfType([l.PropTypes.string,l.PropTypes.arrayOf(l.PropTypes.string)]).def("name"),useGroup:l.PropTypes.bool.def(!1),allowCreate:l.PropTypes.bool.def(!1),maxData:l.PropTypes.number.def(-1),maxResult:l.PropTypes.number.def(10),contentMaxHeight:l.PropTypes.number.def(300),contentWidth:l.PropTypes.number.def(190),separator:l.PropTypes.string.def(""),allowNextFocus:l.PropTypes.bool.def(!0),allowAutoMatch:l.PropTypes.bool.def(!1),showClearOnlyHover:l.PropTypes.bool.def(!1),leftSpace:l.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 o=r.emit,a=t.reactive({isEdit:!1,isHover:!1,focusItemIndex:e.allowCreate?-1:0}),n=t.reactive({isShow:!1,width:190,modifiers:[{name:"offset",options:{offset:[0,4]}}]}),l=function(e){var r=t.reactive({curPage:1,totalSize:0,totalPage:0,pageSize:e,isPageLoading:!1,curPageList:[],renderListPaged:[]});return{pageState:r,initPage:function(){var e,t,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];r.curPage=1,r.totalSize=o.length,r.totalPage=Math.ceil(r.totalSize/r.pageSize)||1;var a=[];if(r.pageSize>0)for(var n=0;n<r.totalSize;n+=r.pageSize)a.push(o.slice(n,n+r.pageSize));(e=r.renderListPaged).splice.apply(e,[0,r.renderListPaged.length].concat(a)),(t=r.curPageList).splice.apply(t,[0,r.curPageList.length].concat(C(r.renderListPaged[r.curPage-1]||[])))},pageChange:function(e){var t;r.curPage=e,(t=r.curPageList).splice.apply(t,[r.curPageList.length,0].concat(C(r.renderListPaged[r.curPage-1]||[]))),r.isPageLoading=!1}}}(t.toRefs(e).maxResult),i=l.pageState,s=l.initPage,u=l.pageChange,c=function(e){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,a=e;return t.customRef((function(e,t){return{get:function(){return e(),a},set:function(e){clearTimeout(r),r=setTimeout((function(){a=e,t()}),o)}}}))}("",150),p=t.ref(null),f=t.ref(null),g=t.ref(null),v=t.ref(null),h=t.ref(null),y=t.ref(null),m=t.ref(null),T=t.computed((function(){return!e.disabled&&e.hasDeleteIcon})),L=t.computed((function(){return 1===e.maxData})),w=t.computed((function(){return 0===A.selectedTagList.length&&""===c.value&&!a.isEdit})),P=t.computed((function(){return e.clearable&&!e.disabled&&0!==A.selectedTagList.length&&(!e.showClearOnlyHover||a.isHover)})),I=t.computed((function(){return{"bk-tag-input-trigger":!0,active:a.isEdit,disabled:e.disabled}}));t.watch([function(){return C(e.modelValue)},function(){return C(e.list)}],(function(){E()})),t.watch(c,(function(t){var r=0!==i.curPageList.length;""!==t&&r||""===t&&"focus"===e.trigger?n.isShow=!0:"focus"===e.trigger&&r||(n.isShow=!1)})),t.watch((function(){return n.isShow}),(function(e){k(),e&&h.value&&(t.nextTick((function(){h.value.scrollTop=0})),h.value.removeEventListener("scroll",V),h.value.addEventListener("scroll",V))}));var k=function(){var e,t,r=L.value?0:null===(e=v.value)||void 0===e?void 0:e.offsetLeft;n.modifiers=[{name:"offset",options:{offset:[r,4]}}],null===(t=y.value)||void 0===t||t.update()},V=function(){if(!i.isPageLoading&&0!==h.value.scrollTop){var e=h.value;if(e.scrollTop+e.offsetHeight>=e.scrollHeight){var t=i.curPage+1;t<=i.totalPage&&(i.isPageLoading=!0,setTimeout((function(){u(t)}),500))}}},_=function(){var e;return Array.from((null===(e=g.value)||void 0===e?void 0:e.childNodes)||[]).filter((function(e){return e.nodeType!==Node.TEXT_NODE}))},N=function(r){if(!e.disabled){if(null==r?void 0:r.target){var o=r.target.className;(o.indexOf("bk-tag-input-trigger")>-1||o.indexOf("tag-list")>-1)&&g.value.appendChild(v.value)}clearTimeout(m.value),L.value&&R.value.length&&(A.tagListCache=C(R.value),A.selectedTagListCache=C(A.selectedTagList),c.value=A.selectedTagListCache[0][e.saveKey],W(A.selectedTagList[0],0),H()),a.isEdit=!0,t.nextTick((function(){var t;null===(t=p.value)||void 0===t||t.focus(),"focus"===e.trigger&&0!==A.localList.length&&(D(),n.isShow?k():n.isShow=!0)}))}},A=t.reactive({localList:[],tagListCache:[],selectedTagList:[],selectedTagListCache:[]}),R=t.computed((function(){return A.selectedTagList.map((function(t){return t[e.saveKey]}))})),M=function(e){var r=t.toRefs(e),o=r.useGroup,a=r.saveKey,n=r.displayKey,l=r.list,i=t.reactive([]);return t.watch([o,a,n,l],(function(){var e=l.value;o.value&&(e=l.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)}),[])),i.splice.apply(i,[0,i.length].concat(C(e)))}),{immediate:!0,deep:!0}),i}(e),O=t.computed((function(){if(e.useGroup){var t={};return i.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 i.curPageList})),E=function(){var t=e.saveKey,r=e.modelValue,o=e.displayKey,a=e.allowCreate,n=e.trigger;A.selectedTagList=[],A.localList=C(M),r.length&&(r.forEach((function(e){var r=A.localList.find((function(r){return e===r[t]}));if(void 0!==r)A.selectedTagList.push(r);else if(a&&!R.value.includes(e)){var n;A.selectedTagList.push((b(n={},t,e),b(n,o,e),n))}})),L.value||(A.localList=A.localList.filter((function(e){return!r.includes(e[t])})))),"focus"===n&&D()},D=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=e.searchKey,o=e.filterCallback,a=t.toLowerCase(),n=[];if("function"==typeof o)n=o(a,r,A.localList)||[];else if(Array.isArray(r)){var l=r.map((function(e){return A.localList.filter((function(t){return-1!==t[e].toLowerCase().indexOf(a)}))}));n=Array.from(new Set(l.flat()))}else n=A.localList.filter((function(e){return-1!==e[r].toLowerCase().indexOf(a)}));s(n)};t.onMounted((function(){E()}));var j=function(){c.value=""},F=function(){if(L.value)return 0;var e=_().findIndex((function(e){return"tagInputItem"===e.id}));return e>=0?e:0},z=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t&&e){var o=t;r&&(o=t.nextElementSibling||null),t.parentNode.insertBefore(e,o)}},H=function(t){var r=e.maxData,o=e.trigger,l=e.allowCreate;if(-1===r||r>R.value.length){var i=((null==t?void 0:t.target)?t.target:c).value,s=K(i);s?(D(i),p.value.style.width="".concat(s*S,"px")):"focus"===o&&D()}else B(),c.value="",n.isShow=!1;a.isEdit=!0,a.focusItemIndex=l?-1:0},B=function(){m.value=setTimeout((function(){var t=c.value;if(j(),a.isEdit=!1,L.value){var r=x(A.tagListCache,1)[0];t&&t===r&&A.selectedTagListCache.length?U(A.selectedTagListCache[0],"select"):G("remove")}else if(e.allowAutoMatch&&t){var l=i.curPageList.find((function(r){return Array.isArray(e.searchKey)?e.searchKey.map((function(e){return r[e]})).includes(t):r[e.searchKey]===t}));l?q(l,"select"):e.allowCreate&&q(t,"custom")}n.isShow=!1,o("blur",t,R.value)}),50)},q=function(e,t,r){null==r||r.stopPropagation(),e&&!e.disabled&&(L.value&&(A.tagListCache=[],A.selectedTagListCache=[],A.selectedTagList=[]),U(e,t),G("select"),j(),n.isShow=!1)},G=function(e){o("change",R.value),o(e),o("update:modelValue",R.value)},Z=function(){var e=h.value.clientHeight,r=h.value.getBoundingClientRect().y;t.nextTick((function(){var t=h.value.querySelector(".bk-selector-actived");if(t){var o=t.clientHeight,a=t.getBoundingClientRect().y;a<r&&(h.value.scrollTop=h.value.scrollTop-(r-a));var n=a+o-r;n>e&&(h.value.scrollTop=h.value.scrollTop+n-e)}}))},U=function(r,o){if(!(A.selectedTagList.length>=e.maxData&&-1!==e.maxData)){var a,n=e.separator,l=e.saveKey,i=e.displayKey,s=e.createTagValidator,u=F(),c=1,f=!1,g=function(e){return"function"!=typeof s||s(e)},h=function(e){return A.localList.find((function(t){return t[l]===e}))};if("custom"===o)if(n){var y,m=r.split(n),x=(m=m.filter((function(e){return(null==e?void 0:e.trim())&&!R.value.includes(e)&&g(e)}))).map((function(e){var t;return h(e)||(b(t={},l,e),b(t,i,e),t)}));if(m.length)(y=A.selectedTagList).splice.apply(y,[u,0].concat(C(x))),c=x.length,f=!0}else{var T="object"===d(r);if(void 0!==(a=(a=T?r[l]:r.trim()).replace(/\s+/g,""))&&!R.value.includes(a)&&g(a)){var w,P=h(a)||(T?r:(b(w={},l,a),b(w,i,a),w));A.selectedTagList.splice(u,0,P),f=!0}}else r&&(void 0===(a=r[l])||R.value.includes(a)||(A.selectedTagList.splice(u,0,r),f=!0));f&&t.nextTick((function(){for(var t=1;t<=c;t++){var r=_()[u+t];z(r,v.value)}p.value.style.width="".concat(S,"px"),L.value||(e.allowNextFocus&&N(),A.localList=A.localList.filter((function(e){return!R.value.includes(e[l])})))}))}},W=function(t,r){A.selectedTagList.splice(r,1);var o=M.some((function(r){return r===t[e.saveKey]}));(e.allowCreate&&o||!e.allowCreate)&&!L.value&&A.localList.push(t)};return Object.assign(Object.assign(Object.assign(Object.assign({popoverProps:n},t.toRefs(a)),t.toRefs(A)),t.toRefs(i)),{isShowPlaceholder:w,isShowClear:P,curInputValue:c,formatList:M,renderList:O,showTagClose:T,tagInputRef:p,bkTagSelectorRef:f,tagListRef:g,tagInputItemRef:v,selectorListRef:h,popoverRef:y,triggerClass:I,focusInputTrigger:N,activeClass:function(t,r){var o={"bk-selector-actived":!1,"bk-selector-selected":R.value.includes(t[e.saveKey])};return e.useGroup?o["bk-selector-actived"]=t.__index__===a.focusItemIndex:o["bk-selector-actived"]=r===a.focusItemIndex,o},handleInput:H,handleFocus:function(){var t;n.width=L.value?null===(t=f.value)||void 0===t?void 0:t.clientWidth:e.contentWidth},handleBlur:B,handleTagSelected:q,handleTagRemove:function(e,t,r){null==r||r.stopPropagation(),W(e,t),j(),G("remove"),p.value.style.width="".concat(S,"px")},handleClear:function(t){t.stopPropagation();var r=A.selectedTagList;A.selectedTagList=[];var o,a=M.filter((function(t){return r.some((function(r){return r[e.saveKey]===t[e.saveKey]}))}));(!e.allowCreate||0===a.length)&&e.allowCreate||L.value||(o=A.localList).push.apply(o,C(a));G("removeAll")},tagFocus:function(t){e.disabled||(z(v.value,t.currentTarget,!0),p.value.style.width="".concat(S,"px"),n.isShow&&k())},handleKeydown:function(t){if(!i.isPageLoading){var r=t.target.value,o=K(r),l=F(),s=_();switch(t.code){case"ArrowUp":if(t.preventDefault(),!n.isShow)return;a.focusItemIndex=a.focusItemIndex-1,a.focusItemIndex=a.focusItemIndex<0?-1:a.focusItemIndex,-1===a.focusItemIndex&&(a.focusItemIndex=i.curPageList.length-1),Z();break;case"ArrowDown":if(t.preventDefault(),!n.isShow)return;a.focusItemIndex=a.focusItemIndex+1,a.focusItemIndex=a.focusItemIndex>i.curPageList.length-1?i.curPageList.length:a.focusItemIndex,a.focusItemIndex===i.curPageList.length&&(a.focusItemIndex=0),Z();break;case"ArrowLeft":if(a.isEdit=!0,!o){if(l<1)return;z(v.value,s[l-1]),N()}break;case"ArrowRight":if(a.isEdit=!0,!o){if(l===s.length-1)return;z(s[l+1],v.value),N()}break;case"Enter":case"NumpadEnter":!e.allowCreate&&n.isShow||e.allowCreate&&a.focusItemIndex>=0&&n.isShow?q(i.curPageList[a.focusItemIndex],"select",t):e.allowCreate&&q(c.value,"custom",t),t.preventDefault();break;case"Backspace":0===l||c.value||function(t,r){var o=_();z(v.value,o[t-1]),A.selectedTagList.splice(t-1,1),N();var a=M.some((function(t){return t===r[e.saveKey]}));(e.allowCreate&&a||!e.allowCreate)&&!L.value&&A.localList.push(r),p.value="".concat(S,"px"),G("remove")}(l,A.selectedTagList[l-1])}}},handlePaste:function(t){if(t.preventDefault(),L.value)return!1;var r=e.maxData,o=e.saveKey,a=e.pasteFn,n=t.clipboardData.getData("text"),l=a?a(n):function(t){var r=[];return t.split(";").forEach((function(t){if(t.match(/^[a-zA-Z][a-zA-Z_]+/g)){var o,a=t.match(/^[a-zA-Z][a-zA-Z_]+/g).join("");r.push((b(o={},e.saveKey,a),b(o,e.displayKey,a),o))}})),r}(n),i=l.map((function(e){return e[o]}));if(i.length){var s=_(),u=F(),c=A.localList.map((function(e){return e[o]}));if(i=i.filter((function(e){return(null==e?void 0:e.trim())&&!R.value.includes(e)&&c.includes(e)})),-1!==r){var d=A.selectedTagList.length;if(d<r){var f=r-d;i.length>f&&(i=C(i.slice(0,f)))}else i=[]}var g,h=A.localList.filter((function(e){return i.includes(e[o])}));if(i.length)(g=A.selectedTagList).splice.apply(g,[u,0].concat(C(h))),z(v.value,s[u]),p.value.style.width="".concat(S,"px"),A.localList=A.localList.filter((function(e){return!i.includes(e[o])})),G("select"),N()}}})},render:function(){var e=this;return t.createVNode("div",{class:"bk-tag-input",ref:"bkTagSelectorRef",onClick:this.focusInputTrigger,onMouseenter:function(){return e.isHover=!0},onMouseleave:function(){return e.isHover=!1}},[t.createVNode(u.default,{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 t.createVNode("div",{class:e.triggerClass},[t.createVNode("ul",{class:"tag-list",ref:"tagListRef",style:{marginLeft:"".concat(e.leftSpace,"px")}},[e.selectedTagList.map((function(r,a){var n={boundary:"window",theme:"light",distance:12,content:r[e.tooltipKey],disabled:!e.tooltipKey};return t.withDirectives(t.createVNode("li",{class:"tag-item",onClick:e.tagFocus},[t.createVNode(V,{node:r,tpl:e.tagTpl,displayKey:e.displayKey},null),e.showTagClose?t.createVNode(o.Error,{class:"remove-tag",onClick:e.handleTagRemove.bind(e,r,a)},null):null]),[[t.resolveDirective("bk-tooltips"),n]])})),t.withDirectives(t.createVNode("li",{ref:"tagInputItemRef",id:"tagInputItem",class:"tag-input-item",role:"input"},[t.withDirectives(t.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),[[t.vModelText,e.curInputValue]])]),[[t.vShow,e.isEdit]])]),t.withDirectives(t.createVNode("p",{class:"placeholder"},[e.placeholder]),[[t.vShow,e.isShowPlaceholder]]),e.isShowClear?t.createVNode(o.Close,{class:"clear-icon",onClick:e.handleClear},null):null])},content:function(){return t.createVNode("div",{class:"bk-selector-list"},[t.createVNode("ul",{ref:"selectorListRef",style:{"max-height":"".concat(e.contentMaxHeight,"px")},class:"outside-ul"},[e.useGroup?e.renderList.map((function(r){return t.createVNode("li",{class:"bk-selector-group-item"},[t.createVNode("span",{class:"group-name"},[r.name,t.createTextVNode(" ("),r.children.length,t.createTextVNode(")")]),t.createVNode("ul",{class:"bk-selector-group-list-item"},[r.children.map((function(r,o){return t.createVNode("li",{class:["bk-selector-list-item",{disabled:r.disabled},e.activeClass(r,o)],onClick:e.handleTagSelected.bind(e,r,"select")},[t.createVNode(k,{node:r,displayKey:e.displayKey,tpl:e.tpl,searchKey:e.searchKey,searchKeyword:e.curInputValue},null)])}))])])})):e.renderList.map((function(r,o){return t.createVNode("li",{class:["bk-selector-list-item",{disabled:r.disabled},e.activeClass(r,o)],onClick:e.handleTagSelected.bind(e,r,"select")},[t.createVNode(k,{node:r,displayKey:e.displayKey,tpl:e.tpl,searchKey:e.searchKey,searchKeyword:e.curInputValue},null)])})),e.isPageLoading?t.createVNode("li",{class:"bk-selector-list-item loading"},[t.createVNode(s.default,{theme:"primary",size:a.BkLoadingSize.Small},null)]):null])])}})])}});_.install=function(e){e.component(_.name,_)},e.default=_,Object.defineProperty(e,"__esModule",{value:!0})}));
@@ -0,0 +1,47 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ node: import("vue-types").VueTypeValidableDef<{
3
+ [key: string]: any;
4
+ }> & {
5
+ default: () => {
6
+ [key: string]: any;
7
+ };
8
+ };
9
+ searchKey: import("vue-types").VueTypeDef<string | string[]>;
10
+ displayKey: import("vue-types").VueTypeValidableDef<string> & {
11
+ default: string;
12
+ };
13
+ searchKeyword: import("vue-types").VueTypeValidableDef<string> & {
14
+ default: string;
15
+ };
16
+ tpl: {
17
+ type: FunctionConstructor;
18
+ default: any;
19
+ };
20
+ }, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
21
+ node: import("vue-types").VueTypeValidableDef<{
22
+ [key: string]: any;
23
+ }> & {
24
+ default: () => {
25
+ [key: string]: any;
26
+ };
27
+ };
28
+ searchKey: import("vue-types").VueTypeDef<string | string[]>;
29
+ displayKey: import("vue-types").VueTypeValidableDef<string> & {
30
+ default: string;
31
+ };
32
+ searchKeyword: import("vue-types").VueTypeValidableDef<string> & {
33
+ default: string;
34
+ };
35
+ tpl: {
36
+ type: FunctionConstructor;
37
+ default: any;
38
+ };
39
+ }>>, {
40
+ displayKey: string;
41
+ tpl: Function;
42
+ node: {
43
+ [key: string]: any;
44
+ };
45
+ searchKeyword: string;
46
+ }>;
47
+ export default _default;
@@ -0,0 +1,208 @@
1
+ .bk-tag-input {
2
+ position: relative;
3
+ min-height: 32px;
4
+ }
5
+ .bk-tag-input .bk-popover-reference {
6
+ display: block;
7
+ }
8
+ .bk-tag-input .bk-tag-input-trigger {
9
+ position: relative;
10
+ display: flex;
11
+ min-height: 32px;
12
+ padding: 0 0 0 5px;
13
+ overflow: hidden;
14
+ font-size: 12px;
15
+ cursor: pointer;
16
+ background: white;
17
+ border: 1px solid #c4c6cc;
18
+ border-radius: 2px;
19
+ align-items: center;
20
+ justify-content: space-between;
21
+ }
22
+ .bk-tag-input .bk-tag-input-trigger.active {
23
+ border-color: #3a84ff;
24
+ }
25
+ .bk-tag-input .bk-tag-input-trigger.disabled {
26
+ cursor: not-allowed;
27
+ background: #fafbfd;
28
+ border-color: #dcdee5;
29
+ }
30
+ .bk-tag-input .bk-tag-input-trigger .tag-list {
31
+ display: inline-flex;
32
+ max-height: 135px;
33
+ padding: 0;
34
+ margin: 0;
35
+ overflow: auto;
36
+ align-items: center;
37
+ flex-wrap: wrap;
38
+ }
39
+ .bk-tag-input .bk-tag-input-trigger .tag-list > li {
40
+ display: inline-flex;
41
+ height: 22px;
42
+ margin: 4px 5px 4px 0;
43
+ overflow: hidden;
44
+ font-size: 12px;
45
+ border: solid 1px transparent;
46
+ border-radius: 2px;
47
+ align-items: center;
48
+ }
49
+ .bk-tag-input .bk-tag-input-trigger .tag-list > li.tag-item {
50
+ background: #f0f1f5;
51
+ border-color: #f0f1f5;
52
+ }
53
+ .bk-tag-input .bk-tag-input-trigger .tag-list .remove-tag {
54
+ flex-shrink: 0;
55
+ margin-right: 5px;
56
+ font-size: 14px;
57
+ line-height: 0;
58
+ }
59
+ .bk-tag-input .bk-tag-input-trigger .tag-list .tag {
60
+ max-width: 190px;
61
+ overflow: hidden;
62
+ text-overflow: ellipsis;
63
+ word-break: break-all;
64
+ white-space: nowrap;
65
+ flex: 1;
66
+ }
67
+ .bk-tag-input .bk-tag-input-trigger .tag-list .text {
68
+ padding: 0 5px;
69
+ line-height: 20px;
70
+ color: #63656e;
71
+ background-color: #f0f1f5;
72
+ border-radius: 2px;
73
+ box-sizing: border-box;
74
+ }
75
+ .bk-tag-input .bk-tag-input-trigger .tag-list .tag-input {
76
+ width: 10px;
77
+ height: 22px;
78
+ max-width: 295px;
79
+ padding: 0;
80
+ border: 0;
81
+ outline: none;
82
+ box-sizing: border-box;
83
+ }
84
+ .bk-tag-input .bk-tag-input-trigger .placeholder {
85
+ position: absolute;
86
+ top: 0;
87
+ left: 8px;
88
+ padding: 0;
89
+ margin: 0;
90
+ line-height: 30px;
91
+ color: #c4c6cc;
92
+ }
93
+ .bk-tag-input .bk-tag-input-trigger .clear-icon {
94
+ margin-right: 5px;
95
+ font-size: 14px;
96
+ line-height: 0;
97
+ color: #c4c6cc;
98
+ cursor: pointer;
99
+ }
100
+ .bk-tag-input .bk-tag-input-trigger .clear-icon:hover {
101
+ color: #979ba5;
102
+ }
103
+ .bk-tag-input .bk-popover-content {
104
+ padding: 0;
105
+ }
106
+ .bk-selector-list {
107
+ min-width: 150px;
108
+ }
109
+ .bk-selector-list .outside-ul {
110
+ max-height: 160px;
111
+ padding: 0;
112
+ padding: 6px 0;
113
+ margin: 0;
114
+ overflow-y: auto;
115
+ list-style: none;
116
+ background-color: white;
117
+ border: 1px solid #dcdee5;
118
+ border-radius: 2px;
119
+ }
120
+ .bk-selector-list .outside-ul::-webkit-scrollbar {
121
+ width: 6px;
122
+ height: 6px;
123
+ }
124
+ .bk-selector-list .outside-ul::-webkit-scrollbar-thumb {
125
+ min-height: 24px;
126
+ background-color: #dcdee5;
127
+ border-radius: 3px;
128
+ }
129
+ .bk-selector-list .bk-selector-group-item {
130
+ list-style: none;
131
+ }
132
+ .bk-selector-list .bk-selector-group-item .group-name {
133
+ padding-left: 11px;
134
+ font-size: 12px;
135
+ line-height: 32px;
136
+ color: #979ba5;
137
+ }
138
+ .bk-selector-list .bk-selector-group-list-item {
139
+ padding: 0;
140
+ margin: 0;
141
+ list-style: none;
142
+ }
143
+ .bk-selector-list .bk-selector-list-item {
144
+ position: relative;
145
+ width: 100%;
146
+ cursor: pointer;
147
+ background-color: white;
148
+ border-right: #c4c6cc;
149
+ border-left: #c4c6cc;
150
+ }
151
+ .bk-selector-list .bk-selector-list-item:first-child {
152
+ border-top: #c4c6cc;
153
+ }
154
+ .bk-selector-list .bk-selector-list-item:last-child {
155
+ border-bottom: #c4c6cc;
156
+ }
157
+ .bk-selector-list .bk-selector-list-item.bk-selector-selected {
158
+ background-color: #f4f6fa;
159
+ }
160
+ .bk-selector-list .bk-selector-list-item.bk-selector-selected .selected-icon {
161
+ display: inline-block;
162
+ }
163
+ .bk-selector-list .bk-selector-list-item.bk-selector-actived {
164
+ background-color: #f4f6fa;
165
+ }
166
+ .bk-selector-list .bk-selector-list-item:hover {
167
+ background-color: #eaf3ff;
168
+ }
169
+ .bk-selector-list .bk-selector-list-item.disabled {
170
+ cursor: not-allowed;
171
+ background: white;
172
+ }
173
+ .bk-selector-list .bk-selector-list-item.disabled .text {
174
+ color: #c4c6cc;
175
+ }
176
+ .bk-selector-list .bk-selector-list-item.loading {
177
+ padding: 5px 0 3px;
178
+ text-align: center;
179
+ }
180
+ .bk-selector-list .bk-selector-list-item .loading {
181
+ position: relative;
182
+ width: 100%;
183
+ height: 40px;
184
+ font-size: 14px;
185
+ cursor: default;
186
+ }
187
+ .bk-selector-list .bk-selector-list-item .text {
188
+ padding: 0 10px;
189
+ overflow: hidden;
190
+ font-size: 12px;
191
+ line-height: 32px;
192
+ color: #63656e;
193
+ text-overflow: ellipsis;
194
+ white-space: nowrap;
195
+ }
196
+ .bk-selector-list .bk-selector-list-item .bk-selector-tools {
197
+ position: absolute;
198
+ top: 10px;
199
+ right: 0;
200
+ display: none;
201
+ font-size: 12px;
202
+ }
203
+ .bk-selector-list .bk-selector-list-item .bk-selector-tools .bk-selector-list-icon {
204
+ margin-right: 14px;
205
+ }
206
+ .bk-selector-list .bk-selector-list-item .highlight-text {
207
+ color: #3a84ff;
208
+ }