bkui-vue 0.0.1-beta.453 → 0.0.1-beta.455
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 +33 -33
- package/dist/index.esm.js +47 -29
- package/dist/index.umd.js +33 -33
- package/lib/cascader/cascader-panel.d.ts +1 -0
- package/lib/cascader/cascader.d.ts +1 -0
- package/lib/cascader/index.d.ts +4 -0
- package/lib/cascader/index.js +1 -1
- package/lib/cascader/store.d.ts +2 -0
- package/lib/container/index.js +1 -1
- package/lib/container/interface.d.ts +7 -0
- package/lib/search-select/index.js +1 -1
- package/package.json +2 -2
@@ -52,6 +52,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
52
52
|
searchPanelEvents: (node: INode) => {
|
53
53
|
onClick: (e: Event) => void;
|
54
54
|
};
|
55
|
+
expandByNodeList: (value: Array<number | string | string[]>) => void;
|
55
56
|
noDataText: string;
|
56
57
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
57
58
|
width: import("vue-types").VueTypeDef<string | number> & {
|
@@ -178,6 +178,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
178
178
|
getFlattedNodes: (leafOnly?: boolean) => any;
|
179
179
|
setNodesCheck: (nodes: string[][]) => void;
|
180
180
|
getCheckedNodes: () => any;
|
181
|
+
getCheckedLeafNodes: () => any;
|
181
182
|
getNodeByValue: (value: (string | number | string[])[]) => INode;
|
182
183
|
getNodeById: (id: string | number) => INode;
|
183
184
|
appendNode: (nodeData: import("./interface").IData, parentNode: import("./interface").IData) => void;
|
package/lib/cascader/index.d.ts
CHANGED
@@ -335,6 +335,7 @@ declare const BkCascader: {
|
|
335
335
|
getFlattedNodes: (leafOnly?: boolean) => any;
|
336
336
|
setNodesCheck: (nodes: string[][]) => void;
|
337
337
|
getCheckedNodes: () => any;
|
338
|
+
getCheckedLeafNodes: () => any;
|
338
339
|
getNodeByValue: (value: (string | number | string[])[]) => import("./interface").INode;
|
339
340
|
getNodeById: (id: string | number) => import("./interface").INode;
|
340
341
|
appendNode: (nodeData: import("./interface").IData, parentNode: import("./interface").IData) => void;
|
@@ -590,6 +591,7 @@ declare const BkCascader: {
|
|
590
591
|
getFlattedNodes: (leafOnly?: boolean) => any;
|
591
592
|
setNodesCheck: (nodes: string[][]) => void;
|
592
593
|
getCheckedNodes: () => any;
|
594
|
+
getCheckedLeafNodes: () => any;
|
593
595
|
getNodeByValue: (value: (string | number | string[])[]) => import("./interface").INode;
|
594
596
|
getNodeById: (id: string | number) => import("./interface").INode;
|
595
597
|
appendNode: (nodeData: import("./interface").IData, parentNode: import("./interface").IData) => void;
|
@@ -806,6 +808,7 @@ declare const BkCascader: {
|
|
806
808
|
getFlattedNodes: (leafOnly?: boolean) => any;
|
807
809
|
setNodesCheck: (nodes: string[][]) => void;
|
808
810
|
getCheckedNodes: () => any;
|
811
|
+
getCheckedLeafNodes: () => any;
|
809
812
|
getNodeByValue: (value: (string | number | string[])[]) => import("./interface").INode;
|
810
813
|
getNodeById: (id: string | number) => import("./interface").INode;
|
811
814
|
appendNode: (nodeData: import("./interface").IData, parentNode: import("./interface").IData) => void;
|
@@ -910,6 +913,7 @@ declare const BkCascader: {
|
|
910
913
|
searchPanelEvents: (node: import("./interface").INode) => {
|
911
914
|
onClick: (e: Event) => void;
|
912
915
|
};
|
916
|
+
expandByNodeList: (value: (string | number | string[])[]) => void;
|
913
917
|
noDataText: string;
|
914
918
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
915
919
|
width: import("vue-types").VueTypeDef<string | number> & {
|
package/lib/cascader/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("vue-types"),require("../config-provider"),require("../directives"),require("../icon"),require("../popover"),require("../tag"),require("../checkbox"));else if("function"==typeof define&&define.amd)define(["../shared","vue","vue-types","../config-provider","../directives","../icon","../popover","../tag","../checkbox"],t);else{var r="object"==typeof exports?t(require("../shared"),require("vue"),require("vue-types"),require("../config-provider"),require("../directives"),require("../icon"),require("../popover"),require("../tag"),require("../checkbox")):t(e["../shared"],e.vue,e["vue-types"],e["../config-provider"],e["../directives"],e["../icon"],e["../popover"],e["../tag"],e["../checkbox"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,((e,t,r,n,o,a,i,s,l)=>(()=>{var c={7162:(e,t,r)=>{r(5047)},5047:e=>{var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),i=new L(n||[]);return a._invoke=function(e,t,r){var n=d;return function(o,a){if(n===p)throw new Error("Generator is already running");if(n===f){if("throw"===o)throw a;return O()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var s=P(i,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===d)throw n=f,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var l=u(e,t,r);if("normal"===l.type){if(n=r.done?f:h,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n=f,r.method="throw",r.arg=l.arg)}}}(e,r,i),a}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d="suspendedStart",h="suspendedYield",p="executing",f="completed",v={};function g(){}function y(){}function m(){}var b={};l(b,a,(function(){return this}));var N=Object.getPrototypeOf,k=N&&N(N(E([])));k&&k!==r&&n.call(k,a)&&(b=k);var T=m.prototype=g.prototype=Object.create(b);function w(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(o,a,i,s){var l=u(e[o],e,a);if("throw"!==l.type){var c=l.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(d).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,s)}))}s(l.arg)}var o;this._invoke=function(e,n){function a(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(a,a):a()}}function P(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=u(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function V(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function E(e){if(e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}return{next:O}}function O(){return{value:t,done:!0}}return y.prototype=m,l(T,"constructor",m),l(m,"constructor",y),y.displayName=l(m,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,l(e,s,"GeneratorFunction")),e.prototype=Object.create(T),e},e.awrap=function(e){return{__await:e}},w(x.prototype),l(x.prototype,i,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new x(c(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},w(T),l(T,s,"Generator"),l(T,a,(function(){return this})),l(T,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=E,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(V),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,v):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),V(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;V(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:E(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}},5800:e=>{"use strict";e.exports=l},2717:e=>{"use strict";e.exports=n},4061:e=>{"use strict";e.exports=o},6870:e=>{"use strict";e.exports=a},5537:e=>{"use strict";e.exports=i},4212:t=>{"use strict";t.exports=e},7739:e=>{"use strict";e.exports=s},748:e=>{"use strict";e.exports=t},210:e=>{"use strict";e.exports=r}},u={};function d(e){var t=u[e];if(void 0!==t)return t.exports;var r=u[e]={exports:{}};return c[e](r,r.exports,d),r.exports}d.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return d.d(t,{a:t}),t},d.d=(e,t)=>{for(var r in t)d.o(t,r)&&!d.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var h={};return(()=>{"use strict";d.r(h),d.d(h,{BkCascader:()=>w,BkCascaderPanel:()=>f,default:()=>x});var e=d(4212),t=d(748),r=d(210),n=d(2717),o=d(4061),a=d(6870),i=d(5537),s=d.n(i),l=d(7739),c=d.n(l);d(7162),Symbol("BkSelect"),Symbol("BkOptionGroup");var u=d(5800),p=d.n(u);const f=(0,t.defineComponent)({name:"CascaderPanel",props:{width:e.PropTypes.oneOfType([e.PropTypes.number,e.PropTypes.string]).def("auto"),height:e.PropTypes.oneOfType([e.PropTypes.number,e.PropTypes.string]).def(216),store:e.PropTypes.object.def({}),separator:e.PropTypes.string.def(""),suggestions:e.PropTypes.arrayOf((0,r.object)()),isFiltering:e.PropTypes.bool.def(!1),searchKey:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.number]).def(""),modelValue:e.PropTypes.arrayOf(e.PropTypes.oneOfType([(0,r.array)(),String,Number]))},emits:["update:modelValue"],setup:function(r,o){var i=o.emit,s=(0,n.useLocale)("select"),l=r.store,c=(0,t.reactive)({list:[r.store.getNodes()]}),u=(0,t.ref)([]),d=(0,t.ref)([]),h=function(e){return"number"==typeof e?"".concat(e,"px"):e},p=h(r.height),f=h(r.width),v=function(e){e.isDisabled||(e.config.multiple?d.value=l.getCheckedNodes().map((function(e){return e.path})):d.value=e.path,i("update:modelValue",d.value))},g=function(e){var t;if(e&&!(null==e?void 0:e.isDisabled)){if(c.list=c.list.slice(0,e.level),u.value=u.value.slice(0,e.level-1),null===(t=e.children)||void 0===t?void 0:t.length)return c.list.push(e.children),void u.value.push(e);l.config.isRemote&&!e.isLeaf&&(e.loading=!0,l.config.remoteMethod(e,(function(t){l.appendNodes(t,e||null),c.list.push(e.children),u.value.push(e),e.loading=!1})))}},y=s.value.noData,m=function(e,t){e.setNodeCheck(t||!1),v(e)};return(0,t.watch)((function(){return r.modelValue}),(function(e){!function(e){0===e.length&&(c.list=c.list.slice(0,1),u.value=[]),e.forEach((function(e){var t=l.getNodeById(e);g(t)})),d.value=e}(e)}),{immediate:!0}),(0,t.watch)((function(){return r.store}),(function(e){c.list=[e.getNodes()]})),{menus:c,activePath:u,nodeExpandHandler:g,isNodeInPath:function(e){return(u.value[e.level-1]||{}).id===e.id},nodeEvent:function(e){var t=e.config,r=t.trigger,n=t.checkAnyLevel,o=t.multiple;return{onClick:function(t){e.isLeaf&&!o||t.stopPropagation(),"click"===r&&g(e),n&&!o&&v(e),e.isLeaf&&!o&&v(e)},onMouseenter:function(){"hover"===r&&g(e)}}},isCheckedNode:function(t,r){return t.config.multiple?r.some((function(r){return(0,e.arrayEqual)(r,t.path)})):(0,e.arrayEqual)(r,t.path)},checkValue:d,checkNode:m,iconRender:function(e){return e.loading?(0,t.createVNode)(a.Spinner,{class:"icon-spinner"},null):(0,t.createVNode)(a.AngleRight,{class:"icon-angle-right"},null)},panelWidth:f,panelHeight:p,searchPanelEvents:function(e){var t=e.config.multiple;return{onClick:function(r){if(t)return r.stopPropagation(),void m(e,!e.checked);g(e),e.isLeaf&&!t&&v(e)}}},noDataText:y}},render:function(){var r=this,n=parseInt(this.panelWidth,10)>200?this.panelWidth:"".concat(200,"px");return(0,t.createVNode)("div",{class:(0,e.resolveClassName)("cascader-panel-wrapper")},[this.isFiltering?r.suggestions.length?(0,t.createVNode)("ul",{class:[(0,e.resolveClassName)("cascader-panel"),"bk-scroll-y"],style:{height:r.panelHeight,width:r.panelWidth}},[r.suggestions.map((function(n){return(0,t.createVNode)("li",(0,t.mergeProps)({class:[(0,e.resolveClassName)("cascader-node"),{"is-selected":r.isNodeInPath(n)},{"is-disabled":n.isDisabled},{"is-checked":r.isCheckedNode(n,r.checkValue)}]},r.searchPanelEvents(n)),[n.pathNames.join(r.separator)])}))]):(0,t.createVNode)("div",{class:(0,e.resolveClassName)("cascader-search-empty"),style:{width:n}},[(0,t.createVNode)("span",null,[(0,t.createTextVNode)("暂无搜索结果")])]):this.menus.list.map((function(n){return(0,t.createVNode)("ul",{class:[(0,e.resolveClassName)("cascader-panel"),"bk-scroll-y"],style:{height:r.panelHeight,width:r.panelWidth}},[n.length?n.map((function(n){var o,a;return(0,t.createVNode)("li",(0,t.mergeProps)({class:[(0,e.resolveClassName)("cascader-node"),{"is-selected":r.isNodeInPath(n)},{"is-disabled":n.isDisabled},{"is-checked":!n.config.multiple&&r.isCheckedNode(n,r.checkValue)}]},Object.assign(r.nodeEvent(n),(n.config.multiple,{}))),[n.config.multiple&&(0,t.createVNode)(p(),{disabled:n.isDisabled,modelValue:n.checked,"onUpdate:modelValue":function(e){return n.checked=e},indeterminate:n.isIndeterminate,style:"margin-right: 5px",onChange:function(e){return r.checkNode(n,e)}},null),null===(a=(o=r.$slots).default)||void 0===a?void 0:a.call(o,{node:n,data:n.data}),n.isLeaf?"":r.iconRender(n)])})):(0,t.createVNode)("div",{class:(0,e.resolveClassName)("cascader-panel-empty-wrapper")},[r.noDataText])])}))])}});function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function y(e,t,r){return t&&g(e.prototype,t),r&&g(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function m(e){return!!e.data.disabled||(1!==e.level?m(e.parent):e.data.disabled)}const b=function(){function t(e,r,n){v(this,t),this.data=e,this.config=r,this.parent=n||null,this.leaf=e.leaf,this.level=this.parent?this.parent.level+1:1,this.initState()}return y(t,[{key:"initState",value:function(){var e=this,r=this.config,n=r.idKey,o=r.nameKey,a=r.childrenKey;this.id=this.data[n],this.name=this.data[o],this.loading=!1,this.loaded=!1,this.checked=!1;var i=this.data[a];this.children=(i||[]).map((function(r){return new t(r,e.config,e)})),this.pathNodes=this.calculateNodesPath(),this.path=this.pathNodes.map((function(e){return e.id})),this.pathNames=this.pathNodes.map((function(e){return e.name}))}},{key:"isLeaf",get:function(){var e;return this.config.isRemote?this.leaf||!!this.loaded&&!this.children.length:!(Array.isArray(this.children)&&0!==(null===(e=this.children)||void 0===e?void 0:e.length))}},{key:"isDisabled",get:function(){return m(this)}},{key:"broadcast",value:function(t,r){var n="onParent".concat((0,e.capitalize)(t));this.children.forEach((function(e){var o;e&&(e.broadcast(t,r),null===(o=e[n])||void 0===o||o.call(e,r))}))}},{key:"emit",value:function(t){var r,n=this.parent,o="onChild".concat((0,e.capitalize)(t));n&&(null===(r=n[o])||void 0===r||r.call(n),n.emit(t))}},{key:"onParentCheck",value:function(e){this.isDisabled||this.setCheckState(e)}},{key:"onChildCheck",value:function(){var e=this.children.filter((function(e){return!e.isDisabled})),t=!!e.length&&e.every((function(e){return e.checked}));this.setCheckState(t)}},{key:"setCheckState",value:function(e){var t=this.children.length,r=this.children.reduce((function(e,t){var r=t.isIndeterminate?.5:0;return e+(t.checked?1:r)}),0);this.checked=e,this.isIndeterminate=r!==t&&r>0}},{key:"setNodeCheck",value:function(e){if(this.checked!==e){if(this.config.checkAnyLevel)return void(this.checked=e);this.broadcast("check",e),this.setCheckState(e),this.emit("check")}}},{key:"calculateNodesPath",value:function(){for(var e=[this],t=this.parent;t;)e.unshift(t),t=t.parent;return e}}]),t}();var N=function e(t,r){return t.reduce((function(t,n){return n.isLeaf?t.push(n):(!r&&t.push(n),t=t.concat(e(n.children,r))),t}),[])};const k=function(){function t(e){var r=this;v(this,t);var n=e.list;this.data=n,this.config=e,this.nodes=this.data.map((function(e){return new b(e,r.config)}))}return y(t,[{key:"getNodes",value:function(){return this.nodes}},{key:"clearChecked",value:function(){this.getFlattedNodes().forEach((function(e){e.checked=!1,e.isIndeterminate=!1}))}},{key:"removeTag",value:function(t){this.getFlattedNodes().find((function(r){return!!(0,e.arrayEqual)(t,r.path)&&(r.checked=!1,!0)}))}},{key:"getFlattedNodes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return N(this.nodes,e)}},{key:"setNodesCheck",value:function(t){var r=this;this.getFlattedNodes().forEach((function(n){n.checked=!1;var o=t.find((function(t){return(0,e.arrayEqual)(n.path,t)}));o&&(r.getNodeByValue(o).checked=!0)}))}},{key:"getCheckedNodes",value:function(){return this.getFlattedNodes().filter((function(e){return e.checked}))}},{key:"getNodeByValue",value:function(t){var r;return null!==(r=this.getFlattedNodes().filter((function(r){return(0,e.arrayEqual)(r.path,t)}))[0])&&void 0!==r?r:null}},{key:"getNodeById",value:function(e){return this.getFlattedNodes().find((function(t){return t.id===e}))}},{key:"appendNode",value:function(e,t){var r=new b(e,this.config,t);(t?t.children:this.nodes).push(r)}},{key:"appendNodes",value:function(e,t){var r=this;e.forEach((function(e){return r.appendNode(e,t)}))}}]),t}(),T=(0,t.defineComponent)({name:"Cascader",directives:{bkTooltips:o.bkTooltips},components:{CascaderPanel:f,BkPopover:s(),Tag:c()},props:{modelValue:e.PropTypes.arrayOf(e.PropTypes.oneOfType([(0,r.array)(),String,Number])),list:e.PropTypes.array.def([]),placeholder:e.PropTypes.string.def(""),behavior:e.PropTypes.string.def("normal"),filterable:e.PropTypes.bool.def(!1),multiple:e.PropTypes.bool.def(!1),disabled:e.PropTypes.bool.def(!1),clearable:e.PropTypes.bool.def(!0),trigger:e.PropTypes.string.def("click"),checkAnyLevel:e.PropTypes.bool.def(!1),isRemote:e.PropTypes.bool.def(!1),remoteMethod:e.PropTypes.func,showCompleteName:e.PropTypes.bool.def(!0),idKey:e.PropTypes.string.def("id"),nameKey:e.PropTypes.string.def("name"),childrenKey:e.PropTypes.string.def("children"),separator:e.PropTypes.string.def("/"),limitOneLine:e.PropTypes.bool.def(!1),extCls:e.PropTypes.string.def(""),scrollHeight:e.PropTypes.oneOfType([e.PropTypes.number,e.PropTypes.string]).def(216),scrollWidth:e.PropTypes.oneOfType([e.PropTypes.number,e.PropTypes.string]).def("auto"),collapseTags:{type:Boolean,default:!0},floatMode:{type:Boolean,default:!1}},emits:["update:modelValue","change","clear","toggle","focus"],setup:function(r,o){var a=o.emit,i=(0,n.useLocale)("select"),s=r.separator,l=r.multiple,c=function(){var e=(0,t.ref)(!1);return{isHover:e,setHover:function(){e.value=!0},cancelHover:function(){e.value=!1}}}(),u=c.isHover,d=c.setHover,h=c.cancelHover,p=(0,t.ref)(new k(r)),f=(0,t.ref)(""),v=(0,t.ref)([]),g=(0,t.toRefs)(r).modelValue,y=(0,t.ref)(),m=(0,t.ref)(""),b=(0,t.ref)([]),N=(0,t.ref)(!1),T=(0,t.ref)(!1),w=(0,t.ref)(!1),x=(0,t.computed)({get:function(){return g.value},set:function(e){a("update:modelValue",e)}}),P=(0,t.ref)(null),C=(0,t.ref)(null),V=(0,t.ref)(null),L=(0,t.computed)((function(){return r.placeholder?r.placeholder:i.value.pleaseSelect})),E=function(e){return r.showCompleteName?e.pathNames.join(s):e.pathNames[e.pathNames.length-1]},O=function(e){var t;if(l)return p.value.setNodesCheck(e),v.value=p.value.getCheckedNodes().map((function(e){return{text:E(e),key:e.id}})),void(f.value=v.value.map((function(e){return e.text})).join(", "));if(!r.checkAnyLevel&&(null===(t=null==P?void 0:P.value)||void 0===t||t.hide()),0===e.length)f.value="";else{var n=p.value.getNodeByValue(e);if(!n)return;f.value=E(n)}m.value=f.value},S=(0,e.debounce)(200,(function(e){var t=e.target;if(m.value=t.value,""!==m.value){N.value=!0;var n=p.value.getFlattedNodes().filter((function(e){return(r.checkAnyLevel||e.isLeaf)&&e.pathNames.join(r.separator).includes(m.value)}));b.value=n,!(null==P?void 0:P.value.isShow)&&(null==P||P.value.show())}else N.value=!1})),j=function(){a("focus")};(0,t.watch)((function(){return r.modelValue}),(function(e,t){var r;O(e),a("update:modelValue",e),void 0!==t&&a("change",e),null===(r=null==V?void 0:V.value)||void 0===r||r.focus()}),{immediate:!0}),(0,t.watch)((function(){return r.list}),(function(){p.value=new k(r),O(r.modelValue)}),{deep:!0,immediate:!0});var I=(0,t.computed)((function(){return v.value.map((function(e){return e.text}))})),q=(0,t.computed)((function(){return r.collapseTags?r.collapseTags&&w.value:r.collapseTags})),H=function(e,r,n){(0,t.watch)([n,r],(function(){a()}),{flush:"post"});var o=(0,t.ref)(null),a=function(){r.value&&(o.value=null,setTimeout((function(){var t=Array.from(e.value.querySelectorAll(".tag-item")),r=t.findIndex((function(e,r){return!!r&&t[r-1].offsetTop!==e.offsetTop}));o.value=r>0?r-1:null})))};return{overflowTagIndex:o}}(C,(0,t.computed)((function(){return r.collapseTags?r.collapseTags&&T.value:r.collapseTags})),I),F=H.overflowTagIndex;return{calcuPlaceholder:L,bkCascaderRef:C,inputRef:V,overflowTagIndex:F,isCollapse:q,isFocus:w,store:p,updateValue:O,selectedText:f,checkedValue:x,handleClear:function(e){e.stopPropagation(),p.value.clearChecked(),m.value="",O([]),a("update:modelValue",[]),a("clear",JSON.parse(JSON.stringify(r.modelValue)))},isHover:u,setHover:d,popover:P,cancelHover:h,selectedTags:v,removeTag:function(e,t,r){r.stopPropagation();var n=JSON.parse(JSON.stringify(e)),o=n.splice(t,1)[0];T.value=!0,p.value.removeTag(o),O(n),a("update:modelValue",p.value.getCheckedNodes().map((function(e){return e.path}))),setTimeout((function(){T.value=w.value}))},cascaderPanel:y,popoverChangeEmitter:function(e){a("toggle",e.isShow),T.value=e.isShow,w.value=e.isShow,(0,t.nextTick)((function(){var t;e&&(null===(t=V.value)||void 0===t||t.focus())})),e.isShow&&j(),e.isShow||(N.value=!1)},searchKey:m,suggestions:b,isFiltering:N,searchInputHandler:S,focusEmitter:j,tagList:I,isEdit:T}},render:function(){var r=this;this.overflowTagIndex=0===this.overflowTagIndex?1:this.overflowTagIndex;var n=this.tagList.reduce((function(e,t,n){return null!==r.overflowTagIndex&&n>=r.overflowTagIndex&&e.push(t),e}),[]),o=function(){return(0,t.createVNode)(s(),{placement:"bottom-start",theme:"light ".concat((0,e.resolveClassName)("cascader-popover")),trigger:"click",arrow:!1,disabled:r.disabled,class:(0,e.resolveClassName)("cascader-popover-wrapper"),ref:"popover",onAfterHidden:r.popoverChangeEmitter,onAfterShow:r.popoverChangeEmitter,boundary:"body"},{default:function(){return r.$slots.trigger?r.$slots.trigger({selected:r.modelValue}):(0,t.createVNode)("div",{class:[(0,e.resolveClassName)("cascader-name"),"bk-scroll-y"]},[r.multiple&&r.selectedTags.length>0&&(r.limitOneLine?(0,t.createVNode)("span",{class:"cascader-selected-text"},[r.selectedText]):(0,t.createVNode)("div",{class:"cascader-tag-list"},[r.tagList.map((function(n,o){var i=!r.isCollapse&&null!==r.overflowTagIndex&&o>=r.overflowTagIndex;return(0,t.createVNode)("span",{class:"tag-item",style:{display:i?"none":""},key:n},[(0,t.createVNode)("span",{class:"tag-item-name"},[n]),(0,t.createVNode)(a.Error,{class:(0,e.resolveClassName)("icon-clear-icon"),onClick:function(e){e.stopPropagation(),r.removeTag(r.modelValue,o,e)}},null)])})),null!==r.overflowTagIndex&&!r.isCollapse&&(0,t.withDirectives)((0,t.createVNode)(c(),{style:"margin-top: 0"},{default:function(){return[(0,t.createTextVNode)("+"),r.selectedTags.length-r.overflowTagIndex]}}),[[(0,t.resolveDirective)("bk-tooltips"),n.join(", ")]])])),r.filterable?(r.isCollapse||0===r.selectedTags.length)&&(0,t.createVNode)("input",{class:[(0,e.resolveClassName)("cascader-search-input"),{"is-disabled":r.disabled}],type:"text",onInput:r.searchInputHandler,placeholder:r.calcuPlaceholder,value:r.searchKey,disabled:r.disabled,ref:"inputRef"},null):r.multiple?null:(0,t.createVNode)("span",null,[r.selectedText])])},content:function(){return(0,t.createVNode)("div",{class:(0,e.resolveClassName)("cascader-popover")},[(0,t.createVNode)(f,{store:r.store,ref:"cascaderPanel",width:r.scrollWidth,height:r.scrollHeight,"search-key":r.searchKey,separator:r.separator,"is-filtering":r.isFiltering,suggestions:r.suggestions,modelValue:r.checkedValue,"onUpdate:modelValue":function(e){return r.checkedValue=e}},{default:function(n){return r.$slots.default?r.$slots.default(n):(0,t.createVNode)("span",{class:(0,e.resolveClassName)("cascader-node-name")},[n.node.name])}})])}})};return(0,t.createVNode)("div",{class:[(0,e.resolveClassName)("cascader-wrapper"),this.floatMode?"float-mode":""]},[this.$slots.trigger?o():(0,t.createVNode)("div",{class:[(0,e.resolveClassName)("cascader"),this.extCls,{"is-unselected":0===this.modelValue.length,"is-hover":this.isHover,"is-filterable":this.filterable,"is-focus":this.isFocus,"is-disabled":this.disabled,"is-simplicity":"simplicity"===this.behavior}],tabindex:"0","data-placeholder":this.calcuPlaceholder,onMouseenter:this.setHover,onMouseleave:this.cancelHover,ref:"bkCascaderRef"},[r.clearable&&r.isHover&&!r.disabled?(0,t.createVNode)(a.Close,{class:(0,e.resolveClassName)("icon-clear-icon"),onClick:r.handleClear},null):(0,t.createVNode)(a.AngleUp,{class:(0,e.resolveClassName)("icon-angle-up")},null),o()])])}});var w=(0,e.withInstallProps)(T,{CascaderPanel:f});const x=w})(),h})()));
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("vue-types"),require("../config-provider"),require("../directives"),require("../icon"),require("../popover"),require("../tag"),require("../checkbox"));else if("function"==typeof define&&define.amd)define(["../shared","vue","vue-types","../config-provider","../directives","../icon","../popover","../tag","../checkbox"],t);else{var r="object"==typeof exports?t(require("../shared"),require("vue"),require("vue-types"),require("../config-provider"),require("../directives"),require("../icon"),require("../popover"),require("../tag"),require("../checkbox")):t(e["../shared"],e.vue,e["vue-types"],e["../config-provider"],e["../directives"],e["../icon"],e["../popover"],e["../tag"],e["../checkbox"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,((e,t,r,n,o,a,i,s,l)=>(()=>{var c={7162:(e,t,r)=>{r(5047)},5047:e=>{var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),i=new L(n||[]);return a._invoke=function(e,t,r){var n=d;return function(o,a){if(n===h)throw new Error("Generator is already running");if(n===p){if("throw"===o)throw a;return S()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var s=P(i,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===d)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var l=u(e,t,r);if("normal"===l.type){if(n=r.done?p:f,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n=p,r.method="throw",r.arg=l.arg)}}}(e,r,i),a}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d="suspendedStart",f="suspendedYield",h="executing",p="completed",v={};function g(){}function y(){}function m(){}var b={};l(b,a,(function(){return this}));var N=Object.getPrototypeOf,k=N&&N(N(E([])));k&&k!==r&&n.call(k,a)&&(b=k);var T=m.prototype=g.prototype=Object.create(b);function w(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(o,a,i,s){var l=u(e[o],e,a);if("throw"!==l.type){var c=l.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(d).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,s)}))}s(l.arg)}var o;this._invoke=function(e,n){function a(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(a,a):a()}}function P(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=u(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function V(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function E(e){if(e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}return{next:S}}function S(){return{value:t,done:!0}}return y.prototype=m,l(T,"constructor",m),l(m,"constructor",y),y.displayName=l(m,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,l(e,s,"GeneratorFunction")),e.prototype=Object.create(T),e},e.awrap=function(e){return{__await:e}},w(x.prototype),l(x.prototype,i,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new x(c(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},w(T),l(T,s,"Generator"),l(T,a,(function(){return this})),l(T,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=E,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(V),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,v):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),V(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;V(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:E(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}},5800:e=>{"use strict";e.exports=l},2717:e=>{"use strict";e.exports=n},4061:e=>{"use strict";e.exports=o},6870:e=>{"use strict";e.exports=a},5537:e=>{"use strict";e.exports=i},4212:t=>{"use strict";t.exports=e},7739:e=>{"use strict";e.exports=s},748:e=>{"use strict";e.exports=t},210:e=>{"use strict";e.exports=r}},u={};function d(e){var t=u[e];if(void 0!==t)return t.exports;var r=u[e]={exports:{}};return c[e](r,r.exports,d),r.exports}d.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return d.d(t,{a:t}),t},d.d=(e,t)=>{for(var r in t)d.o(t,r)&&!d.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var f={};return(()=>{"use strict";d.r(f),d.d(f,{BkCascader:()=>x,BkCascaderPanel:()=>v,default:()=>P});var e=d(4212),t=d(748),r=d(210),n=d(2717),o=d(4061),a=d(6870),i=d(5537),s=d.n(i),l=d(7739),c=d.n(l);d(7162),Symbol("BkSelect"),Symbol("BkOptionGroup");var u=d(5800),h=d.n(u);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}const v=(0,t.defineComponent)({name:"CascaderPanel",props:{width:e.PropTypes.oneOfType([e.PropTypes.number,e.PropTypes.string]).def("auto"),height:e.PropTypes.oneOfType([e.PropTypes.number,e.PropTypes.string]).def(216),store:e.PropTypes.object.def({}),separator:e.PropTypes.string.def(""),suggestions:e.PropTypes.arrayOf((0,r.object)()),isFiltering:e.PropTypes.bool.def(!1),searchKey:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.number]).def(""),modelValue:e.PropTypes.arrayOf(e.PropTypes.oneOfType([(0,r.array)(),String,Number]))},emits:["update:modelValue"],setup:function(r,o){var i=o.emit,s=(0,n.useLocale)("select"),l=r.store,c=(0,t.reactive)({list:[r.store.getNodes()]}),u=(0,t.ref)([]),d=(0,t.ref)([]),f=function(e){return"number"==typeof e?"".concat(e,"px"):e},h=f(r.height),v=f(r.width),g=function(e){var t=[];if(l.config.multiple){var r,n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return p(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw a}}}}(e);try{for(n.s();!(r=n.n()).done;){var o=r.value;o.length>t.length&&(t=o)}}catch(e){n.e(e)}finally{n.f()}}else t=e;t.forEach((function(e){var t=l.getNodeById(e);m(t)}))},y=function(e){if(!e.isDisabled){if(e.config.multiple){var t=l.config.checkAnyLevel?l.getCheckedNodes():l.getCheckedLeafNodes();d.value=t.map((function(e){return e.path}))}else d.value=e.path;i("update:modelValue",d.value)}},m=function(e){var t;if(e&&!(null==e?void 0:e.isDisabled)){if(c.list=c.list.slice(0,e.level),u.value=u.value.slice(0,e.level-1),null===(t=e.children)||void 0===t?void 0:t.length)return c.list.push(e.children),void u.value.push(e);l.config.isRemote&&!e.isLeaf&&(e.loading=!0,l.config.remoteMethod(e,(function(t){l.appendNodes(t,e||null),c.list.push(e.children),u.value.push(e),e.loading=!1})))}},b=s.value.noData,N=function(e,t){e.setNodeCheck(t||!1),y(e)};return(0,t.watch)((function(){return r.modelValue}),(function(e){!function(e){0===e.length&&(c.list=c.list.slice(0,1),u.value=[]),g(e),d.value=e}(e)}),{immediate:!0}),(0,t.watch)((function(){return r.store}),(function(e){c.list=[e.getNodes()]})),{menus:c,activePath:u,nodeExpandHandler:m,isNodeInPath:function(e){return(u.value[e.level-1]||{}).id===e.id},nodeEvent:function(e){var t=e.config,r=t.trigger,n=t.checkAnyLevel,o=t.multiple;return{onClick:function(t){e.isLeaf&&!o||t.stopPropagation(),"click"===r&&m(e),n&&!o&&y(e),e.isLeaf&&!o&&y(e)},onMouseenter:function(){"hover"===r&&m(e)}}},isCheckedNode:function(t,r){return t.config.multiple?r.some((function(r){return(0,e.arrayEqual)(r,t.path)})):(0,e.arrayEqual)(r,t.path)},checkValue:d,checkNode:N,iconRender:function(e){return e.loading?(0,t.createVNode)(a.Spinner,{class:"icon-spinner"},null):(0,t.createVNode)(a.AngleRight,{class:"icon-angle-right"},null)},panelWidth:v,panelHeight:h,searchPanelEvents:function(e){var t=e.config.multiple;return{onClick:function(r){if(t)return r.stopPropagation(),void N(e,!e.checked);m(e),e.isLeaf&&!t&&y(e)}}},expandByNodeList:g,noDataText:b}},render:function(){var r=this,n=parseInt(this.panelWidth,10)>200?this.panelWidth:"".concat(200,"px");return(0,t.createVNode)("div",{class:(0,e.resolveClassName)("cascader-panel-wrapper")},[this.isFiltering?r.suggestions.length?(0,t.createVNode)("ul",{class:[(0,e.resolveClassName)("cascader-panel"),"bk-scroll-y"],style:{height:r.panelHeight,width:r.panelWidth}},[r.suggestions.map((function(n){return(0,t.createVNode)("li",(0,t.mergeProps)({class:[(0,e.resolveClassName)("cascader-node"),{"is-selected":r.isNodeInPath(n)},{"is-disabled":n.isDisabled},{"is-checked":r.isCheckedNode(n,r.checkValue)}]},r.searchPanelEvents(n)),[n.pathNames.join(r.separator)])}))]):(0,t.createVNode)("div",{class:(0,e.resolveClassName)("cascader-search-empty"),style:{width:n}},[(0,t.createVNode)("span",null,[(0,t.createTextVNode)("暂无搜索结果")])]):this.menus.list.map((function(n){return(0,t.createVNode)("ul",{class:[(0,e.resolveClassName)("cascader-panel"),"bk-scroll-y"],style:{height:r.panelHeight,width:r.panelWidth}},[n.length?n.map((function(n){var o,a;return(0,t.createVNode)("li",(0,t.mergeProps)({class:[(0,e.resolveClassName)("cascader-node"),{"is-selected":r.isNodeInPath(n)},{"is-disabled":n.isDisabled},{"is-checked":!n.config.multiple&&r.isCheckedNode(n,r.checkValue)}]},Object.assign(r.nodeEvent(n),(n.config.multiple,{}))),[n.config.multiple&&(0,t.createVNode)(h(),{disabled:n.isDisabled,modelValue:n.checked,"onUpdate:modelValue":function(e){return n.checked=e},indeterminate:n.isIndeterminate,style:"margin-right: 5px",onChange:function(e){return r.checkNode(n,e)}},null),null===(a=(o=r.$slots).default)||void 0===a?void 0:a.call(o,{node:n,data:n.data}),n.isLeaf?"":r.iconRender(n)])})):(0,t.createVNode)("div",{class:(0,e.resolveClassName)("cascader-panel-empty-wrapper")},[r.noDataText])])}))])}});function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function m(e,t,r){return t&&y(e.prototype,t),r&&y(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function b(e){return!!e.data.disabled||(1!==e.level?b(e.parent):e.data.disabled)}const N=function(){function t(e,r,n){g(this,t),this.data=e,this.config=r,this.parent=n||null,this.leaf=e.leaf,this.level=this.parent?this.parent.level+1:1,this.initState()}return m(t,[{key:"initState",value:function(){var e=this,r=this.config,n=r.idKey,o=r.nameKey,a=r.childrenKey;this.id=this.data[n],this.name=this.data[o],this.loading=!1,this.loaded=!1,this.checked=!1;var i=this.data[a];this.children=(i||[]).map((function(r){return new t(r,e.config,e)})),this.pathNodes=this.calculateNodesPath(),this.path=this.pathNodes.map((function(e){return e.id})),this.pathNames=this.pathNodes.map((function(e){return e.name}))}},{key:"isLeaf",get:function(){var e;return this.config.isRemote?this.leaf||!!this.loaded&&!this.children.length:!(Array.isArray(this.children)&&0!==(null===(e=this.children)||void 0===e?void 0:e.length))}},{key:"isDisabled",get:function(){return b(this)}},{key:"broadcast",value:function(t,r){var n="onParent".concat((0,e.capitalize)(t));this.children.forEach((function(e){var o;e&&(e.broadcast(t,r),null===(o=e[n])||void 0===o||o.call(e,r))}))}},{key:"emit",value:function(t){var r,n=this.parent,o="onChild".concat((0,e.capitalize)(t));n&&(null===(r=n[o])||void 0===r||r.call(n),n.emit(t))}},{key:"onParentCheck",value:function(e){this.isDisabled||this.setCheckState(e)}},{key:"onChildCheck",value:function(){var e=this.children.filter((function(e){return!e.isDisabled})),t=!!e.length&&e.every((function(e){return e.checked}));this.setCheckState(t)}},{key:"setCheckState",value:function(e){var t=this.children.length,r=this.children.reduce((function(e,t){var r=t.isIndeterminate?.5:0;return e+(t.checked?1:r)}),0);this.checked=e,this.isIndeterminate=r!==t&&r>0}},{key:"setNodeCheck",value:function(e){this.config.checkAnyLevel?this.checked=e:(this.broadcast("check",e),this.setCheckState(e),this.emit("check"))}},{key:"calculateNodesPath",value:function(){for(var e=[this],t=this.parent;t;)e.unshift(t),t=t.parent;return e}}]),t}();var k=function e(t,r){return t.reduce((function(t,n){return n.isLeaf?t.push(n):(!r&&t.push(n),t=t.concat(e(n.children,r))),t}),[])};const T=function(){function t(e){var r=this;g(this,t);var n=e.list;this.data=n,this.config=e,this.nodes=this.data.map((function(e){return new N(e,r.config)}))}return m(t,[{key:"getNodes",value:function(){return this.nodes}},{key:"clearChecked",value:function(){this.getFlattedNodes().forEach((function(e){e.setNodeCheck(!1),e.isIndeterminate=!1}))}},{key:"removeTag",value:function(t){this.getFlattedNodes().find((function(r){return!!(0,e.arrayEqual)(t,r.path)&&(r.setNodeCheck(!1),!0)}))}},{key:"getFlattedNodes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return k(this.nodes,e)}},{key:"setNodesCheck",value:function(t){var r=this;this.getFlattedNodes().forEach((function(n){n.setNodeCheck(!1);var o=t.find((function(t){return(0,e.arrayEqual)(n.path,t)}));o&&r.getNodeByValue(o).setNodeCheck(!0)}))}},{key:"getCheckedNodes",value:function(){return this.getFlattedNodes().filter((function(e){return e.checked}))}},{key:"getCheckedLeafNodes",value:function(){return this.getFlattedNodes().filter((function(e){return e.isLeaf&&e.checked}))}},{key:"getNodeByValue",value:function(t){var r;return null!==(r=this.getFlattedNodes().filter((function(r){return(0,e.arrayEqual)(r.path,t)}))[0])&&void 0!==r?r:null}},{key:"getNodeById",value:function(e){return this.getFlattedNodes().find((function(t){return t.id===e}))}},{key:"appendNode",value:function(e,t){var r=new N(e,this.config,t);(t?t.children:this.nodes).push(r)}},{key:"appendNodes",value:function(e,t){var r=this;e.forEach((function(e){return r.appendNode(e,t)}))}}]),t}(),w=(0,t.defineComponent)({name:"Cascader",directives:{bkTooltips:o.bkTooltips},components:{CascaderPanel:v,BkPopover:s(),Tag:c()},props:{modelValue:e.PropTypes.arrayOf(e.PropTypes.oneOfType([(0,r.array)(),String,Number])),list:e.PropTypes.array.def([]),placeholder:e.PropTypes.string.def(""),behavior:e.PropTypes.string.def("normal"),filterable:e.PropTypes.bool.def(!1),multiple:e.PropTypes.bool.def(!1),disabled:e.PropTypes.bool.def(!1),clearable:e.PropTypes.bool.def(!0),trigger:e.PropTypes.string.def("click"),checkAnyLevel:e.PropTypes.bool.def(!1),isRemote:e.PropTypes.bool.def(!1),remoteMethod:e.PropTypes.func,showCompleteName:e.PropTypes.bool.def(!0),idKey:e.PropTypes.string.def("id"),nameKey:e.PropTypes.string.def("name"),childrenKey:e.PropTypes.string.def("children"),separator:e.PropTypes.string.def("/"),limitOneLine:e.PropTypes.bool.def(!1),extCls:e.PropTypes.string.def(""),scrollHeight:e.PropTypes.oneOfType([e.PropTypes.number,e.PropTypes.string]).def(216),scrollWidth:e.PropTypes.oneOfType([e.PropTypes.number,e.PropTypes.string]).def("auto"),collapseTags:{type:Boolean,default:!0},floatMode:{type:Boolean,default:!1}},emits:["update:modelValue","change","clear","toggle","focus"],setup:function(r,o){var a=o.emit,i=(0,n.useLocale)("select"),s=r.separator,l=r.multiple,c=function(){var e=(0,t.ref)(!1);return{isHover:e,setHover:function(){e.value=!0},cancelHover:function(){e.value=!1}}}(),u=c.isHover,d=c.setHover,f=c.cancelHover,h=(0,t.ref)(new T(r)),p=(0,t.ref)(""),v=(0,t.ref)([]),g=(0,t.toRefs)(r).modelValue,y=(0,t.ref)(),m=(0,t.ref)(""),b=(0,t.ref)([]),N=(0,t.ref)(!1),k=(0,t.ref)(!1),w=(0,t.ref)(!1),x=(0,t.computed)({get:function(){return g.value},set:function(e){a("update:modelValue",e)}}),P=(0,t.ref)(null),C=(0,t.ref)(null),V=(0,t.ref)(null),L=(0,t.computed)((function(){return r.placeholder?r.placeholder:i.value.pleaseSelect})),E=function(e){return r.showCompleteName?e.pathNames.join(s):e.pathNames[e.pathNames.length-1]},S=function(e){var t;if(l)return h.value.setNodesCheck(e),v.value=h.value.getCheckedNodes().filter((function(e){return h.value.config.checkAnyLevel||e.isLeaf})).map((function(e){return{text:E(e),key:e.id}})),void(p.value=v.value.map((function(e){return e.text})).join(", "));r.checkAnyLevel||null===(t=null==P?void 0:P.value)||void 0===t||t.hide();var n=h.value.getNodeByValue(e);p.value=n?E(n):"",m.value=p.value},O=(0,e.debounce)(200,(function(e){var t=e.target;if(m.value=t.value,""!==m.value){N.value=!0;var n=h.value.getFlattedNodes().filter((function(e){return(r.checkAnyLevel||e.isLeaf)&&e.pathNames.join(r.separator).includes(m.value)}));b.value=n,!(null==P?void 0:P.value.isShow)&&(null==P||P.value.show())}else N.value=!1})),j=function(){a("focus")};(0,t.watch)((function(){return r.modelValue}),(function(e,t){var r;S(e),a("update:modelValue",e),void 0!==t&&a("change",e),null===(r=null==V?void 0:V.value)||void 0===r||r.focus()}),{immediate:!0}),(0,t.watch)((function(){return r.list}),(function(){h.value=new T(r),S(r.modelValue)}),{deep:!0,immediate:!0});var I=(0,t.computed)((function(){return v.value.map((function(e){return e.text}))})),q=(0,t.computed)((function(){return r.collapseTags?r.collapseTags&&w.value:r.collapseTags})),A=function(e,r,n){(0,t.watch)([n,r],(function(){a()}),{flush:"post"});var o=(0,t.ref)(null),a=function(){r.value&&(o.value=null,setTimeout((function(){var t=Array.from(e.value.querySelectorAll(".tag-item")),r=t.findIndex((function(e,r){return!!r&&t[r-1].offsetTop!==e.offsetTop}));o.value=r>0?r-1:null})))};return{overflowTagIndex:o}}(C,(0,t.computed)((function(){return r.collapseTags?r.collapseTags&&k.value:r.collapseTags})),I),H=A.overflowTagIndex;return{calcuPlaceholder:L,bkCascaderRef:C,inputRef:V,overflowTagIndex:H,isCollapse:q,isFocus:w,store:h,updateValue:S,selectedText:p,checkedValue:x,handleClear:function(e){e.stopPropagation(),h.value.clearChecked(),m.value="",S([]),a("update:modelValue",[]),a("clear",JSON.parse(JSON.stringify(r.modelValue)))},isHover:u,setHover:d,popover:P,cancelHover:f,selectedTags:v,removeTag:function(e,t,r){r.stopPropagation();var n=JSON.parse(JSON.stringify(e)),o=n.splice(t,1)[0];k.value=!0,h.value.removeTag(o),S(n),a("update:modelValue",h.value.getCheckedNodes().map((function(e){return e.path}))),setTimeout((function(){k.value=w.value}))},cascaderPanel:y,popoverChangeEmitter:function(e){a("toggle",e.isShow),k.value=e.isShow,w.value=e.isShow,(0,t.nextTick)((function(){var t;e&&(null===(t=V.value)||void 0===t||t.focus())})),e.isShow&&j(),e.isShow||(N.value=!1)},searchKey:m,suggestions:b,isFiltering:N,searchInputHandler:O,focusEmitter:j,tagList:I,isEdit:k}},render:function(){var r=this;this.overflowTagIndex=0===this.overflowTagIndex?1:this.overflowTagIndex;var n=this.tagList.reduce((function(e,t,n){return null!==r.overflowTagIndex&&n>=r.overflowTagIndex&&e.push(t),e}),[]),o=function(){return(0,t.createVNode)(s(),{placement:"bottom-start",theme:"light ".concat((0,e.resolveClassName)("cascader-popover")),trigger:"click",arrow:!1,disabled:r.disabled,class:(0,e.resolveClassName)("cascader-popover-wrapper"),ref:"popover",onAfterHidden:r.popoverChangeEmitter,onAfterShow:r.popoverChangeEmitter,boundary:"body"},{default:function(){return r.$slots.trigger?r.$slots.trigger({selected:r.modelValue}):(0,t.createVNode)("div",{class:[(0,e.resolveClassName)("cascader-name"),"bk-scroll-y"]},[r.multiple&&r.selectedTags.length>0&&(r.limitOneLine?(0,t.createVNode)("span",{class:"cascader-selected-text"},[r.selectedText]):(0,t.createVNode)("div",{class:"cascader-tag-list"},[r.tagList.map((function(n,o){var i=!r.isCollapse&&null!==r.overflowTagIndex&&o>=r.overflowTagIndex;return(0,t.createVNode)("span",{class:"tag-item",style:{display:i?"none":""},key:n},[(0,t.createVNode)("span",{class:"tag-item-name"},[n]),(0,t.createVNode)(a.Error,{class:(0,e.resolveClassName)("icon-clear-icon"),onClick:function(e){e.stopPropagation(),r.removeTag(r.modelValue,o,e)}},null)])})),null!==r.overflowTagIndex&&!r.isCollapse&&(0,t.withDirectives)((0,t.createVNode)(c(),{style:"margin-top: 0"},{default:function(){return[(0,t.createTextVNode)("+"),r.selectedTags.length-r.overflowTagIndex]}}),[[(0,t.resolveDirective)("bk-tooltips"),n.join(", ")]])])),r.filterable?(r.isCollapse||0===r.selectedTags.length)&&(0,t.createVNode)("input",{class:[(0,e.resolveClassName)("cascader-search-input"),{"is-disabled":r.disabled}],type:"text",onInput:r.searchInputHandler,placeholder:r.calcuPlaceholder,value:r.searchKey,disabled:r.disabled,ref:"inputRef"},null):r.multiple?null:(0,t.createVNode)("span",null,[r.selectedText])])},content:function(){return(0,t.createVNode)("div",{class:(0,e.resolveClassName)("cascader-popover")},[(0,t.createVNode)(v,{store:r.store,ref:"cascaderPanel",width:r.scrollWidth,height:r.scrollHeight,"search-key":r.searchKey,separator:r.separator,"is-filtering":r.isFiltering,suggestions:r.suggestions,modelValue:r.checkedValue,"onUpdate:modelValue":function(e){return r.checkedValue=e}},{default:function(n){return r.$slots.default?r.$slots.default(n):(0,t.createVNode)("span",{class:(0,e.resolveClassName)("cascader-node-name")},[n.node.name])}})])}})};return(0,t.createVNode)("div",{class:[(0,e.resolveClassName)("cascader-wrapper"),this.floatMode?"float-mode":""]},[this.$slots.trigger?o():(0,t.createVNode)("div",{class:[(0,e.resolveClassName)("cascader"),this.extCls,{"is-unselected":0===this.modelValue.length,"is-hover":this.isHover,"is-filterable":this.filterable,"is-focus":this.isFocus,"is-disabled":this.disabled,"is-simplicity":"simplicity"===this.behavior}],tabindex:"0","data-placeholder":this.calcuPlaceholder,onMouseenter:this.setHover,onMouseleave:this.cancelHover,ref:"bkCascaderRef"},[r.clearable&&r.isHover&&!r.disabled?(0,t.createVNode)(a.Close,{class:(0,e.resolveClassName)("icon-clear-icon"),onClick:r.handleClear},null):(0,t.createVNode)(a.AngleUp,{class:(0,e.resolveClassName)("icon-angle-up")},null),o()])])}});var x=(0,e.withInstallProps)(w,{CascaderPanel:v});const P=x})(),f})()));
|
package/lib/cascader/store.d.ts
CHANGED
@@ -15,6 +15,8 @@ declare class Store {
|
|
15
15
|
setNodesCheck(nodes: Array<string[]>): void;
|
16
16
|
/** 获取多选下,被选中(checked)的节点 */
|
17
17
|
getCheckedNodes(): any;
|
18
|
+
/** 获取多选下,被选中(checked),且为叶子节点的节点 */
|
19
|
+
getCheckedLeafNodes(): any;
|
18
20
|
/** 根据值获得node实例 */
|
19
21
|
getNodeByValue(value: Array<number | string | string[]>): INode;
|
20
22
|
getNodeById(id: number | string): INode;
|
package/lib/container/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(e,
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"));else if("function"==typeof define&&define.amd)define(["../shared","vue"],t);else{var r="object"==typeof exports?t(require("../shared"),require("vue")):t(e["../shared"],e.vue);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(self,((e,t)=>(()=>{"use strict";var r={4212:t=>{t.exports=e},748:e=>{e.exports=t}},o={};function n(e){var t=o[e];if(void 0!==t)return t.exports;var u=o[e]={exports:{}};return r[e](u,u.exports,n),u.exports}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 u={};return(()=>{n.r(u),n.d(u,{BkCol:()=>l,BkContainer:()=>s,BkRow:()=>p,default:()=>c});var e=n(4212),t=n(748),r=Symbol("containerProps"),o={span:e.PropTypes.number.def(1),offset:e.PropTypes.number.def(0),pull:e.PropTypes.number.def(0),push:e.PropTypes.number.def(0)};const l=(0,t.defineComponent)({name:"Col",props:o,emits:[],setup:function(e,o){var n=(0,t.inject)(r),u=n.col,l=n.gutter,i=n.flex,a=e.span,p=e.offset,s=e.pull,c=e.push,d=(0,t.computed)((function(){return a||u}));(0,t.provide)("containerProps",{col:d.value,gutter:l,flex:i});var f=function(e){return"".concat(Number((100*e).toFixed(3)),"%")},v=(0,t.computed)((function(){return{width:f(d.value/u),"padding-right":"".concat(l/2,"px"),"padding-left":"".concat(l/2,"px"),"margin-left":p?f(p/u):null,right:s?f(s/u):null,left:c?f(c/u):null}}));return function(){var e,r;return(0,t.createVNode)("div",{class:"bk-grid-col",style:v.value},[null===(r=(e=o.slots).default)||void 0===r?void 0:r.call(e)])}}});var i={col:e.PropTypes.number.def(24),gutter:e.PropTypes.number.def(20),margin:e.PropTypes.number.def(20),flex:e.PropTypes.bool.def(!1),extCls:e.PropTypes.string};const a=(0,t.defineComponent)({name:"Container",props:i,emits:[],setup:function(e,o){var n=e.col,u=e.gutter,l=e.flex,i=e.extCls;(0,t.provide)(r,{col:n,gutter:u,flex:l});var a=(0,t.computed)((function(){return i?"bk-grid-container ".concat(i):"bk-grid-container"})),p=(0,t.computed)((function(){var t=e.margin;return{"padding-right":"".concat(t,"px"),"padding-left":"".concat(t,"px")}}));return function(){var e,r;return(0,t.createVNode)("div",{class:a.value,style:p.value},[null===(r=(e=o.slots).default)||void 0===r?void 0:r.call(e)])}}}),p=(0,t.defineComponent)({name:"Row",emits:[],setup:function(e,o){var n=(0,t.inject)(r),u=n.col,l=n.gutter,i=n.flex;(0,t.provide)("containerProps",{col:u,gutter:l,flex:i});var a=(0,t.computed)((function(){var e=i?{display:["-webkit-box","-ms-flexbox","flex"]}:{};return Object.assign(Object.assign({},e),{"margin-right":"-".concat(l/2,"px"),"margin-left":"-".concat(l/2,"px")})}));return function(){var e,r;return(0,t.createVNode)("div",{class:"bk-grid-row",style:a.value},[null===(r=(e=o.slots).default)||void 0===r?void 0:r.call(e)])}}});var s=(0,e.withInstallProps)(a,{Row:p,Col:l});const c=s})(),u})()));
|
@@ -1 +1 @@
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("../config-provider"),require("../directives"),require("../icon"),require("../popover"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../config-provider","../directives","../icon","../popover"],t);else{var n="object"==typeof exports?t(require("../shared"),require("vue"),require("../config-provider"),require("../directives"),require("../icon"),require("../popover")):t(e["../shared"],e.vue,e["../config-provider"],e["../directives"],e["../icon"],e["../popover"]);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,((e,t,n,r,i,a)=>(()=>{var o={7162:(e,t,n)=>{e.exports=n(5047)},5047:e=>{var t=function(e){"use strict";var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),o=new I(r||[]);return a._invoke=function(e,t,n){var r=d;return function(i,a){if(r===h)throw new Error("Generator is already running");if(r===f){if("throw"===i)throw a;return V()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var l=S(o,n);if(l){if(l===p)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===d)throw r=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=h;var u=c(e,t,n);if("normal"===u.type){if(r=n.done?f:v,u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=f,n.method="throw",n.arg=u.arg)}}}(e,n,o),a}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var d="suspendedStart",v="suspendedYield",h="executing",f="completed",p={};function m(){}function g(){}function _(){}var y={};u(y,a,(function(){return this}));var w=Object.getPrototypeOf,b=w&&w(w(N([])));b&&b!==n&&r.call(b,a)&&(y=b);var x=_.prototype=m.prototype=Object.create(y);function k(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(i,a,o,l){var u=c(e[i],e,a);if("throw"!==u.type){var s=u.arg,d=s.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,o,l)}),(function(e){n("throw",e,o,l)})):t.resolve(d).then((function(e){s.value=e,o(s)}),(function(e){return n("throw",e,o,l)}))}l(u.arg)}var i;this._invoke=function(e,r){function a(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(a,a):a()}}function S(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,S(e,n),"throw"===n.method))return p;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var i=c(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,p):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function N(e){if(e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}return{next:V}}function V(){return{value:t,done:!0}}return g.prototype=_,u(x,"constructor",_),u(_,"constructor",g),g.displayName=u(_,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,u(e,l,"GeneratorFunction")),e.prototype=Object.create(x),e},e.awrap=function(e){return{__await:e}},k(E.prototype),u(E.prototype,o,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new E(s(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},k(x),u(x,l,"Generator"),u(x,a,(function(){return this})),u(x,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=N,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return l.type="throw",l.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],l=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(u&&s){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,p):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;C(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:N(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}},2717:e=>{"use strict";e.exports=n},4061:e=>{"use strict";e.exports=r},6870:e=>{"use strict";e.exports=i},5537:e=>{"use strict";e.exports=a},4212:t=>{"use strict";t.exports=e},748:e=>{"use strict";e.exports=t}},l={};function u(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}};return o[e](n,n.exports,u),n.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 n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},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 s={};return(()=>{"use strict";u.r(s),u.d(s,{BkSearchSelect:()=>D,default:()=>A});var e=u(4212);function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var n=u(748),r=null,i=null;function a(e,t){void 0===t&&(t={});var n=document.createElement(e);return Object.keys(t).forEach((function(e){n[e]=t[e]})),n}function o(e,t,n){return(window.getComputedStyle(e,n||null)||{display:"none"})[t]}function l(e){if(!document.documentElement.contains(e))return{detached:!0,rendered:!1};for(var t=e;t!==document;){if("none"===o(t,"display"))return{detached:!1,rendered:!1};t=t.parentNode}return{detached:!1,rendered:!0}}var c=0,d=null;function v(e,t){if(e.__resize_mutation_handler__||(e.__resize_mutation_handler__=h.bind(e)),!e.__resize_listeners__)if(e.__resize_listeners__=[],window.ResizeObserver){var n=e.offsetWidth,r=e.offsetHeight,i=new ResizeObserver((function(){(e.__resize_observer_triggered__||(e.__resize_observer_triggered__=!0,e.offsetWidth!==n||e.offsetHeight!==r))&&p(e)})),u=l(e),s=u.detached,v=u.rendered;e.__resize_observer_triggered__=!1===s&&!1===v,e.__resize_observer__=i,i.observe(e)}else if(e.attachEvent&&e.addEventListener)e.__resize_legacy_resize_handler__=function(){p(e)},e.attachEvent("onresize",e.__resize_legacy_resize_handler__),document.addEventListener("DOMSubtreeModified",e.__resize_mutation_handler__);else if(c||(d=function(e){var t=document.createElement("style");return t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),(document.querySelector("head")||document.body).appendChild(t),t}('.resize-triggers{visibility:hidden;opacity:0;pointer-events:none}.resize-contract-trigger,.resize-contract-trigger:before,.resize-expand-trigger,.resize-triggers{content:"";position:absolute;top:0;left:0;height:100%;width:100%;overflow:hidden}.resize-contract-trigger,.resize-expand-trigger{background:#eee;overflow:auto}.resize-contract-trigger:before{width:200%;height:200%}')),function(e){var t=o(e,"position");t&&"static"!==t||(e.style.position="relative"),e.__resize_old_position__=t,e.__resize_last__={};var n=a("div",{className:"resize-triggers"}),r=a("div",{className:"resize-expand-trigger"}),i=a("div"),l=a("div",{className:"resize-contract-trigger"});r.appendChild(i),n.appendChild(r),n.appendChild(l),e.appendChild(n),e.__resize_triggers__={triggers:n,expand:r,expandChild:i,contract:l},m(e),e.addEventListener("scroll",f,!0),e.__resize_last__={width:e.offsetWidth,height:e.offsetHeight}}(e),e.__resize_rendered__=l(e).rendered,window.MutationObserver){var g=new MutationObserver(e.__resize_mutation_handler__);g.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),e.__resize_mutation_observer__=g}e.__resize_listeners__.push(t),c++}function h(){var e=l(this),t=e.rendered,n=e.detached;t!==this.__resize_rendered__&&(!n&&this.__resize_triggers__&&(m(this),this.addEventListener("scroll",f,!0)),this.__resize_rendered__=t,p(this))}function f(){var e,t,n=this;m(this),this.__resize_raf__&&(e=this.__resize_raf__,i||(i=(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(e){clearTimeout(e)}).bind(window)),i(e)),this.__resize_raf__=(t=function(){var e,t,r,i,a,o,l=(r=(t=(e=n).__resize_last__).width,i=t.height,a=e.offsetWidth,o=e.offsetHeight,a!==r||o!==i?{width:a,height:o}:null);l&&(n.__resize_last__=l,p(n))},r||(r=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){return setTimeout(e,16)}).bind(window)),r(t))}function p(e){e&&e.__resize_listeners__&&e.__resize_listeners__.forEach((function(t){t.call(e,e)}))}function m(e){var t=e.__resize_triggers__,n=t.expand,r=t.expandChild,i=t.contract,a=i.scrollWidth,o=i.scrollHeight,l=n.offsetWidth,u=n.offsetHeight,s=n.scrollWidth,c=n.scrollHeight;i.scrollLeft=a,i.scrollTop=o,r.style.width=l+1+"px",r.style.height=u+1+"px",n.scrollLeft=s,n.scrollTop=c}var g=u(2717),_=u(4061),y=u(6870),w=u(7162),b=u.n(w);function x(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{u(r.next(e))}catch(e){a(e)}}function l(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,l)}u((r=r.apply(e,t||[])).next())}))}Object.create,Object.create;var k=u(5537),E=u.n(k);const S=(0,n.defineComponent)({name:"SearchSelectMenu",props:{list:{type:Array},hoverId:String,keyword:{type:String,default:""},multiple:{type:Boolean,default:!1},selected:{type:Array,default:function(){return[]}},conditions:{type:Array},footerBtns:{type:Array,default:function(){return[]}}},emits:["selectItem","selectCondition","footerClick"],setup:function(e,t){var r=t.emit,i=(0,g.useLocale)("searchSelect"),a=(0,g.usePrefix)().resolveClassName,o=(0,n.computed)((function(){return void 0===e.footerBtns||0===e.footerBtns.length?[{id:"confirm",name:i.value.ok},{id:"cancel",name:i.value.cancel,disabled:!1}]:e.footerBtns}));return{handleClick:function(e){r("selectItem",e)},handleClickCondition:function(e){r("selectCondition",e)},handleClickFooterBtn:function(e){r("footerClick",e)},filterList:(0,n.computed)((function(){var t,n;return(null===(t=e.list)||void 0===t?void 0:t.length)?(null===(n=e.keyword)||void 0===n?void 0:n.length)?e.list.filter((function(t){return t.name.toLocaleLowerCase().includes(e.keyword.toLocaleLowerCase())})):e.list:[]})),getSearchNode:function(t){var r;return(null===(r=t.value)||void 0===r?void 0:r.name)?[(0,n.createVNode)("span",{class:"menu-name"},[t.name,(0,n.createTextVNode)(":")]),t.value.name]:function(t){if(!t)return t;var r=e.keyword,i=r.length;if(!(null==r?void 0:r.trim().length)||!t.toLocaleLowerCase().includes(r.toLocaleLowerCase()))return t;var a=[],o=-1;return r=r.replace(/([.*/]{1})/gim,"\\$1"),t.replace(new RegExp("".concat(r),"igm"),(function(e,r){return 0===a.length&&0!==r?a.push(t.slice(0,r)):o>=0&&a.push(t.slice(o+e.length,r)),a.push((0,n.createVNode)("span",{class:"is-keyword"},[e])),o=r,e})),o>=0&&a.push(t.slice(o+i)),a.length?a:t}(t.name)},localFooterBtns:o,resolveClassName:a}},render:function(){var e,t,r,i=this;return(0,n.createVNode)("div",{class:this.resolveClassName("search-select-menu")},[!!(null===(e=this.conditions)||void 0===e?void 0:e.length)&&(0,n.createVNode)("ul",{class:"menu-header"},[this.conditions.map((function(e){return(0,n.createVNode)("li",{key:e.id,class:"menu-header-item ".concat(e.disabled?"is-disabled":""),onClick:function(){return!e.disabled&&i.handleClickCondition(e)}},[e.name])}))]),(0,n.createVNode)("ul",{class:"menu-content"},[null===(t=this.list)||void 0===t?void 0:t.map((function(e){return(0,n.createVNode)("li",{class:"menu-item ".concat(e.disabled?"is-disabled":""," ").concat(i.hoverId!==e.id||e.disabled?"":"is-hover"),key:e.id,id:e.id,tabindex:"-1",onClick:function(){return!e.disabled&&i.handleClick(e)}},[i.$slots.default?i.$slots.default({item:e,list:i.list,multiple:!!i.multiple,hoverId:i.hoverId,getSearchNode:i.getSearchNode}):(0,n.createVNode)(n.Fragment,null,[i.getSearchNode(e),i.multiple&&i.selected.includes(e.id)&&(0,n.createVNode)(y.Done,{class:"is-selected"},null)])])}))]),this.multiple&&(null===(r=this.localFooterBtns)||void 0===r?void 0:r.length)&&(0,n.createVNode)("div",{class:"menu-footer"},[this.localFooterBtns.map((function(e){return(0,n.createVNode)("span",{class:"menu-footer-btn ".concat(e.disabled?"is-disabled":""),key:e.id,onClick:function(){return!e.disabled&&i.handleClickFooterBtn(e)}},[e.name])}))])])}});function L(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var I;!function(e){e.ALL="all",e.NEEDKEY="need-key"}(I||(I={}));var N,V=Symbol("SEARCH_SLECT_PROVIDER_KEY"),z=function(){return(0,n.inject)(V)};!function(e){e.DEFAULT="default",e.EDIT="edit"}(N||(N={}));var O=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"|";L(this,e),this.searchItem=t,this.type=n,this.splitCode=r,this.values=[],this.id=t.id,this.name=t.name}var t,n;return t=e,(n=[{key:"multiple",get:function(){return!!this.searchItem.multiple}},{key:"placeholder",get:function(){return this.searchItem.placeholder||""}},{key:"children",get:function(){return this.searchItem.children||[]}},{key:"validate",get:function(){return!this.searchItem.noValidate}},{key:"inputInnerHtml",get:function(){var e;return this.isSpecialType()?this.name:"".concat(this.keyInnerHtml).concat((null===(e=this.values)||void 0===e?void 0:e.map((function(e){return e.name})).join(this.splitCode))||"")}},{key:"inputInnerText",get:function(){var e;return this.isSpecialType()?this.name:"".concat(this.keyInnerText).concat((null===(e=this.values)||void 0===e?void 0:e.map((function(e){return e.name})).join(this.splitCode))||"")}},{key:"keyInnerHtml",get:function(){return this.isSpecialType()?this.name:this.name?"".concat(this.name,": "):""}},{key:"keyInnerText",get:function(){return this.isSpecialType()?this.name:this.name?"".concat(this.name,": "):""}},{key:"isSpecialType",value:function(){return["text","condition"].includes(this.type)}},{key:"addValue",value:function(e){if(this.multiple){var t=this.values.findIndex((function(t){return t.id===e.id}));return t>-1?void this.values.splice(t,1):void this.values.push(e)}this.values=[e]}},{key:"toValue",value:function(){var e,t={id:this.id,name:this.name};return(null===(e=this.values)||void 0===e?void 0:e.length)&&(t.values=this.values.map((function(e){return{id:e.id,name:e.name}}))),this.type&&"default"!==this.type&&(t.type=this.type),t}},{key:"toValueKey",value:function(){return JSON.stringify(this.toValue())}},{key:"isInValueList",value:function(e){return this.children.some((function(t){return t.id===(null==e?void 0:e.id)}))}}])&&C(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const T=(0,n.defineComponent)({name:"SearchSelectInput",directives:{clickoutside:_.clickoutside},props:{data:{type:Array,required:!0},showInputBefore:Boolean,showCondition:Boolean,clickOutside:Function,placeholder:String,conditions:{type:Array,default:function(){return[]}},defautUsingItem:Object,mode:{type:String,default:N.DEFAULT},getMenuList:Function,validateValues:Function,valueBehavior:String},emits:["focus","add","delete"],setup:function(t,r){var i=r.emit,a=r.expose,o=(0,g.useLocale)("searchSelect"),l=(0,g.usePrefix)().resolveClassName,u=(0,n.ref)(null),s=(0,n.ref)(null),c=(0,n.ref)(""),d=(0,n.ref)(!1),v=(0,n.ref)(!1),h=(0,n.ref)(!1),f=(0,n.ref)(t.defautUsingItem),p=(0,n.ref)(""),m=(0,n.ref)(!1),_=(0,e.debounce)(300,M),y=!1,w=(0,n.ref)([]),k=(0,n.ref)([]),E=z(),S=E.editKey,L=E.onValidate,C=E.valueSplitCode;function V(e){switch(e.code){case"ArrowDown":case"ArrowUp":T(e);break;case"Enter":case"NumpadEnter":!function(e){if(y){e.preventDefault();var t=k.value.find((function(e){return e.id===p.value}));t&&B(t)}}(e)}}function T(e){var t;e.preventDefault(),null===(t=u.value)||void 0===t||t.blur();for(var n=k.value.length,r=n,i=k.value.findIndex((function(e){return e.id===p.value}));r>=0;){i=(i="ArrowDown"===e.code?i+1:i-1)>n-1?0:i<0?n-1:i;var a=k.value[i];if(a&&!a.disabled){r=-1;var o=document.getElementById(a.id);return null==o||o.focus(),void(p.value=a.id)}r-=1}}function F(e){q(),e&&M()}function j(e){var n;return x(this,void 0,void 0,b().mark((function r(){var a,o,l,u,s;return b().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return null==e||e.preventDefault(),r.next=3,new Promise((function(e){return setTimeout(e,0)}));case 3:if(f.value){r.next=16;break}if(c.value&&t.valueBehavior!==I.NEEDKEY){r.next=6;break}return r.abrupt("return");case 6:return a={id:c.value,name:c.value},r.next=9,D(a);case 9:if(r.sent){r.next=12;break}return r.abrupt("return");case 12:return i("add",new O(a,"text",C.value)),c.value="",M(),r.abrupt("return");case 16:if(null==(o=f.value.values)?void 0:o.length){r.next=43;break}if(!(null===(n=c.value)||void 0===n?void 0:n.length)){r.next=41;break}if(!c.value.includes(C.value)){r.next=29;break}return l=c.value.split(C.value),r.next=23,D({id:c.value,name:c.value});case 23:if(r.sent){r.next=26;break}return r.abrupt("return");case 26:l.forEach((function(e){return f.value.addValue({id:e,name:e})})),r.next=36;break;case 29:return u={id:c.value,name:c.value},r.next=32,D(u);case 32:if(r.sent){r.next=35;break}return r.abrupt("return");case 35:f.value.addValue(u);case 36:return i("add",f.value),c.value="",f.value=null,q(!0),r.abrupt("return");case 41:return d.value=!0,r.abrupt("return");case 43:if(!c.value){r.next=56;break}return s={id:c.value,name:c.value},r.next=47,D(s);case 47:if(r.sent){r.next=50;break}return r.abrupt("return");case 50:return f.value.addValue(s),i("add",f.value),c.value="",f.value=null,q(!0),r.abrupt("return");case 56:return r.next=58,D();case 58:if(r.sent){r.next=61;break}return r.abrupt("return");case 61:K();case 62:case"end":return r.stop()}}),r)})))}function B(e,n){var r,i,a,o,l;return x(this,void 0,void 0,b().mark((function s(){var d,v;return b().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(!(null===(r=e.value)||void 0===r?void 0:r.id)){s.next=8;break}if((t.valueBehavior!==I.NEEDKEY||!e.value)&&t.validateValues){s.next=8;break}return(d=new O(Object.assign(Object.assign({},e),{id:null!==(i=e.realId)&&void 0!==i?i:e.id}),n,C.value)).addValue(e.value),K(d),t.valueBehavior===I.NEEDKEY&&p.value&&q(!0),p.value="",s.abrupt("return");case 8:if(f.value&&(null===(a=null==u?void 0:u.value)||void 0===a?void 0:a.innerText)){s.next=16;break}return f.value=new O(e,n,C.value),c.value="",(v="condition"===n)&&K(),h.value=v||!!f.value.children.length,q(t.valueBehavior===I.NEEDKEY&&!!p.value),s.abrupt("return");case 16:if("condition"!==(null===(o=f.value)||void 0===o?void 0:o.type)){s.next=20;break}return f.value=new O(e,n,C.value),K(),s.abrupt("return");case 20:return f.value.addValue(e),s.next=23,D(e);case 23:if(s.sent){s.next=26;break}return s.abrupt("return");case 26:f.value.multiple||K(),t.valueBehavior===I.NEEDKEY&&(null===(l=f.value)||void 0===l?void 0:l.multiple)&&q();case 28:case"end":return s.stop()}}),s)})))}function D(e){return x(this,void 0,void 0,b().mark((function n(){var r,i,a,o;return b().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(f.value){n.next=4;break}return n.next=3,A(null,[e]);case 3:case 8:return n.abrupt("return",n.sent);case 4:if(r=f.value,i=r.searchItem,a=r.validate,o=r.values,!a||"function"!=typeof t.validateValues){n.next=9;break}return n.next=8,A(i,e?[e]:o);case 9:return L(""),n.abrupt("return",!0);case 11:case"end":return n.stop()}}),n)})))}function A(e,n){var r;return x(this,void 0,void 0,b().mark((function i(){var a;return b().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,null===(r=t.validateValues)||void 0===r?void 0:r.call(t,null!=e?e:null,n).catch((function(){return!1}));case 2:if("string"!=typeof(a=i.sent)&&!1!==a){i.next=6;break}return L(a||"校验错误"),i.abrupt("return",!1);case 6:return L(""),i.abrupt("return",!0);case 8:case"end":return i.stop()}}),i)})))}function q(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&(0,n.nextTick)().then((function(){M()})),v.value=!0,h.value=!0,d.value=!1;var t=setTimeout((function(){if(u.value){u.value.focus();var e=window.getSelection();0===e.focusOffset&&(e.selectAllChildren(u.value),e.collapseToEnd())}window.clearTimeout(t)}),0);i("focus",v.value)}function M(){var n,r,i,a,o;return x(this,void 0,void 0,b().mark((function l(){var u,s;return b().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(u=[],"function"!=typeof t.getMenuList||void 0!==(null===(r=null===(n=f.value)||void 0===n?void 0:n.searchItem)||void 0===r?void 0:r.async)&&!0!==f.value.searchItem.async){l.next=9;break}return m.value=!0,l.next=5,t.getMenuList(null===(i=f.value)||void 0===i?void 0:i.searchItem,c.value).catch((function(){return[]}));case 5:u=l.sent,m.value=!1,l.next=10;break;case 9:(null==f?void 0:f.value)?"condition"===f.value.type?u=t.conditions:(null===(o=f.value.values)||void 0===o?void 0:o.length)&&!f.value.multiple&&t.mode!==N.EDIT||(u=f.value.children.filter((function(e){return e.name.toLocaleLowerCase().includes(c.value.toLocaleLowerCase())}))):(null===(a=c.value)||void 0===a?void 0:a.length)?t.data.filter((function(e){return!e.isSelected})).forEach((function(t){var n,r;t.name.toLocaleLowerCase().includes(c.value.toLocaleLowerCase())?(u.push(t),null===(n=t.children)||void 0===n||n.forEach((function(n){u.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:n}))})),u.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:{id:c.value,name:c.value}}))):(null===(r=t.children)||void 0===r||r.forEach((function(n){n.name.toLocaleLowerCase().includes(c.value.toLocaleLowerCase())&&u.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:n}))})),u.push(Object.assign(Object.assign({},t),{value:{id:c.value,name:c.value}})))})):u=t.data.filter((function(e){return!e.isSelected})).slice();case 10:k.value=u,t.valueBehavior===I.NEEDKEY&&(s=u.find((function(e){return!e.disabled})))&&(!p.value||p.value&&!u.some((function(e){return e.id===p.value})))&&(p.value=s.id);case 12:case"end":return l.stop()}}),l)})))}function K(e){i("add",null!=e?e:f.value),f.value=null,c.value="",q(t.valueBehavior===I.NEEDKEY)}function H(){var e=u.value.innerText;"\n"===e[e.length-1]||"\r"===e[0]?(R(e.slice(0,-1)),H()):"\n"!==e[0]&&"\r"!==e[0]||(R(e.slice(1)),H())}function R(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";u.value&&(u.value.innerHTML=t||(null===(e=f.value)||void 0===e?void 0:e.inputInnerHtml)||"")}return(0,n.watch)(S,(function(){t.mode===N.DEFAULT&&S.value&&(h.value=!1)})),(0,n.watchEffect)((function(){c.value||R()}),{flush:"pre"}),(0,n.watch)([k,h],(function(){var e;(null===(e=k.value)||void 0===e?void 0:e.some((function(e){return!e.disabled})))&&h.value?y||(t.valueBehavior===I.NEEDKEY?p.value=k.value.find((function(e){return!e.disabled})).id:p.value="",y=!0,document.addEventListener("keydown",V)):(document.removeEventListener("keydown",V),y=!1,t.valueBehavior!==I.NEEDKEY&&(p.value=""))})),a({handleInputFocus:F,isFocus:v}),{popoverRef:s,inputRef:u,keyword:c,loading:m,remoteMenuList:w,menuList:k,menuHoverId:p,isFocus:v,usingItem:f,showPopover:h,showNoSelectValueError:d,debounceSetMenuList:_,documentArrowEvent:T,handleClickOutside:function(e){var n,r;!(null===(n=s.value)||void 0===n?void 0:n.contains(e.target))&&(null===(r=t.clickOutside)||void 0===r?void 0:r.call(t,e.target,s.value))&&(h.value=!1,v.value=!1,i("focus",v.value))},handleInputFocus:F,handleInputChange:function(e){var t,n,r,i,a,o,l,s,d;H();var v=e.target.innerText;if(/(\r|\n)/gm.test(v)||/\s{2}/gm.test(v))e.preventDefault(),v=v.replace(/(\r|\n)/gm,C.value).replace(/\s{2}/gm,""),u.value.innerText=v,q(),c.value=v.replace((null===(t=f.value)||void 0===t?void 0:t.keyInnerText)||"","").trim(),_();else if(!c.value&&v.length<((null===(r=null===(n=f.value)||void 0===n?void 0:n.inputInnerText)||void 0===r?void 0:r.length)||1)){var h=v.replace(" "," ").replace((null===(i=f.value)||void 0===i?void 0:i.keyInnerText.replace(" "," ").trim())||"","").trim();if(v&&(null===(a=f.value)||void 0===a?void 0:a.keyInnerText)&&v.replace(" "," ").includes(f.value.keyInnerText.replace(" "," ").trim())&&h&&(null===(o=f.value.values)||void 0===o?void 0:o.length))return c.value=h,console.info("outerText",h),void _();!h&&(null==v?void 0:v.length)||(f.value=null),c.value=h?v:"",_()}else(null===(s=null===(l=f.value)||void 0===l?void 0:l.values)||void 0===s?void 0:s.length)||(c.value=v.replace(" "," ").replace((null===(d=f.value)||void 0===d?void 0:d.keyInnerText.replace(" "," "))||"","").trim(),q(),_())},handleInputKeyup:function(e){switch(e.code){case"Enter":case"NumpadEnter":if(t.valueBehavior===I.NEEDKEY&&k.value.some((function(e){return e.id===p.value})))return;j(e);break;case"Backspace":!function(){var e,r;if(!f.value&&!c.value)return i("delete"),void(0,n.nextTick)(M);if(null===(e=f.value)||void 0===e?void 0:e.values.length){if((null===(r=f.value)||void 0===r?void 0:r.multiple)||f.value.isInValueList(f.value.values[0])||t.mode===N.EDIT&&!c.value)return f.value.values.splice(-1,1),c.value="",void q()}else c.value||(f.value=null,c.value="",M());L("")}();default:d.value=!1}},handleSelectItem:B,handleSelectCondtionItem:function(e){B(e,"condition")},handleMenuFooterClick:function(e){switch(e.id){case"confirm":j();break;case"cancel":f.value.values=[],h.value=!1}},resolveClassName:l,t:o}},render:function(){var e,t,r=this,i=this.usingItem||{},a=i.multiple,o=i.values,l=i.placeholder,u=i.inputInnerHtml,s=!(null===(e=this.keyword)||void 0===e?void 0:e.length)&&!(null==o?void 0:o.length)&&l,c=this.loading||this.showNoSelectValueError||this.showPopover&&!!(null===(t=this.menuList)||void 0===t?void 0:t.length),d=!this.usingItem&&this.showCondition,v=Object.assign({},this.$slots.menu?{default:function(e){var t,n;return null===(n=(t=r.$slots).menu)||void 0===n?void 0:n.call(t,e)}}:{});return(0,n.createVNode)(E(),{trigger:"manual",theme:"light",placement:"bottom-start",arrow:!1,disableOutsideClick:!0,isShow:c},{default:function(){var e;return(0,n.withDirectives)((0,n.createVNode)("div",{ref:"inputRef",class:{"div-input":!0,"input-before":r.showInputBefore&&!(null===(e=r.keyword)||void 0===e?void 0:e.length),"input-after":s},contenteditable:!0,"data-placeholder":u||r.keyword?"":r.placeholder,"data-tips":l||"",spellcheck:"false",onFocus:r.handleInputFocus,onInput:r.handleInputChange,onKeydown:r.handleInputKeyup},null),[[(0,n.resolveDirective)("clickoutside"),r.handleClickOutside]])},content:function(){var e;return r.loading?(0,n.createVNode)("div",null,[r.t.loading]):r.showNoSelectValueError?(0,n.createVNode)("div",null,[r.t.filterQueryMustHasValue]):(null===(e=r.menuList)||void 0===e?void 0:e.length)?(0,n.createVNode)("div",{ref:"popoverRef",class:r.resolveClassName("search-select-popover")},[(0,n.createVNode)(S,{list:r.menuList,keyword:r.keyword,multiple:!!a,hoverId:r.menuHoverId,selected:(null==o?void 0:o.map((function(e){return e.id})))||[],conditions:d?r.conditions:[],onSelectItem:r.handleSelectItem,onSelectCondition:r.handleSelectCondtionItem,onFooterClick:r.handleMenuFooterClick},Object.assign({},v))]):void 0}})}}),F=(0,n.defineComponent)({name:"SearchSelected",props:{data:{type:Array,required:!0},selectedList:{type:Array,required:!0},overflowIndex:{type:Number,default:-1},conditions:{type:Array,default:function(){return[]}},getMenuList:Function,validateValues:Function,valueBehavior:String},emits:["delete"],setup:function(e,t){var r=t.emit,i=(0,n.ref)(null),a=z(),o=a.onEditClick,l=a.onEditEnter,u=a.onEditBlur,s=a.editKey,c=a.valueSplitCode;return{inputRef:i,editKey:s,copySeletedItem:function(e){var t=new O(e.searchItem,e.type,c.value);return t.values=e.values.slice(),t},handleDeleteSelected:function(e){r("delete",e)},handleEditSeleted:function(e,t,n){e.preventDefault(),e.stopPropagation(),o(t,n),setTimeout((function(){return i.value.handleInputFocus()}),200)},handleInputOutside:function(){return!0},handleAddSelected:function(e,t){l(e,t)},handleInputFocus:function(e){e||u()}}},render:function(){var e=this,t=function(t,r){return e.editKey==="".concat(t.id,"_").concat(r)?(0,n.createVNode)("div",{class:"selected-input",key:e.editKey.toString()},[(0,n.createVNode)(T,{ref:"inputRef",key:e.editKey.toString(),mode:N.EDIT,data:e.data,showCondition:!1,conditions:e.conditions,defautUsingItem:e.copySeletedItem(t),clickOutside:e.handleInputOutside,getMenuList:e.getMenuList,validateValues:e.validateValues,valueBehavior:e.valueBehavior,onAdd:function(t){return e.handleAddSelected(t,r)},onFocus:e.handleInputFocus},null)]):(0,n.createVNode)("li",{class:"search-container-selected ".concat((e.overflowIndex>=0?r<e.overflowIndex:r>=0)?"":"hidden-selected"),key:"".concat(t.id,"_").concat(r)},[(0,n.createVNode)("span",{class:"selected-name",onClick:function(n){return e.handleEditSeleted(n,t,r)}},[t.inputInnerText]),(0,n.createVNode)(y.Error,{class:"selected-clear",onClick:function(){return e.handleDeleteSelected(r)}},null)])};return(0,n.createVNode)(n.Fragment,null,[this.selectedList.map((function(r,i){return[e.overflowIndex>=0&&i===e.overflowIndex&&(0,n.createVNode)("div",{class:"search-container-selected overflow-selected"},[(0,n.createTextVNode)("+"),e.selectedList.length-e.overflowIndex]),t(r,i)]}))])}});var j={data:{type:Array,default:function(){return[]}},modelValue:{type:Array,default:function(){return[]}},shrink:{type:Boolean,default:!0},maxHeight:{type:Number,default:120},minHeight:{type:Number,default:26},conditions:{type:Array,default:function(){return[]}},clearable:{type:Boolean,default:!0},placeholder:String,getMenuList:Function,validateValues:Function,valueSplitCode:{type:String,default:"|"},uniqueSelect:{type:Boolean,default:!1},valueBehavior:{type:String,default:I.ALL,validator:function(e){return[I.ALL,I.NEEDKEY].includes(e)}}};const B=(0,n.defineComponent)({name:"SearchSelect",directives:{clickoutside:_.clickoutside},props:j,emits:["update:modelValue","search"],setup:function(t,r){var i,a=r.emit,o=(0,g.useLocale)("searchSelect"),l=(0,g.usePrefix)().resolveClassName,u=(0,n.computed)((function(){return void 0===t.conditions?[{id:"or",name:o.value.or},{id:"and",name:o.value.and}]:t.conditions})),s=(0,n.ref)(null),h=(0,n.ref)(null),p=(0,n.ref)(!1),m=(0,n.ref)([]),_=(0,n.ref)(-1),y=(0,e.debounce)(32,C),w=(0,n.ref)(""),b=(0,n.ref)(""),x=(0,n.computed)((function(){return t.valueSplitCode})),k=(0,n.shallowRef)([]);function E(e,t){w.value="".concat(e.id,"_").concat(t)}function S(e,t){var n=m.value.slice();n.splice(t,1,e),a("update:modelValue",n.map((function(e){return e.toValue()}))),w.value=""}function L(e){b.value=e||""}function C(){if(p.value||m.value.length<1)_.value=-1;else{for(var e=h.value.querySelector(".".concat(l("search-select-container"))),n=h.value.querySelector(".search-container").clientWidth-6-2,r=e.querySelectorAll(".search-container-selected:not(.overflow-selected)"),i=0,a=0,o=0;0===a&&i<=n-40&&o<=r.length-1;){var u=r[o];if(u.clientHeight>t.minHeight)return void(_.value=o);(i+=u?u.clientWidth+6:0)>=n-40&&(a=o),o+=1}a===r.length-1&&i<=n?_.value=-1:_.value=i>=n-40?a:a-1}}return(0,n.watch)((function(){return t.data}),(function(){var e;k.value=JSON.parse(JSON.stringify(t.data)),null===(e=k.value)||void 0===e||e.forEach((function(e){e.isSelected=t.uniqueSelect&&!!t.modelValue.some((function(t){return t.id===e.id}))}))}),{immediate:!0}),(0,n.watch)((function(){return t.modelValue}),(function(e){var n,r;if(!(null==e?void 0:e.length))return m.value=[],void(null===(n=k.value)||void 0===n||n.forEach((function(e){e.isSelected=!1})));var i=[];e.forEach((function(e){var n,r=m.value.find((function(t){return t.id===e.id&&t.name===e.name}));if((null==r?void 0:r.toValueKey())===JSON.stringify(e))r.values=e.values||[],i.push(r);else{var a=t.data.find((function(t){return t.id===e.id})),o="default";a||(a=t.conditions.find((function(t){return t.id===e.id})))&&(o="condition"),a||(null===(n=e.values)||void 0===n?void 0:n.length)||(o="text");var l=new O(a||e,o,x.value);l.values=e.values||[],i.push(l)}})),m.value=i,null===(r=k.value)||void 0===r||r.forEach((function(e){e.isSelected=t.uniqueSelect&&!!i.some((function(t){return t.id===e.id}))}))}),{immediate:!0,deep:!0}),(0,n.onMounted)((function(){v(h.value.querySelector(".".concat(l("search-select-container"))),y)})),(0,n.onBeforeUnmount)((function(){!function(e,t){var n=e.__resize_listeners__;if(n){if(t&&n.splice(n.indexOf(t),1),!n.length||!t){if(e.detachEvent&&e.removeEventListener)return e.detachEvent("onresize",e.__resize_legacy_resize_handler__),void document.removeEventListener("DOMSubtreeModified",e.__resize_mutation_handler__);e.__resize_observer__?(e.__resize_observer__.unobserve(e),e.__resize_observer__.disconnect(),e.__resize_observer__=null):(e.__resize_mutation_observer__&&(e.__resize_mutation_observer__.disconnect(),e.__resize_mutation_observer__=null),e.removeEventListener("scroll",f),e.removeChild(e.__resize_triggers__.triggers),e.__resize_triggers__=null),e.__resize_listeners__=null}!--c&&d&&d.parentNode.removeChild(d)}}(h.value.querySelector(".".concat(l("search-select-container"))),y)})),i={onEditClick:E,onEditEnter:S,onEditBlur:function(){w.value="",L("")},onValidate:L,editKey:w,valueSplitCode:x},(0,n.provide)(V,i),{inputRef:s,wrapRef:h,isFocus:p,copyData:k,selectedList:m,overflowIndex:_,validateStr:b,splitCode:x,onEditClick:E,onEditEnter:S,handleWrapClick:function(){w.value||s.value.handleInputFocus()},handleInputFocus:function(e){var t;e&&(_.value=-1),!1===e&&(null===(t=h.value.querySelector(".".concat(l("search-select-container"))))||void 0===t||t.scrollTo(0,0)),p.value=e},handleResize:C,handleClearAll:function(){m.value=[],_.value=-1,a("update:modelValue",[])},handleInputOutside:function(e){var t;return!(null===(t=h.value)||void 0===t?void 0:t.contains(e))},handleAddSelected:function(e){var t=m.value.slice();t.push(e),L(""),a("update:modelValue",t.map((function(e){return e.toValue()})))},handleDeleteSelected:function(e){var t=m.value.slice();t.splice("number"==typeof e?e:m.value.length-1,1),L(""),a("update:modelValue",t.map((function(e){return e.toValue()})))},handleClickSearch:function(e){a("search",e)},localConditions:u,resolveClassName:l,t:o}},render:function(){var e,r,i,a=this,o="".concat(!this.shrink||this.isFocus?this.maxHeight:this.minHeight,"px"),l=!!this.selectedList.length&&"condition"!==this.selectedList.slice(-1)[0].type,u=Object.assign({},this.$slots.menu?{menu:function(e){var t,n;return null===(n=(t=a.$slots).menu)||void 0===n?void 0:n.call(t,e)}}:{});return(0,n.createVNode)("div",{class:this.resolveClassName("search-select"),ref:"wrapRef"},[(0,n.createVNode)("div",{class:(e={},t(e,this.resolveClassName("search-select-container"),!0),t(e,"is-focus",this.isFocus),e),onClick:this.handleWrapClick},[(0,n.createVNode)("div",{class:"search-prefix"},[null===(i=(r=this.$slots).prepend)||void 0===i?void 0:i.call(r)]),(0,n.createVNode)("div",{class:"search-container",style:{maxHeight:o}},[(0,n.createVNode)(F,{data:this.copyData,conditions:this.localConditions,selectedList:this.selectedList,overflowIndex:this.overflowIndex,getMenuList:this.getMenuList,validateValues:this.validateValues,valueBehavior:this.valueBehavior,onDelete:this.handleDeleteSelected},Object.assign({},u)),(0,n.createVNode)("div",{class:"search-container-input"},[(0,n.createVNode)(T,{ref:"inputRef",data:this.copyData,showInputBefore:!this.selectedList.length,showCondition:l,conditions:this.localConditions,placeholder:this.placeholder||this.t.pleaseSelect,clickOutside:this.handleInputOutside,getMenuList:this.getMenuList,validateValues:this.validateValues,valueBehavior:this.valueBehavior,onAdd:this.handleAddSelected,onDelete:this.handleDeleteSelected,onFocus:this.handleInputFocus},Object.assign({},u))])]),(0,n.createVNode)("div",{class:"search-nextfix"},[this.clearable&&!!this.selectedList.length&&(0,n.createVNode)(y.Close,{class:"search-clear",onClick:this.handleClearAll},null),this.$slots.append?this.$slots.append():(0,n.createVNode)(y.Search,{onClick:this.handleClickSearch,class:"search-nextfix-icon ".concat(this.isFocus?"is-focus":"")},null)])]),!!this.validateStr.length&&(0,n.createVNode)("div",{class:this.resolveClassName("search-select-tips")},[this.$slots.validate?this.$slots.validate():(0,n.createVNode)(n.Fragment,null,[(0,n.createVNode)(y.ExclamationCircleShape,{class:"select-tips"},null),this.validateStr||""])])])}});var D=(0,e.withInstall)(B);const A=D})(),s})()));
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("../config-provider"),require("../directives"),require("../icon"),require("../popover"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../config-provider","../directives","../icon","../popover"],t);else{var n="object"==typeof exports?t(require("../shared"),require("vue"),require("../config-provider"),require("../directives"),require("../icon"),require("../popover")):t(e["../shared"],e.vue,e["../config-provider"],e["../directives"],e["../icon"],e["../popover"]);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,((e,t,n,r,i,a)=>(()=>{var o={7162:(e,t,n)=>{e.exports=n(5047)},5047:e=>{var t=function(e){"use strict";var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),o=new I(r||[]);return a._invoke=function(e,t,n){var r=d;return function(i,a){if(r===h)throw new Error("Generator is already running");if(r===f){if("throw"===i)throw a;return V()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var l=S(o,n);if(l){if(l===p)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===d)throw r=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=h;var u=c(e,t,n);if("normal"===u.type){if(r=n.done?f:v,u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=f,n.method="throw",n.arg=u.arg)}}}(e,n,o),a}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var d="suspendedStart",v="suspendedYield",h="executing",f="completed",p={};function m(){}function g(){}function _(){}var y={};u(y,a,(function(){return this}));var w=Object.getPrototypeOf,b=w&&w(w(N([])));b&&b!==n&&r.call(b,a)&&(y=b);var x=_.prototype=m.prototype=Object.create(y);function k(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(i,a,o,l){var u=c(e[i],e,a);if("throw"!==u.type){var s=u.arg,d=s.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,o,l)}),(function(e){n("throw",e,o,l)})):t.resolve(d).then((function(e){s.value=e,o(s)}),(function(e){return n("throw",e,o,l)}))}l(u.arg)}var i;this._invoke=function(e,r){function a(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(a,a):a()}}function S(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,S(e,n),"throw"===n.method))return p;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var i=c(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,p):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function N(e){if(e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}return{next:V}}function V(){return{value:t,done:!0}}return g.prototype=_,u(x,"constructor",_),u(_,"constructor",g),g.displayName=u(_,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,u(e,l,"GeneratorFunction")),e.prototype=Object.create(x),e},e.awrap=function(e){return{__await:e}},k(E.prototype),u(E.prototype,o,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new E(s(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},k(x),u(x,l,"Generator"),u(x,a,(function(){return this})),u(x,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=N,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return l.type="throw",l.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],l=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(u&&s){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,p):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;C(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:N(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}},2717:e=>{"use strict";e.exports=n},4061:e=>{"use strict";e.exports=r},6870:e=>{"use strict";e.exports=i},5537:e=>{"use strict";e.exports=a},4212:t=>{"use strict";t.exports=e},748:e=>{"use strict";e.exports=t}},l={};function u(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}};return o[e](n,n.exports,u),n.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 n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},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 s={};return(()=>{"use strict";u.r(s),u.d(s,{BkSearchSelect:()=>D,default:()=>A});var e=u(4212);function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var n=u(748),r=null,i=null;function a(e,t){void 0===t&&(t={});var n=document.createElement(e);return Object.keys(t).forEach((function(e){n[e]=t[e]})),n}function o(e,t,n){return(window.getComputedStyle(e,n||null)||{display:"none"})[t]}function l(e){if(!document.documentElement.contains(e))return{detached:!0,rendered:!1};for(var t=e;t!==document;){if("none"===o(t,"display"))return{detached:!1,rendered:!1};t=t.parentNode}return{detached:!1,rendered:!0}}var c=0,d=null;function v(e,t){if(e.__resize_mutation_handler__||(e.__resize_mutation_handler__=h.bind(e)),!e.__resize_listeners__)if(e.__resize_listeners__=[],window.ResizeObserver){var n=e.offsetWidth,r=e.offsetHeight,i=new ResizeObserver((function(){(e.__resize_observer_triggered__||(e.__resize_observer_triggered__=!0,e.offsetWidth!==n||e.offsetHeight!==r))&&p(e)})),u=l(e),s=u.detached,v=u.rendered;e.__resize_observer_triggered__=!1===s&&!1===v,e.__resize_observer__=i,i.observe(e)}else if(e.attachEvent&&e.addEventListener)e.__resize_legacy_resize_handler__=function(){p(e)},e.attachEvent("onresize",e.__resize_legacy_resize_handler__),document.addEventListener("DOMSubtreeModified",e.__resize_mutation_handler__);else if(c||(d=function(e){var t=document.createElement("style");return t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),(document.querySelector("head")||document.body).appendChild(t),t}('.resize-triggers{visibility:hidden;opacity:0;pointer-events:none}.resize-contract-trigger,.resize-contract-trigger:before,.resize-expand-trigger,.resize-triggers{content:"";position:absolute;top:0;left:0;height:100%;width:100%;overflow:hidden}.resize-contract-trigger,.resize-expand-trigger{background:#eee;overflow:auto}.resize-contract-trigger:before{width:200%;height:200%}')),function(e){var t=o(e,"position");t&&"static"!==t||(e.style.position="relative"),e.__resize_old_position__=t,e.__resize_last__={};var n=a("div",{className:"resize-triggers"}),r=a("div",{className:"resize-expand-trigger"}),i=a("div"),l=a("div",{className:"resize-contract-trigger"});r.appendChild(i),n.appendChild(r),n.appendChild(l),e.appendChild(n),e.__resize_triggers__={triggers:n,expand:r,expandChild:i,contract:l},m(e),e.addEventListener("scroll",f,!0),e.__resize_last__={width:e.offsetWidth,height:e.offsetHeight}}(e),e.__resize_rendered__=l(e).rendered,window.MutationObserver){var g=new MutationObserver(e.__resize_mutation_handler__);g.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),e.__resize_mutation_observer__=g}e.__resize_listeners__.push(t),c++}function h(){var e=l(this),t=e.rendered,n=e.detached;t!==this.__resize_rendered__&&(!n&&this.__resize_triggers__&&(m(this),this.addEventListener("scroll",f,!0)),this.__resize_rendered__=t,p(this))}function f(){var e,t,n=this;m(this),this.__resize_raf__&&(e=this.__resize_raf__,i||(i=(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(e){clearTimeout(e)}).bind(window)),i(e)),this.__resize_raf__=(t=function(){var e,t,r,i,a,o,l=(r=(t=(e=n).__resize_last__).width,i=t.height,a=e.offsetWidth,o=e.offsetHeight,a!==r||o!==i?{width:a,height:o}:null);l&&(n.__resize_last__=l,p(n))},r||(r=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){return setTimeout(e,16)}).bind(window)),r(t))}function p(e){e&&e.__resize_listeners__&&e.__resize_listeners__.forEach((function(t){t.call(e,e)}))}function m(e){var t=e.__resize_triggers__,n=t.expand,r=t.expandChild,i=t.contract,a=i.scrollWidth,o=i.scrollHeight,l=n.offsetWidth,u=n.offsetHeight,s=n.scrollWidth,c=n.scrollHeight;i.scrollLeft=a,i.scrollTop=o,r.style.width=l+1+"px",r.style.height=u+1+"px",n.scrollLeft=s,n.scrollTop=c}var g=u(2717),_=u(4061),y=u(6870),w=u(7162),b=u.n(w);function x(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{u(r.next(e))}catch(e){a(e)}}function l(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,l)}u((r=r.apply(e,t||[])).next())}))}Object.create,Object.create;var k=u(5537),E=u.n(k);const S=(0,n.defineComponent)({name:"SearchSelectMenu",props:{list:{type:Array},hoverId:String,keyword:{type:String,default:""},multiple:{type:Boolean,default:!1},selected:{type:Array,default:function(){return[]}},conditions:{type:Array},footerBtns:{type:Array,default:function(){return[]}}},emits:["selectItem","selectCondition","footerClick"],setup:function(e,t){var r=t.emit,i=(0,g.useLocale)("searchSelect"),a=(0,g.usePrefix)().resolveClassName,o=(0,n.computed)((function(){return void 0===e.footerBtns||0===e.footerBtns.length?[{id:"confirm",name:i.value.ok},{id:"cancel",name:i.value.cancel,disabled:!1}]:e.footerBtns}));return{handleClick:function(e){r("selectItem",e)},handleClickCondition:function(e){r("selectCondition",e)},handleClickFooterBtn:function(e){r("footerClick",e)},filterList:(0,n.computed)((function(){var t,n;return(null===(t=e.list)||void 0===t?void 0:t.length)?(null===(n=e.keyword)||void 0===n?void 0:n.length)?e.list.filter((function(t){return t.name.toLocaleLowerCase().includes(e.keyword.toLocaleLowerCase())})):e.list:[]})),getSearchNode:function(t){var r;return(null===(r=t.value)||void 0===r?void 0:r.name)?[(0,n.createVNode)("span",{class:"menu-name"},[t.name,(0,n.createTextVNode)(":")]),t.value.name]:function(t){if(!t)return t;var r=e.keyword,i=r.length;if(!(null==r?void 0:r.trim().length)||!t.toLocaleLowerCase().includes(r.toLocaleLowerCase()))return t;var a=[],o=-1;return r=r.replace(/([.*/]{1})/gim,"\\$1"),t.replace(new RegExp("".concat(r),"igm"),(function(e,r){return 0===a.length&&0!==r?a.push(t.slice(0,r)):o>=0&&a.push(t.slice(o+e.length,r)),a.push((0,n.createVNode)("span",{class:"is-keyword"},[e])),o=r,e})),o>=0&&a.push(t.slice(o+i)),a.length?a:t}(t.name)},localFooterBtns:o,resolveClassName:a}},render:function(){var e,t,r,i=this;return(0,n.createVNode)("div",{class:this.resolveClassName("search-select-menu")},[!!(null===(e=this.conditions)||void 0===e?void 0:e.length)&&(0,n.createVNode)("ul",{class:"menu-header"},[this.conditions.map((function(e){return(0,n.createVNode)("li",{key:e.id,class:"menu-header-item ".concat(e.disabled?"is-disabled":""),onClick:function(){return!e.disabled&&i.handleClickCondition(e)}},[e.name])}))]),(0,n.createVNode)("ul",{class:"menu-content"},[null===(t=this.list)||void 0===t?void 0:t.map((function(e){return(0,n.createVNode)("li",{class:"menu-item ".concat(e.disabled?"is-disabled":""," ").concat(i.hoverId!==e.id||e.disabled?"":"is-hover"),key:e.id,id:e.id,tabindex:"-1",onClick:function(){return!e.disabled&&i.handleClick(e)}},[i.$slots.default?i.$slots.default({item:e,list:i.list,multiple:!!i.multiple,hoverId:i.hoverId,getSearchNode:i.getSearchNode}):(0,n.createVNode)(n.Fragment,null,[i.getSearchNode(e),i.multiple&&i.selected.includes(e.id)&&(0,n.createVNode)(y.Done,{class:"is-selected"},null)])])}))]),this.multiple&&(null===(r=this.localFooterBtns)||void 0===r?void 0:r.length)&&(0,n.createVNode)("div",{class:"menu-footer"},[this.localFooterBtns.map((function(e){return(0,n.createVNode)("span",{class:"menu-footer-btn ".concat(e.disabled?"is-disabled":""),key:e.id,onClick:function(){return!e.disabled&&i.handleClickFooterBtn(e)}},[e.name])}))])])}});function L(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var I;!function(e){e.ALL="all",e.NEEDKEY="need-key"}(I||(I={}));var N,V=Symbol("SEARCH_SLECT_PROVIDER_KEY"),z=function(){return(0,n.inject)(V)};!function(e){e.DEFAULT="default",e.EDIT="edit"}(N||(N={}));var O=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"|";L(this,e),this.searchItem=t,this.type=n,this.splitCode=r,this.values=[],this.id=t.id,this.name=t.name}var t,n;return t=e,(n=[{key:"multiple",get:function(){return!!this.searchItem.multiple}},{key:"placeholder",get:function(){return this.searchItem.placeholder||""}},{key:"children",get:function(){return this.searchItem.children||[]}},{key:"validate",get:function(){return!this.searchItem.noValidate}},{key:"inputInnerHtml",get:function(){var e;return this.isSpecialType()?this.name:"".concat(this.keyInnerHtml).concat((null===(e=this.values)||void 0===e?void 0:e.map((function(e){return e.name})).join(this.splitCode))||"")}},{key:"inputInnerText",get:function(){var e;return this.isSpecialType()?this.name:"".concat(this.keyInnerText).concat((null===(e=this.values)||void 0===e?void 0:e.map((function(e){return e.name})).join(this.splitCode))||"")}},{key:"keyInnerHtml",get:function(){return this.isSpecialType()?this.name:this.name?"".concat(this.name,": "):""}},{key:"keyInnerText",get:function(){return this.isSpecialType()?this.name:this.name?"".concat(this.name,": "):""}},{key:"isSpecialType",value:function(){return["text","condition"].includes(this.type)}},{key:"addValue",value:function(e){if(this.multiple){var t=this.values.findIndex((function(t){return t.id===e.id}));return t>-1?void this.values.splice(t,1):void this.values.push(e)}this.values=[e]}},{key:"toValue",value:function(){var e,t={id:this.id,name:this.name};return(null===(e=this.values)||void 0===e?void 0:e.length)&&(t.values=this.values.map((function(e){return{id:e.id,name:e.name}}))),this.type&&"default"!==this.type&&(t.type=this.type),t}},{key:"toValueKey",value:function(){return JSON.stringify(this.toValue())}},{key:"isInValueList",value:function(e){return this.children.some((function(t){return t.id===(null==e?void 0:e.id)}))}}])&&C(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const T=(0,n.defineComponent)({name:"SearchSelectInput",directives:{clickoutside:_.clickoutside},props:{data:{type:Array,required:!0},showInputBefore:Boolean,showCondition:Boolean,clickOutside:Function,placeholder:String,conditions:{type:Array,default:function(){return[]}},defautUsingItem:Object,mode:{type:String,default:N.DEFAULT},getMenuList:Function,validateValues:Function,valueBehavior:String},emits:["focus","add","delete"],setup:function(t,r){var i=r.emit,a=r.expose,o=(0,g.useLocale)("searchSelect"),l=(0,g.usePrefix)().resolveClassName,u=(0,n.ref)(null),s=(0,n.ref)(null),c=(0,n.ref)(""),d=(0,n.ref)(!1),v=(0,n.ref)(!1),h=(0,n.ref)(!1),f=(0,n.ref)(t.defautUsingItem),p=(0,n.ref)(""),m=(0,n.ref)(!1),_=(0,e.debounce)(300,M),y=!1,w=(0,n.ref)([]),k=(0,n.ref)([]),E=z(),S=E.editKey,L=E.onValidate,C=E.valueSplitCode;function V(e){switch(e.code){case"ArrowDown":case"ArrowUp":T(e);break;case"Enter":case"NumpadEnter":!function(e){if(y){e.preventDefault();var t=k.value.find((function(e){return e.id===p.value}));t&&B(t)}}(e)}}function T(e){var t;e.preventDefault(),null===(t=u.value)||void 0===t||t.blur();for(var n=k.value.length,r=n,i=k.value.findIndex((function(e){return e.id===p.value}));r>=0;){i=(i="ArrowDown"===e.code?i+1:i-1)>n-1?0:i<0?n-1:i;var a=k.value[i];if(a&&!a.disabled){r=-1;var o=document.getElementById(a.id);return null==o||o.focus(),void(p.value=a.id)}r-=1}}function F(e){q(),e&&M()}function j(e){var n;return x(this,void 0,void 0,b().mark((function r(){var a,o,l,u,s;return b().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return null==e||e.preventDefault(),r.next=3,new Promise((function(e){return setTimeout(e,0)}));case 3:if(f.value){r.next=16;break}if(c.value&&t.valueBehavior!==I.NEEDKEY){r.next=6;break}return r.abrupt("return");case 6:return a={id:c.value,name:c.value},r.next=9,D(a);case 9:if(r.sent){r.next=12;break}return r.abrupt("return");case 12:return i("add",new O(a,"text",C.value)),c.value="",M(),r.abrupt("return");case 16:if(null==(o=f.value.values)?void 0:o.length){r.next=43;break}if(!(null===(n=c.value)||void 0===n?void 0:n.length)){r.next=41;break}if(!c.value.includes(C.value)){r.next=29;break}return l=c.value.split(C.value),r.next=23,D({id:c.value,name:c.value});case 23:if(r.sent){r.next=26;break}return r.abrupt("return");case 26:l.forEach((function(e){return f.value.addValue({id:e,name:e})})),r.next=36;break;case 29:return u={id:c.value,name:c.value},r.next=32,D(u);case 32:if(r.sent){r.next=35;break}return r.abrupt("return");case 35:f.value.addValue(u);case 36:return i("add",f.value),c.value="",f.value=null,q(!0),r.abrupt("return");case 41:return d.value=!0,r.abrupt("return");case 43:if(!c.value){r.next=56;break}return s={id:c.value,name:c.value},r.next=47,D(s);case 47:if(r.sent){r.next=50;break}return r.abrupt("return");case 50:return f.value.addValue(s),i("add",f.value),c.value="",f.value=null,q(!0),r.abrupt("return");case 56:return r.next=58,D();case 58:if(r.sent){r.next=61;break}return r.abrupt("return");case 61:K();case 62:case"end":return r.stop()}}),r)})))}function B(e,n){var r,i,a,o,l;return x(this,void 0,void 0,b().mark((function s(){var d,v;return b().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(console.info(e,"=========="),!(null===(r=e.value)||void 0===r?void 0:r.id)){s.next=9;break}if((t.valueBehavior!==I.NEEDKEY||!e.value)&&t.validateValues){s.next=9;break}return(d=new O(Object.assign(Object.assign({},e),{id:null!==(i=e.realId)&&void 0!==i?i:e.id}),n,C.value)).addValue(e.value),K(d),t.valueBehavior===I.NEEDKEY&&p.value&&q(!0),p.value="",s.abrupt("return");case 9:if(f.value&&(null===(a=null==u?void 0:u.value)||void 0===a?void 0:a.innerText)){s.next=17;break}return f.value=new O(e,n,C.value),c.value="",(v="condition"===n)&&K(),h.value=v||!!f.value.children.length,q(t.valueBehavior===I.NEEDKEY&&!!p.value),s.abrupt("return");case 17:if("condition"!==(null===(o=f.value)||void 0===o?void 0:o.type)){s.next=21;break}return f.value=new O(e,n,C.value),K(),s.abrupt("return");case 21:return f.value.addValue(e),s.next=24,D(e);case 24:if(s.sent){s.next=27;break}return s.abrupt("return");case 27:f.value.multiple||K(),t.valueBehavior===I.NEEDKEY&&(null===(l=f.value)||void 0===l?void 0:l.multiple)&&q();case 29:case"end":return s.stop()}}),s)})))}function D(e){return x(this,void 0,void 0,b().mark((function n(){var r,i,a,o;return b().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(f.value){n.next=4;break}return n.next=3,A(null,[e]);case 3:case 8:return n.abrupt("return",n.sent);case 4:if(r=f.value,i=r.searchItem,a=r.validate,o=r.values,!a||"function"!=typeof t.validateValues){n.next=9;break}return n.next=8,A(i,e?[e]:o);case 9:return L(""),n.abrupt("return",!0);case 11:case"end":return n.stop()}}),n)})))}function A(e,n){var r;return x(this,void 0,void 0,b().mark((function i(){var a;return b().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,null===(r=t.validateValues)||void 0===r?void 0:r.call(t,null!=e?e:null,n).catch((function(){return!1}));case 2:if("string"!=typeof(a=i.sent)&&!1!==a){i.next=6;break}return L(a||"校验错误"),i.abrupt("return",!1);case 6:return L(""),i.abrupt("return",!0);case 8:case"end":return i.stop()}}),i)})))}function q(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&(0,n.nextTick)().then((function(){M()})),v.value=!0,h.value=!0,d.value=!1;var t=setTimeout((function(){if(u.value){u.value.focus();var e=window.getSelection();0===e.focusOffset&&(e.selectAllChildren(u.value),e.collapseToEnd())}window.clearTimeout(t)}),0);i("focus",v.value)}function M(){var n,r,i,a,o;return x(this,void 0,void 0,b().mark((function l(){var u,s;return b().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(u=[],"function"!=typeof t.getMenuList||void 0!==(null===(r=null===(n=f.value)||void 0===n?void 0:n.searchItem)||void 0===r?void 0:r.async)&&!0!==f.value.searchItem.async){l.next=9;break}return m.value=!0,l.next=5,t.getMenuList(null===(i=f.value)||void 0===i?void 0:i.searchItem,c.value).catch((function(){return[]}));case 5:u=l.sent,m.value=!1,l.next=10;break;case 9:(null==f?void 0:f.value)?"condition"===f.value.type?u=t.conditions:(null===(o=f.value.values)||void 0===o?void 0:o.length)&&!f.value.multiple&&t.mode!==N.EDIT||(u=f.value.children.filter((function(e){return e.name.toLocaleLowerCase().includes(c.value.toLocaleLowerCase())}))):(null===(a=c.value)||void 0===a?void 0:a.length)?t.data.filter((function(e){return!e.isSelected})).forEach((function(t){var n,r;t.name.toLocaleLowerCase().includes(c.value.toLocaleLowerCase())?(u.push(t),null===(n=t.children)||void 0===n||n.forEach((function(n){u.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:n}))})),u.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:{id:c.value,name:c.value}}))):(null===(r=t.children)||void 0===r||r.forEach((function(n){n.name.toLocaleLowerCase().includes(c.value.toLocaleLowerCase())&&u.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:n}))})),u.push(Object.assign(Object.assign({},t),{value:{id:c.value,name:c.value}})))})):u=t.data.filter((function(e){return!e.isSelected})).slice();case 10:k.value=u,t.valueBehavior===I.NEEDKEY&&(s=u.find((function(e){return!e.disabled})))&&(!p.value||p.value&&!u.some((function(e){return e.id===p.value})))&&(p.value=s.id);case 12:case"end":return l.stop()}}),l)})))}function K(e){i("add",null!=e?e:f.value),f.value=null,c.value="",q(t.valueBehavior===I.NEEDKEY)}function H(){var e=u.value.innerText;"\n"===e[e.length-1]||"\r"===e[0]?(R(e.slice(0,-1)),H()):"\n"!==e[0]&&"\r"!==e[0]||(R(e.slice(1)),H())}function R(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";u.value&&(u.value.innerHTML=t||(null===(e=f.value)||void 0===e?void 0:e.inputInnerHtml)||"")}return(0,n.watch)(S,(function(){t.mode===N.DEFAULT&&S.value&&(h.value=!1)})),(0,n.watchEffect)((function(){c.value||R()}),{flush:"pre"}),(0,n.watch)([k,h],(function(){var e;(null===(e=k.value)||void 0===e?void 0:e.some((function(e){return!e.disabled})))&&h.value?y||(t.valueBehavior===I.NEEDKEY?p.value=k.value.find((function(e){return!e.disabled})).id:p.value="",y=!0,document.addEventListener("keydown",V)):(document.removeEventListener("keydown",V),y=!1,t.valueBehavior!==I.NEEDKEY&&(p.value=""))})),a({handleInputFocus:F,isFocus:v}),{popoverRef:s,inputRef:u,keyword:c,loading:m,remoteMenuList:w,menuList:k,menuHoverId:p,isFocus:v,usingItem:f,showPopover:h,showNoSelectValueError:d,debounceSetMenuList:_,documentArrowEvent:T,handleClickOutside:function(e){var n,r;!(null===(n=s.value)||void 0===n?void 0:n.contains(e.target))&&(null===(r=t.clickOutside)||void 0===r?void 0:r.call(t,e.target,s.value))&&(h.value=!1,v.value=!1,i("focus",v.value))},handleInputFocus:F,handleInputChange:function(e){var t,n,r,i,a,o,l,s,d;H();var v=e.target.innerText;if(/(\r|\n)/gm.test(v)||/\s{2}/gm.test(v))e.preventDefault(),v=v.replace(/(\r|\n)/gm,C.value).replace(/\s{2}/gm,""),u.value.innerText=v,q(),c.value=v.replace((null===(t=f.value)||void 0===t?void 0:t.keyInnerText)||"","").trim(),_();else if(!c.value&&v.length<((null===(r=null===(n=f.value)||void 0===n?void 0:n.inputInnerText)||void 0===r?void 0:r.length)||1)){var h=v.replace(" "," ").replace((null===(i=f.value)||void 0===i?void 0:i.keyInnerText.replace(" "," ").trim())||"","").trim();if(v&&(null===(a=f.value)||void 0===a?void 0:a.keyInnerText)&&v.replace(" "," ").includes(f.value.keyInnerText.replace(" "," ").trim())&&h&&(null===(o=f.value.values)||void 0===o?void 0:o.length))return c.value=h,console.info("outerText",h),void _();!h&&(null==v?void 0:v.length)||(f.value=null),c.value=h?v:"",_()}else(null===(s=null===(l=f.value)||void 0===l?void 0:l.values)||void 0===s?void 0:s.length)||(c.value=v.replace(" "," ").replace((null===(d=f.value)||void 0===d?void 0:d.keyInnerText.replace(" "," "))||"","").trim(),q(),_())},handleInputKeyup:function(e){switch(e.code){case"Enter":case"NumpadEnter":if(t.valueBehavior===I.NEEDKEY&&k.value.some((function(e){return e.id===p.value})))return;j(e);break;case"Backspace":!function(){var e,r;if(!f.value&&!c.value)return i("delete"),void(0,n.nextTick)(M);if(null===(e=f.value)||void 0===e?void 0:e.values.length){if((null===(r=f.value)||void 0===r?void 0:r.multiple)||f.value.isInValueList(f.value.values[0])||t.mode===N.EDIT&&!c.value)return f.value.values.splice(-1,1),c.value="",void q()}else c.value||(f.value=null,c.value="",M());L("")}();default:d.value=!1}},handleSelectItem:B,handleSelectCondtionItem:function(e){B(e,"condition")},handleMenuFooterClick:function(e){var t;switch(e.id){case"confirm":if(!(null===(t=f.value)||void 0===t?void 0:t.values.length))return;c.value="",j();break;case"cancel":f.value.values=[],h.value=!1}},resolveClassName:l,t:o}},render:function(){var e,t,r=this,i=this.usingItem||{},a=i.multiple,o=i.values,l=i.placeholder,u=i.inputInnerHtml,s=!(null===(e=this.keyword)||void 0===e?void 0:e.length)&&!(null==o?void 0:o.length)&&l,c=this.loading||this.showNoSelectValueError||this.showPopover&&!!(null===(t=this.menuList)||void 0===t?void 0:t.length),d=!this.usingItem&&this.showCondition,v=Object.assign({},this.$slots.menu?{default:function(e){var t,n;return null===(n=(t=r.$slots).menu)||void 0===n?void 0:n.call(t,e)}}:{});return(0,n.createVNode)(E(),{trigger:"manual",theme:"light",placement:"bottom-start",arrow:!1,disableOutsideClick:!0,isShow:c},{default:function(){var e;return(0,n.withDirectives)((0,n.createVNode)("div",{ref:"inputRef",class:{"div-input":!0,"input-before":r.showInputBefore&&!(null===(e=r.keyword)||void 0===e?void 0:e.length),"input-after":s},contenteditable:!0,"data-placeholder":u||r.keyword?"":r.placeholder,"data-tips":l||"",spellcheck:"false",onFocus:r.handleInputFocus,onInput:r.handleInputChange,onKeydown:r.handleInputKeyup},null),[[(0,n.resolveDirective)("clickoutside"),r.handleClickOutside]])},content:function(){var e;return r.loading?(0,n.createVNode)("div",null,[r.t.loading]):r.showNoSelectValueError?(0,n.createVNode)("div",null,[r.t.filterQueryMustHasValue]):(null===(e=r.menuList)||void 0===e?void 0:e.length)?(0,n.createVNode)("div",{ref:"popoverRef",class:r.resolveClassName("search-select-popover")},[(0,n.createVNode)(S,{list:r.menuList,keyword:r.keyword,multiple:!!a,hoverId:r.menuHoverId,selected:(null==o?void 0:o.map((function(e){return e.id})))||[],conditions:d?r.conditions:[],onSelectItem:r.handleSelectItem,onSelectCondition:r.handleSelectCondtionItem,onFooterClick:r.handleMenuFooterClick},Object.assign({},v))]):void 0}})}}),F=(0,n.defineComponent)({name:"SearchSelected",props:{data:{type:Array,required:!0},selectedList:{type:Array,required:!0},overflowIndex:{type:Number,default:-1},conditions:{type:Array,default:function(){return[]}},getMenuList:Function,validateValues:Function,valueBehavior:String},emits:["delete"],setup:function(e,t){var r=t.emit,i=(0,n.ref)(null),a=z(),o=a.onEditClick,l=a.onEditEnter,u=a.onEditBlur,s=a.editKey,c=a.valueSplitCode;return{inputRef:i,editKey:s,copySeletedItem:function(e){var t=new O(e.searchItem,e.type,c.value);return t.values=e.values.slice(),t},handleDeleteSelected:function(e){r("delete",e)},handleEditSeleted:function(e,t,n){e.preventDefault(),e.stopPropagation(),o(t,n),setTimeout((function(){return i.value.handleInputFocus()}),200)},handleInputOutside:function(){return!0},handleAddSelected:function(e,t){l(e,t)},handleInputFocus:function(e){e||u()}}},render:function(){var e=this,t=function(t,r){return e.editKey==="".concat(t.id,"_").concat(r)?(0,n.createVNode)("div",{class:"selected-input",key:e.editKey.toString()},[(0,n.createVNode)(T,{ref:"inputRef",key:e.editKey.toString(),mode:N.EDIT,data:e.data,showCondition:!1,conditions:e.conditions,defautUsingItem:e.copySeletedItem(t),clickOutside:e.handleInputOutside,getMenuList:e.getMenuList,validateValues:e.validateValues,valueBehavior:e.valueBehavior,onAdd:function(t){return e.handleAddSelected(t,r)},onFocus:e.handleInputFocus},null)]):(0,n.createVNode)("li",{class:"search-container-selected ".concat((e.overflowIndex>=0?r<e.overflowIndex:r>=0)?"":"hidden-selected"),key:"".concat(t.id,"_").concat(r)},[(0,n.createVNode)("span",{class:"selected-name",onClick:function(n){return e.handleEditSeleted(n,t,r)}},[t.inputInnerText]),(0,n.createVNode)(y.Error,{class:"selected-clear",onClick:function(){return e.handleDeleteSelected(r)}},null)])};return(0,n.createVNode)(n.Fragment,null,[this.selectedList.map((function(r,i){return[e.overflowIndex>=0&&i===e.overflowIndex&&(0,n.createVNode)("div",{class:"search-container-selected overflow-selected"},[(0,n.createTextVNode)("+"),e.selectedList.length-e.overflowIndex]),t(r,i)]}))])}});var j={data:{type:Array,default:function(){return[]}},modelValue:{type:Array,default:function(){return[]}},shrink:{type:Boolean,default:!0},maxHeight:{type:Number,default:120},minHeight:{type:Number,default:26},conditions:{type:Array,default:function(){return[]}},clearable:{type:Boolean,default:!0},placeholder:String,getMenuList:Function,validateValues:Function,valueSplitCode:{type:String,default:"|"},uniqueSelect:{type:Boolean,default:!1},valueBehavior:{type:String,default:I.ALL,validator:function(e){return[I.ALL,I.NEEDKEY].includes(e)}}};const B=(0,n.defineComponent)({name:"SearchSelect",directives:{clickoutside:_.clickoutside},props:j,emits:["update:modelValue","search"],setup:function(t,r){var i,a=r.emit,o=(0,g.useLocale)("searchSelect"),l=(0,g.usePrefix)().resolveClassName,u=(0,n.computed)((function(){return void 0===t.conditions?[{id:"or",name:o.value.or},{id:"and",name:o.value.and}]:t.conditions})),s=(0,n.ref)(null),h=(0,n.ref)(null),p=(0,n.ref)(!1),m=(0,n.ref)([]),_=(0,n.ref)(-1),y=(0,e.debounce)(32,C),w=(0,n.ref)(""),b=(0,n.ref)(""),x=(0,n.computed)((function(){return t.valueSplitCode})),k=(0,n.shallowRef)([]);function E(e,t){w.value="".concat(e.id,"_").concat(t)}function S(e,t){var n=m.value.slice();n.splice(t,1,e),a("update:modelValue",n.map((function(e){return e.toValue()}))),w.value=""}function L(e){b.value=e||""}function C(){if(p.value||m.value.length<1)_.value=-1;else{for(var e=h.value.querySelector(".".concat(l("search-select-container"))),n=h.value.querySelector(".search-container").clientWidth-6-2,r=e.querySelectorAll(".search-container-selected:not(.overflow-selected)"),i=0,a=0,o=0;0===a&&i<=n-40&&o<=r.length-1;){var u=r[o];if(u.clientHeight>t.minHeight)return void(_.value=o);(i+=u?u.clientWidth+6:0)>=n-40&&(a=o),o+=1}a===r.length-1&&i<=n?_.value=-1:_.value=i>=n-40?a:a-1}}return(0,n.watch)((function(){return t.data}),(function(){var e;k.value=JSON.parse(JSON.stringify(t.data)),null===(e=k.value)||void 0===e||e.forEach((function(e){e.isSelected=t.uniqueSelect&&!!t.modelValue.some((function(t){return t.id===e.id}))}))}),{immediate:!0}),(0,n.watch)((function(){return t.modelValue}),(function(e){var n,r;if(!(null==e?void 0:e.length))return m.value=[],void(null===(n=k.value)||void 0===n||n.forEach((function(e){e.isSelected=!1})));var i=[];e.forEach((function(e){var n,r=m.value.find((function(t){return t.id===e.id&&t.name===e.name}));if((null==r?void 0:r.toValueKey())===JSON.stringify(e))r.values=e.values||[],i.push(r);else{var a=t.data.find((function(t){return t.id===e.id})),o="default";a||(a=t.conditions.find((function(t){return t.id===e.id})))&&(o="condition"),a||(null===(n=e.values)||void 0===n?void 0:n.length)||(o="text");var l=new O(a||e,o,x.value);l.values=e.values||[],i.push(l)}})),m.value=i,null===(r=k.value)||void 0===r||r.forEach((function(e){e.isSelected=t.uniqueSelect&&!!i.some((function(t){return t.id===e.id}))}))}),{immediate:!0,deep:!0}),(0,n.onMounted)((function(){v(h.value.querySelector(".".concat(l("search-select-container"))),y)})),(0,n.onBeforeUnmount)((function(){!function(e,t){var n=e.__resize_listeners__;if(n){if(t&&n.splice(n.indexOf(t),1),!n.length||!t){if(e.detachEvent&&e.removeEventListener)return e.detachEvent("onresize",e.__resize_legacy_resize_handler__),void document.removeEventListener("DOMSubtreeModified",e.__resize_mutation_handler__);e.__resize_observer__?(e.__resize_observer__.unobserve(e),e.__resize_observer__.disconnect(),e.__resize_observer__=null):(e.__resize_mutation_observer__&&(e.__resize_mutation_observer__.disconnect(),e.__resize_mutation_observer__=null),e.removeEventListener("scroll",f),e.removeChild(e.__resize_triggers__.triggers),e.__resize_triggers__=null),e.__resize_listeners__=null}!--c&&d&&d.parentNode.removeChild(d)}}(h.value.querySelector(".".concat(l("search-select-container"))),y)})),i={onEditClick:E,onEditEnter:S,onEditBlur:function(){w.value="",L("")},onValidate:L,editKey:w,valueSplitCode:x},(0,n.provide)(V,i),{inputRef:s,wrapRef:h,isFocus:p,copyData:k,selectedList:m,overflowIndex:_,validateStr:b,splitCode:x,onEditClick:E,onEditEnter:S,handleWrapClick:function(){w.value||s.value.handleInputFocus()},handleInputFocus:function(e){var t;e&&(_.value=-1),!1===e&&(null===(t=h.value.querySelector(".".concat(l("search-select-container"))))||void 0===t||t.scrollTo(0,0)),p.value=e},handleResize:C,handleClearAll:function(){m.value=[],_.value=-1,a("update:modelValue",[])},handleInputOutside:function(e){var t;return!(null===(t=h.value)||void 0===t?void 0:t.contains(e))},handleAddSelected:function(e){var t=m.value.slice();t.push(e),L(""),a("update:modelValue",t.map((function(e){return e.toValue()})))},handleDeleteSelected:function(e){var t=m.value.slice();t.splice("number"==typeof e?e:m.value.length-1,1),L(""),a("update:modelValue",t.map((function(e){return e.toValue()})))},handleClickSearch:function(e){a("search",e)},localConditions:u,resolveClassName:l,t:o}},render:function(){var e,r,i,a=this,o="".concat(!this.shrink||this.isFocus?this.maxHeight:this.minHeight,"px"),l=!!this.selectedList.length&&"condition"!==this.selectedList.slice(-1)[0].type,u=Object.assign({},this.$slots.menu?{menu:function(e){var t,n;return null===(n=(t=a.$slots).menu)||void 0===n?void 0:n.call(t,e)}}:{});return(0,n.createVNode)("div",{class:this.resolveClassName("search-select"),ref:"wrapRef"},[(0,n.createVNode)("div",{class:(e={},t(e,this.resolveClassName("search-select-container"),!0),t(e,"is-focus",this.isFocus),e),onClick:this.handleWrapClick},[(0,n.createVNode)("div",{class:"search-prefix"},[null===(i=(r=this.$slots).prepend)||void 0===i?void 0:i.call(r)]),(0,n.createVNode)("div",{class:"search-container",style:{maxHeight:o}},[(0,n.createVNode)(F,{data:this.copyData,conditions:this.localConditions,selectedList:this.selectedList,overflowIndex:this.overflowIndex,getMenuList:this.getMenuList,validateValues:this.validateValues,valueBehavior:this.valueBehavior,onDelete:this.handleDeleteSelected},Object.assign({},u)),(0,n.createVNode)("div",{class:"search-container-input"},[(0,n.createVNode)(T,{ref:"inputRef",data:this.copyData,showInputBefore:!this.selectedList.length,showCondition:l,conditions:this.localConditions,placeholder:this.placeholder||this.t.pleaseSelect,clickOutside:this.handleInputOutside,getMenuList:this.getMenuList,validateValues:this.validateValues,valueBehavior:this.valueBehavior,onAdd:this.handleAddSelected,onDelete:this.handleDeleteSelected,onFocus:this.handleInputFocus},Object.assign({},u))])]),(0,n.createVNode)("div",{class:"search-nextfix"},[this.clearable&&!!this.selectedList.length&&(0,n.createVNode)(y.Close,{class:"search-clear",onClick:this.handleClearAll},null),this.$slots.append?this.$slots.append():(0,n.createVNode)(y.Search,{onClick:this.handleClickSearch,class:"search-nextfix-icon ".concat(this.isFocus?"is-focus":"")},null)])]),!!this.validateStr.length&&(0,n.createVNode)("div",{class:this.resolveClassName("search-select-tips")},[this.$slots.validate?this.$slots.validate():(0,n.createVNode)(n.Fragment,null,[(0,n.createVNode)(y.ExclamationCircleShape,{class:"select-tips"},null),this.validateStr||""])])])}});var D=(0,e.withInstall)(B);const A=D})(),s})()));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "bkui-vue",
|
3
|
-
"version": "0.0.1-beta.
|
3
|
+
"version": "0.0.1-beta.455",
|
4
4
|
"workspaces": {
|
5
5
|
"packages": [
|
6
6
|
"packages/!(**.bak)*",
|
@@ -42,7 +42,7 @@
|
|
42
42
|
"@babel/plugin-transform-runtime": "~7.17.0",
|
43
43
|
"@babel/preset-env": "~7.16.11",
|
44
44
|
"@babel/preset-typescript": "~7.16.7",
|
45
|
-
"@blueking/magicbox-header": "~1.1.
|
45
|
+
"@blueking/magicbox-header": "~1.1.60",
|
46
46
|
"@commitlint/cli": "~16.2.3",
|
47
47
|
"@commitlint/config-conventional": "~16.2.1",
|
48
48
|
"@types/jest": "~27.4.1",
|