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,4 +1,4 @@
1
- import Button from "../button";
1
+ import { Button } from "../button";
2
2
  import Icon from "../icon";
3
3
  import { getChild } from "../_tool/utils";
4
4
  import cloneVNode from '../_tool/clone'
@@ -18,6 +18,7 @@ export default {
18
18
  title: String,
19
19
  showPlacementArrow: { type: Boolean, default: true },
20
20
  width: [Number, String],
21
+ offsetLeft: { type: Number, default: 0 },
21
22
  placement: {
22
23
  validator(value) {
23
24
  return (
@@ -29,7 +30,8 @@ export default {
29
30
  okText: String,
30
31
  cancelText: String,
31
32
  updateKey: [String, Object, Array],
32
- show: Boolean
33
+ show: Boolean,
34
+ isMenu: { type: Boolean, default: false }
33
35
  },
34
36
  data() {
35
37
  return {
@@ -65,6 +67,7 @@ export default {
65
67
  if (this.trigger == "hover" && !this.confirm && !this.opened) {
66
68
  this.toggle(true)
67
69
  }
70
+ this.$emit('mouseenter', e)
68
71
  },
69
72
  mouseLeave(e) {
70
73
  if (this.trigger == 'hover' &&
@@ -98,16 +101,16 @@ export default {
98
101
  this.toggle(true)
99
102
  }
100
103
  }
104
+ this.$emit('click', e)
101
105
 
102
106
  },
103
107
  renderPopup() {
104
108
  let { placement, trigger, title, preCls, $slots, transfer, color, updateKey } = this, childNode;
105
109
 
106
- title = title || getChild($slots.title)
107
- // console.log(title)
108
110
  let okText = this.okText || t('k.pop.ok')
109
111
  let cancelText = this.cancelText || t('k.pop.cancel')
110
112
  if (this.showPlacementArrow) {
113
+ title = title || getChild($slots.title)
111
114
  let titleNode, contentNode, footerNode;
112
115
  if (this.confirm) {
113
116
  contentNode = [<Icon type={HelpCircle} />, <div class={`k-${preCls}-title`}>{title}</div>]
@@ -121,25 +124,32 @@ export default {
121
124
  contentNode = $slots.content
122
125
  }
123
126
  contentNode = contentNode ? <div class={`k-${preCls}-body`}>{contentNode}</div> : null;
124
-
125
- childNode = [
126
- <div class={`k-${preCls}-content`} style={{ backgroundColor: /^#/.test(color) ? color : null }}>
127
- {[titleNode, contentNode, footerNode]}
128
- <div class={`k-${preCls}-arrow`}>
129
- <svg style={{ fill: /^#/.test(color) ? color : 'currentcolor' }} viewBox="0 0 24 7">
130
- <path d="M24 0V1C20 1 18.5 2 16.5 4C14.5 6 14 7 12 7C10 7 9.5 6 7.5 4C5.5 2 4 1 0 1V0H24Z"></path>
131
- </svg>
132
- </div>
133
- </div>]
134
-
127
+ if (!titleNode && !contentNode && !footerNode) {
128
+ childNode = null
129
+ } else {
130
+ childNode = [
131
+ <div class={`k-${preCls}-content`} style={{ backgroundColor: /^#/.test(color) ? color : null }}>
132
+ {[titleNode, contentNode, footerNode]}
133
+ <div class={`k-${preCls}-arrow`}>
134
+ <svg style={{ fill: /^#/.test(color) ? color : 'currentcolor' }} viewBox="0 0 24 7">
135
+ <path d="M24 0V1C20 1 18.5 2 16.5 4C14.5 6 14 7 12 7C10 7 9.5 6 7.5 4C5.5 2 4 1 0 1V0H24Z"></path>
136
+ </svg>
137
+ </div>
138
+ </div>]
139
+ }
135
140
  } else {
136
141
  childNode = $slots.content
137
142
  }
143
+ if (!childNode) {
144
+ return null
145
+ }
146
+ // console.log(childNode)
138
147
  const props = {
139
148
  ref: 'overlay',
140
149
  key: this.$vnode.key,
141
150
  props: {
142
- transfer,
151
+ transfer: true,
152
+ offsetLeft: this.offsetLeft,
143
153
  value: this.opened,
144
154
  className: [`k-${preCls}`, {
145
155
  [`k-${preCls}-${color}`]: color && !/^#/.test(color),
@@ -158,11 +168,15 @@ export default {
158
168
  mouseenter: e => {
159
169
  if (this.$refs.overlay.$el.contains(e.target)) {
160
170
  clearTimeout(this.timer)
171
+ this.$emit('mouseenter', e)
161
172
  }
162
173
  },
163
174
  mouseleave: e => {
175
+ this.$emit('mouseleave', e)
164
176
  if (this.trigger == 'hover') {
165
- this.toggle(false);
177
+ this.timer = setTimeout(() => {
178
+ this.toggle(false);
179
+ }, 200);
166
180
  }
167
181
  },
168
182
  hide: () => {
@@ -181,15 +195,15 @@ export default {
181
195
  let { $slots } = this
182
196
  let vNode = getChild($slots.default)[0]
183
197
  let popup = this.renderPopup()
184
-
185
- const props = {
186
- on: {
198
+ let props = {}
199
+ if (!this.isMenu) {
200
+ props.on = {
187
201
  'contextmenu': e => this.contextMenu(e),
188
202
  'mouseenter': e => this.mouseEnter(e),
189
203
  'mouseleave': e => this.mouseLeave(e),
190
204
  'click': e => this.onClick(e)
191
205
  }
192
206
  }
193
- return cloneVNode(vNode, props, popup)
207
+ return cloneVNode(vNode, props, [popup])
194
208
  }
195
209
  };
@@ -74,17 +74,11 @@ export default {
74
74
  const iconNode = iconType ? <Icon type={iconType} spin={loading} /> : null
75
75
  const child = getChild($slots.default)
76
76
  const childs = child.map(c => {
77
- if (typeof c.text == 'string') {
78
- return <span>{c.text.trim()}</span>
79
- }
80
- return c
77
+ return typeof c.text == 'string' ? <span>{c.text.trim()}</span> : c
81
78
  })
82
- const button = (
83
- <button {...props} >
84
- {iconNode}
85
- {childs}
86
- </button >
87
- )
88
- return button
79
+ return <button {...props} >
80
+ {iconNode}
81
+ {childs}
82
+ </button >
89
83
  }
90
84
  };
@@ -1,11 +1,4 @@
1
1
  // import './button.less'
2
2
  import Button from './button'
3
3
  import ButtonGroup from './buttonGroup'
4
-
5
- Button.Group = ButtonGroup
6
-
7
- Button.install = function (vue) {
8
- vue.component(Button.name, Button)
9
- vue.component(ButtonGroup.name, ButtonGroup)
10
- }
11
- export default Button
4
+ export { Button, ButtonGroup }
@@ -65,16 +65,16 @@
65
65
  }
66
66
 
67
67
  .k-collaplse-slide-enter-active {
68
- animation: slideIn 0.3s ease-in-out;
68
+ animation: slide 0.3s ease-in-out;
69
69
  animation-fill-mode: both;
70
70
  }
71
71
 
72
72
  .k-collaplse-slide-leave-active {
73
- animation: slideOut 0.3s ease-in-out;
73
+ animation: slide 0.3s ease-in-out reverse;
74
74
  animation-fill-mode: both;
75
75
  }
76
76
 
77
- @keyframes slideIn {
77
+ @keyframes slide {
78
78
  0% {
79
79
  transform: scaleY(0);
80
80
  transform-origin: 0% 0%;
@@ -86,16 +86,3 @@
86
86
  opacity: 1;
87
87
  }
88
88
  }
89
-
90
- @keyframes slideOut {
91
- 0% {
92
- transform: scaleY(1);
93
- transform-origin: 0% 0%;
94
- opacity: 1;
95
- }
96
- 100% {
97
- transform: scaleY(0);
98
- transform-origin: 0% 0%;
99
- opacity: 0;
100
- }
101
- }
@@ -1,6 +1,6 @@
1
1
  import { canvasHelper, limit, hslToRgb, rgbToHsl, parseColor, rgbToHex, cssColorToRgba } from './canvasHelper'
2
2
  import { Input } from '../input'
3
- import Button from '../button'
3
+ import { Button } from '../button'
4
4
  import Icon from '../icon'
5
5
  import Drop from '../base/drop'
6
6
  import { ChevronDown, CaretHor } from 'kui-icons'
@@ -364,7 +364,8 @@ export default {
364
364
  const props = {
365
365
  ref: 'overlay',
366
366
  props: {
367
- transfer: this.transfer,
367
+ placement: 'bottom-left',
368
+ transfer: true,
368
369
  value: this.opened,
369
370
  selection: this.$el,
370
371
  className: 'k-color-picker-dropdown',
@@ -430,7 +431,7 @@ export default {
430
431
  <div class="k-color-picker-color">
431
432
  <div class="k-color-picker-color-inner" style={`background-color:${this.currentColor}`}></div>
432
433
  </div>
433
- {showArrow && <Icon type={icon || ChevronDown} />}
434
+ {showArrow && <Icon class="k-color-picker-arrow" type={icon || ChevronDown} />}
434
435
  </div>
435
436
  {drop}
436
437
  </div >)
@@ -2,13 +2,14 @@
2
2
 
3
3
  .k-color-picker {
4
4
  // width: 55px;
5
- height: 30px;
5
+ height: 32px;
6
6
  border: 1px solid var(--kui-color-border);
7
7
  border-radius: var(--kui-border-radius);
8
8
  position: relative;
9
- display: inline-block;
10
- box-sizing: content-box;
11
-
9
+ display: inline-flex;
10
+ box-sizing: border-box;
11
+ align-items: center;
12
+ padding: 0 2px;
12
13
  &:hover,
13
14
  &:focus {
14
15
  border-color: var(--kui-color-main-hover);
@@ -21,7 +22,7 @@
21
22
  .k-color-picker-selection {
22
23
  display: flex;
23
24
  align-items: center;
24
- padding: 2px;
25
+ // padding: 2px;
25
26
  cursor: pointer;
26
27
  }
27
28
 
@@ -41,28 +42,22 @@
41
42
  }
42
43
  }
43
44
 
44
- .k-icon {
45
- // position: absolute;
46
- // right: 5px;
47
- // top: 50%;
48
- // transform: translateY(-50%);
45
+ .k-color-picker-arrow {
49
46
  margin: 0 5px;
50
47
  font-size: 16px;
51
48
  color: var(--kui-color-icon);
52
-
53
- #chevron-up {
54
- transform: rotate(180deg);
55
- }
49
+ transition: transform .3s cubic-bezier(0.075, 0.82, 0.165, 1);
56
50
  }
57
51
 
58
- .k-icon-default {
59
- transform: rotate(180deg);
60
- }
61
52
  }
62
53
 
63
54
  .k-color-picker-opened {
64
55
  border: 1px solid var(--kui-color-main);
65
- box-shadow: 0 0 5px var(--kui-color-main-30);
56
+ box-shadow: 0 0 0 2px var(--kui-color-main-90);
57
+
58
+ .k-color-picker-arrow {
59
+ transform: rotate(180deg);
60
+ }
66
61
  }
67
62
 
68
63
  .k-color-picker-disabled {
@@ -92,11 +87,11 @@
92
87
  height: 40px;
93
88
 
94
89
  .k-color-picker-color {
95
- width: 35.5px;
96
- height: 35.5px;
90
+ width: 34px;
91
+ height: 34px;
97
92
  }
98
93
 
99
- .k-icon {
94
+ .k-color-picker-arrow {
100
95
  font-size: 22px;
101
96
  }
102
97
  }
@@ -105,16 +100,12 @@
105
100
  // width: 45px;
106
101
  height: 22px;
107
102
 
108
- .k-color-picker-selection {
109
- padding: 3px;
110
- }
111
-
112
103
  .k-color-picker-color {
113
104
  width: 16px;
114
105
  height: 16px;
115
106
  }
116
107
 
117
- .k-icon {
108
+ .k-color-picker-arrow {
118
109
  font-size: 14px;
119
110
  }
120
111
  }
@@ -135,7 +126,7 @@
135
126
  position: absolute;
136
127
  background: var(--kui-color-back);
137
128
  border: 1px solid var(--kui-color-border);
138
- box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
129
+ box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
139
130
  border-radius: 50%;
140
131
  top: 10px;
141
132
  left: 10px;
@@ -194,7 +185,7 @@
194
185
  position: absolute;
195
186
  background: var(--kui-color-back);
196
187
  border: 1px solid var(--kui-color-border);
197
- box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
188
+ box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
198
189
  border-radius: 50%;
199
190
  pointer-events: none;
200
191
  }
@@ -303,7 +294,7 @@
303
294
  }
304
295
  }
305
296
 
306
- @keyframes dropDownIn {
297
+ @keyframes drop-down {
307
298
  0% {
308
299
  opacity: 0;
309
300
  transform: scaleY(0)
@@ -315,24 +306,12 @@
315
306
  }
316
307
  }
317
308
 
318
- @keyframes dropDownOut {
319
- 0% {
320
- opacity: 1;
321
- transform: scaleY(1)
322
- }
323
-
324
- to {
325
- opacity: 0;
326
- transform: scaleY(0)
327
- }
328
- }
329
-
330
309
  .k-color-picker-enter-active {
331
310
  transform-origin: 0 0;
332
- animation: dropDownIn .3s;
311
+ animation: drop-down .3s;
333
312
  }
334
313
 
335
314
  .k-color-picker-leave-active {
336
315
  transform-origin: 0 0;
337
- animation: dropDownOut .3s
316
+ animation: drop-down .3s reverse;
338
317
  }
@@ -1,5 +1,5 @@
1
1
 
2
- import Button from '../button'
2
+ import {Button} from '../button'
3
3
  import dayjs from 'dayjs'
4
4
  import { t } from '../locale'
5
5
  import {
@@ -331,7 +331,10 @@ export default {
331
331
  calendar.push(presetsNode)
332
332
  }
333
333
  const leftProps = {
334
- props: { format, mode, opened, disabledTime, disabledDate, value: dv1, date: d1, v1, v2, h2, pickerSize },
334
+ props: {
335
+ format, mode, opened, disabledTime,
336
+ disabledDate, value: dv1, date: d1, v1, v2, h2, pickerSize: pickerSize || size
337
+ },
335
338
  on: {
336
339
  input: (e, f) => this.picker1Update(e, f),
337
340
  close: (v) => {
@@ -380,7 +383,7 @@ export default {
380
383
  const props = {
381
384
  props: {
382
385
  className: ['k-datepicker-dropdown', { 'k-datepicker-range-dropdown': isRange }],
383
- transfer: transfer,
386
+ transfer: true,
384
387
  selection: this.$el,
385
388
  value: this.opened,
386
389
  placement: 'bottom-left',
@@ -182,6 +182,7 @@
182
182
  white-space: nowrap;
183
183
  line-height: 0;
184
184
  }
185
+
185
186
  &.k-datepicker-with-time {
186
187
 
187
188
  .k-datepicker-placeholder,
@@ -250,7 +251,7 @@
250
251
  }
251
252
 
252
253
 
253
- @keyframes dropDownIn {
254
+ @keyframes drop-down {
254
255
  0% {
255
256
  opacity: 0;
256
257
  transform: scaleY(0)
@@ -262,24 +263,13 @@
262
263
  }
263
264
  }
264
265
 
265
- @keyframes dropDownOut {
266
- 0% {
267
- opacity: 1;
268
- transform: scaleY(1)
269
- }
270
-
271
- to {
272
- opacity: 0;
273
- transform: scaleY(0)
274
- }
275
- }
276
266
 
277
267
  .k-date-picker-enter-active {
278
268
  transform-origin: 0 0;
279
- animation: dropDownIn .3s;
269
+ animation: drop-down .3s;
280
270
  }
281
271
 
282
272
  .k-date-picker-leave-active {
283
273
  transform-origin: 0 0;
284
- animation: dropDownOut .3s
274
+ animation: drop-down .3s reverse
285
275
  }
@@ -1,4 +1,4 @@
1
- import Button from "../button";
1
+ import {Button} from "../button";
2
2
  import Icon from "../icon";
3
3
  import { t } from "../locale";
4
4
  import transfer from "../_tool/transfer";
@@ -5,7 +5,7 @@
5
5
 
6
6
  ```vue
7
7
  <template>
8
- <Dropdown>
8
+ <Dropdown show-placement-arrow >
9
9
  <Button>
10
10
  滑动展开 <Icon :type="ChevronDown" />
11
11
  </Button>
@@ -13,22 +13,22 @@
13
13
  color: '#999',
14
14
  }" class="demo-back">Right Click on here</div>
15
15
  <Menu slot="content">
16
- <MenuItem key="news">New file</MenuItem>
17
- <MenuItem key="edit">Edit</MenuItem>
16
+ <MenuItem key="news" :icon="Document">New file</MenuItem>
17
+ <MenuItem key="edit" :icon="IconEdit">Edit</MenuItem>
18
18
  <MenuItem key="save" :icon="Save">Save</MenuItem>
19
19
  <MenuItem key="cut" :icon="Cut">Cut</MenuItem>
20
20
  <MenuDivider />
21
- <MenuItem key="exit">Exit</MenuItem>
21
+ <MenuItem key="exit" :icon="Exit">Exit</MenuItem>
22
22
  </Menu>
23
23
  </Dropdown>
24
24
  </template>
25
25
 
26
26
  <script>
27
- import { Save, Cut } from 'kui-icons'
27
+ import { Save, Cut, Document, IconEdit, Exit } from 'kui-icons'
28
28
  export default {
29
29
  data() {
30
30
  return {
31
- Save, Cut
31
+ Save, Cut, Document, IconEdit, Exit
32
32
  }
33
33
  },
34
34
  methods:{
@@ -1,4 +1,4 @@
1
- import PopBase from '../base/pop'
1
+ import BasePop from '../base/pop'
2
2
 
3
3
  export default {
4
4
  name: 'Dropdown',
@@ -24,6 +24,7 @@ export default {
24
24
  },
25
25
  data() {
26
26
  return {
27
+ timer: null,
27
28
  visible: this.value || false
28
29
  }
29
30
  },
@@ -48,13 +49,20 @@ export default {
48
49
  }
49
50
  }
50
51
  return (
51
- <PopBase {...props}>
52
+ <BasePop {...props} ref="pop">
52
53
  {this.$slots.default}
53
54
  <template slot="content">{this.$slots.content}</template>
54
- </PopBase >
55
+ </BasePop >
55
56
  )
56
57
  },
57
58
  methods: {
59
+ hidePopup() {
60
+ clearTimeout(this.timer)
61
+ this.timer = setTimeout(() => {
62
+ this.visible = false
63
+ this.$emit('input', false)
64
+ }, 200);
65
+ },
58
66
  handleClick(options) {
59
67
  this.$emit('click', options)
60
68
  this.visible = false