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
@@ -3,7 +3,6 @@ import BasePop from '../base/pop'
3
3
  import CMenu from './menu.jsx'
4
4
  import { getChild, isVnode } from '../_tool/utils'
5
5
  import Icon from '../icon'
6
- // import cloneVNode from '../_tool/clone'
7
6
  import { ChevronDown, ChevronForward } from 'kui-icons'
8
7
 
9
8
  export default {
@@ -30,8 +29,14 @@ export default {
30
29
  left: null,
31
30
  minWidth: null,
32
31
  rendered: false,
32
+ zIndex: 1,
33
33
  };
34
34
  },
35
+ created() {
36
+ if (this.SubMenu) {
37
+ this.zIndex += this.SubMenu.zIndex
38
+ }
39
+ },
35
40
  mounted() {
36
41
  let { SubMenu, Menu } = this
37
42
  if (Menu) {
@@ -56,7 +61,7 @@ export default {
56
61
  render() {
57
62
  let { $slots, disabled, Dropdown, opened, Menu, SubMenu, icon, rendered } = this
58
63
  let key = this.$vnode.key || 'sub_' + this._uid
59
- const { currentMode, theme, selectedKeys, inlineCollapsed,
64
+ const { currentMode, theme, selectedKeys, inlineCollapsed,
60
65
  mode, defaultOpenKeys } = Menu
61
66
  let selected = selectedKeys.indexOf(key) >= 0
62
67
 
@@ -74,38 +79,40 @@ export default {
74
79
  class: `k-${preCls}-title`,
75
80
  on: {
76
81
  click: () => this.openChange(),
77
- mouseenter: () => this.showPopupMenu(),
78
- mouseleave: () => this.hidePopupMenu()
82
+ mouseenter: this.showPopupMenu,
83
+ mouseleave: this.hidePopupMenu
84
+ },
85
+ style: {
79
86
  }
80
87
  }
81
-
88
+ if (SubMenu && SubMenu.zIndex > 0 && (Menu && Menu.mode == 'inline' && !Menu.inlineCollapsed)) {
89
+ titleProps.style.paddingLeft = this.zIndex * 16 + 'px'
90
+ }
82
91
  let title = this.title || $slots.title
83
92
  const titleNode = <div {...titleProps}>
84
- <span class={`k-${preCls}-inner`}>
85
- {icon ? <Icon type={icon} /> : null}
86
- {isVnode(title) ? title : <span>{title}</span>}
87
- </span>
93
+ {icon ? <Icon type={icon} class="k-menu-item-icon" /> : null}
94
+ {<span class="k-menu-title-content">{title}</span>}
88
95
  <Icon type={(showInline && !inlineCollapsed) || (currentMode == 'horizontal' && SubMenu == null) ?
89
96
  ChevronDown : ChevronForward} class={`k-${preCls}-arrow`} />
90
97
  </div>
91
98
 
92
99
  const popupProps = {
93
100
  slot: 'content',
94
- class: [`k-${preCls}-popup`],
101
+ class: [`k-${preCls}-sub`],
95
102
  style: {
96
103
  'min-width': `${this.minWidth}px`,
97
104
  'margin-left': theme == 'dark' && !SubMenu && mode == "horizontal" ? '-16px' : null
98
105
  },
99
106
  on: {
100
- mouseenter: () => {
101
- clearTimeout(this.timer);
102
- this.active = true;
103
- if (!showInline)
104
- this.opened = true
105
- },
106
- mouseleave: () => {
107
- this.hidePopupMenu()
108
- },
107
+ // mouseenter: () => {
108
+ // clearTimeout(this.timer);
109
+ // this.active = true;
110
+ // // if (!showInline)
111
+ // // this.opened = true
112
+ // },
113
+ // mouseleave: () => {
114
+ // // this.hidePopupMenu()
115
+ // },
109
116
  }
110
117
  }
111
118
 
@@ -119,27 +126,46 @@ export default {
119
126
  }
120
127
  const childNode = <div {...popupProps}><CMenu mode={types} theme={theme}>{$slots.default}</CMenu></div>
121
128
 
122
- let popMenuNode = null
123
- if (((!showInline || inlineCollapsed) && !SubMenu && !Dropdown)) {
124
- const popProps = {
129
+ // let popMenuNode = null
130
+ let popNodes = [titleNode]
131
+ // if (((!showInline || inlineCollapsed) && !SubMenu && !Dropdown)) {
132
+ let popProps = {}
133
+ if (!showInline || inlineCollapsed) {
134
+ popProps = {
125
135
  props: {
136
+ isMenu: true,
126
137
  showPlacementArrow: false,
127
138
  preCls: preCls + '-popup',
128
- transfer: !SubMenu,
129
- placement: currentMode == 'horizontal' ? 'bottom-left' : 'right-top',
139
+ // transfer: !SubMenu,
140
+ transfer: true,
141
+ placement: currentMode == 'horizontal' && !SubMenu && !Dropdown ? 'bottom-left' : 'right-top',
130
142
  value: opened,
143
+ offsetLeft: currentMode == 'vertical' || inlineCollapsed || (currentMode == 'horizontal' && SubMenu) ? 6 : 0,
131
144
  },
132
145
  on: {
146
+ click: this.openChange,
147
+ mouseleave: this.subMouseLeave,
148
+ mouseenter: this.subMouseEnter,
133
149
  input: (opened) => {
134
- if (currentMode == 'horizontal')
135
- this.minWidth = this.$el.offsetWidth
150
+ this.opened = opened
151
+ // if (currentMode == 'horizontal') {
152
+ // this.minWidth = this.$el.offsetWidth
153
+ // }
136
154
  }
137
155
  }
138
156
  }
139
- popMenuNode = <BasePop {...popProps}>{[titleNode, childNode]}</BasePop>
157
+ // popMenuNode = <BasePop {...popProps} ref="pop">{[titleNode, childNode]}</BasePop>
140
158
  } else {
141
- popMenuNode = [titleNode, rendered ? <Collapse collapse={showInline && !inlineCollapsed}
142
- name={'k-' + preCls + (showInline && !inlineCollapsed && !Dropdown ? '-slide' : '-fade')}>{childNode}</Collapse> : null]
159
+ // popMenuNode = [titleNode, rendered ? <Collapse collapse={showInline && !inlineCollapsed}
160
+ // name={'k-' + preCls + (showInline && !inlineCollapsed && !Dropdown ? '-slide' : '-fade')}>{childNode}</Collapse> : null]
161
+ }
162
+ let CollapseNode = null
163
+
164
+ if (!showInline || inlineCollapsed) {
165
+ popNodes.push(childNode)
166
+ } else if (rendered) {
167
+ CollapseNode = <Collapse collapse={showInline && !inlineCollapsed}
168
+ name={'k-' + preCls + (showInline && !inlineCollapsed && !Dropdown ? '-slide' : '-fade')}>{childNode}</Collapse>
143
169
  }
144
170
  const classes = [`k-${preCls}`, {
145
171
  [`k-${preCls}-active`]: this.active,
@@ -148,17 +174,48 @@ export default {
148
174
  [`k-${preCls}-disabled`]: disabled
149
175
  }]
150
176
 
151
- return (<li class={classes}>{popMenuNode}</li>)
177
+ return (<li class={classes}>{<BasePop {...popProps} ref="pop">{titleNode}{popNodes}</BasePop>}{CollapseNode}</li>)
178
+ // return (<li class={classes}>{popMenuNode}</li>)
152
179
  },
153
180
  methods: {
154
- hidePopupMenu() {
181
+ subMouseEnter(e) {
182
+ if (this.disabled) return;
183
+ clearTimeout(this.timer)
184
+ let sub = this.SubMenu
185
+ // console.log(this.SubMenu, this.Dropdown)
186
+ while (sub) {
187
+ // sub.active = true
188
+ clearTimeout(sub.timer)
189
+ clearTimeout(sub.$refs.pop.timer)
190
+ sub = sub.SubMenu
191
+ }
192
+ let drop = this.Dropdown
193
+ if (drop) {
194
+ clearTimeout(drop.timer)
195
+ clearTimeout(drop.$refs.pop.timer)
196
+ }
197
+ },
198
+ subMouseLeave(e) {
199
+ if (this.disabled) return;
200
+ let sub = this.SubMenu
201
+ this.hidePopupMenu()
202
+ while (sub) {
203
+ sub.hidePopupMenu()
204
+ sub = sub.SubMenu
205
+ }
206
+ let drop = this.Dropdown
207
+ if (drop) {
208
+ drop.hidePopup()
209
+ }
210
+ },
211
+ hidePopupMenu() { //for sub title
155
212
  if (this.disabled) return;
156
- this.active = false
157
213
  let { Menu } = this
158
214
  let { currentMode, inlineCollapsed } = Menu
159
215
  if (currentMode != 'inline' || inlineCollapsed) {
160
216
  clearTimeout(this.timer)
161
217
  this.timer = setTimeout(() => {
218
+ this.active = false
162
219
  this.opened = false
163
220
 
164
221
  let openKeys = [].concat(Menu.defaultOpenKeys)
@@ -166,15 +223,25 @@ export default {
166
223
  index = openKeys.indexOf(key)
167
224
  index > -1 && openKeys.splice(index, 1)
168
225
  Menu.openChange(openKeys)
169
- }, 300);
226
+ }, 200);
170
227
  }
171
228
  },
172
- showPopupMenu() {
229
+ showPopupMenu() { //for sub title
173
230
  if (this.disabled) return;
174
- clearTimeout(this.timer)
175
- this.active = true
176
231
  let { Menu } = this
177
232
  let { currentMode, inlineCollapsed } = Menu
233
+ if (currentMode == 'inline' && !inlineCollapsed) return;
234
+ clearTimeout(this.timer)
235
+ this.active = true
236
+ if (this.$refs.pop) {
237
+ clearTimeout(this.$refs.pop.timer)
238
+ }
239
+ if (this.Dropdown) {
240
+ clearTimeout(this.Dropdown.timer)
241
+ }
242
+ if (currentMode == 'horizontal') {
243
+ this.minWidth = this.$el.offsetWidth
244
+ }
178
245
  if (currentMode != 'inline' || inlineCollapsed) {
179
246
  this.rendered = true
180
247
  this.$nextTick(() => {
@@ -188,9 +255,10 @@ export default {
188
255
  }
189
256
  },
190
257
  openChange() {
258
+ if (this.disabled) return;
191
259
  if (this.Menu) {
192
260
  let { currentMode, defaultOpenKeys, accordion, inlineCollapsed } = this.Menu
193
- if (currentMode != 'inline' || inlineCollapsed) return;
261
+ // if (currentMode != 'inline' || inlineCollapsed) return;
194
262
  let openKeys = [].concat(defaultOpenKeys)
195
263
  let key = this.$vnode.key || 'sub_' + this._uid
196
264
  let index = openKeys.indexOf(key)
@@ -213,6 +281,7 @@ export default {
213
281
  }
214
282
  },
215
283
  handleClick(options) { //item click event
284
+ // if (this.disabled) return;
216
285
  let key = this.$vnode.key || 'sub_' + this._uid
217
286
  options.keyPath.unshift(key)
218
287
  let parent = this.SubMenu || this.Menu
@@ -1,4 +1,5 @@
1
1
  @import '../../styles/var.less';
2
+
2
3
  .k-message {
3
4
  font-size: 14px;
4
5
  line-height: 1.5;
@@ -12,6 +13,7 @@
12
13
  top: 16px;
13
14
  left: 0;
14
15
  pointer-events: none;
16
+
15
17
  .k-message-box {
16
18
  box-sizing: content-box;
17
19
  padding: 0 12px 14px 12px;
@@ -19,6 +21,7 @@
19
21
  transition: all .3s;
20
22
  // margin-top: -8px;
21
23
  }
24
+
22
25
  .k-message-content {
23
26
  box-sizing: content-box;
24
27
  line-height: 1;
@@ -30,12 +33,14 @@
30
33
  align-items: center;
31
34
  pointer-events: all;
32
35
  align-items: center;
36
+
33
37
  .k-message-icon {
34
38
  margin-right: 8px;
35
39
  font-size: 22px;
36
40
  vertical-align: sub;
37
41
  }
38
42
  }
43
+
39
44
  .k-message-close {
40
45
  overflow: hidden;
41
46
  cursor: pointer;
@@ -44,7 +49,8 @@
44
49
  vertical-align: sub;
45
50
  border-radius: var(--kui-border-radius);
46
51
  padding: 2px;
47
- &:hover{
52
+
53
+ &:hover {
48
54
  background-color: var(--kui-color-gray-80);
49
55
  }
50
56
  }
@@ -66,32 +72,23 @@
66
72
  color: var(--kui-color-warning);
67
73
  }
68
74
 
69
- @keyframes msgIn {
75
+ @keyframes k-message-slide {
70
76
  from {
71
77
  opacity: 0;
72
78
  margin-top: -55px;
73
79
  }
80
+
74
81
  to {
75
82
  opacity: 1;
76
83
  margin-top: 0;
77
84
  }
78
85
  }
79
86
 
80
- @keyframes msgOut {
81
- from {
82
- opacity: 1;
83
- margin-top: 0;
84
- }
85
- to {
86
- opacity: -55px;
87
- margin-top: 0;
88
- }
89
- }
90
87
 
91
88
  .k-message-slide-enter-active {
92
- animation: msgIn .3s ease;
89
+ animation: k-message-slide .3s ease;
93
90
  }
94
91
 
95
92
  .k-message-slide-leave-active {
96
- animation: msgOut .3s ease;
93
+ animation: k-message-slide .3s ease reverse;
97
94
  }
@@ -1,7 +1,7 @@
1
1
  import Modal from './modal.jsx'
2
2
  import Icon from '../icon'
3
3
  import Vue from 'vue'
4
- import Button from '../button'
4
+ import {Button} from '../button'
5
5
  import { t } from '../locale'
6
6
  import{InformationCircle,CloseCircle,CheckmarkCircle,AlertCircle,HelpCircle} from 'kui-icons'
7
7
  const SSR = Vue && Vue.prototype.$isServer
@@ -1,5 +1,5 @@
1
1
  import Icon from '../icon'
2
- import Button from '../button'
2
+ import { Button } from '../button'
3
3
  import transfer from "../_tool/transfer";
4
4
  import { measureScrollBar, getOffset } from '../_tool/utils'
5
5
  import { t } from '../locale'
@@ -185,7 +185,7 @@ export default {
185
185
  let contentNode = $slots.content
186
186
  if (!contentNode) {
187
187
  const contents = []
188
- this.showClose && contents.push(<span class="k-modal-close" onClick={this.close}><Icon type={Close} strokeWidth={50}/></span>)
188
+ this.showClose && contents.push(<span class="k-modal-close" onClick={this.close}><Icon type={Close} strokeWidth={50} /></span>)
189
189
  this.title !== null && contents.push(<div class="k-modal-header" ref="hRef"><div class="k-modal-header-inner">{this.title}</div></div>)
190
190
  contents.push(<div class="k-modal-body">{$slots.default}</div>)
191
191