@titaui/pc 1.11.4-0 → 1.11.4-0.beta-2

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 (163) hide show
  1. package/lib/components/avatar/text-avatar/index.css +9 -2
  2. package/lib/components/avatar/text-avatar/index.js +34 -9
  3. package/lib/components/button/rect-btn/index.js +7 -7
  4. package/lib/components/change-okr-modal/Item.js +15 -15
  5. package/lib/components/communication/index.js +30 -29
  6. package/lib/components/drawer/index.js +7 -6
  7. package/lib/components/dynamic/constant.js +43 -36
  8. package/lib/components/dynamic/dynamic-item/dynamic-ai-dialy/dynamic-footer.js +243 -0
  9. package/lib/components/dynamic/dynamic-item/dynamic-ai-dialy/index.js +6 -2
  10. package/lib/components/dynamic/dynamic-item/dynamic-interview/img/wifi.svg +24 -0
  11. package/lib/components/dynamic/dynamic-item/dynamic-interview/index.css +51 -0
  12. package/lib/components/dynamic/dynamic-item/dynamic-interview/index.js +50 -0
  13. package/lib/components/dynamic/dynamic-item/dynamic-interview/interview-content.js +65 -0
  14. package/lib/components/dynamic/dynamic-item/dynamic-interview-share/img/wifi.svg +24 -0
  15. package/lib/components/dynamic/dynamic-item/dynamic-interview-share/index.css +61 -0
  16. package/lib/components/dynamic/dynamic-item/dynamic-interview-share/index.js +61 -0
  17. package/lib/components/dynamic/dynamic-item/dynamic-interview-share/interview-content.js +69 -0
  18. package/lib/components/dynamic/dynamic-item/dynamic-kr/index.js +6 -6
  19. package/lib/components/dynamic/dynamic-item/dynamic-milestone/index.js +7 -7
  20. package/lib/components/dynamic/dynamic-item/dynamic-progress/index.js +11 -11
  21. package/lib/components/dynamic/dynamic-item/dynamic-reply/index.js +14 -14
  22. package/lib/components/dynamic/dynamic-item/dynamic-task/index.js +10 -10
  23. package/lib/components/dynamic/dynamic-item/index.js +70 -41
  24. package/lib/components/dynamic/dynamic-list/index.js +5 -13
  25. package/lib/components/e-priority/index.js +18 -12
  26. package/lib/components/eReport/eReportShare/index.js +12 -12
  27. package/lib/components/file-list/components/single-file/index.js +11 -11
  28. package/lib/components/form/form-fields/date/index.css +24 -0
  29. package/lib/components/form/form-fields/date/index.js +102 -0
  30. package/lib/components/form/form-fields/input/index.js +10 -10
  31. package/lib/components/form/form-fields/user/index.css +23 -3
  32. package/lib/components/form/form-fields/user/index.js +18 -8
  33. package/lib/components/form/form-fields/user/user-input.js +15 -6
  34. package/lib/components/form/index.js +10 -3
  35. package/lib/components/grid-layout/sub-employee-okr/person-okr.js +11 -5
  36. package/lib/components/icon-button-list/index.css +2 -57
  37. package/lib/components/icon-button-list/index.js +10 -7
  38. package/lib/components/img-viewer/index.css +10 -3
  39. package/lib/components/img-viewer/index.js +57 -18
  40. package/lib/components/mblog/components/MblogContent.js +5 -2
  41. package/lib/components/mblog/index.js +31 -30
  42. package/lib/components/menus/components/menu-tree/images/interview-menu/my-interview.svg +16 -0
  43. package/lib/components/menus/components/menu-tree/images/interview-menu/template.svg +16 -0
  44. package/lib/components/menus/components/menu-tree/images/interview-menu/todo.svg +16 -0
  45. package/lib/components/menus/components/menu-tree/index.css +4 -2
  46. package/lib/components/menus/components/menu-tree/tree-node/index.css +85 -1
  47. package/lib/components/menus/export-modules/interview-menus/constant.js +23 -17
  48. package/lib/components/menus/export-modules/interview-menus/handle-highlight.js +5 -5
  49. package/lib/components/menus/export-modules/interview-menus/index.css +7 -0
  50. package/lib/components/menus/export-modules/interview-menus/index.js +5 -4
  51. package/lib/components/nav-top/components/menu/img/new.svg +30 -0
  52. package/lib/components/nav-top/components/menu/img/wecome-temp.png +0 -0
  53. package/lib/components/nav-top/components/menu/index.css +91 -0
  54. package/lib/components/nav-top/components/menu/index.js +80 -32
  55. package/lib/components/nav-top/components/user-message/components/inform/inform-item.js +25 -19
  56. package/lib/components/nav-top/components/user-message/components/remind/remind-item.js +48 -10
  57. package/lib/components/nav-top/components/user-message/constant.js +1 -0
  58. package/lib/components/nav-top/components/user-message/hrMessage.js +22 -19
  59. package/lib/components/nav-top/components/user-message/index.js +23 -20
  60. package/lib/components/nav-top/request.apis.js +3 -1
  61. package/lib/components/okr-detail/components/okr-tree/tree-node/e-node/e-priority-dropdown.js +7 -7
  62. package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/index.js +3 -2
  63. package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/range-picker-pop.js +10 -0
  64. package/lib/components/okr-detail/detail-header/actions.js +62 -66
  65. package/lib/components/okr-detail/detail-header/index.css +2 -2
  66. package/lib/components/okr-detail/detail-header/index.js +205 -194
  67. package/lib/components/okr-detail/index.js +21 -19
  68. package/lib/components/okr-detail/okr-list/index.js +5 -3
  69. package/lib/components/okr-flow/child-node/index.css +68 -22
  70. package/lib/components/okr-flow/child-node/work-node.js +61 -24
  71. package/lib/components/okr-flow/empty/index.css +8 -1
  72. package/lib/components/okr-flow/export-modal/index.js +108 -21
  73. package/lib/components/okr-flow/export-modules/okr-search-panel/index.css +3 -1
  74. package/lib/components/okr-flow/export-modules/okr-search-panel/index.js +30 -24
  75. package/lib/components/okr-flow/images/loading-light.gif +0 -0
  76. package/lib/components/okr-flow/okr-map/index.js +43 -22
  77. package/lib/components/okr-flow/request-apis.js +15 -8
  78. package/lib/components/okr-flow/root-node/index.css +2 -2
  79. package/lib/components/okr-flow/root-node/index.js +26 -25
  80. package/lib/components/okr-flow/utils/index.js +45 -29
  81. package/lib/components/okr-flow/utils/tree-handler.js +29 -18
  82. package/lib/components/okrcase-library/index.css +6 -4
  83. package/lib/components/okrcase-library/okrcases-components/submitOkr-dialog.js +36 -30
  84. package/lib/components/pagination/index.css +3 -3
  85. package/lib/components/pagination/select.css +58 -23
  86. package/lib/components/period-selector/index.css +9 -3
  87. package/lib/components/period-selector/index.js +14 -11
  88. package/lib/components/picker/components/panels/date-panel/date-body.js +21 -19
  89. package/lib/components/picker/components/panels/date-panel/date-head.js +29 -8
  90. package/lib/components/picker/components/panels/month-panel/month-body.js +6 -4
  91. package/lib/components/picker/components/picker-trigger/index.css +31 -0
  92. package/lib/components/picker/components/picker-trigger/index.js +24 -15
  93. package/lib/components/picker/picker-panels.js +1 -1
  94. package/lib/components/picker/picker.js +12 -13
  95. package/lib/components/popup/index.js +4 -4
  96. package/lib/components/radio/index.css +9 -9
  97. package/lib/components/scroll-container/index.js +423 -0
  98. package/lib/components/scroll-container/style.css +35 -0
  99. package/lib/components/scrollbar/scroll-mask/index.js +1 -1
  100. package/lib/components/superset-charts/components/chart/index.js +1 -1
  101. package/lib/components/superset-charts/utils/axios.js +5 -13
  102. package/lib/components/survey-model/contact.js +93 -0
  103. package/lib/components/survey-model/index.css +141 -0
  104. package/lib/components/survey-model/index.js +268 -0
  105. package/lib/components/survey-model/instance.js +86 -0
  106. package/lib/components/survey-model/request-api.js +80 -0
  107. package/lib/components/task-relation-modal/index.js +0 -1
  108. package/lib/components/task-tree/helper.js +61 -0
  109. package/lib/components/task-tree/images/P1.svg +15 -0
  110. package/lib/components/task-tree/images/P2.svg +15 -0
  111. package/lib/components/task-tree/images/P3.svg +15 -0
  112. package/lib/components/task-tree/images/P4.svg +15 -0
  113. package/lib/components/task-tree/images/P5.svg +15 -0
  114. package/lib/components/task-tree/images/arrow.svg +9 -0
  115. package/lib/components/task-tree/images/empty-131.png +0 -0
  116. package/lib/components/task-tree/images/followed.svg +33 -0
  117. package/lib/components/task-tree/images/nice.svg +108 -0
  118. package/lib/components/task-tree/images/struc12.png +0 -0
  119. package/lib/components/task-tree/images/struc2.png +0 -0
  120. package/lib/components/task-tree/images/xialat-s.svg +13 -0
  121. package/lib/components/task-tree/index.js +16 -0
  122. package/lib/components/task-tree/precls.js +8 -0
  123. package/lib/components/task-tree/request-apis.js +88 -0
  124. package/lib/components/task-tree/task-item-node/constant.js +45 -0
  125. package/lib/components/task-tree/task-item-node/e-empty.js +29 -0
  126. package/lib/components/task-tree/task-item-node/e-project.js +212 -0
  127. package/lib/components/task-tree/task-item-node/e-status-dropdown.js +114 -0
  128. package/lib/components/task-tree/task-item-node/e-task.js +426 -0
  129. package/lib/components/task-tree/task-item-node/get-process-color.js +62 -0
  130. package/lib/components/task-tree/task-item-node/index.css +299 -0
  131. package/lib/components/task-tree/task-item-node/task-node-render.js +43 -0
  132. package/lib/components/task-tree/task-tree.css +16 -0
  133. package/lib/components/task-tree/task-tree.js +49 -0
  134. package/lib/components/time-picker/index.css +24 -0
  135. package/lib/components/time-picker/time-picker-selector.js +8 -12
  136. package/lib/components/time-picker/time-picker.js +94 -133
  137. package/lib/components/time-picker/timer-picker-input.js +3 -7
  138. package/lib/components/time-picker/utils.js +13 -2
  139. package/lib/components/user-selector/select-tree/tree-nodes/tree-person-node/index.css +1 -0
  140. package/lib/components/wechat-btn/index.css +14 -0
  141. package/lib/components/wechat-btn/index.js +338 -0
  142. package/lib/components-v1/radio/radio.js +3 -3
  143. package/lib/components-v1/radio/style/index.css +8 -8
  144. package/lib/index.js +99 -91
  145. package/lib/pages/okr-map/export-modules/okr-map/header/index.css +7 -2
  146. package/lib/pages/okr-map/export-modules/okr-map/header/index.js +73 -34
  147. package/lib/pages/okr-map/export-modules/okr-map/okr-map.js +65 -42
  148. package/lib/pages/okr-map/export-modules/share-okr-page/header/index.css +26 -14
  149. package/lib/pages/okr-map/export-modules/share-okr-page/header/index.js +58 -13
  150. package/lib/pages/okr-map/export-modules/share-okr-page/share-okr-map.js +28 -20
  151. package/lib/pages/okr-map/number-select/index.css +12 -9
  152. package/lib/pages/okr-map/number-select/index.js +3 -3
  153. package/lib/utils/auth.js +65 -8
  154. package/lib/utils/bs-global.js +18 -6
  155. package/lib/utils/open-data.js +63 -43
  156. package/package.json +6 -2
  157. package/.eslintignore +0 -3
  158. package/.eslintrc.js +0 -223
  159. package/.husky/pre-commit +0 -4
  160. package/.prettierignore +0 -31
  161. package/.prettierrc.js +0 -90
  162. package/.vscode/settings.json +0 -5
  163. package/yarn-error.log +0 -22184
@@ -72,7 +72,7 @@ function OkrSearchPanel(props, ref) {
72
72
  _props$rootId = props.rootId,
73
73
  rootId = _props$rootId === void 0 ? 0 : _props$rootId,
74
74
  _props$rootName = props.rootName,
75
- rootName = _props$rootName === void 0 ? "" : _props$rootName,
75
+ rootName = _props$rootName === void 0 ? '' : _props$rootName,
76
76
  _props$avatar = props.avatar,
77
77
  avatar = _props$avatar === void 0 ? {} : _props$avatar,
78
78
  direction = props.direction,
@@ -80,13 +80,15 @@ function OkrSearchPanel(props, ref) {
80
80
  yqmNum = props.yqmNum,
81
81
  annualNum = props.annualNum,
82
82
  _props$okrType = props.okrType,
83
- okrType = _props$okrType === void 0 ? "" : _props$okrType,
83
+ okrType = _props$okrType === void 0 ? '' : _props$okrType,
84
84
  _props$openLevel = props.openLevel,
85
85
  openLevel = _props$openLevel === void 0 ? 2 : _props$openLevel,
86
86
  _props$showkr = props.showkr,
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) {
@@ -125,12 +127,12 @@ function OkrSearchPanel(props, ref) {
125
127
  cycleType: cycleType,
126
128
  yqmNum: yqmNum,
127
129
  annualNum: annualNum,
128
- userIds: searchType == "user" ? rootId : "",
129
- departmentIds: searchType == "depart" ? rootId : "",
130
- groupIds: searchType == "group" ? rootId : "",
130
+ userIds: searchType == 'user' ? rootId : '',
131
+ departmentIds: searchType == 'depart' ? rootId : '',
132
+ groupIds: searchType == 'group' ? rootId : '',
131
133
  orderType: 2,
132
134
  // 排序
133
- okrType: _config.OkrTypeSetting ? searchType == "user" ? "" : okrType : "",
135
+ okrType: _config.OkrTypeSetting ? searchType == 'user' ? '' : okrType : '',
134
136
  status: 0
135
137
  });
136
138
 
@@ -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:
@@ -165,7 +168,7 @@ function OkrSearchPanel(props, ref) {
165
168
  subTreeNodes = (0, _treeHandler.buildTreeNodes)(allNodes, openLevel, showkr);
166
169
  setTreeNodes({
167
170
  id: 0,
168
- modelType: "root",
171
+ modelType: 'root',
169
172
  data: _defineProperty({
170
173
  searchType: searchType,
171
174
  rootName: rootName,
@@ -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) {
@@ -213,10 +217,11 @@ function OkrSearchPanel(props, ref) {
213
217
  id = node.id, modelType = node.modelType, data = node.data;
214
218
  _context2.next = 3;
215
219
  return (0, _requestApis.expandNode)({
216
- krId: modelType == "kr" ? id : 0,
217
- okrId: modelType == "kr" ? data.workId : id,
218
- okrIdParent: modelType == "work" ? data.parentId : data.workId,
219
- childRoot: false
220
+ krId: modelType == 'kr' ? id : 0,
221
+ okrId: modelType == 'kr' ? data.workId : id,
222
+ okrIdParent: modelType == 'work' ? data.parentId : data.workId,
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
  }();
@@ -264,11 +269,12 @@ function OkrSearchPanel(props, ref) {
264
269
  id = node.id, modelType = node.modelType, data = node.data;
265
270
  _context3.next = 3;
266
271
  return (0, _requestApis.expandNode)({
267
- krId: modelType == "kr" ? id : 0,
268
- okrId: modelType == "work" ? id : data.workId,
272
+ krId: modelType == 'kr' ? id : 0,
273
+ okrId: modelType == 'work' ? id : data.workId,
269
274
  okrIdParent: 0,
270
275
  childRoot: true,
271
- currentOkrRole: modelType == "kr" ? data.mapkrVisible : data.MapOkrVisible
276
+ showCardKr: showCardKr ? 1 : 0,
277
+ currentOkrRole: modelType == 'kr' ? data.mapkrVisible : data.MapOkrVisible
272
278
  });
273
279
 
274
280
  case 3:
@@ -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
  }();
@@ -319,7 +325,7 @@ function OkrSearchPanel(props, ref) {
319
325
  break;
320
326
  }
321
327
 
322
- _toast["default"].Warning("暂无OKR");
328
+ _toast["default"].Warning('暂无OKR');
323
329
 
324
330
  return _context4.abrupt("return");
325
331
 
@@ -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 _isEqual = _interopRequireDefault(require("lodash/isEqual"));
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."); }
@@ -53,7 +63,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
53
63
 
54
64
  var OkrMap = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
55
65
  var _props$direction = props.direction,
56
- direction = _props$direction === void 0 ? "horizontal" : _props$direction,
66
+ direction = _props$direction === void 0 ? 'horizontal' : _props$direction,
57
67
  _props$darkTheme = props.darkTheme,
58
68
  darkTheme = _props$darkTheme === void 0 ? false : _props$darkTheme,
59
69
  _props$showkr = props.showkr,
@@ -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,30 +91,42 @@ 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
- if (direction == "horizontal") {
103
+ if (direction == 'horizontal') {
100
104
  var targetY = containerHeight / 2;
101
105
  return [-160, targetY - rootNode.position.y];
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
+ }, _isEqual["default"]);
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
  }
@@ -27,8 +27,8 @@ var userId = window.BSGlobal && window.BSGlobal.loginUserInfo.Id || 0;
27
27
  exports.userId = userId;
28
28
 
29
29
  var requestDomain = function requestDomain() {
30
- if (!window.location.hostname.match(/dev/)) return "";
31
- return "https://www.tita.gift";
30
+ if (!window.location.hostname.match(/dev/)) return '';
31
+ return 'https://www.tita.gift';
32
32
  };
33
33
 
34
34
  var checkTenantOkrExist = /*#__PURE__*/function () {
@@ -70,15 +70,17 @@ exports.searchOkrs = searchOkrs;
70
70
 
71
71
  var expandNode = function expandNode(params) {
72
72
  var _params$okrId = params.okrId,
73
- okrId = _params$okrId === void 0 ? "" : _params$okrId,
73
+ okrId = _params$okrId === void 0 ? '' : _params$okrId,
74
74
  _params$krId = params.krId,
75
- krId = _params$krId === void 0 ? "" : _params$krId,
75
+ krId = _params$krId === void 0 ? '' : _params$krId,
76
76
  _params$childRoot = params.childRoot,
77
77
  childRoot = _params$childRoot === void 0 ? true : _params$childRoot,
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
  }
@@ -50,19 +50,19 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
50
50
  function RootNode(props) {
51
51
  var _props$data = props.data,
52
52
  _props$data$rootName = _props$data.rootName,
53
- rootName = _props$data$rootName === void 0 ? "" : _props$data$rootName,
53
+ rootName = _props$data$rootName === void 0 ? '' : _props$data$rootName,
54
54
  _props$data$rootId = _props$data.rootId,
55
55
  rootId = _props$data$rootId === void 0 ? 0 : _props$data$rootId,
56
56
  _props$data$avatar = _props$data.avatar,
57
57
  avatar = _props$data$avatar === void 0 ? {} : _props$data$avatar,
58
58
  searchType = _props$data.searchType;
59
59
 
60
- var _useState = (0, _react.useState)(""),
60
+ var _useState = (0, _react.useState)(''),
61
61
  _useState2 = _slicedToArray(_useState, 2),
62
62
  normalRootImg = _useState2[0],
63
63
  setNormalRootImg = _useState2[1];
64
64
 
65
- var _useState3 = (0, _react.useState)(""),
65
+ var _useState3 = (0, _react.useState)(''),
66
66
  _useState4 = _slicedToArray(_useState3, 2),
67
67
  whiteRootImg = _useState4[0],
68
68
  setWhiteImg = _useState4[1];
@@ -80,19 +80,19 @@ function RootNode(props) {
80
80
  darkTheme = context.darkTheme;
81
81
 
82
82
  var getRootIcon = function getRootIcon() {
83
- if (searchType == "company") {
83
+ if (searchType == 'company') {
84
84
  return /*#__PURE__*/_react["default"].createElement("span", {
85
85
  className: (0, _classnames["default"])("".concat(_precls["default"], "--root-node-icon__company"))
86
86
  });
87
87
  }
88
88
 
89
- if (searchType == "user") {
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
- borderRadius: "50%"
95
+ borderRadius: '50%'
96
96
  }
97
97
  });
98
98
  }
@@ -118,7 +118,7 @@ function RootNode(props) {
118
118
  })));
119
119
  }
120
120
 
121
- if (searchType == "depart") {
121
+ if (searchType == 'depart') {
122
122
  return /*#__PURE__*/_react["default"].createElement("span", {
123
123
  className: (0, _classnames["default"])("".concat(_precls["default"], "--root-node-icon__normal"))
124
124
  }, rootName[0]);
@@ -147,15 +147,15 @@ function RootNode(props) {
147
147
  return (0, _openDataPainter.getOpenData)({
148
148
  id: rootId,
149
149
  name: rootName,
150
- type: searchType == "user" ? "userName" : "departmentName"
150
+ type: searchType == 'user' ? 'userName' : 'departmentName'
151
151
  });
152
152
 
153
153
  case 4:
154
154
  wxRootName = _context.sent;
155
155
 
156
156
  case 5:
157
- generalCanvas("normal", wxRootName);
158
- generalCanvas("white", wxRootName);
157
+ generalCanvas('normal', wxRootName);
158
+ generalCanvas('white', wxRootName);
159
159
 
160
160
  case 7:
161
161
  case "end":
@@ -171,11 +171,11 @@ function RootNode(props) {
171
171
  }();
172
172
 
173
173
  var generalCanvas = function generalCanvas() {
174
- var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "normal";
174
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'normal';
175
175
  var rootName = arguments.length > 1 ? arguments[1] : undefined;
176
- var canvas = document.createElement("canvas");
177
- var font = "normal 14px/24px Arial,Verdana,Helvetica Neue,Helvetica,sans-serif,PingFang SC,Microsoft YaHei";
178
- var ctx = canvas.getContext("2d");
176
+ var canvas = document.createElement('canvas');
177
+ var font = 'normal 14px/24px Arial,Verdana,Helvetica Neue,Helvetica,sans-serif,PingFang SC,Microsoft YaHei';
178
+ var ctx = canvas.getContext('2d');
179
179
  ctx.font = font; // const fitStr = fittingString(ctx, rootName, 268);
180
180
 
181
181
  var _ctx$measureText = ctx.measureText(rootName),
@@ -185,41 +185,42 @@ function RootNode(props) {
185
185
  (0, _openDataPainter.setSize)(canvas, ctx, actualWidth, 24); // 设置画布尺寸
186
186
 
187
187
  setImgWidth(actualWidth);
188
- ctx.textBaseline = "middle";
188
+ ctx.textBaseline = 'middle';
189
189
  ctx.font = font;
190
- ctx.fillStyle = type == "normal" ? "#6f7886" : "#FFFFFF";
190
+ ctx.fillStyle = type == 'normal' ? '#6f7886' : '#FFFFFF';
191
191
  ctx.fillText(rootName, 0, 12);
192
- type == "normal" ? setNormalRootImg(canvas.toDataURL()) : setWhiteImg(canvas.toDataURL());
192
+ type == 'normal' ? setNormalRootImg(canvas.toDataURL()) : setWhiteImg(canvas.toDataURL());
193
193
  };
194
194
 
195
195
  (0, _react.useEffect)(function () {
196
- (searchType == "user" || searchType == "depart") && rootName.length && getRootName();
196
+ ;
197
+ (searchType == 'user' || searchType == 'depart') && rootName.length && getRootName();
197
198
  }, [rootName, rootId]);
198
199
  return /*#__PURE__*/_react["default"].createElement("div", {
199
200
  className: (0, _classnames["default"])("".concat(_precls["default"], "--root-node-wrapper"), "".concat(_precls["default"], "--root-node-wrapper__").concat(direction))
200
201
  }, /*#__PURE__*/_react["default"].createElement("div", {
201
202
  className: (0, _classnames["default"])("".concat(_precls["default"], "--root-node"))
202
- }, getRootIcon(), searchType !== "user" && searchType !== "depart" && /*#__PURE__*/_react["default"].createElement("span", {
203
+ }, getRootIcon(), searchType !== 'user' && searchType !== 'depart' && /*#__PURE__*/_react["default"].createElement("span", {
203
204
  className: (0, _classnames["default"])("".concat(_precls["default"], "--root-node-text"))
204
- }, rootName), (searchType == "user" || searchType == "depart") && /*#__PURE__*/_react["default"].createElement("img", {
205
+ }, rootName), (searchType == 'user' || searchType == 'depart') && /*#__PURE__*/_react["default"].createElement("img", {
205
206
  src: darkTheme ? whiteRootImg : normalRootImg,
206
207
  style: {
207
208
  maxWidth: 268,
208
209
  marginLeft: 4
209
210
  },
210
211
  width: imgWidth
211
- })), direction === "horizontal" && /*#__PURE__*/_react["default"].createElement(_reactFlowRenderer.Handle, {
212
+ })), direction === 'horizontal' && /*#__PURE__*/_react["default"].createElement(_reactFlowRenderer.Handle, {
212
213
  type: "source",
213
214
  position: "right",
214
215
  style: {
215
- visibility: "hidden",
216
+ visibility: 'hidden',
216
217
  right: 0
217
218
  }
218
- }), direction === "vertical" && /*#__PURE__*/_react["default"].createElement(_reactFlowRenderer.Handle, {
219
+ }), direction === 'vertical' && /*#__PURE__*/_react["default"].createElement(_reactFlowRenderer.Handle, {
219
220
  type: "source",
220
221
  position: "bottom",
221
222
  style: {
222
- visibility: "hidden",
223
+ visibility: 'hidden',
223
224
  bottom: 0
224
225
  }
225
226
  }));
@@ -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"]
@@ -22,44 +28,54 @@ var nodeTypes = {
22
28
  exports.nodeTypes = nodeTypes;
23
29
 
24
30
  var getLayoutedElements = function getLayoutedElements(elements) {
25
- var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "horizontal";
26
- 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 {};
31
+ var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'horizontal';
32
+ var isHorizontal = direction === 'horizontal'; // const g = new dagre.graphlib.Graph({compound: true });
33
+
34
+ var g = new _dagre["default"].graphlib.Graph();
35
+ g.setGraph({
36
+ rankdir: isHorizontal ? 'LR' : 'TB',
37
+ nodesep: 12,
38
+ ranksep: 80
32
39
  });
33
- dagreGraph.setGraph({
34
- rankdir: isHorizontal ? "LR" : "TB",
35
- ranksep: 80,
36
- nodesep: 12
40
+ g.setDefaultEdgeLabel(function () {
41
+ return {};
37
42
  });
38
- elements.forEach(function (el) {
39
- if ((0, _reactFlowRenderer.isNode)(el)) {
40
- dagreGraph.setNode(el.id, {
41
- width: nodeWidth,
42
- height: nodeHeight
43
+ elements.forEach(function (element) {
44
+ if ((0, _reactFlowRenderer.isNode)(element)) {
45
+ var _element$__rf, _element$__rf2;
46
+
47
+ // const { data,id } = element
48
+ // if(id!=="0"){
49
+ // const {parentId} = data
50
+ // if(parentId===0||parentId){
51
+ // g.setParent(id, parentId+"");
52
+ // }
53
+ // }
54
+ g.setNode(element.id, {
55
+ width: (_element$__rf = element.__rf) === null || _element$__rf === void 0 ? void 0 : _element$__rf.width,
56
+ height: (_element$__rf2 = element.__rf) === null || _element$__rf2 === void 0 ? void 0 : _element$__rf2.height
43
57
  });
44
58
  } else {
45
- dagreGraph.setEdge(el.source, el.target);
59
+ g.setEdge(element.source, element.target);
46
60
  }
47
61
  });
48
62
 
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
- };
63
+ _dagre["default"].layout(g);
64
+
65
+ return elements.map(function (element) {
66
+ if ((0, _reactFlowRenderer.isNode)(element)) {
67
+ var node = g.node(element.id);
68
+ return _objectSpread(_objectSpread({}, element), {}, {
69
+ targetPosition: isHorizontal ? 'left' : 'top',
70
+ sourcePosition: isHorizontal ? 'right' : 'bottom',
71
+ position: {
72
+ x: node ? (node === null || node === void 0 ? void 0 : node.x) - (node === null || node === void 0 ? void 0 : node.width) / 2 : 0,
73
+ y: node ? (node === null || node === void 0 ? void 0 : node.y) - (node === null || node === void 0 ? void 0 : node.height) / 2 : 0
74
+ }
75
+ });
60
76
  }
61
77
 
62
- return el;
78
+ return element;
63
79
  });
64
80
  };
65
81