bkui-vue 0.0.1-beta.345 → 0.0.1-beta.347
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 +34 -34
- package/dist/index.esm.js +92 -43
- package/dist/index.umd.js +37 -37
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/search-select/index.d.ts +120 -7
- package/lib/search-select/index.js +1 -1
- package/lib/search-select/input.d.ts +4 -2
- package/lib/search-select/search-select.css +3 -2
- package/lib/search-select/search-select.d.ts +71 -20
- package/lib/search-select/search-select.less +8 -3
- package/lib/search-select/search-select.variable.css +3 -2
- package/lib/search-select/selected.d.ts +6 -4
- package/lib/search-select/utils.d.ts +7 -2
- package/package.json +1 -1
@@ -9,7 +9,9 @@ declare const BkSearchSelect: {
|
|
9
9
|
clearable: boolean;
|
10
10
|
modelValue: import("./utils").ISearchValue[];
|
11
11
|
conditions: import("./utils").ICommonItem[];
|
12
|
+
valueSplitCode: string;
|
12
13
|
shrink: boolean;
|
14
|
+
uniqueSelect: boolean;
|
13
15
|
}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
14
16
|
data: {
|
15
17
|
type: import("vue").PropType<import("./utils").ISearchItem[]>;
|
@@ -44,9 +46,17 @@ declare const BkSearchSelect: {
|
|
44
46
|
};
|
45
47
|
getMenuList: import("vue").PropType<import("./utils").GetMenuListFunc>;
|
46
48
|
validateValues: import("vue").PropType<import("./utils").ValidateValuesFunc>;
|
49
|
+
valueSplitCode: {
|
50
|
+
type: StringConstructor;
|
51
|
+
default: string;
|
52
|
+
};
|
53
|
+
uniqueSelect: {
|
54
|
+
type: BooleanConstructor;
|
55
|
+
default: boolean;
|
56
|
+
};
|
47
57
|
}>> & {
|
48
58
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
49
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "data" | "maxHeight" | "minHeight" | "clearable" | "modelValue" | "conditions" | "shrink">;
|
59
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "data" | "maxHeight" | "minHeight" | "clearable" | "modelValue" | "conditions" | "valueSplitCode" | "shrink" | "uniqueSelect">;
|
50
60
|
$attrs: {
|
51
61
|
[x: string]: unknown;
|
52
62
|
};
|
@@ -94,6 +104,14 @@ declare const BkSearchSelect: {
|
|
94
104
|
};
|
95
105
|
getMenuList: import("vue").PropType<import("./utils").GetMenuListFunc>;
|
96
106
|
validateValues: import("vue").PropType<import("./utils").ValidateValuesFunc>;
|
107
|
+
valueSplitCode: {
|
108
|
+
type: StringConstructor;
|
109
|
+
default: string;
|
110
|
+
};
|
111
|
+
uniqueSelect: {
|
112
|
+
type: BooleanConstructor;
|
113
|
+
default: boolean;
|
114
|
+
};
|
97
115
|
}>> & {
|
98
116
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
99
117
|
}, {
|
@@ -114,7 +132,7 @@ declare const BkSearchSelect: {
|
|
114
132
|
type: import("vue").PropType<import("./utils").SearchInputMode>;
|
115
133
|
default: import("./utils").SearchInputMode;
|
116
134
|
};
|
117
|
-
|
135
|
+
getMenuList: import("vue").PropType<import("./utils").GetMenuListFunc>;
|
118
136
|
validateValues: import("vue").PropType<import("./utils").ValidateValuesFunc>;
|
119
137
|
}, {
|
120
138
|
popoverRef: import("vue").Ref<HTMLDivElement>;
|
@@ -130,7 +148,9 @@ declare const BkSearchSelect: {
|
|
130
148
|
name: string;
|
131
149
|
id: string;
|
132
150
|
realId?: string;
|
151
|
+
isSelected?: boolean;
|
133
152
|
};
|
153
|
+
isSelected?: boolean;
|
134
154
|
}[]>;
|
135
155
|
menuList: import("vue").Ref<import("./utils").ISearchItem[]>;
|
136
156
|
menuHoverId: import("vue").Ref<string>;
|
@@ -167,7 +187,7 @@ declare const BkSearchSelect: {
|
|
167
187
|
type: import("vue").PropType<import("./utils").SearchInputMode>;
|
168
188
|
default: import("./utils").SearchInputMode;
|
169
189
|
};
|
170
|
-
|
190
|
+
getMenuList: import("vue").PropType<import("./utils").GetMenuListFunc>;
|
171
191
|
validateValues: import("vue").PropType<import("./utils").ValidateValuesFunc>;
|
172
192
|
}>> & {
|
173
193
|
onFocus?: (...args: any[]) => any;
|
@@ -181,6 +201,7 @@ declare const BkSearchSelect: {
|
|
181
201
|
}>>;
|
182
202
|
wrapRef: import("vue").Ref<HTMLDivElement>;
|
183
203
|
isFocus: import("vue").Ref<boolean>;
|
204
|
+
copyData: import("vue").Ref<import("./utils").ISearchItem[]>;
|
184
205
|
selectedList: import("vue").Ref<{
|
185
206
|
id: string;
|
186
207
|
name: string;
|
@@ -193,7 +214,9 @@ declare const BkSearchSelect: {
|
|
193
214
|
name: string;
|
194
215
|
id: string;
|
195
216
|
realId?: string;
|
217
|
+
isSelected?: boolean;
|
196
218
|
};
|
219
|
+
isSelected?: boolean;
|
197
220
|
}[];
|
198
221
|
condition: string;
|
199
222
|
searchItem: {
|
@@ -208,15 +231,32 @@ declare const BkSearchSelect: {
|
|
208
231
|
name: string;
|
209
232
|
id: string;
|
210
233
|
realId?: string;
|
234
|
+
isSelected?: boolean;
|
211
235
|
};
|
236
|
+
isSelected?: boolean;
|
212
237
|
}[];
|
213
238
|
multiple?: boolean;
|
214
239
|
async?: boolean;
|
215
240
|
noValidate?: boolean;
|
216
241
|
placeholder?: string;
|
217
242
|
disabled?: boolean;
|
243
|
+
value?: {
|
244
|
+
id: string;
|
245
|
+
name: string;
|
246
|
+
disabled?: boolean;
|
247
|
+
realId?: string;
|
248
|
+
value?: {
|
249
|
+
name: string;
|
250
|
+
id: string;
|
251
|
+
realId?: string;
|
252
|
+
isSelected?: boolean;
|
253
|
+
};
|
254
|
+
isSelected?: boolean;
|
255
|
+
};
|
256
|
+
isSelected?: boolean;
|
218
257
|
};
|
219
258
|
type: import("./utils").SearchItemType;
|
259
|
+
splitCode: string;
|
220
260
|
readonly multiple: boolean;
|
221
261
|
readonly placeholder: string;
|
222
262
|
readonly children: {
|
@@ -228,7 +268,9 @@ declare const BkSearchSelect: {
|
|
228
268
|
name: string;
|
229
269
|
id: string;
|
230
270
|
realId?: string;
|
271
|
+
isSelected?: boolean;
|
231
272
|
};
|
273
|
+
isSelected?: boolean;
|
232
274
|
}[];
|
233
275
|
readonly validate: boolean;
|
234
276
|
readonly inputInnerHtml: string;
|
@@ -243,6 +285,7 @@ declare const BkSearchSelect: {
|
|
243
285
|
}[]>;
|
244
286
|
overflowIndex: import("vue").Ref<number>;
|
245
287
|
validateStr: import("vue").Ref<string>;
|
288
|
+
splitCode: import("vue").ComputedRef<string>;
|
246
289
|
onEditClick: (item: import("./utils").SelectedItem, index: number) => void;
|
247
290
|
onEditEnter: (item: import("./utils").SelectedItem, index: number) => void;
|
248
291
|
handleWrapClick: () => void;
|
@@ -259,7 +302,9 @@ declare const BkSearchSelect: {
|
|
259
302
|
clearable: boolean;
|
260
303
|
modelValue: import("./utils").ISearchValue[];
|
261
304
|
conditions: import("./utils").ICommonItem[];
|
305
|
+
valueSplitCode: string;
|
262
306
|
shrink: boolean;
|
307
|
+
uniqueSelect: boolean;
|
263
308
|
}> & {
|
264
309
|
beforeCreate?: (() => void) | (() => void)[];
|
265
310
|
created?: (() => void) | (() => void)[];
|
@@ -314,6 +359,14 @@ declare const BkSearchSelect: {
|
|
314
359
|
};
|
315
360
|
getMenuList: import("vue").PropType<import("./utils").GetMenuListFunc>;
|
316
361
|
validateValues: import("vue").PropType<import("./utils").ValidateValuesFunc>;
|
362
|
+
valueSplitCode: {
|
363
|
+
type: StringConstructor;
|
364
|
+
default: string;
|
365
|
+
};
|
366
|
+
uniqueSelect: {
|
367
|
+
type: BooleanConstructor;
|
368
|
+
default: boolean;
|
369
|
+
};
|
317
370
|
}>> & {
|
318
371
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
319
372
|
} & import("vue").ShallowUnwrapRef<{
|
@@ -334,7 +387,7 @@ declare const BkSearchSelect: {
|
|
334
387
|
type: import("vue").PropType<import("./utils").SearchInputMode>;
|
335
388
|
default: import("./utils").SearchInputMode;
|
336
389
|
};
|
337
|
-
|
390
|
+
getMenuList: import("vue").PropType<import("./utils").GetMenuListFunc>;
|
338
391
|
validateValues: import("vue").PropType<import("./utils").ValidateValuesFunc>;
|
339
392
|
}, {
|
340
393
|
popoverRef: import("vue").Ref<HTMLDivElement>;
|
@@ -350,7 +403,9 @@ declare const BkSearchSelect: {
|
|
350
403
|
name: string;
|
351
404
|
id: string;
|
352
405
|
realId?: string;
|
406
|
+
isSelected?: boolean;
|
353
407
|
};
|
408
|
+
isSelected?: boolean;
|
354
409
|
}[]>;
|
355
410
|
menuList: import("vue").Ref<import("./utils").ISearchItem[]>;
|
356
411
|
menuHoverId: import("vue").Ref<string>;
|
@@ -387,7 +442,7 @@ declare const BkSearchSelect: {
|
|
387
442
|
type: import("vue").PropType<import("./utils").SearchInputMode>;
|
388
443
|
default: import("./utils").SearchInputMode;
|
389
444
|
};
|
390
|
-
|
445
|
+
getMenuList: import("vue").PropType<import("./utils").GetMenuListFunc>;
|
391
446
|
validateValues: import("vue").PropType<import("./utils").ValidateValuesFunc>;
|
392
447
|
}>> & {
|
393
448
|
onFocus?: (...args: any[]) => any;
|
@@ -401,6 +456,7 @@ declare const BkSearchSelect: {
|
|
401
456
|
}>>;
|
402
457
|
wrapRef: import("vue").Ref<HTMLDivElement>;
|
403
458
|
isFocus: import("vue").Ref<boolean>;
|
459
|
+
copyData: import("vue").Ref<import("./utils").ISearchItem[]>;
|
404
460
|
selectedList: import("vue").Ref<{
|
405
461
|
id: string;
|
406
462
|
name: string;
|
@@ -413,7 +469,9 @@ declare const BkSearchSelect: {
|
|
413
469
|
name: string;
|
414
470
|
id: string;
|
415
471
|
realId?: string;
|
472
|
+
isSelected?: boolean;
|
416
473
|
};
|
474
|
+
isSelected?: boolean;
|
417
475
|
}[];
|
418
476
|
condition: string;
|
419
477
|
searchItem: {
|
@@ -428,15 +486,32 @@ declare const BkSearchSelect: {
|
|
428
486
|
name: string;
|
429
487
|
id: string;
|
430
488
|
realId?: string;
|
489
|
+
isSelected?: boolean;
|
431
490
|
};
|
491
|
+
isSelected?: boolean;
|
432
492
|
}[];
|
433
493
|
multiple?: boolean;
|
434
494
|
async?: boolean;
|
435
495
|
noValidate?: boolean;
|
436
496
|
placeholder?: string;
|
437
497
|
disabled?: boolean;
|
498
|
+
value?: {
|
499
|
+
id: string;
|
500
|
+
name: string;
|
501
|
+
disabled?: boolean;
|
502
|
+
realId?: string;
|
503
|
+
value?: {
|
504
|
+
name: string;
|
505
|
+
id: string;
|
506
|
+
realId?: string;
|
507
|
+
isSelected?: boolean;
|
508
|
+
};
|
509
|
+
isSelected?: boolean;
|
510
|
+
};
|
511
|
+
isSelected?: boolean;
|
438
512
|
};
|
439
513
|
type: import("./utils").SearchItemType;
|
514
|
+
splitCode: string;
|
440
515
|
readonly multiple: boolean;
|
441
516
|
readonly placeholder: string;
|
442
517
|
readonly children: {
|
@@ -448,7 +523,9 @@ declare const BkSearchSelect: {
|
|
448
523
|
name: string;
|
449
524
|
id: string;
|
450
525
|
realId?: string;
|
526
|
+
isSelected?: boolean;
|
451
527
|
};
|
528
|
+
isSelected?: boolean;
|
452
529
|
}[];
|
453
530
|
readonly validate: boolean;
|
454
531
|
readonly inputInnerHtml: string;
|
@@ -463,6 +540,7 @@ declare const BkSearchSelect: {
|
|
463
540
|
}[]>;
|
464
541
|
overflowIndex: import("vue").Ref<number>;
|
465
542
|
validateStr: import("vue").Ref<string>;
|
543
|
+
splitCode: import("vue").ComputedRef<string>;
|
466
544
|
onEditClick: (item: import("./utils").SelectedItem, index: number) => void;
|
467
545
|
onEditEnter: (item: import("./utils").SelectedItem, index: number) => void;
|
468
546
|
handleWrapClick: () => void;
|
@@ -510,6 +588,14 @@ declare const BkSearchSelect: {
|
|
510
588
|
};
|
511
589
|
getMenuList: import("vue").PropType<import("./utils").GetMenuListFunc>;
|
512
590
|
validateValues: import("vue").PropType<import("./utils").ValidateValuesFunc>;
|
591
|
+
valueSplitCode: {
|
592
|
+
type: StringConstructor;
|
593
|
+
default: string;
|
594
|
+
};
|
595
|
+
uniqueSelect: {
|
596
|
+
type: BooleanConstructor;
|
597
|
+
default: boolean;
|
598
|
+
};
|
513
599
|
}>> & {
|
514
600
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
515
601
|
}, {
|
@@ -530,7 +616,7 @@ declare const BkSearchSelect: {
|
|
530
616
|
type: import("vue").PropType<import("./utils").SearchInputMode>;
|
531
617
|
default: import("./utils").SearchInputMode;
|
532
618
|
};
|
533
|
-
|
619
|
+
getMenuList: import("vue").PropType<import("./utils").GetMenuListFunc>;
|
534
620
|
validateValues: import("vue").PropType<import("./utils").ValidateValuesFunc>;
|
535
621
|
}, {
|
536
622
|
popoverRef: import("vue").Ref<HTMLDivElement>;
|
@@ -546,7 +632,9 @@ declare const BkSearchSelect: {
|
|
546
632
|
name: string;
|
547
633
|
id: string;
|
548
634
|
realId?: string;
|
635
|
+
isSelected?: boolean;
|
549
636
|
};
|
637
|
+
isSelected?: boolean;
|
550
638
|
}[]>;
|
551
639
|
menuList: import("vue").Ref<import("./utils").ISearchItem[]>;
|
552
640
|
menuHoverId: import("vue").Ref<string>;
|
@@ -583,7 +671,7 @@ declare const BkSearchSelect: {
|
|
583
671
|
type: import("vue").PropType<import("./utils").SearchInputMode>;
|
584
672
|
default: import("./utils").SearchInputMode;
|
585
673
|
};
|
586
|
-
|
674
|
+
getMenuList: import("vue").PropType<import("./utils").GetMenuListFunc>;
|
587
675
|
validateValues: import("vue").PropType<import("./utils").ValidateValuesFunc>;
|
588
676
|
}>> & {
|
589
677
|
onFocus?: (...args: any[]) => any;
|
@@ -597,6 +685,7 @@ declare const BkSearchSelect: {
|
|
597
685
|
}>>;
|
598
686
|
wrapRef: import("vue").Ref<HTMLDivElement>;
|
599
687
|
isFocus: import("vue").Ref<boolean>;
|
688
|
+
copyData: import("vue").Ref<import("./utils").ISearchItem[]>;
|
600
689
|
selectedList: import("vue").Ref<{
|
601
690
|
id: string;
|
602
691
|
name: string;
|
@@ -609,7 +698,9 @@ declare const BkSearchSelect: {
|
|
609
698
|
name: string;
|
610
699
|
id: string;
|
611
700
|
realId?: string;
|
701
|
+
isSelected?: boolean;
|
612
702
|
};
|
703
|
+
isSelected?: boolean;
|
613
704
|
}[];
|
614
705
|
condition: string;
|
615
706
|
searchItem: {
|
@@ -624,15 +715,32 @@ declare const BkSearchSelect: {
|
|
624
715
|
name: string;
|
625
716
|
id: string;
|
626
717
|
realId?: string;
|
718
|
+
isSelected?: boolean;
|
627
719
|
};
|
720
|
+
isSelected?: boolean;
|
628
721
|
}[];
|
629
722
|
multiple?: boolean;
|
630
723
|
async?: boolean;
|
631
724
|
noValidate?: boolean;
|
632
725
|
placeholder?: string;
|
633
726
|
disabled?: boolean;
|
727
|
+
value?: {
|
728
|
+
id: string;
|
729
|
+
name: string;
|
730
|
+
disabled?: boolean;
|
731
|
+
realId?: string;
|
732
|
+
value?: {
|
733
|
+
name: string;
|
734
|
+
id: string;
|
735
|
+
realId?: string;
|
736
|
+
isSelected?: boolean;
|
737
|
+
};
|
738
|
+
isSelected?: boolean;
|
739
|
+
};
|
740
|
+
isSelected?: boolean;
|
634
741
|
};
|
635
742
|
type: import("./utils").SearchItemType;
|
743
|
+
splitCode: string;
|
636
744
|
readonly multiple: boolean;
|
637
745
|
readonly placeholder: string;
|
638
746
|
readonly children: {
|
@@ -644,7 +752,9 @@ declare const BkSearchSelect: {
|
|
644
752
|
name: string;
|
645
753
|
id: string;
|
646
754
|
realId?: string;
|
755
|
+
isSelected?: boolean;
|
647
756
|
};
|
757
|
+
isSelected?: boolean;
|
648
758
|
}[];
|
649
759
|
readonly validate: boolean;
|
650
760
|
readonly inputInnerHtml: string;
|
@@ -659,6 +769,7 @@ declare const BkSearchSelect: {
|
|
659
769
|
}[]>;
|
660
770
|
overflowIndex: import("vue").Ref<number>;
|
661
771
|
validateStr: import("vue").Ref<string>;
|
772
|
+
splitCode: import("vue").ComputedRef<string>;
|
662
773
|
onEditClick: (item: import("./utils").SelectedItem, index: number) => void;
|
663
774
|
onEditEnter: (item: import("./utils").SelectedItem, index: number) => void;
|
664
775
|
handleWrapClick: () => void;
|
@@ -675,7 +786,9 @@ declare const BkSearchSelect: {
|
|
675
786
|
clearable: boolean;
|
676
787
|
modelValue: import("./utils").ISearchValue[];
|
677
788
|
conditions: import("./utils").ICommonItem[];
|
789
|
+
valueSplitCode: string;
|
678
790
|
shrink: boolean;
|
791
|
+
uniqueSelect: boolean;
|
679
792
|
}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & import("@vue/runtime-core").Plugin;
|
680
793
|
export default BkSearchSelect;
|
681
794
|
export { BkSearchSelect, };
|
@@ -1 +1 @@
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("../directives"),require("../icon"),require("../popover"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../directives","../icon","../popover"],t);else{var n="object"==typeof exports?t(require("../shared"),require("vue"),require("../directives"),require("../icon"),require("../popover")):t(e["../shared"],e.vue,e["../directives"],e["../icon"],e["../popover"]);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,((e,t,n,r,i)=>(()=>{var o={7162:(e,t,n)=>{e.exports=n(5047)},5047:e=>{var t=function(e){"use strict";var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var i=t&&t.prototype instanceof m?t:m,o=Object.create(i.prototype),a=new V(r||[]);return o._invoke=function(e,t,n){var r=d;return function(i,o){if(r===h)throw new Error("Generator is already running");if(r===f){if("throw"===i)throw o;return N()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var l=I(a,n);if(l){if(l===p)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===d)throw r=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=h;var u=c(e,t,n);if("normal"===u.type){if(r=n.done?f:v,u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=f,n.method="throw",n.arg=u.arg)}}}(e,n,a),o}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var d="suspendedStart",v="suspendedYield",h="executing",f="completed",p={};function m(){}function _(){}function g(){}var y={};u(y,o,(function(){return this}));var w=Object.getPrototypeOf,b=w&&w(w(C([])));b&&b!==n&&r.call(b,o)&&(y=b);var x=g.prototype=m.prototype=Object.create(y);function k(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function L(e,t){function n(i,o,a,l){var u=c(e[i],e,o);if("throw"!==u.type){var s=u.arg,d=s.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,a,l)}),(function(e){n("throw",e,a,l)})):t.resolve(d).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,l)}))}l(u.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function I(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,I(e,n),"throw"===n.method))return p;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var i=c(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;var o=i.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,p):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function V(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function C(e){if(e){var n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}return{next:N}}function N(){return{value:t,done:!0}}return _.prototype=g,u(x,"constructor",g),u(g,"constructor",_),_.displayName=u(g,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===_||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,u(e,l,"GeneratorFunction")),e.prototype=Object.create(x),e},e.awrap=function(e){return{__await:e}},k(L.prototype),u(L.prototype,a,(function(){return this})),e.AsyncIterator=L,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new L(s(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(x),u(x,l,"Generator"),u(x,o,(function(){return this})),u(x,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=C,V.prototype={constructor:V,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(S),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return l.type="throw",l.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],l=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}},4061:e=>{"use strict";e.exports=n},6870:e=>{"use strict";e.exports=r},5537:e=>{"use strict";e.exports=i},4212:t=>{"use strict";t.exports=e},748:e=>{"use strict";e.exports=t}},a={};function l(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return o[e](n,n.exports,l),n.exports}l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};return(()=>{"use strict";l.r(u),l.d(u,{BkSearchSelect:()=>T,default:()=>j});var e=l(4212),t=l(748),n=null,r=null;function i(e,t){void 0===t&&(t={});var n=document.createElement(e);return Object.keys(t).forEach((function(e){n[e]=t[e]})),n}function o(e,t,n){return(window.getComputedStyle(e,n||null)||{display:"none"})[t]}function a(e){if(!document.documentElement.contains(e))return{detached:!0,rendered:!1};for(var t=e;t!==document;){if("none"===o(t,"display"))return{detached:!1,rendered:!1};t=t.parentNode}return{detached:!1,rendered:!0}}var s=0,c=null;function d(e,t){if(e.__resize_mutation_handler__||(e.__resize_mutation_handler__=v.bind(e)),!e.__resize_listeners__)if(e.__resize_listeners__=[],window.ResizeObserver){var n=e.offsetWidth,r=e.offsetHeight,l=new ResizeObserver((function(){(e.__resize_observer_triggered__||(e.__resize_observer_triggered__=!0,e.offsetWidth!==n||e.offsetHeight!==r))&&f(e)})),u=a(e),d=u.detached,m=u.rendered;e.__resize_observer_triggered__=!1===d&&!1===m,e.__resize_observer__=l,l.observe(e)}else if(e.attachEvent&&e.addEventListener)e.__resize_legacy_resize_handler__=function(){f(e)},e.attachEvent("onresize",e.__resize_legacy_resize_handler__),document.addEventListener("DOMSubtreeModified",e.__resize_mutation_handler__);else if(s||(c=function(e){var t=document.createElement("style");return t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),(document.querySelector("head")||document.body).appendChild(t),t}('.resize-triggers{visibility:hidden;opacity:0;pointer-events:none}.resize-contract-trigger,.resize-contract-trigger:before,.resize-expand-trigger,.resize-triggers{content:"";position:absolute;top:0;left:0;height:100%;width:100%;overflow:hidden}.resize-contract-trigger,.resize-expand-trigger{background:#eee;overflow:auto}.resize-contract-trigger:before{width:200%;height:200%}')),function(e){var t=o(e,"position");t&&"static"!==t||(e.style.position="relative"),e.__resize_old_position__=t,e.__resize_last__={};var n=i("div",{className:"resize-triggers"}),r=i("div",{className:"resize-expand-trigger"}),a=i("div"),l=i("div",{className:"resize-contract-trigger"});r.appendChild(a),n.appendChild(r),n.appendChild(l),e.appendChild(n),e.__resize_triggers__={triggers:n,expand:r,expandChild:a,contract:l},p(e),e.addEventListener("scroll",h,!0),e.__resize_last__={width:e.offsetWidth,height:e.offsetHeight}}(e),e.__resize_rendered__=a(e).rendered,window.MutationObserver){var _=new MutationObserver(e.__resize_mutation_handler__);_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),e.__resize_mutation_observer__=_}e.__resize_listeners__.push(t),s++}function v(){var e=a(this),t=e.rendered,n=e.detached;t!==this.__resize_rendered__&&(!n&&this.__resize_triggers__&&(p(this),this.addEventListener("scroll",h,!0)),this.__resize_rendered__=t,f(this))}function h(){var e,t,i=this;p(this),this.__resize_raf__&&(e=this.__resize_raf__,r||(r=(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(e){clearTimeout(e)}).bind(window)),r(e)),this.__resize_raf__=(t=function(){var e,t,n,r,o,a,l=(n=(t=(e=i).__resize_last__).width,r=t.height,o=e.offsetWidth,a=e.offsetHeight,o!==n||a!==r?{width:o,height:a}:null);l&&(i.__resize_last__=l,f(i))},n||(n=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){return setTimeout(e,16)}).bind(window)),n(t))}function f(e){e&&e.__resize_listeners__&&e.__resize_listeners__.forEach((function(t){t.call(e,e)}))}function p(e){var t=e.__resize_triggers__,n=t.expand,r=t.expandChild,i=t.contract,o=i.scrollWidth,a=i.scrollHeight,l=n.offsetWidth,u=n.offsetHeight,s=n.scrollWidth,c=n.scrollHeight;i.scrollLeft=o,i.scrollTop=a,r.style.width=l+1+"px",r.style.height=u+1+"px",n.scrollLeft=s,n.scrollTop=c}var m=l(4061),_=l(6870),g=l(7162),y=l.n(g);function w(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function l(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))}Object.create,Object.create;var b=l(5537),x=l.n(b);const k=(0,t.defineComponent)({name:"SearchSelectMenu",props:{list:{type:Array},hoverId:String,keyword:{type:String,default:""},multiple:{type:Boolean,default:!1},selected:{type:Array,default:function(){return[]}},conditions:{type:Array},footerBtns:{type:Array,default:function(){return[{id:"confirm",name:"确认"},{id:"cancel",name:"取消",disabled:!1}]}}},emits:["selectItem","selectCondition","footerClick"],setup:function(e,n){var r=n.emit;return{handleClick:function(e){r("selectItem",e)},handleClickCondition:function(e){r("selectCondition",e)},handleClickFooterBtn:function(e){r("footerClick",e)},filterList:(0,t.computed)((function(){var t,n;return(null===(t=e.list)||void 0===t?void 0:t.length)?(null===(n=e.keyword)||void 0===n?void 0:n.length)?e.list.filter((function(t){return t.name.toLocaleLowerCase().includes(e.keyword.toLocaleLowerCase())})):e.list:[]})),getSearchNode:function(n){var r;return(null===(r=n.value)||void 0===r?void 0:r.name)?[(0,t.createVNode)("span",{class:"menu-name"},[n.name,(0,t.createTextVNode)(":")]),n.value.name]:function(n){if(!n)return n;var r=e.keyword,i=r.length;if(!(null==r?void 0:r.trim().length)||!n.toLocaleLowerCase().includes(r.toLocaleLowerCase()))return n;var o=[],a=-1;return r=r.replace(/([.*/]{1})/gim,"\\$1"),n.replace(new RegExp("".concat(r),"igm"),(function(e,r){return 0===o.length&&0!==r?o.push(n.slice(0,r)):a>=0&&o.push(n.slice(a+e.length,r)),o.push((0,t.createVNode)("span",{class:"is-keyword"},[e])),a=r,e})),a>=0&&o.push(n.slice(a+i)),o.length?o:n}(n.name)}}},render:function(){var e,n,r,i=this;return(0,t.createVNode)("div",{class:"bk-search-select-menu"},[!!(null===(e=this.conditions)||void 0===e?void 0:e.length)&&(0,t.createVNode)("ul",{class:"menu-header"},[this.conditions.map((function(e){return(0,t.createVNode)("li",{key:e.id,class:"menu-header-item ".concat(e.disabled?"is-disabled":""),onClick:function(){return!e.disabled&&i.handleClickCondition(e)}},[e.name])}))]),(0,t.createVNode)("ul",{class:"menu-content"},[null===(n=this.list)||void 0===n?void 0:n.map((function(e){return(0,t.createVNode)("li",{class:"menu-item ".concat(e.disabled?"is-disabled":""," ").concat(i.hoverId!==e.id||e.disabled?"":"is-hover"),key:e.id,id:e.id,tabindex:"-1",onClick:function(){return!e.disabled&&i.handleClick(e)}},[i.$slots.default?i.$slots.default({item:e,list:i.list,multiple:!!i.multiple,hoverId:i.hoverId,getSearchNode:i.getSearchNode}):(0,t.createVNode)(t.Fragment,null,[i.getSearchNode(e),i.multiple&&i.selected.includes(e.id)&&(0,t.createVNode)(_.Done,{class:"is-selected"},null)])])}))]),this.multiple&&(null===(r=this.footerBtns)||void 0===r?void 0:r.length)&&(0,t.createVNode)("div",{class:"menu-footer"},[this.footerBtns.map((function(e){return(0,t.createVNode)("span",{class:"menu-footer-btn ".concat(e.disabled?"is-disabled":""),key:e.id,onClick:function(){return!e.disabled&&i.handleClickFooterBtn(e)}},[e.name])}))])])}});function L(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var E,S=Symbol("SEARCH_SLECT_PROVIDER_KEY"),V=function(){return(0,t.inject)(S)};!function(e){e.DEFAULT="default",e.EDIT="edit"}(E||(E={}));var C=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";L(this,e),this.searchItem=t,this.type=n,this.values=[],this.id=t.id,this.name=t.name}var t,n;return t=e,(n=[{key:"multiple",get:function(){return!!this.searchItem.multiple}},{key:"placeholder",get:function(){return this.searchItem.placeholder||""}},{key:"children",get:function(){return this.searchItem.children||[]}},{key:"validate",get:function(){return!this.searchItem.noValidate}},{key:"inputInnerHtml",get:function(){var e;return this.isSpecialType()?this.name:"".concat(this.keyInnerHtml).concat((null===(e=this.values)||void 0===e?void 0:e.map((function(e){return e.name})).join("|"))||"")}},{key:"inputInnerText",get:function(){var e;return this.isSpecialType()?this.name:"".concat(this.keyInnerText).concat((null===(e=this.values)||void 0===e?void 0:e.map((function(e){return e.name})).join("|"))||"")}},{key:"keyInnerHtml",get:function(){return this.isSpecialType()?this.name:this.name?"".concat(this.name,": "):""}},{key:"keyInnerText",get:function(){return this.isSpecialType()?this.name:this.name?"".concat(this.name,": "):""}},{key:"isSpecialType",value:function(){return["text","condition"].includes(this.type)}},{key:"addValue",value:function(e){if(this.multiple){var t=this.values.findIndex((function(t){return t.id===e.id}));return t>-1?void this.values.splice(t,1):void this.values.push(e)}this.values=[e]}},{key:"toValue",value:function(){var e,t={id:this.id,name:this.name};return(null===(e=this.values)||void 0===e?void 0:e.length)&&(t.values=this.values.map((function(e){return{id:e.id,name:e.name}}))),this.type&&"default"!==this.type&&(t.type=this.type),t}},{key:"toValueKey",value:function(){return JSON.stringify(this.toValue())}},{key:"isInValueList",value:function(e){return this.children.some((function(t){return t.id===(null==e?void 0:e.id)}))}}])&&I(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const N=(0,t.defineComponent)({name:"SearchSelectInput",directives:{clickoutside:m.clickoutside},props:{data:{type:Array,required:!0},showInputBefore:Boolean,showCondition:Boolean,clickOutside:Function,conditions:{type:Array,default:function(){return[]}},defautUsingItem:Object,mode:{type:String,default:E.DEFAULT},geMenuList:Function,validateValues:Function},emits:["focus","add","delete"],setup:function(n,r){var i=r.emit,o=r.expose,a=(0,t.ref)(null),l=(0,t.ref)(null),u=(0,t.ref)(""),s=(0,t.ref)(!1),c=(0,t.ref)(!1),d=(0,t.ref)(!1),v=(0,t.ref)(n.defautUsingItem),h=(0,t.ref)(""),f=(0,t.ref)(!1),p=(0,e.debounce)(300,j),m=!1,_=(0,t.ref)([]),g=(0,t.ref)([]),b=V(),x=b.editKey,k=b.onValidate;function L(e){switch(e.code){case"ArrowDown":case"ArrowUp":I(e);break;case"Enter":case"NumpadEnter":!function(e){if(m){e.preventDefault();var t=g.value.find((function(e){return e.id===h.value}));t&&z(t)}}(e)}}function I(e){var t;e.preventDefault(),null===(t=a.value)||void 0===t||t.blur();for(var n=g.value.length,r=n,i=g.value.findIndex((function(e){return e.id===h.value}));r>=0;){i=(i="ArrowDown"===e.code?i+1:i-1)>n-1?0:i<0?n-1:i;var o=g.value[i];if(!o.disabled){r=-1;var l=document.getElementById(o.id);return null==l||l.focus(),void(h.value=o.id)}r-=1}}function S(e){T(),e&&j()}function N(e){var t;return w(this,void 0,void 0,y().mark((function n(){var r,o,a;return y().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null==e||e.preventDefault(),v.value){n.next=14;break}if(u.value){n.next=4;break}return n.abrupt("return");case 4:return r={id:u.value,name:u.value},n.next=7,O(r);case 7:if(n.sent){n.next=10;break}return n.abrupt("return");case 10:return i("add",new C(r,"text")),u.value="",j(),n.abrupt("return");case 14:if(null==(o=v.value.values)?void 0:o.length){n.next=30;break}if(!(null===(t=u.value)||void 0===t?void 0:t.length)){n.next=28;break}return a={id:u.value,name:u.value},n.next=20,O(a);case 20:if(n.sent){n.next=23;break}return n.abrupt("return");case 23:return v.value.addValue(a),i("add",v.value),u.value="",v.value=null,n.abrupt("return");case 28:return s.value=!0,n.abrupt("return");case 30:return n.next=32,O();case 32:if(n.sent){n.next=35;break}return n.abrupt("return");case 35:A();case 36:case"end":return n.stop()}}),n)})))}function z(e,t){var n,r,i,o;return w(this,void 0,void 0,y().mark((function l(){var s,c;return y().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(!(null===(n=e.value)||void 0===n?void 0:n.id)){l.next=5;break}return(s=new C(Object.assign(Object.assign({},e),{id:null!==(r=e.realId)&&void 0!==r?r:e.id}),t)).addValue(e.value),A(s),l.abrupt("return");case 5:if(v.value&&(null===(i=null==a?void 0:a.value)||void 0===i?void 0:i.innerText)){l.next=13;break}return v.value=new C(e,t),u.value="",(c="condition"===t)&&A(),d.value=c||!!v.value.children.length,T(),l.abrupt("return");case 13:if("condition"!==(null===(o=v.value)||void 0===o?void 0:o.type)){l.next=17;break}return v.value=new C(e,t),A(),l.abrupt("return");case 17:return v.value.addValue(e),l.next=20,O(e);case 20:if(l.sent){l.next=23;break}return l.abrupt("return");case 23:!v.value.multiple&&A();case 24:case"end":return l.stop()}}),l)})))}function O(e){return w(this,void 0,void 0,y().mark((function t(){var r,i,o,a;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(v.value){t.next=4;break}return t.next=3,F(null,[e]);case 3:case 8:return t.abrupt("return",t.sent);case 4:if(r=v.value,i=r.searchItem,o=r.validate,a=r.values,!o||"function"!=typeof n.validateValues){t.next=9;break}return t.next=8,F(i,e?[e]:a);case 9:return k(""),t.abrupt("return",!0);case 11:case"end":return t.stop()}}),t)})))}function F(e,t){var r;return w(this,void 0,void 0,y().mark((function i(){var o;return y().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,null===(r=n.validateValues)||void 0===r?void 0:r.call(n,null!=e?e:null,t).catch((function(){return!1}));case 2:if("string"!=typeof(o=i.sent)&&!1!==o){i.next=6;break}return k(o||"校验错误"),i.abrupt("return",!1);case 6:return k(""),i.abrupt("return",!0);case 8:case"end":return i.stop()}}),i)})))}function T(){c.value=!0,d.value=!0,s.value=!1;var e=setTimeout((function(){if(a.value){a.value.focus();var t=window.getSelection();0===t.focusOffset&&(t.selectAllChildren(a.value),t.collapseToEnd())}window.clearTimeout(e)}),0);i("focus",c.value)}function j(){var t,r,i,o,a;return w(this,void 0,void 0,y().mark((function l(){var s;return y().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(s=[],"function"!=typeof n.geMenuList||(null===(r=null===(t=v.value)||void 0===t?void 0:t.searchItem)||void 0===r?void 0:r.async)){l.next=9;break}return f.value=!0,l.next=5,n.geMenuList(null===(i=v.value)||void 0===i?void 0:i.searchItem,u.value).catch((function(){return[]}));case 5:s=l.sent,f.value=!1,l.next=10;break;case 9:(null==v?void 0:v.value)?"condition"===v.value.type?s=n.conditions:(null===(a=v.value.values)||void 0===a?void 0:a.length)&&!v.value.multiple&&n.mode!==E.EDIT||(s=v.value.children.filter((function(e){return e.name.toLocaleLowerCase().includes(u.value.toLocaleLowerCase())}))):(null===(o=u.value)||void 0===o?void 0:o.length)?n.data.forEach((function(t){var n,r;t.name.toLocaleLowerCase().includes(u.value.toLocaleLowerCase())?(s.push(t),null===(n=t.children)||void 0===n||n.forEach((function(n){s.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:n}))})),s.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:{id:u.value,name:u.value}}))):(null===(r=t.children)||void 0===r||r.forEach((function(n){n.name.toLocaleLowerCase().includes(u.value.toLocaleLowerCase())&&s.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:n}))})),s.push(Object.assign(Object.assign({},t),{value:{id:u.value,name:u.value}})))})):s=n.data.slice();case 10:g.value=s;case 11:case"end":return l.stop()}}),l)})))}function A(e){i("add",null!=e?e:v.value),v.value=null,u.value="",T()}function D(){var e=a.value.innerText;"\n"===e[e.length-1]||"\r"===e[0]?(M(e.slice(0,-1)),D()):"\n"!==e[0]&&"\r"!==e[0]||(M(e.slice(1)),D())}function M(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";a.value&&(a.value.innerHTML=t||(null===(e=v.value)||void 0===e?void 0:e.inputInnerHtml)||"")}return(0,t.watch)(x,(function(){n.mode===E.DEFAULT&&x.value&&(d.value=!1)})),(0,t.watchEffect)((function(){u.value||M()}),{flush:"pre"}),(0,t.watch)([g,d],(function(){var e;(null===(e=g.value)||void 0===e?void 0:e.some((function(e){return!e.disabled})))&&d.value?m||(h.value="",m=!0,document.addEventListener("keydown",L)):(document.removeEventListener("keydown",L),m=!1,h.value="")})),o({handleInputFocus:S,isFocus:c}),{popoverRef:l,inputRef:a,keyword:u,loading:f,remoteMenuList:_,menuList:g,menuHoverId:h,isFocus:c,usingItem:v,showPopover:d,showNoSelectValueError:s,debounceSetMenuList:p,documentArrowEvent:I,handleClickOutside:function(e){var t,r;!(null===(t=l.value)||void 0===t?void 0:t.contains(e.target))&&(null===(r=n.clickOutside)||void 0===r?void 0:r.call(n,e.target,l.value))&&(d.value=!1,c.value=!1,i("focus",c.value))},handleInputFocus:S,handleInputChange:function(e){var t,n,r,i,o,l;D();var s=e.target.innerText;if(/(\r|\n)/gm.test(s)||/\s{2}/gm.test(s))e.preventDefault(),s=s.replace(/(\r|\n)/gm,"|").replace(/\s{2}/gm,""),a.value.innerText=s,T(),u.value=s,p();else if(!u.value&&s.length<((null===(n=null===(t=v.value)||void 0===t?void 0:t.inputInnerText)||void 0===n?void 0:n.length)||1)){var c=s.replace(" "," ").replace((null===(r=v.value)||void 0===r?void 0:r.keyInnerText.replace(" "," ").trim())||"","").trim();c&&(v.value=null),u.value=c?s:"",p()}else(null===(o=null===(i=v.value)||void 0===i?void 0:i.values)||void 0===o?void 0:o.length)||(u.value=s.replace(" "," ").replace((null===(l=v.value)||void 0===l?void 0:l.keyInnerText.replace(" "," "))||"","").trim(),T(),p())},handleInputKeyup:function(e){switch(e.code){case"Enter":case"NumpadEnter":N(e);break;case"Backspace":!function(){var e,t;if(v.value||u.value)return(null===(e=v.value)||void 0===e?void 0:e.values.length)&&((null===(t=v.value)||void 0===t?void 0:t.multiple)||v.value.isInValueList(v.value.values[0]))?(v.value.values.splice(-1,1),u.value="",void T()):void k("");i("delete")}();default:s.value=!1}},handleSelectItem:z,handleSelectCondtionItem:function(e){z(e,"condition")},handleMenuFooterClick:function(e){switch(e.id){case"confirm":N();break;case"cancel":v.value.values=[],T()}}}},render:function(){var e,n,r=this,i=this.usingItem||{},o=i.multiple,a=i.values,l=i.placeholder,u=i.inputInnerHtml,s=!(null===(e=this.keyword)||void 0===e?void 0:e.length)&&!(null==a?void 0:a.length)&&l,c=this.loading||this.showNoSelectValueError||this.showPopover&&!!(null===(n=this.menuList)||void 0===n?void 0:n.length),d=!this.usingItem&&this.showCondition,v=Object.assign({},this.$slots.menu?{default:function(e){var t,n;return null===(n=(t=r.$slots).menu)||void 0===n?void 0:n.call(t,e)}}:{});return(0,t.createVNode)(x(),{trigger:"manual",theme:"light",placement:"bottom-start",arrow:!1,disableOutsideClick:!0,isShow:c},{default:function(){var e;return(0,t.withDirectives)((0,t.createVNode)("div",{ref:"inputRef",class:{"div-input":!0,"input-before":r.showInputBefore&&!(null===(e=r.keyword)||void 0===e?void 0:e.length),"input-after":s},contenteditable:!0,"data-placeholder":u||r.keyword?"":"请选择","data-tips":l||"",spellcheck:"false",onFocus:r.handleInputFocus,onInput:r.handleInputChange,onKeydown:r.handleInputKeyup},null),[[(0,t.resolveDirective)("clickoutside"),r.handleClickOutside]])},content:function(){var e;return r.loading?(0,t.createVNode)("div",null,[(0,t.createTextVNode)("加载中...")]):r.showNoSelectValueError?(0,t.createVNode)("div",null,[(0,t.createTextVNode)("包含键值的过滤查询必须有一个值")]):(null===(e=r.menuList)||void 0===e?void 0:e.length)?(0,t.createVNode)("div",{ref:"popoverRef",class:"bk-search-select-popover"},[(0,t.createVNode)(k,{list:r.menuList,keyword:r.keyword,multiple:!!o,hoverId:r.menuHoverId,selected:(null==a?void 0:a.map((function(e){return e.id})))||[],conditions:d?r.conditions:[],onSelectItem:r.handleSelectItem,onSelectCondition:r.handleSelectCondtionItem,onFooterClick:r.handleMenuFooterClick},Object.assign({},v))]):void 0}})}}),z=(0,t.defineComponent)({name:"SearchSelected",props:{data:{type:Array,required:!0},selectedList:{type:Array,required:!0},overflowIndex:{type:Number,default:-1},conditions:{type:Array,default:function(){return[]}},geMenuList:Function,validateValues:Function},emits:["delete"],setup:function(e,n){var r=n.emit,i=(0,t.ref)(null),o=V(),a=o.onEditClick,l=o.onEditEnter,u=o.onEditBlur,s=o.editKey;return{inputRef:i,editKey:s,copySeletedItem:function(e){var t=new C(e.searchItem,e.type);return t.values=e.values.slice(),t},handleDeleteSelected:function(e){r("delete",e)},handleEditSeleted:function(e,t,n){e.preventDefault(),e.stopPropagation(),a(t,n),setTimeout((function(){return i.value.handleInputFocus()}),200)},handleInputOutside:function(){return!0},handleAddSelected:function(e,t){l(e,t)},handleInputFocus:function(e){e||u()}}},render:function(){var e=this,n=function(n,r){return e.editKey==="".concat(n.id,"_").concat(r)?(0,t.createVNode)("div",{class:"selected-input",key:e.editKey.toString()},[(0,t.createVNode)(N,{ref:"inputRef",key:e.editKey.toString(),mode:E.EDIT,data:e.data,showCondition:!1,conditions:e.conditions,defautUsingItem:e.copySeletedItem(n),clickOutside:e.handleInputOutside,geMenuList:e.geMenuList,validateValues:e.validateValues,onAdd:function(t){return e.handleAddSelected(t,r)},onFocus:e.handleInputFocus},null)]):(0,t.createVNode)("li",{class:"search-container-selected ".concat((e.overflowIndex>=0?r<e.overflowIndex:r>=0)?"":"hidden-selected"),key:"".concat(n.id,"_").concat(r)},[(0,t.createVNode)("span",{class:"selected-name",onClick:function(t){return e.handleEditSeleted(t,n,r)}},[n.inputInnerText]),(0,t.createVNode)(_.Close,{class:"selected-clear",onClick:function(){return e.handleDeleteSelected(r)}},null)])};return(0,t.createVNode)(t.Fragment,null,[this.selectedList.map((function(r,i){return[e.overflowIndex>=0&&i===e.overflowIndex&&(0,t.createVNode)("div",{class:"search-container-selected overflow-selected"},[(0,t.createTextVNode)("+"),e.selectedList.length-e.overflowIndex]),n(r,i)]}))])}});var O={data:{type:Array,default:function(){return[]}},modelValue:{type:Array,default:function(){return[]}},shrink:{type:Boolean,default:!0},maxHeight:{type:Number,default:120},minHeight:{type:Number,default:26},conditions:{type:Array,default:function(){return[{id:"or",name:"或"},{id:"and",name:"且"}]}},clearable:{type:Boolean,default:!0},getMenuList:Function,validateValues:Function};const F=(0,t.defineComponent)({name:"SearchSelect",directives:{clickoutside:m.clickoutside},props:O,emits:["update:modelValue"],setup:function(n,r){var i,o=r.emit,a=(0,t.ref)(null),l=(0,t.ref)(null),u=(0,t.ref)(!1),v=(0,t.ref)([]),f=(0,t.ref)(-1),p=(0,e.debounce)(32,b),m=(0,t.ref)(""),_=(0,t.ref)("");function g(e,t){m.value="".concat(e.id,"_").concat(t)}function y(e,t){var n=v.value.slice();n.splice(t,1,e),o("update:modelValue",n.map((function(e){return e.toValue()}))),m.value=""}function w(e){_.value=e||""}function b(){if(u.value||v.value.length<1)f.value=-1;else{for(var e=l.value.querySelector(".bk-search-select-container"),t=l.value.querySelector(".search-container").clientWidth-6-2,r=e.querySelectorAll(".search-container-selected:not(.overflow-selected)"),i=0,o=0,a=0;0===o&&i<=t-40&&a<=r.length-1;){var s=r[a];if(s.clientHeight>n.minHeight)return void(f.value=a);(i+=s?s.clientWidth+6:0)>=t-40&&(o=a),a+=1}o===r.length-1&&i<=t?f.value=-1:f.value=i>=t-40?o:o-1}}return(0,t.watch)((function(){return n.modelValue}),(function(e){if(null==e?void 0:e.length){var t=[];e.forEach((function(e){var r,i=v.value.find((function(t){return t.id===e.id&&t.name===e.name}));if((null==i?void 0:i.toValueKey())===JSON.stringify(e))i.values=e.values||[],t.push(i);else{var o=n.data.find((function(t){return t.id===e.id})),a="default";o||(o=n.conditions.find((function(t){return t.id===e.id})))&&(a="condition"),o||(null===(r=e.values)||void 0===r?void 0:r.length)||(a="text");var l=new C(o||e,a);l.values=e.values||[],t.push(l)}})),v.value=t}else v.value=[]}),{immediate:!0,deep:!0}),(0,t.onMounted)((function(){d(l.value.querySelector(".bk-search-select-container"),p)})),(0,t.onBeforeUnmount)((function(){!function(e,t){var n=e.__resize_listeners__;if(n){if(t&&n.splice(n.indexOf(t),1),!n.length||!t){if(e.detachEvent&&e.removeEventListener)return e.detachEvent("onresize",e.__resize_legacy_resize_handler__),void document.removeEventListener("DOMSubtreeModified",e.__resize_mutation_handler__);e.__resize_observer__?(e.__resize_observer__.unobserve(e),e.__resize_observer__.disconnect(),e.__resize_observer__=null):(e.__resize_mutation_observer__&&(e.__resize_mutation_observer__.disconnect(),e.__resize_mutation_observer__=null),e.removeEventListener("scroll",h),e.removeChild(e.__resize_triggers__.triggers),e.__resize_triggers__=null),e.__resize_listeners__=null}!--s&&c&&c.parentNode.removeChild(c)}}(l.value.querySelector(".bk-search-select-container"),p)})),i={onEditClick:g,onEditEnter:y,onEditBlur:function(){m.value="",w("")},onValidate:w,editKey:m},(0,t.provide)(S,i),{inputRef:a,wrapRef:l,isFocus:u,selectedList:v,overflowIndex:f,validateStr:_,onEditClick:g,onEditEnter:y,handleWrapClick:function(){m.value||a.value.handleInputFocus()},handleInputFocus:function(e){e&&(f.value=-1),u.value=e},handleResize:b,handleClearAll:function(){v.value=[],f.value=-1,o("update:modelValue",[])},handleInputOutside:function(e){var t;return!(null===(t=l.value)||void 0===t?void 0:t.contains(e))},handleAddSelected:function(e){var t=v.value.slice();t.push(e),w(""),o("update:modelValue",t.map((function(e){return e.toValue()})))},handleDeleteSelected:function(e){var t=v.value.slice();t.splice("number"==typeof e?e:v.value.length-1,1),w(""),o("update:modelValue",t.map((function(e){return e.toValue()})))}}},render:function(){var e,n,r=this,i="".concat(!this.shrink||this.isFocus?this.maxHeight:this.minHeight,"px"),o=!!this.selectedList.length&&"condition"!==this.selectedList.slice(-1)[0].type,a=Object.assign({},this.$slots.menu?{menu:function(e){var t,n;return null===(n=(t=r.$slots).menu)||void 0===n?void 0:n.call(t,e)}}:{});return(0,t.createVNode)("div",{class:"bk-search-select",ref:"wrapRef"},[(0,t.createVNode)("div",{class:{"bk-search-select-container":!0,"is-focus":this.isFocus},onClick:this.handleWrapClick},[(0,t.createVNode)("div",{class:"search-prefix"},[null===(n=(e=this.$slots).prepend)||void 0===n?void 0:n.call(e)]),(0,t.createVNode)("div",{class:"search-container",style:{maxHeight:i}},[(0,t.createVNode)(z,{data:this.data,conditions:this.conditions,selectedList:this.selectedList,overflowIndex:this.overflowIndex,geMenuList:this.getMenuList,validateValues:this.validateValues,onDelete:this.handleDeleteSelected},Object.assign({},a)),(0,t.createVNode)("div",{class:"search-container-input"},[(0,t.createVNode)(N,{ref:"inputRef",data:this.data,showInputBefore:!this.selectedList.length,showCondition:o,conditions:this.conditions,clickOutside:this.handleInputOutside,geMenuList:this.getMenuList,validateValues:this.validateValues,onAdd:this.handleAddSelected,onDelete:this.handleDeleteSelected,onFocus:this.handleInputFocus},Object.assign({},a))])]),(0,t.createVNode)("div",{class:"search-nextfix"},[this.clearable&&!!this.selectedList.length&&(0,t.createVNode)(_.Close,{class:"search-clear",onClick:this.handleClearAll},null),this.$slots.append?this.$slots.append():(0,t.createVNode)(_.Search,{class:"search-nextfix-icon ".concat(this.isFocus?"is-focus":"")},null)])]),!!this.validateStr.length&&(0,t.createVNode)("div",{class:"bk-search-select-tips"},[this.$slots.validate?this.$slots.validate():(0,t.createVNode)(t.Fragment,null,[(0,t.createVNode)(_.ExclamationCircleShape,{class:"select-tips"},null),this.validateStr||""])])])}});var T=(0,e.withInstall)(F);const j=T})(),u})()));
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("../directives"),require("../icon"),require("../popover"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../directives","../icon","../popover"],t);else{var n="object"==typeof exports?t(require("../shared"),require("vue"),require("../directives"),require("../icon"),require("../popover")):t(e["../shared"],e.vue,e["../directives"],e["../icon"],e["../popover"]);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,((e,t,n,r,i)=>(()=>{var a={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=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=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 _(){}function g(){}var y={};u(y,a,(function(){return this}));var w=Object.getPrototypeOf,b=w&&w(w(V([])));b&&b!==n&&r.call(b,a)&&(y=b);var x=g.prototype=m.prototype=Object.create(y);function k(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function L(e,t){function n(i,a,o,l){var u=c(e[i],e,a);if("throw"!==u.type){var s=u.arg,d=s.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,o,l)}),(function(e){n("throw",e,o,l)})):t.resolve(d).then((function(e){s.value=e,o(s)}),(function(e){return n("throw",e,o,l)}))}l(u.arg)}var i;this._invoke=function(e,r){function a(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(a,a):a()}}function S(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,S(e,n),"throw"===n.method))return p;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var i=c(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,p):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function I(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 E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,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 _.prototype=g,u(x,"constructor",g),u(g,"constructor",_),_.displayName=u(g,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===_||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,u(e,l,"GeneratorFunction")),e.prototype=Object.create(x),e},e.awrap=function(e){return{__await:e}},k(L.prototype),u(L.prototype,o,(function(){return this})),e.AsyncIterator=L,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new L(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(E),!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),E(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;E(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)}},4061:e=>{"use strict";e.exports=n},6870:e=>{"use strict";e.exports=r},5537:e=>{"use strict";e.exports=i},4212:t=>{"use strict";t.exports=e},748:e=>{"use strict";e.exports=t}},o={};function l(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return a[e](n,n.exports,l),n.exports}l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};return(()=>{"use strict";l.r(u),l.d(u,{BkSearchSelect:()=>F,default:()=>j});var e=l(4212),t=l(748),n=null,r=null;function i(e,t){void 0===t&&(t={});var n=document.createElement(e);return Object.keys(t).forEach((function(e){n[e]=t[e]})),n}function 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 s=0,c=null;function d(e,t){if(e.__resize_mutation_handler__||(e.__resize_mutation_handler__=v.bind(e)),!e.__resize_listeners__)if(e.__resize_listeners__=[],window.ResizeObserver){var n=e.offsetWidth,r=e.offsetHeight,l=new ResizeObserver((function(){(e.__resize_observer_triggered__||(e.__resize_observer_triggered__=!0,e.offsetWidth!==n||e.offsetHeight!==r))&&h(e)})),u=o(e),d=u.detached,m=u.rendered;e.__resize_observer_triggered__=!1===d&&!1===m,e.__resize_observer__=l,l.observe(e)}else if(e.attachEvent&&e.addEventListener)e.__resize_legacy_resize_handler__=function(){h(e)},e.attachEvent("onresize",e.__resize_legacy_resize_handler__),document.addEventListener("DOMSubtreeModified",e.__resize_mutation_handler__);else if(s||(c=function(e){var t=document.createElement("style");return t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),(document.querySelector("head")||document.body).appendChild(t),t}('.resize-triggers{visibility:hidden;opacity:0;pointer-events:none}.resize-contract-trigger,.resize-contract-trigger:before,.resize-expand-trigger,.resize-triggers{content:"";position:absolute;top:0;left:0;height:100%;width:100%;overflow:hidden}.resize-contract-trigger,.resize-expand-trigger{background:#eee;overflow:auto}.resize-contract-trigger:before{width:200%;height:200%}')),function(e){var t=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 _=new MutationObserver(e.__resize_mutation_handler__);_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),e.__resize_mutation_observer__=_}e.__resize_listeners__.push(t),s++}function v(){var e=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=l(4061),_=l(6870),g=l(7162),y=l.n(g);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 b=l(5537),x=l.n(b);const k=(0,t.defineComponent)({name:"SearchSelectMenu",props:{list:{type:Array},hoverId:String,keyword:{type:String,default:""},multiple:{type:Boolean,default:!1},selected:{type:Array,default:function(){return[]}},conditions:{type:Array},footerBtns:{type:Array,default:function(){return[{id:"confirm",name:"确认"},{id:"cancel",name:"取消",disabled:!1}]}}},emits:["selectItem","selectCondition","footerClick"],setup:function(e,n){var r=n.emit;return{handleClick:function(e){r("selectItem",e)},handleClickCondition:function(e){r("selectCondition",e)},handleClickFooterBtn:function(e){r("footerClick",e)},filterList:(0,t.computed)((function(){var t,n;return(null===(t=e.list)||void 0===t?void 0:t.length)?(null===(n=e.keyword)||void 0===n?void 0:n.length)?e.list.filter((function(t){return t.name.toLocaleLowerCase().includes(e.keyword.toLocaleLowerCase())})):e.list:[]})),getSearchNode:function(n){var r;return(null===(r=n.value)||void 0===r?void 0:r.name)?[(0,t.createVNode)("span",{class:"menu-name"},[n.name,(0,t.createTextVNode)(":")]),n.value.name]:function(n){if(!n)return n;var r=e.keyword,i=r.length;if(!(null==r?void 0:r.trim().length)||!n.toLocaleLowerCase().includes(r.toLocaleLowerCase()))return n;var 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)}}},render:function(){var e,n,r,i=this;return(0,t.createVNode)("div",{class:"bk-search-select-menu"},[!!(null===(e=this.conditions)||void 0===e?void 0:e.length)&&(0,t.createVNode)("ul",{class:"menu-header"},[this.conditions.map((function(e){return(0,t.createVNode)("li",{key:e.id,class:"menu-header-item ".concat(e.disabled?"is-disabled":""),onClick:function(){return!e.disabled&&i.handleClickCondition(e)}},[e.name])}))]),(0,t.createVNode)("ul",{class:"menu-content"},[null===(n=this.list)||void 0===n?void 0:n.map((function(e){return(0,t.createVNode)("li",{class:"menu-item ".concat(e.disabled?"is-disabled":""," ").concat(i.hoverId!==e.id||e.disabled?"":"is-hover"),key:e.id,id:e.id,tabindex:"-1",onClick:function(){return!e.disabled&&i.handleClick(e)}},[i.$slots.default?i.$slots.default({item:e,list:i.list,multiple:!!i.multiple,hoverId:i.hoverId,getSearchNode:i.getSearchNode}):(0,t.createVNode)(t.Fragment,null,[i.getSearchNode(e),i.multiple&&i.selected.includes(e.id)&&(0,t.createVNode)(_.Done,{class:"is-selected"},null)])])}))]),this.multiple&&(null===(r=this.footerBtns)||void 0===r?void 0:r.length)&&(0,t.createVNode)("div",{class:"menu-footer"},[this.footerBtns.map((function(e){return(0,t.createVNode)("span",{class:"menu-footer-btn ".concat(e.disabled?"is-disabled":""),key:e.id,onClick:function(){return!e.disabled&&i.handleClickFooterBtn(e)}},[e.name])}))])])}});function L(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function 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,E=Symbol("SEARCH_SLECT_PROVIDER_KEY"),C=function(){return(0,t.inject)(E)};!function(e){e.DEFAULT="default",e.EDIT="edit"}(I||(I={}));var V=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 N=(0,t.defineComponent)({name:"SearchSelectInput",directives:{clickoutside:m.clickoutside},props:{data:{type:Array,required:!0},showInputBefore:Boolean,showCondition:Boolean,clickOutside:Function,conditions:{type:Array,default:function(){return[]}},defautUsingItem:Object,mode:{type:String,default:I.DEFAULT},getMenuList:Function,validateValues:Function},emits:["focus","add","delete"],setup:function(n,r){var i=r.emit,a=r.expose,o=(0,t.ref)(null),l=(0,t.ref)(null),u=(0,t.ref)(""),s=(0,t.ref)(!1),c=(0,t.ref)(!1),d=(0,t.ref)(!1),v=(0,t.ref)(n.defautUsingItem),f=(0,t.ref)(""),h=(0,t.ref)(!1),p=(0,e.debounce)(300,A),m=!1,_=(0,t.ref)([]),g=(0,t.ref)([]),b=C(),x=b.editKey,k=b.onValidate,L=b.valueSplitCode;function S(e){switch(e.code){case"ArrowDown":case"ArrowUp":E(e);break;case"Enter":case"NumpadEnter":!function(e){if(m){e.preventDefault();var t=g.value.find((function(e){return e.id===f.value}));t&&O(t)}}(e)}}function E(e){var t;e.preventDefault(),null===(t=o.value)||void 0===t||t.blur();for(var n=g.value.length,r=n,i=g.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=g.value[i];if(!a.disabled){r=-1;var l=document.getElementById(a.id);return null==l||l.focus(),void(f.value=a.id)}r-=1}}function N(e){j(),e&&A()}function z(e){var t;return w(this,void 0,void 0,y().mark((function n(){var r,a,o,l;return y().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null==e||e.preventDefault(),v.value){n.next=14;break}if(u.value){n.next=4;break}return n.abrupt("return");case 4:return r={id:u.value,name:u.value},n.next=7,T(r);case 7:if(n.sent){n.next=10;break}return n.abrupt("return");case 10:return i("add",new V(r,"text",L.value)),u.value="",A(),n.abrupt("return");case 14:if(null==(a=v.value.values)?void 0:a.length){n.next=40;break}if(!(null===(t=u.value)||void 0===t?void 0:t.length)){n.next=38;break}if(!u.value.includes(L.value)){n.next=27;break}return o=u.value.split(L.value),n.next=21,T({id:u.value,name:u.value});case 21:if(n.sent){n.next=24;break}return n.abrupt("return");case 24:o.forEach((function(e){return v.value.addValue({id:e,name:e})})),n.next=34;break;case 27:return l={id:u.value,name:u.value},n.next=30,T(l);case 30:if(n.sent){n.next=33;break}return n.abrupt("return");case 33:v.value.addValue(l);case 34:return i("add",v.value),u.value="",v.value=null,n.abrupt("return");case 38:return s.value=!0,n.abrupt("return");case 40:return n.next=42,T();case 42:if(n.sent){n.next=45;break}return n.abrupt("return");case 45:D();case 46:case"end":return n.stop()}}),n)})))}function O(e,t){var n,r,i,a;return w(this,void 0,void 0,y().mark((function l(){var s,c;return y().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(!(null===(n=e.value)||void 0===n?void 0:n.id)){l.next=5;break}return(s=new V(Object.assign(Object.assign({},e),{id:null!==(r=e.realId)&&void 0!==r?r:e.id}),t,L.value)).addValue(e.value),D(s),l.abrupt("return");case 5:if(v.value&&(null===(i=null==o?void 0:o.value)||void 0===i?void 0:i.innerText)){l.next=13;break}return v.value=new V(e,t,L.value),u.value="",(c="condition"===t)&&D(),d.value=c||!!v.value.children.length,j(),l.abrupt("return");case 13:if("condition"!==(null===(a=v.value)||void 0===a?void 0:a.type)){l.next=17;break}return v.value=new V(e,t,L.value),D(),l.abrupt("return");case 17:return v.value.addValue(e),l.next=20,T(e);case 20:if(l.sent){l.next=23;break}return l.abrupt("return");case 23:!v.value.multiple&&D();case 24:case"end":return l.stop()}}),l)})))}function T(e){return w(this,void 0,void 0,y().mark((function t(){var r,i,a,o;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(v.value){t.next=4;break}return t.next=3,F(null,[e]);case 3:case 8:return t.abrupt("return",t.sent);case 4:if(r=v.value,i=r.searchItem,a=r.validate,o=r.values,!a||"function"!=typeof n.validateValues){t.next=9;break}return t.next=8,F(i,e?[e]:o);case 9:return k(""),t.abrupt("return",!0);case 11:case"end":return t.stop()}}),t)})))}function F(e,t){var r;return w(this,void 0,void 0,y().mark((function i(){var a;return y().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,null===(r=n.validateValues)||void 0===r?void 0:r.call(n,null!=e?e:null,t).catch((function(){return!1}));case 2:if("string"!=typeof(a=i.sent)&&!1!==a){i.next=6;break}return k(a||"校验错误"),i.abrupt("return",!1);case 6:return k(""),i.abrupt("return",!0);case 8:case"end":return i.stop()}}),i)})))}function j(){c.value=!0,d.value=!0,s.value=!1;var e=setTimeout((function(){if(o.value){o.value.focus();var t=window.getSelection();0===t.focusOffset&&(t.selectAllChildren(o.value),t.collapseToEnd())}window.clearTimeout(e)}),0);i("focus",c.value)}function A(){var t,r,i,a,o;return w(this,void 0,void 0,y().mark((function l(){var s;return y().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(s=[],"function"!=typeof n.getMenuList||void 0!==(null===(r=null===(t=v.value)||void 0===t?void 0:t.searchItem)||void 0===r?void 0:r.async)&&!0!==v.value.searchItem.async){l.next=9;break}return h.value=!0,l.next=5,n.getMenuList(null===(i=v.value)||void 0===i?void 0:i.searchItem,u.value).catch((function(){return[]}));case 5:s=l.sent,h.value=!1,l.next=10;break;case 9:(null==v?void 0:v.value)?"condition"===v.value.type?s=n.conditions:(null===(o=v.value.values)||void 0===o?void 0:o.length)&&!v.value.multiple&&n.mode!==I.EDIT||(s=v.value.children.filter((function(e){return e.name.toLocaleLowerCase().includes(u.value.toLocaleLowerCase())}))):(null===(a=u.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(u.value.toLocaleLowerCase())?(s.push(t),null===(n=t.children)||void 0===n||n.forEach((function(n){s.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:n}))})),s.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:{id:u.value,name:u.value}}))):(null===(r=t.children)||void 0===r||r.forEach((function(n){n.name.toLocaleLowerCase().includes(u.value.toLocaleLowerCase())&&s.push(Object.assign(Object.assign({},t),{realId:t.id,id:(0,e.random)(10),value:n}))})),s.push(Object.assign(Object.assign({},t),{value:{id:u.value,name:u.value}})))})):s=n.data.filter((function(e){return!e.isSelected})).slice();case 10:g.value=s;case 11:case"end":return l.stop()}}),l)})))}function D(e){i("add",null!=e?e:v.value),v.value=null,u.value="",j()}function M(){var e=o.value.innerText;"\n"===e[e.length-1]||"\r"===e[0]?(q(e.slice(0,-1)),M()):"\n"!==e[0]&&"\r"!==e[0]||(q(e.slice(1)),M())}function q(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";o.value&&(o.value.innerHTML=t||(null===(e=v.value)||void 0===e?void 0:e.inputInnerHtml)||"")}return(0,t.watch)(x,(function(){n.mode===I.DEFAULT&&x.value&&(d.value=!1)})),(0,t.watchEffect)((function(){u.value||q()}),{flush:"pre"}),(0,t.watch)([g,d],(function(){var e;(null===(e=g.value)||void 0===e?void 0:e.some((function(e){return!e.disabled})))&&d.value?m||(f.value="",m=!0,document.addEventListener("keydown",S)):(document.removeEventListener("keydown",S),m=!1,f.value="")})),a({handleInputFocus:N,isFocus:c}),{popoverRef:l,inputRef:o,keyword:u,loading:h,remoteMenuList:_,menuList:g,menuHoverId:f,isFocus:c,usingItem:v,showPopover:d,showNoSelectValueError:s,debounceSetMenuList:p,documentArrowEvent:E,handleClickOutside:function(e){var t,r;!(null===(t=l.value)||void 0===t?void 0:t.contains(e.target))&&(null===(r=n.clickOutside)||void 0===r?void 0:r.call(n,e.target,l.value))&&(d.value=!1,c.value=!1,i("focus",c.value))},handleInputFocus:N,handleInputChange:function(e){var t,n,r,i,a,l,s;M();var c=e.target.innerText;if(/(\r|\n)/gm.test(c)||/\s{2}/gm.test(c))e.preventDefault(),c=c.replace(/(\r|\n)/gm,L.value).replace(/\s{2}/gm,""),o.value.innerText=c,j(),u.value=c.replace((null===(t=v.value)||void 0===t?void 0:t.keyInnerText)||"","").trim(),p();else if(!u.value&&c.length<((null===(r=null===(n=v.value)||void 0===n?void 0:n.inputInnerText)||void 0===r?void 0:r.length)||1)){var d=c.replace(" "," ").replace((null===(i=v.value)||void 0===i?void 0:i.keyInnerText.replace(" "," ").trim())||"","").trim();!d&&(null==c?void 0:c.length)||(v.value=null),u.value=d?c:"",p()}else(null===(l=null===(a=v.value)||void 0===a?void 0:a.values)||void 0===l?void 0:l.length)||(u.value=c.replace(" "," ").replace((null===(s=v.value)||void 0===s?void 0:s.keyInnerText.replace(" "," "))||"","").trim(),j(),p())},handleInputKeyup:function(e){switch(e.code){case"Enter":case"NumpadEnter":z(e);break;case"Backspace":v.value||u.value?(null===(n=v.value)||void 0===n?void 0:n.values.length)&&((null===(r=v.value)||void 0===r?void 0:r.multiple)||v.value.isInValueList(v.value.values[0]))?(v.value.values.splice(-1,1),u.value="",j()):k(""):(i("delete"),(0,t.nextTick)(A));default:s.value=!1}var n,r},handleSelectItem:O,handleSelectCondtionItem:function(e){O(e,"condition")},handleMenuFooterClick:function(e){switch(e.id){case"confirm":z();break;case"cancel":v.value.values=[],j()}}}},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)(x(),{trigger:"manual",theme:"light",placement:"bottom-start",arrow:!1,disableOutsideClick:!0,isShow:c},{default:function(){var e;return(0,t.withDirectives)((0,t.createVNode)("div",{ref:"inputRef",class:{"div-input":!0,"input-before":r.showInputBefore&&!(null===(e=r.keyword)||void 0===e?void 0:e.length),"input-after":s},contenteditable:!0,"data-placeholder":u||r.keyword?"":"请选择","data-tips":l||"",spellcheck:"false",onFocus:r.handleInputFocus,onInput:r.handleInputChange,onKeydown:r.handleInputKeyup},null),[[(0,t.resolveDirective)("clickoutside"),r.handleClickOutside]])},content:function(){var e;return r.loading?(0,t.createVNode)("div",null,[(0,t.createTextVNode)("加载中...")]):r.showNoSelectValueError?(0,t.createVNode)("div",null,[(0,t.createTextVNode)("包含键值的过滤查询必须有一个值")]):(null===(e=r.menuList)||void 0===e?void 0:e.length)?(0,t.createVNode)("div",{ref:"popoverRef",class:"bk-search-select-popover"},[(0,t.createVNode)(k,{list:r.menuList,keyword:r.keyword,multiple:!!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}})}}),z=(0,t.defineComponent)({name:"SearchSelected",props:{data:{type:Array,required:!0},selectedList:{type:Array,required:!0},overflowIndex:{type:Number,default:-1},conditions:{type:Array,default:function(){return[]}},getMenuList:Function,validateValues:Function},emits:["delete"],setup:function(e,n){var r=n.emit,i=(0,t.ref)(null),a=C(),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 V(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)(N,{ref:"inputRef",key:e.editKey.toString(),mode:I.EDIT,data:e.data,showCondition:!1,conditions:e.conditions,defautUsingItem:e.copySeletedItem(n),clickOutside:e.handleInputOutside,getMenuList:e.getMenuList,validateValues:e.validateValues,onAdd:function(t){return e.handleAddSelected(t,r)},onFocus:e.handleInputFocus},null)]):(0,t.createVNode)("li",{class:"search-container-selected ".concat((e.overflowIndex>=0?r<e.overflowIndex:r>=0)?"":"hidden-selected"),key:"".concat(n.id,"_").concat(r)},[(0,t.createVNode)("span",{class:"selected-name",onClick:function(t){return e.handleEditSeleted(t,n,r)}},[n.inputInnerText]),(0,t.createVNode)(_.Close,{class:"selected-clear",onClick:function(){return e.handleDeleteSelected(r)}},null)])};return(0,t.createVNode)(t.Fragment,null,[this.selectedList.map((function(r,i){return[e.overflowIndex>=0&&i===e.overflowIndex&&(0,t.createVNode)("div",{class:"search-container-selected overflow-selected"},[(0,t.createTextVNode)("+"),e.selectedList.length-e.overflowIndex]),n(r,i)]}))])}});var O={data:{type:Array,default:function(){return[]}},modelValue:{type:Array,default:function(){return[]}},shrink:{type:Boolean,default:!0},maxHeight:{type:Number,default:120},minHeight:{type:Number,default:26},conditions:{type:Array,default:function(){return[{id:"or",name:"或"},{id:"and",name:"且"}]}},clearable:{type:Boolean,default:!0},getMenuList:Function,validateValues:Function,valueSplitCode:{type:String,default:"|"},uniqueSelect:{type:Boolean,default:!1}};const T=(0,t.defineComponent)({name:"SearchSelect",directives:{clickoutside:m.clickoutside},props:O,emits:["update:modelValue"],setup:function(n,r){var i,a,o=r.emit,l=(0,t.ref)(null),u=(0,t.ref)(null),v=(0,t.ref)(!1),h=(0,t.ref)([]),p=(0,t.ref)(-1),m=(0,e.debounce)(32,k),_=(0,t.ref)(""),g=(0,t.ref)(""),y=(0,t.computed)((function(){return n.valueSplitCode}));function w(e,t){_.value="".concat(e.id,"_").concat(t)}function b(e,t){var n=h.value.slice();n.splice(t,1,e),o("update:modelValue",n.map((function(e){return e.toValue()}))),_.value=""}function x(e){g.value=e||""}function k(){if(v.value||h.value.length<1)p.value=-1;else{for(var e=u.value.querySelector(".bk-search-select-container"),t=u.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(p.value=o);(i+=l?l.clientWidth+6:0)>=t-40&&(a=o),o+=1}a===r.length-1&&i<=t?p.value=-1:p.value=i>=t-40?a:a-1}}return(0,t.watch)((function(){return n.data}),(function(){var e;null===(e=(i=(0,t.ref)(JSON.parse(JSON.stringify(n.data)))).value)||void 0===e||e.forEach((function(e){e.isSelected=!!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 h.value=[],void(null===(t=i.value)||void 0===t||t.forEach((function(e){e.isSelected=!1})));var a=[];e.forEach((function(e){var t,r=h.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||[],a.push(r);else{var i=n.data.find((function(t){return t.id===e.id})),o="default";i||(i=n.conditions.find((function(t){return t.id===e.id})))&&(o="condition"),i||(null===(t=e.values)||void 0===t?void 0:t.length)||(o="text");var l=new V(i||e,o,y.value);l.values=e.values||[],a.push(l)}})),h.value=a,null===(r=i.value)||void 0===r||r.forEach((function(e){e.isSelected=!!a.some((function(t){return t.id===e.id}))}))}),{immediate:!0,deep:!0}),(0,t.onMounted)((function(){d(u.value.querySelector(".bk-search-select-container"),m)})),(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}!--s&&c&&c.parentNode.removeChild(c)}}(u.value.querySelector(".bk-search-select-container"),m)})),a={onEditClick:w,onEditEnter:b,onEditBlur:function(){_.value="",x("")},onValidate:x,editKey:_,valueSplitCode:y},(0,t.provide)(E,a),{inputRef:l,wrapRef:u,isFocus:v,copyData:i,selectedList:h,overflowIndex:p,validateStr:g,splitCode:y,onEditClick:w,onEditEnter:b,handleWrapClick:function(){_.value||l.value.handleInputFocus()},handleInputFocus:function(e){e&&(p.value=-1),v.value=e},handleResize:k,handleClearAll:function(){h.value=[],p.value=-1,o("update:modelValue",[])},handleInputOutside:function(e){var t;return!(null===(t=u.value)||void 0===t?void 0:t.contains(e))},handleAddSelected:function(e){var t=h.value.slice();t.push(e),x(""),o("update:modelValue",t.map((function(e){return e.toValue()})))},handleDeleteSelected:function(e){var t=h.value.slice();t.splice("number"==typeof e?e:h.value.length-1,1),x(""),o("update:modelValue",t.map((function(e){return e.toValue()})))}}},render:function(){var e,n,r=this,i="".concat(!this.shrink||this.isFocus?this.maxHeight:this.minHeight,"px"),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)(z,{data:this.copyData,conditions:this.conditions,selectedList:this.selectedList,overflowIndex:this.overflowIndex,getMenuList:this.getMenuList,validateValues:this.validateValues,onDelete:this.handleDeleteSelected},Object.assign({},o)),(0,t.createVNode)("div",{class:"search-container-input"},[(0,t.createVNode)(N,{ref:"inputRef",data:this.copyData,showInputBefore:!this.selectedList.length,showCondition:a,conditions:this.conditions,clickOutside:this.handleInputOutside,getMenuList:this.getMenuList,validateValues:this.validateValues,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 F=(0,e.withInstall)(T);const j=F})(),u})()));
|
@@ -17,7 +17,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
17
17
|
type: PropType<SearchInputMode>;
|
18
18
|
default: SearchInputMode;
|
19
19
|
};
|
20
|
-
|
20
|
+
getMenuList: PropType<GetMenuListFunc>;
|
21
21
|
validateValues: PropType<ValidateValuesFunc>;
|
22
22
|
}, {
|
23
23
|
popoverRef: Ref<HTMLDivElement>;
|
@@ -33,7 +33,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
33
33
|
name: string;
|
34
34
|
id: string;
|
35
35
|
realId?: string;
|
36
|
+
isSelected?: boolean;
|
36
37
|
};
|
38
|
+
isSelected?: boolean;
|
37
39
|
}[]>;
|
38
40
|
menuList: Ref<ISearchItem[]>;
|
39
41
|
menuHoverId: Ref<string>;
|
@@ -70,7 +72,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
70
72
|
type: PropType<SearchInputMode>;
|
71
73
|
default: SearchInputMode;
|
72
74
|
};
|
73
|
-
|
75
|
+
getMenuList: PropType<GetMenuListFunc>;
|
74
76
|
validateValues: PropType<ValidateValuesFunc>;
|
75
77
|
}>> & {
|
76
78
|
onFocus?: (...args: any[]) => any;
|
@@ -440,7 +440,7 @@
|
|
440
440
|
border-color: var(--search-select-focus-border-color) !important;
|
441
441
|
}
|
442
442
|
.bk-search-select .div-input {
|
443
|
-
height:
|
443
|
+
height: 100%;
|
444
444
|
padding: 5px 0;
|
445
445
|
line-height: 20px;
|
446
446
|
word-break: break-all;
|
@@ -452,7 +452,7 @@
|
|
452
452
|
.bk-search-select-container {
|
453
453
|
position: relative;
|
454
454
|
display: flex;
|
455
|
-
min-height:
|
455
|
+
min-height: 30px;
|
456
456
|
overflow: hidden;
|
457
457
|
font-size: 12px;
|
458
458
|
color: var(--search-select-font-color);
|
@@ -701,6 +701,7 @@
|
|
701
701
|
padding: 0 12px;
|
702
702
|
flex: 0 0 32px;
|
703
703
|
outline: none;
|
704
|
+
white-space: pre;
|
704
705
|
}
|
705
706
|
.bk-search-select-menu .menu-content .menu-item:hover {
|
706
707
|
cursor: pointer;
|