@ysgroup/ui 0.1.60 → 0.1.62
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/package.json +6 -6
- package/src/components/YsAppToolbar.vue +18 -9
- package/src/components/YsCalendar.vue +176 -15
- package/src/components/YsCalendarDayCard.vue +53 -4
- package/src/components/YsCardList.vue +247 -0
- package/src/components/YsCrudTable.vue +25 -1
- package/src/components/YsFilePreview.vue +3 -2
- package/src/components/YsPageHeader.vue +9 -3
- package/src/components/YsPageLayout.vue +237 -27
- package/src/components/YsRowActionMenu.vue +13 -0
- package/src/components/YsSettingsCenterDialog.vue +2 -1
- package/src/components/YsSideMenu.vue +13 -0
- package/src/components/YsTablePagination.vue +12 -1
- package/src/components/YsTableToolbar.vue +46 -1
- package/src/index.ts +12 -0
- package/src/viewport.ts +52 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ysgroup/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.62",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"@ysgroup/contracts": ">=0.1.50",
|
|
14
|
-
"@ysgroup/core": ">=0.1.
|
|
15
|
-
"@ysgroup/theme": ">=0.3.
|
|
14
|
+
"@ysgroup/core": ">=0.1.34",
|
|
15
|
+
"@ysgroup/theme": ">=0.3.4",
|
|
16
16
|
"element-plus": ">=2.9",
|
|
17
17
|
"vue": ">=3.5"
|
|
18
18
|
},
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@ysgroup/contracts": "^0.1.
|
|
29
|
-
"@ysgroup/core": "^0.1.
|
|
30
|
-
"@ysgroup/theme": "^0.3.
|
|
28
|
+
"@ysgroup/contracts": "^0.1.53",
|
|
29
|
+
"@ysgroup/core": "^0.1.34",
|
|
30
|
+
"@ysgroup/theme": "^0.3.4",
|
|
31
31
|
"docx-preview": "^0.4.1"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { onBeforeUnmount, ref } from "vue";
|
|
2
|
+
import { computed, onBeforeUnmount, ref } from "vue";
|
|
3
3
|
import { ElMessage } from "element-plus";
|
|
4
4
|
import { Moon, Setting, Sunny } from "@element-plus/icons-vue";
|
|
5
5
|
import {
|
|
@@ -9,11 +9,16 @@ import {
|
|
|
9
9
|
THEME_CHANGE_EVENT,
|
|
10
10
|
type ThemeMode,
|
|
11
11
|
} from "@ysgroup/theme";
|
|
12
|
+
import { useYsMobile, useYsTouch } from "../viewport";
|
|
12
13
|
|
|
13
14
|
defineProps<{ username?: string }>();
|
|
14
15
|
const emit = defineEmits<{ settings: []; logout: [] }>();
|
|
15
16
|
const mode = ref<ThemeMode>(resolvedMode());
|
|
16
17
|
const dropdown = ref<{ handleClose: () => void } | null>(null);
|
|
18
|
+
const mobile = useYsMobile();
|
|
19
|
+
const touch = useYsTouch();
|
|
20
|
+
/** 触屏没有悬停:设置菜单改成点一下打开;换肤按钮在触屏上直接切换,不弹菜单。 */
|
|
21
|
+
const menuTrigger = computed(() => (touch.value ? "click" : "hover"));
|
|
17
22
|
if (currentMode() === "auto") applyTheme(mode.value, "sync");
|
|
18
23
|
|
|
19
24
|
// 登录后按账号偏好切换、或别处切换时,图标跟着变。
|
|
@@ -51,13 +56,15 @@ function settingsCommand(command: string) {
|
|
|
51
56
|
|
|
52
57
|
<template>
|
|
53
58
|
<div class="ys-app-toolbar">
|
|
54
|
-
|
|
59
|
+
<!-- 手机上不显示用户名(设置中心里有),把顶栏留给系统名称。 -->
|
|
60
|
+
<span v-if="username && !mobile" class="ys-app-toolbar__user" :title="username">{{
|
|
55
61
|
username
|
|
56
62
|
}}</span>
|
|
57
|
-
<span v-if="username" class="ys-app-toolbar__divider" aria-hidden="true" />
|
|
63
|
+
<span v-if="username && !mobile" class="ys-app-toolbar__divider" aria-hidden="true" />
|
|
58
64
|
<el-dropdown
|
|
59
65
|
ref="dropdown"
|
|
60
66
|
trigger="hover"
|
|
67
|
+
:disabled="touch"
|
|
61
68
|
popper-class="ys-app-theme-menu"
|
|
62
69
|
@command="selectTheme"
|
|
63
70
|
>
|
|
@@ -88,7 +95,7 @@ function settingsCommand(command: string) {
|
|
|
88
95
|
</template>
|
|
89
96
|
</el-dropdown>
|
|
90
97
|
<span class="ys-app-toolbar__divider" aria-hidden="true" />
|
|
91
|
-
<el-dropdown trigger="
|
|
98
|
+
<el-dropdown :trigger="menuTrigger" @command="settingsCommand">
|
|
92
99
|
<button type="button" class="ys-app-toolbar__button" aria-label="设置">
|
|
93
100
|
<el-icon :size="18"><Setting /></el-icon>
|
|
94
101
|
</button>
|
|
@@ -156,16 +163,18 @@ function settingsCommand(command: string) {
|
|
|
156
163
|
outline-offset: -2px;
|
|
157
164
|
color: var(--ys-color-primary);
|
|
158
165
|
}
|
|
159
|
-
|
|
166
|
+
/* 手机:按钮放大到 40px,分隔线收窄。 */
|
|
167
|
+
@media (max-width: 767px) {
|
|
160
168
|
.ys-app-toolbar {
|
|
161
169
|
padding-left: 4px;
|
|
170
|
+
gap: 0;
|
|
162
171
|
}
|
|
163
|
-
.ys-app-
|
|
164
|
-
|
|
165
|
-
|
|
172
|
+
.ys-app-toolbar__button {
|
|
173
|
+
width: 40px;
|
|
174
|
+
height: 40px;
|
|
166
175
|
}
|
|
167
176
|
.ys-app-toolbar__divider {
|
|
168
|
-
margin: 0
|
|
177
|
+
margin: 0 2px;
|
|
169
178
|
}
|
|
170
179
|
}
|
|
171
180
|
</style>
|
|
@@ -15,8 +15,13 @@
|
|
|
15
15
|
* - v-model 是选中日期,v-model:month 是显示的月份(`YYYY-MM`);翻月后按 ysMonthRange(month) 取这一屏的日期信息。
|
|
16
16
|
* - 键盘:方向键移动一天或一周,PageUp / PageDown 翻月,Home / End 到本周一 / 周日,Enter 或空格选中;跨月自动翻页。
|
|
17
17
|
* - 事件条(events)每格最多 maxEvents 条,其余收成「+N」(触发 more);要完全自定义格子内容用 #day 插槽。
|
|
18
|
+
* - 交易所额外休市(国务院安排上班、交易所休市,如 2024-02-09 除夕):交易日视图按休市显示,两种视图都写「交易所休市」。
|
|
19
|
+
* - night:交易日视图标出期货夜盘——当晚有夜盘的交易日在标签旁写小「夜」,节前等没有夜盘的交易日写「无夜盘」。
|
|
20
|
+
* - years:各年数据来源与核对状态(服务端 CalendarService.year_states()),传了就在顶部写这一屏所在年份的来源,
|
|
21
|
+
* 如「2026 年:Auth 下发 · 已与交易所核对」,悬停看各数据源的核对结果。
|
|
18
22
|
*/
|
|
19
23
|
import { computed, nextTick, ref, watch } from "vue";
|
|
24
|
+
import { useYsMobile } from "../viewport";
|
|
20
25
|
import {
|
|
21
26
|
YS_DAY_KIND_LABELS,
|
|
22
27
|
YS_TRADING_TAG_LABELS,
|
|
@@ -31,7 +36,9 @@ import {
|
|
|
31
36
|
ysToday,
|
|
32
37
|
ysTradingMarks,
|
|
33
38
|
ysWeekday,
|
|
39
|
+
ysCalendarYearText,
|
|
34
40
|
type YsCalendarDay,
|
|
41
|
+
type YsCalendarYearInfo,
|
|
35
42
|
type YsMonthCell,
|
|
36
43
|
type YsTradingMark,
|
|
37
44
|
} from "@ysgroup/core";
|
|
@@ -89,6 +96,10 @@ const props = withDefaults(
|
|
|
89
96
|
disabledDate?: (date: string, info?: YsCalendarDay) => boolean;
|
|
90
97
|
/** 显示底部图例;默认有日期信息时显示。 */
|
|
91
98
|
legend?: boolean | null;
|
|
99
|
+
/** 交易日视图标出期货夜盘(有夜盘写「夜」,没有写「无夜盘」)。 */
|
|
100
|
+
night?: boolean;
|
|
101
|
+
/** 各年数据来源与核对状态;传了就在顶部写这一屏所在年份的来源。 */
|
|
102
|
+
years?: readonly YsCalendarYearInfo[];
|
|
92
103
|
}>(),
|
|
93
104
|
{
|
|
94
105
|
modelValue: "",
|
|
@@ -107,6 +118,8 @@ const props = withDefaults(
|
|
|
107
118
|
maxEvents: 3,
|
|
108
119
|
disabledDate: undefined,
|
|
109
120
|
legend: null,
|
|
121
|
+
night: false,
|
|
122
|
+
years: () => [],
|
|
110
123
|
},
|
|
111
124
|
);
|
|
112
125
|
|
|
@@ -147,6 +160,12 @@ const eventMap = computed(() => {
|
|
|
147
160
|
return map;
|
|
148
161
|
});
|
|
149
162
|
const small = computed(() => props.size === "small");
|
|
163
|
+
/**
|
|
164
|
+
* 格子紧凑:迷你模式,或者手机(≤767px,每格只有 50px 左右宽,放不下状态标签和事件条)。
|
|
165
|
+
* 紧凑时格子里只有日期、底色、休 / 班角标和事件圆点;手机上月份统计、数据来源、图例照常显示,详情看旁边的 YsCalendarDayCard。
|
|
166
|
+
*/
|
|
167
|
+
const mobile = useYsMobile();
|
|
168
|
+
const compact = computed(() => small.value || mobile.value);
|
|
150
169
|
const view = computed(() => props.mark ?? (props.trading ? "trading" : "none"));
|
|
151
170
|
const tradingView = computed(() => view.value === "trading");
|
|
152
171
|
const labelText = computed<YsCalendarLabels>(() => ({
|
|
@@ -167,6 +186,32 @@ const missingYears = computed(() => {
|
|
|
167
186
|
years.add(cell.date.slice(0, 4));
|
|
168
187
|
return [...years].sort();
|
|
169
188
|
});
|
|
189
|
+
/** 这一屏所在年份(本月)的数据来源说明。 */
|
|
190
|
+
const yearInfo = computed(() =>
|
|
191
|
+
props.years.find(
|
|
192
|
+
(item) => String(item.year) === shownMonth.value.slice(0, 4),
|
|
193
|
+
),
|
|
194
|
+
);
|
|
195
|
+
const yearText = computed(() => ysCalendarYearText(yearInfo.value));
|
|
196
|
+
const yearTitle = computed(() => {
|
|
197
|
+
const info = yearInfo.value;
|
|
198
|
+
if (!info) return "";
|
|
199
|
+
const lines = [`${info.year} 年:${yearText.value}`];
|
|
200
|
+
for (const check of info.checks ?? []) {
|
|
201
|
+
const head = `${check.label || check.source}:${check.status_label || check.status}`;
|
|
202
|
+
lines.push(check.message ? `${head}(${check.message})` : head);
|
|
203
|
+
for (const line of (check.differences ?? []).slice(0, 5))
|
|
204
|
+
lines.push(` ${line}`);
|
|
205
|
+
}
|
|
206
|
+
return lines.join("\n");
|
|
207
|
+
});
|
|
208
|
+
const yearTone = computed(() => {
|
|
209
|
+
const info = yearInfo.value;
|
|
210
|
+
if (!info || info.status === "unpublished" || info.status === "unknown")
|
|
211
|
+
return "warning";
|
|
212
|
+
if (info.checks?.some((item) => item.status === "differ")) return "warning";
|
|
213
|
+
return info.verified ? "success" : "info";
|
|
214
|
+
});
|
|
170
215
|
const todayVisible = computed(() =>
|
|
171
216
|
cells.value.some((cell) => cell.date === todayText.value),
|
|
172
217
|
);
|
|
@@ -238,16 +283,31 @@ function isWeekendCell(cell: YsMonthCell): boolean {
|
|
|
238
283
|
if (value) return value === "weekend" || value === "holiday";
|
|
239
284
|
return cell.weekday >= 5;
|
|
240
285
|
}
|
|
241
|
-
/** 状态标签下面那一行:节日名;交易日视图休市日写「国庆节 ·
|
|
286
|
+
/** 状态标签下面那一行:节日名;交易日视图休市日写「国庆节 · 休市」,法定补班写「国庆节调休」,
|
|
287
|
+
* 交易所额外休市写「交易所休市」,夜盘视图下没有夜盘的交易日写「无夜盘」。 */
|
|
242
288
|
function subline(date: string): string {
|
|
243
289
|
if (!inShownMonth(date)) return "";
|
|
244
290
|
const value = status(date);
|
|
245
|
-
const
|
|
291
|
+
const item = info(date);
|
|
292
|
+
const name = item?.name ?? "";
|
|
293
|
+
if (value && item?.market_closed) return "交易所休市";
|
|
294
|
+
if (value === "trading" && props.night && item?.night_session === false)
|
|
295
|
+
return "无夜盘";
|
|
246
296
|
if (!value || !name) return "";
|
|
247
297
|
if (value === "closed") return `${name} · ${labelText.value.closed}`;
|
|
248
298
|
if (value === "adjusted") return `${name}调休`;
|
|
249
299
|
return name;
|
|
250
300
|
}
|
|
301
|
+
/** 夜盘视图下当晚有夜盘的交易日。 */
|
|
302
|
+
function hasNight(date: string): boolean {
|
|
303
|
+
return (
|
|
304
|
+
props.night &&
|
|
305
|
+
tradingView.value &&
|
|
306
|
+
inShownMonth(date) &&
|
|
307
|
+
status(date) === "trading" &&
|
|
308
|
+
info(date)?.night_session === true
|
|
309
|
+
);
|
|
310
|
+
}
|
|
251
311
|
function ordinalOf(date: string): number | undefined {
|
|
252
312
|
return props.showOrdinal && inShownMonth(date)
|
|
253
313
|
? marks.value.get(date)?.ordinal
|
|
@@ -269,6 +329,7 @@ function ariaLabel(cell: YsMonthCell): string {
|
|
|
269
329
|
? `${YS_DAY_KIND_LABELS[item.kind]} ${item.name}`
|
|
270
330
|
: YS_DAY_KIND_LABELS[item.kind],
|
|
271
331
|
);
|
|
332
|
+
if (item.market_closed) parts.push(`交易所休市(${item.market_closed})`);
|
|
272
333
|
if (tradingView.value) {
|
|
273
334
|
const mark = markOf(cell.date);
|
|
274
335
|
parts.push(
|
|
@@ -278,6 +339,12 @@ function ariaLabel(cell: YsMonthCell): string {
|
|
|
278
339
|
: "交易日"
|
|
279
340
|
: "休市",
|
|
280
341
|
);
|
|
342
|
+
if (props.night && item.trading && item.night_session != null)
|
|
343
|
+
parts.push(
|
|
344
|
+
item.night_session
|
|
345
|
+
? `当晚有夜盘,归属 ${item.night_trading_day ?? ""}`
|
|
346
|
+
: "当晚没有夜盘",
|
|
347
|
+
);
|
|
281
348
|
for (const tag of mark?.tags ?? [])
|
|
282
349
|
parts.push(YS_TRADING_TAG_LABELS[tag].full);
|
|
283
350
|
}
|
|
@@ -294,7 +361,10 @@ const legendItems = computed<{ key: YsCalendarStatus; text: string }[]>(() => {
|
|
|
294
361
|
if (tradingView.value)
|
|
295
362
|
return [
|
|
296
363
|
{ key: "trading", text: props.showOrdinal ? "旁边是本月第几个" : "" },
|
|
297
|
-
{
|
|
364
|
+
{
|
|
365
|
+
key: "closed",
|
|
366
|
+
text: `周末、放假、交易所休市和${labelText.value.adjusted}的周末`,
|
|
367
|
+
},
|
|
298
368
|
];
|
|
299
369
|
if (view.value === "work")
|
|
300
370
|
return [
|
|
@@ -404,6 +474,8 @@ function goToday() {
|
|
|
404
474
|
class="ys-calendar"
|
|
405
475
|
:class="{
|
|
406
476
|
'is-small': small,
|
|
477
|
+
'is-compact': compact,
|
|
478
|
+
'is-mobile': mobile,
|
|
407
479
|
'is-trading-view': tradingView,
|
|
408
480
|
'is-focusing': Boolean(focusStatus),
|
|
409
481
|
}"
|
|
@@ -455,6 +527,14 @@ function goToday() {
|
|
|
455
527
|
><strong>{{ part.value }}</strong></span
|
|
456
528
|
>
|
|
457
529
|
</div>
|
|
530
|
+
<span
|
|
531
|
+
v-if="yearText && !small"
|
|
532
|
+
class="ys-calendar__source"
|
|
533
|
+
:class="`is-${yearTone}`"
|
|
534
|
+
:title="yearTitle"
|
|
535
|
+
role="note"
|
|
536
|
+
>{{ shownMonth.slice(0, 4) }} 年:{{ yearText }}</span
|
|
537
|
+
>
|
|
458
538
|
<div v-if="$slots.extra" class="ys-calendar__extra">
|
|
459
539
|
<slot name="extra" />
|
|
460
540
|
</div>
|
|
@@ -485,7 +565,7 @@ function goToday() {
|
|
|
485
565
|
:class="{ 'is-weekend': index >= 5 }"
|
|
486
566
|
role="columnheader"
|
|
487
567
|
>
|
|
488
|
-
{{
|
|
568
|
+
{{ compact ? label : `周${label}` }}
|
|
489
569
|
</div>
|
|
490
570
|
</div>
|
|
491
571
|
<div
|
|
@@ -534,15 +614,16 @@ function goToday() {
|
|
|
534
614
|
Number(cell.date.slice(8))
|
|
535
615
|
}}</span>
|
|
536
616
|
<span
|
|
537
|
-
v-if="
|
|
617
|
+
v-if="compact && badge(cell.date)"
|
|
538
618
|
class="ys-calendar__badge"
|
|
539
619
|
:class="badge(cell.date) === '休' ? 'is-off' : 'is-work'"
|
|
540
620
|
>{{ badge(cell.date) }}</span
|
|
541
621
|
>
|
|
542
622
|
<span
|
|
543
623
|
v-else-if="
|
|
544
|
-
!
|
|
624
|
+
!compact &&
|
|
545
625
|
(ordinalOf(cell.date) ||
|
|
626
|
+
hasNight(cell.date) ||
|
|
546
627
|
(showLabel && statusLabel(cell.date)))
|
|
547
628
|
"
|
|
548
629
|
class="ys-calendar__status"
|
|
@@ -553,6 +634,12 @@ function goToday() {
|
|
|
553
634
|
aria-hidden="true"
|
|
554
635
|
>第 {{ ordinalOf(cell.date) }} 个</span
|
|
555
636
|
>
|
|
637
|
+
<span
|
|
638
|
+
v-if="hasNight(cell.date)"
|
|
639
|
+
class="ys-calendar__night"
|
|
640
|
+
aria-hidden="true"
|
|
641
|
+
>夜</span
|
|
642
|
+
>
|
|
556
643
|
<span
|
|
557
644
|
v-if="showLabel && statusLabel(cell.date)"
|
|
558
645
|
class="ys-calendar__label"
|
|
@@ -561,7 +648,7 @@ function goToday() {
|
|
|
561
648
|
>
|
|
562
649
|
</span>
|
|
563
650
|
</div>
|
|
564
|
-
<template v-if="!
|
|
651
|
+
<template v-if="!compact">
|
|
565
652
|
<div v-if="subline(cell.date)" class="ys-calendar__name">
|
|
566
653
|
{{ subline(cell.date) }}
|
|
567
654
|
</div>
|
|
@@ -617,6 +704,9 @@ function goToday() {
|
|
|
617
704
|
item.text
|
|
618
705
|
}}</span>
|
|
619
706
|
</button>
|
|
707
|
+
<span v-if="night && tradingView" class="ys-calendar__legend-night"
|
|
708
|
+
><i class="ys-calendar__night">夜</i>当晚有期货夜盘</span
|
|
709
|
+
>
|
|
620
710
|
<span v-if="todayVisible" class="ys-calendar__legend-today">今天</span>
|
|
621
711
|
</footer>
|
|
622
712
|
</div>
|
|
@@ -711,6 +801,53 @@ function goToday() {
|
|
|
711
801
|
font-size: 14px;
|
|
712
802
|
font-variant-numeric: tabular-nums;
|
|
713
803
|
}
|
|
804
|
+
.ys-calendar__source {
|
|
805
|
+
padding: 1px 8px;
|
|
806
|
+
border-radius: var(--ys-radius-s);
|
|
807
|
+
color: var(--ys-color-text-2);
|
|
808
|
+
background: color-mix(in srgb, var(--ys-color-text-3) 10%, transparent);
|
|
809
|
+
font-size: 12px;
|
|
810
|
+
line-height: 20px;
|
|
811
|
+
cursor: help;
|
|
812
|
+
}
|
|
813
|
+
.ys-calendar__source.is-success {
|
|
814
|
+
color: color-mix(
|
|
815
|
+
in srgb,
|
|
816
|
+
var(--ys-color-success) 80%,
|
|
817
|
+
var(--ys-color-text-1)
|
|
818
|
+
);
|
|
819
|
+
background: color-mix(in srgb, var(--ys-color-success) 10%, transparent);
|
|
820
|
+
}
|
|
821
|
+
.ys-calendar__source.is-warning {
|
|
822
|
+
color: color-mix(
|
|
823
|
+
in srgb,
|
|
824
|
+
var(--ys-color-warning) 80%,
|
|
825
|
+
var(--ys-color-text-1)
|
|
826
|
+
);
|
|
827
|
+
background: color-mix(in srgb, var(--ys-color-warning) 12%, transparent);
|
|
828
|
+
}
|
|
829
|
+
/* 夜盘角标:小号描边「夜」,不抢交易日标签 */
|
|
830
|
+
.ys-calendar__night {
|
|
831
|
+
flex: none;
|
|
832
|
+
padding: 0 3px;
|
|
833
|
+
border: 1px solid color-mix(in srgb, var(--ys-color-primary) 45%, transparent);
|
|
834
|
+
border-radius: var(--ys-radius-s);
|
|
835
|
+
color: color-mix(
|
|
836
|
+
in srgb,
|
|
837
|
+
var(--ys-color-primary) 85%,
|
|
838
|
+
var(--ys-color-text-1)
|
|
839
|
+
);
|
|
840
|
+
font-size: 10px;
|
|
841
|
+
font-style: normal;
|
|
842
|
+
font-weight: 600;
|
|
843
|
+
line-height: 14px;
|
|
844
|
+
}
|
|
845
|
+
.ys-calendar__legend-night {
|
|
846
|
+
display: inline-flex;
|
|
847
|
+
gap: 5px;
|
|
848
|
+
align-items: center;
|
|
849
|
+
margin-left: 6px;
|
|
850
|
+
}
|
|
714
851
|
.ys-calendar__extra {
|
|
715
852
|
display: flex;
|
|
716
853
|
flex-wrap: wrap;
|
|
@@ -1070,33 +1207,33 @@ function goToday() {
|
|
|
1070
1207
|
content: "";
|
|
1071
1208
|
}
|
|
1072
1209
|
|
|
1073
|
-
/*
|
|
1074
|
-
.ys-calendar.is-
|
|
1210
|
+
/* 紧凑格子(迷你模式和手机):只有日期、底色、休、班角标和事件圆点,悬停或看详情卡了解完整信息 */
|
|
1211
|
+
.ys-calendar.is-compact .ys-calendar__weekday {
|
|
1075
1212
|
padding: 4px 0;
|
|
1076
1213
|
text-align: center;
|
|
1077
1214
|
}
|
|
1078
|
-
.ys-calendar.is-
|
|
1215
|
+
.ys-calendar.is-compact .ys-calendar__cell {
|
|
1079
1216
|
align-items: center;
|
|
1080
1217
|
justify-content: center;
|
|
1081
1218
|
min-height: 36px;
|
|
1082
1219
|
padding: 2px;
|
|
1083
1220
|
}
|
|
1084
|
-
.ys-calendar.is-
|
|
1221
|
+
.ys-calendar.is-compact .ys-calendar__cell + .ys-calendar__cell {
|
|
1085
1222
|
border-left: 0;
|
|
1086
1223
|
}
|
|
1087
|
-
.ys-calendar.is-
|
|
1224
|
+
.ys-calendar.is-compact .ys-calendar__row + .ys-calendar__row {
|
|
1088
1225
|
border-top: 0;
|
|
1089
1226
|
}
|
|
1090
1227
|
/* 角标跟着日期数字:top 只包住数字,角标挂在数字右上角(不超出最右一列) */
|
|
1091
|
-
.ys-calendar.is-
|
|
1228
|
+
.ys-calendar.is-compact .ys-calendar__top {
|
|
1092
1229
|
position: relative;
|
|
1093
1230
|
display: inline-flex;
|
|
1094
1231
|
}
|
|
1095
|
-
.ys-calendar.is-
|
|
1232
|
+
.ys-calendar.is-compact .ys-calendar__date {
|
|
1096
1233
|
font-size: 12px;
|
|
1097
1234
|
font-weight: 500;
|
|
1098
1235
|
}
|
|
1099
|
-
.ys-calendar.is-
|
|
1236
|
+
.ys-calendar.is-compact .ys-calendar__badge {
|
|
1100
1237
|
position: absolute;
|
|
1101
1238
|
top: -5px;
|
|
1102
1239
|
right: -6px;
|
|
@@ -1110,4 +1247,28 @@ function goToday() {
|
|
|
1110
1247
|
border-radius: 50%;
|
|
1111
1248
|
background: var(--ys-color-primary);
|
|
1112
1249
|
}
|
|
1250
|
+
/* 手机:格子高 44px 好点,月份切换和页面自己的开关(#extra)各占一行 */
|
|
1251
|
+
.ys-calendar.is-mobile .ys-calendar__cell {
|
|
1252
|
+
min-height: 44px;
|
|
1253
|
+
}
|
|
1254
|
+
.ys-calendar.is-mobile .ys-calendar__date {
|
|
1255
|
+
font-size: 14px;
|
|
1256
|
+
}
|
|
1257
|
+
.ys-calendar.is-mobile .ys-calendar__head {
|
|
1258
|
+
gap: 8px;
|
|
1259
|
+
}
|
|
1260
|
+
.ys-calendar.is-mobile .ys-calendar__nav {
|
|
1261
|
+
flex: 1 1 100%;
|
|
1262
|
+
}
|
|
1263
|
+
.ys-calendar.is-mobile .ys-calendar__nav :deep(.el-date-editor.ys-calendar__month) {
|
|
1264
|
+
flex: 1;
|
|
1265
|
+
width: auto;
|
|
1266
|
+
}
|
|
1267
|
+
.ys-calendar.is-mobile .ys-calendar__arrow {
|
|
1268
|
+
width: 40px;
|
|
1269
|
+
height: 36px;
|
|
1270
|
+
}
|
|
1271
|
+
.ys-calendar.is-mobile .ys-calendar__extra {
|
|
1272
|
+
flex: 1 1 100%;
|
|
1273
|
+
}
|
|
1113
1274
|
</style>
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* 选中日详情卡:放在 YsCalendar 旁边,介绍选中那天的情况。
|
|
4
4
|
*
|
|
5
|
-
* -
|
|
5
|
+
* - 头部:日期方块(颜色跟月历一致:工作日、法定补班浅绿,放假浅橙,休息灰)、完整日期、离今天几天、农历、
|
|
6
6
|
* 传统节日和节气。
|
|
7
7
|
* - 状态:工作日 / 法定补班 / 休息 / 放假、交易日 / 休市,以及节前最后、节后首日、月初、月末这些关键交易日(全称)。
|
|
8
8
|
* - 本月位置:几月第 N 个工作日、第 N 个交易日(带进度条),放假时写「国庆节假期第 3 天,共 8 天」。
|
|
9
9
|
* - 当天的事项(events),以及默认插槽放页面自己的内容(如上一个、下一个交易日和 T+N 推算)。
|
|
10
|
-
* -
|
|
10
|
+
* - 农历、干支生肖、传统节日和节气默认显示,页面不用加开关;确实不需要的系统传 :lunar="false"。农历用 ysLunar 现算,只用于显示。
|
|
11
|
+
* - 交易所额外休市(国务院安排上班、交易所休市)写「交易所休市」和原因;交易日写当晚有没有期货夜盘、夜盘归属哪个交易日
|
|
12
|
+
* (night 关掉不写)。
|
|
13
|
+
* - years 传了就在底部写这一天所在年份的数据来源与核对状态。
|
|
11
14
|
* - 数据都由 @ysgroup/core 的 ysDayDetail 从服务端下发的 days 推出,组件只显示。
|
|
12
15
|
*/
|
|
13
16
|
import { computed } from "vue";
|
|
@@ -19,7 +22,9 @@ import {
|
|
|
19
22
|
ysIsDate,
|
|
20
23
|
ysToday,
|
|
21
24
|
ysWeekdayLabel,
|
|
25
|
+
ysCalendarYearText,
|
|
22
26
|
type YsCalendarDay,
|
|
27
|
+
type YsCalendarYearInfo,
|
|
23
28
|
} from "@ysgroup/core";
|
|
24
29
|
import type {
|
|
25
30
|
YsCalendarEvent,
|
|
@@ -48,8 +53,12 @@ const props = withDefaults(
|
|
|
48
53
|
labels?: Partial<YsCalendarLabels>;
|
|
49
54
|
/** 显示交易日相关内容(交易日 / 休市、第几个交易日、关键交易日);不涉及交易的系统可以关掉。 */
|
|
50
55
|
trading?: boolean;
|
|
51
|
-
/**
|
|
56
|
+
/** 显示农历、干支生肖、传统节日和节气;默认显示,不需要时传 false。 */
|
|
52
57
|
lunar?: boolean;
|
|
58
|
+
/** 交易日写当晚有没有期货夜盘(trading 关掉时也不写)。 */
|
|
59
|
+
night?: boolean;
|
|
60
|
+
/** 各年数据来源与核对状态(服务端 CalendarService.year_states())。 */
|
|
61
|
+
years?: readonly YsCalendarYearInfo[];
|
|
53
62
|
}>(),
|
|
54
63
|
{
|
|
55
64
|
days: () => [],
|
|
@@ -57,7 +66,9 @@ const props = withDefaults(
|
|
|
57
66
|
today: "",
|
|
58
67
|
labels: () => ({}),
|
|
59
68
|
trading: true,
|
|
60
|
-
lunar:
|
|
69
|
+
lunar: true,
|
|
70
|
+
night: true,
|
|
71
|
+
years: () => [],
|
|
61
72
|
},
|
|
62
73
|
);
|
|
63
74
|
|
|
@@ -126,12 +137,20 @@ const chips = computed(() => {
|
|
|
126
137
|
tone: "holiday",
|
|
127
138
|
});
|
|
128
139
|
else list.push({ text: labels[kind], tone: kind });
|
|
140
|
+
if (info.value.market_closed)
|
|
141
|
+
list.push({ text: "交易所休市", tone: "holiday" });
|
|
129
142
|
if (props.trading) {
|
|
130
143
|
list.push(
|
|
131
144
|
info.value.trading
|
|
132
145
|
? { text: labels.trading, tone: "trading" }
|
|
133
146
|
: { text: labels.closed, tone: "closed" },
|
|
134
147
|
);
|
|
148
|
+
if (props.night && info.value.trading && info.value.night_session != null)
|
|
149
|
+
list.push(
|
|
150
|
+
info.value.night_session
|
|
151
|
+
? { text: "当晚有夜盘", tone: "trading" }
|
|
152
|
+
: { text: "当晚无夜盘", tone: "key" },
|
|
153
|
+
);
|
|
135
154
|
for (const tag of detail.value.tags)
|
|
136
155
|
list.push({ text: YS_TRADING_TAG_LABELS[tag].full, tone: "key" });
|
|
137
156
|
}
|
|
@@ -176,9 +195,30 @@ const note = computed(() => {
|
|
|
176
195
|
if (!info.value) return "";
|
|
177
196
|
if (props.trading && info.value.kind === "adjusted")
|
|
178
197
|
return "法定补班的周末要上班,但交易所照常休市,不是交易日。";
|
|
198
|
+
if (info.value.market_closed)
|
|
199
|
+
return `国务院安排这天上班,但交易所休市:${info.value.market_closed}。`;
|
|
200
|
+
if (
|
|
201
|
+
props.trading &&
|
|
202
|
+
props.night &&
|
|
203
|
+
info.value.night_session &&
|
|
204
|
+
info.value.night_trading_day
|
|
205
|
+
)
|
|
206
|
+
return `当晚 21:00 起的夜盘归属 ${info.value.night_trading_day} 交易日。`;
|
|
207
|
+
if (
|
|
208
|
+
props.trading &&
|
|
209
|
+
props.night &&
|
|
210
|
+
info.value.trading &&
|
|
211
|
+
info.value.night_session === null
|
|
212
|
+
)
|
|
213
|
+
return "下一个交易日所在年份还没有安排,暂不判断当晚有没有夜盘。";
|
|
179
214
|
return "";
|
|
180
215
|
});
|
|
181
216
|
|
|
217
|
+
const yearInfo = computed(() =>
|
|
218
|
+
props.years.find((item) => String(item.year) === props.date.slice(0, 4)),
|
|
219
|
+
);
|
|
220
|
+
const sourceText = computed(() => ysCalendarYearText(yearInfo.value));
|
|
221
|
+
|
|
182
222
|
const dayEvents = computed(() =>
|
|
183
223
|
props.events.filter((item) => item.date === props.date),
|
|
184
224
|
);
|
|
@@ -278,6 +318,10 @@ const dayEvents = computed(() =>
|
|
|
278
318
|
<div v-if="$slots.default" class="ys-day-card__extra">
|
|
279
319
|
<slot :detail="detail" />
|
|
280
320
|
</div>
|
|
321
|
+
|
|
322
|
+
<p v-if="sourceText" class="ys-day-card__source">
|
|
323
|
+
数据来源:{{ sourceText }}
|
|
324
|
+
</p>
|
|
281
325
|
</template>
|
|
282
326
|
<p v-else class="ys-day-card__empty">
|
|
283
327
|
点月历里的一天,这里显示当天的详情。
|
|
@@ -546,6 +590,11 @@ const dayEvents = computed(() =>
|
|
|
546
590
|
.ys-day-card__events li.is-info {
|
|
547
591
|
--chip: var(--ys-color-text-3);
|
|
548
592
|
}
|
|
593
|
+
.ys-day-card__source {
|
|
594
|
+
margin: 0;
|
|
595
|
+
color: var(--ys-color-text-3);
|
|
596
|
+
font-size: 12px;
|
|
597
|
+
}
|
|
549
598
|
.ys-day-card__extra {
|
|
550
599
|
padding-top: 12px;
|
|
551
600
|
border-top: 1px dashed var(--ys-color-border);
|