@tsingroc/tsingroc-components 5.0.0-alpha.11 → 5.0.0-alpha.13

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 (150) hide show
  1. package/dist/components/Auth.d.ts +310 -0
  2. package/dist/components/Auth.js +267 -0
  3. package/dist/components/AutoResizedECharts.d.ts +21 -0
  4. package/dist/components/AutoResizedECharts.js +98 -0
  5. package/dist/components/Calendar.d.ts +50 -0
  6. package/dist/components/Calendar.js +130 -0
  7. package/dist/components/CircularProgress.d.ts +21 -0
  8. package/dist/components/CircularProgress.js +34 -0
  9. package/dist/components/ConnectedECharts.d.ts +31 -0
  10. package/dist/components/ConnectedECharts.js +100 -0
  11. package/dist/components/ECharts.d.ts +57 -0
  12. package/dist/components/ECharts.js +255 -0
  13. package/dist/components/Header.d.ts +67 -0
  14. package/dist/components/Header.js +171 -0
  15. package/dist/components/ImageBackground.d.ts +32 -0
  16. package/dist/components/ImageBackground.js +76 -0
  17. package/dist/components/IndicatorLight.d.ts +44 -0
  18. package/dist/components/IndicatorLight.js +124 -0
  19. package/dist/components/LeftAlignedECharts.d.ts +42 -0
  20. package/dist/components/LeftAlignedECharts.js +270 -0
  21. package/dist/components/LineChartEditor.d.ts +74 -0
  22. package/dist/components/LineChartEditor.js +458 -0
  23. package/dist/components/LineChartTable.d.ts +38 -0
  24. package/dist/components/LineChartTable.js +245 -0
  25. package/dist/components/LinkedLineChart.d.ts +45 -0
  26. package/dist/components/LinkedLineChart.js +159 -0
  27. package/dist/components/QuickDateRangePicker.d.ts +30 -0
  28. package/dist/components/QuickDateRangePicker.js +58 -0
  29. package/dist/components/SegmentedButtons.d.ts +22 -0
  30. package/dist/components/SegmentedButtons.js +86 -0
  31. package/dist/components/SelectableECharts.d.ts +22 -0
  32. package/dist/components/SelectableECharts.js +402 -0
  33. package/dist/components/Sidebar.d.ts +79 -0
  34. package/dist/components/Sidebar.js +178 -0
  35. package/dist/components/TsingrocDatePicker.d.ts +38 -0
  36. package/dist/components/TsingrocDatePicker.js +64 -0
  37. package/dist/components/TsingrocTheme.d.ts +15 -0
  38. package/dist/components/TsingrocTheme.js +72 -0
  39. package/dist/components/UserButton.d.ts +42 -0
  40. package/dist/components/UserButton.js +105 -0
  41. package/dist/components/VerticalColorLegend.d.ts +7 -0
  42. package/dist/components/VerticalColorLegend.js +208 -0
  43. package/dist/components/WeatherMap.d.ts +18 -0
  44. package/dist/components/WeatherMap.js +658 -0
  45. package/dist/deckgl/TiandituLayer.d.ts +13 -0
  46. package/dist/deckgl/TiandituLayer.js +44 -0
  47. package/dist/deckgl/WeatherData.d.ts +53 -0
  48. package/dist/deckgl/WeatherData.js +94 -0
  49. package/dist/deckgl/index.d.ts +1 -0
  50. package/dist/deckgl/index.js +1 -0
  51. package/dist/echarts/coordinateSystems/grid.d.ts +43 -0
  52. package/dist/echarts/coordinateSystems/grid.js +108 -0
  53. package/dist/echarts/coordinateSystems/index.js +2 -0
  54. package/dist/echarts/coordinateSystems/polar.d.ts +45 -0
  55. package/dist/echarts/coordinateSystems/polar.js +96 -0
  56. package/dist/echarts/gl-types.d.js +0 -0
  57. package/dist/echarts/gl.d.ts +115 -0
  58. package/dist/echarts/gl.js +47 -0
  59. package/dist/echarts/index.d.ts +46 -0
  60. package/dist/echarts/index.js +46 -0
  61. package/dist/echarts/legend.d.ts +17 -0
  62. package/dist/echarts/legend.js +15 -0
  63. package/dist/echarts/radar.d.ts +24 -0
  64. package/dist/echarts/radar.js +22 -0
  65. package/dist/echarts/series/barSeries.d.ts +23 -0
  66. package/dist/echarts/series/barSeries.js +18 -0
  67. package/dist/echarts/series/boxplotSeries.d.ts +21 -0
  68. package/dist/echarts/series/boxplotSeries.js +40 -0
  69. package/dist/echarts/series/index.js +7 -0
  70. package/dist/echarts/series/intervalSeries.d.ts +32 -0
  71. package/dist/echarts/series/intervalSeries.js +55 -0
  72. package/dist/echarts/series/lineSeries.d.ts +36 -0
  73. package/dist/echarts/series/lineSeries.js +45 -0
  74. package/dist/echarts/series/maxBarSeries.d.ts +18 -0
  75. package/dist/echarts/series/maxBarSeries.js +39 -0
  76. package/dist/echarts/series/pieSeries.d.ts +31 -0
  77. package/dist/echarts/series/pieSeries.js +47 -0
  78. package/dist/echarts/series/windLineSeries.d.ts +47 -0
  79. package/dist/echarts/series/windLineSeries.js +51 -0
  80. package/{src/echarts/tooltip.ts → dist/echarts/tooltip.d.ts} +1 -5
  81. package/dist/echarts/tooltip.js +22 -0
  82. package/dist/env.d.js +0 -0
  83. package/dist/index.d.ts +21 -0
  84. package/dist/index.js +21 -0
  85. package/dist/utils/debug.d.ts +1 -0
  86. package/dist/utils/debug.js +25 -0
  87. package/dist/utils/destructureLineDataItem.d.ts +6 -0
  88. package/dist/utils/destructureLineDataItem.js +17 -0
  89. package/dist/utils/filterMap.d.ts +1 -0
  90. package/dist/utils/filterMap.js +11 -0
  91. package/dist/utils/index.d.ts +8 -0
  92. package/dist/utils/index.js +8 -0
  93. package/dist/utils/math.d.ts +9 -0
  94. package/{src/utils/math.ts → dist/utils/math.js} +2 -2
  95. package/dist/utils/mock.d.ts +8 -0
  96. package/dist/utils/mock.js +40 -0
  97. package/dist/utils/normalizeIntoArray.d.ts +1 -0
  98. package/dist/utils/normalizeIntoArray.js +3 -0
  99. package/dist/utils/startOfQuarter.d.ts +2 -0
  100. package/dist/utils/startOfQuarter.js +4 -0
  101. package/dist/utils/timeAxisLabel.d.ts +5 -0
  102. package/dist/utils/timeAxisLabel.js +18 -0
  103. package/package.json +26 -14
  104. package/src/components/Auth.tsx +0 -623
  105. package/src/components/AutoResizedECharts.tsx +0 -70
  106. package/src/components/Calendar.tsx +0 -182
  107. package/src/components/CircularProgress.tsx +0 -38
  108. package/src/components/ConnectedECharts.tsx +0 -62
  109. package/src/components/ECharts.tsx +0 -206
  110. package/src/components/Header.tsx +0 -136
  111. package/src/components/ImageBackground.tsx +0 -58
  112. package/src/components/IndicatorLight.tsx +0 -106
  113. package/src/components/LeftAlignedECharts.tsx +0 -190
  114. package/src/components/LineChartEditor.tsx +0 -558
  115. package/src/components/LineChartTable.tsx +0 -286
  116. package/src/components/LinkedECharts.tsx +0 -51
  117. package/src/components/LinkedLineChart.tsx +0 -144
  118. package/src/components/QuickDateRangePicker.tsx +0 -84
  119. package/src/components/SegmentedButtons.tsx +0 -46
  120. package/src/components/Sidebar.tsx +0 -271
  121. package/src/components/StrictECharts.d.ts +0 -47
  122. package/src/components/StrictECharts.js +0 -1
  123. package/src/components/TsingrocDatePicker.tsx +0 -103
  124. package/src/components/TsingrocTheme.tsx +0 -48
  125. package/src/components/UserButton.tsx +0 -165
  126. package/src/components/VerticalColorLegend.tsx +0 -73
  127. package/src/components/WeatherMap.tsx +0 -522
  128. package/src/deckgl/TiandituLayer.ts +0 -56
  129. package/src/deckgl/WeatherData.ts +0 -157
  130. package/src/deckgl/index.ts +0 -4
  131. package/src/echarts/coordinateSystems/grid.ts +0 -143
  132. package/src/echarts/coordinateSystems/polar.ts +0 -148
  133. package/src/echarts/gl.ts +0 -159
  134. package/src/echarts/index.ts +0 -129
  135. package/src/echarts/legend.ts +0 -36
  136. package/src/echarts/radar.ts +0 -46
  137. package/src/echarts/series/barSeries.ts +0 -37
  138. package/src/echarts/series/boxplotSeries.ts +0 -62
  139. package/src/echarts/series/intervalSeries.ts +0 -70
  140. package/src/echarts/series/lineSeries.ts +0 -78
  141. package/src/echarts/series/maxBarSeries.ts +0 -55
  142. package/src/echarts/series/pieSeries.ts +0 -76
  143. package/src/echarts/series/windLineSeries.ts +0 -113
  144. package/src/index.ts +0 -120
  145. package/src/types.d.ts +0 -5
  146. package/src/utils/debug.ts +0 -39
  147. package/src/utils/mock.ts +0 -69
  148. package/src/utils/startOfQuarter.ts +0 -6
  149. /package/{src/echarts/coordinateSystems/index.ts → dist/echarts/coordinateSystems/index.d.ts} +0 -0
  150. /package/{src/echarts/series/index.ts → dist/echarts/series/index.d.ts} +0 -0
@@ -0,0 +1,67 @@
1
+ import { type MenuProps } from "antd";
2
+ import type { CSSProperties, ReactNode } from "react";
3
+ export type MenuItem = Required<MenuProps>["items"][number];
4
+ export interface HeaderProps extends MenuProps {
5
+ /**
6
+ * 网站 logo 的 URL。
7
+ *
8
+ * 建议导入图片,然后填入导入得到的地址,而不要硬编码地址。
9
+ */
10
+ logo?: string;
11
+ /** 顶栏的标题。*/
12
+ title?: string;
13
+ /**
14
+ * 顶栏左端部分(logo 和标题)的宽度。在与边栏搭配时,推荐设置成与边栏同宽。
15
+ * @default 260
16
+ */
17
+ leftEndWidth?: number | string;
18
+ /**
19
+ * 顶栏左端的内容(logo 和标题)。设置了该属性时,
20
+ * {@linkcode HeaderProps.logo | logo}、
21
+ * {@linkcode HeaderProps.title | title} 和
22
+ * {@linkcode HeaderProps.leftEndWidth | leftEndWidth} 将失去作用。
23
+ * 填 `null` 可以隐藏掉默认值(与 `undefined` 不同!)。
24
+ */
25
+ leftEnd?: ReactNode;
26
+ /**
27
+ * 菜单项配置,默认为空。
28
+ *
29
+ * 该属性以及其余属性的用法可参考 [`Menu` 组件的文档][1]。
30
+ *
31
+ * [1]: https://ant-design.antgroup.com/components/menu-cn
32
+ */
33
+ items?: MenuItem[];
34
+ /** 当前选中的菜单项 key 数组。 */
35
+ selectedKeys?: string[];
36
+ /** 当前展开的子菜单 key 数组。 */
37
+ openKeys?: string[];
38
+ /** 菜单项被选中时的回调函数。 */
39
+ onSelect?: MenuProps["onSelect"];
40
+ /** 子菜单展开/收起时的回调函数。 */
41
+ onOpenChange?: MenuProps["onOpenChange"];
42
+ /**
43
+ * 顶栏右端的额外内容。默认使用 {@linkcode UserButton} 组件。
44
+ * 填 `null` 可以隐藏掉默认值(与 `undefined` 不同!)。
45
+ * @default <UserButton layout="header" />
46
+ */
47
+ rightEnd?: ReactNode;
48
+ /** 额外的 `className`。*/
49
+ className?: string;
50
+ /** 额外的 CSS 样式。*/
51
+ style?: CSSProperties;
52
+ }
53
+ /**
54
+ * 顶栏组件。该组件需要放置在 [Ant Design 的 `Layout` 组件][1]内部才能正常工作。
55
+ * 如果没有指定 {@linkcode HeaderProps.rightEnd | rightEnd} 属性,
56
+ * 那么还需要包裹在 {@linkcode AuthProvider} 内,并且经过 {@linkcode AuthCheck} 验证后
57
+ * 才能正常显示顶栏右端的用户信息按钮。
58
+ *
59
+ * 一般来说,使用该组件时至少需要提供 `logo`、`items` 和 `onSelect` 三个属性,具体用法请参照范例。
60
+ *
61
+ * 除了文档中列出的属性之外,该组件会把额外的属性全部传递给内部的菜单 [`Menu` 组件][2]。
62
+ *
63
+ * [1]: https://ant-design.antgroup.com/components/layout-cn
64
+ * [2]: https://ant-design.antgroup.com/components/menu-cn
65
+ */
66
+ declare function Header(props: HeaderProps): import("react/jsx-runtime").JSX.Element;
67
+ export default Header;
@@ -0,0 +1,171 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Flex, Layout, Menu, theme } from "antd";
3
+ import UserButton from "./UserButton";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ /**
6
+ * 顶栏组件。该组件需要放置在 [Ant Design 的 `Layout` 组件][1]内部才能正常工作。
7
+ * 如果没有指定 {@linkcode HeaderProps.rightEnd | rightEnd} 属性,
8
+ * 那么还需要包裹在 {@linkcode AuthProvider} 内,并且经过 {@linkcode AuthCheck} 验证后
9
+ * 才能正常显示顶栏右端的用户信息按钮。
10
+ *
11
+ * 一般来说,使用该组件时至少需要提供 `logo`、`items` 和 `onSelect` 三个属性,具体用法请参照范例。
12
+ *
13
+ * 除了文档中列出的属性之外,该组件会把额外的属性全部传递给内部的菜单 [`Menu` 组件][2]。
14
+ *
15
+ * [1]: https://ant-design.antgroup.com/components/layout-cn
16
+ * [2]: https://ant-design.antgroup.com/components/menu-cn
17
+ */
18
+ function Header(props) {
19
+ const $ = _c(34);
20
+ const {
21
+ token
22
+ } = theme.useToken();
23
+ let className;
24
+ let leftEnd;
25
+ let logo;
26
+ let rest;
27
+ let rightEnd;
28
+ let style;
29
+ let t0;
30
+ let title;
31
+ if ($[0] !== props) {
32
+ ({
33
+ logo,
34
+ title,
35
+ leftEndWidth: t0,
36
+ leftEnd,
37
+ rightEnd,
38
+ className,
39
+ style,
40
+ ...rest
41
+ } = props);
42
+ $[0] = props;
43
+ $[1] = className;
44
+ $[2] = leftEnd;
45
+ $[3] = logo;
46
+ $[4] = rest;
47
+ $[5] = rightEnd;
48
+ $[6] = style;
49
+ $[7] = t0;
50
+ $[8] = title;
51
+ } else {
52
+ className = $[1];
53
+ leftEnd = $[2];
54
+ logo = $[3];
55
+ rest = $[4];
56
+ rightEnd = $[5];
57
+ style = $[6];
58
+ t0 = $[7];
59
+ title = $[8];
60
+ }
61
+ const leftEndWidth = t0 === undefined ? 260 : t0;
62
+ let t1;
63
+ if ($[9] !== style || $[10] !== token.colorBgContainer || $[11] !== token.colorText) {
64
+ t1 = {
65
+ display: "flex",
66
+ alignItems: "center",
67
+ boxShadow: "rgba(0, 0, 0, 0.15) 0 0 8px",
68
+ zIndex: 1,
69
+ background: token.colorBgContainer,
70
+ padding: 0,
71
+ color: token.colorText,
72
+ ...style
73
+ };
74
+ $[9] = style;
75
+ $[10] = token.colorBgContainer;
76
+ $[11] = token.colorText;
77
+ $[12] = t1;
78
+ } else {
79
+ t1 = $[12];
80
+ }
81
+ let t2;
82
+ if ($[13] !== leftEnd || $[14] !== leftEndWidth || $[15] !== logo || $[16] !== title || $[17] !== token.colorText || $[18] !== token.marginSM || $[19] !== token.paddingLG || $[20] !== token.paddingSM || $[21] !== token.paddingXXS) {
83
+ t2 = leftEnd !== undefined ? leftEnd : /*#__PURE__*/_jsxs(Flex, {
84
+ align: "center",
85
+ gap: token.marginSM,
86
+ style: {
87
+ minWidth: leftEndWidth,
88
+ height: "100%",
89
+ paddingInlineStart: token.paddingLG + token.paddingXXS,
90
+ paddingInlineEnd: token.paddingSM
91
+ },
92
+ children: [/*#__PURE__*/_jsx("img", {
93
+ alt: "logo",
94
+ src: logo,
95
+ style: {
96
+ height: "50%"
97
+ }
98
+ }), /*#__PURE__*/_jsx("h1", {
99
+ style: {
100
+ flexBasis: "100%",
101
+ textAlign: "center",
102
+ color: token.colorText
103
+ },
104
+ children: title
105
+ })]
106
+ });
107
+ $[13] = leftEnd;
108
+ $[14] = leftEndWidth;
109
+ $[15] = logo;
110
+ $[16] = title;
111
+ $[17] = token.colorText;
112
+ $[18] = token.marginSM;
113
+ $[19] = token.paddingLG;
114
+ $[20] = token.paddingSM;
115
+ $[21] = token.paddingXXS;
116
+ $[22] = t2;
117
+ } else {
118
+ t2 = $[22];
119
+ }
120
+ let t3;
121
+ if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
122
+ t3 = {
123
+ flexBasis: "100%",
124
+ height: "100%",
125
+ borderBlockEnd: "none"
126
+ };
127
+ $[23] = t3;
128
+ } else {
129
+ t3 = $[23];
130
+ }
131
+ let t4;
132
+ if ($[24] !== rest) {
133
+ t4 = /*#__PURE__*/_jsx(Menu, {
134
+ mode: "horizontal",
135
+ ...rest,
136
+ style: t3
137
+ });
138
+ $[24] = rest;
139
+ $[25] = t4;
140
+ } else {
141
+ t4 = $[25];
142
+ }
143
+ let t5;
144
+ if ($[26] !== rightEnd) {
145
+ t5 = rightEnd !== undefined ? rightEnd : /*#__PURE__*/_jsx(UserButton, {
146
+ layout: "header"
147
+ });
148
+ $[26] = rightEnd;
149
+ $[27] = t5;
150
+ } else {
151
+ t5 = $[27];
152
+ }
153
+ let t6;
154
+ if ($[28] !== className || $[29] !== t1 || $[30] !== t2 || $[31] !== t4 || $[32] !== t5) {
155
+ t6 = /*#__PURE__*/_jsxs(Layout.Header, {
156
+ className: className,
157
+ style: t1,
158
+ children: [t2, t4, t5]
159
+ });
160
+ $[28] = className;
161
+ $[29] = t1;
162
+ $[30] = t2;
163
+ $[31] = t4;
164
+ $[32] = t5;
165
+ $[33] = t6;
166
+ } else {
167
+ t6 = $[33];
168
+ }
169
+ return t6;
170
+ }
171
+ export default Header;
@@ -0,0 +1,32 @@
1
+ export interface ImageBackgroundProps extends React.HTMLAttributes<HTMLDivElement> {
2
+ /**
3
+ * 图片的 URL。
4
+ *
5
+ * 建议导入图片,然后填入导入得到的地址,而不要硬编码地址。
6
+ *
7
+ * ```jsx
8
+ * import img from "../public/image.png";
9
+ * <ImageBackground url={img}>...</ImageBackground>
10
+ * ```
11
+ */
12
+ url: string;
13
+ children: React.ReactNode;
14
+ /**
15
+ * 容器的宽度。
16
+ * @default "100%"
17
+ */
18
+ width?: React.CSSProperties["width"];
19
+ /**
20
+ * 容器的高度。
21
+ * @default "100%"
22
+ */
23
+ height?: React.CSSProperties["height"];
24
+ style?: React.CSSProperties;
25
+ }
26
+ /**
27
+ * 以图片作为背景的块级容器。除了文档列出的属性以外,也兼容所有 [HTML Div 元素][1] 的属性。
28
+ *
29
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div
30
+ */
31
+ declare function ImageBackground(props: ImageBackgroundProps): import("react/jsx-runtime").JSX.Element;
32
+ export default ImageBackground;
@@ -0,0 +1,76 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ /**
4
+ * 以图片作为背景的块级容器。除了文档列出的属性以外,也兼容所有 [HTML Div 元素][1] 的属性。
5
+ *
6
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div
7
+ */
8
+ function ImageBackground(props) {
9
+ const $ = _c(16);
10
+ let children;
11
+ let rest;
12
+ let style;
13
+ let t0;
14
+ let t1;
15
+ let url;
16
+ if ($[0] !== props) {
17
+ ({
18
+ url,
19
+ children,
20
+ width: t0,
21
+ height: t1,
22
+ style,
23
+ ...rest
24
+ } = props);
25
+ $[0] = props;
26
+ $[1] = children;
27
+ $[2] = rest;
28
+ $[3] = style;
29
+ $[4] = t0;
30
+ $[5] = t1;
31
+ $[6] = url;
32
+ } else {
33
+ children = $[1];
34
+ rest = $[2];
35
+ style = $[3];
36
+ t0 = $[4];
37
+ t1 = $[5];
38
+ url = $[6];
39
+ }
40
+ const width = t0 === undefined ? "100%" : t0;
41
+ const height = t1 === undefined ? "100%" : t1;
42
+ const t2 = `url('${url}')`;
43
+ let t3;
44
+ if ($[7] !== height || $[8] !== style || $[9] !== t2 || $[10] !== width) {
45
+ t3 = {
46
+ backgroundSize: "100% 100%",
47
+ width,
48
+ height,
49
+ backgroundImage: t2,
50
+ ...style
51
+ };
52
+ $[7] = height;
53
+ $[8] = style;
54
+ $[9] = t2;
55
+ $[10] = width;
56
+ $[11] = t3;
57
+ } else {
58
+ t3 = $[11];
59
+ }
60
+ let t4;
61
+ if ($[12] !== children || $[13] !== rest || $[14] !== t3) {
62
+ t4 = /*#__PURE__*/_jsx("div", {
63
+ ...rest,
64
+ style: t3,
65
+ children: children
66
+ });
67
+ $[12] = children;
68
+ $[13] = rest;
69
+ $[14] = t3;
70
+ $[15] = t4;
71
+ } else {
72
+ t4 = $[15];
73
+ }
74
+ return t4;
75
+ }
76
+ export default ImageBackground;
@@ -0,0 +1,44 @@
1
+ import type { HTMLAttributes } from "react";
2
+ export interface IndicatorLightProps extends HTMLAttributes<HTMLDivElement> {
3
+ /**
4
+ * 指示灯的直径。
5
+ * @default token.sizeXL
6
+ */
7
+ size?: number | string;
8
+ /**
9
+ * 指示的状态。设置了这一项时,{@linkcode onColor}、{@linkcode mode} 和 {@linkcode period} 会被忽略。
10
+ *
11
+ * `"healthy"` 表示常绿,`"attention"` 表示绿色闪烁,
12
+ * `"danger"` 表示常红,`"emergency"` 表示红色闪烁,
13
+ * `"off"` 表示关闭。
14
+ * 具体色值取自 design token。
15
+ */
16
+ status?: "healthy" | "attention" | "danger" | "emergency" | "off";
17
+ /**
18
+ * 灯亮时的颜色。
19
+ * @default token.colorError
20
+ */
21
+ onColor?: string;
22
+ /**
23
+ * 灯灭时的颜色。
24
+ * @default token.colorFill
25
+ */
26
+ offColor?: string;
27
+ /**
28
+ * 灯的状态。`"on"` 表示常亮,`"flash"` 表示闪烁,`"off"` 表示常暗。
29
+ * @default "on"
30
+ */
31
+ mode?: "on" | "flash" | "off";
32
+ /**
33
+ * 闪烁周期(一亮一暗)的时长,以秒为单位。不可为 `0`、`NaN` 或 `Infinity`。
34
+ * @default 1
35
+ */
36
+ period?: number;
37
+ }
38
+ /**
39
+ * 一个指示灯。
40
+ *
41
+ * 文档内未列出的属性会被传递给组件顶层的 `div` 元素。
42
+ */
43
+ declare function IndicatorLight(props: IndicatorLightProps): import("react/jsx-runtime").JSX.Element;
44
+ export default IndicatorLight;
@@ -0,0 +1,124 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { createStyles, keyframes } from "antd-style";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ const ANIMATION_MAP = {
5
+ on: "linear(0, 0) paused",
6
+ flash: "cubic-bezier(0.9, 0, 0.1, 1) infinite alternate",
7
+ off: "linear(1, 1) paused"
8
+ };
9
+ const useStyles = createStyles(({
10
+ token,
11
+ css
12
+ }, props) => {
13
+ const size = props.size ?? token.sizeXL;
14
+ const sizeCss = typeof size === "number" ? `${size}px` : size;
15
+ const colorMap = {
16
+ healthy: {
17
+ onColor: token.colorSuccess,
18
+ mode: "on"
19
+ },
20
+ attention: {
21
+ onColor: token.colorSuccess,
22
+ mode: "flash"
23
+ },
24
+ danger: {
25
+ onColor: token.colorError,
26
+ mode: "on"
27
+ },
28
+ emergency: {
29
+ onColor: token.colorError,
30
+ mode: "flash"
31
+ },
32
+ off: {
33
+ onColor: token.colorError,
34
+ mode: "off"
35
+ }
36
+ };
37
+ const {
38
+ onColor = token.colorError,
39
+ mode = "on"
40
+ } = props.status ? colorMap[props.status] : props;
41
+ const offColor = props.offColor ?? token.colorFillSecondary;
42
+ const halfPeriod = (props.period ?? 1) / 2;
43
+ const flash = keyframes`
44
+ from {
45
+ background-color: ${onColor};
46
+ box-shadow: 0 0 6px 2px ${onColor};
47
+ }
48
+ to {
49
+ background-color: ${offColor};
50
+ }
51
+ `;
52
+ return {
53
+ light: css`
54
+ width: 100%;
55
+ height: 100%;
56
+ border-radius: 50%;
57
+ animation: ${flash} ${halfPeriod}s ${ANIMATION_MAP[mode]};
58
+ `,
59
+ lightBorder: css`
60
+ height: ${sizeCss};
61
+ aspect-ratio: 1;
62
+ border: ${token.colorBorder} 2px solid;
63
+ border-radius: 50%;
64
+ `
65
+ };
66
+ });
67
+
68
+ /**
69
+ * 一个指示灯。
70
+ *
71
+ * 文档内未列出的属性会被传递给组件顶层的 `div` 元素。
72
+ */
73
+ function IndicatorLight(props) {
74
+ const $ = _c(9);
75
+ const {
76
+ size,
77
+ status,
78
+ onColor,
79
+ offColor,
80
+ mode,
81
+ period,
82
+ ...rest
83
+ } = props;
84
+ const {
85
+ cx,
86
+ styles
87
+ } = useStyles(props);
88
+ const t0 = cx(styles.lightBorder, rest.className);
89
+ let t1;
90
+ if ($[0] !== cx || $[1] !== styles.light) {
91
+ t1 = cx(styles.light);
92
+ $[0] = cx;
93
+ $[1] = styles.light;
94
+ $[2] = t1;
95
+ } else {
96
+ t1 = $[2];
97
+ }
98
+ let t2;
99
+ if ($[3] !== t1) {
100
+ t2 = /*#__PURE__*/_jsx("div", {
101
+ className: t1
102
+ });
103
+ $[3] = t1;
104
+ $[4] = t2;
105
+ } else {
106
+ t2 = $[4];
107
+ }
108
+ let t3;
109
+ if ($[5] !== rest || $[6] !== t0 || $[7] !== t2) {
110
+ t3 = /*#__PURE__*/_jsx("div", {
111
+ ...rest,
112
+ className: t0,
113
+ children: t2
114
+ });
115
+ $[5] = rest;
116
+ $[6] = t0;
117
+ $[7] = t2;
118
+ $[8] = t3;
119
+ } else {
120
+ t3 = $[8];
121
+ }
122
+ return t3;
123
+ }
124
+ export default IndicatorLight;
@@ -0,0 +1,42 @@
1
+ import { type ReactNode } from "react";
2
+ import type { EChartsHOCType, EChartsProps } from "./ECharts";
3
+ /**
4
+ * 为 {@linkcode LeftAlignedECharts} 和
5
+ * {@linkcode withLeftAlign | withLeftAlign(ECharts)}
6
+ * 提供对齐上下文。
7
+ */
8
+ export declare function EChartsLeftAligner({ children }: {
9
+ children: ReactNode;
10
+ }): import("react/jsx-runtime").JSX.Element;
11
+ /**
12
+ * 为 ECharts 添加与其它 ECharts 纵轴左对齐的能力。
13
+ *
14
+ * 使用该组件时必须满足下列限制:
15
+ *
16
+ * - 必须包裹在 {@linkcode EChartsLeftAligner} 内,否则会立即抛出错误。
17
+ * - 图像所在的容器本身必须已经左对齐。
18
+ * - 图像中必须包含且仅包含一个 grid 坐标系。
19
+ * 如果图像不包含 grid,那么该组件不会产生任何效果。
20
+ * 如果图像包含多个 grid,那么该组件只会对齐其中一个 grid,且无法保证是哪一个。
21
+ * - grid 必须有且仅有一个纵轴,并且在左侧,不满足这一条件的影响同上一条。
22
+ * - grid 坐标系必须被设置为 `{ containLabel: true }` 或者
23
+ * `{ outerBoundsMode: "same", outerBoundsContain: "axisLabel" }`。
24
+ * 这也是组件库内的 `echarts.grid()` 的默认设置。
25
+ * 如果你不这么设置,而是使用 `left` 和 `bottom` 来手动对齐轴线,那就没必要使用这个组件,强行使用可能导致布局异常。
26
+ * - grid 坐标系的 `left` 属性会被该组件覆盖,最终效果总是会使得纵轴标签最宽的坐标系的标签紧贴容器左边缘(即 `left === 0`)。
27
+ * - 左对齐时原本的过渡动画会被打断。
28
+ */
29
+ export declare const withLeftAlign: EChartsHOCType;
30
+ /**
31
+ * 预置了纵轴左对齐、联动和自适应容器尺寸能力的 ECharts 组件。
32
+ *
33
+ * @see {@linkcode withLeftAlign}
34
+ * @see {@linkcode withConnector}
35
+ * @see {@linkcode withAutoResize}
36
+ */
37
+ declare const LeftAlignedECharts: import("./ECharts").EChartsComponentType<EChartsProps<import("echarts/core").EChartsCoreOption> & {
38
+ group?: string;
39
+ }> & {
40
+ displayName: string;
41
+ };
42
+ export default LeftAlignedECharts;