bkui-vue 0.0.1-beta.83 → 0.0.1-beta.86
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 +28 -28
- package/dist/index.esm.js +379 -456
- package/dist/index.umd.js +29 -29
- package/dist/style.css +1 -1
- package/lib/alert/alert.css +3 -3
- package/lib/alert/alert.less +5 -3
- package/lib/alert/alert.variable.css +3 -3
- package/lib/alert/index.js +1 -1
- package/lib/badge/badge.d.ts +1 -1
- package/lib/badge/index.d.ts +4 -4
- package/lib/button/button.d.ts +1 -1
- package/lib/button/index.d.ts +4 -4
- package/lib/cascader/cascader.d.ts +2 -2
- package/lib/cascader/index.d.ts +7 -7
- package/lib/checkbox/index.js +1 -1
- package/lib/date-picker/date-picker.d.ts +1 -1
- package/lib/date-picker/index.d.ts +4 -4
- package/lib/date-picker/index.js +1 -1
- package/lib/dialog/dialog.d.ts +1 -1
- package/lib/dialog/index.d.ts +4 -4
- package/lib/dropdown/dropdown.d.ts +2 -2
- package/lib/dropdown/index.d.ts +7 -7
- package/lib/form/form-item.d.ts +3 -3
- package/lib/form/form.d.ts +23 -9
- package/lib/form/index.d.ts +44 -21
- package/lib/form/index.js +1 -1
- package/lib/form/type.d.ts +5 -4
- package/lib/form/validator.d.ts +1 -0
- package/lib/input/index.d.ts +20 -20
- package/lib/input/index.js +1 -1
- package/lib/input/input.d.ts +6 -6
- package/lib/link/index.d.ts +7 -7
- package/lib/link/link.d.ts +2 -2
- package/lib/message/messageConstructor.d.ts +1 -1
- package/lib/notify/notifyConstructor.d.ts +2 -2
- package/lib/pagination/index.d.ts +4 -4
- package/lib/pagination/index.js +1 -1
- package/lib/pagination/pagination.d.ts +1 -1
- package/lib/popover/index.d.ts +13 -13
- package/lib/popover/popover.d.ts +4 -4
- package/lib/progress/index.d.ts +4 -4
- package/lib/progress/progress.d.ts +1 -1
- package/lib/radio/index.js +1 -1
- package/lib/rate/index.js +1 -1
- package/lib/resize-layout/index.d.ts +7 -7
- package/lib/resize-layout/resize-layout.d.ts +2 -2
- package/lib/select/index.d.ts +34 -87
- package/lib/select/index.js +1 -1
- package/lib/select/option.d.ts +2 -7
- package/lib/select/optionGroup.d.ts +1 -1
- package/lib/select/select.d.ts +6 -14
- package/lib/shared/index.d.ts +2 -0
- package/lib/shared/index.js +1 -1
- package/lib/shared/token.d.ts +4 -2
- package/lib/switcher/index.d.ts +4 -4
- package/lib/switcher/index.js +1 -1
- package/lib/switcher/switcher.d.ts +1 -1
- package/lib/tab/index.d.ts +5 -5
- package/lib/tab/tab-panel.d.ts +1 -1
- package/lib/tab/tab.d.ts +1 -1
- package/lib/table/const.d.ts +3 -1
- package/lib/table/index.d.ts +83 -6
- package/lib/table/index.js +1 -1
- package/lib/table/props.d.ts +27 -1
- package/lib/table/render.d.ts +1 -1
- package/lib/table/table.css +27 -7
- package/lib/table/table.d.ts +37 -2
- package/lib/table/table.less +30 -6
- package/lib/table/table.variable.css +27 -7
- package/lib/table/use-common.d.ts +4 -2
- package/lib/table/utils.d.ts +7 -0
- package/lib/tag-input/index.d.ts +11 -11
- package/lib/tag-input/index.js +1 -1
- package/lib/tag-input/tag-input.d.ts +3 -3
- package/lib/transfer/const.d.ts +5 -0
- package/lib/transfer/index.d.ts +164 -150
- package/lib/transfer/index.js +1 -1
- package/lib/transfer/props.d.ts +54 -0
- package/lib/transfer/transfer.css +6 -6
- package/lib/transfer/transfer.d.ts +70 -95
- package/lib/transfer/transfer.less +4 -4
- package/lib/transfer/transfer.variable.css +6 -6
- package/lib/tree/index.js +1 -1
- package/lib/upload/upload-list.d.ts +1 -1
- package/lib/upload/upload-trigger.d.ts +1 -1
- package/lib/upload/upload.d.ts +1 -1
- package/lib/virtual-render/index.js +1 -1
- package/package.json +2 -1
- package/lib/form/common.d.ts +0 -3
- package/lib/use-form.d.ts +0 -3
package/lib/table/table.less
CHANGED
@@ -30,20 +30,32 @@
|
|
30
30
|
.@{bk-prefix}-table-body {
|
31
31
|
background: @table-bg-color;
|
32
32
|
|
33
|
+
&.__is-empty {
|
34
|
+
display: flex;
|
35
|
+
height: 100%;
|
36
|
+
justify-content: center;
|
37
|
+
align-items: center;
|
38
|
+
|
39
|
+
.@{bk-prefix}-table-body-content {
|
40
|
+
display: flex;
|
41
|
+
height: 100%;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
33
45
|
table {
|
34
46
|
width: 100%;
|
35
47
|
border-collapse: collapse;
|
36
48
|
table-layout: fixed;
|
49
|
+
align-self: flex-start;
|
37
50
|
|
38
51
|
th,
|
39
52
|
td {
|
40
53
|
min-width: 80px;
|
41
|
-
padding: 0 15px;
|
42
54
|
clear: both;
|
43
55
|
|
44
56
|
.cell {
|
45
|
-
|
46
|
-
|
57
|
+
height: var(--row-height);
|
58
|
+
padding: 0 15px;
|
47
59
|
overflow: hidden;
|
48
60
|
line-height: var(--row-height);
|
49
61
|
color: @table-body-font-color;
|
@@ -72,6 +84,11 @@
|
|
72
84
|
color: @table-head-font-color;
|
73
85
|
background-color: @table-head-bg-color;
|
74
86
|
|
87
|
+
.cell {
|
88
|
+
display: flex;
|
89
|
+
align-items: center;
|
90
|
+
}
|
91
|
+
|
75
92
|
&.active,
|
76
93
|
&:hover {
|
77
94
|
background: @table-row-active-bg-color;
|
@@ -149,7 +166,9 @@
|
|
149
166
|
&.bordered-row {
|
150
167
|
td,
|
151
168
|
th {
|
152
|
-
|
169
|
+
.cell {
|
170
|
+
border-bottom: 1px solid @table-border-color;
|
171
|
+
}
|
153
172
|
}
|
154
173
|
|
155
174
|
&.has-footer {
|
@@ -159,7 +178,9 @@
|
|
159
178
|
tr {
|
160
179
|
&:last-child {
|
161
180
|
td {
|
162
|
-
|
181
|
+
.cell {
|
182
|
+
border-bottom: none;
|
183
|
+
}
|
163
184
|
}
|
164
185
|
}
|
165
186
|
}
|
@@ -189,8 +210,11 @@
|
|
189
210
|
td {
|
190
211
|
border-top: none;
|
191
212
|
border-right: none;
|
192
|
-
border-bottom: none;
|
193
213
|
border-left: none;
|
214
|
+
|
215
|
+
.cell {
|
216
|
+
border-bottom: none;
|
217
|
+
}
|
194
218
|
}
|
195
219
|
}
|
196
220
|
|
@@ -320,26 +320,38 @@
|
|
320
320
|
.bk-table .bk-table-body {
|
321
321
|
background: white;
|
322
322
|
}
|
323
|
+
.bk-table .bk-table-head.__is-empty,
|
324
|
+
.bk-table .bk-table-body.__is-empty {
|
325
|
+
display: flex;
|
326
|
+
height: 100%;
|
327
|
+
justify-content: center;
|
328
|
+
align-items: center;
|
329
|
+
}
|
330
|
+
.bk-table .bk-table-head.__is-empty .bk-table-body-content,
|
331
|
+
.bk-table .bk-table-body.__is-empty .bk-table-body-content {
|
332
|
+
display: flex;
|
333
|
+
height: 100%;
|
334
|
+
}
|
323
335
|
.bk-table .bk-table-head table,
|
324
336
|
.bk-table .bk-table-body table {
|
325
337
|
width: 100%;
|
326
338
|
border-collapse: collapse;
|
327
339
|
table-layout: fixed;
|
340
|
+
align-self: flex-start;
|
328
341
|
}
|
329
342
|
.bk-table .bk-table-head table th,
|
330
343
|
.bk-table .bk-table-body table th,
|
331
344
|
.bk-table .bk-table-head table td,
|
332
345
|
.bk-table .bk-table-body table td {
|
333
346
|
min-width: 80px;
|
334
|
-
padding: 0 15px;
|
335
347
|
clear: both;
|
336
348
|
}
|
337
349
|
.bk-table .bk-table-head table th .cell,
|
338
350
|
.bk-table .bk-table-body table th .cell,
|
339
351
|
.bk-table .bk-table-head table td .cell,
|
340
352
|
.bk-table .bk-table-body table td .cell {
|
341
|
-
|
342
|
-
|
353
|
+
height: var(--row-height);
|
354
|
+
padding: 0 15px;
|
343
355
|
overflow: hidden;
|
344
356
|
line-height: var(--row-height);
|
345
357
|
color: #575961;
|
@@ -372,6 +384,11 @@
|
|
372
384
|
color: #313238;
|
373
385
|
background-color: #fafbfd;
|
374
386
|
}
|
387
|
+
.bk-table .bk-table-head table thead th .cell,
|
388
|
+
.bk-table .bk-table-body table thead th .cell {
|
389
|
+
display: flex;
|
390
|
+
align-items: center;
|
391
|
+
}
|
375
392
|
.bk-table .bk-table-head table thead th.active,
|
376
393
|
.bk-table .bk-table-body table thead th.active,
|
377
394
|
.bk-table .bk-table-head table thead th:hover,
|
@@ -426,14 +443,14 @@
|
|
426
443
|
.bk-table .bk-table-footer.is-hidden {
|
427
444
|
display: none;
|
428
445
|
}
|
429
|
-
.bk-table.bordered-row td,
|
430
|
-
.bk-table.bordered-row th {
|
446
|
+
.bk-table.bordered-row td .cell,
|
447
|
+
.bk-table.bordered-row th .cell {
|
431
448
|
border-bottom: 1px solid #dcdee5;
|
432
449
|
}
|
433
450
|
.bk-table.bordered-row.has-footer {
|
434
451
|
border-bottom: none;
|
435
452
|
}
|
436
|
-
.bk-table.bordered-row.has-footer.has-scroll-y tr:last-child td {
|
453
|
+
.bk-table.bordered-row.has-footer.has-scroll-y tr:last-child td .cell {
|
437
454
|
border-bottom: none;
|
438
455
|
}
|
439
456
|
.bk-table.bordered-outer {
|
@@ -452,9 +469,12 @@
|
|
452
469
|
.bk-table.bordered-none td {
|
453
470
|
border-top: none;
|
454
471
|
border-right: none;
|
455
|
-
border-bottom: none;
|
456
472
|
border-left: none;
|
457
473
|
}
|
474
|
+
.bk-table.bordered-none th .cell,
|
475
|
+
.bk-table.bordered-none td .cell {
|
476
|
+
border-bottom: none;
|
477
|
+
}
|
458
478
|
.bk-table .bk-table-fixed {
|
459
479
|
position: absolute;
|
460
480
|
top: 0;
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import { TablePropTypes } from './props';
|
2
|
-
export declare const useClass: (props: TablePropTypes, root?: any, reactiveProp?: any) => {
|
2
|
+
export declare const useClass: (props: TablePropTypes, root?: any, reactiveProp?: any, pageData?: any) => {
|
3
3
|
tableClass: import("vue").ComputedRef<string>;
|
4
4
|
headClass: string;
|
5
|
-
contentClass:
|
5
|
+
contentClass: {
|
6
|
+
[x: string]: boolean;
|
7
|
+
};
|
6
8
|
footerClass: import("vue").ComputedRef<string>;
|
7
9
|
wrapperStyle: import("vue").ComputedRef<{
|
8
10
|
minHeight: string | number;
|
package/lib/table/utils.d.ts
CHANGED
@@ -91,3 +91,10 @@ export declare const resolveHeadConfig: (props: TablePropTypes) => {
|
|
91
91
|
* @returns
|
92
92
|
*/
|
93
93
|
export declare const getRowText: (row: any, key: string, column: Column) => any;
|
94
|
+
/**
|
95
|
+
* 格式化prop配置为标准数组格式
|
96
|
+
* @param prop prop对象值
|
97
|
+
* @param args 如果是function参数
|
98
|
+
* @returns
|
99
|
+
*/
|
100
|
+
export declare const formatPropAsArray: (prop: string | object | (() => any), args: any[]) => any;
|
package/lib/tag-input/index.d.ts
CHANGED
@@ -3,16 +3,16 @@ declare const TagInput: {
|
|
3
3
|
$: import("vue").ComponentInternalInstance;
|
4
4
|
$data: {};
|
5
5
|
$props: Partial<{
|
6
|
+
trigger: string;
|
7
|
+
disabled: boolean;
|
6
8
|
placeholder: string;
|
7
9
|
list: {
|
8
10
|
[key: string]: any;
|
9
11
|
}[];
|
10
12
|
separator: string;
|
11
|
-
disabled: boolean;
|
12
13
|
clearable: boolean;
|
13
14
|
showClearOnlyHover: boolean;
|
14
15
|
modelValue: string[];
|
15
|
-
trigger: string;
|
16
16
|
allowCreate: boolean;
|
17
17
|
searchKey: string | string[];
|
18
18
|
displayKey: string;
|
@@ -176,13 +176,13 @@ declare const TagInput: {
|
|
176
176
|
default: any;
|
177
177
|
};
|
178
178
|
}>> & {
|
179
|
-
onChange?: (...args: any[]) => any;
|
180
179
|
onBlur?: (...args: any[]) => any;
|
180
|
+
onChange?: (...args: any[]) => any;
|
181
181
|
onSelect?: (...args: any[]) => any;
|
182
182
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
183
183
|
onRemove?: (...args: any[]) => any;
|
184
184
|
onRemoveAll?: (...args: any[]) => any;
|
185
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "
|
185
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "trigger" | "disabled" | "placeholder" | "list" | "separator" | "clearable" | "showClearOnlyHover" | "modelValue" | "allowCreate" | "searchKey" | "displayKey" | "tooltipKey" | "saveKey" | "hasDeleteIcon" | "useGroup" | "maxData" | "maxResult" | "contentMaxHeight" | "contentWidth" | "allowNextFocus" | "allowAutoMatch" | "leftSpace" | "createTagValidator" | "filterCallback" | "tagTpl" | "tpl" | "pasteFn">;
|
186
186
|
$attrs: {
|
187
187
|
[x: string]: unknown;
|
188
188
|
};
|
@@ -332,8 +332,8 @@ declare const TagInput: {
|
|
332
332
|
default: any;
|
333
333
|
};
|
334
334
|
}>> & {
|
335
|
-
onChange?: (...args: any[]) => any;
|
336
335
|
onBlur?: (...args: any[]) => any;
|
336
|
+
onChange?: (...args: any[]) => any;
|
337
337
|
onSelect?: (...args: any[]) => any;
|
338
338
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
339
339
|
onRemove?: (...args: any[]) => any;
|
@@ -395,16 +395,16 @@ declare const TagInput: {
|
|
395
395
|
}[];
|
396
396
|
};
|
397
397
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "blur" | "change" | "update:modelValue" | "remove" | "removeAll")[], string, {
|
398
|
+
trigger: string;
|
399
|
+
disabled: boolean;
|
398
400
|
placeholder: string;
|
399
401
|
list: {
|
400
402
|
[key: string]: any;
|
401
403
|
}[];
|
402
404
|
separator: string;
|
403
|
-
disabled: boolean;
|
404
405
|
clearable: boolean;
|
405
406
|
showClearOnlyHover: boolean;
|
406
407
|
modelValue: string[];
|
407
|
-
trigger: string;
|
408
408
|
allowCreate: boolean;
|
409
409
|
searchKey: string | string[];
|
410
410
|
displayKey: string;
|
@@ -588,8 +588,8 @@ declare const TagInput: {
|
|
588
588
|
default: any;
|
589
589
|
};
|
590
590
|
}>> & {
|
591
|
-
onChange?: (...args: any[]) => any;
|
592
591
|
onBlur?: (...args: any[]) => any;
|
592
|
+
onChange?: (...args: any[]) => any;
|
593
593
|
onSelect?: (...args: any[]) => any;
|
594
594
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
595
595
|
onRemove?: (...args: any[]) => any;
|
@@ -790,8 +790,8 @@ declare const TagInput: {
|
|
790
790
|
default: any;
|
791
791
|
};
|
792
792
|
}>> & {
|
793
|
-
onChange?: (...args: any[]) => any;
|
794
793
|
onBlur?: (...args: any[]) => any;
|
794
|
+
onChange?: (...args: any[]) => any;
|
795
795
|
onSelect?: (...args: any[]) => any;
|
796
796
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
797
797
|
onRemove?: (...args: any[]) => any;
|
@@ -853,16 +853,16 @@ declare const TagInput: {
|
|
853
853
|
}[];
|
854
854
|
};
|
855
855
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "blur" | "change" | "update:modelValue" | "remove" | "removeAll")[], "select" | "blur" | "change" | "update:modelValue" | "remove" | "removeAll", {
|
856
|
+
trigger: string;
|
857
|
+
disabled: boolean;
|
856
858
|
placeholder: string;
|
857
859
|
list: {
|
858
860
|
[key: string]: any;
|
859
861
|
}[];
|
860
862
|
separator: string;
|
861
|
-
disabled: boolean;
|
862
863
|
clearable: boolean;
|
863
864
|
showClearOnlyHover: boolean;
|
864
865
|
modelValue: string[];
|
865
|
-
trigger: string;
|
866
866
|
allowCreate: boolean;
|
867
867
|
searchKey: string | string[];
|
868
868
|
displayKey: string;
|
package/lib/tag-input/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("lodash"),require("../directives"),require("../icon"),require("../loading"),require("../popover"));else if("function"==typeof define&&define.amd)define(["../shared","vue","lodash","../directives","../icon","../loading","../popover"],t);else{var r="object"==typeof exports?t(require("../shared"),require("vue"),require("lodash"),require("../directives"),require("../icon"),require("../loading"),require("../popover")):t(e["../shared"],e.vue,e.lodash,e["../directives"],e["../icon"],e["../loading"],e["../popover"]);for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(self,((e,t,r,a,n,o,l)=>(()=>{"use strict";var i={4061:e=>{e.exports=a},6870:e=>{e.exports=n},4870:e=>{e.exports=o},5537:e=>{e.exports=l},4212:t=>{t.exports=e},467:e=>{e.exports=r},748:e=>{e.exports=t}},s={};function u(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return i[e](r,r.exports,u),r.exports}u.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return u.d(t,{a:t}),t},u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var c={};return(()=>{u.r(c),u.d(c,{default:()=>L});var e=u(4212);function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}function a(e,t){if(e){if("string"==typeof e)return r(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?r(e,t):void 0}}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var l=u(748),i=u(467),s=u(4061),d=u(6870),p=u(4870),f=u.n(p),v=u(5537),g=u.n(v),h=12,y=function(e){for(var t=e.length,r=0,a=0;a<t;a++)0!=(65280&e.charCodeAt(a))&&(r+=1),r+=1;return r};const m=(0,l.defineComponent)({name:"ListTagRender",props:{node:e.PropTypes.object,searchKey:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.arrayOf(e.PropTypes.string)]),displayKey:e.PropTypes.string,searchKeyword:e.PropTypes.string,tpl:{type:Function,default:null}},render:function(){var e=this,t=function(t){if(e.searchKeyword){var r=new RegExp("(".concat(e.searchKeyword,")"),"i");return t.replace(r,'<strong class="highlight-text">$1</strong>')}return t};if(this.tpl)return this.tpl(this.node,t,l.h,this);var r=this.node[this.displayKey];return(0,l.createVNode)("div",{class:"bk-selector-node"},[(0,l.createVNode)("span",{class:"text",innerHTML:t(r)},[r])])}}),b=(0,l.defineComponent)({name:"TagRender",props:{node:e.PropTypes.object,displayKey:e.PropTypes.string,tpl:{type:Function,default:null}},render:function(){return this.tpl?this.tpl(this.node,l.h,this):(0,l.createVNode)("div",{class:"tag"},[(0,l.createVNode)("span",{class:"text"},[this.node[this.displayKey]])])}}),T=(0,l.defineComponent)({name:"TagInput",directives:{bkTooltips:s.bkTooltips},props:{modelValue:e.PropTypes.arrayOf(e.PropTypes.string).def([]),placeholder:e.PropTypes.string.def("请输入并按 Enter 结束"),list:e.PropTypes.arrayOf(e.PropTypes.object).def([]),disabled:e.PropTypes.bool.def(!1),tooltipKey:e.PropTypes.string.def(""),saveKey:e.PropTypes.string.def("id"),displayKey:e.PropTypes.string.def("name"),hasDeleteIcon:e.PropTypes.bool.def(!1),clearable:e.PropTypes.bool.def(!0),trigger:e.PropTypes.commonType(["focus","search"]).def("search"),searchKey:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.arrayOf(e.PropTypes.string)]).def("name"),useGroup:e.PropTypes.bool.def(!1),allowCreate:e.PropTypes.bool.def(!1),maxData:e.PropTypes.number.def(-1),maxResult:e.PropTypes.number.def(10),contentMaxHeight:e.PropTypes.number.def(300),contentWidth:e.PropTypes.number.def(190),separator:e.PropTypes.string.def(""),allowNextFocus:e.PropTypes.bool.def(!0),allowAutoMatch:e.PropTypes.bool.def(!1),showClearOnlyHover:e.PropTypes.bool.def(!1),leftSpace:e.PropTypes.number.def(0),createTagValidator:{type:Function,default:null},filterCallback:{type:Function,default:null},tagTpl:{type:Function,default:null},tpl:{type:Function,default:null},pasteFn:{type:Function,default:null}},emits:["update:modelValue","change","select","blur","remove","removeAll"],setup:function(e,r){var s=r.emit,u=(0,l.reactive)({isEdit:!1,isHover:!1,focusItemIndex:e.allowCreate?-1:0}),c=(0,l.reactive)({isShow:!1,width:190,modifiers:[{name:"offset",options:{offset:[0,4]}}]}),d=function(e){var t=(0,l.reactive)({curPage:1,totalSize:0,totalPage:0,pageSize:e,isPageLoading:!1,curPageList:[],renderListPaged:[]});return{pageState:t,initPage:function(){var e,r,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.curPage=1,t.totalSize=a.length,t.totalPage=Math.ceil(t.totalSize/t.pageSize)||1;var n=[];if(t.pageSize>0)for(var l=0;l<t.totalSize;l+=t.pageSize)n.push(a.slice(l,l+t.pageSize));(e=t.renderListPaged).splice.apply(e,[0,t.renderListPaged.length].concat(n)),(r=t.curPageList).splice.apply(r,[0,t.curPageList.length].concat(o(t.renderListPaged[t.curPage-1]||[])))},pageChange:function(e){var r;t.curPage=e,(r=t.curPageList).splice.apply(r,[t.curPageList.length,0].concat(o(t.renderListPaged[t.curPage-1]||[]))),t.isPageLoading=!1}}}((0,l.toRefs)(e).maxResult),p=d.pageState,f=d.initPage,v=d.pageChange,g=(0,l.ref)(""),m=(0,l.ref)(null),b=(0,l.ref)(null),T=(0,l.ref)(null),L=(0,l.ref)(null),w=(0,l.ref)(null),P=(0,l.ref)(null),x=(0,l.ref)(null),I=(0,l.computed)((function(){return!e.disabled&&e.hasDeleteIcon})),S=(0,l.computed)((function(){return 1===e.maxData})),C=(0,l.computed)((function(){return 0===R.selectedTagList.length&&""===g.value&&!u.isEdit})),K=(0,l.computed)((function(){return e.clearable&&!e.disabled&&0!==R.selectedTagList.length&&(!e.showClearOnlyHover||u.isHover)})),V=(0,l.computed)((function(){return{"bk-tag-input-trigger":!0,active:u.isEdit,disabled:e.disabled}}));(0,l.watch)([function(){return o(e.modelValue)},function(){return o(e.list)}],(function(){F()})),(0,l.watch)(g,(0,i.debounce)((function(){var t=0!==p.curPageList.length,r=g.value;""!==r&&t||""===r&&"focus"===e.trigger&&t?c.isShow=!0:"focus"===e.trigger&&t||(c.isShow=!1)}),150)),(0,l.watch)((function(){return c.isShow}),(function(e){k(),e&&w.value&&((0,l.nextTick)((function(){w.value.scrollTop=0})),w.value.removeEventListener("scroll",N),w.value.addEventListener("scroll",N))}));var k=function(){var e,t,r=S.value?0:null===(e=L.value)||void 0===e?void 0:e.offsetLeft;c.modifiers=[{name:"offset",options:{offset:[r,4]}}],null===(t=P.value)||void 0===t||t.update()},N=function(){if(!p.isPageLoading&&0!==w.value.scrollTop){var e=w.value;if(e.scrollTop+e.offsetHeight>=e.scrollHeight){var t=p.curPage+1;t<=p.totalPage&&(p.isPageLoading=!0,setTimeout((function(){v(t)}),500))}}},A=function(){var e;return Array.from((null===(e=T.value)||void 0===e?void 0:e.childNodes)||[]).filter((function(e){return e.nodeType!==Node.TEXT_NODE}))},O=function(t){if(!e.disabled){if(null==t?void 0:t.target){var r=t.target.className;(r.indexOf("bk-tag-input-trigger")>-1||r.indexOf("tag-list")>-1)&&T.value.appendChild(L.value)}clearTimeout(x.value),S.value&&j.value.length&&(R.tagListCache=o(j.value),R.selectedTagListCache=o(R.selectedTagList),g.value=R.selectedTagListCache[0][e.saveKey],$(R.selectedTagList[0],0),H()),u.isEdit=!0,(0,l.nextTick)((function(){var t;null===(t=m.value)||void 0===t||t.focus(),"focus"===e.trigger&&0!==R.localList.length&&(q(),c.isShow?k():c.isShow=!0)}))}},R=(0,l.reactive)({localList:[],tagListCache:[],selectedTagList:[],selectedTagListCache:[]}),j=(0,l.computed)((function(){return R.selectedTagList.map((function(t){return t[e.saveKey]}))})),E=function(e){var t=(0,l.toRefs)(e),r=t.useGroup,a=t.saveKey,n=t.displayKey,i=t.list,s=(0,l.reactive)([]);return(0,l.watch)([r,a,n,i],(function(){var e=i.value;r.value&&(e=i.value.reduce((function(e,t){var r=[];return t.children&&(r=t.children.map((function(e){return Object.assign({group:{groupId:t[a.value],groupName:t[n.value]}},e)}))),e.concat(r)}),[])),s.splice.apply(s,[0,s.length].concat(o(e)))}),{immediate:!0,deep:!0}),s}(e),D=(0,l.computed)((function(){if(e.useGroup){var t={};return p.curPageList.forEach((function(e,r){e.__index__=r,t[e.group.groupId]||(t[e.group.groupId]={id:e.group.groupId,name:e.group.groupName,children:[]}),t[e.group.groupId].children.push(e)})),Object.keys(t).map((function(e){return t[e]}))}return p.curPageList})),F=function(){var t=e.saveKey,r=e.modelValue,a=e.displayKey,l=e.allowCreate,i=e.trigger;R.selectedTagList=[],R.localList=o(E),r.length&&(r.forEach((function(e){var r=R.localList.find((function(r){return e===r[t]}));if(void 0!==r)R.selectedTagList.push(r);else if(l&&!j.value.includes(e)){var o;R.selectedTagList.push((n(o={},t,e),n(o,a,e),o))}})),S.value||(R.localList=R.localList.filter((function(e){return!r.includes(e[t])})))),"focus"===i&&q()},q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=e.searchKey,a=e.filterCallback,n=t.toLowerCase(),o=[];if("function"==typeof a)o=a(n,r,R.localList)||[];else if(Array.isArray(r)){var l=r.map((function(e){return R.localList.filter((function(t){return-1!==t[e].toLowerCase().indexOf(n)}))}));o=Array.from(new Set(l.flat()))}else o=R.localList.filter((function(e){return-1!==e[r].toLowerCase().indexOf(n)}));f(o)};(0,l.onMounted)((function(){F()}));var z=function(){g.value=""},_=function(){if(S.value)return 0;var e=A().findIndex((function(e){return"tagInputItem"===e.id}));return e>=0?e:0},M=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t&&e){var a=t;r&&(a=t.nextElementSibling||null),t.parentNode.insertBefore(e,a)}},H=function(t){var r=e.maxData,a=e.trigger,n=e.allowCreate;if(-1===r||r>j.value.length){var o=((null==t?void 0:t.target)?t.target:g).value,l=y(o);l?(q(o),m.value.style.width="".concat(l*h,"px")):"focus"===a&&q()}else B(),g.value="",c.isShow=!1;u.isEdit=!0,u.focusItemIndex=n?-1:0},B=function(){x.value=setTimeout((function(){var t,r,n=g.value;if(z(),u.isEdit=!1,S.value){var o=(t=R.tagListCache,r=1,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a,n,o=[],l=!0,i=!1;try{for(r=r.call(e);!(l=(a=r.next()).done)&&(o.push(a.value),!t||o.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==r.return||r.return()}finally{if(i)throw n}}return o}}(t,r)||a(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];n&&n===o&&R.selectedTagListCache.length?W(R.selectedTagListCache[0],"select"):Z("remove")}else if(e.allowAutoMatch&&n){var l=p.curPageList.find((function(t){return Array.isArray(e.searchKey)?e.searchKey.map((function(e){return t[e]})).includes(n):t[e.searchKey]===n}));l?G(l,"select"):e.allowCreate&&G(n,"custom")}c.isShow=!1,s("blur",n,j.value)}),50)},G=function(e,t,r){null==r||r.stopPropagation(),e&&!e.disabled&&(S.value&&(R.tagListCache=[],R.selectedTagListCache=[],R.selectedTagList=[]),W(e,t),Z("select"),z(),c.isShow=!1)},Z=function(e,t){s("change",j.value),s(e,t),s("update:modelValue",j.value)},U=function(){var e=w.value.clientHeight,t=w.value.getBoundingClientRect().y;(0,l.nextTick)((function(){var r=w.value.querySelector(".bk-selector-actived");if(r){var a=r.clientHeight,n=r.getBoundingClientRect().y;n<t&&(w.value.scrollTop=w.value.scrollTop-(t-n));var o=n+a-t;o>e&&(w.value.scrollTop=w.value.scrollTop+o-e)}}))},W=function(r,a){if(!(R.selectedTagList.length>=e.maxData&&-1!==e.maxData)){var i,s=e.separator,u=e.saveKey,c=e.displayKey,d=e.createTagValidator,p=_(),f=1,v=!1,g=function(e){return"function"!=typeof d||d(e)},y=function(e){return R.localList.find((function(t){return t[u]===e}))};if("custom"===a)if(s){var b,T=r.split(s),w=(T=T.filter((function(e){return(null==e?void 0:e.trim())&&!j.value.includes(e)&&g(e)}))).map((function(e){var t;return y(e)||(n(t={},u,e),n(t,c,e),t)}));T.length&&((b=R.selectedTagList).splice.apply(b,[p,0].concat(o(w))),f=w.length,v=!0)}else{var P="object"===t(r);if(void 0!==(i=(i=P?r[u]:r.trim()).replace(/\s+/g,""))&&!j.value.includes(i)&&g(i)){var x,I=y(i)||(P?r:(n(x={},u,i),n(x,c,i),x));R.selectedTagList.splice(p,0,I),v=!0}}else r&&(void 0===(i=r[u])||j.value.includes(i)||(R.selectedTagList.splice(p,0,r),v=!0));v&&(0,l.nextTick)((function(){for(var t=1;t<=f;t++){var r=A()[p+t];M(r,L.value)}m.value.style.width="".concat(h,"px"),S.value||(e.allowNextFocus&&O(),R.localList=R.localList.filter((function(e){return!j.value.includes(e[u])})))}))}},$=function(t,r){R.selectedTagList.splice(r,1);var a=E.some((function(r){return r===t[e.saveKey]}));(e.allowCreate&&a||!e.allowCreate)&&!S.value&&R.localList.push(t)};return Object.assign(Object.assign(Object.assign(Object.assign({popoverProps:c},(0,l.toRefs)(u)),(0,l.toRefs)(R)),(0,l.toRefs)(p)),{isShowPlaceholder:C,isShowClear:K,curInputValue:g,formatList:E,renderList:D,showTagClose:I,tagInputRef:m,bkTagSelectorRef:b,tagListRef:T,tagInputItemRef:L,selectorListRef:w,popoverRef:P,triggerClass:V,focusInputTrigger:O,activeClass:function(t,r){var a={"bk-selector-actived":!1,"bk-selector-selected":j.value.includes(t[e.saveKey])};return e.useGroup?a["bk-selector-actived"]=t.__index__===u.focusItemIndex:a["bk-selector-actived"]=r===u.focusItemIndex,a},handleInput:H,handleFocus:function(){var t;c.width=S.value?null===(t=b.value)||void 0===t?void 0:t.clientWidth:e.contentWidth},handleBlur:B,handleTagSelected:G,handleTagRemove:function(e,t,r){null==r||r.stopPropagation(),$(e,t),z(),Z("remove",e),m.value.style.width="".concat(h,"px")},handleClear:function(t){t.stopPropagation();var r=R.selectedTagList;R.selectedTagList=[];var a,n=E.filter((function(t){return r.some((function(r){return r[e.saveKey]===t[e.saveKey]}))}));(!e.allowCreate||0===n.length)&&e.allowCreate||S.value||(a=R.localList).push.apply(a,o(n)),Z("removeAll")},tagFocus:function(t){e.disabled||(M(L.value,t.currentTarget,!0),m.value.style.width="".concat(h,"px"),c.isShow&&k())},handleKeydown:function(t){if(!p.isPageLoading){var r=t.target.value,a=y(r),n=_(),o=A();switch(t.code){case"ArrowUp":if(t.preventDefault(),!c.isShow)return;u.focusItemIndex=u.focusItemIndex-1,u.focusItemIndex=u.focusItemIndex<0?-1:u.focusItemIndex,-1===u.focusItemIndex&&(u.focusItemIndex=p.curPageList.length-1),U();break;case"ArrowDown":if(t.preventDefault(),!c.isShow)return;u.focusItemIndex=u.focusItemIndex+1,u.focusItemIndex=u.focusItemIndex>p.curPageList.length-1?p.curPageList.length:u.focusItemIndex,u.focusItemIndex===p.curPageList.length&&(u.focusItemIndex=0),U();break;case"ArrowLeft":if(u.isEdit=!0,!a){if(n<1)return;M(L.value,o[n-1]),O()}break;case"ArrowRight":if(u.isEdit=!0,!a){if(n===o.length-1)return;M(o[n+1],L.value),O()}break;case"Enter":case"NumpadEnter":!e.allowCreate&&c.isShow||e.allowCreate&&u.focusItemIndex>=0&&c.isShow?G(p.curPageList[u.focusItemIndex],"select",t):e.allowCreate&&G(g.value,"custom",t),t.preventDefault();break;case"Backspace":0===n||g.value||function(t,r){var a=A();M(L.value,a[t-1]),R.selectedTagList.splice(t-1,1),O();var n=E.some((function(t){return t===r[e.saveKey]}));(e.allowCreate&&n||!e.allowCreate)&&!S.value&&R.localList.push(r),m.value="".concat(h,"px"),Z("remove")}(n,R.selectedTagList[n-1])}}},handlePaste:function(t){if(t.preventDefault(),S.value)return!1;var r=e.maxData,a=e.saveKey,l=e.pasteFn,i=t.clipboardData.getData("text"),s=l?l(i):function(t){var r=[];return t.split(";").forEach((function(t){if(t.match(/^[a-zA-Z][a-zA-Z_]+/g)){var a,o=t.match(/^[a-zA-Z][a-zA-Z_]+/g).join("");r.push((n(a={},e.saveKey,o),n(a,e.displayKey,o),a))}})),r}(i),u=s.map((function(e){return e[a]}));if(u.length){var c=A(),d=_(),p=R.localList.map((function(e){return e[a]}));if(u=u.filter((function(e){return(null==e?void 0:e.trim())&&!j.value.includes(e)&&p.includes(e)})),-1!==r){var f=R.selectedTagList.length;if(f<r){var v=r-f;u.length>v&&(u=o(u.slice(0,v)))}else u=[]}var g,y=R.localList.filter((function(e){return u.includes(e[a])}));u.length&&((g=R.selectedTagList).splice.apply(g,[d,0].concat(o(y))),M(L.value,c[d]),m.value.style.width="".concat(h,"px"),R.localList=R.localList.filter((function(e){return!u.includes(e[a])})),Z("select"),O())}}})},render:function(){var e=this;return(0,l.createVNode)("div",{class:"bk-tag-input",ref:"bkTagSelectorRef",onClick:this.focusInputTrigger,onMouseenter:function(){return e.isHover=!0},onMouseleave:function(){return e.isHover=!1}},[(0,l.createVNode)(g(),{ref:"popoverRef",theme:"light",trigger:"manual",placement:"bottom-start",arrow:!1,width:this.popoverProps.width,isShow:this.popoverProps.isShow,modifiers:this.popoverProps.modifiers},{default:function(){var t,r,a;return(0,l.createVNode)("div",{class:e.triggerClass},[(0,l.createVNode)("ul",{class:"tag-list",ref:"tagListRef",style:{marginLeft:"".concat(e.leftSpace,"px")}},[e.selectedTagList.map((function(t,r){var a={boundary:"window",theme:"light",distance:12,content:t[e.tooltipKey],disabled:!e.tooltipKey};return(0,l.withDirectives)((0,l.createVNode)("li",{class:"tag-item",onClick:e.tagFocus},[(0,l.createVNode)(b,{node:t,tpl:e.tagTpl,displayKey:e.displayKey},null),e.showTagClose?(0,l.createVNode)(d.Error,{class:"remove-tag",onClick:e.handleTagRemove.bind(e,t,r)},null):null]),[[(0,l.resolveDirective)("bk-tooltips"),a]])})),(0,l.withDirectives)((0,l.createVNode)("li",{ref:"tagInputItemRef",id:"tagInputItem",class:"tag-input-item",role:"input"},[(0,l.withDirectives)((0,l.createVNode)("input",{type:"text",class:"tag-input",ref:"tagInputRef","onUpdate:modelValue":function(t){return e.curInputValue=t},onInput:e.handleInput,onFocus:e.handleFocus,onBlur:e.handleBlur,onKeydown:e.handleKeydown,onPaste:e.handlePaste},null),[[l.vModelText,e.curInputValue]])]),[[l.vShow,e.isEdit]])]),(0,l.withDirectives)((0,l.createVNode)("p",{class:"placeholder"},[e.placeholder]),[[l.vShow,e.isShowPlaceholder]]),null!==(a=null===(r=null===(t=e.$slots)||void 0===t?void 0:t.suffix)||void 0===r?void 0:r.call(t))&&void 0!==a?a:e.isShowClear&&(0,l.createVNode)(d.Close,{class:"clear-icon",onClick:e.handleClear},null)])},content:function(){return(0,l.createVNode)("div",{class:"bk-selector-list"},[(0,l.createVNode)("ul",{ref:"selectorListRef",style:{"max-height":"".concat(e.contentMaxHeight,"px")},class:"outside-ul"},[e.useGroup?e.renderList.map((function(t){return(0,l.createVNode)("li",{class:"bk-selector-group-item"},[(0,l.createVNode)("span",{class:"group-name"},[t.name,(0,l.createTextVNode)(" ("),t.children.length,(0,l.createTextVNode)(")")]),(0,l.createVNode)("ul",{class:"bk-selector-group-list-item"},[t.children.map((function(t,r){return(0,l.createVNode)("li",{class:["bk-selector-list-item",{disabled:t.disabled},e.activeClass(t,r)],onClick:e.handleTagSelected.bind(e,t,"select")},[(0,l.createVNode)(m,{node:t,displayKey:e.displayKey,tpl:e.tpl,searchKey:e.searchKey,searchKeyword:e.curInputValue},null)])}))])])})):e.renderList.map((function(t,r){return(0,l.createVNode)("li",{class:["bk-selector-list-item",{disabled:t.disabled},e.activeClass(t,r)],onClick:e.handleTagSelected.bind(e,t,"select")},[(0,l.createVNode)(m,{node:t,displayKey:e.displayKey,tpl:e.tpl,searchKey:e.searchKey,searchKeyword:e.curInputValue},null)])})),e.isPageLoading?(0,l.createVNode)("li",{class:"bk-selector-list-item loading"},[(0,l.createVNode)(f(),{theme:"primary",size:p.BkLoadingSize.Small},null)]):null])])}})])}}),L=(0,e.withInstall)(T)})(),c})()));
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("lodash"),require("../directives"),require("../icon"),require("../loading"),require("../popover"));else if("function"==typeof define&&define.amd)define(["../shared","vue","lodash","../directives","../icon","../loading","../popover"],t);else{var r="object"==typeof exports?t(require("../shared"),require("vue"),require("lodash"),require("../directives"),require("../icon"),require("../loading"),require("../popover")):t(e["../shared"],e.vue,e.lodash,e["../directives"],e["../icon"],e["../loading"],e["../popover"]);for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(self,((e,t,r,a,n,o,l)=>(()=>{"use strict";var i={4061:e=>{e.exports=a},6870:e=>{e.exports=n},4870:e=>{e.exports=o},5537:e=>{e.exports=l},4212:t=>{t.exports=e},467:e=>{e.exports=r},748:e=>{e.exports=t}},s={};function u(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return i[e](r,r.exports,u),r.exports}u.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return u.d(t,{a:t}),t},u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var c={};return(()=>{u.r(c),u.d(c,{default:()=>L});var e=u(4212);function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}function a(e,t){if(e){if("string"==typeof e)return r(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?r(e,t):void 0}}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var l=u(748),i=u(467),s=u(4061),d=u(6870),p=u(4870),f=u.n(p),v=u(5537),g=u.n(v),h=12,y=function(e){for(var t=e.length,r=0,a=0;a<t;a++)0!=(65280&e.charCodeAt(a))&&(r+=1),r+=1;return r};const m=(0,l.defineComponent)({name:"ListTagRender",props:{node:e.PropTypes.object,searchKey:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.arrayOf(e.PropTypes.string)]),displayKey:e.PropTypes.string,searchKeyword:e.PropTypes.string,tpl:{type:Function,default:null}},render:function(){var e=this,t=function(t){if(e.searchKeyword){var r=new RegExp("(".concat(e.searchKeyword,")"),"i");return t.replace(r,'<strong class="highlight-text">$1</strong>')}return t};if(this.tpl)return this.tpl(this.node,t,l.h,this);var r=this.node[this.displayKey];return(0,l.createVNode)("div",{class:"bk-selector-node"},[(0,l.createVNode)("span",{class:"text",innerHTML:t(r)},[r])])}}),b=(0,l.defineComponent)({name:"TagRender",props:{node:e.PropTypes.object,displayKey:e.PropTypes.string,tpl:{type:Function,default:null}},render:function(){return this.tpl?this.tpl(this.node,l.h,this):(0,l.createVNode)("div",{class:"tag"},[(0,l.createVNode)("span",{class:"text"},[this.node[this.displayKey]])])}}),T=(0,l.defineComponent)({name:"TagInput",directives:{bkTooltips:s.bkTooltips},props:{modelValue:e.PropTypes.arrayOf(e.PropTypes.string).def([]),placeholder:e.PropTypes.string.def("请输入并按 Enter 结束"),list:e.PropTypes.arrayOf(e.PropTypes.object).def([]),disabled:e.PropTypes.bool.def(!1),tooltipKey:e.PropTypes.string.def(""),saveKey:e.PropTypes.string.def("id"),displayKey:e.PropTypes.string.def("name"),hasDeleteIcon:e.PropTypes.bool.def(!1),clearable:e.PropTypes.bool.def(!0),trigger:e.PropTypes.commonType(["focus","search"]).def("search"),searchKey:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.arrayOf(e.PropTypes.string)]).def("name"),useGroup:e.PropTypes.bool.def(!1),allowCreate:e.PropTypes.bool.def(!1),maxData:e.PropTypes.number.def(-1),maxResult:e.PropTypes.number.def(10),contentMaxHeight:e.PropTypes.number.def(300),contentWidth:e.PropTypes.number.def(190),separator:e.PropTypes.string.def(""),allowNextFocus:e.PropTypes.bool.def(!0),allowAutoMatch:e.PropTypes.bool.def(!1),showClearOnlyHover:e.PropTypes.bool.def(!1),leftSpace:e.PropTypes.number.def(0),createTagValidator:{type:Function,default:null},filterCallback:{type:Function,default:null},tagTpl:{type:Function,default:null},tpl:{type:Function,default:null},pasteFn:{type:Function,default:null}},emits:["update:modelValue","change","select","blur","remove","removeAll"],setup:function(r,s){var u=s.emit,c=(0,e.useFormItem)(),d=(0,l.reactive)({isEdit:!1,isHover:!1,focusItemIndex:r.allowCreate?-1:0}),p=(0,l.reactive)({isShow:!1,width:190,modifiers:[{name:"offset",options:{offset:[0,4]}}]}),f=function(e){var t=(0,l.reactive)({curPage:1,totalSize:0,totalPage:0,pageSize:e,isPageLoading:!1,curPageList:[],renderListPaged:[]});return{pageState:t,initPage:function(){var e,r,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.curPage=1,t.totalSize=a.length,t.totalPage=Math.ceil(t.totalSize/t.pageSize)||1;var n=[];if(t.pageSize>0)for(var l=0;l<t.totalSize;l+=t.pageSize)n.push(a.slice(l,l+t.pageSize));(e=t.renderListPaged).splice.apply(e,[0,t.renderListPaged.length].concat(n)),(r=t.curPageList).splice.apply(r,[0,t.curPageList.length].concat(o(t.renderListPaged[t.curPage-1]||[])))},pageChange:function(e){var r;t.curPage=e,(r=t.curPageList).splice.apply(r,[t.curPageList.length,0].concat(o(t.renderListPaged[t.curPage-1]||[]))),t.isPageLoading=!1}}}((0,l.toRefs)(r).maxResult),v=f.pageState,g=f.initPage,m=f.pageChange,b=(0,l.ref)(""),T=(0,l.ref)(null),L=(0,l.ref)(null),w=(0,l.ref)(null),P=(0,l.ref)(null),x=(0,l.ref)(null),I=(0,l.ref)(null),S=(0,l.ref)(null),C=(0,l.computed)((function(){return!r.disabled&&r.hasDeleteIcon})),K=(0,l.computed)((function(){return 1===r.maxData})),V=(0,l.computed)((function(){return 0===E.selectedTagList.length&&""===b.value&&!d.isEdit})),k=(0,l.computed)((function(){return r.clearable&&!r.disabled&&0!==E.selectedTagList.length&&(!r.showClearOnlyHover||d.isHover)})),N=(0,l.computed)((function(){return{"bk-tag-input-trigger":!0,active:d.isEdit,disabled:r.disabled}}));(0,l.watch)([function(){return o(r.modelValue)},function(){return o(r.list)}],(function(){z()})),(0,l.watch)(b,(0,i.debounce)((function(){var e=0!==v.curPageList.length,t=b.value;""!==t&&e||""===t&&"focus"===r.trigger&&e?p.isShow=!0:"focus"===r.trigger&&e||(p.isShow=!1)}),150)),(0,l.watch)((function(){return p.isShow}),(function(e){A(),e&&x.value&&((0,l.nextTick)((function(){x.value.scrollTop=0})),x.value.removeEventListener("scroll",O),x.value.addEventListener("scroll",O))}));var A=function(){var e,t,r=K.value?0:null===(e=P.value)||void 0===e?void 0:e.offsetLeft;p.modifiers=[{name:"offset",options:{offset:[r,4]}}],null===(t=I.value)||void 0===t||t.update()},O=function(){if(!v.isPageLoading&&0!==x.value.scrollTop){var e=x.value;if(e.scrollTop+e.offsetHeight>=e.scrollHeight){var t=v.curPage+1;t<=v.totalPage&&(v.isPageLoading=!0,setTimeout((function(){m(t)}),500))}}},R=function(){var e;return Array.from((null===(e=w.value)||void 0===e?void 0:e.childNodes)||[]).filter((function(e){return e.nodeType!==Node.TEXT_NODE}))},j=function(e){if(!r.disabled){if(null==e?void 0:e.target){var t=e.target.className;(t.indexOf("bk-tag-input-trigger")>-1||t.indexOf("tag-list")>-1)&&w.value.appendChild(P.value)}clearTimeout(S.value),K.value&&D.value.length&&(E.tagListCache=o(D.value),E.selectedTagListCache=o(E.selectedTagList),b.value=E.selectedTagListCache[0][r.saveKey],J(E.selectedTagList[0],0),G()),d.isEdit=!0,(0,l.nextTick)((function(){var e;null===(e=T.value)||void 0===e||e.focus(),"focus"===r.trigger&&0!==E.localList.length&&(_(),p.isShow?A():p.isShow=!0)}))}},E=(0,l.reactive)({localList:[],tagListCache:[],selectedTagList:[],selectedTagListCache:[]}),D=(0,l.computed)((function(){return E.selectedTagList.map((function(e){return e[r.saveKey]}))})),F=function(e){var t=(0,l.toRefs)(e),r=t.useGroup,a=t.saveKey,n=t.displayKey,i=t.list,s=(0,l.reactive)([]);return(0,l.watch)([r,a,n,i],(function(){var e=i.value;r.value&&(e=i.value.reduce((function(e,t){var r=[];return t.children&&(r=t.children.map((function(e){return Object.assign({group:{groupId:t[a.value],groupName:t[n.value]}},e)}))),e.concat(r)}),[])),s.splice.apply(s,[0,s.length].concat(o(e)))}),{immediate:!0,deep:!0}),s}(r),q=(0,l.computed)((function(){if(r.useGroup){var e={};return v.curPageList.forEach((function(t,r){t.__index__=r,e[t.group.groupId]||(e[t.group.groupId]={id:t.group.groupId,name:t.group.groupName,children:[]}),e[t.group.groupId].children.push(t)})),Object.keys(e).map((function(t){return e[t]}))}return v.curPageList})),z=function(){var e=r.saveKey,t=r.modelValue,a=r.displayKey,l=r.allowCreate,i=r.trigger;E.selectedTagList=[],E.localList=o(F),t.length&&(t.forEach((function(t){var r=E.localList.find((function(r){return t===r[e]}));if(void 0!==r)E.selectedTagList.push(r);else if(l&&!D.value.includes(t)){var o;E.selectedTagList.push((n(o={},e,t),n(o,a,t),o))}})),K.value||(E.localList=E.localList.filter((function(r){return!t.includes(r[e])})))),"focus"===i&&_()},_=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=r.searchKey,a=r.filterCallback,n=e.toLowerCase(),o=[];if("function"==typeof a)o=a(n,t,E.localList)||[];else if(Array.isArray(t)){var l=t.map((function(e){return E.localList.filter((function(t){return-1!==t[e].toLowerCase().indexOf(n)}))}));o=Array.from(new Set(l.flat()))}else o=E.localList.filter((function(e){return-1!==e[t].toLowerCase().indexOf(n)}));g(o)};(0,l.onMounted)((function(){z()}));var M=function(){b.value=""},H=function(){if(K.value)return 0;var e=R().findIndex((function(e){return"tagInputItem"===e.id}));return e>=0?e:0},B=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t&&e){var a=t;r&&(a=t.nextElementSibling||null),t.parentNode.insertBefore(e,a)}},G=function(e){var t=r.maxData,a=r.trigger,n=r.allowCreate;if(-1===t||t>D.value.length){var o=((null==e?void 0:e.target)?e.target:b).value,l=y(o);l?(_(o),T.value.style.width="".concat(l*h,"px")):"focus"===a&&_()}else Z(),b.value="",p.isShow=!1;d.isEdit=!0,d.focusItemIndex=n?-1:0},Z=function(){S.value=setTimeout((function(){var e,t,n,o=b.value;if(M(),d.isEdit=!1,K.value){var l=(t=E.tagListCache,n=1,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a,n,o=[],l=!0,i=!1;try{for(r=r.call(e);!(l=(a=r.next()).done)&&(o.push(a.value),!t||o.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==r.return||r.return()}finally{if(i)throw n}}return o}}(t,n)||a(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];o&&o===l&&E.selectedTagListCache.length?X(E.selectedTagListCache[0],"select"):W("remove")}else if(r.allowAutoMatch&&o){var i=v.curPageList.find((function(e){return Array.isArray(r.searchKey)?r.searchKey.map((function(t){return e[t]})).includes(o):e[r.searchKey]===o}));i?U(i,"select"):r.allowCreate&&U(o,"custom")}p.isShow=!1,u("blur",o,D.value),null===(e=null==c?void 0:c.validate)||void 0===e||e.call(c,"blur")}),50)},U=function(e,t,r){null==r||r.stopPropagation(),e&&!e.disabled&&(K.value&&(E.tagListCache=[],E.selectedTagListCache=[],E.selectedTagList=[]),X(e,t),W("select"),M(),p.isShow=!1)},W=function(e,t){var r;u("change",D.value),u(e,t),u("update:modelValue",D.value),null===(r=null==c?void 0:c.validate)||void 0===r||r.call(c,"change")},$=function(){var e=x.value.clientHeight,t=x.value.getBoundingClientRect().y;(0,l.nextTick)((function(){var r=x.value.querySelector(".bk-selector-actived");if(r){var a=r.clientHeight,n=r.getBoundingClientRect().y;n<t&&(x.value.scrollTop=x.value.scrollTop-(t-n));var o=n+a-t;o>e&&(x.value.scrollTop=x.value.scrollTop+o-e)}}))},X=function(e,a){if(!(E.selectedTagList.length>=r.maxData&&-1!==r.maxData)){var i,s=r.separator,u=r.saveKey,c=r.displayKey,d=r.createTagValidator,p=H(),f=1,v=!1,g=function(e){return"function"!=typeof d||d(e)},y=function(e){return E.localList.find((function(t){return t[u]===e}))};if("custom"===a)if(s){var m,b=e.split(s),L=(b=b.filter((function(e){return(null==e?void 0:e.trim())&&!D.value.includes(e)&&g(e)}))).map((function(e){var t;return y(e)||(n(t={},u,e),n(t,c,e),t)}));b.length&&((m=E.selectedTagList).splice.apply(m,[p,0].concat(o(L))),f=L.length,v=!0)}else{var w="object"===t(e);if(void 0!==(i=(i=w?e[u]:e.trim()).replace(/\s+/g,""))&&!D.value.includes(i)&&g(i)){var x,I=y(i)||(w?e:(n(x={},u,i),n(x,c,i),x));E.selectedTagList.splice(p,0,I),v=!0}}else e&&(void 0===(i=e[u])||D.value.includes(i)||(E.selectedTagList.splice(p,0,e),v=!0));v&&(0,l.nextTick)((function(){for(var e=1;e<=f;e++){var t=R()[p+e];B(t,P.value)}T.value.style.width="".concat(h,"px"),K.value||(r.allowNextFocus&&j(),E.localList=E.localList.filter((function(e){return!D.value.includes(e[u])})))}))}},J=function(e,t){E.selectedTagList.splice(t,1);var a=F.some((function(t){return t===e[r.saveKey]}));(r.allowCreate&&a||!r.allowCreate)&&!K.value&&E.localList.push(e)};return Object.assign(Object.assign(Object.assign(Object.assign({popoverProps:p},(0,l.toRefs)(d)),(0,l.toRefs)(E)),(0,l.toRefs)(v)),{isShowPlaceholder:V,isShowClear:k,curInputValue:b,formatList:F,renderList:q,showTagClose:C,tagInputRef:T,bkTagSelectorRef:L,tagListRef:w,tagInputItemRef:P,selectorListRef:x,popoverRef:I,triggerClass:N,focusInputTrigger:j,activeClass:function(e,t){var a={"bk-selector-actived":!1,"bk-selector-selected":D.value.includes(e[r.saveKey])};return r.useGroup?a["bk-selector-actived"]=e.__index__===d.focusItemIndex:a["bk-selector-actived"]=t===d.focusItemIndex,a},handleInput:G,handleFocus:function(){var e;p.width=K.value?null===(e=L.value)||void 0===e?void 0:e.clientWidth:r.contentWidth},handleBlur:Z,handleTagSelected:U,handleTagRemove:function(e,t,r){null==r||r.stopPropagation(),J(e,t),M(),W("remove",e),T.value.style.width="".concat(h,"px")},handleClear:function(e){e.stopPropagation();var t=E.selectedTagList;E.selectedTagList=[];var a,n=F.filter((function(e){return t.some((function(t){return t[r.saveKey]===e[r.saveKey]}))}));(!r.allowCreate||0===n.length)&&r.allowCreate||K.value||(a=E.localList).push.apply(a,o(n)),W("removeAll")},tagFocus:function(e){r.disabled||(B(P.value,e.currentTarget,!0),T.value.style.width="".concat(h,"px"),p.isShow&&A())},handleKeydown:function(e){if(!v.isPageLoading){var t=e.target.value,a=y(t),n=H(),o=R();switch(e.code){case"ArrowUp":if(e.preventDefault(),!p.isShow)return;d.focusItemIndex=d.focusItemIndex-1,d.focusItemIndex=d.focusItemIndex<0?-1:d.focusItemIndex,-1===d.focusItemIndex&&(d.focusItemIndex=v.curPageList.length-1),$();break;case"ArrowDown":if(e.preventDefault(),!p.isShow)return;d.focusItemIndex=d.focusItemIndex+1,d.focusItemIndex=d.focusItemIndex>v.curPageList.length-1?v.curPageList.length:d.focusItemIndex,d.focusItemIndex===v.curPageList.length&&(d.focusItemIndex=0),$();break;case"ArrowLeft":if(d.isEdit=!0,!a){if(n<1)return;B(P.value,o[n-1]),j()}break;case"ArrowRight":if(d.isEdit=!0,!a){if(n===o.length-1)return;B(o[n+1],P.value),j()}break;case"Enter":case"NumpadEnter":!r.allowCreate&&p.isShow||r.allowCreate&&d.focusItemIndex>=0&&p.isShow?U(v.curPageList[d.focusItemIndex],"select",e):r.allowCreate&&U(b.value,"custom",e),e.preventDefault();break;case"Backspace":0===n||b.value||function(e,t){var a=R();B(P.value,a[e-1]),E.selectedTagList.splice(e-1,1),j();var n=F.some((function(e){return e===t[r.saveKey]}));(r.allowCreate&&n||!r.allowCreate)&&!K.value&&E.localList.push(t),T.value="".concat(h,"px"),W("remove")}(n,E.selectedTagList[n-1])}}},handlePaste:function(e){if(e.preventDefault(),K.value)return!1;var t=r.maxData,a=r.saveKey,l=r.pasteFn,i=e.clipboardData.getData("text"),s=l?l(i):function(e){var t=[];return e.split(";").forEach((function(e){if(e.match(/^[a-zA-Z][a-zA-Z_]+/g)){var a,o=e.match(/^[a-zA-Z][a-zA-Z_]+/g).join("");t.push((n(a={},r.saveKey,o),n(a,r.displayKey,o),a))}})),t}(i),u=s.map((function(e){return e[a]}));if(u.length){var c=R(),d=H(),p=E.localList.map((function(e){return e[a]}));if(u=u.filter((function(e){return(null==e?void 0:e.trim())&&!D.value.includes(e)&&p.includes(e)})),-1!==t){var f=E.selectedTagList.length;if(f<t){var v=t-f;u.length>v&&(u=o(u.slice(0,v)))}else u=[]}var g,y=E.localList.filter((function(e){return u.includes(e[a])}));u.length&&((g=E.selectedTagList).splice.apply(g,[d,0].concat(o(y))),B(P.value,c[d]),T.value.style.width="".concat(h,"px"),E.localList=E.localList.filter((function(e){return!u.includes(e[a])})),W("select"),j())}}})},render:function(){var e=this;return(0,l.createVNode)("div",{class:"bk-tag-input",ref:"bkTagSelectorRef",onClick:this.focusInputTrigger,onMouseenter:function(){return e.isHover=!0},onMouseleave:function(){return e.isHover=!1}},[(0,l.createVNode)(g(),{ref:"popoverRef",theme:"light",trigger:"manual",placement:"bottom-start",arrow:!1,width:this.popoverProps.width,isShow:this.popoverProps.isShow,modifiers:this.popoverProps.modifiers},{default:function(){var t,r,a;return(0,l.createVNode)("div",{class:e.triggerClass},[(0,l.createVNode)("ul",{class:"tag-list",ref:"tagListRef",style:{marginLeft:"".concat(e.leftSpace,"px")}},[e.selectedTagList.map((function(t,r){var a={boundary:"window",theme:"light",distance:12,content:t[e.tooltipKey],disabled:!e.tooltipKey};return(0,l.withDirectives)((0,l.createVNode)("li",{class:"tag-item",onClick:e.tagFocus},[(0,l.createVNode)(b,{node:t,tpl:e.tagTpl,displayKey:e.displayKey},null),e.showTagClose?(0,l.createVNode)(d.Error,{class:"remove-tag",onClick:e.handleTagRemove.bind(e,t,r)},null):null]),[[(0,l.resolveDirective)("bk-tooltips"),a]])})),(0,l.withDirectives)((0,l.createVNode)("li",{ref:"tagInputItemRef",id:"tagInputItem",class:"tag-input-item",role:"input"},[(0,l.withDirectives)((0,l.createVNode)("input",{type:"text",class:"tag-input",ref:"tagInputRef","onUpdate:modelValue":function(t){return e.curInputValue=t},onInput:e.handleInput,onFocus:e.handleFocus,onBlur:e.handleBlur,onKeydown:e.handleKeydown,onPaste:e.handlePaste},null),[[l.vModelText,e.curInputValue]])]),[[l.vShow,e.isEdit]])]),(0,l.withDirectives)((0,l.createVNode)("p",{class:"placeholder"},[e.placeholder]),[[l.vShow,e.isShowPlaceholder]]),null!==(a=null===(r=null===(t=e.$slots)||void 0===t?void 0:t.suffix)||void 0===r?void 0:r.call(t))&&void 0!==a?a:e.isShowClear&&(0,l.createVNode)(d.Close,{class:"clear-icon",onClick:e.handleClear},null)])},content:function(){return(0,l.createVNode)("div",{class:"bk-selector-list"},[(0,l.createVNode)("ul",{ref:"selectorListRef",style:{"max-height":"".concat(e.contentMaxHeight,"px")},class:"outside-ul"},[e.useGroup?e.renderList.map((function(t){return(0,l.createVNode)("li",{class:"bk-selector-group-item"},[(0,l.createVNode)("span",{class:"group-name"},[t.name,(0,l.createTextVNode)(" ("),t.children.length,(0,l.createTextVNode)(")")]),(0,l.createVNode)("ul",{class:"bk-selector-group-list-item"},[t.children.map((function(t,r){return(0,l.createVNode)("li",{class:["bk-selector-list-item",{disabled:t.disabled},e.activeClass(t,r)],onClick:e.handleTagSelected.bind(e,t,"select")},[(0,l.createVNode)(m,{node:t,displayKey:e.displayKey,tpl:e.tpl,searchKey:e.searchKey,searchKeyword:e.curInputValue},null)])}))])])})):e.renderList.map((function(t,r){return(0,l.createVNode)("li",{class:["bk-selector-list-item",{disabled:t.disabled},e.activeClass(t,r)],onClick:e.handleTagSelected.bind(e,t,"select")},[(0,l.createVNode)(m,{node:t,displayKey:e.displayKey,tpl:e.tpl,searchKey:e.searchKey,searchKeyword:e.curInputValue},null)])})),e.isPageLoading?(0,l.createVNode)("li",{class:"bk-selector-list-item loading"},[(0,l.createVNode)(f(),{theme:"primary",size:p.BkLoadingSize.Small},null)]):null])])}})])}}),L=(0,e.withInstall)(T)})(),c})()));
|
@@ -326,23 +326,23 @@ declare const _default: import("vue").DefineComponent<{
|
|
326
326
|
default: any;
|
327
327
|
};
|
328
328
|
}>> & {
|
329
|
-
onChange?: (...args: any[]) => any;
|
330
329
|
onBlur?: (...args: any[]) => any;
|
330
|
+
onChange?: (...args: any[]) => any;
|
331
331
|
onSelect?: (...args: any[]) => any;
|
332
332
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
333
333
|
onRemove?: (...args: any[]) => any;
|
334
334
|
onRemoveAll?: (...args: any[]) => any;
|
335
335
|
}, {
|
336
|
+
trigger: string;
|
337
|
+
disabled: boolean;
|
336
338
|
placeholder: string;
|
337
339
|
list: {
|
338
340
|
[key: string]: any;
|
339
341
|
}[];
|
340
342
|
separator: string;
|
341
|
-
disabled: boolean;
|
342
343
|
clearable: boolean;
|
343
344
|
showClearOnlyHover: boolean;
|
344
345
|
modelValue: string[];
|
345
|
-
trigger: string;
|
346
346
|
allowCreate: boolean;
|
347
347
|
searchKey: string | string[];
|
348
348
|
displayKey: string;
|