jianghu-ui 1.0.2 → 1.0.4
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/jianghu-ui.css +92 -57
- package/dist/jianghu-ui.js +1 -1
- package/package.json +5 -2
- package/src/components/JhTable/JhTable.vue +66 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jianghu-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "JianghuJS UI Component Library with Storybook, Vue 2, and Vuetify 2",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
"build": "webpack --config webpack.config.js",
|
|
10
10
|
"build:watch": "webpack --config webpack.config.js --watch",
|
|
11
11
|
"serve-storybook": "npx http-server storybook-static",
|
|
12
|
-
"deploy": "npm run build && npm run build-storybook && npx gh-pages -d storybook-static"
|
|
12
|
+
"deploy": "npm run build && npm run build-storybook && npx gh-pages -d storybook-static",
|
|
13
|
+
"release:patch": "npm version patch && npm run build && npm publish",
|
|
14
|
+
"release:minor": "npm version minor && npm run build && npm publish",
|
|
15
|
+
"release:major": "npm version major && npm run build && npm publish"
|
|
13
16
|
},
|
|
14
17
|
"keywords": [
|
|
15
18
|
"jianghujs",
|
|
@@ -117,6 +117,17 @@
|
|
|
117
117
|
clearable
|
|
118
118
|
></v-text-field>
|
|
119
119
|
|
|
120
|
+
<!-- 导出按钮 -->
|
|
121
|
+
<v-btn
|
|
122
|
+
v-if="toolbarConfig.export"
|
|
123
|
+
icon
|
|
124
|
+
small
|
|
125
|
+
@click="handleExport"
|
|
126
|
+
title="导出"
|
|
127
|
+
>
|
|
128
|
+
<v-icon>mdi-export-variant</v-icon>
|
|
129
|
+
</v-btn>
|
|
130
|
+
|
|
120
131
|
<!-- 刷新按钮 -->
|
|
121
132
|
<v-btn
|
|
122
133
|
v-if="toolbarConfig.refresh"
|
|
@@ -244,7 +255,7 @@
|
|
|
244
255
|
:single-select="singleSelectComputed"
|
|
245
256
|
:value="selectedItems"
|
|
246
257
|
:item-key="rowKey"
|
|
247
|
-
:dense="
|
|
258
|
+
:dense="tableDense"
|
|
248
259
|
:multi-sort="multiSort"
|
|
249
260
|
:must-sort="mustSort"
|
|
250
261
|
:sort-by="internalSortBy"
|
|
@@ -964,6 +975,7 @@ export default {
|
|
|
964
975
|
setting: true,
|
|
965
976
|
density: true,
|
|
966
977
|
fullscreen: false,
|
|
978
|
+
export: false, // Default to false, can be enabled via prop
|
|
967
979
|
...this.toolbar
|
|
968
980
|
};
|
|
969
981
|
}
|
|
@@ -972,7 +984,8 @@ export default {
|
|
|
972
984
|
refresh: true,
|
|
973
985
|
setting: true,
|
|
974
986
|
density: true,
|
|
975
|
-
fullscreen: false
|
|
987
|
+
fullscreen: false,
|
|
988
|
+
export: false // Default to false
|
|
976
989
|
};
|
|
977
990
|
},
|
|
978
991
|
// 可见的表头
|
|
@@ -992,6 +1005,15 @@ export default {
|
|
|
992
1005
|
}
|
|
993
1006
|
];
|
|
994
1007
|
},
|
|
1008
|
+
tableDense() {
|
|
1009
|
+
if (this.currentDensity === 'compact') {
|
|
1010
|
+
return true;
|
|
1011
|
+
}
|
|
1012
|
+
// For 'medium' and 'default', we don't use the dense prop, but a custom class.
|
|
1013
|
+
// But we still respect the component's `dense` prop as a baseline.
|
|
1014
|
+
return this.dense;
|
|
1015
|
+
},
|
|
1016
|
+
|
|
995
1017
|
// 密度样式类
|
|
996
1018
|
densityClass() {
|
|
997
1019
|
return {
|
|
@@ -1156,6 +1178,12 @@ export default {
|
|
|
1156
1178
|
this.$nextTick(() => this.applySelectionState());
|
|
1157
1179
|
}
|
|
1158
1180
|
},
|
|
1181
|
+
actionColumn: {
|
|
1182
|
+
handler() {
|
|
1183
|
+
this.initColumns(this.headers);
|
|
1184
|
+
},
|
|
1185
|
+
deep: true
|
|
1186
|
+
},
|
|
1159
1187
|
columnsState: {
|
|
1160
1188
|
deep: true,
|
|
1161
1189
|
handler(newVal) {
|
|
@@ -1194,10 +1222,31 @@ export default {
|
|
|
1194
1222
|
methods: {
|
|
1195
1223
|
// 初始化列配置
|
|
1196
1224
|
initColumns(headers) {
|
|
1225
|
+
const processedHeaders = [...(headers || [])];
|
|
1226
|
+
|
|
1227
|
+
if (this.actionColumn) {
|
|
1228
|
+
const hasActionColumn = processedHeaders.some(h => h.value === 'action');
|
|
1229
|
+
|
|
1230
|
+
if (!hasActionColumn) {
|
|
1231
|
+
const actionColumnConfig = {
|
|
1232
|
+
text: '操作', value: 'action', sortable: false, width: 120, align: 'center', class: 'fixed', cellClass: 'fixed'
|
|
1233
|
+
};
|
|
1234
|
+
|
|
1235
|
+
if (typeof this.actionColumn === 'object' && this.actionColumn !== null) {
|
|
1236
|
+
const { title, ...restOfActionColumn } = this.actionColumn;
|
|
1237
|
+
Object.assign(actionColumnConfig, restOfActionColumn);
|
|
1238
|
+
if (title) {
|
|
1239
|
+
actionColumnConfig.text = title;
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
processedHeaders.push(actionColumnConfig);
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1197
1246
|
const persistedState = this.getPersistedColumnState();
|
|
1198
1247
|
const externalState = this.columnsState?.value;
|
|
1199
1248
|
const defaultVisible = this.columnsState?.defaultVisible;
|
|
1200
|
-
this.internalColumns =
|
|
1249
|
+
this.internalColumns = processedHeaders.map(h => {
|
|
1201
1250
|
const value = h.value || h.dataIndex || h.key;
|
|
1202
1251
|
const baseVisible = h.visible !== false;
|
|
1203
1252
|
const visible = this.resolveColumnVisible({
|
|
@@ -1463,6 +1512,10 @@ export default {
|
|
|
1463
1512
|
this.emitColumnStateChange();
|
|
1464
1513
|
this.$forceUpdate();
|
|
1465
1514
|
},
|
|
1515
|
+
// 导出表格
|
|
1516
|
+
handleExport() {
|
|
1517
|
+
this.$emit('export');
|
|
1518
|
+
},
|
|
1466
1519
|
// 刷新表格
|
|
1467
1520
|
async handleRefresh() {
|
|
1468
1521
|
this.$emit('refresh');
|
|
@@ -2000,6 +2053,16 @@ export default {
|
|
|
2000
2053
|
flex: 1;
|
|
2001
2054
|
}
|
|
2002
2055
|
|
|
2056
|
+
/* --- 密度调整 --- */
|
|
2057
|
+
/* 中等密度 */
|
|
2058
|
+
.jh-pro-table ::v-deep .jh-table-medium.v-data-table > .v-data-table__wrapper > table > thead > tr > th {
|
|
2059
|
+
height: 40px;
|
|
2060
|
+
}
|
|
2061
|
+
.jh-pro-table ::v-deep .jh-table-medium.v-data-table > .v-data-table__wrapper > table > tbody > tr > td {
|
|
2062
|
+
height: 40px;
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
|
|
2003
2066
|
.jh-pro-table-header-right {
|
|
2004
2067
|
display: flex;
|
|
2005
2068
|
align-items: center;
|