bkui-vue 0.0.1-beta.442 → 0.0.1-beta.444
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 +18 -18
- package/dist/index.esm.js +32 -12
- package/dist/index.umd.js +18 -18
- package/lib/search-select/index.d.ts +47 -3
- package/lib/search-select/index.js +1 -1
- package/lib/search-select/input.d.ts +2 -0
- package/lib/search-select/search-select.d.ts +17 -1
- package/lib/search-select/selected.d.ts +2 -0
- package/lib/table/components/table-column.d.ts +35 -39
- package/lib/table/index.d.ts +101 -117
- package/lib/table/index.js +1 -1
- package/lib/table/props.d.ts +3 -0
- package/lib/table-column/index.d.ts +101 -117
- package/lib/table-column/index.js +1 -1
- package/package.json +1 -1
@@ -42,6 +42,7 @@ declare const BkSearchSelect: {
|
|
42
42
|
type: BooleanConstructor;
|
43
43
|
default: boolean;
|
44
44
|
};
|
45
|
+
placeholder: StringConstructor;
|
45
46
|
getMenuList: import("vue").PropType<import("./utils").GetMenuListFunc>;
|
46
47
|
validateValues: import("vue").PropType<import("./utils").ValidateValuesFunc>;
|
47
48
|
valueSplitCode: {
|
@@ -59,6 +60,7 @@ declare const BkSearchSelect: {
|
|
59
60
|
};
|
60
61
|
}>> & {
|
61
62
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
63
|
+
onSearch?: (...args: any[]) => any;
|
62
64
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "data" | "maxHeight" | "minHeight" | "clearable" | "modelValue" | "conditions" | "valueBehavior" | "valueSplitCode" | "shrink" | "uniqueSelect">;
|
63
65
|
$attrs: {
|
64
66
|
[x: string]: unknown;
|
@@ -71,7 +73,7 @@ declare const BkSearchSelect: {
|
|
71
73
|
}>;
|
72
74
|
$root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
|
73
75
|
$parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
|
74
|
-
$emit: (event: "update:modelValue", ...args: any[]) => void;
|
76
|
+
$emit: (event: "search" | "update:modelValue", ...args: any[]) => void;
|
75
77
|
$el: any;
|
76
78
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
77
79
|
data: {
|
@@ -102,6 +104,7 @@ declare const BkSearchSelect: {
|
|
102
104
|
type: BooleanConstructor;
|
103
105
|
default: boolean;
|
104
106
|
};
|
107
|
+
placeholder: StringConstructor;
|
105
108
|
getMenuList: import("vue").PropType<import("./utils").GetMenuListFunc>;
|
106
109
|
validateValues: import("vue").PropType<import("./utils").ValidateValuesFunc>;
|
107
110
|
valueSplitCode: {
|
@@ -119,6 +122,7 @@ declare const BkSearchSelect: {
|
|
119
122
|
};
|
120
123
|
}>> & {
|
121
124
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
125
|
+
onSearch?: (...args: any[]) => any;
|
122
126
|
}, {
|
123
127
|
inputRef: import("vue").Ref<import("vue").DefineComponent<{
|
124
128
|
data: {
|
@@ -128,6 +132,7 @@ declare const BkSearchSelect: {
|
|
128
132
|
showInputBefore: BooleanConstructor;
|
129
133
|
showCondition: BooleanConstructor;
|
130
134
|
clickOutside: FunctionConstructor;
|
135
|
+
placeholder: StringConstructor;
|
131
136
|
conditions: {
|
132
137
|
type: import("vue").PropType<import("./utils").ICommonItem[]>;
|
133
138
|
default: () => any[];
|
@@ -193,6 +198,7 @@ declare const BkSearchSelect: {
|
|
193
198
|
showInputBefore: BooleanConstructor;
|
194
199
|
showCondition: BooleanConstructor;
|
195
200
|
clickOutside: FunctionConstructor;
|
201
|
+
placeholder: StringConstructor;
|
196
202
|
conditions: {
|
197
203
|
type: import("vue").PropType<import("./utils").ICommonItem[]>;
|
198
204
|
default: () => any[];
|
@@ -311,8 +317,18 @@ declare const BkSearchSelect: {
|
|
311
317
|
handleInputOutside: (target: Node) => boolean;
|
312
318
|
handleAddSelected: (item: import("./utils").SelectedItem) => void;
|
313
319
|
handleDeleteSelected: (index?: number) => void;
|
320
|
+
handleClickSearch: (e: MouseEvent) => void;
|
314
321
|
localConditions: import("vue").ComputedRef<import("./utils").ICommonItem[]>;
|
315
|
-
|
322
|
+
t: import("vue").ComputedRef<{
|
323
|
+
pleaseSelect: string;
|
324
|
+
loading: string;
|
325
|
+
filterQueryMustHasValue: string;
|
326
|
+
ok: string;
|
327
|
+
cancel: string;
|
328
|
+
or: string;
|
329
|
+
and: string;
|
330
|
+
}>;
|
331
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("search" | "update:modelValue")[], string, {
|
316
332
|
data: import("./utils").ISearchItem[];
|
317
333
|
maxHeight: number;
|
318
334
|
minHeight: number;
|
@@ -372,6 +388,7 @@ declare const BkSearchSelect: {
|
|
372
388
|
type: BooleanConstructor;
|
373
389
|
default: boolean;
|
374
390
|
};
|
391
|
+
placeholder: StringConstructor;
|
375
392
|
getMenuList: import("vue").PropType<import("./utils").GetMenuListFunc>;
|
376
393
|
validateValues: import("vue").PropType<import("./utils").ValidateValuesFunc>;
|
377
394
|
valueSplitCode: {
|
@@ -389,6 +406,7 @@ declare const BkSearchSelect: {
|
|
389
406
|
};
|
390
407
|
}>> & {
|
391
408
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
409
|
+
onSearch?: (...args: any[]) => any;
|
392
410
|
} & import("vue").ShallowUnwrapRef<{
|
393
411
|
inputRef: import("vue").Ref<import("vue").DefineComponent<{
|
394
412
|
data: {
|
@@ -398,6 +416,7 @@ declare const BkSearchSelect: {
|
|
398
416
|
showInputBefore: BooleanConstructor;
|
399
417
|
showCondition: BooleanConstructor;
|
400
418
|
clickOutside: FunctionConstructor;
|
419
|
+
placeholder: StringConstructor;
|
401
420
|
conditions: {
|
402
421
|
type: import("vue").PropType<import("./utils").ICommonItem[]>;
|
403
422
|
default: () => any[];
|
@@ -463,6 +482,7 @@ declare const BkSearchSelect: {
|
|
463
482
|
showInputBefore: BooleanConstructor;
|
464
483
|
showCondition: BooleanConstructor;
|
465
484
|
clickOutside: FunctionConstructor;
|
485
|
+
placeholder: StringConstructor;
|
466
486
|
conditions: {
|
467
487
|
type: import("vue").PropType<import("./utils").ICommonItem[]>;
|
468
488
|
default: () => any[];
|
@@ -581,7 +601,17 @@ declare const BkSearchSelect: {
|
|
581
601
|
handleInputOutside: (target: Node) => boolean;
|
582
602
|
handleAddSelected: (item: import("./utils").SelectedItem) => void;
|
583
603
|
handleDeleteSelected: (index?: number) => void;
|
604
|
+
handleClickSearch: (e: MouseEvent) => void;
|
584
605
|
localConditions: import("vue").ComputedRef<import("./utils").ICommonItem[]>;
|
606
|
+
t: import("vue").ComputedRef<{
|
607
|
+
pleaseSelect: string;
|
608
|
+
loading: string;
|
609
|
+
filterQueryMustHasValue: string;
|
610
|
+
ok: string;
|
611
|
+
cancel: string;
|
612
|
+
or: string;
|
613
|
+
and: string;
|
614
|
+
}>;
|
585
615
|
}> & {} & {} & import("vue").ComponentCustomProperties;
|
586
616
|
__isFragment?: never;
|
587
617
|
__isTeleport?: never;
|
@@ -615,6 +645,7 @@ declare const BkSearchSelect: {
|
|
615
645
|
type: BooleanConstructor;
|
616
646
|
default: boolean;
|
617
647
|
};
|
648
|
+
placeholder: StringConstructor;
|
618
649
|
getMenuList: import("vue").PropType<import("./utils").GetMenuListFunc>;
|
619
650
|
validateValues: import("vue").PropType<import("./utils").ValidateValuesFunc>;
|
620
651
|
valueSplitCode: {
|
@@ -632,6 +663,7 @@ declare const BkSearchSelect: {
|
|
632
663
|
};
|
633
664
|
}>> & {
|
634
665
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
666
|
+
onSearch?: (...args: any[]) => any;
|
635
667
|
}, {
|
636
668
|
inputRef: import("vue").Ref<import("vue").DefineComponent<{
|
637
669
|
data: {
|
@@ -641,6 +673,7 @@ declare const BkSearchSelect: {
|
|
641
673
|
showInputBefore: BooleanConstructor;
|
642
674
|
showCondition: BooleanConstructor;
|
643
675
|
clickOutside: FunctionConstructor;
|
676
|
+
placeholder: StringConstructor;
|
644
677
|
conditions: {
|
645
678
|
type: import("vue").PropType<import("./utils").ICommonItem[]>;
|
646
679
|
default: () => any[];
|
@@ -706,6 +739,7 @@ declare const BkSearchSelect: {
|
|
706
739
|
showInputBefore: BooleanConstructor;
|
707
740
|
showCondition: BooleanConstructor;
|
708
741
|
clickOutside: FunctionConstructor;
|
742
|
+
placeholder: StringConstructor;
|
709
743
|
conditions: {
|
710
744
|
type: import("vue").PropType<import("./utils").ICommonItem[]>;
|
711
745
|
default: () => any[];
|
@@ -824,8 +858,18 @@ declare const BkSearchSelect: {
|
|
824
858
|
handleInputOutside: (target: Node) => boolean;
|
825
859
|
handleAddSelected: (item: import("./utils").SelectedItem) => void;
|
826
860
|
handleDeleteSelected: (index?: number) => void;
|
861
|
+
handleClickSearch: (e: MouseEvent) => void;
|
827
862
|
localConditions: import("vue").ComputedRef<import("./utils").ICommonItem[]>;
|
828
|
-
|
863
|
+
t: import("vue").ComputedRef<{
|
864
|
+
pleaseSelect: string;
|
865
|
+
loading: string;
|
866
|
+
filterQueryMustHasValue: string;
|
867
|
+
ok: string;
|
868
|
+
cancel: string;
|
869
|
+
or: string;
|
870
|
+
and: string;
|
871
|
+
}>;
|
872
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("search" | "update:modelValue")[], "search" | "update:modelValue", {
|
829
873
|
data: import("./utils").ISearchItem[];
|
830
874
|
maxHeight: number;
|
831
875
|
minHeight: number;
|
@@ -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 C(r||[]);return a._invoke=function(e,t,n){var r=d;return function(i,a){if(r===f)throw new Error("Generator is already running");if(r===h){if("throw"===i)throw a;return N()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var l=L(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=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=f;var u=c(e,t,n);if("normal"===u.type){if(r=n.done?h:v,u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=h,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",f="executing",h="completed",p={};function m(){}function g(){}function _(){}var y={};u(y,a,(function(){return this}));var b=Object.getPrototypeOf,w=b&&b(b(V([])));w&&w!==n&&r.call(w,a)&&(y=w);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 L(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,L(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 S(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 I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function V(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:N}}function N(){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=V,C.prototype={constructor:C,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(I),!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),I(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;I(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:V(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:()=>B,default:()=>D});var e=u(4212),t=u(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 a(e,t,n){return(window.getComputedStyle(e,n||null)||{display:"none"})[t]}function o(e){if(!document.documentElement.contains(e))return{detached:!0,rendered:!1};for(var t=e;t!==document;){if("none"===a(t,"display"))return{detached:!1,rendered:!1};t=t.parentNode}return{detached:!1,rendered:!0}}var l=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,u=new ResizeObserver((function(){(e.__resize_observer_triggered__||(e.__resize_observer_triggered__=!0,e.offsetWidth!==n||e.offsetHeight!==r))&&h(e)})),s=o(e),d=s.detached,m=s.rendered;e.__resize_observer_triggered__=!1===d&&!1===m,e.__resize_observer__=u,u.observe(e)}else if(e.attachEvent&&e.addEventListener)e.__resize_legacy_resize_handler__=function(){h(e)},e.attachEvent("onresize",e.__resize_legacy_resize_handler__),document.addEventListener("DOMSubtreeModified",e.__resize_mutation_handler__);else if(l||(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=a(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"}),o=i("div"),l=i("div",{className:"resize-contract-trigger"});r.appendChild(o),n.appendChild(r),n.appendChild(l),e.appendChild(n),e.__resize_triggers__={triggers:n,expand:r,expandChild:o,contract:l},p(e),e.addEventListener("scroll",f,!0),e.__resize_last__={width:e.offsetWidth,height:e.offsetHeight}}(e),e.__resize_rendered__=o(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),l++}function v(){var e=o(this),t=e.rendered,n=e.detached;t!==this.__resize_rendered__&&(!n&&this.__resize_triggers__&&(p(this),this.addEventListener("scroll",f,!0)),this.__resize_rendered__=t,h(this))}function f(){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,a,o,l=(n=(t=(e=i).__resize_last__).width,r=t.height,a=e.offsetWidth,o=e.offsetHeight,a!==n||o!==r?{width:a,height:o}:null);l&&(i.__resize_last__=l,h(i))},n||(n=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){return setTimeout(e,16)}).bind(window)),n(t))}function h(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,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 m=u(2717),g=u(4061),_=u(6870),y=u(7162),b=u.n(y);function w(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 x=u(5537),k=u.n(x);const E=(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[]}}},emits:["selectItem","selectCondition","footerClick"],setup:function(e,n){var r=n.emit,i=(0,m.useLocale)("searchSelect"),a=(0,t.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,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 a=[],o=-1;return r=r.replace(/([.*/]{1})/gim,"\\$1"),n.replace(new RegExp("".concat(r),"igm"),(function(e,r){return 0===a.length&&0!==r?a.push(n.slice(0,r)):o>=0&&a.push(n.slice(o+e.length,r)),a.push((0,t.createVNode)("span",{class:"is-keyword"},[e])),o=r,e})),o>=0&&a.push(n.slice(o+i)),a.length?a:n}(n.name)},localFooterBtns:a}},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.localFooterBtns)||void 0===r?void 0:r.length)&&(0,t.createVNode)("div",{class:"menu-footer"},[this.localFooterBtns.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 S(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 C,V=Symbol("SEARCH_SLECT_PROVIDER_KEY"),N=function(){return(0,t.inject)(V)};!function(e){e.DEFAULT="default",e.EDIT="edit"}(C||(C={}));var z=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)}))}}])&&S(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const O=(0,t.defineComponent)({name:"SearchSelectInput",directives:{clickoutside:g.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:C.DEFAULT},getMenuList:Function,validateValues:Function,valueBehavior:String},emits:["focus","add","delete"],setup:function(n,r){var i=r.emit,a=r.expose,o=(0,m.useLocale)("searchSelect"),l=(0,t.ref)(null),u=(0,t.ref)(null),s=(0,t.ref)(""),c=(0,t.ref)(!1),d=(0,t.ref)(!1),v=(0,t.ref)(!1),f=(0,t.ref)(n.defautUsingItem),h=(0,t.ref)(""),p=(0,t.ref)(!1),g=(0,e.debounce)(300,M),_=!1,y=(0,t.ref)([]),x=(0,t.ref)([]),k=N(),E=k.editKey,L=k.onValidate,S=k.valueSplitCode;function V(e){switch(e.code){case"ArrowDown":case"ArrowUp":O(e);break;case"Enter":case"NumpadEnter":!function(e){if(_){e.preventDefault();var t=x.value.find((function(e){return e.id===h.value}));t&&j(t)}}(e)}}function O(e){var t;e.preventDefault(),null===(t=l.value)||void 0===t||t.blur();for(var n=x.value.length,r=n,i=x.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 a=x.value[i];if(a&&!a.disabled){r=-1;var o=document.getElementById(a.id);return null==o||o.focus(),void(h.value=a.id)}r-=1}}function T(e){A(),e&&M()}function F(e){var t;return w(this,void 0,void 0,b().mark((function r(){var a,o,l,u,d;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(s.value&&n.valueBehavior!==I.NEEDKEY){r.next=6;break}return r.abrupt("return");case 6:return a={id:s.value,name:s.value},r.next=9,B(a);case 9:if(r.sent){r.next=12;break}return r.abrupt("return");case 12:return i("add",new z(a,"text",S.value)),s.value="",M(),r.abrupt("return");case 16:if(null==(o=f.value.values)?void 0:o.length){r.next=43;break}if(!(null===(t=s.value)||void 0===t?void 0:t.length)){r.next=41;break}if(!s.value.includes(S.value)){r.next=29;break}return l=s.value.split(S.value),r.next=23,B({id:s.value,name:s.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:s.value,name:s.value},r.next=32,B(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),s.value="",f.value=null,A(!0),r.abrupt("return");case 41:return c.value=!0,r.abrupt("return");case 43:if(!s.value){r.next=56;break}return d={id:s.value,name:s.value},r.next=47,B(d);case 47:if(r.sent){r.next=50;break}return r.abrupt("return");case 50:return f.value.addValue(d),i("add",f.value),s.value="",f.value=null,A(!0),r.abrupt("return");case 56:return r.next=58,B();case 58:if(r.sent){r.next=61;break}return r.abrupt("return");case 61:q();case 62:case"end":return r.stop()}}),r)})))}function j(e,t){var r,i,a,o,u;return w(this,void 0,void 0,b().mark((function c(){var d,p;return b().wrap((function(c){for(;;)switch(c.prev=c.next){case 0:if(!(null===(r=e.value)||void 0===r?void 0:r.id)){c.next=8;break}if((n.valueBehavior!==I.NEEDKEY||!e.value)&&n.validateValues){c.next=8;break}return(d=new z(Object.assign(Object.assign({},e),{id:null!==(i=e.realId)&&void 0!==i?i:e.id}),t,S.value)).addValue(e.value),q(d),n.valueBehavior===I.NEEDKEY&&h.value&&A(!0),h.value="",c.abrupt("return");case 8:if(f.value&&(null===(a=null==l?void 0:l.value)||void 0===a?void 0:a.innerText)){c.next=16;break}return f.value=new z(e,t,S.value),s.value="",(p="condition"===t)&&q(),v.value=p||!!f.value.children.length,A(n.valueBehavior===I.NEEDKEY&&!!h.value),c.abrupt("return");case 16:if("condition"!==(null===(o=f.value)||void 0===o?void 0:o.type)){c.next=20;break}return f.value=new z(e,t,S.value),q(),c.abrupt("return");case 20:return f.value.addValue(e),c.next=23,B(e);case 23:if(c.sent){c.next=26;break}return c.abrupt("return");case 26:f.value.multiple||q(),n.valueBehavior===I.NEEDKEY&&(null===(u=f.value)||void 0===u?void 0:u.multiple)&&A();case 28:case"end":return c.stop()}}),c)})))}function B(e){return w(this,void 0,void 0,b().mark((function t(){var r,i,a,o;return b().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(f.value){t.next=4;break}return t.next=3,D(null,[e]);case 3:case 8:return t.abrupt("return",t.sent);case 4:if(r=f.value,i=r.searchItem,a=r.validate,o=r.values,!a||"function"!=typeof n.validateValues){t.next=9;break}return t.next=8,D(i,e?[e]:o);case 9:return L(""),t.abrupt("return",!0);case 11:case"end":return t.stop()}}),t)})))}function D(e,t){var r;return w(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=n.validateValues)||void 0===r?void 0:r.call(n,null!=e?e:null,t).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 A(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&(0,t.nextTick)().then((function(){M()})),d.value=!0,v.value=!0,c.value=!1;var n=setTimeout((function(){if(l.value){l.value.focus();var e=window.getSelection();0===e.focusOffset&&(e.selectAllChildren(l.value),e.collapseToEnd())}window.clearTimeout(n)}),0);i("focus",d.value)}function M(){var t,r,i,a,o;return w(this,void 0,void 0,b().mark((function l(){var u,c;return b().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(u=[],"function"!=typeof n.getMenuList||void 0!==(null===(r=null===(t=f.value)||void 0===t?void 0:t.searchItem)||void 0===r?void 0:r.async)&&!0!==f.value.searchItem.async){l.next=9;break}return p.value=!0,l.next=5,n.getMenuList(null===(i=f.value)||void 0===i?void 0:i.searchItem,s.value).catch((function(){return[]}));case 5:u=l.sent,p.value=!1,l.next=10;break;case 9:(null==f?void 0:f.value)?"condition"===f.value.type?u=n.conditions:(null===(o=f.value.values)||void 0===o?void 0:o.length)&&!f.value.multiple&&n.mode!==C.EDIT||(u=f.value.children.filter((function(e){return e.name.toLocaleLowerCase().includes(s.value.toLocaleLowerCase())}))):(null===(a=s.value)||void 0===a?void 0:a.length)?n.data.filter((function(e){return!e.isSelected})).forEach((function(t){var n,r;t.name.toLocaleLowerCase().includes(s.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:s.value,name:s.value}}))):(null===(r=t.children)||void 0===r||r.forEach((function(n){n.name.toLocaleLowerCase().includes(s.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:s.value,name:s.value}})))})):u=n.data.filter((function(e){return!e.isSelected})).slice();case 10:x.value=u,n.valueBehavior===I.NEEDKEY&&(c=u.find((function(e){return!e.disabled})))&&(!h.value||h.value&&!u.some((function(e){return e.id===h.value})))&&(h.value=c.id);case 12:case"end":return l.stop()}}),l)})))}function q(e){i("add",null!=e?e:f.value),f.value=null,s.value="",A(n.valueBehavior===I.NEEDKEY)}function K(){var e=l.value.innerText;"\n"===e[e.length-1]||"\r"===e[0]?(H(e.slice(0,-1)),K()):"\n"!==e[0]&&"\r"!==e[0]||(H(e.slice(1)),K())}function H(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";l.value&&(l.value.innerHTML=t||(null===(e=f.value)||void 0===e?void 0:e.inputInnerHtml)||"")}return(0,t.watch)(E,(function(){n.mode===C.DEFAULT&&E.value&&(v.value=!1)})),(0,t.watchEffect)((function(){s.value||H()}),{flush:"pre"}),(0,t.watch)([x,v],(function(){var e;(null===(e=x.value)||void 0===e?void 0:e.some((function(e){return!e.disabled})))&&v.value?_||(n.valueBehavior===I.NEEDKEY?h.value=x.value.find((function(e){return!e.disabled})).id:h.value="",_=!0,document.addEventListener("keydown",V)):(document.removeEventListener("keydown",V),_=!1,n.valueBehavior!==I.NEEDKEY&&(h.value=""))})),a({handleInputFocus:T,isFocus:d}),{popoverRef:u,inputRef:l,keyword:s,loading:p,remoteMenuList:y,menuList:x,menuHoverId:h,isFocus:d,usingItem:f,showPopover:v,showNoSelectValueError:c,debounceSetMenuList:g,documentArrowEvent:O,handleClickOutside:function(e){var t,r;!(null===(t=u.value)||void 0===t?void 0:t.contains(e.target))&&(null===(r=n.clickOutside)||void 0===r?void 0:r.call(n,e.target,u.value))&&(v.value=!1,d.value=!1,i("focus",d.value))},handleInputFocus:T,handleInputChange:function(e){var t,n,r,i,a,o,u,c,d;K();var v=e.target.innerText;if(/(\r|\n)/gm.test(v)||/\s{2}/gm.test(v))e.preventDefault(),v=v.replace(/(\r|\n)/gm,S.value).replace(/\s{2}/gm,""),l.value.innerText=v,A(),s.value=v.replace((null===(t=f.value)||void 0===t?void 0:t.keyInnerText)||"","").trim(),g();else if(!s.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 s.value=h,console.info("outerText",h),void g();!h&&(null==v?void 0:v.length)||(f.value=null),s.value=h?v:"",g()}else(null===(c=null===(u=f.value)||void 0===u?void 0:u.values)||void 0===c?void 0:c.length)||(s.value=v.replace(" "," ").replace((null===(d=f.value)||void 0===d?void 0:d.keyInnerText.replace(" "," "))||"","").trim(),A(),g())},handleInputKeyup:function(e){switch(e.code){case"Enter":case"NumpadEnter":if(n.valueBehavior===I.NEEDKEY&&x.value.some((function(e){return e.id===h.value})))return;F(e);break;case"Backspace":!function(){var e,r;if(!f.value&&!s.value)return i("delete"),void(0,t.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])||n.mode===C.EDIT&&!s.value)return f.value.values.splice(-1,1),s.value="",void A()}else s.value||(f.value=null,s.value="",M());L("")}();default:c.value=!1}},handleSelectItem:j,handleSelectCondtionItem:function(e){j(e,"condition")},handleMenuFooterClick:function(e){switch(e.id){case"confirm":F();break;case"cancel":f.value.values=[],v.value=!1}},t:o}},render:function(){var e,n,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===(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)(k(),{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?"":r.t.pleaseSelect,"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,[r.t.loading]):r.showNoSelectValueError?(0,t.createVNode)("div",null,[r.t.filterQueryMustHasValue]):(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)(E,{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}})}}),T=(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[]}},getMenuList:Function,validateValues:Function,valueBehavior:String},emits:["delete"],setup:function(e,n){var r=n.emit,i=(0,t.ref)(null),a=N(),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 z(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,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)(O,{ref:"inputRef",key:e.editKey.toString(),mode:C.EDIT,data:e.data,showCondition:!1,conditions:e.conditions,defautUsingItem:e.copySeletedItem(n),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,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)(_.Error,{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 F={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},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 j=(0,t.defineComponent)({name:"SearchSelect",directives:{clickoutside:g.clickoutside},props:F,emits:["update:modelValue"],setup:function(n,r){var i,a=r.emit,o=(0,m.useLocale)("searchSelect"),u=(0,t.computed)((function(){return void 0===n.conditions?[{id:"or",name:o.value.or},{id:"and",name:o.value.and}]:n.conditions})),s=(0,t.ref)(null),v=(0,t.ref)(null),h=(0,t.ref)(!1),p=(0,t.ref)([]),g=(0,t.ref)(-1),_=(0,e.debounce)(32,S),y=(0,t.ref)(""),b=(0,t.ref)(""),w=(0,t.computed)((function(){return n.valueSplitCode})),x=(0,t.shallowRef)([]);function k(e,t){y.value="".concat(e.id,"_").concat(t)}function E(e,t){var n=p.value.slice();n.splice(t,1,e),a("update:modelValue",n.map((function(e){return e.toValue()}))),y.value=""}function L(e){b.value=e||""}function S(){if(h.value||p.value.length<1)g.value=-1;else{for(var e=v.value.querySelector(".bk-search-select-container"),t=v.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<=t-40&&o<=r.length-1;){var l=r[o];if(l.clientHeight>n.minHeight)return void(g.value=o);(i+=l?l.clientWidth+6:0)>=t-40&&(a=o),o+=1}a===r.length-1&&i<=t?g.value=-1:g.value=i>=t-40?a:a-1}}return(0,t.watch)((function(){return n.data}),(function(){var e;x.value=JSON.parse(JSON.stringify(n.data)),null===(e=x.value)||void 0===e||e.forEach((function(e){e.isSelected=n.uniqueSelect&&!!n.modelValue.some((function(t){return t.id===e.id}))}))}),{immediate:!0}),(0,t.watch)((function(){return n.modelValue}),(function(e){var t,r;if(!(null==e?void 0:e.length))return p.value=[],void(null===(t=x.value)||void 0===t||t.forEach((function(e){e.isSelected=!1})));var i=[];e.forEach((function(e){var t,r=p.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=n.data.find((function(t){return t.id===e.id})),o="default";a||(a=n.conditions.find((function(t){return t.id===e.id})))&&(o="condition"),a||(null===(t=e.values)||void 0===t?void 0:t.length)||(o="text");var l=new z(a||e,o,w.value);l.values=e.values||[],i.push(l)}})),p.value=i,null===(r=x.value)||void 0===r||r.forEach((function(e){e.isSelected=n.uniqueSelect&&!!i.some((function(t){return t.id===e.id}))}))}),{immediate:!0,deep:!0}),(0,t.onMounted)((function(){d(v.value.querySelector(".bk-search-select-container"),_)})),(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",f),e.removeChild(e.__resize_triggers__.triggers),e.__resize_triggers__=null),e.__resize_listeners__=null}!--l&&c&&c.parentNode.removeChild(c)}}(v.value.querySelector(".bk-search-select-container"),_)})),i={onEditClick:k,onEditEnter:E,onEditBlur:function(){y.value="",L("")},onValidate:L,editKey:y,valueSplitCode:w},(0,t.provide)(V,i),{inputRef:s,wrapRef:v,isFocus:h,copyData:x,selectedList:p,overflowIndex:g,validateStr:b,splitCode:w,onEditClick:k,onEditEnter:E,handleWrapClick:function(){y.value||s.value.handleInputFocus()},handleInputFocus:function(e){e&&(g.value=-1),h.value=e},handleResize:S,handleClearAll:function(){p.value=[],g.value=-1,a("update:modelValue",[])},handleInputOutside:function(e){var t;return!(null===(t=v.value)||void 0===t?void 0:t.contains(e))},handleAddSelected:function(e){var t=p.value.slice();t.push(e),L(""),a("update:modelValue",t.map((function(e){return e.toValue()})))},handleDeleteSelected:function(e){var t=p.value.slice();t.splice("number"==typeof e?e:p.value.length-1,1),L(""),a("update:modelValue",t.map((function(e){return e.toValue()})))},localConditions:u}},render:function(){var e,n,r=this,i="".concat(!this.shrink||this.isFocus?this.maxHeight:this.minHeight,"px"),a=!!this.selectedList.length&&"condition"!==this.selectedList.slice(-1)[0].type,o=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)(T,{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({},o)),(0,t.createVNode)("div",{class:"search-container-input"},[(0,t.createVNode)(O,{ref:"inputRef",data:this.copyData,showInputBefore:!this.selectedList.length,showCondition:a,conditions:this.localConditions,clickOutside:this.handleInputOutside,getMenuList:this.getMenuList,validateValues:this.validateValues,valueBehavior:this.valueBehavior,onAdd:this.handleAddSelected,onDelete:this.handleDeleteSelected,onFocus:this.handleInputFocus},Object.assign({},o))])]),(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 B=(0,e.withInstall)(j);const D=B})(),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 c(e,t,n,r){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),o=new C(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 N()}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=s(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 s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d="suspendedStart",v="suspendedYield",h="executing",f="completed",p={};function m(){}function g(){}function _(){}var y={};u(y,a,(function(){return this}));var b=Object.getPrototypeOf,w=b&&b(b(V([])));w&&w!==n&&r.call(w,a)&&(y=w);var k=_.prototype=m.prototype=Object.create(y);function x(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=s(e[i],e,a);if("throw"!==u.type){var c=u.arg,d=c.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){c.value=e,o(c)}),(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=s(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 I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function V(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:N}}function N(){return{value:t,done:!0}}return g.prototype=_,u(k,"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(k),e},e.awrap=function(e){return{__await:e}},x(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(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},x(k),u(k,l,"Generator"),u(k,a,(function(){return this})),u(k,"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=V,C.prototype={constructor:C,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(I),!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"),c=r.call(o,"finallyLoc");if(u&&c){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(!c)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),I(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;I(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:V(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 c={};return(()=>{"use strict";u.r(c),u.d(c,{BkSearchSelect:()=>B,default:()=>D});var e=u(4212),t=u(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 a(e,t,n){return(window.getComputedStyle(e,n||null)||{display:"none"})[t]}function o(e){if(!document.documentElement.contains(e))return{detached:!0,rendered:!1};for(var t=e;t!==document;){if("none"===a(t,"display"))return{detached:!1,rendered:!1};t=t.parentNode}return{detached:!1,rendered:!0}}var l=0,s=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,u=new ResizeObserver((function(){(e.__resize_observer_triggered__||(e.__resize_observer_triggered__=!0,e.offsetWidth!==n||e.offsetHeight!==r))&&f(e)})),c=o(e),d=c.detached,m=c.rendered;e.__resize_observer_triggered__=!1===d&&!1===m,e.__resize_observer__=u,u.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(l||(s=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=a(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"}),o=i("div"),l=i("div",{className:"resize-contract-trigger"});r.appendChild(o),n.appendChild(r),n.appendChild(l),e.appendChild(n),e.__resize_triggers__={triggers:n,expand:r,expandChild:o,contract:l},p(e),e.addEventListener("scroll",h,!0),e.__resize_last__={width:e.offsetWidth,height:e.offsetHeight}}(e),e.__resize_rendered__=o(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),l++}function v(){var e=o(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,a,o,l=(n=(t=(e=i).__resize_last__).width,r=t.height,a=e.offsetWidth,o=e.offsetHeight,a!==n||o!==r?{width:a,height:o}: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,a=i.scrollWidth,o=i.scrollHeight,l=n.offsetWidth,u=n.offsetHeight,c=n.scrollWidth,s=n.scrollHeight;i.scrollLeft=a,i.scrollTop=o,r.style.width=l+1+"px",r.style.height=u+1+"px",n.scrollLeft=c,n.scrollTop=s}var m=u(2717),g=u(4061),_=u(6870),y=u(7162),b=u.n(y);function w(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),x=u.n(k);const E=(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[]}}},emits:["selectItem","selectCondition","footerClick"],setup:function(e,n){var r=n.emit,i=(0,m.useLocale)("searchSelect"),a=(0,t.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,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 a=[],o=-1;return r=r.replace(/([.*/]{1})/gim,"\\$1"),n.replace(new RegExp("".concat(r),"igm"),(function(e,r){return 0===a.length&&0!==r?a.push(n.slice(0,r)):o>=0&&a.push(n.slice(o+e.length,r)),a.push((0,t.createVNode)("span",{class:"is-keyword"},[e])),o=r,e})),o>=0&&a.push(n.slice(o+i)),a.length?a:n}(n.name)},localFooterBtns:a}},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.localFooterBtns)||void 0===r?void 0:r.length)&&(0,t.createVNode)("div",{class:"menu-footer"},[this.localFooterBtns.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 S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L(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 C,V=Symbol("SEARCH_SLECT_PROVIDER_KEY"),N=function(){return(0,t.inject)(V)};!function(e){e.DEFAULT="default",e.EDIT="edit"}(C||(C={}));var z=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]:"|";S(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)}))}}])&&L(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const O=(0,t.defineComponent)({name:"SearchSelectInput",directives:{clickoutside:g.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:C.DEFAULT},getMenuList:Function,validateValues:Function,valueBehavior:String},emits:["focus","add","delete"],setup:function(n,r){var i=r.emit,a=r.expose,o=(0,m.useLocale)("searchSelect"),l=(0,t.ref)(null),u=(0,t.ref)(null),c=(0,t.ref)(""),s=(0,t.ref)(!1),d=(0,t.ref)(!1),v=(0,t.ref)(!1),h=(0,t.ref)(n.defautUsingItem),f=(0,t.ref)(""),p=(0,t.ref)(!1),g=(0,e.debounce)(300,q),_=!1,y=(0,t.ref)([]),k=(0,t.ref)([]),x=N(),E=x.editKey,S=x.onValidate,L=x.valueSplitCode;function V(e){switch(e.code){case"ArrowDown":case"ArrowUp":O(e);break;case"Enter":case"NumpadEnter":!function(e){if(_){e.preventDefault();var t=k.value.find((function(e){return e.id===f.value}));t&&j(t)}}(e)}}function O(e){var t;e.preventDefault(),null===(t=l.value)||void 0===t||t.blur();for(var n=k.value.length,r=n,i=k.value.findIndex((function(e){return e.id===f.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(f.value=a.id)}r-=1}}function T(e){A(),e&&q()}function F(e){var t;return w(this,void 0,void 0,b().mark((function r(){var a,o,l,u,d;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(h.value){r.next=16;break}if(c.value&&n.valueBehavior!==I.NEEDKEY){r.next=6;break}return r.abrupt("return");case 6:return a={id:c.value,name:c.value},r.next=9,B(a);case 9:if(r.sent){r.next=12;break}return r.abrupt("return");case 12:return i("add",new z(a,"text",L.value)),c.value="",q(),r.abrupt("return");case 16:if(null==(o=h.value.values)?void 0:o.length){r.next=43;break}if(!(null===(t=c.value)||void 0===t?void 0:t.length)){r.next=41;break}if(!c.value.includes(L.value)){r.next=29;break}return l=c.value.split(L.value),r.next=23,B({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 h.value.addValue({id:e,name:e})})),r.next=36;break;case 29:return u={id:c.value,name:c.value},r.next=32,B(u);case 32:if(r.sent){r.next=35;break}return r.abrupt("return");case 35:h.value.addValue(u);case 36:return i("add",h.value),c.value="",h.value=null,A(!0),r.abrupt("return");case 41:return s.value=!0,r.abrupt("return");case 43:if(!c.value){r.next=56;break}return d={id:c.value,name:c.value},r.next=47,B(d);case 47:if(r.sent){r.next=50;break}return r.abrupt("return");case 50:return h.value.addValue(d),i("add",h.value),c.value="",h.value=null,A(!0),r.abrupt("return");case 56:return r.next=58,B();case 58:if(r.sent){r.next=61;break}return r.abrupt("return");case 61:M();case 62:case"end":return r.stop()}}),r)})))}function j(e,t){var r,i,a,o,u;return w(this,void 0,void 0,b().mark((function s(){var d,p;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((n.valueBehavior!==I.NEEDKEY||!e.value)&&n.validateValues){s.next=8;break}return(d=new z(Object.assign(Object.assign({},e),{id:null!==(i=e.realId)&&void 0!==i?i:e.id}),t,L.value)).addValue(e.value),M(d),n.valueBehavior===I.NEEDKEY&&f.value&&A(!0),f.value="",s.abrupt("return");case 8:if(h.value&&(null===(a=null==l?void 0:l.value)||void 0===a?void 0:a.innerText)){s.next=16;break}return h.value=new z(e,t,L.value),c.value="",(p="condition"===t)&&M(),v.value=p||!!h.value.children.length,A(n.valueBehavior===I.NEEDKEY&&!!f.value),s.abrupt("return");case 16:if("condition"!==(null===(o=h.value)||void 0===o?void 0:o.type)){s.next=20;break}return h.value=new z(e,t,L.value),M(),s.abrupt("return");case 20:return h.value.addValue(e),s.next=23,B(e);case 23:if(s.sent){s.next=26;break}return s.abrupt("return");case 26:h.value.multiple||M(),n.valueBehavior===I.NEEDKEY&&(null===(u=h.value)||void 0===u?void 0:u.multiple)&&A();case 28:case"end":return s.stop()}}),s)})))}function B(e){return w(this,void 0,void 0,b().mark((function t(){var r,i,a,o;return b().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(h.value){t.next=4;break}return t.next=3,D(null,[e]);case 3:case 8:return t.abrupt("return",t.sent);case 4:if(r=h.value,i=r.searchItem,a=r.validate,o=r.values,!a||"function"!=typeof n.validateValues){t.next=9;break}return t.next=8,D(i,e?[e]:o);case 9:return S(""),t.abrupt("return",!0);case 11:case"end":return t.stop()}}),t)})))}function D(e,t){var r;return w(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=n.validateValues)||void 0===r?void 0:r.call(n,null!=e?e:null,t).catch((function(){return!1}));case 2:if("string"!=typeof(a=i.sent)&&!1!==a){i.next=6;break}return S(a||"校验错误"),i.abrupt("return",!1);case 6:return S(""),i.abrupt("return",!0);case 8:case"end":return i.stop()}}),i)})))}function A(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&(0,t.nextTick)().then((function(){q()})),d.value=!0,v.value=!0,s.value=!1;var n=setTimeout((function(){if(l.value){l.value.focus();var e=window.getSelection();0===e.focusOffset&&(e.selectAllChildren(l.value),e.collapseToEnd())}window.clearTimeout(n)}),0);i("focus",d.value)}function q(){var t,r,i,a,o;return w(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 n.getMenuList||void 0!==(null===(r=null===(t=h.value)||void 0===t?void 0:t.searchItem)||void 0===r?void 0:r.async)&&!0!==h.value.searchItem.async){l.next=9;break}return p.value=!0,l.next=5,n.getMenuList(null===(i=h.value)||void 0===i?void 0:i.searchItem,c.value).catch((function(){return[]}));case 5:u=l.sent,p.value=!1,l.next=10;break;case 9:(null==h?void 0:h.value)?"condition"===h.value.type?u=n.conditions:(null===(o=h.value.values)||void 0===o?void 0:o.length)&&!h.value.multiple&&n.mode!==C.EDIT||(u=h.value.children.filter((function(e){return e.name.toLocaleLowerCase().includes(c.value.toLocaleLowerCase())}))):(null===(a=c.value)||void 0===a?void 0:a.length)?n.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=n.data.filter((function(e){return!e.isSelected})).slice();case 10:k.value=u,n.valueBehavior===I.NEEDKEY&&(s=u.find((function(e){return!e.disabled})))&&(!f.value||f.value&&!u.some((function(e){return e.id===f.value})))&&(f.value=s.id);case 12:case"end":return l.stop()}}),l)})))}function M(e){i("add",null!=e?e:h.value),h.value=null,c.value="",A(n.valueBehavior===I.NEEDKEY)}function K(){var e=l.value.innerText;"\n"===e[e.length-1]||"\r"===e[0]?(H(e.slice(0,-1)),K()):"\n"!==e[0]&&"\r"!==e[0]||(H(e.slice(1)),K())}function H(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";l.value&&(l.value.innerHTML=t||(null===(e=h.value)||void 0===e?void 0:e.inputInnerHtml)||"")}return(0,t.watch)(E,(function(){n.mode===C.DEFAULT&&E.value&&(v.value=!1)})),(0,t.watchEffect)((function(){c.value||H()}),{flush:"pre"}),(0,t.watch)([k,v],(function(){var e;(null===(e=k.value)||void 0===e?void 0:e.some((function(e){return!e.disabled})))&&v.value?_||(n.valueBehavior===I.NEEDKEY?f.value=k.value.find((function(e){return!e.disabled})).id:f.value="",_=!0,document.addEventListener("keydown",V)):(document.removeEventListener("keydown",V),_=!1,n.valueBehavior!==I.NEEDKEY&&(f.value=""))})),a({handleInputFocus:T,isFocus:d}),{popoverRef:u,inputRef:l,keyword:c,loading:p,remoteMenuList:y,menuList:k,menuHoverId:f,isFocus:d,usingItem:h,showPopover:v,showNoSelectValueError:s,debounceSetMenuList:g,documentArrowEvent:O,handleClickOutside:function(e){var t,r;!(null===(t=u.value)||void 0===t?void 0:t.contains(e.target))&&(null===(r=n.clickOutside)||void 0===r?void 0:r.call(n,e.target,u.value))&&(v.value=!1,d.value=!1,i("focus",d.value))},handleInputFocus:T,handleInputChange:function(e){var t,n,r,i,a,o,u,s,d;K();var v=e.target.innerText;if(/(\r|\n)/gm.test(v)||/\s{2}/gm.test(v))e.preventDefault(),v=v.replace(/(\r|\n)/gm,L.value).replace(/\s{2}/gm,""),l.value.innerText=v,A(),c.value=v.replace((null===(t=h.value)||void 0===t?void 0:t.keyInnerText)||"","").trim(),g();else if(!c.value&&v.length<((null===(r=null===(n=h.value)||void 0===n?void 0:n.inputInnerText)||void 0===r?void 0:r.length)||1)){var f=v.replace(" "," ").replace((null===(i=h.value)||void 0===i?void 0:i.keyInnerText.replace(" "," ").trim())||"","").trim();if(v&&(null===(a=h.value)||void 0===a?void 0:a.keyInnerText)&&v.replace(" "," ").includes(h.value.keyInnerText.replace(" "," ").trim())&&f&&(null===(o=h.value.values)||void 0===o?void 0:o.length))return c.value=f,console.info("outerText",f),void g();!f&&(null==v?void 0:v.length)||(h.value=null),c.value=f?v:"",g()}else(null===(s=null===(u=h.value)||void 0===u?void 0:u.values)||void 0===s?void 0:s.length)||(c.value=v.replace(" "," ").replace((null===(d=h.value)||void 0===d?void 0:d.keyInnerText.replace(" "," "))||"","").trim(),A(),g())},handleInputKeyup:function(e){switch(e.code){case"Enter":case"NumpadEnter":if(n.valueBehavior===I.NEEDKEY&&k.value.some((function(e){return e.id===f.value})))return;F(e);break;case"Backspace":!function(){var e,r;if(!h.value&&!c.value)return i("delete"),void(0,t.nextTick)(q);if(null===(e=h.value)||void 0===e?void 0:e.values.length){if((null===(r=h.value)||void 0===r?void 0:r.multiple)||h.value.isInValueList(h.value.values[0])||n.mode===C.EDIT&&!c.value)return h.value.values.splice(-1,1),c.value="",void A()}else c.value||(h.value=null,c.value="",q());S("")}();default:s.value=!1}},handleSelectItem:j,handleSelectCondtionItem:function(e){j(e,"condition")},handleMenuFooterClick:function(e){switch(e.id){case"confirm":F();break;case"cancel":h.value.values=[],v.value=!1}},t:o}},render:function(){var e,n,r=this,i=this.usingItem||{},a=i.multiple,o=i.values,l=i.placeholder,u=i.inputInnerHtml,c=!(null===(e=this.keyword)||void 0===e?void 0:e.length)&&!(null==o?void 0:o.length)&&l,s=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:s},{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":c},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,t.resolveDirective)("clickoutside"),r.handleClickOutside]])},content:function(){var e;return r.loading?(0,t.createVNode)("div",null,[r.t.loading]):r.showNoSelectValueError?(0,t.createVNode)("div",null,[r.t.filterQueryMustHasValue]):(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)(E,{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}})}}),T=(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[]}},getMenuList:Function,validateValues:Function,valueBehavior:String},emits:["delete"],setup:function(e,n){var r=n.emit,i=(0,t.ref)(null),a=N(),o=a.onEditClick,l=a.onEditEnter,u=a.onEditBlur,c=a.editKey,s=a.valueSplitCode;return{inputRef:i,editKey:c,copySeletedItem:function(e){var t=new z(e.searchItem,e.type,s.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,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)(O,{ref:"inputRef",key:e.editKey.toString(),mode:C.EDIT,data:e.data,showCondition:!1,conditions:e.conditions,defautUsingItem:e.copySeletedItem(n),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,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)(_.Error,{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 F={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 j=(0,t.defineComponent)({name:"SearchSelect",directives:{clickoutside:g.clickoutside},props:F,emits:["update:modelValue","search"],setup:function(n,r){var i,a=r.emit,o=(0,m.useLocale)("searchSelect"),u=(0,t.computed)((function(){return void 0===n.conditions?[{id:"or",name:o.value.or},{id:"and",name:o.value.and}]:n.conditions})),c=(0,t.ref)(null),v=(0,t.ref)(null),f=(0,t.ref)(!1),p=(0,t.ref)([]),g=(0,t.ref)(-1),_=(0,e.debounce)(32,L),y=(0,t.ref)(""),b=(0,t.ref)(""),w=(0,t.computed)((function(){return n.valueSplitCode})),k=(0,t.shallowRef)([]);function x(e,t){y.value="".concat(e.id,"_").concat(t)}function E(e,t){var n=p.value.slice();n.splice(t,1,e),a("update:modelValue",n.map((function(e){return e.toValue()}))),y.value=""}function S(e){b.value=e||""}function L(){if(f.value||p.value.length<1)g.value=-1;else{for(var e=v.value.querySelector(".bk-search-select-container"),t=v.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<=t-40&&o<=r.length-1;){var l=r[o];if(l.clientHeight>n.minHeight)return void(g.value=o);(i+=l?l.clientWidth+6:0)>=t-40&&(a=o),o+=1}a===r.length-1&&i<=t?g.value=-1:g.value=i>=t-40?a:a-1}}return(0,t.watch)((function(){return n.data}),(function(){var e;k.value=JSON.parse(JSON.stringify(n.data)),null===(e=k.value)||void 0===e||e.forEach((function(e){e.isSelected=n.uniqueSelect&&!!n.modelValue.some((function(t){return t.id===e.id}))}))}),{immediate:!0}),(0,t.watch)((function(){return n.modelValue}),(function(e){var t,r;if(!(null==e?void 0:e.length))return p.value=[],void(null===(t=k.value)||void 0===t||t.forEach((function(e){e.isSelected=!1})));var i=[];e.forEach((function(e){var t,r=p.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=n.data.find((function(t){return t.id===e.id})),o="default";a||(a=n.conditions.find((function(t){return t.id===e.id})))&&(o="condition"),a||(null===(t=e.values)||void 0===t?void 0:t.length)||(o="text");var l=new z(a||e,o,w.value);l.values=e.values||[],i.push(l)}})),p.value=i,null===(r=k.value)||void 0===r||r.forEach((function(e){e.isSelected=n.uniqueSelect&&!!i.some((function(t){return t.id===e.id}))}))}),{immediate:!0,deep:!0}),(0,t.onMounted)((function(){d(v.value.querySelector(".bk-search-select-container"),_)})),(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}!--l&&s&&s.parentNode.removeChild(s)}}(v.value.querySelector(".bk-search-select-container"),_)})),i={onEditClick:x,onEditEnter:E,onEditBlur:function(){y.value="",S("")},onValidate:S,editKey:y,valueSplitCode:w},(0,t.provide)(V,i),{inputRef:c,wrapRef:v,isFocus:f,copyData:k,selectedList:p,overflowIndex:g,validateStr:b,splitCode:w,onEditClick:x,onEditEnter:E,handleWrapClick:function(){y.value||c.value.handleInputFocus()},handleInputFocus:function(e){var t;e&&(g.value=-1),!1===e&&(null===(t=v.value.querySelector(".bk-search-select-container"))||void 0===t||t.scrollTo(0,0)),f.value=e},handleResize:L,handleClearAll:function(){p.value=[],g.value=-1,a("update:modelValue",[])},handleInputOutside:function(e){var t;return!(null===(t=v.value)||void 0===t?void 0:t.contains(e))},handleAddSelected:function(e){var t=p.value.slice();t.push(e),S(""),a("update:modelValue",t.map((function(e){return e.toValue()})))},handleDeleteSelected:function(e){var t=p.value.slice();t.splice("number"==typeof e?e:p.value.length-1,1),S(""),a("update:modelValue",t.map((function(e){return e.toValue()})))},handleClickSearch:function(e){a("search",e)},localConditions:u,t:o}},render:function(){var e,n,r=this,i="".concat(!this.shrink||this.isFocus?this.maxHeight:this.minHeight,"px"),a=!!this.selectedList.length&&"condition"!==this.selectedList.slice(-1)[0].type,o=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)(T,{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({},o)),(0,t.createVNode)("div",{class:"search-container-input"},[(0,t.createVNode)(O,{ref:"inputRef",data:this.copyData,showInputBefore:!this.selectedList.length,showCondition:a,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({},o))])]),(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,{onClick:this.handleClickSearch,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 B=(0,e.withInstall)(j);const D=B})(),c})()));
|
@@ -8,6 +8,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
8
8
|
showInputBefore: BooleanConstructor;
|
9
9
|
showCondition: BooleanConstructor;
|
10
10
|
clickOutside: FunctionConstructor;
|
11
|
+
placeholder: StringConstructor;
|
11
12
|
conditions: {
|
12
13
|
type: PropType<ICommonItem[]>;
|
13
14
|
default: () => any[];
|
@@ -73,6 +74,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
73
74
|
showInputBefore: BooleanConstructor;
|
74
75
|
showCondition: BooleanConstructor;
|
75
76
|
clickOutside: FunctionConstructor;
|
77
|
+
placeholder: StringConstructor;
|
76
78
|
conditions: {
|
77
79
|
type: PropType<ICommonItem[]>;
|
78
80
|
default: () => any[];
|
@@ -29,6 +29,7 @@ export declare const SearchSelectProps: {
|
|
29
29
|
type: BooleanConstructor;
|
30
30
|
default: boolean;
|
31
31
|
};
|
32
|
+
placeholder: StringConstructor;
|
32
33
|
getMenuList: PropType<GetMenuListFunc>;
|
33
34
|
validateValues: PropType<ValidateValuesFunc>;
|
34
35
|
valueSplitCode: {
|
@@ -74,6 +75,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
74
75
|
type: BooleanConstructor;
|
75
76
|
default: boolean;
|
76
77
|
};
|
78
|
+
placeholder: StringConstructor;
|
77
79
|
getMenuList: PropType<GetMenuListFunc>;
|
78
80
|
validateValues: PropType<ValidateValuesFunc>;
|
79
81
|
valueSplitCode: {
|
@@ -98,6 +100,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
98
100
|
showInputBefore: BooleanConstructor;
|
99
101
|
showCondition: BooleanConstructor;
|
100
102
|
clickOutside: FunctionConstructor;
|
103
|
+
placeholder: StringConstructor;
|
101
104
|
conditions: {
|
102
105
|
type: PropType<ICommonItem[]>;
|
103
106
|
default: () => any[];
|
@@ -163,6 +166,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
163
166
|
showInputBefore: BooleanConstructor;
|
164
167
|
showCondition: BooleanConstructor;
|
165
168
|
clickOutside: FunctionConstructor;
|
169
|
+
placeholder: StringConstructor;
|
166
170
|
conditions: {
|
167
171
|
type: PropType<ICommonItem[]>;
|
168
172
|
default: () => any[];
|
@@ -281,8 +285,18 @@ declare const _default: import("vue").DefineComponent<{
|
|
281
285
|
handleInputOutside: (target: Node) => boolean;
|
282
286
|
handleAddSelected: (item: SelectedItem) => void;
|
283
287
|
handleDeleteSelected: (index?: number) => void;
|
288
|
+
handleClickSearch: (e: MouseEvent) => void;
|
284
289
|
localConditions: import("vue").ComputedRef<ICommonItem[]>;
|
285
|
-
|
290
|
+
t: import("vue").ComputedRef<{
|
291
|
+
pleaseSelect: string;
|
292
|
+
loading: string;
|
293
|
+
filterQueryMustHasValue: string;
|
294
|
+
ok: string;
|
295
|
+
cancel: string;
|
296
|
+
or: string;
|
297
|
+
and: string;
|
298
|
+
}>;
|
299
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("search" | "update:modelValue")[], "search" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
286
300
|
data: {
|
287
301
|
type: PropType<ISearchItem[]>;
|
288
302
|
default: () => any[];
|
@@ -311,6 +325,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
311
325
|
type: BooleanConstructor;
|
312
326
|
default: boolean;
|
313
327
|
};
|
328
|
+
placeholder: StringConstructor;
|
314
329
|
getMenuList: PropType<GetMenuListFunc>;
|
315
330
|
validateValues: PropType<ValidateValuesFunc>;
|
316
331
|
valueSplitCode: {
|
@@ -328,6 +343,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
328
343
|
};
|
329
344
|
}>> & {
|
330
345
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
346
|
+
onSearch?: (...args: any[]) => any;
|
331
347
|
}, {
|
332
348
|
data: ISearchItem[];
|
333
349
|
maxHeight: number;
|
@@ -29,6 +29,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
29
29
|
showInputBefore: BooleanConstructor;
|
30
30
|
showCondition: BooleanConstructor;
|
31
31
|
clickOutside: FunctionConstructor;
|
32
|
+
placeholder: StringConstructor;
|
32
33
|
conditions: {
|
33
34
|
type: PropType<ICommonItem[]>;
|
34
35
|
default: () => any[];
|
@@ -94,6 +95,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
94
95
|
showInputBefore: BooleanConstructor;
|
95
96
|
showCondition: BooleanConstructor;
|
96
97
|
clickOutside: FunctionConstructor;
|
98
|
+
placeholder: StringConstructor;
|
97
99
|
conditions: {
|
98
100
|
type: PropType<ICommonItem[]>;
|
99
101
|
default: () => any[];
|
@@ -49,6 +49,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
49
49
|
list: any[] | (object & (() => any[]));
|
50
50
|
filterFn: any;
|
51
51
|
match: "full" | "fuzzy";
|
52
|
+
checked: any[] | (object & (() => any[]));
|
52
53
|
filterScope: (object | "all" | "current" | (() => "all" | "current") | ((props: Record<string, unknown>) => "all" | "current")) & ("all" | "current");
|
53
54
|
btnSave: (string | boolean | object | (() => string | boolean) | ((props: Record<string, unknown>) => string | boolean)) & (string | boolean);
|
54
55
|
btnReset: (string | boolean | object | (() => string | boolean) | ((props: Record<string, unknown>) => string | boolean)) & (string | boolean);
|
@@ -57,6 +58,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
57
58
|
list: any[] | (object & (() => any[]));
|
58
59
|
filterFn: any;
|
59
60
|
match: "full" | "fuzzy";
|
61
|
+
checked: any[] | (object & (() => any[]));
|
60
62
|
filterScope: (object | "all" | "current" | (() => "all" | "current") | ((props: Record<string, unknown>) => "all" | "current")) & ("all" | "current");
|
61
63
|
btnSave: (string | boolean | object | (() => string | boolean) | ((props: Record<string, unknown>) => string | boolean)) & (string | boolean);
|
62
64
|
btnReset: (string | boolean | object | (() => string | boolean) | ((props: Record<string, unknown>) => string | boolean)) & (string | boolean);
|
@@ -72,50 +74,41 @@ declare const _default: import("vue").DefineComponent<{
|
|
72
74
|
queueStack: (_: any, fn: any) => any;
|
73
75
|
};
|
74
76
|
column: {
|
75
|
-
field:
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
77
|
+
field: any;
|
78
|
+
render: any;
|
79
|
+
fixed: boolean | "left" | "right";
|
80
|
+
sort: string | boolean | {
|
81
|
+
sortFn: any;
|
82
|
+
sortScope: (object | "all" | "current" | (() => "all" | "current") | ((props: Record<string, unknown>) => "all" | "current")) & ("all" | "current");
|
83
|
+
value: (string | object | (() => string) | ((props: Record<string, unknown>) => string)) & string;
|
84
|
+
};
|
85
|
+
filter: string | boolean | {
|
86
|
+
list: any[] | (object & (() => any[]));
|
87
|
+
filterFn: any;
|
88
|
+
match: "full" | "fuzzy";
|
89
|
+
checked: any[] | (object & (() => any[]));
|
90
|
+
filterScope: (object | "all" | "current" | (() => "all" | "current") | ((props: Record<string, unknown>) => "all" | "current")) & ("all" | "current");
|
91
|
+
btnSave: (string | boolean | object | (() => string | boolean) | ((props: Record<string, unknown>) => string | boolean)) & (string | boolean);
|
92
|
+
btnReset: (string | boolean | object | (() => string | boolean) | ((props: Record<string, unknown>) => string | boolean)) & (string | boolean);
|
93
|
+
};
|
94
|
+
type: "none" | "selection" | "index" | "expand";
|
95
|
+
label: any;
|
96
|
+
width: string | number;
|
97
|
+
minWidth: string | number;
|
98
|
+
className: any;
|
99
|
+
align: "" | "left" | "center" | "right";
|
100
|
+
index: number;
|
101
|
+
columnKey: string;
|
102
|
+
showOverflowTooltip: boolean | {
|
82
103
|
content: string | Function;
|
83
104
|
disabled?: boolean;
|
84
105
|
watchCellResize?: boolean;
|
85
106
|
mode?: "auto" | "static";
|
86
107
|
};
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
sortFn?: Function;
|
92
|
-
sortScope?: string;
|
93
|
-
value?: string;
|
94
|
-
};
|
95
|
-
filter?: string | boolean | {
|
96
|
-
list?: any;
|
97
|
-
filterFn?: Function;
|
98
|
-
};
|
99
|
-
colspan?: Function | {
|
100
|
-
toString: (radix?: number) => string;
|
101
|
-
toFixed: (fractionDigits?: number) => string;
|
102
|
-
toExponential: (fractionDigits?: number) => string;
|
103
|
-
toPrecision: (precision?: number) => string;
|
104
|
-
valueOf: () => number;
|
105
|
-
toLocaleString: (locales?: string | string[], options?: Intl.NumberFormatOptions) => string;
|
106
|
-
};
|
107
|
-
rowspan?: Function | {
|
108
|
-
toString: (radix?: number) => string;
|
109
|
-
toFixed: (fractionDigits?: number) => string;
|
110
|
-
toExponential: (fractionDigits?: number) => string;
|
111
|
-
toPrecision: (precision?: number) => string;
|
112
|
-
valueOf: () => number;
|
113
|
-
toLocaleString: (locales?: string | string[], options?: Intl.NumberFormatOptions) => string;
|
114
|
-
};
|
115
|
-
className?: string | Function;
|
116
|
-
align?: string;
|
117
|
-
prop?: string | Function;
|
118
|
-
index?: number;
|
108
|
+
resizable: boolean;
|
109
|
+
colspan: any;
|
110
|
+
rowspan: any;
|
111
|
+
prop: any;
|
119
112
|
};
|
120
113
|
}, unknown, {}, {
|
121
114
|
updateColumnDefine(unmounted?: boolean): void;
|
@@ -167,6 +160,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
167
160
|
list: any[] | (object & (() => any[]));
|
168
161
|
filterFn: any;
|
169
162
|
match: "full" | "fuzzy";
|
163
|
+
checked: any[] | (object & (() => any[]));
|
170
164
|
filterScope: (object | "all" | "current" | (() => "all" | "current") | ((props: Record<string, unknown>) => "all" | "current")) & ("all" | "current");
|
171
165
|
btnSave: (string | boolean | object | (() => string | boolean) | ((props: Record<string, unknown>) => string | boolean)) & (string | boolean);
|
172
166
|
btnReset: (string | boolean | object | (() => string | boolean) | ((props: Record<string, unknown>) => string | boolean)) & (string | boolean);
|
@@ -175,6 +169,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
175
169
|
list: any[] | (object & (() => any[]));
|
176
170
|
filterFn: any;
|
177
171
|
match: "full" | "fuzzy";
|
172
|
+
checked: any[] | (object & (() => any[]));
|
178
173
|
filterScope: (object | "all" | "current" | (() => "all" | "current") | ((props: Record<string, unknown>) => "all" | "current")) & ("all" | "current");
|
179
174
|
btnSave: (string | boolean | object | (() => string | boolean) | ((props: Record<string, unknown>) => string | boolean)) & (string | boolean);
|
180
175
|
btnReset: (string | boolean | object | (() => string | boolean) | ((props: Record<string, unknown>) => string | boolean)) & (string | boolean);
|
@@ -195,6 +190,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
195
190
|
list: any[] | (object & (() => any[]));
|
196
191
|
filterFn: any;
|
197
192
|
match: "full" | "fuzzy";
|
193
|
+
checked: any[] | (object & (() => any[]));
|
198
194
|
filterScope: (object | "all" | "current" | (() => "all" | "current") | ((props: Record<string, unknown>) => "all" | "current")) & ("all" | "current");
|
199
195
|
btnSave: (string | boolean | object | (() => string | boolean) | ((props: Record<string, unknown>) => string | boolean)) & (string | boolean);
|
200
196
|
btnReset: (string | boolean | object | (() => string | boolean) | ((props: Record<string, unknown>) => string | boolean)) & (string | boolean);
|