niuma-ui 1.1.6 → 1.1.7

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.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,16 @@
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.1.7] - 2026-08-21
10
+
11
+ ### 新增
12
+
13
+ - `RsDatePicker` / `RsCalendarGrid`:面板标题两侧增加上一年 / 下一年双箭头,月份仍用单箭头前后切换。
14
+
15
+ ### 变更
16
+
17
+ - `RsInput`:清除按钮与密码显隐按钮 `tabindex="-1"`,Tab 只停在输入框(对齐 `RsInputNumber` 步进按钮);鼠标点击与 `aria-label` 不变。
18
+
9
19
  ## [1.1.6] - 2026-08-20
10
20
 
11
21
  ### 变更
@@ -159,7 +169,8 @@
159
169
 
160
170
  - 1.0 之前的私有 tag(如 `v0.1.0`)仅作历史记录;新接入请依赖 `v1.0.0` 及之后版本。
161
171
 
162
- [Unreleased]: https://github.com/Blair-Shang/niuma-ui/compare/v1.1.6...HEAD
172
+ [Unreleased]: https://github.com/Blair-Shang/niuma-ui/compare/v1.1.7...HEAD
173
+ [1.1.7]: https://github.com/Blair-Shang/niuma-ui/releases/tag/v1.1.7
163
174
  [1.1.6]: https://github.com/Blair-Shang/niuma-ui/releases/tag/v1.1.6
164
175
  [1.1.5]: https://github.com/Blair-Shang/niuma-ui/releases/tag/v1.1.5
165
176
  [1.1.4]: https://github.com/Blair-Shang/niuma-ui/releases/tag/v1.1.4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "niuma-ui",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "Vue 3 设计系统与 Rs* 组件库(--rs-* token)",
@@ -60,12 +60,31 @@ describe('RsCalendarGrid', () => {
60
60
  expect(disabledCount).toBeGreaterThanOrEqual(3)
61
61
  })
62
62
 
63
- it('updates view month via navigation', async () => {
63
+ it('updates view month via month navigation', async () => {
64
64
  const wrapper = mount(RsCalendarGrid, {
65
65
  props: { viewYear: 2025, viewMonth: 6 },
66
66
  })
67
- await wrapper.findAll('.rs-calendar-grid__nav')[1].trigger('click')
67
+ await wrapper.find('.rs-calendar-grid__nav--next-month').trigger('click')
68
68
  expect(wrapper.emitted('update:viewMonth')?.[0]).toEqual([7])
69
+ expect(wrapper.emitted('update:viewYear')).toBeUndefined()
70
+ })
71
+
72
+ it('updates view year via year navigation and keeps the month', async () => {
73
+ const next = mount(RsCalendarGrid, {
74
+ props: { viewYear: 2025, viewMonth: 6 },
75
+ })
76
+ await next.find('.rs-calendar-grid__nav--next-year').trigger('click')
77
+ expect(next.emitted('update:viewYear')?.[0]).toEqual([2026])
78
+ expect(next.emitted('update:viewMonth')).toBeUndefined()
79
+ next.unmount()
80
+
81
+ const prev = mount(RsCalendarGrid, {
82
+ props: { viewYear: 2025, viewMonth: 6 },
83
+ })
84
+ await prev.find('.rs-calendar-grid__nav--prev-year').trigger('click')
85
+ expect(prev.emitted('update:viewYear')?.[0]).toEqual([2024])
86
+ expect(prev.emitted('update:viewMonth')).toBeUndefined()
87
+ prev.unmount()
69
88
  })
70
89
 
71
90
  it('highlights range between start and end', () => {
@@ -244,6 +244,7 @@ describe('RsInput', () => {
244
244
  expect(wrapper.find('.rs-input-group--has-suffix').exists()).toBe(true)
245
245
  const toggle = wrapper.find('button.rs-input-group__action')
246
246
  expect(toggle.exists()).toBe(true)
247
+ expect(toggle.attributes('tabindex')).toBe('-1')
247
248
  await toggle.trigger('click')
248
249
  expect(wrapper.find('input').attributes('type')).toBe('text')
249
250
  })
@@ -65,6 +65,14 @@ const weeks = computed(() => {
65
65
  return rows
66
66
  })
67
67
 
68
+ function goPrevYear(): void {
69
+ viewYear.value -= 1
70
+ }
71
+
72
+ function goNextYear(): void {
73
+ viewYear.value += 1
74
+ }
75
+
68
76
  function goPrevMonth(): void {
69
77
  if (viewMonth.value === 1) {
70
78
  viewYear.value -= 1
@@ -133,23 +141,43 @@ function selectDate(cell: RsCalendarCell): void {
133
141
  <template>
134
142
  <div class="rs-calendar-grid">
135
143
  <div class="rs-calendar-grid__header">
136
- <button
137
- type="button"
138
- class="rs-calendar-grid__nav"
139
- :aria-label="t('datePicker.prevMonth')"
140
- @click="goPrevMonth"
141
- >
142
- <RsIcon name="chevron-left" :size="16" />
143
- </button>
144
+ <div class="rs-calendar-grid__nav-group">
145
+ <button
146
+ type="button"
147
+ class="rs-calendar-grid__nav rs-calendar-grid__nav--prev-year"
148
+ :aria-label="t('datePicker.prevYear')"
149
+ @click="goPrevYear"
150
+ >
151
+ <RsIcon name="chevrons-left" :size="16" />
152
+ </button>
153
+ <button
154
+ type="button"
155
+ class="rs-calendar-grid__nav rs-calendar-grid__nav--prev-month"
156
+ :aria-label="t('datePicker.prevMonth')"
157
+ @click="goPrevMonth"
158
+ >
159
+ <RsIcon name="chevron-left" :size="16" />
160
+ </button>
161
+ </div>
144
162
  <span class="rs-calendar-grid__title">{{ monthLabel }}</span>
145
- <button
146
- type="button"
147
- class="rs-calendar-grid__nav"
148
- :aria-label="t('datePicker.nextMonth')"
149
- @click="goNextMonth"
150
- >
151
- <RsIcon name="chevron-right" :size="16" />
152
- </button>
163
+ <div class="rs-calendar-grid__nav-group">
164
+ <button
165
+ type="button"
166
+ class="rs-calendar-grid__nav rs-calendar-grid__nav--next-month"
167
+ :aria-label="t('datePicker.nextMonth')"
168
+ @click="goNextMonth"
169
+ >
170
+ <RsIcon name="chevron-right" :size="16" />
171
+ </button>
172
+ <button
173
+ type="button"
174
+ class="rs-calendar-grid__nav rs-calendar-grid__nav--next-year"
175
+ :aria-label="t('datePicker.nextYear')"
176
+ @click="goNextYear"
177
+ >
178
+ <RsIcon name="chevrons-right" :size="16" />
179
+ </button>
180
+ </div>
153
181
  </div>
154
182
 
155
183
  <table class="rs-calendar-grid__table">
@@ -200,8 +228,14 @@ function selectDate(cell: RsCalendarCell): void {
200
228
  justify-content: space-between;
201
229
  gap: var(--rs-space-sm);
202
230
  }
231
+ .rs-calendar-grid__nav-group {
232
+ display: inline-flex;
233
+ align-items: center;
234
+ flex: 0 0 auto;
235
+ }
203
236
  .rs-calendar-grid__title {
204
237
  flex: 1;
238
+ min-width: 0;
205
239
  text-align: center;
206
240
  font-size: var(--rs-font-size-sm);
207
241
  font-weight: var(--rs-font-weight-semibold);
@@ -728,6 +728,8 @@ defineExpose({
728
728
 
729
729
  class="rs-input-group__action"
730
730
 
731
+ tabindex="-1"
732
+
731
733
  :aria-label="t('input.clear')"
732
734
 
733
735
  @pointerdown.prevent
@@ -748,6 +750,8 @@ defineExpose({
748
750
 
749
751
  class="rs-input-group__action"
750
752
 
753
+ tabindex="-1"
754
+
751
755
  :aria-label="passwordVisible ? t('input.hidePassword') : t('input.showPassword')"
752
756
 
753
757
  :aria-pressed="passwordVisible"
@@ -101,6 +101,8 @@ export const zhCN: RsLocaleMessages = {
101
101
  'datePicker.placeholder': '选择日期',
102
102
  'datePicker.rangePlaceholder': '选择日期范围',
103
103
  'datePicker.clear': '清空日期',
104
+ 'datePicker.prevYear': '上一年',
105
+ 'datePicker.nextYear': '下一年',
104
106
  'datePicker.prevMonth': '上个月',
105
107
  'datePicker.nextMonth': '下个月',
106
108
  'datePicker.today': '今天',
@@ -300,6 +302,8 @@ export const enUS: RsLocaleMessages = {
300
302
  'datePicker.placeholder': 'Select date',
301
303
  'datePicker.rangePlaceholder': 'Select date range',
302
304
  'datePicker.clear': 'Clear date',
305
+ 'datePicker.prevYear': 'Previous year',
306
+ 'datePicker.nextYear': 'Next year',
303
307
  'datePicker.prevMonth': 'Previous month',
304
308
  'datePicker.nextMonth': 'Next month',
305
309
  'datePicker.today': 'Today',