@tsingroc/tsingroc-components 4.3.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 +3 -3
- 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 +16 -2
- 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 +4 -4
- 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,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
|
}
|