@tsingroc/tsingroc-components 5.0.1 → 5.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.
Files changed (82) hide show
  1. package/dist/components/BarLineChart/BarLineChart.module.css +10 -0
  2. package/dist/components/BarLineChart/index.d.ts +66 -0
  3. package/dist/components/BarLineChart/index.js +590 -0
  4. package/dist/components/BaseBarChart/BaseBarChart.module.css +12 -0
  5. package/dist/components/BaseBarChart/index.d.ts +33 -0
  6. package/dist/components/BaseBarChart/index.js +121 -0
  7. package/dist/components/DataCellNumber/DataCellNumber.module.css +20 -0
  8. package/dist/components/DataCellNumber/index.d.ts +14 -0
  9. package/dist/components/DataCellNumber/index.js +142 -0
  10. package/dist/components/FlexColLayout/index.d.ts +6 -0
  11. package/dist/components/FlexColLayout/index.js +40 -0
  12. package/dist/components/FlexRowLayout/index.d.ts +5 -0
  13. package/dist/components/FlexRowLayout/index.js +45 -0
  14. package/dist/components/HighlightSyncedECharts/index.d.ts +47 -0
  15. package/dist/components/HighlightSyncedECharts/index.js +260 -0
  16. package/dist/components/HighlightSyncedTable/index.d.ts +8 -0
  17. package/dist/components/HighlightSyncedTable/index.js +183 -0
  18. package/dist/components/LoadingSection/index.d.ts +41 -0
  19. package/dist/components/LoadingSection/index.js +183 -0
  20. package/dist/components/LoadingSkeleton/index.d.ts +42 -0
  21. package/dist/components/LoadingSkeleton/index.js +634 -0
  22. package/dist/components/ScrollableTable/ScrollableTable.module.css +21 -0
  23. package/dist/components/ScrollableTable/index.d.ts +13 -0
  24. package/dist/components/ScrollableTable/index.js +29 -0
  25. package/dist/components/TsingrocTable/TsingrocTable.module.css +32 -0
  26. package/dist/components/TsingrocTable/index.d.ts +12 -0
  27. package/dist/components/TsingrocTable/index.js +23 -0
  28. package/dist/components/TsingrocTheme/index.js +3 -3
  29. package/dist/index.d.ts +4 -0
  30. package/dist/index.js +4 -0
  31. package/dist/pages/DayAheadReviewPage/components/PricePlot/index.d.ts +7 -0
  32. package/dist/pages/DayAheadReviewPage/components/PricePlot/index.js +136 -0
  33. package/dist/pages/DayAheadReviewPage/components/ProfitBarChart/ProfitBarChart.module.css +13 -0
  34. package/dist/pages/DayAheadReviewPage/components/ProfitBarChart/index.d.ts +17 -0
  35. package/dist/pages/DayAheadReviewPage/components/ProfitBarChart/index.js +278 -0
  36. package/dist/pages/DayAheadReviewPage/components/RevenueCard/RevenueCard.module.css +40 -0
  37. package/dist/pages/DayAheadReviewPage/components/RevenueCard/index.d.ts +9 -0
  38. package/dist/pages/DayAheadReviewPage/components/RevenueCard/index.js +195 -0
  39. package/dist/pages/DayAheadReviewPage/components/RevenueSummaryCard/RevenueSummaryCard.module.css +38 -0
  40. package/dist/pages/DayAheadReviewPage/components/RevenueSummaryCard/index.d.ts +10 -0
  41. package/dist/pages/DayAheadReviewPage/components/RevenueSummaryCard/index.js +117 -0
  42. package/dist/pages/DayAheadReviewPage/components/ReviewLineChart/ReviewLineChart.module.css +11 -0
  43. package/dist/pages/DayAheadReviewPage/components/ReviewLineChart/index.d.ts +53 -0
  44. package/dist/pages/DayAheadReviewPage/components/ReviewLineChart/index.js +398 -0
  45. package/dist/pages/DayAheadReviewPage/components/ReviewSummaryTable/ReviewSummaryTable.module.css +33 -0
  46. package/dist/pages/DayAheadReviewPage/components/ReviewSummaryTable/index.d.ts +17 -0
  47. package/dist/pages/DayAheadReviewPage/components/ReviewSummaryTable/index.js +187 -0
  48. package/dist/pages/DayAheadReviewPage/components/StrategyPlot/index.d.ts +10 -0
  49. package/dist/pages/DayAheadReviewPage/components/StrategyPlot/index.js +223 -0
  50. package/dist/pages/DayAheadReviewPage/components/SummaryTable/index.d.ts +7 -0
  51. package/dist/pages/DayAheadReviewPage/components/SummaryTable/index.js +39 -0
  52. package/dist/pages/DayAheadReviewPage/components/SummaryTable/useTableColumns.d.ts +10 -0
  53. package/dist/pages/DayAheadReviewPage/components/SummaryTable/useTableColumns.js +307 -0
  54. package/dist/pages/DayAheadReviewPage/hook/useDayAheadReviewDate.d.ts +137 -0
  55. package/dist/pages/DayAheadReviewPage/hook/useDayAheadReviewDate.js +252 -0
  56. package/dist/pages/DayAheadReviewPage/index.d.ts +149 -0
  57. package/dist/pages/DayAheadReviewPage/index.js +259 -0
  58. package/dist/pages/DayAheadReviewPage/layout/LeftChartContainer.d.ts +12 -0
  59. package/dist/pages/DayAheadReviewPage/layout/LeftChartContainer.js +236 -0
  60. package/dist/pages/DayAheadReviewPage/layout/ReviewPageLayout.d.ts +4 -0
  61. package/dist/pages/DayAheadReviewPage/layout/ReviewPageLayout.js +32 -0
  62. package/dist/pages/DayAheadReviewPage/layout/RightSummaryContainer.d.ts +14 -0
  63. package/dist/pages/DayAheadReviewPage/layout/RightSummaryContainer.js +199 -0
  64. package/dist/pages/DayAheadReviewPage/layout/TopDayReviewHeader.d.ts +9 -0
  65. package/dist/pages/DayAheadReviewPage/layout/TopDayReviewHeader.js +115 -0
  66. package/dist/pages/DayAheadReviewPage/types/dayahead.d.ts +172 -0
  67. package/dist/pages/DayAheadReviewPage/types/dayahead.js +1 -0
  68. package/dist/utils/accessibility.d.ts +114 -0
  69. package/dist/utils/accessibility.js +214 -0
  70. package/dist/utils/constants.d.ts +18 -0
  71. package/dist/utils/constants.js +34 -0
  72. package/dist/utils/export.d.ts +10 -0
  73. package/dist/utils/export.js +72 -0
  74. package/dist/utils/formatters.d.ts +46 -0
  75. package/dist/utils/formatters.js +84 -0
  76. package/dist/utils/index.d.ts +1 -0
  77. package/dist/utils/index.js +1 -0
  78. package/dist/utils/presenters.d.ts +24 -0
  79. package/dist/utils/presenters.js +48 -0
  80. package/dist/utils/ui.d.ts +116 -0
  81. package/dist/utils/ui.js +171 -0
  82. package/package.json +32 -31
@@ -0,0 +1,8 @@
1
+ import type { GetProps, Table } from "antd";
2
+ /**
3
+ * 添加了高亮同步能力的表格,必须包裹在 {@linkcode HighlightProvider} 内使用。
4
+ *
5
+ * 调用接口与 [Ant Design 的 Table](https://ant-design.antgroup.com/components/table-cn) 完全一致,
6
+ * 也支持套用 {@linkcode TsingrocTable} 的样式。
7
+ */
8
+ export default function HighlightSyncedTable<DataType extends Record<string, any>>({ ref: outerRef, onRow, ...props }: GetProps<typeof Table<DataType>>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,183 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { useEffect, useEffectEvent, useId, useImperativeHandle, useRef } from "react";
3
+ import { debugAssert } from "#src/utils/debug";
4
+ import { useHighlight
5
+ // oxlint-disable-line no-unused-vars
6
+ } from "../HighlightSyncedECharts";
7
+ import ScrollableTable from "../ScrollableTable";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ // oxlint-disable-line no-unused-vars
10
+
11
+ class SyntheticMouseEvent extends MouseEvent {
12
+ constructor(name) {
13
+ super(name, {
14
+ bubbles: true,
15
+ cancelable: true,
16
+ view: window
17
+ });
18
+ }
19
+ }
20
+
21
+ /**
22
+ * 添加了高亮同步能力的表格,必须包裹在 {@linkcode HighlightProvider} 内使用。
23
+ *
24
+ * 调用接口与 [Ant Design 的 Table](https://ant-design.antgroup.com/components/table-cn) 完全一致,
25
+ * 也支持套用 {@linkcode TsingrocTable} 的样式。
26
+ */
27
+ export default function HighlightSyncedTable(t0) {
28
+ const $ = _c(25);
29
+ let onRow;
30
+ let outerRef;
31
+ let props;
32
+ if ($[0] !== t0) {
33
+ ({
34
+ ref: outerRef,
35
+ onRow,
36
+ ...props
37
+ } = t0);
38
+ $[0] = t0;
39
+ $[1] = onRow;
40
+ $[2] = outerRef;
41
+ $[3] = props;
42
+ } else {
43
+ onRow = $[1];
44
+ outerRef = $[2];
45
+ props = $[3];
46
+ }
47
+ const id = useId();
48
+ const [highlight, setHighlight] = useHighlight();
49
+ const ref = useRef(null);
50
+ let t1;
51
+ let t2;
52
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
53
+ t1 = () => {
54
+ debugAssert(ref.current, "ref should be connected");
55
+ return ref.current;
56
+ };
57
+ t2 = [];
58
+ $[4] = t1;
59
+ $[5] = t2;
60
+ } else {
61
+ t1 = $[4];
62
+ t2 = $[5];
63
+ }
64
+ useImperativeHandle(outerRef, t1, t2);
65
+ let t3;
66
+ let t4;
67
+ if ($[6] !== highlight || $[7] !== id) {
68
+ t3 = () => {
69
+ if (!ref.current) {
70
+ return;
71
+ }
72
+ if (highlight && highlight.source !== id) {
73
+ const row = ref.current.nativeElement.querySelector(`.ant-table-body tr:nth-child(${highlight.index + 2})`);
74
+ if (row) {
75
+ row.scrollIntoView({
76
+ block: "center",
77
+ container: "nearest",
78
+ behavior: "smooth"
79
+ });
80
+ row.children[0]?.dispatchEvent(new SyntheticMouseEvent("mouseover"));
81
+ }
82
+ } else {
83
+ if (!highlight) {
84
+ ref.current.nativeElement.querySelector("tr:nth-child(2) > td")?.dispatchEvent(new SyntheticMouseEvent("mouseout"));
85
+ }
86
+ }
87
+ };
88
+ t4 = [id, highlight];
89
+ $[6] = highlight;
90
+ $[7] = id;
91
+ $[8] = t3;
92
+ $[9] = t4;
93
+ } else {
94
+ t3 = $[8];
95
+ t4 = $[9];
96
+ }
97
+ useEffect(t3, t4);
98
+ let t5;
99
+ if ($[10] !== highlight || $[11] !== id || $[12] !== setHighlight) {
100
+ t5 = (event, index) => {
101
+ if (event.nativeEvent instanceof SyntheticMouseEvent) {
102
+ return;
103
+ }
104
+ if (index === undefined) {
105
+ return;
106
+ }
107
+ if (highlight?.source === id && highlight.index === index) {
108
+ return;
109
+ }
110
+ setHighlight({
111
+ source: id,
112
+ index
113
+ });
114
+ };
115
+ $[10] = highlight;
116
+ $[11] = id;
117
+ $[12] = setHighlight;
118
+ $[13] = t5;
119
+ } else {
120
+ t5 = $[13];
121
+ }
122
+ const onMouseOverRow = useEffectEvent(t5);
123
+ let t6;
124
+ if ($[14] !== highlight?.source || $[15] !== id || $[16] !== setHighlight) {
125
+ t6 = event_0 => {
126
+ if (event_0.nativeEvent instanceof SyntheticMouseEvent) {
127
+ return;
128
+ }
129
+ if (highlight?.source !== id) {
130
+ return;
131
+ }
132
+ setHighlight(undefined);
133
+ };
134
+ $[14] = highlight?.source;
135
+ $[15] = id;
136
+ $[16] = setHighlight;
137
+ $[17] = t6;
138
+ } else {
139
+ t6 = $[17];
140
+ }
141
+ const onMouseOutRow = useEffectEvent(t6);
142
+ let t7;
143
+ if ($[18] !== onMouseOutRow || $[19] !== onMouseOverRow || $[20] !== onRow) {
144
+ t7 = (data, index_0) => {
145
+ const {
146
+ onMouseOver,
147
+ onMouseOut,
148
+ ...rest
149
+ } = onRow?.(data, index_0) ?? {};
150
+ return {
151
+ onMouseOver: event_1 => {
152
+ onMouseOverRow(event_1, index_0);
153
+ onMouseOver?.(event_1);
154
+ },
155
+ onMouseOut: event_2 => {
156
+ onMouseOutRow(event_2);
157
+ onMouseOut?.(event_2);
158
+ },
159
+ ...rest
160
+ };
161
+ };
162
+ $[18] = onMouseOutRow;
163
+ $[19] = onMouseOverRow;
164
+ $[20] = onRow;
165
+ $[21] = t7;
166
+ } else {
167
+ t7 = $[21];
168
+ }
169
+ let t8;
170
+ if ($[22] !== props || $[23] !== t7) {
171
+ t8 = /*#__PURE__*/_jsx(ScrollableTable, {
172
+ ref: ref,
173
+ onRow: t7,
174
+ ...props
175
+ });
176
+ $[22] = props;
177
+ $[23] = t7;
178
+ $[24] = t8;
179
+ } else {
180
+ t8 = $[24];
181
+ }
182
+ return t8;
183
+ }
@@ -0,0 +1,41 @@
1
+ import type { CSSProperties } from "react";
2
+ /**
3
+ * Props for LoadingSection component
4
+ */
5
+ export interface LoadingSectionProps {
6
+ /** Type of content being loaded */
7
+ type: "chart" | "table" | "summary" | "custom";
8
+ /** Number of rows/items to show (for table/summary type) */
9
+ rows?: number;
10
+ /** Whether to show active animation */
11
+ active?: boolean;
12
+ /** Custom style */
13
+ style?: CSSProperties;
14
+ /** Custom className */
15
+ className?: string;
16
+ /** Height for chart type */
17
+ height?: string | number;
18
+ }
19
+ /**
20
+ * LoadingSection - Section-level skeleton for charts, tables, dashboards
21
+ *
22
+ * **Usage:** Charts, tables, analytics panels, dashboards, cards
23
+ *
24
+ * Reserves layout space and shows skeleton placeholder for section-level content.
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * // Chart section
29
+ * <LoadingSection type="chart" height={300} />
30
+ *
31
+ * // Table section
32
+ * <LoadingSection type="table" rows={8} />
33
+ *
34
+ * // Summary section (header + content)
35
+ * <LoadingSection type="summary" rows={3} />
36
+ *
37
+ * // Custom section
38
+ * <LoadingSection type="custom" rows={6} />
39
+ * ```
40
+ */
41
+ export declare function LoadingSection({ type, rows, active, style, className, height, }: LoadingSectionProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,183 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Skeleton } from "antd";
3
+ import { ARIA_LABELS, ARIA_ROLES } from "#src/utils/accessibility";
4
+ import { LoadingSkeleton } from "../LoadingSkeleton";
5
+
6
+ /**
7
+ * Props for LoadingSection component
8
+ */
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ /**
11
+ * LoadingSection - Section-level skeleton for charts, tables, dashboards
12
+ *
13
+ * **Usage:** Charts, tables, analytics panels, dashboards, cards
14
+ *
15
+ * Reserves layout space and shows skeleton placeholder for section-level content.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * // Chart section
20
+ * <LoadingSection type="chart" height={300} />
21
+ *
22
+ * // Table section
23
+ * <LoadingSection type="table" rows={8} />
24
+ *
25
+ * // Summary section (header + content)
26
+ * <LoadingSection type="summary" rows={3} />
27
+ *
28
+ * // Custom section
29
+ * <LoadingSection type="custom" rows={6} />
30
+ * ```
31
+ */
32
+ export function LoadingSection(t0) {
33
+ const $ = _c(27);
34
+ const {
35
+ type,
36
+ rows: t1,
37
+ active: t2,
38
+ style,
39
+ className,
40
+ height
41
+ } = t0;
42
+ const rows = t1 === undefined ? 6 : t1;
43
+ const active = t2 === undefined ? true : t2;
44
+ let t3;
45
+ if ($[0] !== style) {
46
+ t3 = {
47
+ width: "100%",
48
+ ...style
49
+ };
50
+ $[0] = style;
51
+ $[1] = t3;
52
+ } else {
53
+ t3 = $[1];
54
+ }
55
+ const baseStyle = t3;
56
+ switch (type) {
57
+ case "chart":
58
+ {
59
+ const t4 = height || 300;
60
+ let t5;
61
+ if ($[2] !== baseStyle || $[3] !== t4) {
62
+ t5 = {
63
+ height: t4,
64
+ display: "flex",
65
+ alignItems: "center",
66
+ justifyContent: "center",
67
+ ...baseStyle
68
+ };
69
+ $[2] = baseStyle;
70
+ $[3] = t4;
71
+ $[4] = t5;
72
+ } else {
73
+ t5 = $[4];
74
+ }
75
+ let t6;
76
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
77
+ t6 = {
78
+ width: "100%",
79
+ height: "100%"
80
+ };
81
+ $[5] = t6;
82
+ } else {
83
+ t6 = $[5];
84
+ }
85
+ let t7;
86
+ if ($[6] !== active) {
87
+ t7 = /*#__PURE__*/_jsx(Skeleton.Node, {
88
+ active: active,
89
+ style: t6
90
+ });
91
+ $[6] = active;
92
+ $[7] = t7;
93
+ } else {
94
+ t7 = $[7];
95
+ }
96
+ let t8;
97
+ if ($[8] !== className || $[9] !== t5 || $[10] !== t7) {
98
+ t8 = /*#__PURE__*/_jsx("div", {
99
+ style: t5,
100
+ className: className,
101
+ role: ARIA_ROLES.STATUS,
102
+ "aria-live": "polite",
103
+ "aria-label": ARIA_LABELS.LOADING,
104
+ children: t7
105
+ });
106
+ $[8] = className;
107
+ $[9] = t5;
108
+ $[10] = t7;
109
+ $[11] = t8;
110
+ } else {
111
+ t8 = $[11];
112
+ }
113
+ return t8;
114
+ }
115
+ case "table":
116
+ {
117
+ let t4;
118
+ if ($[12] !== active || $[13] !== className || $[14] !== rows || $[15] !== style) {
119
+ t4 = /*#__PURE__*/_jsx(LoadingSkeleton, {
120
+ type: "table",
121
+ rows: rows,
122
+ active: active,
123
+ className: className,
124
+ style: style
125
+ });
126
+ $[12] = active;
127
+ $[13] = className;
128
+ $[14] = rows;
129
+ $[15] = style;
130
+ $[16] = t4;
131
+ } else {
132
+ t4 = $[16];
133
+ }
134
+ return t4;
135
+ }
136
+ case "summary":
137
+ {
138
+ let t4;
139
+ if ($[17] !== active || $[18] !== className || $[19] !== rows || $[20] !== style) {
140
+ t4 = /*#__PURE__*/_jsx(LoadingSkeleton, {
141
+ type: "summary",
142
+ rows: rows,
143
+ active: active,
144
+ className: className,
145
+ style: style
146
+ });
147
+ $[17] = active;
148
+ $[18] = className;
149
+ $[19] = rows;
150
+ $[20] = style;
151
+ $[21] = t4;
152
+ } else {
153
+ t4 = $[21];
154
+ }
155
+ return t4;
156
+ }
157
+ case "custom":
158
+ {
159
+ let t4;
160
+ if ($[22] !== active || $[23] !== className || $[24] !== rows || $[25] !== style) {
161
+ t4 = /*#__PURE__*/_jsx(LoadingSkeleton, {
162
+ type: "custom",
163
+ rows: rows,
164
+ active: active,
165
+ className: className,
166
+ style: style
167
+ });
168
+ $[22] = active;
169
+ $[23] = className;
170
+ $[24] = rows;
171
+ $[25] = style;
172
+ $[26] = t4;
173
+ } else {
174
+ t4 = $[26];
175
+ }
176
+ return t4;
177
+ }
178
+ default:
179
+ {
180
+ return null;
181
+ }
182
+ }
183
+ }
@@ -0,0 +1,42 @@
1
+ import type { CSSProperties } from "react";
2
+ /**
3
+ * Props for LoadingSkeleton component
4
+ */
5
+ interface LoadingSkeletonProps {
6
+ /** Type of skeleton to display */
7
+ type?: "table" | "form" | "card" | "list" | "custom" | "summary" | "compact";
8
+ /** Number of rows (for table/list/custom type) */
9
+ rows?: number;
10
+ /** Number of cards (for card type) */
11
+ cards?: number;
12
+ /** Whether to show the active animation */
13
+ active?: boolean;
14
+ /** Custom className */
15
+ className?: string;
16
+ /** Custom style */
17
+ style?: CSSProperties;
18
+ }
19
+ /**
20
+ * LoadingSkeleton - Textual content skeleton
21
+ *
22
+ * **Usage:** Text paragraphs, lists, form content
23
+ *
24
+ * Displays skeleton placeholder for textual content with accessibility support.
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * // Compact text skeleton (for stats cards, small areas)
29
+ * <LoadingSkeleton type="compact" rows={2} />
30
+ *
31
+ * // Table skeleton
32
+ * <LoadingSkeleton type="table" rows={8} />
33
+ *
34
+ * // Summary skeleton (header + content)
35
+ * <LoadingSkeleton type="summary" rows={4} />
36
+ *
37
+ * // Custom skeleton (default paragraph style)
38
+ * <LoadingSkeleton rows={4} />
39
+ * ```
40
+ */
41
+ export declare function LoadingSkeleton({ type, rows, cards, active, className, style, }: LoadingSkeletonProps): import("react/jsx-runtime").JSX.Element;
42
+ export {};