@oceanbase/ui 1.0.0-alpha.6 → 1.0.0-alpha.7

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.
Files changed (130) hide show
  1. package/dist/static/Inter-Medium.ea234620.woff2 +0 -0
  2. package/dist/static/Inter-Regular.34ba43c9.woff2 +0 -0
  3. package/dist/static/Inter-SemiBold.95439fb4.woff2 +0 -0
  4. package/dist/ui.min.js +1 -1
  5. package/es/BasicLayout/locale/ja-JP.js +6 -6
  6. package/es/Boundary/locale/en-US.js +1 -1
  7. package/es/Boundary/locale/ja-JP.js +4 -4
  8. package/es/Boundary/locale/zh-CN.js +1 -1
  9. package/es/Boundary/locale/zh-TW.js +1 -1
  10. package/es/DateRanger/locale/ja-JP.js +3 -3
  11. package/es/Dialog/locale/ja-JP.js +2 -2
  12. package/es/Dialog/locale/zh-CN.js +1 -1
  13. package/es/Dialog/locale/zh-TW.js +1 -1
  14. package/es/Login/locale/ja-JP.js +11 -11
  15. package/es/Login/locale/zh-CN.js +2 -2
  16. package/es/PageContainer/index.d.ts +2 -0
  17. package/es/PageContainer/index.js +74 -23
  18. package/es/PageContainer/locale/en-US.d.ts +1 -0
  19. package/es/PageContainer/locale/en-US.js +2 -1
  20. package/es/PageContainer/locale/ja-JP.d.ts +1 -0
  21. package/es/PageContainer/locale/ja-JP.js +2 -1
  22. package/es/PageContainer/locale/zh-CN.d.ts +1 -0
  23. package/es/PageContainer/locale/zh-CN.js +2 -1
  24. package/es/PageContainer/locale/zh-TW.d.ts +1 -0
  25. package/es/PageContainer/locale/zh-TW.js +2 -1
  26. package/es/PageContainer/style/index.js +16 -2
  27. package/es/Password/locale/ja-JP.js +6 -6
  28. package/es/ProTable/style/index.js +8 -4
  29. package/es/_util/genComponentStyleHook.d.ts +2 -2
  30. package/es/_util/genComponentStyleHook.js +1 -1
  31. package/es/index.d.ts +0 -4
  32. package/es/index.js +0 -2
  33. package/es/locale/en-US.js +0 -4
  34. package/es/locale/ja-JP.js +0 -4
  35. package/es/locale/zh-CN.js +0 -4
  36. package/es/locale/zh-TW.js +0 -4
  37. package/lib/BasicLayout/locale/ja-JP.js +6 -6
  38. package/lib/Boundary/locale/en-US.js +1 -1
  39. package/lib/Boundary/locale/ja-JP.js +4 -4
  40. package/lib/Boundary/locale/zh-CN.js +1 -1
  41. package/lib/Boundary/locale/zh-TW.js +1 -1
  42. package/lib/DateRanger/locale/ja-JP.js +3 -3
  43. package/lib/Dialog/locale/ja-JP.js +2 -2
  44. package/lib/Dialog/locale/zh-CN.js +1 -1
  45. package/lib/Dialog/locale/zh-TW.js +1 -1
  46. package/lib/Login/locale/ja-JP.js +11 -11
  47. package/lib/Login/locale/zh-CN.js +2 -2
  48. package/lib/PageContainer/index.d.ts +2 -0
  49. package/lib/PageContainer/index.js +49 -2
  50. package/lib/PageContainer/locale/en-US.d.ts +1 -0
  51. package/lib/PageContainer/locale/en-US.js +2 -1
  52. package/lib/PageContainer/locale/ja-JP.d.ts +1 -0
  53. package/lib/PageContainer/locale/ja-JP.js +2 -1
  54. package/lib/PageContainer/locale/zh-CN.d.ts +1 -0
  55. package/lib/PageContainer/locale/zh-CN.js +2 -1
  56. package/lib/PageContainer/locale/zh-TW.d.ts +1 -0
  57. package/lib/PageContainer/locale/zh-TW.js +2 -1
  58. package/lib/PageContainer/style/index.js +17 -1
  59. package/lib/Password/locale/ja-JP.js +6 -6
  60. package/lib/ProTable/style/index.js +11 -1
  61. package/lib/_util/genComponentStyleHook.d.ts +2 -2
  62. package/lib/_util/genComponentStyleHook.js +1 -1
  63. package/lib/index.d.ts +0 -4
  64. package/lib/index.js +0 -6
  65. package/lib/locale/en-US.js +16 -20
  66. package/lib/locale/ja-JP.js +16 -20
  67. package/lib/locale/zh-CN.js +17 -21
  68. package/lib/locale/zh-TW.js +15 -19
  69. package/package.json +4 -4
  70. package/dist/static/Inter.f6bcdfb6.woff2 +0 -0
  71. package/es/GraphToolbar/index.d.ts +0 -25
  72. package/es/GraphToolbar/index.js +0 -149
  73. package/es/GraphToolbar/locale/en-US.d.ts +0 -9
  74. package/es/GraphToolbar/locale/en-US.js +0 -8
  75. package/es/GraphToolbar/locale/ja-JP.d.ts +0 -9
  76. package/es/GraphToolbar/locale/ja-JP.js +0 -8
  77. package/es/GraphToolbar/locale/zh-CN.d.ts +0 -9
  78. package/es/GraphToolbar/locale/zh-CN.js +0 -8
  79. package/es/GraphToolbar/locale/zh-TW.d.ts +0 -9
  80. package/es/GraphToolbar/locale/zh-TW.js +0 -8
  81. package/es/GraphToolbar/style/index.d.ts +0 -10
  82. package/es/GraphToolbar/style/index.js +0 -60
  83. package/es/TaskGraph/Graph/style/index.d.ts +0 -10
  84. package/es/TaskGraph/Graph/style/index.js +0 -28
  85. package/es/TaskGraph/Graph.d.ts +0 -23
  86. package/es/TaskGraph/Graph.js +0 -287
  87. package/es/TaskGraph/index.d.ts +0 -15
  88. package/es/TaskGraph/index.js +0 -181
  89. package/es/TaskGraph/locale/en-US.d.ts +0 -13
  90. package/es/TaskGraph/locale/en-US.js +0 -12
  91. package/es/TaskGraph/locale/ja-JP.d.ts +0 -13
  92. package/es/TaskGraph/locale/ja-JP.js +0 -12
  93. package/es/TaskGraph/locale/zh-CN.d.ts +0 -13
  94. package/es/TaskGraph/locale/zh-CN.js +0 -12
  95. package/es/TaskGraph/locale/zh-TW.d.ts +0 -13
  96. package/es/TaskGraph/locale/zh-TW.js +0 -12
  97. package/es/TaskGraph/register.d.ts +0 -7
  98. package/es/TaskGraph/register.js +0 -200
  99. package/es/TaskGraph/style/index.d.ts +0 -10
  100. package/es/TaskGraph/style/index.js +0 -102
  101. package/lib/GraphToolbar/index.d.ts +0 -25
  102. package/lib/GraphToolbar/index.js +0 -169
  103. package/lib/GraphToolbar/locale/en-US.d.ts +0 -9
  104. package/lib/GraphToolbar/locale/en-US.js +0 -32
  105. package/lib/GraphToolbar/locale/ja-JP.d.ts +0 -9
  106. package/lib/GraphToolbar/locale/ja-JP.js +0 -32
  107. package/lib/GraphToolbar/locale/zh-CN.d.ts +0 -9
  108. package/lib/GraphToolbar/locale/zh-CN.js +0 -32
  109. package/lib/GraphToolbar/locale/zh-TW.d.ts +0 -9
  110. package/lib/GraphToolbar/locale/zh-TW.js +0 -32
  111. package/lib/GraphToolbar/style/index.d.ts +0 -10
  112. package/lib/GraphToolbar/style/index.js +0 -91
  113. package/lib/TaskGraph/Graph/style/index.d.ts +0 -10
  114. package/lib/TaskGraph/Graph/style/index.js +0 -56
  115. package/lib/TaskGraph/Graph.d.ts +0 -23
  116. package/lib/TaskGraph/Graph.js +0 -275
  117. package/lib/TaskGraph/index.d.ts +0 -15
  118. package/lib/TaskGraph/index.js +0 -171
  119. package/lib/TaskGraph/locale/en-US.d.ts +0 -13
  120. package/lib/TaskGraph/locale/en-US.js +0 -36
  121. package/lib/TaskGraph/locale/ja-JP.d.ts +0 -13
  122. package/lib/TaskGraph/locale/ja-JP.js +0 -36
  123. package/lib/TaskGraph/locale/zh-CN.d.ts +0 -13
  124. package/lib/TaskGraph/locale/zh-CN.js +0 -36
  125. package/lib/TaskGraph/locale/zh-TW.d.ts +0 -13
  126. package/lib/TaskGraph/locale/zh-TW.js +0 -36
  127. package/lib/TaskGraph/register.d.ts +0 -7
  128. package/lib/TaskGraph/register.js +0 -205
  129. package/lib/TaskGraph/style/index.d.ts +0 -10
  130. package/lib/TaskGraph/style/index.js +0 -143
@@ -1,32 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/GraphToolbar/locale/zh-TW.ts
20
- var zh_TW_exports = {};
21
- __export(zh_TW_exports, {
22
- default: () => zh_TW_default
23
- });
24
- module.exports = __toCommonJS(zh_TW_exports);
25
- var zh_TW_default = {
26
- fullscreen: "進入全屏",
27
- shrink: "縮小",
28
- enlarge: "放大",
29
- reset: "顯示原始比例",
30
- fitView: "自我調整畫布",
31
- refresh: "刷新"
32
- };
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import type { GenerateStyle } from '@oceanbase/design/es/theme';
3
- import type { OBToken } from '../../_util/genComponentStyleHook';
4
- export type GraphToolbarToken = OBToken;
5
- export declare const genGraphToolbarStyle: GenerateStyle<GraphToolbarToken>;
6
- declare const _default: (prefixCls: string) => {
7
- wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
8
- hashId: string;
9
- };
10
- export default _default;
@@ -1,91 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/GraphToolbar/style/index.ts
20
- var style_exports = {};
21
- __export(style_exports, {
22
- default: () => style_default,
23
- genGraphToolbarStyle: () => genGraphToolbarStyle
24
- });
25
- module.exports = __toCommonJS(style_exports);
26
- var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
27
- var genGraphToolbarStyle = (token) => {
28
- const { componentCls, iconCls, colorTextQuaternary, colorTextSecondary, borderRadius, boxShadowSecondary } = token;
29
- return {
30
- [`${componentCls}`]: {
31
- display: "inline-flex",
32
- alignItems: "center",
33
- justifyContent: "space-between",
34
- [`${componentCls}-pointable`]: {
35
- cursor: "pointer"
36
- },
37
- [`${componentCls}-disabled`]: {
38
- color: colorTextQuaternary,
39
- cursor: "not-allowed",
40
- pointerEvents: "none"
41
- },
42
- "span, img": {
43
- userSelect: "none"
44
- },
45
- "> span:not(:last-child)": {
46
- marginRight: 16
47
- },
48
- "img:not(:last-child)": {
49
- marginRight: 16
50
- },
51
- [`${componentCls}-divider`]: {
52
- margin: 0
53
- },
54
- [`${componentCls}-zoom-wrapper`]: {
55
- display: "inline-flex",
56
- alignItems: "center",
57
- justifyContent: "space-between",
58
- width: 90,
59
- height: 24,
60
- padding: "0 8px",
61
- color: colorTextSecondary,
62
- fontSize: 12,
63
- backgroundColor: "#f5f6fa",
64
- borderRadius,
65
- [`${iconCls}`]: {
66
- fontSize: 12
67
- }
68
- }
69
- },
70
- [`${componentCls}-fixed`]: {
71
- position: "absolute",
72
- top: 24,
73
- right: 24,
74
- height: 40,
75
- padding: "8px 24px",
76
- background: "#fff",
77
- borderRadius: 20,
78
- boxShadow: boxShadowSecondary
79
- }
80
- };
81
- };
82
- var style_default = (prefixCls) => {
83
- const useStyle = (0, import_genComponentStyleHook.genComponentStyleHook)("GraphToolbar", (token) => {
84
- return [genGraphToolbarStyle(token)];
85
- });
86
- return useStyle(prefixCls);
87
- };
88
- // Annotate the CommonJS export names for ESM import in node:
89
- 0 && (module.exports = {
90
- genGraphToolbarStyle
91
- });
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import type { GenerateStyle } from '@oceanbase/design/es/theme';
3
- import type { OBToken } from '../../../_util/genComponentStyleHook';
4
- export type TaskGraphItemToken = OBToken;
5
- export declare const genTaskGraphItemStyle: GenerateStyle<TaskGraphItemToken>;
6
- declare const _default: (prefixCls: string) => {
7
- wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
8
- hashId: string;
9
- };
10
- export default _default;
@@ -1,56 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/TaskGraph/Graph/style/index.ts
20
- var style_exports = {};
21
- __export(style_exports, {
22
- default: () => style_default,
23
- genTaskGraphItemStyle: () => genTaskGraphItemStyle
24
- });
25
- module.exports = __toCommonJS(style_exports);
26
- var import_genComponentStyleHook = require("../../../_util/genComponentStyleHook");
27
- var genTaskGraphItemStyle = (token) => {
28
- const { componentCls, antCls, colorTextTertiary } = token;
29
- return {
30
- [`${componentCls}-menu`]: {
31
- position: "fixed",
32
- [`${componentCls}-task-id-wrapper`]: {
33
- padding: "5px 12px",
34
- [`${antCls}-typography`]: {
35
- display: "flex",
36
- alignItems: "center",
37
- justifyContent: "space-between",
38
- color: colorTextTertiary,
39
- [`${antCls}-typography-copy`]: {
40
- color: colorTextTertiary
41
- }
42
- }
43
- }
44
- }
45
- };
46
- };
47
- var style_default = (prefixCls) => {
48
- const useStyle = (0, import_genComponentStyleHook.genComponentStyleHook)("TaskGraphItem", (token) => {
49
- return [genTaskGraphItemStyle(token)];
50
- });
51
- return useStyle(prefixCls);
52
- };
53
- // Annotate the CommonJS export names for ESM import in node:
54
- 0 && (module.exports = {
55
- genTaskGraphItemStyle
56
- });
@@ -1,23 +0,0 @@
1
- import type { GraphData } from '@antv/g6/lib/types';
2
- import type { LocaleWrapperProps } from '../locale/LocaleWrapper';
3
- export interface TaskGraphLocale {
4
- successful: string;
5
- running: string;
6
- failed: string;
7
- pending: string;
8
- taskId: string;
9
- log: string;
10
- parameter: string;
11
- stop: string;
12
- retry: string;
13
- skip: string;
14
- }
15
- export interface TaskGraphProps extends LocaleWrapperProps {
16
- data: GraphData;
17
- onMenuClick: (key: string, subTask: any, onSuccess: () => void) => void;
18
- onLogAdd: (subTask: any) => void;
19
- assetsPath?: string;
20
- locale?: TaskGraphLocale;
21
- }
22
- declare const _default: any;
23
- export default _default;
@@ -1,275 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/TaskGraph/Graph.tsx
30
- var Graph_exports = {};
31
- __export(Graph_exports, {
32
- default: () => Graph_default
33
- });
34
- module.exports = __toCommonJS(Graph_exports);
35
- var import_util = require("@oceanbase/util");
36
- var import_design = require("@oceanbase/design");
37
- var import_lodash = require("lodash");
38
- var import_react = __toESM(require("react"));
39
- var import_design2 = require("@oceanbase/design");
40
- var import_GraphToolbar = __toESM(require("../GraphToolbar"));
41
- var import_LocaleWrapper = __toESM(require("../locale/LocaleWrapper"));
42
- var import_style = __toESM(require("./Graph/style"));
43
- var import_zh_CN = __toESM(require("./locale/zh-CN"));
44
- var import_jsx_runtime = require("react/jsx-runtime");
45
- var { Text } = import_design.Typography;
46
- var GraphWrapper = ({
47
- prefixCls,
48
- children
49
- }) => {
50
- const { wrapSSR } = (0, import_style.default)(prefixCls);
51
- return wrapSSR(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children }));
52
- };
53
- var TaskGraph = class extends import_react.default.PureComponent {
54
- constructor(props) {
55
- super(props);
56
- this.main = null;
57
- this.menu = null;
58
- this.drawGraph = () => {
59
- const { data } = this.props;
60
- if (this.graph && this.graph.changeData) {
61
- this.graph.changeData(data);
62
- } else {
63
- const splitPane = document.getElementsByClassName("SplitPane") && document.getElementsByClassName("SplitPane")[0];
64
- const width = this.main && this.main.scrollWidth || 1200;
65
- const height = (this.main && this.main.scrollHeight || splitPane.scrollHeight || 500) - 65;
66
- import("@antv/g6").then((G6) => {
67
- const graph = new G6.Graph({
68
- container: "container",
69
- width,
70
- height,
71
- minZoom: 0.2,
72
- maxZoom: 2,
73
- layout: {
74
- type: "dagre",
75
- nodesep: 90,
76
- ranksep: 40,
77
- controlPoints: false
78
- },
79
- defaultNode: {
80
- type: "subTaskNode",
81
- anchorPoints: [
82
- [0.5, 0],
83
- [0.5, 1]
84
- ]
85
- },
86
- defaultEdge: {
87
- type: "subTaskEdge"
88
- },
89
- nodeStateStyles: {
90
- hover: {
91
- lineWidth: 2,
92
- stroke: import_design2.token.colorPrimary,
93
- fill: "#e6f7ff"
94
- }
95
- },
96
- modes: {
97
- default: ["drag-canvas", "zoom-canvas", "click-select"]
98
- }
99
- });
100
- const canvas = graph.get("canvas");
101
- canvas.set("localRefresh", false);
102
- graph.data(data);
103
- graph.render();
104
- graph.fitView();
105
- canvas.on("moreGroup:click", (e) => {
106
- const subTaskNode = e.currentTarget && e.currentTarget.getParent();
107
- const model = subTaskNode && subTaskNode.get("item") && subTaskNode.get("item").getModel();
108
- this.setState(
109
- {
110
- currentSubTask: model
111
- },
112
- () => {
113
- if (!this.menu) {
114
- this.menu = document.getElementById("menu");
115
- }
116
- this.menu.style.left = `${e.x}px`;
117
- this.menu.style.top = `${e.y - height - 5}px`;
118
- }
119
- );
120
- });
121
- graph.on("node:mouseleave", () => {
122
- if (!this.menu) {
123
- this.menu = document.getElementById("menu");
124
- }
125
- this.menu.style.left = "-1500px";
126
- });
127
- this.graph = graph;
128
- this.forceUpdate();
129
- });
130
- }
131
- };
132
- this.handleMenuClick = ({ key }) => {
133
- const { onMenuClick } = this.props;
134
- const { currentSubTask } = this.state;
135
- const onSuccess = () => {
136
- this.setState({
137
- currentSubTask: null
138
- });
139
- };
140
- if (key === "log") {
141
- this.log();
142
- }
143
- if (onMenuClick) {
144
- onMenuClick(key, currentSubTask, onSuccess);
145
- }
146
- if (this.menu) {
147
- this.menu.style.left = "-1500px";
148
- }
149
- };
150
- this.log = () => {
151
- const { onLogAdd } = this.props;
152
- const { currentSubTask } = this.state;
153
- if (onLogAdd) {
154
- onLogAdd(currentSubTask);
155
- }
156
- };
157
- const { locale } = props;
158
- this.state = {
159
- currentSubTask: null,
160
- statusList: [
161
- {
162
- label: locale.successful,
163
- value: "SUCCESSFUL",
164
- color: "#9adc78",
165
- operations: ["taskId", "log", "parameter"]
166
- },
167
- {
168
- label: locale.running,
169
- value: "RUNNING",
170
- color: "#80c3fc",
171
- operations: ["taskId", "log", "parameter", "stop"]
172
- },
173
- {
174
- label: locale.failed,
175
- value: "FAILED",
176
- color: "#fca4a2",
177
- operations: ["taskId", "log", "parameter", "retry", "skip"]
178
- },
179
- {
180
- label: locale.pending,
181
- value: "PENDING",
182
- color: "#cccccc",
183
- operations: ["taskId", "parameter"]
184
- }
185
- ]
186
- };
187
- }
188
- componentDidMount() {
189
- const { assetsPath = "/assets" } = this.props;
190
- const { statusList } = this.state;
191
- import("./register").then((register) => {
192
- register.default(statusList, assetsPath);
193
- this.menu = document.getElementById("menu");
194
- this.drawGraph();
195
- });
196
- }
197
- componentDidUpdate(prevProps) {
198
- const { data } = this.props;
199
- if (!(0, import_lodash.isEqual)(data, prevProps.data)) {
200
- this.drawGraph();
201
- }
202
- }
203
- render() {
204
- const { locale } = this.props;
205
- const { statusList, currentSubTask } = this.state;
206
- const { getPrefixCls } = this.context || {};
207
- const prefixCls = getPrefixCls == null ? void 0 : getPrefixCls("task-graph-item");
208
- const operations = (0, import_util.findByValue)(statusList, currentSubTask && currentSubTask.status).operations || [];
209
- const menus = [
210
- {
211
- label: locale.taskId,
212
- value: "taskId"
213
- },
214
- {
215
- label: locale.log,
216
- value: "log"
217
- },
218
- {
219
- label: locale.parameter,
220
- value: "parameter"
221
- },
222
- {
223
- label: locale.stop,
224
- value: "stop"
225
- },
226
- {
227
- label: locale.retry,
228
- value: "retry"
229
- },
230
- {
231
- label: locale.skip,
232
- value: "skip"
233
- }
234
- ];
235
- const filterMenus = menus.filter((item) => operations.includes(item.value));
236
- const menu = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design.Menu, { id: "menu", onClick: this.handleMenuClick, style: { left: -1500 }, children: filterMenus.map(
237
- (item) => item.value === "taskId" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
238
- "div",
239
- {
240
- className: `${prefixCls}-task-id-wrapper`,
241
- style: filterMenus.length > 1 ? { borderBottom: "1px solid #e8e8e8" } : {},
242
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { copyable: true, children: `ID: ${currentSubTask && currentSubTask.id}` })
243
- },
244
- "task-id"
245
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design.Menu.Item, { children: item.label }, item.value)
246
- ) });
247
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(GraphWrapper, { prefixCls, children: [
248
- this.graph && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphToolbar.default, { mode: "fixed", graph: this.graph }),
249
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
250
- "div",
251
- {
252
- id: "container",
253
- ref: (node) => {
254
- this.main = node;
255
- }
256
- }
257
- ),
258
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
259
- import_design.Dropdown,
260
- {
261
- visible: true,
262
- open: true,
263
- overlay: menu,
264
- overlayClassName: `${prefixCls}-menu`,
265
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {})
266
- }
267
- )
268
- ] });
269
- }
270
- };
271
- TaskGraph.contextType = import_design.ConfigProvider.ConfigContext;
272
- var Graph_default = (0, import_LocaleWrapper.default)({
273
- componentName: "TaskGraph",
274
- defaultLocale: import_zh_CN.default
275
- })(TaskGraph);
@@ -1,15 +0,0 @@
1
- import type { GraphData } from '@antv/g6/lib/types';
2
- import type { LocaleWrapperProps } from '../locale/LocaleWrapper';
3
- import type { TaskGraphLocale } from './Graph';
4
- export interface TaskGraphProps extends LocaleWrapperProps {
5
- data: GraphData;
6
- logLoading?: boolean;
7
- subTaskLog: string;
8
- onMenuClick: (key: string, subTask: any, onSuccess: () => void) => void;
9
- onTabsChange?: (targetKey: string) => void;
10
- onTabsEdit?: (targetKey: string, action: 'add' | 'remove') => void;
11
- assetsPath?: string;
12
- locale?: TaskGraphLocale;
13
- }
14
- declare const _default: any;
15
- export default _default;
@@ -1,171 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/TaskGraph/index.tsx
30
- var TaskGraph_exports = {};
31
- __export(TaskGraph_exports, {
32
- default: () => TaskGraph_default
33
- });
34
- module.exports = __toCommonJS(TaskGraph_exports);
35
- var import_icons = require("@oceanbase/icons");
36
- var import_design = require("@oceanbase/design");
37
- var import_lodash = require("lodash");
38
- var import_react = require("react");
39
- var import_react_split_pane = __toESM(require("react-split-pane"));
40
- var import_LocaleWrapper = __toESM(require("../locale/LocaleWrapper"));
41
- var import_style = __toESM(require("./style"));
42
- var import_Graph = __toESM(require("./Graph"));
43
- var import_zh_CN = __toESM(require("./locale/zh-CN"));
44
- var import_jsx_runtime = require("react/jsx-runtime");
45
- var { TabPane } = import_design.Tabs;
46
- var MIN_SIZE = 56;
47
- var DEFAULT_SIZE = 240;
48
- var TaskGraph = ({
49
- logLoading = false,
50
- subTaskLog,
51
- onTabsChange = import_lodash.noop,
52
- onTabsEdit = import_lodash.noop,
53
- ...restProps
54
- }) => {
55
- const { getPrefixCls } = (0, import_react.useContext)(import_design.ConfigProvider.ConfigContext);
56
- const prefixCls = getPrefixCls("task-graph");
57
- const { wrapSSR } = (0, import_style.default)(prefixCls);
58
- const [size, setSize] = (0, import_react.useState)(DEFAULT_SIZE);
59
- const [activeKey, setActiveKey] = (0, import_react.useState)(void 0);
60
- const [panes, setPanes] = (0, import_react.useState)([]);
61
- const [collapsed, setCollapsed] = (0, import_react.useState)(true);
62
- function handleEditLogWindow(targetKey, action) {
63
- var _a, _b;
64
- if (action === "remove") {
65
- let lastIndex = -1;
66
- panes.forEach((item, i) => {
67
- if (`${item.id}` === targetKey) {
68
- lastIndex = i - 1;
69
- }
70
- });
71
- const newPanes = panes.filter((item) => `${item.id}` !== targetKey);
72
- if (newPanes.length > 0 && activeKey === targetKey) {
73
- if (lastIndex >= 0) {
74
- setActiveKey(`${(_a = newPanes == null ? void 0 : newPanes[lastIndex]) == null ? void 0 : _a.id}`);
75
- } else {
76
- setActiveKey(`${(_b = newPanes == null ? void 0 : newPanes[0]) == null ? void 0 : _b.id}`);
77
- }
78
- }
79
- setPanes(newPanes);
80
- if (newPanes.length === 0) {
81
- setActiveKey("");
82
- setCollapsed(true);
83
- }
84
- }
85
- if (onTabsEdit) {
86
- onTabsEdit(targetKey, action);
87
- }
88
- }
89
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
90
- import_react_split_pane.default,
91
- {
92
- split: "horizontal",
93
- primary: "second",
94
- minSize: collapsed ? MIN_SIZE : 160,
95
- maxSize: 480,
96
- size: collapsed ? MIN_SIZE : size,
97
- onChange: (value) => {
98
- setSize(value);
99
- if (value === MIN_SIZE) {
100
- setCollapsed(true);
101
- } else if (value > MIN_SIZE && collapsed) {
102
- setCollapsed(false);
103
- }
104
- },
105
- className: `${prefixCls}-split-pane`,
106
- children: [
107
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
108
- import_Graph.default,
109
- {
110
- onLogAdd: (subTask) => {
111
- const isExisted = (0, import_lodash.find)(panes, (item) => item.id === subTask.id);
112
- if (!isExisted) {
113
- setPanes([...panes, subTask]);
114
- }
115
- setCollapsed(false);
116
- if (size === MIN_SIZE) {
117
- setSize(DEFAULT_SIZE);
118
- }
119
- setActiveKey(subTask && `${subTask.id}`);
120
- },
121
- ...restProps
122
- }
123
- ) }),
124
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `${prefixCls}-tabs-wrapper`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
125
- import_design.Tabs,
126
- {
127
- type: "editable-card",
128
- hideAdd: true,
129
- activeKey,
130
- onChange: (key) => {
131
- setActiveKey(key);
132
- if (onTabsChange) {
133
- onTabsChange(key);
134
- }
135
- },
136
- onEdit: handleEditLogWindow,
137
- tabBarExtraContent: collapsed ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
138
- import_icons.UpOutlined,
139
- {
140
- onClick: () => {
141
- setCollapsed(!collapsed);
142
- if (size === MIN_SIZE) {
143
- setSize(DEFAULT_SIZE);
144
- }
145
- }
146
- }
147
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
148
- import_icons.DownOutlined,
149
- {
150
- onClick: () => {
151
- setCollapsed(!collapsed);
152
- if (size === MIN_SIZE) {
153
- setSize(DEFAULT_SIZE);
154
- }
155
- }
156
- }
157
- ),
158
- children: panes.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TabPane, { tab: `${item.name} (ID: ${item.id})`, children: [
159
- logLoading && item.status !== "RUNNING" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design.Spin, {}) : subTaskLog,
160
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design.Spin, { spinning: item.status === "RUNNING" })
161
- ] }, `${item.id}`))
162
- }
163
- ) })
164
- ]
165
- }
166
- );
167
- };
168
- var TaskGraph_default = (0, import_LocaleWrapper.default)({
169
- componentName: "TaskGraph",
170
- defaultLocale: import_zh_CN.default
171
- })(TaskGraph);