bkui-vue 0.0.1-beta.471 → 0.0.1-beta.473
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 +59 -59
- package/dist/index.esm.js +11712 -11527
- package/dist/index.umd.js +61 -61
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/alert/alert.d.ts +5 -3
- package/lib/alert/index.d.ts +14 -10
- package/lib/alert/index.js +1 -1
- package/lib/button/button-group.d.ts +2 -2
- package/lib/button/index.d.ts +2 -2
- package/lib/button/index.js +1 -1
- package/lib/card/card.d.ts +1 -0
- package/lib/card/index.d.ts +3 -0
- package/lib/card/index.js +1 -1
- package/lib/cascader/index.js +1 -1
- package/lib/checkbox/checkbox.d.ts +15 -11
- package/lib/checkbox/index.d.ts +32 -23
- package/lib/checkbox/index.js +1 -1
- package/lib/code-diff/index.js +1 -1
- package/lib/collapse/collapse-panel.d.ts +1 -0
- package/lib/collapse/index.d.ts +1 -0
- package/lib/collapse/index.js +1 -1
- package/lib/color-picker/color-picker.less +50 -50
- package/lib/color-picker/index.js +1 -1
- package/lib/config-provider/index.d.ts +1 -1
- package/lib/container/container.less +4 -4
- package/lib/container/index.js +1 -1
- package/lib/dropdown/dropdown.d.ts +1 -0
- package/lib/dropdown/dropdown.less +6 -9
- package/lib/dropdown/index.d.ts +3 -0
- package/lib/dropdown/index.js +1 -1
- package/lib/exception/exception.less +15 -15
- package/lib/exception/index.js +1 -1
- package/lib/form/compose-form-item.d.ts +3 -1
- package/lib/form/form-item.d.ts +1 -0
- package/lib/form/form.css +13 -1
- package/lib/form/form.d.ts +1 -0
- package/lib/form/form.less +15 -1
- package/lib/form/form.variable.css +13 -1
- package/lib/form/index.d.ts +7 -1
- package/lib/form/index.js +1 -1
- package/lib/input/index.d.ts +7 -7
- package/lib/input/input.d.ts +4 -4
- package/lib/menu/index.js +1 -1
- package/lib/navigation/index.d.ts +3 -0
- package/lib/navigation/index.js +1 -1
- package/lib/navigation/navigation.d.ts +1 -0
- package/lib/notify/index.js +1 -1
- package/lib/notify/notify.less +8 -8
- package/lib/notify/notifyConstructor.d.ts +1 -0
- package/lib/pagination/index.d.ts +10 -7
- package/lib/pagination/index.js +1 -1
- package/lib/pagination/pagination.d.ts +5 -4
- package/lib/process/index.d.ts +3 -0
- package/lib/process/index.js +1 -1
- package/lib/process/process.d.ts +1 -0
- package/lib/process/process.less +7 -7
- package/lib/progress/index.d.ts +13 -7
- package/lib/progress/index.js +1 -1
- package/lib/progress/progress.d.ts +5 -3
- package/lib/progress/progress.less +8 -8
- package/lib/radio/index.d.ts +38 -20
- package/lib/radio/index.js +1 -1
- package/lib/radio/radio-button.d.ts +10 -6
- package/lib/radio/radio-group.d.ts +9 -4
- package/lib/radio/radio.d.ts +7 -3
- package/lib/rate/index.d.ts +4 -4
- package/lib/rate/rate.d.ts +2 -2
- package/lib/resize-layout/index.d.ts +3 -0
- package/lib/resize-layout/index.js +1 -1
- package/lib/resize-layout/resize-layout.d.ts +1 -0
- package/lib/resize-layout/resize-layout.less +23 -23
- package/lib/select/index.d.ts +15 -18
- package/lib/select/index.js +1 -1
- package/lib/select/option.d.ts +6 -9
- package/lib/select/select.d.ts +5 -5
- package/lib/select/type.d.ts +1 -1
- package/lib/shared/vue-types.d.ts +1 -1
- package/lib/sideslider/index.js +1 -1
- package/lib/sideslider/sideslider.less +9 -9
- package/lib/steps/index.d.ts +7 -4
- package/lib/steps/index.js +1 -1
- package/lib/steps/steps.d.ts +4 -3
- package/lib/steps/steps.less +62 -62
- package/lib/swiper/index.js +1 -1
- package/lib/swiper/swiper.less +15 -13
- package/lib/swiper/swiper.variable.css +122 -0
- package/lib/switcher/index.d.ts +4 -4
- package/lib/switcher/index.js +1 -1
- package/lib/switcher/switcher.d.ts +2 -2
- package/lib/switcher/switcher.less +29 -29
- package/lib/table/index.d.ts +1 -1
- package/lib/table-column/index.d.ts +1 -1
- package/lib/tag/index.d.ts +3 -0
- package/lib/tag/index.js +1 -1
- package/lib/tag/tag.css +2 -2
- package/lib/tag/tag.d.ts +1 -0
- package/lib/tag/tag.less +14 -13
- package/lib/tag/tag.variable.css +2 -2
- package/lib/tag-input/index.d.ts +9 -9
- package/lib/tag-input/index.js +1 -1
- package/lib/tag-input/tag-input.d.ts +3 -3
- package/lib/timeline/index.d.ts +3 -0
- package/lib/timeline/index.js +1 -1
- package/lib/timeline/timeline.d.ts +1 -0
- package/lib/timeline/timeline.less +35 -35
- package/lib/transfer/index.d.ts +3 -0
- package/lib/transfer/index.js +1 -1
- package/lib/transfer/transfer.d.ts +1 -0
- package/lib/transfer/transfer.less +2 -2
- package/lib/tree/index.js +1 -1
- package/package.json +1 -1
@@ -70,7 +70,7 @@
|
|
70
70
|
}
|
71
71
|
|
72
72
|
|
73
|
-
|
73
|
+
.@{bk-prefix}-switcher-loading {
|
74
74
|
position: absolute;
|
75
75
|
top: 1px;
|
76
76
|
left: 1px;
|
@@ -92,7 +92,7 @@
|
|
92
92
|
bottom: 0;
|
93
93
|
left: 0;
|
94
94
|
margin: auto;
|
95
|
-
animation: loading 1s linear infinite
|
95
|
+
animation: loading 1s linear infinite
|
96
96
|
}
|
97
97
|
}
|
98
98
|
|
@@ -115,7 +115,7 @@
|
|
115
115
|
height: 24px;
|
116
116
|
}
|
117
117
|
|
118
|
-
|
118
|
+
.@{bk-prefix}-switcher-loading {
|
119
119
|
width: 24px;
|
120
120
|
height: 24px;
|
121
121
|
font-size: 20px;
|
@@ -123,7 +123,7 @@
|
|
123
123
|
}
|
124
124
|
|
125
125
|
&.show-label.is-checked {
|
126
|
-
|
126
|
+
.@{bk-prefix}-switcher-loading {
|
127
127
|
left: 100%;
|
128
128
|
margin-left: -25px;
|
129
129
|
}
|
@@ -133,7 +133,7 @@
|
|
133
133
|
cursor: not-allowed;
|
134
134
|
opacity: .3;
|
135
135
|
|
136
|
-
|
136
|
+
.@{bk-prefix}-switcher-loading {
|
137
137
|
cursor: not-allowed;
|
138
138
|
}
|
139
139
|
|
@@ -141,20 +141,20 @@
|
|
141
141
|
cursor: not-allowed;
|
142
142
|
}
|
143
143
|
}
|
144
|
-
|
144
|
+
|
145
145
|
&.is-checked {
|
146
146
|
background: @success-color;
|
147
|
-
|
148
|
-
|
147
|
+
|
148
|
+
.@{bk-prefix}-switcher-loading {
|
149
149
|
svg {
|
150
150
|
color: @success-color;
|
151
151
|
}
|
152
152
|
}
|
153
153
|
|
154
|
-
&:not(
|
154
|
+
&:not(.@{bk-prefix}-switcher-outline)&.@{bk-prefix}-primary {
|
155
155
|
background: @primary-color;
|
156
156
|
|
157
|
-
|
157
|
+
.@{bk-prefix}-switcher-loading {
|
158
158
|
svg {
|
159
159
|
color: @primary-color;
|
160
160
|
}
|
@@ -174,12 +174,12 @@
|
|
174
174
|
|
175
175
|
}
|
176
176
|
|
177
|
-
&:not(.show-label).is-checked
|
177
|
+
&:not(.show-label).is-checked .@{bk-prefix}-switcher-loading {
|
178
178
|
left: 100%;
|
179
179
|
margin-left: -17px;
|
180
180
|
}
|
181
181
|
|
182
|
-
|
182
|
+
&.@{bk-prefix}-switcher-outline {
|
183
183
|
background: @switch-default-color;
|
184
184
|
border: 1px solid @switch-grey-color;
|
185
185
|
|
@@ -209,14 +209,14 @@
|
|
209
209
|
|
210
210
|
}
|
211
211
|
|
212
|
-
|
212
|
+
.@{bk-prefix}-switcher-loading {
|
213
213
|
svg {
|
214
214
|
color: #fff;
|
215
215
|
}
|
216
216
|
}
|
217
217
|
}
|
218
218
|
|
219
|
-
|
219
|
+
&.@{bk-prefix}-switcher-outline&.@{bk-prefix}-primary {
|
220
220
|
&.is-checked {
|
221
221
|
border: 1px solid @primary-color;
|
222
222
|
|
@@ -231,7 +231,7 @@
|
|
231
231
|
|
232
232
|
}
|
233
233
|
|
234
|
-
|
234
|
+
&.@{bk-prefix}-switcher-square {
|
235
235
|
border-radius: 2px;
|
236
236
|
|
237
237
|
&:after {
|
@@ -239,31 +239,31 @@
|
|
239
239
|
}
|
240
240
|
}
|
241
241
|
|
242
|
-
|
242
|
+
&.@{bk-prefix}-switcher-large {
|
243
243
|
height: 24px;
|
244
244
|
min-width: 42px;
|
245
245
|
line-height: 22px;
|
246
|
-
|
246
|
+
|
247
247
|
&:after {
|
248
248
|
width: 20px;
|
249
249
|
height: 20px;
|
250
250
|
}
|
251
251
|
|
252
|
-
|
252
|
+
.@{bk-prefix}-switcher-loading {
|
253
253
|
width: 20px;
|
254
254
|
height: 20px;
|
255
255
|
font-size: 16px;
|
256
256
|
}
|
257
257
|
|
258
258
|
&.is-checked {
|
259
|
-
|
259
|
+
.@{bk-prefix}-switcher-loading {
|
260
260
|
margin-left: -21px;
|
261
261
|
}
|
262
262
|
}
|
263
263
|
|
264
264
|
}
|
265
265
|
|
266
|
-
|
266
|
+
&.@{bk-prefix}-switcher-small {
|
267
267
|
height: 16px;
|
268
268
|
min-width: 26px;
|
269
269
|
line-height: 22px;
|
@@ -273,7 +273,7 @@
|
|
273
273
|
height: 12px;
|
274
274
|
}
|
275
275
|
|
276
|
-
|
276
|
+
.@{bk-prefix}-switcher-loading {
|
277
277
|
width: 12px;
|
278
278
|
height: 12px;
|
279
279
|
font-weight: 700;
|
@@ -281,36 +281,36 @@
|
|
281
281
|
}
|
282
282
|
}
|
283
283
|
|
284
|
-
|
285
|
-
|
284
|
+
&.@{bk-prefix}-switcher-small.is-checked {
|
285
|
+
.@{bk-prefix}-switcher-loading {
|
286
286
|
margin-left: -13px;
|
287
287
|
}
|
288
|
-
|
288
|
+
|
289
289
|
}
|
290
290
|
}
|
291
291
|
|
292
|
-
&:not(.show-label)
|
292
|
+
&:not(.show-label).@{bk-prefix}-switcher-default.@{bk-prefix}-switcher-outline {
|
293
293
|
&::after {
|
294
294
|
width: 16px;
|
295
295
|
height: 16px;
|
296
296
|
}
|
297
297
|
}
|
298
298
|
|
299
|
-
&:not(.show-label)
|
299
|
+
&:not(.show-label).@{bk-prefix}-switcher-outline.is-checked.@{bk-prefix}-switcher-small {
|
300
300
|
&::after {
|
301
301
|
width: 12px;
|
302
302
|
height: 12px;
|
303
303
|
}
|
304
304
|
}
|
305
305
|
|
306
|
-
&:not(.show-label)
|
306
|
+
&:not(.show-label).@{bk-prefix}-switcher-outline.is-checked.@{bk-prefix}-switcher-large {
|
307
307
|
&::after {
|
308
308
|
width: 20px;
|
309
309
|
height: 20px;
|
310
310
|
}
|
311
311
|
}
|
312
312
|
|
313
|
-
&:not(.show-label)
|
313
|
+
&:not(.show-label).@{bk-prefix}-switcher-outline.is-checked {
|
314
314
|
&::after {
|
315
315
|
width: 16px;
|
316
316
|
height: 16px;
|
@@ -327,7 +327,7 @@
|
|
327
327
|
@keyframes waveEffect {
|
328
328
|
100% {
|
329
329
|
box-shadow: 0 0 0 #1890ff;
|
330
|
-
}
|
330
|
+
}
|
331
331
|
}
|
332
332
|
|
333
333
|
@keyframes loading {
|
package/lib/table/index.d.ts
CHANGED
@@ -797,8 +797,8 @@ declare const BkColumn: {
|
|
797
797
|
columnKey?: string;
|
798
798
|
showOverflowTooltip?: boolean | import("./props").IOverflowTooltip;
|
799
799
|
resizable?: boolean;
|
800
|
-
readonly render?: any;
|
801
800
|
readonly type?: "none" | "selection" | "index" | "expand";
|
801
|
+
readonly render?: any;
|
802
802
|
class?: unknown;
|
803
803
|
readonly label?: any;
|
804
804
|
style?: unknown;
|
@@ -23,8 +23,8 @@ declare const BkTableColumn: {
|
|
23
23
|
columnKey?: string;
|
24
24
|
showOverflowTooltip?: boolean | import("../../table/src/props").IOverflowTooltip;
|
25
25
|
resizable?: boolean;
|
26
|
-
readonly render?: any;
|
27
26
|
readonly type?: "none" | "selection" | "index" | "expand";
|
27
|
+
readonly render?: any;
|
28
28
|
class?: unknown;
|
29
29
|
readonly label?: any;
|
30
30
|
style?: unknown;
|
package/lib/tag/index.d.ts
CHANGED
@@ -113,6 +113,7 @@ declare const BkTag: {
|
|
113
113
|
}>;
|
114
114
|
handleClose: (e: Event) => void;
|
115
115
|
handleClick: (e: Event) => void;
|
116
|
+
resolveClassName: (cls: string) => string;
|
116
117
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close")[], string, {
|
117
118
|
type: "" | "stroke" | "filled";
|
118
119
|
extCls: string;
|
@@ -186,6 +187,7 @@ declare const BkTag: {
|
|
186
187
|
}>;
|
187
188
|
handleClose: (e: Event) => void;
|
188
189
|
handleClick: (e: Event) => void;
|
190
|
+
resolveClassName: (cls: string) => string;
|
189
191
|
}> & {} & import("vue").ComponentCustomProperties & {};
|
190
192
|
__isFragment?: never;
|
191
193
|
__isTeleport?: never;
|
@@ -232,6 +234,7 @@ declare const BkTag: {
|
|
232
234
|
}>;
|
233
235
|
handleClose: (e: Event) => void;
|
234
236
|
handleClick: (e: Event) => void;
|
237
|
+
resolveClassName: (cls: string) => string;
|
235
238
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close")[], "change" | "close", {
|
236
239
|
type: "" | "stroke" | "filled";
|
237
240
|
extCls: string;
|
package/lib/tag/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("vue-types"),require("../icon"));else if("function"==typeof define&&define.amd)define(["../shared","vue","vue-types","../icon"],t);else{var r="object"==typeof exports?t(require("../shared"),require("vue"),require("vue-types"),require("../icon")):t(e["../shared"],e.vue,e["vue-types"],e["../icon"]);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(self,((e,t,r,o)=>(()=>{"use strict";var
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("vue-types"),require("../config-provider"),require("../icon"));else if("function"==typeof define&&define.amd)define(["../shared","vue","vue-types","../config-provider","../icon"],t);else{var r="object"==typeof exports?t(require("../shared"),require("vue"),require("vue-types"),require("../config-provider"),require("../icon")):t(e["../shared"],e.vue,e["vue-types"],e["../config-provider"],e["../icon"]);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(self,((e,t,r,o,n)=>(()=>{"use strict";var s={2717:e=>{e.exports=o},6870:e=>{e.exports=n},4212:t=>{t.exports=e},748:e=>{e.exports=t},210:e=>{e.exports=r}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return s[e](r,r.exports,a),r.exports}a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var c={};return(()=>{a.r(c),a.d(c,{default:()=>u});var e=a(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,r,o){return(r=function(e){var r=function(e,r){if("object"!==t(e)||null===e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var n=o.call(e,"string");if("object"!==t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===t(r)?r:String(r)}(r))in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}var o,n=a(748),s=a(210),i=a(2717),l=a(6870);!function(e){e.UNKNOWN="",e.FILLED="filled",e.STROKE="stroke"}(o||(o={}));const p=(0,n.defineComponent)({name:"Tag",props:{theme:(0,e.TagThemeType)(),closable:e.PropTypes.bool.def(!1),type:(0,s.toType)("tagStorkeType",{}).def(o.UNKNOWN),checkable:e.PropTypes.bool.def(!1),checked:e.PropTypes.bool.def(!1),radius:e.PropTypes.string.def("2px"),extCls:e.PropTypes.string.def("")},emits:["change","close"],slots:Object,setup:function(t,o){var s=o.emit,a=(0,i.usePrefix)().resolveClassName;return{wrapperCls:(0,n.computed)((function(){var o;return(0,e.classes)((r(o={},"".concat(a("tag-closable")),t.closable),r(o,"".concat(a("tag-checkable")),t.checkable),r(o,"".concat(a("tag-check")),t.checked),r(o,"".concat(a("tag-".concat(t.type))),t.type),r(o,"".concat(a("tag-".concat(t.theme))),t.theme),r(o,t.extCls,!!t.extCls),o),a("tag"))})),wrapperStyle:(0,n.computed)((function(){return{borderRadius:t.radius}})),handleClose:function(e){e.preventDefault(),e.stopPropagation(),s("close",e)},handleClick:function(e){e.preventDefault(),e.stopPropagation(),t.checkable&&s("change",!t.checked)},resolveClassName:a}},render:function(){var e,t;return(0,n.createVNode)("div",{class:this.wrapperCls,style:this.wrapperStyle,onClick:this.handleClick},[this.$slots.icon?(0,n.createVNode)("span",{class:"".concat(this.resolveClassName("tag-icon"))},[this.$slots.icon()]):"",(0,n.createVNode)("span",{class:"".concat(this.resolveClassName("tag-text"))},[null===(t=(e=this.$slots).default)||void 0===t?void 0:t.call(e)]),this.closable?(0,n.createVNode)(l.Error,{class:"".concat(this.resolveClassName("tag-close")),onClick:this.handleClose},null):""])}}),u=(0,e.withInstall)(p)})(),c})()));
|
package/lib/tag/tag.css
CHANGED
@@ -84,10 +84,10 @@
|
|
84
84
|
border-style: solid;
|
85
85
|
border-width: 1px;
|
86
86
|
}
|
87
|
-
.bk-tag.bk-tag-stroke:not(.bk-tag-success
|
87
|
+
.bk-tag.bk-tag-stroke :not(.bk-tag-success):not(.bk-tag-warning):not(.bk-tag-info):not(.bk-tag-danger) {
|
88
88
|
background-color: #FAFBFD;
|
89
89
|
}
|
90
|
-
.bk-tag.bk-tag-stroke:not(.bk-tag-success
|
90
|
+
.bk-tag.bk-tag-stroke :not(.bk-tag-success):not(.bk-tag-warning):not(.bk-tag-info):not(.bk-tag-danger):hover {
|
91
91
|
background-color: #F0F1F5;
|
92
92
|
}
|
93
93
|
.bk-tag.bk-tag-closable {
|
package/lib/tag/tag.d.ts
CHANGED
@@ -38,6 +38,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
38
38
|
}>;
|
39
39
|
handleClose: (e: Event) => void;
|
40
40
|
handleClick: (e: Event) => void;
|
41
|
+
resolveClassName: (cls: string) => string;
|
41
42
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close")[], "change" | "close", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
42
43
|
theme: import("vue-types").VueTypeDef<"info" | "success" | "warning" | "danger"> & {
|
43
44
|
default: "info" | "success" | "warning" | "danger";
|
package/lib/tag/tag.less
CHANGED
@@ -36,7 +36,7 @@
|
|
36
36
|
|
37
37
|
@themeSelectors: success, info, warning, danger;
|
38
38
|
|
39
|
-
|
39
|
+
.@{bk-prefix}-tag {
|
40
40
|
display: inline-flex;
|
41
41
|
align-items: center;
|
42
42
|
height: 22px;
|
@@ -57,17 +57,17 @@
|
|
57
57
|
@bgHoverColor: 'tag-@{value}-hover-bg-color';
|
58
58
|
@filledBgColor: 'tag-filled-@{value}-bg-color';
|
59
59
|
@filledBgHoverColor: 'tag-filled-@{value}-hover-bg-color';
|
60
|
-
|
60
|
+
&.@{bk-prefix}-tag-@{value} {
|
61
61
|
color: @@color;
|
62
62
|
border-color: @@borderColor;
|
63
63
|
background-color: @@bgColor;
|
64
|
-
|
64
|
+
&.@{bk-prefix}-tag-filled {
|
65
65
|
background-color: @@filledBgColor;
|
66
66
|
&:hover {
|
67
67
|
background-color: @@filledBgHoverColor;
|
68
68
|
}
|
69
69
|
}
|
70
|
-
&:hover:not(
|
70
|
+
&:hover:not(.@{bk-prefix}-tag-filled) {
|
71
71
|
background-color: @@bgHoverColor;
|
72
72
|
}
|
73
73
|
}
|
@@ -77,7 +77,7 @@
|
|
77
77
|
background-color: #dcdee5;
|
78
78
|
}
|
79
79
|
|
80
|
-
|
80
|
+
&.@{bk-prefix}-tag-filled {
|
81
81
|
color: @tag-base-color;
|
82
82
|
background-color: @tag-filled-bg-color;
|
83
83
|
|
@@ -86,13 +86,14 @@
|
|
86
86
|
}
|
87
87
|
}
|
88
88
|
|
89
|
-
|
89
|
+
&.@{bk-prefix}-tag-stroke {
|
90
90
|
padding: 0 9px;
|
91
91
|
line-height: 20px;
|
92
92
|
border-style: solid;
|
93
93
|
border-width: 1px;
|
94
94
|
|
95
|
-
&:not(.bk-tag-success, .bk-tag-warning, .bk-tag-info, .bk-tag-danger) {
|
95
|
+
// &:not(.bk-tag-success, .bk-tag-warning, .bk-tag-info, .bk-tag-danger) {
|
96
|
+
:not(.@{bk-prefix}-tag-success):not(.@{bk-prefix}-tag-warning):not(.@{bk-prefix}-tag-info):not(.@{bk-prefix}-tag-danger) {
|
96
97
|
background-color: @tag-stroke-bg-color;
|
97
98
|
|
98
99
|
&:hover {
|
@@ -101,11 +102,11 @@
|
|
101
102
|
}
|
102
103
|
}
|
103
104
|
|
104
|
-
|
105
|
+
&.@{bk-prefix}-tag-closable {
|
105
106
|
padding: 0 4px 0 10px;
|
106
107
|
}
|
107
108
|
|
108
|
-
|
109
|
+
&.@{bk-prefix}-tag-checkable {
|
109
110
|
cursor: pointer;
|
110
111
|
background: none;
|
111
112
|
|
@@ -114,7 +115,7 @@
|
|
114
115
|
}
|
115
116
|
}
|
116
117
|
|
117
|
-
|
118
|
+
&.@{bk-prefix}-tag-check {
|
118
119
|
color: @tag-base-color;
|
119
120
|
background: @tag-info-color;
|
120
121
|
|
@@ -125,21 +126,21 @@
|
|
125
126
|
}
|
126
127
|
}
|
127
128
|
|
128
|
-
|
129
|
+
.@{bk-prefix}-tag-text {
|
129
130
|
flex: 1;
|
130
131
|
overflow: hidden;
|
131
132
|
text-overflow: ellipsis;
|
132
133
|
white-space: nowrap;
|
133
134
|
}
|
134
135
|
|
135
|
-
|
136
|
+
.@{bk-prefix}-tag-icon {
|
136
137
|
flex-shrink: 0;
|
137
138
|
margin-right: 4px;
|
138
139
|
font-size: 14px;
|
139
140
|
line-height: 0;
|
140
141
|
}
|
141
142
|
|
142
|
-
|
143
|
+
.@{bk-prefix}-tag-close {
|
143
144
|
flex-shrink: 0;
|
144
145
|
margin-left: 4px;
|
145
146
|
font-size: 12px;
|
package/lib/tag/tag.variable.css
CHANGED
@@ -206,10 +206,10 @@
|
|
206
206
|
border-style: solid;
|
207
207
|
border-width: 1px;
|
208
208
|
}
|
209
|
-
.bk-tag.bk-tag-stroke:not(.bk-tag-success
|
209
|
+
.bk-tag.bk-tag-stroke :not(.bk-tag-success):not(.bk-tag-warning):not(.bk-tag-info):not(.bk-tag-danger) {
|
210
210
|
background-color: #FAFBFD;
|
211
211
|
}
|
212
|
-
.bk-tag.bk-tag-stroke:not(.bk-tag-success
|
212
|
+
.bk-tag.bk-tag-stroke :not(.bk-tag-success):not(.bk-tag-warning):not(.bk-tag-info):not(.bk-tag-danger):hover {
|
213
213
|
background-color: #F0F1F5;
|
214
214
|
}
|
215
215
|
.bk-tag.bk-tag-closable {
|
package/lib/tag-input/index.d.ts
CHANGED
@@ -401,7 +401,7 @@ declare const TagInput: {
|
|
401
401
|
tagInputItemRef: any;
|
402
402
|
selectorListRef: any;
|
403
403
|
triggerClass: import("vue").ComputedRef<{
|
404
|
-
|
404
|
+
[x: string]: boolean;
|
405
405
|
active: boolean;
|
406
406
|
disabled: boolean;
|
407
407
|
}>;
|
@@ -409,8 +409,7 @@ declare const TagInput: {
|
|
409
409
|
localCollapseTags: import("vue").ComputedRef<boolean>;
|
410
410
|
focusInputTrigger: (e?: MouseEvent) => void;
|
411
411
|
activeClass: (data: any, index: number) => {
|
412
|
-
|
413
|
-
'bk-selector-selected': boolean;
|
412
|
+
[x: string]: boolean;
|
414
413
|
};
|
415
414
|
handleInput: (e?: Event) => void;
|
416
415
|
handleFocus: () => void;
|
@@ -421,6 +420,7 @@ declare const TagInput: {
|
|
421
420
|
tagFocus: (e: MouseEvent) => void;
|
422
421
|
handleKeydown: (e: KeyboardEvent) => void;
|
423
422
|
handlePaste: (e: ClipboardEvent) => boolean;
|
423
|
+
resolveClassName: (cls: string) => string;
|
424
424
|
curPage: import("vue").Ref<number>;
|
425
425
|
totalSize: import("vue").Ref<number>;
|
426
426
|
totalPage: import("vue").Ref<number>;
|
@@ -783,7 +783,7 @@ declare const TagInput: {
|
|
783
783
|
tagInputItemRef: any;
|
784
784
|
selectorListRef: any;
|
785
785
|
triggerClass: import("vue").ComputedRef<{
|
786
|
-
|
786
|
+
[x: string]: boolean;
|
787
787
|
active: boolean;
|
788
788
|
disabled: boolean;
|
789
789
|
}>;
|
@@ -791,8 +791,7 @@ declare const TagInput: {
|
|
791
791
|
localCollapseTags: import("vue").ComputedRef<boolean>;
|
792
792
|
focusInputTrigger: (e?: MouseEvent) => void;
|
793
793
|
activeClass: (data: any, index: number) => {
|
794
|
-
|
795
|
-
'bk-selector-selected': boolean;
|
794
|
+
[x: string]: boolean;
|
796
795
|
};
|
797
796
|
handleInput: (e?: Event) => void;
|
798
797
|
handleFocus: () => void;
|
@@ -803,6 +802,7 @@ declare const TagInput: {
|
|
803
802
|
tagFocus: (e: MouseEvent) => void;
|
804
803
|
handleKeydown: (e: KeyboardEvent) => void;
|
805
804
|
handlePaste: (e: ClipboardEvent) => boolean;
|
805
|
+
resolveClassName: (cls: string) => string;
|
806
806
|
curPage: import("vue").Ref<number>;
|
807
807
|
totalSize: import("vue").Ref<number>;
|
808
808
|
totalPage: import("vue").Ref<number>;
|
@@ -1119,7 +1119,7 @@ declare const TagInput: {
|
|
1119
1119
|
tagInputItemRef: any;
|
1120
1120
|
selectorListRef: any;
|
1121
1121
|
triggerClass: import("vue").ComputedRef<{
|
1122
|
-
|
1122
|
+
[x: string]: boolean;
|
1123
1123
|
active: boolean;
|
1124
1124
|
disabled: boolean;
|
1125
1125
|
}>;
|
@@ -1127,8 +1127,7 @@ declare const TagInput: {
|
|
1127
1127
|
localCollapseTags: import("vue").ComputedRef<boolean>;
|
1128
1128
|
focusInputTrigger: (e?: MouseEvent) => void;
|
1129
1129
|
activeClass: (data: any, index: number) => {
|
1130
|
-
|
1131
|
-
'bk-selector-selected': boolean;
|
1130
|
+
[x: string]: boolean;
|
1132
1131
|
};
|
1133
1132
|
handleInput: (e?: Event) => void;
|
1134
1133
|
handleFocus: () => void;
|
@@ -1139,6 +1138,7 @@ declare const TagInput: {
|
|
1139
1138
|
tagFocus: (e: MouseEvent) => void;
|
1140
1139
|
handleKeydown: (e: KeyboardEvent) => void;
|
1141
1140
|
handlePaste: (e: ClipboardEvent) => boolean;
|
1141
|
+
resolveClassName: (cls: string) => string;
|
1142
1142
|
curPage: import("vue").Ref<number>;
|
1143
1143
|
totalSize: import("vue").Ref<number>;
|
1144
1144
|
totalPage: import("vue").Ref<number>;
|
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("../config-provider"),require("../directives"),require("../icon"),require("../loading"),require("../popover"),require("vue-types"));else if("function"==typeof define&&define.amd)define(["../shared","vue","lodash","../config-provider","../directives","../icon","../loading","../popover","vue-types"],t);else{var r="object"==typeof exports?t(require("../shared"),require("vue"),require("lodash"),require("../config-provider"),require("../directives"),require("../icon"),require("../loading"),require("../popover"),require("vue-types")):t(e["../shared"],e.vue,e.lodash,e["../config-provider"],e["../directives"],e["../icon"],e["../loading"],e["../popover"],e["vue-types"]);for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(self,((e,t,r,a,o,n,l,i,s)=>(()=>{"use strict";var u={2717:e=>{e.exports=a},4061:e=>{e.exports=o},6870:e=>{e.exports=n},4870:e=>{e.exports=l},5537:e=>{e.exports=i},4212:t=>{t.exports=e},467:e=>{e.exports=r},748:e=>{e.exports=t},210:e=>{e.exports=s}},c={};function d(e){var t=c[e];if(void 0!==t)return t.exports;var r=c[e]={exports:{}};return u[e](r,r.exports,d),r.exports}d.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return d.d(t,{a:t}),t},d.d=(e,t)=>{for(var r in t)d.o(t,r)&&!d.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var p={};return(()=>{d.r(p),d.d(p,{default:()=>P});var e=d(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,r,a){return(r=function(e){var r=function(e,r){if("object"!==t(e)||null===e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var o=a.call(e,"string");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===t(r)?r:String(r)}(r))in e?Object.defineProperty(e,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[r]=a,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=d(748),i=d(467),s=d(2717),u=d(4061),c=d(6870),f=d(4870),v=d.n(f),g=d(5537),h=d.n(g),y=12,m=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 T=(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}},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])])}});var b,w=d(210);!function(e){e.FOCUS="focus",e.SEARCH="search"}(b||(b={}));const x=(0,l.defineComponent)({name:"TagRender",directives:{bkTooltips:u.bkTooltips},props:{node:e.PropTypes.object,displayKey:e.PropTypes.string,tpl:{type:Function},hasTips:{type:Boolean,default:!1},tagOverflowTips:{type:Object,default:function(){return{}}}},setup:function(t){var r=(0,l.ref)(),a=(0,l.ref)(!1),o=(0,l.computed)((function(){return Object.assign({boundary:"window",theme:"light",distance:12,content:t.node[t.displayKey],disabled:t.hasTips||!a.value},t.tagOverflowTips)}));return(0,l.onMounted)((function(){a.value=(0,e.checkOverflow)(r.value)})),{overflowTips:o,tagRef:r}},render:function(){return this.tpl?this.tpl(this.node,l.h,this):(0,l.withDirectives)((0,l.createVNode)("div",{class:"tag",ref:"tagRef"},[(0,l.createVNode)("span",{class:"text"},[this.node[this.displayKey]])]),[[(0,l.resolveDirective)("bk-tooltips"),this.overflowTips]])}}),L=(0,l.defineComponent)({name:"TagInput",directives:{bkTooltips:u.bkTooltips},props:{modelValue:e.PropTypes.arrayOf(e.PropTypes.string).def([]),placeholder:e.PropTypes.string.def(""),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:(0,w.toType)("treeTriggerType",{}).def(b.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),isAsyncList:e.PropTypes.bool.def(!1),leftSpace:e.PropTypes.number.def(0),createTagValidator:{type:Function},filterCallback:{type:Function},tagTpl:{type:Function},tpl:{type:Function},pasteFn:{type:Function},withValidate:{type:Boolean,default:!0},popoverProps:{type:Object,default:function(){return{}}},collapseTags:{type:Boolean,default:!1},tagOverflowTips:{type:Object,default:function(){return{}}}},emits:["update:modelValue","change","select","focus","blur","remove","removeAll","input"],setup:function(r,u){var c=u.emit,d=(0,e.useFormItem)(),p=(0,s.useLocale)("tagInput"),f=(0,l.reactive)({isEdit:!1,isHover:!1,focusItemIndex:r.allowCreate?-1:0}),v=(0,l.reactive)(Object.assign({isShow:!1,width:190,offset:{mainAxis:4,crossAxis:0}},r.popoverProps)),g=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),h=g.pageState,T=g.initPage,b=g.pageChange,w=(0,l.ref)(""),x=(0,l.ref)(null),L=(0,l.ref)(null),P=(0,l.ref)(null),I=(0,l.ref)(null),S=(0,l.ref)(null),C=(0,l.ref)(null),K=(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===j.selectedTagList.length&&""===w.value&&!f.isEdit})),N=(0,l.computed)((function(){return r.placeholder||p.value.placeholder})),O=(0,l.computed)((function(){return r.clearable&&!r.disabled&&0!==j.selectedTagList.length&&(!r.showClearOnlyHover||f.isHover)})),A=(0,l.computed)((function(){return{"bk-tag-input-trigger":!0,active:f.isEdit,disabled:r.disabled}})),j=(0,l.reactive)({localList:[],tagListCache:[],selectedTagList:[],selectedTagListCache:[]}),R=(0,l.computed)((function(){return j.selectedTagList.map((function(e){return e[r.saveKey]}))})),E=function(e){var t=(0,l.toRefs)(e),r=t.useGroup,a=t.saveKey,o=t.displayKey,n=t.list,i=(0,l.ref)([]),s=(0,l.ref)({});return(0,l.watch)([r,a,o,n],(function(){i.value=[];var e=(0,l.markRaw)(n.value);r.value&&(e=e.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)}),[])),i.value=e,s.value=e.reduce((function(e,t){return e[t[a.value]]=t,e}),{})}),{immediate:!0,deep:!0}),{flatList:i,saveKeyMap:s}}(r),D=E.flatList,q=E.saveKeyMap,M=(0,l.computed)((function(){if(r.useGroup){var e={};return h.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 h.curPageList}));(0,l.watch)([function(){return D.value}],(function(){(0,l.nextTick)((function(){B()}))}),{deep:!0}),(0,l.watch)((function(){return r.modelValue}),(function(e){var t,a,o;o=e,(a=R.value).length===o.length&&o.every((function(e,t){return a[t]===e}))||((0,l.nextTick)((function(){B()})),r.withValidate&&(null===(t=null==d?void 0:d.validate)||void 0===t||t.call(d,"change")))})),(0,l.watch)(w,(0,i.debounce)((function(){var e=0!==h.curPageList.length,t=w.value;""!==t&&e||""===t&&"focus"===r.trigger&&e?v.isShow=!0:"focus"===r.trigger&&e||(v.isShow=!1)}),150)),(0,l.watch)((function(){return v.isShow}),(function(e){F(),e&&S.value&&((0,l.nextTick)((function(){S.value.scrollTop=0})),S.value.removeEventListener("scroll",H),S.value.addEventListener("scroll",H))})),(0,l.onMounted)((function(){B()}));var F=function(){var e;v.offset.crossAxis=k.value?0:null===(e=I.value)||void 0===e?void 0:e.offsetLeft},H=function(){if(!h.isPageLoading&&0!==S.value.scrollTop){var e=S.value;if(e.scrollTop+e.offsetHeight>=e.scrollHeight){var t=h.curPage+1;t<=h.totalPage&&(h.isPageLoading=!0,setTimeout((function(){b(t)}),500))}}},_=function(){var e;return Array.from((null===(e=P.value)||void 0===e?void 0:e.childNodes)||[]).filter((function(e){return![Node.TEXT_NODE,Node.COMMENT_NODE].includes(e.nodeType)}))},z=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)&&P.value.appendChild(I.value)}clearTimeout(C.value),k.value&&R.value.length&&(j.tagListCache=n(R.value),j.selectedTagListCache=n(j.selectedTagList),w.value=j.selectedTagListCache[0][r.saveKey],te(j.selectedTagList[0],0),Z()),f.isEdit=!0,(0,l.nextTick)((function(){var e;null===(e=x.value)||void 0===e||e.focus(),"focus"===r.trigger&&0!==j.localList.length&&(G(),v.isShow?F():v.isShow=!0)}))}},B=function(){var e=r.saveKey,t=r.modelValue,a=r.displayKey,n=r.allowCreate,l=r.trigger,i=r.isAsyncList;if(j.selectedTagList=[],j.localList=D.value,t.length){var s={};j.selectedTagList=t.map((function(t){var r,l=q.value[t];return s[t]=1,!l&&n?(o(r={},e,t),o(r,a,t),r):l})).filter((function(e){return e})),k.value||(j.localList=j.localList.filter((function(t){return!s[t[e]]})))}if(i&&w.value)return G(w.value),void(h.curPageList.length&&(v.isShow=!0));"focus"===l&&G()},G=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=r.searchKey,a=r.filterCallback,o=e.toLowerCase().trim();if(""!==o){var n;n="function"==typeof a?a(o,t,j.localList)||[]:Array.isArray(t)?j.localList.filter((function(e){return t.some((function(t){return e[t].toLowerCase().indexOf(o)>-1}))})):j.localList.filter((function(e){return e[t].toLowerCase().indexOf(o)>-1})),T(n)}else T(j.localList)},U=function(){w.value=""},W=function(){if(k.value)return 0;var e=_().findIndex((function(e){return"tagInputItem"===e.id}));return e>=0?e:0},$=function(e,t){if(t&&e){var r=t;arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(r=t.nextElementSibling||null),t.parentNode.insertBefore(e,r)}},Z=function(e){var t=r.maxData,a=r.trigger,o=r.allowCreate;if(-1===t||t>R.value.length){var n=((null==e?void 0:e.target)?e.target:w).value,l=m(n);l?(G(n),x.value.style.width="".concat(l*y,"px")):"focus"===a&&G()}else X(),w.value="",v.isShow=!1;f.isEdit=!0,f.focusItemIndex=o?-1:0,c("input",w.value)},X=function(){C.value=setTimeout((function(){var e,t,o,n=w.value;if(U(),f.isEdit=!1,k.value){var l=(t=j.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,i=[],s=!0,u=!1;try{if(n=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(a=n.call(r)).done)&&(i.push(a.value),i.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(u)throw o}}return i}}(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&&j.selectedTagListCache.length?ee(j.selectedTagListCache[0],"select"):Q("remove")}else if(r.allowAutoMatch&&n){var i=h.curPageList.find((function(e){return Array.isArray(r.searchKey)?r.searchKey.map((function(t){return e[t]})).includes(n):e[r.searchKey]===n}));i?J(i,"select"):r.allowCreate&&J(n,"custom")}v.isShow=!1,c("blur",n,R.value),null===(e=null==d?void 0:d.validate)||void 0===e||e.call(d,"blur")}),200)},J=function(e,t,r){null==r||r.stopPropagation(),e&&!e.disabled&&(k.value&&(j.tagListCache=[],j.selectedTagListCache=[],j.selectedTagList=[]),ee(e,t),Q("select"),U(),v.isShow=!1)},Q=function(e,t){c(e,t),c("update:modelValue",R.value),c("change",R.value)},Y=function(){var e=S.value.clientHeight,t=S.value.getBoundingClientRect().y;(0,l.nextTick)((function(){var r=S.value.querySelector(".bk-selector-actived");if(r){var a=r.clientHeight,o=r.getBoundingClientRect().y;o<t&&(S.value.scrollTop=S.value.scrollTop-(t-o));var n=o+a-t;n>e&&(S.value.scrollTop=S.value.scrollTop+n-e)}}))},ee=function(e,a){if(!(j.selectedTagList.length>=r.maxData&&-1!==r.maxData)){var i,s=r.separator,u=r.saveKey,c=r.displayKey,d=r.createTagValidator,p=W(),f=1,v=!1,g=function(e){return"function"!=typeof d||d(e)};if("custom"===a)if(s){var h,m=e.split(s),T=(m=m.filter((function(e){return(null==e?void 0:e.trim())&&!R.value.includes(e)&&g(e)}))).map((function(e){var t;return q.value[e]||(o(t={},u,e),o(t,c,e),t)}));m.length&&((h=j.selectedTagList).splice.apply(h,[p,0].concat(n(T))),f=T.length,v=!0)}else{var b="object"===t(e);if(void 0!==(i=(i=b?e[u]:e.trim()).replace(/\s+/g,""))&&!R.value.includes(i)&&g(i)){var w,L=q.value[i]||(b?e:(o(w={},u,i),o(w,c,i),w));j.selectedTagList.splice(p,0,L),v=!0}}else e&&(void 0===(i=e[u])||R.value.includes(i)||(j.selectedTagList.splice(p,0,e),v=!0));v&&(0,l.nextTick)((function(){for(var e=1;e<=f;e++){var t=_()[p+e];$(t,I.value)}if(x.value.style.width="".concat(y,"px"),!k.value){r.allowNextFocus&&z();var a=R.value.reduce((function(e,t){return e[t]=1,e}),{});j.localList=j.localList.filter((function(e){return!a[e[u]]}))}}))}},te=function(e,t){j.selectedTagList.splice(t,1);var a=q.value[e[r.saveKey]];(r.allowCreate&&a||!r.allowCreate)&&!k.value&&j.localList.push(e)},re=(0,l.computed)((function(){return r.collapseTags?r.collapseTags&&!f.isEdit:r.collapseTags})),ae=function(e,t,r){(0,l.watch)([r,t],(function(){o()}),{flush:"post"});var a=(0,l.ref)(null),o=function(){t.value&&(a.value=null,setTimeout((function(){var t=Array.from(e.value.querySelectorAll(".tag-item")),r=t.findIndex((function(e,r){return!!r&&t[r-1].offsetTop!==e.offsetTop}));a.value=r>0?r-1:null})))};return{overflowTagIndex:a}}(L,re,R),oe=ae.overflowTagIndex;return Object.assign(Object.assign(Object.assign(Object.assign({popoverProps:v},(0,l.toRefs)(f)),(0,l.toRefs)(j)),(0,l.toRefs)(h)),{isShowPlaceholder:V,isShowClear:O,placeholderText:N,curInputValue:w,renderList:M,showTagClose:K,tagInputRef:x,bkTagSelectorRef:L,tagListRef:P,tagInputItemRef:I,selectorListRef:S,triggerClass:A,overflowTagIndex:oe,localCollapseTags:re,focusInputTrigger:z,activeClass:function(e,t){var a={"bk-selector-actived":!1,"bk-selector-selected":R.value.includes(e[r.saveKey])};return r.useGroup?a["bk-selector-actived"]=e.__index__===f.focusItemIndex:a["bk-selector-actived"]=t===f.focusItemIndex,a},handleInput:Z,handleFocus:function(){var e;v.width=k.value?null===(e=L.value)||void 0===e?void 0:e.clientWidth:r.contentWidth,c("focus")},handleBlur:X,handleTagSelected:J,handleTagRemove:function(e,t,r){null==r||r.stopPropagation(),te(e,t),U(),Q("remove",e),x.value.style.width="".concat(y,"px")},handleClear:function(e){e.stopPropagation();var t=j.selectedTagList;j.selectedTagList=[];var a,o=t.filter((function(e){return q.value[e[r.saveKey]]}));(!r.allowCreate||0===o.length)&&r.allowCreate||k.value||(a=j.localList).push.apply(a,n(o)),Q("removeAll")},tagFocus:function(e){r.disabled||($(I.value,e.currentTarget,!0),x.value.style.width="".concat(y,"px"),v.isShow&&F())},handleKeydown:function(e){if(!h.isPageLoading){var t=e.target.value,a=m(t),o=W(),n=_();switch(e.code){case"ArrowUp":if(e.preventDefault(),!v.isShow)return;f.focusItemIndex=f.focusItemIndex-1,f.focusItemIndex=f.focusItemIndex<0?-1:f.focusItemIndex,-1===f.focusItemIndex&&(f.focusItemIndex=h.curPageList.length-1),Y();break;case"ArrowDown":if(e.preventDefault(),!v.isShow)return;f.focusItemIndex=f.focusItemIndex+1,f.focusItemIndex=f.focusItemIndex>h.curPageList.length-1?h.curPageList.length:f.focusItemIndex,f.focusItemIndex===h.curPageList.length&&(f.focusItemIndex=0),Y();break;case"ArrowLeft":if(f.isEdit=!0,!a){if(o<1)return;$(I.value,n[o-1]),z()}break;case"ArrowRight":if(f.isEdit=!0,!a){if(o===n.length-1)return;$(n[o+1],I.value),z()}break;case"Enter":case"NumpadEnter":!r.allowCreate&&v.isShow||r.allowCreate&&f.focusItemIndex>=0&&v.isShow?J(h.curPageList[f.focusItemIndex],"select",e):r.allowCreate&&w.value.trim()&&J(w.value,"custom",e),e.preventDefault();break;case"Backspace":0===o||w.value||function(e,t){var a=_();$(I.value,a[e-1]),j.selectedTagList.splice(e-1,1),z();var o=q.value[t[r.saveKey]];(r.allowCreate&&o||!r.allowCreate)&&!k.value&&j.localList.push(t),x.value="".concat(y,"px"),Q("remove")}(o,j.selectedTagList[o-1])}}},handlePaste:function(e){if(e.preventDefault(),k.value)return!1;var t=r.maxData,a=r.saveKey,l=r.displayKey,i=r.pasteFn,s=r.allowCreate,u=e.clipboardData.getData("text"),c=i?i(u):function(e){var t=[],a=e.split(";"),n=/^[a-zA-Z][a-zA-Z_]*/g;return a.forEach((function(e){var a=e.match(n);if(a){var l,i=a.join("");t.push((o(l={},r.saveKey,i),o(l,r.displayKey,i),l))}})),t}(u),d=c.map((function(e){return e[a]}));if(d.length){var p=_(),f=W(),v=j.localList.map((function(e){return e[a]}));if(d=d.filter((function(e){var t=(null==e?void 0:e.trim())&&!R.value.includes(e);return s?t:t&&v.includes(e)})),-1!==t){var g=j.selectedTagList.length;if(g<t){var h=t-g;d.length>h&&(d=n(d.slice(0,h)))}else d=[]}var m,T=s?d.map((function(e){var t,r=j.localList.find((function(t){return t[a]===e}));return null!=r?r:(o(t={},a,e),o(t,l,e),t)})):j.localList.filter((function(e){return d.includes(e[a])}));d.length&&((m=j.selectedTagList).splice.apply(m,[f,0].concat(n(T))),$(I.value,p[f]),x.value.style.width="".concat(y,"px"),j.localList=j.localList.filter((function(e){return!d.includes(e[a])})),Q("select"),z())}}})},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)(h(),(0,l.mergeProps)({theme:"light bk-tag-input-popover-content",trigger:"manual",placement:"bottom-start",arrow:!1},this.popoverProps),{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},o=e.localCollapseTags&&e.overflowTagIndex&&r>=e.overflowTagIndex;return(0,l.withDirectives)((0,l.createVNode)("li",{class:"tag-item",style:{display:o?"none":""},onClick:e.tagFocus},[(0,l.createVNode)(x,{node:t,tpl:e.tagTpl,displayKey:e.displayKey,hasTips:!!e.tooltipKey,tagOverflowTips:e.tagOverflowTips},null),e.showTagClose?(0,l.createVNode)(c.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]]),!!e.overflowTagIndex&&e.localCollapseTags&&(0,l.createVNode)("li",{class:"tag-item"},[(0,l.createVNode)("div",{class:"tag"},[(0,l.createVNode)("span",{class:"text"},[(0,l.createTextVNode)("+"),e.selectedTagList.length-e.overflowTagIndex])])])]),(0,l.withDirectives)((0,l.createVNode)("p",{class:"placeholder"},[e.placeholderText]),[[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)(c.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.renderList.map((function(t,r){return e.useGroup?(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)(T,{node:t,displayKey:e.displayKey,tpl:e.tpl,searchKey:e.searchKey,searchKeyword:e.curInputValue},null)])}))])]):(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)(T,{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)(v(),{theme:"primary",size:f.BkLoadingSize.Small},null)]):null])])}})])}}),P=(0,e.withInstall)(L)})(),p})()));
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("lodash"),require("../config-provider"),require("../directives"),require("../icon"),require("../loading"),require("../popover"),require("vue-types"));else if("function"==typeof define&&define.amd)define(["../shared","vue","lodash","../config-provider","../directives","../icon","../loading","../popover","vue-types"],t);else{var r="object"==typeof exports?t(require("../shared"),require("vue"),require("lodash"),require("../config-provider"),require("../directives"),require("../icon"),require("../loading"),require("../popover"),require("vue-types")):t(e["../shared"],e.vue,e.lodash,e["../config-provider"],e["../directives"],e["../icon"],e["../loading"],e["../popover"],e["vue-types"]);for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(self,((e,t,r,a,o,n,l,i,s)=>(()=>{"use strict";var c={2717:e=>{e.exports=a},4061:e=>{e.exports=o},6870:e=>{e.exports=n},4870:e=>{e.exports=l},5537:e=>{e.exports=i},4212:t=>{t.exports=e},467:e=>{e.exports=r},748:e=>{e.exports=t},210:e=>{e.exports=s}},u={};function d(e){var t=u[e];if(void 0!==t)return t.exports;var r=u[e]={exports:{}};return c[e](r,r.exports,d),r.exports}d.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return d.d(t,{a:t}),t},d.d=(e,t)=>{for(var r in t)d.o(t,r)&&!d.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var p={};return(()=>{d.r(p),d.d(p,{default:()=>P});var e=d(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){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.")}()}function n(e,r,a){return(r=function(e){var r=function(e,r){if("object"!==t(e)||null===e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var o=a.call(e,"string");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===t(r)?r:String(r)}(r))in e?Object.defineProperty(e,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[r]=a,e}var l=d(748),i=d(467),s=d(2717),c=d(4061),u=d(6870),f=d(4870),v=d.n(f),g=d(5537),h=d.n(g),y=12,m=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 T=(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}},render:function(){var e=this,t=(0,s.usePrefix)().resolveClassName,r=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,r,l.h,this);var a=this.node[this.displayKey];return(0,l.createVNode)("div",{class:"".concat(t("selector-node"))},[(0,l.createVNode)("span",{class:"text",innerHTML:r(a)},[a])])}});var b,w=d(210);!function(e){e.FOCUS="focus",e.SEARCH="search"}(b||(b={}));const x=(0,l.defineComponent)({name:"TagRender",directives:{bkTooltips:c.bkTooltips},props:{node:e.PropTypes.object,displayKey:e.PropTypes.string,tpl:{type:Function},hasTips:{type:Boolean,default:!1},tagOverflowTips:{type:Object,default:function(){return{}}}},setup:function(t){var r=(0,l.ref)(),a=(0,l.ref)(!1),o=(0,l.computed)((function(){return Object.assign({boundary:"window",theme:"light",distance:12,content:t.node[t.displayKey],disabled:t.hasTips||!a.value},t.tagOverflowTips)}));return(0,l.onMounted)((function(){a.value=(0,e.checkOverflow)(r.value)})),{overflowTips:o,tagRef:r}},render:function(){return this.tpl?this.tpl(this.node,l.h,this):(0,l.withDirectives)((0,l.createVNode)("div",{class:"tag",ref:"tagRef"},[(0,l.createVNode)("span",{class:"text"},[this.node[this.displayKey]])]),[[(0,l.resolveDirective)("bk-tooltips"),this.overflowTips]])}}),L=(0,l.defineComponent)({name:"TagInput",directives:{bkTooltips:c.bkTooltips},props:{modelValue:e.PropTypes.arrayOf(e.PropTypes.string).def([]),placeholder:e.PropTypes.string.def(""),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:(0,w.toType)("treeTriggerType",{}).def(b.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),isAsyncList:e.PropTypes.bool.def(!1),leftSpace:e.PropTypes.number.def(0),createTagValidator:{type:Function},filterCallback:{type:Function},tagTpl:{type:Function},tpl:{type:Function},pasteFn:{type:Function},withValidate:{type:Boolean,default:!0},popoverProps:{type:Object,default:function(){return{}}},collapseTags:{type:Boolean,default:!1},tagOverflowTips:{type:Object,default:function(){return{}}}},emits:["update:modelValue","change","select","focus","blur","remove","removeAll","input"],setup:function(r,c){var u=c.emit,d=(0,e.useFormItem)(),p=(0,s.useLocale)("tagInput"),f=(0,l.reactive)({isEdit:!1,isHover:!1,focusItemIndex:r.allowCreate?-1:0}),v=(0,l.reactive)(Object.assign({isShow:!1,width:190,offset:{mainAxis:4,crossAxis:0}},r.popoverProps)),g=(0,s.usePrefix)().resolveClassName,h=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),T=h.pageState,b=h.initPage,w=h.pageChange,x=(0,l.ref)(""),L=(0,l.ref)(null),P=(0,l.ref)(null),I=(0,l.ref)(null),C=(0,l.ref)(null),S=(0,l.ref)(null),N=(0,l.ref)(null),K=(0,l.computed)((function(){return!r.disabled&&r.hasDeleteIcon})),V=(0,l.computed)((function(){return 1===r.maxData})),O=(0,l.computed)((function(){return 0===R.selectedTagList.length&&""===x.value&&!f.isEdit})),A=(0,l.computed)((function(){return r.placeholder||p.value.placeholder})),j=(0,l.computed)((function(){return r.clearable&&!r.disabled&&0!==R.selectedTagList.length&&(!r.showClearOnlyHover||f.isHover)})),k=(0,l.computed)((function(){var e;return n(e={},"".concat(g("tag-input-trigger")),!0),n(e,"active",f.isEdit),n(e,"disabled",r.disabled),e})),R=(0,l.reactive)({localList:[],tagListCache:[],selectedTagList:[],selectedTagListCache:[]}),E=(0,l.computed)((function(){return R.selectedTagList.map((function(e){return e[r.saveKey]}))})),D=function(e){var t=(0,l.toRefs)(e),r=t.useGroup,a=t.saveKey,o=t.displayKey,n=t.list,i=(0,l.ref)([]),s=(0,l.ref)({});return(0,l.watch)([r,a,o,n],(function(){i.value=[];var e=(0,l.markRaw)(n.value);r.value&&(e=e.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)}),[])),i.value=e,s.value=e.reduce((function(e,t){return e[t[a.value]]=t,e}),{})}),{immediate:!0,deep:!0}),{flatList:i,saveKeyMap:s}}(r),q=D.flatList,M=D.saveKeyMap,F=(0,l.computed)((function(){if(r.useGroup){var e={};return T.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 T.curPageList}));(0,l.watch)([function(){return q.value}],(function(){(0,l.nextTick)((function(){G()}))}),{deep:!0}),(0,l.watch)((function(){return r.modelValue}),(function(e){var t,a,o;o=e,(a=E.value).length===o.length&&o.every((function(e,t){return a[t]===e}))||((0,l.nextTick)((function(){G()})),r.withValidate&&(null===(t=null==d?void 0:d.validate)||void 0===t||t.call(d,"change")))})),(0,l.watch)(x,(0,i.debounce)((function(){var e=0!==T.curPageList.length,t=x.value;""!==t&&e||""===t&&"focus"===r.trigger&&e?v.isShow=!0:"focus"===r.trigger&&e||(v.isShow=!1)}),150)),(0,l.watch)((function(){return v.isShow}),(function(e){H(),e&&S.value&&((0,l.nextTick)((function(){S.value.scrollTop=0})),S.value.removeEventListener("scroll",_),S.value.addEventListener("scroll",_))})),(0,l.onMounted)((function(){G()}));var H=function(){var e;v.offset.crossAxis=V.value?0:null===(e=C.value)||void 0===e?void 0:e.offsetLeft},_=function(){if(!T.isPageLoading&&0!==S.value.scrollTop){var e=S.value;if(e.scrollTop+e.offsetHeight>=e.scrollHeight){var t=T.curPage+1;t<=T.totalPage&&(T.isPageLoading=!0,setTimeout((function(){w(t)}),500))}}},z=function(){var e;return Array.from((null===(e=I.value)||void 0===e?void 0:e.childNodes)||[]).filter((function(e){return![Node.TEXT_NODE,Node.COMMENT_NODE].includes(e.nodeType)}))},B=function(e){if(!r.disabled){if(null==e?void 0:e.target){var t=e.target.className;(t.indexOf("".concat(g("tag-input-trigger")))>-1||t.indexOf("tag-list")>-1)&&I.value.appendChild(C.value)}clearTimeout(N.value),V.value&&E.value.length&&(R.tagListCache=o(E.value),R.selectedTagListCache=o(R.selectedTagList),x.value=R.selectedTagListCache[0][r.saveKey],re(R.selectedTagList[0],0),X()),f.isEdit=!0,(0,l.nextTick)((function(){var e;null===(e=L.value)||void 0===e||e.focus(),"focus"===r.trigger&&0!==R.localList.length&&(U(),v.isShow?H():v.isShow=!0)}))}},G=function(){var e=r.saveKey,t=r.modelValue,a=r.displayKey,o=r.allowCreate,l=r.trigger,i=r.isAsyncList;if(R.selectedTagList=[],R.localList=q.value,t.length){var s={};R.selectedTagList=t.map((function(t){var r,l=M.value[t];return s[t]=1,!l&&o?(n(r={},e,t),n(r,a,t),r):l})).filter((function(e){return e})),V.value||(R.localList=R.localList.filter((function(t){return!s[t[e]]})))}if(i&&x.value)return U(x.value),void(T.curPageList.length&&(v.isShow=!0));"focus"===l&&U()},U=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=r.searchKey,a=r.filterCallback,o=e.toLowerCase().trim();if(""!==o){var n;n="function"==typeof a?a(o,t,R.localList)||[]:Array.isArray(t)?R.localList.filter((function(e){return t.some((function(t){return e[t].toLowerCase().indexOf(o)>-1}))})):R.localList.filter((function(e){return e[t].toLowerCase().indexOf(o)>-1})),b(n)}else b(R.localList)},W=function(){x.value=""},$=function(){if(V.value)return 0;var e=z().findIndex((function(e){return"tagInputItem"===e.id}));return e>=0?e:0},Z=function(e,t){if(t&&e){var r=t;arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(r=t.nextElementSibling||null),t.parentNode.insertBefore(e,r)}},X=function(e){var t=r.maxData,a=r.trigger,o=r.allowCreate;if(-1===t||t>E.value.length){var n=((null==e?void 0:e.target)?e.target:x).value,l=m(n);l?(U(n),L.value.style.width="".concat(l*y,"px")):"focus"===a&&U()}else J(),x.value="",v.isShow=!1;f.isEdit=!0,f.focusItemIndex=o?-1:0,u("input",x.value)},J=function(){N.value=setTimeout((function(){var e,t,o,n=x.value;if(W(),f.isEdit=!1,V.value){var l=(t=R.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,i=[],s=!0,c=!1;try{if(n=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(a=n.call(r)).done)&&(i.push(a.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}(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&&R.selectedTagListCache.length?te(R.selectedTagListCache[0],"select"):Y("remove")}else if(r.allowAutoMatch&&n){var i=T.curPageList.find((function(e){return Array.isArray(r.searchKey)?r.searchKey.map((function(t){return e[t]})).includes(n):e[r.searchKey]===n}));i?Q(i,"select"):r.allowCreate&&Q(n,"custom")}v.isShow=!1,u("blur",n,E.value),null===(e=null==d?void 0:d.validate)||void 0===e||e.call(d,"blur")}),200)},Q=function(e,t,r){null==r||r.stopPropagation(),e&&!e.disabled&&(V.value&&(R.tagListCache=[],R.selectedTagListCache=[],R.selectedTagList=[]),te(e,t),Y("select"),W(),v.isShow=!1)},Y=function(e,t){u(e,t),u("update:modelValue",E.value),u("change",E.value)},ee=function(){var e=S.value.clientHeight,t=S.value.getBoundingClientRect().y;(0,l.nextTick)((function(){var r=S.value.querySelector(".".concat(g("selector-actived")));if(r){var a=r.clientHeight,o=r.getBoundingClientRect().y;o<t&&(S.value.scrollTop=S.value.scrollTop-(t-o));var n=o+a-t;n>e&&(S.value.scrollTop=S.value.scrollTop+n-e)}}))},te=function(e,a){if(!(R.selectedTagList.length>=r.maxData&&-1!==r.maxData)){var i,s=r.separator,c=r.saveKey,u=r.displayKey,d=r.createTagValidator,p=$(),f=1,v=!1,g=function(e){return"function"!=typeof d||d(e)};if("custom"===a)if(s){var h,m=e.split(s),T=(m=m.filter((function(e){return(null==e?void 0:e.trim())&&!E.value.includes(e)&&g(e)}))).map((function(e){var t;return M.value[e]||(n(t={},c,e),n(t,u,e),t)}));m.length&&((h=R.selectedTagList).splice.apply(h,[p,0].concat(o(T))),f=T.length,v=!0)}else{var b="object"===t(e);if(void 0!==(i=(i=b?e[c]:e.trim()).replace(/\s+/g,""))&&!E.value.includes(i)&&g(i)){var w,x=M.value[i]||(b?e:(n(w={},c,i),n(w,u,i),w));R.selectedTagList.splice(p,0,x),v=!0}}else e&&(void 0===(i=e[c])||E.value.includes(i)||(R.selectedTagList.splice(p,0,e),v=!0));v&&(0,l.nextTick)((function(){for(var e=1;e<=f;e++){var t=z()[p+e];Z(t,C.value)}if(L.value.style.width="".concat(y,"px"),!V.value){r.allowNextFocus&&B();var a=E.value.reduce((function(e,t){return e[t]=1,e}),{});R.localList=R.localList.filter((function(e){return!a[e[c]]}))}}))}},re=function(e,t){R.selectedTagList.splice(t,1);var a=M.value[e[r.saveKey]];(r.allowCreate&&a||!r.allowCreate)&&!V.value&&R.localList.push(e)},ae=(0,l.computed)((function(){return r.collapseTags?r.collapseTags&&!f.isEdit:r.collapseTags})),oe=function(e,t,r){(0,l.watch)([r,t],(function(){o()}),{flush:"post"});var a=(0,l.ref)(null),o=function(){t.value&&(a.value=null,setTimeout((function(){var t=Array.from(e.value.querySelectorAll(".tag-item")),r=t.findIndex((function(e,r){return!!r&&t[r-1].offsetTop!==e.offsetTop}));a.value=r>0?r-1:null})))};return{overflowTagIndex:a}}(P,ae,E),ne=oe.overflowTagIndex;return Object.assign(Object.assign(Object.assign(Object.assign({popoverProps:v},(0,l.toRefs)(f)),(0,l.toRefs)(R)),(0,l.toRefs)(T)),{isShowPlaceholder:O,isShowClear:j,placeholderText:A,curInputValue:x,renderList:F,showTagClose:K,tagInputRef:L,bkTagSelectorRef:P,tagListRef:I,tagInputItemRef:C,selectorListRef:S,triggerClass:k,overflowTagIndex:ne,localCollapseTags:ae,focusInputTrigger:B,activeClass:function(e,t){var a,o=(n(a={},"".concat(g("selector-actived")),!0),n(a,"".concat(g("selector-selected")),E.value.includes(e[r.saveKey])),a);return r.useGroup?o["".concat(g("selector-actived"))]=e.__index__===f.focusItemIndex:o["".concat(g("selector-actived"))]=t===f.focusItemIndex,o},handleInput:X,handleFocus:function(){var e;v.width=V.value?null===(e=P.value)||void 0===e?void 0:e.clientWidth:r.contentWidth,u("focus")},handleBlur:J,handleTagSelected:Q,handleTagRemove:function(e,t,r){null==r||r.stopPropagation(),re(e,t),W(),Y("remove",e),L.value.style.width="".concat(y,"px")},handleClear:function(e){e.stopPropagation();var t=R.selectedTagList;R.selectedTagList=[];var a,n=t.filter((function(e){return M.value[e[r.saveKey]]}));(!r.allowCreate||0===n.length)&&r.allowCreate||V.value||(a=R.localList).push.apply(a,o(n)),Y("removeAll")},tagFocus:function(e){r.disabled||(Z(C.value,e.currentTarget,!0),L.value.style.width="".concat(y,"px"),v.isShow&&H())},handleKeydown:function(e){if(!T.isPageLoading){var t=e.target.value,a=m(t),o=$(),n=z();switch(e.code){case"ArrowUp":if(e.preventDefault(),!v.isShow)return;f.focusItemIndex=f.focusItemIndex-1,f.focusItemIndex=f.focusItemIndex<0?-1:f.focusItemIndex,-1===f.focusItemIndex&&(f.focusItemIndex=T.curPageList.length-1),ee();break;case"ArrowDown":if(e.preventDefault(),!v.isShow)return;f.focusItemIndex=f.focusItemIndex+1,f.focusItemIndex=f.focusItemIndex>T.curPageList.length-1?T.curPageList.length:f.focusItemIndex,f.focusItemIndex===T.curPageList.length&&(f.focusItemIndex=0),ee();break;case"ArrowLeft":if(f.isEdit=!0,!a){if(o<1)return;Z(C.value,n[o-1]),B()}break;case"ArrowRight":if(f.isEdit=!0,!a){if(o===n.length-1)return;Z(n[o+1],C.value),B()}break;case"Enter":case"NumpadEnter":!r.allowCreate&&v.isShow||r.allowCreate&&f.focusItemIndex>=0&&v.isShow?Q(T.curPageList[f.focusItemIndex],"select",e):r.allowCreate&&x.value.trim()&&Q(x.value,"custom",e),e.preventDefault();break;case"Backspace":0===o||x.value||function(e,t){var a=z();Z(C.value,a[e-1]),R.selectedTagList.splice(e-1,1),B();var o=M.value[t[r.saveKey]];(r.allowCreate&&o||!r.allowCreate)&&!V.value&&R.localList.push(t),L.value="".concat(y,"px"),Y("remove")}(o,R.selectedTagList[o-1])}}},handlePaste:function(e){if(e.preventDefault(),V.value)return!1;var t=r.maxData,a=r.saveKey,l=r.displayKey,i=r.pasteFn,s=r.allowCreate,c=e.clipboardData.getData("text"),u=i?i(c):function(e){var t=[],a=e.split(";"),o=/^[a-zA-Z][a-zA-Z_]*/g;return a.forEach((function(e){var a=e.match(o);if(a){var l,i=a.join("");t.push((n(l={},r.saveKey,i),n(l,r.displayKey,i),l))}})),t}(c),d=u.map((function(e){return e[a]}));if(d.length){var p=z(),f=$(),v=R.localList.map((function(e){return e[a]}));if(d=d.filter((function(e){var t=(null==e?void 0:e.trim())&&!E.value.includes(e);return s?t:t&&v.includes(e)})),-1!==t){var g=R.selectedTagList.length;if(g<t){var h=t-g;d.length>h&&(d=o(d.slice(0,h)))}else d=[]}var m,T=s?d.map((function(e){var t,r=R.localList.find((function(t){return t[a]===e}));return null!=r?r:(n(t={},a,e),n(t,l,e),t)})):R.localList.filter((function(e){return d.includes(e[a])}));d.length&&((m=R.selectedTagList).splice.apply(m,[f,0].concat(o(T))),Z(C.value,p[f]),L.value.style.width="".concat(y,"px"),R.localList=R.localList.filter((function(e){return!d.includes(e[a])})),Y("select"),B())}},resolveClassName:g})},render:function(){var e=this;return(0,l.createVNode)("div",{class:"".concat(this.resolveClassName("tag-input")),ref:"bkTagSelectorRef",onClick:this.focusInputTrigger,onMouseenter:function(){return e.isHover=!0},onMouseleave:function(){return e.isHover=!1}},[(0,l.createVNode)(h(),(0,l.mergeProps)({theme:"light ".concat(this.resolveClassName("tag-input-popover-content")),trigger:"manual",placement:"bottom-start",arrow:!1},this.popoverProps),{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},o=e.localCollapseTags&&e.overflowTagIndex&&r>=e.overflowTagIndex;return(0,l.withDirectives)((0,l.createVNode)("li",{class:"tag-item",style:{display:o?"none":""},onClick:e.tagFocus},[(0,l.createVNode)(x,{node:t,tpl:e.tagTpl,displayKey:e.displayKey,hasTips:!!e.tooltipKey,tagOverflowTips:e.tagOverflowTips},null),e.showTagClose?(0,l.createVNode)(u.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]]),!!e.overflowTagIndex&&e.localCollapseTags&&(0,l.createVNode)("li",{class:"tag-item"},[(0,l.createVNode)("div",{class:"tag"},[(0,l.createVNode)("span",{class:"text"},[(0,l.createTextVNode)("+"),e.selectedTagList.length-e.overflowTagIndex])])])]),(0,l.withDirectives)((0,l.createVNode)("p",{class:"placeholder"},[e.placeholderText]),[[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)(u.Close,{class:"clear-icon",onClick:e.handleClear},null)])},content:function(){return(0,l.createVNode)("div",{class:"".concat(e.resolveClassName("selector-list"))},[(0,l.createVNode)("ul",{ref:"selectorListRef",style:{"max-height":"".concat(e.contentMaxHeight,"px")},class:"outside-ul"},[e.renderList.map((function(t,r){return e.useGroup?(0,l.createVNode)("li",{class:"".concat(e.resolveClassName("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:"".concat(e.resolveClassName("selector-group-list-item"))},[t.children.map((function(t,r){return(0,l.createVNode)("li",{class:["".concat(e.resolveClassName("selector-list-item")),{disabled:t.disabled},e.activeClass(t,r)],onClick:e.handleTagSelected.bind(e,t,"select")},[(0,l.createVNode)(T,{node:t,displayKey:e.displayKey,tpl:e.tpl,searchKey:e.searchKey,searchKeyword:e.curInputValue},null)])}))])]):(0,l.createVNode)("li",{class:["".concat(e.resolveClassName("selector-list-item")),{disabled:t.disabled},e.activeClass(t,r)],onClick:e.handleTagSelected.bind(e,t,"select")},[(0,l.createVNode)(T,{node:t,displayKey:e.displayKey,tpl:e.tpl,searchKey:e.searchKey,searchKeyword:e.curInputValue},null)])})),e.isPageLoading?(0,l.createVNode)("li",{class:"".concat(e.resolveClassName("selector-list-item")," loading")},[(0,l.createVNode)(v(),{theme:"primary",size:f.BkLoadingSize.Small},null)]):null])])}})])}}),P=(0,e.withInstall)(L)})(),p})()));
|
@@ -280,7 +280,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
280
280
|
tagInputItemRef: any;
|
281
281
|
selectorListRef: any;
|
282
282
|
triggerClass: import("vue").ComputedRef<{
|
283
|
-
|
283
|
+
[x: string]: boolean;
|
284
284
|
active: boolean;
|
285
285
|
disabled: boolean;
|
286
286
|
}>;
|
@@ -288,8 +288,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
288
288
|
localCollapseTags: import("vue").ComputedRef<boolean>;
|
289
289
|
focusInputTrigger: (e?: MouseEvent) => void;
|
290
290
|
activeClass: (data: any, index: number) => {
|
291
|
-
|
292
|
-
'bk-selector-selected': boolean;
|
291
|
+
[x: string]: boolean;
|
293
292
|
};
|
294
293
|
handleInput: (e?: Event) => void;
|
295
294
|
handleFocus: () => void;
|
@@ -300,6 +299,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
300
299
|
tagFocus: (e: MouseEvent) => void;
|
301
300
|
handleKeydown: (e: KeyboardEvent) => void;
|
302
301
|
handlePaste: (e: ClipboardEvent) => boolean;
|
302
|
+
resolveClassName: (cls: string) => string;
|
303
303
|
curPage: Ref<number>;
|
304
304
|
totalSize: Ref<number>;
|
305
305
|
totalPage: Ref<number>;
|