lambo-design-bi 0.0.260 → 0.0.263

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,8 +1,12 @@
1
1
  {
2
2
  "name": "lambo-design-bi",
3
- "version": "0.0.260",
3
+ "version": "0.0.263",
4
4
  "description": "Vue2 BI 数据可视化组件库",
5
5
  "main": "index.js",
6
+ "scripts": {
7
+ "publish": "pnpm publish --access public --no-git-checks",
8
+ "release": "npm version patch --no-git-tag-version && npm publish --access public"
9
+ },
6
10
  "author": "finch",
7
11
  "license": "ISC",
8
12
  "publishConfig": {
@@ -44,6 +48,5 @@
44
48
  "eslint": "^7.32.0",
45
49
  "eslint-plugin-vue": "^8.0.3",
46
50
  "vue-template-compiler": "^2.7.16"
47
- },
48
- "scripts": {}
49
- }
51
+ }
52
+ }
@@ -14,7 +14,7 @@
14
14
  </el-button>
15
15
  </div>
16
16
  <div class="select-list">
17
- <el-option v-for="(item, index) in data" :key="index" :label="item.V" :value="item.K" />
17
+ <el-option v-for="(item, index) in data" :key="index" :label="item[actualVKey]" :value="item[actualKKey]" />
18
18
  </div>
19
19
  </el-select>
20
20
  </div>
@@ -40,6 +40,26 @@ export default {
40
40
  width: {
41
41
  type: String,
42
42
  default: "250px"
43
+ },
44
+ // 选项值对应的字段名
45
+ kKey: {
46
+ type: String,
47
+ default: "K"
48
+ },
49
+ // 选项标签对应的字段名
50
+ vKey: {
51
+ type: String,
52
+ default: "V"
53
+ }
54
+ },
55
+ computed: {
56
+ // 实际使用的值字段名,未传入或非有效字符串时回退为 K
57
+ actualKKey() {
58
+ return typeof this.kKey === "string" && this.kKey ? this.kKey : "K"
59
+ },
60
+ // 实际使用的标签字段名,未传入或非有效字符串时回退为 V
61
+ actualVKey() {
62
+ return typeof this.vKey === "string" && this.vKey ? this.vKey : "V"
43
63
  }
44
64
  },
45
65
  data() {
@@ -83,7 +103,7 @@ export default {
83
103
  return
84
104
  }
85
105
 
86
- const allValues = this.data.map(item => item.K)
106
+ const allValues = this.data.map(item => item[this.actualKKey])
87
107
  this.internalValue = [...allValues]
88
108
  this.$emit('change', allValues)
89
109
  this.$emit('select-all', allValues) // 可选:触发全选事件
@@ -95,7 +115,7 @@ export default {
95
115
  return
96
116
  }
97
117
 
98
- const allValues = this.data.map(item => item.K)
118
+ const allValues = this.data.map(item => item[this.actualKKey])
99
119
  const currentValues = this.internalValue
100
120
 
101
121
  // 找出当前未选中的项目
@@ -103,7 +123,7 @@ export default {
103
123
 
104
124
  this.internalValue = [...reversedValues]
105
125
  this.$emit('change', reversedValues)
106
- this.$emit('reverse-select', reversedValues) // 可选:触发反选事件
126
+ this.$emit('reverse-select', reversedValues)
107
127
  },
108
128
 
109
129
  // select变化时触发