@gadmin2n/schematics 0.0.72 → 0.0.74
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/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/prisma/job.prisma +62 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/prisma/system.prisma +0 -21
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/prisma/workflow.prisma +171 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/AgendaJob.ts +60 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/Event.ts +1 -1
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/WorkflowEventOutbox.ts +62 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/WorkflowNodeInstance.ts +62 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/WorkflowNodeType.ts +62 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/.env +5 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/package.json +5 -4
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/prisma.config.ts +14 -7
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/index.ts +4 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/permissions.ts +49 -3
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/workflow-node-types.ts +746 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/workflows.ts +786 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/agenda/agenda.controller.ts +6 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/agenda/agenda.service.ts +79 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/agendaJob/agendaJob.controller.spec.ts +20 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/agendaJob/agendaJob.controller.ts +145 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/agendaJob/agendaJob.module.ts +10 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/{canvas/canvas.service.spec.ts → agendaJob/agendaJob.service.spec.ts} +71 -65
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/agendaJob/agendaJob.service.ts +83 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/index.ts +2 -1
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/temporal.module.ts +9 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/temporal.service.ts +100 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow-execution.dto.ts +19 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow-export.dto.ts +43 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow-export.service.ts +317 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow-node-type.controller.ts +16 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow-node-type.service.ts +13 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow.controller.ts +220 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow.dto.ts +82 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow.module.ts +16 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow.service.ts +505 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowEventOutbox/workflowEventOutbox.controller.spec.ts +22 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowEventOutbox/workflowEventOutbox.controller.ts +147 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowEventOutbox/workflowEventOutbox.module.ts +10 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowEventOutbox/workflowEventOutbox.service.spec.ts +356 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowEventOutbox/workflowEventOutbox.service.ts +110 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowNodeInstance/workflowNodeInstance.controller.spec.ts +22 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowNodeInstance/workflowNodeInstance.controller.ts +216 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowNodeInstance/workflowNodeInstance.module.ts +10 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowNodeInstance/workflowNodeInstance.service.spec.ts +356 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowNodeInstance/workflowNodeInstance.service.ts +168 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowNodeType/workflowNodeType.controller.spec.ts +22 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowNodeType/workflowNodeType.controller.ts +199 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowNodeType/workflowNodeType.module.ts +10 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowNodeType/workflowNodeType.service.spec.ts +348 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowNodeType/workflowNodeType.service.ts +106 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/yarn.lock +579 -1082
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/README.md +278 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/config/development-sql.yaml +5 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/docker-compose.yml +25 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/package.json +13 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/sql/create-event-trigger.sql +87 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/.env +7 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/SANDBOX.md +122 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/package-lock.json +4285 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/package.json +28 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/__tests__/activities/code-execute.test.ts +44 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/__tests__/activities/http-request.test.ts +87 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/__tests__/helpers.test.ts +225 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/__tests__/node-type-consistency.test.ts +101 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/activities/code-execute.ts +51 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/activities/db-execute.ts +85 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/activities/db-query.ts +35 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/activities/http-request.ts +54 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/activities/index.ts +6 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/activities/reporting.ts +62 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/activities/send-notification.ts +47 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/config.ts +13 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/dsl/condition.ts +101 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/dsl/context.ts +58 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/dsl/graph.ts +184 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/dsl/helpers.ts +133 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/dsl/node-types.ts +57 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/dsl/types.ts +77 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/index.ts +36 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/outbox-poller.ts +226 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/workflows/dsl-workflow.ts +411 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/tsconfig.json +19 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/vitest.config.ts +8 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/yarn.lock +1905 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/package-lock.json +17555 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/package.json +5 -2
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/App.tsx +1 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/sider.tsx +5 -1
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/title.tsx +1 -1
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/config/routeRegistry.tsx +63 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/dev-shell/DevShell.tsx +91 -2
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/list.tsx +48 -2
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/show.tsx +43 -2
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/locales/en/common.json +14 -9
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/locales/zh_CN/common.json +14 -9
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/agenda/index.tsx +309 -56
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/agenda/show.tsx +1 -3
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/agendaJob/create.tsx +108 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/agendaJob/edit.tsx +124 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/agendaJob/index.tsx +4 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/agendaJob/list.tsx +245 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/agendaJob/show.tsx +70 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/CanvasListPage.tsx +0 -1
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/CanvasPage.tsx +160 -2
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/CanvasToolbar.tsx +120 -148
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/CodeFloatWindow.tsx +74 -181
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/LivePreview.tsx +15 -13
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/canvasConfigRegistry.tsx +2 -2
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/canvasContextMenuRegistry.tsx +338 -3
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/canvasDefaults.ts +18 -17
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/BarChartDataSourceModal.tsx +10 -4
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/LineChartDataSourceModal.tsx +10 -4
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/{ChartViewerConfigModal.tsx → MultiChartConfigModal.tsx} +30 -18
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/MultiChartDataSourceModal.tsx +427 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/NumCardDataSourceModal.tsx +10 -4
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/PromptModal.tsx +6 -14
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/RadarChartDataSourceModal.tsx +10 -4
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/TableDataSourceModal.tsx +10 -4
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/canvasModalProps.ts +24 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/demos.ts +45 -63
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/CustomNode.tsx +99 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/ExportModal.tsx +87 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/FlowRenderer.tsx +322 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/ImportModal.tsx +175 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/NodeEditModal.tsx +60 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/NodePropertyPanel.tsx +1150 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/RunWorkflowModal.tsx +101 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/StatusCards.tsx +198 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/VersionPanel.tsx +81 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/editor.tsx +566 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/hooks/useWorkflowAgent.ts +224 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/index.tsx +524 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/instance-detail.tsx +343 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/instances.tsx +243 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/components/CreateNodeInstanceModal.tsx +363 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/components/DynamicConfigForm.tsx +154 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/components/NodeInstanceForm.tsx +176 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/create.tsx +77 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/edit.tsx +112 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/index.tsx +305 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/show.tsx +282 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/show.tsx +469 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/types.ts +92 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflowEventOutbox/create.tsx +111 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflowEventOutbox/edit.tsx +127 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflowEventOutbox/index.tsx +4 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflowEventOutbox/list.tsx +254 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflowEventOutbox/show.tsx +74 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/yarn.lock +1501 -1199
- package/package.json +1 -1
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/app.controller.spec.ts +0 -22
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/BarChart/index.tsx +0 -896
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/ChartSwitcher/index.tsx +0 -219
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/ChartViewer/index.tsx +0 -159
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/Filter/index.tsx +0 -192
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/LineChart/index.tsx +0 -1034
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/NumCard/NumCard.module.css +0 -8
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/NumCard/index.tsx +0 -509
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/NumLineCard/index.tsx +0 -66
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/PieChart/index.tsx +0 -552
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/RadarChart/index.tsx +0 -263
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/Section/index.tsx +0 -35
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/Table/index.tsx +0 -207
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/TreemapChart/index.tsx +0 -382
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/WorldMap/index.tsx +0 -135
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/chart-constants.ts +0 -53
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/icon/InfoIcon.tsx +0 -8
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/icon/index.ts +0 -1
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/map/config.ts +0 -31
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/map/nameMap.json +0 -9
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/map/world.geo.json +0 -39349
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/metric-info-tooltip/index.tsx +0 -19
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import { Spin, Empty } from 'antd';
|
|
3
|
-
import * as echarts from 'echarts';
|
|
4
|
-
import { useECharts } from '@/hooks/useECharts';
|
|
5
|
-
import { LEGEND_BASE } from '../chart-constants';
|
|
6
|
-
|
|
7
|
-
// ─── Types ────────────────────────────────────────────────────────────────────
|
|
8
|
-
|
|
9
|
-
/** 单个雷达图系列(一个实体,如一个 BG、一个员工) */
|
|
10
|
-
export interface RadarSeriesItem {
|
|
11
|
-
/** 系列名称,显示在 legend 和 tooltip 中 */
|
|
12
|
-
name: string;
|
|
13
|
-
/** 各维度的值(与 indicators 顺序一一对应) */
|
|
14
|
-
data: number[];
|
|
15
|
-
/** 自定义颜色,不传则使用 ECharts 默认色板 */
|
|
16
|
-
color?: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/** 雷达图维度定义(对应多边形的各顶点) */
|
|
20
|
-
export interface RadarIndicator {
|
|
21
|
-
/** 维度名称 */
|
|
22
|
-
name: string;
|
|
23
|
-
/** 最大值,默认 100 */
|
|
24
|
-
max?: number;
|
|
25
|
-
/** 最小值,默认 0 */
|
|
26
|
-
min?: number;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface RadarChartProps {
|
|
30
|
-
/** 维度指标列表(对应多边形的各顶点),**必填** */
|
|
31
|
-
indicators: RadarIndicator[];
|
|
32
|
-
/** 数据系列,支持多个系列叠加对比,**必填** */
|
|
33
|
-
series: RadarSeriesItem[];
|
|
34
|
-
/**
|
|
35
|
-
* 图表标题,渲染在图表上方。
|
|
36
|
-
* - 字符串:套默认样式(居中、12px、bold、#515151)
|
|
37
|
-
* - ReactNode:直接渲染,样式由调用方控制
|
|
38
|
-
* height 只指图表区域高度,标题额外占空间。
|
|
39
|
-
*/
|
|
40
|
-
title?: React.ReactNode;
|
|
41
|
-
/** 图表容器高度,默认 300。推荐传数字,弹性布局才用字符串 */
|
|
42
|
-
height?: number | string;
|
|
43
|
-
/**
|
|
44
|
-
* 是否显示图例,默认 true。
|
|
45
|
-
* 单系列时建议传 `legendShow={false}`
|
|
46
|
-
*/
|
|
47
|
-
legendShow?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* 透传至 ECharts option 的配置,与基准配置浅合并。
|
|
50
|
-
* 支持字段:`radar`(形状/半径/分割等)、`legend`、`tooltip`
|
|
51
|
-
*/
|
|
52
|
-
chartProps?: Record<string, any>;
|
|
53
|
-
loading?: boolean;
|
|
54
|
-
/** 强制显示空态。未传时组件根据 series.length === 0 自动判断 */
|
|
55
|
-
empty?: boolean;
|
|
56
|
-
style?: React.CSSProperties;
|
|
57
|
-
className?: string;
|
|
58
|
-
/** 渲染为 data-testid,**必须填写** */
|
|
59
|
-
testId: string;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// ─── Option Builder ───────────────────────────────────────────────────────────
|
|
63
|
-
|
|
64
|
-
function buildRadarOption(
|
|
65
|
-
indicators: RadarIndicator[],
|
|
66
|
-
series: RadarSeriesItem[],
|
|
67
|
-
legendShow: boolean,
|
|
68
|
-
chartProps: Record<string, any>,
|
|
69
|
-
): echarts.EChartsOption {
|
|
70
|
-
const {
|
|
71
|
-
radar = {},
|
|
72
|
-
legend = {},
|
|
73
|
-
tooltip = {},
|
|
74
|
-
...restChartProps
|
|
75
|
-
} = chartProps;
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
tooltip: {
|
|
79
|
-
trigger: 'item',
|
|
80
|
-
formatter: (params: any) => {
|
|
81
|
-
const { name, value } = params;
|
|
82
|
-
const rows = indicators
|
|
83
|
-
.map((ind, i) => `<div>${ind.name}:${value[i] ?? '-'}</div>`)
|
|
84
|
-
.join('');
|
|
85
|
-
return `<div style="font-weight:bold;margin-bottom:4px">${name}</div>${rows}`;
|
|
86
|
-
},
|
|
87
|
-
...tooltip,
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
legend: legendShow
|
|
91
|
-
? {
|
|
92
|
-
...LEGEND_BASE,
|
|
93
|
-
data: series.map((s) => s.name),
|
|
94
|
-
textStyle: { fontSize: 11 },
|
|
95
|
-
...legend,
|
|
96
|
-
}
|
|
97
|
-
: { show: false },
|
|
98
|
-
|
|
99
|
-
radar: {
|
|
100
|
-
indicator: indicators.map((ind) => ({
|
|
101
|
-
name: ind.name,
|
|
102
|
-
max: ind.max ?? 100,
|
|
103
|
-
min: ind.min ?? 0,
|
|
104
|
-
})),
|
|
105
|
-
shape: 'polygon',
|
|
106
|
-
center: ['50%', legendShow ? '48%' : '50%'],
|
|
107
|
-
radius: '65%',
|
|
108
|
-
axisName: { fontSize: 11, color: '#515151' },
|
|
109
|
-
splitNumber: 4,
|
|
110
|
-
splitArea: {
|
|
111
|
-
areaStyle: {
|
|
112
|
-
color: [
|
|
113
|
-
'rgba(56,137,243,0.04)',
|
|
114
|
-
'rgba(56,137,243,0.08)',
|
|
115
|
-
'rgba(56,137,243,0.04)',
|
|
116
|
-
'rgba(56,137,243,0.08)',
|
|
117
|
-
],
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
axisLine: { lineStyle: { color: '#ddd' } },
|
|
121
|
-
splitLine: { lineStyle: { color: '#ddd' } },
|
|
122
|
-
...radar,
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
series: [
|
|
126
|
-
{
|
|
127
|
-
type: 'radar',
|
|
128
|
-
data: series.map((s) => ({
|
|
129
|
-
name: s.name,
|
|
130
|
-
value: s.data,
|
|
131
|
-
...(s.color
|
|
132
|
-
? {
|
|
133
|
-
lineStyle: { color: s.color },
|
|
134
|
-
itemStyle: { color: s.color },
|
|
135
|
-
areaStyle: { color: s.color, opacity: 0.15 },
|
|
136
|
-
}
|
|
137
|
-
: { areaStyle: { opacity: 0.15 } }),
|
|
138
|
-
})),
|
|
139
|
-
symbol: 'circle',
|
|
140
|
-
symbolSize: 5,
|
|
141
|
-
lineStyle: { width: 2 },
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
|
|
145
|
-
...restChartProps,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// ─── Component ────────────────────────────────────────────────────────────────
|
|
150
|
-
|
|
151
|
-
export const RadarChart: React.FC<RadarChartProps> = ({
|
|
152
|
-
indicators,
|
|
153
|
-
series,
|
|
154
|
-
title,
|
|
155
|
-
height = 300,
|
|
156
|
-
legendShow = true,
|
|
157
|
-
chartProps = {},
|
|
158
|
-
loading = false,
|
|
159
|
-
empty,
|
|
160
|
-
style,
|
|
161
|
-
className,
|
|
162
|
-
testId,
|
|
163
|
-
}) => {
|
|
164
|
-
const option = useMemo(
|
|
165
|
-
() => buildRadarOption(indicators, series, legendShow, chartProps),
|
|
166
|
-
[indicators, series, legendShow, chartProps],
|
|
167
|
-
);
|
|
168
|
-
|
|
169
|
-
const { domRef } = useECharts({ option });
|
|
170
|
-
|
|
171
|
-
const isEmpty =
|
|
172
|
-
empty !== undefined
|
|
173
|
-
? empty
|
|
174
|
-
: series.length === 0 || series.every((s) => s.data.length === 0);
|
|
175
|
-
|
|
176
|
-
const titleNode = title ? (
|
|
177
|
-
typeof title === 'string' ? (
|
|
178
|
-
<div
|
|
179
|
-
style={{
|
|
180
|
-
textAlign: 'center',
|
|
181
|
-
fontSize: 13,
|
|
182
|
-
fontWeight: 'bold',
|
|
183
|
-
color: '#515151',
|
|
184
|
-
marginTop: 12,
|
|
185
|
-
marginBottom: 4,
|
|
186
|
-
}}
|
|
187
|
-
>
|
|
188
|
-
{title}
|
|
189
|
-
</div>
|
|
190
|
-
) : (
|
|
191
|
-
title
|
|
192
|
-
)
|
|
193
|
-
) : null;
|
|
194
|
-
|
|
195
|
-
return (
|
|
196
|
-
<div
|
|
197
|
-
className={className}
|
|
198
|
-
style={{
|
|
199
|
-
width: '100%',
|
|
200
|
-
position: 'relative',
|
|
201
|
-
...(titleNode
|
|
202
|
-
? {
|
|
203
|
-
display: 'flex',
|
|
204
|
-
flexDirection: 'column',
|
|
205
|
-
height: typeof height === 'number' ? `${height}px` : height,
|
|
206
|
-
}
|
|
207
|
-
: {}),
|
|
208
|
-
...style,
|
|
209
|
-
}}
|
|
210
|
-
data-testid={testId}
|
|
211
|
-
>
|
|
212
|
-
{titleNode}
|
|
213
|
-
<div
|
|
214
|
-
style={{
|
|
215
|
-
width: '100%',
|
|
216
|
-
...(titleNode
|
|
217
|
-
? { flex: 1, minHeight: 0 }
|
|
218
|
-
: { height: typeof height === 'number' ? `${height}px` : height }),
|
|
219
|
-
position: 'relative',
|
|
220
|
-
}}
|
|
221
|
-
>
|
|
222
|
-
<Spin
|
|
223
|
-
spinning={loading}
|
|
224
|
-
size="large"
|
|
225
|
-
style={{ width: '100%', height: '100%', display: 'block' }}
|
|
226
|
-
>
|
|
227
|
-
{isEmpty ? (
|
|
228
|
-
<div
|
|
229
|
-
style={{
|
|
230
|
-
height: '100%',
|
|
231
|
-
display: 'flex',
|
|
232
|
-
alignItems: 'center',
|
|
233
|
-
justifyContent: 'center',
|
|
234
|
-
}}
|
|
235
|
-
>
|
|
236
|
-
<Empty
|
|
237
|
-
description="No Data"
|
|
238
|
-
styles={{
|
|
239
|
-
image: { height: 45 },
|
|
240
|
-
description: { fontSize: 12 },
|
|
241
|
-
}}
|
|
242
|
-
/>
|
|
243
|
-
</div>
|
|
244
|
-
) : (
|
|
245
|
-
<div
|
|
246
|
-
ref={domRef}
|
|
247
|
-
style={{
|
|
248
|
-
width: '100%',
|
|
249
|
-
height: titleNode
|
|
250
|
-
? '100%'
|
|
251
|
-
: typeof height === 'number'
|
|
252
|
-
? `${height}px`
|
|
253
|
-
: height,
|
|
254
|
-
}}
|
|
255
|
-
/>
|
|
256
|
-
)}
|
|
257
|
-
</Spin>
|
|
258
|
-
</div>
|
|
259
|
-
</div>
|
|
260
|
-
);
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
export default RadarChart;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export interface SectionProps {
|
|
4
|
-
title?: string;
|
|
5
|
-
testId: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const Section: React.FC<SectionProps> = ({ title, testId }) => {
|
|
9
|
-
return (
|
|
10
|
-
<div
|
|
11
|
-
data-testid={testId}
|
|
12
|
-
style={{
|
|
13
|
-
width: '100%',
|
|
14
|
-
height: '100%',
|
|
15
|
-
background: '#fff',
|
|
16
|
-
borderRadius: 8,
|
|
17
|
-
}}
|
|
18
|
-
>
|
|
19
|
-
{title && (
|
|
20
|
-
<div
|
|
21
|
-
style={{
|
|
22
|
-
padding: '12px 16px',
|
|
23
|
-
fontSize: 14,
|
|
24
|
-
fontWeight: 600,
|
|
25
|
-
color: '#333',
|
|
26
|
-
}}
|
|
27
|
-
>
|
|
28
|
-
{title}
|
|
29
|
-
</div>
|
|
30
|
-
)}
|
|
31
|
-
</div>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default Section;
|
package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/Table/index.tsx
DELETED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import React, { useMemo, useRef, useState, useEffect } from 'react';
|
|
2
|
-
import { Table as AntTable, TableProps as AntTableProps } from 'antd';
|
|
3
|
-
import type { ColumnType } from 'antd/es/table';
|
|
4
|
-
import type { TablePaginationConfig } from 'antd/es/table';
|
|
5
|
-
|
|
6
|
-
// ─── Types ────────────────────────────────────────────────────────────────────
|
|
7
|
-
|
|
8
|
-
export interface TableProps<RecordType = any> extends Omit<
|
|
9
|
-
AntTableProps<RecordType>,
|
|
10
|
-
'pagination' | 'size'
|
|
11
|
-
> {
|
|
12
|
-
/** 分页配置。未传或 false → 不显示分页 */
|
|
13
|
-
pagination?: TablePaginationConfig | false;
|
|
14
|
-
|
|
15
|
-
/** 实体名称,用于 showTotal 文案。如 "staff"、"user" */
|
|
16
|
-
entityName?: string;
|
|
17
|
-
|
|
18
|
-
/** antd Table size,默认不设(使用 antd 默认值) */
|
|
19
|
-
size?: AntTableProps<RecordType>['size'];
|
|
20
|
-
|
|
21
|
-
/** data-testid,必填 */
|
|
22
|
-
testId: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// ─── 默认分页选项 ─────────────────────────────────────────────────────────────
|
|
26
|
-
|
|
27
|
-
const DEFAULT_PAGE_SIZE_OPTIONS = [10, 20, 50, 100];
|
|
28
|
-
|
|
29
|
-
// ─── showTotal 默认文案 ───────────────────────────────────────────────────────
|
|
30
|
-
|
|
31
|
-
function defaultShowTotal(entityName?: string) {
|
|
32
|
-
return (total: number) => {
|
|
33
|
-
if (entityName) {
|
|
34
|
-
return (
|
|
35
|
-
<span style={{ marginLeft: 16 }}>
|
|
36
|
-
<span className="ant-text secondary">{total}</span> {entityName} in
|
|
37
|
-
total
|
|
38
|
-
</span>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
return <span style={{ marginLeft: 16 }}>Total {total} items</span>;
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// ─── 给 antd 内部元素注入 flex 拉伸样式 ──────────────────────────────────────
|
|
46
|
-
|
|
47
|
-
const FLEX_STRETCH = 'flex:1;min-height:0;display:flex;flex-direction:column';
|
|
48
|
-
|
|
49
|
-
function applyStretchStyles(container: HTMLElement) {
|
|
50
|
-
const selectors = [
|
|
51
|
-
'.ant-table-wrapper',
|
|
52
|
-
'.ant-spin-nested-loading',
|
|
53
|
-
'.ant-spin-container',
|
|
54
|
-
];
|
|
55
|
-
for (const sel of selectors) {
|
|
56
|
-
const el = container.querySelector<HTMLElement>(sel);
|
|
57
|
-
if (el) el.style.cssText += `;${FLEX_STRETCH}`;
|
|
58
|
-
}
|
|
59
|
-
// .ant-table 只需要 flex:1 不需要 flex-direction
|
|
60
|
-
const table = container.querySelector<HTMLElement>('.ant-table');
|
|
61
|
-
if (table)
|
|
62
|
-
table.style.cssText +=
|
|
63
|
-
';flex:1;min-height:0;display:flex;flex-direction:column';
|
|
64
|
-
// .ant-table-container 也要 flex 拉伸
|
|
65
|
-
const tableContainer = container.querySelector<HTMLElement>(
|
|
66
|
-
'.ant-table-container',
|
|
67
|
-
);
|
|
68
|
-
if (tableContainer)
|
|
69
|
-
tableContainer.style.cssText +=
|
|
70
|
-
';flex:1;min-height:0;display:flex;flex-direction:column';
|
|
71
|
-
// .ant-table-body 滚动区域
|
|
72
|
-
const tableBody = container.querySelector<HTMLElement>('.ant-table-body');
|
|
73
|
-
if (tableBody)
|
|
74
|
-
tableBody.style.cssText += ';flex:1;min-height:0;overflow-y:auto';
|
|
75
|
-
// 分页器贴底
|
|
76
|
-
const pager = container.querySelector<HTMLElement>('.ant-table-pagination');
|
|
77
|
-
if (pager) pager.style.cssText += ';margin-top:auto;flex-shrink:0';
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// ─── 组件 ─────────────────────────────────────────────────────────────────────
|
|
81
|
-
|
|
82
|
-
export function Table<RecordType extends object = any>({
|
|
83
|
-
pagination: paginationProp,
|
|
84
|
-
entityName,
|
|
85
|
-
size,
|
|
86
|
-
testId,
|
|
87
|
-
scroll: scrollProp,
|
|
88
|
-
...rest
|
|
89
|
-
}: TableProps<RecordType>) {
|
|
90
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
91
|
-
const [scrollY, setScrollY] = useState<number | undefined>(undefined);
|
|
92
|
-
|
|
93
|
-
const hasPagination = !!paginationProp;
|
|
94
|
-
|
|
95
|
-
// 注入 flex 拉伸样式 + 计算 scroll.y
|
|
96
|
-
useEffect(() => {
|
|
97
|
-
const el = containerRef.current;
|
|
98
|
-
if (!el) return;
|
|
99
|
-
|
|
100
|
-
const compute = () => {
|
|
101
|
-
// 每次都重新注入(antd 可能因 re-render 重置 style)
|
|
102
|
-
applyStretchStyles(el);
|
|
103
|
-
|
|
104
|
-
const containerH = el.clientHeight;
|
|
105
|
-
if (containerH <= 0) return;
|
|
106
|
-
|
|
107
|
-
const thead = el.querySelector<HTMLElement>('.ant-table-thead');
|
|
108
|
-
const headH = thead ? thead.offsetHeight : 0;
|
|
109
|
-
|
|
110
|
-
const pager = el.querySelector<HTMLElement>('.ant-table-pagination');
|
|
111
|
-
const pagerH = pager ? pager.offsetHeight : 0;
|
|
112
|
-
|
|
113
|
-
const tbody = el.querySelector<HTMLElement>('.ant-table-tbody');
|
|
114
|
-
const bodyContentH = tbody ? tbody.scrollHeight : 0;
|
|
115
|
-
|
|
116
|
-
const availableH = containerH - headH - pagerH;
|
|
117
|
-
|
|
118
|
-
if (bodyContentH > availableH && availableH > 50) {
|
|
119
|
-
setScrollY(availableH);
|
|
120
|
-
} else {
|
|
121
|
-
setScrollY(undefined);
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const timer = setTimeout(compute, 50);
|
|
126
|
-
const ro = new ResizeObserver(compute);
|
|
127
|
-
ro.observe(el);
|
|
128
|
-
return () => {
|
|
129
|
-
clearTimeout(timer);
|
|
130
|
-
ro.disconnect();
|
|
131
|
-
};
|
|
132
|
-
}, [hasPagination, size, rest.dataSource]);
|
|
133
|
-
|
|
134
|
-
// 内部管理分页状态(Canvas 静态数据场景下 pagination 是受控写死的)
|
|
135
|
-
const [currentPage, setCurrentPage] = useState(
|
|
136
|
-
paginationProp
|
|
137
|
-
? ((paginationProp as TablePaginationConfig).current ?? 1)
|
|
138
|
-
: 1,
|
|
139
|
-
);
|
|
140
|
-
const [currentPageSize, setCurrentPageSize] = useState(
|
|
141
|
-
paginationProp
|
|
142
|
-
? ((paginationProp as TablePaginationConfig).pageSize ?? 10)
|
|
143
|
-
: 10,
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
const resolvedPagination = useMemo<TablePaginationConfig | false>(() => {
|
|
147
|
-
if (!paginationProp) return false;
|
|
148
|
-
|
|
149
|
-
const showTotal = paginationProp.showTotal ?? defaultShowTotal(entityName);
|
|
150
|
-
return {
|
|
151
|
-
showTotal,
|
|
152
|
-
showSizeChanger: true,
|
|
153
|
-
pageSizeOptions: DEFAULT_PAGE_SIZE_OPTIONS,
|
|
154
|
-
...paginationProp,
|
|
155
|
-
current: currentPage,
|
|
156
|
-
pageSize: currentPageSize,
|
|
157
|
-
total: paginationProp.total || (rest.dataSource?.length ?? 0),
|
|
158
|
-
};
|
|
159
|
-
}, [
|
|
160
|
-
paginationProp,
|
|
161
|
-
entityName,
|
|
162
|
-
currentPage,
|
|
163
|
-
currentPageSize,
|
|
164
|
-
rest.dataSource,
|
|
165
|
-
]);
|
|
166
|
-
|
|
167
|
-
// 为没有 rowKey 的静态数据自动注入唯一 key
|
|
168
|
-
const indexedDataSource = useMemo(() => {
|
|
169
|
-
if (rest.rowKey || !rest.dataSource) return rest.dataSource;
|
|
170
|
-
return rest.dataSource.map((item, i) => ({
|
|
171
|
-
...item,
|
|
172
|
-
__rowKey: String(i),
|
|
173
|
-
}));
|
|
174
|
-
}, [rest.rowKey, rest.dataSource]);
|
|
175
|
-
|
|
176
|
-
return (
|
|
177
|
-
<div
|
|
178
|
-
ref={containerRef}
|
|
179
|
-
style={{ height: '100%', display: 'flex', flexDirection: 'column' }}
|
|
180
|
-
data-testid={testId}
|
|
181
|
-
>
|
|
182
|
-
<AntTable<RecordType>
|
|
183
|
-
{...rest}
|
|
184
|
-
dataSource={indexedDataSource as RecordType[]}
|
|
185
|
-
size={size}
|
|
186
|
-
rowKey={rest.rowKey ?? '__rowKey'}
|
|
187
|
-
pagination={resolvedPagination}
|
|
188
|
-
scroll={scrollY ? { y: scrollY, ...scrollProp } : scrollProp}
|
|
189
|
-
onChange={(pagination, filters, sorter, extra) => {
|
|
190
|
-
if (pagination.current) setCurrentPage(pagination.current);
|
|
191
|
-
if (pagination.pageSize) setCurrentPageSize(pagination.pageSize);
|
|
192
|
-
rest.onChange?.(pagination, filters, sorter, extra);
|
|
193
|
-
}}
|
|
194
|
-
/>
|
|
195
|
-
</div>
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export default Table;
|
|
200
|
-
|
|
201
|
-
// Re-export antd types for convenience
|
|
202
|
-
export type { ColumnType, TablePaginationConfig };
|
|
203
|
-
|
|
204
|
-
// Re-export antd Table sub-components for drop-in compatibility
|
|
205
|
-
Table.Column = AntTable.Column;
|
|
206
|
-
Table.ColumnGroup = AntTable.ColumnGroup;
|
|
207
|
-
Table.Summary = AntTable.Summary;
|