sh-view 2.2.0 → 2.3.0

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.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "基于vxe-table二次封装",
5
5
  "main": "packages/index.js",
6
6
  "scripts": {
@@ -1,10 +1,12 @@
1
1
  <template>
2
2
  <vxe-colgroup v-if="isGroup" v-bind="groupConfig">
3
3
  <template v-for="(child, childIndex) in column.children" :key="childIndex">
4
- <sh-column :column="child"></sh-column>
4
+ <sh-column :column="child" />
5
5
  </template>
6
6
  </vxe-colgroup>
7
- <vxe-column v-else v-bind="columnConfig"></vxe-column>
7
+ <vxe-column v-else v-bind="columnConfig">
8
+ <template v-if="column.slots">{{ renderSlots }}</template>
9
+ </vxe-column>
8
10
  </template>
9
11
 
10
12
  <script>
@@ -41,11 +43,17 @@ export default defineComponent({
41
43
  const groupConfig = computed(() => {
42
44
  return $vUtils.omit(columnConfig.value, ['children', 'cellRender', 'editRender'])
43
45
  })
46
+ const renderSlots = () => {
47
+ return Object.keys(column.slots).map(slotKey => {
48
+ return shTable.slots[slotKey]
49
+ })
50
+ }
44
51
 
45
52
  return {
46
53
  isGroup,
47
54
  columnConfig,
48
- groupConfig
55
+ groupConfig,
56
+ renderSlots
49
57
  }
50
58
  }
51
59
  })
@@ -76,7 +76,7 @@ export const turnColumnItemFilters = (column, props) => {
76
76
  case '$vCheckgroup':
77
77
  case '$vRadiogroup':
78
78
  case '$vSwitch':
79
- column.filters = Array.isArray(columnRender.props && columnRender.props.options) ? columnRender.props.options : false
79
+ column.filters = Array.isArray(columnRender.props && columnRender.props.options) ? columnRender.props.options : []
80
80
  column.filterMultiple = true
81
81
  break
82
82
  case '$vInput':
@@ -125,10 +125,6 @@
125
125
  <template #empty>
126
126
  <sh-empty :icon="emptyIcon" :content="emptyText"></sh-empty>
127
127
  </template>
128
- <template v-for="slot in tableSlots" #[slot]="scope">
129
- <!-- 以之前的名字命名插槽,同时把数据原样绑定 -->
130
- <slot :name="slot" v-bind="scope"></slot>
131
- </template>
132
128
  </vxe-table>
133
129
  <div v-if="isFootSlot" ref="footSlotRef" v-resize="handleResize" class="sh-table-foot"><slot name="foot"></slot></div>
134
130
  <div v-if="isPagerSlot" ref="pagerSlotRef" v-resize="handleResize" class="sh-table-pager">
@@ -230,7 +226,8 @@ export default defineComponent({
230
226
 
231
227
  provide('ShTableInstance', {
232
228
  columnObjConfig: useTableHooks.tableColumnObjConfig,
233
- turnColumnItemFilters: useTableHooks.turnColumnItemFilters
229
+ turnColumnItemFilters: useTableHooks.turnColumnItemFilters,
230
+ slots: useTableHooks.slots
234
231
  })
235
232
 
236
233
  const handleResize = e => {