@titaui/pc 1.9.62 → 1.9.63
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.
|
@@ -39,24 +39,29 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
39
39
|
|
|
40
40
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
41
41
|
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
42
|
+
var getVisibilityList = function getVisibilityList() {
|
|
43
|
+
return [{
|
|
44
|
+
value: 1,
|
|
45
|
+
label: (0, _getLocale.getLocale)("OKR_MyO_Pop_Public")
|
|
46
|
+
}, {
|
|
47
|
+
value: 2,
|
|
48
|
+
label: (0, _getLocale.getLocale)("OKR_MyO_From_Associatedmem")
|
|
49
|
+
}, {
|
|
50
|
+
value: 3,
|
|
51
|
+
label: (0, _getLocale.getLocale)("OKR_MyO_Pop_Directrep")
|
|
52
|
+
}, {
|
|
53
|
+
value: 4,
|
|
54
|
+
label: (0, _getLocale.getLocale)("OKR_MyO_Pop_Specified")
|
|
55
|
+
}];
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
var getVisibilityMapText = function getVisibilityMapText() {
|
|
59
|
+
return {
|
|
60
|
+
1: (0, _getLocale.getLocale)("OKR_MyO_Pop_Public"),
|
|
61
|
+
2: (0, _getLocale.getLocale)("OKR_MyO_From_Associatedmem"),
|
|
62
|
+
3: (0, _getLocale.getLocale)("OKR_MyO_Pop_Directrep"),
|
|
63
|
+
4: (0, _getLocale.getLocale)("OKR_MyO_Pop_Specified")
|
|
64
|
+
};
|
|
60
65
|
};
|
|
61
66
|
|
|
62
67
|
var Visibility = function Visibility(_ref) {
|
|
@@ -80,55 +85,77 @@ var Visibility = function Visibility(_ref) {
|
|
|
80
85
|
users = selectNodes.users;
|
|
81
86
|
|
|
82
87
|
if (departments.length === 0 && groups.length === 0 && users.length === 0) {
|
|
83
|
-
setVisibilityState(oldSelect.current);
|
|
88
|
+
setVisibilityState(oldSelect.current);
|
|
89
|
+
|
|
90
|
+
if (selectorRef.current) {
|
|
91
|
+
// @ts-ignore
|
|
92
|
+
selectorRef.current.close();
|
|
93
|
+
}
|
|
84
94
|
|
|
85
|
-
selectorRef.current && selectorRef.current.close();
|
|
86
95
|
return;
|
|
87
96
|
}
|
|
88
97
|
|
|
89
|
-
|
|
98
|
+
if (onChangeVisiableLimit) {
|
|
99
|
+
onChangeVisiableLimit(4, selectNodes);
|
|
100
|
+
}
|
|
90
101
|
|
|
91
|
-
|
|
102
|
+
if (selectorRef.current) {
|
|
103
|
+
// @ts-ignore
|
|
104
|
+
selectorRef.current.close();
|
|
105
|
+
}
|
|
92
106
|
}, [onChangeVisiableLimit]);
|
|
93
107
|
var handleChangeVisibility = (0, _react.useCallback)(function (data) {
|
|
94
108
|
setVisibilityState(data.value);
|
|
95
109
|
|
|
96
110
|
if (data.value === 4) {
|
|
97
|
-
|
|
98
|
-
|
|
111
|
+
if (selectorRef.current) {
|
|
112
|
+
// @ts-ignore
|
|
113
|
+
selectorRef.current.open();
|
|
114
|
+
}
|
|
99
115
|
} else {
|
|
100
116
|
oldSelect.current = data.value;
|
|
101
|
-
|
|
117
|
+
|
|
118
|
+
if (onChangeVisiableLimit) {
|
|
119
|
+
onChangeVisiableLimit(data.value);
|
|
120
|
+
}
|
|
102
121
|
}
|
|
103
122
|
}, [onChangeVisiableLimit]);
|
|
104
123
|
var renderText = (0, _react.useMemo)(function () {
|
|
105
124
|
var result = [];
|
|
106
125
|
|
|
107
126
|
if (visiableLimit) {
|
|
108
|
-
visiableLimit.users && visiableLimit.users.length > 0
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
if (visiableLimit.users && visiableLimit.users.length > 0) {
|
|
128
|
+
visiableLimit.users.forEach(function (item, index) {
|
|
129
|
+
if (index !== 0) {
|
|
130
|
+
result.push("、");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
result.push( /*#__PURE__*/_react["default"].createElement(_openData.OpenUserName, {
|
|
134
|
+
name: item.name,
|
|
135
|
+
id: item.userId
|
|
136
|
+
}));
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (visiableLimit.departments && visiableLimit.departments.length > 0) {
|
|
141
|
+
visiableLimit.departments.forEach(function (item, index) {
|
|
142
|
+
result.push(index === 0 && result.length === 0 ? "" : "、");
|
|
143
|
+
result.push( /*#__PURE__*/_react["default"].createElement(_openData.OpenDepartmentName, {
|
|
144
|
+
name: item.name,
|
|
145
|
+
id: item.id
|
|
146
|
+
}));
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (visiableLimit.groups && visiableLimit.groups.length > 0) {
|
|
151
|
+
visiableLimit.groups.forEach(function (item, index) {
|
|
152
|
+
result.push(index === 0 && result.length === 0 ? "" : "、");
|
|
153
|
+
result.push(item.name);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
129
156
|
}
|
|
130
157
|
|
|
131
|
-
return result.length > 0 ? result :
|
|
158
|
+
return result.length > 0 ? result : getVisibilityMapText()[visibilityState];
|
|
132
159
|
}, [visiableLimit, visibilityState]);
|
|
133
160
|
(0, _react.useEffect)(function () {
|
|
134
161
|
setVisibilityState(visibility);
|
|
@@ -158,7 +185,7 @@ var Visibility = function Visibility(_ref) {
|
|
|
158
185
|
textClass: "base-info-other-infos__visibility-select-text",
|
|
159
186
|
forceRenderText: visibility === 4,
|
|
160
187
|
initText: renderText,
|
|
161
|
-
items:
|
|
188
|
+
items: getVisibilityList(),
|
|
162
189
|
initValue: visibilityState,
|
|
163
190
|
onChangeSelect: handleChangeVisibility
|
|
164
191
|
}), canEdit ? /*#__PURE__*/_react["default"].createElement(_index["default"], {
|
|
@@ -172,5 +199,8 @@ var Visibility = function Visibility(_ref) {
|
|
|
172
199
|
}) : null);
|
|
173
200
|
};
|
|
174
201
|
|
|
202
|
+
Visibility.defaultProps = {
|
|
203
|
+
canEdit: false
|
|
204
|
+
};
|
|
175
205
|
var _default = Visibility;
|
|
176
206
|
exports["default"] = _default;
|
package/package.json
CHANGED
|
@@ -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
|
|
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
|
|
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
|
-
|
|
45
|
-
|
|
44
|
+
if (selectorRef.current) {
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
selectorRef.current.close();
|
|
47
|
+
}
|
|
46
48
|
return;
|
|
47
49
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
57
|
-
|
|
62
|
+
if (selectorRef.current) {
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
selectorRef.current.open();
|
|
65
|
+
}
|
|
58
66
|
} else {
|
|
59
67
|
oldSelect.current = data.value;
|
|
60
|
-
|
|
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
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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 :
|
|
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={
|
|
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;
|