@ysgroup/ui 0.1.56 → 0.1.57

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ysgroup/ui",
3
- "version": "0.1.56",
3
+ "version": "0.1.57",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "peerDependencies": {
13
13
  "@ysgroup/contracts": ">=0.1.50",
14
- "@ysgroup/core": ">=0.1.31",
14
+ "@ysgroup/core": ">=0.1.32",
15
15
  "@ysgroup/theme": ">=0.3.3",
16
16
  "element-plus": ">=2.9",
17
17
  "vue": ">=3.5"
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "@ysgroup/contracts": "^0.1.51",
29
- "@ysgroup/core": "^0.1.31",
29
+ "@ysgroup/core": "^0.1.32",
30
30
  "@ysgroup/theme": "^0.3.3",
31
31
  "docx-preview": "^0.4.1"
32
32
  }
@@ -1,27 +1,33 @@
1
1
  <script setup lang="ts">
2
2
  /**
3
- * 月历:法定节假日(休、班、节日名)、交易日、今天、选中日,可放事件条;迷你模式用于侧栏或日期概览。
3
+ * 月历:两种视图——「休班」标放假、调休上班和节日名;「交易日」只回答开不开市:交易日左侧主色竖条、右上角写本月
4
+ * 第几个交易日,节前最后、节后首日、月初、月末这几个关键交易日加小标签,休市日(周末、放假、调休上班的周末)斜纹底写「休市」。
4
5
  *
5
- * - 日期信息(days)由服务端 ys_base.calendar 下发,组件只显示,不自己按周一到周五猜;
6
- * 某天 covered 为 false 表示这一年还没有放假安排,顶部写明、格子不标休班。
6
+ * - 日期信息(days)由服务端 ys_base.calendar 下发,组件只显示,不自己按周一到周五猜;某天 covered 为 false 表示这一年
7
+ * 还没有放假安排,顶部写明、格子不标休班也不标交易日。交易日标记由 @ysgroup/core 的 ysTradingMarks 按 trading 字段推出。
7
8
  * - v-model 是选中日期,v-model:month 是显示的月份(`YYYY-MM`);翻月后按 ysMonthRange(month) 取这一屏的日期信息。
9
+ * - mark="work" | "trading" 选视图(旧的 trading 属性等于 mark="trading");summary 在顶部显示本月统计。
8
10
  * - 键盘:方向键移动一天或一周,PageUp / PageDown 翻月,Home / End 到本周一 / 周日,Enter 或空格选中;跨月自动翻页。
9
11
  * - 事件条(events)每格最多 maxEvents 条,其余收成「+N」(触发 more);要完全自定义格子内容用 #day 插槽。
10
12
  */
11
13
  import { computed, nextTick, ref, watch } from "vue";
12
14
  import {
13
15
  YS_DAY_KIND_LABELS,
16
+ YS_TRADING_TAG_LABELS,
14
17
  YS_WEEKDAY_LABELS,
15
18
  ysAddDays,
16
19
  ysDateTitle,
17
20
  ysIsDate,
18
21
  ysMonthGrid,
19
22
  ysMonthOf,
23
+ ysMonthSummary,
20
24
  ysShiftMonth,
21
25
  ysToday,
26
+ ysTradingMarks,
22
27
  ysWeekday,
23
28
  type YsCalendarDay,
24
29
  type YsMonthCell,
30
+ type YsTradingMark,
25
31
  } from "@ysgroup/core";
26
32
 
27
33
  export interface YsCalendarEvent {
@@ -40,8 +46,12 @@ const props = withDefaults(
40
46
  today?: string;
41
47
  loading?: boolean;
42
48
  size?: "default" | "small";
43
- /** 标出交易日:调休上班的周末写「休市」,图例说明交易日规则。 */
49
+ /** 视图:work 休班(默认)、trading 交易日。 */
50
+ mark?: "work" | "trading";
51
+ /** 旧写法,等于 mark="trading"。 */
44
52
  trading?: boolean;
53
+ /** 顶部显示本月统计(休班视图:工作日、放假、调休上班;交易日视图:交易日、休市)。 */
54
+ summary?: boolean;
45
55
  maxEvents?: number;
46
56
  /** 不能选的日期(如非交易日):变淡、点了不选中。 */
47
57
  disabledDate?: (date: string, info?: YsCalendarDay) => boolean;
@@ -56,7 +66,9 @@ const props = withDefaults(
56
66
  today: "",
57
67
  loading: false,
58
68
  size: "default",
69
+ mark: undefined,
59
70
  trading: false,
71
+ summary: false,
60
72
  maxEvents: 3,
61
73
  disabledDate: undefined,
62
74
  legend: null,
@@ -99,6 +111,16 @@ const eventMap = computed(() => {
99
111
  }
100
112
  return map;
101
113
  });
114
+ const small = computed(() => props.size === "small");
115
+ const tradingView = computed(
116
+ () => (props.mark ?? (props.trading ? "trading" : "work")) === "trading",
117
+ );
118
+ const marks = computed(() =>
119
+ tradingView.value
120
+ ? ysTradingMarks(props.days)
121
+ : new Map<string, YsTradingMark>(),
122
+ );
123
+
102
124
  /** 这一屏里还没有放假安排的年份。 */
103
125
  const missingYears = computed(() => {
104
126
  const years = new Set<string>();
@@ -108,9 +130,27 @@ const missingYears = computed(() => {
108
130
  return [...years].sort();
109
131
  });
110
132
  const showLegend = computed(
111
- () => props.size !== "small" && (props.legend ?? props.days.length > 0),
133
+ () => !small.value && (props.legend ?? props.days.length > 0),
112
134
  );
113
- const small = computed(() => props.size === "small");
135
+ const todayVisible = computed(() =>
136
+ cells.value.some((cell) => cell.date === todayText.value),
137
+ );
138
+
139
+ /** 顶部统计:拆成「名称 + 数字」几段,数字加粗。月份信息不全时不显示。 */
140
+ const summaryParts = computed(() => {
141
+ if (!props.summary || small.value) return [];
142
+ const value = ysMonthSummary(props.days, shownMonth.value);
143
+ if (!value.complete) return [];
144
+ if (tradingView.value)
145
+ return [
146
+ { label: "交易日", value: value.trading },
147
+ { label: "休市", value: value.closed },
148
+ ];
149
+ const parts = [{ label: "工作日", value: value.workdays }];
150
+ if (value.holidays) parts.push({ label: "放假", value: value.holidays });
151
+ if (value.adjusted) parts.push({ label: "调休上班", value: value.adjusted });
152
+ return parts;
153
+ });
114
154
 
115
155
  function setMonth(month: string) {
116
156
  if (!month || month === innerMonth.value) return;
@@ -126,14 +166,13 @@ function eventsOf(date: string): YsCalendarEvent[] {
126
166
  return eventMap.value.get(date) ?? [];
127
167
  }
128
168
  function covered(date: string): boolean {
129
- return info(date)?.covered !== false;
169
+ const item = info(date);
170
+ return Boolean(item) && item?.covered !== false;
130
171
  }
131
172
  function badge(date: string): "休" | "班" | "" {
132
- const item = info(date);
133
- if (!item || item.covered === false) return "";
134
- if (item.kind === "holiday") return "休";
135
- if (item.kind === "adjusted") return "班";
136
- return "";
173
+ if (tradingView.value || !covered(date)) return "";
174
+ const kind = info(date)?.kind;
175
+ return kind === "holiday" ? "休" : kind === "adjusted" ? "班" : "";
137
176
  }
138
177
  function isRest(cell: YsMonthCell): boolean {
139
178
  const item = info(cell.date);
@@ -141,6 +180,23 @@ function isRest(cell: YsMonthCell): boolean {
141
180
  return item.kind === "holiday" || item.kind === "weekend";
142
181
  return cell.weekday >= 5;
143
182
  }
183
+ function isTrading(date: string): boolean {
184
+ return tradingView.value && covered(date) && Boolean(info(date)?.trading);
185
+ }
186
+ function isClosed(date: string): boolean {
187
+ return tradingView.value && covered(date) && !info(date)?.trading;
188
+ }
189
+ /** 格子第二行:休班视图写节日名;交易日视图休市日写「休市」或「端午节 · 休市」。 */
190
+ function subline(date: string): string {
191
+ if (!covered(date)) return "";
192
+ const item = info(date);
193
+ if (tradingView.value)
194
+ return isClosed(date) ? (item?.name ? `${item.name} · 休市` : "休市") : "";
195
+ return item?.name ?? "";
196
+ }
197
+ function markOf(date: string): YsTradingMark | undefined {
198
+ return marks.value.get(date);
199
+ }
144
200
  function disabled(date: string): boolean {
145
201
  return Boolean(props.disabledDate?.(date, info(date)));
146
202
  }
@@ -154,7 +210,18 @@ function ariaLabel(cell: YsMonthCell): string {
154
210
  ? `${YS_DAY_KIND_LABELS[item.kind]} ${item.name}`
155
211
  : YS_DAY_KIND_LABELS[item.kind],
156
212
  );
157
- if (props.trading) parts.push(item.trading ? "交易日" : "非交易日");
213
+ if (tradingView.value) {
214
+ const mark = markOf(cell.date);
215
+ parts.push(
216
+ item.trading
217
+ ? mark?.ordinal
218
+ ? `本月第 ${mark.ordinal} 个交易日`
219
+ : "交易日"
220
+ : "休市",
221
+ );
222
+ for (const tag of mark?.tags ?? [])
223
+ parts.push(YS_TRADING_TAG_LABELS[tag].full);
224
+ }
158
225
  }
159
226
  if (cell.date === todayText.value) parts.push("今天");
160
227
  const count = eventsOf(cell.date).length;
@@ -237,7 +304,10 @@ function goToday() {
237
304
  </script>
238
305
 
239
306
  <template>
240
- <div class="ys-calendar" :class="{ 'is-small': small }">
307
+ <div
308
+ class="ys-calendar"
309
+ :class="{ 'is-small': small, 'is-trading-view': tradingView }"
310
+ >
241
311
  <header class="ys-calendar__head">
242
312
  <div class="ys-calendar__nav">
243
313
  <el-button
@@ -272,6 +342,19 @@ function goToday() {
272
342
  >今天</el-button
273
343
  >
274
344
  </div>
345
+ <div
346
+ v-if="summaryParts.length"
347
+ class="ys-calendar__summary"
348
+ aria-label="本月统计"
349
+ >
350
+ <span
351
+ v-for="part in summaryParts"
352
+ :key="part.label"
353
+ class="ys-calendar__summary-item"
354
+ ><span>{{ part.label }}</span
355
+ ><strong>{{ part.value }}</strong></span
356
+ >
357
+ </div>
275
358
  <div v-if="$slots.extra" class="ys-calendar__extra">
276
359
  <slot name="extra" />
277
360
  </div>
@@ -283,7 +366,7 @@ function goToday() {
283
366
  role="status"
284
367
  >
285
368
  {{ missingYears.join("、") }} 年的放假安排还没有(国务院办公厅一般在上一年
286
- 10–11 月发布),这些日期暂不标休班,也不能判断工作日和交易日。
369
+ 10–11 月发布),这些日期暂不标休班和交易日。
287
370
  </p>
288
371
 
289
372
  <div
@@ -328,10 +411,16 @@ function goToday() {
328
411
  'is-selected': cell.date === modelValue,
329
412
  'is-rest': isRest(cell),
330
413
  'is-holiday':
331
- info(cell.date)?.kind === 'holiday' && covered(cell.date),
414
+ !tradingView &&
415
+ covered(cell.date) &&
416
+ info(cell.date)?.kind === 'holiday',
332
417
  'is-adjusted':
333
- info(cell.date)?.kind === 'adjusted' && covered(cell.date),
334
- 'is-uncovered': !covered(cell.date),
418
+ !tradingView &&
419
+ covered(cell.date) &&
420
+ info(cell.date)?.kind === 'adjusted',
421
+ 'is-trading': isTrading(cell.date),
422
+ 'is-closed': isClosed(cell.date),
423
+ 'is-uncovered': info(cell.date)?.covered === false,
335
424
  'is-disabled': disabled(cell.date),
336
425
  }"
337
426
  @click="select(cell.date)"
@@ -342,6 +431,7 @@ function goToday() {
342
431
  :cell="cell"
343
432
  :info="info(cell.date)"
344
433
  :events="eventsOf(cell.date)"
434
+ :mark="markOf(cell.date)"
345
435
  >
346
436
  <div class="ys-calendar__top">
347
437
  <span class="ys-calendar__date">{{
@@ -353,17 +443,27 @@ function goToday() {
353
443
  :class="badge(cell.date) === '休' ? 'is-off' : 'is-work'"
354
444
  >{{ badge(cell.date) }}</span
355
445
  >
446
+ <span
447
+ v-else-if="!small && markOf(cell.date)?.ordinal"
448
+ class="ys-calendar__ordinal"
449
+ aria-hidden="true"
450
+ >{{ markOf(cell.date)?.ordinal }}</span
451
+ >
356
452
  </div>
357
453
  <template v-if="!small">
454
+ <div v-if="subline(cell.date)" class="ys-calendar__name">
455
+ {{ subline(cell.date) }}
456
+ </div>
358
457
  <div
359
- v-if="info(cell.date)?.name && covered(cell.date)"
360
- class="ys-calendar__name"
458
+ v-if="markOf(cell.date)?.tags.length"
459
+ class="ys-calendar__tags"
361
460
  >
362
- {{ info(cell.date)?.name
363
- }}<template
364
- v-if="trading && info(cell.date)?.kind === 'adjusted'"
365
- >
366
- · 休市</template
461
+ <span
462
+ v-for="tag in markOf(cell.date)?.tags"
463
+ :key="tag"
464
+ class="ys-calendar__tag"
465
+ :class="`is-${tag}`"
466
+ >{{ YS_TRADING_TAG_LABELS[tag].short }}</span
367
467
  >
368
468
  </div>
369
469
  <ul v-if="eventsOf(cell.date).length" class="ys-calendar__events">
@@ -398,12 +498,28 @@ function goToday() {
398
498
  </div>
399
499
 
400
500
  <footer v-if="showLegend" class="ys-calendar__legend">
401
- <span><i class="ys-calendar__badge is-off">休</i>放假</span>
402
- <span><i class="ys-calendar__badge is-work">班</i>调休上班</span>
403
- <span v-if="trading"
404
- >交易日:周一到周五且不放假;调休上班的周末交易所休市</span
405
- >
406
- <span class="ys-calendar__legend-today">今天</span>
501
+ <template v-if="tradingView">
502
+ <span
503
+ ><i
504
+ class="ys-calendar__swatch is-trading"
505
+ />交易日(右上角是本月第几个)</span
506
+ >
507
+ <span
508
+ ><i
509
+ class="ys-calendar__swatch is-closed"
510
+ />休市:周末、放假和调休上班的周末</span
511
+ >
512
+ <span
513
+ ><i class="ys-calendar__tag is-pre-holiday">节前最后</i
514
+ ><i class="ys-calendar__tag is-month-last">月末最后</i
515
+ >关键交易日</span
516
+ >
517
+ </template>
518
+ <template v-else>
519
+ <span><i class="ys-calendar__badge is-off">休</i>放假</span>
520
+ <span><i class="ys-calendar__badge is-work">班</i>调休上班</span>
521
+ </template>
522
+ <span v-if="todayVisible" class="ys-calendar__legend-today">今天</span>
407
523
  </footer>
408
524
  </div>
409
525
  </template>
@@ -420,6 +536,12 @@ function goToday() {
420
536
  var(--ys-color-warning) 80%,
421
537
  var(--ys-color-text-1)
422
538
  );
539
+ --cal-bar: color-mix(in srgb, var(--ys-color-primary) 75%, transparent);
540
+ --cal-stripe: repeating-linear-gradient(
541
+ 135deg,
542
+ color-mix(in srgb, var(--ys-color-text-3) 10%, transparent) 0 5px,
543
+ transparent 5px 11px
544
+ );
423
545
  display: flex;
424
546
  flex-direction: column;
425
547
  gap: 8px;
@@ -428,9 +550,8 @@ function goToday() {
428
550
  .ys-calendar__head {
429
551
  display: flex;
430
552
  flex-wrap: wrap;
431
- gap: 8px 12px;
553
+ gap: 8px 16px;
432
554
  align-items: center;
433
- justify-content: space-between;
434
555
  }
435
556
  .ys-calendar__nav {
436
557
  display: flex;
@@ -450,11 +571,29 @@ function goToday() {
450
571
  :deep(.el-date-editor.ys-calendar__month) {
451
572
  width: 112px;
452
573
  }
574
+ .ys-calendar__summary {
575
+ display: flex;
576
+ flex-wrap: wrap;
577
+ gap: 4px 14px;
578
+ color: var(--ys-color-text-2);
579
+ font-size: 12px;
580
+ }
581
+ .ys-calendar__summary-item {
582
+ display: inline-flex;
583
+ gap: 4px;
584
+ align-items: baseline;
585
+ }
586
+ .ys-calendar__summary-item strong {
587
+ color: var(--ys-color-text-1);
588
+ font-size: 14px;
589
+ font-variant-numeric: tabular-nums;
590
+ }
453
591
  .ys-calendar__extra {
454
592
  display: flex;
455
593
  flex-wrap: wrap;
456
594
  gap: 8px;
457
595
  align-items: center;
596
+ margin-left: auto;
458
597
  }
459
598
  .ys-calendar__missing {
460
599
  margin: 0;
@@ -498,43 +637,70 @@ function goToday() {
498
637
  color: var(--cal-rest);
499
638
  }
500
639
  .ys-calendar__cell {
640
+ --cal-ring: 0 0 0 0 transparent;
641
+ --cal-left: 0 0 0 0 transparent;
501
642
  position: relative;
502
643
  display: flex;
503
644
  flex-direction: column;
504
- gap: 2px;
645
+ gap: 3px;
505
646
  min-width: 0;
506
- min-height: 92px;
507
- padding: 6px;
647
+ /* 格子随宽度略微变高,大屏不显得扁 */
648
+ min-height: clamp(88px, 6.8vw, 128px);
649
+ padding: 6px 6px 6px 8px;
508
650
  cursor: pointer;
509
651
  outline: none;
510
- transition: background-color 0.12s ease;
652
+ box-shadow: var(--cal-left), var(--cal-ring);
653
+ transition:
654
+ background-color 0.15s ease,
655
+ box-shadow 0.15s ease;
511
656
  }
512
657
  .ys-calendar__cell + .ys-calendar__cell {
513
658
  border-left: 1px solid var(--ys-color-border);
514
659
  }
515
660
  .ys-calendar__cell:hover {
516
- background: color-mix(in srgb, var(--ys-color-primary) 5%, transparent);
661
+ background-color: color-mix(in srgb, var(--ys-color-primary) 4%, transparent);
517
662
  }
518
663
  .ys-calendar__cell:focus-visible {
519
- box-shadow: inset 0 0 0 2px var(--ys-color-primary);
664
+ --cal-ring: inset 0 0 0 2px var(--ys-color-primary);
520
665
  }
521
666
  .ys-calendar__cell.is-rest:not(.is-selected) {
522
- background: color-mix(in srgb, var(--ys-color-text-3) 4%, transparent);
667
+ background-color: color-mix(in srgb, var(--ys-color-text-3) 4%, transparent);
523
668
  }
524
669
  .ys-calendar__cell.is-holiday:not(.is-selected) {
525
- background: color-mix(in srgb, var(--ys-color-success) 7%, transparent);
670
+ background-color: color-mix(in srgb, var(--ys-color-success) 7%, transparent);
526
671
  }
527
672
  .ys-calendar__cell.is-adjusted:not(.is-selected) {
528
- background: color-mix(in srgb, var(--ys-color-warning) 7%, transparent);
673
+ background-color: color-mix(in srgb, var(--ys-color-warning) 7%, transparent);
674
+ }
675
+ /* 交易日视图:交易日左侧竖条,休市斜纹 */
676
+ .ys-calendar__cell.is-trading {
677
+ --cal-left: inset 3px 0 0 var(--cal-bar);
678
+ }
679
+ .ys-calendar__cell.is-closed {
680
+ background-image: var(--cal-stripe);
681
+ }
682
+ .ys-calendar__cell.is-closed .ys-calendar__date {
683
+ color: var(--ys-color-text-3);
529
684
  }
530
685
  .ys-calendar__cell.is-selected {
531
- background: color-mix(in srgb, var(--ys-color-primary) 11%, transparent);
532
- box-shadow: inset 0 0 0 1px
533
- color-mix(in srgb, var(--ys-color-primary) 55%, transparent);
686
+ --cal-ring: inset 0 0 0 1px
687
+ color-mix(in srgb, var(--ys-color-primary) 60%, transparent);
688
+ background-color: color-mix(
689
+ in srgb,
690
+ var(--ys-color-primary) 11%,
691
+ transparent
692
+ );
693
+ }
694
+ .ys-calendar__cell.is-selected:focus-visible {
695
+ --cal-ring: inset 0 0 0 2px var(--ys-color-primary);
534
696
  }
535
697
  .ys-calendar__cell.is-outside > * {
536
698
  opacity: 0.42;
537
699
  }
700
+ .ys-calendar__cell.is-outside.is-trading {
701
+ --cal-left: inset 3px 0 0
702
+ color-mix(in srgb, var(--ys-color-primary) 28%, transparent);
703
+ }
538
704
  .ys-calendar__cell.is-disabled {
539
705
  cursor: not-allowed;
540
706
  }
@@ -560,7 +726,7 @@ function goToday() {
560
726
  font-variant-numeric: tabular-nums;
561
727
  font-weight: 600;
562
728
  }
563
- .ys-calendar__cell.is-rest .ys-calendar__date {
729
+ .ys-calendar__cell.is-rest:not(.is-closed) .ys-calendar__date {
564
730
  color: var(--cal-rest);
565
731
  }
566
732
  .ys-calendar__cell.is-uncovered .ys-calendar__date {
@@ -591,6 +757,18 @@ function goToday() {
591
757
  color: var(--cal-work);
592
758
  background: color-mix(in srgb, var(--ys-color-warning) 18%, transparent);
593
759
  }
760
+ .ys-calendar__ordinal {
761
+ min-width: 20px;
762
+ color: color-mix(
763
+ in srgb,
764
+ var(--ys-color-primary) 70%,
765
+ var(--ys-color-text-3)
766
+ );
767
+ font-size: 11px;
768
+ font-variant-numeric: tabular-nums;
769
+ font-weight: 600;
770
+ text-align: right;
771
+ }
594
772
  .ys-calendar__name {
595
773
  overflow: hidden;
596
774
  color: var(--cal-rest);
@@ -602,6 +780,31 @@ function goToday() {
602
780
  .ys-calendar__cell.is-adjusted .ys-calendar__name {
603
781
  color: var(--cal-work);
604
782
  }
783
+ .ys-calendar__cell.is-closed .ys-calendar__name {
784
+ color: var(--ys-color-text-3);
785
+ }
786
+ .ys-calendar__tags {
787
+ display: flex;
788
+ flex-wrap: wrap;
789
+ gap: 3px;
790
+ }
791
+ .ys-calendar__tag {
792
+ --tone: var(--ys-color-primary);
793
+ padding: 0 5px;
794
+ border-radius: var(--ys-radius-s);
795
+ color: color-mix(in srgb, var(--tone) 82%, var(--ys-color-text-1));
796
+ background: color-mix(in srgb, var(--tone) 13%, transparent);
797
+ font-size: 11px;
798
+ font-style: normal;
799
+ line-height: 17px;
800
+ white-space: nowrap;
801
+ }
802
+ .ys-calendar__tag.is-pre-holiday {
803
+ --tone: var(--ys-color-warning);
804
+ }
805
+ .ys-calendar__tag.is-post-holiday {
806
+ --tone: var(--ys-color-success);
807
+ }
605
808
  .ys-calendar__events {
606
809
  display: flex;
607
810
  flex-direction: column;
@@ -650,19 +853,35 @@ function goToday() {
650
853
  .ys-calendar__more:hover {
651
854
  background: color-mix(in srgb, var(--ys-color-primary) 10%, transparent);
652
855
  }
856
+
857
+ /* 图例 */
653
858
  .ys-calendar__legend {
654
859
  display: flex;
655
860
  flex-wrap: wrap;
656
- gap: 4px 16px;
861
+ gap: 4px 18px;
657
862
  align-items: center;
658
863
  color: var(--ys-color-text-3);
659
864
  font-size: 12px;
660
865
  }
661
866
  .ys-calendar__legend > span {
662
867
  display: inline-flex;
663
- gap: 4px;
868
+ gap: 5px;
664
869
  align-items: center;
665
870
  }
871
+ .ys-calendar__swatch {
872
+ display: inline-block;
873
+ width: 18px;
874
+ height: 14px;
875
+ border: 1px solid var(--ys-color-border);
876
+ border-radius: 3px;
877
+ background: var(--ys-color-bg-elevated);
878
+ }
879
+ .ys-calendar__swatch.is-trading {
880
+ box-shadow: inset 3px 0 0 var(--cal-bar);
881
+ }
882
+ .ys-calendar__swatch.is-closed {
883
+ background-image: var(--cal-stripe);
884
+ }
666
885
  .ys-calendar__legend-today::before {
667
886
  display: inline-block;
668
887
  width: 10px;
@@ -672,7 +891,7 @@ function goToday() {
672
891
  content: "";
673
892
  }
674
893
 
675
- /* 迷你模式:只有日期、休班角标和事件圆点,悬停看完整信息 */
894
+ /* 迷你模式:只有日期、休班角标(交易日视图为休市斜纹)和事件圆点,悬停看完整信息 */
676
895
  .ys-calendar.is-small .ys-calendar__weekday {
677
896
  padding: 4px 0;
678
897
  text-align: center;
@@ -683,6 +902,9 @@ function goToday() {
683
902
  min-height: 36px;
684
903
  padding: 2px;
685
904
  }
905
+ .ys-calendar.is-small .ys-calendar__cell.is-trading {
906
+ --cal-left: 0 0 0 0 transparent;
907
+ }
686
908
  .ys-calendar.is-small .ys-calendar__cell + .ys-calendar__cell {
687
909
  border-left: 0;
688
910
  }