消息
This commit is contained in:
176
unpackage/dist/dev/mp-weixin/TUIKit/components/TUIChat/message-input/index.js
vendored
Normal file
176
unpackage/dist/dev/mp-weixin/TUIKit/components/TUIChat/message-input/index.js
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
require("../../../adapter-vue.js");
|
||||
const common_assets = require("../../../../common/assets.js");
|
||||
const TUIKit_utils_env = require("../../../utils/env.js");
|
||||
const TUIKit_components_TUIChat_utils_sendMessage = require("../utils/sendMessage.js");
|
||||
const TUIKit_components_TUIChat_config = require("../config.js");
|
||||
if (!Math) {
|
||||
(MessageInputAudio + MessageInputEditor + MessageInputAt + Icon + MessageQuote)();
|
||||
}
|
||||
const MessageInputEditor = () => "./message-input-editor.js";
|
||||
const MessageInputAt = () => "./message-input-at/index.js";
|
||||
const MessageInputAudio = () => "./message-input-audio.js";
|
||||
const MessageQuote = () => "./message-input-quote/index.js";
|
||||
const Icon = () => "../../common/Icon.js";
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
__name: "index",
|
||||
props: {
|
||||
placeholder: { default: "this is placeholder" },
|
||||
isMuted: { type: Boolean, default: true },
|
||||
muteText: { default: "" },
|
||||
enableInput: { type: Boolean, default: true },
|
||||
enableAt: { type: Boolean, default: true },
|
||||
enableTyping: { type: Boolean, default: true },
|
||||
replyOrReference: { default: () => ({}) },
|
||||
inputToolbarDisplayType: { default: "none" }
|
||||
},
|
||||
emits: ["changeToolbarDisplayType"],
|
||||
setup(__props, { expose: __expose, emit: __emit }) {
|
||||
const emits = __emit;
|
||||
const props = __props;
|
||||
const editor = common_vendor.ref();
|
||||
const messageInputAtRef = common_vendor.ref();
|
||||
const currentConversation = common_vendor.ref();
|
||||
const isGroup = common_vendor.ref(false);
|
||||
const displayType = common_vendor.ref("editor");
|
||||
const featureConfig = TUIKit_components_TUIChat_config.ChatConfig.getFeatureConfig();
|
||||
const isRenderVoice = common_vendor.ref(featureConfig.InputVoice);
|
||||
const isRenderEmojiPicker = common_vendor.ref(featureConfig.InputEmoji || featureConfig.InputStickers);
|
||||
const isRenderMore = common_vendor.ref(featureConfig.InputImage || featureConfig.InputVideo || featureConfig.InputEvaluation || featureConfig.InputQuickReplies);
|
||||
common_vendor.onMounted(() => {
|
||||
common_vendor.Jt.watch(common_vendor.o.CONV, {
|
||||
currentConversation: onCurrentConversationUpdated
|
||||
});
|
||||
common_vendor.Jt.watch(common_vendor.o.CHAT, {
|
||||
quoteMessage: onQuoteMessageUpdated
|
||||
});
|
||||
});
|
||||
common_vendor.onUnmounted(() => {
|
||||
common_vendor.Jt.unwatch(common_vendor.o.CONV, {
|
||||
currentConversation: onCurrentConversationUpdated
|
||||
});
|
||||
common_vendor.Jt.unwatch(common_vendor.o.CHAT, {
|
||||
quoteMessage: onQuoteMessageUpdated
|
||||
});
|
||||
});
|
||||
common_vendor.watch(() => props.inputToolbarDisplayType, (newVal) => {
|
||||
if (newVal !== "none") {
|
||||
changeDisplayType("editor");
|
||||
}
|
||||
});
|
||||
function changeDisplayType(display) {
|
||||
displayType.value = display;
|
||||
if (display === "audio") {
|
||||
emits("changeToolbarDisplayType", "none");
|
||||
}
|
||||
}
|
||||
function changeToolbarDisplayType(displayType2) {
|
||||
emits("changeToolbarDisplayType", displayType2);
|
||||
}
|
||||
const onTyping = (inputContentEmpty, inputBlur) => {
|
||||
TUIKit_components_TUIChat_utils_sendMessage.sendTyping(inputContentEmpty, inputBlur);
|
||||
};
|
||||
const onAt = (show) => {
|
||||
var _a;
|
||||
(_a = messageInputAtRef == null ? void 0 : messageInputAtRef.value) == null ? void 0 : _a.toggleAtList(show);
|
||||
};
|
||||
const onFocus = () => {
|
||||
if (TUIKit_utils_env.isH5) {
|
||||
emits("changeToolbarDisplayType", "none");
|
||||
}
|
||||
};
|
||||
const insertEmoji = (emoji) => {
|
||||
var _a, _b;
|
||||
((_a = editor == null ? void 0 : editor.value) == null ? void 0 : _a.addEmoji) && ((_b = editor == null ? void 0 : editor.value) == null ? void 0 : _b.addEmoji(emoji));
|
||||
};
|
||||
const insertAt = (atInfo) => {
|
||||
var _a, _b;
|
||||
((_a = editor == null ? void 0 : editor.value) == null ? void 0 : _a.insertAt) && ((_b = editor == null ? void 0 : editor.value) == null ? void 0 : _b.insertAt(atInfo));
|
||||
};
|
||||
const onAtListOpen = () => {
|
||||
var _a, _b;
|
||||
((_a = editor == null ? void 0 : editor.value) == null ? void 0 : _a.blur) && ((_b = editor == null ? void 0 : editor.value) == null ? void 0 : _b.blur());
|
||||
};
|
||||
const reEdit = (content) => {
|
||||
var _a, _b;
|
||||
(_a = editor == null ? void 0 : editor.value) == null ? void 0 : _a.resetEditor();
|
||||
(_b = editor == null ? void 0 : editor.value) == null ? void 0 : _b.setEditorContent(content);
|
||||
};
|
||||
function onCurrentConversationUpdated(conversation) {
|
||||
var _a;
|
||||
currentConversation.value = conversation;
|
||||
isGroup.value = ((_a = currentConversation.value) == null ? void 0 : _a.type) === common_vendor.qt.TYPES.CONV_GROUP;
|
||||
}
|
||||
function onQuoteMessageUpdated(options) {
|
||||
if ((options == null ? void 0 : options.message) && (options == null ? void 0 : options.type) === "quote") {
|
||||
changeDisplayType("editor");
|
||||
}
|
||||
}
|
||||
__expose({
|
||||
insertEmoji,
|
||||
reEdit
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: (common_vendor.unref(TUIKit_utils_env.isWeChat) || common_vendor.unref(TUIKit_utils_env.isApp)) && common_vendor.unref(isRenderVoice)
|
||||
}, (common_vendor.unref(TUIKit_utils_env.isWeChat) || common_vendor.unref(TUIKit_utils_env.isApp)) && common_vendor.unref(isRenderVoice) ? {
|
||||
b: common_vendor.unref(displayType) === "audio" ? 1 : "",
|
||||
c: common_vendor.o$1(changeDisplayType),
|
||||
d: common_vendor.p({
|
||||
isEnableAudio: common_vendor.unref(displayType) === "audio"
|
||||
})
|
||||
} : {}, {
|
||||
e: common_vendor.sr(editor, "ceb9e230-1", {
|
||||
"k": "editor"
|
||||
}),
|
||||
f: common_vendor.unref(displayType) === "editor",
|
||||
g: common_vendor.o$1(onTyping),
|
||||
h: common_vendor.o$1(onAt),
|
||||
i: common_vendor.o$1(onFocus),
|
||||
j: common_vendor.p({
|
||||
placeholder: props.placeholder,
|
||||
isMuted: props.isMuted,
|
||||
muteText: props.muteText,
|
||||
enableInput: props.enableInput,
|
||||
enableAt: props.enableAt,
|
||||
enableTyping: props.enableTyping,
|
||||
isGroup: common_vendor.unref(isGroup)
|
||||
}),
|
||||
k: props.enableAt
|
||||
}, props.enableAt ? {
|
||||
l: common_vendor.sr(messageInputAtRef, "ceb9e230-2", {
|
||||
"k": "messageInputAtRef"
|
||||
}),
|
||||
m: common_vendor.o$1(insertAt),
|
||||
n: common_vendor.o$1(onAtListOpen)
|
||||
} : {}, {
|
||||
o: common_vendor.unref(isRenderEmojiPicker)
|
||||
}, common_vendor.unref(isRenderEmojiPicker) ? {
|
||||
p: common_vendor.o$1(($event) => changeToolbarDisplayType("emojiPicker")),
|
||||
q: common_vendor.p({
|
||||
file: common_vendor.unref(common_assets.faceIcon),
|
||||
size: "23px",
|
||||
hotAreaSize: "3px"
|
||||
})
|
||||
} : {}, {
|
||||
r: common_vendor.unref(isRenderMore)
|
||||
}, common_vendor.unref(isRenderMore) ? {
|
||||
s: common_vendor.o$1(($event) => changeToolbarDisplayType("tools")),
|
||||
t: common_vendor.p({
|
||||
file: common_vendor.unref(common_assets.moreIcon),
|
||||
size: "23px",
|
||||
hotAreaSize: "3px"
|
||||
})
|
||||
} : {}, {
|
||||
v: common_vendor.p({
|
||||
displayType: common_vendor.unref(displayType)
|
||||
}),
|
||||
w: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "message-input-h5")
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-ceb9e230"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIChat/message-input/index.js.map
|
||||
Reference in New Issue
Block a user