828.388358ac.js 39 KB

1
  1. "use strict";(self["webpackChunk_zoom_client_email_desktop"]=self["webpackChunk_zoom_client_email_desktop"]||[]).push([[828],{31305:function(e,t,a){a.r(t),a.d(t,{default:function(){return Ae}});var i=function(){var e=this,t=e._self._c;return t("div",{directives:[{name:"show",rawName:"v-show",value:e.controlHeaderVisible,expression:"controlHeaderVisible"}],ref:"controlHeader",staticClass:"control-header"},[t("zm-dropdown",{directives:[{name:"show",rawName:"v-show",value:e.checkBoxVisible,expression:"checkBoxVisible"}],ref:"checkAll",attrs:{trigger:"click",role:"presentation",placement:"bottom"},on:{command:e.handleCheckMore}},[t("div",{staticClass:"check-all-container tab-focus",attrs:{"aria-label":e.$t("accessibility.checkAll"),tabindex:"0",role:"button"}},[t("zm-checkbox",{directives:[{name:"metric",rawName:"v-metric:inbox_header_action_all",arg:"inbox_header_action_all"}],staticClass:"control-header-select-checkbox",attrs:{tabindex:"-1",indeterminate:e.isIndeterminate,controls:Object.keys(e.mailHead).join(" "),"zm-ta":"inbox-control-header-check-all"},on:{change:e.handleCheckAllChange},model:{value:e.checkAll,callback:function(t){e.checkAll=t},expression:"checkAll"}}),t("span",{staticClass:"zm-dropdown-link",attrs:{tabindex:"-1"}},[t("svg-icon",{attrs:{iconClass:"triangle-down"}})],1)],1),t("zm-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[t("zm-dropdown-item",{directives:[{name:"metric",rawName:"v-metric:inbox_header_action_all",arg:"inbox_header_action_all"}],staticClass:"clearfix",attrs:{command:"All","zm-ta":"inbox-control-header-all"}},[t("span",[e._v(e._s(e.$t("select.all")))])]),t("zm-dropdown-item",{directives:[{name:"metric",rawName:"v-metric:inbox_header_action_none",arg:"inbox_header_action_none"}],staticClass:"clearfix",attrs:{command:"None","zm-ta":"inbox-control-header-none"}},[t("span",[e._v(e._s(e.$t("select.none")))])]),t("zm-dropdown-item",{directives:[{name:"metric",rawName:"v-metric:inbox_header_action_read",arg:"inbox_header_action_read"}],staticClass:"clearfix",attrs:{command:"Read","zm-ta":"inbox-control-header-read"}},[t("span",[e._v(e._s(e.$t("select.read")))])]),t("zm-dropdown-item",{directives:[{name:"metric",rawName:"v-metric:inbox_header_action_unread",arg:"inbox_header_action_unread"}],staticClass:"clearfix",attrs:{command:"Unread","zm-ta":"inbox-control-header-unread"}},[t("span",[e._v(e._s(e.$t("select.unread")))])]),t("zm-dropdown-item",{directives:[{name:"metric",rawName:"v-metric:inbox_header_action_stared",arg:"inbox_header_action_stared"}],staticClass:"clearfix",attrs:{command:"Starred","zm-ta":"inbox-control-header-starred"}},[t("span",[e._v(e._s(e.$t("select.starred")))])]),t("zm-dropdown-item",{directives:[{name:"metric",rawName:"v-metric:inbox_header_action_unstarred",arg:"inbox_header_action_unstarred"}],staticClass:"clearfix",attrs:{command:"Unstarred","zm-ta":"inbox-control-header-unstarred"}},[t("span",[e._v(e._s(e.$t("select.unstarred")))])])],1)],1),t("inbox-filters",{directives:[{name:"show",rawName:"v-show",value:e.filterVisible,expression:"filterVisible"}],ref:"inboxFilters",attrs:{mailCount:e.mailCount},on:{changeSearchErrorStatus:e.changeSearchErrorStatus}}),t("shortcut-reminder",{attrs:{preTooltip:e.$t("operation.closeAllDetailWindows"),placement:"right",shortcutKey:""}},[t("zm-button",{staticClass:"close-all-btn",attrs:{"zm-ta":"detail-popout","aria-label":e.$t("operation.closeAllDetailWindows"),ghost:""},on:{click:function(t){return t.stopPropagation(),t.preventDefault(),e.closeAllPopoutedDetail.apply(null,arguments)}}},[t("div",{staticClass:"button"},[t("svg-icon",{attrs:{iconClass:"close"}})],1)])],1),t("SearchFilters",{directives:[{name:"show",rawName:"v-show",value:e.searchFiltersVisible,expression:"searchFiltersVisible"}],attrs:{"zm-ta":"search-filters"},on:{viewFilters:e.handleViewFilters,change:e.handleSearchFiltersChange}}),t("MarkAllAsReadWrap",{attrs:{available:!e.ActionBarVisible}}),t("ActionBar",{directives:[{name:"show",rawName:"v-show",value:e.ActionBarVisible,expression:"ActionBarVisible"}],attrs:{actions:e.actions,selectedInboxItems:e.selectedInboxItems}})],1)},r=[],n=a(34948),s=a(29648),l=a(53806),o=a(63012),c=a(37597),d=a(6800),u=function(){var e=this,t=e._self._c;return t("div",{staticClass:"search-filters"},[e._l(e.filters,(function(a){return t("div",{key:a.id,staticClass:"search-filters__item"},[a.type===e.ComponentTypes.CHECKBOX?[t("search-filter-check-box",{attrs:{value:e.filterData[a.props],desc:a.name},on:{change:function(t){return e.handleFilterOptionsChange(t,a.props)}}})]:e._e(),a.type===e.ComponentTypes.MULTI_SELECT?void 0:e._e(),a.type===e.ComponentTypes.USER_SELECT?[t("search-filter-user-select",{attrs:{value:e.filterData[a.props],title:a.name},on:{change:function(t){return e.handleFilterOptionsChange(t,a.props)}}})]:e._e(),a.type===e.ComponentTypes.DATE_PICKER?[t("search-filter-date-picker",{attrs:{value:e.filterData[a.props]},on:{change:function(t){return e.handleFilterOptionsChange(t,a.props)}}})]:e._e()],2)})),t("zm-button",{staticClass:"search-filters__more",attrs:{type:"primary",ghost:""},on:{click:e.handleIconClick}},[e._v(" "+e._s(e.$t("search.advancedSearch"))+" ")])],2)},h=[],m=a(6041),f=(a(77950),a(37761)),p=a(91866),b=function(){var e=this,t=e._self._c;return t("zm-popover",{staticClass:"search-filter__userselect",attrs:{placement:"bottom-start",width:"200","visible-arrow":!1,trigger:"click","tab-to-leave":!0,transition:"none"},model:{value:e.visible,callback:function(t){e.visible=t},expression:"visible"}},[t("zm-tooltip",{ref:"tooltip",attrs:{slot:"reference",placement:"bottom",disabled:!e.tooltipContent,enterable:!1},slot:"reference"},[t("div",{staticClass:"search-filter__tooltip force-dark",attrs:{slot:"content"},slot:"content"},[t("div",{staticClass:"tooltip-content"},[e._v(e._s(e.tooltipContent))])]),t("zm-button",{class:["search-filter__userselect__button",e.surplus>=0&&"is-checked"]},[t("span",[e._v(e._s(e.desc))]),t("span",{directives:[{name:"show",rawName:"v-show",value:e.surplus>0,expression:"surplus > 0"}],style:{marginLeft:"4px"}},[e._v("+ "+e._s(e.surplus))]),t("div",{staticClass:"search-filter__userselect__icon"},[t("svg-icon",{style:{transform:e.visible?"rotate(-90deg)":"rotate(90deg)"},attrs:{iconClass:"arrow-right"}})],1)])],1),t("div",{staticClass:"search-filter__userselect__container"},[t("zm-input",{staticClass:"search-filter__userselect__input",attrs:{placeholder:"Search..."},model:{value:e.keyword,callback:function(t){e.keyword=t},expression:"keyword"}},[t("svg-icon",{staticClass:"search-filter__userselect__input__icon",attrs:{slot:"prefix",iconClass:"search"},slot:"prefix"})],1),t("zm-checkbox-group",{staticClass:"search-filter__userselect__select",attrs:{vertical:""},model:{value:e.selectedData,callback:function(t){e.selectedData=t},expression:"selectedData"}},e._l(e.users,(function(a){return t("zm-checkbox",{key:a.email,attrs:{label:a.email},scopedSlots:e._u([{key:"suffix",fn:function(){return[t("div",{staticClass:"search-filter__userselect__item"},[t("contact-tooltip",{attrs:{email:a.email,name:a.displayName}},[t("avatar",{staticClass:"search-filter__userselect__avatar",attrs:{email:a.email,name:a.displayName,tabindex:"-1"}})],1),t("p",[e._v(e._s(a.displayName||a.email))])],1)]},proxy:!0}],null,!0)})})),1),t("div",{staticClass:"search-filter__userselect__footer"},[t("zm-button",{staticClass:"search-filter__userselect__btns",attrs:{disabled:e.applyBtnDisabled,type:"default",size:"mini"},on:{click:e.apply}},[e._v(" "+e._s(e.$t("common.apply"))+" ")]),t("zm-button",{staticClass:"search-filter__userselect__btns",attrs:{disabled:e.clearBtnDisabled,type:"primary",size:"mini",ghost:""},on:{click:e.clear}},[e._v(" "+e._s(e.$t("common.clear"))+" ")])],1)],1)],1)},v=[],g=a(70021),_=a(56706),S=(a(17368),a(24471),a(97626)),C=a(90479),F=a(27266),k=a(87693),x=a(71951),I={name:"SearchFilterUserSelect",components:{Avatar:C.Z,ContactTooltip:F.Z,SvgIcon:S.Z},props:{value:{type:Array,required:!0},title:{type:String,required:!0}},data:function(){return{visible:!1,recentJsCallId:"",keyword:"",selectedData:[],originalSelectedData:[]}},computed:(0,n.Z)((0,n.Z)({},(0,s.rn)({contactSearches:function(e){return e.contactSearches},userEmail:function(e){return e.userProfile.userEmail||""},userTimeZone:function(e){return e.userProfile.userTimeZone}})),{},{userName:function(e){var t=e.userEmail;return this.getUserName(t)},contacts:function(e){var t=this,a=e.recentJsCallId,i=e.keyword,r=e.contactSearches;if(!a||!i||null===r||void 0===r||!r[a])return[];var n=new RegExp((0,k.hr)(i),"gi"),s=r[a];if(this.combinedKeyword=(0,k.a1)([i]).join(","),0===s.searchResults.length){var o=(0,k.a1)([this.combinedKeyword]).map((function(e){return e.includes(x.aE)?l.Utils.getContactName(e):e.split("@")[0]})),c="";o.forEach((function(e,t){c+=t===o.length-1?e:e+", "}));var d=[{displayName:l.Utils.sanitizeHTML2String(c),email:l.Utils.sanitizeHTML2String(this.combinedKeyword)}];return d.reduce((function(e,a){var i=a.email,r=a.displayName,s=n.test(r)||n.test(i),l="@"===t.combinedKeyword[t.combinedKeyword.length-1];return s&&!l&&e.push({email:i.toLowerCase(),displayName:r}),e}),[])}var u=s.searchResults.reduce((function(e,t){var a=t.email,i=t.displayName;return e.push({email:a.toLowerCase(),displayName:i}),e}),[]);return u},selectedUsers:function(e){var t=this,a=e.selectedData;return a.map((function(e){return e?{email:e,displayName:t.getUserName(e)}:null})).filter((function(e){return!!e}))},users:function(e){var t=e.userEmail,a=e.userName,i=e.selectedUsers,r=e.contacts,n=r.filter((function(e){return!i.find((function(t){return t.email===e.email}))&&e.email!==t}));return[{email:t,displayName:a}].concat((0,m.Z)(i.filter((function(e){return e.email!==t}))),(0,m.Z)(n))},desc:function(e){var t=this,a=e.title,i=e.originalSelectedData,r=i.map((function(e){return e?{email:e,displayName:t.getUserName(e)}:null})).filter((function(e){return!!e}));return r.length?"".concat(a,": ").concat(r[0].displayName||r[0].email):a},surplus:function(e){var t=e.originalSelectedData;return t.length-1},applyBtnDisabled:function(e){var t=e.selectedData,a=e.originalSelectedData;return t.length===a.length&&0===(0,f.difference)(t,a).length},clearBtnDisabled:function(e){var t=e.selectedData;return 0===t.length},tooltipContent:function(e){var t=e.title,a=e.selectedUsers;return a.length?"".concat(t,": ")+a.map((function(e){return e.displayName||e.email})).join(", "):""}}),watch:{value:{handler:function(e){this.selectedData=(0,m.Z)(e),this.originalSelectedData=(0,m.Z)(e)}},keyword:{handler:function(e,t){e!==t&&(e?this.debouncedUserSuggestion():this.clearUserSuggestion())},immediate:!0},visible:{handler:function(e){var t=this;e||this.$nextTick((function(){t.keyword="",t.selectedData=(0,m.Z)(t.originalSelectedData)}))}}},mounted:function(){this.selectedData=(0,m.Z)(this.value),this.originalSelectedData=(0,m.Z)(this.value)},methods:(0,n.Z)((0,n.Z)({},(0,s.OI)(["clearStaleContactSearch","listenForSearchCallbacks"])),{},{getUserName:function(e){return e.split("@")[0].split(".").map((function(e){return e.slice(0,1).toUpperCase()+e.slice(1).toLocaleLowerCase()})).join(" ")},debouncedUserSuggestion:(0,f.debounce)((function(){this.getContactSearchSuggestion()}),500,!0),clearUserSuggestion:function(){this.recentJsCallId&&this.clearStaleContactSearch(this.recentJsCallId)},getContactSearchSuggestion:function(){var e=this;return(0,_.Z)((0,g.Z)().mark((function t(){var a;return(0,g.Z)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(e.keyword){t.next=4;break}return e.clearStaleContactSearch(e.recentJsCallId),e.recentJsCallId="",t.abrupt("return");case 4:return t.next=6,o.Setting.getRecentContacts({keyword:e.keyword});case 6:if(a=t.sent,0===a.errorCode){t.next=9;break}return t.abrupt("return");case 9:e.clearStaleContactSearch(e.recentJsCallId),e.listenForSearchCallbacks({jsCallId:a.data.jsCallId,result:a.data,isResultUpdated:!1}),e.recentJsCallId=a.data.jsCallId;case 12:case"end":return t.stop()}}),t)})))()},apply:function(){this.visible=!1,this.originalSelectedData=this.selectedData,this.$emit("change",this.selectedData)},clear:function(){this.visible=!1,this.selectedData=[],this.originalSelectedData=[],this.$emit("change",this.selectedData)}})},w=I,L=a(93483),y=(0,L.Z)(w,b,v,!1,null,"33f4044e",null),A=y.exports,R=function(){var e=this,t=e._self._c;return t("div",{staticClass:"search-filter__datepicker"},[t("zm-popover",{staticClass:"search-filter__datepicker",attrs:{placement:"bottom-start",width:"200","visible-arrow":!1,trigger:"click","tab-to-leave":!0,transition:"none"},model:{value:e.visible,callback:function(t){e.visible=t},expression:"visible"}},[t("zm-button",{class:["search-filter__datepicker__button",e.dateRange&&"is-checked"],attrs:{slot:"reference"},slot:"reference"},[t("span",[e._v(e._s(e.renderedDesc))]),t("div",{staticClass:"search-filter__datepicker__icon"},[t("svg-icon",{style:{transform:e.visible?"rotate(-90deg)":"rotate(90deg)"},attrs:{iconClass:"arrow-right"}})],1)]),t("div",{staticClass:"search-filter__datepicker__container"},[e._l(e.dateFilterOptions,(function(a){return t("div",{key:a.name,staticClass:"search-filter__datepicker__item",on:{click:function(t){return e.handleDateOptionChange(a)}}},[t("div",{staticClass:"search-filter__datepicker__item__icon"},[t("svg-icon",{directives:[{name:"show",rawName:"v-show",value:e.desc===a.name,expression:"desc === item.name"}],attrs:{iconClass:"checkmark-blue"}})],1),t("span",[e._v(e._s(a.displayName))])])})),t("div",{staticClass:"search-filter__datepicker__divider"}),t("div",{staticClass:"search-filter__datepicker__item",on:{click:function(t){return e.handleDateOptionChange(e.CustomDateFilterOption)}}},[t("div",{staticClass:"search-filter__datepicker__item__icon"},[t("svg-icon",{directives:[{name:"show",rawName:"v-show",value:e.desc===e.CustomDateFilterOption.name,expression:"desc === CustomDateFilterOption.name"}],attrs:{iconClass:"checkmark-blue"}})],1),t("span",[e._v(e._s(e.CustomDateFilterOption.name))])])],2)],1),t("date-panel",{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:e.handleDatePanelClose,expression:"handleDatePanelClose"}],ref:"datePanelRef",staticClass:"search-filter__datepicker__datepanel",attrs:{"show-time":!1},on:{pick:e.handleDatePick}})],1)},D=[],$=a(68571),E=a(72381),T=a(12546),Z=a(30048),O=a(11995),M=864e5,P={name:"SearchFilterDatePicker",directives:{Clickoutside:Z.Z},components:{DatePanel:E.Z,SvgIcon:S.Z},props:{value:{type:String|Array,required:!0}},data:function(){return{CustomDateFilterOption:{name:"custom",displayName:this.$t("common.custom"),value:"custom"},visible:!1,desc:"anyTime",lastDesc:"",dateRange:"",lastDateRange:""}},computed:(0,n.Z)((0,n.Z)({},(0,s.rn)({clientLanguage:function(e){return e.auth.clientLanguage}})),{},{dateFilterOptions:function(){return[{name:"anyTime",displayName:this.$t("time.anyTime"),value:""},{name:"today",displayName:this.$t("time.today"),value:1},{name:"last7Days",displayName:this.$t("time.lastSomeDays",[7]),value:7},{name:"last30Days",displayName:this.$t("time.lastSomeDays",[30]),value:30},{name:"last6Months",displayName:this.$t("time.lastSomeMonths",[6]),value:180},{name:"lastYear",displayName:this.$t("time.lastYear"),value:365}]},modelValue:function(){return this.value},formattedCustomDateRange:function(e){var t=e.dateRange;if(!t)return this.CustomDateFilterOption.name;var a=(0,$.Z)(t,2),i=a[0],r=a[1],n=(0,T.XF)(this.clientLanguage),s=i.getFullYear()===r.getFullYear()?{month:"short",day:"numeric"}:{year:"numeric",month:"short",day:"numeric"},l=i.toLocaleDateString(n,s),o=r.toLocaleDateString(n,s);return"".concat(l," - ").concat(o)},renderedDesc:function(e){var t=e.desc,a=e.formattedCustomDateRange,i=e.dateFilterOptions;return t===this.CustomDateFilterOption.name?a:i.find((function(e){return e.name===t})).displayName}}),watch:{modelValue:{handler:function(e){var t=(0,O.A9)(e);if(console.debug("date picker value offset",e,t),t)return this.desc=this.dateFilterOptions.find((function(e){return e.value===t})).name,void(this.dateRange=e);this.desc=""===e?this.dateFilterOptions.find((function(e){return""===e.value})).name:this.CustomDateFilterOption.name,this.dateRange=e}}},created:function(){this.desc=this.dateFilterOptions.find((function(e){return""===e.value})).name},mounted:function(){""===this.value?this.desc=this.dateFilterOptions.find((function(e){return""===e.value})).name:this.desc=this.CustomDateFilterOption.name,this.dateRange=this.value},methods:{handleDateOptionChange:function(e){var t=this;if(console.debug("handleDateOptionChange",e),this.lastDesc=this.desc,this.lastDateRange=this.dateRange,this.desc=e.name,this.visible=!1,"string"===typeof e.value)return e.value||(this.dateRange="",this.$emit("change",this.dateRange)),void(e.value===this.CustomDateFilterOption.value&&(this.dateRange="",setTimeout((function(){t.$refs.datePanelRef.disabledDate=function(e){return e.getTime()-1*Number(M)>Date.now()},t.$refs.datePanelRef.visible=!0}))));var a=new Date,i=new Date;1===e.value?a.setTime(a.getTime()+M*e.value):i.setTime(i.getTime()-M*e.value),this.dateRange=[i,a],this.$emit("change",this.dateRange)},handleDatePick:function(e){var t;this.dateRange=e,this.$refs.datePanelRef.value=e,this.$refs.datePanelRef.visible=!1,null===(t=this.$refs.datePanelRef)||void 0===t||t.resetView(),this.$emit("change",this.dateRange)},handleDatePanelClose:function(){var e;this.$refs.datePanelRef.visible&&(Array.isArray(this.$refs.datePanelRef.value)&&2!==this.$refs.datePanelRef.value.length&&(this.desc=this.lastDesc,this.dateRange=this.lastDateRange),this.$refs.datePanelRef.visible=!1,null===(e=this.$refs.datePanelRef)||void 0===e||e.resetView())}}},N=P,H=(0,L.Z)(N,R,D,!1,null,"1f51c086",null),z=H.exports,V=function(){var e=this,t=e._self._c;return t("zm-checkbox",{staticClass:"search-filter__checkbox",attrs:{value:e.modelValue,label:e.desc,"aria-label":e.desc},on:{change:e.updateValue}},[e._v(" "+e._s(e.desc)+" ")])},B=[],U={name:"SearchFilterCheckBox",props:{value:{type:Boolean,required:!0},desc:{type:String,required:!0}},computed:{modelValue:function(){return this.value}},methods:{updateValue:function(e){this.$emit("change",e)}}},K=U,j=(0,L.Z)(K,V,B,!1,null,"0fabbd2a",null),q=j.exports,J={DATE_PICKER:"datepicker",CHECKBOX:"checkbox",MULTI_SELECT:"multiselect",USER_SELECT:"userselect"},W={name:"SearchFilters",components:{SearchFilterUserSelect:A,SearchFilterDatePicker:z,SearchFilterCheckBox:q},props:{options:{type:Array,default:function(){return[]}}},data:function(){return{ComponentTypes:J,filterData:(0,p.Id)().searchFiltersOptions}},computed:(0,n.Z)((0,n.Z)({},(0,s.rn)({userEmail:function(e){return e.userProfile.userEmail||""},userTimeZone:function(e){return e.userProfile.userTimeZone},searchFiltersOptions:function(e){return e.search.searchFiltersOptions}})),{},{userName:function(e){var t=e.userEmail;return t.split("@")[0].split(".").map((function(e){return e.slice(0,1).toUpperCase()+e.slice(1).toLocaleLowerCase()})).join(" ")},defaultOptions:function(){return[{id:"from",name:this.$t("filter.from"),type:J.USER_SELECT,props:"from"},{id:"to",name:this.$t("filter.to"),type:J.USER_SELECT,props:"to"},{id:"dateRange",name:this.$t("filter.date"),type:J.DATE_PICKER,props:"dateRange",subProps:"dateDesc"},{id:"hasAttachment",name:this.$t("search.hasAttachment"),type:J.CHECKBOX,props:"hasAttachment"}]},filters:function(e){var t=e.defaultOptions,a=e.options;return a.length?[].concat((0,m.Z)(t),(0,m.Z)(a)):t}}),watch:{searchFiltersOptions:{handler:function(e){this.filterData=(0,f.cloneDeep)(e)},deep:!0}},mounted:function(){this.filterData=(0,f.cloneDeep)(this.searchFiltersOptions)},methods:(0,n.Z)((0,n.Z)({},(0,s.OI)("search",["updateSearchFiltersOptions"])),{},{debouncedUpdateSearchFiltersOptions:(0,f.debounce)((function(){var e=this;console.debug("debouncedUpdateSearchFiltersOptions",this.filterData),this.updateSearchFiltersOptions(this.filterData),setTimeout((function(){e.$emit("change",e.filterData)}))}),500,{leading:!0,trailing:!0}),handleFilterOptionsChange:function(e,t){this.filterData[t]=e;var a=(0,O.L8)(this.filterData,this.searchFiltersOptions);console.debug("handleFilterOptionsChange",this.filterData,this.searchFiltersOptions,a),a&&this.debouncedUpdateSearchFiltersOptions()},handleIconClick:function(){this.$emit("viewFilters")}})},Y=W,G=(0,L.Z)(Y,u,h,!1,null,"7d941037",null),X=G.exports,Q=a(91007),ee=function(){var e=this,t=e._self._c;return t("div",{class:["inbox-filters",e.inFilters&&"inbox-filters-active"]},[t("zm-dropdown",{ref:"quickFilterRef",attrs:{trigger:"click",placement:"bottom-start","hide-on-click":!1},on:{"visible-change":function(t){return e.dropdownVisible=t},command:e.onDropdownCommand}},[t("zm-tooltip",{ref:"filterTooltipRef",attrs:{content:e.$t("operation.filter"),placement:"right",disabled:e.dropdownVisible,enterable:!1}},[t("span",{ref:"dropdownTrigger",class:["filter-button","tab-focus",e.hasFilterSelected&&"filter-selected",e.dropdownVisible&&"opened"],attrs:{tabindex:"0","aria-label":e.filterAriaLabel}},[t("svg-icon",{staticClass:"filter-icon",attrs:{iconClass:"filter","zm-ta":"inbox-filter"}}),e.hasFilterSelected?t("span",{staticClass:"selected-filter-number"},[e._v(e._s(e.$t("common.numberSelected",[e.selectedFilters.length])))]):e._e(),e.inFilters?t("svg-icon",{staticClass:"tab-focus inbox-filter-clear-icon",attrs:{tabindex:"0","zm-ta":"inbox-filter-none",iconClass:"close","aria-label":e.$t("search.exitQuickFilter"),role:"button"},on:{click:function(t){return t.stopPropagation(),t.preventDefault(),e.onCloseFilter.apply(null,arguments)},keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),t.preventDefault(),e.onCloseFilter.apply(null,arguments))}}}):e._e()],1)]),t("zm-dropdown-menu",{staticClass:"inbox-filter-dropdown",attrs:{slot:"dropdown"},slot:"dropdown"},[t("div",{staticClass:"clear-filter-row"},[t("zm-dropdown-item",{staticClass:"clear-filter-item",attrs:{disabled:!e.selectedFilters.length,command:"clear"}},[t("zm-button",{staticClass:"clear-filter-button",attrs:{size:"mini",type:"primary",ghost:"",disabled:!e.selectedFilters.length},on:{click:e.onClearFilter}},[e._v(e._s(e.$t("search.clearFilter"))+" ")])],1)],1),t("zm-checkbox-group",{directives:[{name:"metric",rawName:"v-metric:inbox_filter",arg:"inbox_filter"}],on:{change:e.onSelectedFiltersChange},model:{value:e.selectedFilters,callback:function(t){e.selectedFilters=t},expression:"selectedFilters"}},e._l(e.filters,(function(a){return t("div",{key:a.id,staticClass:"filter-option-root"},[t("zm-checkbox",{ref:a.id,refInFor:!0,staticClass:"filter-option-checkbox tab-focus",attrs:{label:a.id,"aria-label":e.$t(a.label),"zm-ta":"inbox-filter-option-checkbox-".concat(a.id),tabindex:"1"}}),t("zm-dropdown-item",{staticClass:"filter-option-label",attrs:{command:a.id,divided:a.divided,"zm-ta":"inbox-filter-option-".concat(a.id),role:"menuitemcheckbox","aria-checked":e.selectedFilters.includes(a.id).toString()}},[e._v(" "+e._s(e.$t(a.label))+" ")])],1)})),0)],1)],1)],1)},te=[],ae=a(63147),ie=a(32682),re=l.Enums.SystemDefinedMailLabelIds,ne=l.Business.getFilterTypes,se=l.Business.FILTER_OPTION_CONFIG,le=l.Business.FILTER_TYPE,oe={name:"InboxFilter",inject:["isMailListViewportFilled","isMailListScrollToEnd"],props:{mailCount:{type:Number,default:0}},data:function(){return{filterTypes:[],dropdownVisible:!1}},computed:(0,n.Z)((0,n.Z)((0,n.Z)((0,n.Z)((0,n.Z)((0,n.Z)({},(0,s.Se)(["isOutlook","isZmail"])),(0,s.Se)("inbox",["isLabelLoading","isLabelReachLastPage"])),(0,s.Se)("inbox",["isImportantEnabled"])),(0,s.rn)({selectMailLabel:function(e){return e.selectMailLabel},selectPrevLabel:function(e){return e.selectPrevLabel},allLabels:function(e){return e.allLabels},currentInboxFilter:function(e){return e.currentInboxFilter},typeOfEmail:function(e){return e.typeOfEmail}})),(0,s.rn)("search",["searchIndeterminate","curSearchHash","inFilters","selectedInboxFilters"])),{},{selectedFilters:{get:function(){return this.selectedInboxFilters},set:function(e){this.updateSelectedInboxFilters(e)}},isNotInSearchMode:function(){var e;return"inbox"!==this.$route.name||"inbox"===this.$route.name&&!ae.Z.isLocalSearch(null===(e=this.$route.params)||void 0===e?void 0:e.id)},hasFilterSelected:function(){return this.selectedFilters.length>0},filters:function(){return this.filterTypes.map((function(e){return se[e]})).filter((function(e){return!!e}))},filterAriaLabel:function(){return this.hasFilterSelected?this.$tc("accessibility.filterSelected",this.selectedFilters.length,[this.selectedFilters.length]):this.$t("search.quickFilter")}}),watch:{selectMailLabel:function(e){e.id!==re.SEARCH&&(this.filterTypes=ne(this.typeOfEmail,!this.isZmail||this.isImportantEnabled,this.selectMailLabel.id),this.cancelPreviousSearch(),this._clearFilterStatus(),this.setLabelLoadingState({labelId:re.SEARCH,flag:!1}),this.$store.commit("clearSearchResults"),this.$store.commit("search/changeInFilters",!1))},hasFilterSelected:function(e){e||(this.setLabelLoadingState({labelId:re.SEARCH,flag:!1}),this.cancelPreviousSearch())}},mounted:function(){this.filterTypes=ne(this.typeOfEmail,!this.isZmail||this.isImportantEnabled),this.addInboxListener()},methods:(0,n.Z)((0,n.Z)((0,n.Z)((0,n.Z)({},(0,s.OI)("search",["setSearchIndeterminate","setCurSearchHash","updateSelectedInboxFilters","clearSelectedInboxFilters"])),(0,s.OI)("inbox",["setLabelLoadingState","updateLastPageFlag"])),(0,s.nv)(["getAllMailHead"])),{},{onSelectedFiltersChange:(0,f.debounce)((function(){this.handleInboxFilter()}),1e3,{leading:!0}),onDropdownCommand:function(e){var t,a,i,r,n;"clear"===e?this.onClearFilter():null===(i=this.$refs[e])||void 0===i||null===(r=i[0])||void 0===r||null===(n=r.$refs.input)||void 0===n||n.click();null===(t=this.$refs.quickFilterRef)||void 0===t||null===(a=t.hide)||void 0===a||a.call(t),this.$refs.dropdownTrigger.focus()},onCloseFilter:function(){var e,t,a,i;this.inFilters&&(this.clearFilter(),null===(e=this.$refs.filterTooltipRef)||void 0===e||null===(t=e.hide)||void 0===t||t.call(e),null===(a=this.$refs.quickFilterRef)||void 0===a||null===(i=a.hide)||void 0===i||i.call(a))},onClearFilter:function(){var e,t;this.inFilters&&(this.clearFilter(),null===(e=this.$refs.quickFilterRef)||void 0===e||null===(t=e.hide)||void 0===t||t.call(e))},clearFilter:function(){var e,t=this,a="inbox";if(null!==(e=this.selectPrevLabel)&&void 0!==e&&e.id)this.$store.commit("changeSelectMailLabel",this.selectPrevLabel),a=this.selectPrevLabel.id;else{var i=this.allLabels.find((function(e){return e.id===re.INBOX}));this.$store.commit("changeSelectMailLabel",i),a=null===i||void 0===i?void 0:i.id}this.$router.push({name:"inbox",params:{id:a}}),this.$nextTick((function(){var e;null===(e=t.$parent.$refs.recycleScroller)||void 0===e||e.scrollToPosition(0)})),this._clearFilterStatus(),console.debug("filter result cleared")},_clearFilterStatus:function(){this.clearSelectedInboxFilters(),this.$store.commit("clearSearchResults"),this.$store.commit("search/changeInFilters",!1),this.setCurSearchHash(""),this.setLabelLoadingState({labelId:re.SEARCH,flag:!1})},handleInboxFilter:function(){console.debug("handleInboxFilter"),this.$store.commit("clearSearchResults"),this.selectedFilters.length?this.doFilterSearch(!0):this.clearFilter()},doFilterSearch:function(){var e=arguments,t=this;return(0,_.Z)((0,g.Z)().mark((function a(){var i;return(0,g.Z)().wrap((function(a){while(1)switch(a.prev=a.next){case 0:return i=e.length>0&&void 0!==e[0]&&e[0],console.log("[Filter] searchFromBeginning ".concat(i),t.selectedFilters),i&&(t.cancelPreviousSearch(),t.$store.commit("search/changeInFilters",!0),t.isNotInSearchMode&&t.$store.commit("search/setOriginalLabelId",t.selectMailLabel.id),t.setSearchIndeterminate(!0),t.$store.commit("changeSelectMailLabel",{id:re.SEARCH}),t.setCurSearchHash((0,ie.Z)())),t.setLabelLoadingState({labelId:re.SEARCH,flag:!0}),t.isNotInSearchMode&&t.$router.push({name:"inbox",params:{id:re.SEARCH}}),a.next=7,t.getFilterResult({hash:t.curSearchHash,searchFromBeginning:i});case 7:case"end":return a.stop()}}),a)})))()},getFilterResult:function(e){var t=this;return(0,_.Z)((0,g.Z)().mark((function a(){var i,r,n,s,o,c,d,u,h;return(0,g.Z)().wrap((function(a){while(1)switch(a.prev=a.next){case 0:return i=e.hash,r=e.searchFromBeginning,n=!1,s=0,o=0,t.curSearchAction||(c=function(){var e=(0,_.Z)((0,g.Z)().mark((function e(a){var r,l,c,d,u;return(0,g.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(i===t.curSearchHash){e.next=2;break}return e.abrupt("return");case 2:return r=a.labelId,l=a.mailIds,c=a.isLastPage,d=a.isFinish,d&&(n=!0,console.log("%c[Filter] all Filter search notification received.","font-weight: bold; color: green",a)),t.$emit("changeSearchErrorStatus",!1),t.updateLastPageFlag({labelId:re.SEARCH,isLastPage:c}),u=function(){if(t.setSearchIndeterminate(!1),i===t.curSearchHash){o++;var e=o===s;if(n&&e){if(t.setLabelLoadingState({labelId:re.SEARCH,flag:!1}),console.log("%c[Filter] Filter all thread head loaded, finished!","font-weight: bold; color: green"),!c){if(!t.isMailListViewportFilled())return console.log("%c[Filter] mail list viewport not full filled, continue to load more data!","font-weight: bold; color: Brown"),void t.doFilterSearch();t.isMailListScrollToEnd()&&(console.log("%c[Filter] Mail List Scroll To End! continue to load more data!","font-weight: bold; color: Brown"),t.doFilterSearch())}}else console.log("%c[Search] get thread head data, search not finish! ".concat(o,"/").concat(s," Request"),"font-weight: bold;")}},s++,e.next=10,t.getThreadHeads({labelId:r,mailIds:l,hash:i,onFetchThreadHeadFinish:u});case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),d=function(){t.setLabelLoadingState({labelId:re.SEARCH,flag:!1})},t.curSearchAction=l.Hooks.useSearchAction({onSuccess:c,onFailed:d,beforeSearch:function(){console.log("%c[Search] before search, reset flag state","font-weight: bold;"),n=!1,s=0,o=0}})),u=t._getCurrentFilterLabelId(),a.next=8,t.curSearchAction.search({keyword:"",field:"",inSpamTrash:[re.SPAM,re.TRASH].includes(u),advSearch:{inLabelId:t._getCurrentFilterLabelId(),isUnread:t.selectedFilters.includes(le.UNREAD),isStarred:t.selectedFilters.includes(le.STARRED),hasAttach:t.selectedFilters.includes(le.HAS_ATTACHMENT),isImportant:t.selectedFilters.includes(le.IMPORTANT)},searchFromBeginning:r});case 8:if(h=a.sent,h){a.next=14;break}return t.$emit("changeSearchErrorStatus",!0),t.updateLastPageFlag({labelId:re.SEARCH,isLastPage:!1}),t.setLabelLoadingState({labelId:re.SEARCH,flag:!1}),a.abrupt("return");case 14:t.$emit("changeSearchErrorStatus",!1);case 15:case"end":return a.stop()}}),a)})))()},cancelPreviousSearch:function(){var e;this.setCurSearchHash(""),null===(e=this.curSearchAction)||void 0===e||e.destroy(),this.curSearchAction=null},_getCurrentFilterLabelId:function(){var e,t;return(null===(e=this.selectMailLabel)||void 0===e?void 0:e.id)!==re.SEARCH?this.selectMailLabel.id:(null===(t=this.selectPrevLabel)||void 0===t?void 0:t.id)||re.INBOX},getThreadHeads:function(e){var t=this;return(0,_.Z)((0,g.Z)().mark((function a(){var i,r,n,s;return(0,g.Z)().wrap((function(a){while(1)switch(a.prev=a.next){case 0:if(i=e.labelId,r=e.mailIds,n=e.hash,s=e.onFetchThreadHeadFinish,0!==r.length){a.next=4;break}return s([]),a.abrupt("return");case 4:if(i&&n===t.curSearchHash){a.next=6;break}return a.abrupt("return");case 6:t.getAllMailHead({labelId:i,mailIds:r,onFinish:function(){n===t.curSearchHash&&s()},onError:function(){n===t.curSearchHash&&t.$emit("changeSearchErrorStatus",!0)}});case 7:case"end":return a.stop()}}),a)})))()},addInboxListener:function(){var e=this;this.$Bus.$on("onLoadMore",this.onLoadMore=function(){!e.inFilters||e.isLabelLoading(re.SEARCH)||e.isLabelReachLastPage(re.SEARCH)||(console.log("%c[LoadMore] filter load more","font-weight: bold"),e.doFilterSearch())}),this.$once("hook:beforeDestroy",(function(){e.$Bus.$off("onLoadMore",e.onLoadMore)})),console.log("%c[LoadMore] registered LoadMoreListener for filter","font-weight: bold; color: CornflowerBlue")}})},ce=oe,de=(0,L.Z)(ce,ee,te,!1,null,"f0a6596a",null),ue=de.exports,he=function(){var e=this,t=e._self._c;return e.visible?t("div",{staticClass:"mark-all-as-read-wrap"},[t("shortcut-reminder",{attrs:{preTooltip:e.label,shortcutKey:e.shortcutKey}},[t("HeaderAction",{attrs:{iconClass:e.iconClass,label:e.label,"ta-tag":e.taTag},on:{click:e.handleMarkAllAsRead}})],1)],1):e._e()},me=[],fe=a(66106),pe=5e3,be=l.Business.FILTER_TYPE,ve=l.Enums.SystemDefinedMailLabelIds,ge={name:"MarkAllAsReadWrap",components:{HeaderAction:fe.Z,ShortcutReminder:Q.Z},props:{available:{type:Boolean,required:!0}},data:function(){return{shortcutKey:"mark-all-read",iconClass:"read",label:this.$t("operation.markAllAsRead"),taTag:"mark-all-as-read"}},computed:(0,n.Z)((0,n.Z)((0,n.Z)((0,n.Z)({},(0,s.rn)({mailHead:function(e){return e.mailHead},allLabels:function(e){return e.allLabels},selectMailLabel:function(e){return e.selectMailLabel},inFilters:function(e){return e.search.inFilters},originalLabelIdInFilters:function(e){return e.search.originalLabelIdInFilters},selectedInboxFilters:function(e){return e.search.selectedInboxFilters}})),(0,s.Se)(["isOutlook"])),(0,s.Se)("inbox",["selectedInboxMailIds","mails"])),{},{visible:function(e){var t=e.available,a=e.isOutlook,i=e.inFilters,r=e.hasUnreadMails,n=e.selectedInboxFilters,s=e.originalLabelIdInFilters,l=s===ve.SEARCH;return t&&!a&&i&&n.includes(be.UNREAD)&&r&&!l},hasUnreadMails:function(){var e=this.mails.filter((function(e){return e.labelId&&e.mailId}));return!!e.length&&e.some((function(e){var t=e.mailHead;return t.isUnread}))},currentLabelName:function(e){var t=e.allLabels,a=e.originalLabelIdInFilters,i=e.isOutlook;if(!a)return"";var r=t.find((function(e){return e.id===a}));return(0,O.fu)(r,i)}}),methods:(0,n.Z)((0,n.Z)({},(0,s.nv)("inbox",["setMarkAllAsReadLoading","clearMarkAllAsReadLoading"])),{},{handleMarkAllAsRead:function(){var e=this;return(0,_.Z)((0,g.Z)().mark((function t(){var a,i;return(0,g.Z)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,o.Mail.getLabelInfo({labelId:e.originalLabelIdInFilters});case 2:a=t.sent,i=a.data.GetLabelInfo.mailLabel.count.msgUnread,e.$confirmDialog({title:e.$t("operation.markAllAsRead"),content:i>pe?e.$t("common.markAllAsReadTipMoreThan5000Mails",[e.currentLabelName]):e.$t("common.markAllAsReadTipLessThan5000Mails",[e.currentLabelName]),width:"475px",approveAction:{id:"continue",type:"primary",text:e.$t("operation.continue")},rejectAction:{id:"cancel",text:e.$t("operation.cancel")}}).then((function(){e.markAllAsRead()}))["catch"]((function(){}));case 5:case"end":return t.stop()}}),t)})))()},markAllAsRead:function(){var e,t=this;o.Thread.markAllAsRead({labelId:this.originalLabelIdInFilters}).then((function(){var e=t.$toast(t.$t("common.markingAsRead"),{iconClass:"loading",duration:0});t.setMarkAllAsReadLoading(e)}));var a=Object.values(this.mailHead[null===(e=this.selectMailLabel)||void 0===e?void 0:e.id]).map((function(e){var t=e.mailHead,a=t.mailId,i=t.msgIds;return{msgIds:i,groupId:a}}));o.Inbox.markMail({mailMarkType:"Read",fromLabelId:this.originalLabelIdInFilters,groupMsgsIds:a})}})},_e=ge,Se=(0,L.Z)(_e,he,me,!1,null,"d0de5222",null),Ce=Se.exports,Fe=a(84878),ke=l.Enums.SystemDefinedMailLabelIds,xe=l.Enums.SystemDefinedCategoryIds,Ie={None:0,Some:1,All:2},we={components:{inboxFilters:ue,ActionBar:c.Z,SearchFilters:X,MarkAllAsReadWrap:Ce,ShortcutReminder:Q.Z},props:{mailCount:{type:Number,default:0},isLoading:{type:Boolean,default:!1},actions:{type:Array,default:function(){return[]}}},data:function(){return{checkAll:!1,isIndeterminate:!1}},computed:(0,n.Z)((0,n.Z)((0,n.Z)((0,n.Z)((0,n.Z)((0,n.Z)((0,n.Z)({},(0,s.rn)(["selectMailLabel","selectPrevLabel","currentPage","maxNumberMailsPerRequest"])),(0,s.rn)("search",["inSearching"])),(0,s.rn)("search",["selectedSearchFilters","searchIndeterminate","inFilters"])),(0,s.Se)(["isGmail","isZmail","isOutlook"])),(0,s.Se)("inbox",["selectedInboxMailIds","inboxSectionVisible","currentSectionViewVisibleMails"])),(0,s.Se)("delegate",["permissionRole"])),{},{threadOperatePermission:function(e){var t=e.permissionRole;return(0,Fe.yz)(t,Fe.Vn.THREAD_OPERATION)},controlHeaderVisible:function(){return this.currentLabelId!==l.Enums.SystemDefinedMailLabelIds.ESCROW&&(this.threadOperatePermission&&(this.checkBoxVisible||this.filterVisible||this.searchFiltersVisible||this.ActionBarVisible))},checkBoxVisible:function(){var e=[ke.GROUP_APPROVAL,ke.ESCROW];return!(e.includes(this.currentLabelId)||this.selectPrevLabel&&e.includes(this.selectPrevLabel.id)&&this.currentLabelId===ke.SEARCH)&&(this.mailCount>0||this.searchIndeterminate)},filterVisible:function(){var e,t;if(this.inboxSectionVisible||this.selectedInboxItems.length)return!1;if(this.inFilters)return!0;if(this.inSearching)return!1;if(this.mailCount<=0)return!1;var a=!(null!==(e=this.selectMailLabel)&&void 0!==e&&e.isSystem),i=this.isZmail?[xe.CATEGORY_PERSONAL,xe.CATEGORY_SOCIAL]:[],r=[ke.INBOX,ke.STARRED,ke.IMPORTANT,ke.SENT,ke.SPAM,ke.TRASH,ke.ARCHIVE,ke.BLOCKED,ke.PRIVATE,ke.ESCROW,ke.GROUP_APPROVAL].concat(i).includes(null===(t=this.selectMailLabel)||void 0===t?void 0:t.id);return a||r},searchFiltersVisible:function(){var e=0===this.selectedInboxItems.length;return e&&this.inSearching},ActionBarVisible:function(){return this.selectedInboxItems.length>0},currentLabelId:function(){var e;return this.checkAll=!1,null===(e=this.selectMailLabel)||void 0===e?void 0:e.id},currentThreadList:function(){return this.mailHead&&Object.keys(this.mailHead)||[]},selectedInboxItems:function(){var e=this;return this.selectedInboxMailIds.filter((function(t){return e.mailHead[t]})).map((function(t){return{groupId:t,msgIds:e.mailHead[t].msgIds}}))},selectedStatus:function(){var e=this.currentThreadList;return this.inboxSectionVisible&&(e=this.currentSectionViewVisibleMails.map((function(e){return e.mailId}))),e.length<1||this.selectedInboxItems.length<1?Ie.None:this.selectedInboxItems.length===Object.values(this.mailHead).filter((function(e){return(0,d.w)(e)})).length?Ie.All:Ie.Some},mailHead:function(){return this.inboxSectionVisible?this.currentSectionViewVisibleMails.reduce((function(e,t){return e[t.mailId]=t,e}),{}):this.$store.state.mailHead[this.currentLabelId]||{}}}),watch:{selectedStatus:{handler:function(e){switch(e){case Ie.None:this.checkAll=!1,this.isIndeterminate=!1;break;case Ie.Some:this.checkAll=!1,this.isIndeterminate=!0;break;case Ie.All:this.checkAll=!0,this.isIndeterminate=!1;break}},immediate:!0}},methods:(0,n.Z)((0,n.Z)({},(0,s.nv)("search",["updateSelectedSearchFilters"])),{},{handleCheckMore:function(e){this.$emit("handleCheckMore",e)},doFilterSearch:function(){var e;null===(e=this.$refs.inboxFilters)||void 0===e||e.doFilterSearch()},changeSearchErrorStatus:function(e){this.$emit("changeSearchErrorStatus",e)},handleCheckAllChange:function(e){var t=this;this.$nextTick((function(){t.checkAll=!t.isIndeterminate&&e,t.$emit("handleCheckAllChange",t.checkAll)})),this.$refs.checkAll.hide()},pageCount:function(){return null===this.mailCount?null:Math.ceil(this.mailCount/this.maxNumberMailsPerRequest)},noMorePrev:function(){return 1===this.currentPage},noMoreNext:function(){return this.currentPage===this.pageCount},handleViewFilters:function(){this.$emit("viewFilters")},handleSearchFiltersChange:function(e){this.$emit("filterChange",e)},closeAllPopoutedDetail:function(){o.Thread.closeAllPopoutedThreads()}})},Le=we,ye=(0,L.Z)(Le,i,r,!1,null,"b02588ea",null),Ae=ye.exports}}]);