bkui-vue 0.0.1-beta.196 → 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.
@@ -0,0 +1,21 @@
1
+ .search-seleted-input {
2
+ position: relative;
3
+ display: flex;
4
+ height: 100%;
5
+ min-width: 150px;
6
+ min-width: 40px;
7
+ padding: 0 10px;
8
+ margin-top: -4px;
9
+ color: #63656e;
10
+ border: none;
11
+ align-items: center;
12
+ offset: none;
13
+ }
14
+ .search-seleted-input .div-input {
15
+ height: 30px;
16
+ padding: 5px 0;
17
+ line-height: 20px;
18
+ word-break: break-all;
19
+ flex: 1 1 auto;
20
+ outline: none;
21
+ }
@@ -0,0 +1,79 @@
1
+ import { InjectionKey, Ref, VNode } from 'vue';
2
+ /**
3
+ * @description: 获取menu list方法
4
+ * @param {ISearchItem} item 已选择的key字段 为空则代表当前并未选择key字段
5
+ * @param {string} keyword 已输入的文本
6
+ * @return {*} menu list用于渲染选择弹层列表
7
+ */
8
+ export declare type GetMenuListFunc = (item: ISearchItem, keyword: string) => Promise<ISearchItem[]>;
9
+ export declare type ValidateValuesFunc = (item: ISearchItem, values: ICommonItem[]) => Promise<string | true>;
10
+ export declare type MenuSlotParams = {
11
+ item: ISearchItem;
12
+ list: ISearchItem[];
13
+ hoverId: string;
14
+ multiple: boolean;
15
+ getSearchNode: (str: string) => string | (string | VNode)[];
16
+ };
17
+ export interface ISearchSelectProvider {
18
+ onEditClick: (item: SelectedItem, index: number) => void;
19
+ onEditEnter: (item: SelectedItem, index: number) => void;
20
+ onEditBlur: () => void;
21
+ onValidate: (str: string) => void;
22
+ editKey: Ref<String>;
23
+ }
24
+ export declare const SEARCH_SLECT_PROVIDER_KEY: InjectionKey<ISearchSelectProvider>;
25
+ export declare const useSearchSelectProvider: (data: ISearchSelectProvider) => void;
26
+ export declare const useSearchSelectInject: () => ISearchSelectProvider;
27
+ export declare enum SearchInputMode {
28
+ 'DEFAULT' = 0,
29
+ 'EDIT' = 1
30
+ }
31
+ export interface ICommonItem {
32
+ id: string;
33
+ name: string;
34
+ disabled?: boolean;
35
+ realId?: string;
36
+ value?: Omit<ICommonItem, 'disabled' | 'value'>;
37
+ }
38
+ export interface ISearchValue extends Omit<ICommonItem, 'disabled' | 'value'> {
39
+ type?: SearchItemType;
40
+ values?: Omit<ICommonItem, 'disabled'>[];
41
+ }
42
+ export interface ISearchItem {
43
+ id: string;
44
+ name: string;
45
+ children?: ICommonItem[];
46
+ multiple?: boolean;
47
+ async?: boolean;
48
+ noValidate?: boolean;
49
+ placeholder?: string;
50
+ disabled?: boolean;
51
+ }
52
+ export interface IMenuFooterItem {
53
+ id: 'confirm' | 'cancel';
54
+ name: string;
55
+ disabled?: boolean;
56
+ }
57
+ export declare type SearchItemType = 'text' | 'default' | 'condition';
58
+ export declare class SelectedItem {
59
+ searchItem: ISearchItem;
60
+ type: SearchItemType;
61
+ id: string;
62
+ name: string;
63
+ values: ICommonItem[];
64
+ condition: string;
65
+ constructor(searchItem: ISearchItem, type?: SearchItemType);
66
+ get multiple(): boolean;
67
+ get placeholder(): string;
68
+ get children(): ICommonItem[];
69
+ get validate(): boolean;
70
+ get inputInnerHtml(): string;
71
+ get inputInnerText(): string;
72
+ get keyInnerHtml(): string;
73
+ get keyInnerText(): string;
74
+ isSpecialType(): boolean;
75
+ addValue(item: ICommonItem): void;
76
+ toValue(): ISearchValue;
77
+ toValueKey(): string;
78
+ isInValueList(item: ICommonItem): boolean;
79
+ }
@@ -52,3 +52,4 @@ import '../container/container.less';
52
52
  import '../cascader/cascader.less';
53
53
  import '../color-picker/color-picker.less';
54
54
  import '../time-picker/time-picker.less';
55
+ import '../search-select/search-select.less';
@@ -15,7 +15,10 @@ export declare function usePage(pageSize: Ref<number>): {
15
15
  initPage: (allList?: any[]) => void;
16
16
  pageChange: (page: number) => void;
17
17
  };
18
- export declare function useFlatList(props: TagProps): Ref<any[]>;
18
+ export declare function useFlatList(props: TagProps): {
19
+ flatList: Ref<any[]>;
20
+ saveKeyMap: Ref<{}>;
21
+ };
19
22
  /**
20
23
  * 获取字符长度,汉字两个字节
21
24
  * @param str 需要计算长度的字符
@@ -516,7 +516,6 @@ declare const TagInput: {
516
516
  isShowPlaceholder: import("vue").ComputedRef<boolean>;
517
517
  isShowClear: import("vue").ComputedRef<boolean>;
518
518
  curInputValue: import("vue").Ref<string>;
519
- formatList: import("vue").Ref<any[]>;
520
519
  renderList: import("vue").ComputedRef<any[]>;
521
520
  showTagClose: import("vue").ComputedRef<boolean>;
522
521
  tagInputRef: any;
@@ -860,7 +859,6 @@ declare const TagInput: {
860
859
  isShowPlaceholder: import("vue").ComputedRef<boolean>;
861
860
  isShowClear: import("vue").ComputedRef<boolean>;
862
861
  curInputValue: import("vue").Ref<string>;
863
- formatList: import("vue").Ref<any[]>;
864
862
  renderList: import("vue").ComputedRef<any[]>;
865
863
  showTagClose: import("vue").ComputedRef<boolean>;
866
864
  tagInputRef: any;
@@ -1148,7 +1146,6 @@ declare const TagInput: {
1148
1146
  isShowPlaceholder: import("vue").ComputedRef<boolean>;
1149
1147
  isShowClear: import("vue").ComputedRef<boolean>;
1150
1148
  curInputValue: import("vue").Ref<string>;
1151
- formatList: import("vue").Ref<any[]>;
1152
1149
  renderList: import("vue").ComputedRef<any[]>;
1153
1150
  showTagClose: import("vue").ComputedRef<boolean>;
1154
1151
  tagInputRef: any;
@@ -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:{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),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})()));
@@ -224,7 +224,6 @@ declare const _default: import("vue").DefineComponent<{
224
224
  isShowPlaceholder: import("vue").ComputedRef<boolean>;
225
225
  isShowClear: import("vue").ComputedRef<boolean>;
226
226
  curInputValue: Ref<string>;
227
- formatList: Ref<any[]>;
228
227
  renderList: import("vue").ComputedRef<any[]>;
229
228
  showTagClose: import("vue").ComputedRef<boolean>;
230
229
  tagInputRef: any;
@@ -138,10 +138,10 @@ declare const Upload: {
138
138
  }>> & {
139
139
  onError?: (...args: any[]) => any;
140
140
  onProgress?: (...args: any[]) => any;
141
+ onDelete?: (...args: any[]) => any;
141
142
  onSuccess?: (...args: any[]) => any;
142
143
  onDone?: (...args: any[]) => any;
143
144
  onExceed?: (...args: any[]) => any;
144
- onDelete?: (...args: any[]) => any;
145
145
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "data" | "header" | "name" | "disabled" | "theme" | "extCls" | "size" | "multiple" | "tip" | "files" | "autoUpload" | "delayTime" | "method" | "handleResCode" | "headers" | "withCredentials" | "formDataAttributes" | "beforeUpload" | "beforeRemove" | "sliceUpload" | "sliceUrl" | "mergeUrl" | "chunkSize">;
146
146
  $attrs: {
147
147
  [x: string]: unknown;
@@ -154,7 +154,7 @@ declare const Upload: {
154
154
  }>;
155
155
  $root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
156
156
  $parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
157
- $emit: (event: "progress" | "error" | "success" | "done" | "exceed" | "delete", ...args: any[]) => void;
157
+ $emit: (event: "progress" | "error" | "success" | "done" | "delete" | "exceed", ...args: any[]) => void;
158
158
  $el: any;
159
159
  $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
160
160
  theme: {
@@ -268,11 +268,11 @@ declare const Upload: {
268
268
  }>> & {
269
269
  onError?: (...args: any[]) => any;
270
270
  onProgress?: (...args: any[]) => any;
271
+ onDelete?: (...args: any[]) => any;
271
272
  onSuccess?: (...args: any[]) => any;
272
273
  onDone?: (...args: any[]) => any;
273
274
  onExceed?: (...args: any[]) => any;
274
- onDelete?: (...args: any[]) => any;
275
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("progress" | "error" | "success" | "done" | "exceed" | "delete")[], string, {
275
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("progress" | "error" | "success" | "done" | "delete" | "exceed")[], string, {
276
276
  data: import("./upload.type").ExtraFormData | import("./upload.type").ExtraFormData[];
277
277
  header: import("./upload.type").HeaderDataAttr | import("./upload.type").HeaderDataAttr[];
278
278
  name: string;
@@ -428,10 +428,10 @@ declare const Upload: {
428
428
  }>> & {
429
429
  onError?: (...args: any[]) => any;
430
430
  onProgress?: (...args: any[]) => any;
431
+ onDelete?: (...args: any[]) => any;
431
432
  onSuccess?: (...args: any[]) => any;
432
433
  onDone?: (...args: any[]) => any;
433
434
  onExceed?: (...args: any[]) => any;
434
- onDelete?: (...args: any[]) => any;
435
435
  } & import("vue").ShallowUnwrapRef<() => JSX.Element> & {} & {} & import("vue").ComponentCustomProperties;
436
436
  __isFragment?: never;
437
437
  __isTeleport?: never;
@@ -548,11 +548,11 @@ declare const Upload: {
548
548
  }>> & {
549
549
  onError?: (...args: any[]) => any;
550
550
  onProgress?: (...args: any[]) => any;
551
+ onDelete?: (...args: any[]) => any;
551
552
  onSuccess?: (...args: any[]) => any;
552
553
  onDone?: (...args: any[]) => any;
553
554
  onExceed?: (...args: any[]) => any;
554
- onDelete?: (...args: any[]) => any;
555
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("progress" | "error" | "success" | "done" | "exceed" | "delete")[], "progress" | "error" | "success" | "done" | "delete" | "exceed", {
555
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("progress" | "error" | "success" | "done" | "delete" | "exceed")[], "progress" | "error" | "success" | "done" | "delete" | "exceed", {
556
556
  data: import("./upload.type").ExtraFormData | import("./upload.type").ExtraFormData[];
557
557
  header: import("./upload.type").HeaderDataAttr | import("./upload.type").HeaderDataAttr[];
558
558
  name: string;
@@ -108,7 +108,7 @@ declare const _default: import("vue").DefineComponent<{
108
108
  type: NumberConstructor;
109
109
  default: number;
110
110
  };
111
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("progress" | "error" | "success" | "done" | "exceed" | "delete")[], "progress" | "error" | "success" | "done" | "delete" | "exceed", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
111
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("progress" | "error" | "success" | "done" | "delete" | "exceed")[], "progress" | "error" | "success" | "done" | "delete" | "exceed", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
112
112
  theme: {
113
113
  type: import("vue").PropType<"button" | "picture" | "draggable">;
114
114
  default: "button" | "picture" | "draggable";
@@ -220,10 +220,10 @@ declare const _default: import("vue").DefineComponent<{
220
220
  }>> & {
221
221
  onError?: (...args: any[]) => any;
222
222
  onProgress?: (...args: any[]) => any;
223
+ onDelete?: (...args: any[]) => any;
223
224
  onSuccess?: (...args: any[]) => any;
224
225
  onDone?: (...args: any[]) => any;
225
226
  onExceed?: (...args: any[]) => any;
226
- onDelete?: (...args: any[]) => any;
227
227
  }, {
228
228
  data: import("./upload.type").ExtraFormData | import("./upload.type").ExtraFormData[];
229
229
  header: import("./upload.type").HeaderDataAttr | import("./upload.type").HeaderDataAttr[];
@@ -95,6 +95,7 @@ declare module '@vue/runtime-core' {
95
95
  BkProcess: typeof import('./process/process').default;
96
96
  BkUpload: typeof import('./upload/upload').default;
97
97
  BkCodeDiff: typeof import('./code-diff/code-diff').default;
98
+ BkSeachSelect: typeof import('./code-diff/search-select').default;
98
99
  }
99
100
  }
100
101
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkui-vue",
3
- "version": "0.0.1-beta.196",
3
+ "version": "0.0.1-beta.197",
4
4
  "workspaces": {
5
5
  "packages": [
6
6
  "packages/!(**.bak)*",
@@ -108,8 +108,7 @@
108
108
  "highlight.js": "~11.5.0",
109
109
  "vue": "^3.2.0"
110
110
  },
111
- "main": "dist/index.umd.js",
112
- "module": "lib/index.js",
111
+ "main": "dist/index.esm.js",
113
112
  "typings": "lib/index.d.ts",
114
113
  "lint-staged": {
115
114
  "scripts/**/*.(vue|ts|tsx|js)": [
@@ -1 +0,0 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("vue"));else if("function"==typeof define&&define.amd)define(["vue"],t);else{var r="object"==typeof exports?t(require("vue")):t(e.vue);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(e=>(()=>{"use strict";var t={9430:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(748);function o(e,t,r){return(0,n.h)(e.name,Object.assign(Object.assign({key:t},e.attributes),{style:"".concat(e.attributes.style," ").concat(r||"")}),(e.elements||[]).map((function(r,n){return o(r,"".concat(t,"-").concat(e.name,"-").concat(n))})))}Object.create,Object.create;var a=function(e,t){var r=Object.assign(Object.assign({},t.attrs),e),a=r.data,i=r.name,c=r.width,l=r.height,s=r.fill,u=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(r,["data","name","width","height","fill"]),p="width: ".concat(c,"; height: ").concat(l,"; fill: ").concat(s);return(0,n.createVNode)("span",u,[o(a,i,p)])};a.inheritAttrs=!1,a.displayName="bkIcon";const i=a},748:t=>{t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{default:()=>i});var e=n(748),t=n(9430),r=JSON.parse('{"type":"element","name":"svg","attributes":{"xmlns":"http://www.w3.org/2000/svg","viewBox":"0 0 1024 1303.273","style":"width: 1em; height: 1em; vertical-align: middle;fill: currentColor;overflow: hidden;"},"elements":[{"type":"element","name":"path","attributes":{"d":"M664.4363636363637 0C676.8000000000001 0 688.5818181818182 4.945454545454545 697.3090909090909 13.672727272727274L697.3090909090909 13.672727272727274 1010.3272727272728 326.6909090909091C1019.0545454545455 335.41818181818184 1024 347.3454545454546 1024 359.70909090909095L1024 359.70909090909095 1024 1256.7272727272727C1024 1282.4727272727273 1003.2 1303.2727272727273 977.4545454545455 1303.2727272727273L977.4545454545455 1303.2727272727273 46.54545454545455 1303.2727272727273C20.8 1303.2727272727273 0 1282.4727272727273 0 1256.7272727272727L0 1256.7272727272727 0 46.54545454545455C0 20.8 20.8 0 46.54545454545455 0L46.54545454545455 0ZM637.6727272727272 744.7272727272727L474.76363636363635 954.1818181818182 358.40000000000003 814.5454545454546 195.4909090909091 1024 847.1272727272727 1024 637.6727272727272 744.7272727272727ZM465.4545454545455 558.5454545454545C414.041856 558.5454545454545 372.3636363636364 600.2236741818182 372.3636363636364 651.6363636363636 372.3636363636364 703.0490530909091 414.041856 744.7272727272727 465.4545454545455 744.7272727272727 516.8672349090909 744.7272727272727 558.5454545454545 703.0490530909091 558.5454545454545 651.6363636363636 558.5454545454545 600.2236741818182 516.8672349090909 558.5454545454545 465.4545454545455 558.5454545454545ZM642.9090909090909 107.34545454545454L642.9090909090909 381.0909090909091 916.6545454545455 381.0909090909091 642.9090909090909 107.34545454545454Z"}}]}'),a=function(n,o){var a=Object.assign(Object.assign({},n),o.attrs);return(0,e.createVNode)(t.Z,(0,e.mergeProps)(a,{data:r,name:"imageFill"}),null)};a.displayName="imageFill",a.inheritAttrs=!1;const i=a})(),o})()));