fcr-ui-scene-mobile 3.4.0
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/lib/assets/ground_glass_bg.png +0 -0
- package/lib/base.d.ts +11 -0
- package/lib/base.js +39 -0
- package/lib/common/device-store.d.ts +86 -0
- package/lib/common/device-store.js +642 -0
- package/lib/common/device-stream-store.d.ts +26 -0
- package/lib/common/device-stream-store.js +298 -0
- package/lib/common/event-store.d.ts +124 -0
- package/lib/common/event-store.js +249 -0
- package/lib/common/global-context.d.ts +11 -0
- package/lib/common/global-context.js +9 -0
- package/lib/common/member-list-data-source.d.ts +28 -0
- package/lib/common/member-list-data-source.js +305 -0
- package/lib/common/participant-store.d.ts +195 -0
- package/lib/common/participant-store.js +1577 -0
- package/lib/common/security-store.d.ts +119 -0
- package/lib/common/security-store.js +948 -0
- package/lib/common/setting-store.d.ts +181 -0
- package/lib/common/setting-store.js +797 -0
- package/lib/common/type.d.ts +73 -0
- package/lib/common/type.js +22 -0
- package/lib/config/default-config.d.ts +32 -0
- package/lib/config/default-config.js +39 -0
- package/lib/config/setting-config.d.ts +16 -0
- package/lib/config/setting-config.js +17 -0
- package/lib/creator.d.ts +10 -0
- package/lib/creator.js +49 -0
- package/lib/global.d.ts +8 -0
- package/lib/hooks/meeting-time.d.ts +15 -0
- package/lib/hooks/meeting-time.js +92 -0
- package/lib/hooks/useIsNodePresent.d.ts +4 -0
- package/lib/hooks/useIsNodePresent.js +53 -0
- package/lib/hooks/useOnRefMount.d.ts +2 -0
- package/lib/hooks/useOnRefMount.js +27 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +50 -0
- package/lib/mobile-global.css +28 -0
- package/lib/modules/action-bar/bottom-icons.d.ts +17 -0
- package/lib/modules/action-bar/bottom-icons.js +160 -0
- package/lib/modules/action-bar/context.d.ts +2 -0
- package/lib/modules/action-bar/context.js +9 -0
- package/lib/modules/action-bar/index.css +33 -0
- package/lib/modules/action-bar/index.d.ts +27 -0
- package/lib/modules/action-bar/index.js +46 -0
- package/lib/modules/action-bar/member-list-popup/attendee/index.css +130 -0
- package/lib/modules/action-bar/member-list-popup/attendee/index.d.ts +19 -0
- package/lib/modules/action-bar/member-list-popup/attendee/index.js +252 -0
- package/lib/modules/action-bar/member-list-popup/attendee/list.d.ts +1 -0
- package/lib/modules/action-bar/member-list-popup/attendee/list.js +82 -0
- package/lib/modules/action-bar/member-list-popup/index.css +35 -0
- package/lib/modules/action-bar/member-list-popup/index.d.ts +7 -0
- package/lib/modules/action-bar/member-list-popup/index.js +40 -0
- package/lib/modules/action-bar/member-list-popup/participant-more-actions/index.css +0 -0
- package/lib/modules/action-bar/member-list-popup/participant-more-actions/index.d.ts +12 -0
- package/lib/modules/action-bar/member-list-popup/participant-more-actions/index.js +58 -0
- package/lib/modules/action-bar/more-popup/index.css +71 -0
- package/lib/modules/action-bar/more-popup/index.d.ts +2 -0
- package/lib/modules/action-bar/more-popup/index.js +126 -0
- package/lib/modules/action-bar/store.d.ts +196 -0
- package/lib/modules/action-bar/store.js +1425 -0
- package/lib/modules/action-bar/type.d.ts +6 -0
- package/lib/modules/action-bar/type.js +13 -0
- package/lib/modules/action-bar/view.d.ts +2 -0
- package/lib/modules/action-bar/view.js +75 -0
- package/lib/modules/audio-stream/ index.d.ts +19 -0
- package/lib/modules/audio-stream/ index.js +109 -0
- package/lib/modules/audio-stream/index.d.ts +25 -0
- package/lib/modules/audio-stream/index.js +135 -0
- package/lib/modules/chat/chat-bar/index.css +97 -0
- package/lib/modules/chat/chat-bar/index.d.ts +12 -0
- package/lib/modules/chat/chat-bar/index.js +129 -0
- package/lib/modules/chat/chat-notification/index.css +71 -0
- package/lib/modules/chat/chat-notification/index.d.ts +3 -0
- package/lib/modules/chat/chat-notification/index.js +75 -0
- package/lib/modules/chat/chat-select/index.css +183 -0
- package/lib/modules/chat/chat-select/index.d.ts +12 -0
- package/lib/modules/chat/chat-select/index.js +223 -0
- package/lib/modules/chat/contex.d.ts +2 -0
- package/lib/modules/chat/contex.js +9 -0
- package/lib/modules/chat/demo-wrapper.d.ts +1 -0
- package/lib/modules/chat/demo-wrapper.js +42 -0
- package/lib/modules/chat/index.css +108 -0
- package/lib/modules/chat/index.d.ts +28 -0
- package/lib/modules/chat/index.dev.d.ts +1 -0
- package/lib/modules/chat/index.dev.js +58 -0
- package/lib/modules/chat/index.js +208 -0
- package/lib/modules/chat/message-list.d.ts +22 -0
- package/lib/modules/chat/message-list.js +617 -0
- package/lib/modules/chat/mock.d.ts +2 -0
- package/lib/modules/chat/mock.js +283 -0
- package/lib/modules/chat/store.d.ts +183 -0
- package/lib/modules/chat/store.js +1101 -0
- package/lib/modules/chat/util.d.ts +6 -0
- package/lib/modules/chat/util.js +69 -0
- package/lib/modules/chat/view.d.ts +11 -0
- package/lib/modules/chat/view.js +414 -0
- package/lib/modules/layout/bottom-drawer/index.css +34 -0
- package/lib/modules/layout/bottom-drawer/index.d.ts +3 -0
- package/lib/modules/layout/bottom-drawer/index.js +129 -0
- package/lib/modules/layout/components/Layout.d.ts +1 -0
- package/lib/modules/layout/components/Layout.js +98 -0
- package/lib/modules/layout/components/equip-request-popup/index.css +30 -0
- package/lib/modules/layout/components/equip-request-popup/index.d.ts +3 -0
- package/lib/modules/layout/components/equip-request-popup/index.js +78 -0
- package/lib/modules/layout/components/index.css +78 -0
- package/lib/modules/layout/components/index.d.ts +2 -0
- package/lib/modules/layout/components/index.js +25 -0
- package/lib/modules/layout/context.d.ts +2 -0
- package/lib/modules/layout/context.js +9 -0
- package/lib/modules/layout/drawer-header/index.css +27 -0
- package/lib/modules/layout/drawer-header/index.d.ts +10 -0
- package/lib/modules/layout/drawer-header/index.js +54 -0
- package/lib/modules/layout/index.css +22 -0
- package/lib/modules/layout/index.d.ts +8 -0
- package/lib/modules/layout/index.js +47 -0
- package/lib/modules/layout/store.d.ts +59 -0
- package/lib/modules/layout/store.js +379 -0
- package/lib/modules/layout/type.d.ts +65 -0
- package/lib/modules/layout/type.js +52 -0
- package/lib/modules/layout/view.d.ts +2 -0
- package/lib/modules/layout/view.js +10 -0
- package/lib/modules/member-layout/context.d.ts +2 -0
- package/lib/modules/member-layout/context.js +9 -0
- package/lib/modules/member-layout/data.d.ts +2 -0
- package/lib/modules/member-layout/data.js +304 -0
- package/lib/modules/member-layout/grid/index.css +98 -0
- package/lib/modules/member-layout/grid/index.d.ts +21 -0
- package/lib/modules/member-layout/grid/index.js +316 -0
- package/lib/modules/member-layout/index.css +88 -0
- package/lib/modules/member-layout/index.d.ts +8 -0
- package/lib/modules/member-layout/index.js +45 -0
- package/lib/modules/member-layout/share-toast/index.css +30 -0
- package/lib/modules/member-layout/share-toast/index.d.ts +5 -0
- package/lib/modules/member-layout/share-toast/index.js +43 -0
- package/lib/modules/member-layout/speaker/index.css +30 -0
- package/lib/modules/member-layout/speaker/index.d.ts +9 -0
- package/lib/modules/member-layout/speaker/index.js +28 -0
- package/lib/modules/member-layout/store.d.ts +70 -0
- package/lib/modules/member-layout/store.js +479 -0
- package/lib/modules/member-layout/user/index.css +121 -0
- package/lib/modules/member-layout/user/index.d.ts +34 -0
- package/lib/modules/member-layout/user/index.js +355 -0
- package/lib/modules/member-layout/user/types.d.ts +16 -0
- package/lib/modules/member-layout/user/types.js +6 -0
- package/lib/modules/member-layout/view.d.ts +2 -0
- package/lib/modules/member-layout/view.js +225 -0
- package/lib/modules/state-bar/context.d.ts +2 -0
- package/lib/modules/state-bar/context.js +9 -0
- package/lib/modules/state-bar/index.css +79 -0
- package/lib/modules/state-bar/index.d.ts +17 -0
- package/lib/modules/state-bar/index.js +55 -0
- package/lib/modules/state-bar/leaving-room/index.css +14 -0
- package/lib/modules/state-bar/leaving-room/index.d.ts +7 -0
- package/lib/modules/state-bar/leaving-room/index.js +38 -0
- package/lib/modules/state-bar/meeting-detail/index.css +72 -0
- package/lib/modules/state-bar/meeting-detail/index.d.ts +2 -0
- package/lib/modules/state-bar/meeting-detail/index.js +59 -0
- package/lib/modules/state-bar/meeting-detail/meeting-info/copy.d.ts +4 -0
- package/lib/modules/state-bar/meeting-detail/meeting-info/copy.js +81 -0
- package/lib/modules/state-bar/meeting-detail/meeting-info/index.css +92 -0
- package/lib/modules/state-bar/meeting-detail/meeting-info/index.d.ts +2 -0
- package/lib/modules/state-bar/meeting-detail/meeting-info/index.js +188 -0
- package/lib/modules/state-bar/meeting-detail/net-quality/index.css +27 -0
- package/lib/modules/state-bar/meeting-detail/net-quality/index.d.ts +2 -0
- package/lib/modules/state-bar/meeting-detail/net-quality/index.js +87 -0
- package/lib/modules/state-bar/store.d.ts +76 -0
- package/lib/modules/state-bar/store.js +561 -0
- package/lib/modules/state-bar/view.d.ts +7 -0
- package/lib/modules/state-bar/view.js +215 -0
- package/lib/modules/whiteboard/app.d.ts +2 -0
- package/lib/modules/whiteboard/app.js +41 -0
- package/lib/modules/whiteboard/components/control-bar/index.css +53 -0
- package/lib/modules/whiteboard/components/control-bar/index.d.ts +2 -0
- package/lib/modules/whiteboard/components/control-bar/index.js +156 -0
- package/lib/modules/whiteboard/components/control-bar/store.d.ts +35 -0
- package/lib/modules/whiteboard/components/control-bar/store.js +288 -0
- package/lib/modules/whiteboard/components/loading/index.css +76 -0
- package/lib/modules/whiteboard/components/loading/index.d.ts +2 -0
- package/lib/modules/whiteboard/components/loading/index.js +68 -0
- package/lib/modules/whiteboard/components/loading/loading.png +0 -0
- package/lib/modules/whiteboard/components/multi-window/index.css +65 -0
- package/lib/modules/whiteboard/components/multi-window/index.d.ts +5 -0
- package/lib/modules/whiteboard/components/multi-window/index.js +39 -0
- package/lib/modules/whiteboard/components/pagination/index.css +228 -0
- package/lib/modules/whiteboard/components/pagination/index.d.ts +15 -0
- package/lib/modules/whiteboard/components/pagination/index.js +163 -0
- package/lib/modules/whiteboard/components/pagination/store.d.ts +18 -0
- package/lib/modules/whiteboard/components/pagination/store.js +17 -0
- package/lib/modules/whiteboard/components/progress/index.d.ts +5 -0
- package/lib/modules/whiteboard/components/progress/index.js +43 -0
- package/lib/modules/whiteboard/components/progress/style.css +52 -0
- package/lib/modules/whiteboard/components/scene-pagination.d.ts +1 -0
- package/lib/modules/whiteboard/components/scene-pagination.js +30 -0
- package/lib/modules/whiteboard/components/switch-theme/index.css +98 -0
- package/lib/modules/whiteboard/components/switch-theme/index.d.ts +3 -0
- package/lib/modules/whiteboard/components/switch-theme/index.js +89 -0
- package/lib/modules/whiteboard/components/switch-theme/item.d.ts +9 -0
- package/lib/modules/whiteboard/components/switch-theme/item.js +53 -0
- package/lib/modules/whiteboard/components/switch-theme/libs.d.ts +4 -0
- package/lib/modules/whiteboard/components/switch-theme/libs.js +29 -0
- package/lib/modules/whiteboard/components/toolbar/ style.css +588 -0
- package/lib/modules/whiteboard/components/toolbar/components/color-picker/components/color.d.ts +5 -0
- package/lib/modules/whiteboard/components/toolbar/components/color-picker/components/color.js +38 -0
- package/lib/modules/whiteboard/components/toolbar/components/color-picker/components/panel.d.ts +1 -0
- package/lib/modules/whiteboard/components/toolbar/components/color-picker/components/panel.js +107 -0
- package/lib/modules/whiteboard/components/toolbar/components/color-picker/components/picker.d.ts +1 -0
- package/lib/modules/whiteboard/components/toolbar/components/color-picker/components/picker.js +59 -0
- package/lib/modules/whiteboard/components/toolbar/components/color-picker/index.d.ts +2 -0
- package/lib/modules/whiteboard/components/toolbar/components/color-picker/index.js +44 -0
- package/lib/modules/whiteboard/components/toolbar/components/eraser-picker.d.ts +4 -0
- package/lib/modules/whiteboard/components/toolbar/components/eraser-picker.js +89 -0
- package/lib/modules/whiteboard/components/toolbar/components/extra-tool-picker.d.ts +1 -0
- package/lib/modules/whiteboard/components/toolbar/components/extra-tool-picker.js +63 -0
- package/lib/modules/whiteboard/components/toolbar/components/history.d.ts +2 -0
- package/lib/modules/whiteboard/components/toolbar/components/history.js +46 -0
- package/lib/modules/whiteboard/components/toolbar/components/icons/fold-icon.d.ts +2 -0
- package/lib/modules/whiteboard/components/toolbar/components/icons/fold-icon.js +39 -0
- package/lib/modules/whiteboard/components/toolbar/components/icons/move-icon.d.ts +1 -0
- package/lib/modules/whiteboard/components/toolbar/components/icons/move-icon.js +66 -0
- package/lib/modules/whiteboard/components/toolbar/components/move-handle.d.ts +5 -0
- package/lib/modules/whiteboard/components/toolbar/components/move-handle.js +134 -0
- package/lib/modules/whiteboard/components/toolbar/components/pen-picker.d.ts +4 -0
- package/lib/modules/whiteboard/components/toolbar/components/pen-picker.js +106 -0
- package/lib/modules/whiteboard/components/toolbar/components/shape-picker.d.ts +4 -0
- package/lib/modules/whiteboard/components/toolbar/components/shape-picker.js +168 -0
- package/lib/modules/whiteboard/components/toolbar/hooks/index.d.ts +14 -0
- package/lib/modules/whiteboard/components/toolbar/hooks/index.js +211 -0
- package/lib/modules/whiteboard/components/toolbar/index.d.ts +2 -0
- package/lib/modules/whiteboard/components/toolbar/index.js +183 -0
- package/lib/modules/whiteboard/components/toolbar/store.d.ts +51 -0
- package/lib/modules/whiteboard/components/toolbar/store.js +248 -0
- package/lib/modules/whiteboard/context.d.ts +69 -0
- package/lib/modules/whiteboard/context.js +36 -0
- package/lib/modules/whiteboard/index.d.ts +119 -0
- package/lib/modules/whiteboard/index.js +1134 -0
- package/lib/modules/whiteboard/style.css +143 -0
- package/lib/modules/whiteboard/type.d.ts +94 -0
- package/lib/modules/whiteboard/type.js +89 -0
- package/lib/modules/whiteboard/utils.d.ts +12 -0
- package/lib/modules/whiteboard/utils.js +36 -0
- package/lib/plugins/css-preset-plugin.d.ts +1 -0
- package/lib/plugins/css-preset-plugin.js +29 -0
- package/lib/plugins/module-dev-plugin.d.ts +12 -0
- package/lib/plugins/module-dev-plugin.js +183 -0
- package/lib/plugins/multi-lang-plugin.d.ts +1 -0
- package/lib/plugins/multi-lang-plugin.js +19 -0
- package/lib/plugins/rtm-plugin.d.ts +1 -0
- package/lib/plugins/rtm-plugin.js +5 -0
- package/lib/plugins/web-rtc-plugin.d.ts +1 -0
- package/lib/plugins/web-rtc-plugin.js +5 -0
- package/lib/translations/enUS.d.ts +1855 -0
- package/lib/translations/enUS.js +1895 -0
- package/lib/translations/zhCN.d.ts +1852 -0
- package/lib/translations/zhCN.js +1892 -0
- package/lib/type.d.ts +121 -0
- package/lib/type.js +46 -0
- package/lib/ui-manager.d.ts +32 -0
- package/lib/ui-manager.js +426 -0
- package/lib/ui-scene.d.ts +14 -0
- package/lib/ui-scene.js +141 -0
- package/lib/utilities/board-context.d.ts +4 -0
- package/lib/utilities/board-context.js +12 -0
- package/lib/utilities/constant.d.ts +286 -0
- package/lib/utilities/constant.js +271 -0
- package/lib/utilities/copyText.d.ts +2 -0
- package/lib/utilities/copyText.js +43 -0
- package/lib/utilities/extract.d.ts +5 -0
- package/lib/utilities/extract.js +117 -0
- package/lib/utilities/hooks.d.ts +14 -0
- package/lib/utilities/hooks.js +101 -0
- package/lib/utilities/mute-action.d.ts +4 -0
- package/lib/utilities/mute-action.js +48 -0
- package/lib/utilities/parameters.d.ts +7 -0
- package/lib/utilities/parameters.js +20 -0
- package/lib/utilities/regex.d.ts +1 -0
- package/lib/utilities/regex.js +14 -0
- package/lib/utilities/tools.d.ts +27 -0
- package/lib/utilities/tools.js +169 -0
- package/lib/utilities/useNamespace.d.ts +15 -0
- package/lib/utilities/useNamespace.js +66 -0
- package/package.json +63 -0
|
@@ -0,0 +1,617 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.symbol.js");
|
|
4
|
+
require("core-js/modules/es.array.filter.js");
|
|
5
|
+
require("core-js/modules/es.array.for-each.js");
|
|
6
|
+
require("core-js/modules/es.array.push.js");
|
|
7
|
+
require("core-js/modules/es.object.define-properties.js");
|
|
8
|
+
require("core-js/modules/es.object.define-property.js");
|
|
9
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
10
|
+
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
11
|
+
require("core-js/modules/es.object.keys.js");
|
|
12
|
+
require("core-js/modules/es.weak-map.js");
|
|
13
|
+
require("core-js/modules/esnext.async-iterator.filter.js");
|
|
14
|
+
require("core-js/modules/esnext.async-iterator.for-each.js");
|
|
15
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
16
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
17
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
18
|
+
require("core-js/modules/esnext.weak-map.delete-all.js");
|
|
19
|
+
require("core-js/modules/esnext.weak-map.emplace.js");
|
|
20
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
21
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
22
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
23
|
+
Object.defineProperty(exports, "__esModule", {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
exports.MessageList = void 0;
|
|
27
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
28
|
+
require("core-js/modules/es.array.concat.js");
|
|
29
|
+
require("core-js/modules/es.array.find-index.js");
|
|
30
|
+
require("core-js/modules/es.array.iterator.js");
|
|
31
|
+
require("core-js/modules/es.map.js");
|
|
32
|
+
require("core-js/modules/es.object.to-string.js");
|
|
33
|
+
require("core-js/modules/es.string.iterator.js");
|
|
34
|
+
require("core-js/modules/esnext.map.delete-all.js");
|
|
35
|
+
require("core-js/modules/esnext.map.emplace.js");
|
|
36
|
+
require("core-js/modules/esnext.map.every.js");
|
|
37
|
+
require("core-js/modules/esnext.map.filter.js");
|
|
38
|
+
require("core-js/modules/esnext.map.find.js");
|
|
39
|
+
require("core-js/modules/esnext.map.find-key.js");
|
|
40
|
+
require("core-js/modules/esnext.map.includes.js");
|
|
41
|
+
require("core-js/modules/esnext.map.key-of.js");
|
|
42
|
+
require("core-js/modules/esnext.map.map-keys.js");
|
|
43
|
+
require("core-js/modules/esnext.map.map-values.js");
|
|
44
|
+
require("core-js/modules/esnext.map.merge.js");
|
|
45
|
+
require("core-js/modules/esnext.map.reduce.js");
|
|
46
|
+
require("core-js/modules/esnext.map.some.js");
|
|
47
|
+
require("core-js/modules/esnext.map.update.js");
|
|
48
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
49
|
+
require("core-js/modules/web.timers.js");
|
|
50
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
51
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
52
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
53
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
54
|
+
require("./index.css");
|
|
55
|
+
var _reactVirtualized = require("react-virtualized");
|
|
56
|
+
var _messageBubble = require("agora-ui-foundation/lib/components/message-bubble");
|
|
57
|
+
var _messageLabelMobile = require("agora-ui-foundation/lib/components/message-label-mobile");
|
|
58
|
+
var _avatar = require("agora-ui-foundation/lib/components/avatar");
|
|
59
|
+
var _util = require("./util");
|
|
60
|
+
var _textBubble = require("agora-ui-foundation/lib/components/text-bubble");
|
|
61
|
+
var _latestButton = require("agora-ui-foundation/lib/components/latest-button");
|
|
62
|
+
var _store = require("./store");
|
|
63
|
+
var _i18n = require("agora-ui-foundation/lib/i18n");
|
|
64
|
+
var _contex = require("./contex");
|
|
65
|
+
var _mobxReact = require("mobx-react");
|
|
66
|
+
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
67
|
+
var _multiSelect = require("agora-ui-foundation/lib/components/multi-select");
|
|
68
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
69
|
+
var _copyText = require("../../utilities/copyText");
|
|
70
|
+
var _icon = require("agora-ui-foundation/lib/components/icon");
|
|
71
|
+
var _type = require("agora-ui-foundation/lib/components/icon/type");
|
|
72
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
73
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
74
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
75
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
76
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // 当向上滚动时,且超出底部 10 条,点击需要回到底部,如果此时有新的消息,那么展示未读的新消息
|
|
77
|
+
// 当滚动条在最底部时,有新消息时,自动滚动到最新消息
|
|
78
|
+
// 初始化时,如果有历史消息未读,展示未读条数,并且要回到指定的位置
|
|
79
|
+
// 消息列表
|
|
80
|
+
// 显示的消息列表
|
|
81
|
+
// 未读消息列表
|
|
82
|
+
var genRequestAnimationFrame = function genRequestAnimationFrame(cb) {
|
|
83
|
+
return requestAnimationFrame(cb);
|
|
84
|
+
};
|
|
85
|
+
var MessageList = exports.MessageList = (0, _mobxReact.observer)(function (_ref) {
|
|
86
|
+
var updateReadMsgIndex = _ref.updateReadMsgIndex,
|
|
87
|
+
localUserId = _ref.userId,
|
|
88
|
+
setMultiSelectActive = _ref.setMultiSelectActive,
|
|
89
|
+
multiSelectActive = _ref.multiSelectActive,
|
|
90
|
+
copyMap = _ref.copyMap,
|
|
91
|
+
setCopyMap = _ref.setCopyMap,
|
|
92
|
+
selectCnt = _ref.selectCnt,
|
|
93
|
+
copyTips = _ref.copyTips;
|
|
94
|
+
var t = (0, _i18n.useI18n)();
|
|
95
|
+
var _useContext = (0, _react.useContext)(_contex.StoreContext),
|
|
96
|
+
chatRoomStores = _useContext.chatRoomStores,
|
|
97
|
+
activeTabIndex = _useContext.activeTabIndex;
|
|
98
|
+
var _ref2 = chatRoomStores[activeTabIndex],
|
|
99
|
+
storeMsgs = _ref2.messageList,
|
|
100
|
+
readMsgIndex = _ref2.readMsgIndex,
|
|
101
|
+
needCbBottomCount = _ref2.needCbBottomCount,
|
|
102
|
+
list = _ref2.list,
|
|
103
|
+
mostRecentHeight = _ref2.mostRecentHeight,
|
|
104
|
+
mostRecentWidth = _ref2.mostRecentWidth,
|
|
105
|
+
cache = _ref2.cache,
|
|
106
|
+
scrollHeight = _ref2.scrollHeight,
|
|
107
|
+
scrollTop = _ref2.scrollTop,
|
|
108
|
+
clientHeight = _ref2.clientHeight,
|
|
109
|
+
firstMsgId = _ref2.firstMsgId,
|
|
110
|
+
readIdx = _ref2.readIdx,
|
|
111
|
+
viewIdx = _ref2.viewIdx,
|
|
112
|
+
historyUnReadCount = _ref2.historyUnreadCount,
|
|
113
|
+
hasHistoryMsg = _ref2.hasHistoryMsg,
|
|
114
|
+
newMsgsUnReadCnt = _ref2.newMsgsUnReadCnt,
|
|
115
|
+
initReadInfo = _ref2.initReadInfo,
|
|
116
|
+
updateScrollInfo = _ref2.updateScrollInfo,
|
|
117
|
+
updateHasHistoryMsg = _ref2.updateHasHistoryMsg,
|
|
118
|
+
updateHistoryCnt = _ref2.updateHistoryUnreadCnt,
|
|
119
|
+
updateViewIdx = _ref2.updateViewIdx,
|
|
120
|
+
updateReadIdx = _ref2.updateReadIdx,
|
|
121
|
+
updateFirstMsgId = _ref2.updateFirstMsgId,
|
|
122
|
+
updateHistoryUnReadCount = _ref2.updateHistoryUnReadCount,
|
|
123
|
+
updateList = _ref2.updateList,
|
|
124
|
+
updateMostRecentHeight = _ref2.updateMostRecentHeight,
|
|
125
|
+
updateMostRecentWidth = _ref2.updateMostRecentWidth,
|
|
126
|
+
forceNotifyMsgs = _ref2.forceNotifyMsgs,
|
|
127
|
+
permitPrivateChat = _ref2.permitPrivateChat,
|
|
128
|
+
lastScrollTop = _ref2.lastScrollTop,
|
|
129
|
+
setLastScrollTop = _ref2.setLastScrollTop;
|
|
130
|
+
var _useState = (0, _react.useState)(storeMsgs !== null && storeMsgs !== void 0 ? storeMsgs : []),
|
|
131
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
132
|
+
messageList = _useState2[0],
|
|
133
|
+
setMessageList = _useState2[1];
|
|
134
|
+
var _useState3 = (0, _react.useState)(messageList.length - 1),
|
|
135
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
136
|
+
scrollIndex = _useState4[0],
|
|
137
|
+
setScrollIndex = _useState4[1];
|
|
138
|
+
var firstRowsRendered = undefined;
|
|
139
|
+
var _useState5 = (0, _react.useState)(false),
|
|
140
|
+
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
141
|
+
latestBtnVisible = _useState6[0],
|
|
142
|
+
setLatestBtnVisible = _useState6[1];
|
|
143
|
+
var latestBtnVisibleFlag = false;
|
|
144
|
+
var _useState7 = (0, _react.useState)(false),
|
|
145
|
+
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
146
|
+
historyMsgVisible = _useState8[0],
|
|
147
|
+
setHistoryMsgVisible = _useState8[1];
|
|
148
|
+
var latestBtnVisibleTimer = undefined;
|
|
149
|
+
// const [checkboxVisible, setCheckboxVisible] = useState<boolean>(false);
|
|
150
|
+
// const [copyMap, setCopyMap] = useState<Map<number, boolean>>(new Map());
|
|
151
|
+
|
|
152
|
+
(0, _react.useEffect)(function () {
|
|
153
|
+
initReadInfo();
|
|
154
|
+
return function () {
|
|
155
|
+
updateReadInfo();
|
|
156
|
+
clearTimeout(latestBtnVisibleTimer);
|
|
157
|
+
};
|
|
158
|
+
}, []);
|
|
159
|
+
var updateReadInfo = function updateReadInfo(data) {
|
|
160
|
+
updateReadMsgIndex && messageList.length > 0 && updateReadMsgIndex(data);
|
|
161
|
+
updateHistoryUnReadCount(0);
|
|
162
|
+
updateHasHistoryMsg(false);
|
|
163
|
+
};
|
|
164
|
+
(0, _react.useEffect)(function () {
|
|
165
|
+
setMessageList(storeMsgs);
|
|
166
|
+
}, [storeMsgs]);
|
|
167
|
+
(0, _react.useEffect)(function () {
|
|
168
|
+
var _messageList$;
|
|
169
|
+
// 视口位置在最底部时, 滚动到最新消息
|
|
170
|
+
var isBottom = clientHeight === 0 || Math.abs(scrollHeight - clientHeight - scrollTop) < cache.rowHeight({
|
|
171
|
+
index: readIdx
|
|
172
|
+
});
|
|
173
|
+
if (isBottom) {
|
|
174
|
+
genRequestAnimationFrame(function () {
|
|
175
|
+
scrollToIdx(messageList.length - 1);
|
|
176
|
+
});
|
|
177
|
+
} else {
|
|
178
|
+
var _messageList;
|
|
179
|
+
var len = messageList.length;
|
|
180
|
+
if (readMsgIndex.index === len - 2 && ((_messageList = messageList[len - 1]) === null || _messageList === void 0 ? void 0 : _messageList.uid) === localUserId) {
|
|
181
|
+
scrollToIdx(len - 1);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// TODO: 优化, 消息队列中, 后部分消息高度不会变, 是否可以使用 cache 中已有的高度?
|
|
186
|
+
// 消息列表从头更新, 重新计算每条消息的高度
|
|
187
|
+
if (firstMsgId && messageList[0] && ((_messageList$ = messageList[0]) === null || _messageList$ === void 0 ? void 0 : _messageList$.id) !== firstMsgId) {
|
|
188
|
+
cache.clearAll();
|
|
189
|
+
list === null || list === void 0 || list.recomputeRowHeights();
|
|
190
|
+
updateFirstMsgId(messageList[0].id);
|
|
191
|
+
}
|
|
192
|
+
var last2Idx = messageList.length - 2;
|
|
193
|
+
if (last2Idx >= 0) {
|
|
194
|
+
// 防止 margin 堆叠, 动态计算倒数第二条消息高度
|
|
195
|
+
cache.clear(last2Idx, 0);
|
|
196
|
+
list === null || list === void 0 || list.recomputeRowHeights(last2Idx);
|
|
197
|
+
}
|
|
198
|
+
}, [messageList]);
|
|
199
|
+
(0, _react.useEffect)(function () {
|
|
200
|
+
var isBottom = clientHeight === 0 || Math.abs(scrollHeight - clientHeight - scrollTop) < 1;
|
|
201
|
+
if (newMsgsUnReadCnt === 0 || isBottom) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
// 当有新消息来时,视口不在底部,需要提示有新消息
|
|
205
|
+
setLatestBtnVisible(true);
|
|
206
|
+
latestBtnVisibleFlag = true;
|
|
207
|
+
scrollToIdx(viewIdx);
|
|
208
|
+
}, [newMsgsUnReadCnt]);
|
|
209
|
+
var handleCopyMsg = /*#__PURE__*/function () {
|
|
210
|
+
var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(msg, time, publisherNickName, targetNickname) {
|
|
211
|
+
var msgHandled;
|
|
212
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
213
|
+
while (1) switch (_context.prev = _context.next) {
|
|
214
|
+
case 0:
|
|
215
|
+
msgHandled = (0, _i18n.getLanguage)() === 'zh' ? "".concat(publisherNickName, "\u5BF9").concat(targetNickname, "\u8BF4(").concat(time, ")\n").concat(msg) : "".concat(publisherNickName, " said to ").concat(targetNickname, "(").concat(time, ")\n").concat(msg);
|
|
216
|
+
_context.next = 3;
|
|
217
|
+
return (0, _copyText.copyText)(msgHandled);
|
|
218
|
+
case 3:
|
|
219
|
+
copyTips === null || copyTips === void 0 || copyTips();
|
|
220
|
+
case 4:
|
|
221
|
+
case "end":
|
|
222
|
+
return _context.stop();
|
|
223
|
+
}
|
|
224
|
+
}, _callee);
|
|
225
|
+
}));
|
|
226
|
+
return function handleCopyMsg(_x, _x2, _x3, _x4) {
|
|
227
|
+
return _ref3.apply(this, arguments);
|
|
228
|
+
};
|
|
229
|
+
}();
|
|
230
|
+
var handleSelectMsg = function handleSelectMsg(idx, checked) {
|
|
231
|
+
var _copyMap = new Map(copyMap);
|
|
232
|
+
if (checked) {
|
|
233
|
+
_copyMap === null || _copyMap === void 0 || _copyMap.set(idx, checked);
|
|
234
|
+
setCopyMap && setCopyMap(_copyMap !== null && _copyMap !== void 0 ? _copyMap : new Map());
|
|
235
|
+
} else {
|
|
236
|
+
_copyMap["delete"](idx);
|
|
237
|
+
setCopyMap && setCopyMap(_copyMap !== null && _copyMap !== void 0 ? _copyMap : new Map());
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// const _scrollTop = list?.getOffsetForRow({ index: idx });
|
|
241
|
+
// cache.clear(idx, 0);
|
|
242
|
+
// // TODO: 宽高改变后需要回到视口位置
|
|
243
|
+
// // 强制渲染列表
|
|
244
|
+
// list?.recomputeRowHeights(idx);
|
|
245
|
+
// list?.scrollToPosition(_scrollTop);
|
|
246
|
+
};
|
|
247
|
+
var rowRenderer = function rowRenderer(messageList) {
|
|
248
|
+
return function (_ref4) {
|
|
249
|
+
var _arr, _arr2, _arr3, _arr4;
|
|
250
|
+
var index = _ref4.index,
|
|
251
|
+
key = _ref4.key,
|
|
252
|
+
parent = _ref4.parent,
|
|
253
|
+
style = _ref4.style;
|
|
254
|
+
var datum = messageList[index % messageList.length];
|
|
255
|
+
if (!datum) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
var publisherRole = datum.role,
|
|
259
|
+
time = datum.time,
|
|
260
|
+
_datum$msg = datum.msg,
|
|
261
|
+
msg = _datum$msg === void 0 ? '' : _datum$msg,
|
|
262
|
+
color = datum.color,
|
|
263
|
+
publisherNickName = datum.nickName,
|
|
264
|
+
publisherUid = datum.uid,
|
|
265
|
+
isPrivate = datum.isPrivate,
|
|
266
|
+
targetNickname = datum.target,
|
|
267
|
+
chatLevel = datum.chatLevel;
|
|
268
|
+
var arr = messageList;
|
|
269
|
+
var idx = index;
|
|
270
|
+
var systemMsg = datum.systemMsg;
|
|
271
|
+
var publisherIsSelf = publisherUid === localUserId;
|
|
272
|
+
var checked = (copyMap === null || copyMap === void 0 ? void 0 : copyMap.get(idx)) || false;
|
|
273
|
+
var checkDisabled = (selectCnt !== null && selectCnt !== void 0 ? selectCnt : 0) >= _multiSelect.MAX_SELECT_CNT && !checked;
|
|
274
|
+
var needLabel = ((_arr = arr[idx - 1]) === null || _arr === void 0 ? void 0 : _arr.uid) !== publisherUid || ((_arr2 = arr[idx - 1]) === null || _arr2 === void 0 ? void 0 : _arr2.isPrivate) !== isPrivate || ((_arr3 = arr[idx - 1]) === null || _arr3 === void 0 ? void 0 : _arr3.role) !== publisherRole || ((_arr4 = arr[idx - 1]) === null || _arr4 === void 0 ? void 0 : _arr4.target) !== targetNickname;
|
|
275
|
+
var isManager = publisherRole === 'host' || publisherRole === 'union-host';
|
|
276
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactVirtualized.CellMeasurer, {
|
|
277
|
+
cache: cache,
|
|
278
|
+
columnIndex: 0,
|
|
279
|
+
rowIndex: index,
|
|
280
|
+
parent: parent,
|
|
281
|
+
children: function children() {
|
|
282
|
+
var _datum$img, _arr5;
|
|
283
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
284
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, style), {}, {
|
|
285
|
+
display: 'flex',
|
|
286
|
+
flexDirection: 'column'
|
|
287
|
+
}, systemMsg ? {
|
|
288
|
+
width: '100%'
|
|
289
|
+
} : {
|
|
290
|
+
width: 'auto'
|
|
291
|
+
}), systemMsg ? {} : publisherIsSelf ? {
|
|
292
|
+
marginRight: 15,
|
|
293
|
+
marginLeft: multiSelectActive ? 8 : 25,
|
|
294
|
+
alignItems: 'flex-end',
|
|
295
|
+
right: 0
|
|
296
|
+
} : {
|
|
297
|
+
marginRight: 15,
|
|
298
|
+
marginLeft: multiSelectActive ? 8 : 15,
|
|
299
|
+
alignItems: 'flex-start'
|
|
300
|
+
}),
|
|
301
|
+
id: String(idx),
|
|
302
|
+
children: systemMsg ? publisherRole === 'system' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_textBubble.TextBubble, {
|
|
303
|
+
txt: (0, _util.handleMessageTime)(time),
|
|
304
|
+
type: "transparent",
|
|
305
|
+
bold: true,
|
|
306
|
+
lineHeight: "small",
|
|
307
|
+
styles: {
|
|
308
|
+
marginBottom: 16
|
|
309
|
+
}
|
|
310
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_textBubble.TextBubble, {
|
|
311
|
+
txt: "".concat((0, _util.handleChatLevelChangedSystemMsg)(t, chatLevel, publisherRole, publisherNickName, publisherIsSelf)),
|
|
312
|
+
marginBottom: 15
|
|
313
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
314
|
+
children: [needLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_messageLabelMobile.MessageLabel, {
|
|
315
|
+
styles: {
|
|
316
|
+
marginLeft: publisherUid !== localUserId && multiSelectActive ? 24 : 0
|
|
317
|
+
},
|
|
318
|
+
color: color,
|
|
319
|
+
time: (0, _util.handleMessageTime)(time),
|
|
320
|
+
publisher: publisherNickName,
|
|
321
|
+
avatar: publisherUid !== localUserId ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_avatar.FcrAvatar, {
|
|
322
|
+
size: 24,
|
|
323
|
+
textSize: 24,
|
|
324
|
+
nickName: publisherNickName
|
|
325
|
+
}) : null,
|
|
326
|
+
publisherIsSelf: publisherIsSelf,
|
|
327
|
+
target: targetNickname || _store.allToUser.userName,
|
|
328
|
+
isPrivate: isPrivate,
|
|
329
|
+
tag: isManager ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
330
|
+
className: (0, _classnames["default"])('fcr-msg-tag', {
|
|
331
|
+
'fcr-msg-tag--union': publisherRole === 'union-host'
|
|
332
|
+
}),
|
|
333
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
334
|
+
children: publisherRole === 'host' ? t('fmt_role_host') : t('fmt_role_cohost')
|
|
335
|
+
})
|
|
336
|
+
}) : null
|
|
337
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
338
|
+
className: "fcr-line-message",
|
|
339
|
+
style: {
|
|
340
|
+
display: 'flex',
|
|
341
|
+
alignItems: 'center',
|
|
342
|
+
justifyContent: publisherIsSelf ? multiSelectActive ? 'space-between' : 'flex-end' : 'flex-start',
|
|
343
|
+
flexDirection: 'row',
|
|
344
|
+
width: '100%'
|
|
345
|
+
},
|
|
346
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
347
|
+
onClick: function onClick() {
|
|
348
|
+
if (!multiSelectActive || checkDisabled) {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
var newChecked = !checked;
|
|
352
|
+
handleSelectMsg(idx, newChecked);
|
|
353
|
+
},
|
|
354
|
+
style: {
|
|
355
|
+
// marginLeft: uid !== userId && multiSelectActive ? 24 : 0,
|
|
356
|
+
},
|
|
357
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_messageBubble.MessageBubble, {
|
|
358
|
+
file: datum === null || datum === void 0 || (_datum$img = datum.img) === null || _datum$img === void 0 ? void 0 : _datum$img.url,
|
|
359
|
+
msg: msg,
|
|
360
|
+
role: publisherRole,
|
|
361
|
+
isSelf: publisherIsSelf
|
|
362
|
+
// 消息间间距
|
|
363
|
+
,
|
|
364
|
+
marginBottom: ((_arr5 = arr[idx + 1]) === null || _arr5 === void 0 ? void 0 : _arr5.uid) === publisherUid ? 'small' : 'large',
|
|
365
|
+
styles: {
|
|
366
|
+
marginLeft: publisherUid !== localUserId && !multiSelectActive ? 34 : 0,
|
|
367
|
+
width: 'auto'
|
|
368
|
+
},
|
|
369
|
+
onCopy: (/*#__PURE__*/function () {
|
|
370
|
+
var _ref5 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(type) {
|
|
371
|
+
var currentScrollTop;
|
|
372
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
373
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
374
|
+
case 0:
|
|
375
|
+
if (!(type === 'singling')) {
|
|
376
|
+
_context2.next = 5;
|
|
377
|
+
break;
|
|
378
|
+
}
|
|
379
|
+
_context2.next = 3;
|
|
380
|
+
return handleCopyMsg(msg, (0, _util.handleMessageTime)(time), publisherIsSelf && isPrivate ? t('fmt_settings_labels_you') : publisherNickName, // 你
|
|
381
|
+
targetNickname !== null && targetNickname !== void 0 ? targetNickname : _store.allToUser.userName);
|
|
382
|
+
case 3:
|
|
383
|
+
_context2.next = 6;
|
|
384
|
+
break;
|
|
385
|
+
case 5:
|
|
386
|
+
if (type === 'multiple') {
|
|
387
|
+
currentScrollTop = list === null || list === void 0 ? void 0 : list.getOffsetForRow({
|
|
388
|
+
index: idx
|
|
389
|
+
});
|
|
390
|
+
scrollToIdx(viewIdx);
|
|
391
|
+
setLastScrollTop(currentScrollTop);
|
|
392
|
+
setMultiSelectActive && setMultiSelectActive(true);
|
|
393
|
+
}
|
|
394
|
+
case 6:
|
|
395
|
+
case "end":
|
|
396
|
+
return _context2.stop();
|
|
397
|
+
}
|
|
398
|
+
}, _callee2);
|
|
399
|
+
}));
|
|
400
|
+
return function (_x5) {
|
|
401
|
+
return _ref5.apply(this, arguments);
|
|
402
|
+
};
|
|
403
|
+
}()),
|
|
404
|
+
onPrivate: function onPrivate() {
|
|
405
|
+
handleClickPrivateChat(publisherUid);
|
|
406
|
+
},
|
|
407
|
+
hiddenMore: true
|
|
408
|
+
})
|
|
409
|
+
})
|
|
410
|
+
})]
|
|
411
|
+
})
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}, key);
|
|
415
|
+
};
|
|
416
|
+
};
|
|
417
|
+
var scrollToIdx = function scrollToIdx(idx) {
|
|
418
|
+
var rowCount = messageList.length;
|
|
419
|
+
var scrollIdx = Math.min(rowCount - 1, idx);
|
|
420
|
+
if (isNaN(scrollIdx)) {
|
|
421
|
+
scrollIdx = undefined;
|
|
422
|
+
}
|
|
423
|
+
setScrollIndex(scrollIdx);
|
|
424
|
+
};
|
|
425
|
+
var handleScroll = function handleScroll(params) {
|
|
426
|
+
var listScrollHeight = params.scrollHeight,
|
|
427
|
+
listScrollTop = params.scrollTop,
|
|
428
|
+
listClientHeight = params.clientHeight;
|
|
429
|
+
updateScrollInfo(listScrollHeight, listScrollTop, listClientHeight);
|
|
430
|
+
updateScrollIndexByScroll();
|
|
431
|
+
};
|
|
432
|
+
var updateScrollIndexByScroll = (0, _throttle["default"])(function () {
|
|
433
|
+
if (scrollTop !== 0 && scrollHeight - scrollTop === clientHeight && latestBtnVisible) {
|
|
434
|
+
setLatestBtnVisible(false);
|
|
435
|
+
scrollToIdx(messageList.length - 1);
|
|
436
|
+
}
|
|
437
|
+
}, 200);
|
|
438
|
+
var handleRowRendered = function handleRowRendered(params) {
|
|
439
|
+
var stopIndex = params.stopIndex,
|
|
440
|
+
startIndex = params.startIndex;
|
|
441
|
+
|
|
442
|
+
// 历史未读消息
|
|
443
|
+
var lastReadIdx = messageList.findIndex(function (msg) {
|
|
444
|
+
return msg.id === readMsgIndex.msgId;
|
|
445
|
+
});
|
|
446
|
+
var hasHistoryUnRead = readMsgIndex.index < 0 || lastReadIdx < 0 || readMsgIndex.index < startIndex;
|
|
447
|
+
if (messageList.length > 0 && stopIndex >= messageList.length - 1 && hasHistoryUnRead && startIndex > 0 && hasHistoryMsg) {
|
|
448
|
+
var unReadCnt = 0;
|
|
449
|
+
if (lastReadIdx === -1) {
|
|
450
|
+
unReadCnt = startIndex - 1;
|
|
451
|
+
} else if (lastReadIdx >= 0) {
|
|
452
|
+
unReadCnt = startIndex - lastReadIdx;
|
|
453
|
+
}
|
|
454
|
+
updateHistoryCnt(unReadCnt);
|
|
455
|
+
unReadCnt > 0 && setHistoryMsgVisible(true);
|
|
456
|
+
updateHasHistoryMsg(false);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// 视口已经滚动到所有历史未读消息之前
|
|
460
|
+
var unreadIdx = messageList.findIndex(function (msg) {
|
|
461
|
+
return msg.id === readMsgIndex.msgId;
|
|
462
|
+
});
|
|
463
|
+
if (stopIndex <= unreadIdx) {
|
|
464
|
+
setHistoryMsgVisible(false);
|
|
465
|
+
}
|
|
466
|
+
updateViewIdx(stopIndex);
|
|
467
|
+
if (firstRowsRendered) {
|
|
468
|
+
firstRowsRendered = false;
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
var latestIdx = messageList.length - 1;
|
|
472
|
+
// 往上滚动超过 40 条
|
|
473
|
+
if (latestIdx - stopIndex >= needCbBottomCount && !latestBtnVisibleFlag) {
|
|
474
|
+
latestBtnVisibleFlag = true;
|
|
475
|
+
clearTimeout(latestBtnVisibleTimer);
|
|
476
|
+
latestBtnVisibleTimer = setTimeout(function () {
|
|
477
|
+
var isBottom = clientHeight === 0 || Math.abs(scrollHeight - clientHeight - scrollTop) < 1;
|
|
478
|
+
!isBottom && setLatestBtnVisible(true);
|
|
479
|
+
}, 500);
|
|
480
|
+
}
|
|
481
|
+
if (latestIdx - stopIndex < 10 && latestBtnVisibleFlag) {
|
|
482
|
+
latestBtnVisibleFlag = false;
|
|
483
|
+
setTimeout(function () {
|
|
484
|
+
setLatestBtnVisible(false);
|
|
485
|
+
}, 500);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// 视口出现新消息
|
|
489
|
+
if (stopIndex > readIdx) {
|
|
490
|
+
updateReadIdx(stopIndex);
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
(0, _react.useEffect)(function () {
|
|
494
|
+
var isBottom = clientHeight === 0 || Math.abs(scrollHeight - clientHeight - scrollTop) < 1;
|
|
495
|
+
if (isBottom) {
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
}, [readMsgIndex]);
|
|
499
|
+
(0, _react.useEffect)(function () {
|
|
500
|
+
// 重新计算高度
|
|
501
|
+
cache.clearAll();
|
|
502
|
+
list === null || list === void 0 || list.recomputeRowHeights();
|
|
503
|
+
if (lastScrollTop !== undefined) {
|
|
504
|
+
list === null || list === void 0 || list.scrollToPosition(lastScrollTop);
|
|
505
|
+
setLastScrollTop(undefined);
|
|
506
|
+
}
|
|
507
|
+
}, [multiSelectActive]);
|
|
508
|
+
var handleClickPrivateChat = function handleClickPrivateChat(userId) {
|
|
509
|
+
permitPrivateChat(userId);
|
|
510
|
+
};
|
|
511
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
512
|
+
className: 'fcr-message-list',
|
|
513
|
+
style: {},
|
|
514
|
+
children: [historyMsgVisible && messageList.length > 0 && historyUnReadCount > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_latestButton.LatestButton, {
|
|
515
|
+
onClick: function onClick() {
|
|
516
|
+
var len = messageList.length;
|
|
517
|
+
// 回到历史消息指定位置
|
|
518
|
+
var idx = (readMsgIndex === null || readMsgIndex === void 0 ? void 0 : readMsgIndex.index) < 0 ? 0 : messageList.findIndex(function (msg) {
|
|
519
|
+
return msg.id === readMsgIndex.msgId;
|
|
520
|
+
});
|
|
521
|
+
scrollToIdx(idx);
|
|
522
|
+
setHistoryMsgVisible(false);
|
|
523
|
+
var lastMsg = messageList[len - 1];
|
|
524
|
+
if (updateReadMsgIndex && lastMsg) {
|
|
525
|
+
updateReadMsgIndex({
|
|
526
|
+
index: len - 1,
|
|
527
|
+
msgId: lastMsg.id
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
updateHistoryUnReadCount(0);
|
|
531
|
+
},
|
|
532
|
+
txt: "".concat(t('fmt_chat_tips_newmessage', {
|
|
533
|
+
reason1: historyUnReadCount
|
|
534
|
+
})),
|
|
535
|
+
iconTransform: true,
|
|
536
|
+
direction: "top",
|
|
537
|
+
styles: {
|
|
538
|
+
zIndex: 999
|
|
539
|
+
}
|
|
540
|
+
}) : null, latestBtnVisible === true ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_latestButton.LatestButton, {
|
|
541
|
+
onClick: function onClick() {
|
|
542
|
+
forceNotifyMsgs();
|
|
543
|
+
var len = messageList.length;
|
|
544
|
+
|
|
545
|
+
// 回到最新消息的第一条
|
|
546
|
+
if (readIdx === len - 1) {
|
|
547
|
+
// 没有新消息
|
|
548
|
+
if (scrollIndex === len - 1) {
|
|
549
|
+
list === null || list === void 0 || list.scrollToPosition(scrollHeight - clientHeight);
|
|
550
|
+
} else {
|
|
551
|
+
scrollToIdx(len - 1);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
setLatestBtnVisible(false);
|
|
555
|
+
latestBtnVisibleFlag = false;
|
|
556
|
+
var lastMsg = messageList[len - 1];
|
|
557
|
+
if (updateReadMsgIndex && lastMsg) {
|
|
558
|
+
updateReadMsgIndex({
|
|
559
|
+
index: len - 1,
|
|
560
|
+
msgId: lastMsg.id
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
txt: "".concat(
|
|
565
|
+
// readIdx === messageList.length - 1
|
|
566
|
+
newMsgsUnReadCnt === 0 ? t('fmt_chat_button_latestlocation') // 回到最新位置
|
|
567
|
+
: t('fmt_chat_tips_newmessage', {
|
|
568
|
+
reason1: newMsgsUnReadCnt || messageList.length - 1 - readIdx
|
|
569
|
+
})),
|
|
570
|
+
styles: {
|
|
571
|
+
zIndex: 999
|
|
572
|
+
}
|
|
573
|
+
}) : null, messageList.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
574
|
+
className: "fcr-no-data-chat",
|
|
575
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_icon.FcrIcon, {
|
|
576
|
+
type: _type.FcrIconType.FCR_DEFAULTPAGE
|
|
577
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
578
|
+
children: t('fmt_chat_tips_nodata')
|
|
579
|
+
})]
|
|
580
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactVirtualized.AutoSizer, {
|
|
581
|
+
style: {
|
|
582
|
+
alignSelf: 'stretch'
|
|
583
|
+
},
|
|
584
|
+
children: function children(_ref6) {
|
|
585
|
+
var height = _ref6.height,
|
|
586
|
+
width = _ref6.width;
|
|
587
|
+
if (height !== mostRecentHeight || width !== mostRecentWidth) {
|
|
588
|
+
cache.clearAll();
|
|
589
|
+
if (list) {
|
|
590
|
+
list.recomputeRowHeights();
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
updateMostRecentHeight(height);
|
|
594
|
+
updateMostRecentWidth(width);
|
|
595
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactVirtualized.List, {
|
|
596
|
+
ref: function ref(_ref7) {
|
|
597
|
+
updateList(_ref7);
|
|
598
|
+
},
|
|
599
|
+
style: {
|
|
600
|
+
padding: 'inherit',
|
|
601
|
+
scrollbarWidth: 'none'
|
|
602
|
+
},
|
|
603
|
+
onScroll: handleScroll,
|
|
604
|
+
onRowsRendered: handleRowRendered,
|
|
605
|
+
width: width,
|
|
606
|
+
height: height,
|
|
607
|
+
rowHeight: cache.rowHeight,
|
|
608
|
+
rowCount: messageList.length,
|
|
609
|
+
rowRenderer: rowRenderer(messageList),
|
|
610
|
+
deferredMeasurementCache: cache,
|
|
611
|
+
overscanRowCount: 0,
|
|
612
|
+
scrollToIndex: latestBtnVisible ? undefined : scrollIndex
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
})]
|
|
616
|
+
});
|
|
617
|
+
});
|