@oceanbase/ui 1.0.0-alpha.5 → 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.
- package/dist/static/Inter-Medium.ea234620.woff2 +0 -0
- package/dist/static/Inter-Regular.34ba43c9.woff2 +0 -0
- package/dist/static/Inter-SemiBold.95439fb4.woff2 +0 -0
- package/dist/ui.min.css +1 -1
- package/dist/ui.min.js +1 -1
- package/es/BasicLayout/locale/ja-JP.js +6 -6
- package/es/Boundary/locale/en-US.js +1 -1
- package/es/Boundary/locale/ja-JP.js +4 -4
- package/es/Boundary/locale/zh-CN.js +1 -1
- package/es/Boundary/locale/zh-TW.js +1 -1
- package/es/DateRanger/locale/ja-JP.js +3 -3
- package/es/Dialog/locale/ja-JP.js +2 -2
- package/es/Dialog/locale/zh-CN.js +1 -1
- package/es/Dialog/locale/zh-TW.js +1 -1
- package/es/Login/locale/ja-JP.js +11 -11
- package/es/Login/locale/zh-CN.js +2 -2
- package/es/PageContainer/index.d.ts +2 -0
- package/es/PageContainer/index.js +74 -23
- package/es/PageContainer/locale/en-US.d.ts +1 -0
- package/es/PageContainer/locale/en-US.js +2 -1
- package/es/PageContainer/locale/ja-JP.d.ts +1 -0
- package/es/PageContainer/locale/ja-JP.js +2 -1
- package/es/PageContainer/locale/zh-CN.d.ts +1 -0
- package/es/PageContainer/locale/zh-CN.js +2 -1
- package/es/PageContainer/locale/zh-TW.d.ts +1 -0
- package/es/PageContainer/locale/zh-TW.js +2 -1
- package/es/PageContainer/style/index.js +16 -2
- package/es/Password/locale/ja-JP.js +6 -6
- package/es/ProTable/style/index.js +8 -4
- package/es/_util/genComponentStyleHook.d.ts +2 -2
- package/es/_util/genComponentStyleHook.js +1 -1
- package/es/index.d.ts +0 -4
- package/es/index.js +0 -2
- package/es/locale/en-US.js +0 -4
- package/es/locale/ja-JP.js +0 -4
- package/es/locale/zh-CN.js +0 -4
- package/es/locale/zh-TW.js +0 -4
- package/lib/BasicLayout/locale/ja-JP.js +6 -6
- package/lib/Boundary/locale/en-US.js +1 -1
- package/lib/Boundary/locale/ja-JP.js +4 -4
- package/lib/Boundary/locale/zh-CN.js +1 -1
- package/lib/Boundary/locale/zh-TW.js +1 -1
- package/lib/DateRanger/locale/ja-JP.js +3 -3
- package/lib/Dialog/locale/ja-JP.js +2 -2
- package/lib/Dialog/locale/zh-CN.js +1 -1
- package/lib/Dialog/locale/zh-TW.js +1 -1
- package/lib/Login/locale/ja-JP.js +11 -11
- package/lib/Login/locale/zh-CN.js +2 -2
- package/lib/PageContainer/index.d.ts +2 -0
- package/lib/PageContainer/index.js +49 -2
- package/lib/PageContainer/locale/en-US.d.ts +1 -0
- package/lib/PageContainer/locale/en-US.js +2 -1
- package/lib/PageContainer/locale/ja-JP.d.ts +1 -0
- package/lib/PageContainer/locale/ja-JP.js +2 -1
- package/lib/PageContainer/locale/zh-CN.d.ts +1 -0
- package/lib/PageContainer/locale/zh-CN.js +2 -1
- package/lib/PageContainer/locale/zh-TW.d.ts +1 -0
- package/lib/PageContainer/locale/zh-TW.js +2 -1
- package/lib/PageContainer/style/index.js +17 -1
- package/lib/Password/locale/ja-JP.js +6 -6
- package/lib/ProTable/style/index.js +11 -1
- package/lib/_util/genComponentStyleHook.d.ts +2 -2
- package/lib/_util/genComponentStyleHook.js +1 -1
- package/lib/index.d.ts +0 -4
- package/lib/index.js +0 -6
- package/lib/locale/en-US.js +16 -20
- package/lib/locale/ja-JP.js +16 -20
- package/lib/locale/zh-CN.js +17 -21
- package/lib/locale/zh-TW.js +15 -19
- package/package.json +4 -4
- package/dist/static/Inter.f6bcdfb6.woff2 +0 -0
- package/es/GraphToolbar/index.d.ts +0 -25
- package/es/GraphToolbar/index.js +0 -149
- package/es/GraphToolbar/locale/en-US.d.ts +0 -9
- package/es/GraphToolbar/locale/en-US.js +0 -8
- package/es/GraphToolbar/locale/ja-JP.d.ts +0 -9
- package/es/GraphToolbar/locale/ja-JP.js +0 -8
- package/es/GraphToolbar/locale/zh-CN.d.ts +0 -9
- package/es/GraphToolbar/locale/zh-CN.js +0 -8
- package/es/GraphToolbar/locale/zh-TW.d.ts +0 -9
- package/es/GraphToolbar/locale/zh-TW.js +0 -8
- package/es/GraphToolbar/style/index.d.ts +0 -10
- package/es/GraphToolbar/style/index.js +0 -60
- package/es/TaskGraph/Graph/style/index.d.ts +0 -10
- package/es/TaskGraph/Graph/style/index.js +0 -28
- package/es/TaskGraph/Graph.d.ts +0 -23
- package/es/TaskGraph/Graph.js +0 -287
- package/es/TaskGraph/index.d.ts +0 -15
- package/es/TaskGraph/index.js +0 -181
- package/es/TaskGraph/locale/en-US.d.ts +0 -13
- package/es/TaskGraph/locale/en-US.js +0 -12
- package/es/TaskGraph/locale/ja-JP.d.ts +0 -13
- package/es/TaskGraph/locale/ja-JP.js +0 -12
- package/es/TaskGraph/locale/zh-CN.d.ts +0 -13
- package/es/TaskGraph/locale/zh-CN.js +0 -12
- package/es/TaskGraph/locale/zh-TW.d.ts +0 -13
- package/es/TaskGraph/locale/zh-TW.js +0 -12
- package/es/TaskGraph/register.d.ts +0 -7
- package/es/TaskGraph/register.js +0 -200
- package/es/TaskGraph/style/index.d.ts +0 -10
- package/es/TaskGraph/style/index.js +0 -102
- package/lib/GraphToolbar/index.d.ts +0 -25
- package/lib/GraphToolbar/index.js +0 -169
- package/lib/GraphToolbar/locale/en-US.d.ts +0 -9
- package/lib/GraphToolbar/locale/en-US.js +0 -32
- package/lib/GraphToolbar/locale/ja-JP.d.ts +0 -9
- package/lib/GraphToolbar/locale/ja-JP.js +0 -32
- package/lib/GraphToolbar/locale/zh-CN.d.ts +0 -9
- package/lib/GraphToolbar/locale/zh-CN.js +0 -32
- package/lib/GraphToolbar/locale/zh-TW.d.ts +0 -9
- package/lib/GraphToolbar/locale/zh-TW.js +0 -32
- package/lib/GraphToolbar/style/index.d.ts +0 -10
- package/lib/GraphToolbar/style/index.js +0 -91
- package/lib/TaskGraph/Graph/style/index.d.ts +0 -10
- package/lib/TaskGraph/Graph/style/index.js +0 -56
- package/lib/TaskGraph/Graph.d.ts +0 -23
- package/lib/TaskGraph/Graph.js +0 -275
- package/lib/TaskGraph/index.d.ts +0 -15
- package/lib/TaskGraph/index.js +0 -171
- package/lib/TaskGraph/locale/en-US.d.ts +0 -13
- package/lib/TaskGraph/locale/en-US.js +0 -36
- package/lib/TaskGraph/locale/ja-JP.d.ts +0 -13
- package/lib/TaskGraph/locale/ja-JP.js +0 -36
- package/lib/TaskGraph/locale/zh-CN.d.ts +0 -13
- package/lib/TaskGraph/locale/zh-CN.js +0 -36
- package/lib/TaskGraph/locale/zh-TW.d.ts +0 -13
- package/lib/TaskGraph/locale/zh-TW.js +0 -36
- package/lib/TaskGraph/register.d.ts +0 -7
- package/lib/TaskGraph/register.js +0 -205
- package/lib/TaskGraph/style/index.d.ts +0 -10
- package/lib/TaskGraph/style/index.js +0 -143
package/es/TaskGraph/Graph.js
DELETED
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
6
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
7
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
9
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
10
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
12
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
14
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
-
import { findByValue } from '@oceanbase/util';
|
|
16
|
-
import { ConfigProvider, Dropdown, Menu, Typography } from '@oceanbase/design';
|
|
17
|
-
import { isEqual } from 'lodash';
|
|
18
|
-
import React from 'react';
|
|
19
|
-
import { token } from '@oceanbase/design';
|
|
20
|
-
import GraphToolbar from "../GraphToolbar";
|
|
21
|
-
import LocaleWrapper from "../locale/LocaleWrapper";
|
|
22
|
-
import useStyle from "./Graph/style";
|
|
23
|
-
import zhCN from "./locale/zh-CN";
|
|
24
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
25
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
|
-
var Text = Typography.Text;
|
|
28
|
-
|
|
29
|
-
// Wrapper component to use hooks for styling
|
|
30
|
-
var GraphWrapper = function GraphWrapper(_ref) {
|
|
31
|
-
var prefixCls = _ref.prefixCls,
|
|
32
|
-
children = _ref.children;
|
|
33
|
-
var _useStyle = useStyle(prefixCls),
|
|
34
|
-
wrapSSR = _useStyle.wrapSSR;
|
|
35
|
-
return wrapSSR( /*#__PURE__*/_jsx(_Fragment, {
|
|
36
|
-
children: children
|
|
37
|
-
}));
|
|
38
|
-
};
|
|
39
|
-
var TaskGraph = /*#__PURE__*/function (_React$PureComponent) {
|
|
40
|
-
_inherits(TaskGraph, _React$PureComponent);
|
|
41
|
-
var _super = _createSuper(TaskGraph);
|
|
42
|
-
function TaskGraph(props) {
|
|
43
|
-
var _this;
|
|
44
|
-
_classCallCheck(this, TaskGraph);
|
|
45
|
-
_this = _super.call(this, props);
|
|
46
|
-
_defineProperty(_assertThisInitialized(_this), "main", null);
|
|
47
|
-
_defineProperty(_assertThisInitialized(_this), "menu", null);
|
|
48
|
-
_defineProperty(_assertThisInitialized(_this), "graph", void 0);
|
|
49
|
-
_defineProperty(_assertThisInitialized(_this), "drawGraph", function () {
|
|
50
|
-
var data = _this.props.data;
|
|
51
|
-
if (_this.graph && _this.graph.changeData) {
|
|
52
|
-
_this.graph.changeData(data);
|
|
53
|
-
} else {
|
|
54
|
-
var splitPane = document.getElementsByClassName('SplitPane') && document.getElementsByClassName('SplitPane')[0];
|
|
55
|
-
var width = _this.main && _this.main.scrollWidth || 1200;
|
|
56
|
-
// 高度优先级: 元素本身的高度 => 分隔面板的高度 => 500
|
|
57
|
-
// 还需要减去下方的 log 条的最小高度 56px
|
|
58
|
-
var height = (_this.main && _this.main.scrollHeight || splitPane.scrollHeight || 500) - 65;
|
|
59
|
-
import('@antv/g6').then(function (G6) {
|
|
60
|
-
var graph = new G6.Graph({
|
|
61
|
-
container: 'container',
|
|
62
|
-
width: width,
|
|
63
|
-
height: height,
|
|
64
|
-
minZoom: 0.2,
|
|
65
|
-
maxZoom: 2,
|
|
66
|
-
layout: {
|
|
67
|
-
type: 'dagre',
|
|
68
|
-
nodesep: 90,
|
|
69
|
-
ranksep: 40,
|
|
70
|
-
controlPoints: false
|
|
71
|
-
},
|
|
72
|
-
defaultNode: {
|
|
73
|
-
type: 'subTaskNode',
|
|
74
|
-
anchorPoints: [[0.5, 0], [0.5, 1]]
|
|
75
|
-
},
|
|
76
|
-
defaultEdge: {
|
|
77
|
-
type: 'subTaskEdge'
|
|
78
|
-
},
|
|
79
|
-
nodeStateStyles: {
|
|
80
|
-
hover: {
|
|
81
|
-
lineWidth: 2,
|
|
82
|
-
stroke: token.colorPrimary,
|
|
83
|
-
fill: '#e6f7ff'
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
modes: {
|
|
87
|
-
default: ['drag-canvas', 'zoom-canvas', 'click-select']
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
var canvas = graph.get('canvas');
|
|
91
|
-
// 关闭局部渲染,避免渲染出现拖影
|
|
92
|
-
canvas.set('localRefresh', false);
|
|
93
|
-
graph.data(data);
|
|
94
|
-
graph.render();
|
|
95
|
-
graph.fitView();
|
|
96
|
-
|
|
97
|
-
// 监听 moreGroup 的 click 事件
|
|
98
|
-
canvas.on('moreGroup:click', function (e) {
|
|
99
|
-
var subTaskNode = e.currentTarget && e.currentTarget.getParent();
|
|
100
|
-
var model = subTaskNode && subTaskNode.get('item') && subTaskNode.get('item').getModel();
|
|
101
|
-
_this.setState({
|
|
102
|
-
currentSubTask: model
|
|
103
|
-
}, function () {
|
|
104
|
-
if (!_this.menu) {
|
|
105
|
-
_this.menu = document.getElementById('menu');
|
|
106
|
-
}
|
|
107
|
-
_this.menu.style.left = "".concat(e.x, "px");
|
|
108
|
-
// y 坐标减去高度,并再往上 5px
|
|
109
|
-
_this.menu.style.top = "".concat(e.y - height - 5, "px");
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
// 监听节点的 mouseleave 事件
|
|
114
|
-
graph.on('node:mouseleave', function () {
|
|
115
|
-
if (!_this.menu) {
|
|
116
|
-
_this.menu = document.getElementById('menu');
|
|
117
|
-
}
|
|
118
|
-
_this.menu.style.left = '-1500px';
|
|
119
|
-
});
|
|
120
|
-
_this.graph = graph;
|
|
121
|
-
// 强制更新一次视图,否则 this.graph 不会更新
|
|
122
|
-
_this.forceUpdate();
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
_defineProperty(_assertThisInitialized(_this), "handleMenuClick", function (_ref2) {
|
|
127
|
-
var key = _ref2.key;
|
|
128
|
-
var onMenuClick = _this.props.onMenuClick;
|
|
129
|
-
var currentSubTask = _this.state.currentSubTask;
|
|
130
|
-
// 成功的回调
|
|
131
|
-
var onSuccess = function onSuccess() {
|
|
132
|
-
_this.setState({
|
|
133
|
-
currentSubTask: null
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
if (key === 'log') {
|
|
137
|
-
_this.log();
|
|
138
|
-
}
|
|
139
|
-
if (onMenuClick) {
|
|
140
|
-
onMenuClick(key, currentSubTask, onSuccess);
|
|
141
|
-
}
|
|
142
|
-
if (_this.menu) {
|
|
143
|
-
_this.menu.style.left = '-1500px';
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
_defineProperty(_assertThisInitialized(_this), "log", function () {
|
|
147
|
-
var onLogAdd = _this.props.onLogAdd;
|
|
148
|
-
var currentSubTask = _this.state.currentSubTask;
|
|
149
|
-
if (onLogAdd) {
|
|
150
|
-
onLogAdd(currentSubTask);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
var locale = props.locale;
|
|
154
|
-
_this.state = {
|
|
155
|
-
currentSubTask: null,
|
|
156
|
-
statusList: [{
|
|
157
|
-
label: locale.successful,
|
|
158
|
-
value: 'SUCCESSFUL',
|
|
159
|
-
color: '#9adc78',
|
|
160
|
-
operations: ['taskId', 'log', 'parameter']
|
|
161
|
-
}, {
|
|
162
|
-
label: locale.running,
|
|
163
|
-
value: 'RUNNING',
|
|
164
|
-
color: '#80c3fc',
|
|
165
|
-
operations: ['taskId', 'log', 'parameter', 'stop']
|
|
166
|
-
}, {
|
|
167
|
-
label: locale.failed,
|
|
168
|
-
value: 'FAILED',
|
|
169
|
-
color: '#fca4a2',
|
|
170
|
-
operations: ['taskId', 'log', 'parameter', 'retry', 'skip']
|
|
171
|
-
}, {
|
|
172
|
-
label: locale.pending,
|
|
173
|
-
value: 'PENDING',
|
|
174
|
-
color: '#cccccc',
|
|
175
|
-
operations: ['taskId', 'parameter']
|
|
176
|
-
}]
|
|
177
|
-
};
|
|
178
|
-
return _this;
|
|
179
|
-
}
|
|
180
|
-
_createClass(TaskGraph, [{
|
|
181
|
-
key: "componentDidMount",
|
|
182
|
-
value: function componentDidMount() {
|
|
183
|
-
var _this2 = this;
|
|
184
|
-
var _this$props$assetsPat = this.props.assetsPath,
|
|
185
|
-
assetsPath = _this$props$assetsPat === void 0 ? '/assets' : _this$props$assetsPat;
|
|
186
|
-
var statusList = this.state.statusList;
|
|
187
|
-
import("./register").then(function (register) {
|
|
188
|
-
register.default(statusList, assetsPath);
|
|
189
|
-
_this2.menu = document.getElementById('menu');
|
|
190
|
-
_this2.drawGraph();
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
}, {
|
|
194
|
-
key: "componentDidUpdate",
|
|
195
|
-
value: function componentDidUpdate(prevProps) {
|
|
196
|
-
var data = this.props.data;
|
|
197
|
-
if (!isEqual(data, prevProps.data)) {
|
|
198
|
-
this.drawGraph();
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}, {
|
|
202
|
-
key: "render",
|
|
203
|
-
value: function render() {
|
|
204
|
-
var _this3 = this;
|
|
205
|
-
var locale = this.props.locale;
|
|
206
|
-
var _this$state = this.state,
|
|
207
|
-
statusList = _this$state.statusList,
|
|
208
|
-
currentSubTask = _this$state.currentSubTask;
|
|
209
|
-
// @ts-ignore
|
|
210
|
-
var _ref3 = this.context || {},
|
|
211
|
-
getPrefixCls = _ref3.getPrefixCls;
|
|
212
|
-
var prefixCls = getPrefixCls === null || getPrefixCls === void 0 ? void 0 : getPrefixCls('task-graph-item');
|
|
213
|
-
var operations = findByValue(statusList, currentSubTask && currentSubTask.status).operations || [];
|
|
214
|
-
var menus = [{
|
|
215
|
-
label: locale.taskId,
|
|
216
|
-
value: 'taskId'
|
|
217
|
-
}, {
|
|
218
|
-
label: locale.log,
|
|
219
|
-
value: 'log'
|
|
220
|
-
}, {
|
|
221
|
-
label: locale.parameter,
|
|
222
|
-
value: 'parameter'
|
|
223
|
-
}, {
|
|
224
|
-
label: locale.stop,
|
|
225
|
-
value: 'stop'
|
|
226
|
-
}, {
|
|
227
|
-
label: locale.retry,
|
|
228
|
-
value: 'retry'
|
|
229
|
-
}, {
|
|
230
|
-
label: locale.skip,
|
|
231
|
-
value: 'skip'
|
|
232
|
-
}];
|
|
233
|
-
var filterMenus = menus.filter(function (item) {
|
|
234
|
-
return operations.includes(item.value);
|
|
235
|
-
});
|
|
236
|
-
var menu = /*#__PURE__*/_jsx(Menu, {
|
|
237
|
-
id: "menu",
|
|
238
|
-
onClick: this.handleMenuClick,
|
|
239
|
-
style: {
|
|
240
|
-
left: -1500
|
|
241
|
-
},
|
|
242
|
-
children: filterMenus.map(function (item) {
|
|
243
|
-
return item.value === 'taskId' ? /*#__PURE__*/_jsx("div", {
|
|
244
|
-
className: "".concat(prefixCls, "-task-id-wrapper")
|
|
245
|
-
// 下拉菜单数 > 1 时才有下边框
|
|
246
|
-
,
|
|
247
|
-
style: filterMenus.length > 1 ? {
|
|
248
|
-
borderBottom: '1px solid #e8e8e8'
|
|
249
|
-
} : {},
|
|
250
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
251
|
-
copyable: true,
|
|
252
|
-
children: "ID: ".concat(currentSubTask && currentSubTask.id)
|
|
253
|
-
})
|
|
254
|
-
}, "task-id") : /*#__PURE__*/_jsx(Menu.Item, {
|
|
255
|
-
children: item.label
|
|
256
|
-
}, item.value);
|
|
257
|
-
})
|
|
258
|
-
});
|
|
259
|
-
return /*#__PURE__*/_jsxs(GraphWrapper, {
|
|
260
|
-
prefixCls: prefixCls,
|
|
261
|
-
children: [this.graph && /*#__PURE__*/_jsx(GraphToolbar, {
|
|
262
|
-
mode: "fixed",
|
|
263
|
-
graph: this.graph
|
|
264
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
265
|
-
id: "container",
|
|
266
|
-
ref: function ref(node) {
|
|
267
|
-
_this3.main = node;
|
|
268
|
-
}
|
|
269
|
-
}), /*#__PURE__*/_jsx(Dropdown, {
|
|
270
|
-
visible: true
|
|
271
|
-
// Support for antd 5.0
|
|
272
|
-
,
|
|
273
|
-
open: true,
|
|
274
|
-
overlay: menu,
|
|
275
|
-
overlayClassName: "".concat(prefixCls, "-menu"),
|
|
276
|
-
children: /*#__PURE__*/_jsx("span", {})
|
|
277
|
-
})]
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
}]);
|
|
281
|
-
return TaskGraph;
|
|
282
|
-
}(React.PureComponent);
|
|
283
|
-
_defineProperty(TaskGraph, "contextType", ConfigProvider.ConfigContext);
|
|
284
|
-
export default LocaleWrapper({
|
|
285
|
-
componentName: 'TaskGraph',
|
|
286
|
-
defaultLocale: zhCN
|
|
287
|
-
})(TaskGraph);
|
package/es/TaskGraph/index.d.ts
DELETED
|
@@ -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;
|
package/es/TaskGraph/index.js
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["logLoading", "subTaskLog", "onTabsChange", "onTabsEdit"];
|
|
3
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
11
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
12
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
16
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
17
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
19
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
|
-
//@ts-nocheck
|
|
21
|
-
import { DownOutlined, UpOutlined } from '@oceanbase/icons';
|
|
22
|
-
import { ConfigProvider, Spin, Tabs } from '@oceanbase/design';
|
|
23
|
-
import { find, noop } from 'lodash';
|
|
24
|
-
import React, { useContext, useState } from 'react';
|
|
25
|
-
import SplitPane from 'react-split-pane';
|
|
26
|
-
import LocaleWrapper from "../locale/LocaleWrapper";
|
|
27
|
-
import useStyle from "./style";
|
|
28
|
-
import Graph from "./Graph";
|
|
29
|
-
import zhCN from "./locale/zh-CN";
|
|
30
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
31
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
32
|
-
var TabPane = Tabs.TabPane;
|
|
33
|
-
var MIN_SIZE = 56;
|
|
34
|
-
var DEFAULT_SIZE = 240;
|
|
35
|
-
var TaskGraph = function TaskGraph(_ref) {
|
|
36
|
-
var _ref$logLoading = _ref.logLoading,
|
|
37
|
-
logLoading = _ref$logLoading === void 0 ? false : _ref$logLoading,
|
|
38
|
-
subTaskLog = _ref.subTaskLog,
|
|
39
|
-
_ref$onTabsChange = _ref.onTabsChange,
|
|
40
|
-
onTabsChange = _ref$onTabsChange === void 0 ? noop : _ref$onTabsChange,
|
|
41
|
-
_ref$onTabsEdit = _ref.onTabsEdit,
|
|
42
|
-
onTabsEdit = _ref$onTabsEdit === void 0 ? noop : _ref$onTabsEdit,
|
|
43
|
-
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
44
|
-
var _useContext = useContext(ConfigProvider.ConfigContext),
|
|
45
|
-
getPrefixCls = _useContext.getPrefixCls;
|
|
46
|
-
var prefixCls = getPrefixCls('task-graph');
|
|
47
|
-
var _useStyle = useStyle(prefixCls),
|
|
48
|
-
wrapSSR = _useStyle.wrapSSR;
|
|
49
|
-
var _useState = useState(DEFAULT_SIZE),
|
|
50
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
-
size = _useState2[0],
|
|
52
|
-
setSize = _useState2[1];
|
|
53
|
-
var _useState3 = useState(undefined),
|
|
54
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
55
|
-
activeKey = _useState4[0],
|
|
56
|
-
setActiveKey = _useState4[1];
|
|
57
|
-
var _useState5 = useState([]),
|
|
58
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
59
|
-
panes = _useState6[0],
|
|
60
|
-
setPanes = _useState6[1];
|
|
61
|
-
var _useState7 = useState(true),
|
|
62
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
63
|
-
collapsed = _useState8[0],
|
|
64
|
-
setCollapsed = _useState8[1];
|
|
65
|
-
function handleEditLogWindow(targetKey, action) {
|
|
66
|
-
// 只处理关闭标签页的行为
|
|
67
|
-
if (action === 'remove') {
|
|
68
|
-
var lastIndex = -1;
|
|
69
|
-
panes.forEach(function (item, i) {
|
|
70
|
-
// id 为数值,需要转为字符串才能与 targetKey 进行比较判断
|
|
71
|
-
if ("".concat(item.id) === targetKey) {
|
|
72
|
-
lastIndex = i - 1;
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
var newPanes = panes.filter(function (item) {
|
|
76
|
-
return "".concat(item.id) !== targetKey;
|
|
77
|
-
});
|
|
78
|
-
// 关闭当前打开的 tab 页
|
|
79
|
-
if (newPanes.length > 0 && activeKey === targetKey) {
|
|
80
|
-
if (lastIndex >= 0) {
|
|
81
|
-
var _newPanes$lastIndex;
|
|
82
|
-
setActiveKey("".concat(newPanes === null || newPanes === void 0 || (_newPanes$lastIndex = newPanes[lastIndex]) === null || _newPanes$lastIndex === void 0 ? void 0 : _newPanes$lastIndex.id));
|
|
83
|
-
} else {
|
|
84
|
-
var _newPanes$;
|
|
85
|
-
setActiveKey("".concat(newPanes === null || newPanes === void 0 || (_newPanes$ = newPanes[0]) === null || _newPanes$ === void 0 ? void 0 : _newPanes$.id));
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
setPanes(newPanes);
|
|
89
|
-
if (newPanes.length === 0) {
|
|
90
|
-
// 关闭全部 tab 页时,选中的 tab 页为空
|
|
91
|
-
setActiveKey('');
|
|
92
|
-
setCollapsed(true);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (onTabsEdit) {
|
|
96
|
-
onTabsEdit(targetKey, action);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return /*#__PURE__*/_jsxs(SplitPane, {
|
|
100
|
-
split: "horizontal",
|
|
101
|
-
primary: "second"
|
|
102
|
-
// 折叠状态最小高度为 MIN_SIZE,否则为 160
|
|
103
|
-
,
|
|
104
|
-
minSize: collapsed ? MIN_SIZE : 160,
|
|
105
|
-
maxSize: 480,
|
|
106
|
-
size: collapsed ? MIN_SIZE : size,
|
|
107
|
-
onChange: function onChange(value) {
|
|
108
|
-
setSize(value);
|
|
109
|
-
if (value === MIN_SIZE) {
|
|
110
|
-
// 如果高度等于最小值,则设为收缩状态
|
|
111
|
-
setCollapsed(true);
|
|
112
|
-
} else if (value > MIN_SIZE && collapsed) {
|
|
113
|
-
// 如果高度大于最小值,且为收缩状态,则设为展开状态
|
|
114
|
-
setCollapsed(false);
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
className: "".concat(prefixCls, "-split-pane"),
|
|
118
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
119
|
-
style: {
|
|
120
|
-
position: 'absolute',
|
|
121
|
-
width: '100%'
|
|
122
|
-
},
|
|
123
|
-
children: /*#__PURE__*/_jsx(Graph, _objectSpread({
|
|
124
|
-
onLogAdd: function onLogAdd(subTask) {
|
|
125
|
-
var isExisted = find(panes, function (item) {
|
|
126
|
-
return item.id === subTask.id;
|
|
127
|
-
});
|
|
128
|
-
if (!isExisted) {
|
|
129
|
-
setPanes([].concat(_toConsumableArray(panes), [subTask]));
|
|
130
|
-
}
|
|
131
|
-
setCollapsed(false);
|
|
132
|
-
if (size === MIN_SIZE) {
|
|
133
|
-
setSize(DEFAULT_SIZE);
|
|
134
|
-
}
|
|
135
|
-
setActiveKey(subTask && "".concat(subTask.id));
|
|
136
|
-
}
|
|
137
|
-
}, restProps))
|
|
138
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
139
|
-
className: "".concat(prefixCls, "-tabs-wrapper"),
|
|
140
|
-
children: /*#__PURE__*/_jsx(Tabs, {
|
|
141
|
-
type: "editable-card",
|
|
142
|
-
hideAdd: true,
|
|
143
|
-
activeKey: activeKey,
|
|
144
|
-
onChange: function onChange(key) {
|
|
145
|
-
setActiveKey(key);
|
|
146
|
-
if (onTabsChange) {
|
|
147
|
-
onTabsChange(key);
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
onEdit: handleEditLogWindow,
|
|
151
|
-
tabBarExtraContent: collapsed ? /*#__PURE__*/_jsx(UpOutlined, {
|
|
152
|
-
onClick: function onClick() {
|
|
153
|
-
setCollapsed(!collapsed);
|
|
154
|
-
if (size === MIN_SIZE) {
|
|
155
|
-
setSize(DEFAULT_SIZE);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}) : /*#__PURE__*/_jsx(DownOutlined, {
|
|
159
|
-
onClick: function onClick() {
|
|
160
|
-
setCollapsed(!collapsed);
|
|
161
|
-
if (size === MIN_SIZE) {
|
|
162
|
-
setSize(DEFAULT_SIZE);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}),
|
|
166
|
-
children: panes.map(function (item) {
|
|
167
|
-
return /*#__PURE__*/_jsxs(TabPane, {
|
|
168
|
-
tab: "".concat(item.name, " (ID: ").concat(item.id, ")"),
|
|
169
|
-
children: [logLoading && item.status !== 'RUNNING' ? /*#__PURE__*/_jsx(Spin, {}) : subTaskLog, /*#__PURE__*/_jsx(Spin, {
|
|
170
|
-
spinning: item.status === 'RUNNING'
|
|
171
|
-
})]
|
|
172
|
-
}, "".concat(item.id));
|
|
173
|
-
})
|
|
174
|
-
})
|
|
175
|
-
})]
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
export default LocaleWrapper({
|
|
179
|
-
componentName: 'TaskGraph',
|
|
180
|
-
defaultLocale: zhCN
|
|
181
|
-
})(TaskGraph);
|