@titaui/pc 1.13.5-beta.1 → 1.13.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 (73) hide show
  1. package/lib/components/checkbox-list/index.css +31 -0
  2. package/lib/components/checkbox-list/index.js +68 -0
  3. package/lib/components/create-okr-modal/index.js +4 -1
  4. package/lib/components/dialog-qq-docs/index.css +106 -0
  5. package/lib/components/dialog-qq-docs/index.js +505 -0
  6. package/lib/components/dialog-qq-docs/request-apis.js +16 -0
  7. package/lib/components/dialog-qq-docs/utils.js +79 -0
  8. package/lib/components/dialog-select/index.css +9 -0
  9. package/lib/components/dialog-select/index.js +48 -0
  10. package/lib/components/dialog-upload/img/folder.svg +40 -0
  11. package/lib/components/dialog-upload/img/form.svg +38 -0
  12. package/lib/components/dialog-upload/img/mind.svg +39 -0
  13. package/lib/components/dialog-upload/util.js +20 -2
  14. package/lib/components/dialog-upload-type/assets/folder.svg +20 -0
  15. package/lib/components/dialog-upload-type/assets/qq-docs.svg +20 -0
  16. package/lib/components/dialog-upload-type/components/upload-type-item/index.css +14 -0
  17. package/lib/components/dialog-upload-type/components/upload-type-item/index.js +36 -0
  18. package/lib/components/dialog-upload-type/index.css +7 -0
  19. package/lib/components/dialog-upload-type/index.js +68 -0
  20. package/lib/components/dynamic/dynamic-item/components/okr-progress/index.js +3 -2
  21. package/lib/components/dynamic/dynamic-item/components/schedule/index.js +5 -1
  22. package/lib/components/dynamic/dynamic-item/components/table-row-okr/index.css +12 -0
  23. package/lib/components/dynamic/dynamic-item/components/table-row-okr/index.js +13 -2
  24. package/lib/components/dynamic/dynamic-item/components/table-row-okr/utils.js +56 -0
  25. package/lib/components/dynamic/dynamic-item/components/task-progress/render-row.js +2 -2
  26. package/lib/components/dynamic/dynamic-item/dynamic-new-report/components/remind-user-view/index.css +16 -1
  27. package/lib/components/dynamic/dynamic-item/dynamic-new-report/components/remind-user-view/index.js +51 -9
  28. package/lib/components/dynamic/dynamic-item/dynamic-new-report/index.js +28 -11
  29. package/lib/components/dynamic/dynamic-item/dynamic-progress/index.js +6 -4
  30. package/lib/components/dynamic/dynamic-item/index.js +23 -3
  31. package/lib/components/dynamic/request-api.js +9 -2
  32. package/lib/components/file-list/components/single-file/index.css +29 -0
  33. package/lib/components/file-list/components/single-file/index.js +19 -28
  34. package/lib/components/file-list/img/folder.svg +40 -0
  35. package/lib/components/file-list/img/form.svg +38 -0
  36. package/lib/components/file-list/img/mind.svg +39 -0
  37. package/lib/components/file-list/index.js +2 -1
  38. package/lib/components/file-list/util.js +20 -2
  39. package/lib/components/file-preview/index.css +44 -0
  40. package/lib/components/file-preview/index.js +68 -0
  41. package/lib/components/loading/assets/loading.gif +0 -0
  42. package/lib/components/loading/index.css +28 -0
  43. package/lib/components/loading/index.js +64 -0
  44. package/lib/components/nav/index.css +37 -0
  45. package/lib/components/nav/index.js +31 -0
  46. package/lib/components/nav-top/components/app-center/index.js +1 -6
  47. package/lib/components/nav-top/components/menu/index.js +14 -44
  48. package/lib/components/nav-top/components/user-message/components/inform/inform-item.js +2 -2
  49. package/lib/components/nav-top/index.css +6 -0
  50. package/lib/components/nav-top/index.js +138 -2
  51. package/lib/components/nav-top/request.apis.js +10 -2
  52. package/lib/components/okr-guide/constant.js +23 -0
  53. package/lib/components/okr-guide/img/left-img.jpg +0 -0
  54. package/lib/components/okr-guide/index.css +148 -0
  55. package/lib/components/okr-guide/index.js +242 -0
  56. package/lib/components/okr-guide/request-api.js +57 -0
  57. package/lib/components/rich-editor-at/index.js +85 -13
  58. package/lib/components/scroll-container/index.js +27 -6
  59. package/lib/components/search-input/index.css +2 -2
  60. package/lib/components/search-input/index.js +4 -0
  61. package/lib/components/upload/img/folder.svg +40 -0
  62. package/lib/components/upload/img/form.svg +38 -0
  63. package/lib/components/upload/img/mind.svg +39 -0
  64. package/lib/components/upload/index.js +193 -25
  65. package/lib/components/upload/index2.js +379 -0
  66. package/lib/components/upload/util.js +20 -2
  67. package/lib/components/user-selector/request-apis.js +3 -3
  68. package/lib/components/version-change-modal/index.js +1 -3
  69. package/lib/index.js +8 -0
  70. package/lib/utils/helpers.js +54 -17
  71. package/lib/utils/open-data.js +93 -54
  72. package/lib/utils/tools.js +11 -1
  73. package/package.json +3 -2
@@ -15,6 +15,8 @@ var _bsGlobal = require("./bs-global");
15
15
 
16
16
  var _openDataPainter = require("../components/open-data-painter");
17
17
 
18
+ var _helpers = require("./helpers");
19
+
18
20
  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); }
19
21
 
20
22
  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; }
@@ -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];
@@ -74,7 +76,27 @@ function openData() {
74
76
  var _getBSGlobal;
75
77
 
76
78
  // 企业微信租户 && 非自建应用
77
- if (getSource() === WX_SOURCE && ((_getBSGlobal = (0, _bsGlobal.getBSGlobal)("tenantInfo")) === null || _getBSGlobal === void 0 ? void 0 : _getBSGlobal.corpCreateType) !== 2 || getUA().includes(WX_UA_STR)) {
79
+ if (getSource() === WX_SOURCE && ((_getBSGlobal = (0, _bsGlobal.getBSGlobal)('tenantInfo')) === null || _getBSGlobal === void 0 ? void 0 : _getBSGlobal.corpCreateType) !== 2 || getUA().includes(WX_UA_STR)) {
80
+ // 企业微信初始化失败
81
+ if (!window.WWOpenData && !window.top.WWOpenData) {
82
+ return function (p) {
83
+ if (p.name == undefined || p.id == undefined) {
84
+ try {
85
+ (0, _helpers.errorLog)(1, JSON.stringify({
86
+ errorType: 'WWOpenData is undefined',
87
+ pName: p.name == undefined ? 'undefined' : p.name,
88
+ pId: p.id == undefined ? 'undefined' : p.id,
89
+ pType: p.type
90
+ }));
91
+ } catch (e) {
92
+ console.log(e);
93
+ }
94
+ }
95
+
96
+ return p.name || p.id || null;
97
+ };
98
+ }
99
+
78
100
  return function (p) {
79
101
  var pId = p.id,
80
102
  pName = p.name,
@@ -89,18 +111,39 @@ function openData() {
89
111
  var openId = pCorpId || getOpenId(pId, pType);
90
112
 
91
113
  if (!openId) {
92
- if (!pId) {
114
+ if (pId) {
115
+ try {
116
+ // BSGlobal
117
+ var openIds;
118
+
119
+ if (pType === 'userName') {
120
+ openIds = (0, _bsGlobal.getBSGlobal)('openIds');
121
+ } else if (pType === 'departmentName') {
122
+ openIds = (0, _bsGlobal.getBSGlobal)('openDepartmentIds');
123
+ }
124
+
125
+ (0, _helpers.errorLog)(1, JSON.stringify({
126
+ errorType: 'openId 不存在',
127
+ pName: pName == undefined ? 'undefined' : pName,
128
+ pId: pId == undefined ? 'undefined' : pId,
129
+ pType: pType,
130
+ openIds: openIds
131
+ }));
132
+ } catch (e) {
133
+ console.log(e);
134
+ }
135
+
93
136
  Sentry.withScope(function (scope) {
94
- scope.setTag("error-level", "P1");
95
- scope.setTag("error-type", "企业微信openData调用失败");
96
- scope.setExtra("fail_type", pType);
97
- scope.setExtra("p_id", pId);
98
- scope.setExtra("p_name", pName);
99
- scope.setExtra("corp_id", pCorpId);
100
- scope.setExtra("open_id", getOpenId(pId, pType));
101
- p.callFunc && scope.setExtra("fail_callFunc", p.callFunc);
102
- p.extra && scope.setExtra("fail_extra", p.extra);
103
- Sentry.captureException(new Error("企业微信openData调用失败"), scope);
137
+ scope.setTag('error-level', 'P1');
138
+ scope.setTag('error-type', '企业微信openData调用失败');
139
+ scope.setExtra('fail_type', pType);
140
+ scope.setExtra('p_id', pId);
141
+ scope.setExtra('p_name', pName);
142
+ scope.setExtra('corp_id', pCorpId);
143
+ scope.setExtra('open_id', getOpenId(pId, pType));
144
+ p.callFunc && scope.setExtra('fail_callFunc', p.callFunc);
145
+ p.extra && scope.setExtra('fail_extra', p.extra);
146
+ Sentry.captureException(new Error('企业微信openData调用失败'), scope);
104
147
  });
105
148
  }
106
149
 
@@ -113,28 +156,24 @@ function openData() {
113
156
 
114
157
  // @ts-ignore
115
158
  (_ref = window.WWOpenData && window.WWOpenData || window.top.WWOpenData) === null || _ref === void 0 ? void 0 : _ref.bind(ref.current);
116
- if (!p.id) return;
117
- var openId = getOpenId(p.id, p.type);
118
-
119
- if (!openId) {}
120
159
  }, []);
121
160
  return /*#__PURE__*/_react["default"].createElement("div", {
122
161
  style: {
123
- display: "inline",
124
- position: "relative",
125
- overflow: "hidden",
126
- textOverflow: "ellipsis"
162
+ display: 'inline',
163
+ position: 'relative',
164
+ overflow: 'hidden',
165
+ textOverflow: 'ellipsis'
127
166
  }
128
167
  },
129
168
  /*#__PURE__*/
130
169
  // @ts-ignore
131
170
  _react["default"].createElement("ww-open-data", {
132
171
  ref: ref,
133
- type: p.type,
172
+ type: pType,
134
173
  openid: openId
135
174
  }), /*#__PURE__*/_react["default"].createElement("div", {
136
175
  style: {
137
- position: "absolute",
176
+ position: 'absolute',
138
177
  top: 0,
139
178
  left: 0,
140
179
  right: 0,
@@ -154,7 +193,7 @@ var getOpenData = openData();
154
193
 
155
194
  var OpenUserName = function OpenUserName(p) {
156
195
  return getOpenData(_objectSpread(_objectSpread({}, p), {}, {
157
- type: "userName"
196
+ type: 'userName'
158
197
  }));
159
198
  };
160
199
 
@@ -162,7 +201,7 @@ exports.OpenUserName = OpenUserName;
162
201
 
163
202
  var OpenDepartmentName = function OpenDepartmentName(p) {
164
203
  return getOpenData(_objectSpread(_objectSpread({}, p), {}, {
165
- type: "departmentName"
204
+ type: 'departmentName'
166
205
  }));
167
206
  };
168
207
 
@@ -173,22 +212,22 @@ var openDataMap = {
173
212
  }; // name:'wx'|'dd'|'feishu',type:'source'|'env'|'all' = 'all'
174
213
 
175
214
  var isPlatform = function isPlatform(name) {
176
- var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "all";
215
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all';
177
216
 
178
217
  switch (name) {
179
- case "wx":
218
+ case 'wx':
180
219
  {
181
- if (type == "source") return getSource() === WX_SOURCE;
182
- if (type == "env") return getUA().includes(WX_UA_STR);
220
+ if (type == 'source') return getSource() === WX_SOURCE;
221
+ if (type == 'env') return getUA().includes(WX_UA_STR);
183
222
  return getSource() === WX_SOURCE || getUA().includes(WX_UA_STR);
184
223
  }
185
224
 
186
- case "dd":
225
+ case 'dd':
187
226
  {
188
227
  return getSource() === DINGTALK_SOURCE;
189
228
  }
190
229
 
191
- case "feishu":
230
+ case 'feishu':
192
231
  {
193
232
  return getSource() === FEISHU_SOURCE;
194
233
  }
@@ -210,7 +249,7 @@ var parseTag = function parseTag(str) {
210
249
  // return <span dangerouslySetInnerHTML={{ '__html': str }} />;
211
250
 
212
251
  while (matchStr != null) {
213
- var OpenDataCompoent = matchStr[1] == "userId" ? OpenUserName : OpenDepartmentName;
252
+ var OpenDataCompoent = matchStr[1] == 'userId' ? OpenUserName : OpenDepartmentName;
214
253
 
215
254
  if (!OpenDataCompoent) {
216
255
  openDatas.push( /*#__PURE__*/_react["default"].createElement("span", {
@@ -224,8 +263,8 @@ var parseTag = function parseTag(str) {
224
263
  } else {
225
264
  openDatas.push( /*#__PURE__*/_react["default"].createElement("span", {
226
265
  style: {
227
- color: "#1890ff",
228
- margin: "0 4px"
266
+ color: '#1890ff',
267
+ margin: '0 4px'
229
268
  },
230
269
  onClick: function onClick(e) {
231
270
  return e.stopPropagation();
@@ -261,7 +300,7 @@ var parseString = function parseString(str) {
261
300
  var source = window.BSGlobal.tenantInfo.Source;
262
301
  var ua = navigator.userAgent.toLowerCase();
263
302
 
264
- if (source != WX_SOURCE && ua.indexOf("wxwork") == -1) {
303
+ if (source != WX_SOURCE && ua.indexOf('wxwork') == -1) {
265
304
  return /*#__PURE__*/_react["default"].createElement("span", {
266
305
  dangerouslySetInnerHTML: {
267
306
  __html: str
@@ -319,7 +358,7 @@ var parseStringV2 = function parseStringV2(str) {
319
358
  var source = window.BSGlobal.tenantInfo.Source;
320
359
  var ua = navigator.userAgent.toLowerCase();
321
360
 
322
- if (source != WX_SOURCE && ua.indexOf("micromessenger") == -1) {
361
+ if (source != WX_SOURCE && ua.indexOf('micromessenger') == -1) {
323
362
  return /*#__PURE__*/_react["default"].createElement("span", {
324
363
  dangerouslySetInnerHTML: {
325
364
  __html: str
@@ -381,14 +420,14 @@ var parseOpenDataStringToImg = /*#__PURE__*/function () {
381
420
  font = _args.length > 1 && _args[1] !== undefined ? _args[1] : {
382
421
  lineHeight: 20,
383
422
  fontSize: 18,
384
- fontWeight: "500",
385
- color: "#3f4755"
423
+ fontWeight: '500',
424
+ color: '#3f4755'
386
425
  };
387
426
  font = _objectSpread(_objectSpread({}, {
388
427
  lineHeight: 20,
389
428
  fontSize: 18,
390
- fontWeight: "500",
391
- color: "#3f4755"
429
+ fontWeight: '500',
430
+ color: '#3f4755'
392
431
  }), font || {});
393
432
  reg = /\$(userName|departmentName)\=(.+?)\$/g;
394
433
  strReg = /\$(?:userName|departmentName)\=.+?\$/;
@@ -454,8 +493,8 @@ var getCanvasImg = /*#__PURE__*/function () {
454
493
  case 0:
455
494
  lineHeight = _ref3.lineHeight, fontSize = _ref3.fontSize, fontWeight = _ref3.fontWeight, color = _ref3.color;
456
495
  font = "".concat(fontWeight, " ").concat(fontSize, "px/").concat(lineHeight, "px arial,sans-serif");
457
- canvas = document.createElement("canvas");
458
- ctx = canvas.getContext("2d");
496
+ canvas = document.createElement('canvas');
497
+ ctx = canvas.getContext('2d');
459
498
 
460
499
  if (ctx) {
461
500
  _context2.next = 6;
@@ -473,16 +512,16 @@ var getCanvasImg = /*#__PURE__*/function () {
473
512
 
474
513
  case 8:
475
514
  name = _context2.sent;
476
- img = document.createElement("img");
515
+ img = document.createElement('img');
477
516
  ctx.font = font; // const fitStr = fittingString(ctx, name, 92);
478
517
 
479
- _ctx$measureText = ctx.measureText(name || ""), width = _ctx$measureText.width;
518
+ _ctx$measureText = ctx.measureText(name || ''), width = _ctx$measureText.width;
480
519
  actualWidth = Math.min(width, 92);
481
520
  (0, _openDataPainter.setSize)(canvas, ctx, actualWidth, lineHeight);
482
- ctx.textBaseline = "middle";
521
+ ctx.textBaseline = 'middle';
483
522
  ctx.font = font;
484
523
  ctx.fillStyle = color;
485
- ctx.fillText(name || "", 0, lineHeight / 2);
524
+ ctx.fillText(name || '', 0, lineHeight / 2);
486
525
  src = canvas.toDataURL();
487
526
  return _context2.abrupt("return", /*#__PURE__*/_react["default"].createElement("img", {
488
527
  src: src,
@@ -513,7 +552,7 @@ var parseHtmlAndTextTag = function parseHtmlAndTextTag(str) {
513
552
 
514
553
  while (matchStr != null) {
515
554
  if (matchStr) {
516
- var OpenDataCompoent = matchStr[1] == "userId" ? OpenUserName : OpenDepartmentName;
555
+ var OpenDataCompoent = matchStr[1] == 'userId' ? OpenUserName : OpenDepartmentName;
517
556
 
518
557
  if (!OpenDataCompoent) {
519
558
  var strParsed = parseString(matchStr[0]);
@@ -521,8 +560,8 @@ var parseHtmlAndTextTag = function parseHtmlAndTextTag(str) {
521
560
  } else {
522
561
  openDatas.push( /*#__PURE__*/_react["default"].createElement("span", {
523
562
  style: {
524
- color: "#1890ff",
525
- margin: "0 4px"
563
+ color: '#1890ff',
564
+ margin: '0 4px'
526
565
  },
527
566
  onClick: function onClick(e) {
528
567
  return e.stopPropagation();
@@ -10,7 +10,9 @@ exports.htmlDecodeByHtmlRegExp = htmlDecodeByHtmlRegExp;
10
10
  exports.htmlDecodeByRegExp = htmlDecodeByRegExp;
11
11
  exports.htmlEncodeByRegExp = htmlEncodeByRegExp;
12
12
  exports.htmlEncodeToHtmlByRegExp = htmlEncodeToHtmlByRegExp;
13
- exports.unHighLight = exports.openPage = exports.htmlToText = void 0;
13
+ exports.openPage = exports.htmlToText = void 0;
14
+ exports.openUrl = openUrl;
15
+ exports.unHighLight = void 0;
14
16
 
15
17
  var _platform = require("./platform");
16
18
 
@@ -34,6 +36,14 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
34
36
 
35
37
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
36
38
 
39
+ function openUrl(url) {
40
+ if (typeof url !== 'string') return;
41
+ var newTab = window.open();
42
+ if (!newTab) return;
43
+ newTab.opener = null;
44
+ newTab.location = url;
45
+ }
46
+
37
47
  function htmlEncodeByRegExp(str) {
38
48
  if (!str) return "";
39
49
  var htmlString = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@titaui/pc",
3
- "version": "1.13.5-beta.1",
3
+ "version": "1.13.7",
4
4
  "nameCN": "",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
@@ -38,6 +38,7 @@
38
38
  "@types/styled-components": "5.1.2",
39
39
  "@typescript-eslint/eslint-plugin": "5.10.0",
40
40
  "@typescript-eslint/parser": "5.10.0",
41
+ "@webpack-cli/serve": "^1.7.0",
41
42
  "babel-loader": "8.1.0",
42
43
  "babel-plugin-import": "1.13.3",
43
44
  "babel-plugin-module-resolver": "4.1.0",
@@ -78,7 +79,7 @@
78
79
  "@titaui/rc-trigger": "5.2.5",
79
80
  "@titaui/react-flow-renderer": "9.5.4",
80
81
  "@titaui/request": "^1.0.1",
81
- "@titaui/rich-editor": "0.1.56",
82
+ "@titaui/rich-editor": "0.1.63",
82
83
  "@titaui/toast": "1.0.0",
83
84
  "@types/color": "3.0.3",
84
85
  "@types/prosemirror-commands": "1.0.4",