@ddwl/ddwl-ui 1.2.3-beta.2 → 1.2.3-beta.3

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.
Files changed (39) hide show
  1. package/dist/app.common.js +3881 -3878
  2. package/dist/app.css +17 -18
  3. package/dist/app.umd.js +17141 -17138
  4. package/dist/app.umd.min.js +4 -4
  5. package/package.json +6 -3
  6. package/src/lib/install/index.js +1 -2
  7. package/src/lib/slots/buttonGroup.vue +21 -12
  8. package/src/lib/slots/dict.vue +4 -6
  9. package/src/lib/slots/file.vue +4 -6
  10. package/src/lib/slots/icon.vue +7 -6
  11. package/src/lib/slots/index.js +1 -1
  12. package/src/main.js +1 -4
  13. package/src/packages/button/index.vue +5 -10
  14. package/src/packages/checkbox-group/index.vue +8 -18
  15. package/src/packages/descriptions/index.vue +9 -18
  16. package/src/packages/dialog/index.vue +17 -22
  17. package/src/packages/dialog-confirm/index.vue +15 -13
  18. package/src/packages/drawer/index.vue +10 -15
  19. package/src/packages/file-preview/index.vue +34 -66
  20. package/src/packages/filter-tree/index.vue +44 -42
  21. package/src/packages/form/index.vue +40 -41
  22. package/src/packages/form-item/index.vue +28 -31
  23. package/src/packages/import-file/index.vue +18 -30
  24. package/src/packages/menu/index.vue +11 -9
  25. package/src/packages/menu/menuItem.vue +28 -45
  26. package/src/packages/popconfirm/index.vue +3 -8
  27. package/src/packages/radio-group/index.vue +8 -18
  28. package/src/packages/search-form/index.vue +50 -50
  29. package/src/packages/search-input/index.vue +12 -8
  30. package/src/packages/search-table/index.vue +30 -17
  31. package/src/packages/select/index.vue +10 -16
  32. package/src/packages/svg-icon/index.vue +10 -10
  33. package/src/packages/table/index.vue +67 -80
  34. package/src/packages/upload/index.vue +92 -112
  35. package/src/utils/constant.js +1 -1
  36. package/src/utils/index.js +1 -1
  37. package/src/utils/treeLib.js +3 -13
  38. package/dist/static/fonts/element-icons.f1a45d74.ttf +0 -0
  39. package/dist/static/fonts/element-icons.ff18efd1.woff +0 -0
@@ -1,12 +1,24 @@
1
1
  <!-- 查询表格 -->
2
2
  <template>
3
- <div class="table-search-wrap">
4
- <search-form v-model="form" :config="config.searchConfig" :search-data="searchData" v-bind="$attrs"
5
- v-on="$listeners">
3
+ <div class="d-table-search-wrap">
4
+ <search-form
5
+ v-model="form"
6
+ :config="config.searchConfig"
7
+ :search-data="searchData"
8
+ v-bind="$attrs"
9
+ v-on="$listeners"
10
+ >
6
11
  <slot />
7
12
  </search-form>
8
- <d-table ref="dTable" :request-config="requestConfig" :columns="config.columns" :data="data" v-bind="$attrs"
9
- class="table-wrap" v-on="$listeners" />
13
+ <d-table
14
+ ref="dTable"
15
+ :request-config="requestConfig"
16
+ :columns="config.columns"
17
+ :data="data"
18
+ v-bind="$attrs"
19
+ class="d-table-wrap"
20
+ v-on="$listeners"
21
+ />
10
22
  </div>
11
23
  </template>
12
24
 
@@ -42,12 +54,13 @@ export default {
42
54
  const requestConfig = this.config.requestConfig
43
55
  return {
44
56
  ...requestConfig,
45
- params: typeof requestConfig.params === 'function'
46
- ? requestConfig.params(cloneDeep(this.form)) // 处理自定义参数
47
- : {
48
- ...this.form,
49
- ...requestConfig.params
50
- }
57
+ params:
58
+ typeof requestConfig.params === 'function'
59
+ ? requestConfig.params(cloneDeep(this.form)) // 处理自定义参数
60
+ : {
61
+ ...this.form,
62
+ ...requestConfig.params
63
+ }
51
64
  }
52
65
  }
53
66
  },
@@ -56,8 +69,8 @@ export default {
56
69
  },
57
70
  methods: {
58
71
  createFormBind() {
59
- const _form = {};
60
- (this.config.searchConfig || []).forEach(c => {
72
+ const _form = {}
73
+ ;(this.config.searchConfig || []).forEach((c) => {
61
74
  _form[c.prop] = c.defaultValue || ''
62
75
  })
63
76
  this.form = _form
@@ -73,19 +86,19 @@ export default {
73
86
  }
74
87
  }
75
88
  </script>
76
- <style lang="scss" scoped>
77
- .table-search-wrap {
89
+ <style lang="scss">
90
+ .d-table-search-wrap {
78
91
  height: 100%;
79
92
  width: 100%;
80
93
  overflow: hidden;
81
94
  display: flex;
82
95
  flex-direction: column;
83
96
 
84
- .table-wrap {
97
+ .d-table-wrap {
85
98
  flex: 1;
86
99
  overflow: hidden;
87
100
 
88
- :deep(.el-table) {
101
+ .el-table {
89
102
  max-height: calc(100% - 52px) !important;
90
103
  }
91
104
  }
@@ -1,11 +1,7 @@
1
1
  <!-- 下拉选择器 -->
2
2
  <template>
3
3
  <div>
4
- <el-select
5
- v-model="value"
6
- v-bind="$attrs"
7
- v-on="{...$listeners, change: onChange}"
8
- >
4
+ <el-select v-model="value" v-bind="$attrs" v-on="{ ...$listeners, change: onChange }">
9
5
  <el-option
10
6
  v-for="item in options"
11
7
  :key="item.value"
@@ -40,29 +36,28 @@ export default {
40
36
  default: () => []
41
37
  }
42
38
  },
43
- data () {
44
- return {
45
- }
39
+ data() {
40
+ return {}
46
41
  },
47
42
  computed: {
48
43
  value: {
49
- get () {
44
+ get() {
50
45
  return this.modelValue
51
46
  },
52
- set (value) {
47
+ set(value) {
53
48
  this.$emit('modelChange', value)
54
49
  }
55
50
  }
56
51
  },
57
52
  watch: {},
58
- created () {},
53
+ created() {},
59
54
  methods: {
60
- onChange (value) {
55
+ onChange(value) {
61
56
  let data
62
57
  if (Array.isArray(value)) {
63
- data = this.options.filter(i => value.includes(i.value)) || []
58
+ data = this.options.filter((i) => value.includes(i.value)) || []
64
59
  } else {
65
- data = this.options.find(i => value === i.value) || {}
60
+ data = this.options.find((i) => value === i.value) || {}
66
61
  }
67
62
  this.$emit('change', value, data)
68
63
  }
@@ -70,5 +65,4 @@ export default {
70
65
  }
71
66
  </script>
72
67
 
73
- <style lang='scss' scoped>
74
- </style>
68
+ <style lang="scss"></style>
@@ -18,10 +18,10 @@ export default {
18
18
  }
19
19
  },
20
20
  computed: {
21
- iconName () {
21
+ iconName() {
22
22
  return `#icon-${this.icon}`
23
23
  },
24
- svgClass () {
24
+ svgClass() {
25
25
  if (this.className) {
26
26
  return 'svg-icon ' + this.className
27
27
  } else {
@@ -32,12 +32,12 @@ export default {
32
32
  }
33
33
  </script>
34
34
 
35
- <style lang="scss" scoped>
36
- .svg-icon {
37
- width: 14px;
38
- height: 14px;
39
- vertical-align: -0.15em;
40
- fill: currentColor;
41
- overflow: hidden;
42
- }
35
+ <style lang="scss">
36
+ .svg-icon {
37
+ width: 14px;
38
+ height: 14px;
39
+ vertical-align: -0.15em;
40
+ fill: currentColor;
41
+ overflow: hidden;
42
+ }
43
43
  </style>
@@ -1,11 +1,6 @@
1
1
  <!-- 表格 -->
2
2
  <template>
3
- <div
4
- :key="key"
5
- v-loading="loading"
6
- class="d-table"
7
- :class="draggable && 'drag-query-table'"
8
- >
3
+ <div :key="key" v-loading="loading" class="d-table" :class="draggable && 'd-drag-query-table'">
9
4
  <el-table
10
5
  ref="table"
11
6
  :row-key="rowKey"
@@ -25,13 +20,7 @@
25
20
  align="center"
26
21
  width="50"
27
22
  />
28
- <el-table-column
29
- v-if="index"
30
- key="index"
31
- label="序号"
32
- align="center"
33
- width="55"
34
- >
23
+ <el-table-column v-if="index" key="index" label="序号" align="center" width="55">
35
24
  <template slot-scope="scope">
36
25
  {{ (pageNum - 1) * pageSize + scope.$index + 1 }}
37
26
  </template>
@@ -50,33 +39,18 @@
50
39
  :row="scope.row"
51
40
  :index="scope.$index"
52
41
  />
53
- <column-render
54
- v-else-if="column.render"
55
- :scope="scope"
56
- :render="column.render"
57
- />
42
+ <column-render v-else-if="column.render" :scope="scope" :render="column.render" />
58
43
  <template v-else>
59
44
  {{ scope.row[column.prop] }}
60
45
  </template>
61
46
  </template>
62
47
  </el-table-column>
63
- <el-table-column
64
- v-if="draggable && rowKey"
65
- label=""
66
- width="55"
67
- align="center"
68
- >
69
- <img
70
- class="table-drag-icon"
71
- src="./drag.png"
72
- >
48
+ <el-table-column v-if="draggable && rowKey" label="" width="55" align="center">
49
+ <img class="d-table-drag-icon" src="./drag.png" />
73
50
  </el-table-column>
74
51
  </el-table>
75
52
  <!-- 分页器 -->
76
- <div
77
- v-if="pagination"
78
- class="d-table-footer"
79
- >
53
+ <div v-if="pagination" class="d-table-footer">
80
54
  <div>
81
55
  <slot name="footer" />
82
56
  </div>
@@ -135,7 +109,7 @@ export default {
135
109
  },
136
110
  pageSizes: {
137
111
  type: Array,
138
- default: () => ([10, 20, 30, 50])
112
+ default: () => [10, 20, 30, 50]
139
113
  },
140
114
  background: {
141
115
  type: Boolean,
@@ -182,7 +156,7 @@ export default {
182
156
  type: Boolean
183
157
  }
184
158
  },
185
- data () {
159
+ data() {
186
160
  return {
187
161
  pageSize: 10,
188
162
  pageNum: 1,
@@ -196,13 +170,13 @@ export default {
196
170
  }
197
171
  },
198
172
  computed: {
199
- visibleColumns () {
200
- return this.columns.filter(item => !item.hide)
173
+ visibleColumns() {
174
+ return this.columns.filter((item) => !item.hide)
201
175
  }
202
176
  },
203
177
  watch: {
204
178
  data: {
205
- handler (val) {
179
+ handler(val) {
206
180
  if (JSON.stringify(val) === JSON.stringify(this.list)) {
207
181
  return
208
182
  }
@@ -217,17 +191,17 @@ export default {
217
191
  immediate: true
218
192
  },
219
193
  defaultCheckList: {
220
- handler () {
194
+ handler() {
221
195
  this.handleSelectionData()
222
196
  },
223
197
  deep: true
224
198
  }
225
199
  },
226
- mounted () {
200
+ mounted() {
227
201
  if (this.draggable && !this.rowKey) {
228
202
  console.error('[DTable] 请设置正确的 rowKey 用于拖拽排序')
229
203
  }
230
-
204
+
231
205
  this.checkedList = this.defaultCheckList
232
206
  // 如果不需要分页器,每页显示条目数设置最大
233
207
  if (!this.pagination) {
@@ -238,7 +212,10 @@ export default {
238
212
  this.initSortable()
239
213
  }
240
214
  // 是否开启自动请求
241
- if (!this.staticPaging && (this.requestConfig.autoRequest || this.requestConfig.autoRequest === undefined)) {
215
+ if (
216
+ !this.staticPaging &&
217
+ (this.requestConfig.autoRequest || this.requestConfig.autoRequest === undefined)
218
+ ) {
242
219
  this.search()
243
220
  }
244
221
  },
@@ -247,7 +224,7 @@ export default {
247
224
  * @description: 表格查询方法包装
248
225
  * @param {*} param 自定义查询条件
249
226
  */
250
- async search (param = {}) {
227
+ async search(param = {}) {
251
228
  this.loading = true
252
229
  try {
253
230
  if (param.pageNum) {
@@ -264,13 +241,19 @@ export default {
264
241
  })
265
242
  this.total = total
266
243
  this.handleRequestData(data)
267
- // eslint-disable-next-line no-empty
244
+ // eslint-disable-next-line no-empty
268
245
  } catch (e) {}
269
246
  this.loading = false
270
247
  },
271
- async getData (params) {
272
- const defaultParams = typeof this.requestConfig.params === 'function' ? this.requestConfig.params() : this.requestConfig.params
273
- const { data } = await this.requestConfig.api({ ...defaultParams, ...params })
248
+ async getData(params) {
249
+ const defaultParams =
250
+ typeof this.requestConfig.params === 'function'
251
+ ? this.requestConfig.params()
252
+ : this.requestConfig.params
253
+ const { data } = await this.requestConfig.api({
254
+ ...defaultParams,
255
+ ...params
256
+ })
274
257
  this.total = data.total
275
258
  let listData = data.list || []
276
259
  if (this.requestConfig.props) {
@@ -288,7 +271,7 @@ export default {
288
271
  /**
289
272
  * @description: 处理表格接口获取的数据
290
273
  */
291
- handleRequestData (data) {
274
+ handleRequestData(data) {
292
275
  if (this.staticPaging) {
293
276
  this.totalList = cloneDeep(data)
294
277
  this.total = this.totalList.length
@@ -320,30 +303,30 @@ export default {
320
303
  /**
321
304
  * @description: 处理表格默认勾选
322
305
  */
323
- handleSelectionData () {
306
+ handleSelectionData() {
324
307
  this.checkedList = this.defaultCheckList
325
308
  this.$refs.table && this.$refs.table.clearSelection()
326
309
  if (this.checkedList.length) {
327
- const ids = this.checkedList.map(item => item[this.rowKey])
328
- const rows = this.list.filter(item => ids.includes(item[this.rowKey]))
310
+ const ids = this.checkedList.map((item) => item[this.rowKey])
311
+ const rows = this.list.filter((item) => ids.includes(item[this.rowKey]))
329
312
  this.$nextTick(() => {
330
- rows.forEach(row => {
313
+ rows.forEach((row) => {
331
314
  this.$refs.table.toggleRowSelection(row, true)
332
315
  })
333
316
  })
334
317
  }
335
318
  },
336
- calcStaticPageData () {
319
+ calcStaticPageData() {
337
320
  const _list = JSON.parse(JSON.stringify(this.totalList))
338
321
  this.list = _list.splice((this.pageNum - 1) * this.pageSize, this.pageSize)
339
322
  },
340
- handleSizeChange (val) {
323
+ handleSizeChange(val) {
341
324
  this.pageSize = val
342
325
  this.pageNum = 1
343
326
  this.staticPaging ? this.calcStaticPageData() : this.search()
344
327
  this.$emit('page-change', { size: this.pageSize, page: this.pageNum })
345
328
  },
346
- handleCurrentChange (val) {
329
+ handleCurrentChange(val) {
347
330
  this.pageNum = val
348
331
  this.staticPaging ? this.calcStaticPageData() : this.search()
349
332
  this.$emit('page-change', { size: this.pageSize, page: this.pageNum })
@@ -353,39 +336,43 @@ export default {
353
336
  * @param {Array} list
354
337
  * @return {Array}
355
338
  */
356
- selectChange (list, row) {
339
+ selectChange(list, row) {
357
340
  if (!this.asyncSelection) {
358
341
  this.$emit('select-change', list)
359
342
  } else {
360
- if (list.some(i => i[this.rowKey] === row[this.rowKey])) {
343
+ if (list.some((i) => i[this.rowKey] === row[this.rowKey])) {
361
344
  this.checkedList.push(row)
362
345
  } else {
363
- this.checkedList = this.checkedList.filter(item => item[this.rowKey] !== row[this.rowKey])
346
+ this.checkedList = this.checkedList.filter(
347
+ (item) => item[this.rowKey] !== row[this.rowKey]
348
+ )
364
349
  }
365
350
  this.$emit('select-change', cloneDeep(this.checkedList))
366
351
  }
367
352
  },
368
- selectAllChange (list) {
353
+ selectAllChange(list) {
369
354
  if (!this.asyncSelection) {
370
355
  this.$emit('select-change', list)
371
356
  } else {
372
357
  if (list.length) {
373
- const checkedKeys = this.checkedList.map(item => item[this.rowKey])
374
- const newData = list.filter(item => !checkedKeys.includes(item[this.rowKey]))
358
+ const checkedKeys = this.checkedList.map((item) => item[this.rowKey])
359
+ const newData = list.filter((item) => !checkedKeys.includes(item[this.rowKey]))
375
360
  this.checkedList = this.checkedList.concat(newData)
376
361
  } else {
377
- const listKeys = this.list.map(item => item[this.rowKey])
378
- this.checkedList = this.checkedList.filter(item => !listKeys.includes(item[this.rowKey]))
362
+ const listKeys = this.list.map((item) => item[this.rowKey])
363
+ this.checkedList = this.checkedList.filter(
364
+ (item) => !listKeys.includes(item[this.rowKey])
365
+ )
379
366
  }
380
367
  this.$emit('select-change', cloneDeep(this.checkedList))
381
368
  }
382
369
  },
383
370
 
384
- selectionChange () {},
371
+ selectionChange() {},
385
372
  /**
386
373
  * @description: 清空用户的选择
387
374
  */
388
- clearSelection () {
375
+ clearSelection() {
389
376
  this.checkedList = []
390
377
  this.$refs.table.clearSelection()
391
378
  },
@@ -394,9 +381,9 @@ export default {
394
381
  * @param {*} value 改变选中状态的值
395
382
  * @param {*} selected 是否选中
396
383
  */
397
- toggleAsyncSelection (value, selected = false) {
398
- this.checkedList = this.checkedList.filter(item => item[this.rowKey] !== value)
399
- const data = this.list.find(item => item[this.rowKey] === value)
384
+ toggleAsyncSelection(value, selected = false) {
385
+ this.checkedList = this.checkedList.filter((item) => item[this.rowKey] !== value)
386
+ const data = this.list.find((item) => item[this.rowKey] === value)
400
387
  if (data) {
401
388
  this.$refs.table.toggleRowSelection(data, selected)
402
389
  } else {
@@ -406,7 +393,7 @@ export default {
406
393
  /**
407
394
  * @description: 表格拖拽
408
395
  */
409
- initSortable () {
396
+ initSortable() {
410
397
  const el = this.$refs.table.$el.querySelector('.el-table__body-wrapper > table > tbody')
411
398
  /* eslint-disable no-new */
412
399
  new Sortable(el, {
@@ -429,25 +416,25 @@ export default {
429
416
  }
430
417
  </script>
431
418
 
432
- <style lang="scss" scoped>
419
+ <style lang="scss">
433
420
  .d-table {
434
421
  display: flex;
435
422
  flex-direction: column;
423
+ .d-table-footer {
424
+ display: flex;
425
+ align-items: center;
426
+ justify-content: space-between;
427
+ margin-top: 16px;
428
+ }
429
+ .d-table-drag-icon {
430
+ cursor: pointer;
431
+ }
436
432
  }
437
- .drag-query-table {
438
- :deep(.hover-row) {
433
+ .d-drag-query-table {
434
+ .hover-row {
439
435
  td {
440
436
  background-color: #fff;
441
437
  }
442
438
  }
443
439
  }
444
- .table-drag-icon {
445
- cursor: pointer;
446
- }
447
- .d-table-footer {
448
- display: flex;
449
- align-items: center;
450
- justify-content: space-between;
451
- margin-top: 16px;
452
- }
453
440
  </style>