"use strict";const common_vendor=require("../../../../../../common/vendor.js");const uni_modules_zPaging_components_zPaging_js_zPagingUtils=require("../z-paging-utils.js");const chatRecordModerModule={props:{useChatRecordMode:{type:Boolean,default:uni_modules_zPaging_components_zPaging_js_zPagingUtils.u.gc("useChatRecordMode",false)},chatRecordMoreOffset:{type:[Number,String],default:uni_modules_zPaging_components_zPaging_js_zPagingUtils.u.gc("chatRecordMoreOffset","0rpx")},autoHideKeyboardWhenChat:{type:Boolean,default:uni_modules_zPaging_components_zPaging_js_zPagingUtils.u.gc("autoHideKeyboardWhenChat",true)},autoAdjustPositionWhenChat:{type:Boolean,default:uni_modules_zPaging_components_zPaging_js_zPagingUtils.u.gc("autoAdjustPositionWhenChat",true)},chatAdjustPositionOffset:{type:[Number,String],default:uni_modules_zPaging_components_zPaging_js_zPagingUtils.u.gc("chatAdjustPositionOffset","0rpx")},autoToBottomWhenChat:{type:Boolean,default:uni_modules_zPaging_components_zPaging_js_zPagingUtils.u.gc("autoToBottomWhenChat",false)},showChatLoadingWhenReload:{type:Boolean,default:uni_modules_zPaging_components_zPaging_js_zPagingUtils.u.gc("showChatLoadingWhenReload",false)},chatLoadingMoreDefaultAsLoading:{type:Boolean,default:uni_modules_zPaging_components_zPaging_js_zPagingUtils.u.gc("chatLoadingMoreDefaultAsLoading",true)}},data(){return{keyboardHeight:0,isKeyboardHeightChanged:false}},computed:{finalChatRecordMoreOffset(){return uni_modules_zPaging_components_zPaging_js_zPagingUtils.u.convertToPx(this.chatRecordMoreOffset)},finalChatAdjustPositionOffset(){return uni_modules_zPaging_components_zPaging_js_zPagingUtils.u.convertToPx(this.chatAdjustPositionOffset)},chatRecordRotateStyle(){let cellStyle;cellStyle=this.useChatRecordMode?{transform:"scaleY(-1)"}:{};this.$emit("update:cellStyle",cellStyle);this.$emit("cellStyleChange",cellStyle);this.$nextTick((()=>{if(this.isFirstPage&&this.isChatRecordModeAndNotInversion){this.$nextTick((()=>{this._scrollToBottom(false);uni_modules_zPaging_components_zPaging_js_zPagingUtils.u.delay((()=>{this._scrollToBottom(false);uni_modules_zPaging_components_zPaging_js_zPagingUtils.u.delay((()=>{this._scrollToBottom(false)}),50)}),50)}))}}));return cellStyle},isChatRecordModeHasTransform(){return this.useChatRecordMode&&this.chatRecordRotateStyle&&this.chatRecordRotateStyle.transform},isChatRecordModeAndNotInversion(){return this.isChatRecordModeHasTransform&&this.chatRecordRotateStyle.transform==="scaleY(1)"},isChatRecordModeAndInversion(){return this.isChatRecordModeHasTransform&&this.chatRecordRotateStyle.transform==="scaleY(-1)"},chatRecordModeSafeAreaBottom(){return this.safeAreaInsetBottom&&!this.keyboardHeight?this.safeAreaBottom:0}},mounted(){if(this.useChatRecordMode){common_vendor.index.onKeyboardHeightChange(this._handleKeyboardHeightChange)}},methods:{addChatRecordData(data,toBottom=true,toBottomWithAnimate=true){if(!this.useChatRecordMode)return;this.isTotalChangeFromAddData=true;this.addDataFromTop(data,toBottom,toBottomWithAnimate)},doChatRecordLoadMore(){this.useChatRecordMode&&this._onLoadingMore("click")},_handleKeyboardHeightChange(res){this.$emit("keyboardHeightChange",res);if(this.autoAdjustPositionWhenChat){this.isKeyboardHeightChanged=true;this.keyboardHeight=res.height>0?res.height+this.finalChatAdjustPositionOffset:res.height}if(this.autoToBottomWhenChat&&this.keyboardHeight>0){uni_modules_zPaging_components_zPaging_js_zPagingUtils.u.delay((()=>{this.scrollToBottom(false);uni_modules_zPaging_components_zPaging_js_zPagingUtils.u.delay((()=>{this.scrollToBottom(false)}))}))}}}};exports.chatRecordModerModule=chatRecordModerModule;
