@titaui/pc 1.11.52 → 1.11.55

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 (117) hide show
  1. package/lib/components/button/images/blue.svg +21 -0
  2. package/lib/components/button/images/red.svg +21 -0
  3. package/lib/components/button/images/white.svg +19 -0
  4. package/lib/components/button/rect-btn/index.js +3 -3
  5. package/lib/components/checkbox/index.css +4 -0
  6. package/lib/components/create-okr-modal/index.js +3 -1
  7. package/lib/components/dynamic/dynamic-list/index.js +14 -7
  8. package/lib/components/dynamic/index.js +9 -12
  9. package/lib/components/dynamic/request-api.js +7 -68
  10. package/lib/components/nav-top/index.js +2 -2
  11. package/lib/components/okr-detail/components/base-okr-type/confirm/confirm.js +1 -1
  12. package/lib/components/okr-detail/e-list/index.js +2 -2
  13. package/lib/components/period-selector/interface.js +7 -0
  14. package/lib/components/publish-dynamic-modal/publish-dynamic-modal.js +16 -10
  15. package/lib/components/search-input/index.css +1 -1
  16. package/lib/components/select-layer/index.css +1 -1
  17. package/lib/components/task-relation-modal/helper.js +139 -2
  18. package/lib/components/task-relation-modal/image/loading.gif +0 -0
  19. package/lib/components/task-relation-modal/index.js +9 -0
  20. package/lib/components/task-relation-modal/okr-relation/relation-task-model/index.css +18 -0
  21. package/lib/components/task-relation-modal/okr-relation/relation-task-model/index.js +262 -0
  22. package/lib/components/task-relation-modal/okr-relation/relation-task-model/search-form.js +135 -0
  23. package/lib/components/task-relation-modal/okr-relation/relation-work-model/index.css +0 -0
  24. package/lib/components/task-relation-modal/okr-relation/relation-work-model/index.js +129 -0
  25. package/lib/components/task-relation-modal/okr-relation/request-api.js +106 -0
  26. package/lib/components/task-relation-modal/okr-relation/tree/task-tree/index.css +120 -0
  27. package/lib/components/task-relation-modal/okr-relation/tree/task-tree/index.js +185 -0
  28. package/lib/components/task-relation-modal/request-api.js +28 -2
  29. package/lib/components/task-relation-modal/search/okr-status-select.js +3 -3
  30. package/lib/components/task-relation-modal/search/principal.js +20 -5
  31. package/lib/components/task-relation-modal/search/search-dropdown/index.css +2 -1
  32. package/lib/components/task-relation-modal/search/search-dropdown/index.js +1 -1
  33. package/lib/components/{dynamic/dynamic-topping/index.js → task-relation-modal/search/task-relation.js} +45 -44
  34. package/lib/components/task-relation-modal/search/task-status-select.js +87 -0
  35. package/lib/components/{dynamic/dynamic-liking/index.js → task-relation-modal/search/work-relation.js} +43 -39
  36. package/lib/components/task-relation-modal/search/work-status-select.js +74 -0
  37. package/lib/components/task-relation-modal/tree/okr-tree/index.css +1 -1
  38. package/lib/components/task-relation-modal/tree/okr-tree/search-form.js +16 -2
  39. package/lib/components/task-relation-modal/tree/task-list/index.css +0 -0
  40. package/lib/components/task-relation-modal/tree/task-list/index.js +1 -0
  41. package/lib/components/task-relation-modal/tree/work-list/index.css +14 -0
  42. package/lib/components/task-relation-modal/tree/work-list/index.js +176 -0
  43. package/lib/components/task-relation-modal/tree/work-list/search-form.js +123 -0
  44. package/lib/components/task-relation-modal/tree-node/work-node/index.js +3 -1
  45. package/lib/components/task-relation-modal/work-relation/index.css +0 -0
  46. package/lib/components/task-relation-modal/work-relation/index.js +256 -0
  47. package/lib/components/tooltip/index.js +3 -0
  48. package/lib/components/tooltip/tooltip-rows/index.css +26 -0
  49. package/lib/components/{dynamic/advertise → tooltip/tooltip-rows}/index.js +65 -85
  50. package/lib/components/user-selector/select-tree/tree-nodes/tree-person-node/index.js +46 -18
  51. package/lib/utils/planDataJson.js +11115 -0
  52. package/package.json +2 -2
  53. package/lib/components/dynamic/advertise/components/next-btn/index.css +0 -27
  54. package/lib/components/dynamic/advertise/components/next-btn/index.js +0 -32
  55. package/lib/components/dynamic/advertise/components/pre-btn/index.css +0 -26
  56. package/lib/components/dynamic/advertise/components/pre-btn/index.js +0 -32
  57. package/lib/components/dynamic/advertise/index.css +0 -21
  58. package/lib/components/dynamic/advertise/interface.js +0 -5
  59. package/lib/components/dynamic/advertise/util.js +0 -28
  60. package/lib/components/dynamic/components/dynamic-search-input/index.css +0 -81
  61. package/lib/components/dynamic/components/dynamic-search-input/index.js +0 -203
  62. package/lib/components/dynamic/components/first-level-tabs/index.css +0 -101
  63. package/lib/components/dynamic/components/first-level-tabs/index.js +0 -131
  64. package/lib/components/dynamic/dynamic-like-ranking/image/like-ranking.svg +0 -23
  65. package/lib/components/dynamic/dynamic-like-ranking/image/ranking-1.png +0 -0
  66. package/lib/components/dynamic/dynamic-like-ranking/image/ranking-2.png +0 -0
  67. package/lib/components/dynamic/dynamic-like-ranking/image/ranking-3.png +0 -0
  68. package/lib/components/dynamic/dynamic-like-ranking/image/ranking-empty.png +0 -0
  69. package/lib/components/dynamic/dynamic-like-ranking/index.css +0 -146
  70. package/lib/components/dynamic/dynamic-like-ranking/index.js +0 -180
  71. package/lib/components/dynamic/dynamic-like-ranking/item.js +0 -105
  72. package/lib/components/dynamic/dynamic-like-ranking/mock.js +0 -84
  73. package/lib/components/dynamic/dynamic-liking/image/like-dynamic.svg +0 -30
  74. package/lib/components/dynamic/dynamic-liking/index.css +0 -81
  75. package/lib/components/dynamic/dynamic-liking/item.js +0 -75
  76. package/lib/components/dynamic/dynamic-liking/mock.js +0 -83
  77. package/lib/components/dynamic/dynamic-topping/image/quotation-mark.svg +0 -16
  78. package/lib/components/dynamic/dynamic-topping/image/top-icon.svg +0 -30
  79. package/lib/components/dynamic/dynamic-topping/index.css +0 -141
  80. package/lib/components/dynamic/dynamic-topping/interface.js +0 -5
  81. package/lib/components/dynamic/dynamic-topping/item.js +0 -153
  82. package/lib/components/dynamic/dynamic-topping/request-api.js +0 -36
  83. package/lib/components/dynamic/dynamic.css +0 -173
  84. package/lib/components/dynamic/dynamic.js +0 -428
  85. package/lib/components/dynamic/export-module/index.js +0 -37
  86. package/lib/components/dynamic/img/dynamic-top.svg +0 -14
  87. package/lib/components/dynamic/my-team/img/add-subordinate.png +0 -0
  88. package/lib/components/dynamic/my-team/img/line.png +0 -0
  89. package/lib/components/dynamic/my-team/img/team.png +0 -0
  90. package/lib/components/dynamic/my-team/index.css +0 -184
  91. package/lib/components/dynamic/my-team/index.js +0 -263
  92. package/lib/components/dynamic/my-team/request-api.js +0 -52
  93. package/lib/components/dynamic/my-team/util.js +0 -20
  94. package/lib/components/dynamic/new-ui.css +0 -192
  95. package/lib/components/dynamic/online-broadcast/components/broadcast-item/index.css +0 -58
  96. package/lib/components/dynamic/online-broadcast/components/broadcast-item/index.js +0 -68
  97. package/lib/components/dynamic/online-broadcast/data.js +0 -95
  98. package/lib/components/dynamic/online-broadcast/img/broadcast.svg +0 -14
  99. package/lib/components/dynamic/online-broadcast/img/new.png +0 -0
  100. package/lib/components/dynamic/online-broadcast/img/preview.png +0 -0
  101. package/lib/components/dynamic/online-broadcast/index.css +0 -46
  102. package/lib/components/dynamic/online-broadcast/index.js +0 -61
  103. package/lib/components/dynamic/online-broadcast/interfact.js +0 -5
  104. package/lib/components/dynamic/quick-operation/components/create-announcement/index.css +0 -25
  105. package/lib/components/dynamic/quick-operation/components/create-announcement/index.js +0 -39
  106. package/lib/components/dynamic/quick-operation/components/create-okr/index.css +0 -25
  107. package/lib/components/dynamic/quick-operation/components/create-okr/index.js +0 -39
  108. package/lib/components/dynamic/quick-operation/components/create-share/index.css +0 -25
  109. package/lib/components/dynamic/quick-operation/components/create-share/index.js +0 -39
  110. package/lib/components/dynamic/quick-operation/components/create-task/index.css +0 -25
  111. package/lib/components/dynamic/quick-operation/components/create-task/index.js +0 -44
  112. package/lib/components/dynamic/quick-operation/img/new-announcement.png +0 -0
  113. package/lib/components/dynamic/quick-operation/img/new-okr.png +0 -0
  114. package/lib/components/dynamic/quick-operation/img/new-share.png +0 -0
  115. package/lib/components/dynamic/quick-operation/img/new-task.png +0 -0
  116. package/lib/components/dynamic/quick-operation/index.css +0 -51
  117. package/lib/components/dynamic/quick-operation/index.js +0 -120
@@ -0,0 +1,256 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _dialog = _interopRequireDefault(require("../../dialog"));
13
+
14
+ var _toast = _interopRequireDefault(require("../../toast"));
15
+
16
+ var _okrTree = _interopRequireDefault(require("../tree/okr-tree"));
17
+
18
+ var _helper = require("../helper");
19
+
20
+ var _context3 = require("../context");
21
+
22
+ var _requestApi = require("../request-api");
23
+
24
+ var _getLocale = require("../../../utils/getLocale");
25
+
26
+ require("./index.css");
27
+
28
+ var _excluded = ["defaultVisible", "multiple", "onOk", "onCancel", "taskId", "isRelationOther", "lastSelected"];
29
+
30
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
31
+
32
+ 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); }
33
+
34
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
+
36
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
37
+
38
+ 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); } }
39
+
40
+ 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); }); }; }
41
+
42
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
43
+
44
+ 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."); }
45
+
46
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
47
+
48
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
49
+
50
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
51
+
52
+ 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
+
54
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
55
+
56
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
57
+
58
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
59
+
60
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
61
+
62
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
63
+
64
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
65
+
66
+ function WorkRelationModal(props) {
67
+ var _props$defaultVisible = props.defaultVisible,
68
+ defaultVisible = _props$defaultVisible === void 0 ? false : _props$defaultVisible,
69
+ _props$multiple = props.multiple,
70
+ multiple = _props$multiple === void 0 ? true : _props$multiple,
71
+ onOk = props.onOk,
72
+ _props$onCancel = props.onCancel,
73
+ onCancel = _props$onCancel === void 0 ? function () {} : _props$onCancel,
74
+ _props$taskId = props.taskId,
75
+ taskId = _props$taskId === void 0 ? 0 : _props$taskId,
76
+ _props$isRelationOthe = props.isRelationOther,
77
+ isRelationOther = _props$isRelationOthe === void 0 ? false : _props$isRelationOthe,
78
+ _props$lastSelected = props.lastSelected,
79
+ lastSelected = _props$lastSelected === void 0 ? [] : _props$lastSelected,
80
+ restProps = _objectWithoutProperties(props, _excluded);
81
+
82
+ var _useState = (0, _react.useState)(defaultVisible),
83
+ _useState2 = _slicedToArray(_useState, 2),
84
+ visible = _useState2[0],
85
+ setVisible = _useState2[1];
86
+
87
+ var _useState3 = (0, _react.useState)(lastSelected),
88
+ _useState4 = _slicedToArray(_useState3, 2),
89
+ selected = _useState4[0],
90
+ setSelected = _useState4[1];
91
+
92
+ var _useState5 = (0, _react.useState)([]),
93
+ _useState6 = _slicedToArray(_useState5, 2),
94
+ selectedRoots = _useState6[0],
95
+ setSelectedRoots = _useState6[1];
96
+
97
+ (0, _react.useEffect)(function () {
98
+ var roots = selected.reduce(function (res, cur) {
99
+ return [].concat(_toConsumableArray(res), [cur.workId]);
100
+ }, []);
101
+ setSelectedRoots(roots);
102
+ }, [selected]);
103
+
104
+ var updateRelationOthers = /*#__PURE__*/function () {
105
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
106
+ var _yield$relationWorks, Message;
107
+
108
+ return regeneratorRuntime.wrap(function _callee$(_context) {
109
+ while (1) {
110
+ switch (_context.prev = _context.next) {
111
+ case 0:
112
+ _context.next = 2;
113
+ return (0, _requestApi.relationWorks)({
114
+ TaskId: taskId,
115
+ taskRelationModels: selected.map(function (item) {
116
+ return {
117
+ WorkId: item.workId,
118
+ KrId: item.krId
119
+ };
120
+ })
121
+ });
122
+
123
+ case 2:
124
+ _yield$relationWorks = _context.sent;
125
+ Message = _yield$relationWorks.Message;
126
+
127
+ if (Message) {
128
+ _toast["default"].Error(Message);
129
+ } else {
130
+ _toast["default"].Success((0, _getLocale.getLocale)("Mod_Successfuloperat"));
131
+ }
132
+
133
+ case 5:
134
+ case "end":
135
+ return _context.stop();
136
+ }
137
+ }
138
+ }, _callee);
139
+ }));
140
+
141
+ return function updateRelationOthers() {
142
+ return _ref.apply(this, arguments);
143
+ };
144
+ }();
145
+
146
+ var updateRelation = /*#__PURE__*/function () {
147
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
148
+ var _selected, node, _yield$updateLable, Message;
149
+
150
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
151
+ while (1) {
152
+ switch (_context2.prev = _context2.next) {
153
+ case 0:
154
+ if (!(selected.length > 0)) {
155
+ _context2.next = 7;
156
+ break;
157
+ }
158
+
159
+ _selected = _slicedToArray(selected, 1), node = _selected[0];
160
+ _context2.next = 4;
161
+ return (0, _requestApi.updateLable)({
162
+ task_id: taskId,
163
+ lab_id: node.workId,
164
+ // 目标id 、项目id、分类id
165
+ lab_type: _helper.lableTypeMap[node.type],
166
+ mileStoneId: node.krId // kr | 里程碑id
167
+
168
+ });
169
+
170
+ case 4:
171
+ _yield$updateLable = _context2.sent;
172
+ Message = _yield$updateLable.Message;
173
+
174
+ if (Message) {
175
+ _toast["default"].Error(Message);
176
+ } else {
177
+ _toast["default"].Success((0, _getLocale.getLocale)("Mod_Successfuloperat"));
178
+ }
179
+
180
+ case 7:
181
+ case "end":
182
+ return _context2.stop();
183
+ }
184
+ }
185
+ }, _callee2);
186
+ }));
187
+
188
+ return function updateRelation() {
189
+ return _ref2.apply(this, arguments);
190
+ };
191
+ }();
192
+
193
+ var onOkHandler = function onOkHandler() {
194
+ if (taskId) {
195
+ isRelationOther && updateRelationOthers();
196
+ !isRelationOther && updateRelation();
197
+ }
198
+
199
+ setVisible(false);
200
+ onOk && onOk(selected);
201
+ setSelected([]);
202
+ };
203
+
204
+ var onCancelHandler = function onCancelHandler() {
205
+ setVisible(false);
206
+ onCancel && onCancel();
207
+ };
208
+
209
+ var addSelected = function addSelected(node) {
210
+ if (multiple) {
211
+ setSelected([].concat(_toConsumableArray(selected), [node]));
212
+ } else {
213
+ setSelected([node]);
214
+ }
215
+ };
216
+
217
+ var removeSelected = function removeSelected(id) {
218
+ var newSelected = selected.filter(function (item) {
219
+ return item.id !== id;
220
+ });
221
+ setSelected(_toConsumableArray(newSelected));
222
+ };
223
+
224
+ return /*#__PURE__*/_react["default"].createElement(_dialog["default"], _extends({
225
+ title: '关联 OKR',
226
+ visible: visible,
227
+ onOk: onOkHandler,
228
+ onCancel: onCancelHandler,
229
+ onClose: onCancelHandler,
230
+ style: {
231
+ height: "590px"
232
+ },
233
+ width: 840,
234
+ noFooterLine: true // getContainer={getContainer}
235
+ ,
236
+ extraClass: ["pull-screen-ignore", "tita-user-pop"],
237
+ destroyOnClose: false
238
+ }, restProps), /*#__PURE__*/_react["default"].createElement(_context3.Context.Provider, {
239
+ value: {
240
+ multiple: multiple,
241
+ selected: selected,
242
+ selectedRoots: selectedRoots,
243
+ addSelected: addSelected,
244
+ removeSelected: removeSelected
245
+ }
246
+ }, /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
247
+ className: "".concat(_helper.preCls, "__content")
248
+ }, /*#__PURE__*/_react["default"].createElement(_okrTree["default"], null)), selected.length > 0 && multiple && /*#__PURE__*/_react["default"].createElement("div", {
249
+ className: "".concat(_helper.preCls, "__select")
250
+ }, "\u5DF2\u9009", /*#__PURE__*/_react["default"].createElement("span", {
251
+ className: "".concat(_helper.preCls, "__select-count")
252
+ }, selected.length), "\u9879"))));
253
+ }
254
+
255
+ var _default = WorkRelationModal;
256
+ exports["default"] = _default;
@@ -11,11 +11,14 @@ var _tooltip = _interopRequireDefault(require("./tooltip"));
11
11
 
12
12
  var _tooltipText = _interopRequireDefault(require("./tooltip-text"));
13
13
 
14
+ var _tooltipRows = _interopRequireDefault(require("./tooltip-rows"));
15
+
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
17
 
16
18
  // export const TooltipText = _TooltipText;
17
19
  // export const ErrorToolTip = _ErrorTip;
18
20
  _tooltip["default"].Text = _tooltipText["default"];
19
21
  _tooltip["default"].Error = _errorTip["default"];
22
+ _tooltip["default"].Rows = _tooltipRows["default"];
20
23
  var _default = _tooltip["default"];
21
24
  exports["default"] = _default;
@@ -0,0 +1,26 @@
1
+ .tooltip-rows {
2
+ width: 100%;
3
+ position: relative;
4
+ }
5
+
6
+ .tooltip-rows-wrapper {
7
+ width: 100%;
8
+ overflow: hidden;
9
+ }
10
+
11
+ .tooltip-rows-wrapper--hidden {
12
+ position: absolute;
13
+ visibility: hidden;
14
+ }
15
+
16
+ .tooltip-rows-wrapper--normal-chirdren {
17
+ margin-right: 4px;
18
+ }
19
+
20
+ .tooltip-rows-wrapper-suffix {
21
+ position: absolute;
22
+ bottom: 0;
23
+ right: 0;
24
+ padding: 0 4px 0 14px;
25
+ background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, #ffffff 20%);
26
+ }
@@ -9,23 +9,7 @@ exports["default"] = void 0;
9
9
 
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
 
12
- var _reactSlick = _interopRequireDefault(require("react-slick"));
13
-
14
- var _classnames = _interopRequireDefault(require("classnames"));
15
-
16
- var _requestApi = require("../request-api");
17
-
18
- var _toast = _interopRequireDefault(require("../../toast"));
19
-
20
- var _util = require("./util");
21
-
22
- var _nextBtn = _interopRequireDefault(require("./components/next-btn"));
23
-
24
- var _preBtn = _interopRequireDefault(require("./components/pre-btn"));
25
-
26
- require("slick-carousel/slick/slick.css");
27
-
28
- require("slick-carousel/slick/slick-theme.css");
12
+ var _tooltip = _interopRequireDefault(require("../tooltip"));
29
13
 
30
14
  require("./index.css");
31
15
 
@@ -35,10 +19,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
35
19
 
36
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37
21
 
38
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
39
-
40
- 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
-
42
22
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
43
23
 
44
24
  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."); }
@@ -51,76 +31,76 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
51
31
 
52
32
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
53
33
 
54
- var prefix = "tutaui-dynamic-advertise";
55
- var settings = {
56
- dots: false,
57
- infinite: true,
58
- speed: 1000,
59
- slidesToShow: 1,
60
- slidesToScroll: 1,
61
- // arrows: false,
62
- autoplay: true
63
- };
64
-
65
- var DynamicAdvertise = function DynamicAdvertise() {
66
- var _useState = (0, _react.useState)([]),
34
+ var TooltipText = function TooltipText(_ref) {
35
+ var _ref$overlayText = _ref.overlayText,
36
+ overlayText = _ref$overlayText === void 0 ? "" : _ref$overlayText,
37
+ _ref$exClass = _ref.exClass,
38
+ exClass = _ref$exClass === void 0 ? "" : _ref$exClass,
39
+ _ref$isPercent = _ref.isPercent,
40
+ isPercent = _ref$isPercent === void 0 ? false : _ref$isPercent,
41
+ _ref$overlayClassName = _ref.overlayClassName,
42
+ overlayClassName = _ref$overlayClassName === void 0 ? "" : _ref$overlayClassName,
43
+ _ref$mouseEnterDelay = _ref.mouseEnterDelay,
44
+ mouseEnterDelay = _ref$mouseEnterDelay === void 0 ? 0 : _ref$mouseEnterDelay,
45
+ _ref$lineHeight = _ref.lineHeight,
46
+ lineHeight = _ref$lineHeight === void 0 ? 22 : _ref$lineHeight,
47
+ _ref$rowNum = _ref.rowNum,
48
+ rowNum = _ref$rowNum === void 0 ? 2 : _ref$rowNum,
49
+ _ref$suffix = _ref.suffix,
50
+ suffix = _ref$suffix === void 0 ? null : _ref$suffix,
51
+ _ref$suffixClass = _ref.suffixClass,
52
+ suffixClass = _ref$suffixClass === void 0 ? "" : _ref$suffixClass,
53
+ children = _ref.children;
54
+
55
+ var _useState = (0, _react.useState)(false),
67
56
  _useState2 = _slicedToArray(_useState, 2),
68
- sliderData = _useState2[0],
69
- setSliderData = _useState2[1];
70
-
71
- var _useState3 = (0, _react.useState)(false),
72
- _useState4 = _slicedToArray(_useState3, 2),
73
- isMouseEnter = _useState4[0],
74
- setIsMouseEnter = _useState4[1];
75
-
76
- var handleImgClick = function handleImgClick(link) {
77
- window.open(link, "_blank");
78
- };
79
-
80
- var handleMouseEnter = function handleMouseEnter() {
81
- setIsMouseEnter(true);
82
- };
83
-
84
- var handleMouseLeave = function handleMouseLeave() {
85
- setIsMouseEnter(false);
86
- };
57
+ hasTooltip = _useState2[0],
58
+ setHasTooltip = _useState2[1];
87
59
 
60
+ var domRef = (0, _react.useRef)();
88
61
  (0, _react.useEffect)(function () {
89
- (0, _requestApi.getAdvertise)().then(function (resp) {
90
- if (resp.Code === 1 && resp.Data.length > 0) {
91
- setSliderData((0, _util.formatResp)(resp.Data));
92
- }
93
-
94
- if (resp.Code !== 1) {
95
- _toast["default"].Error(resp.Message, {
96
- canClose: false
97
- });
62
+ if (isPercent) {
63
+ var _console = console,
64
+ log = _console.log;
65
+ log(domRef.current.getBoundingClientRect());
66
+ var domClient = domRef.current ? domRef.current.getBoundingClientRect() : {
67
+ height: 0,
68
+ width: 0
69
+ };
70
+ var height = domClient.height;
71
+
72
+ if (height > rowNum * lineHeight) {
73
+ setHasTooltip(true);
98
74
  }
99
- });
75
+ }
100
76
  }, []);
101
77
  return /*#__PURE__*/_react["default"].createElement("div", {
102
- className: (0, _classnames["default"])(prefix, _defineProperty({}, "".concat(prefix, "--not-empty"), sliderData.length > 0)),
103
- onMouseEnter: handleMouseEnter,
104
- onMouseLeave: handleMouseLeave
105
- }, sliderData.length > 0 && /*#__PURE__*/_react["default"].createElement(_reactSlick["default"], _extends({}, settings, {
106
- nextArrow: /*#__PURE__*/_react["default"].createElement(_nextBtn["default"], {
107
- isShow: isMouseEnter
108
- }),
109
- prevArrow: /*#__PURE__*/_react["default"].createElement(_preBtn["default"], {
110
- isShow: isMouseEnter
111
- })
112
- }), sliderData.map(function (item) {
113
- return /*#__PURE__*/_react["default"].createElement("div", {
114
- onClick: function onClick() {
115
- handleImgClick(item.link);
116
- }
117
- }, /*#__PURE__*/_react["default"].createElement("img", {
118
- className: "".concat(prefix, "__img"),
119
- src: item.img,
120
- alt: item.name
121
- }));
122
- })));
78
+ className: "tooltip-rows"
79
+ }, hasTooltip && /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
80
+ overlayClassName: overlayClassName,
81
+ overlay: overlayText || children,
82
+ placement: "top",
83
+ mouseEnterDelay: mouseEnterDelay
84
+ }, /*#__PURE__*/_react["default"].createElement("div", {
85
+ className: "tooltip-rows-wrapper ".concat(exClass),
86
+ style: {
87
+ height: rowNum * lineHeight,
88
+ lineHeight: "".concat(lineHeight, "px")
89
+ }
90
+ }, children, /*#__PURE__*/_react["default"].createElement("div", {
91
+ className: "tooltip-rows-wrapper-suffix ".concat(suffixClass)
92
+ }, !!suffix && suffix))), !hasTooltip && /*#__PURE__*/_react["default"].createElement("div", {
93
+ className: "tooltip-rows-wrapper ".concat(exClass)
94
+ }, /*#__PURE__*/_react["default"].createElement("span", {
95
+ className: "tooltip-rows-wrapper--normal-chirdren"
96
+ }, children), suffix), /*#__PURE__*/_react["default"].createElement("span", {
97
+ className: "tooltip-rows-wrapper tooltip-rows-wrapper--hidden ".concat(exClass),
98
+ ref: domRef,
99
+ style: {
100
+ lineHeight: "".concat(lineHeight, "px")
101
+ }
102
+ }, children));
123
103
  };
124
104
 
125
- var _default = DynamicAdvertise;
105
+ var _default = TooltipText;
126
106
  exports["default"] = _default;
@@ -35,30 +35,58 @@ function _default(props) {
35
35
  onRemove && onRemove(props);
36
36
  };
37
37
 
38
+ var renderAvatar = function renderAvatar() {
39
+ var _data$avatar, _data$avatar2, _data$avatar3;
40
+
41
+ if ((data === null || data === void 0 ? void 0 : (_data$avatar = data.avatar) === null || _data$avatar === void 0 ? void 0 : _data$avatar.hasAvatar) === false) {
42
+ return /*#__PURE__*/_react["default"].createElement("span", {
43
+ style: {
44
+ backgroundColor: data.avatar.color
45
+ }
46
+ }, /*#__PURE__*/_react["default"].createElement("span", {
47
+ className: "perspm-person__avatar-text",
48
+ title: ""
49
+ }, /*#__PURE__*/_react["default"].createElement(_openData.OpenUserName, {
50
+ id: data.userId,
51
+ name: data.name
52
+ })));
53
+ } else if (data !== null && data !== void 0 && (_data$avatar2 = data.avatar) !== null && _data$avatar2 !== void 0 && _data$avatar2.original || data !== null && data !== void 0 && (_data$avatar3 = data.avatar) !== null && _data$avatar3 !== void 0 && _data$avatar3.small) {
54
+ var _data$avatar4, _data$avatar5;
55
+
56
+ return /*#__PURE__*/_react["default"].createElement("img", {
57
+ key: data.userId,
58
+ src: (data === null || data === void 0 ? void 0 : (_data$avatar4 = data.avatar) === null || _data$avatar4 === void 0 ? void 0 : _data$avatar4.original) || (data === null || data === void 0 ? void 0 : (_data$avatar5 = data.avatar) === null || _data$avatar5 === void 0 ? void 0 : _data$avatar5.small),
59
+ style: {
60
+ width: "100%",
61
+ height: "100%",
62
+ position: 'relative',
63
+ top: '-1px'
64
+ }
65
+ });
66
+ } else {
67
+ var _data$avatar6;
68
+
69
+ return /*#__PURE__*/_react["default"].createElement("span", {
70
+ style: {
71
+ backgroundColor: data === null || data === void 0 ? void 0 : (_data$avatar6 = data.avatar) === null || _data$avatar6 === void 0 ? void 0 : _data$avatar6.color
72
+ }
73
+ }, /*#__PURE__*/_react["default"].createElement("span", {
74
+ className: "perspm-person__avatar-text",
75
+ title: ""
76
+ }, /*#__PURE__*/_react["default"].createElement(_openData.OpenUserName, {
77
+ id: data.userId,
78
+ name: data.name
79
+ })));
80
+ }
81
+ };
82
+
38
83
  return /*#__PURE__*/_react["default"].createElement("div", {
39
84
  className: (0, _classnames["default"])("perspm-person", {
40
85
  "perspm-person--small": hideUserInfo
41
86
  })
42
87
  }, /*#__PURE__*/_react["default"].createElement("span", {
43
88
  className: "perspm-person__avatar"
44
- }, data.avatar.small ? /*#__PURE__*/_react["default"].createElement("img", {
45
- key: data.userId,
46
- src: data.avatar.small,
47
- style: {
48
- width: "100%",
49
- height: "100%"
50
- }
51
- }) : /*#__PURE__*/_react["default"].createElement("span", {
52
- style: {
53
- backgroundColor: data.avatar.color
54
- }
55
- }, /*#__PURE__*/_react["default"].createElement("span", {
56
- className: "perspm-person__avatar-text",
57
- title: ""
58
- }, /*#__PURE__*/_react["default"].createElement(_openData.OpenUserName, {
59
- id: data.userId,
60
- name: data.name
61
- })))), /*#__PURE__*/_react["default"].createElement("span", {
89
+ }, renderAvatar()), /*#__PURE__*/_react["default"].createElement("span", {
62
90
  className: "perspm-person__info"
63
91
  }, /*#__PURE__*/_react["default"].createElement("span", {
64
92
  style: {