@tsingroc/tsingroc-components 4.2.0 → 4.3.1
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/dist/components/Auth.d.ts +2 -2
- package/dist/components/Auth.js +15 -10
- package/dist/components/Auth.js.map +1 -1
- package/dist/components/Calendar.js +1 -1
- package/dist/components/Calendar.js.map +1 -1
- package/dist/components/Header.d.ts +1 -1
- package/dist/components/Header.js.map +1 -1
- package/dist/components/IndicatorLight.js +1 -1
- package/dist/components/IndicatorLight.js.map +1 -1
- package/dist/components/LineChartEditor.js +4 -4
- package/dist/components/LineChartEditor.js.map +1 -1
- package/dist/components/LineChartTable.js +4 -3
- package/dist/components/LineChartTable.js.map +1 -1
- package/dist/components/LinkedLineChart.d.ts +2 -2
- package/dist/components/LinkedLineChart.js +2 -2
- package/dist/components/LinkedLineChart.js.map +1 -1
- package/dist/components/QuickDateRangePicker.d.ts +1 -1
- package/dist/components/QuickDateRangePicker.js.map +1 -1
- package/dist/components/SegmentedButtons.js.map +1 -1
- package/dist/components/Sidebar.js +40 -21
- package/dist/components/Sidebar.js.map +1 -1
- package/dist/components/TsingrocDatePicker.d.ts +1 -1
- package/dist/components/TsingrocDatePicker.js +1 -1
- package/dist/components/TsingrocDatePicker.js.map +1 -1
- package/dist/components/TsingrocTheme.js +1 -1
- package/dist/components/TsingrocTheme.js.map +1 -1
- package/dist/components/UserButton.js +2 -1
- package/dist/components/UserButton.js.map +1 -1
- package/dist/components/VerticalColorLegend.js +1 -1
- package/dist/components/VerticalColorLegend.js.map +1 -1
- package/dist/components/WeatherMap.js +8 -7
- package/dist/components/WeatherMap.js.map +1 -1
- package/dist/deckgl/TiandituLayer.d.ts +2 -2
- package/dist/deckgl/TiandituLayer.js.map +1 -1
- package/dist/deckgl/WeatherData.js.map +1 -1
- package/dist/echarts/coordinateSystem.js +2 -2
- package/dist/echarts/coordinateSystem.js.map +1 -1
- package/dist/echarts/gl.d.ts +1 -1
- package/dist/echarts/gl.js.map +1 -1
- package/dist/echarts/index.js +1 -0
- package/dist/echarts/index.js.map +1 -1
- package/package.json +26 -12
- package/src/components/Auth.tsx +17 -12
- package/src/components/Calendar.tsx +1 -1
- package/src/components/Header.tsx +1 -1
- package/src/components/IndicatorLight.tsx +1 -1
- package/src/components/LineChartEditor.tsx +11 -11
- package/src/components/LineChartTable.tsx +11 -10
- package/src/components/LinkedLineChart.tsx +7 -7
- package/src/components/QuickDateRangePicker.tsx +4 -4
- package/src/components/SegmentedButtons.tsx +1 -1
- package/src/components/Sidebar.tsx +93 -68
- package/src/components/TsingrocDatePicker.tsx +4 -4
- package/src/components/TsingrocTheme.tsx +2 -1
- package/src/components/UserButton.tsx +4 -4
- package/src/components/VerticalColorLegend.tsx +3 -3
- package/src/components/WeatherMap.tsx +13 -12
- package/src/deckgl/TiandituLayer.ts +3 -3
- package/src/deckgl/WeatherData.ts +7 -7
- package/src/echarts/coordinateSystem.ts +3 -3
- package/src/echarts/gl.ts +2 -1
- package/src/echarts/index.ts +1 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Button,
|
|
3
|
-
type ButtonProps,
|
|
4
3
|
DatePicker,
|
|
5
4
|
Space,
|
|
5
|
+
type ButtonProps,
|
|
6
6
|
type SpaceProps,
|
|
7
7
|
} from "antd";
|
|
8
|
+
import type { RangePickerProps } from "antd/es/date-picker";
|
|
8
9
|
import dayjs, { type Dayjs } from "dayjs";
|
|
9
10
|
import type { NoUndefinedRangeValueType } from "rc-picker/lib/PickerInput/RangePicker";
|
|
10
|
-
import type { RangePickerProps } from "antd/es/date-picker";
|
|
11
11
|
import { useState } from "react";
|
|
12
12
|
|
|
13
13
|
export interface QuickDateRangePickerProps
|
|
@@ -72,8 +72,8 @@ function QuickDateRangePicker(props: QuickDateRangePickerProps) {
|
|
|
72
72
|
value={range}
|
|
73
73
|
allowClear={false}
|
|
74
74
|
onChange={(range) => {
|
|
75
|
-
setRange(range
|
|
76
|
-
onChange?.(range
|
|
75
|
+
setRange(range as NoUndefinedRangeValueType<Dayjs>);
|
|
76
|
+
onChange?.(range as NoUndefinedRangeValueType<Dayjs>); // 由于 allowClear=false,这里 range 不可能为 null
|
|
77
77
|
}}
|
|
78
78
|
{...pickerProps}
|
|
79
79
|
/>
|
|
@@ -37,7 +37,7 @@ export function TimeUnitSwitcher(props: TimeUnitSwitcherProps) {
|
|
|
37
37
|
<Radio.Group
|
|
38
38
|
optionType="button"
|
|
39
39
|
options={TIME_UNIT_OPTIONS}
|
|
40
|
-
onChange={(e) => onChange?.(e.target.value)}
|
|
40
|
+
onChange={(e) => onChange?.(e.target.value as "day" | "week" | "month")}
|
|
41
41
|
{...rest}
|
|
42
42
|
/>
|
|
43
43
|
);
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { Button, Flex, Layout, Menu, type MenuProps } from "antd";
|
|
2
|
+
import { createStyles } from "antd-style";
|
|
3
|
+
import { useState, type CSSProperties, type Key, type ReactNode } from "react";
|
|
1
4
|
import {
|
|
2
5
|
BarChartOutlined,
|
|
3
6
|
LeftOutlined,
|
|
@@ -5,9 +8,6 @@ import {
|
|
|
5
8
|
SwapOutlined,
|
|
6
9
|
TeamOutlined,
|
|
7
10
|
} from "@ant-design/icons";
|
|
8
|
-
import { Button, Flex, Layout, Menu, type MenuProps } from "antd";
|
|
9
|
-
import { type CSSProperties, type Key, type ReactNode, useState } from "react";
|
|
10
|
-
import { createStyles } from "antd-style";
|
|
11
11
|
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
13
|
import { AuthCheck, AuthProvider } from "./Auth";
|
|
@@ -104,70 +104,6 @@ export interface SidebarProps extends MenuProps {
|
|
|
104
104
|
style?: CSSProperties;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
const useStyles = createStyles(
|
|
108
|
-
({ token, css, cx, prefixCls }, collapsed: boolean) => {
|
|
109
|
-
const sidebarHeader = css`
|
|
110
|
-
margin-top: ${token.marginXXS}px;
|
|
111
|
-
|
|
112
|
-
> img {
|
|
113
|
-
width: 40%;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
> h1 {
|
|
117
|
-
margin: ${collapsed ? 0 : token.marginXXS}px 0 0 0;
|
|
118
|
-
font-size: ${collapsed ? 0 : token.fontSize}px;
|
|
119
|
-
font-weight: normal;
|
|
120
|
-
line-height: 1;
|
|
121
|
-
transition:
|
|
122
|
-
margin-top ${token.motionDurationMid},
|
|
123
|
-
font-size ${token.motionDurationMid};
|
|
124
|
-
}
|
|
125
|
-
`;
|
|
126
|
-
const sidebarMenu = css`
|
|
127
|
-
flex-basis: 100%;
|
|
128
|
-
overflow-y: auto;
|
|
129
|
-
`;
|
|
130
|
-
const sidebarBtn = css`
|
|
131
|
-
position: absolute;
|
|
132
|
-
top: 75%;
|
|
133
|
-
right: 0;
|
|
134
|
-
transform: translate(50%, -50%);
|
|
135
|
-
|
|
136
|
-
font-size: ${token.sizeSM}px;
|
|
137
|
-
|
|
138
|
-
transition: opacity ${token.motionDurationMid};
|
|
139
|
-
opacity: 0%;
|
|
140
|
-
`;
|
|
141
|
-
const sidebar = css`
|
|
142
|
-
position: relative;
|
|
143
|
-
box-shadow: rgba(0, 0, 0, 0.15) 0 0 8px;
|
|
144
|
-
|
|
145
|
-
> .${prefixCls}-layout-sider-children {
|
|
146
|
-
display: flex;
|
|
147
|
-
flex-direction: column;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/* 为了提高权重 */
|
|
151
|
-
& .${cx(sidebarBtn)} {
|
|
152
|
-
width: ${token.controlHeightXS}px;
|
|
153
|
-
}
|
|
154
|
-
& .${cx(sidebarMenu)}.${cx(sidebarMenu)} {
|
|
155
|
-
border-inline-end: none;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
&:hover .${cx(sidebarBtn)} {
|
|
159
|
-
opacity: 100%;
|
|
160
|
-
}
|
|
161
|
-
`;
|
|
162
|
-
return {
|
|
163
|
-
sidebar,
|
|
164
|
-
sidebarHeader,
|
|
165
|
-
sidebarMenu,
|
|
166
|
-
sidebarBtn,
|
|
167
|
-
};
|
|
168
|
-
},
|
|
169
|
-
);
|
|
170
|
-
|
|
171
107
|
/**
|
|
172
108
|
* 出自 TMS 系统的侧边栏组件。该组件需要放置在 [Ant Design 的 `Layout` 组件][1]内部才能正常工作。
|
|
173
109
|
* 如果没有指定 {@linkcode SidebarProps.footer | footer} 属性,
|
|
@@ -202,6 +138,11 @@ function Sidebar(props: SidebarProps) {
|
|
|
202
138
|
} = props;
|
|
203
139
|
|
|
204
140
|
const [collapsed, setCollapsed] = useState(false);
|
|
141
|
+
// 默认展开到 selectedKeys
|
|
142
|
+
const [openKeys, setOpenKeys] = useState<string[]>(
|
|
143
|
+
() =>
|
|
144
|
+
rest.selectedKeys?.flatMap((key) => findKeyPath(items, key) ?? []) ?? [],
|
|
145
|
+
);
|
|
205
146
|
const { cx, styles, theme: token } = useStyles(collapsed);
|
|
206
147
|
|
|
207
148
|
return (
|
|
@@ -232,10 +173,12 @@ function Sidebar(props: SidebarProps) {
|
|
|
232
173
|
mode="inline"
|
|
233
174
|
items={items}
|
|
234
175
|
inlineCollapsed={collapsible ? collapsed : false}
|
|
176
|
+
openKeys={openKeys}
|
|
177
|
+
onOpenChange={(openKeys) => setOpenKeys(openKeys)}
|
|
235
178
|
className={cx(styles.sidebarMenu)}
|
|
236
179
|
{...rest}
|
|
237
180
|
/>
|
|
238
|
-
{footer === null ? null : footer
|
|
181
|
+
{footer === null ? null : footer(collapsed)}
|
|
239
182
|
{collapsible && (
|
|
240
183
|
<Button
|
|
241
184
|
className={cx(styles.sidebarBtn)}
|
|
@@ -248,3 +191,85 @@ function Sidebar(props: SidebarProps) {
|
|
|
248
191
|
}
|
|
249
192
|
|
|
250
193
|
export default Sidebar;
|
|
194
|
+
|
|
195
|
+
const useStyles = createStyles(
|
|
196
|
+
({ token, css, cx, prefixCls }, collapsed: boolean) => {
|
|
197
|
+
const sidebarHeader = css`
|
|
198
|
+
margin-top: ${token.marginXXS}px;
|
|
199
|
+
|
|
200
|
+
> img {
|
|
201
|
+
width: 40%;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
> h1 {
|
|
205
|
+
margin: ${collapsed ? 0 : token.marginXXS}px 0 0 0;
|
|
206
|
+
font-size: ${collapsed ? 0 : token.fontSize}px;
|
|
207
|
+
font-weight: normal;
|
|
208
|
+
line-height: 1;
|
|
209
|
+
transition:
|
|
210
|
+
margin-top ${token.motionDurationMid},
|
|
211
|
+
font-size ${token.motionDurationMid};
|
|
212
|
+
}
|
|
213
|
+
`;
|
|
214
|
+
const sidebarMenu = css`
|
|
215
|
+
flex-basis: 100%;
|
|
216
|
+
overflow-y: auto;
|
|
217
|
+
`;
|
|
218
|
+
const sidebarBtn = css`
|
|
219
|
+
position: absolute;
|
|
220
|
+
top: 75%;
|
|
221
|
+
right: 0;
|
|
222
|
+
transform: translate(50%, -50%);
|
|
223
|
+
|
|
224
|
+
font-size: ${token.sizeSM}px;
|
|
225
|
+
|
|
226
|
+
transition: opacity ${token.motionDurationMid};
|
|
227
|
+
opacity: 0%;
|
|
228
|
+
`;
|
|
229
|
+
const sidebar = css`
|
|
230
|
+
position: relative;
|
|
231
|
+
box-shadow: rgba(0, 0, 0, 0.15) 0 0 8px;
|
|
232
|
+
|
|
233
|
+
> .${prefixCls}-layout-sider-children {
|
|
234
|
+
display: flex;
|
|
235
|
+
flex-direction: column;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/* 为了提高权重 */
|
|
239
|
+
& .${cx(sidebarBtn)} {
|
|
240
|
+
width: ${token.controlHeightXS}px;
|
|
241
|
+
}
|
|
242
|
+
& .${cx(sidebarMenu)}.${cx(sidebarMenu)} {
|
|
243
|
+
border-inline-end: none;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
&:hover .${cx(sidebarBtn)} {
|
|
247
|
+
opacity: 100%;
|
|
248
|
+
}
|
|
249
|
+
`;
|
|
250
|
+
return {
|
|
251
|
+
sidebar,
|
|
252
|
+
sidebarHeader,
|
|
253
|
+
sidebarMenu,
|
|
254
|
+
sidebarBtn,
|
|
255
|
+
};
|
|
256
|
+
},
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
function findKeyPath(items: MenuItem[], key: string): string[] | null {
|
|
260
|
+
for (const item of items) {
|
|
261
|
+
if (!item) {
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
if (item.key === key) {
|
|
265
|
+
return [];
|
|
266
|
+
}
|
|
267
|
+
if ("children" in item) {
|
|
268
|
+
const childrenResult = findKeyPath(item.children ?? [], key);
|
|
269
|
+
if (childrenResult) {
|
|
270
|
+
return [item.key as string, ...childrenResult];
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
type DatePickerProps as AntdDatePickerProps,
|
|
3
2
|
Button,
|
|
4
|
-
type ButtonProps,
|
|
5
3
|
DatePicker,
|
|
6
4
|
Space,
|
|
5
|
+
type DatePickerProps as AntdDatePickerProps,
|
|
6
|
+
type ButtonProps,
|
|
7
7
|
} from "antd";
|
|
8
|
-
import { LeftOutlined, RightOutlined } from "@ant-design/icons";
|
|
9
|
-
import type { Dayjs } from "dayjs";
|
|
10
8
|
import type { SpaceCompactProps } from "antd/es/space/Compact";
|
|
9
|
+
import type { Dayjs } from "dayjs";
|
|
11
10
|
import { useState } from "react";
|
|
11
|
+
import { LeftOutlined, RightOutlined } from "@ant-design/icons";
|
|
12
12
|
|
|
13
13
|
export interface DatePickerProps extends Omit<SpaceCompactProps, "onChange"> {
|
|
14
14
|
value?: Dayjs;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ConfigProvider, theme } from "antd";
|
|
2
|
+
import zhCN from "antd/es/locale/zh_CN";
|
|
2
3
|
import dayjs from "dayjs";
|
|
3
4
|
import type { ReactNode } from "react";
|
|
4
|
-
|
|
5
|
+
|
|
5
6
|
import "dayjs/locale/zh-cn";
|
|
6
7
|
|
|
7
8
|
export interface TsingrocThemeProps {
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Avatar,
|
|
3
3
|
Button,
|
|
4
|
-
type ButtonProps,
|
|
5
4
|
Dropdown,
|
|
6
|
-
type DropdownProps,
|
|
7
5
|
theme,
|
|
6
|
+
type ButtonProps,
|
|
7
|
+
type DropdownProps,
|
|
8
8
|
} from "antd";
|
|
9
|
+
import type { Account } from "casdoor-js-sdk/lib/esm/sdk";
|
|
9
10
|
import {
|
|
10
11
|
DownOutlined,
|
|
11
12
|
LogoutOutlined,
|
|
12
13
|
UpOutlined,
|
|
13
14
|
UserOutlined,
|
|
14
15
|
} from "@ant-design/icons";
|
|
15
|
-
import type { Account } from "casdoor-js-sdk/lib/esm/sdk";
|
|
16
16
|
|
|
17
17
|
import {
|
|
18
18
|
AuthCheck, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
19
19
|
AuthProvider, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
20
|
+
useAuth,
|
|
20
21
|
type CasdoorAuth,
|
|
21
22
|
type LocalAuth,
|
|
22
|
-
useAuth,
|
|
23
23
|
} from "./Auth";
|
|
24
24
|
|
|
25
25
|
export interface UserButtonProps extends ButtonProps {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HTMLAttributes } from "react";
|
|
2
1
|
import { theme } from "antd";
|
|
2
|
+
import type { HTMLAttributes } from "react";
|
|
3
3
|
|
|
4
4
|
export interface VerticalColorLegendProps
|
|
5
5
|
extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -10,7 +10,7 @@ export interface VerticalColorLegendProps
|
|
|
10
10
|
function VerticalColorLegend(props: VerticalColorLegendProps) {
|
|
11
11
|
const { title, palette, ...rest } = props;
|
|
12
12
|
const { token } = theme.useToken();
|
|
13
|
-
const max = palette.at(-1)
|
|
13
|
+
const max = (palette.at(-1) as [number, [number, number, number]])[0];
|
|
14
14
|
const min = palette[0][0];
|
|
15
15
|
const range = max - min;
|
|
16
16
|
return (
|
|
@@ -58,7 +58,7 @@ function VerticalColorLegend(props: VerticalColorLegendProps) {
|
|
|
58
58
|
key={i}
|
|
59
59
|
style={{
|
|
60
60
|
position: "relative",
|
|
61
|
-
top: ((max - value) / range) * 100
|
|
61
|
+
top: `${((max - value) / range) * 100}%`,
|
|
62
62
|
}}
|
|
63
63
|
>
|
|
64
64
|
{value.toFixed(1)}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { Button, Flex, Slider, Spin, theme, type ButtonProps } from "antd";
|
|
2
|
+
import { createStyles } from "antd-style";
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
import DeckGL from "deck.gl";
|
|
3
5
|
import {
|
|
6
|
+
useMemo,
|
|
7
|
+
useState,
|
|
4
8
|
type CSSProperties,
|
|
5
9
|
type HTMLAttributes,
|
|
6
10
|
type ReactNode,
|
|
7
|
-
useMemo,
|
|
8
|
-
useState,
|
|
9
11
|
} from "react";
|
|
10
12
|
import { MdDewPoint, MdThermostat } from "react-icons/md";
|
|
11
13
|
import {
|
|
@@ -15,10 +17,9 @@ import {
|
|
|
15
17
|
WiRain,
|
|
16
18
|
WiStrongWind,
|
|
17
19
|
} from "react-icons/wi";
|
|
18
|
-
import
|
|
19
|
-
import dayjs from "dayjs";
|
|
20
|
-
import DeckGL from "deck.gl";
|
|
20
|
+
import * as wl from "weatherlayers-gl";
|
|
21
21
|
|
|
22
|
+
import { TiandituLayer } from "../deckgl";
|
|
22
23
|
import {
|
|
23
24
|
extractMagnitudeData,
|
|
24
25
|
extractScalarData,
|
|
@@ -26,7 +27,6 @@ import {
|
|
|
26
27
|
getBounds,
|
|
27
28
|
type WeatherData,
|
|
28
29
|
} from "../deckgl/WeatherData";
|
|
29
|
-
import { TiandituLayer } from "../deckgl";
|
|
30
30
|
import TsingrocTheme from "./TsingrocTheme";
|
|
31
31
|
import VerticalColorLegend from "./VerticalColorLegend";
|
|
32
32
|
|
|
@@ -88,7 +88,7 @@ function WeatherMap(props: WeatherMapProps) {
|
|
|
88
88
|
return adaptiveColorCoding(
|
|
89
89
|
scalarFrame.min,
|
|
90
90
|
scalarFrame.max,
|
|
91
|
-
selectedScalar.adaptivePalette
|
|
91
|
+
selectedScalar.adaptivePalette,
|
|
92
92
|
);
|
|
93
93
|
}, [selectedScalar, scalarFrame]);
|
|
94
94
|
return (
|
|
@@ -141,7 +141,7 @@ function WeatherMap(props: WeatherMapProps) {
|
|
|
141
141
|
tooltip={{
|
|
142
142
|
formatter: (value) =>
|
|
143
143
|
dayjs
|
|
144
|
-
.unix(data.coords.time[value
|
|
144
|
+
.unix(data.coords.time[value as number])
|
|
145
145
|
.format("YYYY-MM-DD HH:mm:ss"),
|
|
146
146
|
}}
|
|
147
147
|
/>
|
|
@@ -298,8 +298,8 @@ interface ScalarInfo {
|
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
const iconSizeFix = (ratio: number): CSSProperties => ({
|
|
301
|
-
fontSize: ratio
|
|
302
|
-
margin: -(1 - 1 / ratio) / 3
|
|
301
|
+
fontSize: `${ratio}em`,
|
|
302
|
+
margin: `${-(1 - 1 / ratio) / 3}em ${-(1 - 1 / ratio) / 2}em`,
|
|
303
303
|
});
|
|
304
304
|
|
|
305
305
|
const TEMPERATURE_ADAPTIVE_PALETTE: AdaptivePalette = {
|
|
@@ -506,6 +506,7 @@ function adaptiveColorCoding(
|
|
|
506
506
|
}
|
|
507
507
|
|
|
508
508
|
// 参考 https://dbba.sacinfo.org.cn/attachment/downloadStdFile?pk=dda6960be9435ed7ab01e336e197cd67a072a28725f03685bfbdaf19cbfeb267
|
|
509
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
509
510
|
function fixedColorCoding<T>(min: number, max: number, palette: [number, T][]) {
|
|
510
511
|
let minIdx = palette.findIndex(([value]) => value > min) - 1;
|
|
511
512
|
if (minIdx < -1) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BitmapLayer, CompositeLayer } from "deck.gl";
|
|
2
|
-
import { TileLayer, type TileLayerProps } from "@deck.gl/geo-layers";
|
|
3
2
|
import type { DefaultProps } from "@deck.gl/core";
|
|
3
|
+
import { TileLayer, type TileLayerProps } from "@deck.gl/geo-layers";
|
|
4
4
|
|
|
5
5
|
export interface TiandituLayerProps {
|
|
6
6
|
tiandituTk: string;
|
|
@@ -14,7 +14,7 @@ export default class TiandituLayer extends CompositeLayer<TiandituLayerProps> {
|
|
|
14
14
|
type: { type: "object", value: "vec" },
|
|
15
15
|
layer: { type: "object", value: "base" },
|
|
16
16
|
};
|
|
17
|
-
renderLayers() {
|
|
17
|
+
renderLayers(): TileLayer {
|
|
18
18
|
const { tiandituTk, type, layer } = this.props;
|
|
19
19
|
const actualType = layer === "base" ? type : "c" + type[0] + "a";
|
|
20
20
|
return new TileLayer(
|
|
@@ -24,7 +24,7 @@ export default class TiandituLayer extends CompositeLayer<TiandituLayerProps> {
|
|
|
24
24
|
maxZoom: 18,
|
|
25
25
|
zoomOffset: 1,
|
|
26
26
|
renderSubLayers,
|
|
27
|
-
}),
|
|
27
|
+
}) as TileLayerProps,
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -42,11 +42,11 @@ export interface WeatherData {
|
|
|
42
42
|
export const getBounds = (data: WeatherData): BitmapBoundingBox => {
|
|
43
43
|
const [lngMin, lngMax] = [
|
|
44
44
|
data.coords.longitude[0],
|
|
45
|
-
data.coords.longitude.at(-1)
|
|
45
|
+
data.coords.longitude.at(-1) as number,
|
|
46
46
|
].sort();
|
|
47
47
|
const [latMin, latMax] = [
|
|
48
48
|
data.coords.latitude[0],
|
|
49
|
-
data.coords.latitude.at(-1)
|
|
49
|
+
data.coords.latitude.at(-1) as number,
|
|
50
50
|
].sort();
|
|
51
51
|
return [lngMin, latMin, lngMax, latMax];
|
|
52
52
|
};
|
|
@@ -69,7 +69,7 @@ export function extractScalarData(
|
|
|
69
69
|
for (let i = 0; i < data.dims.longitude; i++) {
|
|
70
70
|
for (let j = 0; j < data.dims.latitude; j++) {
|
|
71
71
|
for (let t = 0; t < data.dims.time; t++) {
|
|
72
|
-
let value = data.data_vars[variable]
|
|
72
|
+
let value = (data.data_vars[variable] as number[][][])[i][j][t];
|
|
73
73
|
if (value === -9999) value = NaN;
|
|
74
74
|
result[t].image.data[p] = value;
|
|
75
75
|
if (value > result[t].max) result[t].max = value;
|
|
@@ -104,8 +104,8 @@ export function extractVectorData(
|
|
|
104
104
|
for (let i = 0; i < data.dims.longitude; i++) {
|
|
105
105
|
for (let j = 0; j < data.dims.latitude; j++) {
|
|
106
106
|
for (let t = 0; t < data.dims.time; t++) {
|
|
107
|
-
let u = data.data_vars[variableU]
|
|
108
|
-
let v = data.data_vars[variableV]
|
|
107
|
+
let u = (data.data_vars[variableU] as number[][][])[i][j][t];
|
|
108
|
+
let v = (data.data_vars[variableV] as number[][][])[i][j][t];
|
|
109
109
|
if (u === -9999) u = NaN;
|
|
110
110
|
if (v === -9999) v = NaN;
|
|
111
111
|
result[t].data[p] = u;
|
|
@@ -136,8 +136,8 @@ export function extractMagnitudeData(
|
|
|
136
136
|
for (let i = 0; i < data.dims.longitude; i++) {
|
|
137
137
|
for (let j = 0; j < data.dims.latitude; j++) {
|
|
138
138
|
for (let t = 0; t < data.dims.time; t++) {
|
|
139
|
-
let u = data.data_vars[variableU]
|
|
140
|
-
let v = data.data_vars[variableV]
|
|
139
|
+
let u = (data.data_vars[variableU] as number[][][])[i][j][t];
|
|
140
|
+
let v = (data.data_vars[variableV] as number[][][])[i][j][t];
|
|
141
141
|
if (u === -9999) u = NaN;
|
|
142
142
|
if (v === -9999) v = NaN;
|
|
143
143
|
const value = Math.sqrt(u * u + v * v);
|
|
@@ -84,7 +84,7 @@ export function useGrid(option: GridOption): EChartsComponent {
|
|
|
84
84
|
id: gridId + "y",
|
|
85
85
|
type: option.yAxis?.type ?? "value",
|
|
86
86
|
gridId,
|
|
87
|
-
nameGap:
|
|
87
|
+
nameGap: 10,
|
|
88
88
|
...option.yAxis,
|
|
89
89
|
nameTextStyle: {
|
|
90
90
|
align: "left",
|
|
@@ -100,7 +100,7 @@ export function useGrid(option: GridOption): EChartsComponent {
|
|
|
100
100
|
yAxis: [yAxis],
|
|
101
101
|
series: option.series
|
|
102
102
|
?.flatMap((item) => item.series)
|
|
103
|
-
|
|
103
|
+
.map((series) => ({
|
|
104
104
|
...series,
|
|
105
105
|
coordinateSystem: "cartesian2d",
|
|
106
106
|
xAxisId,
|
|
@@ -113,7 +113,7 @@ const MINIMAL_GRID: GridPreset = (grid, xAxis, yAxis) => {
|
|
|
113
113
|
grid.top = 0;
|
|
114
114
|
xAxis.show = false;
|
|
115
115
|
if (
|
|
116
|
-
(xAxis.type === undefined && (xAxis as { data
|
|
116
|
+
(xAxis.type === undefined && (xAxis as { data?: [] }).data !== undefined) ||
|
|
117
117
|
xAxis.type === "category"
|
|
118
118
|
) {
|
|
119
119
|
(xAxis as { boundaryGap: boolean }).boundaryGap = false;
|
package/src/echarts/gl.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { FlowGLSeriesOption as OrigFlowGLSeriesOption } from "echarts";
|
|
1
2
|
import type {
|
|
2
3
|
ComponentOption,
|
|
3
4
|
SeriesOnCartesianOptionMixin,
|
|
4
5
|
SeriesOnGeoOptionMixin,
|
|
5
6
|
} from "echarts/types/src/util/types.js";
|
|
6
|
-
|
|
7
|
+
|
|
7
8
|
import "echarts-gl";
|
|
8
9
|
|
|
9
10
|
import type { EChartsSeries } from ".";
|
package/src/echarts/index.ts
CHANGED
|
@@ -57,6 +57,7 @@ export function buildEChartsOption(
|
|
|
57
57
|
for (const component of components) {
|
|
58
58
|
Object.entries(component).forEach(([k, value]) => {
|
|
59
59
|
const key = k as keyof EChartsComponent;
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
60
61
|
(option[key] ??= []).push(...(value ?? []));
|
|
61
62
|
});
|
|
62
63
|
}
|