@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
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@ddwl/ddwl-ui",
3
- "version": "1.2.3-beta.2",
3
+ "version": "1.2.3-beta.3",
4
4
  "private": false,
5
5
  "main": "dist/app.common.js",
6
- "style": "lib/theme/index.css",
6
+ "style": "dist/app.css",
7
7
  "description": "ddwl组件库",
8
8
  "author": "dingshengfei",
9
9
  "license": "MIT",
@@ -15,7 +15,8 @@
15
15
  "registry": "https://registry.npmjs.org"
16
16
  },
17
17
  "scripts": {
18
- "dev": "vue-cli-service serve",
18
+ "lint": "vue-cli-service lint",
19
+ "dev": "vue-cli-service lint && vue-cli-service serve",
19
20
  "build": "vue-cli-service build --target lib --name app src/main.js",
20
21
  "release": "bumpp -r && npm publish --access=public"
21
22
  },
@@ -43,6 +44,8 @@
43
44
  "bumpp": "^10.2.0",
44
45
  "conventional-changelog-cli": "^5.0.0",
45
46
  "eslint": "^7.32.0",
47
+ "eslint-config-prettier": "^10.1.8",
48
+ "eslint-plugin-prettier": "^5.5.4",
46
49
  "eslint-plugin-vue": "^8.0.3",
47
50
  "vue-template-compiler": "^2.6.14"
48
51
  },
@@ -1,7 +1,6 @@
1
1
  import previewVue from '../../packages/file-preview/index.vue'
2
2
 
3
3
  export default (Vue) => {
4
-
5
4
  // 文件预览
6
5
  Vue.prototype.$preview = ({ defaultIndex = 0, list = [] }) => {
7
6
  const Preview = Vue.extend(previewVue)
@@ -11,4 +10,4 @@ export default (Vue) => {
11
10
  instance.defaultIndex = defaultIndex
12
11
  instance.list = list
13
12
  }
14
- }
13
+ }
@@ -13,15 +13,24 @@
13
13
  :button-name="btn.name"
14
14
  :button-type="btn.type"
15
15
  :disabled="typeof btn.disabled === 'function' ? btn.disabled(row) : btn.disabled"
16
- @submit="(callback) => { btn.method(callback, row, index) }"
16
+ @submit="
17
+ (callback) => {
18
+ btn.method(callback, row, index)
19
+ }
20
+ "
17
21
  >
18
22
  {{ typeof btn.title === 'function' ? btn.title(row) : btn.title }}
19
23
  </dialog-confirm>
20
24
  <span
21
25
  v-else
22
- :class="`${btn.type === 'danger' ? 'danger-text-btn' : 'primary-text-btn'} ${(typeof btn.disabled === 'function' ? btn.disabled(row) : btn.disabled) ? 'disabled' : ''}`"
26
+ :class="`${btn.type === 'danger' ? 'danger-text-btn' : 'primary-text-btn'} ${
27
+ (typeof btn.disabled === 'function' ? btn.disabled(row) : btn.disabled)
28
+ ? 'disabled'
29
+ : ''
30
+ }`"
23
31
  @click="btn.method(row, index)"
24
- >{{ btn.name }}</span>
32
+ >{{ btn.name }}</span
33
+ >
25
34
  </span>
26
35
  </template>
27
36
  <el-dropdown
@@ -67,7 +76,7 @@ export default {
67
76
  default: -1
68
77
  }
69
78
  },
70
- data () {
79
+ data() {
71
80
  return {
72
81
  buttons: [],
73
82
  dropdownButtons: []
@@ -76,10 +85,10 @@ export default {
76
85
  computed: {},
77
86
  watch: {
78
87
  list: {
79
- handler () {
88
+ handler() {
80
89
  if (this.list.length) {
81
- this.buttons = this.list.filter(btn => !btn.dropdown)
82
- this.dropdownButtons = this.list.filter(btn => btn.dropdown)
90
+ this.buttons = this.list.filter((btn) => !btn.dropdown)
91
+ this.dropdownButtons = this.list.filter((btn) => btn.dropdown)
83
92
  } else {
84
93
  this.buttons = []
85
94
  this.dropdownButtons = []
@@ -89,23 +98,23 @@ export default {
89
98
  immediate: true
90
99
  }
91
100
  },
92
- created () { },
101
+ created() {},
93
102
  methods: {
94
- commandChange (value) {
95
- const button = this.dropdownButtons.find(btn => btn.name === value)
103
+ commandChange(value) {
104
+ const button = this.dropdownButtons.find((btn) => btn.name === value)
96
105
  button.method(this.row)
97
106
  }
98
107
  }
99
108
  }
100
109
  </script>
101
110
 
102
- <style lang='scss' scoped>
111
+ <style lang="scss">
103
112
  .button-group-item + .button-group-item {
104
113
  margin-left: 8px;
105
114
  }
106
115
  .el-dropdown-link {
107
116
  cursor: pointer;
108
- color: #409EFF;
117
+ color: #409eff;
109
118
  }
110
119
  .el-icon-arrow-down {
111
120
  font-size: 12px;
@@ -23,12 +23,11 @@ export default {
23
23
  default: ''
24
24
  }
25
25
  },
26
- data () {
27
- return {
28
- }
26
+ data() {
27
+ return {}
29
28
  },
30
29
  computed: {
31
- dictText () {
30
+ dictText() {
32
31
  if (Array.isArray(this.row[this.prop])) {
33
32
  const result = this.$DDWL.enum.getLabels(this.code, this.row[this.prop])
34
33
  return result?.length ? result.join(',') : ''
@@ -42,5 +41,4 @@ export default {
42
41
  }
43
42
  </script>
44
43
 
45
- <style lang='scss' scoped>
46
- </style>
44
+ <style lang="scss"></style>
@@ -21,16 +21,14 @@ export default {
21
21
  default: ''
22
22
  }
23
23
  },
24
- data () {
25
- return {
26
- }
24
+ data() {
25
+ return {}
27
26
  },
28
27
  computed: {},
29
28
  watch: {},
30
- created () {},
29
+ created() {},
31
30
  methods: {}
32
31
  }
33
32
  </script>
34
33
 
35
- <style lang='scss' scoped>
36
- </style>
34
+ <style lang="scss"></style>
@@ -3,7 +3,7 @@
3
3
  <div class="icon-slot">
4
4
  <div v-for="({ icon, type, color }, index) in list" :key="index">
5
5
  <!-- image -->
6
- <img v-if="type === 'image'" class="icon-image" :src="icon" alt="">
6
+ <img v-if="type === 'image'" class="icon-image" :src="icon" alt="" />
7
7
  <!-- svg -->
8
8
  <svg-icon v-else-if="type === 'svg'" :style="{ color }" class="icon-svg" :icon="icon" />
9
9
  <!-- iconfont -->
@@ -34,11 +34,11 @@ export default {
34
34
  default: () => []
35
35
  }
36
36
  },
37
- data () {
37
+ data() {
38
38
  return {}
39
39
  },
40
40
  computed: {
41
- list () {
41
+ list() {
42
42
  if (typeof this.icons === 'function') {
43
43
  return this.icons(this.row)
44
44
  } else {
@@ -46,12 +46,12 @@ export default {
46
46
  }
47
47
  }
48
48
  },
49
- created () {},
49
+ created() {},
50
50
  methods: {}
51
51
  }
52
52
  </script>
53
53
 
54
- <style lang='scss' scoped>
54
+ <style lang="scss">
55
55
  .icon-slot {
56
56
  display: flex;
57
57
  align-items: center;
@@ -60,7 +60,8 @@ export default {
60
60
  height: 20px;
61
61
  margin-right: 4px;
62
62
  }
63
- .icon-svg, .icon-iconfont {
63
+ .icon-svg,
64
+ .icon-iconfont {
64
65
  font-size: 18px;
65
66
  margin-right: 4px;
66
67
  }
@@ -1,7 +1,7 @@
1
1
  const modules = {}
2
2
  const requireComponent = require.context('../slots', true, /.vue$/)
3
3
 
4
- requireComponent.keys().forEach(file => {
4
+ requireComponent.keys().forEach((file) => {
5
5
  const componentConfig = requireComponent(file)
6
6
  const components = componentConfig.default || componentConfig
7
7
 
package/src/main.js CHANGED
@@ -22,8 +22,6 @@ import RadioGroup from './packages/radio-group'
22
22
 
23
23
  import extendComponentInstall from './lib/install/index.js'
24
24
 
25
- import './lib/theme/index.css'
26
-
27
25
  const components = [
28
26
  Button,
29
27
  Descriptions,
@@ -49,7 +47,6 @@ const components = [
49
47
  ]
50
48
 
51
49
  const install = (Vue, opts = {}) => {
52
-
53
50
  Vue.prototype.$DDWL = {
54
51
  upload: opts.upload,
55
52
  enum: opts.enum
@@ -67,4 +64,4 @@ if (typeof window !== 'undefined' && window.Vue) {
67
64
 
68
65
  export default {
69
66
  install
70
- }
67
+ }
@@ -1,10 +1,6 @@
1
1
  <!-- 按钮 -->
2
2
  <template>
3
- <el-button
4
- v-bind="$attrs"
5
- :loading="loading"
6
- @click="handleClick"
7
- >
3
+ <el-button v-bind="$attrs" :loading="loading" @click="handleClick">
8
4
  <slot />
9
5
  </el-button>
10
6
  </template>
@@ -13,16 +9,16 @@
13
9
  export default {
14
10
  name: 'DButton',
15
11
  components: {},
16
- data () {
12
+ data() {
17
13
  return {
18
14
  loading: false
19
15
  }
20
16
  },
21
17
  computed: {},
22
18
  watch: {},
23
- created () {},
19
+ created() {},
24
20
  methods: {
25
- handleClick () {
21
+ handleClick() {
26
22
  this.loading = true
27
23
  this.$emit('submit', () => {
28
24
  this.loading = false
@@ -32,5 +28,4 @@ export default {
32
28
  }
33
29
  </script>
34
30
 
35
- <style lang='scss' scoped>
36
- </style>
31
+ <style lang="scss"></style>
@@ -1,15 +1,7 @@
1
1
  <!-- 多选框组 -->
2
2
  <template>
3
- <el-checkbox-group
4
- v-model="value"
5
- v-bind="$attrs"
6
- v-on="$listeners"
7
- >
8
- <el-checkbox
9
- v-for="item in options"
10
- :key="item.value"
11
- :label="item.value"
12
- >
3
+ <el-checkbox-group v-model="value" v-bind="$attrs" v-on="$listeners">
4
+ <el-checkbox v-for="item in options" :key="item.value" :label="item.value">
13
5
  {{ item.label }}
14
6
  </el-checkbox>
15
7
  </el-checkbox-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>
@@ -4,7 +4,7 @@
4
4
  <el-descriptions
5
5
  :class="{
6
6
  'd-descriptions': true,
7
- 'border': border
7
+ border: border
8
8
  }"
9
9
  :border="border"
10
10
  :label-style="{
@@ -13,22 +13,13 @@
13
13
  }"
14
14
  v-bind="$attrs"
15
15
  >
16
- <el-descriptions-item
17
- v-for="item in config"
18
- :key="item.prop"
19
- v-bind="item"
20
- >
16
+ <el-descriptions-item v-for="item in config" :key="item.prop" v-bind="item">
21
17
  <template slot="label">
22
18
  <item-render v-if="item.labelRender" :scope="data" :render="item.labelRender" />
23
19
  <span v-else>{{ item.label }}</span>
24
20
  </template>
25
21
  <template>
26
- <component
27
- :is="item.component"
28
- v-if="item.component"
29
- v-bind="item"
30
- :row="data"
31
- />
22
+ <component :is="item.component" v-if="item.component" v-bind="item" :row="data" />
32
23
  <item-render v-else-if="item.render" :scope="data" :render="item.render" />
33
24
  <span v-else>{{ data[item.prop] }}</span>
34
25
  </template>
@@ -52,7 +43,7 @@ export default {
52
43
  default: () => [],
53
44
  type: Array
54
45
  },
55
- border: {
46
+ border: {
56
47
  default: true,
57
48
  type: Boolean
58
49
  },
@@ -65,19 +56,19 @@ export default {
65
56
  type: Object
66
57
  }
67
58
  },
68
- data () {
59
+ data() {
69
60
  return {}
70
61
  },
71
62
  computed: {},
72
63
  watch: {},
73
- created () {},
64
+ created() {},
74
65
  methods: {}
75
66
  }
76
67
  </script>
77
68
 
78
- <style lang='scss' scoped>
69
+ <style lang="scss">
79
70
  .d-descriptions {
80
- :deep(.el-descriptions__body) {
71
+ .el-descriptions__body {
81
72
  .el-descriptions__header {
82
73
  margin-bottom: 12px;
83
74
  }
@@ -101,7 +92,7 @@ export default {
101
92
  }
102
93
  }
103
94
  .d-descriptions.border {
104
- :deep(.el-descriptions__body) {
95
+ .el-descriptions__body {
105
96
  .el-descriptions__table.is-bordered {
106
97
  width: 100%;
107
98
  table-layout: fixed;
@@ -1,7 +1,7 @@
1
1
  <!-- 弹窗 -->
2
2
  <template>
3
3
  <el-dialog
4
- :class="fullscreen ? 'cover-screen-dialog' : ''"
4
+ :class="fullscreen ? 'd-cover-screen-dialog' : ''"
5
5
  class="d-dialog"
6
6
  v-bind="$attrs"
7
7
  :title="title"
@@ -18,12 +18,7 @@
18
18
  <template slot="footer">
19
19
  <slot name="footer" />
20
20
  <div v-if="showButton" class="ar">
21
- <el-button
22
- type="primary"
23
- :icon="submitButtonIcon"
24
- :loading="loading"
25
- @click="submit"
26
- >
21
+ <el-button type="primary" :icon="submitButtonIcon" :loading="loading" @click="submit">
27
22
  {{ submitButtonText }}
28
23
  </el-button>
29
24
  <el-button @click="cancel">
@@ -90,31 +85,31 @@ export default {
90
85
  default: false
91
86
  }
92
87
  },
93
- data () {
88
+ data() {
94
89
  return {
95
90
  loading: false
96
91
  }
97
92
  },
98
93
  computed: {
99
94
  visible: {
100
- get () {
95
+ get() {
101
96
  return this.modelValue
102
97
  },
103
- set (value) {
98
+ set(value) {
104
99
  this.$emit('change', value)
105
100
  }
106
101
  }
107
102
  },
108
103
  methods: {
109
- getRef (ref) {
104
+ getRef(ref) {
110
105
  return typeof ref === 'string' ? this.$parent.$refs[ref] : ref
111
106
  },
112
- async submit () {
107
+ async submit() {
113
108
  // 是否需要进行表单校验
114
109
  if (this.formRefs) {
115
110
  // 多表单校验
116
111
  if (Array.isArray(this.formRefs)) {
117
- await Promise.all(this.formRefs.map(ref => this.getRef(ref)?.validate()))
112
+ await Promise.all(this.formRefs.map((ref) => this.getRef(ref)?.validate()))
118
113
  } else {
119
114
  await this.getRef(this.formRefs)?.validate()
120
115
  }
@@ -127,19 +122,19 @@ export default {
127
122
  }
128
123
  })
129
124
  },
130
- cancel () {
125
+ cancel() {
131
126
  this.$emit('cancel')
132
127
  this.visible = false
133
128
  },
134
129
  /**
135
130
  * @description: 弹窗关闭时清除表单校验
136
131
  */
137
- closed () {
132
+ closed() {
138
133
  this.$emit('closed')
139
134
  if (this.formRefs) {
140
135
  // 多表单校验
141
136
  if (Array.isArray(this.formRefs)) {
142
- this.formRefs.forEach(ref => this.getRef(ref)?.resetFields())
137
+ this.formRefs.forEach((ref) => this.getRef(ref)?.resetFields())
143
138
  } else {
144
139
  this.getRef(this.formRefs)?.resetFields()
145
140
  }
@@ -148,12 +143,12 @@ export default {
148
143
  }
149
144
  }
150
145
  </script>
151
- <style lang="scss" scoped>
146
+ <style lang="scss">
152
147
  .d-dialog {
153
148
  display: flex;
154
149
  align-items: center;
155
150
  justify-content: center;
156
- :deep(.el-dialog) {
151
+ .el-dialog {
157
152
  max-height: 90vh;
158
153
  display: flex;
159
154
  flex-direction: column;
@@ -163,10 +158,10 @@ export default {
163
158
  overflow: auto;
164
159
  }
165
160
  }
166
- }
167
- .cover-screen-dialog {
168
- :deep(.el-dialog) {
169
- height: 90vh;
161
+ &.d-cover-screen-dialog {
162
+ .el-dialog {
163
+ height: 90vh;
164
+ }
170
165
  }
171
166
  }
172
167
  </style>
@@ -4,8 +4,12 @@
4
4
  <span
5
5
  v-if="button === 'text'"
6
6
  slot="reference"
7
- :class="`${buttonType || 'primary'}-text-btn ${disabled ? 'disabled': ''}`"
8
- @click="() => { visible = true }"
7
+ :class="`${buttonType || 'primary'}-text-btn ${disabled ? 'disabled' : ''}`"
8
+ @click="
9
+ () => {
10
+ visible = true
11
+ }
12
+ "
9
13
  >
10
14
  {{ buttonName }}
11
15
  </span>
@@ -14,17 +18,15 @@
14
18
  :disabled="disabled"
15
19
  :icon="buttonIcon"
16
20
  :type="buttonType"
17
- @click="() => { visible = true }"
21
+ @click="
22
+ () => {
23
+ visible = true
24
+ }
25
+ "
18
26
  >
19
27
  {{ buttonName }}
20
28
  </el-button>
21
- <d-dialog
22
- v-model="visible"
23
- :title="title"
24
- width="374px"
25
- append-to-body
26
- @submit="submit"
27
- >
29
+ <d-dialog v-model="visible" :title="title" width="374px" append-to-body @submit="submit">
28
30
  <div class="d-dialog-confirm-container">
29
31
  <i class="el-icon-warning" />
30
32
  <p class="d-dialog-confirm-content">
@@ -67,20 +69,20 @@ export default {
67
69
  type: String
68
70
  }
69
71
  },
70
- data () {
72
+ data() {
71
73
  return {
72
74
  visible: false
73
75
  }
74
76
  },
75
77
  methods: {
76
- submit (callback) {
78
+ submit(callback) {
77
79
  this.$emit('submit', callback)
78
80
  }
79
81
  }
80
82
  }
81
83
  </script>
82
84
 
83
- <style lang="scss" scoped>
85
+ <style lang="scss">
84
86
  .d-dialog-confirm-container {
85
87
  display: flex;
86
88
  align-items: center;
@@ -17,12 +17,7 @@
17
17
  <slot />
18
18
  </div>
19
19
  <div v-if="showButton" class="ar mt16">
20
- <el-button
21
- type="primary"
22
- :icon="submitButtonIcon"
23
- :loading="loading"
24
- @click="submit"
25
- >
20
+ <el-button type="primary" :icon="submitButtonIcon" :loading="loading" @click="submit">
26
21
  {{ submitButtonText }}
27
22
  </el-button>
28
23
  <el-button @click="cancel">
@@ -76,31 +71,31 @@ export default {
76
71
  default: '70%'
77
72
  }
78
73
  },
79
- data () {
74
+ data() {
80
75
  return {
81
76
  loading: false
82
77
  }
83
78
  },
84
79
  computed: {
85
80
  visible: {
86
- get () {
81
+ get() {
87
82
  return this.modelValue
88
83
  },
89
- set (value) {
84
+ set(value) {
90
85
  this.$emit('change', value)
91
86
  }
92
87
  }
93
88
  },
94
89
  methods: {
95
- getRef (ref) {
90
+ getRef(ref) {
96
91
  return typeof ref === 'string' ? this.$parent.$refs[ref] : ref
97
92
  },
98
- async submit () {
93
+ async submit() {
99
94
  // 是否需要进行表单校验
100
95
  if (this.formRefs) {
101
96
  // 多表单校验
102
97
  if (Array.isArray(this.formRefs)) {
103
- await Promise.all(this.formRefs.map(ref => this.getRef(ref)?.validate()))
98
+ await Promise.all(this.formRefs.map((ref) => this.getRef(ref)?.validate()))
104
99
  } else {
105
100
  await this.getRef(this.formRefs)?.validate()
106
101
  }
@@ -113,19 +108,19 @@ export default {
113
108
  }
114
109
  })
115
110
  },
116
- cancel () {
111
+ cancel() {
117
112
  this.$emit('cancel')
118
113
  this.visible = false
119
114
  },
120
115
  /**
121
116
  * @description: 弹窗关闭时清除表单校验
122
117
  */
123
- closed () {
118
+ closed() {
124
119
  this.$emit('closed')
125
120
  if (this.formRefs) {
126
121
  // 多表单校验
127
122
  if (Array.isArray(this.formRefs)) {
128
- this.formRefs.forEach(ref => this.getRef(ref)?.resetFields())
123
+ this.formRefs.forEach((ref) => this.getRef(ref)?.resetFields())
129
124
  } else {
130
125
  this.getRef(this.formRefs)?.resetFields()
131
126
  }