sh-view 2.8.9 → 2.8.10
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sh-view",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.10",
|
|
4
4
|
"description": "基于vxe-table二次封装,更包含Alert,Badge,Card,CodeEditor,Col,Corner,CountTo,Drawer,Empty,Form,Header,Icon,List,Loading,Modal,Noticebar,Poptip,Progress,PullRefresh,Query,Result,Row,Split,Grid,Table,Tabs,Tag,Toolbar,Tree,Upload,WaterFall,WaterMark等丰富组件库",
|
|
5
5
|
"main": "packages/index.js",
|
|
6
6
|
"typings": "types/index.d.ts",
|
|
@@ -32,7 +32,7 @@ export const columnDefaultFilterMethod = ({ column, $columnIndex }) => {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// 默认求底部计算方法(已改用footer渲染器,其他需要自行计算)
|
|
35
|
-
export const tableFooterCompute = (columns,
|
|
35
|
+
export const tableFooterCompute = (columns, tableData, computeType, typeObj = {}) => {
|
|
36
36
|
const { emptyText = '', name, data = {} } = typeObj
|
|
37
37
|
let computeName = name || ''
|
|
38
38
|
if (!computeName) {
|
|
@@ -58,9 +58,9 @@ export const tableFooterCompute = (columns, fullData, computeType, typeObj = {})
|
|
|
58
58
|
let footerValue = data[column.property] || emptyText
|
|
59
59
|
if (renderName === '$vMoney' || renderProps.calculate) {
|
|
60
60
|
if (computeType === 'subTotal') {
|
|
61
|
-
footerValue = $vUtils.sum(
|
|
61
|
+
footerValue = $vUtils.sum(tableData, column.property)
|
|
62
62
|
} else if (computeType === 'mean') {
|
|
63
|
-
footerValue = $vUtils.mean(
|
|
63
|
+
footerValue = $vUtils.mean(tableData, column.property)
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
return footerValue
|
|
@@ -168,7 +168,7 @@ export default function (props, context, proxy, isGrid) {
|
|
|
168
168
|
})
|
|
169
169
|
const tableFilterConfig = computed(() => Object.assign({ clearable: true, type: 'search', placeholder: '全局关键字搜索' }, tableVmConfig.value))
|
|
170
170
|
const tableSlots = computed(() => {
|
|
171
|
-
let disSlots = ['head', 'form', '
|
|
171
|
+
let disSlots = ['top', 'head', 'foot', 'form', 'toolbar', 'formLeft', 'formRight', 'toolbarLeft', 'toolbarRight', 'pagerLeft', 'pagerRight']
|
|
172
172
|
return Object.keys(slots).filter(key => !disSlots.includes(key))
|
|
173
173
|
})
|
|
174
174
|
const tableBindConfig = computed(() => {
|
|
@@ -231,13 +231,12 @@ export default function (props, context, proxy, isGrid) {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
// 默认求底部绑定方法vxe
|
|
234
|
-
const tableFooterMethod = ({ columns }) => {
|
|
234
|
+
const tableFooterMethod = ({ columns, data }) => {
|
|
235
235
|
const { footerCalculate } = props
|
|
236
|
-
const fullData = getFullData()
|
|
237
236
|
let footerData = []
|
|
238
237
|
let footerCalculateList = footerCalculate.calculate || []
|
|
239
238
|
footerCalculateList.forEach(computeType => {
|
|
240
|
-
footerData.push(tableFooterCompute(columns,
|
|
239
|
+
footerData.push(tableFooterCompute(columns, data, computeType, footerCalculate[computeType]))
|
|
241
240
|
})
|
|
242
241
|
return footerData
|
|
243
242
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div ref="tableWrapRef" class="sh-vxe-table" :class="{ 'sh-table-ghost': tableGlobalConfig.ghost, 'is--loading': tableBindConfig.loading }" :style="{ height: wrapHeight }">
|
|
2
|
+
<div ref="tableWrapRef" v-resize="handleResize" class="sh-vxe-table" :class="{ 'sh-table-ghost': tableGlobalConfig.ghost, 'is--loading': tableBindConfig.loading }" :style="{ height: wrapHeight }">
|
|
3
3
|
<div v-if="isTopSlot" ref="topSlotRef" v-resize="handleResize" class="sh-table-top"><slot name="top"></slot></div>
|
|
4
4
|
<div v-if="isFormSlot" ref="formSlotRef" v-resize="handleResize" class="sh-table-form">
|
|
5
5
|
<slot name="form">
|
|
@@ -68,12 +68,13 @@
|
|
|
68
68
|
@toolbar-button-click="onToolbarButtonClick"
|
|
69
69
|
@toolbar-tool-click="onToolbarToolClick"
|
|
70
70
|
@option-click="handleGoptionClick">
|
|
71
|
-
<template v-if="customLayout">
|
|
72
|
-
<slot></slot>
|
|
73
|
-
</template>
|
|
74
71
|
<template #empty>
|
|
75
72
|
<sh-empty :icon="emptyIcon" :content="emptyText"></sh-empty>
|
|
76
73
|
</template>
|
|
74
|
+
<template v-for="slot in tableSlots" #[slot]="scope">
|
|
75
|
+
<!-- 以之前的名字命名插槽,同时把数据原样绑定 -->
|
|
76
|
+
<slot :name="slot" v-bind="scope"></slot>
|
|
77
|
+
</template>
|
|
77
78
|
</vxe-table>
|
|
78
79
|
<div v-if="isFootSlot" ref="footSlotRef" v-resize="handleResize" class="sh-table-foot"><slot name="foot"></slot></div>
|
|
79
80
|
<div v-if="isPagerSlot" ref="pagerSlotRef" v-resize="handleResize" class="sh-table-pager">
|