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