niuma-ui 1.0.1 → 1.1.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.
- package/CHANGELOG.md +65 -1
- package/package.json +10 -2
- package/src/__tests__/RsButton.spec.ts +47 -0
- package/src/__tests__/RsCard.spec.ts +160 -1
- package/src/__tests__/RsConfirmDialog.spec.ts +127 -0
- package/src/__tests__/RsContextMenu.spec.ts +12 -0
- package/src/__tests__/RsDatePicker.spec.ts +21 -0
- package/src/__tests__/RsDateTimePicker.spec.ts +11 -0
- package/src/__tests__/RsDescriptions.spec.ts +50 -0
- package/src/__tests__/RsDialog.spec.ts +178 -0
- package/src/__tests__/RsDrawer.spec.ts +96 -3
- package/src/__tests__/RsDynamicTags.spec.ts +52 -0
- package/src/__tests__/RsForm.spec.ts +250 -6
- package/src/__tests__/RsFormItem.spec.ts +478 -0
- package/src/__tests__/RsFormList.spec.ts +109 -0
- package/src/__tests__/RsInput.spec.ts +108 -1
- package/src/__tests__/RsInputNumber.spec.ts +33 -0
- package/src/__tests__/RsMenu.spec.ts +406 -14
- package/src/__tests__/RsPagination.spec.ts +67 -2
- package/src/__tests__/RsSelect.spec.ts +465 -2
- package/src/__tests__/RsSwitch.spec.ts +74 -0
- package/src/__tests__/RsTable.a11y.spec.ts +83 -0
- package/src/__tests__/RsTable.dom-baseline.spec.ts +87 -0
- package/src/__tests__/RsTable.perf.spec.ts +23 -4
- package/src/__tests__/RsTable.spec.ts +63 -8
- package/src/__tests__/RsTable.ssr.spec.ts +71 -0
- package/src/__tests__/RsTable.summary.spec.ts +45 -0
- package/src/__tests__/RsTabs.spec.ts +102 -4
- package/src/__tests__/RsTimePicker.spec.ts +20 -0
- package/src/__tests__/RsTooltip.spec.ts +43 -0
- package/src/__tests__/RsUpload.spec.ts +62 -6
- package/src/__tests__/createRsDialog.spec.ts +145 -0
- package/src/__tests__/css-token.spec.ts +51 -0
- package/src/__tests__/date-picker-utils.spec.ts +49 -0
- package/src/__tests__/dialog-utils.spec.ts +43 -0
- package/src/__tests__/form-path.spec.ts +46 -0
- package/src/__tests__/form-rules.spec.ts +139 -0
- package/src/__tests__/perf-budgets.ts +32 -0
- package/src/__tests__/rs-table-api.spec.ts +206 -0
- package/src/__tests__/rs-table-compat-matrix.spec.ts +108 -0
- package/src/__tests__/rs-table-echarts-adapter.spec.ts +43 -0
- package/src/__tests__/rs-table-grid-nav.spec.ts +63 -0
- package/src/__tests__/rs-table-isolation.spec.ts +158 -0
- package/src/__tests__/split-pane-utils.spec.ts +21 -0
- package/src/__tests__/table-chart-utils.spec.ts +88 -0
- package/src/__tests__/table-summary-utils.spec.ts +62 -0
- package/src/__tests__/table-utils.spec.ts +124 -0
- package/src/__tests__/theme.spec.ts +27 -0
- package/src/__tests__/useRsTableColumnResize.spec.ts +25 -0
- package/src/__tests__/useRsTableCore.perf.spec.ts +170 -0
- package/src/components/RsAlert.vue +212 -0
- package/src/components/RsAvatar.vue +1 -1
- package/src/components/RsBadge.vue +1 -1
- package/src/components/RsBreadcrumb.vue +1 -1
- package/src/components/RsButton.vue +147 -23
- package/src/components/RsCalendarGrid.vue +3 -3
- package/src/components/RsCard.vue +204 -20
- package/src/components/RsCodeBlock.vue +4 -4
- package/src/components/RsCodeEditor.vue +8 -8
- package/src/components/RsConfirmDialog.vue +217 -30
- package/src/components/RsContextMenu.vue +57 -17
- package/src/components/RsDatePicker.vue +316 -39
- package/src/components/RsDateTimePicker.vue +27 -2
- package/src/components/RsDescriptions.vue +186 -0
- package/src/components/RsDescriptionsItem.vue +32 -0
- package/src/components/RsDialog.vue +374 -52
- package/src/components/RsDivider.vue +89 -0
- package/src/components/RsDrawer.vue +559 -34
- package/src/components/RsDropdown.vue +34 -3
- package/src/components/RsDynamicTags.vue +531 -0
- package/src/components/RsEmpty.vue +1 -1
- package/src/components/RsForm.vue +164 -8
- package/src/components/RsFormItem.vue +423 -0
- package/src/components/RsFormItemControl.vue +21 -0
- package/src/components/RsFormList.vue +117 -0
- package/src/components/RsInput.vue +491 -100
- package/src/components/RsInputNumber.vue +77 -27
- package/src/components/RsLabel.vue +20 -5
- package/src/components/RsLink.vue +1 -1
- package/src/components/RsLoadingBar.vue +151 -0
- package/src/components/RsMarkdown.vue +5 -5
- package/src/components/RsMenu.vue +74 -16
- package/src/components/RsMenuItems.vue +147 -9
- package/src/components/RsMonacoEditor.vue +9 -3
- package/src/components/RsPagination.vue +93 -14
- package/src/components/RsProseEditor.vue +3 -3
- package/src/components/RsRadio.vue +81 -0
- package/src/components/RsRadioItem.vue +156 -0
- package/src/components/RsSelect.vue +372 -642
- package/src/components/RsSidebarGroup.vue +1 -1
- package/src/components/RsSplitPane.vue +90 -1
- package/src/components/RsStatCard.vue +2 -2
- package/src/components/RsSteps.vue +2 -2
- package/src/components/RsSwitch.vue +192 -0
- package/src/components/RsTable.vue +653 -2555
- package/src/components/RsTabs.vue +422 -90
- package/src/components/RsTag.vue +191 -0
- package/src/components/RsTerminal.vue +58 -19
- package/src/components/RsTimePicker.vue +72 -9
- package/src/components/RsTimePickerColumns.vue +137 -78
- package/src/components/RsToaster.vue +64 -24
- package/src/components/RsTooltip.vue +10 -1
- package/src/components/RsTooltipProvider.vue +11 -1
- package/src/components/RsTree.vue +45 -27
- package/src/components/RsUpload.vue +147 -14
- package/src/components/RsVNodeHost.vue +20 -0
- package/src/components/button-utils.ts +39 -0
- package/src/components/context-menu-utils.ts +6 -0
- package/src/components/date-picker-utils.ts +195 -4
- package/src/components/descriptions-utils.ts +24 -0
- package/src/components/dialog-utils.ts +182 -0
- package/src/components/dialog-window.ts +74 -9
- package/src/components/drawer-utils.ts +73 -0
- package/src/components/form-item-control.ts +55 -0
- package/src/components/form-path.ts +92 -0
- package/src/components/form-rules.ts +311 -0
- package/src/components/form-utils.ts +145 -3
- package/src/components/menu-utils.ts +11 -0
- package/src/components/overlay-utils.ts +3 -0
- package/src/components/radio-utils.ts +12 -0
- package/src/components/reka.ts +5 -0
- package/src/components/select-utils.ts +285 -6
- package/src/components/split-pane-utils.ts +65 -12
- package/src/components/table/RsTableBody.vue +217 -0
- package/src/components/table/RsTableBodyRow.vue +90 -1
- package/src/components/table/RsTableColGroup.vue +41 -0
- package/src/components/table/RsTableHeader.vue +158 -0
- package/src/components/table/RsTableHeaderFilter.vue +1 -1
- package/src/components/table/RsTableSummaryRow.vue +52 -0
- package/src/components/table/rs-table-api.ts +99 -0
- package/src/components/table/rs-table-compat-matrix.ts +71 -0
- package/src/components/table/rs-table-echarts-adapter.ts +81 -0
- package/src/components/table/rs-table-feature-host.ts +178 -0
- package/src/components/table/rs-table-grid-nav.ts +122 -0
- package/src/components/table/rs-table-header-types.ts +47 -0
- package/src/components/table/rs-table-module-registry.ts +72 -0
- package/src/components/table/rs-table-props.ts +274 -0
- package/src/components/table/rs-table-view-context.ts +258 -0
- package/src/components/table/rs-table.css +85 -7
- package/src/components/table/table-chart-utils.ts +165 -0
- package/src/components/table/table-features.ts +284 -0
- package/src/components/table/table-summary-utils.ts +194 -0
- package/src/components/table-utils.ts +452 -2
- package/src/components/tabs-utils.ts +142 -2
- package/src/components/time-picker-utils.ts +76 -3
- package/src/components/upload-utils.ts +122 -0
- package/src/components/use-rs-select.ts +436 -0
- package/src/components/virtual-list-utils.ts +15 -2
- package/src/composables/assembleRsTableApi.ts +79 -0
- package/src/composables/bindRsTableViewContext.ts +269 -0
- package/src/composables/createRsDialog.ts +357 -0
- package/src/composables/createRsTableEditEmitBridge.ts +38 -0
- package/src/composables/useRsConfig.ts +10 -3
- package/src/composables/useRsI18n.ts +16 -5
- package/src/composables/useRsLoadingBar.ts +36 -0
- package/src/composables/useRsTable.ts +134 -0
- package/src/composables/useRsTableA11y.ts +52 -0
- package/src/composables/useRsTableChartBridge.ts +79 -0
- package/src/composables/useRsTableColumnLayout.ts +320 -0
- package/src/composables/useRsTableColumnResize.ts +244 -0
- package/src/composables/useRsTableColumnVirtual.ts +180 -0
- package/src/composables/useRsTableColumns.ts +200 -0
- package/src/composables/useRsTableContextMenu.ts +257 -0
- package/src/composables/useRsTableCore.ts +256 -0
- package/src/composables/useRsTableEditActions.ts +606 -0
- package/src/composables/useRsTableEditLayer.ts +251 -0
- package/src/composables/useRsTableEngine.ts +357 -0
- package/src/composables/useRsTableGridKeyboard.ts +123 -0
- package/src/composables/useRsTableHeadless.ts +137 -0
- package/src/composables/useRsTableInteraction.ts +433 -0
- package/src/composables/useRsTableScrollHost.ts +75 -0
- package/src/composables/useRsTableScrollLayout.ts +255 -0
- package/src/composables/useRsTableSelectionSource.ts +89 -0
- package/src/composables/useRsTableShell.ts +416 -0
- package/src/composables/useRsTableShellChrome.ts +170 -0
- package/src/composables/useRsTableSummary.ts +113 -0
- package/src/composables/useRsTableViewProvide.ts +263 -0
- package/src/composables/useRsTableVirtual.ts +154 -0
- package/src/composables/useRsTabsNav.ts +4 -0
- package/src/composables/useTableEdit.ts +1 -1
- package/src/index.ts +378 -10
- package/src/locale/interpolate.ts +32 -0
- package/src/locale/messages.ts +40 -0
- package/src/styles.css +365 -56
- package/src/theme/brand.example.css +24 -2
- package/src/theme/css-token.ts +107 -0
- package/src/theme/presets.ts +4 -0
- package/src/theme/types.ts +68 -0
- package/src/components/RsTableColgroup.vue +0 -17
- package/src/components/RsTableHeaderRow.vue +0 -30
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, nextTick, onMounted, onUnmounted, useTemplateRef, watch } from 'vue'
|
|
3
3
|
import { useRsI18n } from '../composables/useRsI18n'
|
|
4
|
+
import type { RsComponentSize } from '../theme/types'
|
|
5
|
+
import { useResolvedRsComponentSize } from './resolve-size'
|
|
4
6
|
import {
|
|
7
|
+
formatTimeFromParts,
|
|
8
|
+
getTimeMinuteOptions,
|
|
5
9
|
parseTimeValue,
|
|
6
|
-
rangeInclusive,
|
|
7
10
|
scheduleAfterPaint,
|
|
11
|
+
scrollTimeColumnToValue,
|
|
12
|
+
TIME_HOUR_OPTIONS,
|
|
13
|
+
TIME_SECOND_OPTIONS,
|
|
14
|
+
type RsTimeUnit,
|
|
8
15
|
} from './time-picker-utils'
|
|
9
16
|
|
|
17
|
+
defineOptions({ name: 'RsTimePickerColumns' })
|
|
18
|
+
|
|
10
19
|
const model = defineModel<string>({ default: '00:00' })
|
|
11
20
|
|
|
12
21
|
const props = withDefaults(
|
|
@@ -14,7 +23,8 @@ const props = withDefaults(
|
|
|
14
23
|
minuteStep?: number
|
|
15
24
|
second?: boolean
|
|
16
25
|
disabled?: boolean
|
|
17
|
-
|
|
26
|
+
size?: RsComponentSize
|
|
27
|
+
isUnitDisabled?: (unit: RsTimeUnit, value: number) => boolean
|
|
18
28
|
}>(),
|
|
19
29
|
{
|
|
20
30
|
minuteStep: 1,
|
|
@@ -24,6 +34,7 @@ const props = withDefaults(
|
|
|
24
34
|
)
|
|
25
35
|
|
|
26
36
|
const { t } = useRsI18n()
|
|
37
|
+
const resolvedSize = useResolvedRsComponentSize(() => props.size)
|
|
27
38
|
|
|
28
39
|
const hourListRef = useTemplateRef<HTMLDivElement>('hourListRef')
|
|
29
40
|
const minuteListRef = useTemplateRef<HTMLDivElement>('minuteListRef')
|
|
@@ -31,11 +42,9 @@ const secondListRef = useTemplateRef<HTMLDivElement>('secondListRef')
|
|
|
31
42
|
|
|
32
43
|
let cancelScheduledScroll: (() => void) | undefined
|
|
33
44
|
|
|
34
|
-
const hourOptions =
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
)
|
|
38
|
-
const secondOptions = computed(() => rangeInclusive(59))
|
|
45
|
+
const hourOptions = TIME_HOUR_OPTIONS
|
|
46
|
+
const secondOptions = TIME_SECOND_OPTIONS
|
|
47
|
+
const minuteOptions = computed(() => getTimeMinuteOptions(props.minuteStep))
|
|
39
48
|
|
|
40
49
|
const parts = computed(() => {
|
|
41
50
|
const parsed = parseTimeValue(model.value, props.second)
|
|
@@ -45,27 +54,19 @@ const parts = computed(() => {
|
|
|
45
54
|
return { hour: 0, minute: 0, second: 0 }
|
|
46
55
|
})
|
|
47
56
|
|
|
48
|
-
function isDisabled(unit:
|
|
49
|
-
return props.isUnitDisabled?.(unit, value) ?? false
|
|
57
|
+
function isDisabled(unit: RsTimeUnit, value: number): boolean {
|
|
58
|
+
return props.disabled || (props.isUnitDisabled?.(unit, value) ?? false)
|
|
50
59
|
}
|
|
51
60
|
|
|
52
|
-
function scrollColumn(
|
|
53
|
-
container
|
|
54
|
-
unit: 'hour' | 'minute' | 'second',
|
|
55
|
-
value: number,
|
|
56
|
-
): void {
|
|
57
|
-
if (!container) return
|
|
58
|
-
const selected = container.querySelector<HTMLElement>(
|
|
59
|
-
`[data-unit="${unit}"][data-value="${value}"]`,
|
|
60
|
-
)
|
|
61
|
-
selected?.scrollIntoView({ block: 'center', behavior: 'auto' })
|
|
61
|
+
function scrollColumn(container: HTMLDivElement | null, value: number): void {
|
|
62
|
+
scrollTimeColumnToValue(container, value)
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
function scrollToSelection(): void {
|
|
65
|
-
scrollColumn(hourListRef.value,
|
|
66
|
-
scrollColumn(minuteListRef.value,
|
|
66
|
+
scrollColumn(hourListRef.value, parts.value.hour)
|
|
67
|
+
scrollColumn(minuteListRef.value, parts.value.minute)
|
|
67
68
|
if (props.second) {
|
|
68
|
-
scrollColumn(secondListRef.value,
|
|
69
|
+
scrollColumn(secondListRef.value, parts.value.second)
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
|
|
@@ -74,12 +75,10 @@ function scrollToSelectionAfterPaint(): void {
|
|
|
74
75
|
cancelScheduledScroll = scheduleAfterPaint(scrollToSelection)
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
function selectUnit(unit:
|
|
78
|
-
if (isDisabled(unit, value)
|
|
78
|
+
function selectUnit(unit: RsTimeUnit, value: number): void {
|
|
79
|
+
if (isDisabled(unit, value)) return
|
|
79
80
|
const next = { ...parts.value, [unit]: value }
|
|
80
|
-
model.value = props.second
|
|
81
|
-
? `${String(next.hour).padStart(2, '0')}:${String(next.minute).padStart(2, '0')}:${String(next.second).padStart(2, '0')}`
|
|
82
|
-
: `${String(next.hour).padStart(2, '0')}:${String(next.minute).padStart(2, '0')}`
|
|
81
|
+
model.value = formatTimeFromParts(next.hour, next.minute, next.second, props.second)
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
watch(
|
|
@@ -101,65 +100,79 @@ onUnmounted(() => {
|
|
|
101
100
|
defineExpose({
|
|
102
101
|
scrollToSelection,
|
|
103
102
|
scrollToSelectionAfterPaint,
|
|
103
|
+
resolvedSize,
|
|
104
104
|
})
|
|
105
105
|
</script>
|
|
106
106
|
|
|
107
107
|
<template>
|
|
108
|
-
<div
|
|
108
|
+
<div
|
|
109
|
+
class="rs-time-columns"
|
|
110
|
+
:class="[
|
|
111
|
+
`rs-time-columns--${resolvedSize}`,
|
|
112
|
+
{ 'rs-time-columns--seconds': second },
|
|
113
|
+
]"
|
|
114
|
+
>
|
|
109
115
|
<div class="rs-time-columns__column">
|
|
110
116
|
<span class="rs-time-columns__label">{{ t('timePicker.hour') }}</span>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
117
|
+
<!-- shell:overflow:hidden 裁剪滚动条,避免盖住圆角 -->
|
|
118
|
+
<div class="rs-time-columns__list-shell">
|
|
119
|
+
<div ref="hourListRef" class="rs-time-columns__list">
|
|
120
|
+
<button
|
|
121
|
+
v-for="option in hourOptions"
|
|
122
|
+
:key="option.value"
|
|
123
|
+
type="button"
|
|
124
|
+
class="rs-time-columns__item"
|
|
125
|
+
:class="{ 'rs-time-columns__item--active': parts.hour === option.value }"
|
|
126
|
+
data-unit="hour"
|
|
127
|
+
:data-value="option.value"
|
|
128
|
+
:disabled="isDisabled('hour', option.value)"
|
|
129
|
+
@click="selectUnit('hour', option.value)"
|
|
130
|
+
>
|
|
131
|
+
{{ option.label }}
|
|
132
|
+
</button>
|
|
133
|
+
</div>
|
|
125
134
|
</div>
|
|
126
135
|
</div>
|
|
127
136
|
|
|
128
137
|
<div class="rs-time-columns__column">
|
|
129
138
|
<span class="rs-time-columns__label">{{ t('timePicker.minute') }}</span>
|
|
130
|
-
<div
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
139
|
+
<div class="rs-time-columns__list-shell">
|
|
140
|
+
<div ref="minuteListRef" class="rs-time-columns__list">
|
|
141
|
+
<button
|
|
142
|
+
v-for="option in minuteOptions"
|
|
143
|
+
:key="option.value"
|
|
144
|
+
type="button"
|
|
145
|
+
class="rs-time-columns__item"
|
|
146
|
+
:class="{ 'rs-time-columns__item--active': parts.minute === option.value }"
|
|
147
|
+
data-unit="minute"
|
|
148
|
+
:data-value="option.value"
|
|
149
|
+
:disabled="isDisabled('minute', option.value)"
|
|
150
|
+
@click="selectUnit('minute', option.value)"
|
|
151
|
+
>
|
|
152
|
+
{{ option.label }}
|
|
153
|
+
</button>
|
|
154
|
+
</div>
|
|
144
155
|
</div>
|
|
145
156
|
</div>
|
|
146
157
|
|
|
147
158
|
<div v-if="second" class="rs-time-columns__column">
|
|
148
159
|
<span class="rs-time-columns__label">{{ t('timePicker.second') }}</span>
|
|
149
|
-
<div
|
|
150
|
-
<
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
<div class="rs-time-columns__list-shell">
|
|
161
|
+
<div ref="secondListRef" class="rs-time-columns__list">
|
|
162
|
+
<button
|
|
163
|
+
v-for="option in secondOptions"
|
|
164
|
+
:key="option.value"
|
|
165
|
+
type="button"
|
|
166
|
+
class="rs-time-columns__item"
|
|
167
|
+
:class="{ 'rs-time-columns__item--active': parts.second === option.value }"
|
|
168
|
+
data-unit="second"
|
|
169
|
+
:data-value="option.value"
|
|
170
|
+
:disabled="isDisabled('second', option.value)"
|
|
171
|
+
@click="selectUnit('second', option.value)"
|
|
172
|
+
>
|
|
173
|
+
{{ option.label }}
|
|
174
|
+
</button>
|
|
175
|
+
</div>
|
|
163
176
|
</div>
|
|
164
177
|
</div>
|
|
165
178
|
</div>
|
|
@@ -170,10 +183,33 @@ defineExpose({
|
|
|
170
183
|
display: grid;
|
|
171
184
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
172
185
|
gap: var(--rs-space-sm);
|
|
186
|
+
--rs-time-columns-list-max-height: 10rem;
|
|
187
|
+
--rs-time-columns-item-padding-y: 0.375rem;
|
|
188
|
+
--rs-time-columns-item-font-size: var(--rs-font-size-sm);
|
|
189
|
+
--rs-time-columns-label-font-size: var(--rs-font-size-xs);
|
|
173
190
|
}
|
|
174
191
|
.rs-time-columns--seconds {
|
|
175
192
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
176
193
|
}
|
|
194
|
+
.rs-time-columns--ssm {
|
|
195
|
+
--rs-time-columns-list-max-height: 7.5rem;
|
|
196
|
+
--rs-time-columns-item-padding-y: 0.2rem;
|
|
197
|
+
--rs-time-columns-item-font-size: var(--rs-font-size-xs);
|
|
198
|
+
--rs-time-columns-label-font-size: var(--rs-font-size-xs);
|
|
199
|
+
gap: var(--rs-space-xs);
|
|
200
|
+
}
|
|
201
|
+
.rs-time-columns--sm {
|
|
202
|
+
--rs-time-columns-list-max-height: 8.5rem;
|
|
203
|
+
--rs-time-columns-item-padding-y: 0.28rem;
|
|
204
|
+
--rs-time-columns-item-font-size: var(--rs-font-size-xs);
|
|
205
|
+
--rs-time-columns-label-font-size: var(--rs-font-size-xs);
|
|
206
|
+
}
|
|
207
|
+
.rs-time-columns--lg {
|
|
208
|
+
--rs-time-columns-list-max-height: 12rem;
|
|
209
|
+
--rs-time-columns-item-padding-y: 0.5rem;
|
|
210
|
+
--rs-time-columns-item-font-size: var(--rs-font-size-base);
|
|
211
|
+
--rs-time-columns-label-font-size: var(--rs-font-size-xs);
|
|
212
|
+
}
|
|
177
213
|
.rs-time-columns__column {
|
|
178
214
|
display: flex;
|
|
179
215
|
min-width: 0;
|
|
@@ -182,19 +218,41 @@ defineExpose({
|
|
|
182
218
|
}
|
|
183
219
|
.rs-time-columns__label {
|
|
184
220
|
text-align: center;
|
|
185
|
-
font-size:
|
|
186
|
-
font-weight:
|
|
221
|
+
font-size: var(--rs-time-columns-label-font-size);
|
|
222
|
+
font-weight: var(--rs-font-weight-medium);
|
|
187
223
|
letter-spacing: 0.02em;
|
|
188
224
|
color: var(--rs-muted);
|
|
189
225
|
}
|
|
190
|
-
.rs-time-columns__list {
|
|
191
|
-
|
|
192
|
-
overflow-y: auto;
|
|
193
|
-
padding: 0.25rem;
|
|
226
|
+
.rs-time-columns__list-shell {
|
|
227
|
+
overflow: hidden;
|
|
194
228
|
border: 1px solid var(--rs-border-subtle);
|
|
195
229
|
border-radius: var(--rs-radius-sm);
|
|
196
230
|
background: color-mix(in srgb, var(--rs-surface) 72%, transparent);
|
|
197
231
|
}
|
|
232
|
+
.rs-time-columns__list {
|
|
233
|
+
position: relative;
|
|
234
|
+
max-height: var(--rs-time-columns-list-max-height);
|
|
235
|
+
overflow-y: auto;
|
|
236
|
+
padding: 0.25rem;
|
|
237
|
+
scrollbar-width: thin;
|
|
238
|
+
scrollbar-color: color-mix(in srgb, var(--rs-muted) 42%, transparent) transparent;
|
|
239
|
+
}
|
|
240
|
+
/* 去掉 Windows 原生滚动条上下三角,避免盖住圆角描边 */
|
|
241
|
+
.rs-time-columns__list::-webkit-scrollbar {
|
|
242
|
+
width: 6px;
|
|
243
|
+
}
|
|
244
|
+
.rs-time-columns__list::-webkit-scrollbar-button {
|
|
245
|
+
display: none;
|
|
246
|
+
width: 0;
|
|
247
|
+
height: 0;
|
|
248
|
+
}
|
|
249
|
+
.rs-time-columns__list::-webkit-scrollbar-thumb {
|
|
250
|
+
border-radius: 999px;
|
|
251
|
+
background: color-mix(in srgb, var(--rs-muted) 42%, transparent);
|
|
252
|
+
}
|
|
253
|
+
.rs-time-columns__list::-webkit-scrollbar-track {
|
|
254
|
+
background: transparent;
|
|
255
|
+
}
|
|
198
256
|
.rs-time-columns__item {
|
|
199
257
|
display: flex;
|
|
200
258
|
width: 100%;
|
|
@@ -202,10 +260,11 @@ defineExpose({
|
|
|
202
260
|
justify-content: center;
|
|
203
261
|
border: 0;
|
|
204
262
|
border-radius: var(--rs-radius-sm);
|
|
205
|
-
padding:
|
|
263
|
+
padding: var(--rs-time-columns-item-padding-y) 0;
|
|
206
264
|
background: transparent;
|
|
207
265
|
color: var(--rs-text);
|
|
208
|
-
font-size: var(--rs-font-size
|
|
266
|
+
font-size: var(--rs-time-columns-item-font-size);
|
|
267
|
+
line-height: var(--rs-line-height-tight);
|
|
209
268
|
cursor: pointer;
|
|
210
269
|
transition: background var(--rs-transition-fast), color var(--rs-transition-fast);
|
|
211
270
|
}
|
|
@@ -119,21 +119,21 @@ const sonnerTheme = computed<'light' | 'dark'>(() => {
|
|
|
119
119
|
overflow: hidden;
|
|
120
120
|
display: grid;
|
|
121
121
|
grid-template-columns: auto minmax(0, 1fr);
|
|
122
|
-
align-items:
|
|
123
|
-
column-gap: 0.
|
|
124
|
-
row-gap: 0.
|
|
122
|
+
align-items: center;
|
|
123
|
+
column-gap: 0.625rem;
|
|
124
|
+
row-gap: 0.5rem;
|
|
125
125
|
width: var(--width, auto);
|
|
126
126
|
min-width: 19rem;
|
|
127
127
|
max-width: min(29rem, calc(100vw - 1.5rem));
|
|
128
|
-
padding: 0.
|
|
128
|
+
padding: 0.8125rem 2.25rem 0.8125rem 0.875rem;
|
|
129
129
|
border: 1px solid var(--rs-toast-border);
|
|
130
130
|
border-radius: var(--rs-toast-radius);
|
|
131
131
|
background:
|
|
132
132
|
linear-gradient(
|
|
133
133
|
180deg,
|
|
134
|
-
transparent 0.
|
|
135
|
-
var(--rs-toast-accent) 0.
|
|
136
|
-
transparent calc(100% - 0.
|
|
134
|
+
transparent 0.5rem,
|
|
135
|
+
var(--rs-toast-accent) 0.5rem calc(100% - 0.5rem),
|
|
136
|
+
transparent calc(100% - 0.5rem)
|
|
137
137
|
)
|
|
138
138
|
0.5rem 0 / 2px 100% no-repeat,
|
|
139
139
|
linear-gradient(180deg, var(--rs-toast-highlight), transparent 38%),
|
|
@@ -151,6 +151,13 @@ const sonnerTheme = computed<'light' | 'dark'>(() => {
|
|
|
151
151
|
background var(--rs-transition-fast);
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
/* 带描述时顶对齐,图标与标题第一行光学对齐 */
|
|
155
|
+
.rs-toast:has([data-description]) {
|
|
156
|
+
align-items: start;
|
|
157
|
+
padding-top: 0.875rem;
|
|
158
|
+
padding-bottom: 0.875rem;
|
|
159
|
+
}
|
|
160
|
+
|
|
154
161
|
.rs-toast:hover {
|
|
155
162
|
box-shadow:
|
|
156
163
|
0 18px 42px -20px rgb(0 0 0 / 0.34),
|
|
@@ -166,53 +173,72 @@ const sonnerTheme = computed<'light' | 'dark'>(() => {
|
|
|
166
173
|
.rs-toast [data-icon] {
|
|
167
174
|
position: relative;
|
|
168
175
|
z-index: 1;
|
|
176
|
+
grid-column: 1;
|
|
177
|
+
grid-row: 1;
|
|
169
178
|
display: inline-flex;
|
|
170
|
-
grid-row: 1 / span 2;
|
|
171
179
|
align-items: center;
|
|
172
180
|
justify-content: center;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
181
|
+
align-self: center;
|
|
182
|
+
width: 1.25rem;
|
|
183
|
+
height: 1.25rem;
|
|
184
|
+
margin: 0;
|
|
176
185
|
border-radius: 999px;
|
|
177
186
|
background: transparent;
|
|
178
187
|
color: var(--rs-info);
|
|
179
188
|
box-shadow: none;
|
|
180
189
|
}
|
|
181
190
|
|
|
191
|
+
.rs-toast [data-icon] svg {
|
|
192
|
+
width: 1.25rem;
|
|
193
|
+
height: 1.25rem;
|
|
194
|
+
flex-shrink: 0;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/* 多行内容时,图标略下移以对齐标题字面中线 */
|
|
198
|
+
.rs-toast:has([data-description]) [data-icon] {
|
|
199
|
+
align-self: start;
|
|
200
|
+
margin-top: 0.125rem;
|
|
201
|
+
}
|
|
202
|
+
|
|
182
203
|
.rs-toast [data-content] {
|
|
183
204
|
position: relative;
|
|
184
205
|
z-index: 1;
|
|
206
|
+
grid-column: 2;
|
|
207
|
+
grid-row: 1;
|
|
185
208
|
display: grid;
|
|
186
209
|
gap: 0.1875rem;
|
|
187
210
|
min-width: 0;
|
|
188
|
-
padding-right: 1.5rem;
|
|
189
211
|
}
|
|
190
212
|
|
|
191
213
|
.rs-toast [data-button] {
|
|
192
214
|
position: relative;
|
|
193
215
|
z-index: 1;
|
|
194
|
-
|
|
216
|
+
grid-column: 2;
|
|
217
|
+
margin-top: 0;
|
|
195
218
|
}
|
|
196
219
|
|
|
197
220
|
.rs-toast__title {
|
|
198
221
|
margin: 0;
|
|
199
222
|
color: var(--rs-text);
|
|
200
|
-
font-size:
|
|
201
|
-
font-weight:
|
|
202
|
-
line-height:
|
|
223
|
+
font-size: var(--rs-font-size-sm);
|
|
224
|
+
font-weight: var(--rs-font-weight-semibold);
|
|
225
|
+
line-height: var(--rs-line-height-tight);
|
|
203
226
|
letter-spacing: -0.012em;
|
|
204
227
|
}
|
|
205
228
|
|
|
206
229
|
.rs-toast__description {
|
|
207
230
|
margin: 0;
|
|
208
231
|
color: color-mix(in srgb, var(--rs-muted) 94%, var(--rs-text) 6%);
|
|
209
|
-
font-size:
|
|
210
|
-
line-height:
|
|
232
|
+
font-size: var(--rs-font-size-xs);
|
|
233
|
+
line-height: var(--rs-line-height-normal);
|
|
211
234
|
}
|
|
212
235
|
|
|
213
236
|
.rs-toast [data-close-button].rs-toast__close {
|
|
214
237
|
position: absolute;
|
|
215
|
-
|
|
238
|
+
top: 50%;
|
|
239
|
+
right: 0.625rem;
|
|
240
|
+
left: auto;
|
|
241
|
+
bottom: auto;
|
|
216
242
|
z-index: 2;
|
|
217
243
|
display: inline-flex;
|
|
218
244
|
align-items: center;
|
|
@@ -226,7 +252,7 @@ const sonnerTheme = computed<'light' | 'dark'>(() => {
|
|
|
226
252
|
color: var(--rs-muted);
|
|
227
253
|
box-shadow: none;
|
|
228
254
|
cursor: pointer;
|
|
229
|
-
transform:
|
|
255
|
+
transform: translateY(-50%);
|
|
230
256
|
opacity: 0.72;
|
|
231
257
|
transition:
|
|
232
258
|
opacity var(--rs-transition-fast),
|
|
@@ -236,6 +262,11 @@ const sonnerTheme = computed<'light' | 'dark'>(() => {
|
|
|
236
262
|
box-shadow var(--rs-transition-fast);
|
|
237
263
|
}
|
|
238
264
|
|
|
265
|
+
.rs-toast:has([data-description]) [data-close-button].rs-toast__close {
|
|
266
|
+
top: 0.75rem;
|
|
267
|
+
transform: none;
|
|
268
|
+
}
|
|
269
|
+
|
|
239
270
|
.rs-toast [data-close-button].rs-toast__close svg {
|
|
240
271
|
width: 0.75rem;
|
|
241
272
|
height: 0.75rem;
|
|
@@ -270,8 +301,8 @@ const sonnerTheme = computed<'light' | 'dark'>(() => {
|
|
|
270
301
|
border-radius: 999px;
|
|
271
302
|
background: color-mix(in srgb, var(--rs-primary) 92%, white 8%);
|
|
272
303
|
color: var(--rs-primary-foreground);
|
|
273
|
-
font-size:
|
|
274
|
-
font-weight:
|
|
304
|
+
font-size: var(--rs-font-size-xs);
|
|
305
|
+
font-weight: var(--rs-font-weight-semibold);
|
|
275
306
|
line-height: 1;
|
|
276
307
|
letter-spacing: 0.01em;
|
|
277
308
|
box-shadow:
|
|
@@ -371,16 +402,25 @@ const sonnerTheme = computed<'light' | 'dark'>(() => {
|
|
|
371
402
|
.rs-toast {
|
|
372
403
|
min-width: min(100%, 18.5rem);
|
|
373
404
|
max-width: calc(100vw - 1rem);
|
|
374
|
-
padding: 0.
|
|
405
|
+
padding: 0.75rem 2.125rem 0.75rem 0.8125rem;
|
|
375
406
|
border-radius: 0.9375rem;
|
|
376
407
|
}
|
|
377
408
|
|
|
409
|
+
.rs-toast:has([data-description]) {
|
|
410
|
+
padding-top: 0.8125rem;
|
|
411
|
+
padding-bottom: 0.8125rem;
|
|
412
|
+
}
|
|
413
|
+
|
|
378
414
|
.rs-toast [data-close-button].rs-toast__close {
|
|
379
|
-
|
|
415
|
+
right: 0.5rem;
|
|
380
416
|
width: 1.25rem;
|
|
381
417
|
height: 1.25rem;
|
|
382
418
|
}
|
|
383
419
|
|
|
420
|
+
.rs-toast:has([data-description]) [data-close-button].rs-toast__close {
|
|
421
|
+
top: 0.625rem;
|
|
422
|
+
}
|
|
423
|
+
|
|
384
424
|
.rs-toast__action {
|
|
385
425
|
min-height: 1.875rem;
|
|
386
426
|
padding: 0 0.6875rem;
|
|
@@ -10,6 +10,11 @@ const props = withDefaults(
|
|
|
10
10
|
align?: 'start' | 'center' | 'end'
|
|
11
11
|
sideOffset?: number
|
|
12
12
|
disabled?: boolean
|
|
13
|
+
/**
|
|
14
|
+
* 仅键盘 `:focus-visible` 时因焦点打开 tip。
|
|
15
|
+
* 默认 true:避免 Dialog/Popover 关闭回焦误开(对齐 Reka 推荐与 RsButton tooltip)。
|
|
16
|
+
*/
|
|
17
|
+
ignoreNonKeyboardFocus?: boolean
|
|
13
18
|
/** 单行展示并按内容撑开宽度(适合集合名等标识符) */
|
|
14
19
|
nowrap?: boolean
|
|
15
20
|
/**
|
|
@@ -25,6 +30,7 @@ const props = withDefaults(
|
|
|
25
30
|
align: 'center',
|
|
26
31
|
sideOffset: 6,
|
|
27
32
|
disabled: false,
|
|
33
|
+
ignoreNonKeyboardFocus: true,
|
|
28
34
|
nowrap: false,
|
|
29
35
|
icon: false,
|
|
30
36
|
iconName: 'info',
|
|
@@ -37,7 +43,10 @@ const iconAriaLabel = computed(() => props.content?.trim() || 'Help')
|
|
|
37
43
|
</script>
|
|
38
44
|
|
|
39
45
|
<template>
|
|
40
|
-
<TooltipRoot
|
|
46
|
+
<TooltipRoot
|
|
47
|
+
:disabled="disabled"
|
|
48
|
+
:ignore-non-keyboard-focus="ignoreNonKeyboardFocus"
|
|
49
|
+
>
|
|
41
50
|
<template v-if="icon">
|
|
42
51
|
<span class="rs-tooltip__with-icon">
|
|
43
52
|
<span v-if="hasLabelSlot" class="rs-tooltip__label">
|
|
@@ -5,16 +5,26 @@ withDefaults(
|
|
|
5
5
|
defineProps<{
|
|
6
6
|
delayDuration?: number
|
|
7
7
|
skipDelayDuration?: number
|
|
8
|
+
/**
|
|
9
|
+
* 仅键盘 focus-visible 时因焦点打开 tip。
|
|
10
|
+
* 默认 true:避免 Dialog/Popover 关闭回焦、切页签等非键盘焦点误开(对齐 Reka 推荐与 RsButton tooltip)。
|
|
11
|
+
*/
|
|
12
|
+
ignoreNonKeyboardFocus?: boolean
|
|
8
13
|
}>(),
|
|
9
14
|
{
|
|
10
15
|
delayDuration: 300,
|
|
11
16
|
skipDelayDuration: 0,
|
|
17
|
+
ignoreNonKeyboardFocus: true,
|
|
12
18
|
},
|
|
13
19
|
)
|
|
14
20
|
</script>
|
|
15
21
|
|
|
16
22
|
<template>
|
|
17
|
-
<TooltipProvider
|
|
23
|
+
<TooltipProvider
|
|
24
|
+
:delay-duration="delayDuration"
|
|
25
|
+
:skip-delay-duration="skipDelayDuration"
|
|
26
|
+
:ignore-non-keyboard-focus="ignoreNonKeyboardFocus"
|
|
27
|
+
>
|
|
18
28
|
<slot />
|
|
19
29
|
</TooltipProvider>
|
|
20
30
|
</template>
|