@titaui/pc 1.16.31 → 1.16.33

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 (25) hide show
  1. package/lib/components/change-okr-modal/index.js +1 -2
  2. package/lib/components/communication/CommunicationRecord.js +9 -1
  3. package/lib/components/communication/index.css +4 -0
  4. package/lib/components/communication/index.js +4 -1
  5. package/lib/components/create-okr-modal/index.js +15 -3
  6. package/lib/components/dynamic/dynamic-item/dynamic-announcement/index.css +4 -0
  7. package/lib/components/dynamic/dynamic-item/dynamic-announcement/index.js +9 -1
  8. package/lib/components/dynamic/dynamic-item/dynamic-interview-share/index.css +4 -0
  9. package/lib/components/dynamic/dynamic-item/dynamic-interview-share/index.js +12 -3
  10. package/lib/components/dynamic/dynamic-item/dynamic-share/index.css +4 -0
  11. package/lib/components/dynamic/dynamic-item/dynamic-share/index.js +9 -1
  12. package/lib/components/emotions-selector/selector-content.js +9 -1
  13. package/lib/components/emotions-selector/selector-pop.js +2 -2
  14. package/lib/components/mblog/components/MblogAction.js +5 -5
  15. package/lib/components/mblog/components/MblogContent.js +25 -30
  16. package/lib/components/mblog/index.css +11 -0
  17. package/lib/components/mblog/index.js +75 -51
  18. package/lib/components/okr-detail/e-list/search-form/fields/e-status.js +1 -1
  19. package/lib/components/okr-review/ReviewPop/components/ReviewBody/index.js +3 -4
  20. package/lib/components/okr-review/components/ReviewItem/index.js +1 -1
  21. package/lib/components/okr-review/index.js +1 -1
  22. package/lib/components-v1/textarea/index.js +0 -3
  23. package/lib/utils/bs-global.js +3 -0
  24. package/lib/utils/editor.js +78 -0
  25. package/package.json +1 -1
@@ -579,8 +579,7 @@ var _initialiseProps = function _initialiseProps() {
579
579
  data: isRefresh ? resData : [].concat(_toConsumableArray(data), _toConsumableArray(resData)),
580
580
  isEnd: res.Data.nextPage === 0
581
581
  }, function () {
582
- console.log(_this4.state.data);
583
-
582
+ // console.log(this.state.data)
584
583
  if (isRefresh) {
585
584
  _this4.scollListToTop();
586
585
  }
@@ -21,6 +21,8 @@ var _ConvertUserName = _interopRequireDefault(require("./ConvertUserName"));
21
21
 
22
22
  var _openData = require("../../utils/open-data");
23
23
 
24
+ var _richEditor = _interopRequireDefault(require("@titaui/rich-editor"));
25
+
24
26
  var _fileList = _interopRequireDefault(require("../file-list"));
25
27
 
26
28
  var _tools = require("../../utils/tools");
@@ -108,7 +110,13 @@ var CommunicationRecord = function CommunicationRecord(_ref) {
108
110
  })))), /*#__PURE__*/_react["default"].createElement("span", {
109
111
  className: "".concat(prefix, "__communication-content"),
110
112
  ref: contentRef
111
- }, (0, _openData.parseTag)(communicationTrack.content.trim())), communicationTrack.attachments && /*#__PURE__*/_react["default"].createElement("div", {
113
+ }, [undefined, 0].includes(communicationTrack.version) && (0, _openData.parseTag)(communicationTrack.content.trim()), communicationTrack.version === 1 && /*#__PURE__*/_react["default"].createElement(_richEditor["default"], {
114
+ className: "".concat(prefix, "__editor-preview"),
115
+ placeholder: "",
116
+ editable: false,
117
+ showToolbar: false,
118
+ initialState: communicationTrack.content
119
+ })), communicationTrack.attachments && /*#__PURE__*/_react["default"].createElement("div", {
112
120
  className: "".concat(prefix, "__communication-attachments")
113
121
  }, /*#__PURE__*/_react["default"].createElement(_fileList["default"], {
114
122
  data: communicationTrack.attachments
@@ -1,3 +1,7 @@
1
+ .titaui-communication__editor-preview {
2
+ background-color: transparent !important;
3
+ }
4
+
1
5
  .titaui-communication__communication-item {
2
6
  display: flex;
3
7
  align-items: center;
@@ -398,7 +398,9 @@ var Communication = /*#__PURE__*/function (_PureComponent) {
398
398
  _this$props7$autoFocu = _this$props7.autoFocus,
399
399
  autoFocus = _this$props7$autoFocu === void 0 ? false : _this$props7$autoFocu,
400
400
  _this$props7$showUser = _this$props7.showUser,
401
- showUser = _this$props7$showUser === void 0 ? false : _this$props7$showUser;
401
+ showUser = _this$props7$showUser === void 0 ? false : _this$props7$showUser,
402
+ _this$props7$attachem = _this$props7.attachemntCanSubmit,
403
+ attachemntCanSubmit = _this$props7$attachem === void 0 ? true : _this$props7$attachem;
402
404
  var user = (0, _bsGlobal.getUserInfo)();
403
405
  return /*#__PURE__*/_react["default"].createElement(_style.CommunicationWrapper, {
404
406
  className: "communcation-wrapper ".concat(className)
@@ -474,6 +476,7 @@ var Communication = /*#__PURE__*/function (_PureComponent) {
474
476
  isShowSendSms: isShowSendSms,
475
477
  submitText: submitText,
476
478
  showAtAll: showAtAll,
479
+ attachemntCanSubmit: attachemntCanSubmit,
477
480
  atAllText: atAllText,
478
481
  atAllTipText: atAllTipText,
479
482
  atAllValue: atAllValue,
@@ -221,7 +221,13 @@ function CreateOkrModal(_ref, ref) {
221
221
  setOkrClassify = _useState20[1]; // 目标类别
222
222
 
223
223
 
224
- var _useState21 = (0, _react.useState)(2),
224
+ var _useState21 = (0, _react.useState)(function () {
225
+ if (window.BSGlobal.tenantInfo.isOpenInfo) {
226
+ return 1;
227
+ } else {
228
+ return 2;
229
+ }
230
+ }),
225
231
  _useState22 = _slicedToArray(_useState21, 2),
226
232
  visibility = _useState22[0],
227
233
  setVisibility = _useState22[1]; // 可见性
@@ -680,7 +686,13 @@ function CreateOkrModal(_ref, ref) {
680
686
  });
681
687
  setCycle(cycle);
682
688
  setOkrClassify(undefined);
683
- setVisibility(2);
689
+
690
+ if (window.BSGlobal.tenantInfo.isOpenInfo) {
691
+ setVisibility(1);
692
+ } else {
693
+ setVisibility(2);
694
+ }
695
+
684
696
  setParent({
685
697
  parentWorkId: 0,
686
698
  parentWorkName: '',
@@ -857,7 +869,7 @@ function CreateOkrModal(_ref, ref) {
857
869
  if (!isVisible) return; // @ts-ignore
858
870
 
859
871
  (0, _requestApi.getImageBase64ByUrl)(user.id).then(function (data) {
860
- console.log(data);
872
+ // console.log(data)
861
873
  setUserAvatarBase64Url(data.Data.obj);
862
874
  })["catch"](function (err) {
863
875
  _toast["default"].Error(err);
@@ -2,6 +2,10 @@
2
2
  font-family: OPPOSans, Arial, Verdana, Helvetica Neue, Helvetica, PingFang SC, Microsoft YaHei, sans-serif;
3
3
  }
4
4
 
5
+ .titaui-dynamic-announcement-item__editor-preview {
6
+ background-color: transparent !important;
7
+ }
8
+
5
9
  .titaui-dynamic-announcement-item__content {
6
10
  font-size: 14px;
7
11
  color: #3f4755;
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _fileList = _interopRequireDefault(require("../../../file-list"));
13
13
 
14
+ var _richEditor = _interopRequireDefault(require("@titaui/rich-editor"));
15
+
14
16
  var _context = require("../../context");
15
17
 
16
18
  var _tools = require("../../../../utils/tools");
@@ -72,7 +74,13 @@ var DynamicAnnouncement = function DynamicAnnouncement(_ref) {
72
74
  className: "".concat(prefix, "__content")
73
75
  }, /*#__PURE__*/_react["default"].createElement("div", {
74
76
  ref: contentRef
75
- }, (0, _openData.parseTag)(data.content))), data.attachments && /*#__PURE__*/_react["default"].createElement("div", {
77
+ }, [undefined, 0].includes(data.version) && (0, _openData.parseTag)(data.content.trim()), data.version === 1 && /*#__PURE__*/_react["default"].createElement(_richEditor["default"], {
78
+ className: "".concat(prefix, "__editor-preview"),
79
+ placeholder: "",
80
+ editable: false,
81
+ showToolbar: false,
82
+ initialState: data.content
83
+ }))), data.attachments && /*#__PURE__*/_react["default"].createElement("div", {
76
84
  className: "".concat(prefix, "__files")
77
85
  }, /*#__PURE__*/_react["default"].createElement(_fileList["default"], {
78
86
  data: data.attachments
@@ -7,6 +7,10 @@
7
7
  margin-bottom: 12px;
8
8
  }
9
9
 
10
+ .titaui-dynamic-interview-share__editor-preview {
11
+ background-color: transparent !important;
12
+ }
13
+
10
14
  .titaui-dynamic-interview-share__operate-desc {
11
15
  font-size: 14px;
12
16
  font-weight: 400;
@@ -9,6 +9,8 @@ exports["default"] = void 0;
9
9
 
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
 
12
+ var _richEditor = _interopRequireDefault(require("@titaui/rich-editor"));
13
+
12
14
  var _getLocale = require("../../../../utils/getLocale");
13
15
 
14
16
  var _header = _interopRequireDefault(require("../components/header"));
@@ -36,8 +38,9 @@ function DynamicInterviewShare(_ref) {
36
38
  hasDynamicOpereateAuth = _ref$hasDynamicOperea === void 0 ? false : _ref$hasDynamicOperea;
37
39
  var publishUser = data.publishUser,
38
40
  content = data.content,
39
- shareFeedSource = data.shareFeedSource;
40
- var isPublisher = data.publishUser.userId === ((_window$BSGlobal$logi = window.BSGlobal.loginUserInfo) === null || _window$BSGlobal$logi === void 0 ? void 0 : _window$BSGlobal$logi.Id);
41
+ shareFeedSource = data.shareFeedSource,
42
+ version = data.version;
43
+ var isPublisher = publishUser.userId === ((_window$BSGlobal$logi = window.BSGlobal.loginUserInfo) === null || _window$BSGlobal$logi === void 0 ? void 0 : _window$BSGlobal$logi.Id);
41
44
  var renderDesc = (0, _react.useMemo)(function () {
42
45
  return /*#__PURE__*/_react["default"].createElement("span", {
43
46
  className: "".concat(preCls, "__operate-desc")
@@ -54,7 +57,13 @@ function DynamicInterviewShare(_ref) {
54
57
  showTopping: hasDynamicOpereateAuth
55
58
  }), /*#__PURE__*/_react["default"].createElement("div", {
56
59
  className: "".concat(preCls, "__text")
57
- }, (0, _openData.parseTag)(content)), /*#__PURE__*/_react["default"].createElement(_interviewContent["default"], {
60
+ }, [undefined, 0].includes(version) && (0, _openData.parseTag)(content.trim()), version === 1 && /*#__PURE__*/_react["default"].createElement(_richEditor["default"], {
61
+ className: "".concat(preCls, "__editor-preview"),
62
+ placeholder: "",
63
+ editable: false,
64
+ showToolbar: false,
65
+ initialState: content
66
+ })), /*#__PURE__*/_react["default"].createElement(_interviewContent["default"], {
58
67
  data: shareFeedSource
59
68
  }));
60
69
  }
@@ -2,6 +2,10 @@
2
2
  font-family: OPPOSans, Arial, Verdana, Helvetica Neue, Helvetica, PingFang SC, Microsoft YaHei, sans-serif;
3
3
  }
4
4
 
5
+ .titaui-dynamic-share-item__editor-preview {
6
+ background-color: transparent !important;
7
+ }
8
+
5
9
  .titaui-dynamic-share-item__content {
6
10
  font-size: 14px;
7
11
  color: #3f4755;
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _fileList = _interopRequireDefault(require("../../../file-list"));
13
13
 
14
+ var _richEditor = _interopRequireDefault(require("@titaui/rich-editor"));
15
+
14
16
  var _context = require("../../context");
15
17
 
16
18
  var _header = _interopRequireDefault(require("../components/header"));
@@ -130,7 +132,13 @@ var DynamicShare = function DynamicShare(_ref) {
130
132
  onClickTitle: handleClickTitle
131
133
  }, (0, _utils.getDynamicTitleProps)(obj)))), /*#__PURE__*/_react["default"].createElement("div", {
132
134
  ref: contentRef
133
- }, (0, _openData.parseTag)(data.content))), data.attachments && /*#__PURE__*/_react["default"].createElement("div", {
135
+ }, [undefined, 0].includes(data.version) && (0, _openData.parseTag)(data.content.trim()), data.version === 1 && /*#__PURE__*/_react["default"].createElement(_richEditor["default"], {
136
+ className: "".concat(prefix, "__editor-preview"),
137
+ placeholder: "",
138
+ editable: false,
139
+ showToolbar: false,
140
+ initialState: data.content
141
+ }))), data.attachments && /*#__PURE__*/_react["default"].createElement("div", {
134
142
  className: "".concat(prefix, "__files")
135
143
  }, /*#__PURE__*/_react["default"].createElement(_fileList["default"], {
136
144
  data: data.attachments
@@ -19,6 +19,12 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
19
19
 
20
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; }
21
21
 
22
+ 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; }
23
+
24
+ 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; }
25
+
26
+ 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; }
27
+
22
28
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
23
29
 
24
30
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -141,7 +147,9 @@ var EmotionsSelector = /*#__PURE__*/function (_PureComponent) {
141
147
  key: item.address,
142
148
  className: currentEmotions.size == "small" ? "emotion__body__item-small" : "emotion__body__item-big",
143
149
  onMouseDown: function onMouseDown() {
144
- return onSubmit(item.name);
150
+ return onSubmit(item.name, _objectSpread(_objectSpread({}, item), {}, {
151
+ host: currentEmotions.host
152
+ }));
145
153
  }
146
154
  }, /*#__PURE__*/_react["default"].createElement("img", {
147
155
  "data-name": "emotion-img",
@@ -89,8 +89,8 @@ var EmotionsSelectorPop = /*#__PURE__*/function (_PureComponent) {
89
89
  container: container,
90
90
  className: "tita-common-pop-no-shadow ".concat(popExtraClassName) || ""
91
91
  }, /*#__PURE__*/_react["default"].createElement(_selectorContent["default"], {
92
- onSubmit: function onSubmit(emotionName) {
93
- _onSubmit(emotionName);
92
+ onSubmit: function onSubmit(emotionName, emotion) {
93
+ _onSubmit(emotionName, emotion);
94
94
 
95
95
  _this2.handleHide();
96
96
  },
@@ -163,6 +163,8 @@ var MblogAction = /*#__PURE__*/function (_PureComponent) {
163
163
  emotionsSelectorPopAlign = _this$props.emotionsSelectorPopAlign,
164
164
  visibility = _this$props.visibility,
165
165
  onActionsSelectedUserChange = _this$props.onActionsSelectedUserChange,
166
+ onActionsAllMembersChange = _this$props.onActionsAllMembersChange,
167
+ onActionsEmotionChange = _this$props.onActionsEmotionChange,
166
168
  dragFilesList = _this$props.dragFilesList,
167
169
  _this$props$disableRa = _this$props.disableRangeSelect,
168
170
  disableRangeSelect = _this$props$disableRa === void 0 ? true : _this$props$disableRa;
@@ -214,9 +216,7 @@ var MblogAction = /*#__PURE__*/function (_PureComponent) {
214
216
  }, /*#__PURE__*/_react["default"].createElement(_style.LeftBtn, {
215
217
  key: this.props.atAllText,
216
218
  tips: this.props.atAllTipText,
217
- onMouseDown: function onMouseDown() {
218
- return onActionsTextChange(atAllValue || '');
219
- }
219
+ onMouseDown: onActionsAllMembersChange
220
220
  }, /*#__PURE__*/_react["default"].createElement("span", {
221
221
  className: "btn-txt"
222
222
  }, this.props.atAllText))), this.props.isShowEmotion && /*#__PURE__*/_react["default"].createElement(_style.LeftBtn, {
@@ -225,8 +225,8 @@ var MblogAction = /*#__PURE__*/function (_PureComponent) {
225
225
  align: emotionsSelectorPopAlign,
226
226
  popExtraClassName: "pull-screen-ignore",
227
227
  container: this.context.popContainer,
228
- onSubmit: function onSubmit(emotionName) {
229
- return onActionsTextChange(emotionName);
228
+ onSubmit: function onSubmit(emotionName, emotion) {
229
+ return onActionsEmotionChange(emotion);
230
230
  }
231
231
  }, /*#__PURE__*/_react["default"].createElement(_style.IconSpan, {
232
232
  className: "tu-icon-emoji"
@@ -9,8 +9,12 @@ exports["default"] = void 0;
9
9
 
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
 
12
+ var _richEditor = _interopRequireDefault(require("@titaui/rich-editor"));
13
+
12
14
  var _style = require("../style");
13
15
 
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
+
14
18
  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); }
15
19
 
16
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; }
@@ -47,10 +51,8 @@ var MblogContent = /*#__PURE__*/function (_PureComponent) {
47
51
 
48
52
  _this = _super.call(this, props);
49
53
 
50
- _this._handlerTipsLabelClick = function () {
51
- // @ts-ignore
52
- _this.refs.textareaInput.focus(); // 点击 输入框获得焦点
53
-
54
+ _this._handlerTipsLabelClick = function () {// @ts-ignore
55
+ // this.refs.textareaInput.focus(); // 点击 输入框获得焦点
54
56
  };
55
57
 
56
58
  _this._handlerFocus = function (event) {
@@ -146,20 +148,22 @@ var MblogContent = /*#__PURE__*/function (_PureComponent) {
146
148
  _this.props.onContentChange(event.target.value);
147
149
 
148
150
  _this.setTextareaHeight(); // @ts-ignore
151
+ // this.refs.textareaInput.focus();
149
152
 
153
+ };
150
154
 
151
- _this.refs.textareaInput.focus();
155
+ _this.onChangeEditor = function (value) {
156
+ _this.props.onContentChange(value);
152
157
  };
153
158
 
154
159
  _this.setTextareaHeight = function () {
155
160
  var _this$props = _this.props,
156
161
  initialTextHeight = _this$props.initialTextHeight,
157
162
  autoResizing = _this$props.autoResizing;
158
- if (!autoResizing) return;
159
- var textareaSetHeight = _this.refs.textareaSetHeight;
160
- var textareaInput = _this.refs.textareaInput; // @ts-ignore
161
-
162
- textareaInput.style.height = autoResizing && textareaSetHeight.scrollHeight > initialTextHeight ? "".concat(textareaSetHeight.scrollHeight, "px") : "".concat(initialTextHeight, "px");
163
+ if (!autoResizing) return; // const { textareaSetHeight } = this.refs;
164
+ // const { textareaInput } = this.refs;
165
+ // @ts-ignore
166
+ // // textareaInput.style.height = autoResizing && textareaSetHeight.scrollHeight > initialTextHeight ? `${textareaSetHeight.scrollHeight}px` : `${initialTextHeight}px`;
163
167
  };
164
168
 
165
169
  _this.state = {
@@ -172,12 +176,10 @@ var MblogContent = /*#__PURE__*/function (_PureComponent) {
172
176
  _createClass(MblogContent, [{
173
177
  key: "componentDidMount",
174
178
  value: function componentDidMount() {
175
- if (this.props.autoFocus) {
176
- // @ts-ignore
177
- this.refs.textareaInput.focus();
178
- }
179
+ if (this.props.autoFocus) {// @ts-ignore
180
+ // this.refs.textareaInput.focus();
181
+ } // this.props.setTextareaRef && this.props.setTextareaRef(this.refs.textareaInput);
179
182
 
180
- this.props.setTextareaRef && this.props.setTextareaRef(this.refs.textareaInput);
181
183
  }
182
184
  }, {
183
185
  key: "componentDidUpdate",
@@ -210,21 +212,14 @@ var MblogContent = /*#__PURE__*/function (_PureComponent) {
210
212
  }
211
213
  }, placeholderText)), /*#__PURE__*/_react["default"].createElement(_style.TextareaWrapper, {
212
214
  className: "textarea-wrap"
213
- }, /*#__PURE__*/_react["default"].createElement(_style.Textarea, {
214
- ref: "textareaSetHeight",
215
- value: textareaValue,
216
- onChange: function onChange() {},
217
- className: "textarea-setheight"
218
- }), /*#__PURE__*/_react["default"].createElement(_style.Textarea, {
219
- ref: "textareaInput",
220
- className: "textarea-details ".concat(visibility === 1 ? "" : "private__bg"),
221
- value: textareaValue,
222
- onFocus: this._handlerFocus,
223
- onBlur: this._handlerBlur,
224
- onKeyUp: this._handlerKeyUp,
225
- onKeyDown: this._handlerKeyDown,
226
- onPaste: this._handlerPaste,
227
- onChange: this._handleInputChange
215
+ }, /*#__PURE__*/_react["default"].createElement(_richEditor["default"], {
216
+ ref: "editorRef",
217
+ editable: true,
218
+ showToolbar: false,
219
+ withMentions: true,
220
+ initialState: {},
221
+ onDocChange: this.onChangeEditor,
222
+ placeholder: placeholderText
228
223
  })), /*#__PURE__*/_react["default"].createElement(_style.Tips, {
229
224
  className: "textarea-tips",
230
225
  onMouseDown: this._handlerTipsLabelClick,
@@ -5,3 +5,14 @@
5
5
  .titaui-mblog__avatar {
6
6
  margin-right: 12px;
7
7
  }
8
+
9
+ .titaui-mblog .textarea-wrap .tita-rich-editor {
10
+ height: 80px;
11
+ overflow-y: auto;
12
+ }
13
+
14
+ .titaui-mblog .textarea-wrap .tita-rich-editor p {
15
+ font-size: 14px;
16
+ line-height: 22px;
17
+ padding: 0;
18
+ }
@@ -27,6 +27,8 @@ var _platform = require("../../utils/platform");
27
27
 
28
28
  var _getLocale = require("../../utils/getLocale");
29
29
 
30
+ var _editor = _interopRequireWildcard(require("../../utils/editor"));
31
+
30
32
  require("./index.css");
31
33
 
32
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -94,17 +96,23 @@ var MBlog = /*#__PURE__*/function (_PureComponent) {
94
96
  });
95
97
  };
96
98
 
97
- _this.onContentChange = function (contentValue) {
98
- // @ts-ignore
99
- var textareaInput = _this.refs.textEditor.refs.textareaInput;
100
- var start = textareaInput.selectionStart;
101
- var atAll = !!contentValue.match(/@\[所有同事:all_members\]/g);
99
+ _this.onEditorContentChange = function (_ref) {
100
+ var mentionUsers = _ref.mentionUsers,
101
+ pureText = _ref.pureText,
102
+ richText = _ref.richText,
103
+ state = _ref.state;
104
+ var contentValue = pureText;
105
+ var atAll = !!mentionUsers.find(function (_ref2) {
106
+ var mentionType = _ref2.mentionType;
107
+ return mentionType === 2;
108
+ });
102
109
 
103
110
  _this.setState({
104
- isInputAt: contentValue.charAt(start - 1) == '@',
105
- // isInputEnterSubmit: contentValue === 'isInputEnterSubmit',
111
+ mentionUsers: mentionUsers,
112
+ richText: richText,
113
+ pureText: pureText,
106
114
  textareaValue: contentValue,
107
- isAllowSubmit: _this.allowSubmit(contentValue),
115
+ isAllowSubmit: state.doc.content.size > 2,
108
116
  isAtAll: atAll,
109
117
  visibility: atAll ? 1 : _this.state.visibility
110
118
  });
@@ -112,6 +120,26 @@ var MBlog = /*#__PURE__*/function (_PureComponent) {
112
120
  localStorage.setItem(_this.state.localStroageKey, contentValue);
113
121
  };
114
122
 
123
+ _this.onActionsAllMembersChange = function () {
124
+ var editorRef = _this.refs.textEditor.refs.editorRef;
125
+ editorRef.append((0, _editor["default"])([{
126
+ type: 'all_members',
127
+ Name: (0, _getLocale.getLocale)('Per_Ma_form_newdetail_All'),
128
+ Id: 0
129
+ }]), {
130
+ insertPos: true
131
+ });
132
+ editorRef.focus();
133
+ };
134
+
135
+ _this.onActionsEmotionChange = function (emotion) {
136
+ var editorRef = _this.refs.textEditor.refs.editorRef;
137
+ editorRef.append((0, _editor.appendImgs)(emotion.host + emotion.address, emotion.name), {
138
+ insertPos: true
139
+ });
140
+ editorRef.focus();
141
+ };
142
+
115
143
  _this.onActionsTextChange = function (actionValue) {
116
144
  if (actionValue === 'allowSendSMS') {
117
145
  return _this.setState({
@@ -135,63 +163,39 @@ var MBlog = /*#__PURE__*/function (_PureComponent) {
135
163
  return _this.setState({
136
164
  visibility: 3
137
165
  });
138
- } // @ts-ignore
139
-
140
-
141
- var textareaInput = _this.refs.textEditor.refs.textareaInput;
142
- var textareaValue = _this.state.textareaValue;
143
- textareaValue = (0, _index.insertTextAtPointer)(textareaInput, actionValue);
144
- localStorage.setItem(_this.state.localStroageKey, textareaValue); // 输入内容进行本地缓存
145
-
146
- var atAll = !!textareaValue.match(/@\[所有同事:all_members\]/g);
147
-
148
- _this.setState({
149
- textareaValue: textareaValue,
150
- isAllowSubmit: _this.allowSubmit(textareaValue),
151
- isAtAll: atAll,
152
- visibility: atAll ? 1 : _this.state.visibility
153
- }, function () {
154
- _this.focus();
155
- });
166
+ }
156
167
  };
157
168
 
158
169
  _this.onActionsSelectedUserChange = function (users) {
159
- // @ts-ignore
160
- var textareaInput = _this.refs.textEditor.refs.textareaInput;
161
- var mark = (0, _index.generateSelectedMark)(users, textareaInput);
162
- var nextContent = (0, _index.insertTextAtPointer)(textareaInput, mark);
170
+ var editorRef = _this.refs.textEditor.refs.editorRef;
171
+ editorRef.append((0, _editor["default"])(users), {
172
+ insertPos: true
173
+ });
174
+ editorRef.focus(); // @ts-ignore
175
+ // const { textareaInput } = this.refs.textEditor.refs
176
+ // const mark = generateSelectedMark(users, textareaInput)
177
+ // const nextContent = insertTextAtPointer(textareaInput, mark)
163
178
 
164
179
  _this.setState({
165
- isInputAt: false,
166
- textareaValue: nextContent,
167
- isAllowSubmit: _this.allowSubmit(nextContent)
180
+ isInputAt: false
168
181
  }, function () {
169
182
  _this.focus();
170
183
  });
171
184
  };
172
185
 
173
186
  _this.handlerDealAttachemntData = function (uploadSuccessFilesPath) {
174
- var _this$refs$textEditor2;
175
-
187
+ var attachemntCanSubmit = _this.props.attachemntCanSubmit;
176
188
  var successFilesPath = uploadSuccessFilesPath.filter(function (item) {
177
189
  return item !== '';
178
190
  });
179
- var successFilesPathLen = successFilesPath.length; // @ts-ignore
180
-
181
- var _this$refs$textEditor = (_this$refs$textEditor2 = _this.refs.textEditor) === null || _this$refs$textEditor2 === void 0 ? void 0 : _this$refs$textEditor2.refs,
182
- textareaInput = _this$refs$textEditor.textareaInput;
183
-
184
- var textareaValue = _this.state.textareaValue; // textareaValue = dealWithLoadedFileTips(textareaValue, successFilesPathLen); // 更新输入框内容
185
191
 
186
- localStorage.setItem(_this.state.localStroageKey, textareaValue); // 将输入框内容进行本地缓存
187
-
188
- if (textareaInput) {
189
- textareaInput.focus();
192
+ if (successFilesPath.length > 0 && attachemntCanSubmit) {
193
+ _this.setState({
194
+ isAllowSubmit: true
195
+ });
190
196
  }
191
197
 
192
198
  _this.setState({
193
- textareaValue: textareaValue,
194
- isAllowSubmit: textareaValue.trim().length > 0 && textareaValue.trim().length <= (_this.props.maxLength || 2000) || successFilesPath.length > 0,
195
199
  uploadSuccessFilesPath: successFilesPath,
196
200
  dragFilesList: []
197
201
  });
@@ -217,7 +221,10 @@ var MBlog = /*#__PURE__*/function (_PureComponent) {
217
221
  textareaValue = _this$state.textareaValue,
218
222
  uploadSuccessFilesPath = _this$state.uploadSuccessFilesPath,
219
223
  isSendSMS = _this$state.isSendSMS,
220
- visibility = _this$state.visibility;
224
+ visibility = _this$state.visibility,
225
+ mentionUsers = _this$state.mentionUsers,
226
+ richText = _this$state.richText,
227
+ pureText = _this$state.pureText;
221
228
  var _this$props2 = _this.props,
222
229
  isShowAttachment = _this$props2.isShowAttachment,
223
230
  isShowSendSms = _this$props2.isShowSendSms,
@@ -243,7 +250,15 @@ var MBlog = /*#__PURE__*/function (_PureComponent) {
243
250
  } // @ts-ignore
244
251
 
245
252
 
246
- sentData.Content = (0, _index.htmlEncodeByRegExp)(textareaValue); // @ts-ignore
253
+ sentData.Content = richText; // @ts-ignore
254
+
255
+ if (pureText) {
256
+ sentData.contentTxt = pureText.replace(/@\$userName=0\$/g, '@所有人');
257
+ } // @ts-ignore
258
+
259
+
260
+ if (mentionUsers) sentData.mentionUsers = (0, _editor.usersTypeToNumber)(mentionUsers);
261
+ sentData.version = 1; // @ts-ignore
247
262
 
248
263
  if (submitType === 'submit' && submitStatus !== 2) {
249
264
  // 发送
@@ -253,6 +268,9 @@ var MBlog = /*#__PURE__*/function (_PureComponent) {
253
268
  _this.props.onMblogSubmit(submitType);
254
269
  }
255
270
 
271
+ var editorRef = _this.refs.textEditor.refs.editorRef;
272
+ editorRef.clear();
273
+
256
274
  _this.setState({
257
275
  textareaValue: '',
258
276
  uploadSuccessFilesPath: []
@@ -323,6 +341,9 @@ var MBlog = /*#__PURE__*/function (_PureComponent) {
323
341
  };
324
342
 
325
343
  _this.state = {
344
+ mentionUsers: [],
345
+ richText: '',
346
+ pureText: '',
326
347
  uploadSuccessFilesPath: [],
327
348
  isAllowSubmit: false,
328
349
  localStroageKey: '',
@@ -473,7 +494,7 @@ var MBlog = /*#__PURE__*/function (_PureComponent) {
473
494
  _this2.handlerPasteChange(file);
474
495
  },
475
496
  onContentChange: function onContentChange(contentValue) {
476
- _this2.onContentChange(contentValue);
497
+ _this2.onEditorContentChange(contentValue);
477
498
  },
478
499
  onActionSubmit: function onActionSubmit(submitType) {
479
500
  _this2.onActionSubmit(submitType);
@@ -515,6 +536,8 @@ var MBlog = /*#__PURE__*/function (_PureComponent) {
515
536
  onActionsTextChange: function onActionsTextChange(actionValue) {
516
537
  _this2.onActionsTextChange(actionValue);
517
538
  },
539
+ onActionsAllMembersChange: this.onActionsAllMembersChange,
540
+ onActionsEmotionChange: this.onActionsEmotionChange,
518
541
  onActionsSelectedUserChange: function onActionsSelectedUserChange(users) {
519
542
  return _this2.onActionsSelectedUserChange(users);
520
543
  },
@@ -570,5 +593,6 @@ MBlog.defaultProps = {
570
593
  isShowRangeDropDown: true,
571
594
  isShowBtnCancel: true,
572
595
  submitStatus: 0,
573
- showUser: false
596
+ showUser: false,
597
+ attachemntCanSubmit: true
574
598
  };
@@ -89,7 +89,7 @@ function _default(props) {
89
89
  name: "doing"
90
90
  }, (0, _getLocale.getLocale)("Per_MyRe_text_Inprogress")), /*#__PURE__*/_react["default"].createElement(_dropSelector.Item, {
91
91
  name: "finish"
92
- }, (0, _getLocale.getLocale)("OKR_MyO_Butt_Hasended")), /*#__PURE__*/_react["default"].createElement(_dropSelector.Item, {
92
+ }, (0, _getLocale.getLocale)("OKR_MyO_E_From_Completed")), /*#__PURE__*/_react["default"].createElement(_dropSelector.Item, {
93
93
  name: "delay"
94
94
  }, (0, _getLocale.getLocale)("OKR_MyO_E_From_Delayed")), /*#__PURE__*/_react["default"].createElement(_dropSelector.Item, {
95
95
  name: "cancel"
@@ -271,9 +271,8 @@ var ReviewBody = /*#__PURE__*/function (_PureComponent) {
271
271
  };
272
272
 
273
273
  _this._handlerStandardModeProblemChange = function (value) {
274
- var data = _objectSpread({}, _this.state.data);
274
+ var data = _objectSpread({}, _this.state.data); // console.log(htmlEncodeByRegExp(value))
275
275
 
276
- console.log((0, _mblog.htmlEncodeByRegExp)(value));
277
276
 
278
277
  _this._updateReviewData(data, "Drawback", value);
279
278
  };
@@ -605,8 +604,8 @@ var ReviewBody = /*#__PURE__*/function (_PureComponent) {
605
604
  var screenHeight = window.screen.height;
606
605
  var _this$props2 = this.props,
607
606
  ObjData = _this$props2.ObjData,
608
- EditType = _this$props2.EditType;
609
- console.log(ObjData);
607
+ EditType = _this$props2.EditType; // console.log(ObjData);
608
+
610
609
  var _this$state = this.state,
611
610
  data = _this$state.data,
612
611
  popContainer = _this$state.popContainer;
@@ -61,7 +61,7 @@ var ReviewItem = /*#__PURE__*/function (_PureComponent) {
61
61
  editReview = _this$props.editReview,
62
62
  reviewItemData = _this$props.reviewItemData,
63
63
  editAble = _this$props.editAble;
64
- var href = "".concat(location.pathname, "#okr/reviewDetail?okrId=8077&back=").concat(location.hash, "&replayId=").concat(reviewItemData.replayId, "&feedId=").concat(feedId, "&krIndex=").concat(krIndex, "&editAble=").concat(editAble);
64
+ var href = "".concat(location.pathname, "#okr/reviewDetail?okrId=8077&back=''&replayId=").concat(reviewItemData.replayId, "&feedId=").concat(feedId, "&krIndex=").concat(krIndex, "&editAble=").concat(editAble);
65
65
  return /*#__PURE__*/_react["default"].createElement(_style.ReviewItemContainer, {
66
66
  className: className,
67
67
  mode: isCompactMode ? 0 : 1
@@ -210,7 +210,7 @@ var Review = /*#__PURE__*/function (_PureComponent) {
210
210
  mode: isCompactMode ? 0 : 1
211
211
  }), /*#__PURE__*/_react["default"].createElement("span", null, (0, _getLocale.getLocale)("OKR_MyO_KRP_Pop_Understandt"))))) : /*#__PURE__*/_react["default"].createElement(_style.ReviewList, null, reviewList.map(function (item, index) {
212
212
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
213
- key: index
213
+ key: feedId
214
214
  }, /*#__PURE__*/_react["default"].createElement(_ReviewItem["default"], {
215
215
  isCompactMode: isCompactMode,
216
216
  feedId: feedId,
@@ -11,8 +11,6 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _i18nFrontTranslate = require("../../utils/i18n-front-translate");
13
13
 
14
- var _mblog = require("../../utils/mblog");
15
-
16
14
  var _style = require("./style");
17
15
 
18
16
  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); }
@@ -149,7 +147,6 @@ var TextareaView = /*#__PURE__*/function (_PureComponent) {
149
147
  isFocus = _this$state.isFocus,
150
148
  isHasPlaceholder = _this$state.isHasPlaceholder;
151
149
  var valueLen = value.length;
152
- console.log(123, (0, _mblog.htmlDecodeByRegExp)(value));
153
150
  return /*#__PURE__*/_react["default"].createElement(_style.TextareaWrapper, {
154
151
  className: className,
155
152
  style: style
@@ -54,7 +54,10 @@ var getSource = function getSource() {
54
54
  exports.getSource = getSource;
55
55
 
56
56
  var getUploadMaxSize = function getUploadMaxSize() {
57
+ var _info$tenantSetting;
58
+
57
59
  var info = getBSGlobal('tenantInfo');
60
+ if ((_info$tenantSetting = info.tenantSetting) !== null && _info$tenantSetting !== void 0 && _info$tenantSetting.allowUploadAttachmentSize) return info.tenantSetting.allowUploadAttachmentSize;
58
61
  if (info.Id === 352728) return 150;
59
62
  var isDingDing = info.Source === 861;
60
63
  var isDingZhi = window.dingZhiSize && window.dingZhiSize.indexOf(info.Id) !== -1;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.usersTypeToNumber = exports["default"] = exports.appendUsers = exports.appendImgs = exports.UserTypeNumberEnum = void 0;
7
+
8
+ var _flatten = _interopRequireDefault(require("lodash/flatten"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ 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; }
13
+
14
+ 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; }
15
+
16
+ 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; }
17
+
18
+ var UserTypeNumberEnum;
19
+ exports.UserTypeNumberEnum = UserTypeNumberEnum;
20
+
21
+ (function (UserTypeNumberEnum) {
22
+ UserTypeNumberEnum[UserTypeNumberEnum["User"] = 1] = "User";
23
+ UserTypeNumberEnum[UserTypeNumberEnum["AllMembers"] = 2] = "AllMembers";
24
+ UserTypeNumberEnum[UserTypeNumberEnum["ProjectOrTarget"] = 4] = "ProjectOrTarget";
25
+ })(UserTypeNumberEnum || (exports.UserTypeNumberEnum = UserTypeNumberEnum = {}));
26
+
27
+ var appendUsers = function appendUsers(users) {
28
+ return (0, _flatten["default"])(users.map(function (_ref) {
29
+ var Name = _ref.Name,
30
+ Id = _ref.Id,
31
+ _ref$type = _ref.type,
32
+ type = _ref$type === void 0 ? 'user' : _ref$type;
33
+ return [{
34
+ type: 'mention',
35
+ attrs: {
36
+ mentionId: Id,
37
+ mentionName: Name,
38
+ mentionType: type
39
+ }
40
+ }, {
41
+ type: 'text',
42
+ text: ' '
43
+ }];
44
+ }));
45
+ };
46
+
47
+ exports.appendUsers = appendUsers;
48
+
49
+ var appendImgs = function appendImgs(src, name) {
50
+ return [{
51
+ type: 'image',
52
+ attrs: {
53
+ src: src,
54
+ alt: name
55
+ },
56
+ content: [{
57
+ type: 'text',
58
+ text: name
59
+ }]
60
+ }];
61
+ };
62
+
63
+ exports.appendImgs = appendImgs;
64
+
65
+ var usersTypeToNumber = function usersTypeToNumber(mentionUsers) {
66
+ return mentionUsers.map(function (user) {
67
+ return _objectSpread(_objectSpread({}, user), {}, {
68
+ mentionType: {
69
+ user: UserTypeNumberEnum.User,
70
+ all_members: UserTypeNumberEnum.AllMembers
71
+ }[user.mentionType]
72
+ });
73
+ });
74
+ };
75
+
76
+ exports.usersTypeToNumber = usersTypeToNumber;
77
+ var _default = appendUsers;
78
+ exports["default"] = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@titaui/pc",
3
- "version": "1.16.31",
3
+ "version": "1.16.33",
4
4
  "nameCN": "",
5
5
  "description": "",
6
6
  "main": "lib/index.js",