@titaui/pc 1.11.12 → 1.11.13-beta.3

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 (59) hide show
  1. package/.husky/pre-commit +1 -1
  2. package/lib/components/avatar/name-avatar/index.css +1 -0
  3. package/lib/components/avatar/name-avatar/index.js +22 -13
  4. package/lib/components/button/rect-btn/index.css +25 -11
  5. package/lib/components/button/rect-btn/index.js +8 -4
  6. package/lib/components/create-okr-modal/request-api.js +1 -1
  7. package/lib/components/drawer/headerAction.js +5 -1
  8. package/lib/components/drawer/headerDrop.js +41 -4
  9. package/lib/components/drawer/index.css +44 -0
  10. package/lib/components/drawer/index.js +35 -6
  11. package/lib/components/dynamic/constant.js +9 -5
  12. package/lib/components/dynamic/dynamic-item/dynamic-kr/index.js +1 -1
  13. package/lib/components/dynamic/dynamic-item/dynamic-task/index.js +1 -1
  14. package/lib/components/icon-button-list/index.css +1 -1
  15. package/lib/components/nav-top/index.js +6 -2
  16. package/lib/components/okr-detail/base-info/other-infos/date-cycle/index.js +16 -4
  17. package/lib/components/okr-detail/base-info/other-infos/principal/index.js +9 -1
  18. package/lib/components/okr-detail/components/header/index.js +9 -3
  19. package/lib/components/okr-detail/components/header/o-name.js +9 -3
  20. package/lib/components/okr-detail/components/o-classify.js +5 -1
  21. package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/index.js +9 -6
  22. package/lib/components/okr-detail/detail-header/constant.js +53 -0
  23. package/lib/components/okr-detail/detail-header/index.js +12 -1
  24. package/lib/components/okr-detail/helper.js +62 -0
  25. package/lib/components/okr-detail/index.js +21 -2
  26. package/lib/components/okr-detail/okr-list/index.js +8 -3
  27. package/lib/components/okr-detail/request-apis.js +7 -1
  28. package/lib/components/okr-flow/child-node/index.css +54 -15
  29. package/lib/components/okr-flow/child-node/work-node.js +19 -3
  30. package/lib/components/okr-flow/empty/index.css +8 -1
  31. package/lib/components/okr-flow/export-modal/index.js +26 -2
  32. package/lib/components/okr-flow/export-modules/okr-search-panel/index.css +3 -1
  33. package/lib/components/okr-flow/export-modules/okr-search-panel/index.js +14 -9
  34. package/lib/components/okr-flow/images/loading-light.gif +0 -0
  35. package/lib/components/okr-flow/okr-map/index.js +32 -14
  36. package/lib/components/okr-flow/request-apis.js +11 -4
  37. package/lib/components/okr-flow/root-node/index.css +2 -2
  38. package/lib/components/okr-flow/utils/index.js +43 -26
  39. package/lib/components/okr-flow/utils/tree-handler.js +14 -3
  40. package/lib/components/okr-period-selector/select-cycle.js +23 -19
  41. package/lib/components/okrcase-library/okrcases-components/submitOkr-dialog.js +1 -0
  42. package/lib/components/period-selector/index.js +3 -0
  43. package/lib/components/textarea/index.css +120 -0
  44. package/lib/components/textarea/index.js +257 -0
  45. package/lib/index.js +40 -0
  46. package/lib/pages/new-okr-list/header/common.js +52 -0
  47. package/lib/pages/new-okr-list/header/index.css +45 -0
  48. package/lib/pages/new-okr-list/header/index.js +28 -16
  49. package/lib/pages/new-okr-list/header/operate-record.js +88 -0
  50. package/lib/pages/new-okr-list/index.js +3 -1
  51. package/lib/pages/new-okr-list/list/index.js +19 -2
  52. package/lib/pages/okr-map/export-modules/okr-map/header/index.css +6 -1
  53. package/lib/pages/okr-map/export-modules/okr-map/header/index.js +47 -13
  54. package/lib/pages/okr-map/export-modules/okr-map/okr-map.js +27 -17
  55. package/lib/pages/okr-map/number-select/index.css +4 -1
  56. package/lib/pages/okr-map/number-select/index.js +1 -1
  57. package/lib/utils/format-time.js +8 -1
  58. package/lib/utils/open-data.js +5 -1
  59. package/package.json +1 -1
@@ -33,6 +33,8 @@ var _precls = _interopRequireDefault(require("../precls"));
33
33
 
34
34
  var _getLocale = require("../../../utils/getLocale");
35
35
 
36
+ var _lodash = _interopRequireDefault(require("lodash"));
37
+
36
38
  require("rc-color-picker/assets/index.css");
37
39
 
38
40
  require("./index.css");
@@ -45,6 +47,14 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
45
47
 
46
48
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
47
49
 
50
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
51
+
52
+ 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."); }
53
+
54
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
55
+
56
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
57
+
48
58
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
49
59
 
50
60
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -88,6 +98,7 @@ var ExportMapModal = function ExportMapModal(props) {
88
98
  setIsExport = _useState6[1];
89
99
 
90
100
  var modalRef = (0, _react.useRef)();
101
+ var virtualElements = (0, _react.useRef)([]);
91
102
  (0, _react.useEffect)(function () {
92
103
  if ((0, _bsGlobal.isWx)() && window.WWOpenData) {
93
104
  if (window.WWOpenData.enableCanvasSharing) {
@@ -236,6 +247,19 @@ var ExportMapModal = function ExportMapModal(props) {
236
247
  setBgColor(colors ? colors.color : "none");
237
248
  };
238
249
 
250
+ var NodeDebug = function NodeDebug() {
251
+ var elements = (0, _reactFlowRenderer.useStoreState)(function (state) {
252
+ return [].concat(_toConsumableArray(state.nodes), _toConsumableArray(state.edges));
253
+ }, _lodash["default"].isEqual);
254
+ var setElements = (0, _reactFlowRenderer.useStoreActions)(function (actions) {
255
+ return actions.setElements;
256
+ });
257
+ var newElements = (0, _utils.getLayoutedElements)(elements, direction);
258
+ virtualElements = newElements;
259
+ setElements(newElements);
260
+ return null;
261
+ };
262
+
239
263
  return /*#__PURE__*/_react["default"].createElement(_dialog["default"], {
240
264
  title: (0, _getLocale.getLocale)("OKR_Ali_Exportmap"),
241
265
  noFooterLine: true,
@@ -275,7 +299,7 @@ var ExportMapModal = function ExportMapModal(props) {
275
299
  nodesDraggable: false,
276
300
  nodesConnectable: false,
277
301
  className: (0, _classnames["default"])("".concat(_precls["default"], "__export"), _defineProperty({}, "".concat(_precls["default"], "__dark"), darkTheme)),
278
- elements: (0, _utils.getLayoutedElements)(dataSource, direction),
302
+ elements: dataSource,
279
303
  nodeTypes: _utils.nodeTypes,
280
304
  minZoom: 0.05,
281
305
  zoomOnScroll: false,
@@ -287,7 +311,7 @@ var ExportMapModal = function ExportMapModal(props) {
287
311
  width: "100%",
288
312
  background: bgColor
289
313
  }
290
- }))))));
314
+ }, /*#__PURE__*/_react["default"].createElement(NodeDebug, null)))))));
291
315
  };
292
316
 
293
317
  ExportMapModal.defaultProps = {
@@ -4,12 +4,14 @@
4
4
  display: flex;
5
5
  justify-content: center;
6
6
  align-items: center;
7
+ background: #f0f4fa;
7
8
  }
8
9
 
9
10
  .titaui-okr-flow--loading-img {
10
- width: 162px;
11
+ width: 80px;
11
12
  height: 140px;
12
13
  background: url("../../images/loading-light.gif") no-repeat;
14
+ background-size: 100% auto;
13
15
  }
14
16
 
15
17
  .titaui-okr-flow--loading-img__dark {
@@ -87,6 +87,8 @@ function OkrSearchPanel(props, ref) {
87
87
  showkr = _props$showkr === void 0 ? true : _props$showkr,
88
88
  _props$darkTheme = props.darkTheme,
89
89
  darkTheme = _props$darkTheme === void 0 ? false : _props$darkTheme,
90
+ _props$showCardKr = props.showCardKr,
91
+ showCardKr = _props$showCardKr === void 0 ? false : _props$showCardKr,
90
92
  onNodeClick = props.onNodeClick;
91
93
 
92
94
  var _useState = (0, _react.useState)(true),
@@ -111,7 +113,7 @@ function OkrSearchPanel(props, ref) {
111
113
 
112
114
 
113
115
  var getSearchData = (0, _react.useRef)((0, _helper.debounce)( /*#__PURE__*/function () {
114
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(searchType, rootId, rootName, avatar, cycleType, yqmNum, annualNum, okrType, openLevel, showkr) {
116
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(searchType, rootId, rootName, avatar, cycleType, yqmNum, annualNum, okrType, openLevel, showkr, showCardKr) {
115
117
  var _yield$searchOkrs, works, okrIds, nodes, allNodes, subTreeNodes;
116
118
 
117
119
  return regeneratorRuntime.wrap(function _callee$(_context) {
@@ -155,7 +157,8 @@ function OkrSearchPanel(props, ref) {
155
157
  return (0, _requestApis.expandNodesByLevel)({
156
158
  okrIds: okrIds,
157
159
  level: openLevel - 1,
158
- showKr: showkr ? 0 : 1
160
+ showKr: showkr ? 1 : 0,
161
+ showCardKr: showCardKr ? 1 : 0
159
162
  });
160
163
 
161
164
  case 13:
@@ -188,19 +191,19 @@ function OkrSearchPanel(props, ref) {
188
191
  }, _callee);
189
192
  }));
190
193
 
191
- return function (_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x10) {
194
+ return function (_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x10, _x11) {
192
195
  return _ref.apply(this, arguments);
193
196
  };
194
197
  }(), 500)).current;
195
198
  var okrFlow = (0, _react.useRef)();
196
199
  (0, _react.useEffect)(function () {
197
200
  if (!annualNum) return;
198
- getSearchData(searchType, rootId, rootName, avatar, cycleType, yqmNum, annualNum, okrType, openLevel, showkr);
199
- }, [searchType, rootId, rootName, cycleType, yqmNum, annualNum, okrType, openLevel, showkr]);
201
+ getSearchData(searchType, rootId, rootName, avatar, cycleType, yqmNum, annualNum, okrType, openLevel, showkr, showCardKr);
202
+ }, [searchType, rootId, rootName, cycleType, yqmNum, annualNum, okrType, openLevel, showkr, showCardKr]);
200
203
  (0, _react.useEffect)(function () {
201
204
  var data = (0, _treeHandler.transToMapData)(treeNodes, showkr);
202
205
  setDataSource(data.length > 1 ? data : []);
203
- }, [treeNodes, showkr]);
206
+ }, [treeNodes, showkr, showCardKr]);
204
207
 
205
208
  var handleParentExpand = /*#__PURE__*/function () {
206
209
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(node) {
@@ -216,7 +219,8 @@ function OkrSearchPanel(props, ref) {
216
219
  krId: modelType == "kr" ? id : 0,
217
220
  okrId: modelType == "kr" ? data.workId : id,
218
221
  okrIdParent: modelType == "work" ? data.parentId : data.workId,
219
- childRoot: false
222
+ childRoot: false,
223
+ showCardKr: showCardKr ? 1 : 0
220
224
  });
221
225
 
222
226
  case 3:
@@ -249,7 +253,7 @@ function OkrSearchPanel(props, ref) {
249
253
  }, _callee2);
250
254
  }));
251
255
 
252
- return function handleParentExpand(_x11) {
256
+ return function handleParentExpand(_x12) {
253
257
  return _ref2.apply(this, arguments);
254
258
  };
255
259
  }();
@@ -268,6 +272,7 @@ function OkrSearchPanel(props, ref) {
268
272
  okrId: modelType == "work" ? id : data.workId,
269
273
  okrIdParent: 0,
270
274
  childRoot: true,
275
+ showCardKr: showCardKr ? 1 : 0,
271
276
  currentOkrRole: modelType == "kr" ? data.mapkrVisible : data.MapOkrVisible
272
277
  });
273
278
 
@@ -294,7 +299,7 @@ function OkrSearchPanel(props, ref) {
294
299
  }, _callee3);
295
300
  }));
296
301
 
297
- return function handleChildExpand(_x12) {
302
+ return function handleChildExpand(_x13) {
298
303
  return _ref3.apply(this, arguments);
299
304
  };
300
305
  }();
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _reactFlowRenderer = _interopRequireWildcard(require("@titaui/react-flow-renderer"));
13
13
 
14
+ var _lodash = _interopRequireDefault(require("lodash"));
15
+
14
16
  var _classnames = _interopRequireDefault(require("classnames"));
15
17
 
16
18
  var _html2canvas = _interopRequireDefault(require("html2canvas"));
@@ -39,6 +41,14 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
39
41
 
40
42
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
41
43
 
44
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
45
+
46
+ 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."); }
47
+
48
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
49
+
50
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
51
+
42
52
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
43
53
 
44
54
  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."); }
@@ -68,16 +78,12 @@ var OkrMap = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
68
78
  onChildClose = _props$onChildClose === void 0 ? function () {} : _props$onChildClose,
69
79
  _props$dataSource = props.dataSource,
70
80
  dataSource = _props$dataSource === void 0 ? [] : _props$dataSource;
81
+ var virtualElements = (0, _react.useRef)([]);
71
82
 
72
- var _useState = (0, _react.useState)([]),
83
+ var _useState = (0, _react.useState)(),
73
84
  _useState2 = _slicedToArray(_useState, 2),
74
- elements = _useState2[0],
75
- setElements = _useState2[1];
76
-
77
- var _useState3 = (0, _react.useState)(),
78
- _useState4 = _slicedToArray(_useState3, 2),
79
- flowInstance = _useState4[0],
80
- setFlowInstance = _useState4[1];
85
+ flowInstance = _useState2[0],
86
+ setFlowInstance = _useState2[1];
81
87
 
82
88
  var isMoving = (0, _react.useRef)(false);
83
89
 
@@ -89,12 +95,10 @@ var OkrMap = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
89
95
  onNodeClick & onNodeClick(data);
90
96
  };
91
97
 
92
- var layoutedElements = (0, _utils.getLayoutedElements)(dataSource, direction);
93
-
94
98
  var getDefaultPos = function getDefaultPos() {
95
99
  var containerHeight = document.body.clientHeight - 200 - 96;
96
100
  var containerWidth = document.body.clientWidth - 180 - 320;
97
- var rootNode = layoutedElements[0];
101
+ var rootNode = virtualElements[0];
98
102
 
99
103
  if (direction == "horizontal") {
100
104
  var targetY = containerHeight / 2;
@@ -102,13 +106,27 @@ var OkrMap = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
102
106
  }
103
107
 
104
108
  var targetX = containerWidth / 2;
105
- return [targetX - rootNode.position.x, -48];
109
+ return [targetX - rootNode.position.x, -48]; // debugger
110
+ // return [0, 0]
106
111
  };
107
112
 
108
113
  var onLoad = function onLoad(reactFlowInstance) {
109
114
  setFlowInstance(reactFlowInstance);
110
115
  };
111
116
 
117
+ var NodeDebug = function NodeDebug() {
118
+ var elements = (0, _reactFlowRenderer.useStoreState)(function (state) {
119
+ return [].concat(_toConsumableArray(state.nodes), _toConsumableArray(state.edges));
120
+ }, _lodash["default"].isEqual);
121
+ var setElements = (0, _reactFlowRenderer.useStoreActions)(function (actions) {
122
+ return actions.setElements;
123
+ });
124
+ var newElements = (0, _utils.getLayoutedElements)(elements, direction);
125
+ virtualElements = newElements;
126
+ setElements(newElements);
127
+ return null;
128
+ };
129
+
112
130
  (0, _react.useEffect)(function () {
113
131
  if (flowInstance) {
114
132
  var _getDefaultPos = getDefaultPos(),
@@ -174,7 +192,7 @@ var OkrMap = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
174
192
 
175
193
  }, /*#__PURE__*/_react["default"].createElement(_reactFlowRenderer.ReactFlowProvider, null, dataSource.length == 0 ? /*#__PURE__*/_react["default"].createElement(_empty["default"], null) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_reactFlowRenderer["default"], {
176
194
  onLoad: onLoad,
177
- elements: layoutedElements,
195
+ elements: dataSource,
178
196
  nodesDraggable: false,
179
197
  nodesConnectable: false,
180
198
  nodeTypes: _utils.nodeTypes,
@@ -182,7 +200,7 @@ var OkrMap = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
182
200
  minZoom: 0.25,
183
201
  maxZoom: 1.5,
184
202
  panOnScroll: true
185
- }), /*#__PURE__*/_react["default"].createElement(_miniMap["default"], {
203
+ }, /*#__PURE__*/_react["default"].createElement(NodeDebug, null)), /*#__PURE__*/_react["default"].createElement(_miniMap["default"], {
186
204
  onMoveStart: function onMoveStart() {
187
205
  return isMoving.current = true;
188
206
  }
@@ -78,7 +78,9 @@ var expandNode = function expandNode(params) {
78
78
  _params$okrIdParent = params.okrIdParent,
79
79
  okrIdParent = _params$okrIdParent === void 0 ? 0 : _params$okrIdParent,
80
80
  _params$currentOkrRol = params.currentOkrRole,
81
- currentOkrRole = _params$currentOkrRol === void 0 ? true : _params$currentOkrRol;
81
+ currentOkrRole = _params$currentOkrRol === void 0 ? true : _params$currentOkrRol,
82
+ _params$showCardKr = params.showCardKr,
83
+ showCardKr = _params$showCardKr === void 0 ? 1 : _params$showCardKr;
82
84
  return _axios["default"].get("".concat(requestDomain(), "/api/v1/").concat(tenantId, "/").concat(userId, "/okr/map/expand"), {
83
85
  params: {
84
86
  okrId: okrId,
@@ -87,7 +89,9 @@ var expandNode = function expandNode(params) {
87
89
  // true: 展开子节点, false: 展开父节点
88
90
  okrIdParent: okrIdParent,
89
91
  // 当前选中okr 或 当前选中kr 的okrId(kr的父节点是所属okr)
90
- currentOkrRole: currentOkrRole // 查看权限
92
+ currentOkrRole: currentOkrRole,
93
+ // 查看权限
94
+ showCardKr: showCardKr // o带上kr
91
95
 
92
96
  }
93
97
  }).then(function (res) {
@@ -103,12 +107,15 @@ var expandNodesByLevel = function expandNodesByLevel(_ref2) {
103
107
  _ref2$okrIds = _ref2.okrIds,
104
108
  okrIds = _ref2$okrIds === void 0 ? [] : _ref2$okrIds,
105
109
  _ref2$showKr = _ref2.showKr,
106
- showKr = _ref2$showKr === void 0 ? 0 : _ref2$showKr;
110
+ showKr = _ref2$showKr === void 0 ? 0 : _ref2$showKr,
111
+ _ref2$showCardKr = _ref2.showCardKr,
112
+ showCardKr = _ref2$showCardKr === void 0 ? 0 : _ref2$showCardKr;
107
113
  return (// const queryStr = qs.stringify({ okrIds, level }, { arrayFormat: 'repeat' });
108
114
  _axios["default"].post("".concat(requestDomain(), "/api/v1/").concat(tenantId, "/").concat(userId, "/okr/map/generalview"), {
109
115
  okrIds: okrIds,
110
116
  level: level,
111
- showKr: showKr
117
+ showKr: showKr,
118
+ showCardKr: showCardKr
112
119
  }).then(function (res) {
113
120
  return res.data.Data;
114
121
  })
@@ -1,6 +1,6 @@
1
1
  .titaui-okr-flow--root-node {
2
- padding: 5px 12px;
3
- background: #f0f2f5;
2
+ padding: 4px 12px;
3
+ background: rgba(255, 255, 255, 0.6);
4
4
  border-radius: 16px;
5
5
  color: #89919f;
6
6
  }
@@ -15,6 +15,12 @@ var _rootNode = _interopRequireDefault(require("../root-node"));
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
17
 
18
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
+
20
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21
+
22
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
23
+
18
24
  var nodeTypes = {
19
25
  ChildNode: _childNode["default"],
20
26
  RootNode: _rootNode["default"]
@@ -24,42 +30,53 @@ exports.nodeTypes = nodeTypes;
24
30
  var getLayoutedElements = function getLayoutedElements(elements) {
25
31
  var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "horizontal";
26
32
  var isHorizontal = direction === "horizontal";
27
- var nodeWidth = 320;
28
- var nodeHeight = 96;
29
- var dagreGraph = new _dagre["default"].graphlib.Graph();
30
- dagreGraph.setDefaultEdgeLabel(function () {
31
- return {};
33
+ var g = new _dagre["default"].graphlib.Graph({
34
+ compound: true
32
35
  });
33
- dagreGraph.setGraph({
36
+ g.setGraph({
34
37
  rankdir: isHorizontal ? "LR" : "TB",
35
- ranksep: 80,
36
- nodesep: 12
38
+ nodesep: 12,
39
+ ranksep: 80
37
40
  });
38
- elements.forEach(function (el) {
39
- if ((0, _reactFlowRenderer.isNode)(el)) {
40
- dagreGraph.setNode(el.id, {
41
- width: nodeWidth,
42
- height: nodeHeight
41
+ g.setDefaultEdgeLabel(function () {
42
+ return {};
43
+ });
44
+ elements.forEach(function (element) {
45
+ if ((0, _reactFlowRenderer.isNode)(element)) {
46
+ var _element$__rf, _element$__rf2;
47
+
48
+ // const { data,id } = element
49
+ // if(id!=="0"){
50
+ // const {parentId} = data
51
+ // if(parentId===0||parentId){
52
+ // g.setParent(id, parentId+"");
53
+ // }
54
+ // }
55
+ g.setNode(element.id, {
56
+ width: (_element$__rf = element.__rf) === null || _element$__rf === void 0 ? void 0 : _element$__rf.width,
57
+ height: (_element$__rf2 = element.__rf) === null || _element$__rf2 === void 0 ? void 0 : _element$__rf2.height
43
58
  });
44
59
  } else {
45
- dagreGraph.setEdge(el.source, el.target);
60
+ g.setEdge(element.source, element.target);
46
61
  }
47
62
  });
48
63
 
49
- _dagre["default"].layout(dagreGraph);
50
-
51
- return elements.map(function (el) {
52
- if ((0, _reactFlowRenderer.isNode)(el)) {
53
- var nodeWithPosition = dagreGraph.node(el.id);
54
- el.targetPosition = isHorizontal ? "left" : "top";
55
- el.sourcePosition = isHorizontal ? "right" : "bottom";
56
- el.position = {
57
- x: nodeWithPosition.x,
58
- y: nodeWithPosition.y
59
- };
64
+ _dagre["default"].layout(g);
65
+
66
+ return elements.map(function (element) {
67
+ if ((0, _reactFlowRenderer.isNode)(element)) {
68
+ var node = g.node(element.id);
69
+ return _objectSpread(_objectSpread({}, element), {}, {
70
+ targetPosition: isHorizontal ? "left" : "top",
71
+ sourcePosition: isHorizontal ? "right" : "bottom",
72
+ position: {
73
+ x: node.x - node.width / 2,
74
+ y: node.y - node.height / 2
75
+ }
76
+ });
60
77
  }
61
78
 
62
- return el;
79
+ return element;
63
80
  });
64
81
  };
65
82
 
@@ -130,6 +130,7 @@ exports.formatNodes = formatNodes;
130
130
 
131
131
  var flatTree = function flatTree(current, elements, showkr) {
132
132
  var isParentExpand = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
133
+ var parentId = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
133
134
  if (!current) return;
134
135
  var id = current.id,
135
136
  data = current.data,
@@ -142,7 +143,12 @@ var flatTree = function flatTree(current, elements, showkr) {
142
143
  elements.push({
143
144
  id: "".concat(id),
144
145
  type: "RootNode",
145
- data: data
146
+ data: data,
147
+ isParent: true,
148
+ position: {
149
+ x: 0,
150
+ y: 0
151
+ }
146
152
  });
147
153
  } else {
148
154
  var isChildExpand = false;
@@ -164,11 +170,16 @@ var flatTree = function flatTree(current, elements, showkr) {
164
170
  elements.push({
165
171
  id: "".concat(id),
166
172
  type: "ChildNode",
173
+ position: {
174
+ x: 0,
175
+ y: 0
176
+ },
167
177
  data: {
168
178
  id: id,
169
179
  data: data,
170
180
  isParentExpand: isParentExpand,
171
181
  isChildExpand: isChildExpand,
182
+ parentId: parentId,
172
183
  modelType: modelType,
173
184
  isSearchRes: isSearchRes
174
185
  }
@@ -191,7 +202,7 @@ var flatTree = function flatTree(current, elements, showkr) {
191
202
  source: "".concat(id),
192
203
  target: "".concat(sub.id)
193
204
  });
194
- flatTree(sub, elements, showkr, current.modelType != "root");
205
+ flatTree(sub, elements, showkr, current.modelType != "root", id);
195
206
  });
196
207
  }
197
208
  } else {
@@ -200,7 +211,7 @@ var flatTree = function flatTree(current, elements, showkr) {
200
211
  source: "".concat(id),
201
212
  target: "".concat(child.id)
202
213
  });
203
- flatTree(child, elements, showkr, current.modelType != "root");
214
+ flatTree(child, elements, showkr, current.modelType != "root", id);
204
215
  }
205
216
  });
206
217
  }
@@ -49,7 +49,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
49
49
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
50
50
 
51
51
  function _formatCycleData(periodParams, getCycleRange) {
52
- if (!periodParams) return "";
52
+ if (!periodParams) return '';
53
53
  var startDate = periodParams.startDate;
54
54
  var endDate = periodParams.endDate;
55
55
 
@@ -58,7 +58,7 @@ function _formatCycleData(periodParams, getCycleRange) {
58
58
  endDate = periodParams.endDate.slice(5);
59
59
  }
60
60
 
61
- return "".concat(_periodSelector["default"].formatPeriod(periodParams)).concat(getCycleRange ? ",".concat(startDate, "~").concat(endDate) : "");
61
+ return "".concat(_periodSelector["default"].formatPeriod(periodParams)).concat(getCycleRange ? ",".concat(startDate, "~").concat(endDate) : '');
62
62
  }
63
63
 
64
64
  function CreateCycle(_ref) {
@@ -94,21 +94,21 @@ function CreateCycle(_ref) {
94
94
  setCycleSetting = _useState4[1];
95
95
 
96
96
  (0, _react.useEffect)(function () {
97
- var settings = localStorage.getItem("OKR_CYCLE_SETTING");
97
+ var settings = localStorage.getItem('OKR_CYCLE_SETTING');
98
98
 
99
99
  if (settings) {
100
100
  setCycleSetting(JSON.parse(settings));
101
101
  return;
102
102
  }
103
103
 
104
- var url = (0, _helper.getApiUrl)("okr/cycleSetting");
105
- (0, _helper.taker)(url, "GET").then(function (res) {
104
+ var url = (0, _helper.getApiUrl)('okr/cycleSetting');
105
+ (0, _helper.taker)(url, 'GET').then(function (res) {
106
106
  if (res.Code == 1) {
107
107
  setCycleSetting(res.Data);
108
108
  }
109
109
  });
110
110
  }, []);
111
- var cycleWrapperRef = (0, _react.useRef)(document.createElement("div"));
111
+ var cycleWrapperRef = (0, _react.useRef)(document.createElement('div'));
112
112
 
113
113
  var onPeriodSelectorChangeHandler = function onPeriodSelectorChangeHandler(c) {
114
114
  setSelfCycle(_objectSpread(_objectSpread({}, selfCycle), c));
@@ -148,13 +148,13 @@ function CreateCycle(_ref) {
148
148
  },
149
149
  ref: cycleWrapperRef,
150
150
  style: {
151
- backgroundColor: "white",
152
- boxShadow: "0px 4px 12px 0px rgb(127 145 180 / 20%)",
151
+ backgroundColor: 'white',
152
+ boxShadow: '0px 4px 12px 0px rgb(127 145 180 / 20%)',
153
153
  borderRadius: 4
154
154
  }
155
155
  }, /*#__PURE__*/_react["default"].createElement(_periodSelector["default"], {
156
156
  style: {
157
- width: "100%"
157
+ width: '100%'
158
158
  },
159
159
  selected: selfCycle,
160
160
  showFullCycle: false,
@@ -176,9 +176,9 @@ function CreateCycle(_ref) {
176
176
  }))), /*#__PURE__*/_react["default"].createElement("div", {
177
177
  className: "okr-detail-date-cycle__date-line",
178
178
  style: {
179
- borderBottom: "1px solid #F0F2F5"
179
+ borderBottom: '1px solid #F0F2F5'
180
180
  }
181
- }, (0, _getLocale.getLocale)("Mod_StartDate"), "\uFF1A", /*#__PURE__*/_react["default"].createElement(_rangePickerPop["default"], {
181
+ }, (0, _getLocale.getLocale)('Mod_StartDate'), "\uFF1A", /*#__PURE__*/_react["default"].createElement(_rangePickerPop["default"], {
182
182
  format: "YYYY/MM/DD",
183
183
  controlled: true,
184
184
  onConfirm: onStartDateConfirmHandler,
@@ -193,7 +193,7 @@ function CreateCycle(_ref) {
193
193
  className: "tu-icon-arrow-down okr-detail-date-cycle__select-time-down-icon"
194
194
  })))), /*#__PURE__*/_react["default"].createElement("div", {
195
195
  className: "okr-detail-date-cycle__date-line"
196
- }, (0, _getLocale.getLocale)("Mod_EndDate"), "\uFF1A", /*#__PURE__*/_react["default"].createElement(_rangePickerPop["default"], {
196
+ }, (0, _getLocale.getLocale)('Mod_EndDate'), "\uFF1A", /*#__PURE__*/_react["default"].createElement(_rangePickerPop["default"], {
197
197
  format: "YYYY/MM/DD",
198
198
  controlled: true,
199
199
  onConfirm: onEndDateCOnfirmHandler,
@@ -208,8 +208,8 @@ function CreateCycle(_ref) {
208
208
  className: "tu-icon-arrow-down okr-detail-date-cycle__select-time-down-icon"
209
209
  })))), /*#__PURE__*/_react["default"].createElement("div", {
210
210
  style: {
211
- display: "flex",
212
- justifyContent: "flex-end"
211
+ display: 'flex',
212
+ justifyContent: 'flex-end'
213
213
  }
214
214
  }, /*#__PURE__*/_react["default"].createElement(_titaUi.Button, {
215
215
  size: "s",
@@ -217,15 +217,15 @@ function CreateCycle(_ref) {
217
217
  marginRight: 12
218
218
  },
219
219
  onClick: onCancelClickHandler
220
- }, (0, _getLocale.getLocale)("Mod_Cancel")), /*#__PURE__*/_react["default"].createElement(_titaUi.Button, {
220
+ }, (0, _getLocale.getLocale)('Mod_Cancel')), /*#__PURE__*/_react["default"].createElement(_titaUi.Button, {
221
221
  size: "s",
222
222
  type: "primary",
223
223
  onClick: onSureClickHandler
224
- }, (0, _getLocale.getLocale)("OKR_MyO_Butt_Determine"))));
224
+ }, (0, _getLocale.getLocale)('OKR_MyO_Butt_Determine'))));
225
225
  } else {
226
- return /*#__PURE__*/_react["default"].createElement(_periodSelector["default"], {
226
+ return canEdit ? /*#__PURE__*/_react["default"].createElement(_periodSelector["default"], {
227
227
  style: {
228
- width: "100%"
228
+ width: '100%'
229
229
  },
230
230
  selected: cycle,
231
231
  showFullCycle: false,
@@ -245,7 +245,11 @@ function CreateCycle(_ref) {
245
245
  btnRef: btnRef,
246
246
  clickCallback: function clickCallback() {},
247
247
  text: _formatCycleData(cycle, getCycleRange)
248
- }));
248
+ })) : renderInnerContent({
249
+ btnRef: btnRef,
250
+ clickCallback: function clickCallback() {},
251
+ text: _formatCycleData(cycle, getCycleRange)
252
+ });
249
253
  }
250
254
  }
251
255
 
@@ -303,6 +303,7 @@ function PayDialog(props) {
303
303
  if (payCode === "wxPay") {
304
304
  e.preventDefault();
305
305
  var path = window.location.href.split("#")[0];
306
+ path = path.replace(/eLearningHome/, "Home");
306
307
  var encode = encodeURIComponent("orderId=".concat(orderId, "&payCode=").concat(payCode, "&payName=").concat(payName));
307
308
  window.open("".concat(path, "#/pay?").concat(encode), "_blank"); // postWxPayOrder({
308
309
  // order_id: orderId,
@@ -73,6 +73,8 @@ function PeriodSelector(_ref) {
73
73
  wrapperStyle = _ref.wrapperStyle,
74
74
  popClass = _ref.popClass,
75
75
  style = _ref.style,
76
+ _ref$buttonClass = _ref.buttonClass,
77
+ buttonClass = _ref$buttonClass === void 0 ? "" : _ref$buttonClass,
76
78
  _ref$noBorder = _ref.noBorder,
77
79
  noBorder = _ref$noBorder === void 0 ? false : _ref$noBorder;
78
80
 
@@ -174,6 +176,7 @@ function PeriodSelector(_ref) {
174
176
  className: className
175
177
  }, children || /*#__PURE__*/_react["default"].createElement(_button["default"], {
176
178
  type: "default",
179
+ className: buttonClass,
177
180
  style: noBorder ? {
178
181
  padding: "0",
179
182
  border: "none"