doway-coms 2.8.0 → 2.8.2

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": "doway-coms",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "description": "doway组件库",
5
5
  "author": "dowaysoft",
6
6
  "main": "packages/index.js",
@@ -83,6 +83,7 @@
83
83
  :maxHeight="expandHeight"
84
84
  :show-footer="showFooter"
85
85
  @scroll="bodyScroll"
86
+ @keydown="keydownEvent"
86
87
  >
87
88
  <template v-for="item in internalColumns" #[item.field]>
88
89
  <div :key="item.field">
@@ -207,6 +208,7 @@
207
208
  :min="scope.column.numberMin"
208
209
  :max="scope.column.numberMax"
209
210
  :disabled="editDisabled(scope)"
211
+ :step="scope.column.params.step"
210
212
  />
211
213
  <div v-else>
212
214
  {{ gridDefaultValueDisplay(scope.row, scope.column) }}
@@ -1161,6 +1163,12 @@ export default {
1161
1163
  default:()=>{
1162
1164
  return null
1163
1165
  }
1166
+ },
1167
+ keyBoardNavi:{
1168
+ type:Boolean,
1169
+ default:()=>{
1170
+ return false
1171
+ }
1164
1172
  }
1165
1173
  },
1166
1174
  beforeCreate() {
@@ -1280,6 +1288,51 @@ export default {
1280
1288
  })
1281
1289
  },
1282
1290
  methods: {
1291
+ keydownEvent({$event,$grid,$table}){
1292
+ if(this.keyBoardNavi){
1293
+ const key=$event.key
1294
+ //当前行
1295
+ const record= $grid.getActiveRecord()
1296
+ if(!record)return
1297
+ const fullData= $grid.getTableData().fullData
1298
+ const currentIndex= $grid.getRowIndex(record.row)
1299
+ const columns= $grid.getColumns()
1300
+ const visibleColIndex= columns.findIndex((x,index)=>{
1301
+ return x.field==record.column.field
1302
+ })
1303
+ let row=null
1304
+ switch (key) {
1305
+ case 'ArrowUp':
1306
+ row= fullData[currentIndex-1]
1307
+ $grid.setActiveCell(row,record.column)
1308
+ $grid.setCurrentRow(row)
1309
+ break;
1310
+ case 'ArrowDown':
1311
+ row= fullData[currentIndex+1]
1312
+ $grid.setActiveCell(row,record.column)
1313
+ $grid.setCurrentRow(row)
1314
+ break;
1315
+ case 'ArrowLeft':
1316
+ row= record.row
1317
+ //左右移动的需要手动focus下
1318
+ if(columns[visibleColIndex-1].field){
1319
+ $grid.setActiveCell(row,columns[visibleColIndex-1].field).then(()=>{
1320
+ this.editActived($grid.getActiveRecord())
1321
+ })
1322
+ }
1323
+ break;
1324
+ case 'ArrowRight':
1325
+ row= record.row
1326
+ //左右移动的需要手动focus下
1327
+ if(columns[visibleColIndex+1].field){
1328
+ $grid.setActiveCell(row,columns[visibleColIndex+1].field).then(()=>{
1329
+ this.editActived($grid.getActiveRecord())
1330
+ })
1331
+ }
1332
+ break;
1333
+ }
1334
+ }
1335
+ },
1283
1336
  // 响应重新赋值列数据-用于动态列响应更新列数据,其余未考虑
1284
1337
  updateColumns() {
1285
1338
  this.internalColumns = []
@@ -1988,7 +2041,6 @@ export default {
1988
2041
  method: 'post',
1989
2042
  url: originCol.api,
1990
2043
  }).then((res) => {
1991
- console.log(res)
1992
2044
  colParams['dataSource'] = XEUtils.map(res.content, (item) => {
1993
2045
  return {
1994
2046
  value: item[originCol.value],
@@ -2009,6 +2061,10 @@ export default {
2009
2061
  }
2010
2062
  if (originCol.controlType === controlType.number) {
2011
2063
  colParams['controlEdit'] = true
2064
+ //如果启用了键盘导航 数字输入就不要跳了
2065
+ if(this.keyBoardNavi){
2066
+ colParams['step'] = 0
2067
+ }
2012
2068
  }
2013
2069
  if (originCol.controlType === controlType.date) {
2014
2070
  colParams['pastDate'] = originCol.pastDate == undefined ? true : false
@@ -702,7 +702,7 @@ export default {
702
702
  let vm = this
703
703
  this.inputTimeout = setTimeout(() => {
704
704
  //判断面板是否打开
705
- if (vm.$refs.pulldownRef.isPanelVisible() === false) {
705
+ if (vm.$refs.pulldownRef&&vm.$refs.pulldownRef.isPanelVisible() === false) {
706
706
  vm.$refs.pulldownRef.showPanel()
707
707
  }
708
708
  vm.searchData()
@@ -386,12 +386,12 @@ export default {
386
386
  }
387
387
  }
388
388
  return false
389
- },
389
+ },
390
390
  changeData(value) {
391
- if (!value) {
391
+ if (value) {
392
392
  this.$set(this.row, this.linkedField, '')
393
393
  this.$set(this.row, this.field, '')
394
- this.$emit('selectChanged', this.row)
394
+ this.$emit('change', this.row)
395
395
  }
396
396
  },
397
397
  },