bkui-vue 0.0.1-beta.337 → 0.0.1-beta.339
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 +38 -38
- package/dist/index.esm.js +5213 -5359
- package/dist/index.umd.js +39 -39
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/affix/affix.css +357 -0
- package/lib/affix/affix.variable.css +715 -1
- package/lib/alert/alert.css +360 -3
- package/lib/alert/alert.variable.css +715 -1
- package/lib/backtop/backtop.css +360 -3
- package/lib/backtop/backtop.variable.css +715 -1
- package/lib/badge/badge.css +383 -26
- package/lib/badge/badge.variable.css +715 -1
- package/lib/breadcrumb/breadcrumb.css +362 -5
- package/lib/breadcrumb/breadcrumb.variable.css +715 -1
- package/lib/button/button.css +472 -115
- package/lib/button/button.variable.css +715 -1
- package/lib/card/card.css +361 -4
- package/lib/card/card.variable.css +715 -1
- package/lib/cascader/cascader.css +368 -11
- package/lib/cascader/cascader.variable.css +715 -1
- package/lib/cascader/index.js +1 -1
- package/lib/checkbox/checkbox.css +364 -7
- package/lib/checkbox/checkbox.variable.css +715 -1
- package/lib/code-diff/code-diff.css +357 -0
- package/lib/code-diff/code-diff.variable.css +715 -1
- package/lib/collapse/collapse-panel.d.ts +2 -2
- package/lib/collapse/collapse.css +358 -1
- package/lib/collapse/collapse.d.ts +2 -2
- package/lib/collapse/collapse.variable.css +715 -1
- package/lib/collapse/index.d.ts +9 -9
- package/lib/color-picker/color-picker.css +357 -0
- package/lib/color-picker/color-picker.variable.css +715 -1
- package/lib/components.d.ts +2 -1
- package/lib/components.js +1 -1
- package/lib/container/container.css +357 -0
- package/lib/container/container.variable.css +715 -1
- package/lib/date-picker/date-picker.css +374 -17
- package/lib/date-picker/date-picker.variable.css +715 -1
- package/lib/dialog/dialog.d.ts +8 -7
- package/lib/dialog/index.d.ts +21 -18
- package/lib/dialog/index.js +1 -1
- package/lib/dialog/props.d.ts +2 -2
- package/lib/divider/divider.css +360 -3
- package/lib/divider/divider.variable.css +715 -1
- package/lib/dropdown/dropdown.css +358 -1
- package/lib/dropdown/dropdown.d.ts +10 -10
- package/lib/dropdown/dropdown.less +1 -1
- package/lib/dropdown/dropdown.variable.css +716 -2
- package/lib/dropdown/index.js +1 -1
- package/lib/exception/exception.css +357 -0
- package/lib/exception/exception.variable.css +715 -1
- package/lib/fixed-navbar/fixed-navbar.css +361 -4
- package/lib/fixed-navbar/fixed-navbar.variable.css +715 -1
- package/lib/form/form.css +357 -0
- package/lib/form/form.variable.css +715 -1
- package/lib/form/index.js +1 -1
- package/lib/info-box/index.js +1 -1
- package/lib/input/input.css +417 -59
- package/lib/input/input.variable.css +715 -1
- package/lib/link/link.css +373 -16
- package/lib/link/link.variable.css +715 -1
- package/lib/loading/loading.css +373 -16
- package/lib/loading/loading.variable.css +715 -1
- package/lib/menu/menu.css +375 -18
- package/lib/menu/menu.variable.css +715 -1
- package/lib/menu/submenu.css +357 -0
- package/lib/menu/submenu.variable.css +715 -1
- package/lib/message/message.css +378 -21
- package/lib/message/message.variable.css +715 -1
- package/lib/modal/index.d.ts +13 -13
- package/lib/modal/index.js +1 -1
- package/lib/modal/modal.d.ts +5 -5
- package/lib/modal/props.mixin.d.ts +2 -2
- package/lib/navigation/navigation.css +359 -2
- package/lib/navigation/navigation.variable.css +715 -1
- package/lib/notify/notify.css +364 -7
- package/lib/notify/notify.variable.css +715 -1
- package/lib/pagination/index.js +1 -1
- package/lib/pagination/pagination.css +358 -1
- package/lib/pagination/pagination.variable.css +715 -1
- package/lib/plugin-popover/index.d.ts +1 -1
- package/lib/plugin-popover/index.js +1 -1
- package/lib/{popover2 → popover}/arrow.d.ts +0 -0
- package/lib/{popover2 → popover}/const.d.ts +0 -0
- package/lib/{popover2 → popover}/content.d.ts +0 -0
- package/lib/popover/index.d.ts +271 -114
- package/lib/popover/index.js +1 -1
- package/lib/{popover2 → popover}/plugin-popover.d.ts +0 -0
- package/lib/popover/popover.css +364 -50
- package/lib/popover/popover.d.ts +116 -53
- package/lib/popover/popover.less +19 -68
- package/lib/popover/popover.variable.css +721 -50
- package/lib/popover/props.d.ts +55 -37
- package/lib/{popover2 → popover}/reference.d.ts +0 -0
- package/lib/{popover2 → popover}/root.d.ts +0 -0
- package/lib/{popover2 → popover}/use-floating.d.ts +0 -0
- package/lib/{popover2 → popover}/use-platform.d.ts +0 -0
- package/lib/{popover2 → popover}/use-popover-init.d.ts +0 -0
- package/lib/{popover2 → popover}/use-popper-id.d.ts +0 -0
- package/lib/{popover2 → popover}/utils.d.ts +0 -0
- package/lib/process/process.css +370 -13
- package/lib/process/process.variable.css +715 -1
- package/lib/progress/progress.css +361 -4
- package/lib/progress/progress.variable.css +715 -1
- package/lib/radio/radio.css +387 -30
- package/lib/radio/radio.variable.css +715 -1
- package/lib/resize-layout/resize-layout.css +357 -0
- package/lib/resize-layout/resize-layout.variable.css +715 -1
- package/lib/search-select/index.js +1 -1
- package/lib/search-select/search-select.css +393 -36
- package/lib/search-select/search-select.variable.css +715 -1
- package/lib/select/index.d.ts +15 -0
- package/lib/select/index.js +1 -1
- package/lib/select/select.css +413 -56
- package/lib/select/select.d.ts +5 -0
- package/lib/select/select.less +1 -1
- package/lib/select/select.variable.css +747 -33
- package/lib/sideslider/index.d.ts +18 -18
- package/lib/sideslider/sideslider.css +358 -1
- package/lib/sideslider/sideslider.d.ts +7 -7
- package/lib/sideslider/sideslider.variable.css +715 -1
- package/lib/slider/slider.css +361 -4
- package/lib/slider/slider.variable.css +715 -1
- package/lib/steps/steps.css +393 -36
- package/lib/steps/steps.variable.css +715 -1
- package/lib/styles/index.d.ts +0 -2
- package/lib/styles/mixins/scroll.css +357 -0
- package/lib/styles/mixins/scroll.variable.css +715 -1
- package/lib/styles/themes/themes.css +357 -0
- package/lib/styles/themes/themes.less +614 -117
- package/lib/styles/themes/themes.variable.css +357 -0
- package/lib/switcher/switcher.css +374 -17
- package/lib/switcher/switcher.variable.css +715 -1
- package/lib/tab/tab.css +377 -20
- package/lib/tab/tab.variable.css +715 -1
- package/lib/table/const.d.ts +1 -0
- package/lib/table/index.js +1 -1
- package/lib/table/plugins/head-filter.css +369 -11
- package/lib/table/plugins/head-filter.less +2 -1
- package/lib/table/plugins/head-filter.variable.css +725 -10
- package/lib/table/plugins/head-sort.css +357 -0
- package/lib/table/plugins/head-sort.variable.css +715 -1
- package/lib/table/plugins/settings.css +373 -0
- package/lib/table/plugins/settings.less +22 -0
- package/lib/table/plugins/settings.variable.css +731 -1
- package/lib/table/table.css +534 -160
- package/lib/table/table.less +1 -1
- package/lib/table/table.variable.css +1249 -161
- package/lib/tag/tag.css +362 -5
- package/lib/tag/tag.variable.css +715 -1
- package/lib/tag-input/index.d.ts +156 -92
- package/lib/tag-input/index.js +1 -1
- package/lib/tag-input/tag-input.css +375 -18
- package/lib/tag-input/tag-input.d.ts +78 -46
- package/lib/tag-input/tag-input.variable.css +715 -1
- package/lib/tag-input/tag-props.d.ts +39 -23
- package/lib/time-picker/time-picker.css +357 -0
- package/lib/time-picker/time-picker.variable.css +715 -1
- package/lib/timeline/timeline.css +376 -19
- package/lib/timeline/timeline.variable.css +715 -1
- package/lib/transfer/transfer.css +369 -12
- package/lib/transfer/transfer.variable.css +715 -1
- package/lib/tree/tree.css +364 -7
- package/lib/tree/tree.variable.css +1079 -8
- package/lib/upload/upload.css +384 -27
- package/lib/upload/upload.variable.css +715 -1
- package/lib/virtual-render/virtual-render.css +357 -0
- package/lib/virtual-render/virtual-render.variable.css +1072 -1
- package/lib/volar.components.d.ts +1 -1
- package/package.json +1 -1
- package/lib/popover2/index.d.ts +0 -545
- package/lib/popover2/index.js +0 -1
- package/lib/popover2/popover2.css +0 -25
- package/lib/popover2/popover2.d.ts +0 -228
- package/lib/popover2/popover2.less +0 -35
- package/lib/popover2/popover2.variable.css +0 -144
- package/lib/popover2/props.d.ts +0 -118
@@ -1 +1 @@
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("../directives"),require("../icon"),require("../popover2"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../directives","../icon","../popover2"],t);else{var n="object"==typeof exports?t(require("../shared"),require("vue"),require("../directives"),require("../icon"),require("../popover2")):t(e["../shared"],e.vue,e["../directives"],e["../icon"],e["../popover2"]);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,((e,t,n,r,i)=>(()=>{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:{},o=i.iterator||"@@iterator",a=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,o=Object.create(i.prototype),a=new V(r||[]);return o._invoke=function(e,t,n){var r=d;return function(i,o){if(r===h)throw new Error("Generator is already running");if(r===f){if("throw"===i)throw o;return N()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var l=I(a,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,a),o}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 _(){}function g(){}var y={};u(y,o,(function(){return this}));var w=Object.getPrototypeOf,b=w&&w(w(C([])));b&&b!==n&&r.call(b,o)&&(y=b);var x=g.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 L(e,t){function n(i,o,a,l){var u=c(e[i],e,o);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,a,l)}),(function(e){n("throw",e,a,l)})):t.resolve(d).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,l)}))}l(u.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function I(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,I(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 o=i.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,p):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function E(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 S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function V(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function C(e){if(e){var n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=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 a.next=a}}return{next:N}}function N(){return{value:t,done:!0}}return _.prototype=g,u(x,"constructor",g),u(g,"constructor",_),_.displayName=u(g,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===_||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,u(e,l,"GeneratorFunction")),e.prototype=Object.create(x),e},e.awrap=function(e){return{__await:e}},k(L.prototype),u(L.prototype,a,(function(){return this})),e.AsyncIterator=L,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new L(s(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(x),u(x,l,"Generator"),u(x,o,(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=C,V.prototype={constructor:V,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(S),!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 o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],l=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.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 o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(a)},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),S(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;S(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(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)}},4061:e=>{"use strict";e.exports=n},6870:e=>{"use strict";e.exports=r},6175:e=>{"use strict";e.exports=i},4212:t=>{"use strict";t.exports=e},748:e=>{"use strict";e.exports=t}},a={};function l(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return o[e](n,n.exports,l),n.exports}l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};return(()=>{"use strict";l.r(u),l.d(u,{BkSearchSelect:()=>T,default:()=>j});var e=l(4212),t=l(748),n=null,r=null;function i(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 a(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 s=0,c=null;function d(e,t){if(e.__resize_mutation_handler__||(e.__resize_mutation_handler__=v.bind(e)),!e.__resize_listeners__)if(e.__resize_listeners__=[],window.ResizeObserver){var n=e.offsetWidth,r=e.offsetHeight,l=new ResizeObserver((function(){(e.__resize_observer_triggered__||(e.__resize_observer_triggered__=!0,e.offsetWidth!==n||e.offsetHeight!==r))&&f(e)})),u=a(e),d=u.detached,m=u.rendered;e.__resize_observer_triggered__=!1===d&&!1===m,e.__resize_observer__=l,l.observe(e)}else if(e.attachEvent&&e.addEventListener)e.__resize_legacy_resize_handler__=function(){f(e)},e.attachEvent("onresize",e.__resize_legacy_resize_handler__),document.addEventListener("DOMSubtreeModified",e.__resize_mutation_handler__);else if(s||(c=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=i("div",{className:"resize-triggers"}),r=i("div",{className:"resize-expand-trigger"}),a=i("div"),l=i("div",{className:"resize-contract-trigger"});r.appendChild(a),n.appendChild(r),n.appendChild(l),e.appendChild(n),e.__resize_triggers__={triggers:n,expand:r,expandChild:a,contract:l},p(e),e.addEventListener("scroll",h,!0),e.__resize_last__={width:e.offsetWidth,height:e.offsetHeight}}(e),e.__resize_rendered__=a(e).rendered,window.MutationObserver){var _=new MutationObserver(e.__resize_mutation_handler__);_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),e.__resize_mutation_observer__=_}e.__resize_listeners__.push(t),s++}function v(){var e=a(this),t=e.rendered,n=e.detached;t!==this.__resize_rendered__&&(!n&&this.__resize_triggers__&&(p(this),this.addEventListener("scroll",h,!0)),this.__resize_rendered__=t,f(this))}function h(){var e,t,i=this;p(this),this.__resize_raf__&&(e=this.__resize_raf__,r||(r=(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(e){clearTimeout(e)}).bind(window)),r(e)),this.__resize_raf__=(t=function(){var e,t,n,r,o,a,l=(n=(t=(e=i).__resize_last__).width,r=t.height,o=e.offsetWidth,a=e.offsetHeight,o!==n||a!==r?{width:o,height:a}:null);l&&(i.__resize_last__=l,f(i))},n||(n=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){return setTimeout(e,16)}).bind(window)),n(t))}function f(e){e&&e.__resize_listeners__&&e.__resize_listeners__.forEach((function(t){t.call(e,e)}))}function p(e){var t=e.__resize_triggers__,n=t.expand,r=t.expandChild,i=t.contract,o=i.scrollWidth,a=i.scrollHeight,l=n.offsetWidth,u=n.offsetHeight,s=n.scrollWidth,c=n.scrollHeight;i.scrollLeft=o,i.scrollTop=a,r.style.width=l+1+"px",r.style.height=u+1+"px",n.scrollLeft=s,n.scrollTop=c}var m=l(4061),_=l(6870),g=l(7162),y=l.n(g);function w(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function l(e){try{u(r.throw(e))}catch(e){o(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(a,l)}u((r=r.apply(e,t||[])).next())}))}Object.create,Object.create;var b=l(6175),x=l.n(b);const k=(0,t.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[{id:"confirm",name:"确认"},{id:"cancel",name:"取消",disabled:!1}]}}},emits:["selectItem","selectCondition","footerClick"],setup:function(e,n){var r=n.emit;return{handleClick:function(e){r("selectItem",e)},handleClickCondition:function(e){r("selectCondition",e)},handleClickFooterBtn:function(e){r("footerClick",e)},filterList:(0,t.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(n){var r;return(null===(r=n.value)||void 0===r?void 0:r.name)?[(0,t.createVNode)("span",{class:"menu-name"},[n.name,(0,t.createTextVNode)(":")]),n.value.name]:function(n){if(!n)return n;var r=e.keyword,i=r.length;if(!(null==r?void 0:r.trim().length)||!n.toLocaleLowerCase().includes(r.toLocaleLowerCase()))return n;var o=[],a=-1;return r=r.replace(/([.*/]{1})/gim,"\\$1"),n.replace(new RegExp("".concat(r),"igm"),(function(e,r){return 0===o.length&&0!==r?o.push(n.slice(0,r)):a>=0&&o.push(n.slice(a+e.length,r)),o.push((0,t.createVNode)("span",{class:"is-keyword"},[e])),a=r,e})),a>=0&&o.push(n.slice(a+i)),o.length?o:n}(n.name)}}},render:function(){var e,n,r,i=this;return(0,t.createVNode)("div",{class:"bk-search-select-menu"},[!!(null===(e=this.conditions)||void 0===e?void 0:e.length)&&(0,t.createVNode)("ul",{class:"menu-header"},[this.conditions.map((function(e){return(0,t.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,t.createVNode)("ul",{class:"menu-content"},[null===(n=this.list)||void 0===n?void 0:n.map((function(e){return(0,t.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,t.createVNode)(t.Fragment,null,[i.getSearchNode(e),i.multiple&&i.selected.includes(e.id)&&(0,t.createVNode)(_.Done,{class:"is-selected"},null)])])}))]),this.multiple&&(null===(r=this.footerBtns)||void 0===r?void 0:r.length)&&(0,t.createVNode)("div",{class:"menu-footer"},[this.footerBtns.map((function(e){return(0,t.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 I(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 E,S=Symbol("SEARCH_SLECT_PROVIDER_KEY"),V=function(){return(0,t.inject)(S)};!function(e){e.DEFAULT="default",e.EDIT="edit"}(E||(E={}));var C=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";L(this,e),this.searchItem=t,this.type=n,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("|"))||"")}},{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("|"))||"")}},{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)}))}}])&&I(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const N=(0,t.defineComponent)({name:"SearchSelectInput",directives:{clickoutside:m.clickoutside},props:{data:{type:Array,required:!0},showInputBefore:Boolean,showCondition:Boolean,clickOutside:Function,conditions:{type:Array,default:function(){return[]}},defautUsingItem:Object,mode:{type:String,default:E.DEFAULT},geMenuList:Function,validateValues:Function},emits:["focus","add","delete"],setup:function(n,r){var i=r.emit,o=r.expose,a=(0,t.ref)(null),l=(0,t.ref)(null),u=(0,t.ref)(""),s=(0,t.ref)(!1),c=(0,t.ref)(!1),d=(0,t.ref)(!1),v=(0,t.ref)(n.defautUsingItem),h=(0,t.ref)(""),f=(0,t.ref)(!1),p=(0,e.debounce)(300,j),m=!1,_=(0,t.ref)([]),g=(0,t.ref)([]),b=V(),x=b.editKey,k=b.onValidate;function L(e){switch(e.code){case"ArrowDown":case"ArrowUp":I(e);break;case"Enter":case"NumpadEnter":!function(e){if(m){e.preventDefault();var t=g.value.find((function(e){return e.id===h.value}));t&&z(t)}}(e)}}function I(e){var t;e.preventDefault(),null===(t=a.value)||void 0===t||t.blur();for(var n=g.value.length,r=n,i=g.value.findIndex((function(e){return e.id===h.value}));r>=0;){i=(i="ArrowDown"===e.code?i+1:i-1)>n-1?0:i<0?n-1:i;var o=g.value[i];if(!o.disabled){r=-1;var l=document.getElementById(o.id);return null==l||l.focus(),void(h.value=o.id)}r-=1}}function S(e){T(),e&&j()}function N(e){var t;return w(this,void 0,void 0,y().mark((function n(){var r,o,a;return y().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null==e||e.preventDefault(),v.value){n.next=14;break}if(u.value){n.next=4;break}return n.abrupt("return");case 4:return r={id:u.value,name:u.value},n.next=7,O(r);case 7:if(n.sent){n.next=10;break}return n.abrupt("return");case 10:return i("add",new C(r,"text")),u.value="",j(),n.abrupt("return");case 14:if(null==(o=v.value.values)?void 0:o.length){n.next=30;break}if(!(null===(t=u.value)||void 0===t?void 0:t.length)){n.next=28;break}return a={id:u.value,name:u.value},n.next=20,O(a);case 20:if(n.sent){n.next=23;break}return n.abrupt("return");case 23:return v.value.addValue(a),i("add",v.value),u.value="",v.value=null,n.abrupt("return");case 28:return s.value=!0,n.abrupt("return");case 30:return n.next=32,O();case 32:if(n.sent){n.next=35;break}return n.abrupt("return");case 35:A();case 36:case"end":return n.stop()}}),n)})))}function z(e,t){var n,r,i,o;return w(this,void 0,void 0,y().mark((function l(){var s,c;return y().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(!(null===(n=e.value)||void 0===n?void 0:n.id)){l.next=5;break}return(s=new C(Object.assign(Object.assign({},e),{id:null!==(r=e.realId)&&void 0!==r?r:e.id}),t)).addValue(e.value),A(s),l.abrupt("return");case 5:if(v.value&&(null===(i=null==a?void 0:a.value)||void 0===i?void 0:i.innerText)){l.next=13;break}return v.value=new C(e,t),u.value="",(c="condition"===t)&&A(),d.value=c||!!v.value.children.length,T(),l.abrupt("return");case 13:if("condition"!==(null===(o=v.value)||void 0===o?void 0:o.type)){l.next=17;break}return v.value=new C(e,t),A(),l.abrupt("return");case 17:return v.value.addValue(e),l.next=20,O(e);case 20:if(l.sent){l.next=23;break}return l.abrupt("return");case 23:!v.value.multiple&&A();case 24:case"end":return l.stop()}}),l)})))}function O(e){return w(this,void 0,void 0,y().mark((function t(){var r,i,o,a;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(v.value){t.next=4;break}return t.next=3,F(null,[e]);case 3:case 8:return t.abrupt("return",t.sent);case 4:if(r=v.value,i=r.searchItem,o=r.validate,a=r.values,!o||"function"!=typeof n.validateValues){t.next=9;break}return t.next=8,F(i,e?[e]:a);case 9:return k(""),t.abrupt("return",!0);case 11:case"end":return t.stop()}}),t)})))}function F(e,t){var r;return w(this,void 0,void 0,y().mark((function i(){var o;return y().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,null===(r=n.validateValues)||void 0===r?void 0:r.call(n,null!=e?e:null,t).catch((function(){return!1}));case 2:if("string"!=typeof(o=i.sent)&&!1!==o){i.next=6;break}return k(o||"校验错误"),i.abrupt("return",!1);case 6:return k(""),i.abrupt("return",!0);case 8:case"end":return i.stop()}}),i)})))}function T(){c.value=!0,d.value=!0,s.value=!1;var e=setTimeout((function(){if(a.value){a.value.focus();var t=window.getSelection();0===t.focusOffset&&(t.selectAllChildren(a.value),t.collapseToEnd())}window.clearTimeout(e)}),0);i("focus",c.value)}function j(){var t,r,i,o,a;return w(this,void 0,void 0,y().mark((function l(){var s;return y().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(s=[],"function"!=typeof n.geMenuList||(null===(r=null===(t=v.value)||void 0===t?void 0:t.searchItem)||void 0===r?void 0:r.async)){l.next=9;break}return f.value=!0,l.next=5,n.geMenuList(null===(i=v.value)||void 0===i?void 0:i.searchItem,u.value).catch((function(){return[]}));case 5:s=l.sent,f.value=!1,l.next=10;break;case 9:(null==v?void 0:v.value)?"condition"===v.value.type?s=n.conditions:(null===(a=v.value.values)||void 0===a?void 0:a.length)&&!v.value.multiple&&n.mode!==E.EDIT||(s=v.value.children.filter((function(e){return e.name.toLocaleLowerCase().includes(u.value.toLocaleLowerCase())}))):(null===(o=u.value)||void 0===o?void 0:o.length)?n.data.forEach((function(t){var n,r;t.name.toLocaleLowerCase().includes(u.value.toLocaleLowerCase())?(s.push(t),null===(n=t.children)||void 0===n||n.forEach((function(n){s.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:n}))})),s.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:{id:u.value,name:u.value}}))):(null===(r=t.children)||void 0===r||r.forEach((function(n){n.name.toLocaleLowerCase().includes(u.value.toLocaleLowerCase())&&s.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:n}))})),s.push(Object.assign(Object.assign({},t),{value:{id:u.value,name:u.value}})))})):s=n.data.slice();case 10:g.value=s;case 11:case"end":return l.stop()}}),l)})))}function A(e){i("add",null!=e?e:v.value),v.value=null,u.value="",T()}function D(){var e=a.value.innerText;"\n"===e[e.length-1]||"\r"===e[0]?(M(e.slice(0,-1)),D()):"\n"!==e[0]&&"\r"!==e[0]||(M(e.slice(1)),D())}function M(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";a.value&&(a.value.innerHTML=t||(null===(e=v.value)||void 0===e?void 0:e.inputInnerHtml)||"")}return(0,t.watch)(x,(function(){n.mode===E.DEFAULT&&x.value&&(d.value=!1)})),(0,t.watchEffect)((function(){u.value||M()}),{flush:"pre"}),(0,t.watch)([g,d],(function(){var e;(null===(e=g.value)||void 0===e?void 0:e.some((function(e){return!e.disabled})))&&d.value?m||(h.value="",m=!0,document.addEventListener("keydown",L)):(document.removeEventListener("keydown",L),m=!1,h.value="")})),o({handleInputFocus:S,isFocus:c}),{popoverRef:l,inputRef:a,keyword:u,loading:f,remoteMenuList:_,menuList:g,menuHoverId:h,isFocus:c,usingItem:v,showPopover:d,showNoSelectValueError:s,debounceSetMenuList:p,documentArrowEvent:I,handleClickOutside:function(e){var t,r;!(null===(t=l.value)||void 0===t?void 0:t.contains(e.target))&&(null===(r=n.clickOutside)||void 0===r?void 0:r.call(n,e.target,l.value))&&(d.value=!1,c.value=!1,i("focus",c.value))},handleInputFocus:S,handleInputChange:function(e){var t,n,r,i,o,l;D();var s=e.target.innerText;if(/(\r|\n)/gm.test(s)||/\s{2}/gm.test(s))e.preventDefault(),s=s.replace(/(\r|\n)/gm,"|").replace(/\s{2}/gm,""),a.value.innerText=s,T(),u.value=s,p();else if(!u.value&&s.length<((null===(n=null===(t=v.value)||void 0===t?void 0:t.inputInnerText)||void 0===n?void 0:n.length)||1)){var c=s.replace(" "," ").replace((null===(r=v.value)||void 0===r?void 0:r.keyInnerText.replace(" "," ").trim())||"","").trim();c&&(v.value=null),u.value=c?s:"",p()}else(null===(o=null===(i=v.value)||void 0===i?void 0:i.values)||void 0===o?void 0:o.length)||(u.value=s.replace(" "," ").replace((null===(l=v.value)||void 0===l?void 0:l.keyInnerText.replace(" "," "))||"","").trim(),T(),p())},handleInputKeyup:function(e){switch(e.code){case"Enter":case"NumpadEnter":N(e);break;case"Backspace":!function(){var e,t;if(v.value||u.value)return(null===(e=v.value)||void 0===e?void 0:e.values.length)&&((null===(t=v.value)||void 0===t?void 0:t.multiple)||v.value.isInValueList(v.value.values[0]))?(v.value.values.splice(-1,1),u.value="",void T()):void k("");i("delete")}();default:s.value=!1}},handleSelectItem:z,handleSelectCondtionItem:function(e){z(e,"condition")},handleMenuFooterClick:function(e){switch(e.id){case"confirm":N();break;case"cancel":v.value.values=[],T()}}}},render:function(){var e,n,r=this,i=this.usingItem||{},o=i.multiple,a=i.values,l=i.placeholder,u=i.inputInnerHtml,s=!(null===(e=this.keyword)||void 0===e?void 0:e.length)&&!(null==a?void 0:a.length)&&l,c=this.loading||this.showNoSelectValueError||this.showPopover&&!!(null===(n=this.menuList)||void 0===n?void 0:n.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,t.createVNode)(x(),{trigger:"manual",theme:"light",placement:"bottom-start",arrow:!1,disableOutsideClick:!0,isShow:c},{default:function(){var e;return(0,t.withDirectives)((0,t.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?"":"请选择","data-tips":l||"",spellcheck:"false",onFocus:r.handleInputFocus,onInput:r.handleInputChange,onKeydown:r.handleInputKeyup},null),[[(0,t.resolveDirective)("clickoutside"),r.handleClickOutside]])},content:function(){var e;return r.loading?(0,t.createVNode)("div",null,[(0,t.createTextVNode)("加载中...")]):r.showNoSelectValueError?(0,t.createVNode)("div",null,[(0,t.createTextVNode)("包含键值的过滤查询必须有一个值")]):(null===(e=r.menuList)||void 0===e?void 0:e.length)?(0,t.createVNode)("div",{ref:"popoverRef",class:"bk-search-select-popover"},[(0,t.createVNode)(k,{list:r.menuList,keyword:r.keyword,multiple:!!o,hoverId:r.menuHoverId,selected:(null==a?void 0:a.map((function(e){return e.id})))||[],conditions:d?r.conditions:[],onSelectItem:r.handleSelectItem,onSelectCondition:r.handleSelectCondtionItem,onFooterClick:r.handleMenuFooterClick},Object.assign({},v))]):void 0}})}}),z=(0,t.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[]}},geMenuList:Function,validateValues:Function},emits:["delete"],setup:function(e,n){var r=n.emit,i=(0,t.ref)(null),o=V(),a=o.onEditClick,l=o.onEditEnter,u=o.onEditBlur,s=o.editKey;return{inputRef:i,editKey:s,copySeletedItem:function(e){var t=new C(e.searchItem,e.type);return t.values=e.values.slice(),t},handleDeleteSelected:function(e){r("delete",e)},handleEditSeleted:function(e,t,n){e.preventDefault(),e.stopPropagation(),a(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,n=function(n,r){return e.editKey==="".concat(n.id,"_").concat(r)?(0,t.createVNode)("div",{class:"selected-input",key:e.editKey.toString()},[(0,t.createVNode)(N,{ref:"inputRef",key:e.editKey.toString(),mode:E.EDIT,data:e.data,showCondition:!1,conditions:e.conditions,defautUsingItem:e.copySeletedItem(n),clickOutside:e.handleInputOutside,geMenuList:e.geMenuList,validateValues:e.validateValues,onAdd:function(t){return e.handleAddSelected(t,r)},onFocus:e.handleInputFocus},null)]):(0,t.createVNode)("li",{class:"search-container-selected ".concat((e.overflowIndex>=0?r<e.overflowIndex:r>=0)?"":"hidden-selected"),key:"".concat(n.id,"_").concat(r)},[(0,t.createVNode)("span",{class:"selected-name",onClick:function(t){return e.handleEditSeleted(t,n,r)}},[n.inputInnerText]),(0,t.createVNode)(_.Close,{class:"selected-clear",onClick:function(){return e.handleDeleteSelected(r)}},null)])};return(0,t.createVNode)(t.Fragment,null,[this.selectedList.map((function(r,i){return[e.overflowIndex>=0&&i===e.overflowIndex&&(0,t.createVNode)("div",{class:"search-container-selected overflow-selected"},[(0,t.createTextVNode)("+"),e.selectedList.length-e.overflowIndex]),n(r,i)]}))])}});var O={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[{id:"or",name:"或"},{id:"and",name:"且"}]}},clearable:{type:Boolean,default:!0},getMenuList:Function,validateValues:Function};const F=(0,t.defineComponent)({name:"SearchSelect",directives:{clickoutside:m.clickoutside},props:O,emits:["update:modelValue"],setup:function(n,r){var i,o=r.emit,a=(0,t.ref)(null),l=(0,t.ref)(null),u=(0,t.ref)(!1),v=(0,t.ref)([]),f=(0,t.ref)(-1),p=(0,e.debounce)(32,b),m=(0,t.ref)(""),_=(0,t.ref)("");function g(e,t){m.value="".concat(e.id,"_").concat(t)}function y(e,t){var n=v.value.slice();n.splice(t,1,e),o("update:modelValue",n.map((function(e){return e.toValue()}))),m.value=""}function w(e){_.value=e||""}function b(){if(u.value||v.value.length<1)f.value=-1;else{for(var e=l.value.querySelector(".bk-search-select-container"),t=l.value.querySelector(".search-container").clientWidth-6-2,r=e.querySelectorAll(".search-container-selected:not(.overflow-selected)"),i=0,o=0,a=0;0===o&&i<=t-40&&a<=r.length-1;){var s=r[a];if(s.clientHeight>n.minHeight)return void(f.value=a);(i+=s?s.clientWidth+6:0)>=t-40&&(o=a),a+=1}o===r.length-1&&i<=t?f.value=-1:f.value=i>=t-40?o:o-1}}return(0,t.watch)((function(){return n.modelValue}),(function(e){if(null==e?void 0:e.length){var t=[];e.forEach((function(e){var r,i=v.value.find((function(t){return t.id===e.id&&t.name===e.name}));if((null==i?void 0:i.toValueKey())===JSON.stringify(e))i.values=e.values||[],t.push(i);else{var o=n.data.find((function(t){return t.id===e.id})),a="default";o||(o=n.conditions.find((function(t){return t.id===e.id})))&&(a="condition"),o||(null===(r=e.values)||void 0===r?void 0:r.length)||(a="text");var l=new C(o||e,a);l.values=e.values||[],t.push(l)}})),v.value=t}else v.value=[]}),{immediate:!0,deep:!0}),(0,t.onMounted)((function(){d(l.value.querySelector(".bk-search-select-container"),p)})),(0,t.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",h),e.removeChild(e.__resize_triggers__.triggers),e.__resize_triggers__=null),e.__resize_listeners__=null}!--s&&c&&c.parentNode.removeChild(c)}}(l.value.querySelector(".bk-search-select-container"),p)})),i={onEditClick:g,onEditEnter:y,onEditBlur:function(){m.value="",w("")},onValidate:w,editKey:m},(0,t.provide)(S,i),{inputRef:a,wrapRef:l,isFocus:u,selectedList:v,overflowIndex:f,validateStr:_,onEditClick:g,onEditEnter:y,handleWrapClick:function(){m.value||a.value.handleInputFocus()},handleInputFocus:function(e){e&&(f.value=-1),u.value=e},handleResize:b,handleClearAll:function(){v.value=[],f.value=-1,o("update:modelValue",[])},handleInputOutside:function(e){var t;return!(null===(t=l.value)||void 0===t?void 0:t.contains(e))},handleAddSelected:function(e){var t=v.value.slice();t.push(e),w(""),o("update:modelValue",t.map((function(e){return e.toValue()})))},handleDeleteSelected:function(e){var t=v.value.slice();t.splice("number"==typeof e?e:v.value.length-1,1),w(""),o("update:modelValue",t.map((function(e){return e.toValue()})))}}},render:function(){var e,n,r=this,i="".concat(!this.shrink||this.isFocus?this.maxHeight:this.minHeight,"px"),o=!!this.selectedList.length&&"condition"!==this.selectedList.slice(-1)[0].type,a=Object.assign({},this.$slots.menu?{menu:function(e){var t,n;return null===(n=(t=r.$slots).menu)||void 0===n?void 0:n.call(t,e)}}:{});return(0,t.createVNode)("div",{class:"bk-search-select",ref:"wrapRef"},[(0,t.createVNode)("div",{class:{"bk-search-select-container":!0,"is-focus":this.isFocus},onClick:this.handleWrapClick},[(0,t.createVNode)("div",{class:"search-prefix"},[null===(n=(e=this.$slots).prepend)||void 0===n?void 0:n.call(e)]),(0,t.createVNode)("div",{class:"search-container",style:{maxHeight:i}},[(0,t.createVNode)(z,{data:this.data,conditions:this.conditions,selectedList:this.selectedList,overflowIndex:this.overflowIndex,geMenuList:this.getMenuList,validateValues:this.validateValues,onDelete:this.handleDeleteSelected},Object.assign({},a)),(0,t.createVNode)("div",{class:"search-container-input"},[(0,t.createVNode)(N,{ref:"inputRef",data:this.data,showInputBefore:!this.selectedList.length,showCondition:o,conditions:this.conditions,clickOutside:this.handleInputOutside,geMenuList:this.getMenuList,validateValues:this.validateValues,onAdd:this.handleAddSelected,onDelete:this.handleDeleteSelected,onFocus:this.handleInputFocus},Object.assign({},a))])]),(0,t.createVNode)("div",{class:"search-nextfix"},[this.clearable&&!!this.selectedList.length&&(0,t.createVNode)(_.Close,{class:"search-clear",onClick:this.handleClearAll},null),this.$slots.append?this.$slots.append():(0,t.createVNode)(_.Search,{class:"search-nextfix-icon ".concat(this.isFocus?"is-focus":"")},null)])]),!!this.validateStr.length&&(0,t.createVNode)("div",{class:"bk-search-select-tips"},[this.$slots.validate?this.$slots.validate():(0,t.createVNode)(t.Fragment,null,[(0,t.createVNode)(_.ExclamationCircleShape,{class:"select-tips"},null),this.validateStr||""])])])}});var T=(0,e.withInstall)(F);const j=T})(),u})()));
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("../directives"),require("../icon"),require("../popover"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../directives","../icon","../popover"],t);else{var n="object"==typeof exports?t(require("../shared"),require("vue"),require("../directives"),require("../icon"),require("../popover")):t(e["../shared"],e.vue,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)=>(()=>{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:{},o=i.iterator||"@@iterator",a=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,o=Object.create(i.prototype),a=new V(r||[]);return o._invoke=function(e,t,n){var r=d;return function(i,o){if(r===h)throw new Error("Generator is already running");if(r===f){if("throw"===i)throw o;return N()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var l=I(a,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,a),o}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 _(){}function g(){}var y={};u(y,o,(function(){return this}));var w=Object.getPrototypeOf,b=w&&w(w(C([])));b&&b!==n&&r.call(b,o)&&(y=b);var x=g.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 L(e,t){function n(i,o,a,l){var u=c(e[i],e,o);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,a,l)}),(function(e){n("throw",e,a,l)})):t.resolve(d).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,l)}))}l(u.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function I(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,I(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 o=i.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,p):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function E(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 S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function V(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function C(e){if(e){var n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=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 a.next=a}}return{next:N}}function N(){return{value:t,done:!0}}return _.prototype=g,u(x,"constructor",g),u(g,"constructor",_),_.displayName=u(g,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===_||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,u(e,l,"GeneratorFunction")),e.prototype=Object.create(x),e},e.awrap=function(e){return{__await:e}},k(L.prototype),u(L.prototype,a,(function(){return this})),e.AsyncIterator=L,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new L(s(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(x),u(x,l,"Generator"),u(x,o,(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=C,V.prototype={constructor:V,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(S),!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 o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],l=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.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 o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(a)},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),S(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;S(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(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)}},4061:e=>{"use strict";e.exports=n},6870:e=>{"use strict";e.exports=r},5537:e=>{"use strict";e.exports=i},4212:t=>{"use strict";t.exports=e},748:e=>{"use strict";e.exports=t}},a={};function l(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return o[e](n,n.exports,l),n.exports}l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};return(()=>{"use strict";l.r(u),l.d(u,{BkSearchSelect:()=>T,default:()=>j});var e=l(4212),t=l(748),n=null,r=null;function i(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 a(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 s=0,c=null;function d(e,t){if(e.__resize_mutation_handler__||(e.__resize_mutation_handler__=v.bind(e)),!e.__resize_listeners__)if(e.__resize_listeners__=[],window.ResizeObserver){var n=e.offsetWidth,r=e.offsetHeight,l=new ResizeObserver((function(){(e.__resize_observer_triggered__||(e.__resize_observer_triggered__=!0,e.offsetWidth!==n||e.offsetHeight!==r))&&f(e)})),u=a(e),d=u.detached,m=u.rendered;e.__resize_observer_triggered__=!1===d&&!1===m,e.__resize_observer__=l,l.observe(e)}else if(e.attachEvent&&e.addEventListener)e.__resize_legacy_resize_handler__=function(){f(e)},e.attachEvent("onresize",e.__resize_legacy_resize_handler__),document.addEventListener("DOMSubtreeModified",e.__resize_mutation_handler__);else if(s||(c=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=i("div",{className:"resize-triggers"}),r=i("div",{className:"resize-expand-trigger"}),a=i("div"),l=i("div",{className:"resize-contract-trigger"});r.appendChild(a),n.appendChild(r),n.appendChild(l),e.appendChild(n),e.__resize_triggers__={triggers:n,expand:r,expandChild:a,contract:l},p(e),e.addEventListener("scroll",h,!0),e.__resize_last__={width:e.offsetWidth,height:e.offsetHeight}}(e),e.__resize_rendered__=a(e).rendered,window.MutationObserver){var _=new MutationObserver(e.__resize_mutation_handler__);_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),e.__resize_mutation_observer__=_}e.__resize_listeners__.push(t),s++}function v(){var e=a(this),t=e.rendered,n=e.detached;t!==this.__resize_rendered__&&(!n&&this.__resize_triggers__&&(p(this),this.addEventListener("scroll",h,!0)),this.__resize_rendered__=t,f(this))}function h(){var e,t,i=this;p(this),this.__resize_raf__&&(e=this.__resize_raf__,r||(r=(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(e){clearTimeout(e)}).bind(window)),r(e)),this.__resize_raf__=(t=function(){var e,t,n,r,o,a,l=(n=(t=(e=i).__resize_last__).width,r=t.height,o=e.offsetWidth,a=e.offsetHeight,o!==n||a!==r?{width:o,height:a}:null);l&&(i.__resize_last__=l,f(i))},n||(n=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){return setTimeout(e,16)}).bind(window)),n(t))}function f(e){e&&e.__resize_listeners__&&e.__resize_listeners__.forEach((function(t){t.call(e,e)}))}function p(e){var t=e.__resize_triggers__,n=t.expand,r=t.expandChild,i=t.contract,o=i.scrollWidth,a=i.scrollHeight,l=n.offsetWidth,u=n.offsetHeight,s=n.scrollWidth,c=n.scrollHeight;i.scrollLeft=o,i.scrollTop=a,r.style.width=l+1+"px",r.style.height=u+1+"px",n.scrollLeft=s,n.scrollTop=c}var m=l(4061),_=l(6870),g=l(7162),y=l.n(g);function w(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function l(e){try{u(r.throw(e))}catch(e){o(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(a,l)}u((r=r.apply(e,t||[])).next())}))}Object.create,Object.create;var b=l(5537),x=l.n(b);const k=(0,t.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[{id:"confirm",name:"确认"},{id:"cancel",name:"取消",disabled:!1}]}}},emits:["selectItem","selectCondition","footerClick"],setup:function(e,n){var r=n.emit;return{handleClick:function(e){r("selectItem",e)},handleClickCondition:function(e){r("selectCondition",e)},handleClickFooterBtn:function(e){r("footerClick",e)},filterList:(0,t.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(n){var r;return(null===(r=n.value)||void 0===r?void 0:r.name)?[(0,t.createVNode)("span",{class:"menu-name"},[n.name,(0,t.createTextVNode)(":")]),n.value.name]:function(n){if(!n)return n;var r=e.keyword,i=r.length;if(!(null==r?void 0:r.trim().length)||!n.toLocaleLowerCase().includes(r.toLocaleLowerCase()))return n;var o=[],a=-1;return r=r.replace(/([.*/]{1})/gim,"\\$1"),n.replace(new RegExp("".concat(r),"igm"),(function(e,r){return 0===o.length&&0!==r?o.push(n.slice(0,r)):a>=0&&o.push(n.slice(a+e.length,r)),o.push((0,t.createVNode)("span",{class:"is-keyword"},[e])),a=r,e})),a>=0&&o.push(n.slice(a+i)),o.length?o:n}(n.name)}}},render:function(){var e,n,r,i=this;return(0,t.createVNode)("div",{class:"bk-search-select-menu"},[!!(null===(e=this.conditions)||void 0===e?void 0:e.length)&&(0,t.createVNode)("ul",{class:"menu-header"},[this.conditions.map((function(e){return(0,t.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,t.createVNode)("ul",{class:"menu-content"},[null===(n=this.list)||void 0===n?void 0:n.map((function(e){return(0,t.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,t.createVNode)(t.Fragment,null,[i.getSearchNode(e),i.multiple&&i.selected.includes(e.id)&&(0,t.createVNode)(_.Done,{class:"is-selected"},null)])])}))]),this.multiple&&(null===(r=this.footerBtns)||void 0===r?void 0:r.length)&&(0,t.createVNode)("div",{class:"menu-footer"},[this.footerBtns.map((function(e){return(0,t.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 I(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 E,S=Symbol("SEARCH_SLECT_PROVIDER_KEY"),V=function(){return(0,t.inject)(S)};!function(e){e.DEFAULT="default",e.EDIT="edit"}(E||(E={}));var C=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";L(this,e),this.searchItem=t,this.type=n,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("|"))||"")}},{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("|"))||"")}},{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)}))}}])&&I(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const N=(0,t.defineComponent)({name:"SearchSelectInput",directives:{clickoutside:m.clickoutside},props:{data:{type:Array,required:!0},showInputBefore:Boolean,showCondition:Boolean,clickOutside:Function,conditions:{type:Array,default:function(){return[]}},defautUsingItem:Object,mode:{type:String,default:E.DEFAULT},geMenuList:Function,validateValues:Function},emits:["focus","add","delete"],setup:function(n,r){var i=r.emit,o=r.expose,a=(0,t.ref)(null),l=(0,t.ref)(null),u=(0,t.ref)(""),s=(0,t.ref)(!1),c=(0,t.ref)(!1),d=(0,t.ref)(!1),v=(0,t.ref)(n.defautUsingItem),h=(0,t.ref)(""),f=(0,t.ref)(!1),p=(0,e.debounce)(300,j),m=!1,_=(0,t.ref)([]),g=(0,t.ref)([]),b=V(),x=b.editKey,k=b.onValidate;function L(e){switch(e.code){case"ArrowDown":case"ArrowUp":I(e);break;case"Enter":case"NumpadEnter":!function(e){if(m){e.preventDefault();var t=g.value.find((function(e){return e.id===h.value}));t&&z(t)}}(e)}}function I(e){var t;e.preventDefault(),null===(t=a.value)||void 0===t||t.blur();for(var n=g.value.length,r=n,i=g.value.findIndex((function(e){return e.id===h.value}));r>=0;){i=(i="ArrowDown"===e.code?i+1:i-1)>n-1?0:i<0?n-1:i;var o=g.value[i];if(!o.disabled){r=-1;var l=document.getElementById(o.id);return null==l||l.focus(),void(h.value=o.id)}r-=1}}function S(e){T(),e&&j()}function N(e){var t;return w(this,void 0,void 0,y().mark((function n(){var r,o,a;return y().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null==e||e.preventDefault(),v.value){n.next=14;break}if(u.value){n.next=4;break}return n.abrupt("return");case 4:return r={id:u.value,name:u.value},n.next=7,O(r);case 7:if(n.sent){n.next=10;break}return n.abrupt("return");case 10:return i("add",new C(r,"text")),u.value="",j(),n.abrupt("return");case 14:if(null==(o=v.value.values)?void 0:o.length){n.next=30;break}if(!(null===(t=u.value)||void 0===t?void 0:t.length)){n.next=28;break}return a={id:u.value,name:u.value},n.next=20,O(a);case 20:if(n.sent){n.next=23;break}return n.abrupt("return");case 23:return v.value.addValue(a),i("add",v.value),u.value="",v.value=null,n.abrupt("return");case 28:return s.value=!0,n.abrupt("return");case 30:return n.next=32,O();case 32:if(n.sent){n.next=35;break}return n.abrupt("return");case 35:A();case 36:case"end":return n.stop()}}),n)})))}function z(e,t){var n,r,i,o;return w(this,void 0,void 0,y().mark((function l(){var s,c;return y().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(!(null===(n=e.value)||void 0===n?void 0:n.id)){l.next=5;break}return(s=new C(Object.assign(Object.assign({},e),{id:null!==(r=e.realId)&&void 0!==r?r:e.id}),t)).addValue(e.value),A(s),l.abrupt("return");case 5:if(v.value&&(null===(i=null==a?void 0:a.value)||void 0===i?void 0:i.innerText)){l.next=13;break}return v.value=new C(e,t),u.value="",(c="condition"===t)&&A(),d.value=c||!!v.value.children.length,T(),l.abrupt("return");case 13:if("condition"!==(null===(o=v.value)||void 0===o?void 0:o.type)){l.next=17;break}return v.value=new C(e,t),A(),l.abrupt("return");case 17:return v.value.addValue(e),l.next=20,O(e);case 20:if(l.sent){l.next=23;break}return l.abrupt("return");case 23:!v.value.multiple&&A();case 24:case"end":return l.stop()}}),l)})))}function O(e){return w(this,void 0,void 0,y().mark((function t(){var r,i,o,a;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(v.value){t.next=4;break}return t.next=3,F(null,[e]);case 3:case 8:return t.abrupt("return",t.sent);case 4:if(r=v.value,i=r.searchItem,o=r.validate,a=r.values,!o||"function"!=typeof n.validateValues){t.next=9;break}return t.next=8,F(i,e?[e]:a);case 9:return k(""),t.abrupt("return",!0);case 11:case"end":return t.stop()}}),t)})))}function F(e,t){var r;return w(this,void 0,void 0,y().mark((function i(){var o;return y().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,null===(r=n.validateValues)||void 0===r?void 0:r.call(n,null!=e?e:null,t).catch((function(){return!1}));case 2:if("string"!=typeof(o=i.sent)&&!1!==o){i.next=6;break}return k(o||"校验错误"),i.abrupt("return",!1);case 6:return k(""),i.abrupt("return",!0);case 8:case"end":return i.stop()}}),i)})))}function T(){c.value=!0,d.value=!0,s.value=!1;var e=setTimeout((function(){if(a.value){a.value.focus();var t=window.getSelection();0===t.focusOffset&&(t.selectAllChildren(a.value),t.collapseToEnd())}window.clearTimeout(e)}),0);i("focus",c.value)}function j(){var t,r,i,o,a;return w(this,void 0,void 0,y().mark((function l(){var s;return y().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(s=[],"function"!=typeof n.geMenuList||(null===(r=null===(t=v.value)||void 0===t?void 0:t.searchItem)||void 0===r?void 0:r.async)){l.next=9;break}return f.value=!0,l.next=5,n.geMenuList(null===(i=v.value)||void 0===i?void 0:i.searchItem,u.value).catch((function(){return[]}));case 5:s=l.sent,f.value=!1,l.next=10;break;case 9:(null==v?void 0:v.value)?"condition"===v.value.type?s=n.conditions:(null===(a=v.value.values)||void 0===a?void 0:a.length)&&!v.value.multiple&&n.mode!==E.EDIT||(s=v.value.children.filter((function(e){return e.name.toLocaleLowerCase().includes(u.value.toLocaleLowerCase())}))):(null===(o=u.value)||void 0===o?void 0:o.length)?n.data.forEach((function(t){var n,r;t.name.toLocaleLowerCase().includes(u.value.toLocaleLowerCase())?(s.push(t),null===(n=t.children)||void 0===n||n.forEach((function(n){s.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:n}))})),s.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:{id:u.value,name:u.value}}))):(null===(r=t.children)||void 0===r||r.forEach((function(n){n.name.toLocaleLowerCase().includes(u.value.toLocaleLowerCase())&&s.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:n}))})),s.push(Object.assign(Object.assign({},t),{value:{id:u.value,name:u.value}})))})):s=n.data.slice();case 10:g.value=s;case 11:case"end":return l.stop()}}),l)})))}function A(e){i("add",null!=e?e:v.value),v.value=null,u.value="",T()}function D(){var e=a.value.innerText;"\n"===e[e.length-1]||"\r"===e[0]?(M(e.slice(0,-1)),D()):"\n"!==e[0]&&"\r"!==e[0]||(M(e.slice(1)),D())}function M(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";a.value&&(a.value.innerHTML=t||(null===(e=v.value)||void 0===e?void 0:e.inputInnerHtml)||"")}return(0,t.watch)(x,(function(){n.mode===E.DEFAULT&&x.value&&(d.value=!1)})),(0,t.watchEffect)((function(){u.value||M()}),{flush:"pre"}),(0,t.watch)([g,d],(function(){var e;(null===(e=g.value)||void 0===e?void 0:e.some((function(e){return!e.disabled})))&&d.value?m||(h.value="",m=!0,document.addEventListener("keydown",L)):(document.removeEventListener("keydown",L),m=!1,h.value="")})),o({handleInputFocus:S,isFocus:c}),{popoverRef:l,inputRef:a,keyword:u,loading:f,remoteMenuList:_,menuList:g,menuHoverId:h,isFocus:c,usingItem:v,showPopover:d,showNoSelectValueError:s,debounceSetMenuList:p,documentArrowEvent:I,handleClickOutside:function(e){var t,r;!(null===(t=l.value)||void 0===t?void 0:t.contains(e.target))&&(null===(r=n.clickOutside)||void 0===r?void 0:r.call(n,e.target,l.value))&&(d.value=!1,c.value=!1,i("focus",c.value))},handleInputFocus:S,handleInputChange:function(e){var t,n,r,i,o,l;D();var s=e.target.innerText;if(/(\r|\n)/gm.test(s)||/\s{2}/gm.test(s))e.preventDefault(),s=s.replace(/(\r|\n)/gm,"|").replace(/\s{2}/gm,""),a.value.innerText=s,T(),u.value=s,p();else if(!u.value&&s.length<((null===(n=null===(t=v.value)||void 0===t?void 0:t.inputInnerText)||void 0===n?void 0:n.length)||1)){var c=s.replace(" "," ").replace((null===(r=v.value)||void 0===r?void 0:r.keyInnerText.replace(" "," ").trim())||"","").trim();c&&(v.value=null),u.value=c?s:"",p()}else(null===(o=null===(i=v.value)||void 0===i?void 0:i.values)||void 0===o?void 0:o.length)||(u.value=s.replace(" "," ").replace((null===(l=v.value)||void 0===l?void 0:l.keyInnerText.replace(" "," "))||"","").trim(),T(),p())},handleInputKeyup:function(e){switch(e.code){case"Enter":case"NumpadEnter":N(e);break;case"Backspace":!function(){var e,t;if(v.value||u.value)return(null===(e=v.value)||void 0===e?void 0:e.values.length)&&((null===(t=v.value)||void 0===t?void 0:t.multiple)||v.value.isInValueList(v.value.values[0]))?(v.value.values.splice(-1,1),u.value="",void T()):void k("");i("delete")}();default:s.value=!1}},handleSelectItem:z,handleSelectCondtionItem:function(e){z(e,"condition")},handleMenuFooterClick:function(e){switch(e.id){case"confirm":N();break;case"cancel":v.value.values=[],T()}}}},render:function(){var e,n,r=this,i=this.usingItem||{},o=i.multiple,a=i.values,l=i.placeholder,u=i.inputInnerHtml,s=!(null===(e=this.keyword)||void 0===e?void 0:e.length)&&!(null==a?void 0:a.length)&&l,c=this.loading||this.showNoSelectValueError||this.showPopover&&!!(null===(n=this.menuList)||void 0===n?void 0:n.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,t.createVNode)(x(),{trigger:"manual",theme:"light",placement:"bottom-start",arrow:!1,disableOutsideClick:!0,isShow:c},{default:function(){var e;return(0,t.withDirectives)((0,t.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?"":"请选择","data-tips":l||"",spellcheck:"false",onFocus:r.handleInputFocus,onInput:r.handleInputChange,onKeydown:r.handleInputKeyup},null),[[(0,t.resolveDirective)("clickoutside"),r.handleClickOutside]])},content:function(){var e;return r.loading?(0,t.createVNode)("div",null,[(0,t.createTextVNode)("加载中...")]):r.showNoSelectValueError?(0,t.createVNode)("div",null,[(0,t.createTextVNode)("包含键值的过滤查询必须有一个值")]):(null===(e=r.menuList)||void 0===e?void 0:e.length)?(0,t.createVNode)("div",{ref:"popoverRef",class:"bk-search-select-popover"},[(0,t.createVNode)(k,{list:r.menuList,keyword:r.keyword,multiple:!!o,hoverId:r.menuHoverId,selected:(null==a?void 0:a.map((function(e){return e.id})))||[],conditions:d?r.conditions:[],onSelectItem:r.handleSelectItem,onSelectCondition:r.handleSelectCondtionItem,onFooterClick:r.handleMenuFooterClick},Object.assign({},v))]):void 0}})}}),z=(0,t.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[]}},geMenuList:Function,validateValues:Function},emits:["delete"],setup:function(e,n){var r=n.emit,i=(0,t.ref)(null),o=V(),a=o.onEditClick,l=o.onEditEnter,u=o.onEditBlur,s=o.editKey;return{inputRef:i,editKey:s,copySeletedItem:function(e){var t=new C(e.searchItem,e.type);return t.values=e.values.slice(),t},handleDeleteSelected:function(e){r("delete",e)},handleEditSeleted:function(e,t,n){e.preventDefault(),e.stopPropagation(),a(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,n=function(n,r){return e.editKey==="".concat(n.id,"_").concat(r)?(0,t.createVNode)("div",{class:"selected-input",key:e.editKey.toString()},[(0,t.createVNode)(N,{ref:"inputRef",key:e.editKey.toString(),mode:E.EDIT,data:e.data,showCondition:!1,conditions:e.conditions,defautUsingItem:e.copySeletedItem(n),clickOutside:e.handleInputOutside,geMenuList:e.geMenuList,validateValues:e.validateValues,onAdd:function(t){return e.handleAddSelected(t,r)},onFocus:e.handleInputFocus},null)]):(0,t.createVNode)("li",{class:"search-container-selected ".concat((e.overflowIndex>=0?r<e.overflowIndex:r>=0)?"":"hidden-selected"),key:"".concat(n.id,"_").concat(r)},[(0,t.createVNode)("span",{class:"selected-name",onClick:function(t){return e.handleEditSeleted(t,n,r)}},[n.inputInnerText]),(0,t.createVNode)(_.Close,{class:"selected-clear",onClick:function(){return e.handleDeleteSelected(r)}},null)])};return(0,t.createVNode)(t.Fragment,null,[this.selectedList.map((function(r,i){return[e.overflowIndex>=0&&i===e.overflowIndex&&(0,t.createVNode)("div",{class:"search-container-selected overflow-selected"},[(0,t.createTextVNode)("+"),e.selectedList.length-e.overflowIndex]),n(r,i)]}))])}});var O={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[{id:"or",name:"或"},{id:"and",name:"且"}]}},clearable:{type:Boolean,default:!0},getMenuList:Function,validateValues:Function};const F=(0,t.defineComponent)({name:"SearchSelect",directives:{clickoutside:m.clickoutside},props:O,emits:["update:modelValue"],setup:function(n,r){var i,o=r.emit,a=(0,t.ref)(null),l=(0,t.ref)(null),u=(0,t.ref)(!1),v=(0,t.ref)([]),f=(0,t.ref)(-1),p=(0,e.debounce)(32,b),m=(0,t.ref)(""),_=(0,t.ref)("");function g(e,t){m.value="".concat(e.id,"_").concat(t)}function y(e,t){var n=v.value.slice();n.splice(t,1,e),o("update:modelValue",n.map((function(e){return e.toValue()}))),m.value=""}function w(e){_.value=e||""}function b(){if(u.value||v.value.length<1)f.value=-1;else{for(var e=l.value.querySelector(".bk-search-select-container"),t=l.value.querySelector(".search-container").clientWidth-6-2,r=e.querySelectorAll(".search-container-selected:not(.overflow-selected)"),i=0,o=0,a=0;0===o&&i<=t-40&&a<=r.length-1;){var s=r[a];if(s.clientHeight>n.minHeight)return void(f.value=a);(i+=s?s.clientWidth+6:0)>=t-40&&(o=a),a+=1}o===r.length-1&&i<=t?f.value=-1:f.value=i>=t-40?o:o-1}}return(0,t.watch)((function(){return n.modelValue}),(function(e){if(null==e?void 0:e.length){var t=[];e.forEach((function(e){var r,i=v.value.find((function(t){return t.id===e.id&&t.name===e.name}));if((null==i?void 0:i.toValueKey())===JSON.stringify(e))i.values=e.values||[],t.push(i);else{var o=n.data.find((function(t){return t.id===e.id})),a="default";o||(o=n.conditions.find((function(t){return t.id===e.id})))&&(a="condition"),o||(null===(r=e.values)||void 0===r?void 0:r.length)||(a="text");var l=new C(o||e,a);l.values=e.values||[],t.push(l)}})),v.value=t}else v.value=[]}),{immediate:!0,deep:!0}),(0,t.onMounted)((function(){d(l.value.querySelector(".bk-search-select-container"),p)})),(0,t.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",h),e.removeChild(e.__resize_triggers__.triggers),e.__resize_triggers__=null),e.__resize_listeners__=null}!--s&&c&&c.parentNode.removeChild(c)}}(l.value.querySelector(".bk-search-select-container"),p)})),i={onEditClick:g,onEditEnter:y,onEditBlur:function(){m.value="",w("")},onValidate:w,editKey:m},(0,t.provide)(S,i),{inputRef:a,wrapRef:l,isFocus:u,selectedList:v,overflowIndex:f,validateStr:_,onEditClick:g,onEditEnter:y,handleWrapClick:function(){m.value||a.value.handleInputFocus()},handleInputFocus:function(e){e&&(f.value=-1),u.value=e},handleResize:b,handleClearAll:function(){v.value=[],f.value=-1,o("update:modelValue",[])},handleInputOutside:function(e){var t;return!(null===(t=l.value)||void 0===t?void 0:t.contains(e))},handleAddSelected:function(e){var t=v.value.slice();t.push(e),w(""),o("update:modelValue",t.map((function(e){return e.toValue()})))},handleDeleteSelected:function(e){var t=v.value.slice();t.splice("number"==typeof e?e:v.value.length-1,1),w(""),o("update:modelValue",t.map((function(e){return e.toValue()})))}}},render:function(){var e,n,r=this,i="".concat(!this.shrink||this.isFocus?this.maxHeight:this.minHeight,"px"),o=!!this.selectedList.length&&"condition"!==this.selectedList.slice(-1)[0].type,a=Object.assign({},this.$slots.menu?{menu:function(e){var t,n;return null===(n=(t=r.$slots).menu)||void 0===n?void 0:n.call(t,e)}}:{});return(0,t.createVNode)("div",{class:"bk-search-select",ref:"wrapRef"},[(0,t.createVNode)("div",{class:{"bk-search-select-container":!0,"is-focus":this.isFocus},onClick:this.handleWrapClick},[(0,t.createVNode)("div",{class:"search-prefix"},[null===(n=(e=this.$slots).prepend)||void 0===n?void 0:n.call(e)]),(0,t.createVNode)("div",{class:"search-container",style:{maxHeight:i}},[(0,t.createVNode)(z,{data:this.data,conditions:this.conditions,selectedList:this.selectedList,overflowIndex:this.overflowIndex,geMenuList:this.getMenuList,validateValues:this.validateValues,onDelete:this.handleDeleteSelected},Object.assign({},a)),(0,t.createVNode)("div",{class:"search-container-input"},[(0,t.createVNode)(N,{ref:"inputRef",data:this.data,showInputBefore:!this.selectedList.length,showCondition:o,conditions:this.conditions,clickOutside:this.handleInputOutside,geMenuList:this.getMenuList,validateValues:this.validateValues,onAdd:this.handleAddSelected,onDelete:this.handleDeleteSelected,onFocus:this.handleInputFocus},Object.assign({},a))])]),(0,t.createVNode)("div",{class:"search-nextfix"},[this.clearable&&!!this.selectedList.length&&(0,t.createVNode)(_.Close,{class:"search-clear",onClick:this.handleClearAll},null),this.$slots.append?this.$slots.append():(0,t.createVNode)(_.Search,{class:"search-nextfix-icon ".concat(this.isFocus?"is-focus":"")},null)])]),!!this.validateStr.length&&(0,t.createVNode)("div",{class:"bk-search-select-tips"},[this.$slots.validate?this.$slots.validate():(0,t.createVNode)(t.Fragment,null,[(0,t.createVNode)(_.ExclamationCircleShape,{class:"select-tips"},null),this.validateStr||""])])])}});var T=(0,e.withInstall)(F);const j=T})(),u})()));
|