rayyy-vue-table-components 2.0.36 → 2.0.37
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 +1444 -1437
- package/dist/index.umd.js +6 -6
- package/dist/src/locales/en-US.json.d.ts +2 -1
- package/dist/src/locales/index.d.ts +2 -0
- package/dist/src/locales/zh-TW.json.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/tables/BaseTable.vue +73 -66
- package/src/locales/en-US.json +2 -1
- package/src/locales/zh-TW.json +2 -1
|
@@ -37,6 +37,7 @@ export declare const messages: {
|
|
|
37
37
|
"button.delete": string;
|
|
38
38
|
"common.save": string;
|
|
39
39
|
"common.discard": string;
|
|
40
|
+
"table.empty": string;
|
|
40
41
|
};
|
|
41
42
|
'en-US': {
|
|
42
43
|
"common.select": string;
|
|
@@ -74,6 +75,7 @@ export declare const messages: {
|
|
|
74
75
|
"button.delete": string;
|
|
75
76
|
"common.save": string;
|
|
76
77
|
"common.discard": string;
|
|
78
|
+
"table.empty": string;
|
|
77
79
|
};
|
|
78
80
|
};
|
|
79
81
|
export type LocaleType = keyof typeof messages;
|
package/package.json
CHANGED
|
@@ -86,78 +86,85 @@ const elementLocale = computed(() => {
|
|
|
86
86
|
if (props.locale) {
|
|
87
87
|
return props.locale
|
|
88
88
|
}
|
|
89
|
-
// 回退:使用簡化的 composable
|
|
90
89
|
return useComponentElementLocale().value
|
|
91
90
|
})
|
|
92
91
|
</script>
|
|
93
92
|
|
|
94
93
|
<template>
|
|
95
|
-
<el-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
<!-- 選擇列 -->
|
|
112
|
-
<el-table-column v-if="showSelection" type="selection" width="60" fixed="left" align="center" />
|
|
113
|
-
|
|
114
|
-
<!-- 數據列 -->
|
|
115
|
-
<el-table-column v-for="(column, index) in columns" :key="index" v-bind="column">
|
|
116
|
-
<template #default="{ row }">
|
|
117
|
-
<div class="cell-content" @click="handleCellClick(column, row)">
|
|
118
|
-
<template v-if="column.formatter">
|
|
119
|
-
{{ column.formatter(row) }}
|
|
120
|
-
</template>
|
|
121
|
-
<component
|
|
122
|
-
v-else-if="column.template"
|
|
123
|
-
:is="{
|
|
124
|
-
setup() {
|
|
125
|
-
return () => column.template?.(row)
|
|
126
|
-
},
|
|
127
|
-
}"
|
|
128
|
-
/>
|
|
129
|
-
<span v-else-if="column.prop">{{ row[column.prop] }}</span>
|
|
130
|
-
</div>
|
|
131
|
-
</template>
|
|
132
|
-
</el-table-column>
|
|
133
|
-
<el-table-column
|
|
134
|
-
v-if="props.showCheckBtn || props.showEditBtn"
|
|
135
|
-
:width="operatorWidth"
|
|
136
|
-
align="center"
|
|
137
|
-
fixed="right"
|
|
94
|
+
<el-config-provider :locale="elementLocale">
|
|
95
|
+
<el-table
|
|
96
|
+
v-if="data.length > 0"
|
|
97
|
+
v-loading="loading"
|
|
98
|
+
:element-loading-text="t('common.loading')"
|
|
99
|
+
:data="data"
|
|
100
|
+
border
|
|
101
|
+
:show-summary="showSummary"
|
|
102
|
+
:show-overflow-tooltip="showOverFlowTooltip"
|
|
103
|
+
:summary-method="getSummaries"
|
|
104
|
+
:row-class-name="tableRowClassName"
|
|
105
|
+
class="data-table"
|
|
106
|
+
@selection-change="handleSelectionChange"
|
|
107
|
+
@current-change="(currentRow: any) => emit('current-change', currentRow)"
|
|
108
|
+
:sort="() => {}"
|
|
109
|
+
@sort-change="onSortChange"
|
|
138
110
|
>
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
v-if="
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
111
|
+
<!-- 選擇列 -->
|
|
112
|
+
<el-table-column
|
|
113
|
+
v-if="showSelection"
|
|
114
|
+
type="selection"
|
|
115
|
+
width="60"
|
|
116
|
+
fixed="left"
|
|
117
|
+
align="center"
|
|
118
|
+
/>
|
|
119
|
+
|
|
120
|
+
<!-- 數據列 -->
|
|
121
|
+
<el-table-column v-for="(column, index) in columns" :key="index" v-bind="column">
|
|
122
|
+
<template #default="{ row }">
|
|
123
|
+
<div class="cell-content" @click="handleCellClick(column, row)">
|
|
124
|
+
<template v-if="column.formatter">
|
|
125
|
+
{{ column.formatter(row) }}
|
|
126
|
+
</template>
|
|
127
|
+
<component
|
|
128
|
+
v-else-if="column.template"
|
|
129
|
+
:is="{
|
|
130
|
+
setup() {
|
|
131
|
+
return () => column.template?.(row)
|
|
132
|
+
},
|
|
133
|
+
}"
|
|
134
|
+
/>
|
|
135
|
+
<span v-else-if="column.prop">{{ row[column.prop] }}</span>
|
|
136
|
+
</div>
|
|
137
|
+
</template>
|
|
138
|
+
</el-table-column>
|
|
139
|
+
<el-table-column
|
|
140
|
+
v-if="props.showCheckBtn || props.showEditBtn"
|
|
141
|
+
:width="operatorWidth"
|
|
142
|
+
align="center"
|
|
143
|
+
fixed="right"
|
|
144
|
+
>
|
|
145
|
+
<template #default="{ row }">
|
|
146
|
+
<div class="flex items-center justify-center">
|
|
147
|
+
<p
|
|
148
|
+
class="blue-text cursor-pointer font-bold"
|
|
149
|
+
@click="handleOperateClick(row, 'check')"
|
|
150
|
+
v-if="showCheckBtn"
|
|
151
|
+
>
|
|
152
|
+
{{ t('common.view') }}
|
|
153
|
+
</p>
|
|
154
|
+
<el-divider direction="vertical" class="!mx-2" v-if="showCheckBtn && showEditBtn" />
|
|
155
|
+
<p
|
|
156
|
+
class="blue-text cursor-pointer font-bold"
|
|
157
|
+
@click="handleOperateClick(row, 'edit')"
|
|
158
|
+
v-if="showEditBtn"
|
|
159
|
+
>
|
|
160
|
+
{{ t('common.edit') }}
|
|
161
|
+
</p>
|
|
162
|
+
</div>
|
|
163
|
+
</template>
|
|
164
|
+
</el-table-column>
|
|
165
|
+
</el-table>
|
|
166
|
+
<el-empty :description="t('table.empty')" v-else />
|
|
167
|
+
</el-config-provider>
|
|
161
168
|
</template>
|
|
162
169
|
|
|
163
170
|
<style scoped lang="scss"></style>
|
package/src/locales/en-US.json
CHANGED