sh-view 2.8.10 → 2.8.11

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.10",
3
+ "version": "2.8.11",
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",
@@ -82,10 +82,6 @@
82
82
  <template #empty>
83
83
  <sh-empty :icon="emptyIcon" :content="emptyText"></sh-empty>
84
84
  </template>
85
- <template v-for="slot in tableSlots" #[slot]="scope">
86
- <!-- 以之前的名字命名插槽,同时把数据原样绑定 -->
87
- <slot :name="slot" v-bind="scope"></slot>
88
- </template>
89
85
  </vxe-grid>
90
86
  <!--导入弹窗-->
91
87
  <importModal v-if="importBindConfig.modalConfig.modelValue" v-bind="importBindConfig" @confirm="setImportData"></importModal>
@@ -103,12 +103,21 @@ export const getFieldRules = (ori, rules) => {
103
103
  }
104
104
  }
105
105
  // 转换生成新表头数据
106
- export const getTransfarFields = (oriArr = [], columnObj, isSearch) => {
106
+ export const getTransfarFields = (oriArr = [], { slots, columnObj, isSearch }) => {
107
107
  let rules = {}
108
108
  let columnsFlatArr = []
109
109
  let formItemsArr = []
110
110
  let columnsArr = $vUtils.mapTree(oriArr, ori => {
111
- let tar = Object.assign({}, columnObj, ori)
111
+ let slotObj = {}
112
+ // 将插槽转换为函数式
113
+ if (slots && ori.slots) {
114
+ Object.keys(ori.slots).forEach(slotKey => {
115
+ if ($vUtils.isString(ori.slots[slotKey])) {
116
+ $vUtils.set(slotObj, `slots.${slotKey}`, slots[ori.slots[slotKey]])
117
+ }
118
+ })
119
+ }
120
+ let tar = Object.assign({}, columnObj, ori, slotObj)
112
121
  if (ori.children && ori.children.length > 0) {
113
122
  tar.sortable = false
114
123
  tar.filter = false
@@ -259,7 +259,7 @@ export default function (props, context, proxy, isGrid) {
259
259
  selectionRows.value = selections
260
260
  }
261
261
  const updateExpended = () => {
262
- if (tableRef.value && tableTreeConfig.value.expandAll) {
262
+ if (tableRef.value && tableTreeConfig.value && tableTreeConfig.value.expandAll) {
263
263
  setTimeout(() => {
264
264
  tableRef.value.setAllTreeExpand(true)
265
265
  })
@@ -404,7 +404,7 @@ export default function (props, context, proxy, isGrid) {
404
404
 
405
405
  // 初始化生成新表头数据
406
406
  const initTableColumns = () => {
407
- let transResult = getTransfarFields(props.columns, tableColumnObjConfig.value, tableGlobalConfig.value.search)
407
+ let transResult = getTransfarFields(props.columns, { slots, columnObj: tableColumnObjConfig.value, isSearch: tableGlobalConfig.value.search })
408
408
  tableColumnsFlat.value = transResult.columnsFlatArr
409
409
  tableFormItems.value = transResult.formItemsArr
410
410
  tableColumnsFixed.value = transResult.columnsArr
@@ -71,10 +71,6 @@
71
71
  <template #empty>
72
72
  <sh-empty :icon="emptyIcon" :content="emptyText"></sh-empty>
73
73
  </template>
74
- <template v-for="slot in tableSlots" #[slot]="scope">
75
- <!-- 以之前的名字命名插槽,同时把数据原样绑定 -->
76
- <slot :name="slot" v-bind="scope"></slot>
77
- </template>
78
74
  </vxe-table>
79
75
  <div v-if="isFootSlot" ref="footSlotRef" v-resize="handleResize" class="sh-table-foot"><slot name="foot"></slot></div>
80
76
  <div v-if="isPagerSlot" ref="pagerSlotRef" v-resize="handleResize" class="sh-table-pager">