bkui-vue 0.0.1-beta.153 → 0.0.1-beta.156
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 +88 -65
- package/dist/index.umd.js +35 -35
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/checkbox/checkbox-group.d.ts +16 -0
- package/lib/checkbox/index.d.ts +11 -0
- package/lib/checkbox/index.js +1 -1
- package/lib/color-picker/color-picker.d.ts +16 -0
- package/lib/color-picker/index.d.ts +24 -1
- package/lib/color-picker/index.js +1 -1
- package/lib/date-picker/date-picker.d.ts +9 -0
- package/lib/date-picker/index.d.ts +20 -1
- package/lib/date-picker/index.js +1 -1
- package/lib/date-picker/props.d.ts +4 -0
- package/lib/form/form-item.d.ts +1 -1
- package/lib/form/form.css +6 -0
- package/lib/form/form.less +9 -0
- package/lib/form/form.variable.css +6 -0
- package/lib/form/index.d.ts +1 -1
- package/lib/form/index.js +1 -1
- package/lib/input/index.d.ts +27 -4
- package/lib/input/index.js +1 -1
- package/lib/input/input.d.ts +17 -1
- package/lib/process/index.js +1 -1
- package/lib/radio/index.d.ts +11 -0
- package/lib/radio/index.js +1 -1
- package/lib/radio/radio-group.d.ts +16 -0
- package/lib/rate/index.d.ts +24 -1
- package/lib/rate/index.js +1 -1
- package/lib/rate/rate.d.ts +11 -0
- package/lib/resize-layout/index.d.ts +4 -4
- package/lib/resize-layout/resize-layout.d.ts +1 -1
- package/lib/select/index.d.ts +48 -1
- package/lib/select/index.js +1 -1
- package/lib/select/option.d.ts +1 -0
- package/lib/select/select.css +4 -4
- package/lib/select/select.d.ts +22 -0
- package/lib/select/select.less +5 -5
- package/lib/select/select.variable.css +4 -4
- package/lib/select/type.d.ts +1 -0
- package/lib/switcher/index.d.ts +24 -1
- package/lib/switcher/index.js +1 -1
- package/lib/switcher/switcher.d.ts +11 -0
- package/lib/table/plugins/head-sort.css +22 -0
- package/lib/table/table.css +11 -4
- package/lib/table/table.less +12 -5
- package/lib/table/table.variable.css +11 -4
- package/lib/tag-input/index.d.ts +20 -1
- package/lib/tag-input/index.js +1 -1
- package/lib/tag-input/tag-input.d.ts +10 -1
- package/lib/tag-input/tag-props.d.ts +4 -0
- package/lib/tree/tree.css +2 -1
- package/lib/tree/tree.less +2 -1
- package/lib/tree/tree.variable.css +2 -1
- package/lib/upload/index.js +1 -1
- package/package.json +1 -1
package/lib/select/select.css
CHANGED
@@ -247,15 +247,15 @@
|
|
247
247
|
text-overflow: ellipsis;
|
248
248
|
white-space: nowrap;
|
249
249
|
}
|
250
|
+
.bk-popover2.bk-pop2-content.bk-select-popover .bk-select-content .bk-select-option .bk-select-selected-icon {
|
251
|
+
position: absolute;
|
252
|
+
right: 10px;
|
253
|
+
}
|
250
254
|
.bk-popover2.bk-pop2-content.bk-select-popover .bk-select-content .bk-select-option-item {
|
251
255
|
overflow: hidden;
|
252
256
|
text-overflow: ellipsis;
|
253
257
|
white-space: nowrap;
|
254
258
|
}
|
255
|
-
.bk-popover2.bk-pop2-content.bk-select-popover .bk-select-content .bk-select-option-item .done-icon {
|
256
|
-
position: absolute;
|
257
|
-
right: 10px;
|
258
|
-
}
|
259
259
|
.bk-popover2.bk-pop2-content.bk-select-popover .bk-select-content .bk-select-option.is-hover {
|
260
260
|
color: #3a84ff;
|
261
261
|
background-color: #f5f7fa;
|
package/lib/select/select.d.ts
CHANGED
@@ -132,6 +132,16 @@ declare const _default: import("vue").DefineComponent<{
|
|
132
132
|
} & {
|
133
133
|
default: string;
|
134
134
|
};
|
135
|
+
withValidate: import("vue-types").VueTypeValidableDef<boolean> & {
|
136
|
+
default: boolean;
|
137
|
+
} & {
|
138
|
+
default: boolean;
|
139
|
+
};
|
140
|
+
showSelectedIcon: import("vue-types").VueTypeValidableDef<boolean> & {
|
141
|
+
default: boolean;
|
142
|
+
} & {
|
143
|
+
default: boolean;
|
144
|
+
};
|
135
145
|
}, {
|
136
146
|
selected: import("vue").Ref<{
|
137
147
|
value: string;
|
@@ -460,6 +470,16 @@ declare const _default: import("vue").DefineComponent<{
|
|
460
470
|
} & {
|
461
471
|
default: string;
|
462
472
|
};
|
473
|
+
withValidate: import("vue-types").VueTypeValidableDef<boolean> & {
|
474
|
+
default: boolean;
|
475
|
+
} & {
|
476
|
+
default: boolean;
|
477
|
+
};
|
478
|
+
showSelectedIcon: import("vue-types").VueTypeValidableDef<boolean> & {
|
479
|
+
default: boolean;
|
480
|
+
} & {
|
481
|
+
default: boolean;
|
482
|
+
};
|
463
483
|
}>> & {
|
464
484
|
onFocus?: (...args: any[]) => any;
|
465
485
|
onBlur?: (...args: any[]) => any;
|
@@ -478,6 +498,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
478
498
|
loading: boolean;
|
479
499
|
clearable: boolean;
|
480
500
|
behavior: string;
|
501
|
+
withValidate: boolean;
|
502
|
+
showSelectedIcon: boolean;
|
481
503
|
tagTheme: string;
|
482
504
|
filterable: boolean;
|
483
505
|
allowCreate: boolean;
|
package/lib/select/select.less
CHANGED
@@ -252,13 +252,13 @@
|
|
252
252
|
|
253
253
|
.ellipsis();
|
254
254
|
|
255
|
+
.bk-select-selected-icon {
|
256
|
+
position: absolute;
|
257
|
+
right: 10px;
|
258
|
+
}
|
259
|
+
|
255
260
|
&-item {
|
256
261
|
.ellipsis();
|
257
|
-
|
258
|
-
.done-icon {
|
259
|
-
position: absolute;
|
260
|
-
right: 10px;
|
261
|
-
}
|
262
262
|
}
|
263
263
|
|
264
264
|
&.is-hover {
|
@@ -360,15 +360,15 @@
|
|
360
360
|
text-overflow: ellipsis;
|
361
361
|
white-space: nowrap;
|
362
362
|
}
|
363
|
+
.bk-popover2.bk-pop2-content.bk-select-popover .bk-select-content .bk-select-option .bk-select-selected-icon {
|
364
|
+
position: absolute;
|
365
|
+
right: 10px;
|
366
|
+
}
|
363
367
|
.bk-popover2.bk-pop2-content.bk-select-popover .bk-select-content .bk-select-option-item {
|
364
368
|
overflow: hidden;
|
365
369
|
text-overflow: ellipsis;
|
366
370
|
white-space: nowrap;
|
367
371
|
}
|
368
|
-
.bk-popover2.bk-pop2-content.bk-select-popover .bk-select-content .bk-select-option-item .done-icon {
|
369
|
-
position: absolute;
|
370
|
-
right: 10px;
|
371
|
-
}
|
372
372
|
.bk-popover2.bk-pop2-content.bk-select-popover .bk-select-content .bk-select-option.is-hover {
|
373
373
|
color: #3a84ff;
|
374
374
|
background-color: #f5f7fa;
|
package/lib/select/type.d.ts
CHANGED
@@ -12,6 +12,7 @@ export interface ISelectContext {
|
|
12
12
|
multiple?: boolean;
|
13
13
|
selected: ISelected[];
|
14
14
|
activeOptionValue: any;
|
15
|
+
showSelectedIcon: boolean;
|
15
16
|
register(key: any, option: OptionInstanceType): any;
|
16
17
|
unregister(key: any): any;
|
17
18
|
registerGroup(key: any, option: GroupInstanceType): any;
|
package/lib/switcher/index.d.ts
CHANGED
@@ -8,6 +8,7 @@ declare const BkSwitcher: {
|
|
8
8
|
extCls: string;
|
9
9
|
value: string | number | boolean;
|
10
10
|
modelValue: string | number | boolean;
|
11
|
+
withValidate: boolean;
|
11
12
|
beforeChange: (...args: any[]) => any;
|
12
13
|
showText: boolean;
|
13
14
|
isOutline: boolean;
|
@@ -63,10 +64,15 @@ declare const BkSwitcher: {
|
|
63
64
|
modelValue: import("vue-types").VueTypeDef<string | number | boolean> & {
|
64
65
|
default: string | number | boolean;
|
65
66
|
};
|
67
|
+
withValidate: import("vue-types").VueTypeValidableDef<boolean> & {
|
68
|
+
default: boolean;
|
69
|
+
} & {
|
70
|
+
default: boolean;
|
71
|
+
};
|
66
72
|
}>> & {
|
67
73
|
onChange?: (...args: any[]) => any;
|
68
74
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
69
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "disabled" | "theme" | "extCls" | "value" | "modelValue" | "beforeChange" | "showText" | "isOutline" | "onText" | "offText" | "isSquare" | "trueValue" | "falseValue">;
|
75
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "disabled" | "theme" | "extCls" | "value" | "modelValue" | "withValidate" | "beforeChange" | "showText" | "isOutline" | "onText" | "offText" | "isSquare" | "trueValue" | "falseValue">;
|
70
76
|
$attrs: {
|
71
77
|
[x: string]: unknown;
|
72
78
|
};
|
@@ -127,6 +133,11 @@ declare const BkSwitcher: {
|
|
127
133
|
modelValue: import("vue-types").VueTypeDef<string | number | boolean> & {
|
128
134
|
default: string | number | boolean;
|
129
135
|
};
|
136
|
+
withValidate: import("vue-types").VueTypeValidableDef<boolean> & {
|
137
|
+
default: boolean;
|
138
|
+
} & {
|
139
|
+
default: boolean;
|
140
|
+
};
|
130
141
|
}>> & {
|
131
142
|
onChange?: (...args: any[]) => any;
|
132
143
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
@@ -136,6 +147,7 @@ declare const BkSwitcher: {
|
|
136
147
|
extCls: string;
|
137
148
|
value: string | number | boolean;
|
138
149
|
modelValue: string | number | boolean;
|
150
|
+
withValidate: boolean;
|
139
151
|
beforeChange: (...args: any[]) => any;
|
140
152
|
showText: boolean;
|
141
153
|
isOutline: boolean;
|
@@ -211,6 +223,11 @@ declare const BkSwitcher: {
|
|
211
223
|
modelValue: import("vue-types").VueTypeDef<string | number | boolean> & {
|
212
224
|
default: string | number | boolean;
|
213
225
|
};
|
226
|
+
withValidate: import("vue-types").VueTypeValidableDef<boolean> & {
|
227
|
+
default: boolean;
|
228
|
+
} & {
|
229
|
+
default: boolean;
|
230
|
+
};
|
214
231
|
}>> & {
|
215
232
|
onChange?: (...args: any[]) => any;
|
216
233
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
@@ -265,6 +282,11 @@ declare const BkSwitcher: {
|
|
265
282
|
modelValue: import("vue-types").VueTypeDef<string | number | boolean> & {
|
266
283
|
default: string | number | boolean;
|
267
284
|
};
|
285
|
+
withValidate: import("vue-types").VueTypeValidableDef<boolean> & {
|
286
|
+
default: boolean;
|
287
|
+
} & {
|
288
|
+
default: boolean;
|
289
|
+
};
|
268
290
|
}>> & {
|
269
291
|
onChange?: (...args: any[]) => any;
|
270
292
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
@@ -274,6 +296,7 @@ declare const BkSwitcher: {
|
|
274
296
|
extCls: string;
|
275
297
|
value: string | number | boolean;
|
276
298
|
modelValue: string | number | boolean;
|
299
|
+
withValidate: boolean;
|
277
300
|
beforeChange: (...args: any[]) => any;
|
278
301
|
showText: boolean;
|
279
302
|
isOutline: boolean;
|
package/lib/switcher/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(e,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o(require("../shared"),require("vue"),require("../icon"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../icon"],o);else{var r="object"==typeof exports?o(require("../shared"),require("vue"),require("../icon")):o(e["../shared"],e.vue,e["../icon"]);for(var t in r)("object"==typeof exports?exports:e)[t]=r[t]}}(self,((e,o,r)=>(()=>{"use strict";var t={6870:e=>{e.exports=r},4212:o=>{o.exports=e},748:e=>{e.exports=o}},n={};function u(e){var o=n[e];if(void 0!==o)return o.exports;var r=n[e]={exports:{}};return t[e](r,r.exports,u),r.exports}u.d=(e,o)=>{for(var r in o)u.o(o,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},u.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{u.r(a),u.d(a,{default:()=>i});var e=u(4212);function o(e,o,r){return o in e?Object.defineProperty(e,o,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[o]=r,e}var r=u(748),t=u(6870);const n=(0,r.defineComponent)({name:"Switcher",props:{theme:e.PropTypes.theme().def(""),size:e.PropTypes.size(),disabled:e.PropTypes.bool,showText:e.PropTypes.bool,isOutline:e.PropTypes.bool,onText:e.PropTypes.string.def("ON"),offText:e.PropTypes.string.def("OFF"),isSquare:e.PropTypes.bool,extCls:e.PropTypes.string,beforeChange:e.PropTypes.func.def(void 0),trueValue:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.number,e.PropTypes.bool]).def(!0),falseValue:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.number,e.PropTypes.bool]).def(!1),value:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.number,e.PropTypes.bool]).def(!1),modelValue:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.number,e.PropTypes.bool]).def(!1)},emits:["update:modelValue","change"],setup:function(n,u){var a=u.emit,i=(0,e.useFormItem)(),s=(0,r.ref)(!1),
|
1
|
+
!function(e,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o(require("../shared"),require("vue"),require("../icon"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../icon"],o);else{var r="object"==typeof exports?o(require("../shared"),require("vue"),require("../icon")):o(e["../shared"],e.vue,e["../icon"]);for(var t in r)("object"==typeof exports?exports:e)[t]=r[t]}}(self,((e,o,r)=>(()=>{"use strict";var t={6870:e=>{e.exports=r},4212:o=>{o.exports=e},748:e=>{e.exports=o}},n={};function u(e){var o=n[e];if(void 0!==o)return o.exports;var r=n[e]={exports:{}};return t[e](r,r.exports,u),r.exports}u.d=(e,o)=>{for(var r in o)u.o(o,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},u.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{u.r(a),u.d(a,{default:()=>i});var e=u(4212);function o(e,o,r){return o in e?Object.defineProperty(e,o,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[o]=r,e}var r=u(748),t=u(6870);const n=(0,r.defineComponent)({name:"Switcher",props:{theme:e.PropTypes.theme().def(""),size:e.PropTypes.size(),disabled:e.PropTypes.bool,showText:e.PropTypes.bool,isOutline:e.PropTypes.bool,onText:e.PropTypes.string.def("ON"),offText:e.PropTypes.string.def("OFF"),isSquare:e.PropTypes.bool,extCls:e.PropTypes.string,beforeChange:e.PropTypes.func.def(void 0),trueValue:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.number,e.PropTypes.bool]).def(!0),falseValue:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.number,e.PropTypes.bool]).def(!1),value:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.number,e.PropTypes.bool]).def(!1),modelValue:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.number,e.PropTypes.bool]).def(!1),withValidate:e.PropTypes.bool.def(!0)},emits:["update:modelValue","change"],setup:function(n,u){var a=u.emit,i=(0,e.useFormItem)(),s=(0,r.ref)(!1),l=(0,r.computed)((function(){return n.trueValue===f.value})),p=(0,r.ref)(!1!==n.modelValue),f=(0,r.computed)((function(){return p.value?n.modelValue:n.value})),d=(0,r.computed)((function(){var e,r=(o(e={},n.extCls,!!n.extCls),o(e,"bk-switcher",!0),o(e,"bk-switcher-outline",n.isOutline),o(e,"bk-switcher-square",n.isSquare),o(e,"show-label",n.showText),o(e,"is-disabled",n.disabled),o(e,"is-checked",l.value),o(e,"is-unchecked",!l.value),o(e,"is-loading",s.value),o(e,"bk-primary","primary"===n.theme),e);return n.size&&!n.showText&&(r["bk-switcher-".concat(n.size)]=!0),r}));(0,r.watch)((function(){return n.modelValue}),(function(){var e;p.value=!0,n.withValidate&&(null===(e=null==i?void 0:i.validate)||void 0===e||e.call(i,"change"))})),(0,r.watch)((function(){return n.value}),(function(){p.value=!1}));var c=function(e){if(e.stopPropagation(),e.preventDefault(),!n.disabled&&!s.value){var o=l.value?n.falseValue:n.trueValue,r=!l.value,t=function(){a("update:modelValue",o),a("change",r)},u=!0;if("function"==typeof n.beforeChange&&"function"==typeof(u=n.beforeChange(o)).then)return s.value=!0,u.then((function(){t()})).finally((function(){s.value=!1}));u&&t()}};return function(){return(0,r.createVNode)("div",{class:d.value,onClick:c,tabindex:"0",onKeydown:c},[s.value?(0,r.createVNode)(t.SwitcherLoading,{class:"bk-switcher-loading"},null):"",n.showText?(0,r.createVNode)("span",{class:"switcher-text"},[l.value?n.onText:n.offText]):""])}}}),i=(0,e.withInstall)(n)})(),a})()));
|
@@ -45,6 +45,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
45
45
|
modelValue: import("vue-types").VueTypeDef<string | number | boolean> & {
|
46
46
|
default: string | number | boolean;
|
47
47
|
};
|
48
|
+
withValidate: import("vue-types").VueTypeValidableDef<boolean> & {
|
49
|
+
default: boolean;
|
50
|
+
} & {
|
51
|
+
default: boolean;
|
52
|
+
};
|
48
53
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:modelValue")[], "change" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
49
54
|
theme: import("vue-types").VueTypeDef<string> & {
|
50
55
|
default: string;
|
@@ -92,6 +97,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
92
97
|
modelValue: import("vue-types").VueTypeDef<string | number | boolean> & {
|
93
98
|
default: string | number | boolean;
|
94
99
|
};
|
100
|
+
withValidate: import("vue-types").VueTypeValidableDef<boolean> & {
|
101
|
+
default: boolean;
|
102
|
+
} & {
|
103
|
+
default: boolean;
|
104
|
+
};
|
95
105
|
}>> & {
|
96
106
|
onChange?: (...args: any[]) => any;
|
97
107
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
@@ -101,6 +111,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
101
111
|
extCls: string;
|
102
112
|
value: string | number | boolean;
|
103
113
|
modelValue: string | number | boolean;
|
114
|
+
withValidate: boolean;
|
104
115
|
beforeChange: (...args: any[]) => any;
|
105
116
|
showText: boolean;
|
106
117
|
isOutline: boolean;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
.bk-head-cell-sort {
|
2
|
+
display: flex;
|
3
|
+
flex-direction: column;
|
4
|
+
margin-left: 4px;
|
5
|
+
font-size: 10px;
|
6
|
+
}
|
7
|
+
.bk-head-cell-sort .sort-action {
|
8
|
+
display: flex;
|
9
|
+
width: 18px;
|
10
|
+
height: calc(var(--row-height)/2);
|
11
|
+
color: #c0c4cc;
|
12
|
+
cursor: pointer;
|
13
|
+
}
|
14
|
+
.bk-head-cell-sort .sort-action.active {
|
15
|
+
color: #3a84ff;
|
16
|
+
}
|
17
|
+
.bk-head-cell-sort .sort-action.sort-asc {
|
18
|
+
align-items: flex-end;
|
19
|
+
}
|
20
|
+
.bk-head-cell-sort .sort-action.sort-desc {
|
21
|
+
align-items: flex-start;
|
22
|
+
}
|
package/lib/table/table.css
CHANGED
@@ -933,6 +933,12 @@
|
|
933
933
|
min-width: 80px;
|
934
934
|
clear: both;
|
935
935
|
}
|
936
|
+
.bk-table .bk-table-head table th.expand-row .expand-btn-action,
|
937
|
+
.bk-table .bk-table-body table th.expand-row .expand-btn-action,
|
938
|
+
.bk-table .bk-table-head table td.expand-row .expand-btn-action,
|
939
|
+
.bk-table .bk-table-body table td.expand-row .expand-btn-action {
|
940
|
+
color: #575961;
|
941
|
+
}
|
936
942
|
.bk-table .bk-table-head table th .cell,
|
937
943
|
.bk-table .bk-table-body table th .cell,
|
938
944
|
.bk-table .bk-table-head table td .cell,
|
@@ -952,12 +958,13 @@
|
|
952
958
|
padding: 0;
|
953
959
|
text-overflow: unset;
|
954
960
|
}
|
955
|
-
.bk-table .bk-table-head table th .
|
956
|
-
.bk-table .bk-table-body table th .
|
957
|
-
.bk-table .bk-table-head table td .
|
958
|
-
.bk-table .bk-table-body table td .
|
961
|
+
.bk-table .bk-table-head table th .expand-btn-action,
|
962
|
+
.bk-table .bk-table-body table th .expand-btn-action,
|
963
|
+
.bk-table .bk-table-head table td .expand-btn-action,
|
964
|
+
.bk-table .bk-table-body table td .expand-btn-action {
|
959
965
|
display: flex;
|
960
966
|
padding: 0 15px;
|
967
|
+
color: #c4c6cc;
|
961
968
|
cursor: pointer;
|
962
969
|
}
|
963
970
|
.bk-table .bk-table-head table th.column_fixed,
|
package/lib/table/table.less
CHANGED
@@ -70,6 +70,12 @@
|
|
70
70
|
min-width: 80px;
|
71
71
|
clear: both;
|
72
72
|
|
73
|
+
&.expand-row {
|
74
|
+
.expand-btn-action {
|
75
|
+
color: #575961;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
73
79
|
.cell {
|
74
80
|
padding: 0 15px;
|
75
81
|
overflow: hidden;
|
@@ -83,12 +89,13 @@
|
|
83
89
|
padding: 0;
|
84
90
|
text-overflow: unset;
|
85
91
|
}
|
92
|
+
}
|
86
93
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
94
|
+
.expand-btn-action {
|
95
|
+
display: flex;
|
96
|
+
padding: 0 15px;
|
97
|
+
color: #c4c6cc;
|
98
|
+
cursor: pointer;
|
92
99
|
}
|
93
100
|
|
94
101
|
&.column_fixed {
|
@@ -1046,6 +1046,12 @@
|
|
1046
1046
|
min-width: 80px;
|
1047
1047
|
clear: both;
|
1048
1048
|
}
|
1049
|
+
.bk-table .bk-table-head table th.expand-row .expand-btn-action,
|
1050
|
+
.bk-table .bk-table-body table th.expand-row .expand-btn-action,
|
1051
|
+
.bk-table .bk-table-head table td.expand-row .expand-btn-action,
|
1052
|
+
.bk-table .bk-table-body table td.expand-row .expand-btn-action {
|
1053
|
+
color: #575961;
|
1054
|
+
}
|
1049
1055
|
.bk-table .bk-table-head table th .cell,
|
1050
1056
|
.bk-table .bk-table-body table th .cell,
|
1051
1057
|
.bk-table .bk-table-head table td .cell,
|
@@ -1065,12 +1071,13 @@
|
|
1065
1071
|
padding: 0;
|
1066
1072
|
text-overflow: unset;
|
1067
1073
|
}
|
1068
|
-
.bk-table .bk-table-head table th .
|
1069
|
-
.bk-table .bk-table-body table th .
|
1070
|
-
.bk-table .bk-table-head table td .
|
1071
|
-
.bk-table .bk-table-body table td .
|
1074
|
+
.bk-table .bk-table-head table th .expand-btn-action,
|
1075
|
+
.bk-table .bk-table-body table th .expand-btn-action,
|
1076
|
+
.bk-table .bk-table-head table td .expand-btn-action,
|
1077
|
+
.bk-table .bk-table-body table td .expand-btn-action {
|
1072
1078
|
display: flex;
|
1073
1079
|
padding: 0 15px;
|
1080
|
+
color: #c4c6cc;
|
1074
1081
|
cursor: pointer;
|
1075
1082
|
}
|
1076
1083
|
.bk-table .bk-table-head table th.column_fixed,
|
package/lib/tag-input/index.d.ts
CHANGED
@@ -13,6 +13,7 @@ declare const TagInput: {
|
|
13
13
|
clearable: boolean;
|
14
14
|
showClearOnlyHover: boolean;
|
15
15
|
modelValue: string[];
|
16
|
+
withValidate: boolean;
|
16
17
|
allowCreate: boolean;
|
17
18
|
displayKey: string;
|
18
19
|
searchKey: string | string[];
|
@@ -175,6 +176,10 @@ declare const TagInput: {
|
|
175
176
|
type: import("vue").PropType<(value: string) => any[]>;
|
176
177
|
default: any;
|
177
178
|
};
|
179
|
+
withValidate: {
|
180
|
+
type: BooleanConstructor;
|
181
|
+
default: boolean;
|
182
|
+
};
|
178
183
|
}>> & {
|
179
184
|
onBlur?: (...args: any[]) => any;
|
180
185
|
onChange?: (...args: any[]) => any;
|
@@ -182,7 +187,7 @@ declare const TagInput: {
|
|
182
187
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
183
188
|
onRemove?: (...args: any[]) => any;
|
184
189
|
onRemoveAll?: (...args: any[]) => any;
|
185
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "disabled" | "trigger" | "placeholder" | "list" | "separator" | "clearable" | "showClearOnlyHover" | "modelValue" | "allowCreate" | "displayKey" | "searchKey" | "tooltipKey" | "saveKey" | "hasDeleteIcon" | "useGroup" | "maxData" | "maxResult" | "contentMaxHeight" | "contentWidth" | "allowNextFocus" | "allowAutoMatch" | "leftSpace" | "createTagValidator" | "filterCallback" | "tagTpl" | "tpl" | "pasteFn">;
|
190
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "disabled" | "trigger" | "placeholder" | "list" | "separator" | "clearable" | "showClearOnlyHover" | "modelValue" | "withValidate" | "allowCreate" | "displayKey" | "searchKey" | "tooltipKey" | "saveKey" | "hasDeleteIcon" | "useGroup" | "maxData" | "maxResult" | "contentMaxHeight" | "contentWidth" | "allowNextFocus" | "allowAutoMatch" | "leftSpace" | "createTagValidator" | "filterCallback" | "tagTpl" | "tpl" | "pasteFn">;
|
186
191
|
$attrs: {
|
187
192
|
[x: string]: unknown;
|
188
193
|
};
|
@@ -331,6 +336,10 @@ declare const TagInput: {
|
|
331
336
|
type: import("vue").PropType<(value: string) => any[]>;
|
332
337
|
default: any;
|
333
338
|
};
|
339
|
+
withValidate: {
|
340
|
+
type: BooleanConstructor;
|
341
|
+
default: boolean;
|
342
|
+
};
|
334
343
|
}>> & {
|
335
344
|
onBlur?: (...args: any[]) => any;
|
336
345
|
onChange?: (...args: any[]) => any;
|
@@ -405,6 +414,7 @@ declare const TagInput: {
|
|
405
414
|
clearable: boolean;
|
406
415
|
showClearOnlyHover: boolean;
|
407
416
|
modelValue: string[];
|
417
|
+
withValidate: boolean;
|
408
418
|
allowCreate: boolean;
|
409
419
|
displayKey: string;
|
410
420
|
searchKey: string | string[];
|
@@ -587,6 +597,10 @@ declare const TagInput: {
|
|
587
597
|
type: import("vue").PropType<(value: string) => any[]>;
|
588
598
|
default: any;
|
589
599
|
};
|
600
|
+
withValidate: {
|
601
|
+
type: BooleanConstructor;
|
602
|
+
default: boolean;
|
603
|
+
};
|
590
604
|
}>> & {
|
591
605
|
onBlur?: (...args: any[]) => any;
|
592
606
|
onChange?: (...args: any[]) => any;
|
@@ -789,6 +803,10 @@ declare const TagInput: {
|
|
789
803
|
type: import("vue").PropType<(value: string) => any[]>;
|
790
804
|
default: any;
|
791
805
|
};
|
806
|
+
withValidate: {
|
807
|
+
type: BooleanConstructor;
|
808
|
+
default: boolean;
|
809
|
+
};
|
792
810
|
}>> & {
|
793
811
|
onBlur?: (...args: any[]) => any;
|
794
812
|
onChange?: (...args: any[]) => any;
|
@@ -863,6 +881,7 @@ declare const TagInput: {
|
|
863
881
|
clearable: boolean;
|
864
882
|
showClearOnlyHover: boolean;
|
865
883
|
modelValue: string[];
|
884
|
+
withValidate: boolean;
|
866
885
|
allowCreate: boolean;
|
867
886
|
displayKey: string;
|
868
887
|
searchKey: string | 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(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)({flatList:[]});return(0,l.watch)([r,a,n,i],(function(){s.flatList=[];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.flatList=o(e)}),{immediate:!0,deep:!0}),s.flatList}(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")}),200)},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})()));
|
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,o,n,l)=>(()=>{"use strict";var i={4061:e=>{e.exports=a},6870:e=>{e.exports=o},4870:e=>{e.exports=n},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 o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(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},withValidate:{type:Boolean,default:!0}},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 o=[];if(t.pageSize>0)for(var l=0;l<t.totalSize;l+=t.pageSize)o.push(a.slice(l,l+t.pageSize));(e=t.renderListPaged).splice.apply(e,[0,t.renderListPaged.length].concat(o)),(r=t.curPageList).splice.apply(r,[0,t.curPageList.length].concat(n(t.renderListPaged[t.curPage-1]||[])))},pageChange:function(e){var r;t.curPage=e,(r=t.curPageList).splice.apply(r,[t.curPageList.length,0].concat(n(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 n(r.modelValue)},function(){return n(r.list)}],(function(){var e;z(),r.withValidate&&(null===(e=null==c?void 0:c.validate)||void 0===e||e.call(c,"change"))})),(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=n(D.value),E.selectedTagListCache=n(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,o=t.displayKey,i=t.list,s=(0,l.reactive)({flatList:[]});return(0,l.watch)([r,a,o,i],(function(){s.flatList=[];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[o.value]}},e)}))),e.concat(r)}),[])),s.flatList=n(e)}),{immediate:!0,deep:!0}),s.flatList}(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=n(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 n;E.selectedTagList.push((o(n={},e,t),o(n,a,t),n))}})),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,o=e.toLowerCase(),n=[];if("function"==typeof a)n=a(o,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(o)}))}));n=Array.from(new Set(l.flat()))}else n=E.localList.filter((function(e){return-1!==e[t].toLowerCase().indexOf(o)}));g(n)};(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,o=r.allowCreate;if(-1===t||t>D.value.length){var n=((null==e?void 0:e.target)?e.target:b).value,l=y(n);l?(_(n),T.value.style.width="".concat(l*h,"px")):"focus"===a&&_()}else Z(),b.value="",p.isShow=!1;d.isEdit=!0,d.focusItemIndex=o?-1:0},Z=function(){S.value=setTimeout((function(){var e,t,o,n=b.value;if(M(),d.isEdit=!1,K.value){var l=(t=E.tagListCache,o=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,o,n=[],l=!0,i=!1;try{for(r=r.call(e);!(l=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);l=!0);}catch(e){i=!0,o=e}finally{try{l||null==r.return||r.return()}finally{if(i)throw o}}return n}}(t,o)||a(t,o)||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===l&&E.selectedTagListCache.length?X(E.selectedTagListCache[0],"select"):W("remove")}else if(r.allowAutoMatch&&n){var i=v.curPageList.find((function(e){return Array.isArray(r.searchKey)?r.searchKey.map((function(t){return e[t]})).includes(n):e[r.searchKey]===n}));i?U(i,"select"):r.allowCreate&&U(n,"custom")}p.isShow=!1,u("blur",n,D.value),null===(e=null==c?void 0:c.validate)||void 0===e||e.call(c,"blur")}),200)},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){u("change",D.value),u(e,t),u("update:modelValue",D.value)},$=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,o=r.getBoundingClientRect().y;o<t&&(x.value.scrollTop=x.value.scrollTop-(t-o));var n=o+a-t;n>e&&(x.value.scrollTop=x.value.scrollTop+n-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)||(o(t={},u,e),o(t,c,e),t)}));b.length&&((m=E.selectedTagList).splice.apply(m,[p,0].concat(n(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:(o(x={},u,i),o(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,o=F.filter((function(e){return t.some((function(t){return t[r.saveKey]===e[r.saveKey]}))}));(!r.allowCreate||0===o.length)&&r.allowCreate||K.value||(a=E.localList).push.apply(a,n(o)),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),o=H(),n=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(o<1)return;B(P.value,n[o-1]),j()}break;case"ArrowRight":if(d.isEdit=!0,!a){if(o===n.length-1)return;B(n[o+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===o||b.value||function(e,t){var a=R();B(P.value,a[e-1]),E.selectedTagList.splice(e-1,1),j();var o=F.some((function(e){return e===t[r.saveKey]}));(r.allowCreate&&o||!r.allowCreate)&&!K.value&&E.localList.push(t),T.value="".concat(h,"px"),W("remove")}(o,E.selectedTagList[o-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,n=e.match(/^[a-zA-Z][a-zA-Z_]+/g).join("");t.push((o(a={},r.saveKey,n),o(a,r.displayKey,n),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=n(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(n(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})()));
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Ref } from 'vue';
|
1
|
+
import { type Ref } from 'vue';
|
2
2
|
declare const _default: import("vue").DefineComponent<{
|
3
3
|
modelValue: import("vue-types").VueTypeDef<string[]> & {
|
4
4
|
default: () => string[];
|
@@ -134,6 +134,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
134
134
|
type: import("vue").PropType<(value: string) => any[]>;
|
135
135
|
default: any;
|
136
136
|
};
|
137
|
+
withValidate: {
|
138
|
+
type: BooleanConstructor;
|
139
|
+
default: boolean;
|
140
|
+
};
|
137
141
|
}, {
|
138
142
|
isShowPlaceholder: import("vue").ComputedRef<boolean>;
|
139
143
|
isShowClear: import("vue").ComputedRef<boolean>;
|
@@ -325,6 +329,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
325
329
|
type: import("vue").PropType<(value: string) => any[]>;
|
326
330
|
default: any;
|
327
331
|
};
|
332
|
+
withValidate: {
|
333
|
+
type: BooleanConstructor;
|
334
|
+
default: boolean;
|
335
|
+
};
|
328
336
|
}>> & {
|
329
337
|
onBlur?: (...args: any[]) => any;
|
330
338
|
onChange?: (...args: any[]) => any;
|
@@ -343,6 +351,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
343
351
|
clearable: boolean;
|
344
352
|
showClearOnlyHover: boolean;
|
345
353
|
modelValue: string[];
|
354
|
+
withValidate: boolean;
|
346
355
|
allowCreate: boolean;
|
347
356
|
displayKey: string;
|
348
357
|
searchKey: string | string[];
|
@@ -126,6 +126,10 @@ declare const tagProps: () => {
|
|
126
126
|
type: PropType<(value: string) => any[]>;
|
127
127
|
default: any;
|
128
128
|
};
|
129
|
+
withValidate: {
|
130
|
+
type: BooleanConstructor;
|
131
|
+
default: boolean;
|
132
|
+
};
|
129
133
|
};
|
130
134
|
export default tagProps;
|
131
135
|
export declare type TagProps = Partial<ExtractPropTypes<ReturnType<typeof tagProps>>>;
|
package/lib/tree/tree.css
CHANGED
package/lib/tree/tree.less
CHANGED