@titaui/pc 1.12.22-beta.4 → 1.12.22-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/lib/components/attachments-preview/index.js +6 -2
  2. package/lib/components/dynamic/components/comments-dialog/index.js +12 -6
  3. package/lib/components/dynamic/dynamic-item/components/header/index.js +1 -41
  4. package/lib/components/dynamic/dynamic-item/components/okr-progress/index.js +3 -14
  5. package/lib/components/dynamic/dynamic-item/components/summary-header/index.js +53 -7
  6. package/lib/components/dynamic/dynamic-item/components/summary-header/request-api.js +17 -0
  7. package/lib/components/dynamic/dynamic-item/components/task-progress/constant.js +15 -2
  8. package/lib/components/dynamic/dynamic-item/components/task-progress/index.css +40 -30
  9. package/lib/components/dynamic/dynamic-item/components/task-progress/index.js +72 -85
  10. package/lib/components/dynamic/dynamic-item/components/task-progress/interface.js +18 -1
  11. package/lib/components/dynamic/dynamic-item/components/task-progress/render-row.js +80 -0
  12. package/lib/components/dynamic/dynamic-item/components/task-progress/request-api.js +16 -0
  13. package/lib/components/dynamic/dynamic-item/components/task-progress/utils.js +92 -8
  14. package/lib/components/dynamic/dynamic-item/dynamic-new-report/components/evalute/index.js +44 -19
  15. package/lib/components/dynamic/dynamic-item/dynamic-new-report/index.js +40 -61
  16. package/lib/components/import-modal/import-task-modal/search-form.js +4 -1
  17. package/lib/components/import-modal/request-api.js +1 -1
  18. package/lib/components/import-modal/search/task-relation.js +9 -5
  19. package/lib/components/menus/components/search-colleague/index.js +3 -1
  20. package/lib/components/menus/export-modules/summary-menus/depart-menus/index.js +2 -3
  21. package/lib/utils/helpers.js +58 -3
  22. package/package.json +1 -1
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _classnames = _interopRequireDefault(require("classnames"));
13
13
 
14
+ var _richEditor = _interopRequireWildcard(require("@titaui/rich-editor"));
15
+
14
16
  var _context = require("../../context");
15
17
 
16
18
  var _summaryHeader = _interopRequireDefault(require("../components/summary-header"));
@@ -29,16 +31,14 @@ var _evalute = _interopRequireDefault(require("./components/evalute"));
29
31
 
30
32
  var _richEditorUpload = _interopRequireDefault(require("../../../rich-editor-upload"));
31
33
 
32
- var _richEditor = _interopRequireDefault(require("../../../rich-editor"));
33
-
34
34
  var _getLocale = require("../../../../utils/getLocale");
35
35
 
36
36
  var _constant = require("./constant");
37
37
 
38
- require("./index.css");
39
-
40
38
  var _util = require("./util");
41
39
 
40
+ require("./index.css");
41
+
42
42
  var _excluded = ["data", "showCollect"];
43
43
 
44
44
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -99,37 +99,17 @@ var DynamicReply = function DynamicReply(_ref) {
99
99
  mindImg = _useState2[0],
100
100
  setMindImg = _useState2[1];
101
101
 
102
- var _useState3 = (0, _react.useState)({}),
103
- _useState4 = _slicedToArray(_useState3, 2),
104
- okrTableData = _useState4[0],
105
- setOkrtableData = _useState4[1];
106
-
107
- var _useState5 = (0, _react.useState)({}),
108
- _useState6 = _slicedToArray(_useState5, 2),
109
- taskTableData = _useState6[0],
110
- setTasktableData = _useState6[1];
111
-
112
- var _useState7 = (0, _react.useState)(""),
113
- _useState8 = _slicedToArray(_useState7, 2),
114
- okrTableTitle = _useState8[0],
115
- setOkrtableTitle = _useState8[1];
116
-
117
- var _useState9 = (0, _react.useState)(""),
118
- _useState10 = _slicedToArray(_useState9, 2),
119
- taskTableTitle = _useState10[0],
120
- setTasktableTitle = _useState10[1];
121
-
122
- var _useState11 = (0, _react.useState)(),
123
- _useState12 = _slicedToArray(_useState11, 2),
124
- richTextData = _useState12[0],
125
- setRichTextData = _useState12[1];
126
-
127
102
  var contentRichTextRef = (0, _react.useRef)();
128
103
  var workPlanRichTextRef = (0, _react.useRef)();
129
104
 
130
105
  var _useContext = (0, _react.useContext)(_context.SearchKeyContext),
131
106
  searchKeyWord = _useContext.searchKeyWord;
132
107
 
108
+ var _useState3 = (0, _react.useState)(evaluates || []),
109
+ _useState4 = _slicedToArray(_useState3, 2),
110
+ currentEvalutes = _useState4[0],
111
+ setCurrentEvalutes = _useState4[1];
112
+
133
113
  var renderSuffix = (0, _react.useMemo)(function () {
134
114
  var _classNames, _classNames2;
135
115
 
@@ -149,6 +129,9 @@ var DynamicReply = function DynamicReply(_ref) {
149
129
  className: "".concat(prefix, "__operate-desc")
150
130
  }, reportTextMap[reportType]);
151
131
  }, []);
132
+ (0, _react.useEffect)(function () {
133
+ setCurrentEvalutes(evaluates);
134
+ }, [evaluates]);
152
135
  (0, _react.useEffect)(function () {
153
136
  (0, _tools.highLightWord)({
154
137
  parentDom: contentRichTextRef.current,
@@ -161,26 +144,11 @@ var DynamicReply = function DynamicReply(_ref) {
161
144
  }, [data, searchKeyWord]);
162
145
  (0, _react.useEffect)(function () {
163
146
  if (dailyContent) {
164
- var _dailyContent$filter$, _dailyContent$filter$2, _dailyContent$filter$3, _dailyContent$filter$4, _mindData$, _mindData$2;
147
+ var _mindData$, _mindData$2;
165
148
 
166
149
  var mindData = dailyContent.filter(function (item) {
167
150
  return (item === null || item === void 0 ? void 0 : item.contentType) === 1;
168
151
  });
169
- setOkrtableData(((_dailyContent$filter$ = dailyContent.filter(function (item) {
170
- return (item === null || item === void 0 ? void 0 : item.contentType) === 2;
171
- })[0]) === null || _dailyContent$filter$ === void 0 ? void 0 : _dailyContent$filter$.content) || null);
172
- setOkrtableTitle((_dailyContent$filter$2 = dailyContent.filter(function (item) {
173
- return (item === null || item === void 0 ? void 0 : item.contentType) === 2;
174
- })[0]) === null || _dailyContent$filter$2 === void 0 ? void 0 : _dailyContent$filter$2.title);
175
- setTasktableData(((_dailyContent$filter$3 = dailyContent.filter(function (item) {
176
- return (item === null || item === void 0 ? void 0 : item.contentType) === 3;
177
- })[0]) === null || _dailyContent$filter$3 === void 0 ? void 0 : _dailyContent$filter$3.content) || null);
178
- setTasktableTitle((_dailyContent$filter$4 = dailyContent.filter(function (item) {
179
- return (item === null || item === void 0 ? void 0 : item.contentType) === 3;
180
- })[0]) === null || _dailyContent$filter$4 === void 0 ? void 0 : _dailyContent$filter$4.title);
181
- setRichTextData(dailyContent.filter(function (item) {
182
- return (item === null || item === void 0 ? void 0 : item.contentType) === _constant.dailyContentType.richText;
183
- }));
184
152
 
185
153
  if (typeof ((_mindData$ = mindData[0]) === null || _mindData$ === void 0 ? void 0 : _mindData$.content) === "string" && ((_mindData$2 = mindData[0]) === null || _mindData$2 === void 0 ? void 0 : _mindData$2.content) !== "") {
186
154
  setMindImg(_constant.Motion.filter(function (item) {
@@ -199,7 +167,8 @@ var DynamicReply = function DynamicReply(_ref) {
199
167
  suffixContent: renderSuffix,
200
168
  showDelete: true,
201
169
  showCollect: showCollect,
202
- canEvaluate: canEvaluate && !evaluates
170
+ canEvaluate: canEvaluate && !currentEvalutes,
171
+ setEvaluates: setCurrentEvalutes
203
172
  })), /*#__PURE__*/_react["default"].createElement("div", {
204
173
  className: "".concat(prefix, "__content")
205
174
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -214,19 +183,29 @@ var DynamicReply = function DynamicReply(_ref) {
214
183
  src: mindImg,
215
184
  className: "".concat(prefix, "__content-mind"),
216
185
  alt: ""
217
- })), (richTextData === null || richTextData === void 0 ? void 0 : richTextData.length) !== 0 && (richTextData === null || richTextData === void 0 ? void 0 : richTextData.map(function (item) {
218
- return item.richContent !== "" && typeof item.richContent === "string" && /*#__PURE__*/_react["default"].createElement("div", {
219
- className: "".concat(prefix, "__work")
220
- }, item.title, /*#__PURE__*/_react["default"].createElement(_richEditor["default"].Editor, {
221
- defaultState: JSON.parse(item.richContent),
222
- editable: false
223
- }));
224
- })), okrTableData && /*#__PURE__*/_react["default"].createElement(_okrProgress["default"], {
225
- data: okrTableData,
226
- title: okrTableTitle
227
- }), taskTableData && /*#__PURE__*/_react["default"].createElement(_taskProgress["default"], {
228
- data: taskTableData,
229
- title: taskTableTitle
186
+ })), dailyContent.map(function (item) {
187
+ if (item.contentType === _constant.dailyContentType.richText) {
188
+ return item.richContent !== "" && typeof item.richContent === "string" && /*#__PURE__*/_react["default"].createElement("div", {
189
+ className: "".concat(prefix, "__work")
190
+ }, item.title, /*#__PURE__*/_react["default"].createElement(_richEditor["default"], null, /*#__PURE__*/_react["default"].createElement(_richEditor.EditorComponent, {
191
+ editable: false,
192
+ initialState: JSON.parse(item.richContent)
193
+ })));
194
+ }
195
+
196
+ if (item.contentType === _constant.dailyContentType.okr) {
197
+ return item.content && /*#__PURE__*/_react["default"].createElement(_okrProgress["default"], {
198
+ data: item.content,
199
+ title: item.title
200
+ });
201
+ }
202
+
203
+ if (item.contentType === _constant.dailyContentType.task) {
204
+ return item.content && /*#__PURE__*/_react["default"].createElement(_taskProgress["default"], {
205
+ data: item.content,
206
+ title: item.title
207
+ });
208
+ }
230
209
  }), files.length > 0 && /*#__PURE__*/_react["default"].createElement("div", {
231
210
  className: "".concat(prefix, "__upload")
232
211
  }, /*#__PURE__*/_react["default"].createElement(_richEditorUpload["default"], {
@@ -236,8 +215,8 @@ var DynamicReply = function DynamicReply(_ref) {
236
215
  enableDelete: false
237
216
  })), /*#__PURE__*/_react["default"].createElement(_remindUserView["default"], {
238
217
  data: atUsers
239
- }), evaluates && evaluates.length !== 0 && /*#__PURE__*/_react["default"].createElement(_evalute["default"], {
240
- evaluation: evaluates[0],
218
+ }), currentEvalutes && currentEvalutes.length !== 0 && /*#__PURE__*/_react["default"].createElement(_evalute["default"], {
219
+ evaluation: currentEvalutes[0],
241
220
  feedId: feedId,
242
221
  publishUser: publishUser,
243
222
  canEvaluate: canEvaluate
@@ -70,13 +70,15 @@ function SearchForm(props) {
70
70
  keyWords = _useState6[0],
71
71
  setKeyWords = _useState6[1];
72
72
 
73
- var _useState7 = (0, _react.useState)(0),
73
+ var _useState7 = (0, _react.useState)(1),
74
74
  _useState8 = _slicedToArray(_useState7, 2),
75
75
  relation = _useState8[0],
76
76
  setRelation = _useState8[1];
77
77
 
78
78
  var dilagRef = (0, _react.useRef)(document.createElement('div'));
79
+ var isInitRef = (0, _react.useRef)(true);
79
80
  (0, _react.useEffect)(function () {
81
+ if (isInitRef.current) return;
80
82
  onChange(_objectSpread({
81
83
  status: status,
82
84
  keyWords: keyWords,
@@ -85,6 +87,7 @@ function SearchForm(props) {
85
87
  }, [status, keyWords, cycle, relation]);
86
88
  (0, _react.useEffect)(function () {
87
89
  if (time) {
90
+ isInitRef.current = false;
88
91
  var cycleDate = (0, _helper.getCycleDate)(time);
89
92
  setCycle({
90
93
  annualNum: Number(time.split('/')[0]),
@@ -142,7 +142,7 @@ var planTableTask = function planTableTask(params, pageNum, pageSize) {
142
142
  }
143
143
 
144
144
  if (!relation) {
145
- relation = '1,2,3';
145
+ relation = '1,2';
146
146
  }
147
147
 
148
148
  return (0, _request.rpost)('v2')(url, {
@@ -37,14 +37,18 @@ function Relation(props) {
37
37
  var onChange = props.onChange,
38
38
  initValue = props.initValue;
39
39
 
40
- var _useState = (0, _react.useState)((0, _getLocale.getLocale)("Pro_page_Plan_FullRange")),
40
+ var _useState = (0, _react.useState)((0, _getLocale.getLocale)('OKR_Menu_Title03_Owned')),
41
41
  _useState2 = _slicedToArray(_useState, 2),
42
42
  selectText = _useState2[0],
43
43
  setSelectText = _useState2[1];
44
44
 
45
45
  (0, _react.useEffect)(function () {
46
46
  if (initValue === 0) {
47
- setSelectText((0, _getLocale.getLocale)("Pro_page_Plan_FullRange"));
47
+ setSelectText((0, _getLocale.getLocale)('Pro_page_Plan_FullRange'));
48
+ } else if (initValue === 1) {
49
+ setSelectText((0, _getLocale.getLocale)('OKR_Menu_Title03_Owned'));
50
+ } else if (initValue === 2) {
51
+ setSelectText((0, _getLocale.getLocale)('OKR_Menu_Title_Collaborator'));
48
52
  }
49
53
  }, [initValue]);
50
54
 
@@ -54,13 +58,13 @@ function Relation(props) {
54
58
  };
55
59
 
56
60
  var selectOptions = [{
57
- label: (0, _getLocale.getLocale)("Pro_page_Plan_FullRange"),
61
+ label: (0, _getLocale.getLocale)('Pro_page_Plan_FullRange'),
58
62
  value: 0
59
63
  }, {
60
- label: (0, _getLocale.getLocale)("OKR_Menu_Title03_Owned"),
64
+ label: (0, _getLocale.getLocale)('OKR_Menu_Title03_Owned'),
61
65
  value: 1
62
66
  }, {
63
- label: (0, _getLocale.getLocale)("OKR_Menu_Title_Collaborator"),
67
+ label: (0, _getLocale.getLocale)('OKR_Menu_Title_Collaborator'),
64
68
  value: 2
65
69
  }];
66
70
  return /*#__PURE__*/_react["default"].createElement(_selectLayer["default"], {
@@ -86,6 +86,7 @@ function _default(props) {
86
86
  var _ref2 = _slicedToArray(_ref, 1),
87
87
  user = _ref2[0];
88
88
 
89
+ setSearchVal(user.title);
89
90
  onSelect(user);
90
91
  };
91
92
 
@@ -109,7 +110,8 @@ function _default(props) {
109
110
  placeholder: placeholder,
110
111
  onChange: handleInputChange,
111
112
  onFocus: onInputFocusHandler,
112
- onBlur: onInputBlurHandler
113
+ onBlur: onInputBlurHandler,
114
+ value: searchVal
113
115
  })), /*#__PURE__*/_react["default"].createElement(_userSelector["default"], {
114
116
  ref: selectorRef,
115
117
  multiple: false,
@@ -104,7 +104,6 @@ var _default = function _default() {
104
104
  var allDepartmentText = window.getLocale && window.getLocale(_i18n.locale.menu_alldeparment) || _i18n.locale.menu_alldeparment;
105
105
 
106
106
  (0, _requestApis.getDepsAndUsers)(-1, false).then(function (rawTreeData) {
107
- var transNodes = (0, _helper.translateDepartsToTreeNode)(rawTreeData);
108
107
  var rootNode = {
109
108
  async: true,
110
109
  data: {
@@ -118,8 +117,8 @@ var _default = function _default() {
118
117
  nodeType: _index.DEPART_NODE,
119
118
  title: allDepartmentText
120
119
  };
121
- setRawTreeData([rootNode].concat(_toConsumableArray(transNodes)));
122
- setTreeData((0, _utils.toTree)([rootNode].concat(_toConsumableArray(transNodes))));
120
+ setRawTreeData([rootNode].concat(_toConsumableArray(rawTreeData)));
121
+ setTreeData((0, _utils.toTree)([rootNode].concat(_toConsumableArray(rawTreeData))));
123
122
  setLoading(false);
124
123
  });
125
124
  } else {
@@ -6,13 +6,17 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.cssSupport = cssSupport;
7
7
  exports.escapeHtml = escapeHtml;
8
8
  exports.getApiUrl = getApiUrl;
9
- exports.getPreAndNextMonthDate = exports.getLoginUserInfo = void 0;
9
+ exports.getPreAndNextMonthDate = exports.getPointYearMonthWeeksRange = exports.getLoginUserInfo = void 0;
10
10
  exports.getTenantInfo = getTenantInfo;
11
11
  exports.getUploadMaxSize = getUploadMaxSize;
12
- exports.isTencentHr = exports.isLocal = exports.isFeishu = exports.isDingDing = void 0;
12
+ exports.toTree = exports.isTencentHr = exports.isLocal = exports.isFeishu = exports.isDingDing = void 0;
13
13
 
14
14
  var _bsGlobal = require("./bs-global");
15
15
 
16
+ var _cloneDeep = _interopRequireDefault(require("clone-deep"));
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+
16
20
  function cssSupport(attr, value) {
17
21
  var element = document.createElement('div');
18
22
 
@@ -121,6 +125,57 @@ var getPreAndNextMonthDate = function getPreAndNextMonthDate() {
121
125
  preDate: preDate,
122
126
  nextDate: nextDate
123
127
  };
128
+ }; //根据年月,计算这个月周的范围
129
+
130
+
131
+ exports.getPreAndNextMonthDate = getPreAndNextMonthDate;
132
+
133
+ var getPointYearMonthWeeksRange = function getPointYearMonthWeeksRange(year, month) {
134
+ var startDate = new Date("".concat(year, "/").concat(month, "/1"));
135
+ var calDays = new Date(startDate.valueOf());
136
+ calDays.setMonth(calDays.getMonth() + 1);
137
+ calDays.setDate(0);
138
+ var days = calDays.getDate();
139
+ var dayNum = 1 * 24 * 60 * 60 * 1000;
140
+ var result = [];
141
+
142
+ for (var i = 0; i < days; i++) {
143
+ var date = new Date(startDate.valueOf() + i * dayNum);
144
+
145
+ if (date.getDay() === 1) {
146
+ var endDate = new Date(date.valueOf() + 6 * dayNum);
147
+ result.push({
148
+ startTime: "".concat(date.getMonth() + 1 >= 10 ? date.getMonth() + 1 : "0" + (date.getMonth() + 1), "/").concat(date.getDate() >= 10 ? date.getDate() : "0" + date.getDate()),
149
+ endTime: "".concat(endDate.getMonth() + 1 >= 10 ? endDate.getMonth() + 1 : "0" + (endDate.getMonth() + 1), "/").concat(endDate.getDate() >= 10 ? endDate.getDate() : "0" + endDate.getDate())
150
+ });
151
+ i += 6;
152
+ }
153
+ }
154
+
155
+ return result;
156
+ }; // 扁平数据转换为树
157
+
158
+
159
+ exports.getPointYearMonthWeeksRange = getPointYearMonthWeeksRange;
160
+
161
+ var toTree = function toTree(data) {
162
+ var cloneData = (0, _cloneDeep["default"])(data);
163
+ var map = {};
164
+ var res = [];
165
+ cloneData.forEach(function (item) {
166
+ return map[item.id] = item;
167
+ });
168
+ cloneData.forEach(function (item) {
169
+ var parent = map[item.parentId];
170
+
171
+ if (parent) {
172
+ if (!parent.children) parent.children = [];
173
+ parent.children.push(item);
174
+ } else {
175
+ res.push(item);
176
+ }
177
+ });
178
+ return res;
124
179
  };
125
180
 
126
- exports.getPreAndNextMonthDate = getPreAndNextMonthDate;
181
+ exports.toTree = toTree;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@titaui/pc",
3
- "version": "1.12.22-beta.4",
3
+ "version": "1.12.22-beta.7",
4
4
  "nameCN": "",
5
5
  "description": "",
6
6
  "main": "lib/index.js",