vue2-client 1.16.86 → 1.16.88

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.
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="x-time-select" :class="wrapperClassObject">
2
+ <div class="x-time-select" :class="[{ 'has-nav-arrows': navArrows }, wrapperClassObject]">
3
3
  <div class="time-select-container">
4
4
  <div v-if="type === 'range'" class="picker-wrapper">
5
5
  <span v-if="showCalendarIcon" class="left-calendar-icon"><a-icon type="calendar" /></span>
@@ -14,7 +14,7 @@
14
14
  @change="handleDateChange"
15
15
  />
16
16
  </div>
17
- <div v-if="type === 'date'" class="picker-wrapper">
17
+ <div v-if="type === 'date' && !navArrows" class="picker-wrapper">
18
18
  <span v-if="showCalendarIcon" class="left-calendar-icon"><a-icon type="calendar" /></span>
19
19
  <a-date-picker
20
20
  :value="dateRange[0]"
@@ -25,6 +25,29 @@
25
25
  @change="handleDateChange"
26
26
  />
27
27
  </div>
28
+ <div v-if="type === 'date' && navArrows" class="picker-wrapper nav-arrows-wrapper">
29
+ <span
30
+ v-if="!disabled"
31
+ class="nav-arrow nav-arrow-left"
32
+ @mousedown.prevent.stop
33
+ @click.stop="handleShiftDay(-1)"
34
+ ><a-icon type="left" /></span>
35
+ <a-date-picker
36
+ :value="dateRange[0]"
37
+ :format="format"
38
+ :disabled="disabled"
39
+ :allowClear="allowClear"
40
+ :showTime="showTime"
41
+ :suffixIcon="null"
42
+ @change="handleDateChange"
43
+ />
44
+ <span
45
+ v-if="!disabled"
46
+ class="nav-arrow nav-arrow-right"
47
+ @mousedown.prevent.stop
48
+ @click.stop="handleShiftDay(1)"
49
+ ><a-icon type="right" /></span>
50
+ </div>
28
51
 
29
52
  </div>
30
53
  </div>
@@ -61,6 +84,10 @@ export default {
61
84
  format: {
62
85
  type: String,
63
86
  default: 'YYYY-MM-DD'
87
+ },
88
+ navArrows: {
89
+ type: Boolean,
90
+ default: false
64
91
  }
65
92
  },
66
93
  data () {
@@ -158,6 +185,8 @@ export default {
158
185
  }
159
186
  // 处理图标开关配置(默认关闭)
160
187
  this.showCalendarIcon = res && res.showCalendarIcon === true
188
+ // 处理左右箭头开关配置(默认关闭)
189
+ this.navArrows = !!(res && (res.navArrows === true || res.showNavArrows === true))
161
190
  // 处理defaultTime配置
162
191
  if (res.defaultTime !== undefined) {
163
192
  if (res.defaultTime === 'now') {
@@ -176,6 +205,14 @@ export default {
176
205
  this.convertValueToMoment(this.value)
177
206
  })
178
207
  }
208
+ },
209
+ handleShiftDay (delta) {
210
+ if (this.type !== 'date') return
211
+ const current = this.dateRange && this.dateRange[0] ? this.dateRange[0].clone() : moment()
212
+ const unit = this.showTime ? 'day' : 'day'
213
+ const next = current.add(delta, unit)
214
+ this.dateRange = [next]
215
+ this.$emit('change', next ? next.format(this.format) : '')
179
216
  }
180
217
  }
181
218
  }
@@ -199,6 +236,34 @@ export default {
199
236
  position: relative;
200
237
  }
201
238
 
239
+ .nav-arrows-wrapper {
240
+ position: relative;
241
+ }
242
+
243
+ .nav-arrow {
244
+ position: absolute;
245
+ top: 50%;
246
+ transform: translateY(-50%);
247
+ display: inline-flex;
248
+ align-items: center;
249
+ justify-content: center;
250
+ width: 24px;
251
+ height: 24px;
252
+ color: #848484;
253
+ cursor: pointer;
254
+ user-select: none;
255
+ z-index: 3;
256
+ }
257
+ .nav-arrow:hover {
258
+ color: #515151;
259
+ }
260
+ .nav-arrow-left {
261
+ left: 6px;
262
+ }
263
+ .nav-arrow-right {
264
+ right: 6px;
265
+ }
266
+
202
267
  .x-time-select :deep(.ant-picker-range),
203
268
  .x-time-select :deep(.ant-picker) {
204
269
  width: 100%;
@@ -209,6 +274,9 @@ export default {
209
274
  box-sizing: border-box;
210
275
  opacity: 1;
211
276
  }
277
+ .x-time-select.has-nav-arrows :deep(.ant-picker-suffix) {
278
+ display: none; /* 仅箭头模式隐藏后缀图标容器 */
279
+ }
212
280
  .x-time-select :deep(.ant-calendar-picker) {
213
281
  width: 100%;
214
282
  display: block;
@@ -262,6 +330,11 @@ export default {
262
330
  text-align: center;
263
331
  color: #313131;
264
332
  }
333
+ .x-time-select.has-nav-arrows :deep(.ant-calendar-picker-icon),
334
+ .x-time-select.has-nav-arrows :deep(.ant-calendar-picker-clear),
335
+ .x-time-select.has-nav-arrows :deep(.anticon-calendar) {
336
+ display: none; /* 仅箭头模式隐藏旧版图标节点 */
337
+ }
265
338
 
266
339
  .x-time-select.xtime-yizhu-date {
267
340
  margin: 5px 11px auto 24px;
@@ -295,7 +368,11 @@ export default {
295
368
  text-align: left;
296
369
  padding-left: 28px;
297
370
  }
298
-
371
+ /* 箭头模式下,让输入有左右内边距以避让箭头 */
372
+ .x-time-select.has-nav-arrows :deep(.ant-picker-input > input) {
373
+ padding-left: 30px;
374
+ padding-right: 30px;
375
+ }
299
376
  /* 分隔符与清除按钮占位优化,减少遮挡概率 */
300
377
  .x-time-select.xtime-yizhu-date :deep(.ant-picker-range .ant-picker-separator) {
301
378
  margin: 0 4px;