@titaui/pc 1.11.14 → 1.11.17-beta.1

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 (64) hide show
  1. package/.husky/pre-commit +2 -2
  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/change-okr-modal/Item.js +1 -1
  7. package/lib/components/create-okr-modal/request-api.js +1 -1
  8. package/lib/components/drawer/headerAction.js +5 -1
  9. package/lib/components/drawer/headerDrop.js +41 -4
  10. package/lib/components/drawer/index.css +44 -0
  11. package/lib/components/drawer/index.js +36 -7
  12. package/lib/components/dynamic/constant.js +4 -2
  13. package/lib/components/dynamic/dynamic-item/index.js +14 -2
  14. package/lib/components/dynamic/dynamic-list/index.js +1 -9
  15. package/lib/components/icon-button-list/index.css +2 -57
  16. package/lib/components/icon-button-list/index.js +8 -5
  17. package/lib/components/nav-top/index.js +6 -2
  18. package/lib/components/okr-detail/base-info/other-infos/date-cycle/index.js +16 -4
  19. package/lib/components/okr-detail/base-info/other-infos/principal/index.js +9 -1
  20. package/lib/components/okr-detail/components/header/index.js +9 -3
  21. package/lib/components/okr-detail/components/header/o-name.js +9 -3
  22. package/lib/components/okr-detail/components/o-classify.js +5 -1
  23. package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/index.js +9 -6
  24. package/lib/components/okr-detail/detail-header/constant.js +53 -0
  25. package/lib/components/okr-detail/detail-header/index.js +12 -1
  26. package/lib/components/okr-detail/helper.js +62 -0
  27. package/lib/components/okr-detail/index.js +21 -2
  28. package/lib/components/okr-detail/okr-list/index.js +8 -3
  29. package/lib/components/okr-detail/request-apis.js +7 -1
  30. package/lib/components/okr-flow/child-node/index.css +60 -15
  31. package/lib/components/okr-flow/child-node/work-node.js +43 -6
  32. package/lib/components/okr-flow/empty/index.css +8 -1
  33. package/lib/components/okr-flow/export-modal/index.js +26 -2
  34. package/lib/components/okr-flow/export-modules/okr-search-panel/index.css +3 -1
  35. package/lib/components/okr-flow/export-modules/okr-search-panel/index.js +16 -10
  36. package/lib/components/okr-flow/images/loading-light.gif +0 -0
  37. package/lib/components/okr-flow/okr-map/index.js +41 -20
  38. package/lib/components/okr-flow/request-apis.js +11 -4
  39. package/lib/components/okr-flow/root-node/index.css +2 -2
  40. package/lib/components/okr-flow/root-node/index.js +1 -1
  41. package/lib/components/okr-flow/utils/index.js +43 -26
  42. package/lib/components/okr-flow/utils/tree-handler.js +14 -3
  43. package/lib/components/okr-period-selector/select-cycle.js +23 -19
  44. package/lib/components/okrcase-library/index.css +6 -4
  45. package/lib/components/period-selector/index.js +3 -0
  46. package/lib/components/textarea/index.css +120 -0
  47. package/lib/components/textarea/index.js +257 -0
  48. package/lib/index.js +40 -0
  49. package/lib/pages/new-okr-list/header/common.js +52 -0
  50. package/lib/pages/new-okr-list/header/index.css +45 -0
  51. package/lib/pages/new-okr-list/header/index.js +38 -16
  52. package/lib/pages/new-okr-list/header/operate-record.js +124 -0
  53. package/lib/pages/new-okr-list/index.js +3 -1
  54. package/lib/pages/new-okr-list/list/index.js +19 -2
  55. package/lib/pages/new-okr-list/request-api.js +8 -2
  56. package/lib/pages/okr-map/export-modules/okr-map/header/index.css +6 -1
  57. package/lib/pages/okr-map/export-modules/okr-map/header/index.js +60 -21
  58. package/lib/pages/okr-map/export-modules/okr-map/okr-map.js +41 -18
  59. package/lib/pages/okr-map/export-modules/share-okr-page/header/index.js +10 -5
  60. package/lib/pages/okr-map/number-select/index.css +12 -9
  61. package/lib/pages/okr-map/number-select/index.js +1 -1
  62. package/lib/utils/format-time.js +8 -1
  63. package/lib/utils/open-data.js +5 -1
  64. package/package.json +1 -1
@@ -36,16 +36,17 @@
36
36
 
37
37
  .titaui-okr-flow--node {
38
38
  position: relative;
39
- padding: 10px 12px;
40
- width: 320px;
41
- height: 96px;
39
+ padding: 12px 12px;
40
+ width: 340px;
42
41
  background: #ffffff;
43
42
  box-shadow: 0px 4px 10px 0px rgba(127, 145, 180, 0.1);
44
- border-radius: 6px;
43
+ border-radius: 12px;
45
44
  box-sizing: border-box;
46
45
  }
47
46
 
48
47
  .titaui-okr-flow--node__private {
48
+ width: 340px;
49
+ height: 102px;
49
50
  background: url(../images/private-light.png) no-repeat;
50
51
  background-size: contain;
51
52
  }
@@ -75,25 +76,68 @@
75
76
  white-space: unset;
76
77
  }
77
78
 
79
+ .titaui-okr-flow--node-krs {
80
+ margin-top: 12px;
81
+ }
82
+
83
+ .titaui-okr-flow--node-kr {
84
+ cursor: pointer;
85
+ display: flex;
86
+ line-height: 20px;
87
+ font-size: 12px;
88
+ margin-top: 8px;
89
+ }
90
+
91
+ .titaui-okr-flow--node-kr-icon {
92
+ color: rgba(40, 121, 255, 0.6);
93
+ margin-right: 8px;
94
+ }
95
+
96
+ .titaui-okr-flow--node-kr-title {
97
+ flex: 1;
98
+ font-size: 13px;
99
+ font-weight: 400;
100
+ color: #3F4755;
101
+ }
102
+
103
+ .titaui-okr-flow--node-kr-progress {
104
+ width: 32px;
105
+ text-align: right;
106
+ margin-left: 8px;
107
+ white-space: nowrap;
108
+ }
109
+
110
+ .titaui-okr-flow--node-kr-status--normal {
111
+ color: #2879ff;
112
+ }
113
+
114
+ .titaui-okr-flow--node-kr-status--risk {
115
+ color: #f6bd16;
116
+ }
117
+
118
+ .titaui-okr-flow--node-kr-status--expired {
119
+ color: #f05e5e;
120
+ }
121
+
122
+ .titaui-okr-flow--node-kr-status--complete {
123
+ color: #5ad8a6;
124
+ }
125
+
78
126
  .titaui-okr-flow--node-title {
79
127
  max-width: 252px;
80
- height: 44px;
81
128
  margin-right: 54px;
82
- margin-bottom: 8px;
83
- line-height: 22px;
129
+ margin-bottom: 4px;
130
+ line-height: 24px;
84
131
  color: #141c28;
85
132
  font-size: 14px;
86
- overflow: hidden;
87
- text-overflow: ellipsis;
88
- display: -webkit-box;
89
- text-overflow: ellipsis;
90
- -webkit-box-orient: vertical;
91
- -webkit-line-clamp: 2;
133
+ font-weight: 600;
134
+ cursor: pointer;
92
135
  }
93
136
 
94
137
  .titaui-okr-flow--node-desp {
95
138
  font-family: PingFangSC-Regular, PingFang SC;
96
139
  position: relative;
140
+ cursor: pointer;
97
141
  }
98
142
 
99
143
  .titaui-okr-flow--node-right {
@@ -118,7 +162,7 @@
118
162
  overflow: hidden;
119
163
  text-overflow: ellipsis;
120
164
  white-space: nowrap;
121
- line-height: 24px;
165
+ line-height: 20px;
122
166
  max-width: 96px;
123
167
  }
124
168
 
@@ -291,12 +335,13 @@
291
335
  }
292
336
 
293
337
  .titaui-okr-flow--node-status {
338
+ cursor: pointer;
294
339
  position: absolute;
295
340
  right: 0;
296
341
  top: 0;
297
342
  width: 50px;
298
343
  height: 32px;
299
- border-radius: 0 6px 0 20px;
344
+ border-radius: 0 12px 0 20px;
300
345
  font-size: 13px;
301
346
  text-align: center;
302
347
  line-height: 32px;
@@ -31,6 +31,10 @@ var _bsGlobal = require("../../../utils/bs-global");
31
31
 
32
32
  var _getLocale = require("../../../utils/getLocale");
33
33
 
34
+ var _tools = require("../../../utils/tools");
35
+
36
+ var _drawerManager = _interopRequireDefault(require("../../../components/drawer-manager"));
37
+
34
38
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
35
39
 
36
40
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -71,6 +75,7 @@ function WorkNode(_ref) {
71
75
  manualRiskLevel = data.manualRiskLevel,
72
76
  progress = data.progress,
73
77
  okrClassify = data.okrClassify,
78
+ Krs = data.Krs,
74
79
  cycleType = data.cycleType,
75
80
  startDate = data.startDate,
76
81
  endDate = data.endDate,
@@ -92,6 +97,8 @@ function WorkNode(_ref) {
92
97
  imgWidth = _useState6[0],
93
98
  setImgWidth = _useState6[1];
94
99
 
100
+ var bodyr = (0, _react.useRef)();
101
+
95
102
  var getOkrTypeMap = function getOkrTypeMap() {
96
103
  return {
97
104
  1: (0, _getLocale.getLocale)("OKR_MyO_Pop_Individual"),
@@ -176,6 +183,18 @@ function WorkNode(_ref) {
176
183
  }
177
184
  }, []);
178
185
 
186
+ var openODetail = function openODetail(id) {
187
+ _drawerManager["default"].open("okrDetail", {
188
+ okrId: workId
189
+ });
190
+ };
191
+
192
+ var openKr = function openKr(id) {
193
+ _drawerManager["default"].open("krDetail", {
194
+ krId: id
195
+ });
196
+ };
197
+
179
198
  var getCycleTextByType = function getCycleTextByType() {
180
199
  var cycleType = data.cycleType,
181
200
  yqmnum = data.yqmnum,
@@ -210,18 +229,21 @@ function WorkNode(_ref) {
210
229
  }; // 1:正常 2:有风险 3:过期 4:完成 5:过期完成 ,
211
230
 
212
231
 
213
- var riskLevelSuffix = ["normal", "normal", "risk", "expired", "complete", "complete_over"];
232
+ var riskLevelSuffix = ["normal", "normal", "risk", "expired", "complete", "complete_over", "normal"];
214
233
  if (!MapOkrVisible) return /*#__PURE__*/_react["default"].createElement("div", {
215
234
  className: (0, _classnames["default"])("".concat(_precls["default"], "--node"), "".concat(_precls["default"], "--node__private"))
216
235
  });
217
236
  return /*#__PURE__*/_react["default"].createElement("div", {
218
- className: (0, _classnames["default"])("".concat(_precls["default"], "--node"), _defineProperty({}, "".concat(_precls["default"], "--node__search"), isSearchRes))
237
+ className: (0, _classnames["default"])("".concat(_precls["default"], "--node"), _defineProperty({}, "".concat(_precls["default"], "--node__search"), isSearchRes)),
238
+ ref: bodyr
219
239
  }, /*#__PURE__*/_react["default"].createElement("div", {
220
- className: (0, _classnames["default"])("".concat(_precls["default"], "--node-title"))
221
- }, workName, /*#__PURE__*/_react["default"].createElement(_okrClassify["default"], {
240
+ className: (0, _classnames["default"])("".concat(_precls["default"], "--node-title")),
241
+ onClick: openODetail
242
+ }, (0, _tools.htmlDecodeByRegExp)(workName), /*#__PURE__*/_react["default"].createElement(_okrClassify["default"], {
222
243
  classify: okrClassify
223
244
  })), /*#__PURE__*/_react["default"].createElement("div", {
224
- className: (0, _classnames["default"])("".concat(_precls["default"], "--node-desp"))
245
+ className: (0, _classnames["default"])("".concat(_precls["default"], "--node-desp")),
246
+ onClick: openODetail
225
247
  }, /*#__PURE__*/_react["default"].createElement(_creator["default"], {
226
248
  creator: principalUser || {}
227
249
  }), /*#__PURE__*/_react["default"].createElement("div", {
@@ -230,7 +252,22 @@ function WorkNode(_ref) {
230
252
  className: (0, _classnames["default"])("".concat(_precls["default"], "--node-type"))
231
253
  }, getOkrTypeMap()[okrType])), /*#__PURE__*/_react["default"].createElement("span", {
232
254
  className: (0, _classnames["default"])("".concat(_precls["default"], "--node-cycle"))
233
- }, getCycleTextByType()))), /*#__PURE__*/_react["default"].createElement("span", {
255
+ }, getCycleTextByType()))), !!(Krs !== null && Krs !== void 0 && Krs.length) && /*#__PURE__*/_react["default"].createElement("div", {
256
+ className: (0, _classnames["default"])("".concat(_precls["default"], "--node-krs"))
257
+ }, Krs.map(function (item, key) {
258
+ return /*#__PURE__*/_react["default"].createElement("div", {
259
+ className: (0, _classnames["default"])("".concat(_precls["default"], "--node-kr")),
260
+ onClick: function onClick() {
261
+ return openKr(item.mileStoneId);
262
+ }
263
+ }, /*#__PURE__*/_react["default"].createElement("span", {
264
+ className: (0, _classnames["default"])("".concat(_precls["default"], "--node-kr-icon"))
265
+ }, "KR", item.SortNum + 1), /*#__PURE__*/_react["default"].createElement("div", {
266
+ className: (0, _classnames["default"])("".concat(_precls["default"], "--node-kr-title"))
267
+ }, item.mileStoneName), /*#__PURE__*/_react["default"].createElement("div", {
268
+ className: (0, _classnames["default"])("".concat(_precls["default"], "--node-kr-progress ").concat(_precls["default"], "--node-kr-status--").concat(riskLevelSuffix[item.riskLevel]))
269
+ }, item.progress, "%"));
270
+ })), /*#__PURE__*/_react["default"].createElement("span", {
234
271
  className: (0, _classnames["default"])("".concat(_precls["default"], "--node-status"), "".concat(_precls["default"], "--node-status__").concat(riskLevelSuffix[manualRiskLevel]))
235
272
  }, /*#__PURE__*/_react["default"].createElement(_tooltipText["default"], {
236
273
  text: "".concat(progress, "%"),
@@ -1,5 +1,12 @@
1
1
  .titaui-okr-flow--empty {
2
- padding-top: 125px;
2
+ width: 200px;
3
+ height: 200px;
4
+ position: absolute;
5
+ left: 0;
6
+ right: 0;
7
+ top: 0;
8
+ bottom: 0;
9
+ margin: auto;
3
10
  text-align: center;
4
11
  }
5
12
 
@@ -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:
@@ -173,7 +176,8 @@ function OkrSearchPanel(props, ref) {
173
176
  avatar: {
174
177
  hasAvatar: avatar.HasAvatar || avatar.hasAvatar,
175
178
  color: avatar.Color || avatar.color,
176
- small: avatar.Small || avatar.small
179
+ small: avatar.Small || avatar.small,
180
+ big: avatar.Original || avatar.original || avatar.large || avatar.big || avatar.Large
177
181
  }
178
182
  }, "searchType", searchType),
179
183
  children: subTreeNodes
@@ -188,19 +192,19 @@ function OkrSearchPanel(props, ref) {
188
192
  }, _callee);
189
193
  }));
190
194
 
191
- return function (_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x10) {
195
+ return function (_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x10, _x11) {
192
196
  return _ref.apply(this, arguments);
193
197
  };
194
198
  }(), 500)).current;
195
199
  var okrFlow = (0, _react.useRef)();
196
200
  (0, _react.useEffect)(function () {
197
201
  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]);
202
+ getSearchData(searchType, rootId, rootName, avatar, cycleType, yqmNum, annualNum, okrType, openLevel, showkr, showCardKr);
203
+ }, [searchType, rootId, rootName, cycleType, yqmNum, annualNum, okrType, openLevel, showkr, showCardKr]);
200
204
  (0, _react.useEffect)(function () {
201
205
  var data = (0, _treeHandler.transToMapData)(treeNodes, showkr);
202
206
  setDataSource(data.length > 1 ? data : []);
203
- }, [treeNodes, showkr]);
207
+ }, [treeNodes, showkr, showCardKr]);
204
208
 
205
209
  var handleParentExpand = /*#__PURE__*/function () {
206
210
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(node) {
@@ -216,7 +220,8 @@ function OkrSearchPanel(props, ref) {
216
220
  krId: modelType == "kr" ? id : 0,
217
221
  okrId: modelType == "kr" ? data.workId : id,
218
222
  okrIdParent: modelType == "work" ? data.parentId : data.workId,
219
- childRoot: false
223
+ childRoot: false,
224
+ showCardKr: showCardKr ? 1 : 0
220
225
  });
221
226
 
222
227
  case 3:
@@ -249,7 +254,7 @@ function OkrSearchPanel(props, ref) {
249
254
  }, _callee2);
250
255
  }));
251
256
 
252
- return function handleParentExpand(_x11) {
257
+ return function handleParentExpand(_x12) {
253
258
  return _ref2.apply(this, arguments);
254
259
  };
255
260
  }();
@@ -268,6 +273,7 @@ function OkrSearchPanel(props, ref) {
268
273
  okrId: modelType == "work" ? id : data.workId,
269
274
  okrIdParent: 0,
270
275
  childRoot: true,
276
+ showCardKr: showCardKr ? 1 : 0,
271
277
  currentOkrRole: modelType == "kr" ? data.mapkrVisible : data.MapOkrVisible
272
278
  });
273
279
 
@@ -294,7 +300,7 @@ function OkrSearchPanel(props, ref) {
294
300
  }, _callee3);
295
301
  }));
296
302
 
297
- return function handleChildExpand(_x12) {
303
+ return function handleChildExpand(_x13) {
298
304
  return _ref3.apply(this, arguments);
299
305
  };
300
306
  }();
@@ -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
 
@@ -85,16 +91,14 @@ var OkrMap = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
85
91
  var _element$data = element.data,
86
92
  data = _element$data === void 0 ? {} : _element$data,
87
93
  type = element.type;
88
- if (type == "default" || type == "RootNode") return;
94
+ if (type == "default" || type == "RootNode" || (data === null || data === void 0 ? void 0 : data.modelType) == "work") return;
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(),
@@ -152,10 +170,13 @@ var OkrMap = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
152
170
 
153
171
  var panelMouseUpHandler = function panelMouseUpHandler() {
154
172
  isMoving.current = false; // drawerWrapper.close()
155
- }; // const closeOkrDrawer = () => {
156
- // drawerWrapper.close()
157
- // }
173
+ };
158
174
 
175
+ var closeOkrDrawer = function closeOkrDrawer() {
176
+ var mousedown = document.createEvent("MouseEvents");
177
+ mousedown.initMouseEvent("mousedown", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
178
+ window.parent.document.body.dispatchEvent(mousedown); // drawerWrapper.close()
179
+ };
159
180
 
160
181
  return /*#__PURE__*/_react["default"].createElement(_context.CommonContext.Provider, {
161
182
  value: {
@@ -170,11 +191,11 @@ var OkrMap = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
170
191
  }, /*#__PURE__*/_react["default"].createElement("div", {
171
192
  className: (0, _classnames["default"])("".concat(_precls["default"]), _defineProperty({}, "".concat(_precls["default"], "__dark"), darkTheme)),
172
193
  onMouseMove: mapMovingHandler,
173
- onMouseUp: panelMouseUpHandler // onClick={closeOkrDrawer}
174
-
194
+ onMouseUp: panelMouseUpHandler,
195
+ onClick: closeOkrDrawer
175
196
  }, /*#__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
197
  onLoad: onLoad,
177
- elements: layoutedElements,
198
+ elements: dataSource,
178
199
  nodesDraggable: false,
179
200
  nodesConnectable: false,
180
201
  nodeTypes: _utils.nodeTypes,
@@ -182,7 +203,7 @@ var OkrMap = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
182
203
  minZoom: 0.25,
183
204
  maxZoom: 1.5,
184
205
  panOnScroll: true
185
- }), /*#__PURE__*/_react["default"].createElement(_miniMap["default"], {
206
+ }, /*#__PURE__*/_react["default"].createElement(NodeDebug, null)), /*#__PURE__*/_react["default"].createElement(_miniMap["default"], {
186
207
  onMoveStart: function onMoveStart() {
187
208
  return isMoving.current = true;
188
209
  }
@@ -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
  }
@@ -89,7 +89,7 @@ function RootNode(props) {
89
89
  if (searchType == "user") {
90
90
  if (hasAvatar) {
91
91
  return /*#__PURE__*/_react["default"].createElement("img", {
92
- src: avatar.small,
92
+ src: avatar.big ? avatar.big : avatar.small,
93
93
  width: 24,
94
94
  style: {
95
95
  borderRadius: "50%"