kui-vue 3.3.10 → 3.3.12

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 (60) hide show
  1. package/components/_tool/clone.js +1 -2
  2. package/components/_tool/utils.js +3 -3
  3. package/components/alert/styles/index.less +2 -2
  4. package/components/avatar/AvatarGroup.jsx +2 -2
  5. package/components/backtop/styles/index.less +44 -47
  6. package/components/base/drop.jsx +3 -2
  7. package/components/base/pop.jsx +34 -20
  8. package/components/button/button.jsx +5 -11
  9. package/components/button/index.js +1 -8
  10. package/components/button/styles/index.less +2 -2
  11. package/components/collapse/styles/index.less +3 -16
  12. package/components/colorPicker/colorpicker.jsx +1 -1
  13. package/components/colorPicker/styles/index.less +23 -21
  14. package/components/datePicker/datecalendar.jsx +5 -2
  15. package/components/datePicker/datepicker.jsx +30 -53
  16. package/components/datePicker/demo/format.md +1 -1
  17. package/components/datePicker/styles/calendar.less +31 -10
  18. package/components/datePicker/styles/datepicker.less +7 -16
  19. package/components/drawer/drawer.jsx +1 -1
  20. package/components/dropdown/demo/base.md +1 -1
  21. package/components/dropdown/demo/rightmenu.md +5 -5
  22. package/components/dropdown/dropdown.jsx +11 -3
  23. package/components/dropdown/styles/index.less +31 -13
  24. package/components/form/demo/valid.md +1 -1
  25. package/components/form/form.jsx +1 -1
  26. package/components/form/styles/index.less +3 -14
  27. package/components/fragment/component.js +98 -0
  28. package/components/fragment/frag.js +362 -0
  29. package/components/fragment/fragment.js +19 -0
  30. package/components/fragment/index.js +104 -0
  31. package/components/fragment/ssr.js +4 -0
  32. package/components/icon/demo/search.vue +1 -1
  33. package/components/image/styles/index.less +41 -17
  34. package/components/index.js +2 -2
  35. package/components/inputNumber/styles/index.less +5 -1
  36. package/components/menu/menuitem.jsx +12 -7
  37. package/components/menu/styles/index.less +189 -202
  38. package/components/menu/submenu.jsx +106 -37
  39. package/components/message/styles/index.less +11 -14
  40. package/components/modal/index.js +1 -1
  41. package/components/modal/modal.jsx +2 -2
  42. package/components/modal/styles/index.less +227 -221
  43. package/components/notice/styles/index.less +19 -5
  44. package/components/page/styles/index.less +7 -4
  45. package/components/popconfirm/styles/index.less +33 -14
  46. package/components/poptip/styles/index.less +3 -14
  47. package/components/radio/button.jsx +1 -1
  48. package/components/select/styles/index.less +13 -33
  49. package/components/styles/color.less +111 -111
  50. package/components/switch/styles/index.less +10 -10
  51. package/components/table/table.jsx +1 -1
  52. package/components/tabs/styles/index.less +3 -2
  53. package/components/tag/styles/index.less +3 -15
  54. package/components/tooltip/styles/index.less +45 -16
  55. package/components/tooltip/tooltip.jsx +3 -3
  56. package/components/tree/node.jsx +1 -1
  57. package/dist/k-ui.css +2 -2
  58. package/dist/k-ui.js +2 -2
  59. package/package.json +3 -3
  60. package/components/menu/styles/dropmenu.less +0 -119
@@ -55,6 +55,7 @@ function extractData(vnode, isComp) {
55
55
  return data
56
56
  }
57
57
 
58
+
58
59
  export default function cloneVNode(vnode, options = {}, child) {
59
60
  if (!vnode) return vnode
60
61
  // use the context that the original vnode was created in.
@@ -93,10 +94,8 @@ export default function cloneVNode(vnode, options = {}, child) {
93
94
  }
94
95
  }
95
96
  data.on = { ...oEven, ...nEven }
96
- // console.log(data, oEven, nEven)
97
97
  const tag = isComp
98
98
  ? vnode.componentOptions.Ctor
99
99
  : vnode.tag
100
- // const childNodes = children ? children.map(c => cloneVNode(c)) : undefined
101
100
  return h(tag, data, children)
102
101
  }
@@ -1,6 +1,7 @@
1
1
  export function isEmptyNode(vnode = {}) {
2
2
  return !(vnode.eml || vnode.tag || (vnode.text && vnode.text.trim() !== ''))
3
3
  }
4
+
4
5
  export function getChild(child = [], name) {
5
6
  // return child.filter(c => !isEmptyNode(c, name) )
6
7
  return child.filter(c => {
@@ -63,7 +64,6 @@ export function getElementPos(element) {
63
64
  /*
64
65
  see: https://github.com/vuejs/vue/blob/dev/src/core/vdom/vnode.js
65
66
  */
66
-
67
67
  export function cloneVNode(vnode, options = {}, childs) {
68
68
  let { componentOptions, data = {}, children } = vnode
69
69
  if (childs && children) {
@@ -76,7 +76,7 @@ export function cloneVNode(vnode, options = {}, childs) {
76
76
  componentOptions.children = componentOptions.children.concat(childs)
77
77
  }
78
78
  }
79
- let ndata = JSON.parse(JSON.stringify(data))
79
+ // let ndata = JSON.parse(JSON.stringify(data))
80
80
  let { attrs = {}, on = {}, style = {} } = data
81
81
 
82
82
  data.attrs = Object.assign(attrs, options.attrs)
@@ -151,7 +151,7 @@ export function getPosition(selection, picker, transfer, placement = 'bottom-lef
151
151
  let showInRight = clientWidth - selectionRect.right > pickerWidth
152
152
 
153
153
  // console.log(showInRight, selectionRect.left > pickerWidth, selectionRect.right, pickerWidth)
154
-
154
+ // console.log('bottom:', showInBottom, 'top:', showInTop, 'left:', showInLeft, 'right:', showInRight)
155
155
  // console.log(placement, 'showInTop:', showInTop, 'showInBottom:', showInBottom, clientHeight, scrollTop, selectionRect.top, pickerHeight)
156
156
 
157
157
  let hasBottom = placement.slice(0, 6) == 'bottom'
@@ -89,10 +89,10 @@
89
89
  }
90
90
  }
91
91
  &-slide-leave-to {
92
- animation: k-alert-slide-out 0.3s ease-in-out;
92
+ animation: k-alert-slide 0.3s ease-in-out;
93
93
  animation-fill-mode: both;
94
94
  }
95
- @keyframes k-alert-slide-out {
95
+ @keyframes k-alert-slide {
96
96
  0% {
97
97
  transform: scaleY(1);
98
98
  transform-origin: 0% 0%;
@@ -1,5 +1,5 @@
1
- import { getChild, cloneVNode } from '../_tool/utils'
2
-
1
+ import { getChild } from '../_tool/utils'
2
+ import cloneVNode from 'components/_tool/clone'
3
3
  export default {
4
4
  props: {
5
5
  maxCount: Number,
@@ -1,59 +1,56 @@
1
1
  @import '../../styles/var.less';
2
+
2
3
  .k-backtop {
3
- box-sizing: border-box;
4
- margin: 0;
5
- padding: 0;
6
- list-style: none;
7
- z-index: 10;
8
- position: fixed;
9
- right: 50px;
10
- bottom: 50px;
11
- height: 40px;
12
- width: 40px;
13
- cursor: pointer;
14
- display: block;
15
- overflow: hidden;
16
- border-radius: var(--kui-border-radius);
17
- &-content {
18
- background-color: rgba(0, 0, 0, .45);
19
- opacity: .5;
20
- height: 40px;
21
- transition: opacity .3s ease-in-out;
22
- text-align: center;
23
- line-height: 40px;
24
- color: #fff;
25
- &:hover {
26
- opacity: 1;
27
- }
28
- .k-ion {
29
- font-size: 20px;
30
- color: #fff;
31
- }
32
- }
33
- }
4
+ box-sizing: border-box;
5
+ margin: 0;
6
+ padding: 0;
7
+ list-style: none;
8
+ z-index: 10;
9
+ position: fixed;
10
+ right: 50px;
11
+ bottom: 50px;
12
+ height: 40px;
13
+ width: 40px;
14
+ cursor: pointer;
15
+ display: block;
16
+ overflow: hidden;
17
+ border-radius: var(--kui-border-radius);
18
+
19
+ &-content {
20
+ background-color: rgba(0, 0, 0, .45);
21
+ opacity: .5;
22
+ height: 40px;
23
+ transition: opacity .3s ease-in-out;
24
+ text-align: center;
25
+ line-height: 40px;
26
+ color: #fff;
34
27
 
35
- @keyframes k-backtop-fade-in {
36
- from {
37
- opacity: 0;
38
- }
39
- to {
40
- opacity: 1;
41
- }
28
+ &:hover {
29
+ opacity: 1;
30
+ }
31
+
32
+ .k-ion {
33
+ font-size: 20px;
34
+ color: #fff;
35
+ }
36
+ }
42
37
  }
43
38
 
44
- @keyframes k-backtop-fade-out {
45
- from {
46
- opacity: 1;
47
- }
48
- to {
49
- opacity: 0;
50
- }
39
+ @keyframes k-backtop-fade {
40
+ from {
41
+ opacity: 0;
42
+ }
43
+
44
+ to {
45
+ opacity: 1;
46
+ }
51
47
  }
52
48
 
49
+
53
50
  .k-backtop-fade-enter-active {
54
- animation: k-backtop-fade-in .4s;
51
+ animation: k-backtop-fade .4s;
55
52
  }
56
53
 
57
54
  .k-backtop-fade-leave-active {
58
- animation: k-backtop-fade-out .4s;
55
+ animation: k-backtop-fade .4s reverse;
59
56
  }
@@ -16,7 +16,8 @@ export default {
16
16
  trigger: { type: String, default: "click" },
17
17
  transitionName: { type: String, default: 'dropdown' },
18
18
  selection: { validator: v => true },
19
- updateKey: [String, Object, Array]
19
+ updateKey: [String, Object, Array],
20
+ offsetLeft: { type: Number, default: 0 }
20
21
  },
21
22
 
22
23
  watch: {
@@ -121,7 +122,7 @@ export default {
121
122
  let { selection, transfer, placement } = this
122
123
  getPosition(selection, this.$el, transfer, placement, (top, left, origin, placement) => {
123
124
  this.top = top
124
- this.left = left
125
+ this.left = left + (placement.includes('right') ? this.offsetLeft : -this.offsetLeft)
125
126
  // this.minWidth = this.selection.offsetWidth
126
127
  this.transformOrigin = origin
127
128
  this.currentPlacement = placement
@@ -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
151
  transfer,
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 }
@@ -24,8 +24,8 @@
24
24
 
25
25
  // &:focus,
26
26
  &:hover {
27
- border-color: var(--kui-color-main-hover);
28
- color: var(--kui-color-main-hover);
27
+ border-color: var(--kui-color-main);
28
+ color: var(--kui-color-main);
29
29
  z-index: 1;
30
30
  }
31
31
 
@@ -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'
@@ -8,11 +8,13 @@
8
8
  position: relative;
9
9
  display: inline-block;
10
10
  box-sizing: content-box;
11
+
11
12
  &:hover,
12
13
  &:focus {
13
14
  border-color: var(--kui-color-main-hover);
14
15
  }
15
- &:active{
16
+
17
+ &:active {
16
18
  opacity: .8;
17
19
  }
18
20
 
@@ -57,20 +59,32 @@
57
59
  transform: rotate(180deg);
58
60
  }
59
61
  }
60
- .k-color-picker-opened{
62
+
63
+ .k-color-picker-opened {
61
64
  border: 1px solid var(--kui-color-main);
62
- box-shadow: 0 0 5px var(--kui-color-main-30);
65
+ box-shadow: 0 0 0 2px var(--kui-color-main-90);
63
66
  }
64
67
 
65
68
  .k-color-picker-disabled {
66
69
  cursor: not-allowed;
67
70
  background: var(--kui-color-disable-back);
68
71
  border-color: var(--kui-color-disable-border);
69
- cursor: not-allowed;
72
+
73
+ * {
74
+ cursor: not-allowed;
75
+ }
70
76
 
71
77
  .k-color-picker-color {
72
78
  opacity: .5;
73
79
  }
80
+
81
+ &:hover {
82
+ border-color: var(--kui-color-disable-border);
83
+ }
84
+
85
+ &:active {
86
+ opacity: 1;
87
+ }
74
88
  }
75
89
 
76
90
  .k-color-picker-lg {
@@ -121,7 +135,7 @@
121
135
  position: absolute;
122
136
  background: var(--kui-color-back);
123
137
  border: 1px solid var(--kui-color-border);
124
- box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
138
+ box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
125
139
  border-radius: 50%;
126
140
  top: 10px;
127
141
  left: 10px;
@@ -180,7 +194,7 @@
180
194
  position: absolute;
181
195
  background: var(--kui-color-back);
182
196
  border: 1px solid var(--kui-color-border);
183
- box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
197
+ box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
184
198
  border-radius: 50%;
185
199
  pointer-events: none;
186
200
  }
@@ -289,7 +303,7 @@
289
303
  }
290
304
  }
291
305
 
292
- @keyframes dropDownIn {
306
+ @keyframes drop-down {
293
307
  0% {
294
308
  opacity: 0;
295
309
  transform: scaleY(0)
@@ -301,24 +315,12 @@
301
315
  }
302
316
  }
303
317
 
304
- @keyframes dropDownOut {
305
- 0% {
306
- opacity: 1;
307
- transform: scaleY(1)
308
- }
309
-
310
- to {
311
- opacity: 0;
312
- transform: scaleY(0)
313
- }
314
- }
315
-
316
318
  .k-color-picker-enter-active {
317
319
  transform-origin: 0 0;
318
- animation: dropDownIn .3s;
320
+ animation: drop-down .3s;
319
321
  }
320
322
 
321
323
  .k-color-picker-leave-active {
322
324
  transform-origin: 0 0;
323
- animation: dropDownOut .3s
325
+ animation: drop-down .3s reverse;
324
326
  }
@@ -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 {
@@ -164,7 +164,9 @@ export default {
164
164
  }
165
165
  },
166
166
  isDisabled(date) {
167
- return (this.v1 && this.isRange && dayjs(date).isBefore(this.v1, 'date') && !this.v2) || this.disabledDate(date)
167
+ return (this.v1 && this.isRange && dayjs(date).isBefore(this.v1, 'date') && !this.v2)
168
+ || (this.v2 && this.isRange && dayjs(date).isAfter(this.v2, 'date') && !this.v1)
169
+ || this.disabledDate(date)
168
170
  },
169
171
  dayMouseHover(date) {
170
172
  if (this.v1 && !this.v2) {
@@ -311,6 +313,7 @@ export default {
311
313
  },
312
314
  getTimesNode() {
313
315
  let { $H, $m, $s } = this.date
316
+ // console.log($H, $m, $s)
314
317
  let hours = [], minus = [], sec = [];
315
318
  //hour
316
319
  for (let j = 0; j < 24; j++) {