yy-vue-easytable 2.27.2
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/LICENSE +22 -0
- package/README.md +187 -0
- package/libs/font/demo.css +539 -0
- package/libs/font/demo_index.html +400 -0
- package/libs/font/iconfont.css +57 -0
- package/libs/font/iconfont.eot +0 -0
- package/libs/font/iconfont.js +1 -0
- package/libs/font/iconfont.json +79 -0
- package/libs/font/iconfont.svg +56 -0
- package/libs/font/iconfont.ttf +0 -0
- package/libs/font/iconfont.woff +0 -0
- package/libs/font/iconfont.woff2 +0 -0
- package/libs/locale/lang/af-ZA.js +48 -0
- package/libs/locale/lang/en-US.js +48 -0
- package/libs/locale/lang/fr-FR.js +48 -0
- package/libs/locale/lang/ko-KR.js +48 -0
- package/libs/locale/lang/pt-BR.js +48 -0
- package/libs/locale/lang/ru-RU.js +48 -0
- package/libs/locale/lang/zh-CN.js +48 -0
- package/libs/locale/lang/zh-TW.js +48 -0
- package/libs/locale/lang/zu-ZA.js +48 -0
- package/libs/main.js +1 -0
- package/libs/theme-dark/base.css +1 -0
- package/libs/theme-dark/index.css +1253 -0
- package/libs/theme-dark/var.css +7 -0
- package/libs/theme-dark/ve-checkbox.css +150 -0
- package/libs/theme-dark/ve-contextmenu.css +71 -0
- package/libs/theme-dark/ve-dropdown.css +177 -0
- package/libs/theme-dark/ve-icon.css +10 -0
- package/libs/theme-dark/ve-loading.css +218 -0
- package/libs/theme-dark/ve-pagination.css +136 -0
- package/libs/theme-dark/ve-radio.css +111 -0
- package/libs/theme-dark/ve-select.css +50 -0
- package/libs/theme-dark/ve-table.css +385 -0
- package/libs/theme-default/base.css +1 -0
- package/libs/theme-default/index.css +1253 -0
- package/libs/theme-default/var.css +7 -0
- package/libs/theme-default/ve-checkbox.css +150 -0
- package/libs/theme-default/ve-contextmenu.css +71 -0
- package/libs/theme-default/ve-dropdown.css +177 -0
- package/libs/theme-default/ve-icon.css +10 -0
- package/libs/theme-default/ve-loading.css +218 -0
- package/libs/theme-default/ve-pagination.css +136 -0
- package/libs/theme-default/ve-radio.css +111 -0
- package/libs/theme-default/ve-select.css +50 -0
- package/libs/theme-default/ve-table.css +385 -0
- package/libs/umd/index.js +9 -0
- package/libs/ve-checkbox-group.js +1 -0
- package/libs/ve-checkbox.js +1 -0
- package/libs/ve-contextmenu.js +1 -0
- package/libs/ve-dropdown.js +1 -0
- package/libs/ve-icon.js +1 -0
- package/libs/ve-loading.js +1 -0
- package/libs/ve-locale.js +1 -0
- package/libs/ve-pagination.js +1 -0
- package/libs/ve-radio.js +1 -0
- package/libs/ve-select.js +1 -0
- package/libs/ve-table.js +1 -0
- package/package.json +142 -0
- package/packages/font/demo.css +539 -0
- package/packages/font/demo_index.html +400 -0
- package/packages/font/iconfont.css +57 -0
- package/packages/font/iconfont.eot +0 -0
- package/packages/font/iconfont.js +1 -0
- package/packages/font/iconfont.json +79 -0
- package/packages/font/iconfont.svg +56 -0
- package/packages/font/iconfont.ttf +0 -0
- package/packages/font/iconfont.woff +0 -0
- package/packages/font/iconfont.woff2 +0 -0
- package/packages/index.js +75 -0
- package/packages/src/comps/resize-observer/index.js +2 -0
- package/packages/src/comps/resize-observer/src/index.jsx +38 -0
- package/packages/src/directives/clickoutside.js +31 -0
- package/packages/src/directives/events-outside.js +79 -0
- package/packages/src/directives/focus.js +28 -0
- package/packages/src/locale/index.js +27 -0
- package/packages/src/locale/lang/af-ZA.js +29 -0
- package/packages/src/locale/lang/en-US.js +30 -0
- package/packages/src/locale/lang/fr-FR.js +29 -0
- package/packages/src/locale/lang/ko-KR.js +29 -0
- package/packages/src/locale/lang/pt-BR.js +29 -0
- package/packages/src/locale/lang/ru-RU.js +29 -0
- package/packages/src/locale/lang/zh-CN.js +30 -0
- package/packages/src/locale/lang/zh-TW.js +29 -0
- package/packages/src/locale/lang/zu-ZA.js +29 -0
- package/packages/src/mixins/emitter.js +39 -0
- package/packages/src/utils/animation-frame.js +39 -0
- package/packages/src/utils/auto-resize.js +179 -0
- package/packages/src/utils/constant.js +42 -0
- package/packages/src/utils/dom.js +239 -0
- package/packages/src/utils/event-key-codes.js +53 -0
- package/packages/src/utils/hooks-manager.js +76 -0
- package/packages/src/utils/index.js +161 -0
- package/packages/src/utils/mouse-event.js +24 -0
- package/packages/src/utils/random.js +6 -0
- package/packages/src/utils/request-animation-timeout.js +36 -0
- package/packages/src/utils/resize-event.js +40 -0
- package/packages/src/utils/scroll-bar.js +27 -0
- package/packages/style/ve-checkbox.less +179 -0
- package/packages/style/ve-contextmenu.less +76 -0
- package/packages/style/ve-dropdown.less +204 -0
- package/packages/style/ve-icon.less +3 -0
- package/packages/style/ve-loading.less +242 -0
- package/packages/style/ve-pagination.less +153 -0
- package/packages/style/ve-radio.less +126 -0
- package/packages/style/ve-select.less +48 -0
- package/packages/style/ve-table.less +539 -0
- package/packages/theme-dark/base.less +1 -0
- package/packages/theme-dark/index.less +12 -0
- package/packages/theme-dark/var.less +111 -0
- package/packages/theme-dark/ve-checkbox.less +2 -0
- package/packages/theme-dark/ve-contextmenu.less +2 -0
- package/packages/theme-dark/ve-dropdown.less +2 -0
- package/packages/theme-dark/ve-icon.less +2 -0
- package/packages/theme-dark/ve-loading.less +2 -0
- package/packages/theme-dark/ve-pagination.less +2 -0
- package/packages/theme-dark/ve-radio.less +2 -0
- package/packages/theme-dark/ve-select.less +2 -0
- package/packages/theme-dark/ve-table.less +2 -0
- package/packages/theme-default/base.less +1 -0
- package/packages/theme-default/index.less +12 -0
- package/packages/theme-default/var.less +111 -0
- package/packages/theme-default/ve-checkbox.less +2 -0
- package/packages/theme-default/ve-contextmenu.less +2 -0
- package/packages/theme-default/ve-dropdown.less +2 -0
- package/packages/theme-default/ve-icon.less +2 -0
- package/packages/theme-default/ve-loading.less +2 -0
- package/packages/theme-default/ve-pagination.less +2 -0
- package/packages/theme-default/ve-radio.less +2 -0
- package/packages/theme-default/ve-select.less +2 -0
- package/packages/theme-default/ve-table.less +2 -0
- package/packages/ve-checkbox/index.js +7 -0
- package/packages/ve-checkbox/src/index.jsx +175 -0
- package/packages/ve-checkbox/src/util/constant.js +14 -0
- package/packages/ve-checkbox/src/util/index.js +10 -0
- package/packages/ve-checkbox-group/index.js +7 -0
- package/packages/ve-checkbox-group/src/index.jsx +53 -0
- package/packages/ve-checkbox-group/src/util/constant.js +14 -0
- package/packages/ve-checkbox-group/src/util/index.js +10 -0
- package/packages/ve-contextmenu/index.js +7 -0
- package/packages/ve-contextmenu/src/index.jsx +731 -0
- package/packages/ve-contextmenu/src/util/constant.js +29 -0
- package/packages/ve-contextmenu/src/util/index.js +10 -0
- package/packages/ve-dropdown/index.js +7 -0
- package/packages/ve-dropdown/src/index.jsx +720 -0
- package/packages/ve-dropdown/src/util/constant.js +15 -0
- package/packages/ve-dropdown/src/util/index.js +10 -0
- package/packages/ve-icon/index.js +7 -0
- package/packages/ve-icon/src/index.jsx +52 -0
- package/packages/ve-icon/src/util/constant.js +10 -0
- package/packages/ve-icon/src/util/index.js +10 -0
- package/packages/ve-loading/index.js +8 -0
- package/packages/ve-loading/src/bounce.jsx +50 -0
- package/packages/ve-loading/src/flow.jsx +51 -0
- package/packages/ve-loading/src/grid.jsx +57 -0
- package/packages/ve-loading/src/index.js +106 -0
- package/packages/ve-loading/src/loading.jsx +63 -0
- package/packages/ve-loading/src/plane.jsx +38 -0
- package/packages/ve-loading/src/pulse.jsx +38 -0
- package/packages/ve-loading/src/util/constant.js +31 -0
- package/packages/ve-loading/src/util/index.js +10 -0
- package/packages/ve-loading/src/wave.jsx +53 -0
- package/packages/ve-locale/index.js +28 -0
- package/packages/ve-pagination/index.js +7 -0
- package/packages/ve-pagination/src/index.jsx +304 -0
- package/packages/ve-pagination/src/pager.jsx +166 -0
- package/packages/ve-pagination/src/util/constant.js +16 -0
- package/packages/ve-pagination/src/util/index.js +10 -0
- package/packages/ve-radio/index.js +7 -0
- package/packages/ve-radio/src/index.jsx +121 -0
- package/packages/ve-radio/src/util/constant.js +13 -0
- package/packages/ve-radio/src/util/index.js +10 -0
- package/packages/ve-select/index.js +7 -0
- package/packages/ve-select/src/index.jsx +193 -0
- package/packages/ve-select/src/util/constant.js +13 -0
- package/packages/ve-select/src/util/index.js +10 -0
- package/packages/ve-table/index.js +7 -0
- package/packages/ve-table/src/body/body-checkbox-content.jsx +126 -0
- package/packages/ve-table/src/body/body-radio-content.jsx +113 -0
- package/packages/ve-table/src/body/body-td.jsx +671 -0
- package/packages/ve-table/src/body/body-tr-scrolling.jsx +38 -0
- package/packages/ve-table/src/body/body-tr.jsx +383 -0
- package/packages/ve-table/src/body/expand-tr-icon.jsx +80 -0
- package/packages/ve-table/src/body/expand-tr.jsx +147 -0
- package/packages/ve-table/src/body/index.jsx +943 -0
- package/packages/ve-table/src/colgroup/index.jsx +48 -0
- package/packages/ve-table/src/column-resizer/index.jsx +318 -0
- package/packages/ve-table/src/editor/constant.js +5 -0
- package/packages/ve-table/src/editor/index.jsx +533 -0
- package/packages/ve-table/src/footer/footer-td.jsx +396 -0
- package/packages/ve-table/src/footer/footer-tr.jsx +249 -0
- package/packages/ve-table/src/footer/index.jsx +108 -0
- package/packages/ve-table/src/header/header-checkbox-content.jsx +69 -0
- package/packages/ve-table/src/header/header-filter-content.jsx +100 -0
- package/packages/ve-table/src/header/header-filter-custom-content.jsx +110 -0
- package/packages/ve-table/src/header/header-th.jsx +664 -0
- package/packages/ve-table/src/header/header-tr.jsx +255 -0
- package/packages/ve-table/src/header/index.jsx +195 -0
- package/packages/ve-table/src/index.jsx +4196 -0
- package/packages/ve-table/src/selection/constant.js +5 -0
- package/packages/ve-table/src/selection/index.jsx +1643 -0
- package/packages/ve-table/src/util/clipboard.js +428 -0
- package/packages/ve-table/src/util/constant.js +269 -0
- package/packages/ve-table/src/util/index.js +1585 -0
- package/packages/ve-table/src/util/store.js +14 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { clsName } from "../util";
|
|
2
|
+
import FooterTr from "./footer-tr";
|
|
3
|
+
import { COMPS_NAME } from "../util/constant";
|
|
4
|
+
export default {
|
|
5
|
+
name: COMPS_NAME.VE_TABLE_FOOTER,
|
|
6
|
+
props: {
|
|
7
|
+
colgroups: {
|
|
8
|
+
type: Array,
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
footerData: {
|
|
12
|
+
type: Array,
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
hasFixedColumn: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false,
|
|
18
|
+
},
|
|
19
|
+
allRowKeys: {
|
|
20
|
+
type: Array,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
rowKeyFieldName: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: null,
|
|
26
|
+
},
|
|
27
|
+
// cell style option
|
|
28
|
+
cellStyleOption: {
|
|
29
|
+
type: Object,
|
|
30
|
+
default: function () {
|
|
31
|
+
return null;
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
// event custom option
|
|
35
|
+
eventCustomOption: {
|
|
36
|
+
type: Object,
|
|
37
|
+
default: function () {
|
|
38
|
+
return null;
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
// footer rows
|
|
42
|
+
footerRows: {
|
|
43
|
+
type: Array,
|
|
44
|
+
default: function () {
|
|
45
|
+
return [];
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
// fixed footer
|
|
49
|
+
fixedFooter: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: true,
|
|
52
|
+
},
|
|
53
|
+
// cell span option
|
|
54
|
+
cellSpanOption: {
|
|
55
|
+
type: Object,
|
|
56
|
+
default: function () {
|
|
57
|
+
return null;
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
computed: {
|
|
62
|
+
// footer class
|
|
63
|
+
footerClass() {
|
|
64
|
+
return {
|
|
65
|
+
[clsName("fixed-footer")]: this.fixedFooter,
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
methods: {
|
|
70
|
+
// get tr key
|
|
71
|
+
getTrKey({ rowData, rowIndex }) {
|
|
72
|
+
let result = rowIndex;
|
|
73
|
+
|
|
74
|
+
const { rowKeyFieldName } = this;
|
|
75
|
+
if (rowKeyFieldName) {
|
|
76
|
+
result = rowData[rowKeyFieldName];
|
|
77
|
+
}
|
|
78
|
+
return result;
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
render() {
|
|
82
|
+
const { colgroups, rowKeyFieldName, cellStyleOption } = this;
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<tfoot class={this.footerClass}>
|
|
86
|
+
{this.footerData.map((rowData, rowIndex) => {
|
|
87
|
+
const trProps = {
|
|
88
|
+
key: this.getTrKey({ rowData, rowIndex }),
|
|
89
|
+
props: {
|
|
90
|
+
rowIndex,
|
|
91
|
+
rowData,
|
|
92
|
+
colgroups,
|
|
93
|
+
rowKeyFieldName,
|
|
94
|
+
cellStyleOption,
|
|
95
|
+
footerRows: this.footerRows,
|
|
96
|
+
fixedFooter: this.fixedFooter,
|
|
97
|
+
cellSpanOption: this.cellSpanOption,
|
|
98
|
+
eventCustomOption: this.eventCustomOption,
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
return <FooterTr {...trProps} />;
|
|
103
|
+
})}
|
|
104
|
+
{this.$slots.default}
|
|
105
|
+
</tfoot>
|
|
106
|
+
);
|
|
107
|
+
},
|
|
108
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import VeCheckbox from "vue-easytable/packages/ve-checkbox";
|
|
2
|
+
import { COMPS_NAME, EMIT_EVENTS } from "../util/constant";
|
|
3
|
+
import { clsName } from "../util";
|
|
4
|
+
import emitter from "../../../src/mixins/emitter";
|
|
5
|
+
export default {
|
|
6
|
+
name: COMPS_NAME.VE_TABLE_HEADER_CHECKBOX_CONTENT,
|
|
7
|
+
mixins: [emitter],
|
|
8
|
+
props: {
|
|
9
|
+
// checkbox option
|
|
10
|
+
checkboxOption: {
|
|
11
|
+
type: Object,
|
|
12
|
+
default: function () {
|
|
13
|
+
return null;
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
data() {
|
|
18
|
+
return {
|
|
19
|
+
// is selected
|
|
20
|
+
isSelected: false,
|
|
21
|
+
isIndeterminate: false,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
methods: {
|
|
26
|
+
// selected change
|
|
27
|
+
selectedChange(isSelected) {
|
|
28
|
+
this.isSelected = isSelected;
|
|
29
|
+
|
|
30
|
+
this.dispatch(
|
|
31
|
+
COMPS_NAME.VE_TABLE,
|
|
32
|
+
EMIT_EVENTS.CHECKBOX_SELECTED_ALL_CHANGE,
|
|
33
|
+
{
|
|
34
|
+
isSelected,
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
// set selected all info
|
|
40
|
+
setSelectedAllInfo({ isSelected, isIndeterminate }) {
|
|
41
|
+
this.isSelected = isSelected;
|
|
42
|
+
this.isIndeterminate = isIndeterminate;
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
mounted() {
|
|
46
|
+
// receive selected all info
|
|
47
|
+
this.$on(EMIT_EVENTS.CHECKBOX_SELECTED_ALL_INFO, (params) => {
|
|
48
|
+
this.setSelectedAllInfo(params);
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
render() {
|
|
52
|
+
const { isSelected, isIndeterminate, selectedChange } = this;
|
|
53
|
+
|
|
54
|
+
const checkboxProps = {
|
|
55
|
+
class: clsName("checkbox-wrapper"),
|
|
56
|
+
props: {
|
|
57
|
+
isControlled: true,
|
|
58
|
+
isSelected: isSelected,
|
|
59
|
+
indeterminate: isIndeterminate,
|
|
60
|
+
},
|
|
61
|
+
on: {
|
|
62
|
+
"on-checked-change": (isSelectedParam) =>
|
|
63
|
+
selectedChange(isSelectedParam),
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return <VeCheckbox {...checkboxProps} />;
|
|
68
|
+
},
|
|
69
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import VeDropdown from "vue-easytable/packages/ve-dropdown";
|
|
2
|
+
import { COMPS_NAME, EMIT_EVENTS, LOCALE_COMP_NAME } from "../util/constant";
|
|
3
|
+
import { clsName } from "../util";
|
|
4
|
+
import { createLocale, isFunction } from "../../../src/utils/index";
|
|
5
|
+
import VeIcon from "vue-easytable/packages/ve-icon";
|
|
6
|
+
import { ICON_NAMES } from "../../../src/utils/constant";
|
|
7
|
+
|
|
8
|
+
const t = createLocale(LOCALE_COMP_NAME);
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
name: COMPS_NAME.VE_TABLE_HEADER_FILTER_CONTENT,
|
|
12
|
+
props: {
|
|
13
|
+
column: {
|
|
14
|
+
type: Object,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
data() {
|
|
19
|
+
return {
|
|
20
|
+
filterList: [],
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
watch: {
|
|
24
|
+
column: {
|
|
25
|
+
handler: function (column) {
|
|
26
|
+
if (column.filter && Array.isArray(column.filter.filterList)) {
|
|
27
|
+
this.filterList = column.filter.filterList;
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
immediate: true,
|
|
31
|
+
deep: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
methods: {
|
|
35
|
+
/*
|
|
36
|
+
* @filterConfirm
|
|
37
|
+
* @desc filter confirm
|
|
38
|
+
* @param {Array} val - filter list
|
|
39
|
+
*/
|
|
40
|
+
filterConfirm() {
|
|
41
|
+
const { filterConfirm } = this.column.filter;
|
|
42
|
+
filterConfirm && filterConfirm(this.filterList);
|
|
43
|
+
},
|
|
44
|
+
// filter reset
|
|
45
|
+
filterReset() {
|
|
46
|
+
const { filterReset } = this.column.filter;
|
|
47
|
+
filterReset && filterReset(this.filterList);
|
|
48
|
+
},
|
|
49
|
+
// getIcon
|
|
50
|
+
getIcon(h) {
|
|
51
|
+
let result;
|
|
52
|
+
const { filterIcon } = this.column.filter;
|
|
53
|
+
if (isFunction(filterIcon)) {
|
|
54
|
+
result = filterIcon(h);
|
|
55
|
+
} else {
|
|
56
|
+
result = <VeIcon name={ICON_NAMES.FILTER} />;
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
render(h) {
|
|
62
|
+
const { filterList, isMultiple, maxHeight, beforeVisibleChange } =
|
|
63
|
+
this.column.filter;
|
|
64
|
+
|
|
65
|
+
const compProps = {
|
|
66
|
+
props: {
|
|
67
|
+
value: filterList,
|
|
68
|
+
showOperation: true,
|
|
69
|
+
isMultiple: isMultiple,
|
|
70
|
+
showRadio: true, // when single selection
|
|
71
|
+
confirmFilterText: t("confirmFilter"),
|
|
72
|
+
resetFilterText: t("resetFilter"),
|
|
73
|
+
beforeVisibleChange: beforeVisibleChange,
|
|
74
|
+
},
|
|
75
|
+
on: {
|
|
76
|
+
[EMIT_EVENTS.HEADER_FILTER_CONFIRM]: this.filterConfirm,
|
|
77
|
+
[EMIT_EVENTS.HEADER_FILTER_RESET]: this.filterReset,
|
|
78
|
+
// v-model
|
|
79
|
+
input: (val) => {
|
|
80
|
+
this.filterList = val;
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
if (typeof maxHeight === "number") {
|
|
86
|
+
compProps.props.maxHeight = maxHeight;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<VeDropdown {...compProps}>
|
|
91
|
+
{/* icon */}
|
|
92
|
+
<span class={clsName("filter")}>
|
|
93
|
+
<span class={clsName("filter-icon")}>
|
|
94
|
+
{this.getIcon(h)}
|
|
95
|
+
</span>
|
|
96
|
+
</span>
|
|
97
|
+
</VeDropdown>
|
|
98
|
+
);
|
|
99
|
+
},
|
|
100
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import VeDropdown from "vue-easytable/packages/ve-dropdown";
|
|
2
|
+
import { COMPS_NAME } from "../util/constant";
|
|
3
|
+
import { clsName } from "../util";
|
|
4
|
+
import { isFunction, isBoolean } from "../../../src/utils/index";
|
|
5
|
+
import VeIcon from "vue-easytable/packages/ve-icon";
|
|
6
|
+
import { ICON_NAMES } from "../../../src/utils/constant";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
name: COMPS_NAME.VE_TABLE_HEADER_FILTER_CUSTOM_CONTENT,
|
|
10
|
+
props: {
|
|
11
|
+
column: {
|
|
12
|
+
type: Object,
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
data() {
|
|
17
|
+
return {
|
|
18
|
+
internalVisible: false,
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
watch: {
|
|
22
|
+
column: {
|
|
23
|
+
handler: function (column) {
|
|
24
|
+
if (
|
|
25
|
+
column.filterCustom &&
|
|
26
|
+
isBoolean(column.filterCustom.defaultVisible)
|
|
27
|
+
) {
|
|
28
|
+
this.internalVisible = column.filterCustom.defaultVisible;
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
immediate: true,
|
|
32
|
+
deep: true,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
methods: {
|
|
36
|
+
// visible change
|
|
37
|
+
visibleChange(visible) {
|
|
38
|
+
this.internalVisible = visible;
|
|
39
|
+
},
|
|
40
|
+
// get custom content
|
|
41
|
+
getCustomContent(h) {
|
|
42
|
+
let result = null;
|
|
43
|
+
|
|
44
|
+
const { render } = this.column.filterCustom;
|
|
45
|
+
if (isFunction(render)) {
|
|
46
|
+
const props = {
|
|
47
|
+
slot: "custom-content",
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
result = (
|
|
51
|
+
<div {...props}>
|
|
52
|
+
{render(
|
|
53
|
+
{
|
|
54
|
+
showFn: this.show,
|
|
55
|
+
closeFn: this.close,
|
|
56
|
+
},
|
|
57
|
+
h,
|
|
58
|
+
)}
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
},
|
|
64
|
+
// getIcon
|
|
65
|
+
getIcon(h) {
|
|
66
|
+
let result;
|
|
67
|
+
const { filterIcon } = this.column.filterCustom;
|
|
68
|
+
if (isFunction(filterIcon)) {
|
|
69
|
+
result = filterIcon(h);
|
|
70
|
+
} else {
|
|
71
|
+
result = <VeIcon name={ICON_NAMES.FILTER} />;
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
close() {
|
|
77
|
+
this.internalVisible = false;
|
|
78
|
+
},
|
|
79
|
+
show() {
|
|
80
|
+
this.internalVisible = true;
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
render(h) {
|
|
84
|
+
const compProps = {
|
|
85
|
+
props: {
|
|
86
|
+
isCustomContent: true,
|
|
87
|
+
isControlled: true,
|
|
88
|
+
visible: this.internalVisible,
|
|
89
|
+
beforeVisibleChange:
|
|
90
|
+
this.column.filterCustom.beforeVisibleChange,
|
|
91
|
+
},
|
|
92
|
+
on: {
|
|
93
|
+
"on-dropdown-visible-change": this.visibleChange,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<VeDropdown {...compProps}>
|
|
99
|
+
{/* icon */}
|
|
100
|
+
<span class={clsName("filter")}>
|
|
101
|
+
<span class={clsName("filter-icon")}>
|
|
102
|
+
{this.getIcon(h)}
|
|
103
|
+
</span>
|
|
104
|
+
</span>
|
|
105
|
+
{/* custom content */}
|
|
106
|
+
{this.getCustomContent(h)}
|
|
107
|
+
</VeDropdown>
|
|
108
|
+
);
|
|
109
|
+
},
|
|
110
|
+
};
|