@tsingroc/tsingroc-components 5.0.0-alpha.26 → 5.0.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/{AutoResizedECharts.d.ts → AutoResizedECharts/index.d.ts} +2 -2
- package/dist/components/{AutoResizedECharts.js → AutoResizedECharts/index.js} +2 -2
- package/dist/components/{Calendar.js → Calendar/index.js} +8 -8
- package/dist/components/{ConnectedECharts.d.ts → ConnectedECharts/index.d.ts} +2 -2
- package/dist/components/{ConnectedECharts.js → ConnectedECharts/index.js} +1 -1
- package/dist/components/ECharts/Wrapper.d.ts +5 -0
- package/dist/components/ECharts/Wrapper.js +16 -0
- package/dist/components/{ECharts.d.ts → ECharts/index.d.ts} +4 -1
- package/dist/components/{ECharts.js → ECharts/index.js} +2 -5
- package/dist/components/{Header.js → Header/index.js} +3 -3
- package/dist/components/{LeftAlignedECharts.d.ts → LeftAlignedECharts/index.d.ts} +2 -2
- package/dist/components/{LeftAlignedECharts.js → LeftAlignedECharts/index.js} +3 -3
- package/dist/components/{LineChartEditor.js → LineChartEditor/index.js} +3 -6
- package/dist/components/{LineChartTable.js → LineChartTable/index.js} +2 -2
- package/dist/components/{LinkedLineChart.d.ts → LinkedLineChart/index.d.ts} +1 -1
- package/dist/components/{LinkedLineChart.js → LinkedLineChart/index.js} +5 -2
- package/dist/components/{QuickDateRangePicker.js → QuickDateRangePicker/index.js} +6 -6
- package/dist/components/{SegmentedButtons.js → SegmentedButtons/index.js} +0 -2
- package/dist/components/{SelectableECharts.d.ts → SelectableECharts/index.d.ts} +11 -3
- package/dist/components/{SelectableECharts.js → SelectableECharts/index.js} +7 -4
- package/dist/components/{Sidebar.js → Sidebar/index.js} +3 -3
- package/dist/components/{TsingrocDatePicker.js → TsingrocDatePicker/index.js} +5 -5
- package/dist/components/{UserButton.js → UserButton/index.js} +3 -3
- package/dist/components/auth/AuthProvider.d.ts +39 -8
- package/dist/components/auth/AuthProvider.js +24 -1
- package/dist/components/auth/AuthService.d.ts +3 -0
- package/dist/components/auth/{CasdoorAuth.d.ts → CasdoorAuth/index.d.ts} +20 -3
- package/dist/components/auth/{CasdoorAuth.js → CasdoorAuth/index.js} +3 -3
- package/dist/components/auth/{EmbeddedAuth.d.ts → EmbeddedAuth/index.d.ts} +8 -3
- package/dist/components/auth/{EmbeddedAuth.js → EmbeddedAuth/index.js} +3 -3
- package/dist/components/auth/{LocalAuth.d.ts → LocalAuth/index.d.ts} +12 -3
- package/dist/components/auth/{LocalAuth.js → LocalAuth/index.js} +2 -2
- package/dist/components/auth/LoginCheck.d.ts +16 -0
- package/dist/components/auth/LoginCheck.js +5 -0
- package/dist/components/auth/SessionStore.d.ts +16 -4
- package/dist/components/auth/SessionStore.js +1 -1
- package/dist/components/auth/Wrappers.d.ts +37 -0
- package/dist/components/auth/Wrappers.js +68 -0
- package/dist/echarts/Wrappers.d.ts +34 -0
- package/dist/echarts/Wrappers.js +76 -0
- package/dist/echarts/coordinateSystems/Wrappers.d.ts +10 -0
- package/dist/echarts/coordinateSystems/Wrappers.js +31 -0
- package/dist/echarts/gl.js +3 -4
- package/dist/echarts/index.d.ts +1 -1
- package/dist/echarts/index.js +1 -1
- package/dist/echarts/series/Wrappers.d.ts +31 -0
- package/dist/echarts/series/Wrappers.js +102 -0
- package/dist/echarts/series/boxplotSeries.js +0 -2
- package/dist/echarts/series/intervalSeries.js +0 -1
- package/dist/echarts/series/maxBarSeries.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -2
- package/dist/utils/destructureLineDataItem.js +1 -2
- package/package.json +49 -42
- package/dist/components/VerticalColorLegend.d.ts +0 -7
- package/dist/components/VerticalColorLegend.js +0 -208
- package/dist/components/WeatherMap.d.ts +0 -18
- package/dist/components/WeatherMap.js +0 -658
- package/dist/deckgl/TiandituLayer.d.ts +0 -13
- package/dist/deckgl/TiandituLayer.js +0 -44
- package/dist/deckgl/WeatherData.d.ts +0 -53
- package/dist/deckgl/WeatherData.js +0 -94
- package/dist/deckgl/index.d.ts +0 -1
- package/dist/deckgl/index.js +0 -1
- /package/dist/components/{Calendar.d.ts → Calendar/index.d.ts} +0 -0
- /package/dist/components/{CircularProgress.d.ts → CircularProgress/index.d.ts} +0 -0
- /package/dist/components/{CircularProgress.js → CircularProgress/index.js} +0 -0
- /package/dist/components/{Header.d.ts → Header/index.d.ts} +0 -0
- /package/dist/components/{ImageBackground.d.ts → ImageBackground/index.d.ts} +0 -0
- /package/dist/components/{ImageBackground.js → ImageBackground/index.js} +0 -0
- /package/dist/components/{IndicatorLight.d.ts → IndicatorLight/index.d.ts} +0 -0
- /package/dist/components/{IndicatorLight.js → IndicatorLight/index.js} +0 -0
- /package/dist/components/{LineChartEditor.d.ts → LineChartEditor/index.d.ts} +0 -0
- /package/dist/components/{LineChartTable.d.ts → LineChartTable/index.d.ts} +0 -0
- /package/dist/components/{QuickDateRangePicker.d.ts → QuickDateRangePicker/index.d.ts} +0 -0
- /package/dist/components/{SegmentedButtons.d.ts → SegmentedButtons/index.d.ts} +0 -0
- /package/dist/components/{Sidebar.d.ts → Sidebar/index.d.ts} +0 -0
- /package/dist/components/{TsingrocDatePicker.d.ts → TsingrocDatePicker/index.d.ts} +0 -0
- /package/dist/components/{TsingrocTheme.d.ts → TsingrocTheme/index.d.ts} +0 -0
- /package/dist/components/{TsingrocTheme.js → TsingrocTheme/index.js} +0 -0
- /package/dist/components/{UserButton.d.ts → UserButton/index.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EChartsHOCType } from "
|
|
1
|
+
import type { EChartsHOCType } from "../ECharts";
|
|
2
2
|
/**
|
|
3
3
|
* 为 ECharts 增加自适应容器尺寸的能力。
|
|
4
4
|
*
|
|
@@ -15,5 +15,5 @@ export declare const withAutoResize: EChartsHOCType;
|
|
|
15
15
|
*
|
|
16
16
|
* @see {@linkcode withAutoResize}
|
|
17
17
|
*/
|
|
18
|
-
declare const AutoResizedECharts: import("
|
|
18
|
+
declare const AutoResizedECharts: import("../ECharts").EChartsComponentType<{}>;
|
|
19
19
|
export default AutoResizedECharts;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { useEffect, useImperativeHandle, useRef } from "react";
|
|
3
|
-
import { debugAssert } from "
|
|
4
|
-
import EChartsInstance from "
|
|
3
|
+
import { debugAssert } from "#src/utils/debug";
|
|
4
|
+
import EChartsInstance from "../ECharts";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* 为 ECharts 增加自适应容器尺寸的能力。
|
|
@@ -79,7 +79,7 @@ function Calendar(props) {
|
|
|
79
79
|
styles
|
|
80
80
|
} = useStyles();
|
|
81
81
|
const [selected, setSelected] = propsSelected === undefined
|
|
82
|
-
//
|
|
82
|
+
// oxlint-disable-next-line rules-of-hooks
|
|
83
83
|
? useState() : [propsSelected, () => {}];
|
|
84
84
|
const monthStart = month.startOf("month");
|
|
85
85
|
const calendarStart = monthStart.startOf("week");
|
|
@@ -105,13 +105,13 @@ function Calendar(props) {
|
|
|
105
105
|
children: Array.from({
|
|
106
106
|
length: alwaysSixWeeks ? 6 : minWeeks
|
|
107
107
|
}, (_, week) => /*#__PURE__*/_jsx("tr", {
|
|
108
|
-
children: Array(7).fill(null).map((
|
|
109
|
-
const date = calendarStart.add(week * 7 +
|
|
108
|
+
children: Array(7).fill(null).map((__0, weekday_0) => {
|
|
109
|
+
const date = calendarStart.add(week * 7 + weekday_0, "day");
|
|
110
110
|
const fade = fadeAdjacentDays && date.month() !== monthStart.month();
|
|
111
111
|
const isSelected = Math.floor(selected?.diff(date, "day", true) ?? NaN) === 0;
|
|
112
112
|
const {
|
|
113
|
-
className,
|
|
114
|
-
...
|
|
113
|
+
className: className_0,
|
|
114
|
+
...props_0
|
|
115
115
|
} = tdProps?.(date, false) ?? {};
|
|
116
116
|
return /*#__PURE__*/_jsx("td", {
|
|
117
117
|
// oxlint-disable-next-line react/no-children-prop
|
|
@@ -120,12 +120,12 @@ function Calendar(props) {
|
|
|
120
120
|
setSelected(date);
|
|
121
121
|
onChange?.(date);
|
|
122
122
|
},
|
|
123
|
-
...
|
|
123
|
+
...props_0,
|
|
124
124
|
className: cx({
|
|
125
125
|
[styles.calendarFade]: fade,
|
|
126
126
|
[styles.calendarSelected]: isSelected
|
|
127
|
-
},
|
|
128
|
-
},
|
|
127
|
+
}, className_0)
|
|
128
|
+
}, weekday_0);
|
|
129
129
|
})
|
|
130
130
|
}, week))
|
|
131
131
|
})]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type { EChartsHOCType } from "
|
|
2
|
+
import type { EChartsHOCType } from "../ECharts";
|
|
3
3
|
/**
|
|
4
4
|
* 为 {@linkcode ConnectedECharts}/{@linkcode withConnector | withConnector(ECharts)}
|
|
5
5
|
* 提供联动上下文,只有同一个上下文内的 ECharts 会联动。
|
|
@@ -22,7 +22,7 @@ export declare const withConnector: EChartsHOCType<{
|
|
|
22
22
|
* @see {@linkcode withConnector}
|
|
23
23
|
* @see {@linkcode withAutoResize}
|
|
24
24
|
*/
|
|
25
|
-
declare const ConnectedECharts: import("
|
|
25
|
+
declare const ConnectedECharts: import("../ECharts").EChartsComponentType<{
|
|
26
26
|
group?: string;
|
|
27
27
|
}>;
|
|
28
28
|
export default ConnectedECharts;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import * as echarts from "echarts/core";
|
|
3
3
|
import { createContext, use, useId } from "react";
|
|
4
|
-
import AutoResizedECharts from "
|
|
4
|
+
import AutoResizedECharts from "../AutoResizedECharts"; // oxlint-disable-line no-unused-vars
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
const EChartsConnectorContext = /*#__PURE__*/createContext("default");
|
|
7
7
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* ECharts 的 React 封装,支持 `theme`、`opts` 等初始化参数和 `option` 配置的响应式更新。
|
|
5
|
+
*/
|
|
6
|
+
export const EChartsWrapper = _props => {
|
|
7
|
+
const $ = _c(1);
|
|
8
|
+
let t0;
|
|
9
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
10
|
+
t0 = /*#__PURE__*/_jsx("a", {});
|
|
11
|
+
$[0] = t0;
|
|
12
|
+
} else {
|
|
13
|
+
t0 = $[0];
|
|
14
|
+
}
|
|
15
|
+
return t0;
|
|
16
|
+
};
|
|
@@ -9,7 +9,10 @@ export interface EChartsProps<Option extends EChartsCoreOption = EChartsOption>
|
|
|
9
9
|
* 实例上添加事件监听器或者执行其它的初始化操作,请使用 {@linkcode onInit}。
|
|
10
10
|
*/
|
|
11
11
|
ref?: Ref<EChartsRef>;
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* 主题。
|
|
14
|
+
* @default "default"
|
|
15
|
+
*/
|
|
13
16
|
theme?: string | Record<string, any> | null;
|
|
14
17
|
/**
|
|
15
18
|
* 初始化实例时的选项。
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-invalid-void-type */
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
2
|
import * as echarts from "echarts/core";
|
|
6
3
|
import { useEffect, useEffectEvent, useImperativeHandle, useRef } from "react";
|
|
7
|
-
import { debugAssert } from "
|
|
4
|
+
import { debugAssert } from "#src/utils/debug";
|
|
8
5
|
|
|
9
6
|
/** 用于 HOC 的返回值。 */
|
|
10
7
|
|
|
@@ -250,6 +247,6 @@ function useForwardEChartsRef(outerRef, innerRef) {
|
|
|
250
247
|
return innerRef.current.instance;
|
|
251
248
|
}
|
|
252
249
|
};
|
|
253
|
-
//
|
|
250
|
+
// oxlint-disable-next-line exhaustive-deps
|
|
254
251
|
}, []);
|
|
255
252
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { Flex, Layout, Menu, theme } from "antd";
|
|
3
|
-
import UserButton from "
|
|
4
|
-
//
|
|
5
|
-
//
|
|
3
|
+
import UserButton from "../UserButton";
|
|
4
|
+
// oxlint-disable-line no-unused-vars
|
|
5
|
+
// oxlint-disable-line no-unused-vars
|
|
6
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
7
|
/**
|
|
8
8
|
* 顶栏组件。该组件需要放置在 [Ant Design 的 `Layout` 组件][1]内部才能正常工作。
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type { EChartsHOCType } from "
|
|
2
|
+
import type { EChartsHOCType } from "../ECharts";
|
|
3
3
|
/**
|
|
4
4
|
* 为 {@linkcode LeftAlignedECharts} 和
|
|
5
5
|
* {@linkcode withLeftAlign | withLeftAlign(ECharts)}
|
|
@@ -34,7 +34,7 @@ export declare const withLeftAlign: EChartsHOCType;
|
|
|
34
34
|
* @see {@linkcode withConnector}
|
|
35
35
|
* @see {@linkcode withAutoResize}
|
|
36
36
|
*/
|
|
37
|
-
declare const LeftAlignedECharts: import("
|
|
37
|
+
declare const LeftAlignedECharts: import("../ECharts").EChartsComponentType<{
|
|
38
38
|
group?: string;
|
|
39
39
|
}>;
|
|
40
40
|
export default LeftAlignedECharts;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { createContext, use, useEffect, useEffectEvent, useId, useImperativeHandle, useRef, useState } from "react";
|
|
3
|
-
import { debugAssert } from "
|
|
4
|
-
//
|
|
5
|
-
import ConnectedECharts from "
|
|
3
|
+
import { debugAssert } from "#src/utils/debug";
|
|
4
|
+
// oxlint-disable-line no-unused-vars
|
|
5
|
+
import ConnectedECharts from "../ConnectedECharts"; // oxlint-disable-line no-unused-vars
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
const LeftAlignContext = /*#__PURE__*/createContext(null);
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Button, ConfigProvider, Flex, Input, Modal, Table, message, theme } from "antd";
|
|
2
2
|
import { createStyles } from "antd-style";
|
|
3
3
|
import { use, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
-
import * as echarts from "
|
|
5
|
-
import ECharts from "
|
|
4
|
+
import * as echarts from "#src/echarts";
|
|
5
|
+
import ECharts from "../ECharts";
|
|
6
6
|
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
7
|
/**
|
|
8
8
|
* 一个折线图编辑器,由折线图、数据表格和确认/撤销按钮三部分组成。
|
|
@@ -31,7 +31,6 @@ function LineChartEditor(props) {
|
|
|
31
31
|
adjustStep: defaultAdjustStep = 0.1,
|
|
32
32
|
...rest
|
|
33
33
|
} = props;
|
|
34
|
-
// TODO i18n
|
|
35
34
|
const unitString = yUnit !== undefined ? `(${yUnit})` : "";
|
|
36
35
|
const {
|
|
37
36
|
cx,
|
|
@@ -111,7 +110,6 @@ function LineChartEditor(props) {
|
|
|
111
110
|
left: "center",
|
|
112
111
|
top: 0,
|
|
113
112
|
style: {
|
|
114
|
-
// TODO i18n
|
|
115
113
|
text: !chartFocused ? "" : selectedIndex !== undefined ? "可使用键盘 ↑/↓/W/S 键调节选中数据,使用 +/- 键修改调节步长" : hoverIndex !== undefined ? "点击可选中当前数据点" : "",
|
|
116
114
|
fill: token.colorTextLabel
|
|
117
115
|
}
|
|
@@ -271,7 +269,6 @@ function LineChartEditor(props) {
|
|
|
271
269
|
}
|
|
272
270
|
let confirmed = true;
|
|
273
271
|
if (confirmPopup) {
|
|
274
|
-
// TODO i18n
|
|
275
272
|
confirmed = await modal.confirm({
|
|
276
273
|
title: "确定要保存修改吗?",
|
|
277
274
|
width: "fit-content",
|
|
@@ -392,7 +389,7 @@ function EditorCell({
|
|
|
392
389
|
...props
|
|
393
390
|
});
|
|
394
391
|
}
|
|
395
|
-
/*
|
|
392
|
+
/* oxlint-disable rules-of-hooks */
|
|
396
393
|
const {
|
|
397
394
|
styles
|
|
398
395
|
} = useStyles();
|
|
@@ -2,8 +2,8 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
2
2
|
import { ConfigProvider, Flex, Table, theme } from "antd";
|
|
3
3
|
import { createStyles } from "antd-style";
|
|
4
4
|
import { use, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
-
import * as echarts from "
|
|
6
|
-
import ECharts from "
|
|
5
|
+
import * as echarts from "#src/echarts";
|
|
6
|
+
import ECharts from "../ECharts";
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
const EMPTY = [];
|
|
9
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LineSeriesOption } from "echarts";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
|
-
import type { EChartsProps } from "
|
|
3
|
+
import type { EChartsProps } from "../ECharts";
|
|
4
4
|
export interface LineChartLinkProviderProps {
|
|
5
5
|
/** X 轴的数据。*/
|
|
6
6
|
xData: (string | number)[];
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { ConfigProvider, theme } from "antd";
|
|
3
|
+
import { DataZoomComponent } from "echarts/components";
|
|
4
|
+
import * as echartsCore from "echarts/core";
|
|
3
5
|
import { createContext, use } from "react";
|
|
4
|
-
import * as echarts from "
|
|
5
|
-
import ConnectedECharts, { EChartsConnector } from "
|
|
6
|
+
import * as echarts from "#src/echarts";
|
|
7
|
+
import ConnectedECharts, { EChartsConnector } from "../ConnectedECharts";
|
|
6
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
9
|
const LineChartLinkContext = /*#__PURE__*/createContext({
|
|
8
10
|
xData: [],
|
|
@@ -49,6 +51,7 @@ export function LineChartLinkProvider(props) {
|
|
|
49
51
|
*/
|
|
50
52
|
function LinkedLineChart(props) {
|
|
51
53
|
const $ = _c(10);
|
|
54
|
+
echartsCore.use(DataZoomComponent);
|
|
52
55
|
let rest;
|
|
53
56
|
let t0;
|
|
54
57
|
let t1;
|
|
@@ -28,11 +28,11 @@ function QuickDateRangePicker(props) {
|
|
|
28
28
|
...rest
|
|
29
29
|
} = props;
|
|
30
30
|
const [range, setRange] = value === undefined
|
|
31
|
-
//
|
|
31
|
+
// oxlint-disable-next-line rules-of-hooks
|
|
32
32
|
? useState(undefined) : [value, () => {}];
|
|
33
|
-
function quickPick(
|
|
33
|
+
function quickPick(value_0) {
|
|
34
34
|
const end = dayjs();
|
|
35
|
-
const start = end.subtract(
|
|
35
|
+
const start = end.subtract(value_0 - 1, "day");
|
|
36
36
|
const newRange = [start, end];
|
|
37
37
|
setRange(newRange);
|
|
38
38
|
onChange?.(newRange);
|
|
@@ -46,9 +46,9 @@ function QuickDateRangePicker(props) {
|
|
|
46
46
|
}, index)), /*#__PURE__*/_jsx(DatePicker.RangePicker, {
|
|
47
47
|
value: range,
|
|
48
48
|
allowClear: false,
|
|
49
|
-
onChange:
|
|
50
|
-
setRange(
|
|
51
|
-
onChange?.(
|
|
49
|
+
onChange: range_0 => {
|
|
50
|
+
setRange(range_0);
|
|
51
|
+
onChange?.(range_0); // 由于 allowClear=false,这里 range 不可能为 null
|
|
52
52
|
},
|
|
53
53
|
...pickerProps
|
|
54
54
|
})]
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { MarkAreaComponentOption } from "echarts";
|
|
2
2
|
import type { ZRStyleProps } from "echarts/types/src/util/types.js";
|
|
3
|
-
import { type EChartsHOCType } from "
|
|
3
|
+
import { type EChartsHOCType } from "../ECharts";
|
|
4
4
|
export interface SelectableEChartsProps {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* 编辑器的选中方式。
|
|
7
|
+
* @default "add"
|
|
8
|
+
*/
|
|
6
9
|
mode?: "add" | "subtract";
|
|
7
10
|
/** 可选中的系列名,若为 `undefined` 则均不可选中。(如果需要选中多个系列,可以嵌套多层 `withSelectable`) */
|
|
8
11
|
seriesName?: string;
|
|
9
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* 选中的数据点下标集合。
|
|
14
|
+
* @default new Set()
|
|
15
|
+
*/
|
|
10
16
|
selectedIndices?: Set<number>;
|
|
11
17
|
/** 选中区域变化时的回调。 */
|
|
12
18
|
onSelectedIndicesChange?: (selectedIndices: Set<number>) => void;
|
|
@@ -20,3 +26,5 @@ export interface SelectableEChartsProps {
|
|
|
20
26
|
markAreaStyle?: MarkAreaComponentOption["itemStyle"];
|
|
21
27
|
}
|
|
22
28
|
export declare const withSelectable: EChartsHOCType<SelectableEChartsProps>;
|
|
29
|
+
declare const SelectableECharts: import("../ECharts").EChartsComponentType<SelectableEChartsProps>;
|
|
30
|
+
export default SelectableECharts;
|
|
@@ -2,10 +2,11 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
2
2
|
import { GraphicComponent, MarkAreaComponent } from "echarts/components";
|
|
3
3
|
import * as echarts from "echarts/core";
|
|
4
4
|
import { useEffectEvent, useState } from "react";
|
|
5
|
-
import { debugAssert } from "
|
|
6
|
-
import { destructureLineDataItem } from "
|
|
7
|
-
import { normalizeIntoArray } from "
|
|
8
|
-
import "
|
|
5
|
+
import { debugAssert } from "#src/utils";
|
|
6
|
+
import { destructureLineDataItem } from "#src/utils/destructureLineDataItem";
|
|
7
|
+
import { normalizeIntoArray } from "#src/utils/normalizeIntoArray";
|
|
8
|
+
import AutoResizedECharts from "../AutoResizedECharts";
|
|
9
|
+
import "../ECharts";
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
11
|
const DEFAULT_SELECTED_INDICES = new Set();
|
|
11
12
|
const DEFAULT_SELECTION_BOX_STYLE = {
|
|
@@ -385,6 +386,8 @@ export const withSelectable = ECharts => function SelectableECharts(props) {
|
|
|
385
386
|
...rest
|
|
386
387
|
});
|
|
387
388
|
};
|
|
389
|
+
const SelectableECharts = withSelectable(AutoResizedECharts);
|
|
390
|
+
export default SelectableECharts;
|
|
388
391
|
function _temp(item, idx) {
|
|
389
392
|
return destructureLineDataItem(item, idx)?.[0][0];
|
|
390
393
|
}
|
|
@@ -2,9 +2,9 @@ import { BarChartOutlined, LeftOutlined, RightOutlined, SwapOutlined, TeamOutlin
|
|
|
2
2
|
import { Button, Flex, Layout, Menu } from "antd";
|
|
3
3
|
import { createStyles } from "antd-style";
|
|
4
4
|
import { useState } from "react";
|
|
5
|
-
import UserButton from "
|
|
6
|
-
//
|
|
7
|
-
//
|
|
5
|
+
import UserButton from "../UserButton";
|
|
6
|
+
// oxlint-disable-line no-unused-vars
|
|
7
|
+
// oxlint-disable-line no-unused-vars
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
9
|
const menuItem = (label, key, icon, children) => ({
|
|
10
10
|
key,
|
|
@@ -20,7 +20,7 @@ function TsingrocDatePicker(props) {
|
|
|
20
20
|
...rest
|
|
21
21
|
} = props;
|
|
22
22
|
const [dateValue, setDateValue] = value === undefined
|
|
23
|
-
//
|
|
23
|
+
// oxlint-disable-next-line rules-of-hooks
|
|
24
24
|
? useState(undefined) : [value, () => {}];
|
|
25
25
|
/**
|
|
26
26
|
* 快速增减一定时间,如果当前未选择日期则无效。
|
|
@@ -32,10 +32,10 @@ function TsingrocDatePicker(props) {
|
|
|
32
32
|
setDateValue(temp);
|
|
33
33
|
propsOnChange?.(temp);
|
|
34
34
|
};
|
|
35
|
-
const onChange =
|
|
36
|
-
if (!
|
|
37
|
-
setDateValue(
|
|
38
|
-
propsOnChange?.(
|
|
35
|
+
const onChange = value_0 => {
|
|
36
|
+
if (!value_0) return;
|
|
37
|
+
setDateValue(value_0);
|
|
38
|
+
propsOnChange?.(value_0);
|
|
39
39
|
};
|
|
40
40
|
return /*#__PURE__*/_jsxs(Space.Compact, {
|
|
41
41
|
...rest,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DownOutlined, LogoutOutlined, UpOutlined, UserOutlined } from "@ant-design/icons";
|
|
2
2
|
import { Avatar, Button, Dropdown, theme } from "antd";
|
|
3
3
|
import { useSyncExternalStore } from "react";
|
|
4
|
-
//
|
|
5
|
-
import { useSessionStoreInternal } from "
|
|
6
|
-
//
|
|
4
|
+
// oxlint-disable-line no-unused-vars
|
|
5
|
+
import { useSessionStoreInternal } from "../auth/AuthProvider";
|
|
6
|
+
// oxlint-disable-line no-unused-vars
|
|
7
7
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
/**
|
|
9
9
|
* 显示用户信息的按钮,点击弹出登出或跳转到账户页的菜单。
|
|
@@ -2,20 +2,48 @@ import { type ReactNode } from "react";
|
|
|
2
2
|
import type { AuthService } from "./AuthService";
|
|
3
3
|
import { SessionStore, type Session, type SessionStoreOptions } from "./SessionStore";
|
|
4
4
|
export type AuthProviderProps = TokenBasedAuthProviderProps | GenericAuthProviderProps;
|
|
5
|
-
export interface
|
|
6
|
-
|
|
5
|
+
export interface CommonAuthProviderProps extends SessionStoreOptions {
|
|
6
|
+
/** 要使用的 `AuthService` 实现。 */
|
|
7
|
+
service: AuthService<unknown, unknown>;
|
|
8
|
+
/**
|
|
9
|
+
* 是否添加 fetcher 中间件。
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
7
12
|
fetcherMiddleware?: boolean;
|
|
8
13
|
children: ReactNode;
|
|
9
14
|
}
|
|
10
|
-
export interface
|
|
11
|
-
service: AuthService<
|
|
12
|
-
|
|
15
|
+
export interface TokenBasedAuthProviderProps extends CommonAuthProviderProps {
|
|
16
|
+
service: AuthService<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
export interface GenericAuthProviderProps extends CommonAuthProviderProps {
|
|
13
19
|
persistent: false;
|
|
14
|
-
children: ReactNode;
|
|
15
20
|
}
|
|
16
21
|
/**
|
|
17
22
|
* 为内部的组件提供鉴权服务。{@linkcode useSessionStore} 和 {@linkcode useSession},
|
|
18
|
-
* 还有很多其它 hooks
|
|
23
|
+
* 还有很多其它 hooks 和组件都只能在这个组件的内部使用。你应该把这个组件包裹在项目的整个 React 组件树的顶层。
|
|
24
|
+
*
|
|
25
|
+
* 如果项目用到了多个鉴权机制,那么应该为不同的路由创建不同的 AuthProvider,并使用不同的 key 来强制 React 重新创建组件的实例。下面以 `@nanostores/router` 为例:
|
|
26
|
+
*
|
|
27
|
+
* ```tsx
|
|
28
|
+
* const router = useStore($router);
|
|
29
|
+
*
|
|
30
|
+
* // 在 AuthProvider 内部,页面的 UI 实现完全不需要改变即可自动兼容两种鉴权机制
|
|
31
|
+
* const inner = <LoginCheck><XxxPage /></LoginCheck>;
|
|
32
|
+
*
|
|
33
|
+
* if (router.route === "embedded") {
|
|
34
|
+
* return (
|
|
35
|
+
* <AuthProvider key="embedded" service={embeddedAuthService}>
|
|
36
|
+
* {inner}
|
|
37
|
+
* </AuthProvider>
|
|
38
|
+
* );
|
|
39
|
+
* } else {
|
|
40
|
+
* return (
|
|
41
|
+
* <AuthProvider key="casdoor" service={casdoorAuthService}>
|
|
42
|
+
* {inner}
|
|
43
|
+
* </AuthProvider>
|
|
44
|
+
* );
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
19
47
|
*/
|
|
20
48
|
export declare function AuthProvider(props: AuthProviderProps): ReactNode;
|
|
21
49
|
export declare function useSessionStoreInternal(user: string): SessionStore;
|
|
@@ -24,7 +52,10 @@ export declare const useSessionStore: () => SessionStore;
|
|
|
24
52
|
export declare function useSessionInternal(user: string, allowNull?: false): Session;
|
|
25
53
|
export declare function useSessionInternal(user: string, allowNull: true): Session | null;
|
|
26
54
|
export interface UseSessionOptions {
|
|
27
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* 当未登录或已登出时是否抛出异常。
|
|
57
|
+
* @default true
|
|
58
|
+
*/
|
|
28
59
|
allowNull?: boolean;
|
|
29
60
|
}
|
|
30
61
|
export interface UseSessionNonNullableOptions extends UseSessionOptions {
|
|
@@ -6,7 +6,30 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
6
6
|
const AuthContext = /*#__PURE__*/createContext(null);
|
|
7
7
|
/**
|
|
8
8
|
* 为内部的组件提供鉴权服务。{@linkcode useSessionStore} 和 {@linkcode useSession},
|
|
9
|
-
* 还有很多其它 hooks
|
|
9
|
+
* 还有很多其它 hooks 和组件都只能在这个组件的内部使用。你应该把这个组件包裹在项目的整个 React 组件树的顶层。
|
|
10
|
+
*
|
|
11
|
+
* 如果项目用到了多个鉴权机制,那么应该为不同的路由创建不同的 AuthProvider,并使用不同的 key 来强制 React 重新创建组件的实例。下面以 `@nanostores/router` 为例:
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const router = useStore($router);
|
|
15
|
+
*
|
|
16
|
+
* // 在 AuthProvider 内部,页面的 UI 实现完全不需要改变即可自动兼容两种鉴权机制
|
|
17
|
+
* const inner = <LoginCheck><XxxPage /></LoginCheck>;
|
|
18
|
+
*
|
|
19
|
+
* if (router.route === "embedded") {
|
|
20
|
+
* return (
|
|
21
|
+
* <AuthProvider key="embedded" service={embeddedAuthService}>
|
|
22
|
+
* {inner}
|
|
23
|
+
* </AuthProvider>
|
|
24
|
+
* );
|
|
25
|
+
* } else {
|
|
26
|
+
* return (
|
|
27
|
+
* <AuthProvider key="casdoor" service={casdoorAuthService}>
|
|
28
|
+
* {inner}
|
|
29
|
+
* </AuthProvider>
|
|
30
|
+
* );
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
10
33
|
*/
|
|
11
34
|
export function AuthProvider(props) {
|
|
12
35
|
const $ = _c(14);
|
|
@@ -3,6 +3,9 @@ import type { Fetcher } from "./Fetcher";
|
|
|
3
3
|
* 鉴权操作的抽象接口。
|
|
4
4
|
*
|
|
5
5
|
* 对于实现者来说,需要注意实现该接口的类自身不应该保存会话状态。
|
|
6
|
+
*
|
|
7
|
+
* @template State 会话状态的类型。只有 State 为 string 的实现才能被 SessionStore 自动持久化。
|
|
8
|
+
* @template RawUserInfo 用户信息的类型。
|
|
6
9
|
*/
|
|
7
10
|
export interface AuthService<State = unknown, RawUserInfo = unknown> {
|
|
8
11
|
/**
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import type { SdkConfig } from "casdoor-js-sdk/lib/esm/sdk";
|
|
2
2
|
import { type JwtPayload } from "jwt-decode";
|
|
3
3
|
import { type ReactNode } from "react";
|
|
4
|
-
import type { AuthService, UserInfo } from "
|
|
5
|
-
import { fetcherWithBearerToken } from "
|
|
4
|
+
import type { AuthService, UserInfo } from "../AuthService";
|
|
5
|
+
import { fetcherWithBearerToken } from "../Fetcher";
|
|
6
6
|
export interface CasdoorAuthServiceOptions {
|
|
7
|
+
/** 传递给 `casdoor-js-sdk` 的配置。 */
|
|
7
8
|
config: SdkConfig;
|
|
9
|
+
/**
|
|
10
|
+
* 登录接口的 origin。
|
|
11
|
+
* @default location.origin
|
|
12
|
+
*/
|
|
8
13
|
signinOrigin?: string;
|
|
9
|
-
|
|
14
|
+
/**
|
|
15
|
+
* 登录接口的路径。
|
|
16
|
+
* @default "/api/signin"
|
|
17
|
+
*/
|
|
18
|
+
signinPath?: string;
|
|
10
19
|
}
|
|
11
20
|
/**
|
|
12
21
|
* 基于 Casdoor 的鉴权服务。该鉴权服务的登录流程如下:
|
|
@@ -130,9 +139,13 @@ export interface CasdoorUserInfo {
|
|
|
130
139
|
roles: string[];
|
|
131
140
|
}
|
|
132
141
|
export interface CasdoorCallbackProps {
|
|
142
|
+
/** 登录成功时的回调。 */
|
|
133
143
|
onSuccess?: () => void;
|
|
144
|
+
/** 登录失败时的回调。 */
|
|
134
145
|
onError?: (err: unknown) => void;
|
|
146
|
+
/** 成功时显示的内容。 */
|
|
135
147
|
success?: ReactNode;
|
|
148
|
+
/** 失败时显示的内容。 */
|
|
136
149
|
error?: ReactNode;
|
|
137
150
|
/**
|
|
138
151
|
* 跳转前显示的内容。
|
|
@@ -143,9 +156,13 @@ export interface CasdoorCallbackProps {
|
|
|
143
156
|
/** Casdoor 回调组件。请将该组件放置在 {@linkcode CasdoorAuthService} 中设定的回调路径上。 */
|
|
144
157
|
export declare function CasdoorCallback(props: CasdoorCallbackProps): ReactNode;
|
|
145
158
|
export interface CasdoorRoleCheckProps {
|
|
159
|
+
/** 限制只有特定角色的用户才能访问内部的组件。 */
|
|
146
160
|
required: string[];
|
|
161
|
+
/** 限制特定角色的用户禁止访问内部的组件。 */
|
|
147
162
|
forbidden?: string[];
|
|
163
|
+
/** 当用户被禁止访问时显示的内容。 */
|
|
148
164
|
error?: ReactNode;
|
|
165
|
+
/** 用户被允许访问时正常显示的内容。 */
|
|
149
166
|
children: ReactNode;
|
|
150
167
|
}
|
|
151
168
|
/** 检查 Casdoor 用户的角色(role),限制只有特定角色的用户才能访问内部的组件。 */
|
|
@@ -2,10 +2,10 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
2
2
|
import Sdk from "casdoor-js-sdk";
|
|
3
3
|
import { jwtDecode } from "jwt-decode";
|
|
4
4
|
import { useEffect, useEffectEvent, useRef, useState, useSyncExternalStore } from "react";
|
|
5
|
-
import { useSessionStoreInternal } from "
|
|
5
|
+
import { useSessionStoreInternal } from "../AuthProvider"; // oxlint-disable-line no-unused-vars
|
|
6
6
|
|
|
7
|
-
import { EmbeddedAuthService } from "
|
|
8
|
-
import { fetcherWithBearerToken } from "
|
|
7
|
+
import { EmbeddedAuthService } from "../EmbeddedAuth";
|
|
8
|
+
import { fetcherWithBearerToken } from "../Fetcher";
|
|
9
9
|
// oxlint-disable-line no-unused-vars
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { SdkConfig } from "casdoor-js-sdk/lib/esm/sdk";
|
|
2
2
|
import { type IframeHTMLAttributes, type ReactNode, type RefAttributes } from "react";
|
|
3
|
-
import type { AuthService, UserInfo } from "
|
|
4
|
-
import { type CasdoorTokenPayload, type CasdoorUserInfo } from "
|
|
5
|
-
import { fetcherWithBearerToken } from "
|
|
3
|
+
import type { AuthService, UserInfo } from "../AuthService";
|
|
4
|
+
import { type CasdoorTokenPayload, type CasdoorUserInfo } from "../CasdoorAuth";
|
|
5
|
+
import { fetcherWithBearerToken } from "../Fetcher";
|
|
6
6
|
export interface EmbeddedAuthServiceOptions {
|
|
7
|
+
/** 传递给 `casdoor-js-sdk` 的配置,必须与父页面的配置相同。 */
|
|
7
8
|
config: SdkConfig;
|
|
9
|
+
/**
|
|
10
|
+
* 等待父页面提供 token 的超时时间。
|
|
11
|
+
* @default 5000
|
|
12
|
+
*/
|
|
8
13
|
timeout?: number;
|
|
9
14
|
}
|
|
10
15
|
/**
|
|
@@ -2,10 +2,10 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
2
2
|
import Sdk from "casdoor-js-sdk";
|
|
3
3
|
import { jwtDecode } from "jwt-decode";
|
|
4
4
|
import { useEffectEvent, useSyncExternalStore } from "react";
|
|
5
|
-
import { useSessionStoreInternal } from "
|
|
5
|
+
import { useSessionStoreInternal } from "../AuthProvider"; // oxlint-disable-line no-unused-vars
|
|
6
6
|
|
|
7
|
-
import { CasdoorAuthService } from "
|
|
8
|
-
import { fetcherWithBearerToken } from "
|
|
7
|
+
import { CasdoorAuthService } from "../CasdoorAuth";
|
|
8
|
+
import { fetcherWithBearerToken } from "../Fetcher";
|
|
9
9
|
// oxlint-disable-line no-unused-vars
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
/**
|