@titaui/pc 1.9.70 → 1.9.74

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 (36) hide show
  1. package/lib/components/create-okr-modal/fields/okr-case.js +8 -9
  2. package/lib/components/dynamic/components/dynamic-search-input/index.js +9 -4
  3. package/lib/components/dynamic/constant.js +20 -16
  4. package/lib/components/dynamic/dynamic-item/dynamic-project/constant.js +15 -10
  5. package/lib/components/dynamic/dynamic-item/dynamic-project/index.js +4 -3
  6. package/lib/components/dynamic/dynamic-item/dynamic-replay/index.css +5 -3
  7. package/lib/components/dynamic/dynamic-item/dynamic-replay/index.js +6 -4
  8. package/lib/components/dynamic/dynamic-item/dynamic-task/constant.js +15 -10
  9. package/lib/components/dynamic/dynamic-item/dynamic-task/index.js +6 -5
  10. package/lib/components/dynamic/dynamic-liking/item.js +1 -1
  11. package/lib/components/okr-detail/components/okr-tree/tree-node/o-child-node/edit-child-okr-weight.js +1 -1
  12. package/lib/components/okrcase-library-card/index.js +1 -1
  13. package/lib/components/photo-card/index.js +3 -6
  14. package/lib/components/photo-card/request.apis.js +2 -2
  15. package/lib/pages/new-okr-list/index.js +5 -1
  16. package/lib/utils/helpers.js +12 -6
  17. package/lib/utils/tools.js +94 -45
  18. package/package.json +1 -1
  19. package/src/components/create-okr-modal/fields/okr-case.tsx +7 -7
  20. package/src/components/dynamic/components/dynamic-search-input/index.tsx +7 -5
  21. package/src/components/dynamic/constant.ts +4 -2
  22. package/src/components/dynamic/dynamic-item/dynamic-project/constant.ts +4 -2
  23. package/src/components/dynamic/dynamic-item/dynamic-project/index.tsx +5 -5
  24. package/src/components/dynamic/dynamic-item/dynamic-replay/index.scss +5 -3
  25. package/src/components/dynamic/dynamic-item/dynamic-replay/index.tsx +6 -5
  26. package/src/components/dynamic/dynamic-item/dynamic-task/constant.ts +4 -2
  27. package/src/components/dynamic/dynamic-item/dynamic-task/index.tsx +6 -6
  28. package/src/components/dynamic/dynamic-liking/item.tsx +1 -1
  29. package/src/components/okr-detail/components/okr-tree/tree-node/o-child-node/edit-child-okr-weight.tsx +1 -1
  30. package/src/components/okrcase-library-card/index.tsx +1 -1
  31. package/src/components/photo-card/index.tsx +5 -6
  32. package/src/components/photo-card/request.apis.ts +1 -1
  33. package/src/pages/new-okr-list/index.tsx +4 -1
  34. package/src/utils/helpers.ts +6 -4
  35. package/src/utils/tools.js +48 -20
  36. package/yarn-error.log +0 -103
@@ -10,8 +10,8 @@ export function cssSupport(attr, value) {
10
10
  }
11
11
  export function getUploadMaxSize() {
12
12
  const info = getBSGlobal("tenantInfo");
13
- const isDingDing = info.Source == 861;
14
- const isDingZhi = window.dingZhiSize && (window.dingZhiSize).indexOf(info.Id) != -1;
13
+ const isDingDing = info.Source === 861;
14
+ const isDingZhi = window.dingZhiSize && (window.dingZhiSize).indexOf(info.Id) !== -1;
15
15
  if (isDingDing) return 20;
16
16
  if (isDingZhi) return 100;
17
17
  return 50;
@@ -21,9 +21,11 @@ export function getTenantInfo() {
21
21
  return getBSGlobal("tenantInfo");
22
22
  }
23
23
 
24
- export const isDingDing = () => getTenantInfo().Source == 861;
24
+ export const isDingDing = () => getTenantInfo().Source === 861;
25
25
 
26
26
  export const isLocal = () => !!getTenantInfo().isLocal;
27
+
28
+ export const isTencentHr = () => getTenantInfo().Source === 964;
27
29
  export function escapeHtml(str) {
28
30
  const htmlEscapes = {
29
31
  "&": "&",
@@ -32,6 +34,6 @@ export function escapeHtml(str) {
32
34
  """: "\"",
33
35
  "'": "'",
34
36
  };
35
- return str.replace(/(&|<|>|"|')/g, (str) => htmlEscapes[str]);
37
+ return str.replace(/(&|<|>|"|')/g, (s) => htmlEscapes[s]);
36
38
  }
37
39
  export const getLoginUserInfo = () => getBSGlobal("loginUserInfo");
@@ -30,7 +30,7 @@ export function htmlDecodeByRegExp(str) {
30
30
  }
31
31
 
32
32
  export function changeQueryString(key, value) {
33
- const hash = decodeURIComponent(location.hash);
33
+ const hash = decodeURIComponent(window.location.hash);
34
34
  const queryObject = {};
35
35
  const markIndex = hash.indexOf("?");
36
36
  // contain query string in fragments
@@ -40,23 +40,23 @@ export function changeQueryString(key, value) {
40
40
  const queryString = hash.slice(markIndex + 1);
41
41
  const queryArray = queryString.split("&");
42
42
  queryArray.forEach((item) => {
43
- item = item.split("=");
44
- queryObject[item[0]] = item[1];
43
+ const [tempItem0, tempItem1] = item.split("=");
44
+ queryObject[tempItem0] = tempItem1;
45
45
  });
46
46
  queryObject[key] = value;
47
47
  const arr = [];
48
- for (const name in queryObject) {
48
+ Object.keys(queryObject).forEach((name) => {
49
49
  arr.push(`${name}=${queryObject[name]}`);
50
- }
51
- location.hash = `${hashName}?${arr.join("&")}`;
50
+ });
51
+ window.location.hash = `${hashName}?${arr.join("&")}`;
52
52
  } else {
53
- location.hash = hash;
53
+ window.location.hash = hash;
54
54
  }
55
55
  }
56
56
 
57
57
  export function getQueryString() {
58
58
  // 获取Url上的参数,以{}返回
59
- const hash = decodeURIComponent(location.hash);
59
+ const hash = decodeURIComponent(window.location.hash);
60
60
  const queryObject = {};
61
61
  const markIndex = hash.indexOf("?");
62
62
  // contain query string in fragments
@@ -64,7 +64,7 @@ export function getQueryString() {
64
64
  // build query object
65
65
  const queryString = hash.slice(markIndex + 1);
66
66
  const queryArray = queryString.split("&");
67
- for (let i = 0; i < queryArray.length; i++) {
67
+ for (let i = 0; i < queryArray.length; i += 1) {
68
68
  const queryPair = queryArray[i].split("=");
69
69
  if (queryPair[0] !== "_k") {
70
70
  queryObject[queryPair[0]] = decodeURIComponent(queryPair[1]);
@@ -97,9 +97,8 @@ export const highLightWord = ({
97
97
  }
98
98
  } else {
99
99
  const doms = Array.from(parentDom.childNodes);
100
- doms
101
- && doms.length > 0
102
- && doms.map((dom) => {
100
+ if (doms && doms.length > 0) {
101
+ doms.forEach((dom) => {
103
102
  // @ts-ignore 1是元素 3是文本节点
104
103
  if (dom.nodeType === 3) {
105
104
  let match = dom.data.match(reg);
@@ -115,11 +114,12 @@ export const highLightWord = ({
115
114
  match = currentDom.data.match(reg);
116
115
  }
117
116
  } else if (dom.nodeType === 1 && dom.childNodes) {
118
- for (let i = 0; i < dom.childNodes.length; i++) {
117
+ for (let i = 0; i < dom.childNodes.length; i += 1) {
119
118
  i += highLightWord({ parentDom: dom.childNodes[i], keyWord });
120
119
  }
121
120
  }
122
121
  });
122
+ }
123
123
  }
124
124
  }
125
125
  };
@@ -130,22 +130,23 @@ export const unHighLight = ({
130
130
  nodeType = "span",
131
131
  }) => {
132
132
  const doms = parentDom.querySelectorAll(`${nodeType} .${className}`);
133
- doms
134
- && doms.forEach((dom) => {
133
+ if (doms) {
134
+ doms.forEach((dom) => {
135
135
  const { parentNode } = dom;
136
136
  const { firstChild } = dom;
137
137
  parentNode.replaceChild(firstChild, dom);
138
138
  parentNode.normalize();
139
139
  });
140
+ }
140
141
  };
141
142
 
142
143
  export const hexToRgba = (hex, opacity = 1) => (
143
144
  `rgba(${
144
- parseInt(`0x${hex.slice(1, 3)}`)
145
+ parseInt(`0x${hex.slice(1, 3)}`, 16)
145
146
  },${
146
- parseInt(`0x${hex.slice(3, 5)}`)
147
+ parseInt(`0x${hex.slice(3, 5)}`, 16)
147
148
  },${
148
- parseInt(`0x${hex.slice(5, 7)}`)
149
+ parseInt(`0x${hex.slice(5, 7)}`, 16)
149
150
  },${
150
151
  opacity
151
152
  })`
@@ -163,13 +164,13 @@ export const getUrlForUserPage = (options) => {
163
164
  !configs.userId
164
165
  || isDD(true)
165
166
  || isFeishu(true)
166
- || configs.userType == 2
167
+ || configs.userType === 2
167
168
  ) {
168
169
  return "";
169
170
  }
170
171
 
171
172
  const userInfo = window.BSGlobal.loginUserInfo;
172
- if (configs.userId == undefined) {
173
+ if (configs.userId === undefined) {
173
174
  configs.userId = userInfo.Id;
174
175
  }
175
176
  const urlHost = window.BSGlobal.titaHost;
@@ -196,3 +197,30 @@ export const openPage = (url) => {
196
197
  window.open(url, "_blank");
197
198
  }
198
199
  };
200
+
201
+ // html标签转义
202
+ export function htmlEncodeToHtmlByRegExp(str) {
203
+ let temp = "";
204
+ if (str.length === 0) return "";
205
+ // temp = str.replace(/&/g, "&amp;")
206
+ temp = str.replace(/</g, "&lt;");
207
+ temp = temp.replace(/>/g, "&gt;");
208
+ // temp = temp.replace(/ /g, "&nbsp;")
209
+ temp = temp.replace(/'/g, "&#39;");
210
+ temp = temp.replace(/"/g, "&quot;");
211
+ temp = temp.replace(/\n/g, "<br/>");
212
+ return temp;
213
+ }
214
+
215
+ export function htmlDecodeByHtmlRegExp(str) {
216
+ let temp = "";
217
+ if (str.length === 0) return "";
218
+ temp = str.replace(/&amp;/g, "&");
219
+ temp = temp.replace(/&lt;/g, "<");
220
+ temp = temp.replace(/&gt;/g, ">");
221
+ temp = temp.replace(/&nbsp;/g, " ");
222
+ temp = temp.replace(/&#39;/g, "'");
223
+ temp = temp.replace(/&quot;/g, "\"");
224
+ temp = temp.replace(/<br\/>/g, "\n");
225
+ return temp;
226
+ }
package/yarn-error.log DELETED
@@ -1,103 +0,0 @@
1
- Arguments:
2
- /usr/local/bin/node /usr/local/bin/yarn
3
-
4
- PATH:
5
- /opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/opt/homebrew/bin:/opt/homebrew/sbin
6
-
7
- Yarn version:
8
- 1.22.10
9
-
10
- Node version:
11
- 12.22.1
12
-
13
- Platform:
14
- darwin x64
15
-
16
- Trace:
17
- SyntaxError: /Users/yang/tita/titaui-pc/package.json: Unexpected token < in JSON at position 26
18
- at JSON.parse (<anonymous>)
19
- at /usr/local/lib/node_modules/yarn/lib/cli.js:1625:59
20
- at Generator.next (<anonymous>)
21
- at step (/usr/local/lib/node_modules/yarn/lib/cli.js:310:30)
22
- at /usr/local/lib/node_modules/yarn/lib/cli.js:321:13
23
-
24
- npm manifest:
25
- {
26
- "name": "@titaui/pc",
27
- <<<<<<< HEAD
28
- "version": "1.2.22",
29
- =======
30
- "version": "1.2.13",
31
- >>>>>>> master
32
- "nameCN": "",
33
- "description": "",
34
- "main": "src/index.js",
35
- "scripts": {
36
- "storybook": "start-storybook -p 6006 --no-dll",
37
- "start": "dev_server=on webpack-dev-server --disableHostCheck=true --progress --colors --config webpack-stories.config.js",
38
- "build-storybook": "build-storybook --docs --no-dll",
39
- "build:es": "babel src -d es --ignore **/__tests__",
40
- "build:lib": "cross-env OUTPUT_MODULE=commonjs babel src -d lib --ignore **/__tests__",
41
- "build:umd": "webpack --config ./.scripts/webpack.umd.js",
42
- "build": "npm run build:lib && npm run build:es && npm run build:umd"
43
- },
44
- "author": "",
45
- "license": "ISC",
46
- "devDependencies": {
47
- "del": "^6.0.0",
48
- "gulp": "^3.x",
49
- "gulp-autoprefixer": "^7.0.1",
50
- "gulp-babel": "^8.0.0",
51
- "gulp-concat": "^2.6.1",
52
- "gulp-cssbeautify": "^3.0.0",
53
- "gulp-cssnano": "^2.1.3",
54
- "gulp-filesize": "0.0.6",
55
- "gulp-postcss": "^9.0.0",
56
- "gulp-rename": "^2.0.0",
57
- "gulp-replace": "^1.0.0",
58
- "gulp-sass": "^4.1.0",
59
- "gulp-sourcemaps": "^2.6.5",
60
- "sass-resources-loader": "^2.2.1"
61
- },
62
- "dependencies": {
63
- "@titaui/dagre": "^0.8.8-pre",
64
- "@titaui/rc-tree2": "^4.1.15",
65
- "@titaui/rc-trigger": "^5.2.5",
66
- "@titaui/react-flow-renderer": "9.5.4",
67
- "@titaui/toast": "^1.0.0",
68
- "axios": "^0.21.1",
69
- "classnames": "^2.2.6",
70
- "clone-deep": "^4.0.1",
71
- "d3-cloud": "^1.2.5",
72
- "dayjs": "^1.10.4",
73
- "html2canvas": "^1.0.0-rc.7",
74
- "moment": "^2.29.1",
75
- "qs": "^6.10.1",
76
- "rc-checkbox": "^2.3.2",
77
- "rc-dialog": "8.5.2",
78
- "rc-drawer": "^4.3.1",
79
- "rc-input-number": "^5.0.0",
80
- "rc-pagination": "^3.1.6",
81
- "rc-queue-anim": "1.4.1",
82
- "rc-select": "^12.1.7",
83
- "rc-switch": "^3.2.2",
84
- "rc-table": "^7.13.2",
85
- "rc-tabs": "^11.7.3",
86
- "rc-tooltip": "^5.1.1",
87
- "rc-tree": "^4.1.5",
88
- "rc-trigger": "^5.2.3",
89
- "rc-upload": "^4.2.0-alpha.0",
90
- "rc-util": "^5.13.1",
91
- "react-collapse": "^5.1.0",
92
- "react-perfect-scrollbar": "^1.5.2",
93
- "url-parse": "^1.5.1",
94
- "uuid": "^3.1.0",
95
- "wordcloud": "^1.2.2"
96
- }
97
- }
98
-
99
- yarn manifest:
100
- No manifest
101
-
102
- Lockfile:
103
- No lockfile