@tencentcloud/sdk-mcp 1.0.7 → 1.0.9
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/package.json +1 -1
- package/resource/doc/chatuikit/react/components/chat.md +38 -0
- package/resource/doc/chatuikit/react/components/chatheader.md +153 -0
- package/resource/doc/chatuikit/react/components/conversation-list.md +765 -0
- package/resource/doc/chatuikit/react/components/message-input.md +799 -0
- package/resource/doc/chatuikit/react/components/message-list.md +385 -0
- package/resource/doc/chatuikit/react/components/tuikit.md +64 -0
- package/resource/doc/chatuikit/react/create-group.md +22 -0
- package/resource/doc/chatuikit/react/login.md +25 -0
- package/resource/doc/chatuikit/vue/components/MessageInput.md +546 -0
- package/resource/doc/chatuikit/vue/components/avatar.md +105 -0
- package/resource/doc/chatuikit/vue/components/chat.md +38 -0
- package/resource/doc/chatuikit/vue/components/chatheader.md +153 -0
- package/resource/doc/chatuikit/vue/components/component-list.md +90 -0
- package/resource/doc/chatuikit/vue/components/conversation-list.md +590 -0
- package/resource/doc/chatuikit/vue/components/login.md +29 -0
- package/resource/doc/chatuikit/vue/components/message-input.md +546 -0
- package/resource/doc/chatuikit/vue/components/message-list.md +548 -0
- package/resource/doc/chatuikit/vue/components/tuikit.md +110 -0
- package/resource/doc/chatuikit/vue/components/userpicker.md +256 -0
- package/resource/doc/chatuikit/vue/create-group.md +26 -0
- package/resource/doc/chatuikit/vue/integration.md +218 -0
- package/resource/doc/chatuikit/vue/login.md +29 -0
- package/resource/doc/chatuikit/vue3/components/MessageList.md +385 -0
- package/resource/doc/chatuikit/vue3/integration.md +7 -4
- package/tools/call/get-native-call-integration-guide.js +2 -2
- package/tools/call/get-native-call-integration-guide.js.map +1 -1
- package/tools/call/get-native-call-integration.js +35 -0
- package/tools/call/get-native-call-integration.js.map +1 -0
- package/tools/call/get-web-call-integration-guide.js +4 -4
- package/tools/call/get-web-call-integration-guide.js.map +1 -1
- package/tools/call/get-web-call-integration.js +34 -0
- package/tools/call/get-web-call-integration.js.map +1 -0
- package/tools/chat/auto-create-group.js +44 -0
- package/tools/chat/auto-create-group.js.map +1 -0
- package/tools/chat/create-group.js +29 -0
- package/tools/chat/create-group.js.map +1 -0
- package/tools/chat/get-native-chat-integration-guide.js +2 -2
- package/tools/chat/get-native-chat-integration-guide.js.map +1 -1
- package/tools/chat/get-native-chat-integration.js +33 -0
- package/tools/chat/get-native-chat-integration.js.map +1 -0
- package/tools/chat/get-web-chat-component-detail.js +8 -5
- package/tools/chat/get-web-chat-component-detail.js.map +1 -1
- package/tools/chat/get-web-chat-integration-guide.js +16 -8
- package/tools/chat/get-web-chat-integration-guide.js.map +1 -1
- package/tools/chat/get-web-chat-integration.js +36 -0
- package/tools/chat/get-web-chat-integration.js.map +1 -0
- package/tools/chat/get-web-chat-uikit-login.js +30 -0
- package/tools/chat/get-web-chat-uikit-login.js.map +1 -0
- package/tools/common/present-framework-choice.js +9 -18
- package/tools/common/present-framework-choice.js.map +1 -1
- package/tools/common/record-prompt.js +3 -3
- package/tools/common/record-prompt.js.map +1 -1
- package/tools/common/record-result.js +6 -6
- package/tools/common/record-result.js.map +1 -1
- package/tools/index.js +12 -8
- package/tools/index.js.map +1 -1
- package/utils/handle-component-name.js +12 -0
- package/utils/handle-component-name.js.map +1 -0
- package/utils/handle-framework.js +9 -0
- package/utils/handle-framework.js.map +1 -0
- package/@tencent/aegis-node-sdk/CHANGELOG.md +0 -8
- package/@tencent/aegis-node-sdk/LICENSE +0 -21
- package/@tencent/aegis-node-sdk/README.md +0 -562
- package/@tencent/aegis-node-sdk/lib/aegis.min.js +0 -1
- package/@tencent/aegis-node-sdk/lib/packages/core/src/constant/config.d.ts +0 -14
- package/@tencent/aegis-node-sdk/lib/packages/core/src/constant/global.d.ts +0 -1
- package/@tencent/aegis-node-sdk/lib/packages/core/src/constant/index.d.ts +0 -9
- package/@tencent/aegis-node-sdk/lib/packages/core/src/constant/report-ignore.d.ts +0 -2
- package/@tencent/aegis-node-sdk/lib/packages/core/src/core.d.ts +0 -85
- package/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/afterRequestHooks.d.ts +0 -3
- package/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/beforeRequestHooks.d.ts +0 -9
- package/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/modifyRequestHooks.d.ts +0 -3
- package/@tencent/aegis-node-sdk/lib/packages/core/src/index.d.ts +0 -9
- package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/config.d.ts +0 -62
- package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/env.d.ts +0 -11
- package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/index.d.ts +0 -4
- package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/log.d.ts +0 -130
- package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/send.d.ts +0 -34
- package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/format.d.ts +0 -2
- package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/index.d.ts +0 -18
- package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/length-limit.d.ts +0 -8
- package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/pv.d.ts +0 -8
- package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/remove-payload.d.ts +0 -2
- package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/repeat-limit.d.ts +0 -4
- package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/report.d.ts +0 -10
- package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/sample.d.ts +0 -3
- package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/throttle.d.ts +0 -3
- package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/index.d.ts +0 -34
- package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/jwt.d.ts +0 -12
- package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/ot-js.d.ts +0 -14
- package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/uuid.d.ts +0 -2
- package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/whitelist.d.ts +0 -12
- package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/write-before.d.ts +0 -3
- package/@tencent/aegis-node-sdk/lib/packages/core/src/plugin.d.ts +0 -33
- package/@tencent/aegis-node-sdk/lib/packages/core/src/polyfill.d.ts +0 -0
- package/@tencent/aegis-node-sdk/lib/packages/core/src/util/destroy.d.ts +0 -2
- package/@tencent/aegis-node-sdk/lib/packages/core/src/util/event-emitter.d.ts +0 -18
- package/@tencent/aegis-node-sdk/lib/packages/core/src/util/index.d.ts +0 -60
- package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/index.d.ts +0 -15
- package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/interface/selector.d.ts +0 -5
- package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/pipes/batch-report-pipe.d.ts +0 -6
- package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/protocol/protocol_base.d.ts +0 -18
- package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/protocol/protocol_http.d.ts +0 -12
- package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/ip_selector.d.ts +0 -10
- package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/polaris_selector.d.ts +0 -20
- package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/selector_base.d.ts +0 -27
- package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/util/eval_require.d.ts +0 -2
- package/@tencent/aegis-node-sdk/package.json +0 -19
- package/@tencent/polaris/README.md +0 -407
- package/@tencent/polaris/dist/consumer/health.d.ts +0 -126
- package/@tencent/polaris/dist/consumer/health.js +0 -283
- package/@tencent/polaris/dist/consumer/health.js.map +0 -1
- package/@tencent/polaris/dist/consumer/index.d.ts +0 -120
- package/@tencent/polaris/dist/consumer/index.js +0 -348
- package/@tencent/polaris/dist/consumer/index.js.map +0 -1
- package/@tencent/polaris/dist/consumer/monitor.d.ts +0 -145
- package/@tencent/polaris/dist/consumer/monitor.js +0 -343
- package/@tencent/polaris/dist/consumer/monitor.js.map +0 -1
- package/@tencent/polaris/dist/consumer/selector.d.ts +0 -73
- package/@tencent/polaris/dist/consumer/selector.js +0 -316
- package/@tencent/polaris/dist/consumer/selector.js.map +0 -1
- package/@tencent/polaris/dist/errors.d.ts +0 -373
- package/@tencent/polaris/dist/errors.js +0 -154
- package/@tencent/polaris/dist/errors.js.map +0 -1
- package/@tencent/polaris/dist/global.d.ts +0 -16
- package/@tencent/polaris/dist/global.js +0 -18
- package/@tencent/polaris/dist/global.js.map +0 -1
- package/@tencent/polaris/dist/index.d.ts +0 -62
- package/@tencent/polaris/dist/index.js +0 -145
- package/@tencent/polaris/dist/index.js.map +0 -1
- package/@tencent/polaris/dist/instance.d.ts +0 -109
- package/@tencent/polaris/dist/instance.js +0 -38
- package/@tencent/polaris/dist/instance.js.map +0 -1
- package/@tencent/polaris/dist/limiter/bucket.d.ts +0 -51
- package/@tencent/polaris/dist/limiter/bucket.js +0 -152
- package/@tencent/polaris/dist/limiter/bucket.js.map +0 -1
- package/@tencent/polaris/dist/limiter/index.d.ts +0 -73
- package/@tencent/polaris/dist/limiter/index.js +0 -149
- package/@tencent/polaris/dist/limiter/index.js.map +0 -1
- package/@tencent/polaris/dist/limiter/ratelimit.d.ts +0 -27
- package/@tencent/polaris/dist/limiter/ratelimit.js +0 -134
- package/@tencent/polaris/dist/limiter/ratelimit.js.map +0 -1
- package/@tencent/polaris/dist/limiter/ratelimiter/base.d.ts +0 -17
- package/@tencent/polaris/dist/limiter/ratelimiter/base.js +0 -15
- package/@tencent/polaris/dist/limiter/ratelimiter/base.js.map +0 -1
- package/@tencent/polaris/dist/limiter/ratelimiter/global.d.ts +0 -59
- package/@tencent/polaris/dist/limiter/ratelimiter/global.js +0 -397
- package/@tencent/polaris/dist/limiter/ratelimiter/global.js.map +0 -1
- package/@tencent/polaris/dist/limiter/ratelimiter/index.d.ts +0 -3
- package/@tencent/polaris/dist/limiter/ratelimiter/index.js +0 -19
- package/@tencent/polaris/dist/limiter/ratelimiter/index.js.map +0 -1
- package/@tencent/polaris/dist/limiter/ratelimiter/local.d.ts +0 -17
- package/@tencent/polaris/dist/limiter/ratelimiter/local.js +0 -52
- package/@tencent/polaris/dist/limiter/ratelimiter/local.js.map +0 -1
- package/@tencent/polaris/dist/location.d.ts +0 -48
- package/@tencent/polaris/dist/location.js +0 -67
- package/@tencent/polaris/dist/location.js.map +0 -1
- package/@tencent/polaris/dist/logging.d.ts +0 -106
- package/@tencent/polaris/dist/logging.js +0 -130
- package/@tencent/polaris/dist/logging.js.map +0 -1
- package/@tencent/polaris/dist/metadata.d.ts +0 -78
- package/@tencent/polaris/dist/metadata.js +0 -119
- package/@tencent/polaris/dist/metadata.js.map +0 -1
- package/@tencent/polaris/dist/plugins/breaker/polaris.d.ts +0 -47
- package/@tencent/polaris/dist/plugins/breaker/polaris.js +0 -162
- package/@tencent/polaris/dist/plugins/breaker/polaris.js.map +0 -1
- package/@tencent/polaris/dist/plugins/lb/base.d.ts +0 -24
- package/@tencent/polaris/dist/plugins/lb/base.js +0 -32
- package/@tencent/polaris/dist/plugins/lb/base.js.map +0 -1
- package/@tencent/polaris/dist/plugins/lb/edf.d.ts +0 -24
- package/@tencent/polaris/dist/plugins/lb/edf.js +0 -77
- package/@tencent/polaris/dist/plugins/lb/edf.js.map +0 -1
- package/@tencent/polaris/dist/plugins/lb/hashring.d.ts +0 -24
- package/@tencent/polaris/dist/plugins/lb/hashring.js +0 -53
- package/@tencent/polaris/dist/plugins/lb/hashring.js.map +0 -1
- package/@tencent/polaris/dist/plugins/lb/sticky.d.ts +0 -31
- package/@tencent/polaris/dist/plugins/lb/sticky.js +0 -88
- package/@tencent/polaris/dist/plugins/lb/sticky.js.map +0 -1
- package/@tencent/polaris/dist/plugins/lb/swrr.d.ts +0 -25
- package/@tencent/polaris/dist/plugins/lb/swrr.js +0 -72
- package/@tencent/polaris/dist/plugins/lb/swrr.js.map +0 -1
- package/@tencent/polaris/dist/plugins/lb/wr.d.ts +0 -17
- package/@tencent/polaris/dist/plugins/lb/wr.js +0 -50
- package/@tencent/polaris/dist/plugins/lb/wr.js.map +0 -1
- package/@tencent/polaris/dist/plugins/lb/wrr.d.ts +0 -19
- package/@tencent/polaris/dist/plugins/lb/wrr.js +0 -81
- package/@tencent/polaris/dist/plugins/lb/wrr.js.map +0 -1
- package/@tencent/polaris/dist/plugins/logging/console.d.ts +0 -10
- package/@tencent/polaris/dist/plugins/logging/console.js +0 -38
- package/@tencent/polaris/dist/plugins/logging/console.js.map +0 -1
- package/@tencent/polaris/dist/plugins/naming/local-server/index.d.ts +0 -32
- package/@tencent/polaris/dist/plugins/naming/local-server/index.js +0 -88
- package/@tencent/polaris/dist/plugins/naming/local-server/index.js.map +0 -1
- package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.d.ts +0 -124
- package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.js +0 -398
- package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.js.map +0 -1
- package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.d.ts +0 -27
- package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.js +0 -287
- package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.js.map +0 -1
- package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.d.ts +0 -15
- package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.js +0 -43
- package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.js.map +0 -1
- package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.d.ts +0 -28
- package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.js +0 -249
- package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.js.map +0 -1
- package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.d.ts +0 -19
- package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.js +0 -222
- package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.js.map +0 -1
- package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.d.ts +0 -26
- package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.js +0 -99
- package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.js.map +0 -1
- package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.d.ts +0 -60
- package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.js +0 -259
- package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.js.map +0 -1
- package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/discover.proto +0 -24
- package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/monitor.proto +0 -18
- package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/ratelimit.proto +0 -12
- package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.d.ts +0 -39
- package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.js +0 -115
- package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.js.map +0 -1
- package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/api.proto +0 -24
- package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/client.proto +0 -22
- package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/model.proto +0 -28
- package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/ratelimit.proto +0 -80
- package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/request.proto +0 -18
- package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/response.proto +0 -65
- package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/routing.proto +0 -66
- package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/service.proto +0 -95
- package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/types.d.ts +0 -1568
- package/@tencent/polaris/dist/plugins/naming/polaris-server/index.d.ts +0 -36
- package/@tencent/polaris/dist/plugins/naming/polaris-server/index.js +0 -51
- package/@tencent/polaris/dist/plugins/naming/polaris-server/index.js.map +0 -1
- package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/api.proto +0 -18
- package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/circuitbreak.proto +0 -67
- package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/request.proto +0 -82
- package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/response.proto +0 -11
- package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdkcache.proto +0 -46
- package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdkconfiguration.proto +0 -16
- package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdktoken.proto +0 -10
- package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/types.d.ts +0 -1102
- package/@tencent/polaris/dist/plugins/naming/polaris-server/pool.d.ts +0 -29
- package/@tencent/polaris/dist/plugins/naming/polaris-server/pool.js +0 -77
- package/@tencent/polaris/dist/plugins/naming/polaris-server/pool.js.map +0 -1
- package/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/api.proto +0 -12
- package/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/ratelimit.proto +0 -28
- package/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/types.d.ts +0 -395
- package/@tencent/polaris/dist/plugins/naming/polaris-server/rules.d.ts +0 -13
- package/@tencent/polaris/dist/plugins/naming/polaris-server/rules.js +0 -116
- package/@tencent/polaris/dist/plugins/naming/polaris-server/rules.js.map +0 -1
- package/@tencent/polaris/dist/plugins/naming/polaris-server/types.d.ts +0 -67
- package/@tencent/polaris/dist/plugins/naming/polaris-server/types.js +0 -67
- package/@tencent/polaris/dist/plugins/naming/polaris-server/types.js.map +0 -1
- package/@tencent/polaris/dist/plugins/naming/polaris-server/utils.d.ts +0 -99
- package/@tencent/polaris/dist/plugins/naming/polaris-server/utils.js +0 -217
- package/@tencent/polaris/dist/plugins/naming/polaris-server/utils.js.map +0 -1
- package/@tencent/polaris/dist/plugins/registry/memory.d.ts +0 -10
- package/@tencent/polaris/dist/plugins/registry/memory.js +0 -50
- package/@tencent/polaris/dist/plugins/registry/memory.js.map +0 -1
- package/@tencent/polaris/dist/plugins/router/polaris/nearby.d.ts +0 -51
- package/@tencent/polaris/dist/plugins/router/polaris/nearby.js +0 -145
- package/@tencent/polaris/dist/plugins/router/polaris/nearby.js.map +0 -1
- package/@tencent/polaris/dist/plugins/router/polaris/rule.d.ts +0 -11
- package/@tencent/polaris/dist/plugins/router/polaris/rule.js +0 -174
- package/@tencent/polaris/dist/plugins/router/polaris/rule.js.map +0 -1
- package/@tencent/polaris/dist/plugins/router/trpc/canary.d.ts +0 -25
- package/@tencent/polaris/dist/plugins/router/trpc/canary.js +0 -36
- package/@tencent/polaris/dist/plugins/router/trpc/canary.js.map +0 -1
- package/@tencent/polaris/dist/plugins/router/trpc/env.d.ts +0 -10
- package/@tencent/polaris/dist/plugins/router/trpc/env.js +0 -34
- package/@tencent/polaris/dist/plugins/router/trpc/env.js.map +0 -1
- package/@tencent/polaris/dist/plugins/router/trpc/set.d.ts +0 -56
- package/@tencent/polaris/dist/plugins/router/trpc/set.js +0 -106
- package/@tencent/polaris/dist/plugins/router/trpc/set.js.map +0 -1
- package/@tencent/polaris/dist/plugins/shaping/unirate.d.ts +0 -31
- package/@tencent/polaris/dist/plugins/shaping/unirate.js +0 -124
- package/@tencent/polaris/dist/plugins/shaping/unirate.js.map +0 -1
- package/@tencent/polaris/dist/plugins/shaping/warmup.d.ts +0 -61
- package/@tencent/polaris/dist/plugins/shaping/warmup.js +0 -171
- package/@tencent/polaris/dist/plugins/shaping/warmup.js.map +0 -1
- package/@tencent/polaris/dist/plugins/weight/polaris.d.ts +0 -23
- package/@tencent/polaris/dist/plugins/weight/polaris.js +0 -159
- package/@tencent/polaris/dist/plugins/weight/polaris.js.map +0 -1
- package/@tencent/polaris/dist/plugins.d.ts +0 -619
- package/@tencent/polaris/dist/plugins.js +0 -91
- package/@tencent/polaris/dist/plugins.js.map +0 -1
- package/@tencent/polaris/dist/polaris.d.ts +0 -33
- package/@tencent/polaris/dist/polaris.js +0 -59
- package/@tencent/polaris/dist/polaris.js.map +0 -1
- package/@tencent/polaris/dist/provider/index.d.ts +0 -102
- package/@tencent/polaris/dist/provider/index.js +0 -168
- package/@tencent/polaris/dist/provider/index.js.map +0 -1
- package/@tencent/polaris/dist/registry.d.ts +0 -174
- package/@tencent/polaris/dist/registry.js +0 -660
- package/@tencent/polaris/dist/registry.js.map +0 -1
- package/@tencent/polaris/dist/rules.d.ts +0 -163
- package/@tencent/polaris/dist/rules.js +0 -24
- package/@tencent/polaris/dist/rules.js.map +0 -1
- package/@tencent/polaris/dist/scripts/postinstall.d.ts +0 -1
- package/@tencent/polaris/dist/scripts/postinstall.js +0 -71
- package/@tencent/polaris/dist/scripts/postinstall.js.map +0 -1
- package/@tencent/polaris/dist/service.d.ts +0 -18
- package/@tencent/polaris/dist/service.js +0 -3
- package/@tencent/polaris/dist/service.js.map +0 -1
- package/@tencent/polaris/dist/skeleton.d.ts +0 -87
- package/@tencent/polaris/dist/skeleton.js +0 -282
- package/@tencent/polaris/dist/skeleton.js.map +0 -1
- package/@tencent/polaris/dist/utils.d.ts +0 -36
- package/@tencent/polaris/dist/utils.js +0 -74
- package/@tencent/polaris/dist/utils.js.map +0 -1
- package/@tencent/polaris/dist/weak.d.ts +0 -11
- package/@tencent/polaris/dist/weak.js +0 -44
- package/@tencent/polaris/dist/weak.js.map +0 -1
- package/@tencent/polaris/package.json +0 -114
- package/resource/doc/chatuikit/react/integrate_tuichat_only_react.md +0 -185
- package/resource/doc/chatuikit/react/integrate_tuichat_react.md +0 -212
- package/resource/doc/chatuikit/vue/integrate_tuichat_only_vue.md +0 -149
- package/resource/doc/chatuikit/vue/integrate_tuichat_vue.md +0 -248
- package/streamableHttp.js +0 -74
- package/streamableHttp.js.map +0 -1
- /package/resource/doc/chatuikit/{iOS → ios}/client_api_iOS.md +0 -0
- /package/resource/doc/chatuikit/{iOS → ios}/integrate_tuichat_only_iOS.md +0 -0
- /package/resource/doc/chatuikit/{iOS → ios}/integrate_tuikit_iOS.md +0 -0
- /package/resource/doc/chatuikit/{iOS → ios}/ui_api_iOS.md +0 -0
- /package/resource/doc/tuicallkit/{iOS → ios}/api_TUICallKit.md +0 -0
- /package/resource/doc/tuicallkit/{iOS → ios}/api_TUICallObserver.md +0 -0
- /package/resource/doc/tuicallkit/{iOS → ios}/how_to_integrated_iOS_callkit.md +0 -0
- /package/resource/doc/tuicallkit/{iOS → ios}/how_to_run_iOS_callkit_demo.md +0 -0
|
@@ -0,0 +1,799 @@
|
|
|
1
|
+
## 概述
|
|
2
|
+
|
|
3
|
+
MessageInput 是一个功能完整的消息输入组件,提供了文本编辑、表情选择、文件附件、发送按钮等核心聊天输入功能。该组件支持丰富的自定义选项,包括输入行为配置、工具栏定制、组件替换和插槽扩展,能够满足不同聊天场景的个性化需求。
|
|
4
|
+
|
|
5
|
+
## Props 配置
|
|
6
|
+
<table>
|
|
7
|
+
<tr>
|
|
8
|
+
<td rowspan="1" colSpan="1" >字段</td>
|
|
9
|
+
|
|
10
|
+
<td rowspan="1" colSpan="1" >类型</td>
|
|
11
|
+
|
|
12
|
+
<td rowspan="1" colSpan="1" >默认值</td>
|
|
13
|
+
|
|
14
|
+
<td rowspan="1" colSpan="1" >描述</td>
|
|
15
|
+
</tr>
|
|
16
|
+
|
|
17
|
+
<tr>
|
|
18
|
+
<td rowspan="1" colSpan="1" >[autoFocus](https://write.woa.com/document/181344257863962624)</td>
|
|
19
|
+
|
|
20
|
+
<td rowspan="1" colSpan="1" >boolean</td>
|
|
21
|
+
|
|
22
|
+
<td rowspan="1" colSpan="1" >true</td>
|
|
23
|
+
|
|
24
|
+
<td rowspan="1" colSpan="1" >是否自动聚焦到输入框</td>
|
|
25
|
+
</tr>
|
|
26
|
+
|
|
27
|
+
<tr>
|
|
28
|
+
<td rowspan="1" colSpan="1" >[disabled](https://write.woa.com/document/181344257863962624)</td>
|
|
29
|
+
|
|
30
|
+
<td rowspan="1" colSpan="1" >boolean</td>
|
|
31
|
+
|
|
32
|
+
<td rowspan="1" colSpan="1" >false</td>
|
|
33
|
+
|
|
34
|
+
<td rowspan="1" colSpan="1" >是否禁用输入组件</td>
|
|
35
|
+
</tr>
|
|
36
|
+
|
|
37
|
+
<tr>
|
|
38
|
+
<td rowspan="1" colSpan="1" >[hideSendButton](https://write.woa.com/document/181344257863962624)</td>
|
|
39
|
+
|
|
40
|
+
<td rowspan="1" colSpan="1" >boolean</td>
|
|
41
|
+
|
|
42
|
+
<td rowspan="1" colSpan="1" >false</td>
|
|
43
|
+
|
|
44
|
+
<td rowspan="1" colSpan="1" >是否隐藏发送按钮</td>
|
|
45
|
+
</tr>
|
|
46
|
+
|
|
47
|
+
<tr>
|
|
48
|
+
<td rowspan="1" colSpan="1" >[placeholder](https://write.woa.com/document/181344257863962624)</td>
|
|
49
|
+
|
|
50
|
+
<td rowspan="1" colSpan="1" >string</td>
|
|
51
|
+
|
|
52
|
+
<td rowspan="1" colSpan="1" >''</td>
|
|
53
|
+
|
|
54
|
+
<td rowspan="1" colSpan="1" >输入框占位符文本</td>
|
|
55
|
+
</tr>
|
|
56
|
+
|
|
57
|
+
<tr>
|
|
58
|
+
<td rowspan="1" colSpan="1" >[className](https://write.woa.com/document/181344257863962624)</td>
|
|
59
|
+
|
|
60
|
+
<td rowspan="1" colSpan="1" >string</td>
|
|
61
|
+
|
|
62
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
63
|
+
|
|
64
|
+
<td rowspan="1" colSpan="1" >根容器自定义 CSS 类名</td>
|
|
65
|
+
</tr>
|
|
66
|
+
|
|
67
|
+
<tr>
|
|
68
|
+
<td rowspan="1" colSpan="1" >[style](https://write.woa.com/document/181344257863962624)</td>
|
|
69
|
+
|
|
70
|
+
<td rowspan="1" colSpan="1" >React.CSSProperties</td>
|
|
71
|
+
|
|
72
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
73
|
+
|
|
74
|
+
<td rowspan="1" colSpan="1" >根容器自定义内联样式</td>
|
|
75
|
+
</tr>
|
|
76
|
+
|
|
77
|
+
<tr>
|
|
78
|
+
<td rowspan="1" colSpan="1" >[attachmentPickerMode](https://write.woa.com/document/181344257863962624)</td>
|
|
79
|
+
|
|
80
|
+
<td rowspan="1" colSpan="1" >'collapsed' \| 'expanded'</td>
|
|
81
|
+
|
|
82
|
+
<td rowspan="1" colSpan="1" >'collapsed'</td>
|
|
83
|
+
|
|
84
|
+
<td rowspan="1" colSpan="1" >附件选择器显示模式</td>
|
|
85
|
+
</tr>
|
|
86
|
+
|
|
87
|
+
<tr>
|
|
88
|
+
<td rowspan="1" colSpan="1" >[actions](https://write.woa.com/document/181344257863962624)</td>
|
|
89
|
+
|
|
90
|
+
<td rowspan="1" colSpan="1" >MessageInputActions</td>
|
|
91
|
+
|
|
92
|
+
<td rowspan="1" colSpan="1" >['EmojiPicker', 'AttachmentPicker']</td>
|
|
93
|
+
|
|
94
|
+
<td rowspan="1" colSpan="1" >工具栏操作按钮配置</td>
|
|
95
|
+
</tr>
|
|
96
|
+
|
|
97
|
+
<tr>
|
|
98
|
+
<td rowspan="1" colSpan="1" >[slots](https://write.woa.com/document/181344257863962624)</td>
|
|
99
|
+
|
|
100
|
+
<td rowspan="1" colSpan="1" >MessageInputSlots</td>
|
|
101
|
+
|
|
102
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
103
|
+
|
|
104
|
+
<td rowspan="1" colSpan="1" >插槽配置对象</td>
|
|
105
|
+
</tr>
|
|
106
|
+
|
|
107
|
+
<tr>
|
|
108
|
+
<td rowspan="1" colSpan="1" >[TextEditor](https://write.woa.com/document/181344257863962624)</td>
|
|
109
|
+
|
|
110
|
+
<td rowspan="1" colSpan="1" >JSX.Element</td>
|
|
111
|
+
|
|
112
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
113
|
+
|
|
114
|
+
<td rowspan="1" colSpan="1" >自定义文本编辑器组件</td>
|
|
115
|
+
</tr>
|
|
116
|
+
|
|
117
|
+
<tr>
|
|
118
|
+
<td rowspan="1" colSpan="1" >[EmojiPicker](https://write.woa.com/document/181344257863962624)</td>
|
|
119
|
+
|
|
120
|
+
<td rowspan="1" colSpan="1" >JSX.Element</td>
|
|
121
|
+
|
|
122
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
123
|
+
|
|
124
|
+
<td rowspan="1" colSpan="1" >自定义表情选择器组件</td>
|
|
125
|
+
</tr>
|
|
126
|
+
|
|
127
|
+
<tr>
|
|
128
|
+
<td rowspan="1" colSpan="1" >[AttachmentPicker](https://write.woa.com/document/181344257863962624)</td>
|
|
129
|
+
|
|
130
|
+
<td rowspan="1" colSpan="1" >JSX.Element</td>
|
|
131
|
+
|
|
132
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
133
|
+
|
|
134
|
+
<td rowspan="1" colSpan="1" >自定义附件选择器组件</td>
|
|
135
|
+
</tr>
|
|
136
|
+
|
|
137
|
+
<tr>
|
|
138
|
+
<td rowspan="1" colSpan="1" >[FilePicker](https://write.woa.com/document/181344257863962624)</td>
|
|
139
|
+
|
|
140
|
+
<td rowspan="1" colSpan="1" >JSX.Element</td>
|
|
141
|
+
|
|
142
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
143
|
+
|
|
144
|
+
<td rowspan="1" colSpan="1" >自定义文件选择器组件</td>
|
|
145
|
+
</tr>
|
|
146
|
+
|
|
147
|
+
<tr>
|
|
148
|
+
<td rowspan="1" colSpan="1" >[ImagePicker](https://write.woa.com/document/181344257863962624)</td>
|
|
149
|
+
|
|
150
|
+
<td rowspan="1" colSpan="1" >JSX.Element</td>
|
|
151
|
+
|
|
152
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
153
|
+
|
|
154
|
+
<td rowspan="1" colSpan="1" >自定义图片选择器组件</td>
|
|
155
|
+
</tr>
|
|
156
|
+
|
|
157
|
+
<tr>
|
|
158
|
+
<td rowspan="1" colSpan="1" >[VideoPicker](https://write.woa.com/document/181344257863962624)</td>
|
|
159
|
+
|
|
160
|
+
<td rowspan="1" colSpan="1" >JSX.Element</td>
|
|
161
|
+
|
|
162
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
163
|
+
|
|
164
|
+
<td rowspan="1" colSpan="1" >自定义视频选择器组件</td>
|
|
165
|
+
</tr>
|
|
166
|
+
</table>
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
## 自定义功能详解
|
|
170
|
+
|
|
171
|
+
### autoFocus
|
|
172
|
+
|
|
173
|
+
参数类型: `boolean`
|
|
174
|
+
|
|
175
|
+
autoFocus 用于设置是否在组件挂载时自动聚焦到输入框,默认值为 `true`。
|
|
176
|
+
|
|
177
|
+
### disabled
|
|
178
|
+
|
|
179
|
+
参数类型: `boolean`
|
|
180
|
+
|
|
181
|
+
disabled 用于设置是否禁用整个输入组件,包括文本输入和所有操作按钮,默认值为 `false`。
|
|
182
|
+
|
|
183
|
+
### hideSendButton
|
|
184
|
+
|
|
185
|
+
参数类型: `boolean`
|
|
186
|
+
|
|
187
|
+
hideSendButton 用于设置是否隐藏发送按钮,适用于需要自定义发送触发方式的场景,默认值为 `false`。
|
|
188
|
+
|
|
189
|
+
### placeholder
|
|
190
|
+
|
|
191
|
+
参数类型: `string`
|
|
192
|
+
|
|
193
|
+
placeholder 用于设置输入框的占位符文本,默认值为空字符串。
|
|
194
|
+
|
|
195
|
+
### className
|
|
196
|
+
|
|
197
|
+
参数类型: `string`
|
|
198
|
+
|
|
199
|
+
className 用于设置根容器自定义 CSS 类名,默认值为 `undefined`。
|
|
200
|
+
|
|
201
|
+
### style
|
|
202
|
+
|
|
203
|
+
参数类型: `React.CSSProperties`
|
|
204
|
+
|
|
205
|
+
style 用于设置根容器自定义内联样式,默认值为 `undefined`。
|
|
206
|
+
|
|
207
|
+
### attachmentPickerMode
|
|
208
|
+
|
|
209
|
+
参数类型: `'collapsed' | 'expanded'`
|
|
210
|
+
|
|
211
|
+
attachmentPickerMode 用于设置附件选择器的显示模式,默认值为 `'collapsed'`。
|
|
212
|
+
- `collapsed`: 收起模式,点击后展开选项
|
|
213
|
+
|
|
214
|
+
- `expanded`: 展开模式,直接显示所有选项
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
> **说明:**
|
|
218
|
+
>
|
|
219
|
+
|
|
220
|
+
> 默认的 AttachmentPicker 意为附件选择器,包括文件选择、图片选择和视频选择。
|
|
221
|
+
>
|
|
222
|
+
> 1. 当 attachmentPickerModel 为 "collapsed" 时,点击附件选择器会弹出一个 popup 菜单展示文件选择、图片选择、视频选择。
|
|
223
|
+
> 2. 当 attachmentPickerModel 为 "expanded" 时,附件选择器会默认展开,平铺展示文件选择、图片选择、视频选择。
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
### actions
|
|
227
|
+
|
|
228
|
+
参数类型: `MessageInputActions`
|
|
229
|
+
|
|
230
|
+
actions 用于配置工具栏中显示的操作按钮,默认值为 `['EmojiPicker', 'AttachmentPicker']`。
|
|
231
|
+
``` ts
|
|
232
|
+
type BuiltInAction =
|
|
233
|
+
| 'EmojiPicker'
|
|
234
|
+
| 'ImagePicker'
|
|
235
|
+
| 'FilePicker'
|
|
236
|
+
| 'VideoPicker'
|
|
237
|
+
| 'AttachmentPicker';
|
|
238
|
+
|
|
239
|
+
type CustomAction = {
|
|
240
|
+
key: string;
|
|
241
|
+
label?: string | undefined;
|
|
242
|
+
component?: React.ComponentType<any> | undefined;
|
|
243
|
+
className?: string | undefined;
|
|
244
|
+
style?: React.CSSProperties | undefined;
|
|
245
|
+
iconSize?: number | undefined;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
type MessageInputActions = Array<BuiltInAction | CustomAction>;
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
#### 示例1: 自定义工具栏按钮顺序
|
|
252
|
+
``` tsx
|
|
253
|
+
import { Chat, MessageInput } from '@tencentcloud/chat-uikit-react';
|
|
254
|
+
|
|
255
|
+
function ChatWithCustomActions() {
|
|
256
|
+
// 自定义按钮顺序:文件、图片、视频、表情
|
|
257
|
+
const customActions = ['FilePicker', 'ImagePicker', 'VideoPicker', 'EmojiPicker'];
|
|
258
|
+
|
|
259
|
+
return (
|
|
260
|
+
<Chat>
|
|
261
|
+
<MessageInput actions={customActions} />
|
|
262
|
+
</Chat>
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
#### 示例2: 添加自定义操作按钮 - 客服系统快捷回复
|
|
268
|
+
``` tsx
|
|
269
|
+
import { Chat, MessageInput } from '@tencentcloud/chat-uikit-react';
|
|
270
|
+
import { useMessageInputState } from '@/states';
|
|
271
|
+
|
|
272
|
+
// 快捷回复组件
|
|
273
|
+
function QuickReplyPicker() {
|
|
274
|
+
const { setContent } = useMessageInputState();
|
|
275
|
+
|
|
276
|
+
const quickReplies = [
|
|
277
|
+
'您好,很高兴为您服务!',
|
|
278
|
+
'请稍等,我来为您查询...',
|
|
279
|
+
'感谢您的咨询,还有其他问题吗?',
|
|
280
|
+
'问题已为您解决,祝您生活愉快!'
|
|
281
|
+
];
|
|
282
|
+
|
|
283
|
+
const handleQuickReply = (text: string) => {
|
|
284
|
+
setContent(text);
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
return (
|
|
288
|
+
<div style={{ position: 'relative' }}>
|
|
289
|
+
<button title="快捷回复">⚡</button>
|
|
290
|
+
<div style={{
|
|
291
|
+
position: 'absolute',
|
|
292
|
+
bottom: '100%',
|
|
293
|
+
left: 0,
|
|
294
|
+
background: 'white',
|
|
295
|
+
border: '1px solid #ccc',
|
|
296
|
+
borderRadius: '4px',
|
|
297
|
+
padding: '8px',
|
|
298
|
+
minWidth: '200px'
|
|
299
|
+
}}>
|
|
300
|
+
{quickReplies.map((reply, index) => (
|
|
301
|
+
<div
|
|
302
|
+
key={index}
|
|
303
|
+
onClick={() => handleQuickReply(reply)}
|
|
304
|
+
style={{
|
|
305
|
+
padding: '4px 8px',
|
|
306
|
+
cursor: 'pointer',
|
|
307
|
+
borderRadius: '2px'
|
|
308
|
+
}}
|
|
309
|
+
>
|
|
310
|
+
{reply}
|
|
311
|
+
</div>
|
|
312
|
+
))}
|
|
313
|
+
</div>
|
|
314
|
+
</div>
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function CustomerServiceChat() {
|
|
319
|
+
const actions = [
|
|
320
|
+
{
|
|
321
|
+
key: 'quickReply',
|
|
322
|
+
label: '快捷回复',
|
|
323
|
+
component: QuickReplyPicker
|
|
324
|
+
},
|
|
325
|
+
'EmojiPicker',
|
|
326
|
+
'FilePicker'
|
|
327
|
+
];
|
|
328
|
+
|
|
329
|
+
return (
|
|
330
|
+
<Chat>
|
|
331
|
+
<MessageInput actions={actions} />
|
|
332
|
+
</Chat>
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### slots
|
|
338
|
+
|
|
339
|
+
参数类型: `MessageInputSlots`
|
|
340
|
+
|
|
341
|
+
slots 用于在输入组件的特定位置插入自定义内容,默认值为 `undefined`。
|
|
342
|
+
``` ts
|
|
343
|
+
interface MessageInputSlots {
|
|
344
|
+
headerToolbar?: () => React.ReactNode;
|
|
345
|
+
footerToolbar?: () => React.ReactNode;
|
|
346
|
+
leftInline?: () => React.ReactNode;
|
|
347
|
+
rightInline?: () => React.ReactNode;
|
|
348
|
+
inputPrefix?: () => React.ReactNode;
|
|
349
|
+
inputSuffix?: () => React.ReactNode;
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+

|
|
354
|
+
|
|
355
|
+
MessageInput 结构图解
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
#### 示例1: 添加消息统计显示
|
|
359
|
+
``` tsx
|
|
360
|
+
import { Chat, MessageInput } from '@tencentcloud/chat-uikit-react';
|
|
361
|
+
import { useMessageInputState } from '@/states';
|
|
362
|
+
|
|
363
|
+
function ChatWithMessageStats() {
|
|
364
|
+
const { inputRawValue } = useMessageInputState();
|
|
365
|
+
|
|
366
|
+
// 头部工具栏:显示字符统计
|
|
367
|
+
const HeaderToolbar = () => !inputRawValue
|
|
368
|
+
? null
|
|
369
|
+
: (
|
|
370
|
+
<div style={{
|
|
371
|
+
padding: '4px 12px',
|
|
372
|
+
fontSize: '12px',
|
|
373
|
+
color: '#666',
|
|
374
|
+
borderBottom: '1px solid #eee',
|
|
375
|
+
}}
|
|
376
|
+
>
|
|
377
|
+
字符数:
|
|
378
|
+
{' '}
|
|
379
|
+
{inputRawValue?.reduce((acc, item) => acc + (item.type === 'text' ? item.content.length : 1), 0) || 0}
|
|
380
|
+
/500
|
|
381
|
+
</div>
|
|
382
|
+
);
|
|
383
|
+
|
|
384
|
+
// 底部工具栏:显示发送提示
|
|
385
|
+
const FooterToolbar = () => (
|
|
386
|
+
<div style={{
|
|
387
|
+
padding: '4px 12px',
|
|
388
|
+
fontSize: '12px',
|
|
389
|
+
color: '#999',
|
|
390
|
+
textAlign: 'right'
|
|
391
|
+
}}>
|
|
392
|
+
按 Ctrl+Enter 换行
|
|
393
|
+
</div>
|
|
394
|
+
);
|
|
395
|
+
|
|
396
|
+
return (
|
|
397
|
+
<Chat>
|
|
398
|
+
<MessageInput
|
|
399
|
+
slots={{
|
|
400
|
+
headerToolbar: HeaderToolbar,
|
|
401
|
+
footerToolbar: FooterToolbar
|
|
402
|
+
}}
|
|
403
|
+
/>
|
|
404
|
+
</Chat>
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
#### 示例2: 输入框前后缀功能
|
|
410
|
+
``` tsx
|
|
411
|
+
import { Chat, MessageInput } from '@tencentcloud/chat-uikit-react';
|
|
412
|
+
|
|
413
|
+
function ChatWithInputPrefixSuffix() {
|
|
414
|
+
// 输入框前缀:@提醒功能
|
|
415
|
+
const InputPrefix = () => (
|
|
416
|
+
<button
|
|
417
|
+
style={{
|
|
418
|
+
border: 'none',
|
|
419
|
+
background: 'transparent',
|
|
420
|
+
color: '#1890ff',
|
|
421
|
+
cursor: 'pointer'
|
|
422
|
+
}}
|
|
423
|
+
onClick={() => {
|
|
424
|
+
// 触发@用户选择
|
|
425
|
+
console.log('打开@用户选择');
|
|
426
|
+
}}
|
|
427
|
+
>
|
|
428
|
+
@
|
|
429
|
+
</button>
|
|
430
|
+
);
|
|
431
|
+
|
|
432
|
+
// 输入框后缀:语音输入
|
|
433
|
+
const InputSuffix = () => (
|
|
434
|
+
<button
|
|
435
|
+
style={{
|
|
436
|
+
border: 'none',
|
|
437
|
+
background: 'transparent',
|
|
438
|
+
cursor: 'pointer'
|
|
439
|
+
}}
|
|
440
|
+
onClick={() => {
|
|
441
|
+
// 开始语音输入
|
|
442
|
+
console.log('开始语音输入');
|
|
443
|
+
}}
|
|
444
|
+
>
|
|
445
|
+
🎤
|
|
446
|
+
</button>
|
|
447
|
+
);
|
|
448
|
+
|
|
449
|
+
return (
|
|
450
|
+
<Chat>
|
|
451
|
+
<MessageInput
|
|
452
|
+
slots={{
|
|
453
|
+
inputPrefix: InputPrefix,
|
|
454
|
+
inputSuffix: InputSuffix
|
|
455
|
+
}}
|
|
456
|
+
/>
|
|
457
|
+
</Chat>
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
#### 示例3: 完全自定义左右侧工具栏
|
|
463
|
+
``` tsx
|
|
464
|
+
import { Chat, MessageInput } from '@tencentcloud/chat-uikit-react';
|
|
465
|
+
|
|
466
|
+
function ChatWithCustomToolbars() {
|
|
467
|
+
// 左侧工具栏:仅保留表情和图片
|
|
468
|
+
const LeftInline = () => (
|
|
469
|
+
<div style={{ display: 'flex', gap: '8px' }}>
|
|
470
|
+
<button>😊</button>
|
|
471
|
+
<button>📷</button>
|
|
472
|
+
</div>
|
|
473
|
+
);
|
|
474
|
+
|
|
475
|
+
// 右侧工具栏:自定义发送区域
|
|
476
|
+
const RightInline = () => (
|
|
477
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
478
|
+
<span style={{ fontSize: '12px', color: '#666' }}>
|
|
479
|
+
Enter
|
|
480
|
+
</span>
|
|
481
|
+
<button
|
|
482
|
+
style={{
|
|
483
|
+
padding: '6px 12px',
|
|
484
|
+
background: '#1890ff',
|
|
485
|
+
color: 'white',
|
|
486
|
+
border: 'none',
|
|
487
|
+
borderRadius: '4px',
|
|
488
|
+
cursor: 'pointer'
|
|
489
|
+
}}
|
|
490
|
+
>
|
|
491
|
+
发送
|
|
492
|
+
</button>
|
|
493
|
+
</div>
|
|
494
|
+
);
|
|
495
|
+
|
|
496
|
+
return (
|
|
497
|
+
<Chat>
|
|
498
|
+
<MessageInput
|
|
499
|
+
slots={{
|
|
500
|
+
leftInline: LeftInline,
|
|
501
|
+
rightInline: RightInline
|
|
502
|
+
}}
|
|
503
|
+
/>
|
|
504
|
+
</Chat>
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
### TextEditor
|
|
510
|
+
|
|
511
|
+
参数类型: `JSX.Element`
|
|
512
|
+
|
|
513
|
+
TextEditor 用于替换默认的文本编辑器组件,默认值为 `undefined`。
|
|
514
|
+
|
|
515
|
+
#### 示例: 集成富文本编辑器
|
|
516
|
+
``` tsx
|
|
517
|
+
import { Chat, MessageInput, useMessageInputState } from '@tencentcloud/chat-uikit-react';
|
|
518
|
+
|
|
519
|
+
// 自定义富文本编辑器
|
|
520
|
+
function RichTextEditor() {
|
|
521
|
+
const { sendMessage } = useMessageInputState();
|
|
522
|
+
const [inputValue, setInputValue] = useState('');
|
|
523
|
+
|
|
524
|
+
const handleContentChange = (content: string) => {
|
|
525
|
+
setInputValue(content);
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
const handleKeyDown = (e: React.KeyboardEvent) => {
|
|
529
|
+
// Enter 发送消息
|
|
530
|
+
if (e.key === 'Enter') {
|
|
531
|
+
// 触发发送逻辑
|
|
532
|
+
e.preventDefault();
|
|
533
|
+
sendMessage(inputValue);
|
|
534
|
+
// 清空 editable div 的输入内容
|
|
535
|
+
const editableDiv = document.querySelector('.editable-div');
|
|
536
|
+
if (editableDiv) {
|
|
537
|
+
editableDiv.textContent = '';
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
return (
|
|
543
|
+
<div style={{
|
|
544
|
+
flex: 1,
|
|
545
|
+
border: '1px solid #d9d9d9',
|
|
546
|
+
borderRadius: '6px',
|
|
547
|
+
padding: '8px 12px',
|
|
548
|
+
minHeight: '32px',
|
|
549
|
+
maxHeight: '120px',
|
|
550
|
+
overflow: 'auto',
|
|
551
|
+
}}
|
|
552
|
+
>
|
|
553
|
+
<div
|
|
554
|
+
contentEditable
|
|
555
|
+
className="editable-div"
|
|
556
|
+
style={{
|
|
557
|
+
outline: 'none',
|
|
558
|
+
minHeight: '20px',
|
|
559
|
+
lineHeight: '20px',
|
|
560
|
+
}}
|
|
561
|
+
onInput={(e) => {
|
|
562
|
+
handleContentChange(e.currentTarget.textContent || '');
|
|
563
|
+
}}
|
|
564
|
+
onKeyDown={handleKeyDown}
|
|
565
|
+
/>
|
|
566
|
+
</div>
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
function ChatWithRichTextEditor() {
|
|
571
|
+
return (
|
|
572
|
+
<Chat>
|
|
573
|
+
<MessageInput TextEditor={<RichTextEditor />} />
|
|
574
|
+
</Chat>
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
### EmojiPicker
|
|
580
|
+
|
|
581
|
+
参数类型: `JSX.Element`
|
|
582
|
+
|
|
583
|
+
EmojiPicker 用于替换默认的表情选择器组件,默认值为 `undefined`。
|
|
584
|
+
|
|
585
|
+
#### 示例: 自定义表情面板
|
|
586
|
+
``` tsx
|
|
587
|
+
import { Chat, MessageInput } from '@tencentcloud/chat-uikit-react';
|
|
588
|
+
import { useMessageInputState } from '@/states';
|
|
589
|
+
|
|
590
|
+
// 自定义表情选择器
|
|
591
|
+
function CustomEmojiPicker() {
|
|
592
|
+
const { insertContent } = useMessageInputState();
|
|
593
|
+
|
|
594
|
+
const emojiCategories = {
|
|
595
|
+
常用: ['😀', '😂', '🥰', '😍', '🤔', '😭', '😡', '👍'],
|
|
596
|
+
手势: ['👋', '🤝', '👏', '🙏', '✌️', '🤞', '🤟', '👌'],
|
|
597
|
+
动物: ['🐶', '🐱', '🐭', '🐹', '🐰', '🦊', '🐻', '🐼'],
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
const [activeCategory, setActiveCategory] = useState('常用');
|
|
601
|
+
const [showPicker, setShowPicker] = useState(false);
|
|
602
|
+
|
|
603
|
+
const insertEmoji = (emoji: string) => {
|
|
604
|
+
insertContent(emoji);
|
|
605
|
+
setShowPicker(false);
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
return (
|
|
609
|
+
<div style={{ position: 'relative' }}>
|
|
610
|
+
<button
|
|
611
|
+
onClick={() => setShowPicker(!showPicker)}
|
|
612
|
+
style={{ border: 'none', background: 'transparent', cursor: 'pointer' }}
|
|
613
|
+
>
|
|
614
|
+
😊
|
|
615
|
+
</button>
|
|
616
|
+
|
|
617
|
+
{showPicker && (
|
|
618
|
+
<div style={{
|
|
619
|
+
position: 'absolute',
|
|
620
|
+
bottom: '100%',
|
|
621
|
+
left: 0,
|
|
622
|
+
background: 'white',
|
|
623
|
+
border: '1px solid #ccc',
|
|
624
|
+
borderRadius: '8px',
|
|
625
|
+
padding: '12px',
|
|
626
|
+
width: '280px',
|
|
627
|
+
boxShadow: '0 4px 12px rgba(0,0,0,0.1)',
|
|
628
|
+
}}
|
|
629
|
+
>
|
|
630
|
+
{/* 分类标签 */}
|
|
631
|
+
<div style={{ display: 'flex', marginBottom: '8px' }}>
|
|
632
|
+
{Object.keys(emojiCategories).map(category => (
|
|
633
|
+
<button
|
|
634
|
+
key={category}
|
|
635
|
+
onClick={() => setActiveCategory(category)}
|
|
636
|
+
style={{
|
|
637
|
+
padding: '4px 8px',
|
|
638
|
+
border: 'none',
|
|
639
|
+
background: activeCategory === category ? '#1890ff' : 'transparent',
|
|
640
|
+
color: activeCategory === category ? 'white' : '#666',
|
|
641
|
+
borderRadius: '4px',
|
|
642
|
+
cursor: 'pointer',
|
|
643
|
+
fontSize: '12px',
|
|
644
|
+
}}
|
|
645
|
+
>
|
|
646
|
+
{category}
|
|
647
|
+
</button>
|
|
648
|
+
))}
|
|
649
|
+
</div>
|
|
650
|
+
|
|
651
|
+
{/* 表情网格 */}
|
|
652
|
+
<div style={{
|
|
653
|
+
display: 'grid',
|
|
654
|
+
gridTemplateColumns: 'repeat(8, 1fr)',
|
|
655
|
+
gap: '4px',
|
|
656
|
+
}}
|
|
657
|
+
>
|
|
658
|
+
{emojiCategories[activeCategory].map(emoji => (
|
|
659
|
+
<button
|
|
660
|
+
key={emoji}
|
|
661
|
+
onClick={() => insertEmoji(emoji)}
|
|
662
|
+
style={{
|
|
663
|
+
border: 'none',
|
|
664
|
+
background: 'transparent',
|
|
665
|
+
fontSize: '20px',
|
|
666
|
+
cursor: 'pointer',
|
|
667
|
+
padding: '4px',
|
|
668
|
+
borderRadius: '4px',
|
|
669
|
+
}}
|
|
670
|
+
>
|
|
671
|
+
{emoji}
|
|
672
|
+
</button>
|
|
673
|
+
))}
|
|
674
|
+
</div>
|
|
675
|
+
</div>
|
|
676
|
+
)}
|
|
677
|
+
</div>
|
|
678
|
+
);
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
function ChatWithCustomEmoji() {
|
|
682
|
+
return (
|
|
683
|
+
<Chat>
|
|
684
|
+
<MessageInput EmojiPicker={<CustomEmojiPicker />} />
|
|
685
|
+
</Chat>
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
### AttachmentPicker
|
|
691
|
+
|
|
692
|
+
参数类型: `JSX.Element`
|
|
693
|
+
|
|
694
|
+
AttachmentPicker 用于替换默认的附件选择器组件,默认值为 `undefined`。
|
|
695
|
+
|
|
696
|
+
#### 示例: 云存储集成的附件选择器
|
|
697
|
+
``` tsx
|
|
698
|
+
import { Chat, MessageInput } from '@tencentcloud/chat-uikit-react';
|
|
699
|
+
|
|
700
|
+
// 集成云存储的附件选择器
|
|
701
|
+
function CloudAttachmentPicker() {
|
|
702
|
+
const [showPicker, setShowPicker] = useState(false);
|
|
703
|
+
|
|
704
|
+
const attachmentTypes = [
|
|
705
|
+
{ key: 'local', label: '本地文件', icon: '📁' },
|
|
706
|
+
{ key: 'cloud', label: '云端文件', icon: '☁️' },
|
|
707
|
+
{ key: 'recent', label: '最近文件', icon: '🕒' },
|
|
708
|
+
{ key: 'screenshot', label: '截图', icon: '📷' }
|
|
709
|
+
];
|
|
710
|
+
|
|
711
|
+
const handleAttachmentSelect = async (type: string) => {
|
|
712
|
+
switch (type) {
|
|
713
|
+
case 'local':
|
|
714
|
+
// 打开本地文件选择
|
|
715
|
+
const input = document.createElement('input');
|
|
716
|
+
input.type = 'file';
|
|
717
|
+
input.multiple = true;
|
|
718
|
+
input.onchange = (e) => {
|
|
719
|
+
const files = (e.target as HTMLInputElement).files;
|
|
720
|
+
console.log('选择的本地文件:', files);
|
|
721
|
+
};
|
|
722
|
+
input.click();
|
|
723
|
+
break;
|
|
724
|
+
|
|
725
|
+
case 'cloud':
|
|
726
|
+
// 打开云端文件选择
|
|
727
|
+
console.log('打开云端文件选择');
|
|
728
|
+
break;
|
|
729
|
+
|
|
730
|
+
case 'recent':
|
|
731
|
+
// 显示最近文件
|
|
732
|
+
console.log('显示最近文件');
|
|
733
|
+
break;
|
|
734
|
+
|
|
735
|
+
case 'screenshot':
|
|
736
|
+
// 开始截图
|
|
737
|
+
console.log('开始截图');
|
|
738
|
+
break;
|
|
739
|
+
}
|
|
740
|
+
setShowPicker(false);
|
|
741
|
+
};
|
|
742
|
+
|
|
743
|
+
return (
|
|
744
|
+
<div style={{ position: 'relative' }}>
|
|
745
|
+
<button
|
|
746
|
+
onClick={() => setShowPicker(!showPicker)}
|
|
747
|
+
style={{ border: 'none', background: 'transparent', cursor: 'pointer' }}
|
|
748
|
+
>
|
|
749
|
+
📎
|
|
750
|
+
</button>
|
|
751
|
+
|
|
752
|
+
{showPicker && (
|
|
753
|
+
<div style={{
|
|
754
|
+
position: 'absolute',
|
|
755
|
+
bottom: '100%',
|
|
756
|
+
left: 0,
|
|
757
|
+
background: 'white',
|
|
758
|
+
border: '1px solid #ccc',
|
|
759
|
+
borderRadius: '8px',
|
|
760
|
+
padding: '8px',
|
|
761
|
+
minWidth: '160px',
|
|
762
|
+
boxShadow: '0 4px 12px rgba(0,0,0,0.1)'
|
|
763
|
+
}}>
|
|
764
|
+
{attachmentTypes.map(type => (
|
|
765
|
+
<div
|
|
766
|
+
key={type.key}
|
|
767
|
+
onClick={() => handleAttachmentSelect(type.key)}
|
|
768
|
+
style={{
|
|
769
|
+
display: 'flex',
|
|
770
|
+
alignItems: 'center',
|
|
771
|
+
gap: '8px',
|
|
772
|
+
padding: '8px 12px',
|
|
773
|
+
cursor: 'pointer',
|
|
774
|
+
borderRadius: '4px',
|
|
775
|
+
fontSize: '14px'
|
|
776
|
+
}}
|
|
777
|
+
>
|
|
778
|
+
<span>{type.icon}</span>
|
|
779
|
+
<span>{type.label}</span>
|
|
780
|
+
</div>
|
|
781
|
+
))}
|
|
782
|
+
</div>
|
|
783
|
+
)}
|
|
784
|
+
</div>
|
|
785
|
+
);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
function ChatWithCloudAttachment() {
|
|
789
|
+
return (
|
|
790
|
+
<Chat>
|
|
791
|
+
<MessageInput AttachmentPicker={<CloudAttachmentPicker />} />
|
|
792
|
+
</Chat>
|
|
793
|
+
);
|
|
794
|
+
}
|
|
795
|
+
```
|
|
796
|
+
|
|
797
|
+
## 总结
|
|
798
|
+
|
|
799
|
+
MessageInput 组件提供了完整的消息输入功能和丰富的自定义选项。通过合理配置 Props 和使用插槽系统,您可以创建出符合特定业务需求的输入界面。建议根据实际使用场景选择合适的自定义方案,并注意保持良好的用户体验和性能表现。
|