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,5 @@
1
1
  @import '../../styles/var.less';
2
+
2
3
  .k-popconfirm {
3
4
  display: inline-block;
4
5
  // position: relative;
@@ -9,56 +10,67 @@
9
10
  position: absolute;
10
11
  z-index: 1001;
11
12
  color: var(--kui-color-font);
13
+
12
14
  &[k-placement^=top] {
13
15
  .k-popconfirm-arrow {
14
16
  bottom: -7px;
15
17
  height: 9px;
16
18
  }
19
+
17
20
  .k-popconfirm-content {
18
21
  margin-bottom: 12px;
19
22
  }
20
23
  }
24
+
21
25
  &[k-placement=top] {
22
26
  .k-popconfirm-arrow {
23
27
  left: 50%;
24
28
  transform: translateX(-50%);
25
29
  }
26
30
  }
31
+
27
32
  &[k-placement=top-right] {
28
33
  .k-popconfirm-arrow {
29
34
  right: 10px;
30
35
  }
31
36
  }
37
+
32
38
  &[k-placement=top-left] {
33
39
  .k-popconfirm-arrow {
34
40
  left: 10px;
35
41
  }
36
42
  }
43
+
37
44
  &[k-placement^=bottom] {
38
45
  .k-popconfirm-arrow {
39
46
  top: -6px;
40
47
  height: 7px;
41
48
  transform: rotate(180deg);
42
49
  }
50
+
43
51
  .k-popconfirm-content {
44
52
  margin-top: 12px;
45
53
  }
46
54
  }
55
+
47
56
  &[k-placement=bottom] {
48
57
  .k-popconfirm-arrow {
49
58
  left: 50%;
50
59
  }
51
60
  }
61
+
52
62
  &[k-placement=bottom-left] {
53
63
  .k-popconfirm-arrow {
54
64
  left: 10px;
55
65
  }
56
66
  }
67
+
57
68
  &[k-placement=bottom-right] {
58
69
  .k-popconfirm-arrow {
59
70
  right: 10px;
60
71
  }
61
72
  }
73
+
62
74
  &[k-placement^=left] {
63
75
  .k-popconfirm-arrow {
64
76
  right: -14px;
@@ -66,26 +78,31 @@
66
78
  height: 7px;
67
79
  transform: rotate(-90deg);
68
80
  }
81
+
69
82
  .k-popconfirm-content {
70
83
  margin-right: 12px;
71
84
  }
72
85
  }
86
+
73
87
  &[k-placement=left] {
74
88
  .k-popconfirm-arrow {
75
89
  top: 50%;
76
90
  transform: translateY(-50%) rotate(-90deg);
77
91
  }
78
92
  }
93
+
79
94
  &[k-placement=left-bottom] {
80
95
  .k-popconfirm-arrow {
81
96
  bottom: 17px;
82
97
  }
83
98
  }
99
+
84
100
  &[k-placement=left-top] {
85
101
  .k-popconfirm-arrow {
86
102
  top: 17px;
87
103
  }
88
104
  }
105
+
89
106
  &[k-placement^=right] {
90
107
  .k-popconfirm-arrow {
91
108
  left: -14px;
@@ -93,21 +110,25 @@
93
110
  height: 7px;
94
111
  transform: rotate(90deg);
95
112
  }
113
+
96
114
  .k-popconfirm-content {
97
115
  margin-left: 12px;
98
116
  }
99
117
  }
118
+
100
119
  &[k-placement=right] {
101
120
  .k-popconfirm-arrow {
102
121
  top: 50%;
103
122
  transform: translateY(-50%) rotate(90deg);
104
123
  }
105
124
  }
125
+
106
126
  &[k-placement=right-top] {
107
127
  .k-popconfirm-arrow {
108
128
  top: 17px;
109
129
  }
110
130
  }
131
+
111
132
  &[k-placement=right-bottom] {
112
133
  .k-popconfirm-arrow {
113
134
  bottom: 17px;
@@ -119,28 +140,33 @@
119
140
  // .k-popconfirm-inner {
120
141
  background: var(--kui-color-control-10);
121
142
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
122
- border-radius: 12px;//var(--kui-border-radius);
143
+ border-radius: 12px; //var(--kui-border-radius);
123
144
  position: relative;
145
+
124
146
  // }
125
147
  .k-popconfirm-body {
126
148
  padding: 18px 18px 10px 18px;
127
149
  box-sizing: border-box;
128
150
  position: relative;
129
151
  }
152
+
130
153
  .k-icon {
131
154
  position: absolute;
132
155
  font-size: 18px;
133
156
  color: var(--kui-color-warning);
134
157
  top: 19px;
135
158
  }
159
+
136
160
  .k-popconfirm-footer {
137
161
  text-align: right;
138
162
  padding-top: 10px;
139
163
  }
164
+
140
165
  .k-popconfirm-title {
141
166
  padding: 0 0 0 24px;
142
167
  font-size: 14px;
143
168
  }
169
+
144
170
  .k-popconfirm-arrow {
145
171
  position: absolute;
146
172
  box-sizing: border-box;
@@ -149,43 +175,36 @@
149
175
  width: 24px;
150
176
  height: 7px;
151
177
  }
178
+
152
179
  .k-popconfirm-footer {
153
180
  text-align: right;
154
181
  padding: 8px 16px 16px;
182
+
155
183
  .k-btn {
156
184
  margin-left: 10px;
157
185
  }
158
186
  }
159
187
  }
160
188
 
161
- @keyframes pop-zoom-in {
189
+ @keyframes k-pop-zoom {
162
190
  from {
163
191
  opacity: 0;
164
192
  transform: scale(.8, .8);
165
193
  }
194
+
166
195
  to {
167
196
  opacity: 1;
168
197
  transform: scale(1, 1);
169
198
  }
170
199
  }
171
200
 
172
- @keyframes pop-zoom-out {
173
- from {
174
- opacity: 1;
175
- transform: scale(1, 1);
176
- }
177
- to {
178
- opacity: 0;
179
- transform: scale(.8, .8);
180
- }
181
- }
182
201
 
183
202
  .k-popconfirm-enter-active {
184
203
  // transform-origin: center bottom;
185
- animation: pop-zoom-in .3s;
204
+ animation: k-pop-zoom .3s;
186
205
  }
187
206
 
188
207
  .k-popconfirm-leave-active {
189
208
  // transform-origin: center bottom;
190
- animation: pop-zoom-out .3s;
209
+ animation: k-pop-zoom .3s reverse;
191
210
  }
@@ -7,7 +7,7 @@
7
7
  <template>
8
8
  <Poptip title="标题" trigger="click" v-model="show">
9
9
  <template slot="content">
10
- <a @click="show=false">Close</a>
10
+ <Button @click="show=false" size="small">Close</Button>
11
11
  </template>
12
12
  <Button type="primary">Click me</Button>
13
13
  </Poptip>
@@ -183,7 +183,7 @@
183
183
  }
184
184
  }
185
185
 
186
- @keyframes pop-zoom-in {
186
+ @keyframes k-pop-zoom {
187
187
  from {
188
188
  opacity: 0;
189
189
  transform: scale(.8, .8);
@@ -195,24 +195,13 @@
195
195
  }
196
196
  }
197
197
 
198
- @keyframes pop-zoom-out {
199
- from {
200
- opacity: 1;
201
- transform: scale(1, 1);
202
- }
203
-
204
- to {
205
- opacity: 0;
206
- transform: scale(.8, .8);
207
- }
208
- }
209
198
 
210
199
  .k-poptip-enter-active {
211
200
  // transform-origin: center bottom;
212
- animation: pop-zoom-in .3s;
201
+ animation: k-pop-zoom .3s;
213
202
  }
214
203
 
215
204
  .k-poptip-leave-active {
216
205
  // transform-origin: center bottom;
217
- animation: pop-zoom-out .3s;
206
+ animation: k-pop-zoom .3s reverse;
218
207
  }
@@ -1,4 +1,4 @@
1
- import Button from '../button';
1
+ import { Button } from '../button';
2
2
  export default {
3
3
  name: "RadioButton",
4
4
  props: {
@@ -2,11 +2,11 @@
2
2
 
3
3
  .k-rate {
4
4
  display: inline-flex;
5
- font-size: 20px;
6
5
  color: orange;
7
6
  line-height: 1;
8
7
  align-items: center;
9
8
  flex-shrink: 0;
9
+
10
10
  .k-star {
11
11
  display: inline-flex;
12
12
  margin-right: 8px;
@@ -14,6 +14,7 @@
14
14
  transition: all .3s ease;
15
15
  cursor: pointer;
16
16
  align-items: center;
17
+ transform: translateZ(0);
17
18
  .k-star-front {
18
19
  position: absolute;
19
20
  line-height: 1;
@@ -24,6 +25,13 @@
24
25
  overflow: hidden;
25
26
  width: 50%;
26
27
  opacity: 0;
28
+ display: flex;
29
+ align-items: center;
30
+ }
31
+
32
+ .k-icon {
33
+ font-size: 20px;
34
+ float: left;
27
35
  }
28
36
 
29
37
  .k-star-back {
@@ -14,7 +14,7 @@
14
14
  <Button @click="select=1" size="small">Choose orange</Button>
15
15
  </Space>
16
16
  <br />
17
- <Space vertical>
17
+ <Space vertical style="margin-top:10px;">
18
18
  <Select :width="200" placeholder="Please Choose">
19
19
  <Option :value="1" label="Apple" />
20
20
  <Option :value="2" label="Orange" />
@@ -19,7 +19,7 @@
19
19
  <Button size="small" @click="data=['3','1']">Select Banana & Apple</Button>
20
20
  </Space>
21
21
  <br/>
22
- <Space vertical>
22
+ <Space vertical style="margin-top:10px">
23
23
  <Select :width="300" multiple v-model="data2" clearable>
24
24
  <Option value="1" label="Apple" />
25
25
  <Option value="2" label="Orange" />
@@ -7,19 +7,11 @@
7
7
  <template>
8
8
  <Space vertical>
9
9
  <Checkbox v-model="checked" label="Shape" />
10
- <Select :width="256" :icon="Search" theme="light" :shape="checked?'circle':''"/>
11
- <Select :width="256" clearable filterable theme="light" :shape="checked?'circle':''">
12
- <Option value="1" label="Apple" />
13
- <Option value="2" label="Orange" />
14
- <Option value="3" label="Banana"/>
15
- <Option value="4" label="Pear" />
10
+ <Select :width="256" :icon="Search" theme="light" :shape="checked?'circle':''" :options="options" />
11
+ <Select :width="256" clearable filterable theme="light" :shape="checked?'circle':''" :options="options">
16
12
  </Select>
17
- <Select :width="256" :icon="Search" :shape="checked?'circle':''"/>
18
- <Select :width="256" multiple v-model="value" filterable theme="light">
19
- <Option value="1" label="Apple" />
20
- <Option value="2" label="Orange" />
21
- <Option value="3" label="Banana" />
22
- <Option value="4" label="Pear" />
13
+ <Select :width="256" :icon="Search" :shape="checked?'circle':''" :options="options" />
14
+ <Select :width="256" multiple v-model="value" filterable theme="light" :options="options">
23
15
  </Select>
24
16
  </Space>
25
17
  </template>
@@ -30,7 +22,13 @@ export default{
30
22
  return {
31
23
  Search,
32
24
  checked:true,
33
- value:['1','3']
25
+ value:['1','3'],
26
+ options:[
27
+ {label:'Apple' ,value: "1"},
28
+ {label:'Orange' ,value: "2"},
29
+ {label:'Banana' ,value: "3"},
30
+ {label:'Pear' ,value: "4"},
31
+ ]
34
32
  }
35
33
  },
36
34
  methods:{
@@ -46,7 +46,8 @@ export default {
46
46
  currentValue: this.value || '',
47
47
  showSearch: false,
48
48
  queryKey: '',
49
- selectWidth: this.width
49
+ selectWidth: this.width,
50
+ isFocus: false
50
51
  };
51
52
  },
52
53
  watch: {
@@ -62,7 +63,7 @@ export default {
62
63
  }
63
64
  },
64
65
  methods: {
65
- hidedrop() {
66
+ hideDrop() {
66
67
  if (this.showSearch) {
67
68
  this.queryKey = ''
68
69
  this.$refs.search.value = ''
@@ -124,16 +125,21 @@ export default {
124
125
  if (this.filterable || isSearch) {
125
126
  this.showSearch = this.opened
126
127
  if (this.opened) {
127
- this.$nextTick(e => this.$refs.search.focus())
128
+ this.$nextTick(e => {
129
+ this.isFocus = true
130
+ this.$refs.search.focus()
131
+ })
128
132
  } else {
129
133
  this.$refs.search.blur()
134
+ this.isFocus = false
135
+
130
136
  setTimeout(() => {
131
137
  this.queryKey = ''
132
138
  this.$refs.search.value = ''
133
139
  }, 200);
134
140
  }
135
141
  }
136
- this.$nextTick(e => this.setPosition())
142
+ // this.$nextTick(e => this.setPosition())
137
143
  },
138
144
  toggleDrop() {
139
145
  if (this.disabled) {
@@ -141,18 +147,21 @@ export default {
141
147
  }
142
148
  let isSearch = ('search' in this.$listeners)
143
149
  if (isSearch) {
150
+ // this.$nextTick(e => {
151
+ this.showSearch = true
144
152
  this.$nextTick(e => {
145
- this.showSearch = true
146
- this.$nextTick(e => this.$refs.search.focus())
153
+ this.$refs.search.focus()
154
+ this.isFocus = true
147
155
  })
156
+ // })
148
157
  return;
149
158
  }
150
159
  this.showDrops()
151
160
  },
152
161
  setPosition() {
153
- if (!hasProp(this, 'width')) {
154
- this.selectWidth = this.$el.offsetWidth
155
- }
162
+ // if (!hasProp(this, 'width')) {
163
+ // this.selectWidth = this.$el.offsetWidth
164
+ // }
156
165
  if (this.opened) {
157
166
  this.$refs.overlay.setPosition()
158
167
  }
@@ -170,7 +179,11 @@ export default {
170
179
  this.opened = false
171
180
  this.showSearch = false
172
181
  } else if ('search' in this.$listeners || this.filterable) {
173
- this.$nextTick(e => this.$refs.search.focus())
182
+ this.$nextTick(e => {
183
+ this.$refs.search.focus()
184
+ this.isFocus = true
185
+
186
+ })
174
187
  }
175
188
  let hasValue = hasProp(this, 'value')
176
189
  //set value
@@ -219,9 +232,10 @@ export default {
219
232
  },
220
233
  searchInput(e) {
221
234
  this.queryKey = e.target.value
235
+ //todo:
222
236
  this.$nextTick(k => {
223
- let max = this.selectWidth - 15 - (this.showArrow ? 25 : 0)
224
- e.target.style.width = (this.$refs.mirror.offsetWidth > max ? max : this.$refs.mirror.offsetWidth) + 'px'
237
+ // let max = this.selectWidth - 15 - (this.showArrow ? 25 : 0)
238
+ e.target.style.width = this.$refs.mirror.offsetWidth + 'px'
225
239
  this.setPosition()
226
240
  })
227
241
  if ('search' in this.$listeners) {
@@ -234,7 +248,11 @@ export default {
234
248
  },
235
249
  emptyClick(e) {
236
250
  if (this.showSearch) {
237
- this.$nextTick(e => this.$refs.search.focus())
251
+ this.$nextTick(e => {
252
+ this.$refs.search.focus()
253
+ this.isFocus = true
254
+
255
+ })
238
256
  }
239
257
  },
240
258
  getOptions() {
@@ -271,7 +289,7 @@ export default {
271
289
  let { disabled, size, multiple,
272
290
  opened, placeholder, showArrow, bordered,
273
291
  clear, removeTag, queryKey, theme, arrowIcon, icon, shape, filterable,
274
- clearable, label, toggleDrop, transfer } = this
292
+ clearable, label, toggleDrop, isFocus } = this
275
293
  let childNode = []
276
294
  if (arrowIcon == undefined) {
277
295
  arrowIcon = ChevronDown
@@ -287,6 +305,9 @@ export default {
287
305
  "k-select-light": theme == 'light',
288
306
  "k-select-has-icon": !!icon,
289
307
  "k-select-circle": shape == 'circle' && !multiple,
308
+ "k-select-multiple": multiple,
309
+ "k-select-show-search": isFocus,
310
+ "k-select-show-tags": multiple && (label || []).length
290
311
  }
291
312
  ]
292
313
 
@@ -295,6 +316,8 @@ export default {
295
316
  input: this.searchInput,
296
317
  blur: () => {
297
318
  if (!this.opened) this.showSearch = false
319
+ this.isFocus = false
320
+
298
321
  }
299
322
  },
300
323
  ref: 'search',
@@ -317,16 +340,19 @@ export default {
317
340
  width: this.selectWidth,
318
341
  value: opened,
319
342
  selection: this.$el,
320
- // transfer: false,
321
- transfer: transfer,
343
+ transfer: true,
344
+ extendWidth: true,
322
345
  transitionName: 'k-select',
323
346
  className: ['k-select-dropdown', { 'k-select-dropdown-multiple': this.multiple, 'k-select-dropdown-sm': size == 'small' }]
324
347
  },
325
348
  on: {
349
+ input: e => {
350
+ this.opened = e
351
+ },
326
352
  hide: () => {
327
353
  this.opened = false
328
354
  setTimeout(() => {
329
- this.hidedrop()
355
+ this.hideDrop()
330
356
  }, 300)
331
357
  }
332
358
  }
@@ -346,40 +372,44 @@ export default {
346
372
  : null
347
373
 
348
374
  const labelStyle = {
349
- opacity: this.showSearch ? .4 : 1,
375
+ // opacity: this.showSearch ? .4 : 1,
350
376
  display: queryKey.length ? 'none' : ''
351
377
  }
352
- const labelsNode = (multiple
378
+ const labelsNode = ((multiple)
353
379
  ? (
354
- <transition-group tag="div" class="k-select-labels" name="k-select-tag">{tags}{queryNode}</transition-group>
380
+ [<div class="k-select-labels" name="k-select-tag">{tags}{queryNode}</div>]
355
381
  )
356
- : <div class="k-select-label" style={labelStyle}>{label}</div>
382
+ : (label.length ? <div class="k-select-label" style={labelStyle}>{label}</div> : null)
357
383
  )
358
384
  let isSearch = ('search' in this.$listeners)
359
385
  childNode.push(labelsNode);
360
386
  placeNode && childNode.push(placeNode);
361
387
 
362
- (!isSearch && showArrow) && childNode.push(<Icon class="k-select-arrow" type={arrowIcon} />)
363
388
 
364
389
  if ((filterable || isSearch) && !multiple) {
365
390
  childNode.push(queryNode)
366
391
  }
367
-
392
+ // label = "1"
368
393
  const styles = { width: `${this.width}px` }
369
394
  let showClear = !disabled && clearable && isNotEmpty(label) && label.length > 0
370
- const selectCls = [
371
- "k-select-selection", {
372
- "k-select-has-clear": showClear,
373
- }
374
- ]
375
- showClear && childNode.push(<Icon class="k-select-clearable" type={CloseCircle} onClick={clear} />)
376
395
 
396
+ classes[1]['k-select-has-clear'] = showClear
397
+ const iconNodes = []
398
+
399
+ if (!isSearch && showArrow) {
400
+ iconNodes.push(<Icon class="k-select-arrow" type={arrowIcon} />)
401
+ }
402
+ if (showClear) {
403
+ iconNodes.push(<Icon class="k-select-clearable" type={CloseCircle} onClick={clear} />)
404
+ }
405
+ console.log(iconNodes)
406
+
407
+ iconNodes.push(" ")
377
408
  return (
378
- <div tabIndex="0" class={classes} style={styles}>
379
- <div class={selectCls} onClick={toggleDrop} ref="rel">
380
- {icon ? <Icon type={icon} class="k-select-icon" /> : null}
381
- {childNode}
382
- </div>
409
+ <div tabIndex="0" class={classes} style={styles} onClick={toggleDrop} ref="rel">
410
+ {icon ? <Icon type={icon} class="k-select-icon" /> : null}
411
+ <div class="k-select-selection">{childNode}</div>
412
+ {iconNodes}
383
413
  {overlay}
384
414
  </div >
385
415
  )