jianghu-ui 1.0.3 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jianghu-ui",
3
- "version": "1.0.3",
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",
@@ -1178,6 +1178,12 @@ export default {
1178
1178
  this.$nextTick(() => this.applySelectionState());
1179
1179
  }
1180
1180
  },
1181
+ actionColumn: {
1182
+ handler() {
1183
+ this.initColumns(this.headers);
1184
+ },
1185
+ deep: true
1186
+ },
1181
1187
  columnsState: {
1182
1188
  deep: true,
1183
1189
  handler(newVal) {
@@ -1216,10 +1222,31 @@ export default {
1216
1222
  methods: {
1217
1223
  // 初始化列配置
1218
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
+
1219
1246
  const persistedState = this.getPersistedColumnState();
1220
1247
  const externalState = this.columnsState?.value;
1221
1248
  const defaultVisible = this.columnsState?.defaultVisible;
1222
- this.internalColumns = headers.map(h => {
1249
+ this.internalColumns = processedHeaders.map(h => {
1223
1250
  const value = h.value || h.dataIndex || h.key;
1224
1251
  const baseVisible = h.visible !== false;
1225
1252
  const visible = this.resolveColumnVisible({