bkui-vue 0.0.1-beta.44 → 0.0.1-beta.47
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 +27 -27
- package/dist/index.esm.js +689 -306
- package/dist/index.umd.js +28 -28
- package/dist/style.css +1 -1
- package/lib/alert/index.js +1 -0
- package/lib/animate-number/{animate-number.js → index.js} +1 -1
- package/lib/backtop/{backtop.js → index.js} +1 -1
- package/lib/badge/index.js +1 -0
- package/lib/breadcrumb/index.js +1 -0
- package/lib/button/index.js +1 -0
- package/lib/card/index.js +1 -0
- package/lib/checkbox/checkbox.css +12 -0
- package/lib/checkbox/checkbox.d.ts +5 -11
- package/lib/checkbox/checkbox.less +17 -0
- package/lib/checkbox/checkbox.variable.css +12 -0
- package/lib/checkbox/common.d.ts +3 -3
- package/lib/checkbox/index.d.ts +10 -18
- package/lib/checkbox/index.js +1 -0
- package/lib/checkbox/type.d.ts +2 -6
- package/lib/code-diff/index.js +1 -0
- package/lib/collapse/index.js +1 -0
- package/lib/date-picker/index.js +1 -0
- package/lib/dialog/dialog.css +3 -0
- package/lib/dialog/dialog.d.ts +89 -17
- package/lib/dialog/dialog.less +4 -0
- package/lib/dialog/dialog.variable.css +3 -0
- package/lib/dialog/index.d.ts +191 -36
- package/lib/dialog/index.js +1 -0
- package/lib/directives/index.js +2 -0
- package/lib/directives/{directives.js.LICENSE.txt → index.js.LICENSE.txt} +0 -0
- package/lib/divider/{divider.js → index.js} +0 -0
- package/lib/dropdown/{dropdown.js → index.js} +0 -0
- package/lib/exception/{exception.js → index.js} +1 -1
- package/lib/fixed-navbar/{fixed-navbar.js → index.js} +1 -1
- package/lib/form/compose-form-item.d.ts +16 -0
- package/lib/form/form.css +73 -12
- package/lib/form/form.less +120 -46
- package/lib/form/form.variable.css +167 -12
- package/lib/form/index.d.ts +17 -1
- package/lib/form/index.js +1 -0
- package/lib/icon/funnel.d.ts +4 -0
- package/lib/icon/funnel.js +1 -0
- package/lib/icon/index.d.ts +1 -0
- package/lib/icon/{icon.js → index.js} +1 -1
- package/lib/input/index.js +1 -0
- package/lib/link/{link.js → index.js} +0 -0
- package/lib/loading/index.js +1 -0
- package/lib/menu/index.js +1 -0
- package/lib/message/{message.js → index.js} +0 -0
- package/lib/modal/index.d.ts +149 -1
- package/lib/modal/index.js +1 -0
- package/lib/modal/modal.css +20 -0
- package/lib/modal/modal.d.ts +58 -0
- package/lib/modal/modal.less +25 -0
- package/lib/modal/modal.variable.css +20 -0
- package/lib/modal/props.mixin.d.ts +26 -0
- package/lib/navigation/index.js +1 -0
- package/lib/notify/index.js +1 -0
- package/lib/pagination/index.js +1 -0
- package/lib/popover/index.d.ts +33 -2
- package/lib/popover/index.js +1 -0
- package/lib/popover/popover.d.ts +16 -1
- package/lib/popover/props.d.ts +12 -0
- package/lib/process/index.js +1 -0
- package/lib/progress/index.js +1 -0
- package/lib/radio/common.d.ts +5 -5
- package/lib/radio/index.d.ts +17 -16
- package/lib/radio/index.js +1 -0
- package/lib/radio/radio-button.d.ts +5 -4
- package/lib/radio/radio.css +2 -2
- package/lib/radio/radio.d.ts +4 -4
- package/lib/radio/radio.less +2 -2
- package/lib/radio/radio.variable.css +2 -2
- package/lib/radio/type.d.ts +9 -4
- package/lib/rate/index.js +1 -0
- package/lib/resize-layout/index.js +1 -0
- package/lib/select/index.js +1 -0
- package/lib/shared/index.js +1 -0
- package/lib/sideslider/index.d.ts +123 -1
- package/lib/sideslider/index.js +1 -0
- package/lib/sideslider/sideslider.d.ts +58 -0
- package/lib/slider/index.js +1 -0
- package/lib/steps/index.js +1 -0
- package/lib/swiper/index.js +1 -0
- package/lib/switcher/index.js +1 -0
- package/lib/switcher/switcher.less +2 -0
- package/lib/tab/index.d.ts +1 -1
- package/lib/tab/index.js +1 -0
- package/lib/tab/tab-panel.d.ts +1 -1
- package/lib/table/index.js +1 -0
- package/lib/table/plugins/head-filter.css +68 -0
- package/lib/table/plugins/head-filter.less +83 -0
- package/lib/table/plugins/head-filter.variable.css +162 -0
- package/lib/table/plugins/head-sort.css +22 -0
- package/lib/table/plugins/head-sort.less +28 -0
- package/lib/table/plugins/head-sort.variable.css +116 -0
- package/lib/table/props.d.ts +8 -1
- package/lib/table/render.d.ts +10 -15
- package/lib/table/table.css +94 -26
- package/lib/table/table.less +9 -28
- package/lib/table/table.variable.css +108 -40
- package/lib/table/utils.d.ts +10 -1
- package/lib/tag/index.js +1 -0
- package/lib/tag-input/index.js +1 -0
- package/lib/timeline/{timeline.js → index.js} +0 -0
- package/lib/transfer/index.js +1 -0
- package/lib/tree/index.js +1 -0
- package/lib/virtual-render/index.js +1 -0
- package/package.json +30 -16
- package/lib/alert/alert.js +0 -1
- package/lib/badge/badge.js +0 -1
- package/lib/breadcrumb/breadcrumb.js +0 -1
- package/lib/button/button.js +0 -1
- package/lib/card/card.js +0 -1
- package/lib/checkbox/checkbox.js +0 -1
- package/lib/code-diff/code-diff.js +0 -1
- package/lib/collapse/collapse.js +0 -1
- package/lib/date-picker/date-picker.js +0 -1
- package/lib/dialog/dialog.js +0 -1
- package/lib/directives/directives.js +0 -2
- package/lib/form/form.js +0 -1
- package/lib/input/input.js +0 -1
- package/lib/loading/loading.js +0 -1
- package/lib/menu/menu.js +0 -1
- package/lib/modal/modal.js +0 -1
- package/lib/navigation/navigation.js +0 -1
- package/lib/notify/notify.js +0 -1
- package/lib/pagination/pagination.js +0 -1
- package/lib/popover/popover.js +0 -1
- package/lib/process/process.js +0 -1
- package/lib/progress/progress.js +0 -1
- package/lib/radio/radio.js +0 -1
- package/lib/rate/rate.js +0 -1
- package/lib/resize-layout/resize-layout.js +0 -1
- package/lib/select/select.js +0 -1
- package/lib/shared/shared.js +0 -1
- package/lib/sideslider/sideslider.js +0 -1
- package/lib/slider/slider.js +0 -1
- package/lib/steps/steps.js +0 -1
- package/lib/swiper/swiper.js +0 -1
- package/lib/switcher/switcher.js +0 -1
- package/lib/tab/tab.js +0 -1
- package/lib/table/table.js +0 -1
- package/lib/tag/tag.js +0 -1
- package/lib/tag-input/tag-input.js +0 -1
- package/lib/transfer/transfer.js +0 -1
- package/lib/tree/tree.js +0 -1
- package/lib/virtual-render/virtual-render.js +0 -1
@@ -0,0 +1,28 @@
|
|
1
|
+
@import '../styles/themes/themes.less';
|
2
|
+
|
3
|
+
.@{bk-prefix}-head-cell-sort {
|
4
|
+
display: flex;
|
5
|
+
flex-direction: column;
|
6
|
+
margin-left: 4px;
|
7
|
+
font-size: 10px;
|
8
|
+
|
9
|
+
.sort-action {
|
10
|
+
display: flex;
|
11
|
+
width: 18px;
|
12
|
+
height: calc(var(--row-height)/2);
|
13
|
+
color: #c0c4cc;
|
14
|
+
cursor: pointer;
|
15
|
+
|
16
|
+
&.active {
|
17
|
+
color: #3a84ff;
|
18
|
+
}
|
19
|
+
|
20
|
+
&.sort-asc {
|
21
|
+
align-items: flex-end;
|
22
|
+
}
|
23
|
+
|
24
|
+
&.sort-desc {
|
25
|
+
align-items: flex-start;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
@@ -0,0 +1,116 @@
|
|
1
|
+
:root {
|
2
|
+
--bk-prefix: bk;
|
3
|
+
--popover-max-height: 216px;
|
4
|
+
--primary-color: #3a84ff;
|
5
|
+
--success-color: #2dcb56;
|
6
|
+
--warning-color: #ff9c01;
|
7
|
+
--danger-color: #ea3636;
|
8
|
+
--default-color: #63656e;
|
9
|
+
--gray-color: #979ba5;
|
10
|
+
--light-gray: #c4c6cc;
|
11
|
+
--white-color: white;
|
12
|
+
--disable-color: #dcdee5;
|
13
|
+
--font-size-base: 12px;
|
14
|
+
--font-size-medium: 14px;
|
15
|
+
--font-size-large: 16px;
|
16
|
+
--line-height-base: 16px;
|
17
|
+
--line-height-medium: 16px;
|
18
|
+
--line-height-large: 18px;
|
19
|
+
--component-size-small: 26px;
|
20
|
+
--component-size-base: 32px;
|
21
|
+
--component-size-large: 38px;
|
22
|
+
--border-width-base: 1px;
|
23
|
+
--border-style-base: solid;
|
24
|
+
--border-radius-base: 2px;
|
25
|
+
--input-disabled-bg: #fafbfd;
|
26
|
+
--input-disabled-border: var(--disable-color);
|
27
|
+
--input-height-base: var(--component-size-base);
|
28
|
+
--input-color: var(--default-color);
|
29
|
+
--input-bg: white;
|
30
|
+
--input-border-color: var(--light-gray);
|
31
|
+
--input-broder-radius: 3px;
|
32
|
+
--input-shadow-color: #a3c5fd;
|
33
|
+
--input-horizontal-padding: 10px;
|
34
|
+
--input-block-color: #f4f6fa;
|
35
|
+
--input-icon-size: var(--font-size-large);
|
36
|
+
--input-maxlength-color: #979ba5;
|
37
|
+
--button-primary-hover-color: #5594fa;
|
38
|
+
--button-danger-hover-color: #ff5656;
|
39
|
+
--button-success-hover-color: #45e35f;
|
40
|
+
--button-warning-hover-color: #ffb848;
|
41
|
+
--button-default-hover-border-color: #979ba5;
|
42
|
+
--button-primary-active-color: #2c77f4;
|
43
|
+
--button-danger-active-color: #db2626;
|
44
|
+
--button-success-active-color: #1ab943;
|
45
|
+
--button-warning-active-color: #eb9000;
|
46
|
+
--fixed-navbar-background: #fff;
|
47
|
+
--fixed-navbar-boxshadow-color: rgba(0, 0, 0, 0.1);
|
48
|
+
--switch-default-color: #fff;
|
49
|
+
--switch-grey-color: #c4c6cc;
|
50
|
+
--breadcrumb-black-color: #979ba5;
|
51
|
+
--breadcrumb-primary-hover-color: #0082ff;
|
52
|
+
--breadcrumb-fn-main-color: #63656e;
|
53
|
+
--link-default-hover-color: #979ba5;
|
54
|
+
--link-primary-hover-color: #699df4;
|
55
|
+
--link-success-hover-color: #45e35f;
|
56
|
+
--link-warning-hover-color: #ffb848;
|
57
|
+
--link-danger-hover-color: #ff5656;
|
58
|
+
--link-default-disabled-color: #dcdee5;
|
59
|
+
--link-primary-disabled-color: #a3c5fd;
|
60
|
+
--link-success-disabled-color: #94f5a4;
|
61
|
+
--link-warning-disabled-color: #ffd695;
|
62
|
+
--link-danger-disabled-color: #fd9c9c;
|
63
|
+
--message-color: var(--default-color);
|
64
|
+
--message-primary-bg-color: #f0f8ff;
|
65
|
+
--message-primary-border-color: #e1ecff;
|
66
|
+
--message-warning-bg-color: #fff4e2;
|
67
|
+
--message-warning-border-color: #ffe8c3;
|
68
|
+
--message-success-bg-color: #f2fff4;
|
69
|
+
--message-success-border-color: #dcffe2;
|
70
|
+
--message-danger-bg-color: #ffeded;
|
71
|
+
--message-danger-border-color: #ffdddd;
|
72
|
+
--slider-default-bg: #dcdee5;
|
73
|
+
--slider-disable-bar-bg: #979ba5;
|
74
|
+
--menu-bg-color: #182132;
|
75
|
+
--submenu-bg-color: #151d2c;
|
76
|
+
--menu-active-bg-color: linear-gradient(90deg, #3f87ff 0%, #3a84ff 100%);
|
77
|
+
--menu-color: #96a2b9;
|
78
|
+
--menu-group-color: var(--default-color);
|
79
|
+
--menu-width: 260px;
|
80
|
+
--menu-collapse-width: 60px;
|
81
|
+
--menu-active-color: white;
|
82
|
+
--nav-header-bg-color: #182132;
|
83
|
+
--nav-bg-color: #182132;
|
84
|
+
--date-picker-disabled-bg: #fafbfd;
|
85
|
+
--date-picker-dropdown-mb: 4px;
|
86
|
+
--date-picker-dropdown-bg: #fff;
|
87
|
+
--table-bg-color: var(--white-color);
|
88
|
+
--table-border-color: #dcdee5;
|
89
|
+
--table-head-bg-color: #fafbfd;
|
90
|
+
--table-head-font-color: #313238;
|
91
|
+
--table-body-font-color: #575961;
|
92
|
+
--table-row-hover-bg-color: #f5f7fa;
|
93
|
+
--table-row-active-bg-color: #f0f1f5;
|
94
|
+
}
|
95
|
+
.bk-head-cell-sort {
|
96
|
+
display: flex;
|
97
|
+
flex-direction: column;
|
98
|
+
margin-left: 4px;
|
99
|
+
font-size: 10px;
|
100
|
+
}
|
101
|
+
.bk-head-cell-sort .sort-action {
|
102
|
+
display: flex;
|
103
|
+
width: 18px;
|
104
|
+
height: calc(var(--row-height)/2);
|
105
|
+
color: #c0c4cc;
|
106
|
+
cursor: pointer;
|
107
|
+
}
|
108
|
+
.bk-head-cell-sort .sort-action.active {
|
109
|
+
color: #3a84ff;
|
110
|
+
}
|
111
|
+
.bk-head-cell-sort .sort-action.sort-asc {
|
112
|
+
align-items: flex-end;
|
113
|
+
}
|
114
|
+
.bk-head-cell-sort .sort-action.sort-desc {
|
115
|
+
align-items: flex-start;
|
116
|
+
}
|
package/lib/table/props.d.ts
CHANGED
@@ -3,6 +3,10 @@ export declare enum SortScope {
|
|
3
3
|
CURRENT = "current",
|
4
4
|
ALL = "all"
|
5
5
|
}
|
6
|
+
export declare type ColumnFilterListItem = {
|
7
|
+
text?: string;
|
8
|
+
value?: string;
|
9
|
+
};
|
6
10
|
export declare const tableProps: {
|
7
11
|
/**
|
8
12
|
* 渲染列表
|
@@ -112,10 +116,13 @@ export declare type Column = {
|
|
112
116
|
width?: number | string;
|
113
117
|
type?: string;
|
114
118
|
sort?: {
|
115
|
-
sortby?: string;
|
116
119
|
sortFn?: Function;
|
117
120
|
sortScope?: string;
|
118
121
|
} | boolean;
|
122
|
+
filter?: {
|
123
|
+
list?: any;
|
124
|
+
filterFn?: Function;
|
125
|
+
} | boolean;
|
119
126
|
};
|
120
127
|
export declare type Thead = {
|
121
128
|
height?: Number;
|
package/lib/table/render.d.ts
CHANGED
@@ -2,12 +2,8 @@ import { TablePlugins } from './plugins/index';
|
|
2
2
|
import { GroupColumn, IColumnActive, IReactiveProp, TablePropTypes } from './props';
|
3
3
|
export declare const enum EVENTS {
|
4
4
|
/** 点击排序事件 */
|
5
|
-
ON_SORT_BY_CLICK = "onSortByClick"
|
6
|
-
|
7
|
-
/** 排序方式 */
|
8
|
-
export declare const enum SortType {
|
9
|
-
ASC = "asc",
|
10
|
-
DESC = "desc"
|
5
|
+
ON_SORT_BY_CLICK = "onSortByClick",
|
6
|
+
ON_FILTER_CLICK = "onFilterClick"
|
11
7
|
}
|
12
8
|
export default class TableRender {
|
13
9
|
props: TablePropTypes;
|
@@ -58,6 +54,14 @@ export default class TableRender {
|
|
58
54
|
* @param index 当前选中列Index
|
59
55
|
*/
|
60
56
|
private handleColumnHeadClick;
|
57
|
+
/**
|
58
|
+
* 获取排序设置表头
|
59
|
+
* @param column 当前渲染排序列
|
60
|
+
* @param index 排序列所在index
|
61
|
+
* @returns
|
62
|
+
*/
|
63
|
+
private getSortCell;
|
64
|
+
private getFilterCell;
|
61
65
|
/**
|
62
66
|
* 渲染Table Header
|
63
67
|
* @returns
|
@@ -85,15 +89,6 @@ export default class TableRender {
|
|
85
89
|
* @param rows
|
86
90
|
*/
|
87
91
|
private handleRowDblClick;
|
88
|
-
/**
|
89
|
-
* 获取当前行指定列的内容
|
90
|
-
* @param row 当前行
|
91
|
-
* @param key 指定列名
|
92
|
-
* @param column 列配置
|
93
|
-
* @param index 当前行Index
|
94
|
-
* @returns
|
95
|
-
*/
|
96
|
-
private getRowText;
|
97
92
|
/**
|
98
93
|
* 渲染表格Cell内容
|
99
94
|
* @param row 当前行
|
package/lib/table/table.css
CHANGED
@@ -1,3 +1,93 @@
|
|
1
|
+
.bk-table-head-action {
|
2
|
+
display: flex;
|
3
|
+
width: 32px;
|
4
|
+
height: var(--row-height);
|
5
|
+
margin-left: 4px;
|
6
|
+
font-size: 12px;
|
7
|
+
color: #c4c6cc;
|
8
|
+
cursor: pointer;
|
9
|
+
align-items: center;
|
10
|
+
}
|
11
|
+
.bk-table-head-action.active {
|
12
|
+
color: #3a84ff;
|
13
|
+
}
|
14
|
+
.bk-table-head-action.opened {
|
15
|
+
color: inherit;
|
16
|
+
}
|
17
|
+
.bk-table-head-filter {
|
18
|
+
padding: 5px 0 0 0;
|
19
|
+
background-color: #fff;
|
20
|
+
border-radius: 2px;
|
21
|
+
box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.1);
|
22
|
+
}
|
23
|
+
.bk-table-head-filter .content-list {
|
24
|
+
max-width: 200px;
|
25
|
+
min-width: 140px;
|
26
|
+
overflow: auto;
|
27
|
+
}
|
28
|
+
.bk-table-head-filter .content-list .list-item {
|
29
|
+
width: 100%;
|
30
|
+
height: 32px;
|
31
|
+
padding: 0 10px;
|
32
|
+
font-size: 12px;
|
33
|
+
line-height: 32px;
|
34
|
+
color: #63656e;
|
35
|
+
text-align: left;
|
36
|
+
}
|
37
|
+
.bk-table-head-filter .content-list .list-item:hover {
|
38
|
+
background: #f0f1f5;
|
39
|
+
}
|
40
|
+
.bk-table-head-filter .content-footer {
|
41
|
+
display: flex;
|
42
|
+
height: 42px;
|
43
|
+
padding: 0 10px;
|
44
|
+
border-top: solid 1px #dcdee5;
|
45
|
+
justify-content: center;
|
46
|
+
align-items: center;
|
47
|
+
}
|
48
|
+
.bk-table-head-filter .content-footer span {
|
49
|
+
display: inline-flex;
|
50
|
+
height: 100%;
|
51
|
+
padding: 6px 12px;
|
52
|
+
font-size: 14px;
|
53
|
+
line-height: 22px;
|
54
|
+
color: #3a84ff;
|
55
|
+
cursor: pointer;
|
56
|
+
align-items: center;
|
57
|
+
}
|
58
|
+
.bk-table-head-filter .content-footer span.btn-filter-split {
|
59
|
+
width: 1px;
|
60
|
+
height: calc(100% - 12px);
|
61
|
+
padding: 6px 0;
|
62
|
+
cursor: default;
|
63
|
+
background: #f0f1f5;
|
64
|
+
}
|
65
|
+
.bk-table-head-filter .content-footer span.btn-filter-reset.disable {
|
66
|
+
color: #979ba5;
|
67
|
+
cursor: not-allowed;
|
68
|
+
}
|
69
|
+
.bk-head-cell-sort {
|
70
|
+
display: flex;
|
71
|
+
flex-direction: column;
|
72
|
+
margin-left: 4px;
|
73
|
+
font-size: 10px;
|
74
|
+
}
|
75
|
+
.bk-head-cell-sort .sort-action {
|
76
|
+
display: flex;
|
77
|
+
width: 18px;
|
78
|
+
height: calc(var(--row-height)/2);
|
79
|
+
color: #c0c4cc;
|
80
|
+
cursor: pointer;
|
81
|
+
}
|
82
|
+
.bk-head-cell-sort .sort-action.active {
|
83
|
+
color: #3a84ff;
|
84
|
+
}
|
85
|
+
.bk-head-cell-sort .sort-action.sort-asc {
|
86
|
+
align-items: flex-end;
|
87
|
+
}
|
88
|
+
.bk-head-cell-sort .sort-action.sort-desc {
|
89
|
+
align-items: flex-start;
|
90
|
+
}
|
1
91
|
.bk-table {
|
2
92
|
height: 100%;
|
3
93
|
overflow: hidden;
|
@@ -48,32 +138,10 @@
|
|
48
138
|
.bk-table .bk-table-body table thead th:hover {
|
49
139
|
background: #f0f1f5;
|
50
140
|
}
|
51
|
-
.bk-table .bk-table-head table
|
52
|
-
.bk-table .bk-table-body table
|
53
|
-
display:
|
54
|
-
|
55
|
-
margin-left: 4px;
|
56
|
-
font-size: 10px;
|
57
|
-
}
|
58
|
-
.bk-table .bk-table-head table thead th .head-cell-sort .sort-action,
|
59
|
-
.bk-table .bk-table-body table thead th .head-cell-sort .sort-action {
|
60
|
-
display: flex;
|
61
|
-
width: 18px;
|
62
|
-
height: calc(var(--row-height)/2);
|
63
|
-
color: #c0c4cc;
|
64
|
-
cursor: pointer;
|
65
|
-
}
|
66
|
-
.bk-table .bk-table-head table thead th .head-cell-sort .sort-action.active,
|
67
|
-
.bk-table .bk-table-body table thead th .head-cell-sort .sort-action.active {
|
68
|
-
color: #3a84ff;
|
69
|
-
}
|
70
|
-
.bk-table .bk-table-head table thead th .head-cell-sort .sort-action.sort-asc,
|
71
|
-
.bk-table .bk-table-body table thead th .head-cell-sort .sort-action.sort-asc {
|
72
|
-
align-items: flex-end;
|
73
|
-
}
|
74
|
-
.bk-table .bk-table-head table thead th .head-cell-sort .sort-action.sort-desc,
|
75
|
-
.bk-table .bk-table-body table thead th .head-cell-sort .sort-action.sort-desc {
|
76
|
-
align-items: flex-start;
|
141
|
+
.bk-table .bk-table-head table tbody tr td .cell,
|
142
|
+
.bk-table .bk-table-body table tbody tr td .cell {
|
143
|
+
display: inline-block;
|
144
|
+
width: 100%;
|
77
145
|
}
|
78
146
|
.bk-table .bk-table-head table tbody tr:hover td,
|
79
147
|
.bk-table .bk-table-body table tbody tr:hover td {
|
package/lib/table/table.less
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
@import '../styles/themes/themes.less';
|
2
|
-
|
2
|
+
@import './plugins/head-filter.less';
|
3
|
+
@import './plugins/head-sort.less';
|
3
4
|
.@{bk-prefix}-table {
|
4
5
|
height: 100%;
|
5
6
|
overflow: hidden;
|
@@ -44,38 +45,18 @@
|
|
44
45
|
&:hover {
|
45
46
|
background: @table-row-active-bg-color;
|
46
47
|
}
|
47
|
-
|
48
|
-
.head-cell-sort {
|
49
|
-
display: flex;
|
50
|
-
flex-direction: column;
|
51
|
-
margin-left: 4px;
|
52
|
-
font-size: 10px;
|
53
|
-
|
54
|
-
.sort-action {
|
55
|
-
display: flex;
|
56
|
-
width: 18px;
|
57
|
-
height: calc(var(--row-height)/2);
|
58
|
-
color: #c0c4cc;
|
59
|
-
cursor: pointer;
|
60
|
-
|
61
|
-
&.active {
|
62
|
-
color: #3a84ff;
|
63
|
-
}
|
64
|
-
|
65
|
-
&.sort-asc {
|
66
|
-
align-items: flex-end;
|
67
|
-
}
|
68
|
-
|
69
|
-
&.sort-desc {
|
70
|
-
align-items: flex-start;
|
71
|
-
}
|
72
|
-
}
|
73
|
-
}
|
74
48
|
}
|
75
49
|
}
|
76
50
|
|
77
51
|
tbody {
|
78
52
|
tr {
|
53
|
+
td {
|
54
|
+
.cell {
|
55
|
+
display: inline-block;
|
56
|
+
width: 100%;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
79
60
|
&:hover {
|
80
61
|
td {
|
81
62
|
background: @table-row-hover-bg-color;
|
@@ -92,18 +92,108 @@
|
|
92
92
|
--table-row-hover-bg-color: #f5f7fa;
|
93
93
|
--table-row-active-bg-color: #f0f1f5;
|
94
94
|
}
|
95
|
+
.bk-table-head-action {
|
96
|
+
display: flex;
|
97
|
+
width: 32px;
|
98
|
+
height: var(--row-height);
|
99
|
+
margin-left: 4px;
|
100
|
+
font-size: 12px;
|
101
|
+
color: #c4c6cc;
|
102
|
+
cursor: pointer;
|
103
|
+
align-items: center;
|
104
|
+
}
|
105
|
+
.bk-table-head-action.active {
|
106
|
+
color: #3a84ff;
|
107
|
+
}
|
108
|
+
.bk-table-head-action.opened {
|
109
|
+
color: inherit;
|
110
|
+
}
|
111
|
+
.bk-table-head-filter {
|
112
|
+
padding: 5px 0 0 0;
|
113
|
+
background-color: #fff;
|
114
|
+
border-radius: 2px;
|
115
|
+
box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.1);
|
116
|
+
}
|
117
|
+
.bk-table-head-filter .content-list {
|
118
|
+
max-width: 200px;
|
119
|
+
min-width: 140px;
|
120
|
+
overflow: auto;
|
121
|
+
}
|
122
|
+
.bk-table-head-filter .content-list .list-item {
|
123
|
+
width: 100%;
|
124
|
+
height: 32px;
|
125
|
+
padding: 0 10px;
|
126
|
+
font-size: 12px;
|
127
|
+
line-height: 32px;
|
128
|
+
color: #63656e;
|
129
|
+
text-align: left;
|
130
|
+
}
|
131
|
+
.bk-table-head-filter .content-list .list-item:hover {
|
132
|
+
background: #f0f1f5;
|
133
|
+
}
|
134
|
+
.bk-table-head-filter .content-footer {
|
135
|
+
display: flex;
|
136
|
+
height: 42px;
|
137
|
+
padding: 0 10px;
|
138
|
+
border-top: solid 1px #dcdee5;
|
139
|
+
justify-content: center;
|
140
|
+
align-items: center;
|
141
|
+
}
|
142
|
+
.bk-table-head-filter .content-footer span {
|
143
|
+
display: inline-flex;
|
144
|
+
height: 100%;
|
145
|
+
padding: 6px 12px;
|
146
|
+
font-size: 14px;
|
147
|
+
line-height: 22px;
|
148
|
+
color: #3a84ff;
|
149
|
+
cursor: pointer;
|
150
|
+
align-items: center;
|
151
|
+
}
|
152
|
+
.bk-table-head-filter .content-footer span.btn-filter-split {
|
153
|
+
width: 1px;
|
154
|
+
height: calc(100% - 12px);
|
155
|
+
padding: 6px 0;
|
156
|
+
cursor: default;
|
157
|
+
background: #f0f1f5;
|
158
|
+
}
|
159
|
+
.bk-table-head-filter .content-footer span.btn-filter-reset.disable {
|
160
|
+
color: #979ba5;
|
161
|
+
cursor: not-allowed;
|
162
|
+
}
|
163
|
+
.bk-head-cell-sort {
|
164
|
+
display: flex;
|
165
|
+
flex-direction: column;
|
166
|
+
margin-left: 4px;
|
167
|
+
font-size: 10px;
|
168
|
+
}
|
169
|
+
.bk-head-cell-sort .sort-action {
|
170
|
+
display: flex;
|
171
|
+
width: 18px;
|
172
|
+
height: calc(var(--row-height)/2);
|
173
|
+
color: #c0c4cc;
|
174
|
+
cursor: pointer;
|
175
|
+
}
|
176
|
+
.bk-head-cell-sort .sort-action.active {
|
177
|
+
color: #3a84ff;
|
178
|
+
}
|
179
|
+
.bk-head-cell-sort .sort-action.sort-asc {
|
180
|
+
align-items: flex-end;
|
181
|
+
}
|
182
|
+
.bk-head-cell-sort .sort-action.sort-desc {
|
183
|
+
align-items: flex-start;
|
184
|
+
}
|
95
185
|
.bk-table {
|
96
186
|
height: 100%;
|
97
187
|
overflow: hidden;
|
98
|
-
border-top: 1px solid
|
99
|
-
border-bottom: 1px solid
|
188
|
+
border-top: 1px solid #dcdee5;
|
189
|
+
border-bottom: 1px solid #dcdee5;
|
100
190
|
}
|
101
191
|
.bk-table .bk-table-body {
|
102
192
|
overflow: auto;
|
103
193
|
}
|
104
194
|
.bk-table .bk-table-head,
|
105
195
|
.bk-table .bk-table-body {
|
106
|
-
background:
|
196
|
+
background: white;
|
107
197
|
}
|
108
198
|
.bk-table .bk-table-head table,
|
109
199
|
.bk-table .bk-table-body table {
|
@@ -126,67 +216,45 @@
|
|
126
216
|
padding: 0 15px;
|
127
217
|
overflow: hidden;
|
128
218
|
line-height: var(--row-height);
|
129
|
-
color:
|
219
|
+
color: #575961;
|
130
220
|
text-align: left;
|
131
221
|
text-overflow: ellipsis;
|
132
222
|
white-space: nowrap;
|
133
223
|
}
|
134
224
|
.bk-table .bk-table-head table thead th,
|
135
225
|
.bk-table .bk-table-body table thead th {
|
136
|
-
color:
|
137
|
-
background-color:
|
226
|
+
color: #313238;
|
227
|
+
background-color: #fafbfd;
|
138
228
|
}
|
139
229
|
.bk-table .bk-table-head table thead th.active,
|
140
230
|
.bk-table .bk-table-body table thead th.active,
|
141
231
|
.bk-table .bk-table-head table thead th:hover,
|
142
232
|
.bk-table .bk-table-body table thead th:hover {
|
143
|
-
background:
|
233
|
+
background: #f0f1f5;
|
144
234
|
}
|
145
|
-
.bk-table .bk-table-head table
|
146
|
-
.bk-table .bk-table-body table
|
147
|
-
display:
|
148
|
-
|
149
|
-
margin-left: 4px;
|
150
|
-
font-size: 10px;
|
151
|
-
}
|
152
|
-
.bk-table .bk-table-head table thead th .head-cell-sort .sort-action,
|
153
|
-
.bk-table .bk-table-body table thead th .head-cell-sort .sort-action {
|
154
|
-
display: flex;
|
155
|
-
width: 18px;
|
156
|
-
height: calc(var(--row-height)/2);
|
157
|
-
color: #c0c4cc;
|
158
|
-
cursor: pointer;
|
159
|
-
}
|
160
|
-
.bk-table .bk-table-head table thead th .head-cell-sort .sort-action.active,
|
161
|
-
.bk-table .bk-table-body table thead th .head-cell-sort .sort-action.active {
|
162
|
-
color: #3a84ff;
|
163
|
-
}
|
164
|
-
.bk-table .bk-table-head table thead th .head-cell-sort .sort-action.sort-asc,
|
165
|
-
.bk-table .bk-table-body table thead th .head-cell-sort .sort-action.sort-asc {
|
166
|
-
align-items: flex-end;
|
167
|
-
}
|
168
|
-
.bk-table .bk-table-head table thead th .head-cell-sort .sort-action.sort-desc,
|
169
|
-
.bk-table .bk-table-body table thead th .head-cell-sort .sort-action.sort-desc {
|
170
|
-
align-items: flex-start;
|
235
|
+
.bk-table .bk-table-head table tbody tr td .cell,
|
236
|
+
.bk-table .bk-table-body table tbody tr td .cell {
|
237
|
+
display: inline-block;
|
238
|
+
width: 100%;
|
171
239
|
}
|
172
240
|
.bk-table .bk-table-head table tbody tr:hover td,
|
173
241
|
.bk-table .bk-table-body table tbody tr:hover td {
|
174
|
-
background:
|
242
|
+
background: #f5f7fa;
|
175
243
|
}
|
176
244
|
.bk-table .bk-table-footer {
|
177
245
|
line-height: 40px;
|
178
246
|
}
|
179
247
|
.bk-table.bordered-row td,
|
180
248
|
.bk-table.bordered-row th {
|
181
|
-
border-bottom: 1px solid
|
249
|
+
border-bottom: 1px solid #dcdee5;
|
182
250
|
}
|
183
251
|
.bk-table.bordered-outer {
|
184
|
-
border-right: 1px solid
|
185
|
-
border-left: 1px solid
|
252
|
+
border-right: 1px solid #dcdee5;
|
253
|
+
border-left: 1px solid #dcdee5;
|
186
254
|
}
|
187
255
|
.bk-table.bordered-col th,
|
188
256
|
.bk-table.bordered-col td {
|
189
|
-
border-right: 1px solid
|
257
|
+
border-right: 1px solid #dcdee5;
|
190
258
|
}
|
191
259
|
.bk-table.bordered-col th:last-child,
|
192
260
|
.bk-table.bordered-col td:last-child {
|
@@ -203,9 +271,9 @@
|
|
203
271
|
width: 100%;
|
204
272
|
}
|
205
273
|
.bk-table colgroup col {
|
206
|
-
background:
|
274
|
+
background: white;
|
207
275
|
}
|
208
276
|
.bk-table colgroup col.active {
|
209
277
|
position: relative;
|
210
|
-
background:
|
278
|
+
background: #f0f1f5;
|
211
279
|
}
|
package/lib/table/utils.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { GroupColumn, TablePropTypes } from './props';
|
1
|
+
import { Column, GroupColumn, TablePropTypes } from './props';
|
2
2
|
/**
|
3
3
|
* 解析Prop值 | 可能为多种类型 & 函数返回的场景
|
4
4
|
* @param prop 当前Prop
|
@@ -80,3 +80,12 @@ export declare const resolveHeadConfig: (props: TablePropTypes) => {
|
|
80
80
|
isShow?: boolean;
|
81
81
|
cellFn?: Function;
|
82
82
|
};
|
83
|
+
/**
|
84
|
+
* 获取当前行指定列的内容
|
85
|
+
* @param row 当前行
|
86
|
+
* @param key 指定列名
|
87
|
+
* @param column 列配置
|
88
|
+
* @param index 当前行Index
|
89
|
+
* @returns
|
90
|
+
*/
|
91
|
+
export declare const getRowText: (row: any, key: string, column: Column) => any;
|
package/lib/tag/index.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("../icon"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../icon"],t);else{var o="object"==typeof exports?t(require("../shared"),require("vue"),require("../icon")):t(e["../shared"],e.vue,e["../icon"]);for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(self,((e,t,o)=>(()=>{"use strict";var r={6870:e=>{e.exports=o},4212:t=>{t.exports=e},748:e=>{e.exports=t}},s={};function n(e){var t=s[e];if(void 0!==t)return t.exports;var o=s[e]={exports:{}};return r[e](o,o.exports,n),o.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{n.r(a),n.d(a,{default:()=>c});var e=n(4212);function t(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var o=n(748),r=n(6870);const s=(0,o.defineComponent)({name:"Tag",props:{theme:e.PropTypes.theme(["success","info","warning","danger"]).def(""),closable:e.PropTypes.bool.def(!1),type:e.PropTypes.commonType(["","filled","stroke"]).def(""),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:["icon"],setup:function(r,s){var n=s.emit;return{wrapperCls:(0,o.computed)((function(){var o;return(0,e.classes)((t(o={"bk-tag-closable":r.closable,"bk-tag-checkable":r.checkable,"bk-tag-check":r.checked},"bk-tag-".concat(r.type),r.type),t(o,"bk-tag-".concat(r.theme),r.theme),t(o,r.extCls,!!r.extCls),o),"bk-tag")})),wrapperStyle:(0,o.computed)((function(){return{borderRadius:r.radius}})),handleClose:function(e){e.preventDefault(),e.stopPropagation(),n("close",e)},handleClick:function(e){e.preventDefault(),e.stopPropagation(),r.checkable&&n("change",!r.checked)}}},render:function(){var e,t;return(0,o.createVNode)("div",{class:this.wrapperCls,style:this.wrapperStyle,onClick:this.handleClick},[this.$slots.icon?(0,o.createVNode)("span",{class:"bk-tag-icon"},[this.$slots.icon()]):"",(0,o.createVNode)("span",{class:"bk-tag-text"},[null===(t=(e=this.$slots).default)||void 0===t?void 0:t.call(e)]),this.closable?(0,o.createVNode)(r.Error,{class:"bk-tag-close",onClick:this.handleClose},null):""])}}),c=(0,e.withInstall)(s)})(),a})()));
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("vue"),require("../directives"),require("../icon"),require("../loading"),require("../popover"),require("../shared"));else if("function"==typeof define&&define.amd)define(["vue","../directives","../icon","../loading","../popover","../shared"],t);else{var r="object"==typeof exports?t(require("vue"),require("../directives"),require("../icon"),require("../loading"),require("../popover"),require("../shared")):t(e.vue,e["../directives"],e["../icon"],e["../loading"],e["../popover"],e["../shared"]);for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(self,((e,t,r,a,n,o)=>(()=>{"use strict";var i={4061:e=>{e.exports=t},6870:e=>{e.exports=r},4870:e=>{e.exports=a},5537:e=>{e.exports=n},4212:e=>{e.exports=o},748:t=>{t.exports=e}},l={};function s(e){var t=l[e];if(void 0!==t)return t.exports;var r=l[e]={exports:{}};return i[e](r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};return(()=>{function e(t){return e="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},e(t)}function t(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 r(e,r){if(e){if("string"==typeof e)return t(e,r);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)?t(e,r):void 0}}function a(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 t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||r(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.")}()}s.r(u),s.d(u,{default:()=>b});var o=s(748),i=s(4061),l=s(6870),c=s(4870),d=s.n(c),p=s(5537),f=s.n(p),g=12,v=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},h=s(4212);const y=(0,o.defineComponent)({name:"ListTagRender",props:{node:h.PropTypes.object,searchKey:h.PropTypes.oneOfType([h.PropTypes.string,h.PropTypes.arrayOf(h.PropTypes.string)]),displayKey:h.PropTypes.string,searchKeyword:h.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,o.h,this);var r=this.node[this.displayKey];return(0,o.createVNode)("div",{class:"bk-selector-node"},[(0,o.createVNode)("span",{class:"text",innerHTML:t(r)},[r])])}}),m=(0,o.defineComponent)({name:"TagRender",props:{node:h.PropTypes.object,displayKey:h.PropTypes.string,tpl:{type:Function,default:null}},render:function(){return this.tpl?this.tpl(this.node,o.h,this):(0,o.createVNode)("div",{class:"tag"},[(0,o.createVNode)("span",{class:"text"},[this.node[this.displayKey]])])}}),T=(0,o.defineComponent)({name:"BkTagInput",directives:{bkTooltips:i.bkTooltips},props:{modelValue:h.PropTypes.arrayOf(h.PropTypes.string).def([]),placeholder:h.PropTypes.string.def("请输入并按 Enter 结束"),list:h.PropTypes.arrayOf(h.PropTypes.object).def([]),disabled:h.PropTypes.bool.def(!1),tooltipKey:h.PropTypes.string.def(""),saveKey:h.PropTypes.string.def("id"),displayKey:h.PropTypes.string.def("name"),hasDeleteIcon:h.PropTypes.bool.def(!1),clearable:h.PropTypes.bool.def(!0),trigger:h.PropTypes.commonType(["focus","search"]).def("search"),searchKey:h.PropTypes.oneOfType([h.PropTypes.string,h.PropTypes.arrayOf(h.PropTypes.string)]).def("name"),useGroup:h.PropTypes.bool.def(!1),allowCreate:h.PropTypes.bool.def(!1),maxData:h.PropTypes.number.def(-1),maxResult:h.PropTypes.number.def(10),contentMaxHeight:h.PropTypes.number.def(300),contentWidth:h.PropTypes.number.def(190),separator:h.PropTypes.string.def(""),allowNextFocus:h.PropTypes.bool.def(!0),allowAutoMatch:h.PropTypes.bool.def(!1),showClearOnlyHover:h.PropTypes.bool.def(!1),leftSpace:h.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(t,i){var l=i.emit,s=(0,o.reactive)({isEdit:!1,isHover:!1,focusItemIndex:t.allowCreate?-1:0}),u=(0,o.reactive)({isShow:!1,width:190,modifiers:[{name:"offset",options:{offset:[0,4]}}]}),c=function(e){var t=(0,o.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 i=0;i<t.totalSize;i+=t.pageSize)o.push(a.slice(i,i+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,o.toRefs)(t).maxResult),d=c.pageState,p=c.initPage,f=c.pageChange,h=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,a=e;return(0,o.customRef)((function(e,n){return{get:function(){return e(),a},set:function(e){clearTimeout(t),t=setTimeout((function(){a=e,n()}),r)}}}))}("",150),y=(0,o.ref)(null),m=(0,o.ref)(null),T=(0,o.ref)(null),b=(0,o.ref)(null),L=(0,o.ref)(null),w=(0,o.ref)(null),P=(0,o.ref)(null),x=(0,o.computed)((function(){return!t.disabled&&t.hasDeleteIcon})),I=(0,o.computed)((function(){return 1===t.maxData})),S=(0,o.computed)((function(){return 0===R.selectedTagList.length&&""===h.value&&!s.isEdit})),C=(0,o.computed)((function(){return t.clearable&&!t.disabled&&0!==R.selectedTagList.length&&(!t.showClearOnlyHover||s.isHover)})),K=(0,o.computed)((function(){return{"bk-tag-input-trigger":!0,active:s.isEdit,disabled:t.disabled}}));(0,o.watch)([function(){return n(t.modelValue)},function(){return n(t.list)}],(function(){D()})),(0,o.watch)(h,(function(e){var r=0!==d.curPageList.length;""!==e&&r||""===e&&"focus"===t.trigger?u.isShow=!0:"focus"===t.trigger&&r||(u.isShow=!1)})),(0,o.watch)((function(){return u.isShow}),(function(e){k(),e&&L.value&&((0,o.nextTick)((function(){L.value.scrollTop=0})),L.value.removeEventListener("scroll",V),L.value.addEventListener("scroll",V))}));var k=function(){var e,t,r=I.value?0:null===(e=b.value)||void 0===e?void 0:e.offsetLeft;u.modifiers=[{name:"offset",options:{offset:[r,4]}}],null===(t=w.value)||void 0===t||t.update()},V=function(){if(!d.isPageLoading&&0!==L.value.scrollTop){var e=L.value;if(e.scrollTop+e.offsetHeight>=e.scrollHeight){var t=d.curPage+1;t<=d.totalPage&&(d.isPageLoading=!0,setTimeout((function(){f(t)}),500))}}},N=function(){var e;return Array.from((null===(e=T.value)||void 0===e?void 0:e.childNodes)||[]).filter((function(e){return e.nodeType!==Node.TEXT_NODE}))},A=function(e){if(!t.disabled){if(null==e?void 0:e.target){var r=e.target.className;(r.indexOf("bk-tag-input-trigger")>-1||r.indexOf("tag-list")>-1)&&T.value.appendChild(b.value)}clearTimeout(P.value),I.value&&O.value.length&&(R.tagListCache=n(O.value),R.selectedTagListCache=n(R.selectedTagList),h.value=R.selectedTagListCache[0][t.saveKey],W(R.selectedTagList[0],0),q()),s.isEdit=!0,(0,o.nextTick)((function(){var e;null===(e=y.value)||void 0===e||e.focus(),"focus"===t.trigger&&0!==R.localList.length&&(F(),u.isShow?k():u.isShow=!0)}))}},R=(0,o.reactive)({localList:[],tagListCache:[],selectedTagList:[],selectedTagListCache:[]}),O=(0,o.computed)((function(){return R.selectedTagList.map((function(e){return e[t.saveKey]}))})),j=function(e){var t=(0,o.toRefs)(e),r=t.useGroup,a=t.saveKey,i=t.displayKey,l=t.list,s=(0,o.reactive)([]);return(0,o.watch)([r,a,i,l],(function(){var e=l.value;r.value&&(e=l.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[i.value]}},e)}))),e.concat(r)}),[])),s.splice.apply(s,[0,s.length].concat(n(e)))}),{immediate:!0,deep:!0}),s}(t),E=(0,o.computed)((function(){if(t.useGroup){var e={};return d.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 d.curPageList})),D=function(){var e=t.saveKey,r=t.modelValue,o=t.displayKey,i=t.allowCreate,l=t.trigger;R.selectedTagList=[],R.localList=n(j),r.length&&(r.forEach((function(t){var r=R.localList.find((function(r){return t===r[e]}));if(void 0!==r)R.selectedTagList.push(r);else if(i&&!O.value.includes(t)){var n;R.selectedTagList.push((a(n={},e,t),a(n,o,t),n))}})),I.value||(R.localList=R.localList.filter((function(t){return!r.includes(t[e])})))),"focus"===l&&F()},F=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=t.searchKey,a=t.filterCallback,n=e.toLowerCase(),o=[];if("function"==typeof a)o=a(n,r,R.localList)||[];else if(Array.isArray(r)){var i=r.map((function(e){return R.localList.filter((function(t){return-1!==t[e].toLowerCase().indexOf(n)}))}));o=Array.from(new Set(i.flat()))}else o=R.localList.filter((function(e){return-1!==e[r].toLowerCase().indexOf(n)}));p(o)};(0,o.onMounted)((function(){D()}));var z=function(){h.value=""},_=function(){if(I.value)return 0;var e=N().findIndex((function(e){return"tagInputItem"===e.id}));return e>=0?e:0},M=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t&&e){var a=t;r&&(a=t.nextElementSibling||null),t.parentNode.insertBefore(e,a)}},q=function(e){var r=t.maxData,a=t.trigger,n=t.allowCreate;if(-1===r||r>O.value.length){var o=((null==e?void 0:e.target)?e.target:h).value,i=v(o);i?(F(o),y.value.style.width="".concat(i*g,"px")):"focus"===a&&F()}else H(),h.value="",u.isShow=!1;s.isEdit=!0,s.focusItemIndex=n?-1:0},H=function(){P.value=setTimeout((function(){var e,a,n=h.value;if(z(),s.isEdit=!1,I.value){var o=(e=R.tagListCache,a=1,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a,n,o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(a=r.next()).done)&&(o.push(a.value),!t||o.length!==t);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}(e,a)||r(e,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];n&&n===o&&R.selectedTagListCache.length?U(R.selectedTagListCache[0],"select"):G("remove")}else if(t.allowAutoMatch&&n){var i=d.curPageList.find((function(e){return Array.isArray(t.searchKey)?t.searchKey.map((function(t){return e[t]})).includes(n):e[t.searchKey]===n}));i?B(i,"select"):t.allowCreate&&B(n,"custom")}u.isShow=!1,l("blur",n,O.value)}),50)},B=function(e,t,r){null==r||r.stopPropagation(),e&&!e.disabled&&(I.value&&(R.tagListCache=[],R.selectedTagListCache=[],R.selectedTagList=[]),U(e,t),G("select"),z(),u.isShow=!1)},G=function(e){l("change",O.value),l(e),l("update:modelValue",O.value)},Z=function(){var e=L.value.clientHeight,t=L.value.getBoundingClientRect().y;(0,o.nextTick)((function(){var r=L.value.querySelector(".bk-selector-actived");if(r){var a=r.clientHeight,n=r.getBoundingClientRect().y;n<t&&(L.value.scrollTop=L.value.scrollTop-(t-n));var o=n+a-t;o>e&&(L.value.scrollTop=L.value.scrollTop+o-e)}}))},U=function(r,i){if(!(R.selectedTagList.length>=t.maxData&&-1!==t.maxData)){var l,s=t.separator,u=t.saveKey,c=t.displayKey,d=t.createTagValidator,p=_(),f=1,v=!1,h=function(e){return"function"!=typeof d||d(e)},m=function(e){return R.localList.find((function(t){return t[u]===e}))};if("custom"===i)if(s){var T,L=r.split(s),w=(L=L.filter((function(e){return(null==e?void 0:e.trim())&&!O.value.includes(e)&&h(e)}))).map((function(e){var t;return m(e)||(a(t={},u,e),a(t,c,e),t)}));L.length&&((T=R.selectedTagList).splice.apply(T,[p,0].concat(n(w))),f=w.length,v=!0)}else{var P="object"===e(r);if(void 0!==(l=(l=P?r[u]:r.trim()).replace(/\s+/g,""))&&!O.value.includes(l)&&h(l)){var x,S=m(l)||(P?r:(a(x={},u,l),a(x,c,l),x));R.selectedTagList.splice(p,0,S),v=!0}}else r&&(void 0===(l=r[u])||O.value.includes(l)||(R.selectedTagList.splice(p,0,r),v=!0));v&&(0,o.nextTick)((function(){for(var e=1;e<=f;e++){var r=N()[p+e];M(r,b.value)}y.value.style.width="".concat(g,"px"),I.value||(t.allowNextFocus&&A(),R.localList=R.localList.filter((function(e){return!O.value.includes(e[u])})))}))}},W=function(e,r){R.selectedTagList.splice(r,1);var a=j.some((function(r){return r===e[t.saveKey]}));(t.allowCreate&&a||!t.allowCreate)&&!I.value&&R.localList.push(e)};return Object.assign(Object.assign(Object.assign(Object.assign({popoverProps:u},(0,o.toRefs)(s)),(0,o.toRefs)(R)),(0,o.toRefs)(d)),{isShowPlaceholder:S,isShowClear:C,curInputValue:h,formatList:j,renderList:E,showTagClose:x,tagInputRef:y,bkTagSelectorRef:m,tagListRef:T,tagInputItemRef:b,selectorListRef:L,popoverRef:w,triggerClass:K,focusInputTrigger:A,activeClass:function(e,r){var a={"bk-selector-actived":!1,"bk-selector-selected":O.value.includes(e[t.saveKey])};return t.useGroup?a["bk-selector-actived"]=e.__index__===s.focusItemIndex:a["bk-selector-actived"]=r===s.focusItemIndex,a},handleInput:q,handleFocus:function(){var e;u.width=I.value?null===(e=m.value)||void 0===e?void 0:e.clientWidth:t.contentWidth},handleBlur:H,handleTagSelected:B,handleTagRemove:function(e,t,r){null==r||r.stopPropagation(),W(e,t),z(),G("remove"),y.value.style.width="".concat(g,"px")},handleClear:function(e){e.stopPropagation();var r=R.selectedTagList;R.selectedTagList=[];var a,o=j.filter((function(e){return r.some((function(r){return r[t.saveKey]===e[t.saveKey]}))}));(!t.allowCreate||0===o.length)&&t.allowCreate||I.value||(a=R.localList).push.apply(a,n(o)),G("removeAll")},tagFocus:function(e){t.disabled||(M(b.value,e.currentTarget,!0),y.value.style.width="".concat(g,"px"),u.isShow&&k())},handleKeydown:function(e){if(!d.isPageLoading){var r=e.target.value,a=v(r),n=_(),o=N();switch(e.code){case"ArrowUp":if(e.preventDefault(),!u.isShow)return;s.focusItemIndex=s.focusItemIndex-1,s.focusItemIndex=s.focusItemIndex<0?-1:s.focusItemIndex,-1===s.focusItemIndex&&(s.focusItemIndex=d.curPageList.length-1),Z();break;case"ArrowDown":if(e.preventDefault(),!u.isShow)return;s.focusItemIndex=s.focusItemIndex+1,s.focusItemIndex=s.focusItemIndex>d.curPageList.length-1?d.curPageList.length:s.focusItemIndex,s.focusItemIndex===d.curPageList.length&&(s.focusItemIndex=0),Z();break;case"ArrowLeft":if(s.isEdit=!0,!a){if(n<1)return;M(b.value,o[n-1]),A()}break;case"ArrowRight":if(s.isEdit=!0,!a){if(n===o.length-1)return;M(o[n+1],b.value),A()}break;case"Enter":case"NumpadEnter":!t.allowCreate&&u.isShow||t.allowCreate&&s.focusItemIndex>=0&&u.isShow?B(d.curPageList[s.focusItemIndex],"select",e):t.allowCreate&&B(h.value,"custom",e),e.preventDefault();break;case"Backspace":0===n||h.value||function(e,r){var a=N();M(b.value,a[e-1]),R.selectedTagList.splice(e-1,1),A();var n=j.some((function(e){return e===r[t.saveKey]}));(t.allowCreate&&n||!t.allowCreate)&&!I.value&&R.localList.push(r),y.value="".concat(g,"px"),G("remove")}(n,R.selectedTagList[n-1])}}},handlePaste:function(e){if(e.preventDefault(),I.value)return!1;var r=t.maxData,o=t.saveKey,i=t.pasteFn,l=e.clipboardData.getData("text"),s=i?i(l):function(e){var r=[];return e.split(";").forEach((function(e){if(e.match(/^[a-zA-Z][a-zA-Z_]+/g)){var n,o=e.match(/^[a-zA-Z][a-zA-Z_]+/g).join("");r.push((a(n={},t.saveKey,o),a(n,t.displayKey,o),n))}})),r}(l),u=s.map((function(e){return e[o]}));if(u.length){var c=N(),d=_(),p=R.localList.map((function(e){return e[o]}));if(u=u.filter((function(e){return(null==e?void 0:e.trim())&&!O.value.includes(e)&&p.includes(e)})),-1!==r){var f=R.selectedTagList.length;if(f<r){var v=r-f;u.length>v&&(u=n(u.slice(0,v)))}else u=[]}var h,m=R.localList.filter((function(e){return u.includes(e[o])}));u.length&&((h=R.selectedTagList).splice.apply(h,[d,0].concat(n(m))),M(b.value,c[d]),y.value.style.width="".concat(g,"px"),R.localList=R.localList.filter((function(e){return!u.includes(e[o])})),G("select"),A())}}})},render:function(){var e=this;return(0,o.createVNode)("div",{class:"bk-tag-input",ref:"bkTagSelectorRef",onClick:this.focusInputTrigger,onMouseenter:function(){return e.isHover=!0},onMouseleave:function(){return e.isHover=!1}},[(0,o.createVNode)(f(),{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(){return(0,o.createVNode)("div",{class:e.triggerClass},[(0,o.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,o.withDirectives)((0,o.createVNode)("li",{class:"tag-item",onClick:e.tagFocus},[(0,o.createVNode)(m,{node:t,tpl:e.tagTpl,displayKey:e.displayKey},null),e.showTagClose?(0,o.createVNode)(l.Error,{class:"remove-tag",onClick:e.handleTagRemove.bind(e,t,r)},null):null]),[[(0,o.resolveDirective)("bk-tooltips"),a]])})),(0,o.withDirectives)((0,o.createVNode)("li",{ref:"tagInputItemRef",id:"tagInputItem",class:"tag-input-item",role:"input"},[(0,o.withDirectives)((0,o.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),[[o.vModelText,e.curInputValue]])]),[[o.vShow,e.isEdit]])]),(0,o.withDirectives)((0,o.createVNode)("p",{class:"placeholder"},[e.placeholder]),[[o.vShow,e.isShowPlaceholder]]),e.isShowClear?(0,o.createVNode)(l.Close,{class:"clear-icon",onClick:e.handleClear},null):null])},content:function(){return(0,o.createVNode)("div",{class:"bk-selector-list"},[(0,o.createVNode)("ul",{ref:"selectorListRef",style:{"max-height":"".concat(e.contentMaxHeight,"px")},class:"outside-ul"},[e.useGroup?e.renderList.map((function(t){return(0,o.createVNode)("li",{class:"bk-selector-group-item"},[(0,o.createVNode)("span",{class:"group-name"},[t.name,(0,o.createTextVNode)(" ("),t.children.length,(0,o.createTextVNode)(")")]),(0,o.createVNode)("ul",{class:"bk-selector-group-list-item"},[t.children.map((function(t,r){return(0,o.createVNode)("li",{class:["bk-selector-list-item",{disabled:t.disabled},e.activeClass(t,r)],onClick:e.handleTagSelected.bind(e,t,"select")},[(0,o.createVNode)(y,{node:t,displayKey:e.displayKey,tpl:e.tpl,searchKey:e.searchKey,searchKeyword:e.curInputValue},null)])}))])])})):e.renderList.map((function(t,r){return(0,o.createVNode)("li",{class:["bk-selector-list-item",{disabled:t.disabled},e.activeClass(t,r)],onClick:e.handleTagSelected.bind(e,t,"select")},[(0,o.createVNode)(y,{node:t,displayKey:e.displayKey,tpl:e.tpl,searchKey:e.searchKey,searchKeyword:e.curInputValue},null)])})),e.isPageLoading?(0,o.createVNode)("li",{class:"bk-selector-list-item loading"},[(0,o.createVNode)(d(),{theme:"primary",size:c.BkLoadingSize.Small},null)]):null])])}})])}});T.install=function(e){e.component(T.name,T)};const b=T})(),u})()));
|
File without changes
|