@titaui/pc 1.12.22 → 1.12.24

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.
@@ -188,7 +188,7 @@ function OkrRelationTaskModal(props) {
188
188
  };
189
189
 
190
190
  var onOkHandler = function onOkHandler() {
191
- if (krId && selected !== null && selected !== void 0 && selected.length) {
191
+ if ((krId || okrId) && selected !== null && selected !== void 0 && selected.length) {
192
192
  (0, _requestApi.relateOkr)(selected, krId, okrId).then(function (res) {
193
193
  if (res.Code) {
194
194
  _toast["default"].Success((0, _getLocale.getLocale)('Per_Ass_New_Ass_text_Succe'));
@@ -83,7 +83,7 @@ function OkrRelationWorkModal(props) {
83
83
  }, [defaultVisible]);
84
84
 
85
85
  var onOkHandler = function onOkHandler() {
86
- if (krId && selected !== null && selected !== void 0 && selected.length) {
86
+ if ((krId || okrId) && selected !== null && selected !== void 0 && selected.length) {
87
87
  (0, _requestApi.workRelateOkr)(selected, krId, okrId).then(function (res) {
88
88
  if (res.Code) {
89
89
  _toast["default"].Success((0, _getLocale.getLocale)('Per_Ass_New_Ass_text_Succe'));
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _bsGlobal = require("./bs-global");
13
13
 
14
+ var Sentry = _interopRequireWildcard(require("@sentry/browser"));
15
+
14
16
  var _openDataPainter = require("../components/open-data-painter");
15
17
 
16
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); }
@@ -30,12 +32,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
30
32
  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; }
31
33
 
32
34
  var WX_SOURCE = 860;
33
- var WX_UA_STR = 'micromessenger';
35
+ var WX_UA_STR = "micromessenger";
34
36
  var FEISHU_SOURCE = 862;
35
37
  var DINGTALK_SOURCE = 861;
36
38
 
37
39
  var getSource = function getSource() {
38
- return (0, _bsGlobal.getBSGlobal)('tenantInfo').Source;
40
+ return (0, _bsGlobal.getBSGlobal)("tenantInfo").Source;
39
41
  };
40
42
 
41
43
  exports.getSource = getSource;
@@ -59,10 +61,10 @@ var getUA = function getUA() {
59
61
  var getOpenId = function getOpenId(id, type) {
60
62
  var openIds;
61
63
 
62
- if (type == 'userName') {
63
- openIds = (0, _bsGlobal.getBSGlobal)('openIds');
64
- } else if (type == 'departmentName') {
65
- openIds = (0, _bsGlobal.getBSGlobal)('openDepartmentIds');
64
+ if (type == "userName") {
65
+ openIds = (0, _bsGlobal.getBSGlobal)("openIds");
66
+ } else if (type == "departmentName") {
67
+ openIds = (0, _bsGlobal.getBSGlobal)("openDepartmentIds");
66
68
  }
67
69
 
68
70
  return openIds && openIds[id];
@@ -73,9 +75,40 @@ exports.getOpenId = getOpenId;
73
75
  function openData(p) {
74
76
  if (getSource() == WX_SOURCE || getUA().includes(WX_UA_STR)) {
75
77
  return function (p) {
76
- if (p.id === undefined && p.corpId === undefined) return p.name || null;
78
+ if (p.id === undefined && p.corpId === undefined) {
79
+ Sentry.withScope(function (scope) {
80
+ scope.setTag("error-level", "P1");
81
+ scope.setTag("error-type", "企业微信openData调用失败");
82
+ scope.setExtra("fail_type", p.type);
83
+ scope.setExtra("p_id", p.id);
84
+ scope.setExtra("corp_id", p.corp_id);
85
+ scope.setExtra("p_name", p.name);
86
+ p.callFunc && scope.setExtra("fail_callFunc", p.callFunc);
87
+ p.extra && scope.setExtra("fail_extra", p.extra);
88
+ Sentry.captureException(new Error("企业微信openData调用失败"), scope);
89
+ });
90
+ return p.name || null;
91
+ } // @ts-ignore
92
+
93
+
77
94
  var openId = p.corpId || getOpenId(p.id, p.type);
78
- if (!openId) return p.name || p.id || null;
95
+
96
+ if (!openId) {
97
+ Sentry.withScope(function (scope) {
98
+ scope.setTag("error-level", "P1");
99
+ scope.setTag("error-type", "企业微信openData调用失败");
100
+ scope.setExtra("fail_type", p.type);
101
+ scope.setExtra("p_id", p.id);
102
+ scope.setExtra("p_name", p.name);
103
+ scope.setExtra("corp_id", p.corp_id);
104
+ scope.setExtra('open_id', getOpenId(p.id, p.type));
105
+ p.callFunc && scope.setExtra("fail_callFunc", p.callFunc);
106
+ p.extra && scope.setExtra("fail_extra", p.extra);
107
+ Sentry.captureException(new Error("企业微信openData调用失败"), scope);
108
+ });
109
+ return p.name || p.id || null;
110
+ }
111
+
79
112
  var ref = (0, _react.useRef)(null);
80
113
  (0, _react.useEffect)(function () {
81
114
  var wWOpenData = window.top.WWOpenData; // // 如果当前页面中没有 WWOpenData 则去 top 上尝试获取
@@ -87,10 +120,10 @@ function openData(p) {
87
120
  });
88
121
  return /*#__PURE__*/_react["default"].createElement("div", {
89
122
  style: {
90
- display: 'inline',
91
- position: 'relative',
92
- overflow: 'hidden',
93
- textOverflow: 'ellipsis'
123
+ display: "inline",
124
+ position: "relative",
125
+ overflow: "hidden",
126
+ textOverflow: "ellipsis"
94
127
  }
95
128
  }, /*#__PURE__*/_react["default"].createElement("ww-open-data", {
96
129
  ref: ref,
@@ -98,7 +131,7 @@ function openData(p) {
98
131
  openid: openId
99
132
  }), /*#__PURE__*/_react["default"].createElement("div", {
100
133
  style: {
101
- position: 'absolute',
134
+ position: "absolute",
102
135
  top: 0,
103
136
  left: 0,
104
137
  right: 0,
@@ -118,7 +151,7 @@ var getOpenData = openData();
118
151
 
119
152
  var OpenUserName = function OpenUserName(p) {
120
153
  return getOpenData(_objectSpread(_objectSpread({}, p), {}, {
121
- type: 'userName'
154
+ type: "userName"
122
155
  }));
123
156
  };
124
157
 
@@ -126,7 +159,7 @@ exports.OpenUserName = OpenUserName;
126
159
 
127
160
  var OpenDepartmentName = function OpenDepartmentName(p) {
128
161
  return getOpenData(_objectSpread(_objectSpread({}, p), {}, {
129
- type: 'departmentName'
162
+ type: "departmentName"
130
163
  }));
131
164
  };
132
165
 
@@ -137,22 +170,22 @@ var openDataMap = {
137
170
  }; // name:'wx'|'dd'|'feishu',type:'source'|'env'|'all' = 'all'
138
171
 
139
172
  var isPlatform = function isPlatform(name) {
140
- var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all';
173
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "all";
141
174
 
142
175
  switch (name) {
143
- case 'wx':
176
+ case "wx":
144
177
  {
145
- if (type == 'source') return getSource() == WX_SOURCE;
146
- if (type == 'env') return getUA().includes(WX_UA_STR);
178
+ if (type == "source") return getSource() == WX_SOURCE;
179
+ if (type == "env") return getUA().includes(WX_UA_STR);
147
180
  return getSource() == WX_SOURCE || getUA().includes(WX_UA_STR);
148
181
  }
149
182
 
150
- case 'dd':
183
+ case "dd":
151
184
  {
152
185
  return getSource() == DINGTALK_SOURCE;
153
186
  }
154
187
 
155
- case 'feishu':
188
+ case "feishu":
156
189
  {
157
190
  return getSource() == FEISHU_SOURCE;
158
191
  }
@@ -171,7 +204,7 @@ var parseTag = function parseTag(str) {
171
204
  // return <span dangerouslySetInnerHTML={{ '__html': str }} />;
172
205
 
173
206
  while (matchStr != null) {
174
- var OpenDataCompoent = matchStr[1] == 'userId' ? OpenUserName : OpenDepartmentName;
207
+ var OpenDataCompoent = matchStr[1] == "userId" ? OpenUserName : OpenDepartmentName;
175
208
 
176
209
  if (!OpenDataCompoent) {
177
210
  openDatas.push( /*#__PURE__*/_react["default"].createElement("span", {
@@ -185,8 +218,8 @@ var parseTag = function parseTag(str) {
185
218
  } else {
186
219
  openDatas.push( /*#__PURE__*/_react["default"].createElement("span", {
187
220
  style: {
188
- color: '#1890ff',
189
- margin: '0 4px'
221
+ color: "#1890ff",
222
+ margin: "0 4px"
190
223
  },
191
224
  onClick: function onClick(e) {
192
225
  return e.stopPropagation();
@@ -221,11 +254,15 @@ var parseString = function parseString(str) {
221
254
  // @ts-ignore
222
255
  var source = window.BSGlobal.tenantInfo.Source;
223
256
  var ua = navigator.userAgent.toLowerCase();
224
- if (source != 860 && ua.indexOf('micromessenger') == -1) return /*#__PURE__*/_react["default"].createElement("span", {
225
- dangerouslySetInnerHTML: {
226
- __html: str
227
- }
228
- });
257
+
258
+ if (source != 860 && ua.indexOf("micromessenger") == -1) {
259
+ return /*#__PURE__*/_react["default"].createElement("span", {
260
+ dangerouslySetInnerHTML: {
261
+ __html: str
262
+ }
263
+ });
264
+ }
265
+
229
266
  var reg = /\[(\w+?)\:(\w+?)\]/g;
230
267
  var strReg = /\[\w+?\:\w+?\]/;
231
268
  var openDatas = [];
@@ -273,11 +310,15 @@ var parseStringV2 = function parseStringV2(str) {
273
310
  // @ts-ignore
274
311
  var source = window.BSGlobal.tenantInfo.Source;
275
312
  var ua = navigator.userAgent.toLowerCase();
276
- if (source != 860 && ua.indexOf('micromessenger') == -1) return /*#__PURE__*/_react["default"].createElement("span", {
277
- dangerouslySetInnerHTML: {
278
- __html: str
279
- }
280
- });
313
+
314
+ if (source != 860 && ua.indexOf("micromessenger") == -1) {
315
+ return /*#__PURE__*/_react["default"].createElement("span", {
316
+ dangerouslySetInnerHTML: {
317
+ __html: str
318
+ }
319
+ });
320
+ }
321
+
281
322
  var reg = /\$(userName|departmentName)\=(.+?)\$/g;
282
323
  var strReg = /\$(?:userName|departmentName)\=.+?\$/;
283
324
  var openDatas = [];
@@ -332,14 +373,14 @@ var parseOpenDataStringToImg = /*#__PURE__*/function () {
332
373
  font = _args.length > 1 && _args[1] !== undefined ? _args[1] : {
333
374
  lineHeight: 20,
334
375
  fontSize: 18,
335
- fontWeight: '500',
336
- color: '#3f4755'
376
+ fontWeight: "500",
377
+ color: "#3f4755"
337
378
  };
338
379
  font = _objectSpread(_objectSpread({}, {
339
380
  lineHeight: 20,
340
381
  fontSize: 18,
341
- fontWeight: '500',
342
- color: '#3f4755'
382
+ fontWeight: "500",
383
+ color: "#3f4755"
343
384
  }), font || {});
344
385
  reg = /\$(userName|departmentName)\=(.+?)\$/g;
345
386
  strReg = /\$(?:userName|departmentName)\=.+?\$/;
@@ -405,8 +446,8 @@ var getCanvasImg = /*#__PURE__*/function () {
405
446
  case 0:
406
447
  lineHeight = _ref2.lineHeight, fontSize = _ref2.fontSize, fontWeight = _ref2.fontWeight, color = _ref2.color;
407
448
  font = "".concat(fontWeight, " ").concat(fontSize, "px/").concat(lineHeight, "px arial,sans-serif");
408
- canvas = document.createElement('canvas');
409
- ctx = canvas.getContext('2d');
449
+ canvas = document.createElement("canvas");
450
+ ctx = canvas.getContext("2d");
410
451
 
411
452
  if (ctx) {
412
453
  _context2.next = 6;
@@ -424,16 +465,16 @@ var getCanvasImg = /*#__PURE__*/function () {
424
465
 
425
466
  case 8:
426
467
  name = _context2.sent;
427
- img = document.createElement('img');
468
+ img = document.createElement("img");
428
469
  ctx.font = font; // const fitStr = fittingString(ctx, name, 92);
429
470
 
430
- _ctx$measureText = ctx.measureText(name || ''), width = _ctx$measureText.width;
471
+ _ctx$measureText = ctx.measureText(name || ""), width = _ctx$measureText.width;
431
472
  actualWidth = Math.min(width, 92);
432
473
  (0, _openDataPainter.setSize)(canvas, ctx, actualWidth, lineHeight);
433
- ctx.textBaseline = 'middle';
474
+ ctx.textBaseline = "middle";
434
475
  ctx.font = font;
435
476
  ctx.fillStyle = color;
436
- ctx.fillText(name || '', 0, lineHeight / 2);
477
+ ctx.fillText(name || "", 0, lineHeight / 2);
437
478
  src = canvas.toDataURL();
438
479
  return _context2.abrupt("return", /*#__PURE__*/_react["default"].createElement("img", {
439
480
  src: src,
@@ -464,7 +505,7 @@ var parseHtmlAndTextTag = function parseHtmlAndTextTag(str) {
464
505
 
465
506
  while (matchStr != null) {
466
507
  if (matchStr) {
467
- var OpenDataCompoent = matchStr[1] == 'userId' ? OpenUserName : OpenDepartmentName;
508
+ var OpenDataCompoent = matchStr[1] == "userId" ? OpenUserName : OpenDepartmentName;
468
509
 
469
510
  if (!OpenDataCompoent) {
470
511
  var strParsed = parseString(matchStr[0]);
@@ -472,8 +513,8 @@ var parseHtmlAndTextTag = function parseHtmlAndTextTag(str) {
472
513
  } else {
473
514
  openDatas.push( /*#__PURE__*/_react["default"].createElement("span", {
474
515
  style: {
475
- color: '#1890ff',
476
- margin: '0 4px'
516
+ color: "#1890ff",
517
+ margin: "0 4px"
477
518
  },
478
519
  onClick: function onClick(e) {
479
520
  return e.stopPropagation();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@titaui/pc",
3
- "version": "1.12.22",
3
+ "version": "1.12.24",
4
4
  "nameCN": "",
5
5
  "description": "",
6
6
  "main": "lib/index.js",