// comps/chat/inputbar/suit/emoji/emoji.js
let WebIM = require("../../../../../utils/WebIM")["default"];
let msgType = require("../../../../../utils/msgtype");
let EMOJI_STATUS = {
    OPENED: "showEmoji",
    CLOSED: "emoji_list",
};

Component({
    /**
     * 组件的属性列表
     */
    properties: {

    },

    /**
     * 组件的初始数据
     */
    data: {
        show: EMOJI_STATUS.CLOSED,
        emoji: WebIM.Emoji,
        emojiObj: WebIM.EmojiObj,

        interval: 5000,
        duration: 1000,
        autoplay: false,
        indicatorDots: true,	// 显示面板指示点
    },

    /**
     * 组件的方法列表
     */
    methods: {
        openEmoji() {
            this.setData({
                show: EMOJI_STATUS.OPENED
            });
        },

        cancelEmoji() {
            this.setData({
                show: EMOJI_STATUS.CLOSED
            });
        },

        // 输出 emoji
        sendEmoji(event) {
            var emoji = event.target.dataset.emoji;
            this.triggerEvent(
                "newEmojiStr",
                {
                    msg: emoji,
                    type: msgType.EMOJI,
                },
                {
                    bubbles: true,
                    composed: true
                }
            );
        },
    }
})
