@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
@@ -8,21 +8,15 @@
8
8
  submit-btn-icon="el-icon-upload2"
9
9
  @submit="submit"
10
10
  >
11
- <el-form
12
- ref="importForm"
13
- :model="form"
14
- :inline="true"
15
- >
11
+ <el-form ref="importForm" :model="form" :inline="true">
16
12
  <el-form-item
17
13
  class="import-form-item"
18
14
  prop="file"
19
15
  label="选择文件"
20
- :rules="[
21
- { required: true, message: '请选择文件' }
22
- ]"
16
+ :rules="[{ required: true, message: '请选择文件' }]"
23
17
  >
24
- <div class="custom-file-input">
25
- <div class="custom-file-content">
18
+ <div class="d-import__custom-file-input">
19
+ <div class="d-import__custom-file-content">
26
20
  {{ form.file ? form.file.name : '请选择' }}
27
21
  </div>
28
22
  <el-upload
@@ -32,19 +26,11 @@
32
26
  action=""
33
27
  :on-change="uploadChange"
34
28
  >
35
- <el-button
36
- type="primary"
37
- icon="el-icon-folder"
38
- />
29
+ <el-button type="primary" icon="el-icon-folder" />
39
30
  </el-upload>
40
31
  </div>
41
32
  </el-form-item>
42
- <el-button
43
- v-show="templateUrl"
44
- icon="el-icon-paperclip"
45
- type="text"
46
- @click="downloadFile"
47
- >
33
+ <el-button v-show="templateUrl" icon="el-icon-paperclip" type="text" @click="downloadFile">
48
34
  模板下载
49
35
  </el-button>
50
36
  </el-form>
@@ -93,7 +79,7 @@ export default {
93
79
  type: Number
94
80
  }
95
81
  },
96
- data () {
82
+ data() {
97
83
  return {
98
84
  fileList: [],
99
85
  form: {
@@ -103,10 +89,10 @@ export default {
103
89
  },
104
90
  computed: {
105
91
  visible: {
106
- get () {
92
+ get() {
107
93
  return this.modelValue
108
94
  },
109
- set (value) {
95
+ set(value) {
110
96
  this.form.file = ''
111
97
  this.fileList = []
112
98
  this.$refs.importForm.clearValidate()
@@ -115,7 +101,7 @@ export default {
115
101
  }
116
102
  },
117
103
  methods: {
118
- downloadFile () {
104
+ downloadFile() {
119
105
  let token
120
106
  try {
121
107
  token = JSON.parse(window.localStorage.getItem('userInfo')).token
@@ -124,9 +110,11 @@ export default {
124
110
  }
125
111
  window.location.href = `${this.templateUrl}?authToken=${token}`
126
112
  },
127
- uploadChange (file, fileList) {
113
+ uploadChange(file, fileList) {
128
114
  const isLimit = file.size / 1024 / 1024 < this.fileSize
129
- const isType = this.fileType.includes(file.name.substr(file.name.lastIndexOf('.') + 1).toLocaleLowerCase())
115
+ const isType = this.fileType.includes(
116
+ file.name.substr(file.name.lastIndexOf('.') + 1).toLocaleLowerCase()
117
+ )
130
118
  if (!isType) {
131
119
  this.$message.error(`请上传正确的文件格式(${this.fileType.join('、')})`)
132
120
  return false
@@ -138,7 +126,7 @@ export default {
138
126
  this.fileList = fileList
139
127
  this.form.file = file.raw
140
128
  },
141
- async submit (callback) {
129
+ async submit(callback) {
142
130
  if (!this.form.file) {
143
131
  this.$message.error('请选择导入文件')
144
132
  callback(new Error(false))
@@ -154,11 +142,11 @@ export default {
154
142
  }
155
143
  </script>
156
144
 
157
- <style lang="scss" scoped>
158
- .custom-file-input {
145
+ <style lang="scss">
146
+ .d-import__custom-file-input {
159
147
  display: flex;
160
148
  width: 230px;
161
- .custom-file-content {
149
+ .d-import__custom-file-content {
162
150
  width: 100%;
163
151
  height: 32px;
164
152
  border: 1px solid #dcdfe6;
@@ -6,7 +6,8 @@
6
6
  :router="isVertical"
7
7
  unique-opened
8
8
  :mode="mode"
9
- @select="menuSelect">
9
+ @select="menuSelect"
10
+ >
10
11
  <menu-item v-for="item in data" :key="item.name" :data="item" :mode="mode"></menu-item>
11
12
  </el-menu>
12
13
  </template>
@@ -26,22 +27,23 @@ export default {
26
27
  default: 'vertical'
27
28
  }
28
29
  },
29
- data () {
30
+ data() {
30
31
  return {
31
32
  activeMenu: ''
32
33
  }
33
34
  },
34
35
  computed: {
35
- isVertical () {
36
+ isVertical() {
36
37
  return this.mode === 'vertical'
37
38
  }
38
39
  },
39
40
  watch: {
40
41
  '$route.path': {
41
- handler (path) {
42
+ handler(path) {
42
43
  if (!this.isVertical) {
43
- if (this.activeMenu && path.substring(0, this.activeMenu.length) === this.activeMenu) return
44
- const data = this.data.find(item => path.substring(0, item.path.length) === item.path)
44
+ if (this.activeMenu && path.substring(0, this.activeMenu.length) === this.activeMenu)
45
+ return
46
+ const data = this.data.find((item) => path.substring(0, item.path.length) === item.path)
45
47
  this.activeMenu = data?.path
46
48
  this.$emit('select', data, false)
47
49
  }
@@ -50,16 +52,16 @@ export default {
50
52
  }
51
53
  },
52
54
  methods: {
53
- menuSelect (index) {
55
+ menuSelect(index) {
54
56
  if (this.isVertical) return
55
- const data = this.data.find(item => item.path === index)
57
+ const data = this.data.find((item) => item.path === index)
56
58
  this.$emit('select', data, true)
57
59
  }
58
60
  }
59
61
  }
60
62
  </script>
61
63
 
62
- <style lang='scss' scoped>
64
+ <style lang="scss">
63
65
  .d-menu {
64
66
  height: 100%;
65
67
  }
@@ -2,45 +2,27 @@
2
2
  <template>
3
3
  <el-submenu
4
4
  v-if="mode === 'vertical' && data.children && data.children.length"
5
+ class="d-menu__submenu"
5
6
  :index="data.path"
6
7
  >
7
8
  <template slot="title">
8
- <img
9
- v-if="data.meta.icon"
10
- class="mr8 menu-icon"
11
- :src="data.meta.icon"
12
- >
9
+ <img v-if="data.meta.icon" class="mr8 menu-icon" :src="data.meta.icon" />
13
10
  <span>{{ data.meta.title }}</span>
14
11
  </template>
15
- <menu-item
16
- v-for="item in data.children"
17
- :key="item.name"
18
- :data="item"
19
- />
12
+ <menu-item v-for="item in data.children" :key="item.name" :data="item" />
20
13
  </el-submenu>
21
- <el-menu-item
22
- v-else
23
- :index="data.path"
24
- >
14
+ <el-menu-item v-else :index="data.path">
25
15
  <template slot="title">
26
- <div
27
- v-if="data.meta.icon"
28
- class="menu-icon-box"
29
- >
30
- <img
31
- class="menu-icon"
32
- :src="data.meta.icon"
33
- >
16
+ <div v-if="data.meta.icon" class="d-menu-icon-box">
17
+ <img class="d-menu-icon" :src="data.meta.icon" />
34
18
  </div>
35
19
  <span
36
20
  v-if="data.meta.isNewWindow"
37
21
  class="ml6 ellipsis flex-1"
38
22
  @click.stop="openNewWindow(data)"
39
- >{{ data.meta.title }}</span>
40
- <span
41
- v-else
42
- class="ml6 ellipsis flex-1"
43
- >{{ data.meta.title }}</span>
23
+ >{{ data.meta.title }}</span
24
+ >
25
+ <span v-else class="ml6 ellipsis flex-1">{{ data.meta.title }}</span>
44
26
  </template>
45
27
  </el-menu-item>
46
28
  </template>
@@ -59,32 +41,33 @@ export default {
59
41
  default: 'vertical'
60
42
  }
61
43
  },
62
- data () {
63
- return {
64
- }
44
+ data() {
45
+ return {}
65
46
  },
66
47
  computed: {},
67
- created () {},
48
+ created() {},
68
49
  methods: {
69
- openNewWindow (data) {
50
+ openNewWindow(data) {
70
51
  window.open(data.path, '_blank')
71
52
  }
72
53
  }
73
54
  }
74
55
  </script>
75
56
 
76
- <style lang='scss' scoped>
77
- .menu-icon-box {
78
- width: 26px;
79
- height: 26px;
80
- border-radius: 50%;
81
- background-color: #fff;
82
- display: flex;
83
- align-items: center;
84
- justify-content: center;
85
- }
86
- .menu-icon {
87
- width: 16px;
88
- height: 16px;
57
+ <style lang="scss">
58
+ .d-menu__submenu {
59
+ .d-menu-icon-box {
60
+ width: 26px;
61
+ height: 26px;
62
+ border-radius: 50%;
63
+ background-color: #fff;
64
+ display: flex;
65
+ align-items: center;
66
+ justify-content: center;
67
+ }
68
+ .d-menu-icon {
69
+ width: 16px;
70
+ height: 16px;
71
+ }
89
72
  }
90
73
  </style>
@@ -1,11 +1,6 @@
1
1
  <!-- 二次确认气泡 -->
2
2
  <template>
3
- <el-popconfirm
4
- :title="title"
5
- cancel-button-type=""
6
- icon="el-icon-warning"
7
- @confirm="confirm"
8
- >
3
+ <el-popconfirm :title="title" cancel-button-type="" icon="el-icon-warning" @confirm="confirm">
9
4
  <span slot="reference" :class="`${type}-text-btn`">{{ buttonName }}</span>
10
5
  </el-popconfirm>
11
6
  </template>
@@ -27,11 +22,11 @@ export default {
27
22
  type: String
28
23
  }
29
24
  },
30
- data () {
25
+ data() {
31
26
  return {}
32
27
  },
33
28
  methods: {
34
- confirm () {
29
+ confirm() {
35
30
  this.$emit('confirm')
36
31
  }
37
32
  }
@@ -1,15 +1,7 @@
1
1
  <!-- 单选框组 -->
2
2
  <template>
3
- <el-radio-group
4
- v-model="value"
5
- v-bind="$attrs"
6
- v-on="$listeners"
7
- >
8
- <el-radio
9
- v-for="item in options"
10
- :key="item.value"
11
- :label="item.value"
12
- >
3
+ <el-radio-group v-model="value" v-bind="$attrs" v-on="$listeners">
4
+ <el-radio v-for="item in options" :key="item.value" :label="item.value">
13
5
  {{ item.label }}
14
6
  </el-radio>
15
7
  </el-radio-group>
@@ -33,25 +25,23 @@ export default {
33
25
  default: () => []
34
26
  }
35
27
  },
36
- data () {
37
- return {
38
- }
28
+ data() {
29
+ return {}
39
30
  },
40
31
  computed: {
41
32
  value: {
42
- get () {
33
+ get() {
43
34
  return this.modelValue
44
35
  },
45
- set (value) {
36
+ set(value) {
46
37
  this.$emit('modelChange', value)
47
38
  }
48
39
  }
49
40
  },
50
41
  watch: {},
51
- created () {},
42
+ created() {},
52
43
  methods: {}
53
44
  }
54
45
  </script>
55
46
 
56
- <style lang='scss' scoped>
57
- </style>
47
+ <style lang="scss"></style>
@@ -9,14 +9,14 @@
9
9
  :span="item.span || Math.floor(24 / cell)"
10
10
  class="col-item"
11
11
  >
12
- <div class="search-item">
13
- <div class="search-item-label">
12
+ <div class="d-search-item">
13
+ <div class="d-search-item-label">
14
14
  {{ item.label }}
15
15
  </div>
16
16
  <form-item v-model="form[item.prop]" :config="item" />
17
17
  </div>
18
18
  </el-col>
19
- <el-col :span="hiddenIndex === list.length || expend ? emptySpan : 0" style="height: 68px;">
19
+ <el-col :span="hiddenIndex === list.length || expend ? emptySpan : 0" style="height: 68px">
20
20
  <span />
21
21
  </el-col>
22
22
  <el-col v-if="hasSlot && expend && !suffixSlot" :span="24 - submitSpan" class="mb16">
@@ -29,12 +29,8 @@
29
29
  }"
30
30
  class="d-search-form-btn"
31
31
  >
32
- <el-button type="primary" :disabled="searchLoading" @click="search">
33
- 查询
34
- </el-button>
35
- <el-button :disabled="searchLoading" @click="reset">
36
- 重置
37
- </el-button>
32
+ <el-button type="primary" :disabled="searchLoading" @click="search"> 查询 </el-button>
33
+ <el-button :disabled="searchLoading" @click="reset"> 重置 </el-button>
38
34
  <el-button
39
35
  v-if="list.length > hiddenIndex"
40
36
  class="expend-btn"
@@ -93,7 +89,7 @@ export default {
93
89
  type: Number
94
90
  }
95
91
  },
96
- data () {
92
+ data() {
97
93
  return {
98
94
  list: [],
99
95
  hiddenIndex: 0,
@@ -107,20 +103,20 @@ export default {
107
103
  },
108
104
  computed: {
109
105
  form: {
110
- get () {
106
+ get() {
111
107
  return this.value
112
108
  },
113
- set (value) {
109
+ set(value) {
114
110
  this.$emit('change', value)
115
111
  }
116
112
  },
117
- submitSpan () {
113
+ submitSpan() {
118
114
  return this.buttonSpan || 24 / this.cell
119
115
  },
120
- spanList () {
121
- return this.list.map(item => item.span || Math.floor(24 / this.cell)) || []
116
+ spanList() {
117
+ return this.list.map((item) => item.span || Math.floor(24 / this.cell)) || []
122
118
  },
123
- showCol () {
119
+ showCol() {
124
120
  return (index) => {
125
121
  return this.expend || index < this.hiddenIndex
126
122
  }
@@ -128,14 +124,14 @@ export default {
128
124
  },
129
125
  watch: {
130
126
  config: {
131
- handler () {
132
- this.list = this.config.filter(item => !item.hidden)
127
+ handler() {
128
+ this.list = this.config.filter((item) => !item.hidden)
133
129
  },
134
130
  deep: true,
135
131
  immediate: true
136
132
  },
137
133
  spanList: {
138
- handler (val, oldVal) {
134
+ handler(val, oldVal) {
139
135
  if (!val.length || JSON.stringify(val) === JSON.stringify(oldVal)) {
140
136
  return
141
137
  }
@@ -145,7 +141,7 @@ export default {
145
141
  immediate: true
146
142
  }
147
143
  },
148
- created () {
144
+ created() {
149
145
  initForm = cloneDeep(this.value)
150
146
  this.$nextTick(() => {
151
147
  this.hasSlot = !!(this.$slots.default && this.$slots.default.length)
@@ -156,7 +152,7 @@ export default {
156
152
  /**
157
153
  * @description: 查询
158
154
  */
159
- async search () {
155
+ async search() {
160
156
  this.$emit('search')
161
157
  if (this.searchData) {
162
158
  try {
@@ -171,7 +167,7 @@ export default {
171
167
  /**
172
168
  * @description: 重置
173
169
  */
174
- async reset () {
170
+ async reset() {
175
171
  this.form = cloneDeep(initForm)
176
172
  this.$emit('search')
177
173
  if (this.searchData) {
@@ -183,44 +179,48 @@ export default {
183
179
  /**
184
180
  * @description: 展开/收起
185
181
  */
186
- changeStatus () {
182
+ changeStatus() {
187
183
  this.expend = !this.expend
188
184
  this.$emit('expand-change', this.expend)
189
185
  },
190
- calcSpan () {
186
+ calcSpan() {
191
187
  let hiddenIndex = 1
192
- const total = this.spanList.length ? this.spanList.reduce((a, b, index) => {
193
- const sum = a + b
194
- if (hiddenIndex < 2) {
195
- if (24 - sum < this.submitSpan) {
196
- hiddenIndex = index
197
- }
198
- if (24 - sum >= this.submitSpan && index === this.spanList.length - 1) {
199
- hiddenIndex = index + 1
200
- }
201
- }
202
- return sum
203
- }) : 0
188
+ const total = this.spanList.length
189
+ ? this.spanList.reduce((a, b, index) => {
190
+ const sum = a + b
191
+ if (hiddenIndex < 2) {
192
+ if (24 - sum < this.submitSpan) {
193
+ hiddenIndex = index
194
+ }
195
+ if (24 - sum >= this.submitSpan && index === this.spanList.length - 1) {
196
+ hiddenIndex = index + 1
197
+ }
198
+ }
199
+ return sum
200
+ })
201
+ : 0
204
202
  this.hiddenIndex = hiddenIndex
205
203
 
206
- const offsetSpan = 24 - total % 24
204
+ const offsetSpan = 24 - (total % 24)
207
205
  if (this.hasSlot) {
208
206
  if (offsetSpan < this.submitSpan || offsetSpan === 24) {
209
207
  this.suffixSlot = false
210
208
  this.emptySpan = 0
211
209
  } else {
212
210
  this.suffixSlot = true
213
- this.emptySpan = offsetSpan >= this.submitSpan ? offsetSpan - this.submitSpan : 24 - this.submitSpan
211
+ this.emptySpan =
212
+ offsetSpan >= this.submitSpan ? offsetSpan - this.submitSpan : 24 - this.submitSpan
214
213
  }
215
214
  } else {
216
- this.emptySpan = offsetSpan >= this.submitSpan ? offsetSpan - this.submitSpan : 24 - this.submitSpan
215
+ this.emptySpan =
216
+ offsetSpan >= this.submitSpan ? offsetSpan - this.submitSpan : 24 - this.submitSpan
217
217
  }
218
218
  }
219
219
  }
220
220
  }
221
221
  </script>
222
222
 
223
- <style lang="scss" scoped>
223
+ <style lang="scss">
224
224
  .d-search-form {
225
225
  margin-bottom: 4px;
226
226
  .col-item {
@@ -242,16 +242,16 @@ export default {
242
242
  .expend-btn {
243
243
  padding: 4px 8px;
244
244
  }
245
- }
246
- .search-item {
247
- margin-bottom: 12px;
248
- &-label {
249
- margin-bottom: 4px;
250
- font-weight: 400;
251
- color: #333333;
252
- }
253
- :deep(.el-input__inner) {
254
- height: 32px !important;
245
+ .d-search-item {
246
+ margin-bottom: 12px;
247
+ &-label {
248
+ margin-bottom: 4px;
249
+ font-weight: 400;
250
+ color: #333333;
251
+ }
252
+ .el-input__inner {
253
+ height: 32px !important;
254
+ }
255
255
  }
256
256
  }
257
257
  </style>
@@ -5,12 +5,16 @@
5
5
  <div>
6
6
  <el-input
7
7
  v-model="value"
8
- class="search-input-container"
8
+ class="d-search-input-container"
9
9
  :placeholder="placeholder"
10
10
  :clearable="clearable"
11
11
  @keyup.enter.native="$emit('search', value)"
12
12
  >
13
- <i slot="suffix" class="el-input__icon el-icon-search pointer" @click="$emit('search', value)" />
13
+ <i
14
+ slot="suffix"
15
+ class="el-input__icon el-icon-search pointer"
16
+ @click="$emit('search', value)"
17
+ />
14
18
  </el-input>
15
19
  </div>
16
20
  </div>
@@ -38,30 +42,30 @@ export default {
38
42
  default: true
39
43
  }
40
44
  },
41
- data () {
45
+ data() {
42
46
  return {}
43
47
  },
44
48
  computed: {
45
49
  value: {
46
- get () {
50
+ get() {
47
51
  return this.modelValue
48
52
  },
49
- set (value) {
53
+ set(value) {
50
54
  this.$emit('change', value)
51
55
  }
52
56
  }
53
57
  },
54
58
  watch: {},
55
- created () {},
59
+ created() {},
56
60
  methods: {}
57
61
  }
58
62
  </script>
59
63
 
60
- <style lang='scss' scoped>
64
+ <style lang="scss">
61
65
  .d-search-input {
62
66
  display: flex;
63
67
  justify-content: space-between;
64
- .search-input-container {
68
+ .d-search-input-container {
65
69
  width: 320px;
66
70
  }
67
71
  }