@gadmin2n/schematics 0.0.72 → 0.0.75
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,6 +1,12 @@
|
|
|
1
1
|
import type { MenuProps } from 'antd';
|
|
2
2
|
import type { TFunction } from 'i18next';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
PlusOutlined,
|
|
5
|
+
MinusOutlined,
|
|
6
|
+
EditOutlined,
|
|
7
|
+
SwapOutlined,
|
|
8
|
+
DownloadOutlined,
|
|
9
|
+
} from '@ant-design/icons';
|
|
4
10
|
|
|
5
11
|
// ─── 组件特有右键菜单操作注册表 ────────────────────────────────────────────────
|
|
6
12
|
//
|
|
@@ -104,7 +110,7 @@ function numCardActions(
|
|
|
104
110
|
onClick: () => {
|
|
105
111
|
let newCode = code;
|
|
106
112
|
if (isWithChart) {
|
|
107
|
-
// 隐藏折线图:注入 showChart={false}
|
|
113
|
+
// 隐藏折线图:注入 showChart={false},切 variant 回 default(恢复数字大小)
|
|
108
114
|
if (/showChart\s*=/.test(newCode)) {
|
|
109
115
|
newCode = newCode.replace(
|
|
110
116
|
/showChart\s*=\s*\{true\}/,
|
|
@@ -120,12 +126,28 @@ function numCardActions(
|
|
|
120
126
|
newCode = newCode.replace(/\/>/, ` showChart={false}\n/>`);
|
|
121
127
|
}
|
|
122
128
|
}
|
|
129
|
+
// 切 variant 回 default,避免数字保持 withChart 的小字体
|
|
130
|
+
newCode = newCode.replace(
|
|
131
|
+
/variant\s*=\s*"withChart"/,
|
|
132
|
+
'variant="default"',
|
|
133
|
+
);
|
|
123
134
|
} else {
|
|
124
135
|
// 显示折线图
|
|
125
136
|
const chartHidden = /showChart\s*=\s*\{false\}/.test(newCode);
|
|
126
137
|
if (chartHidden) {
|
|
127
|
-
// 有数据但被隐藏了 → 移除 showChart={false}
|
|
138
|
+
// 有数据但被隐藏了 → 移除 showChart={false},切 variant 回 withChart
|
|
128
139
|
newCode = newCode.replace(/\s*showChart\s*=\s*\{false\}/, '');
|
|
140
|
+
if (/variant\s*=\s*"[^"]*"/.test(newCode)) {
|
|
141
|
+
newCode = newCode.replace(
|
|
142
|
+
/variant\s*=\s*"[^"]*"/,
|
|
143
|
+
'variant="withChart"',
|
|
144
|
+
);
|
|
145
|
+
} else {
|
|
146
|
+
newCode = newCode.replace(
|
|
147
|
+
/(<NumCard)/,
|
|
148
|
+
'$1\n variant="withChart"',
|
|
149
|
+
);
|
|
150
|
+
}
|
|
129
151
|
} else {
|
|
130
152
|
// 从没有 chart → 切 variant + 注入默认数据
|
|
131
153
|
if (/variant\s*=\s*"[^"]*"/.test(newCode)) {
|
|
@@ -208,6 +230,8 @@ function tableActions(
|
|
|
208
230
|
): MenuProps['items'] {
|
|
209
231
|
const hasPagination = /pagination\s*=\s*\{\{/.test(code);
|
|
210
232
|
|
|
233
|
+
const downloadItems = chartDownloadActions(code, updateCode, closeMenu, t)!;
|
|
234
|
+
|
|
211
235
|
if (hasPagination) {
|
|
212
236
|
// 已有分页:显示"修改分页数量"子菜单 + "移除分页"
|
|
213
237
|
const currentPageSize = code.match(/pageSize\s*:\s*(\d+)/)?.[1] ?? '10';
|
|
@@ -243,6 +267,7 @@ function tableActions(
|
|
|
243
267
|
closeMenu();
|
|
244
268
|
},
|
|
245
269
|
},
|
|
270
|
+
...downloadItems,
|
|
246
271
|
];
|
|
247
272
|
}
|
|
248
273
|
|
|
@@ -271,6 +296,7 @@ function tableActions(
|
|
|
271
296
|
},
|
|
272
297
|
})),
|
|
273
298
|
},
|
|
299
|
+
...downloadItems,
|
|
274
300
|
];
|
|
275
301
|
}
|
|
276
302
|
|
|
@@ -388,6 +414,45 @@ function chartTitleActions(
|
|
|
388
414
|
];
|
|
389
415
|
}
|
|
390
416
|
|
|
417
|
+
// ─── 通用 Chart 操作:显示/隐藏下载按钮 ───────────────────────────────────────
|
|
418
|
+
|
|
419
|
+
function chartDownloadActions(
|
|
420
|
+
code: string,
|
|
421
|
+
updateCode: (newCode: string) => void,
|
|
422
|
+
closeMenu: () => void,
|
|
423
|
+
t?: TFunction,
|
|
424
|
+
): MenuProps['items'] {
|
|
425
|
+
const hasDownload = /showDownload\s*=\s*\{true\}/.test(code);
|
|
426
|
+
|
|
427
|
+
return [
|
|
428
|
+
{
|
|
429
|
+
key: 'toggle-download',
|
|
430
|
+
icon: <DownloadOutlined />,
|
|
431
|
+
label: hasDownload
|
|
432
|
+
? (t?.('canvas.menu.hideDownload') ?? '隐藏下载按钮')
|
|
433
|
+
: (t?.('canvas.menu.showDownload') ?? '显示下载按钮'),
|
|
434
|
+
danger: hasDownload ? true : undefined,
|
|
435
|
+
onClick: () => {
|
|
436
|
+
let newCode = code;
|
|
437
|
+
if (hasDownload) {
|
|
438
|
+
newCode = newCode.replace(/\s*showDownload\s*=\s*\{true\}/, '');
|
|
439
|
+
} else {
|
|
440
|
+
if (/testId\s*=/.test(newCode)) {
|
|
441
|
+
newCode = newCode.replace(
|
|
442
|
+
/([ \t]*)(testId\s*=)/,
|
|
443
|
+
`$1showDownload={true}\n$1$2`,
|
|
444
|
+
);
|
|
445
|
+
} else {
|
|
446
|
+
newCode = newCode.replace(/\/>/, ` showDownload={true}\n/>`);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
updateCode(newCode);
|
|
450
|
+
closeMenu();
|
|
451
|
+
},
|
|
452
|
+
},
|
|
453
|
+
];
|
|
454
|
+
}
|
|
455
|
+
|
|
391
456
|
// ─── BarChart 特有操作 ─────────────────────────────────────────────────────
|
|
392
457
|
|
|
393
458
|
function barChartActions(
|
|
@@ -400,8 +465,79 @@ function barChartActions(
|
|
|
400
465
|
const isHorizontal = /direction\s*=\s*"horizontal"/.test(code);
|
|
401
466
|
const gridIsHidden = /showGrid\s*=\s*\{false\}/.test(code);
|
|
402
467
|
const labelIsHidden = /showLabel\s*=\s*\{false\}/.test(code);
|
|
468
|
+
const isGroupBar = /variant\s*=\s*"groupBar"/.test(code);
|
|
469
|
+
const isStacked = /stacked\s*=\s*\{true\}/.test(code);
|
|
470
|
+
const isPercent = /percent\s*=\s*\{true\}/.test(code);
|
|
403
471
|
|
|
404
472
|
return [
|
|
473
|
+
// ── 多系列模式切换(仅 groupBar) ─────────────────────────────
|
|
474
|
+
...(isGroupBar
|
|
475
|
+
? [
|
|
476
|
+
{
|
|
477
|
+
key: 'toggle-stacked',
|
|
478
|
+
icon: isStacked ? <MinusOutlined /> : <PlusOutlined />,
|
|
479
|
+
label: isStacked
|
|
480
|
+
? (t?.('canvas.menu.disableStacked') ?? '关闭堆叠')
|
|
481
|
+
: (t?.('canvas.menu.enableStacked') ?? '开启堆叠'),
|
|
482
|
+
danger: isStacked ? true : undefined,
|
|
483
|
+
onClick: () => {
|
|
484
|
+
let newCode = code;
|
|
485
|
+
if (isStacked) {
|
|
486
|
+
// 关闭堆叠 → 同时移除 percent
|
|
487
|
+
newCode = newCode.replace(/\s*stacked\s*=\s*\{true\}/, '');
|
|
488
|
+
newCode = newCode.replace(/\s*percent\s*=\s*\{true\}/, '');
|
|
489
|
+
} else {
|
|
490
|
+
if (/testId\s*=/.test(newCode)) {
|
|
491
|
+
newCode = newCode.replace(
|
|
492
|
+
/([ \t]*)(testId\s*=)/,
|
|
493
|
+
`$1stacked={true}\n$1$2`,
|
|
494
|
+
);
|
|
495
|
+
} else {
|
|
496
|
+
newCode = newCode.replace(/\/>/, ` stacked={true}\n/>`);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
updateCode(newCode);
|
|
500
|
+
closeMenu();
|
|
501
|
+
},
|
|
502
|
+
},
|
|
503
|
+
// percent 仅在 stacked 时显示
|
|
504
|
+
...(isStacked
|
|
505
|
+
? [
|
|
506
|
+
{
|
|
507
|
+
key: 'toggle-percent',
|
|
508
|
+
icon: isPercent ? <MinusOutlined /> : <PlusOutlined />,
|
|
509
|
+
label: isPercent
|
|
510
|
+
? (t?.('canvas.menu.disablePercent') ?? '关闭百分比')
|
|
511
|
+
: (t?.('canvas.menu.enablePercent') ?? '开启百分比'),
|
|
512
|
+
danger: isPercent ? true : undefined,
|
|
513
|
+
onClick: () => {
|
|
514
|
+
let newCode = code;
|
|
515
|
+
if (isPercent) {
|
|
516
|
+
newCode = newCode.replace(
|
|
517
|
+
/\s*percent\s*=\s*\{true\}/,
|
|
518
|
+
'',
|
|
519
|
+
);
|
|
520
|
+
} else {
|
|
521
|
+
if (/testId\s*=/.test(newCode)) {
|
|
522
|
+
newCode = newCode.replace(
|
|
523
|
+
/([ \t]*)(testId\s*=)/,
|
|
524
|
+
`$1percent={true}\n$1$2`,
|
|
525
|
+
);
|
|
526
|
+
} else {
|
|
527
|
+
newCode = newCode.replace(
|
|
528
|
+
/\/>/,
|
|
529
|
+
` percent={true}\n/>`,
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
updateCode(newCode);
|
|
534
|
+
closeMenu();
|
|
535
|
+
},
|
|
536
|
+
},
|
|
537
|
+
]
|
|
538
|
+
: []),
|
|
539
|
+
]
|
|
540
|
+
: []),
|
|
405
541
|
{
|
|
406
542
|
key: 'bar-direction',
|
|
407
543
|
icon: <PlusOutlined />,
|
|
@@ -495,6 +631,7 @@ function barChartActions(
|
|
|
495
631
|
},
|
|
496
632
|
...chartLegendActions(code, updateCode, closeMenu, t)!,
|
|
497
633
|
...chartTitleActions(code, updateCode, closeMenu, ctx, t)!,
|
|
634
|
+
...chartDownloadActions(code, updateCode, closeMenu, t)!,
|
|
498
635
|
];
|
|
499
636
|
}
|
|
500
637
|
|
|
@@ -585,6 +722,7 @@ function pieChartActions(
|
|
|
585
722
|
// 图例 + 标题(所有 chart 通用)
|
|
586
723
|
items.push(...chartLegendActions(code, updateCode, closeMenu, t)!);
|
|
587
724
|
items.push(...chartTitleActions(code, updateCode, closeMenu, ctx, t)!);
|
|
725
|
+
items.push(...chartDownloadActions(code, updateCode, closeMenu, t)!);
|
|
588
726
|
|
|
589
727
|
return items;
|
|
590
728
|
}
|
|
@@ -818,6 +956,7 @@ function lineChartActions(
|
|
|
818
956
|
},
|
|
819
957
|
},
|
|
820
958
|
...chartTitleActions(code, updateCode, closeMenu, ctx, t)!,
|
|
959
|
+
...chartDownloadActions(code, updateCode, closeMenu, t)!,
|
|
821
960
|
];
|
|
822
961
|
}
|
|
823
962
|
|
|
@@ -833,6 +972,7 @@ function radarChartActions(
|
|
|
833
972
|
return [
|
|
834
973
|
...chartLegendActions(code, updateCode, closeMenu, t)!,
|
|
835
974
|
...chartTitleActions(code, updateCode, closeMenu, ctx, t)!,
|
|
975
|
+
...chartDownloadActions(code, updateCode, closeMenu, t)!,
|
|
836
976
|
];
|
|
837
977
|
}
|
|
838
978
|
|
|
@@ -848,6 +988,200 @@ function treemapChartActions(
|
|
|
848
988
|
return [
|
|
849
989
|
...chartLegendActions(code, updateCode, closeMenu, t)!,
|
|
850
990
|
...chartTitleActions(code, updateCode, closeMenu, ctx, t)!,
|
|
991
|
+
...chartDownloadActions(code, updateCode, closeMenu, t)!,
|
|
992
|
+
];
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
// ─── MultiChart 特有操作 ──────────────────────────────────────────────────────
|
|
996
|
+
|
|
997
|
+
const MULTI_CHART_TYPES = [
|
|
998
|
+
{ key: 'bar', label: '柱状图', labelEn: 'Bar Chart' },
|
|
999
|
+
{ key: 'line', label: '折线图', labelEn: 'Line Chart' },
|
|
1000
|
+
{ key: 'pie', label: '饼图', labelEn: 'Pie Chart' },
|
|
1001
|
+
{ key: 'radar', label: '雷达图', labelEn: 'Radar Chart' },
|
|
1002
|
+
{ key: 'treemap', label: '矩形树图', labelEn: 'Treemap' },
|
|
1003
|
+
{ key: 'worldmap', label: '世界地图', labelEn: 'World Map' },
|
|
1004
|
+
{ key: 'table', label: '表格', labelEn: 'Table' },
|
|
1005
|
+
];
|
|
1006
|
+
|
|
1007
|
+
/** 从 code 中解析当前 defaultVariant */
|
|
1008
|
+
function parseDefaultVariant(code: string): string {
|
|
1009
|
+
const match = code.match(/defaultVariant\s*=\s*"([^"]*)"/);
|
|
1010
|
+
return match?.[1] ?? 'bar';
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
/** 从 code 中解析 charts 列表 */
|
|
1014
|
+
function parseChartsList(code: string): string[] {
|
|
1015
|
+
const match = code.match(/charts=\{(\[.*?\])\}/s);
|
|
1016
|
+
if (!match) return ['bar', 'line', 'pie'];
|
|
1017
|
+
try {
|
|
1018
|
+
return JSON.parse(match[1].replace(/'/g, '"'));
|
|
1019
|
+
} catch {
|
|
1020
|
+
return ['bar', 'line', 'pie'];
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/** 从 code 中解析 chartConfig JSON */
|
|
1025
|
+
function parseChartConfig(code: string): Record<string, Record<string, any>> {
|
|
1026
|
+
const match = code.match(/chartConfig=\{([\s\S]*?)\}\s*(?=\w+=|\/?>)/);
|
|
1027
|
+
if (!match) return {};
|
|
1028
|
+
try {
|
|
1029
|
+
// chartConfig={{"bar":{"showGrid":false}}}
|
|
1030
|
+
return JSON.parse(match[1]);
|
|
1031
|
+
} catch {
|
|
1032
|
+
return {};
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
/** 将 chartConfig 写回 code 字符串 */
|
|
1037
|
+
function writeChartConfig(
|
|
1038
|
+
code: string,
|
|
1039
|
+
config: Record<string, Record<string, any>>,
|
|
1040
|
+
): string {
|
|
1041
|
+
const configStr = `chartConfig={${JSON.stringify(config)}}`;
|
|
1042
|
+
if (/chartConfig=\{[\s\S]*?\}\s*(?=\w+=|\/?>)/.test(code)) {
|
|
1043
|
+
return code.replace(
|
|
1044
|
+
/chartConfig=\{[\s\S]*?\}\s*(?=\w+=|\/?>)/,
|
|
1045
|
+
configStr + '\n ',
|
|
1046
|
+
);
|
|
1047
|
+
}
|
|
1048
|
+
// 注入到 testId 之前
|
|
1049
|
+
if (/testId\s*=/.test(code)) {
|
|
1050
|
+
return code.replace(/([ \t]*)(testId\s*=)/, `$1${configStr}\n$1$2`);
|
|
1051
|
+
}
|
|
1052
|
+
return code.replace(/\/>/, ` ${configStr}\n/>`);
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
/** 各子图表的隐式默认 props(右键菜单 regex 所依赖的) */
|
|
1056
|
+
const CHART_IMPLICIT_DEFAULTS: Record<string, Record<string, any>> = {
|
|
1057
|
+
pie: { variant: 'pie' },
|
|
1058
|
+
bar: { variant: 'groupBar' },
|
|
1059
|
+
line: {},
|
|
1060
|
+
radar: {},
|
|
1061
|
+
treemap: {},
|
|
1062
|
+
worldmap: {},
|
|
1063
|
+
table: {},
|
|
1064
|
+
};
|
|
1065
|
+
|
|
1066
|
+
function multiChartActions(
|
|
1067
|
+
code: string,
|
|
1068
|
+
updateCode: (newCode: string) => void,
|
|
1069
|
+
closeMenu: () => void,
|
|
1070
|
+
ctx?: MenuActionContext,
|
|
1071
|
+
t?: TFunction,
|
|
1072
|
+
): MenuProps['items'] {
|
|
1073
|
+
const activeChart = parseDefaultVariant(code);
|
|
1074
|
+
const chartsList = parseChartsList(code);
|
|
1075
|
+
const chartConfig = parseChartConfig(code);
|
|
1076
|
+
const activeConfig = chartConfig[activeChart] ?? {};
|
|
1077
|
+
|
|
1078
|
+
// ── 切换到 (二级菜单) ──
|
|
1079
|
+
const switchItems: MenuProps['items'] = chartsList.map((key) => {
|
|
1080
|
+
const meta = MULTI_CHART_TYPES.find((c) => c.key === key);
|
|
1081
|
+
const label = meta?.label ?? key;
|
|
1082
|
+
return {
|
|
1083
|
+
key: `switch-${key}`,
|
|
1084
|
+
label: `${label}${key === activeChart ? ' ✓' : ''}`,
|
|
1085
|
+
onClick: () => {
|
|
1086
|
+
let newCode = code;
|
|
1087
|
+
if (/defaultVariant\s*=\s*"[^"]*"/.test(newCode)) {
|
|
1088
|
+
newCode = newCode.replace(
|
|
1089
|
+
/defaultVariant\s*=\s*"[^"]*"/,
|
|
1090
|
+
`defaultVariant="${key}"`,
|
|
1091
|
+
);
|
|
1092
|
+
} else {
|
|
1093
|
+
if (/testId\s*=/.test(newCode)) {
|
|
1094
|
+
newCode = newCode.replace(
|
|
1095
|
+
/([ \t]*)(testId\s*=)/,
|
|
1096
|
+
`$1defaultVariant="${key}"\n$1$2`,
|
|
1097
|
+
);
|
|
1098
|
+
} else {
|
|
1099
|
+
newCode = newCode.replace(/\/>/, ` defaultVariant="${key}"\n/>`);
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
updateCode(newCode);
|
|
1103
|
+
closeMenu();
|
|
1104
|
+
},
|
|
1105
|
+
};
|
|
1106
|
+
});
|
|
1107
|
+
|
|
1108
|
+
// ── 当前图表的配置项 ──
|
|
1109
|
+
// 构建一个"虚拟 code"传给 chart actions,让它们能正确读取/修改状态
|
|
1110
|
+
// chart actions 修改虚拟 code 后,我们提取差异写入 chartConfig
|
|
1111
|
+
const chartActionsMap: Record<string, ComponentActionsFactory | undefined> = {
|
|
1112
|
+
bar: barChartActions,
|
|
1113
|
+
line: lineChartActions,
|
|
1114
|
+
pie: pieChartActions,
|
|
1115
|
+
radar: radarChartActions,
|
|
1116
|
+
treemap: treemapChartActions,
|
|
1117
|
+
table: tableActions,
|
|
1118
|
+
};
|
|
1119
|
+
|
|
1120
|
+
const currentChartFactory = chartActionsMap[activeChart];
|
|
1121
|
+
let chartSpecificItems: MenuProps['items'] = [];
|
|
1122
|
+
|
|
1123
|
+
if (currentChartFactory) {
|
|
1124
|
+
// 构建虚拟 code:合并隐式默认 + 用户显式配置,转为 JSX props
|
|
1125
|
+
const implicitDefaults = CHART_IMPLICIT_DEFAULTS[activeChart] ?? {};
|
|
1126
|
+
const effectiveConfig = { ...implicitDefaults, ...activeConfig };
|
|
1127
|
+
let virtualCode = `<Component\n`;
|
|
1128
|
+
for (const [k, v] of Object.entries(effectiveConfig)) {
|
|
1129
|
+
if (typeof v === 'boolean') {
|
|
1130
|
+
virtualCode += ` ${k}={${v}}\n`;
|
|
1131
|
+
} else if (typeof v === 'string') {
|
|
1132
|
+
virtualCode += ` ${k}="${v}"\n`;
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
virtualCode += ` testId="virtual"\n/>`;
|
|
1136
|
+
|
|
1137
|
+
const virtualUpdateCode = (newVirtualCode: string) => {
|
|
1138
|
+
// 从 newVirtualCode 提取所有 props
|
|
1139
|
+
const newConfig: Record<string, any> = {};
|
|
1140
|
+
// 解析 boolean props: xxx={true} / xxx={false}
|
|
1141
|
+
const boolMatches = newVirtualCode.matchAll(
|
|
1142
|
+
/(\w+)\s*=\s*\{(true|false)\}/g,
|
|
1143
|
+
);
|
|
1144
|
+
for (const m of boolMatches) {
|
|
1145
|
+
if (m[1] !== 'testId') newConfig[m[1]] = m[2] === 'true';
|
|
1146
|
+
}
|
|
1147
|
+
// 解析 string props: xxx="yyy"
|
|
1148
|
+
const strMatches = newVirtualCode.matchAll(/(\w+)\s*=\s*"([^"]*)"/g);
|
|
1149
|
+
for (const m of strMatches) {
|
|
1150
|
+
if (m[1] !== 'testId') newConfig[m[1]] = m[2];
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
// 更新 chartConfig
|
|
1154
|
+
const updatedConfig = { ...chartConfig, [activeChart]: newConfig };
|
|
1155
|
+
// 清理空对象
|
|
1156
|
+
if (Object.keys(updatedConfig[activeChart]).length === 0) {
|
|
1157
|
+
delete updatedConfig[activeChart];
|
|
1158
|
+
}
|
|
1159
|
+
const newCode = writeChartConfig(code, updatedConfig);
|
|
1160
|
+
updateCode(newCode);
|
|
1161
|
+
};
|
|
1162
|
+
|
|
1163
|
+
chartSpecificItems = currentChartFactory(
|
|
1164
|
+
virtualCode,
|
|
1165
|
+
virtualUpdateCode,
|
|
1166
|
+
closeMenu,
|
|
1167
|
+
ctx,
|
|
1168
|
+
t,
|
|
1169
|
+
);
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
return [
|
|
1173
|
+
{
|
|
1174
|
+
key: 'switch-chart',
|
|
1175
|
+
icon: <SwapOutlined />,
|
|
1176
|
+
label: t?.('canvas.menu.switchTo') ?? '切换到',
|
|
1177
|
+
children: switchItems,
|
|
1178
|
+
},
|
|
1179
|
+
...(chartSpecificItems && chartSpecificItems.length > 0
|
|
1180
|
+
? [
|
|
1181
|
+
{ type: 'divider' as const, key: 'div-chart-config' },
|
|
1182
|
+
...chartSpecificItems,
|
|
1183
|
+
]
|
|
1184
|
+
: []),
|
|
851
1185
|
];
|
|
852
1186
|
}
|
|
853
1187
|
|
|
@@ -872,4 +1206,5 @@ export const CANVAS_CONTEXT_MENU_REGISTRY: Record<
|
|
|
872
1206
|
LineChart: lineChartActions,
|
|
873
1207
|
RadarChart: radarChartActions,
|
|
874
1208
|
TreemapChart: treemapChartActions,
|
|
1209
|
+
MultiChart: multiChartActions,
|
|
875
1210
|
};
|
package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/canvasDefaults.ts
CHANGED
|
@@ -28,6 +28,7 @@ export const CANVAS_COMPONENTS: string[] = [
|
|
|
28
28
|
'PieChart',
|
|
29
29
|
'RadarChart',
|
|
30
30
|
'TreemapChart',
|
|
31
|
+
'MultiChart',
|
|
31
32
|
'Table',
|
|
32
33
|
'WorldMap',
|
|
33
34
|
];
|
|
@@ -38,7 +39,7 @@ export const CANVAS_DEFAULTS: Record<string, CanvasDefault> = {
|
|
|
38
39
|
layout: { w: 10, h: 8, minW: 4, minH: 2 },
|
|
39
40
|
props: getPropsFor('NumCard'),
|
|
40
41
|
variants: getVariantsFor('NumCard'),
|
|
41
|
-
imports: `import { NumCard } from "
|
|
42
|
+
imports: `import { NumCard } from "@gadmin2n/charts";`,
|
|
42
43
|
},
|
|
43
44
|
|
|
44
45
|
Filter: {
|
|
@@ -46,15 +47,15 @@ export const CANVAS_DEFAULTS: Record<string, CanvasDefault> = {
|
|
|
46
47
|
layout: { w: 48, h: 10, minW: 20, minH: 4 },
|
|
47
48
|
props: getPropsFor('Filter'),
|
|
48
49
|
variants: getVariantsFor('Filter'),
|
|
49
|
-
imports: `import { Filter } from "
|
|
50
|
+
imports: `import { Filter } from "@gadmin2n/charts";\nimport { Form, Select, Input } from "antd";`,
|
|
50
51
|
},
|
|
51
52
|
|
|
52
53
|
BarChart: {
|
|
53
|
-
code: `<BarChart variant="bar" data={[{ name: "A", value: 1 }]} height={300}
|
|
54
|
+
code: `<BarChart variant="bar" data={[{ name: "A", value: 1 }]} height={300} testId="canvas-barchart" />`,
|
|
54
55
|
layout: { w: 24, h: 20, minW: 8, minH: 8 },
|
|
55
56
|
props: getPropsFor('BarChart'),
|
|
56
57
|
variants: getVariantsFor('BarChart'),
|
|
57
|
-
imports: `import { BarChart } from "
|
|
58
|
+
imports: `import { BarChart } from "@gadmin2n/charts";`,
|
|
58
59
|
},
|
|
59
60
|
|
|
60
61
|
LineChart: {
|
|
@@ -62,7 +63,7 @@ export const CANVAS_DEFAULTS: Record<string, CanvasDefault> = {
|
|
|
62
63
|
layout: { w: 24, h: 20, minW: 10, minH: 8 },
|
|
63
64
|
props: getPropsFor('LineChart'),
|
|
64
65
|
variants: getVariantsFor('LineChart'),
|
|
65
|
-
imports: `import { LineChart } from "
|
|
66
|
+
imports: `import { LineChart } from "@gadmin2n/charts";`,
|
|
66
67
|
},
|
|
67
68
|
|
|
68
69
|
PieChart: {
|
|
@@ -70,7 +71,7 @@ export const CANVAS_DEFAULTS: Record<string, CanvasDefault> = {
|
|
|
70
71
|
layout: { w: 24, h: 20, minW: 8, minH: 8 },
|
|
71
72
|
props: getPropsFor('PieChart'),
|
|
72
73
|
variants: getVariantsFor('PieChart'),
|
|
73
|
-
imports: `import { PieChart } from "
|
|
74
|
+
imports: `import { PieChart } from "@gadmin2n/charts";`,
|
|
74
75
|
},
|
|
75
76
|
|
|
76
77
|
RadarChart: {
|
|
@@ -78,7 +79,7 @@ export const CANVAS_DEFAULTS: Record<string, CanvasDefault> = {
|
|
|
78
79
|
layout: { w: 24, h: 20, minW: 8, minH: 8 },
|
|
79
80
|
props: getPropsFor('RadarChart'),
|
|
80
81
|
variants: getVariantsFor('RadarChart'),
|
|
81
|
-
imports: `import { RadarChart } from "
|
|
82
|
+
imports: `import { RadarChart } from "@gadmin2n/charts";`,
|
|
82
83
|
},
|
|
83
84
|
|
|
84
85
|
TreemapChart: {
|
|
@@ -86,7 +87,7 @@ export const CANVAS_DEFAULTS: Record<string, CanvasDefault> = {
|
|
|
86
87
|
layout: { w: 24, h: 20, minW: 8, minH: 8 },
|
|
87
88
|
props: getPropsFor('TreemapChart'),
|
|
88
89
|
variants: getVariantsFor('TreemapChart'),
|
|
89
|
-
imports: `import { TreemapChart } from "
|
|
90
|
+
imports: `import { TreemapChart } from "@gadmin2n/charts";`,
|
|
90
91
|
},
|
|
91
92
|
|
|
92
93
|
Table: {
|
|
@@ -94,7 +95,7 @@ export const CANVAS_DEFAULTS: Record<string, CanvasDefault> = {
|
|
|
94
95
|
layout: { w: 24, h: 20, minW: 10, minH: 5 },
|
|
95
96
|
props: getPropsFor('Table'),
|
|
96
97
|
variants: getVariantsFor('Table'),
|
|
97
|
-
imports: `import { Table } from "
|
|
98
|
+
imports: `import { Table } from "@gadmin2n/charts";`,
|
|
98
99
|
},
|
|
99
100
|
|
|
100
101
|
WorldMap: {
|
|
@@ -102,18 +103,18 @@ export const CANVAS_DEFAULTS: Record<string, CanvasDefault> = {
|
|
|
102
103
|
layout: { w: 32, h: 20, minW: 14, minH: 10 },
|
|
103
104
|
props: getPropsFor('WorldMap'),
|
|
104
105
|
variants: getVariantsFor('WorldMap'),
|
|
105
|
-
imports: `import { WorldMap } from "
|
|
106
|
+
imports: `import { WorldMap } from "@gadmin2n/charts";`,
|
|
106
107
|
},
|
|
107
108
|
|
|
108
|
-
|
|
109
|
-
code: `<
|
|
109
|
+
MultiChart: {
|
|
110
|
+
code: `<MultiChart
|
|
110
111
|
height={300}
|
|
111
|
-
testId="canvas-
|
|
112
|
+
testId="canvas-multichart"
|
|
112
113
|
/>`,
|
|
113
114
|
layout: { w: 24, h: 20, minW: 8, minH: 8 },
|
|
114
|
-
props: getPropsFor('
|
|
115
|
-
variants: getVariantsFor('
|
|
116
|
-
imports: `import {
|
|
115
|
+
props: getPropsFor('MultiChart'),
|
|
116
|
+
variants: getVariantsFor('MultiChart'),
|
|
117
|
+
imports: `import { MultiChart } from "@gadmin2n/charts";`,
|
|
117
118
|
},
|
|
118
119
|
|
|
119
120
|
Section: {
|
|
@@ -121,6 +122,6 @@ export const CANVAS_DEFAULTS: Record<string, CanvasDefault> = {
|
|
|
121
122
|
layout: { w: 24, h: 14, minW: 8, minH: 4 },
|
|
122
123
|
props: getPropsFor('Section'),
|
|
123
124
|
variants: getVariantsFor('Section'),
|
|
124
|
-
imports: `import { Section } from "
|
|
125
|
+
imports: `import { Section } from "@gadmin2n/charts";`,
|
|
125
126
|
},
|
|
126
127
|
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { Modal, Radio, Input, Checkbox } from 'antd';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import {
|
|
5
|
+
CANVAS_MODAL_PROPS,
|
|
6
|
+
CANVAS_MODAL_TITLE_STYLE,
|
|
7
|
+
} from './canvasModalProps';
|
|
4
8
|
|
|
5
9
|
export interface BarChartDataSourceResult {
|
|
6
10
|
direction: 'vertical' | 'horizontal';
|
|
@@ -58,15 +62,17 @@ const BarChartDataSourceModal: React.FC<BarChartDataSourceModalProps> = ({
|
|
|
58
62
|
|
|
59
63
|
return (
|
|
60
64
|
<Modal
|
|
61
|
-
|
|
65
|
+
{...CANVAS_MODAL_PROPS}
|
|
66
|
+
title={
|
|
67
|
+
<span style={CANVAS_MODAL_TITLE_STYLE}>
|
|
68
|
+
{t('canvas.dataSourceModal.title')}
|
|
69
|
+
</span>
|
|
70
|
+
}
|
|
62
71
|
open={open}
|
|
63
72
|
onOk={handleConfirm}
|
|
64
73
|
onCancel={onCancel}
|
|
65
74
|
okText={t('canvas.dataSourceModal.ok')}
|
|
66
75
|
cancelText={t('canvas.dataSourceModal.cancel')}
|
|
67
|
-
width={420}
|
|
68
|
-
centered
|
|
69
|
-
destroyOnClose
|
|
70
76
|
>
|
|
71
77
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
|
|
72
78
|
<div>
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { Modal, Checkbox, Input } from 'antd';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import {
|
|
5
|
+
CANVAS_MODAL_PROPS,
|
|
6
|
+
CANVAS_MODAL_TITLE_STYLE,
|
|
7
|
+
} from './canvasModalProps';
|
|
4
8
|
|
|
5
9
|
export interface LineChartDataSourceResult {
|
|
6
10
|
legendShow: boolean;
|
|
@@ -73,15 +77,17 @@ const LineChartDataSourceModal: React.FC<LineChartDataSourceModalProps> = ({
|
|
|
73
77
|
|
|
74
78
|
return (
|
|
75
79
|
<Modal
|
|
76
|
-
|
|
80
|
+
{...CANVAS_MODAL_PROPS}
|
|
81
|
+
title={
|
|
82
|
+
<span style={CANVAS_MODAL_TITLE_STYLE}>
|
|
83
|
+
{t('canvas.dataSourceModal.title')}
|
|
84
|
+
</span>
|
|
85
|
+
}
|
|
77
86
|
open={open}
|
|
78
87
|
onOk={handleConfirm}
|
|
79
88
|
onCancel={onCancel}
|
|
80
89
|
okText={t('canvas.dataSourceModal.ok')}
|
|
81
90
|
cancelText={t('canvas.dataSourceModal.cancel')}
|
|
82
|
-
width={420}
|
|
83
|
-
centered
|
|
84
|
-
destroyOnClose
|
|
85
91
|
>
|
|
86
92
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
|
|
87
93
|
<Checkbox
|