597.8cff0639.js 18 KB

1
  1. "use strict";(self["webpackChunk_zoom_client_email_desktop"]=self["webpackChunk_zoom_client_email_desktop"]||[]).push([[597],{9058:function(e,t,i){i.d(t,{Z:function(){return A}});var n=function(){var e,t=this,i=t._self._c;return i("div",[i("zm-dropdown",{ref:"labelsRef",staticClass:"tab-focus",attrs:{trigger:"click",placement:"bottom-start"},on:{"visible-change":t.handleVisibleChange,command:t.handleApply}},["button"===t.triggerStyle?i("zm-button",{ref:"trigger",staticClass:"button-trigger-override",attrs:{tabindex:"-1"}},[t._t("trigger")],2):"dropdown-item"===t.triggerStyle?i("zm-dropdown-item",{ref:"trigger",staticClass:"button-trigger-override"},[t._t("trigger")],2):t._e(),i("zm-dropdown-menu",{ref:"menu",staticClass:"menu",attrs:{slot:"dropdown"},slot:"dropdown"},[i("zm-input",{ref:"searchInput",staticClass:"search-input",attrs:{placeholder:t.$t("search.search"),autocorrect:"off",autocapitalize:"none","zm-ta":"setting-template-search-input","aria-activedescendant":null===(e=t.$refs.menu)||void 0===e?void 0:e.activedescendant},model:{value:t.searchQuery,callback:function(e){t.searchQuery=e},expression:"searchQuery"}},[i("SvgIcon",{attrs:{slot:"prefix",iconClass:"search"},slot:"prefix"})],1),i("div",{staticClass:"menu-divider"}),i("zm-dropdown-item",{staticClass:"menu-item",attrs:{tabindex:"0",command:"createNewLabel","zm-ta":(t.isMove?"move-":"")+"dropdown-user-label-add"}},[i("div",{staticClass:"menu-item-content"},[i("svg-icon",{attrs:{iconClass:"plus"}}),i("span",{staticClass:"menu-item--text"},[t._v(" "+t._s(t.isOutlook?t.$t("label.createFolder"):t.$t("label.createLabel"))+" ")])],1)]),t.displayedLabels.length<t.minUserLabelCountForVirtualList?i("div",{staticClass:"label-list"},t._l(t.displayedLabels,(function(e){return i("zm-dropdown-item",{key:e.id,staticClass:"menu-item",attrs:{command:e.id,role:"menuitemcheckbox","aria-label":e.labelDisplayFullName,"aria-checked":t.getAriaChecked(e),"zm-ta":"dropdown-user-label-"+e.labelDisplayFullName}},[i("div",{staticClass:"menu-item-content"},[i("svg-label",{attrs:{labelClass:t.labelIcon,labelColor:e.style.labelBgColor}}),i("span",{staticClass:"menu-item--text",attrs:{title:e.labelDisplayFullName}},[t._v(" "+t._s(e.title)+" ")]),t.isOutlook&&t.isCurrentFolder(e)?i("svg-icon",{staticClass:"menu-item--checkbox",attrs:{iconClass:"check"}}):t._e(),t.isMove?t._e():i("div",{staticClass:"menu-item--checkbox",on:{click:function(e){e.stopPropagation()}}},[i("zm-checkbox",{attrs:{value:1===e.checked,indeterminate:2===e.checked,label:e.id},on:{change:t.onCheck}})],1)],1)])})),1):[i("RecycleScroller",{staticClass:"user-label-virtual-list tab-focus-button",attrs:{keyField:"id",items:t.displayedLabels,itemSize:32,simpleArray:!1},scopedSlots:t._u([{key:"default",fn:function(e){var n=e.item;return[i("zm-dropdown-item",{staticClass:"menu-item",attrs:{command:n.id,role:"menuitemcheckbox","aria-label":n.labelDisplayFullName,"aria-checked":t.getAriaChecked(n),"zm-ta":"dropdown-user-label-"+n.labelDisplayFullName}},[i("div",{staticClass:"menu-item-content"},[i("svg-label",{attrs:{labelClass:t.labelIcon,labelColor:n.style.labelBgColor}}),i("span",{staticClass:"menu-item--text",attrs:{title:n.labelDisplayFullName}},[t._v(" "+t._s(n.title)+" ")]),t.isOutlook&&t.isCurrentFolder(n)?i("svg-icon",{staticClass:"menu-item--checkbox",attrs:{iconClass:"check"}}):t._e(),t.isMove?t._e():i("div",{staticClass:"menu-item--checkbox",on:{click:function(e){e.stopPropagation()}}},[i("zm-checkbox",{attrs:{value:1===n.checked,indeterminate:2===n.checked,label:n.id},on:{change:t.onCheck}})],1)],1)])]}}])})],t.isMove?i("div",{staticClass:"menu-divider"}):t._e(),t.isMove?i("div",t._l(t.systemLabels,(function(e){return i("zm-dropdown-item",{key:e.id,staticClass:"menu-item",attrs:{command:e.id}},[i("div",{staticClass:"menu-item-content"},[i("SvgIcon",{attrs:{iconClass:e.icon}}),i("span",{staticClass:"menu-item--text"},[t._v(t._s(t.$t(e.displayName)))])],1)])})),1):t._e()],2)],1),i("labelDialog",{attrs:{visible:t.dialogVisible,action:t.LabelActions.CREATE,showNotice:!1,labelListTree:t.allLabelsTree},on:{onOk:t.handleCreationOk,onCancel:function(e){t.dialogVisible=!1},close:function(e){t.dialogVisible=!1}}})],1)},s=[],a=i(84282),l=i(6041),o=i(70021),r=i(56706),c=i(34948),u=(i(6886),i(43430),i(6710),i(77950),i(85940),i(71372),i(65803)),d=i(87692),h=i(97626),b=i(63147),m=i(53806),f=i(63012),p=i(50620),v=i(29648),g=i(78543),k=i(43251),L=i(87585),y=m.Business.labelUtils,I=m.Enums.SystemDefinedMailLabelIds,C={name:"LabelMenu",components:{SvgIcon:h.Z,SvgLabel:d.Z,labelDialog:u.Z,RecycleScroller:L.EK},mixins:[g.Z],props:{selectedInboxItems:{type:Array,default:function(){return[]}},location:{type:String,default:"inbox"},isMove:{type:Boolean,default:!1},triggerStyle:{type:String,default:"button"}},data:function(){return{searchQuery:"",labels:[],userLabelsCopy:"",checkedLabels:new Set,uncheckedLabels:new Set,dialogVisible:!1,LabelActions:m.Enums.LabelActions}},computed:(0,c.Z)((0,c.Z)((0,c.Z)((0,c.Z)({},(0,v.rn)(["allLabels","isSplitView","selectMailLabel","minUserLabelCountForVirtualList"])),(0,v.Se)(["isZmail","isGmail","isOutlook","labelNameInfo","enableVirtualUserLabelList","userLabels","userLabelsTree","allLabelsTree","flattenedLabels","flattenedUserLabels","userLabelIdToLabel"])),(0,v.rn)({isDelegated:function(e){return e.userProfile.isDelegated}})),{},{systemLabelIds:function(e){var t=e.isDelegated,i=e.isZmail,n=e.isGmail,s=e.selectMailLabel,a=[I.INBOX,I.TRASH,I.ARCHIVE,I.SPAM];return i&&(t||a.push(I.PRIVATE),s.id===I.SPAM&&(a=a.filter((function(e){return e!==I.ARCHIVE})))),!n||s.id!==I.SPAM&&s.id!==I.SENT||(a=a.filter((function(e){return e!==I.ARCHIVE}))),a},systemLabels:function(e){var t=e.systemLabelIds,i=this.$store.state.selectMailLabel.id,n=this.isOutlook?k.Z:p.Z;return t.filter((function(e){return e!==i})).map((function(e){return(0,c.Z)((0,c.Z)({},n[e]),{},{id:e})}))},displayedLabels:function(e){var t=e.labels,i=e.searchQuery,n=e.userLabelIdToLabel,s=t.filter((function(e){return!!n.get(e.id)}));return i?s.filter((function(e){var t=e.title;e.id;return t.toLowerCase().includes(i.toLowerCase())})):s},labelIcon:function(){return y.getLabelIconName(this.isOutlook)}}),watch:{displayedLabels:function(){this.resetDropdownOptions(this.$refs.menu)},allLabels:function(){var e=this,t=this.initUserLabels(),i=this.labels.reduce((function(e,t,i){var n=t.id;return e[n]=i,e}),{});this.labels=t.map((function(t){var i=e.labels.find((function(e){return e.id===t.id}));return i&&(t.checked=i.checked),t})).sort((function(e,t){var n=i[e.id],s=i[t.id];return n>-1&&s>-1?n-s:s>-1&&void 0===n?1:-1}))}},mounted:function(){this.initItem()},methods:(0,c.Z)((0,c.Z)((0,c.Z)({},(0,v.nv)("inbox",["removeSelectedInboxMailIds"])),(0,v.nv)("action",["moveMails"])),{},{initUserLabels:function(){var e,t=this.userLabels;return(this.isOutlook||this.isZmail)&&(t=this.flattenedUserLabels),t=null===(e=t)||void 0===e?void 0:e.map(this.$pickItemFromUserLabel),t.forEach((function(e){e.checked=0})),t},initItem:function(){this.labels=this.initUserLabels(),this.bindDropdownScroll(this.$refs.menu)},showCreateDialog:function(){this.dialogVisible=!0},onCheck:function(e,t){var i,n=null===(i=t.target)||void 0===i?void 0:i.value;if(n){var s,a=this.labels.find((function(e){return e.id===n})),l=null===(s=JSON.parse(this.labelsCopy))||void 0===s?void 0:s.find((function(e){return e.id===n}));if(a)if(2===l.checked)switch(a.checked){case 0:a.checked=2;break;case 2:a.checked=1;break;case 1:a.checked=0;break}else a.checked=e?1:0}this.handleApplyBatchLabels()},handleApply:function(e){e&&("createNewLabel"===e?this.showCreateDialog():this.isMove?(this.handleMove(e),this.goBack()):this.handleLabel(e))},handleLabel:function(e){var t=this.labels.find((function(t){return t.id===e}));if(t){var i=1===t.checked?0:1;t.checked=i,this.handleApplyBatchLabels();var n=this.selectedInboxItems.length;this.$undoNotice({iconClass:"checkmark",title:i?this.$tc("common.messageAddedTo",n,[t.title]):this.$tc("common.messageRemovedFrom",n,[t.title]),duration:5e3}),this.$metric.report("action_bar",{location:this.location,msgId:this.selectedInboxItems.map((function(e){return e.groupId})),actionKey:"label"})}},handleMove:function(e){var t=this;return(0,r.Z)((0,o.Z)().mark((function i(){var n;return(0,o.Z)().wrap((function(i){while(1)switch(i.prev=i.next){case 0:if(console.debug("handleMove (in LabelMenu.vue)",e,"selectedInboxItems",t.selectedInboxItems),n=t.selectMailLabel.id,n!==e){i.next=4;break}return i.abrupt("return");case 4:return i.next=6,t.moveMails({mails:t.selectedInboxItems.map((function(e){return{mailId:e.groupId,msgIds:e.msgIds}})),fromLabelId:n,toLabelId:e,metricConfig:{metricKey:"action_bar",params:{location:t.location,msgId:t.selectedInboxItems.map((function(e){return e.groupId})),actionKey:"move"}}});case 6:case"end":return i.stop()}}),i)})))()},handleApplyBatchLabels:function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){var t,i,n,s,a,l,r;return(0,o.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t=this.labels.reduce((function(e,t){var i=t.id,n=t.checked;return 2!==n&&e.push({labelId:i,owned:1===n?"OwnerByAllMails":"OwnerByNoneMails"}),e}),[]),i=this.$store.state.selectMailLabel.id,n=this.selectedInboxItems.map((function(e){var t=e.groupId,i=e.msgIds;return{groupId:t,msgIds:i}})),e.prev=3,e.next=6,f.Inbox.labelsMails({fromLabelId:i,groupMsgsIds:n,labelOwnedList:t});case 6:if(s=e.sent,0!==s.errorCode){e.next=11;break}this.$Bus.$emit("labelChangeEvent",{labelOwnedList:t}),e.next=12;break;case 11:throw Error("Changing label failed!");case 12:e.next=18;break;case 14:e.prev=14,e.t0=e["catch"](3),this.$msg({type:"Error",content:this.$t("label.updatingLabelFailed")}),console.log(e.t0);case 18:a=this.selectMailLabel.id,l=this.labels.find((function(e){return e.id===a})),0===(null===l||void 0===l?void 0:l.checked)&&(r=n.map((function(e){var t=e.groupId;return t})),this.removeSelectedInboxMailIds({mailIds:r}));case 21:case"end":return e.stop()}}),e,this,[[3,14]])})));function t(){return e.apply(this,arguments)}return t}(),setCheckedLabelList:function(){var e=this;return(0,r.Z)((0,o.Z)().mark((function t(){var i,n,s;return(0,o.Z)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return i=function(){return e.selectedInboxItems.map(function(){var t=(0,r.Z)((0,o.Z)().mark((function t(i){return(0,o.Z)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,f.Inbox.getMailLabelStatus({labelId:e.$store.state.selectMailLabel.id,groupMsgsIds:[(0,c.Z)({},i)]});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())},t.next=3,Promise.all(i());case 3:n=t.sent,s=new Map,n.forEach((function(t,i){for(var n=new Set,a=new Set,o=t||[],r=0;r<o.length;r++)"OwnerByAllMails"===o[r].labelOwnedStatus&&n.add(o[r].id),"OwnerByNoneMails"===o[r].labelOwnedStatus&&a.add(o[r].id),!s.has(o[r].id)&&s.set(o[r].id,o[r]);0===i?(e.checkedLabels=n,e.uncheckedLabels=a):(e.checkedLabels=new Set((0,l.Z)(e.checkedLabels).filter((function(e){return n.has(e)}))),e.uncheckedLabels=new Set((0,l.Z)(e.uncheckedLabels).filter((function(e){return a.has(e)}))))})),console.debug("[label] sorted label result",s,n),e.setItems(s);case 8:case"end":return t.stop()}}),t)})))()},queryCheckStatus:function(e){return this.uncheckedLabels.has(e)?0:this.checkedLabels.has(e)?1:2},$pickItemFromUserLabel:function(e){var t,i;return{id:e.id,isSystem:e.isSystem,title:(null===(t=this.labelNameInfo[e.id])||void 0===t?void 0:t.labelDisplayName)||(this.isGmail?e.name:e.displayName),labelDisplayFullName:null===(i=this.labelNameInfo[e.id])||void 0===i?void 0:i.labelDisplayFullName,checked:this.queryCheckStatus(e.id),style:{labelBgColor:e.backgroundColor,textColor:e.textColor}}},setItems:function(e){var t,i,n=[],s=(0,a.Z)(e.values());try{for(s.s();!(i=s.n()).done;){var l=i.value;n.push(l)}}catch(o){s.e(o)}finally{s.f()}this.isZmail&&(n=y.flatUserLabelsFromLabelListTree(this.userLabelsTree)),this.isOutlook&&(n=y.flatLabelsFromLabelListTree(this.allLabelsTree.filter((function(e){return![m.Enums.SystemDefinedMailLabelIds.TRASH,m.Enums.SystemDefinedMailLabelIds.OUTBOX,m.Enums.SystemDefinedMailLabelIds.SYNC_ISSUES].includes(e.id)})))),this.labels=null===(t=n)||void 0===t?void 0:t.map(this.$pickItemFromUserLabel),this.labelsCopy=JSON.stringify(this.labels)},handleCreationOk:function(e){var t=this,i=e.labels;this.dialogVisible=!1,this.$refs.labelsRef.visible=!1,i.forEach((function(e){var i=t.$pickItemFromUserLabel(e);t.labels.push(i),t.handleApply(e.id)}))},isCurrentFolder:function(e){var t=this.$store.state.selectMailLabel.id;return!b.Z.isLocalSearch(t)&&(t&&t===e.id)},goBack:function(){this.isSplitView||(/^\/main.?/gim.test(this.$route.path)||(this.$router.replace({path:"/main"}),this.$metric.report("detail_back")),this.$store.commit("changeShowDetail",!1))},handleVisibleChange:function(e){var t=this;e&&(this.setCheckedLabelList(),this.searchQuery="",setTimeout((function(){t.$refs.searchInput.$refs.input.focus()}),100)),this.$Bus.$emit("hideActions")},openLabelMenu:function(){this.$refs.trigger.$el.click()},getAriaChecked:function(e){return!(!this.isOutlook||!this.isCurrentFolder(e))||(2===e.checked?"mixed":(1===e.checked).toString())}})},w=C,x=i(93483),S=(0,x.Z)(w,n,s,!1,null,"3792bd42",null),A=S.exports},37597:function(e,t,i){i.d(t,{Z:function(){return I}});i(77950),i(85940),i(75704),i(71639);var n=function(){var e=this,t=e._self._c;return t("div",{ref:"bar",class:["action-bar",{"align-right":"right"===e.alignment}]},[e._l(e.visibleActions,(function(i){return t("div",{key:i.key,ref:"buttons",refInFor:!0,staticClass:"item"},[["label","move"].includes(i.key)?t("LabelMenu",{attrs:{selectedInboxItems:e.selectedInboxItems,isMove:"move"===i.key},scopedSlots:e._u([{key:"trigger",fn:function(){return[t("shortcut-reminder",{attrs:{hideLabel:e.hideLabels,preTooltip:i.preTooltip?i.preTooltip:i.label,shortcutKey:i.shortcutKey,placement:"top"}},[t("HeaderAction",{attrs:{hideLabel:e.hideLabels,iconClass:i.iconClass,label:i.label,location:e.location}})],1)]},proxy:!0}],null,!0)}):"snooze"===i.key?t("zm-popover",{attrs:{trigger:"click"}},[t("shortcut-reminder",{attrs:{slot:"reference",hideLabel:e.hideLabels,preTooltip:i.preTooltip?i.preTooltip:i.label,shortcutKey:i.shortcutKey,placement:"top"},slot:"reference"},[t("HeaderAction",{attrs:{hideLabel:e.hideLabels,iconClass:i.iconClass,label:i.label,location:e.location}})],1),t("snooze-menu",{attrs:{hasUnsnooze:i.isInSnoozed},on:{onSnoozeTime:i.onSnooze,unsnooze:i.unsnooze}})],1):t("shortcut-reminder",{attrs:{hideLabel:e.hideLabels,preTooltip:i.preTooltip?i.preTooltip:i.label,shortcutKey:i.shortcutKey,placement:"top"}},[t("HeaderAction",{attrs:{hideLabel:e.hideLabels,iconClass:i.iconClass,label:i.label,location:e.location,"ta-tag":i.taTag},on:{click:i.onClick}})],1)],1)})),t("zm-dropdown",{directives:[{name:"show",rawName:"v-show",value:e.actionsInMoreMenu.length>0,expression:"actionsInMoreMenu.length > 0"}],staticClass:"item",attrs:{placement:"bottom-start"},on:{command:function(e){return e()},"visible-change":e.onVisibleChange}},[t("HeaderAction",{attrs:{iconClass:"more-horizontal",hideLabel:"",tabindex:"0",label:e.$t("common.moreOptions"),"zm-ta":e.location+"-action-header-more",location:e.location}}),t("zm-dropdown-menu",{ref:"menu",staticClass:"more-menu",attrs:{slot:"dropdown"},slot:"dropdown"},e._l(e.actionsInMoreMenu,(function(i){return t("zm-dropdown-item",{key:i.key,attrs:{"zm-ta":e.location+"-action-header-"+(i.taTag||i.label.replaceAll(" ","-").toLowerCase()),command:["label","move"].includes(i.key)?function(){return e.$refs[i.key][0].openLabelMenu()}:i.onClick}},[["label","move"].includes(i.key)?t("LabelMenu",{ref:i.key,refInFor:!0,attrs:{selectedInboxItems:e.selectedInboxItems,isMove:"move"===i.key,triggerStyle:"dropdown-item"},scopedSlots:e._u([{key:"trigger",fn:function(){return[e._v(" "+e._s(i.label)+" ")]},proxy:!0}],null,!0)}):"snooze"===i.key?t("context-menu-sub",[t("div",{staticClass:"snooze-item",attrs:{slot:"trigger"},slot:"trigger"},[t("div",{staticClass:"label"},[e._v(e._s(e.$t("operation.snooze")))]),t("svg-icon",{attrs:{iconClass:"arrow-right"}})],1),t("snooze-menu",{attrs:{hasUnsnooze:i.isInSnoozed},on:{onSnoozeTime:i.onSnooze,unsnooze:i.unsnooze}})],1):t("div",[e._v(" "+e._s(i.label)+" ")])],1)})),1)],1)],2)},s=[],a=i(6041),l=i(37761),o=i(33223),r=i(66106),c=i(9058),u=i(91007),d=i(60753),h=i(78543),b=i(69003),m=500,f=100,p=24,v=50,g={name:"ActionBar",components:{HeaderAction:r.Z,LabelMenu:c.Z,ShortcutReminder:u.Z,SnoozeMenu:d.Z,ContextMenuSub:b.Z},mixins:[h.Z],props:{actions:{type:Array,default:function(){return[]}},menuActions:{type:Array,default:function(){return[]}},selectedInboxItems:{type:Array,default:function(){return[]}},hideLabels:{type:Boolean,default:!1},maxNumDisplayed:{type:Number,default:null},alignment:{type:String,default:"left"},location:{type:String,default:"inbox"}},data:function(){return{numActionsInBar:0}},computed:{visibleActions:function(){return this.actions.slice(0,this.numActionsInBar)},overflowActions:function(){return this.actions.slice(this.numActionsInBar)},actionsInMoreMenu:function(){return[].concat((0,a.Z)(this.overflowActions),(0,a.Z)(this.menuActions))}},watch:{overflowActions:function(){this.visible&&this.resetDropdownOptions(this.$refs.menu)}},created:function(){this.debouncedAdjust=(0,l.throttle)(this.adjustNumActions,16)},mounted:function(){this.adjustNumActions(),this.resizeObserver=new o.Z(this.debouncedAdjust),this.visible&&this.resizeObserver.observe(this.$refs.bar)},beforeDestroy:function(){var e;null===(e=this.resizeObserver)||void 0===e||e.disconnect(),this.debouncedAdjust.cancel()},methods:{getActionBarWidth:function(){var e,t=(null===(e=this.$refs.bar)||void 0===e?void 0:e.getBoundingClientRect().width)||m;return Math.max(0,t-v-p)},adjustNumActions:function(){var e=this.getActionBarWidth();this.numActionsInBar=Math.floor(e/f),this.checkActionBarFit()},checkActionBarFit:function(){var e=this;this.$nextTick((function(){var t,i=e.getActionBarWidth(),n=null===(t=e.$refs.buttons)||void 0===t?void 0:t.reduce((function(e,t){return e+(null===t||void 0===t?void 0:t.getBoundingClientRect().width)||f}),0);return!(n>i)||(console.debug("Width correction triggered"),e.numActionsInBar--,e.checkActionBarFit())}))},onVisibleChange:function(){this.$Bus.$emit("hideActions")}}},k=g,L=i(93483),y=(0,L.Z)(k,n,s,!1,null,"3d348226",null),I=y.exports}}]);