@ddwl/ddwl-ui 1.2.0 → 1.2.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": "@ddwl/ddwl-ui",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "private": false,
5
5
  "main": "src/main.js",
6
6
  "style": "lib/theme/index.css",
package/src/main.js CHANGED
@@ -16,6 +16,10 @@ import SearchTable from './packages/search-table'
16
16
  import SvgIcon from './packages/svg-icon'
17
17
  import Table from './packages/table'
18
18
  import Upload from './packages/upload'
19
+ import Select from './packages/select'
20
+ import CheckboxGroup from './packages/checkbox-group'
21
+ import RadioGroup from './packages/radio-group'
22
+
19
23
  import extendComponentInstall from './lib/install/index.js'
20
24
 
21
25
  import './lib/theme/index.css'
@@ -38,7 +42,10 @@ const components = [
38
42
  SearchTable,
39
43
  SvgIcon,
40
44
  Table,
41
- Upload
45
+ Upload,
46
+ Select,
47
+ CheckboxGroup,
48
+ RadioGroup
42
49
  ]
43
50
 
44
51
  const install = (Vue, opts = {}) => {
@@ -61,7 +61,7 @@
61
61
  </template>
62
62
  </el-table-column>
63
63
  <el-table-column
64
- v-if="draggable"
64
+ v-if="draggable && rowKey"
65
65
  label=""
66
66
  width="55"
67
67
  align="center"
@@ -224,6 +224,10 @@ export default {
224
224
  }
225
225
  },
226
226
  mounted () {
227
+ if (this.draggable && !this.rowKey) {
228
+ console.error('[DTable] 请设置正确的 rowKey 用于拖拽排序')
229
+ }
230
+
227
231
  this.checkedList = this.defaultCheckList
228
232
  // 如果不需要分页器,每页显示条目数设置最大
229
233
  if (!this.pagination) {
@@ -409,13 +413,11 @@ export default {
409
413
  handle: '.table-drag-icon',
410
414
  onEnd: (evt) => {
411
415
  // 拖拽后数据位置置换
412
- const oldList = JSON.parse(JSON.stringify(this.list))
413
- const data = oldList.splice(evt.oldIndex, 1)
414
- oldList.splice(evt.newIndex, 0, data[0])
415
- this.list = oldList
416
- // this.key++
416
+ const data = this.list.splice(evt.oldIndex, 1)[0]
417
+ this.list.splice(evt.newIndex, 0, data)
418
+
417
419
  this.$nextTick(() => {
418
- // 改变key值table重新渲染导致拖拽功能消失,需要重新初始化sorable实例
420
+ // 重新初始化table
419
421
  this.initSortable()
420
422
  this.handleSelectionData()
421
423
  this.$emit('drag-change', this.list, evt)
@@ -277,8 +277,6 @@ export default {
277
277
  },
278
278
  uploadRemove (file) {
279
279
  this.value = this.value.filter(item => item.fileUrl !== file.fileUrl)
280
- // const index = this.value.findIndex((item) => item.fileUrl === file.fileUrl)
281
- // index > -1 && this.value.splice(index, 1)
282
280
  this.$parent.$emit('el.form.change')
283
281
  },
284
282
  picturePreview (index) {