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

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,6 +1,6 @@
1
1
  <!-- 上传组件 -->
2
2
  <template>
3
- <div>
3
+ <div class="d-upload">
4
4
  <div
5
5
  v-show="imgOrVideoList.length || !readonly"
6
6
  ref="imgList"
@@ -37,11 +37,7 @@
37
37
  >
38
38
  <i class="el-icon-video-play" />
39
39
  </span>
40
- <span
41
- v-show="!readonly"
42
- class="el-upload-list__item-delete"
43
- @click="uploadRemove(file)"
44
- >
40
+ <span v-show="!readonly" class="el-upload-list__item-delete" @click="uploadRemove(file)">
45
41
  <i class="el-icon-delete" />
46
42
  </span>
47
43
  </span>
@@ -54,9 +50,7 @@
54
50
  <el-upload
55
51
  ref="fileUpload"
56
52
  class="custom-upload-files"
57
- :class="
58
- showFileList && list.length >= limit && 'custom-upload-files-limit'
59
- "
53
+ :class="showFileList && list.length >= limit && 'custom-upload-files-limit'"
60
54
  v-bind="$attrs"
61
55
  :show-file-list="false"
62
56
  action="#"
@@ -68,10 +62,7 @@
68
62
  :on-error="uploadError"
69
63
  v-on="$listeners"
70
64
  >
71
- <div
72
- slot="default"
73
- class="custom-upload-files-content"
74
- >
65
+ <div slot="default" class="custom-upload-files-content">
75
66
  <i class="el-icon-plus" />
76
67
  </div>
77
68
  </el-upload>
@@ -93,29 +84,19 @@
93
84
  {{ file.name || file.fileName }}
94
85
  </a>
95
86
  <label class="el-upload-list__item-status-label">
96
- <i
97
- v-show="!readonly"
98
- class="el-icon-upload-success el-icon-circle-check"
99
- />
87
+ <i v-show="!readonly" class="el-icon-upload-success el-icon-circle-check" />
100
88
  </label>
101
- <i
102
- v-show="!readonly"
103
- class="el-icon-close"
104
- @click="uploadRemove(file)"
105
- />
89
+ <i v-show="!readonly" class="el-icon-close" @click="uploadRemove(file)" />
106
90
  </div>
107
91
  </div>
108
- <div
109
- v-show="!readonly"
110
- slot="tip"
111
- class="el-upload__tip"
112
- >
113
- 文件大小不超过 {{ limitSizeText }} , 支持扩展名: {{ (_calcLimitType(limitType) || []).join(' ') }}
92
+ <div v-show="!readonly" slot="tip" class="el-upload__tip">
93
+ 文件大小不超过 {{ limitSizeText }} , 支持扩展名:
94
+ {{ (_calcLimitType(limitType) || []).join(' ') }}
114
95
  </div>
115
96
  <file-preview
116
97
  v-if="previewVisible"
117
98
  :default-index="preveiwIndex"
118
- :list="imgOrVideoList.map(i=> i.fileUrl)"
99
+ :list="imgOrVideoList.map((i) => i.fileUrl)"
119
100
  @close="previewVisible = false"
120
101
  />
121
102
  </div>
@@ -126,7 +107,7 @@ import { get } from 'lodash'
126
107
  import videoBg from '../../assets/video-play.jpeg'
127
108
  import { convertBytesToSize } from '@/utils'
128
109
  import FilePreview from '../file-preview/index.vue'
129
- import {imgExts, videoExts, fileExts} from '../../utils/constant'
110
+ import { imgExts, videoExts, fileExts } from '../../utils/constant'
130
111
  export default {
131
112
  name: 'DUpload',
132
113
  components: { FilePreview },
@@ -176,7 +157,7 @@ export default {
176
157
  type: Function
177
158
  }
178
159
  },
179
- data () {
160
+ data() {
180
161
  return {
181
162
  list: [],
182
163
  dialogVisible: false,
@@ -188,43 +169,44 @@ export default {
188
169
  },
189
170
  computed: {
190
171
  value: {
191
- get () {
192
- if (this.modelValue && this.modelValue.length && this.modelValue.some(v => typeof v === 'string')) {
193
- return this.modelValue.filter(url => url).map(url => this._urlToObj(url))
172
+ get() {
173
+ if (
174
+ this.modelValue &&
175
+ this.modelValue.length &&
176
+ this.modelValue.some((v) => typeof v === 'string')
177
+ ) {
178
+ return this.modelValue.filter((url) => url).map((url) => this._urlToObj(url))
194
179
  } else {
195
180
  return this.modelValue || []
196
181
  }
197
182
  },
198
- set (value) {
183
+ set(value) {
199
184
  this.$emit('change', value)
200
185
  }
201
186
  },
202
- imgOrVideoList () {
203
- return this.value.filter(
204
- (item) => this._hasFileType(imgExts.concat(videoExts), item)
205
- )
187
+ imgOrVideoList() {
188
+ return this.value.filter((item) => this._hasFileType(imgExts.concat(videoExts), item))
206
189
  },
207
- restFileList () {
190
+ restFileList() {
208
191
  return this.value.filter((item) => !this._hasFileType(imgExts.concat(videoExts), item))
209
192
  },
210
- limitSizeText () {
193
+ limitSizeText() {
211
194
  return convertBytesToSize(Number(this.limitSize || 5) * 1024 * 1024)
212
195
  }
213
196
  },
214
- mounted () {
215
- },
197
+ mounted() {},
216
198
  methods: {
217
- _hasFileType (files, item) {
199
+ _hasFileType(files, item) {
218
200
  if (!item.fileExt) {
219
201
  return false
220
202
  }
221
203
  return files.includes(item.fileExt.toLowerCase())
222
204
  },
223
- _calcLimitType (limitType) {
224
- if (typeof limitType === 'string') return limitType.split(',').map(l => l.trim())
205
+ _calcLimitType(limitType) {
206
+ if (typeof limitType === 'string') return limitType.split(',').map((l) => l.trim())
225
207
  return limitType
226
208
  },
227
- _urlToObj (url) {
209
+ _urlToObj(url) {
228
210
  if (typeof url !== 'string') return url
229
211
  const name = url.substring(url.lastIndexOf('/') + 1, url.length) // 最后的文件名截取出来
230
212
  const fileExt = url.substring(url.lastIndexOf('.') + 1)
@@ -235,23 +217,19 @@ export default {
235
217
  fileUrl: url
236
218
  }
237
219
  },
238
- async uploadRequest (data) {
220
+ async uploadRequest(data) {
239
221
  const formData = new FormData()
240
222
  formData.append('file', data.file)
241
223
  const res = await this.$DDWL.upload(formData)
242
224
  return res
243
225
  },
244
- beforeUpload (file) {
226
+ beforeUpload(file) {
245
227
  const isLimit = file.size / 1024 / 1024 < this.limitSize
246
228
  const limitType = this._calcLimitType(this.limitType)
247
- const isType = limitType.includes(
248
- file.name.substr(file.name.lastIndexOf('.') + 1)
249
- )
229
+ const isType = limitType.includes(file.name.substr(file.name.lastIndexOf('.') + 1))
250
230
 
251
231
  if (!isType) {
252
- this.$message.error(
253
- `请上传正确的文件格式(${limitType.join('、')})`
254
- )
232
+ this.$message.error(`请上传正确的文件格式(${limitType.join('、')})`)
255
233
  return false
256
234
  }
257
235
  if (!isLimit) {
@@ -259,7 +237,7 @@ export default {
259
237
  return false
260
238
  }
261
239
  },
262
- uploadSuccess (res, file) {
240
+ uploadSuccess(res, file) {
263
241
  if (res.code === 200) {
264
242
  this.value = this.value.concat({
265
243
  ...file,
@@ -272,14 +250,14 @@ export default {
272
250
  this.$message.error(res.message)
273
251
  }
274
252
  },
275
- uploadError (res) {
253
+ uploadError(res) {
276
254
  console.log('upload error', res)
277
255
  },
278
- uploadRemove (file) {
279
- this.value = this.value.filter(item => item.fileUrl !== file.fileUrl)
256
+ uploadRemove(file) {
257
+ this.value = this.value.filter((item) => item.fileUrl !== file.fileUrl)
280
258
  this.$parent.$emit('el.form.change')
281
259
  },
282
- picturePreview (index) {
260
+ picturePreview(index) {
283
261
  this.preveiwIndex = index
284
262
  this.previewVisible = true
285
263
  }
@@ -287,64 +265,66 @@ export default {
287
265
  }
288
266
  </script>
289
267
 
290
- <style lang='scss' scoped>
291
- .custom-upload-files-content {
292
- display: inline-block;
293
- width: 80px;
294
- height: 80px;
295
- text-align: center;
296
- & > span {
297
- line-height: 16px;
298
- margin-top: 4px;
299
- color: #999;
300
- font-size: 12px;
301
- }
302
- i {
268
+ <style lang="scss">
269
+ .d-upload {
270
+ .custom-upload-files-content {
271
+ display: inline-block;
272
+ width: 80px;
273
+ height: 80px;
303
274
  text-align: center;
275
+ & > span {
276
+ line-height: 16px;
277
+ margin-top: 4px;
278
+ color: #999;
279
+ font-size: 12px;
280
+ }
281
+ i {
282
+ text-align: center;
283
+ }
304
284
  }
305
- }
306
- .custom-upload-files {
307
- display: inline-block;
308
- }
309
- .custom-upload-files-limit {
310
- :deep(.el-upload--picture-card) {
311
- display: none;
285
+ .custom-upload-files {
286
+ display: inline-block;
312
287
  }
313
- }
314
- .img-list {
315
- padding-left: 3px;
316
- display: block;
317
- line-height: 1;
318
- .img-part {
319
- width: 80px;
320
- height: 80px;
288
+ .custom-upload-files-limit {
289
+ .el-upload--picture-card {
290
+ display: none;
291
+ }
321
292
  }
322
- }
323
- .file-list {
324
- :deep(.el-upload-list__item:first-child) {
325
- margin-top: -5px;
293
+ .img-list {
294
+ padding-left: 3px;
295
+ display: block;
296
+ line-height: 1;
297
+ .img-part {
298
+ width: 80px;
299
+ height: 80px;
300
+ }
326
301
  }
327
- }
328
- :deep(.upload-preview-dialog) {
329
- margin-top: 0vh !important;
330
- max-height: 90vh;
331
- max-width: 80%;
332
- min-width: 150px;
333
- min-height: 150px;
334
- width: inherit;
335
- display: flex;
336
- flex-direction: column;
337
- .el-dialog__body {
338
- flex: 1;
339
- overflow: auto;
340
- text-align: center;
341
- img{
342
- max-height: 65vh;
302
+ .file-list {
303
+ .el-upload-list__item:first-child {
304
+ margin-top: -5px;
343
305
  }
344
306
  }
345
- }
346
- .el-upload__tip {
347
- line-height: 20px;
348
- margin-top: 0;
307
+ .upload-preview-dialog {
308
+ margin-top: 0vh !important;
309
+ max-height: 90vh;
310
+ max-width: 80%;
311
+ min-width: 150px;
312
+ min-height: 150px;
313
+ width: inherit;
314
+ display: flex;
315
+ flex-direction: column;
316
+ .el-dialog__body {
317
+ flex: 1;
318
+ overflow: auto;
319
+ text-align: center;
320
+ img {
321
+ max-height: 65vh;
322
+ }
323
+ }
324
+ }
325
+ .el-upload__tip {
326
+ line-height: 20px;
327
+ margin-top: 0;
328
+ }
349
329
  }
350
330
  </style>
@@ -1,4 +1,4 @@
1
1
  export const imgExts = ['png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'svg']
2
2
  export const videoExts = ['mp4']
3
3
  export const audioExts = ['mp3', 'wav', 'ogg']
4
- export const fileExts = ['doc', 'docx', 'pdf']
4
+ export const fileExts = ['doc', 'docx', 'pdf']
@@ -22,7 +22,7 @@ export const convertBytesToSize = (bytes) => {
22
22
  * @param {*} name 参数名称
23
23
  * @return {string}
24
24
  */
25
- export function getQueryString (name) {
25
+ export function getQueryString(name) {
26
26
  const href = window.location.href
27
27
  /*eslint-disable */
28
28
  const reg = new RegExp(name + '=[^&|#|\/]*')
@@ -125,12 +125,7 @@ export const deleteNode = (data, value, self = true, props = {}) => {
125
125
  if (arr.length === data.length) {
126
126
  arr = arr.map((node) => {
127
127
  if (node[props.children] && node[props.children].length) {
128
- node[props.children] = deleteNode(
129
- node[props.children],
130
- value,
131
- self,
132
- props
133
- )
128
+ node[props.children] = deleteNode(node[props.children], value, self, props)
134
129
  }
135
130
  return node
136
131
  })
@@ -141,12 +136,7 @@ export const deleteNode = (data, value, self = true, props = {}) => {
141
136
  delete node[props.children]
142
137
  }
143
138
  if (node[props.children] && node[props.children].length) {
144
- node[props.children] = deleteNode(
145
- node[props.children],
146
- value,
147
- self,
148
- props
149
- )
139
+ node[props.children] = deleteNode(node[props.children], value, self, props)
150
140
  }
151
141
  return node
152
142
  })
@@ -166,7 +156,7 @@ export const filterNodeMethod = (value, data = [], type = 'fuzzy', props = {}) =
166
156
  props = _getProps(props)
167
157
  let newarr = []
168
158
  data.forEach((node) => {
169
- if (type === 'fuzzy' ? (node[props.key].indexOf(value) > -1) : node[props.key] === value) {
159
+ if (type === 'fuzzy' ? node[props.key].indexOf(value) > -1 : node[props.key] === value) {
170
160
  const ab = filterNodeMethod(value, node[props.children], type, props)
171
161
  const obj = {
172
162
  ...node,