rayyy-vue-table-components 2.0.53 → 2.0.55

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": "rayyy-vue-table-components",
3
- "version": "2.0.53",
3
+ "version": "2.0.55",
4
4
  "description": "Vue 3 + Element Plus 表格組件庫",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
@@ -8,10 +8,9 @@
8
8
  @apply h-10;
9
9
 
10
10
  .el-tooltip {
11
- @apply flex items-center;
12
-
13
11
  .cell-content {
14
- @apply truncate;
12
+ @apply block w-full truncate;
13
+ text-align: inherit;
15
14
  }
16
15
  }
17
16
 
@@ -1,11 +1,13 @@
1
1
  <script setup lang="ts" generic="T extends Record<string, unknown> = Record<string, unknown>">
2
- import type { VNode } from 'vue'
2
+ import type { FunctionalComponent, VNode } from 'vue'
3
3
  import { computed } from 'vue'
4
4
  import { useI18n } from 'vue-i18n'
5
5
  import type { TableColumnCtx } from 'element-plus'
6
6
  import type { SortChangValue, TableColumn } from '@/types'
7
7
  import type { Language } from 'element-plus/es/locale'
8
8
 
9
+ const TemplateCell: FunctionalComponent<{ vnode: VNode }> = props => props.vnode
10
+
9
11
  const { t } = useI18n()
10
12
 
11
13
  type Props<T extends Record<string, unknown> = Record<string, unknown>> = {
@@ -145,20 +147,13 @@ const operatorWidth = computed(() => {
145
147
  </el-table-column>
146
148
 
147
149
  <!-- 數據列 -->
148
- <el-table-column v-for="(column, index) in columns" :key="index" v-bind="column">
150
+ <el-table-column v-for="(column, index) in columns" :key="column.prop ?? index" v-bind="column">
149
151
  <template #default="{ row }">
150
152
  <div class="cell-content" @click="handleCellClick(column, row)">
151
153
  <template v-if="column.formatter">
152
154
  {{ column.formatter(row) }}
153
155
  </template>
154
- <component
155
- v-else-if="column.template"
156
- :is="{
157
- setup() {
158
- return () => column.template?.(row)
159
- },
160
- }"
161
- />
156
+ <TemplateCell v-else-if="column.template" :vnode="column.template(row)" />
162
157
  <span v-else-if="column.prop">{{ row[column.prop] }}</span>
163
158
  </div>
164
159
  </template>