@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.
- package/dist/components/Auth.d.ts +310 -0
- package/dist/components/Auth.js +267 -0
- package/dist/components/AutoResizedECharts.d.ts +21 -0
- package/dist/components/AutoResizedECharts.js +98 -0
- package/dist/components/Calendar.d.ts +50 -0
- package/dist/components/Calendar.js +130 -0
- package/dist/components/CircularProgress.d.ts +21 -0
- package/dist/components/CircularProgress.js +34 -0
- package/dist/components/ConnectedECharts.d.ts +31 -0
- package/dist/components/ConnectedECharts.js +100 -0
- package/dist/components/ECharts.d.ts +57 -0
- package/dist/components/ECharts.js +255 -0
- package/dist/components/Header.d.ts +67 -0
- package/dist/components/Header.js +171 -0
- package/dist/components/ImageBackground.d.ts +32 -0
- package/dist/components/ImageBackground.js +76 -0
- package/dist/components/IndicatorLight.d.ts +44 -0
- package/dist/components/IndicatorLight.js +124 -0
- package/dist/components/LeftAlignedECharts.d.ts +42 -0
- package/dist/components/LeftAlignedECharts.js +270 -0
- package/dist/components/LineChartEditor.d.ts +74 -0
- package/dist/components/LineChartEditor.js +458 -0
- package/dist/components/LineChartTable.d.ts +38 -0
- package/dist/components/LineChartTable.js +245 -0
- package/dist/components/LinkedLineChart.d.ts +45 -0
- package/dist/components/LinkedLineChart.js +159 -0
- package/dist/components/QuickDateRangePicker.d.ts +30 -0
- package/dist/components/QuickDateRangePicker.js +58 -0
- package/dist/components/SegmentedButtons.d.ts +22 -0
- package/dist/components/SegmentedButtons.js +86 -0
- package/dist/components/SelectableECharts.d.ts +22 -0
- package/dist/components/SelectableECharts.js +402 -0
- package/dist/components/Sidebar.d.ts +79 -0
- package/dist/components/Sidebar.js +178 -0
- package/dist/components/TsingrocDatePicker.d.ts +38 -0
- package/dist/components/TsingrocDatePicker.js +64 -0
- package/dist/components/TsingrocTheme.d.ts +15 -0
- package/dist/components/TsingrocTheme.js +72 -0
- package/dist/components/UserButton.d.ts +42 -0
- package/dist/components/UserButton.js +105 -0
- package/dist/components/VerticalColorLegend.d.ts +7 -0
- package/dist/components/VerticalColorLegend.js +208 -0
- package/dist/components/WeatherMap.d.ts +18 -0
- package/dist/components/WeatherMap.js +658 -0
- package/dist/deckgl/TiandituLayer.d.ts +13 -0
- package/dist/deckgl/TiandituLayer.js +44 -0
- package/dist/deckgl/WeatherData.d.ts +53 -0
- package/dist/deckgl/WeatherData.js +94 -0
- package/dist/deckgl/index.d.ts +1 -0
- package/dist/deckgl/index.js +1 -0
- package/dist/echarts/coordinateSystems/grid.d.ts +43 -0
- package/dist/echarts/coordinateSystems/grid.js +108 -0
- package/dist/echarts/coordinateSystems/index.js +2 -0
- package/dist/echarts/coordinateSystems/polar.d.ts +45 -0
- package/dist/echarts/coordinateSystems/polar.js +96 -0
- package/dist/echarts/gl-types.d.js +0 -0
- package/dist/echarts/gl.d.ts +115 -0
- package/dist/echarts/gl.js +47 -0
- package/dist/echarts/index.d.ts +46 -0
- package/dist/echarts/index.js +46 -0
- package/dist/echarts/legend.d.ts +17 -0
- package/dist/echarts/legend.js +15 -0
- package/dist/echarts/radar.d.ts +24 -0
- package/dist/echarts/radar.js +22 -0
- package/dist/echarts/series/barSeries.d.ts +23 -0
- package/dist/echarts/series/barSeries.js +18 -0
- package/dist/echarts/series/boxplotSeries.d.ts +21 -0
- package/dist/echarts/series/boxplotSeries.js +40 -0
- package/dist/echarts/series/index.js +7 -0
- package/dist/echarts/series/intervalSeries.d.ts +32 -0
- package/dist/echarts/series/intervalSeries.js +55 -0
- package/dist/echarts/series/lineSeries.d.ts +36 -0
- package/dist/echarts/series/lineSeries.js +45 -0
- package/dist/echarts/series/maxBarSeries.d.ts +18 -0
- package/dist/echarts/series/maxBarSeries.js +39 -0
- package/dist/echarts/series/pieSeries.d.ts +31 -0
- package/dist/echarts/series/pieSeries.js +47 -0
- package/dist/echarts/series/windLineSeries.d.ts +47 -0
- package/dist/echarts/series/windLineSeries.js +51 -0
- package/{src/echarts/tooltip.ts → dist/echarts/tooltip.d.ts} +1 -5
- package/dist/echarts/tooltip.js +22 -0
- package/dist/env.d.js +0 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +21 -0
- package/dist/utils/debug.d.ts +1 -0
- package/dist/utils/debug.js +25 -0
- package/dist/utils/destructureLineDataItem.d.ts +6 -0
- package/dist/utils/destructureLineDataItem.js +17 -0
- package/dist/utils/filterMap.d.ts +1 -0
- package/dist/utils/filterMap.js +11 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/math.d.ts +9 -0
- package/{src/utils/math.ts → dist/utils/math.js} +2 -2
- package/dist/utils/mock.d.ts +8 -0
- package/dist/utils/mock.js +40 -0
- package/dist/utils/normalizeIntoArray.d.ts +1 -0
- package/dist/utils/normalizeIntoArray.js +3 -0
- package/dist/utils/startOfQuarter.d.ts +2 -0
- package/dist/utils/startOfQuarter.js +4 -0
- package/dist/utils/timeAxisLabel.d.ts +5 -0
- package/dist/utils/timeAxisLabel.js +18 -0
- package/package.json +26 -14
- package/src/components/Auth.tsx +0 -623
- package/src/components/AutoResizedECharts.tsx +0 -70
- package/src/components/Calendar.tsx +0 -182
- package/src/components/CircularProgress.tsx +0 -38
- package/src/components/ConnectedECharts.tsx +0 -62
- package/src/components/ECharts.tsx +0 -206
- package/src/components/Header.tsx +0 -136
- package/src/components/ImageBackground.tsx +0 -58
- package/src/components/IndicatorLight.tsx +0 -106
- package/src/components/LeftAlignedECharts.tsx +0 -190
- package/src/components/LineChartEditor.tsx +0 -558
- package/src/components/LineChartTable.tsx +0 -286
- package/src/components/LinkedECharts.tsx +0 -51
- package/src/components/LinkedLineChart.tsx +0 -144
- package/src/components/QuickDateRangePicker.tsx +0 -84
- package/src/components/SegmentedButtons.tsx +0 -46
- package/src/components/Sidebar.tsx +0 -271
- package/src/components/StrictECharts.d.ts +0 -47
- package/src/components/StrictECharts.js +0 -1
- package/src/components/TsingrocDatePicker.tsx +0 -103
- package/src/components/TsingrocTheme.tsx +0 -48
- package/src/components/UserButton.tsx +0 -165
- package/src/components/VerticalColorLegend.tsx +0 -73
- package/src/components/WeatherMap.tsx +0 -522
- package/src/deckgl/TiandituLayer.ts +0 -56
- package/src/deckgl/WeatherData.ts +0 -157
- package/src/deckgl/index.ts +0 -4
- package/src/echarts/coordinateSystems/grid.ts +0 -143
- package/src/echarts/coordinateSystems/polar.ts +0 -148
- package/src/echarts/gl.ts +0 -159
- package/src/echarts/index.ts +0 -129
- package/src/echarts/legend.ts +0 -36
- package/src/echarts/radar.ts +0 -46
- package/src/echarts/series/barSeries.ts +0 -37
- package/src/echarts/series/boxplotSeries.ts +0 -62
- package/src/echarts/series/intervalSeries.ts +0 -70
- package/src/echarts/series/lineSeries.ts +0 -78
- package/src/echarts/series/maxBarSeries.ts +0 -55
- package/src/echarts/series/pieSeries.ts +0 -76
- package/src/echarts/series/windLineSeries.ts +0 -113
- package/src/index.ts +0 -120
- package/src/types.d.ts +0 -5
- package/src/utils/debug.ts +0 -39
- package/src/utils/mock.ts +0 -69
- package/src/utils/startOfQuarter.ts +0 -6
- /package/{src/echarts/coordinateSystems/index.ts → dist/echarts/coordinateSystems/index.d.ts} +0 -0
- /package/{src/echarts/series/index.ts → dist/echarts/series/index.d.ts} +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Button, DatePicker, Space } from "antd";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { LeftOutlined, RightOutlined } from "@ant-design/icons";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
/**
|
|
6
|
+
* 支持快速跳转的日/周/月/年选择器。
|
|
7
|
+
*
|
|
8
|
+
* 除了文档中列出的属性外,该组件会将其它属性传递给 [Ant Design 的 `Space.Compact` 组件][1]。
|
|
9
|
+
*
|
|
10
|
+
* [1]: https://ant-design.antgroup.com/components/space-cn#spacecompact
|
|
11
|
+
*/
|
|
12
|
+
function TsingrocDatePicker(props) {
|
|
13
|
+
const {
|
|
14
|
+
value,
|
|
15
|
+
onChange: propsOnChange,
|
|
16
|
+
dataType = "month",
|
|
17
|
+
disabled,
|
|
18
|
+
buttonProps,
|
|
19
|
+
pickerProps,
|
|
20
|
+
...rest
|
|
21
|
+
} = props;
|
|
22
|
+
const [dateValue, setDateValue] = value === undefined ?
|
|
23
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
24
|
+
useState(undefined) : [value, () => {}];
|
|
25
|
+
/**
|
|
26
|
+
* 快速增减一定时间,如果当前未选择日期则无效。
|
|
27
|
+
* @param delta 增减的时间量,按传入的时间单位 `dataType` 计算
|
|
28
|
+
*/
|
|
29
|
+
const quickSwitch = delta => {
|
|
30
|
+
if (!dateValue) return;
|
|
31
|
+
const temp = dateValue.add(delta, dataType);
|
|
32
|
+
setDateValue(temp);
|
|
33
|
+
propsOnChange?.(temp);
|
|
34
|
+
};
|
|
35
|
+
const onChange = value => {
|
|
36
|
+
setDateValue(value);
|
|
37
|
+
propsOnChange?.(value);
|
|
38
|
+
};
|
|
39
|
+
return /*#__PURE__*/_jsxs(Space.Compact, {
|
|
40
|
+
...rest,
|
|
41
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
42
|
+
onClick: () => quickSwitch(-1),
|
|
43
|
+
icon: /*#__PURE__*/_jsx(LeftOutlined, {}),
|
|
44
|
+
disabled: disabled,
|
|
45
|
+
className: props.className,
|
|
46
|
+
...buttonProps
|
|
47
|
+
}), /*#__PURE__*/_jsx(DatePicker, {
|
|
48
|
+
picker: dataType == "day" ? "date" : dataType,
|
|
49
|
+
value: dateValue,
|
|
50
|
+
onChange: onChange,
|
|
51
|
+
disabled: disabled,
|
|
52
|
+
className: props.className,
|
|
53
|
+
...pickerProps
|
|
54
|
+
}), /*#__PURE__*/_jsx(Button
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-conversion
|
|
56
|
+
, {
|
|
57
|
+
onClick: () => quickSwitch(+1),
|
|
58
|
+
icon: /*#__PURE__*/_jsx(RightOutlined, {}),
|
|
59
|
+
disabled: disabled,
|
|
60
|
+
...buttonProps
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export default TsingrocDatePicker;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface TsingrocThemeProps {
|
|
3
|
+
/** 是否开启黑暗模式。*/
|
|
4
|
+
dark?: boolean;
|
|
5
|
+
/** 是否开启紧凑模式。*/
|
|
6
|
+
compact?: boolean;
|
|
7
|
+
/** 主题覆盖的页面内容。*/
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 清鹏智能的公共 Ant Design 主题,会影响内部的所有 Ant Design 组件的样式。
|
|
12
|
+
* 请将该组件放置在整个 React 项目的顶层。
|
|
13
|
+
*/
|
|
14
|
+
declare function TsingrocTheme(props: TsingrocThemeProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default TsingrocTheme;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { ConfigProvider, theme } from "antd";
|
|
3
|
+
import antdZhCN from "antd/es/locale/zh_CN";
|
|
4
|
+
import dayjs from "dayjs";
|
|
5
|
+
import dayjsZhCN from "dayjs/locale/zh-cn";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
/**
|
|
8
|
+
* 清鹏智能的公共 Ant Design 主题,会影响内部的所有 Ant Design 组件的样式。
|
|
9
|
+
* 请将该组件放置在整个 React 项目的顶层。
|
|
10
|
+
*/
|
|
11
|
+
function TsingrocTheme(props) {
|
|
12
|
+
const $ = _c(11);
|
|
13
|
+
dayjs.locale(dayjsZhCN);
|
|
14
|
+
let algorithm;
|
|
15
|
+
if ($[0] !== props.compact || $[1] !== props.dark) {
|
|
16
|
+
algorithm = [];
|
|
17
|
+
if (props.compact) {
|
|
18
|
+
algorithm.push(theme.compactAlgorithm);
|
|
19
|
+
}
|
|
20
|
+
if (props.dark) {
|
|
21
|
+
algorithm.push(theme.darkAlgorithm);
|
|
22
|
+
}
|
|
23
|
+
$[0] = props.compact;
|
|
24
|
+
$[1] = props.dark;
|
|
25
|
+
$[2] = algorithm;
|
|
26
|
+
} else {
|
|
27
|
+
algorithm = $[2];
|
|
28
|
+
}
|
|
29
|
+
let t0;
|
|
30
|
+
if ($[3] !== props.dark) {
|
|
31
|
+
t0 = props.dark ? {
|
|
32
|
+
colorPrimary: "#9b5efd",
|
|
33
|
+
colorInfo: "#9b5efd",
|
|
34
|
+
colorSuccess: "#1ac489"
|
|
35
|
+
} : {
|
|
36
|
+
colorPrimary: "#5200d7",
|
|
37
|
+
colorInfo: "#5200d7",
|
|
38
|
+
colorSuccess: "#1ac489"
|
|
39
|
+
};
|
|
40
|
+
$[3] = props.dark;
|
|
41
|
+
$[4] = t0;
|
|
42
|
+
} else {
|
|
43
|
+
t0 = $[4];
|
|
44
|
+
}
|
|
45
|
+
let t1;
|
|
46
|
+
if ($[5] !== algorithm || $[6] !== t0) {
|
|
47
|
+
t1 = {
|
|
48
|
+
algorithm,
|
|
49
|
+
token: t0
|
|
50
|
+
};
|
|
51
|
+
$[5] = algorithm;
|
|
52
|
+
$[6] = t0;
|
|
53
|
+
$[7] = t1;
|
|
54
|
+
} else {
|
|
55
|
+
t1 = $[7];
|
|
56
|
+
}
|
|
57
|
+
let t2;
|
|
58
|
+
if ($[8] !== props.children || $[9] !== t1) {
|
|
59
|
+
t2 = /*#__PURE__*/_jsx(ConfigProvider, {
|
|
60
|
+
locale: antdZhCN,
|
|
61
|
+
theme: t1,
|
|
62
|
+
children: props.children
|
|
63
|
+
});
|
|
64
|
+
$[8] = props.children;
|
|
65
|
+
$[9] = t1;
|
|
66
|
+
$[10] = t2;
|
|
67
|
+
} else {
|
|
68
|
+
t2 = $[10];
|
|
69
|
+
}
|
|
70
|
+
return t2;
|
|
71
|
+
}
|
|
72
|
+
export default TsingrocTheme;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ButtonProps, type DropdownProps } from "antd";
|
|
2
|
+
export interface UserButtonProps extends ButtonProps {
|
|
3
|
+
/**
|
|
4
|
+
* 是否显示为缩小形态(只显示头像)。
|
|
5
|
+
* @default false
|
|
6
|
+
*/
|
|
7
|
+
compact?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* 使用边栏布局还是顶栏布局。
|
|
10
|
+
* @default "sidebar"
|
|
11
|
+
*/
|
|
12
|
+
layout?: "sidebar" | "header";
|
|
13
|
+
/** 点击“账户”时的操作。若省略,默认通过 Casdoor SDK 获取用户主页链接并跳转。*/
|
|
14
|
+
onOpenProfile?: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* 点击“登出”时的操作。默认先登出,然后跳转到主页。
|
|
17
|
+
*
|
|
18
|
+
* @default
|
|
19
|
+
* () => {
|
|
20
|
+
* auth.logout(); // auth = useAuth()
|
|
21
|
+
* location.href = "/";
|
|
22
|
+
* }
|
|
23
|
+
*/
|
|
24
|
+
onLogout?: () => void;
|
|
25
|
+
/**
|
|
26
|
+
* 下拉菜单的属性,见 [Ant Design 文档][1]。你可以在这里覆盖弹出菜单的内容和样式。
|
|
27
|
+
*
|
|
28
|
+
* [1]: https://ant-design.antgroup.com/components/dropdown-cn
|
|
29
|
+
*/
|
|
30
|
+
dropdownProps?: DropdownProps;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 显示用户信息的按钮,点击弹出登出或跳转到账户页的菜单。
|
|
34
|
+
* 该组件必须包裹在 {@linkcode AuthProvider} 内,并且经过 {@linkcode AuthCheck} 验证后,
|
|
35
|
+
* 才能正常显示用户信息,否则只会显示占位数据。
|
|
36
|
+
*
|
|
37
|
+
* 除了文档中列出的属性以外,该组件会把额外的属性传递给内部的 [`Button`][1] 组件。
|
|
38
|
+
*
|
|
39
|
+
* [1]: https://ant-design.antgroup.com/components/button-cn
|
|
40
|
+
*/
|
|
41
|
+
declare function UserButton(props: UserButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export default UserButton;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Avatar, Button, Dropdown, theme } from "antd";
|
|
2
|
+
import { DownOutlined, LogoutOutlined, UpOutlined, UserOutlined } from "@ant-design/icons";
|
|
3
|
+
import { AuthCheck,
|
|
4
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
|
+
AuthProvider,
|
|
6
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
7
|
+
useAuth } from "./Auth";
|
|
8
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
/**
|
|
10
|
+
* 显示用户信息的按钮,点击弹出登出或跳转到账户页的菜单。
|
|
11
|
+
* 该组件必须包裹在 {@linkcode AuthProvider} 内,并且经过 {@linkcode AuthCheck} 验证后,
|
|
12
|
+
* 才能正常显示用户信息,否则只会显示占位数据。
|
|
13
|
+
*
|
|
14
|
+
* 除了文档中列出的属性以外,该组件会把额外的属性传递给内部的 [`Button`][1] 组件。
|
|
15
|
+
*
|
|
16
|
+
* [1]: https://ant-design.antgroup.com/components/button-cn
|
|
17
|
+
*/
|
|
18
|
+
function UserButton(props) {
|
|
19
|
+
const {
|
|
20
|
+
token
|
|
21
|
+
} = theme.useToken();
|
|
22
|
+
const auth = useAuth("UserButton");
|
|
23
|
+
const {
|
|
24
|
+
compact,
|
|
25
|
+
layout = "sidebar",
|
|
26
|
+
onOpenProfile = auth.mode === "casdoor" ? () => {
|
|
27
|
+
const account = auth.accessToken === undefined ? undefined : {
|
|
28
|
+
accessToken: auth.accessToken
|
|
29
|
+
};
|
|
30
|
+
location.href = auth.sdk.getMyProfileUrl(account, location.href);
|
|
31
|
+
} : undefined,
|
|
32
|
+
onLogout = () => {
|
|
33
|
+
auth.logout();
|
|
34
|
+
location.href = "/";
|
|
35
|
+
},
|
|
36
|
+
dropdownProps,
|
|
37
|
+
...rest
|
|
38
|
+
} = props;
|
|
39
|
+
return /*#__PURE__*/_jsx(Dropdown, {
|
|
40
|
+
trigger: ["click"],
|
|
41
|
+
placement: layout === "sidebar" ? "topLeft" : "bottomRight",
|
|
42
|
+
...dropdownProps,
|
|
43
|
+
menu: {
|
|
44
|
+
items: [onOpenProfile ? {
|
|
45
|
+
key: "profile",
|
|
46
|
+
label: /*#__PURE__*/_jsx(_Fragment, {
|
|
47
|
+
children: "\u8D26\u6237"
|
|
48
|
+
}),
|
|
49
|
+
// 如果使用字符串,在缩小时会被裁剪,即使宽度足够
|
|
50
|
+
icon: /*#__PURE__*/_jsx(UserOutlined, {}),
|
|
51
|
+
title: "",
|
|
52
|
+
// 若不设置,在缩小时总是会显示工具提示,即使宽度足够
|
|
53
|
+
onClick: onOpenProfile
|
|
54
|
+
} : null, {
|
|
55
|
+
key: "logout",
|
|
56
|
+
icon: /*#__PURE__*/_jsx(LogoutOutlined, {}),
|
|
57
|
+
label: /*#__PURE__*/_jsx(_Fragment, {
|
|
58
|
+
children: "\u9000\u51FA\u767B\u5F55"
|
|
59
|
+
}),
|
|
60
|
+
title: "",
|
|
61
|
+
onClick: onLogout
|
|
62
|
+
}],
|
|
63
|
+
...dropdownProps?.menu,
|
|
64
|
+
style: {
|
|
65
|
+
minWidth: "100%",
|
|
66
|
+
...dropdownProps?.menu?.style
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
70
|
+
type: "text",
|
|
71
|
+
icon: /*#__PURE__*/_jsx(Avatar, {
|
|
72
|
+
alt: "\u5934\u50CF",
|
|
73
|
+
src: auth.mode === "casdoor" ? auth.userInfo?.picture : undefined,
|
|
74
|
+
icon: /*#__PURE__*/_jsx(UserOutlined, {})
|
|
75
|
+
}),
|
|
76
|
+
...rest,
|
|
77
|
+
styles: {
|
|
78
|
+
icon: {
|
|
79
|
+
display: "inline-flex",
|
|
80
|
+
alignItems: "center",
|
|
81
|
+
...rest.styles?.icon
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
style: {
|
|
85
|
+
margin: token.marginXXS,
|
|
86
|
+
...(layout === "sidebar" ? {
|
|
87
|
+
width: "auto",
|
|
88
|
+
padding: token.paddingXXS
|
|
89
|
+
} : {
|
|
90
|
+
paddingBlock: token.padding + token.paddingXS
|
|
91
|
+
}),
|
|
92
|
+
...rest.style
|
|
93
|
+
},
|
|
94
|
+
children: !compact && /*#__PURE__*/_jsxs(_Fragment, {
|
|
95
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
96
|
+
style: {
|
|
97
|
+
marginRight: token.marginXXS
|
|
98
|
+
},
|
|
99
|
+
children: (auth.mode === "casdoor" ? auth.userInfo?.name ?? auth.userInfo?.prefered_username : auth.userInfo?.displayName ?? auth.userInfo?.username) ?? "平台用户"
|
|
100
|
+
}), layout === "sidebar" ? /*#__PURE__*/_jsx(UpOutlined, {}) : /*#__PURE__*/_jsx(DownOutlined, {})]
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export default UserButton;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
export interface VerticalColorLegendProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
title?: string;
|
|
4
|
+
palette: [number, [number, number, number]][];
|
|
5
|
+
}
|
|
6
|
+
declare function VerticalColorLegend(props: VerticalColorLegendProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default VerticalColorLegend;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { theme } from "antd";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
function VerticalColorLegend(props) {
|
|
5
|
+
const $ = _c(43);
|
|
6
|
+
let palette;
|
|
7
|
+
let rest;
|
|
8
|
+
let title;
|
|
9
|
+
if ($[0] !== props) {
|
|
10
|
+
({
|
|
11
|
+
title,
|
|
12
|
+
palette,
|
|
13
|
+
...rest
|
|
14
|
+
} = props);
|
|
15
|
+
$[0] = props;
|
|
16
|
+
$[1] = palette;
|
|
17
|
+
$[2] = rest;
|
|
18
|
+
$[3] = title;
|
|
19
|
+
} else {
|
|
20
|
+
palette = $[1];
|
|
21
|
+
rest = $[2];
|
|
22
|
+
title = $[3];
|
|
23
|
+
}
|
|
24
|
+
const {
|
|
25
|
+
token
|
|
26
|
+
} = theme.useToken();
|
|
27
|
+
let t0;
|
|
28
|
+
if ($[4] !== palette) {
|
|
29
|
+
t0 = palette.at(-1);
|
|
30
|
+
$[4] = palette;
|
|
31
|
+
$[5] = t0;
|
|
32
|
+
} else {
|
|
33
|
+
t0 = $[5];
|
|
34
|
+
}
|
|
35
|
+
const max = t0[0];
|
|
36
|
+
const min = palette[0][0];
|
|
37
|
+
const range = max - min;
|
|
38
|
+
let t1;
|
|
39
|
+
if ($[6] !== rest.style || $[7] !== token.colorText || $[8] !== token.fontSizeSM) {
|
|
40
|
+
t1 = {
|
|
41
|
+
display: "flex",
|
|
42
|
+
flexDirection: "column",
|
|
43
|
+
userSelect: "none",
|
|
44
|
+
fontSize: token.fontSizeSM,
|
|
45
|
+
color: token.colorText,
|
|
46
|
+
textShadow: "-1px -1px white, 0px -1px white, 1px -1px white, 1px 0px white, 1px 1px white, 0px 1px white, -1px 1px white, -1px 0px white",
|
|
47
|
+
...rest.style
|
|
48
|
+
};
|
|
49
|
+
$[6] = rest.style;
|
|
50
|
+
$[7] = token.colorText;
|
|
51
|
+
$[8] = token.fontSizeSM;
|
|
52
|
+
$[9] = t1;
|
|
53
|
+
} else {
|
|
54
|
+
t1 = $[9];
|
|
55
|
+
}
|
|
56
|
+
let t2;
|
|
57
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
58
|
+
t2 = {
|
|
59
|
+
fontWeight: "bold"
|
|
60
|
+
};
|
|
61
|
+
$[10] = t2;
|
|
62
|
+
} else {
|
|
63
|
+
t2 = $[10];
|
|
64
|
+
}
|
|
65
|
+
let t3;
|
|
66
|
+
if ($[11] !== title) {
|
|
67
|
+
t3 = /*#__PURE__*/_jsx("div", {
|
|
68
|
+
style: t2,
|
|
69
|
+
children: title
|
|
70
|
+
});
|
|
71
|
+
$[11] = title;
|
|
72
|
+
$[12] = t3;
|
|
73
|
+
} else {
|
|
74
|
+
t3 = $[12];
|
|
75
|
+
}
|
|
76
|
+
let t4;
|
|
77
|
+
if ($[13] !== token.paddingXXS) {
|
|
78
|
+
t4 = {
|
|
79
|
+
display: "flex",
|
|
80
|
+
flexBasis: "100%",
|
|
81
|
+
alignItems: "stretch",
|
|
82
|
+
gap: token.paddingXXS,
|
|
83
|
+
paddingBlock: "0.5em"
|
|
84
|
+
};
|
|
85
|
+
$[13] = token.paddingXXS;
|
|
86
|
+
$[14] = t4;
|
|
87
|
+
} else {
|
|
88
|
+
t4 = $[14];
|
|
89
|
+
}
|
|
90
|
+
let t5;
|
|
91
|
+
if ($[15] !== min || $[16] !== palette || $[17] !== range) {
|
|
92
|
+
let t6;
|
|
93
|
+
if ($[19] !== min || $[20] !== range) {
|
|
94
|
+
t6 = t7 => {
|
|
95
|
+
const [value, color] = t7;
|
|
96
|
+
return `rgb(${color.join(", ")}) ${(value - min) / range * 100}%`;
|
|
97
|
+
};
|
|
98
|
+
$[19] = min;
|
|
99
|
+
$[20] = range;
|
|
100
|
+
$[21] = t6;
|
|
101
|
+
} else {
|
|
102
|
+
t6 = $[21];
|
|
103
|
+
}
|
|
104
|
+
t5 = palette.map(t6).join(", ");
|
|
105
|
+
$[15] = min;
|
|
106
|
+
$[16] = palette;
|
|
107
|
+
$[17] = range;
|
|
108
|
+
$[18] = t5;
|
|
109
|
+
} else {
|
|
110
|
+
t5 = $[18];
|
|
111
|
+
}
|
|
112
|
+
const t6 = `linear-gradient(
|
|
113
|
+
to top,
|
|
114
|
+
${t5}
|
|
115
|
+
)`;
|
|
116
|
+
let t7;
|
|
117
|
+
if ($[22] !== t6) {
|
|
118
|
+
t7 = /*#__PURE__*/_jsx("div", {
|
|
119
|
+
style: {
|
|
120
|
+
width: 24,
|
|
121
|
+
background: t6
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
$[22] = t6;
|
|
125
|
+
$[23] = t7;
|
|
126
|
+
} else {
|
|
127
|
+
t7 = $[23];
|
|
128
|
+
}
|
|
129
|
+
let t8;
|
|
130
|
+
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
131
|
+
t8 = {
|
|
132
|
+
lineHeight: 0,
|
|
133
|
+
verticalAlign: "middle"
|
|
134
|
+
};
|
|
135
|
+
$[24] = t8;
|
|
136
|
+
} else {
|
|
137
|
+
t8 = $[24];
|
|
138
|
+
}
|
|
139
|
+
let t9;
|
|
140
|
+
if ($[25] !== max || $[26] !== palette || $[27] !== range) {
|
|
141
|
+
let t10;
|
|
142
|
+
if ($[29] !== max || $[30] !== range) {
|
|
143
|
+
t10 = (t11, i) => {
|
|
144
|
+
const [value_0] = t11;
|
|
145
|
+
return /*#__PURE__*/_jsx("div", {
|
|
146
|
+
style: {
|
|
147
|
+
position: "relative",
|
|
148
|
+
top: `${(max - value_0) / range * 100}%`
|
|
149
|
+
},
|
|
150
|
+
children: value_0.toFixed(1)
|
|
151
|
+
}, i);
|
|
152
|
+
};
|
|
153
|
+
$[29] = max;
|
|
154
|
+
$[30] = range;
|
|
155
|
+
$[31] = t10;
|
|
156
|
+
} else {
|
|
157
|
+
t10 = $[31];
|
|
158
|
+
}
|
|
159
|
+
t9 = palette.map(t10);
|
|
160
|
+
$[25] = max;
|
|
161
|
+
$[26] = palette;
|
|
162
|
+
$[27] = range;
|
|
163
|
+
$[28] = t9;
|
|
164
|
+
} else {
|
|
165
|
+
t9 = $[28];
|
|
166
|
+
}
|
|
167
|
+
let t10;
|
|
168
|
+
if ($[32] !== t9) {
|
|
169
|
+
t10 = /*#__PURE__*/_jsx("div", {
|
|
170
|
+
style: t8,
|
|
171
|
+
children: t9
|
|
172
|
+
});
|
|
173
|
+
$[32] = t9;
|
|
174
|
+
$[33] = t10;
|
|
175
|
+
} else {
|
|
176
|
+
t10 = $[33];
|
|
177
|
+
}
|
|
178
|
+
let t11;
|
|
179
|
+
if ($[34] !== t10 || $[35] !== t4 || $[36] !== t7) {
|
|
180
|
+
t11 = /*#__PURE__*/_jsxs("div", {
|
|
181
|
+
style: t4,
|
|
182
|
+
children: [t7, t10]
|
|
183
|
+
});
|
|
184
|
+
$[34] = t10;
|
|
185
|
+
$[35] = t4;
|
|
186
|
+
$[36] = t7;
|
|
187
|
+
$[37] = t11;
|
|
188
|
+
} else {
|
|
189
|
+
t11 = $[37];
|
|
190
|
+
}
|
|
191
|
+
let t12;
|
|
192
|
+
if ($[38] !== rest || $[39] !== t1 || $[40] !== t11 || $[41] !== t3) {
|
|
193
|
+
t12 = /*#__PURE__*/_jsxs("div", {
|
|
194
|
+
...rest,
|
|
195
|
+
style: t1,
|
|
196
|
+
children: [t3, t11]
|
|
197
|
+
});
|
|
198
|
+
$[38] = rest;
|
|
199
|
+
$[39] = t1;
|
|
200
|
+
$[40] = t11;
|
|
201
|
+
$[41] = t3;
|
|
202
|
+
$[42] = t12;
|
|
203
|
+
} else {
|
|
204
|
+
t12 = $[42];
|
|
205
|
+
}
|
|
206
|
+
return t12;
|
|
207
|
+
}
|
|
208
|
+
export default VerticalColorLegend;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type HTMLAttributes } from "react";
|
|
2
|
+
import { type WeatherData } from "../deckgl/WeatherData";
|
|
3
|
+
export { type WeatherData };
|
|
4
|
+
export interface WeatherMapProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** 天地图平台的 token。*/
|
|
6
|
+
tiandituTk: string;
|
|
7
|
+
/** 要显示的天气数据。如果为 `undefined`,则会显示加载界面。*/
|
|
8
|
+
data: WeatherData | undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 一张显示各类天气信息的地图。
|
|
12
|
+
*
|
|
13
|
+
* 多余的属性会被传递给组件最外层的 [`div` 元素][1]。
|
|
14
|
+
*
|
|
15
|
+
* [1]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div
|
|
16
|
+
*/
|
|
17
|
+
declare function WeatherMap(props: WeatherMapProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export default WeatherMap;
|