@smart-link/rn-im 1.0.23 → 1.0.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.
- package/dist/api/addressList.js +6 -17
- package/dist/api/backup.js +8 -20
- package/dist/api/file.js +6 -35
- package/dist/api/user.js +6 -16
- package/dist/components/CachedImage.js +14 -42
- package/dist/components/Camera/Camera.js +26 -54
- package/dist/components/Camera/CameraCapture.js +99 -128
- package/dist/components/Camera/CameraResult.js +33 -61
- package/dist/components/ChatAvatar/ChatAvatar.d.ts +1 -1
- package/dist/components/ChatAvatar/ChatAvatar.js +34 -62
- package/dist/components/ChatAvatar/ChatAvatarId.d.ts +2 -2
- package/dist/components/ChatAvatar/ChatAvatarId.js +26 -51
- package/dist/components/ChatAvatar/ChatAvatarLocal.d.ts +2 -2
- package/dist/components/ChatAvatar/ChatAvatarLocal.js +23 -25
- package/dist/components/ChatAvatar/index.js +2 -23
- package/dist/components/Favicon.js +6 -34
- package/dist/components/FormatTimeText.js +5 -10
- package/dist/components/Highlighter.js +9 -34
- package/dist/components/IndicatorText.js +14 -39
- package/dist/components/LocalImage.js +7 -32
- package/dist/components/NetworkUnconnected.js +14 -42
- package/dist/components/PopoverWrapper.js +22 -47
- package/dist/components/VideoPlayer.js +111 -138
- package/dist/components/styles.js +10 -13
- package/dist/default-assets.d.ts +1 -0
- package/dist/default-assets.js +8 -10
- package/dist/hooks/useDownloadSource.js +7 -12
- package/dist/hooks/useFormatMsgTime.js +5 -13
- package/dist/hooks/useImReady.js +7 -10
- package/dist/hooks/useImSelector.js +34 -48
- package/dist/hooks/useTranslation.js +5 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -28
- package/dist/init.js +30 -40
- package/dist/interface.js +1 -2
- package/dist/locales/en/addressList.js +1 -3
- package/dist/locales/index.js +4 -27
- package/dist/locales/lao/addressList.js +1 -3
- package/dist/locales/zh/addressList.js +1 -3
- package/dist/pages/address-list/AddressList.js +33 -61
- package/dist/pages/address-list/CardInfo.js +10 -18
- package/dist/pages/address-list/ChooseContact.js +50 -78
- package/dist/pages/address-list/Icons.js +7 -14
- package/dist/pages/address-list/Organization.js +59 -89
- package/dist/pages/address-list/UserDetail.js +55 -83
- package/dist/pages/address-list/UserJobs.js +31 -33
- package/dist/pages/address-list/UserSearch.js +29 -54
- package/dist/pages/address-list/addressList.routes.js +11 -16
- package/dist/pages/collection/Collection.js +53 -81
- package/dist/pages/collection/ContentFactory.js +53 -82
- package/dist/pages/collection/collection.routes.js +3 -9
- package/dist/pages/conversation/ForwardToConversation.js +63 -91
- package/dist/pages/conversation/List.js +74 -102
- package/dist/pages/conversation/components/ConversationCard.js +46 -74
- package/dist/pages/conversation/components/ConversationOption.js +27 -55
- package/dist/pages/conversation/conversation.routes.js +17 -23
- package/dist/pages/conversation/setting/GroupTransfer.js +32 -60
- package/dist/pages/conversation/setting/OptionAvatars.js +62 -90
- package/dist/pages/conversation/setting/OptionCancelGroup.js +14 -42
- package/dist/pages/conversation/setting/OptionConversation.js +20 -48
- package/dist/pages/conversation/setting/OptionGroup.js +20 -48
- package/dist/pages/conversation/setting/OptionGroupManage.js +21 -49
- package/dist/pages/conversation/setting/OptionGroupMoreMember.js +48 -53
- package/dist/pages/conversation/setting/OptionGroupNameOrNoticeEdit.js +49 -77
- package/dist/pages/conversation/setting/Setting.js +49 -54
- package/dist/pages/conversation/setting/SettingChatBg.js +26 -54
- package/dist/pages/index.js +7 -27
- package/dist/pages/message/ChooseMember.js +56 -84
- package/dist/pages/message/MessageBackup/Bar.js +18 -43
- package/dist/pages/message/MessageBackup/MessageBackup.js +42 -72
- package/dist/pages/message/MessageBackup/RestoreBackupPage.js +48 -76
- package/dist/pages/message/MessageBackup/StartBackupPage.js +48 -76
- package/dist/pages/message/MessageBackup/index.js +3 -12
- package/dist/pages/message/MessageBackup/utils.js +14 -22
- package/dist/pages/message/MessageList.js +141 -135
- package/dist/pages/message/MessageRecord.js +49 -73
- package/dist/pages/message/components/BusiNotifyCard.js +60 -85
- package/dist/pages/message/components/ChatBg.js +11 -36
- package/dist/pages/message/components/MessageItem.js +82 -110
- package/dist/pages/message/components/MessageItemQuote.js +30 -58
- package/dist/pages/message/components/MessageItemTips.js +27 -55
- package/dist/pages/message/components/MessageOption.js +96 -120
- package/dist/pages/message/components/MessagePayload.js +36 -64
- package/dist/pages/message/components/MessagePictureAlbum.js +32 -60
- package/dist/pages/message/components/MessageReceiptStatus.js +18 -43
- package/dist/pages/message/components/MessageUndo.js +18 -48
- package/dist/pages/message/components/MultipleBar/index.js +48 -76
- package/dist/pages/message/components/Payload/PayloadContact.js +30 -58
- package/dist/pages/message/components/Payload/PayloadFile.js +41 -65
- package/dist/pages/message/components/Payload/PayloadMultiple.js +38 -66
- package/dist/pages/message/components/Payload/PayloadNotify.js +28 -56
- package/dist/pages/message/components/Payload/PayloadPicture.js +21 -49
- package/dist/pages/message/components/Payload/PayloadShare.js +39 -67
- package/dist/pages/message/components/Payload/PayloadText.js +39 -67
- package/dist/pages/message/components/Payload/PayloadVideo.js +28 -56
- package/dist/pages/message/components/Payload/PayloadVoice.js +80 -93
- package/dist/pages/message/components/Payload/PayloadWrapper.js +18 -43
- package/dist/pages/message/components/Payload/type.js +1 -2
- package/dist/pages/message/components/ReceiptBack.js +31 -61
- package/dist/pages/message/components/TextMixMessage.js +13 -38
- package/dist/pages/message/components/TextMixQuote.js +129 -158
- package/dist/pages/message/components/TextMixQuoteMessage.js +16 -44
- package/dist/pages/message/components/UploadProgress.js +12 -37
- package/dist/pages/message/components/messageBar/EmojiPanel.js +25 -50
- package/dist/pages/message/components/messageBar/Icons.js +56 -74
- package/dist/pages/message/components/messageBar/MessageBar.js +84 -115
- package/dist/pages/message/components/messageBar/MessageInput.js +30 -55
- package/dist/pages/message/components/messageBar/OptionPanel.js +54 -82
- package/dist/pages/message/components/messageBar/VoiceBar.js +122 -100
- package/dist/pages/message/components/messageBar/index.js +2 -23
- package/dist/pages/message/message.routes.js +11 -40
- package/dist/pages/search/Search.js +38 -66
- package/dist/pages/search/SearchChatRecords.js +64 -92
- package/dist/pages/search/SearchFile.js +68 -96
- package/dist/pages/search/SearchManager.js +60 -65
- package/dist/pages/search/SearchPicturePage.js +16 -44
- package/dist/pages/search/components/ChatRecords.js +46 -74
- package/dist/pages/search/components/MyGroupChat.js +41 -69
- package/dist/pages/search/components/PictureMulipleBar.js +35 -63
- package/dist/pages/search/components/SearchFileList.js +59 -64
- package/dist/pages/search/components/SearchPictures.js +68 -98
- package/dist/pages/search/components/SearchShareLinkList.js +50 -55
- package/dist/pages/search/components/SearchUser.js +25 -53
- package/dist/pages/search/components/useSearchMessage.js +12 -16
- package/dist/pages/search/search.routes.js +11 -17
- package/dist/pages/search/utils.js +4 -12
- package/dist/pages/types.js +1 -2
- package/dist/slice/contact/contact.action.js +1 -2
- package/dist/slice/contact/contact.slice.js +4 -8
- package/dist/slice/index.js +7 -13
- package/dist/slice/panel/panel.slice.d.ts +2 -1
- package/dist/slice/panel/panel.slice.js +8 -7
- package/dist/slice/video/video.action.d.ts +1 -0
- package/dist/slice/video/video.action.js +56 -38
- package/dist/slice/video/video.slice.d.ts +1 -1
- package/dist/slice/video/video.slice.js +7 -8
- package/dist/utils/audio.d.ts +3 -0
- package/dist/utils/audio.js +10 -0
- package/dist/utils/color.js +2 -9
- package/dist/utils/common-action-sheet.js +9 -14
- package/dist/utils/cookie.js +6 -14
- package/dist/utils/emoji.js +9 -12
- package/dist/utils/file-icon.js +33 -60
- package/dist/utils/file-operate.js +1 -2
- package/dist/utils/file.d.ts +1 -1
- package/dist/utils/file.js +74 -87
- package/dist/utils/golden-rectangle.js +3 -7
- package/dist/utils/phone.js +13 -22
- package/dist/utils/request.js +7 -15
- package/dist/utils/scroll.js +5 -9
- package/dist/utils/summary.js +4 -11
- package/dist/utils/take-camera.js +12 -19
- package/dist/utils/text-mix.js +4 -11
- package/dist/utils/upload.js +20 -41
- package/package.json +6 -7
@@ -1,27 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.Line = exports.CardInfo = void 0;
|
7
|
-
const react_1 = __importDefault(require("react"));
|
8
|
-
const react_native_1 = require("react-native");
|
9
|
-
const CardInfo = (props) => {
|
1
|
+
import React from 'react';
|
2
|
+
import { View, TouchableHighlight, StyleSheet } from 'react-native';
|
3
|
+
export const CardInfo = (props) => {
|
10
4
|
const { children, style } = props;
|
11
|
-
return <
|
5
|
+
return <View style={[styles.cardInfo, style]}>{children}</View>;
|
12
6
|
};
|
13
|
-
|
14
|
-
const Line = (props) => {
|
7
|
+
export const Line = (props) => {
|
15
8
|
const { children, style, onPress, onLongPress } = props;
|
16
9
|
if (onPress || onLongPress) {
|
17
|
-
return (<
|
18
|
-
<
|
19
|
-
</
|
10
|
+
return (<TouchableHighlight style={[style, { borderTopWidth: 0 }]} onLongPress={onLongPress} onPress={onPress}>
|
11
|
+
<View style={[styles.line, style]}>{children}</View>
|
12
|
+
</TouchableHighlight>);
|
20
13
|
}
|
21
|
-
return <
|
14
|
+
return <View style={[styles.line, style]}>{children}</View>;
|
22
15
|
};
|
23
|
-
|
24
|
-
const styles = react_native_1.StyleSheet.create({
|
16
|
+
const styles = StyleSheet.create({
|
25
17
|
cardInfo: {
|
26
18
|
marginTop: 10,
|
27
19
|
},
|
@@ -1,27 +1,3 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
26
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
27
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -31,21 +7,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
31
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
32
8
|
});
|
33
9
|
};
|
34
|
-
|
35
|
-
|
36
|
-
};
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
const contact_slice_1 = require("../../slice/contact/contact.slice");
|
46
|
-
const Organization_1 = require("./Organization");
|
47
|
-
const react_redux_1 = require("react-redux");
|
48
|
-
const user_1 = require("../../api/user");
|
10
|
+
import React, { useEffect, useState } from 'react';
|
11
|
+
import { StyleSheet, View, Text, TouchableOpacity, ScrollView } from 'react-native';
|
12
|
+
import { dp, ListRow, NavigationPage, SearchInput } from '@smart-link/rn-ui';
|
13
|
+
import useTranslation from '../../hooks/useTranslation';
|
14
|
+
import { useContact, useConversation } from '../../hooks/useImSelector';
|
15
|
+
import { getImManager } from '../../init';
|
16
|
+
import { ConversationActions } from '@smart-link/im-base';
|
17
|
+
import { onSelectUser, resetState, onDefaultCheckedUser } from '../../slice/contact/contact.slice';
|
18
|
+
import { RenderUserItem } from './Organization';
|
19
|
+
import { useDispatch } from 'react-redux';
|
20
|
+
import { queryUserByIds, searchUser } from '../../api/user';
|
49
21
|
const rootEntry = [
|
50
22
|
{
|
51
23
|
name: 'organization',
|
@@ -58,31 +30,31 @@ const rootEntry = [
|
|
58
30
|
];
|
59
31
|
const ChooseContact = ({ navigation, route: { params } }) => {
|
60
32
|
const { checkedIds = [] } = params;
|
61
|
-
const { t } = (
|
62
|
-
const dispatch =
|
63
|
-
const { currentConversation } =
|
64
|
-
const { selectUsers, choosePurpose } =
|
65
|
-
const [keyword, setKeyword] =
|
66
|
-
const [userList, setUserList] =
|
33
|
+
const { t } = useTranslation();
|
34
|
+
const dispatch = useDispatch();
|
35
|
+
const { currentConversation } = useConversation();
|
36
|
+
const { selectUsers, choosePurpose } = useContact();
|
37
|
+
const [keyword, setKeyword] = useState('');
|
38
|
+
const [userList, setUserList] = useState([]);
|
67
39
|
const selectCount = Object.keys(selectUsers).length;
|
68
|
-
|
40
|
+
useEffect(() => {
|
69
41
|
navigation.setOptions({
|
70
42
|
title: t('selectContacts'),
|
71
|
-
headerRight: () => (<
|
43
|
+
headerRight: () => (<TouchableOpacity onPress={() => __awaiter(void 0, void 0, void 0, function* () {
|
72
44
|
if (!selectCount) {
|
73
45
|
navigation.goBack();
|
74
46
|
return;
|
75
47
|
}
|
76
48
|
// 处理确认事件
|
77
|
-
const imManager =
|
49
|
+
const imManager = getImManager();
|
78
50
|
const list = Object.values(selectUsers);
|
79
51
|
if (choosePurpose === 'createGroup') {
|
80
|
-
yield imManager.store.dispatch(
|
52
|
+
yield imManager.store.dispatch(ConversationActions.groupOriginate(imManager, {
|
81
53
|
selectUserList: list,
|
82
54
|
}));
|
83
55
|
}
|
84
56
|
if (choosePurpose === 'addMember') {
|
85
|
-
yield imManager.store.dispatch(
|
57
|
+
yield imManager.store.dispatch(ConversationActions.addGroupMembers(imManager, {
|
86
58
|
selectUserList: list,
|
87
59
|
}));
|
88
60
|
}
|
@@ -91,66 +63,66 @@ const ChooseContact = ({ navigation, route: { params } }) => {
|
|
91
63
|
}
|
92
64
|
navigation.goBack();
|
93
65
|
})} style={{ width: 120 }}>
|
94
|
-
<
|
66
|
+
<Text style={{
|
95
67
|
color: '#fff',
|
96
68
|
textAlign: 'right',
|
97
|
-
fontSize:
|
69
|
+
fontSize: dp(14),
|
98
70
|
}}>
|
99
71
|
{selectCount ? `${t('confirm')}(${selectCount})` : t('cancel')}
|
100
|
-
</
|
101
|
-
</
|
72
|
+
</Text>
|
73
|
+
</TouchableOpacity>),
|
102
74
|
});
|
103
75
|
const remove = navigation.addListener('beforeRemove', () => {
|
104
|
-
|
76
|
+
getImManager().store.dispatch(resetState());
|
105
77
|
});
|
106
78
|
return () => {
|
107
79
|
remove();
|
108
80
|
};
|
109
81
|
}, [t, currentConversation, choosePurpose, selectCount, navigation]);
|
110
|
-
|
82
|
+
useEffect(() => {
|
111
83
|
if (checkedIds.length) {
|
112
|
-
|
113
|
-
dispatch(
|
84
|
+
queryUserByIds(checkedIds).then(resp => {
|
85
|
+
dispatch(onDefaultCheckedUser(resp.data));
|
114
86
|
setUserList(resp.data);
|
115
87
|
});
|
116
88
|
}
|
117
89
|
}, [checkedIds]);
|
118
|
-
|
90
|
+
useEffect(() => {
|
119
91
|
if (!keyword || keyword === '') {
|
120
92
|
return;
|
121
93
|
}
|
122
|
-
|
94
|
+
searchUser({
|
123
95
|
searchKey: keyword,
|
124
96
|
pageSize: 50,
|
125
97
|
}).then(({ data }) => {
|
126
98
|
setUserList(data);
|
127
99
|
});
|
128
100
|
}, [keyword]);
|
129
|
-
return (<
|
130
|
-
<
|
131
|
-
<
|
101
|
+
return (<NavigationPage noPadding scroll={false}>
|
102
|
+
<View style={{ height: 10 }}/>
|
103
|
+
<SearchInput style={{ marginHorizontal: 10 }} onSubmitEditing={e => {
|
132
104
|
setKeyword(e.nativeEvent.text);
|
133
105
|
}} placeholder={t('search')}/>
|
134
|
-
<
|
135
|
-
<
|
136
|
-
{userList.length > 0 ? (<
|
137
|
-
{userList.map((item) => (<
|
138
|
-
dispatch(
|
139
|
-
}} title={<
|
140
|
-
</
|
141
|
-
<
|
142
|
-
</
|
143
|
-
</
|
144
|
-
</
|
106
|
+
<View style={{ height: 8 }}/>
|
107
|
+
<View style={{ flex: 1 }}>
|
108
|
+
{userList.length > 0 ? (<ScrollView contentContainerStyle={{ paddingBottom: 20 }}>
|
109
|
+
{userList.map((item) => (<ListRow key={item.userId} onPress={() => {
|
110
|
+
dispatch(onSelectUser(item));
|
111
|
+
}} title={<RenderUserItem disabled checkable={true} checked={!!selectUsers[item.userId]} data={item}/>} topSeparator="full" accessory="none"/>))}
|
112
|
+
</ScrollView>) : (<View style={[styles.noData]}>
|
113
|
+
<Text>{t('noData')}</Text>
|
114
|
+
</View>)}
|
115
|
+
</View>
|
116
|
+
</NavigationPage>);
|
145
117
|
};
|
146
|
-
const styles =
|
118
|
+
const styles = StyleSheet.create({
|
147
119
|
orgInfo: {
|
148
120
|
paddingTop: 20,
|
149
121
|
backgroundColor: '#f1f1f1',
|
150
122
|
textAlignVertical: 'center',
|
151
123
|
},
|
152
124
|
orgLine: {
|
153
|
-
width:
|
125
|
+
width: dp(350),
|
154
126
|
flexDirection: 'row',
|
155
127
|
alignItems: 'center',
|
156
128
|
},
|
@@ -159,7 +131,7 @@ const styles = react_native_1.StyleSheet.create({
|
|
159
131
|
borderTopWidth: 1,
|
160
132
|
},
|
161
133
|
compName: {
|
162
|
-
width:
|
134
|
+
width: dp(305),
|
163
135
|
fontSize: 16,
|
164
136
|
fontWeight: '500',
|
165
137
|
textAlignVertical: 'center',
|
@@ -194,4 +166,4 @@ const styles = react_native_1.StyleSheet.create({
|
|
194
166
|
justifyContent: 'center',
|
195
167
|
},
|
196
168
|
});
|
197
|
-
|
169
|
+
export default ChooseContact;
|
@@ -1,16 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.Unfold = void 0;
|
7
|
-
const rn_ui_1 = require("@smart-link/rn-ui");
|
8
|
-
const react_1 = __importDefault(require("react"));
|
9
|
-
const react_native_svg_1 = require("react-native-svg");
|
10
|
-
const Unfold = (props) => {
|
1
|
+
import { dp } from '@smart-link/rn-ui';
|
2
|
+
import React from 'react';
|
3
|
+
import { Svg, Path } from 'react-native-svg';
|
4
|
+
export const Unfold = (props) => {
|
11
5
|
const { size = 32, color } = props || {};
|
12
|
-
return (<
|
13
|
-
<
|
14
|
-
</
|
6
|
+
return (<Svg viewBox="0 0 1024 1024" width={dp(size)} height={dp(size)}>
|
7
|
+
<Path d="M832 800H256a32 32 0 0 1-32-32V192a32 32 0 0 1 64 0v544h544a32 32 0 1 1 0 64z" fill={color}/>
|
8
|
+
</Svg>);
|
15
9
|
};
|
16
|
-
exports.Unfold = Unfold;
|
@@ -1,46 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
-
};
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
exports.RenderUserItem = void 0;
|
30
|
-
const rn_ui_1 = require("@smart-link/rn-ui");
|
31
|
-
const react_1 = __importStar(require("react"));
|
32
|
-
const react_native_1 = require("react-native");
|
33
|
-
const useTranslation_1 = require("../../hooks/useTranslation");
|
34
|
-
const addressList_1 = require("../../api/addressList");
|
35
|
-
const ChatAvatar_1 = __importDefault(require("../../components/ChatAvatar/ChatAvatar"));
|
1
|
+
import { CaihIcon as Icon, dp, ListRow, Loading, NavigationPage, SearchBar, useTheme, Checkbox, } from '@smart-link/rn-ui';
|
2
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
3
|
+
import { ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
4
|
+
import { useTranslationAddrList } from '../../hooks/useTranslation';
|
5
|
+
import { listTree, listUser } from '../../api/addressList';
|
6
|
+
import ChatAvatar from '../../components/ChatAvatar/ChatAvatar';
|
36
7
|
const Organization = ({ navigation, route: { params } }) => {
|
37
|
-
const [orgPath, setOrgPath] =
|
38
|
-
const [orgList, setOrgList] =
|
39
|
-
const [userList, setUserList] =
|
40
|
-
const [loading, setLoading] =
|
41
|
-
const { t } =
|
42
|
-
const orgPathScroll =
|
43
|
-
|
8
|
+
const [orgPath, setOrgPath] = useState([]);
|
9
|
+
const [orgList, setOrgList] = useState([]);
|
10
|
+
const [userList, setUserList] = useState([]);
|
11
|
+
const [loading, setLoading] = useState(false);
|
12
|
+
const { t } = useTranslationAddrList();
|
13
|
+
const orgPathScroll = useRef(null);
|
14
|
+
useEffect(() => {
|
44
15
|
navigation.setOptions({ title: t('addressList') });
|
45
16
|
if (!params) {
|
46
17
|
return;
|
@@ -53,7 +24,7 @@ const Organization = ({ navigation, route: { params } }) => {
|
|
53
24
|
]);
|
54
25
|
queryListTree(params.groupRootIds);
|
55
26
|
}, [params]);
|
56
|
-
const onPressSearch =
|
27
|
+
const onPressSearch = useCallback(() => {
|
57
28
|
console.log('onPressSearch: ');
|
58
29
|
navigation.navigate('UserSearch', {});
|
59
30
|
}, [navigation]);
|
@@ -75,7 +46,7 @@ const Organization = ({ navigation, route: { params } }) => {
|
|
75
46
|
};
|
76
47
|
const queryListTree = (parentId) => {
|
77
48
|
setLoading(true);
|
78
|
-
|
49
|
+
listTree({
|
79
50
|
groupCatId: params === null || params === void 0 ? void 0 : params.groupCategoryId,
|
80
51
|
parentId,
|
81
52
|
groupStatus: 'valid',
|
@@ -93,7 +64,7 @@ const Organization = ({ navigation, route: { params } }) => {
|
|
93
64
|
};
|
94
65
|
const queryUserList = (item) => {
|
95
66
|
setLoading(true);
|
96
|
-
|
67
|
+
listUser({
|
97
68
|
groupCategoryId: item.groupId,
|
98
69
|
groupId: '',
|
99
70
|
groupIdPathLike: item.groupIdPath,
|
@@ -113,7 +84,7 @@ const Organization = ({ navigation, route: { params } }) => {
|
|
113
84
|
};
|
114
85
|
const changeOrg = (org, index) => {
|
115
86
|
setLoading(true);
|
116
|
-
|
87
|
+
listTree({
|
117
88
|
groupCatId: params === null || params === void 0 ? void 0 : params.groupCategoryId,
|
118
89
|
parentId: org.id,
|
119
90
|
groupStatus: 'valid',
|
@@ -140,40 +111,40 @@ const Organization = ({ navigation, route: { params } }) => {
|
|
140
111
|
orgPathScroll.current.scrollTo({ x: 0, y: 0, animated: false });
|
141
112
|
}
|
142
113
|
};
|
143
|
-
return (<
|
144
|
-
<
|
145
|
-
<
|
146
|
-
<
|
114
|
+
return (<NavigationPage noPadding>
|
115
|
+
<View style={{ height: 10 }}/>
|
116
|
+
<SearchBar onSearch={onPressSearch}/>
|
117
|
+
<View style={{ height: 8 }}/>
|
147
118
|
|
148
|
-
{orgPath.length > 0 && (<
|
149
|
-
<
|
119
|
+
{orgPath.length > 0 && (<View style={styles.orgBreadcrumb}>
|
120
|
+
<ScrollView ref={orgPathScroll} horizontal={true} onContentSizeChange={scrollOrgPath} onLayout={scrollOrgPath} showsHorizontalScrollIndicator={false} contentContainerStyle={{ paddingRight: 40 }}>
|
150
121
|
{orgPath.map((path, index) => {
|
151
122
|
if (index !== orgPath.length - 1) {
|
152
|
-
return (<
|
123
|
+
return (<TouchableOpacity key={path.id} onPress={() => changeOrg(path, index)}>
|
153
124
|
<RenderPathItem path={path} index={index} orgPath={orgPath} active/>
|
154
|
-
</
|
125
|
+
</TouchableOpacity>);
|
155
126
|
}
|
156
127
|
return <RenderPathItem path={path} key={path.id} index={index} orgPath={orgPath}/>;
|
157
128
|
})}
|
158
|
-
</
|
159
|
-
</
|
160
|
-
<
|
129
|
+
</ScrollView>
|
130
|
+
</View>)}
|
131
|
+
<ScrollView style={{ flex: 1 }}>
|
161
132
|
{orgList.length > 0 &&
|
162
|
-
orgList.map((org) => (<
|
133
|
+
orgList.map((org) => (<ListRow key={org.groupId} onPress={() => handleGroupCategory(org)} title={org.groupName} topSeparator="full"/>))}
|
163
134
|
{userList.length > 0 &&
|
164
|
-
userList.map((item) => (<
|
165
|
-
{userList.length === 0 && orgList.length === 0 && (<
|
166
|
-
<
|
167
|
-
</
|
168
|
-
</
|
169
|
-
<
|
170
|
-
</
|
135
|
+
userList.map((item) => (<ListRow key={item.userId} onPress={() => handleUser(item)} title={<RenderUserItem data={item}/>} topSeparator="full"/>))}
|
136
|
+
{userList.length === 0 && orgList.length === 0 && (<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
|
137
|
+
<Text>{t('noData')}</Text>
|
138
|
+
</View>)}
|
139
|
+
</ScrollView>
|
140
|
+
<Loading loading={loading} loadingText={t('loading')}/>
|
141
|
+
</NavigationPage>);
|
171
142
|
};
|
172
143
|
const RenderPathItem = (props) => {
|
173
144
|
const { path, index, active, orgPath } = props;
|
174
|
-
const theme =
|
175
|
-
return (<
|
176
|
-
<
|
145
|
+
const theme = useTheme();
|
146
|
+
return (<View key={index} style={[styles.orgPathItem]}>
|
147
|
+
<Text style={{
|
177
148
|
textAlignVertical: 'center',
|
178
149
|
fontSize: 16,
|
179
150
|
height: 40,
|
@@ -181,41 +152,40 @@ const RenderPathItem = (props) => {
|
|
181
152
|
color: active ? theme.primaryColor : '#A3A5A8',
|
182
153
|
}}>
|
183
154
|
{path.groupName}
|
184
|
-
</
|
185
|
-
{index !== orgPath.length - 1 && (<
|
155
|
+
</Text>
|
156
|
+
{index !== orgPath.length - 1 && (<Icon style={{
|
186
157
|
textAlignVertical: 'center',
|
187
158
|
height: 40,
|
188
159
|
lineHeight: 40,
|
189
160
|
}} name="list-arrow" size={18} color={'#bbb'}/>)}
|
190
|
-
</
|
161
|
+
</View>);
|
191
162
|
};
|
192
|
-
const RenderUserItem = (props) => {
|
163
|
+
export const RenderUserItem = (props) => {
|
193
164
|
const { data, checkable, disabled, checked } = props;
|
194
|
-
return (<
|
195
|
-
{checkable && (<
|
196
|
-
<
|
197
|
-
</
|
198
|
-
<
|
199
|
-
<
|
200
|
-
</
|
165
|
+
return (<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
166
|
+
{checkable && (<View style={{ marginRight: 10 }}>
|
167
|
+
<Checkbox style={disabled ? { pointerEvents: 'none' } : undefined} checked={checked}/>
|
168
|
+
</View>)}
|
169
|
+
<ChatAvatar disabled={disabled} size={dp(40)} id={data.userId} url={data.avatars} name={data.userName}/>
|
170
|
+
<Text style={{ marginLeft: dp(10), fontSize: 16, color: '#333' }}>{data.userName}</Text>
|
171
|
+
</View>);
|
201
172
|
};
|
202
|
-
|
203
|
-
const styles = react_native_1.StyleSheet.create({
|
173
|
+
const styles = StyleSheet.create({
|
204
174
|
orgBreadcrumb: {
|
205
175
|
backgroundColor: '#fff',
|
206
|
-
marginBottom:
|
207
|
-
paddingHorizontal:
|
176
|
+
marginBottom: dp(10),
|
177
|
+
paddingHorizontal: dp(10),
|
208
178
|
},
|
209
179
|
orgPathItem: {
|
210
|
-
height:
|
211
|
-
lineHeight:
|
180
|
+
height: dp(40),
|
181
|
+
lineHeight: dp(40),
|
212
182
|
flexDirection: 'row',
|
213
183
|
backgroundColor: '#fff',
|
214
184
|
},
|
215
185
|
avatars: {
|
216
|
-
height:
|
217
|
-
width:
|
218
|
-
borderRadius:
|
186
|
+
height: dp(40),
|
187
|
+
width: dp(40),
|
188
|
+
borderRadius: dp(20),
|
219
189
|
},
|
220
190
|
});
|
221
|
-
|
191
|
+
export default Organization;
|