rayyy-vue-table-components 2.0.37 → 2.0.38
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/dist/index.es.js +3453 -3458
- package/dist/index.umd.js +6 -6
- package/package.json +1 -1
- package/src/components/tables/BaseTable.vue +65 -82
package/package.json
CHANGED
|
@@ -5,7 +5,6 @@ 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
|
-
import { useComponentElementLocale } from '@/utils/i18n'
|
|
9
8
|
|
|
10
9
|
const { t } = useI18n()
|
|
11
10
|
|
|
@@ -80,91 +79,75 @@ const operatorWidth = computed(() => {
|
|
|
80
79
|
return 60
|
|
81
80
|
}
|
|
82
81
|
})
|
|
83
|
-
|
|
84
|
-
// 優先使用 prop,沒有 prop 則使用 composable
|
|
85
|
-
const elementLocale = computed(() => {
|
|
86
|
-
if (props.locale) {
|
|
87
|
-
return props.locale
|
|
88
|
-
}
|
|
89
|
-
return useComponentElementLocale().value
|
|
90
|
-
})
|
|
91
82
|
</script>
|
|
92
83
|
|
|
93
84
|
<template>
|
|
94
|
-
<el-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
<el-table-column
|
|
113
|
-
v-if="showSelection"
|
|
114
|
-
type="selection"
|
|
115
|
-
width="60"
|
|
116
|
-
fixed="left"
|
|
117
|
-
align="center"
|
|
118
|
-
/>
|
|
85
|
+
<el-table
|
|
86
|
+
v-if="data.length > 0"
|
|
87
|
+
v-loading="loading"
|
|
88
|
+
:element-loading-text="t('common.loading')"
|
|
89
|
+
:data="data"
|
|
90
|
+
border
|
|
91
|
+
:show-summary="showSummary"
|
|
92
|
+
:show-overflow-tooltip="showOverFlowTooltip"
|
|
93
|
+
:summary-method="getSummaries"
|
|
94
|
+
:row-class-name="tableRowClassName"
|
|
95
|
+
class="data-table"
|
|
96
|
+
@selection-change="handleSelectionChange"
|
|
97
|
+
@current-change="(currentRow: any) => emit('current-change', currentRow)"
|
|
98
|
+
:sort="() => {}"
|
|
99
|
+
@sort-change="onSortChange"
|
|
100
|
+
>
|
|
101
|
+
<!-- 選擇列 -->
|
|
102
|
+
<el-table-column v-if="showSelection" type="selection" width="60" fixed="left" align="center" />
|
|
119
103
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
</el-config-provider>
|
|
104
|
+
<!-- 數據列 -->
|
|
105
|
+
<el-table-column v-for="(column, index) in columns" :key="index" v-bind="column">
|
|
106
|
+
<template #default="{ row }">
|
|
107
|
+
<div class="cell-content" @click="handleCellClick(column, row)">
|
|
108
|
+
<template v-if="column.formatter">
|
|
109
|
+
{{ column.formatter(row) }}
|
|
110
|
+
</template>
|
|
111
|
+
<component
|
|
112
|
+
v-else-if="column.template"
|
|
113
|
+
:is="{
|
|
114
|
+
setup() {
|
|
115
|
+
return () => column.template?.(row)
|
|
116
|
+
},
|
|
117
|
+
}"
|
|
118
|
+
/>
|
|
119
|
+
<span v-else-if="column.prop">{{ row[column.prop] }}</span>
|
|
120
|
+
</div>
|
|
121
|
+
</template>
|
|
122
|
+
</el-table-column>
|
|
123
|
+
<el-table-column
|
|
124
|
+
v-if="props.showCheckBtn || props.showEditBtn"
|
|
125
|
+
:width="operatorWidth"
|
|
126
|
+
align="center"
|
|
127
|
+
fixed="right"
|
|
128
|
+
>
|
|
129
|
+
<template #default="{ row }">
|
|
130
|
+
<div class="flex items-center justify-center">
|
|
131
|
+
<p
|
|
132
|
+
class="blue-text cursor-pointer font-bold"
|
|
133
|
+
@click="handleOperateClick(row, 'check')"
|
|
134
|
+
v-if="showCheckBtn"
|
|
135
|
+
>
|
|
136
|
+
{{ t('common.view') }}
|
|
137
|
+
</p>
|
|
138
|
+
<el-divider direction="vertical" class="!mx-2" v-if="showCheckBtn && showEditBtn" />
|
|
139
|
+
<p
|
|
140
|
+
class="blue-text cursor-pointer font-bold"
|
|
141
|
+
@click="handleOperateClick(row, 'edit')"
|
|
142
|
+
v-if="showEditBtn"
|
|
143
|
+
>
|
|
144
|
+
{{ t('common.edit') }}
|
|
145
|
+
</p>
|
|
146
|
+
</div>
|
|
147
|
+
</template>
|
|
148
|
+
</el-table-column>
|
|
149
|
+
</el-table>
|
|
150
|
+
<el-empty :description="t('table.empty')" v-else />
|
|
168
151
|
</template>
|
|
169
152
|
|
|
170
153
|
<style scoped lang="scss"></style>
|