@tsingroc/tsingroc-components 5.0.2 → 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 +27 -25
@@ -0,0 +1,171 @@
1
+ /**
2
+ * Presentation utilities for consistent null/undefined handling in components.
3
+ *
4
+ * These utilities handle how null/undefined values are displayed in the UI.
5
+ * Use these in components to apply consistent design tokens for missing data.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * import { presentCardValue, presentTableValue } from './ui';
10
+ * import { formatPrice, formatVolume } from './formatters';
11
+ *
12
+ * // In a card (shows "-" for null)
13
+ * <Statistic title="Price" value={presentCardValue(formatPrice(data.price))} />
14
+ *
15
+ * // In a table (shows "" for null)
16
+ * <Table.Column render={() => presentTableValue(formatVolume(data.volume))} />
17
+ * ```
18
+ */
19
+
20
+ /**
21
+ * Presentation options for null/undefined values.
22
+ */
23
+
24
+ // Show "0" (for numeric fields)
25
+
26
+ /**
27
+ * Default null presentation for different contexts.
28
+ */
29
+ export const NULL_PRESENTATION_DEFAULTS = {
30
+ /** Default for tables: show empty string */
31
+ table: "empty",
32
+ /** Default for cards: show dash */
33
+ card: "dash",
34
+ /** Default for charts: show dash */
35
+ chart: "dash",
36
+ /** Default for form inputs: show empty */
37
+ form: "empty"
38
+ };
39
+
40
+ /**
41
+ * Present a nullable value with consistent null handling.
42
+ *
43
+ * This is the core presenter function that handles how null/undefined values
44
+ * are displayed in the UI. Use the convenience wrappers (presentCardValue,
45
+ * presentTableValue) for common cases.
46
+ *
47
+ * @param value - The formatted value (could be null from formatters)
48
+ * @param options - How to present null values
49
+ * @returns Display string
50
+ *
51
+ * @example
52
+ * ```tsx
53
+ * // Custom presentation
54
+ * <span>{presentValue(formatPrice(price), { nullAs: "na" })}</span>
55
+ *
56
+ * // Show N/A for null values
57
+ * <span>{presentValue(formatVolume(volume), { nullAs: "na" })}</span>
58
+ *
59
+ * // Use non-breaking space to prevent layout shift
60
+ * <span>{presentValue(formatProfit(profit), { nullAs: "nbsp" })}</span>
61
+ * ```
62
+ */
63
+ export function presentValue(value, options = {}) {
64
+ const {
65
+ nullAs = "empty",
66
+ zeroAs
67
+ } = options;
68
+
69
+ // Handle null/undefined
70
+ if (value === null || value === undefined) {
71
+ switch (nullAs) {
72
+ case "dash":
73
+ return "-";
74
+ case "nbsp":
75
+ return "\u00A0";
76
+ case "na":
77
+ return "N/A";
78
+ case "zero":
79
+ return "0";
80
+ case "empty":
81
+ default:
82
+ return "";
83
+ }
84
+ }
85
+
86
+ // Handle zero if specified
87
+ if (zeroAs !== undefined && value === 0) {
88
+ switch (zeroAs) {
89
+ case "dash":
90
+ return "-";
91
+ case "nbsp":
92
+ return "\u00A0";
93
+ case "na":
94
+ return "N/A";
95
+ case "zero":
96
+ case "empty":
97
+ default:
98
+ return zeroAs === "zero" ? "0" : "";
99
+ }
100
+ }
101
+
102
+ // Return the value as string
103
+ return String(value);
104
+ }
105
+
106
+ /**
107
+ * Convenience presenter for card values (shows "-" for null).
108
+ *
109
+ * Use this in cards, statistics, and other UI elements where a dash "-".
110
+ *
111
+ * @example
112
+ * ```tsx
113
+ * import { presentCardValue } from './ui';
114
+ * import { formatPrice } from './formatters';
115
+ *
116
+ * <Statistic
117
+ * title="Current Price"
118
+ * value={presentCardValue(formatPrice(data.price))}
119
+ * />
120
+ * // null → "-", 0 → "0.00", 123.45 → "123.45"
121
+ * ```
122
+ */
123
+ export function presentCardValue(value) {
124
+ return presentValue(value, {
125
+ nullAs: "dash"
126
+ });
127
+ }
128
+
129
+ /**
130
+ * Convenience presenter for table cells (shows "" for null).
131
+ *
132
+ * Use this in table cells and other compact UI elements where an empty string.
133
+ *
134
+ * @example
135
+ * ```tsx
136
+ * import { presentTableValue } from './ui';
137
+ * import { formatVolume } from './formatters';
138
+ *
139
+ * <Table.Column
140
+ * render={(_, record) => presentTableValue(formatVolume(record.volume))}
141
+ * />
142
+ * // null → "", 0 → "0.000", 123.456 → "123.456"
143
+ * ```
144
+ */
145
+ export function presentTableValue(value) {
146
+ return presentValue(value, {
147
+ nullAs: "empty"
148
+ });
149
+ }
150
+
151
+ /**
152
+ * Convenience presenter for chart tooltips (shows "-" for null).
153
+ *
154
+ * Use this in chart tooltips, legends, and other data visualizations.
155
+ *
156
+ * @example
157
+ * ```tsx
158
+ * import { presentChartValue } from './ui';
159
+ * import { formatProfit } from './formatters';
160
+ *
161
+ * tooltip: {
162
+ * formatter: (params) => presentChartValue(formatProfit(params.value))
163
+ * }
164
+ * // null → "-", 0 → "0.00", 123.45 → "123.45"
165
+ * ```
166
+ */
167
+ export function presentChartValue(value) {
168
+ return presentValue(value, {
169
+ nullAs: "dash"
170
+ });
171
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsingroc/tsingroc-components",
3
- "version": "5.0.2",
3
+ "version": "5.1.0",
4
4
  "author": "",
5
5
  "license": "ISC",
6
6
  "description": "",
@@ -19,6 +19,10 @@
19
19
  "types": "./dist/echarts/index.d.ts",
20
20
  "default": "./dist/echarts/index.js"
21
21
  },
22
+ "./pages/DayAheadReviewPage": {
23
+ "types": "./dist/pages/DayAheadReviewPage/index.d.ts",
24
+ "default": "./dist/pages/DayAheadReviewPage/index.js"
25
+ },
22
26
  "./utils": {
23
27
  "types": "./dist/utils/index.d.ts",
24
28
  "default": "./dist/utils/index.js"
@@ -36,55 +40,53 @@
36
40
  "build": "rm -rf dist && (npx babel src --out-dir dist --extensions .ts,.tsx & tsc -p tsconfig.lib.json & copyfiles src/**/*.css dist --up 1 & wait)"
37
41
  },
38
42
  "dependencies": {
43
+ "@e965/xlsx": "^0.20.3",
39
44
  "antd-style": "^4.1.0",
40
45
  "casdoor-js-sdk": "^0.18.0",
41
46
  "dayjs": "^1.11.20",
42
47
  "jwt-decode": "^4.0.0"
43
48
  },
44
49
  "peerDependencies": {
45
- "@ant-design/icons": "^6.1.0",
46
- "antd": "^6.3.3",
50
+ "@ant-design/icons": "^6.1.1",
51
+ "antd": "^6.3.5",
47
52
  "echarts": "^6.0.0",
48
53
  "echarts-gl": "^2.0.9",
49
- "react": "^19.2.4",
50
- "react-dom": "^19.2.4"
51
- },
52
- "peerDependenciesMeta": {
53
- "echarts-gl": {
54
- "optional": true
55
- }
54
+ "react": "^19.2.5",
55
+ "react-dom": "^19.2.5"
56
56
  },
57
57
  "devDependencies": {
58
- "@ant-design/icons": "^6.1.0",
58
+ "@ant-design/icons": "^6.1.1",
59
59
  "@babel/cli": "^7.28.6",
60
60
  "@babel/core": "^7.29.0",
61
61
  "@babel/preset-react": "^7.28.5",
62
62
  "@babel/preset-typescript": "^7.28.5",
63
- "@storybook/addon-a11y": "^10.3.3",
64
- "@storybook/addon-docs": "^10.3.3",
65
- "@storybook/addon-mcp": "^0.4.2",
66
- "@storybook/addon-vitest": "^10.3.3",
67
- "@storybook/react-vite": "^10.3.3",
68
- "@types/node": "^22.19.15",
63
+ "@storybook/addon-a11y": "^10.3.5",
64
+ "@storybook/addon-docs": "^10.3.5",
65
+ "@storybook/addon-mcp": "^0.5.0",
66
+ "@storybook/addon-vitest": "^10.3.5",
67
+ "@storybook/react-vite": "^10.3.5",
68
+ "@types/node": "^22.19.17",
69
69
  "@types/react": "^19.2.14",
70
70
  "@types/react-dom": "^19.2.3",
71
71
  "@vitejs/plugin-react": "^5.2.0",
72
72
  "@vitest/browser-playwright": "^4.1.1",
73
73
  "@vitest/coverage-v8": "^4.1.1",
74
- "antd": "^6.3.4",
74
+ "antd": "^6.3.5",
75
75
  "babel-plugin-react-compiler": "^1.0.0",
76
76
  "copyfiles": "^2.4.1",
77
- "dprint": "^0.53.0",
77
+ "dprint": "^0.54.0",
78
78
  "echarts": "^6.0.0",
79
79
  "echarts-gl": "^2.0.9",
80
80
  "eslint-plugin-react-hooks": "^7.0.1",
81
- "oxlint": "^1.57.0",
82
- "oxlint-tsgolint": "^0.17.3",
83
- "playwright": "^1.58.2",
84
- "react": "^19.2.4",
85
- "react-dom": "^19.2.4",
86
- "storybook": "^10.3.3",
81
+ "lightningcss": "^1.32.0",
82
+ "oxlint": "^1.59.0",
83
+ "oxlint-tsgolint": "^0.18.1",
84
+ "playwright": "^1.59.1",
85
+ "react": "^19.2.5",
86
+ "react-dom": "^19.2.5",
87
+ "storybook": "^10.3.5",
87
88
  "typescript": "^6.0.2",
89
+ "vite-plugin-svgr": "^5.2.0",
88
90
  "vitest": "^4.1.1"
89
91
  },
90
92
  "overrides": {