cnhis-design-vue 2.1.14 → 2.1.15
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/CHANGELOG.md +2206 -2175
- package/es/affix/index.js +8 -8
- package/es/age/index.js +10 -10
- package/es/alert/index.js +8 -8
- package/es/anchor/index.js +8 -8
- package/es/auto-complete/index.js +8 -8
- package/es/avatar/index.js +8 -8
- package/es/back-top/index.js +8 -8
- package/es/badge/index.js +8 -8
- package/es/base/index.js +8 -8
- package/es/big-table/index.js +129 -136
- package/es/big-table/style.css +1 -1
- package/es/breadcrumb/index.js +8 -8
- package/es/button/index.js +1728 -2761
- package/es/calendar/index.js +8 -8
- package/es/captcha/index.js +3 -3
- package/es/card/index.js +8 -8
- package/es/carousel/index.js +8 -8
- package/es/cascader/index.js +8 -8
- package/es/checkbox/index.js +9 -9
- package/es/col/index.js +8 -8
- package/es/collapse/index.js +8 -8
- package/es/color-picker/index.js +1 -1
- package/es/comment/index.js +8 -8
- package/es/config-provider/index.js +8 -8
- package/es/date-picker/index.js +8 -8
- package/es/descriptions/index.js +8 -8
- package/es/divider/index.js +8 -8
- package/es/drag-layout/index.js +3 -3
- package/es/drawer/index.js +8 -8
- package/es/dropdown/index.js +8 -8
- package/es/editor/index.js +1 -1
- package/es/empty/index.js +8 -8
- package/es/fabric-chart/index.js +83 -72
- package/es/form/index.js +8 -8
- package/es/form-model/index.js +8 -8
- package/es/form-table/index.js +62 -62
- package/es/index/index.js +2275 -3283
- package/es/index/style.css +1 -1
- package/es/input/index.js +9 -9
- package/es/input-number/index.js +8 -8
- package/es/layout/index.js +8 -8
- package/es/list/index.js +8 -8
- package/es/locale-provider/index.js +8 -8
- package/es/map/index.js +9 -9
- package/es/mentions/index.js +8 -8
- package/es/menu/index.js +8 -8
- package/es/message/index.js +8 -8
- package/es/multi-chat/index.js +92 -92
- package/es/multi-chat-client/index.js +86 -86
- package/es/multi-chat-history/index.js +4 -4
- package/es/multi-chat-record/index.js +14 -14
- package/es/multi-chat-setting/index.js +27 -27
- package/es/multi-chat-sip/index.js +1 -1
- package/es/notification/index.js +8 -8
- package/es/page-header/index.js +8 -8
- package/es/pagination/index.js +8 -8
- package/es/popconfirm/index.js +8 -8
- package/es/popover/index.js +8 -8
- package/es/progress/index.js +8 -8
- package/es/radio/index.js +9 -9
- package/es/rate/index.js +8 -8
- package/es/result/index.js +8 -8
- package/es/row/index.js +8 -8
- package/es/scale-view/index.js +33 -33
- package/es/select/index.js +11 -11
- package/es/select-label/index.js +11 -11
- package/es/select-person/index.js +20 -20
- package/es/skeleton/index.js +8 -8
- package/es/slider/index.js +8 -8
- package/es/space/index.js +8 -8
- package/es/spin/index.js +8 -8
- package/es/statistic/index.js +8 -8
- package/es/steps/index.js +8 -8
- package/es/switch/index.js +8 -8
- package/es/table-filter/index.js +1851 -2870
- package/es/tabs/index.js +8 -8
- package/es/tag/index.js +9 -9
- package/es/time-picker/index.js +8 -8
- package/es/timeline/index.js +8 -8
- package/es/tooltip/index.js +8 -8
- package/es/transfer/index.js +8 -8
- package/es/tree/index.js +8 -8
- package/es/tree-select/index.js +8 -8
- package/es/upload/index.js +8 -8
- package/es/verification-code/index.js +2 -2
- package/lib/cui.common.js +2292 -2939
- package/lib/cui.umd.js +2292 -2939
- package/lib/cui.umd.min.js +75 -73
- package/package.json +107 -107
- package/packages/big-table/src/BigTable.vue +3038 -3044
- package/packages/big-table/src/assets/style/table-base.less +370 -370
- package/packages/big-table/src/components/AutoLayoutButton.vue +270 -270
- package/packages/big-table/src/utils/bigTableProps.js +95 -95
- package/packages/button/src/ButtonPrint/components/IdentityVerification.vue +181 -181
- package/packages/button/src/ButtonPrint/index.vue +724 -724
- package/packages/button/src/ButtonPrint/js/print.es.min.js +4 -1
- package/packages/fabric-chart/src/components/TimeScaleValue.vue +117 -117
- package/packages/fabric-chart/src/const/defaultVaule.js +59 -59
- package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +960 -960
- package/packages/fabric-chart/src/fabric-chart/FabricScaleValue.vue +133 -133
- package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +558 -551
- package/packages/fabric-chart/src/fabric-chart2/FabricTop.vue +172 -172
- package/packages/multi-chat/chat/chatFooter.vue +1598 -1598
- package/packages/multi-chat/chat/chatMain.vue +1442 -1442
- package/packages/multi-chat/chat/quickReply.vue +439 -439
- package/packages/multi-chat/chat/scrollList.vue +1232 -1232
- package/packages/multi-chat/setting/baseInfo/index.vue +1302 -1302
- package/packages/multi-chat/store/actions.js +448 -448
- package/packages/multi-chat/store/state.js +112 -112
- package/packages/scale-view/formitem/r-choice.vue +714 -714
- package/packages/scale-view/scaleView.vue +2010 -2010
- package/packages/select-person/select-person.vue +1658 -1658
- package/packages/table-filter/src/base-search-com/BaseSearch.vue +2462 -2462
- package/packages/table-filter/src/components/c-tree-select/tree-select.vue +336 -336
- package/packages/table-filter/src/components/multi-select/multi-select.vue +219 -219
- package/packages/table-filter/src/components/out-quick-search/out-quick-search.vue +340 -340
- package/packages/table-filter/src/const/dataOptions.js +43 -43
- package/packages/table-filter/src/mixins/mixins.js +695 -695
- package/packages/table-filter/src/quick-search/QuickSearch.vue +2083 -2083
- package/src/directive/preventReClick.js +12 -12
|
@@ -1,270 +1,270 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { Icon, Tooltip, Progress, Switch, Popover, Button, Dropdown, Menu, Checkbox, Input, Popconfirm } from 'ant-design-vue';
|
|
3
|
-
import resize from 'vue-resize-directive';
|
|
4
|
-
import vexutils from '@/utils/vexutils';
|
|
5
|
-
import SvgIcon from '@/component/svg/index.vue';
|
|
6
|
-
import utils from '@/utils/utils-map';
|
|
7
|
-
import preventReClick from '@/directive/preventReClick';
|
|
8
|
-
export default {
|
|
9
|
-
name: 'AutoLayoutButton',
|
|
10
|
-
data() {
|
|
11
|
-
return {
|
|
12
|
-
showList: [],
|
|
13
|
-
hideList: [],
|
|
14
|
-
btnShowWidthObj: {},
|
|
15
|
-
btnIcons: {
|
|
16
|
-
// 按钮icon 映射
|
|
17
|
-
copy: 'copy',
|
|
18
|
-
pencil: 'edit',
|
|
19
|
-
delete: 'delete',
|
|
20
|
-
add: 'plus-circle',
|
|
21
|
-
download: 'download',
|
|
22
|
-
label: 'tag',
|
|
23
|
-
queding: 'check',
|
|
24
|
-
del: 'close'
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
},
|
|
28
|
-
props: {
|
|
29
|
-
btnList: {
|
|
30
|
-
type: Array,
|
|
31
|
-
default: () => []
|
|
32
|
-
},
|
|
33
|
-
row: {
|
|
34
|
-
type: Object,
|
|
35
|
-
default: () => ({})
|
|
36
|
-
},
|
|
37
|
-
index: {
|
|
38
|
-
type: Number,
|
|
39
|
-
default: () => ({})
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
computed: {
|
|
43
|
-
handleName() {
|
|
44
|
-
return function(item, key = 'name') {
|
|
45
|
-
return item.alias || item[key];
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
showBtnList() {
|
|
49
|
-
if (!Array.isArray(this.btnList)) return [];
|
|
50
|
-
let res = this.btnList
|
|
51
|
-
.map(btn => {
|
|
52
|
-
if (btn.isShow == '1' && btn.type != 'LINK') {
|
|
53
|
-
let config = {
|
|
54
|
-
btnStyle: vexutils.getBtnStyle(btn),
|
|
55
|
-
btnType: btn.showStyle == 'none_bg' || btn.showStyle === 'only_icon' ? 'link' : 'primary',
|
|
56
|
-
btnGhost: btn.showStyle == 'white_bg',
|
|
57
|
-
btnTitle: this.handleName(btn)
|
|
58
|
-
};
|
|
59
|
-
return Object.assign(btn, config);
|
|
60
|
-
} else {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
.filter(Boolean);
|
|
65
|
-
return res;
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
render() {
|
|
69
|
-
const row = this.row;
|
|
70
|
-
const index = this.index;
|
|
71
|
-
if(window._talbe_row_btn_debugger){
|
|
72
|
-
console.log(this.btnList,'----------------btnList')
|
|
73
|
-
console.log(this.hideList,'----------------hideList')
|
|
74
|
-
}
|
|
75
|
-
return (
|
|
76
|
-
<div class="c_auto-layout-wrap" ref="layoutWrap" v-resize={() => this.onResize()}>
|
|
77
|
-
{this.showList.length === 0 && this.hideList.length === 0 ? (
|
|
78
|
-
this.renderAllBtn(this.btnList)
|
|
79
|
-
) : (
|
|
80
|
-
<div>
|
|
81
|
-
{this.renderAllBtn(this.showList)}
|
|
82
|
-
{this.retnderHideBtn()}
|
|
83
|
-
</div>
|
|
84
|
-
)}
|
|
85
|
-
</div>
|
|
86
|
-
);
|
|
87
|
-
},
|
|
88
|
-
watch: {
|
|
89
|
-
btnList:{
|
|
90
|
-
handler(){
|
|
91
|
-
this.debouncePageResize();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
beforeCreate() {},
|
|
96
|
-
created() {
|
|
97
|
-
this.debouncePageResize = utils.debounce(this.handlePageResize, 300)
|
|
98
|
-
},
|
|
99
|
-
beforeMount() {},
|
|
100
|
-
mounted() {},
|
|
101
|
-
beforeUpdate() {},
|
|
102
|
-
updated() {},
|
|
103
|
-
beforeDestroy() {},
|
|
104
|
-
destroyed() {},
|
|
105
|
-
activated() {},
|
|
106
|
-
methods: {
|
|
107
|
-
getBtnIcon(btn, mr = '8px') {
|
|
108
|
-
let icon;
|
|
109
|
-
if (btn.icon) {
|
|
110
|
-
if (this.btnIcons[btn.icon]) {
|
|
111
|
-
icon = <a-icon type={this.btnIcons[btn.icon]} style={{
|
|
112
|
-
marginRight: mr
|
|
113
|
-
}} />;
|
|
114
|
-
} else {
|
|
115
|
-
icon = (
|
|
116
|
-
<a-tooltip title={this.handleName(btn)}>
|
|
117
|
-
<svg-icon
|
|
118
|
-
iconClass={btn.icon}
|
|
119
|
-
style={{
|
|
120
|
-
marginRight: mr
|
|
121
|
-
}}
|
|
122
|
-
/>
|
|
123
|
-
</a-tooltip>
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
} else if (btn.iconSetting) {
|
|
127
|
-
icon = (
|
|
128
|
-
<svg-icon
|
|
129
|
-
iconClass={JSON.parse(btn.iconSetting).icon}
|
|
130
|
-
style={{
|
|
131
|
-
marginRight: mr
|
|
132
|
-
}}
|
|
133
|
-
/>
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
return [icon];
|
|
137
|
-
},
|
|
138
|
-
|
|
139
|
-
renderAllBtn(list) {
|
|
140
|
-
const row = this.row;
|
|
141
|
-
const index = this.index;
|
|
142
|
-
return list.map((btn, j) => {
|
|
143
|
-
let btnTitle = this.handleName(btn);
|
|
144
|
-
return (
|
|
145
|
-
<a-button
|
|
146
|
-
v-preventReClick={1000}
|
|
147
|
-
ref={`rowBtnItem${btn.sid}`}
|
|
148
|
-
key={btn.sid}
|
|
149
|
-
data-key={btn.sid}
|
|
150
|
-
on-click={e => this.clickBtn(row, btn, index, e, j)}
|
|
151
|
-
class="btn-custom-class row-btn"
|
|
152
|
-
style={{
|
|
153
|
-
...vexutils.getBtnStyle(btn),
|
|
154
|
-
...{
|
|
155
|
-
display: !row.__isInlineEditing ? 'inline-block' : 'none'
|
|
156
|
-
}
|
|
157
|
-
}}
|
|
158
|
-
disabled={row.__isDisableInlineEdit}
|
|
159
|
-
type={btn.showStyle == 'none_bg' || btn.showStyle === 'only_icon' ? 'link' : 'primary'}
|
|
160
|
-
ghost={btn.showStyle == 'white_bg'}
|
|
161
|
-
size="small"
|
|
162
|
-
title={btnTitle}
|
|
163
|
-
>
|
|
164
|
-
{this.getBtnIcon(btn)}
|
|
165
|
-
{btn.showStyle === 'only_icon' ? '' : btnTitle}
|
|
166
|
-
</a-button>
|
|
167
|
-
);
|
|
168
|
-
});
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
retnderHideBtn() {
|
|
172
|
-
const row = this.row;
|
|
173
|
-
const index = this.index;
|
|
174
|
-
if (this.hideList.length === 0) return;
|
|
175
|
-
return (
|
|
176
|
-
<a-dropdown trigger={['hover']}>
|
|
177
|
-
<a-icon type="more" style="cursor: pointer;" />
|
|
178
|
-
<a-menu slot="overlay">
|
|
179
|
-
{this.hideList.map((b, j) => {
|
|
180
|
-
return (
|
|
181
|
-
<a-menu-item key={b.sid} class="c_dropdown-btn" on-click={e => this.clickBtn(row, b, index, e.domEvent, j)}>
|
|
182
|
-
{this.getBtnIcon(b)}
|
|
183
|
-
{b.showStyle === 'only_icon' ? '' : this.handleName(b)}
|
|
184
|
-
</a-menu-item>
|
|
185
|
-
);
|
|
186
|
-
})}
|
|
187
|
-
</a-menu>
|
|
188
|
-
</a-dropdown>
|
|
189
|
-
);
|
|
190
|
-
},
|
|
191
|
-
|
|
192
|
-
onResize() {
|
|
193
|
-
// utils.debounce(this.handlePageResize(), 300);
|
|
194
|
-
this.debouncePageResize();
|
|
195
|
-
},
|
|
196
|
-
|
|
197
|
-
handlePageResize() {
|
|
198
|
-
if(window._talbe_row_btn_debugger){
|
|
199
|
-
console.log(this.btnList,'----------------handlePageResize')
|
|
200
|
-
}
|
|
201
|
-
const layoutWrap = this.$refs.layoutWrap;
|
|
202
|
-
if(!layoutWrap) return;
|
|
203
|
-
let wrapWidth = layoutWrap.clientWidth;
|
|
204
|
-
let btnTotalWidth = 0;
|
|
205
|
-
let hideIndex = -1;
|
|
206
|
-
this.btnList.forEach((btn, i) => {
|
|
207
|
-
// 记录宽度
|
|
208
|
-
let btnDom = this.$refs[`rowBtnItem${btn.sid}`];
|
|
209
|
-
if (btnDom && !this.btnShowWidthObj[btn.id]) {
|
|
210
|
-
this.btnShowWidthObj[btn.id] = btnDom?.$el?.offsetWidth || 0;
|
|
211
|
-
btn.btnClientWidth = btnDom?.$el?.offsetWidth || 0;
|
|
212
|
-
}
|
|
213
|
-
if (hideIndex > 0) {
|
|
214
|
-
btn.showType = '_hide';
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
btnTotalWidth += (this.btnShowWidthObj[btn.id] || 0) + 10;
|
|
218
|
-
if (btnTotalWidth < (wrapWidth-15)) {
|
|
219
|
-
btn.showType = '_show';
|
|
220
|
-
} else {
|
|
221
|
-
btn.showType = '_hide';
|
|
222
|
-
hideIndex = i;
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
this.hideList = [];
|
|
226
|
-
this.showList = [];
|
|
227
|
-
this.btnList.forEach(btn => {
|
|
228
|
-
if (btn.showType === '_hide') {
|
|
229
|
-
this.hideList.push(btn);
|
|
230
|
-
} else {
|
|
231
|
-
this.showList.push(btn);
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
},
|
|
235
|
-
|
|
236
|
-
clickBtn(row, btn, index, e, j) {
|
|
237
|
-
this.$emit('clickBtn', row, btn, index, e, j);
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
components: {
|
|
241
|
-
[Icon.name]: Icon,
|
|
242
|
-
[Button.name]: Button,
|
|
243
|
-
[Tooltip.name]: Tooltip,
|
|
244
|
-
[Progress.name]: Progress,
|
|
245
|
-
[Switch.name]: Switch,
|
|
246
|
-
[Popover.name]: Popover,
|
|
247
|
-
[Dropdown.name]: Dropdown,
|
|
248
|
-
[Popconfirm.name]: Popconfirm,
|
|
249
|
-
[Menu.name]: Menu,
|
|
250
|
-
[Menu.Item.name]: Menu.Item,
|
|
251
|
-
[Menu.ItemGroup.name]: Menu.ItemGroup,
|
|
252
|
-
SvgIcon
|
|
253
|
-
},
|
|
254
|
-
directives: { resize, preventReClick }
|
|
255
|
-
};
|
|
256
|
-
</script>
|
|
257
|
-
|
|
258
|
-
<style lang="less" scoped>
|
|
259
|
-
.c_auto-layout-wrap {
|
|
260
|
-
width: 100%;
|
|
261
|
-
height: 100%;
|
|
262
|
-
overflow: hidden;
|
|
263
|
-
.row-btn {
|
|
264
|
-
margin-right: 10px;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
.ant-dropdown-menu-item.c_dropdown-btn{
|
|
268
|
-
justify-content: flex-start;
|
|
269
|
-
}
|
|
270
|
-
</style>
|
|
1
|
+
<script>
|
|
2
|
+
import { Icon, Tooltip, Progress, Switch, Popover, Button, Dropdown, Menu, Checkbox, Input, Popconfirm } from 'ant-design-vue';
|
|
3
|
+
import resize from 'vue-resize-directive';
|
|
4
|
+
import vexutils from '@/utils/vexutils';
|
|
5
|
+
import SvgIcon from '@/component/svg/index.vue';
|
|
6
|
+
import utils from '@/utils/utils-map';
|
|
7
|
+
import preventReClick from '@/directive/preventReClick';
|
|
8
|
+
export default {
|
|
9
|
+
name: 'AutoLayoutButton',
|
|
10
|
+
data() {
|
|
11
|
+
return {
|
|
12
|
+
showList: [],
|
|
13
|
+
hideList: [],
|
|
14
|
+
btnShowWidthObj: {},
|
|
15
|
+
btnIcons: {
|
|
16
|
+
// 按钮icon 映射
|
|
17
|
+
copy: 'copy',
|
|
18
|
+
pencil: 'edit',
|
|
19
|
+
delete: 'delete',
|
|
20
|
+
add: 'plus-circle',
|
|
21
|
+
download: 'download',
|
|
22
|
+
label: 'tag',
|
|
23
|
+
queding: 'check',
|
|
24
|
+
del: 'close'
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
btnList: {
|
|
30
|
+
type: Array,
|
|
31
|
+
default: () => []
|
|
32
|
+
},
|
|
33
|
+
row: {
|
|
34
|
+
type: Object,
|
|
35
|
+
default: () => ({})
|
|
36
|
+
},
|
|
37
|
+
index: {
|
|
38
|
+
type: Number,
|
|
39
|
+
default: () => ({})
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
computed: {
|
|
43
|
+
handleName() {
|
|
44
|
+
return function(item, key = 'name') {
|
|
45
|
+
return item.alias || item[key];
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
showBtnList() {
|
|
49
|
+
if (!Array.isArray(this.btnList)) return [];
|
|
50
|
+
let res = this.btnList
|
|
51
|
+
.map(btn => {
|
|
52
|
+
if (btn.isShow == '1' && btn.type != 'LINK') {
|
|
53
|
+
let config = {
|
|
54
|
+
btnStyle: vexutils.getBtnStyle(btn),
|
|
55
|
+
btnType: btn.showStyle == 'none_bg' || btn.showStyle === 'only_icon' ? 'link' : 'primary',
|
|
56
|
+
btnGhost: btn.showStyle == 'white_bg',
|
|
57
|
+
btnTitle: this.handleName(btn)
|
|
58
|
+
};
|
|
59
|
+
return Object.assign(btn, config);
|
|
60
|
+
} else {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
.filter(Boolean);
|
|
65
|
+
return res;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
render() {
|
|
69
|
+
const row = this.row;
|
|
70
|
+
const index = this.index;
|
|
71
|
+
if(window._talbe_row_btn_debugger){
|
|
72
|
+
console.log(this.btnList,'----------------btnList')
|
|
73
|
+
console.log(this.hideList,'----------------hideList')
|
|
74
|
+
}
|
|
75
|
+
return (
|
|
76
|
+
<div class="c_auto-layout-wrap" ref="layoutWrap" v-resize={() => this.onResize()}>
|
|
77
|
+
{this.showList.length === 0 && this.hideList.length === 0 ? (
|
|
78
|
+
this.renderAllBtn(this.btnList)
|
|
79
|
+
) : (
|
|
80
|
+
<div>
|
|
81
|
+
{this.renderAllBtn(this.showList)}
|
|
82
|
+
{this.retnderHideBtn()}
|
|
83
|
+
</div>
|
|
84
|
+
)}
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
},
|
|
88
|
+
watch: {
|
|
89
|
+
btnList:{
|
|
90
|
+
handler(){
|
|
91
|
+
this.debouncePageResize();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
beforeCreate() {},
|
|
96
|
+
created() {
|
|
97
|
+
this.debouncePageResize = utils.debounce(this.handlePageResize, 300)
|
|
98
|
+
},
|
|
99
|
+
beforeMount() {},
|
|
100
|
+
mounted() {},
|
|
101
|
+
beforeUpdate() {},
|
|
102
|
+
updated() {},
|
|
103
|
+
beforeDestroy() {},
|
|
104
|
+
destroyed() {},
|
|
105
|
+
activated() {},
|
|
106
|
+
methods: {
|
|
107
|
+
getBtnIcon(btn, mr = '8px') {
|
|
108
|
+
let icon;
|
|
109
|
+
if (btn.icon) {
|
|
110
|
+
if (this.btnIcons[btn.icon]) {
|
|
111
|
+
icon = <a-icon type={this.btnIcons[btn.icon]} style={{
|
|
112
|
+
marginRight: mr
|
|
113
|
+
}} />;
|
|
114
|
+
} else {
|
|
115
|
+
icon = (
|
|
116
|
+
<a-tooltip title={this.handleName(btn)}>
|
|
117
|
+
<svg-icon
|
|
118
|
+
iconClass={btn.icon}
|
|
119
|
+
style={{
|
|
120
|
+
marginRight: mr
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
123
|
+
</a-tooltip>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
} else if (btn.iconSetting) {
|
|
127
|
+
icon = (
|
|
128
|
+
<svg-icon
|
|
129
|
+
iconClass={JSON.parse(btn.iconSetting).icon}
|
|
130
|
+
style={{
|
|
131
|
+
marginRight: mr
|
|
132
|
+
}}
|
|
133
|
+
/>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
return [icon];
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
renderAllBtn(list) {
|
|
140
|
+
const row = this.row;
|
|
141
|
+
const index = this.index;
|
|
142
|
+
return list.map((btn, j) => {
|
|
143
|
+
let btnTitle = this.handleName(btn);
|
|
144
|
+
return (
|
|
145
|
+
<a-button
|
|
146
|
+
v-preventReClick={1000}
|
|
147
|
+
ref={`rowBtnItem${btn.sid}`}
|
|
148
|
+
key={btn.sid}
|
|
149
|
+
data-key={btn.sid}
|
|
150
|
+
on-click={e => this.clickBtn(row, btn, index, e, j)}
|
|
151
|
+
class="btn-custom-class row-btn"
|
|
152
|
+
style={{
|
|
153
|
+
...vexutils.getBtnStyle(btn),
|
|
154
|
+
...{
|
|
155
|
+
display: !row.__isInlineEditing ? 'inline-block' : 'none'
|
|
156
|
+
}
|
|
157
|
+
}}
|
|
158
|
+
disabled={row.__isDisableInlineEdit}
|
|
159
|
+
type={btn.showStyle == 'none_bg' || btn.showStyle === 'only_icon' ? 'link' : 'primary'}
|
|
160
|
+
ghost={btn.showStyle == 'white_bg'}
|
|
161
|
+
size="small"
|
|
162
|
+
title={btnTitle}
|
|
163
|
+
>
|
|
164
|
+
{this.getBtnIcon(btn)}
|
|
165
|
+
{btn.showStyle === 'only_icon' ? '' : btnTitle}
|
|
166
|
+
</a-button>
|
|
167
|
+
);
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
retnderHideBtn() {
|
|
172
|
+
const row = this.row;
|
|
173
|
+
const index = this.index;
|
|
174
|
+
if (this.hideList.length === 0) return;
|
|
175
|
+
return (
|
|
176
|
+
<a-dropdown trigger={['hover']}>
|
|
177
|
+
<a-icon type="more" style="cursor: pointer;" />
|
|
178
|
+
<a-menu slot="overlay">
|
|
179
|
+
{this.hideList.map((b, j) => {
|
|
180
|
+
return (
|
|
181
|
+
<a-menu-item key={b.sid} class="c_dropdown-btn" on-click={e => this.clickBtn(row, b, index, e.domEvent, j)}>
|
|
182
|
+
{this.getBtnIcon(b)}
|
|
183
|
+
{b.showStyle === 'only_icon' ? '' : this.handleName(b)}
|
|
184
|
+
</a-menu-item>
|
|
185
|
+
);
|
|
186
|
+
})}
|
|
187
|
+
</a-menu>
|
|
188
|
+
</a-dropdown>
|
|
189
|
+
);
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
onResize() {
|
|
193
|
+
// utils.debounce(this.handlePageResize(), 300);
|
|
194
|
+
this.debouncePageResize();
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
handlePageResize() {
|
|
198
|
+
if(window._talbe_row_btn_debugger){
|
|
199
|
+
console.log(this.btnList,'----------------handlePageResize')
|
|
200
|
+
}
|
|
201
|
+
const layoutWrap = this.$refs.layoutWrap;
|
|
202
|
+
if(!layoutWrap) return;
|
|
203
|
+
let wrapWidth = layoutWrap.clientWidth;
|
|
204
|
+
let btnTotalWidth = 0;
|
|
205
|
+
let hideIndex = -1;
|
|
206
|
+
this.btnList.forEach((btn, i) => {
|
|
207
|
+
// 记录宽度
|
|
208
|
+
let btnDom = this.$refs[`rowBtnItem${btn.sid}`];
|
|
209
|
+
if (btnDom && !this.btnShowWidthObj[btn.id]) {
|
|
210
|
+
this.btnShowWidthObj[btn.id] = btnDom?.$el?.offsetWidth || 0;
|
|
211
|
+
btn.btnClientWidth = btnDom?.$el?.offsetWidth || 0;
|
|
212
|
+
}
|
|
213
|
+
if (hideIndex > 0) {
|
|
214
|
+
btn.showType = '_hide';
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
btnTotalWidth += (this.btnShowWidthObj[btn.id] || 0) + 10;
|
|
218
|
+
if (btnTotalWidth < (wrapWidth-15)) {
|
|
219
|
+
btn.showType = '_show';
|
|
220
|
+
} else {
|
|
221
|
+
btn.showType = '_hide';
|
|
222
|
+
hideIndex = i;
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
this.hideList = [];
|
|
226
|
+
this.showList = [];
|
|
227
|
+
this.btnList.forEach(btn => {
|
|
228
|
+
if (btn.showType === '_hide') {
|
|
229
|
+
this.hideList.push(btn);
|
|
230
|
+
} else {
|
|
231
|
+
this.showList.push(btn);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
},
|
|
235
|
+
|
|
236
|
+
clickBtn(row, btn, index, e, j) {
|
|
237
|
+
this.$emit('clickBtn', row, btn, index, e, j);
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
components: {
|
|
241
|
+
[Icon.name]: Icon,
|
|
242
|
+
[Button.name]: Button,
|
|
243
|
+
[Tooltip.name]: Tooltip,
|
|
244
|
+
[Progress.name]: Progress,
|
|
245
|
+
[Switch.name]: Switch,
|
|
246
|
+
[Popover.name]: Popover,
|
|
247
|
+
[Dropdown.name]: Dropdown,
|
|
248
|
+
[Popconfirm.name]: Popconfirm,
|
|
249
|
+
[Menu.name]: Menu,
|
|
250
|
+
[Menu.Item.name]: Menu.Item,
|
|
251
|
+
[Menu.ItemGroup.name]: Menu.ItemGroup,
|
|
252
|
+
SvgIcon
|
|
253
|
+
},
|
|
254
|
+
directives: { resize, preventReClick }
|
|
255
|
+
};
|
|
256
|
+
</script>
|
|
257
|
+
|
|
258
|
+
<style lang="less" scoped>
|
|
259
|
+
.c_auto-layout-wrap {
|
|
260
|
+
width: 100%;
|
|
261
|
+
height: 100%;
|
|
262
|
+
overflow: hidden;
|
|
263
|
+
.row-btn {
|
|
264
|
+
margin-right: 10px;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
.ant-dropdown-menu-item.c_dropdown-btn{
|
|
268
|
+
justify-content: flex-start;
|
|
269
|
+
}
|
|
270
|
+
</style>
|