kui-vue 3.3.11 → 3.4.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 (66) hide show
  1. package/components/_tool/clone.js +1 -2
  2. package/components/_tool/transfer.js +5 -5
  3. package/components/_tool/utils.js +2 -137
  4. package/components/alert/styles/index.less +2 -2
  5. package/components/avatar/AvatarGroup.jsx +2 -2
  6. package/components/backtop/styles/index.less +44 -47
  7. package/components/base/drop.jsx +231 -17
  8. package/components/base/pop.jsx +35 -21
  9. package/components/button/button.jsx +5 -11
  10. package/components/button/index.js +1 -8
  11. package/components/collapse/styles/index.less +3 -16
  12. package/components/colorPicker/colorpicker.jsx +4 -3
  13. package/components/colorPicker/styles/index.less +22 -43
  14. package/components/datePicker/datecalendar.jsx +1 -1
  15. package/components/datePicker/datepicker.jsx +5 -2
  16. package/components/datePicker/styles/datepicker.less +4 -14
  17. package/components/drawer/drawer.jsx +1 -1
  18. package/components/dropdown/demo/base.md +1 -1
  19. package/components/dropdown/demo/rightmenu.md +5 -5
  20. package/components/dropdown/dropdown.jsx +11 -3
  21. package/components/dropdown/styles/index.less +35 -13
  22. package/components/form/demo/align.md +1 -1
  23. package/components/form/demo/base.md +1 -1
  24. package/components/form/demo/dynamicvalid.md +1 -1
  25. package/components/form/demo/length.md +2 -2
  26. package/components/form/demo/valid.md +2 -2
  27. package/components/form/form.jsx +1 -1
  28. package/components/form/styles/index.less +3 -14
  29. package/components/fragment/component.js +98 -0
  30. package/components/fragment/frag.js +362 -0
  31. package/components/fragment/fragment.js +19 -0
  32. package/components/fragment/index.js +104 -0
  33. package/components/fragment/ssr.js +4 -0
  34. package/components/icon/demo/search.vue +1 -1
  35. package/components/image/styles/index.less +41 -17
  36. package/components/index.js +2 -2
  37. package/components/input/styles/index.less +2 -2
  38. package/components/menu/menuitem.jsx +12 -7
  39. package/components/menu/styles/index.less +190 -203
  40. package/components/menu/submenu.jsx +106 -37
  41. package/components/message/styles/index.less +11 -14
  42. package/components/modal/index.js +1 -1
  43. package/components/modal/modal.jsx +2 -2
  44. package/components/modal/styles/index.less +227 -221
  45. package/components/notice/styles/index.less +19 -5
  46. package/components/popconfirm/styles/index.less +33 -14
  47. package/components/poptip/demo/closeinside.md +1 -1
  48. package/components/poptip/styles/index.less +3 -14
  49. package/components/radio/button.jsx +1 -1
  50. package/components/rate/styles/index.less +9 -1
  51. package/components/select/demo/base.md +1 -1
  52. package/components/select/demo/multiple.md +1 -1
  53. package/components/select/demo/theme.md +11 -13
  54. package/components/select/select.jsx +64 -34
  55. package/components/select/styles/index.less +143 -149
  56. package/components/table/table.jsx +1 -1
  57. package/components/tabs/styles/index.less +3 -2
  58. package/components/tag/styles/index.less +3 -15
  59. package/components/tooltip/styles/index.less +48 -17
  60. package/components/tooltip/tooltip.jsx +3 -3
  61. package/components/tree/node.jsx +1 -1
  62. package/dist/k-ui.css +2 -2
  63. package/dist/k-ui.js +2 -2
  64. package/package.json +4 -4
  65. package/components/menu/styles/dropmenu.less +0 -119
  66. /package/{README.md → readme.md} +0 -0
@@ -1,20 +1,31 @@
1
1
  @import '../../styles/var.less';
2
+
2
3
  .k-dropdown {
3
4
  font-size: 12px;
4
5
  line-height: 1.5;
5
6
  position: absolute;
6
7
  z-index: 1001;
8
+
7
9
  .k-dropdown-content {
8
10
  background: var(--kui-color-control-10);
9
11
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
10
12
  border-radius: var(--kui-border-radius);
11
13
  }
14
+
12
15
  .k-dropdown-menu {
13
16
  min-width: 150px;
14
17
  }
18
+
19
+ .k-dropdown-menu-item-icon {
20
+ margin-right: 8px;
21
+ }
15
22
  }
16
23
 
17
24
  .k-dropdown-has-arrow {
25
+ .k-dropdown-content {
26
+ box-shadow: none;
27
+ }
28
+
18
29
  .k-dropdown-arrow {
19
30
  position: absolute;
20
31
  box-sizing: border-box;
@@ -23,6 +34,7 @@
23
34
  height: 7px;
24
35
  color: var(--kui-color-control-10);
25
36
  }
37
+
26
38
  // &[k-placement^=top] {
27
39
  // margin-top: -3px;
28
40
  // }
@@ -34,97 +46,116 @@
34
46
  bottom: 6px;
35
47
  height: 7px;
36
48
  }
49
+
37
50
  .k-dropdown-body {
38
51
  margin-bottom: 12px;
39
52
  }
40
53
  }
54
+
41
55
  &[k-placement=top] {
42
56
  .k-dropdown-arrow {
43
57
  left: 50%;
44
58
  transform: translateX(-50%);
45
59
  }
46
60
  }
61
+
47
62
  &[k-placement=top-right] {
48
63
  .k-dropdown-arrow {
49
64
  right: 12px;
50
65
  }
51
66
  }
67
+
52
68
  &[k-placement=top-left] {
53
69
  .k-dropdown-arrow {
54
70
  left: 12px;
55
71
  }
56
72
  }
73
+
57
74
  &[k-placement^=bottom] {
58
75
  .k-dropdown-arrow {
59
76
  top: 6px;
60
77
  height: 7px;
61
78
  transform: rotate(180deg);
62
79
  }
80
+
63
81
  .k-dropdown-body {
64
82
  margin-top: 12px;
65
83
  }
66
84
  }
85
+
67
86
  &[k-placement=bottom] {
68
87
  .k-dropdown-arrow {
69
88
  left: 50%;
70
89
  transform: translateX(-50%) rotate(180deg);
71
90
  }
72
91
  }
92
+
73
93
  &[k-placement=bottom-left] {
74
94
  .k-dropdown-arrow {
75
95
  left: 10px;
76
96
  }
77
97
  }
98
+
78
99
  &[k-placement=bottom-right] {
79
100
  .k-dropdown-arrow {
80
101
  right: 10px;
81
102
  }
82
103
  }
104
+
83
105
  &[k-placement^=left] {
84
106
  .k-dropdown-arrow {
85
107
  right: 8px;
86
108
  box-shadow: 3px -3px 7px rgba(0, 0, 0, 0.07);
87
109
  }
110
+
88
111
  .k-dropdown-body {
89
112
  margin-right: 12px;
90
113
  }
91
114
  }
115
+
92
116
  &[k-placement=left] {
93
117
  .k-dropdown-arrow {
94
118
  top: 50%;
95
119
  transform: translateY(-50%);
96
120
  }
97
121
  }
122
+
98
123
  &[k-placement=left-bottom] {
99
124
  .k-dropdown-arrow {
100
125
  bottom: 10px;
101
126
  }
102
127
  }
128
+
103
129
  &[k-placement=left-top] {
104
130
  .k-dropdown-arrow {
105
131
  top: 10px;
106
132
  }
107
133
  }
134
+
108
135
  &[k-placement^=right] {
109
136
  .k-dropdown-arrow {
110
137
  left: 8px;
111
138
  box-shadow: -3px 3px 7px rgba(0, 0, 0, 0.07);
112
139
  }
140
+
113
141
  .k-dropdown-body {
114
142
  margin-left: 12px;
115
143
  }
116
144
  }
145
+
117
146
  &[k-placement=right] {
118
147
  .k-dropdown-arrow {
119
148
  top: 50%;
120
149
  transform: translateY(-50%);
121
150
  }
122
151
  }
152
+
123
153
  &[k-placement=right-top] {
124
154
  .k-dropdown-arrow {
125
155
  top: 10px;
126
156
  }
127
157
  }
158
+
128
159
  &[k-placement=right-bottom] {
129
160
  .k-dropdown-arrow {
130
161
  bottom: 10px;
@@ -132,32 +163,23 @@
132
163
  }
133
164
  }
134
165
 
135
- @keyframes dropdown-zoom-in {
166
+ @keyframes dropdown-zoom {
136
167
  0% {
137
168
  transform: scaleY(0);
138
169
  opacity: 0;
139
170
  }
171
+
140
172
  100% {
141
173
  transform: scaleY(1);
142
174
  opacity: 1;
143
175
  }
144
176
  }
145
177
 
146
- @keyframes dropdown-zoom-out {
147
- 0% {
148
- transform: scaleY(1);
149
- opacity: 1;
150
- }
151
- 100% {
152
- transform: scaleY(0);
153
- opacity: 0;
154
- }
155
- }
156
178
 
157
179
  .k-dropdown-fade-enter-active {
158
- animation: dropdown-zoom-in .3s;
180
+ animation: dropdown-zoom .3s;
159
181
  }
160
182
 
161
183
  .k-dropdown-fade-leave-active {
162
- animation: dropdown-zoom-out .3s;
184
+ animation: dropdown-zoom .3s reverse;
163
185
  }
@@ -18,7 +18,7 @@
18
18
  <Input />
19
19
  </FormItem>
20
20
  <FormItem label="Select">
21
- <Select >
21
+ <Select style="width:100%">
22
22
  <Option value="0" label="Apple" />
23
23
  <Option value="1" label="Banana" />
24
24
  <Option value="2" label="Orange" />
@@ -25,7 +25,7 @@
25
25
  <InputNumber placeholder="inputnumber..."/>
26
26
  </FormItem>
27
27
  <FormItem label="Select">
28
- <Select >
28
+ <Select style="width:100%;">
29
29
  <Option value="0" label="Apple" />
30
30
  <Option value="1" label="Banana" />
31
31
  <Option value="2" label="Orange" />
@@ -24,7 +24,7 @@
24
24
  { required: true, message: '请输入性别' }
25
25
  ]"
26
26
  >
27
- <Select clearable>
27
+ <Select clearable style="width:100%;">
28
28
  <Option value="1" label="男" />
29
29
  <Option value="0" label="女" />
30
30
  </Select>
@@ -27,13 +27,13 @@
27
27
  </FormItem>
28
28
  <FormItem label="Country">
29
29
  <FormItem prop="country">
30
- <Select clearable>
30
+ <Select clearable style="width:100%;">
31
31
  <Option value="0" label="China" />
32
32
  <Option value="1" label="Russia" />
33
33
  </Select>
34
34
  </FormItem>
35
35
  <FormItem prop="city">
36
- <Select clearable>
36
+ <Select clearable style="width:100%;">
37
37
  <Option value="0" label="Shanghai" />
38
38
  <Option value="1" label="Wuhan" />
39
39
  <Option value="2" label="Hangzhou" />
@@ -39,13 +39,13 @@
39
39
  </FormItem>
40
40
  <FormItem label="Country">
41
41
  <FormItem prop="country">
42
- <Select clearable >
42
+ <Select clearable style="width:100%">
43
43
  <Option value="0" label="China" />
44
44
  <Option value="1" label="Russia" />
45
45
  </Select>
46
46
  </FormItem>
47
47
  <FormItem prop="city">
48
- <Select clearable >
48
+ <Select clearable style="width:100%">
49
49
  <Option value="0" label="Shanghai" />
50
50
  <Option value="1" label="Wuhan" />
51
51
  <Option value="2" label="Hangzhou" />
@@ -130,7 +130,7 @@ export default {
130
130
  submit(e) {
131
131
  e && e.preventDefault()
132
132
  this.validate((valid) => {
133
- let model = JSON.parse(JSON.stringify(this.model))
133
+ let model = JSON.parse(JSON.stringify(this.model || '{}'))
134
134
  this.$emit('submit', { valid, model })
135
135
  })
136
136
  },
@@ -187,7 +187,7 @@
187
187
  }
188
188
  }
189
189
 
190
- @keyframes k-form-item-fade-in {
190
+ @keyframes k-form-item-fade {
191
191
  0% {
192
192
  transform: scaleY(0);
193
193
  opacity: 0;
@@ -199,22 +199,11 @@
199
199
  }
200
200
  }
201
201
 
202
- @keyframes k-form-item-fade-out {
203
- 0% {
204
- transform: scaleY(1);
205
- opacity: 1;
206
- }
207
-
208
- 100% {
209
- transform: scaleY(0);
210
- opacity: 0;
211
- }
212
- }
213
202
 
214
203
  .k-form-item-fade-enter-active {
215
- animation: k-form-item-fade-in .3s;
204
+ animation: k-form-item-fade .3s;
216
205
  }
217
206
 
218
207
  .k-form-item-fade-leave-active {
219
- animation: k-form-item-fade-out .3s;
208
+ animation: k-form-item-fade .3s reverse;
220
209
  }
@@ -0,0 +1,98 @@
1
+ export const freeze = (object, property, value) => {
2
+ Object.defineProperty(object, property, {
3
+ configurable: true,
4
+ get() { return value; },
5
+ set(v) { console.warn(`tried to set frozen property ${property} with ${v}`) }
6
+ });
7
+ };
8
+
9
+ export const unfreeze = (object, property, value = null) => {
10
+ Object.defineProperty(object, property, {
11
+ configurable: true,
12
+ writable: true,
13
+ value: value
14
+ });
15
+ };
16
+
17
+ export default {
18
+ abstract: true,
19
+ name: 'Fragment',
20
+
21
+ props: {
22
+ name: {
23
+ type: String,
24
+ default: () => Math.floor(Date.now() * Math.random()).toString(16)
25
+ },
26
+ html: {
27
+ type: String,
28
+ default: null
29
+ }
30
+ },
31
+
32
+ mounted() {
33
+ const container = this.$el
34
+ const parent = container.parentNode
35
+
36
+ container.__isFragment = true
37
+ container.__isMounted = false
38
+
39
+ const head = document.createComment(`fragment#${this.name}#head`)
40
+ const tail = document.createComment(`fragment#${this.name}#tail`)
41
+
42
+ container.__head = head
43
+ container.__tail = tail
44
+
45
+ // use document fragment to improve efficiency
46
+ let tpl = document.createDocumentFragment()
47
+ tpl.appendChild(head)
48
+
49
+ Array.from(container.childNodes)
50
+ .forEach(node => {
51
+ // container.appendChild(node, true)
52
+ let notFrChild = !node.hasOwnProperty('__isFragmentChild__')
53
+ tpl.appendChild(node)
54
+ if (notFrChild) {
55
+ freeze(node, 'parentNode', container)
56
+ freeze(node, '__isFragmentChild__', true)
57
+ }
58
+ })
59
+
60
+ tpl.appendChild(tail)
61
+
62
+ // embed html
63
+ if (this.html) {
64
+ let template = document.createElement('template')
65
+ template.innerHTML = this.html
66
+ // copy elements over
67
+ Array.from(template.content.childNodes).forEach(node => {
68
+ tpl.appendChild(node)
69
+ })
70
+ }
71
+
72
+ let next = container.nextSibling
73
+ parent.insertBefore(tpl, container, true)
74
+ parent.removeChild(container)
75
+ freeze(container, 'parentNode', parent)
76
+ freeze(container, 'nextSibling', next)
77
+ if (next)
78
+ freeze(next, 'previousSibling', container)
79
+
80
+ container.__isMounted = true
81
+ },
82
+
83
+ render(h) {
84
+ const children = this.$slots.default
85
+
86
+ // add fragment attribute on the children
87
+ if (children && children.length)
88
+ children.forEach(child =>
89
+ child.data = { ...child.data, attrs: { fragment: this.name, ...(child.data || {}).attrs } }
90
+ )
91
+
92
+ return h(
93
+ "div",
94
+ { attrs: { fragment: this.name } },
95
+ children
96
+ )
97
+ }
98
+ };