kui-vue 3.3.10 → 3.3.11

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.
@@ -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'
@@ -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
 
@@ -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,7 +59,8 @@
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
65
  box-shadow: 0 0 5px var(--kui-color-main-30);
63
66
  }
@@ -66,11 +69,22 @@
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 {
@@ -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++) {
@@ -45,8 +45,8 @@ export default {
45
45
  opened: false,
46
46
  currentValue: this.value,
47
47
  v1: null, // render selected
48
- v2: null,
49
- d1: null, //render date
48
+ v2: null, //
49
+ d1: null, //render date view
50
50
  d2: null,
51
51
  h2: null,
52
52
  fmt: {
@@ -102,7 +102,7 @@ export default {
102
102
  this.d1 = a ? dayjs(a) : dayjs()
103
103
  this.d2 = b ? dayjs(b) : dayjs().add(1, 'month')
104
104
  if (this.d1.isSame(this.d2, 'month')) {
105
- this.d2 = this.d1.add(1, 'month')
105
+ this.d2 = this.d2.add(1, 'month')
106
106
  }
107
107
  // this.currentValue = [dayjs(this.d1), dayjs(this.d2)]
108
108
  } else {
@@ -140,10 +140,9 @@ export default {
140
140
  }
141
141
  },
142
142
  picker1Update(value, type) {
143
- console.log(type)
144
143
  let { isRange, format, fmt, mode } = this
145
144
  if (!isRange) {
146
- if (!type) {
145
+ if (!type) { //for day
147
146
  this.d1 = dayjs(value)
148
147
  this.v1 = dayjs(value)
149
148
  } else {
@@ -166,94 +165,73 @@ export default {
166
165
  this.d1 = dayjs(value)
167
166
  if (!v1 && !v2) {
168
167
  this.v1 = dayjs(value)
169
- this.currentValue = [dayjs(value),]
168
+ this.currentValue = [dayjs(value), v2]
170
169
  } else if (v1 && !v2) {
171
170
  this.v2 = dayjs(value)
172
171
  this.currentValue = [v1, this.v2]
173
172
 
174
- let ft = format || fmt[mode]
175
- let dateStr = [v1.format(ft), this.v2.format(ft)]
176
- // console.log(dateStr)
177
- // return
173
+ this.updateStr()
178
174
 
179
- this.$emit('input', dateStr)
180
- this.$emit('change', this.currentValue, dateStr)
181
- this.updateCalendDate()
182
175
  if (!withTime) {
183
176
  this.opened = false
184
177
  }
185
- console.log('22')
186
178
  } else if (v1 && v2) {
187
- console.log('333')
188
179
  this.v1 = dayjs(value)
189
180
  this.v2 = null
190
- this.currentValue = [dayjs(value),]
181
+ this.currentValue = [dayjs(value), v2]
191
182
  }
192
183
  } else {
193
- console.log('11')
194
- this.v1 = (this.v1 || dayjs())[type](value)
195
-
184
+ this.v1 = (this.v1 || dayjs(this.d1))[type](value)
196
185
  this.currentValue = [this.v1, v2]
197
186
  this.d1 = this.d1[type](value)
198
187
 
199
- let ft = format || fmt[mode]
200
- let dateStr = [v1.format(ft), this.v2.format(ft)]
201
- this.$emit('input', dateStr)
202
- this.$emit('change', this.currentValue, dateStr)
203
- this.updateCalendDate()
188
+ this.updateStr()
204
189
  }
205
190
  if (this.d1.isSame(this.d2, 'month') || this.d1.isAfter(this.d2, 'month')) {
206
- this.d2 = this.d1.add(1, 'month')
191
+ this.d2 = this.d2.add(1, 'month')
207
192
  }
208
193
  }
209
194
  },
195
+
210
196
  picker2Update(value, type) {
211
197
  let { v1, v2, withTime, format, fmt, mode } = this
212
- if (!type) { //day
213
- this.d2 = value
214
- if (!v1 && !v2) {
198
+ if (!type) { //for day
199
+ this.d2 = dayjs(value)
200
+ if (!v1) {
215
201
  this.v1 = dayjs(value)
216
- this.currentValue = [dayjs(value),]
202
+ this.currentValue = [dayjs(value), v2]
217
203
  } else if (v1 && !v2) {
218
204
  this.v2 = dayjs(value)
219
205
  this.currentValue = [v1, this.v2]
220
206
 
221
- let ft = format || fmt[mode]
222
- let dateStr = [v1.format(ft), this.v2.format(ft)]
223
- this.$emit('input', dateStr)
224
- this.$emit('change', this.currentValue, dateStr)
225
- this.updateCalendDate()
226
-
227
- // console.log(dateStr)
207
+ this.updateStr()
228
208
  if (!withTime) {
229
209
  this.opened = false
230
210
  }
231
211
  } else if (v1 && v2) {
232
212
  this.v1 = dayjs(value)
233
213
  this.v2 = null
234
- this.currentValue = [dayjs(value),]
214
+ this.currentValue = [dayjs(value), this.v2]
235
215
  }
236
216
  } else { //for year , month , datetime
237
- if (!this.v1) {
238
- this.v1 = (this.v1 || dayjs())[type](value)
239
- this.currentValue = [this.v1, v2]
240
- this.d2 = this.d2[type](value)
241
- } else {
242
- this.v2 = (this.v2 || dayjs())[type](value)
243
- this.currentValue = [v1, this.v2]
244
- this.d2 = this.d2[type](value)
245
- }
246
217
 
247
- let ft = format || fmt[mode]
248
- let dateStr = [v1.format(ft), this.v2.format(ft)]
249
- this.$emit('input', dateStr)
250
- this.$emit('change', this.currentValue, dateStr)
251
- this.updateCalendDate()
218
+ this.v2 = (this.v2 || dayjs(this.d2))[type](value)
219
+ this.d2 = this.d2[type](value)
220
+ this.currentValue = [v1, this.v2]
221
+ this.updateStr()
252
222
  }
253
223
  if (this.d2.isSame(this.d1, 'month') || this.d2.isBefore(this.d1, 'month')) {
254
- this.d1 = this.d2.subtract(1, 'month')
224
+ this.d1 = this.d1.subtract(1, 'month')
255
225
  }
256
226
  },
227
+ updateStr() {
228
+ let { v1, v2, withTime, format, fmt, mode } = this
229
+ let ft = format || fmt[mode]
230
+ let dateStr = [v1 ? v1.format(ft) : null, v2 ? v2.format(ft) : null]
231
+ this.$emit('input', dateStr)
232
+ this.$emit('change', this.currentValue, dateStr)
233
+ this.updateCalendDate()
234
+ },
257
235
  validValue(e) {
258
236
  // 只有一个值的时候, 直接置空
259
237
  if (this.isRange) {
@@ -383,7 +361,6 @@ export default {
383
361
  if (v) {
384
362
  this.opened = false
385
363
  this.validValue(e)
386
-
387
364
  }
388
365
  },
389
366
  hd: (v) => {
@@ -6,7 +6,7 @@
6
6
  ```vue
7
7
  <template>
8
8
  <div>
9
- <DatePicker value="2019-10-12 22:12:12" format="YYYY年MM月DD日 HH:mm:ss" mode="dateTime"/>
9
+ <DatePicker value="2019-10-12 22:12:12" format="YYYY年MM月DD日 HH:mm:ss" mode="dateTime" style="width:210px"/>
10
10
  <br/>
11
11
  <DatePicker value="2019-10-12" format="YYYY/MM/DD"/>
12
12
  <br/>
@@ -108,10 +108,18 @@
108
108
  &:hover {
109
109
  background-color: var(--kui-color-hover);
110
110
  }
111
+
112
+ &:active {
113
+ background-color: var(--kui-color-actived);
114
+ }
111
115
  }
112
116
 
113
117
  .k-calendar-item-selected {
114
- background-color: var(--kui-color-main-80);
118
+ background-color: var(--kui-color-main-90);
119
+
120
+ &:hover {
121
+ background-color: var(--kui-color-main-90);
122
+ }
115
123
  }
116
124
  }
117
125
 
@@ -156,7 +164,11 @@
156
164
  box-sizing: border-box;
157
165
 
158
166
  &:hover {
159
- background: var(--kui-color-main-80);
167
+ background: var(--kui-color-hover);
168
+ }
169
+
170
+ &:active {
171
+ background: var(--kui-color-actived);
160
172
  }
161
173
  }
162
174
 
@@ -167,11 +179,11 @@
167
179
 
168
180
  .k-calendar-day-in {
169
181
  // color: var(--kui-color-main-80);
170
- background: var(--kui-color-main-80);
182
+ background: var(--kui-color-main-90);
171
183
  }
172
184
 
173
- .k-calendar-year-this,
174
- .k-calendar-month-this,
185
+ // .k-calendar-year-this,
186
+ // .k-calendar-month-this,
175
187
  .k-calendar-day-this {
176
188
  // border: 1px solid var(--kui-color-main);
177
189
  color: var(--kui-color-main);
@@ -246,7 +258,7 @@
246
258
  content: '';
247
259
  display: block;
248
260
  width: 100%;
249
- height: 114px;
261
+ height: 127px;
250
262
  }
251
263
 
252
264
  &::-webkit-scrollbar {
@@ -275,14 +287,23 @@
275
287
  transition: all .3s;
276
288
 
277
289
  &:hover {
278
- background: var(--kui-color-main-90);
290
+ background: var(--kui-color-hover);
279
291
  }
292
+
293
+ &:active {
294
+ background: var(--kui-color-actived);
295
+ }
296
+
280
297
  }
281
298
 
282
299
  .k-calendar-item-selected {
283
- color: var(--kui-color-main);
284
- font-weight: bold;
285
- background: var(--kui-color-main-80);
300
+ // color: var(--kui-color-main);
301
+ // font-weight: bold;
302
+ background: var(--kui-color-main-90);
303
+
304
+ &:hover {
305
+ background: var(--kui-color-main-90);
306
+ }
286
307
  }
287
308
 
288
309
  .k-calendar-time-disabled {
@@ -1,9 +1,10 @@
1
1
  @import '../../styles/var.less';
2
2
 
3
3
  .k-datepicker {
4
- display: inline-block;
4
+ display: inline-flex;
5
+ box-sizing: border-box;
5
6
  // width: 100%;
6
- max-width: 100%;
7
+ // max-width: 100%;
7
8
  box-sizing: border-box;
8
9
  vertical-align: middle;
9
10
  color: var(--kui-color-font);
@@ -32,7 +32,7 @@
32
32
  <FormItem label="Captcha" prop="captcha">
33
33
  <Input >
34
34
  <template slot="suffix">
35
- <Button size="small" type="primary" v-if="time==60" @click="sendCode">获取验证码</Button>
35
+ <Button size="small" type="primary" v-if="time==60" theme="normal" @click="sendCode">获取验证码</Button>
36
36
  <span v-else>{{time}}(s)</span>
37
37
  </template>
38
38
  </Input>
@@ -45,7 +45,11 @@
45
45
 
46
46
  &:hover {
47
47
  color: var(--kui-color-main);
48
- background-color: var(--kui-color-gray-80);
48
+ background-color: var(--kui-color-hover);
49
+ }
50
+ &:active {
51
+ color: var(--kui-color-main);
52
+ background-color: var(--kui-color-actived);
49
53
  }
50
54
 
51
55
  &:first-child {
@@ -9,6 +9,7 @@
9
9
  display: flex;
10
10
  align-items: center;
11
11
  flex-shrink: 0;
12
+
12
13
  .k-pager {
13
14
  margin: 0;
14
15
  display: flex;
@@ -39,7 +40,7 @@
39
40
  &:hover {
40
41
  // border-color: var(--kui-color-main-hover);
41
42
  // color: var(--kui-color-main-hover);
42
- background-color: var(--kui-color-border);
43
+ background-color: var(--kui-color-hover);
43
44
 
44
45
  .k-icon {
45
46
  color: var(--kui-color-main-hover);
@@ -47,8 +48,9 @@
47
48
  }
48
49
 
49
50
  &:active {
50
- border-color: var(--kui-color-main-actived);
51
- color: var(--kui-color-main-actived);
51
+ // border-color: var(--kui-color-main-actived);
52
+ background-color: var(--kui-color-actived);
53
+ // color: var(--kui-color-main-actived);
52
54
 
53
55
  .k-icon {
54
56
  color: var(--kui-color-main-actived);
@@ -112,7 +114,8 @@
112
114
  }
113
115
 
114
116
  &:hover {
115
- border-color: var(--kui-color-disable-border);
117
+ // border-color: var(--kui-color-disable-border);
118
+ background: none;
116
119
 
117
120
  .k-icon {
118
121
  color: var(--kui-color-disable-color);
@@ -333,6 +333,9 @@
333
333
  &:hover {
334
334
  background: var(--kui-color-hover);
335
335
  }
336
+ &:active {
337
+ background: var(--kui-color-actived);
338
+ }
336
339
 
337
340
  .k-icon {
338
341
  position: absolute;
@@ -353,8 +356,8 @@
353
356
 
354
357
  .k-select-item-selected {
355
358
  background: var(--kui-color-selected);
356
- color: var(--kui-color-main);
357
- font-weight: 500;
359
+ // color: var(--kui-color-main);
360
+ font-weight: bold;
358
361
 
359
362
  &:hover {
360
363
  background: var(--kui-color-selected);