@titaui/pc 1.9.64 → 1.9.68

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.
package/.eslintignore ADDED
@@ -0,0 +1,3 @@
1
+ **/*.scss
2
+
3
+ **/*.css
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@titaui/pc",
3
- "version": "1.9.64",
3
+ "version": "1.9.68",
4
4
  "nameCN": "",
5
5
  "description": "",
6
6
  "main": "src/index.js",
@@ -116,6 +116,7 @@
116
116
  "react-cropper": "^2.1.8",
117
117
  "react-custom-scrollbars": "^4.2.1",
118
118
  "react-grid-layout": "^1.2.5",
119
+ "react-perfect-scrollbar": "^1.5.8",
119
120
  "react-sizeme": "^3.0.1",
120
121
  "react-slick": "^0.28.1",
121
122
  "react-spring": "^9.2.4",
@@ -58,6 +58,7 @@ export default forwardRef((props: Props, ref) => {
58
58
  onCheckSuccess,
59
59
  className = "",
60
60
  tail,
61
+ ...restProps
61
62
  } = props;
62
63
 
63
64
  const inputRef = useRef<any>();
@@ -171,6 +172,7 @@ export default forwardRef((props: Props, ref) => {
171
172
  onBlur={onBlurHandler}
172
173
  onChange={onChangeHandler}
173
174
  autoComplete="off"
175
+ {...restProps}
174
176
  />
175
177
  </ToolTip>
176
178
  {typeof tail === "string" ? (
@@ -26,11 +26,12 @@
26
26
  justify-content: center;
27
27
  margin: 0 5px;
28
28
  position: relative;
29
+ color: #ffffff;
29
30
  & > a {
30
- color: #FFF!important;
31
+ color: #ffffff !important;
31
32
  }
32
- &--active::after{
33
- content: "";
33
+ &--active::after {
34
+ content: '';
34
35
  position: absolute;
35
36
  top: 50%;
36
37
  left: 50%;
@@ -2,7 +2,7 @@ import React, { ReactElement, useState, useEffect } from "react";
2
2
  import classNames from "classnames";
3
3
  import axios from "axios";
4
4
  import Popup from "../popup";
5
- import { getLoginUserInfo } from "../../utils/helpers";
5
+ import { getLoginUserInfo, getTenantInfo } from "../../utils/helpers";
6
6
  import ArrowImg from "./img/arrow.png";
7
7
  import "./index.scss";
8
8
 
@@ -22,7 +22,7 @@ function HrHeader(): ReactElement {
22
22
  }, []);
23
23
  return (
24
24
  <div className={preCls}>
25
- <span className={`${preCls}__title`}>腾讯HR助手</span>
25
+ <span className={`${preCls}__title`}>{getTenantInfo().Name}</span>
26
26
  <div className={`${preCls}__menu-list`}>
27
27
  {menus.slice(0, 5).map((menu) => (
28
28
  <div
@@ -1,6 +1,6 @@
1
1
  .base-info__divider {
2
2
  height: 8px;
3
- background: #F0F2F5;
3
+ background: #f0f2f5;
4
4
  margin: 0 32px;
5
5
  }
6
6
  .base-info__participant-followers-wrapper {
@@ -9,17 +9,18 @@
9
9
  .base-info__person-block {
10
10
  font-size: 14px;
11
11
  font-weight: 600;
12
- color: #141C28;
12
+ color: #141c28;
13
13
  line-height: 22px;
14
- font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
14
+ font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica,
15
+ sans-serif, PingFang SC, Microsoft YaHei;
15
16
  padding-left: 10px;
16
- &:first-of-type{
17
+ &:first-of-type {
17
18
  margin-bottom: 4px;
18
19
  }
19
20
  .base-info__person-block-title {
20
21
  font-size: 14px;
21
22
  font-weight: 600;
22
- color: #141C28;
23
+ color: #141c28;
23
24
  line-height: 22px;
24
25
  margin-bottom: 8px;
25
26
  display: block;
@@ -28,4 +29,4 @@
28
29
  }
29
30
  .base-info__infos-wrapper {
30
31
  padding: 0 42px 0 22px;
31
- }
32
+ }
@@ -8,19 +8,19 @@ import Tooltip from "../../../../tooltip";
8
8
  import { OpenDepartmentName, OpenUserName } from "../../../../../utils/open-data";
9
9
  import { getLocale } from "../../../../../utils/getLocale";
10
10
 
11
- const visibilityList = [
11
+ const getVisibilityList = () => [
12
12
  { value: 1, label: getLocale("OKR_MyO_Pop_Public") },
13
13
  { value: 2, label: getLocale("OKR_MyO_From_Associatedmem") },
14
14
  { value: 3, label: getLocale("OKR_MyO_Pop_Directrep") },
15
15
  { value: 4, label: getLocale("OKR_MyO_Pop_Specified") },
16
16
  ];
17
17
 
18
- const visibilityMapText = {
18
+ const getVisibilityMapText = () => ({
19
19
  1: getLocale("OKR_MyO_Pop_Public"),
20
20
  2: getLocale("OKR_MyO_From_Associatedmem"),
21
21
  3: getLocale("OKR_MyO_Pop_Directrep"),
22
22
  4: getLocale("OKR_MyO_Pop_Specified"),
23
- };
23
+ });
24
24
 
25
25
  interface IVisibilityProps {
26
26
  visibility: any;
@@ -41,43 +41,59 @@ const Visibility: FC<IVisibilityProps> = ({
41
41
  const { departments, groups, users } = selectNodes;
42
42
  if (departments.length === 0 && groups.length === 0 && users.length === 0) {
43
43
  setVisibilityState(oldSelect.current);
44
- // @ts-ignore
45
- selectorRef.current && selectorRef.current.close();
44
+ if (selectorRef.current) {
45
+ // @ts-ignore
46
+ selectorRef.current.close();
47
+ }
46
48
  return;
47
49
  }
48
- onChangeVisiableLimit && onChangeVisiableLimit(4, selectNodes);
49
- // @ts-ignore
50
- selectorRef.current && selectorRef.current.close();
50
+ if (onChangeVisiableLimit) {
51
+ onChangeVisiableLimit(4, selectNodes);
52
+ }
53
+ if (selectorRef.current) {
54
+ // @ts-ignore
55
+ selectorRef.current.close();
56
+ }
51
57
  }, [onChangeVisiableLimit]);
52
58
 
53
59
  const handleChangeVisibility = useCallback((data) => {
54
60
  setVisibilityState(data.value);
55
61
  if (data.value === 4) {
56
- // @ts-ignore
57
- selectorRef.current && selectorRef.current.open();
62
+ if (selectorRef.current) {
63
+ // @ts-ignore
64
+ selectorRef.current.open();
65
+ }
58
66
  } else {
59
67
  oldSelect.current = data.value;
60
- onChangeVisiableLimit && onChangeVisiableLimit(data.value);
68
+ if (onChangeVisiableLimit) {
69
+ onChangeVisiableLimit(data.value);
70
+ }
61
71
  }
62
72
  }, [onChangeVisiableLimit]);
63
73
 
64
74
  const renderText = useMemo(() => {
65
75
  const result = [];
66
76
  if (visiableLimit) {
67
- visiableLimit.users && visiableLimit.users.length > 0 && visiableLimit.users.forEach((item, index) => {
68
- if (index !== 0) { result.push("、"); }
69
- result.push(<OpenUserName name={item.name} id={item.userId} />);
70
- });
71
- visiableLimit.departments && visiableLimit.departments.length > 0 ? visiableLimit.departments.forEach((item, index) => {
72
- result.push(index === 0 && result.length === 0 ? "" : "、");
73
- result.push(<OpenDepartmentName name={item.name} id={item.id} />);
74
- }) : "";
75
- visiableLimit.groups && visiableLimit.groups.length > 0 ? visiableLimit.groups.forEach((item, index) => {
76
- result.push(index === 0 && result.length === 0 ? "" : "、");
77
- result.push(item.name);
78
- }) : "";
77
+ if (visiableLimit.users && visiableLimit.users.length > 0) {
78
+ visiableLimit.users.forEach((item, index) => {
79
+ if (index !== 0) { result.push("、"); }
80
+ result.push(<OpenUserName name={item.name} id={item.userId} />);
81
+ });
82
+ }
83
+ if (visiableLimit.departments && visiableLimit.departments.length > 0) {
84
+ visiableLimit.departments.forEach((item, index) => {
85
+ result.push(index === 0 && result.length === 0 ? "" : "、");
86
+ result.push(<OpenDepartmentName name={item.name} id={item.id} />);
87
+ });
88
+ }
89
+ if (visiableLimit.groups && visiableLimit.groups.length > 0) {
90
+ visiableLimit.groups.forEach((item, index) => {
91
+ result.push(index === 0 && result.length === 0 ? "" : "、");
92
+ result.push(item.name);
93
+ });
94
+ }
79
95
  }
80
- return result.length > 0 ? result : visibilityMapText[visibilityState];
96
+ return result.length > 0 ? result : getVisibilityMapText()[visibilityState];
81
97
  }, [visiableLimit, visibilityState]);
82
98
 
83
99
  useEffect(() => {
@@ -112,7 +128,7 @@ const Visibility: FC<IVisibilityProps> = ({
112
128
  textClass="base-info-other-infos__visibility-select-text"
113
129
  forceRenderText={visibility === 4}
114
130
  initText={renderText as any}
115
- items={visibilityList}
131
+ items={getVisibilityList()}
116
132
  initValue={visibilityState}
117
133
  onChangeSelect={handleChangeVisibility}
118
134
  />
@@ -131,4 +147,8 @@ const Visibility: FC<IVisibilityProps> = ({
131
147
  );
132
148
  };
133
149
 
150
+ Visibility.defaultProps = {
151
+ canEdit: false,
152
+ };
153
+
134
154
  export default Visibility;
@@ -0,0 +1,37 @@
1
+ .part-notice {
2
+ margin-left: 16px;
3
+ height: 36px;
4
+ background: #fcedd4;
5
+ display: flex;
6
+ align-items: center;
7
+ font-size: 12px;
8
+ font-weight: 400;
9
+ color: #3f4755;
10
+ line-height: 18px;
11
+ position: relative;
12
+ padding: 0 12px;
13
+ margin-bottom: 10px;
14
+ margin-top: 16px;
15
+ border-radius: 12px;
16
+
17
+ > .tu-icon-tishi {
18
+ color: #f0a326;
19
+ margin-right: 8px;
20
+ }
21
+ &__link {
22
+ color: #f6bd16;
23
+ cursor: pointer;
24
+ }
25
+ &__close {
26
+ color: #f6bd16;
27
+ cursor: pointer;
28
+ font-size: 16px;
29
+ position: absolute;
30
+ right: 12px;
31
+ }
32
+ &__image {
33
+ width: 16px;
34
+ height: 16px;
35
+ margin-right: 8px;
36
+ }
37
+ }
@@ -0,0 +1,50 @@
1
+ import React, { FC, useState, useCallback } from "react";
2
+ import { LocalStorage } from "../../utils/local-storage";
3
+ import "./index.scss";
4
+
5
+ interface Props {
6
+ text: any;
7
+ link: string;
8
+ storageName?: string;
9
+ }
10
+
11
+ const preCls = "part-notice";
12
+ const storage = new LocalStorage();
13
+
14
+ const PartNotice: FC<Props> = ({ storageName, text, link }) => {
15
+ const [visible, setVisible] = useState(() => {
16
+ const stopTaking: any = storage.getItem(storageName);
17
+ if (stopTaking?.date) {
18
+ const oldDate = new Date(stopTaking?.date).getDate();
19
+ const newDate = new Date().getDate();
20
+ if (newDate > oldDate) {
21
+ return true;
22
+ }
23
+ return false;
24
+ }
25
+ return true;
26
+ });
27
+
28
+ const handleClose = useCallback(() => {
29
+ setVisible(false);
30
+ storage.setItem(storageName, { bol: false, date: new Date() });
31
+ }, []);
32
+
33
+ const handleOpenLink = () => {
34
+ window.open(link, "_target");
35
+ };
36
+ if (!visible) return <span />;
37
+ return (
38
+ <div className={`${preCls}`}>
39
+ <span className="tu-icon-tishi" />
40
+ {text}
41
+ <span className={`${preCls}__link`} onClick={handleOpenLink}>了解详情</span>
42
+ <span className={`tu-icon-close ${preCls}__close`} onClick={handleClose} />
43
+ </div>
44
+ );
45
+ };
46
+ PartNotice.defaultProps = {
47
+ storageName: "partNotice",
48
+ };
49
+
50
+ export default PartNotice;
@@ -29,6 +29,21 @@ interface Props {
29
29
  export default class MutiMode extends PureComponent<Props> {
30
30
  tab: any;
31
31
 
32
+ componentDidUpdate(prevProps: Props) {
33
+ const { searchTxt } = this.props;
34
+ if (prevProps.searchTxt !== searchTxt) {
35
+ if (searchTxt) {
36
+ this.tab.changeTab("common");
37
+ }
38
+ }
39
+ }
40
+
41
+ handleDepartment = (d: Dept) => {
42
+ const { selectedDept, onSelectDept } = this.props;
43
+ if (selectedDept.findIndex((sd) => sd.Id === d.Id) !== -1) return;
44
+ onSelectDept(d);
45
+ };
46
+
32
47
  handleSelectUser = (users: User[]) => {
33
48
  const { selectedUser, onSelectUser } = this.props;
34
49
  const m = {};
@@ -38,23 +53,16 @@ export default class MutiMode extends PureComponent<Props> {
38
53
  onSelectUser(filterdUsers);
39
54
  };
40
55
 
41
- handleDepartment = (d: Dept) => {
42
- const { selectedDept, onSelectDept } = this.props;
43
- if (selectedDept.findIndex((sd) => sd.Id == d.Id) != -1) return;
44
- onSelectDept(d);
45
- };
46
-
47
- componentDidUpdate(prevProps: Props) {
48
- if (prevProps.searchTxt != this.props.searchTxt) {
49
- if (this.props.searchTxt) {
50
- this.tab.changeTab("common");
51
- }
52
- }
53
- }
54
-
55
56
  render() {
56
57
  const {
57
- selectedUser, selectedDept, onDeleteUser, onDeleteDept, onClear, deptSelectable, rootSelectable,
58
+ selectedUser,
59
+ selectedDept,
60
+ onDeleteUser,
61
+ onDeleteDept,
62
+ onClear,
63
+ deptSelectable,
64
+ rootSelectable,
65
+ searchTxt,
58
66
  } = this.props;
59
67
  const deptIsSelected = selectedDept.length > 0;
60
68
  const userIsSelected = selectedUser.length > 0;
@@ -62,7 +70,10 @@ export default class MutiMode extends PureComponent<Props> {
62
70
  {
63
71
  title: getLocale("OKR_MyO_Butt_Commonlyused"),
64
72
  name: "common",
65
- component: <CommonList searchTxt={this.props.searchTxt} onSelect={(u: User[]) => this.handleSelectUser(u)} />,
73
+ component: <CommonList
74
+ searchTxt={searchTxt}
75
+ onSelect={(u: User[]) => this.handleSelectUser(u)}
76
+ />,
66
77
  },
67
78
  {
68
79
  title: getLocale("OKR_MyO_Butt_Subordinate"),
@@ -74,7 +85,11 @@ export default class MutiMode extends PureComponent<Props> {
74
85
  tabOptions.push({
75
86
  title: getLocale("Mod_Department"),
76
87
  name: "department",
77
- component: <DepartmentList rootSelectable={rootSelectable} onSelectUser={(u: User[]) => this.handleSelectUser(u)} onSelectDept={deptSelectable ? (d: Dept) => this.handleDepartment(d) : undefined} />,
88
+ component: <DepartmentList
89
+ rootSelectable={rootSelectable}
90
+ onSelectUser={(u: User[]) => this.handleSelectUser(u)}
91
+ onSelectDept={deptSelectable ? (d: Dept) => this.handleDepartment(d) : undefined}
92
+ />,
78
93
  });
79
94
  // }
80
95
  return (
@@ -87,7 +102,7 @@ export default class MutiMode extends PureComponent<Props> {
87
102
  <span>
88
103
  {getLocale("Mod_Selecperson")}
89
104
  {selectedUser.length + getLocale("Mod_Number")}
90
- {deptIsSelected && `,组${selectedDept.length}个`}
105
+ {deptIsSelected && `,${getLocale("Mod_departments").replace("XX", `${selectedDept.length}`)}`}
91
106
  </span>
92
107
  <ClearBtn active={deptIsSelected || userIsSelected} onMouseDown={() => onClear()}>
93
108
  {getLocale("OKR_MyO_Pop_Clearselected")}
package/src/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import "./index.scss";
2
- import { default as StopTakingModal } from "./components/stop-taking-modal";
3
2
 
4
3
  export { default as Dialog } from "./components/dialog";
5
4
  export { default as Switch } from "./components/switch";
@@ -58,6 +57,7 @@ export { default as OkrShare } from "./components/okr-share";
58
57
  export { default as OkrcaseLibrary } from "./components/okrcase-library";
59
58
  export { default as OkrcaseLibraryCard } from "./components/okrcase-library-card";
60
59
  export { default as OperationRecords } from "./components/operation-records";
60
+ export { default as PartNotice } from "./components/part-notice";
61
61
  export { default as Pagination } from "./components/pagination";
62
62
  export { default as PasswordInput } from "./components/password-input";
63
63
  export { default as PhotoCard } from "./components/photo-card";
@@ -32,12 +32,12 @@ function openData(p) {
32
32
  const ref = useRef(null);
33
33
 
34
34
  useEffect(() => {
35
- let wWOpenData = window.WWOpenData;
35
+ let wWOpenData = window.top.WWOpenData;
36
36
 
37
- // 如果当前页面中没有 WWOpenData 则去 top 上尝试获取
38
- if (!wWOpenData && window.top.WWOpenData) {
39
- wWOpenData = window.top.WWOpenData;
40
- }
37
+ // // 如果当前页面中没有 WWOpenData 则去 top 上尝试获取
38
+ // if (!wWOpenData && window.top.WWOpenData) {
39
+ // wWOpenData = window.top.WWOpenData;
40
+ // }
41
41
 
42
42
  wWOpenData && wWOpenData.bind(ref.current);
43
43
  });