@univerjs/preset-sheets-filter 0.6.7-nightly.202503291606 → 0.6.7-nightly.202503311607

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.css CHANGED
@@ -1 +1 @@
1
- .univer-ml-1{margin-left:.25rem}.univer-mt-2{margin-top:.5rem}.univer-box-border{box-sizing:border-box}.univer-flex{display:flex}.univer-hidden{display:none}.univer-h-4{height:1rem}.univer-h-5{height:1.25rem}.univer-h-full{height:100%}.univer-max-w-\[245px\]{max-width:245px}.univer-flex-1{flex:1 1 0%}.univer-flex-grow{flex-grow:1}.univer-cursor-pointer{cursor:pointer}.univer-flex-col{flex-direction:column}.univer-items-center{align-items:center}.univer-justify-between{justify-content:space-between}.univer-overflow-hidden{overflow:hidden}.univer-rounded-md{border-radius:.375rem}.univer-border{border-width:1px}.univer-border-solid{border-style:solid}.univer-border-gray-200{--tw-border-opacity: 1;border-color:#e3e5ea;border-color:rgba(227,229,234,var(--tw-border-opacity, 1))}.univer-px-1\.5{padding-left:.375rem;padding-right:.375rem}.univer-px-2{padding-left:.5rem;padding-right:.5rem}.univer-py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.univer-pr-2{padding-right:.5rem}.univer-text-\[13px\]{font-size:13px}.univer-text-primary-500{--tw-text-opacity: 1;color:#466af7;color:rgba(70,106,247,var(--tw-text-opacity, 1))}.hover\:univer-bg-gray-50:hover{--tw-bg-opacity: 1;background-color:#f9fafb;background-color:rgba(249,250,251,var(--tw-bg-opacity, 1))}.\[\&\:hover_a\]\:univer-inline-block:hover a{display:inline-block}.univer-sheets-filter-panel{display:flex;min-width:312px;height:432px;flex-direction:column;background:rgb(var(--bg-color-secondary));border-radius:10px;box-sizing:border-box;box-shadow:var(--box-shadow-lg);padding:16px;overflow:hidden}.univer-sheets-filter-panel-header{flex-grow:0;flex-shrink:0;margin-bottom:4px}.univer-sheets-filter-panel-content{flex-grow:1;flex-shrink:1;overflow:hidden;padding-top:8px}.univer-sheets-filter-panel-select-all{font-size:13px;margin-right:4px}.univer-sheets-filter-panel-select-all-count{font-size:13px;color:rgb(var(--grey-400))}.univer-sheets-filter-panel-values-container{display:flex;height:100%;flex-direction:column}.univer-sheets-filter-panel-values-container>.univer-input-affix-wrapper{flex:0 0 32px}.univer-sheets-filter-panel-values-container .univer-select,.univer-sheets-filter-panel-values-container .univer-input-affix-wrapper,.univer-sheets-filter-panel-values-container .univer-radio-group{width:100%}.univer-sheets-filter-panel-values-find{height:32px;margin-bottom:8px}.univer-sheets-filter-panel-values-virtual{flex-grow:1}.univer-sheets-filter-panel-values-item{box-sizing:border-box;height:32px;padding:2px 0;width:100%}.univer-sheets-filter-panel-values-item-inner{align-items:center;padding:0 2px 0 20px;line-height:28px;box-sizing:border-box;border-radius:6px;height:28px;display:flex;font-size:13px}.univer-sheets-filter-panel-values-item-inner:hover{background-color:rgb(var(--grey-50))}.univer-sheets-filter-panel-values-item-inner:hover .univer-sheets-filter-panel-values-item-count{margin-right:2px}.univer-sheets-filter-panel-values-item-inner:hover .univer-sheets-filter-panel-values-item-exclude-button{box-sizing:border-box;margin-left:auto;display:inline-block;height:24px;font-size:12px;line-height:12px}.univer-sheets-filter-panel-values-item-inner:hover .univer-sheets-filter-panel-values-item-exclude-button:hover{background-color:rgb(var(--hyacinth-50))}.univer-sheets-filter-panel-values-item-inner:hover .univer-sheets-filter-panel-values-item-exclude-button:active{background-color:rgb(var(--hyacinth-100))}.univer-sheets-filter-panel-values-item-text{display:inline-block;height:100%;margin:0 4px;flex-shrink:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.univer-sheets-filter-panel-values-item-count{color:rgb(var(--grey-400))}.univer-sheets-filter-panel-values-item-exclude-button{display:none}.univer-sheets-filter-panel-conditions-container{display:flex;flex-direction:column;height:100%}.univer-sheets-filter-panel-conditions-container .univer-select,.univer-sheets-filter-panel-conditions-container .univer-input-affix-wrapper,.univer-sheets-filter-panel-conditions-container .univer-radio-group{width:100%;margin-bottom:8px}.univer-sheets-filter-panel-conditions-container-inner{flex-grow:1;border-radius:6px;border:1px solid rgb(var(--grey-200));overflow:hidden;padding:8px}.univer-sheets-filter-panel-conditions-desc{margin-top:-6px;color:rgb(var(--grey-500));font-size:12px;line-height:18px}.univer-sheets-filter-panel-footer{margin-top:16px;flex-grow:0;flex-shrink:0;display:inline-flex;flex-wrap:nowrap;overflow:hidden;justify-content:space-between}.univer-sheets-filter-panel-footer-primary-buttons{display:flex}.univer-sheets-filter-panel-footer-primary-buttons>.univer-button{margin-left:12px}.univer-sheets-filter-panel .univer-select,.univer-sheets-filter-panel .univer-input{width:100%}.univer-sheets-filter-panel .univer-form-dual-column-layout{margin-bottom:8px}
1
+ .univer-ml-1{margin-left:.25rem}.univer-mt-2{margin-top:.5rem}.univer-box-border{box-sizing:border-box}.univer-flex{display:flex}.univer-hidden{display:none}.univer-h-4{height:1rem}.univer-h-5{height:1.25rem}.univer-h-full{height:100%}.univer-max-w-\[245px\]{max-width:245px}.univer-flex-1{flex:1 1 0%}.univer-flex-grow{flex-grow:1}.univer-cursor-pointer{cursor:pointer}.univer-flex-col{flex-direction:column}.univer-items-center{align-items:center}.univer-justify-between{justify-content:space-between}.univer-overflow-hidden{overflow:hidden}.univer-whitespace-nowrap{white-space:nowrap}.univer-rounded-md{border-radius:.375rem}.univer-border{border-width:1px}.univer-border-solid{border-style:solid}.univer-border-gray-200{--tw-border-opacity: 1;border-color:#e3e5ea;border-color:rgba(227,229,234,var(--tw-border-opacity, 1))}.univer-px-1\.5{padding-left:.375rem;padding-right:.375rem}.univer-px-2{padding-left:.5rem;padding-right:.5rem}.univer-py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.univer-pr-2{padding-right:.5rem}.univer-text-\[13px\]{font-size:13px}.univer-text-primary-500{--tw-text-opacity: 1;color:#466af7;color:rgba(70,106,247,var(--tw-text-opacity, 1))}.hover\:univer-bg-gray-50:hover{--tw-bg-opacity: 1;background-color:#f9fafb;background-color:rgba(249,250,251,var(--tw-bg-opacity, 1))}.\[\&\:hover_a\]\:univer-inline-block:hover a{display:inline-block}.univer-sheets-filter-panel{display:flex;min-width:312px;height:432px;flex-direction:column;background:rgb(var(--bg-color-secondary));border-radius:10px;box-sizing:border-box;box-shadow:var(--box-shadow-lg);padding:16px;overflow:hidden}.univer-sheets-filter-panel-header{flex-grow:0;flex-shrink:0;margin-bottom:4px}.univer-sheets-filter-panel-content{flex-grow:1;flex-shrink:1;overflow:hidden;padding-top:8px}.univer-sheets-filter-panel-select-all{font-size:13px;margin-right:4px}.univer-sheets-filter-panel-select-all-count{font-size:13px;color:rgb(var(--grey-400))}.univer-sheets-filter-panel-values-container{display:flex;height:100%;flex-direction:column}.univer-sheets-filter-panel-values-container>.univer-input-affix-wrapper{flex:0 0 32px}.univer-sheets-filter-panel-values-container .univer-select,.univer-sheets-filter-panel-values-container .univer-input-affix-wrapper,.univer-sheets-filter-panel-values-container .univer-radio-group{width:100%}.univer-sheets-filter-panel-values-find{height:32px;margin-bottom:8px}.univer-sheets-filter-panel-values-virtual{flex-grow:1}.univer-sheets-filter-panel-values-item{box-sizing:border-box;height:32px;padding:2px 0;width:100%}.univer-sheets-filter-panel-values-item-inner{align-items:center;padding:0 2px 0 20px;line-height:28px;box-sizing:border-box;border-radius:6px;height:28px;display:flex;font-size:13px}.univer-sheets-filter-panel-values-item-inner:hover{background-color:rgb(var(--grey-50))}.univer-sheets-filter-panel-values-item-inner:hover .univer-sheets-filter-panel-values-item-count{margin-right:2px}.univer-sheets-filter-panel-values-item-inner:hover .univer-sheets-filter-panel-values-item-exclude-button{box-sizing:border-box;margin-left:auto;display:inline-block;height:24px;font-size:12px;line-height:12px}.univer-sheets-filter-panel-values-item-inner:hover .univer-sheets-filter-panel-values-item-exclude-button:hover{background-color:rgb(var(--hyacinth-50))}.univer-sheets-filter-panel-values-item-inner:hover .univer-sheets-filter-panel-values-item-exclude-button:active{background-color:rgb(var(--hyacinth-100))}.univer-sheets-filter-panel-values-item-text{display:inline-block;height:100%;margin:0 4px;flex-shrink:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.univer-sheets-filter-panel-values-item-count{color:rgb(var(--grey-400))}.univer-sheets-filter-panel-values-item-exclude-button{display:none}.univer-sheets-filter-panel-conditions-container{display:flex;flex-direction:column;height:100%}.univer-sheets-filter-panel-conditions-container .univer-select,.univer-sheets-filter-panel-conditions-container .univer-input-affix-wrapper,.univer-sheets-filter-panel-conditions-container .univer-radio-group{width:100%;margin-bottom:8px}.univer-sheets-filter-panel-conditions-container-inner{flex-grow:1;border-radius:6px;border:1px solid rgb(var(--grey-200));overflow:hidden;padding:8px}.univer-sheets-filter-panel-conditions-desc{margin-top:-6px;color:rgb(var(--grey-500));font-size:12px;line-height:18px}.univer-sheets-filter-panel-footer{margin-top:16px;flex-grow:0;flex-shrink:0;display:inline-flex;flex-wrap:nowrap;overflow:hidden;justify-content:space-between}.univer-sheets-filter-panel-footer-primary-buttons{display:flex}.univer-sheets-filter-panel-footer-primary-buttons>.univer-button{margin-left:12px}.univer-sheets-filter-panel .univer-select,.univer-sheets-filter-panel .univer-input{width:100%}.univer-sheets-filter-panel .univer-form-dual-column-layout{margin-bottom:8px}
package/lib/umd/index.js CHANGED
@@ -17,7 +17,9 @@
17
17
  `,attachRender:v=>d.jsxs("div",{className:`
18
18
  univer-ml-1 univer-flex univer-h-5 univer-flex-1 univer-cursor-pointer
19
19
  univer-items-center univer-justify-between univer-text-[13px] univer-text-primary-500
20
- `,children:[d.jsx("span",{className:R.sheetsFilterPanelValuesItemCount,children:`(${v.count})`}),d.jsx("a",{className:"univer-box-border univer-hidden univer-h-4 univer-px-1.5",onClick:()=>{const O=[];v.children?v.children.forEach(E=>{E.children?E.children.forEach(A=>{O.push(A.key)}):O.push(E.key)}):O.push(v.key),e.onFilterOnly(O)},children:l})]})})})]})]})}function ht(){var A;const t=T.useDependency(x),e=T.useDependency(c.LocaleService),r=T.useDependency(c.ICommandService),i=T.useObservable(t.filterBy$,void 0,!0),s=T.useObservable(t.filterByModel$,void 0,!1),l=T.useObservable(()=>(s==null?void 0:s.canApply$)||C.of(!1),void 0,!1,[s]),n=mt(e),o=!T.useObservable(t.hasCriteria$),a=y.useCallback(P=>{r.executeCommand(Ne.id,{filterBy:P})},[r]),h=y.useCallback(async()=>{await(s==null?void 0:s.clear()),r.executeCommand(J.id)},[s,r]),m=y.useCallback(()=>{r.executeCommand(J.id)},[r]),f=y.useCallback(async()=>{await(s==null?void 0:s.apply()),r.executeCommand(J.id)},[s,r]),v=(A=T.useDependency(u.SheetsFilterService).activeFilterModel)==null?void 0:A.getRange(),O=t.col,E=T.useComponentsOfPart($.SheetsUIPart.FILTER_PANEL_EMBED_POINT);return d.jsxs("div",{className:R.sheetsFilterPanel,children:[d.jsx(T.ComponentContainer,{components:E,sharedProps:{range:v,colIndex:O,onClose:m}}),d.jsx("div",{className:R.sheetsFilterPanelHeader,children:d.jsx(L.Segmented,{value:i,items:n,onChange:P=>a(P)})}),s?d.jsx("div",{className:R.sheetsFilterPanelContent,children:i===me.VALUES?d.jsx(ut,{model:s}):d.jsx(at,{model:s})}):d.jsx("div",{style:{flex:1}}),d.jsxs("div",{className:R.sheetsFilterPanelFooter,children:[d.jsx(L.Button,{type:"link",onClick:h,disabled:o,children:e.t("sheets-filter.panel.clear-filter")}),d.jsxs("span",{className:R.sheetsFilterPanelFooterPrimaryButtons,children:[d.jsx(L.Button,{type:"default",onClick:m,children:e.t("sheets-filter.panel.cancel")}),d.jsx(L.Button,{disabled:!l,type:"primary",onClick:f,children:e.t("sheets-filter.panel.confirm")})]})]})]})}function mt(t){const e=t.getCurrentLocale();return y.useMemo(()=>[{label:t.t("sheets-filter.panel.by-values"),value:me.VALUES},{label:t.t("sheets-filter.panel.by-conditions"),value:me.CONDITIONS}],[e,t])}function pt(t){const e=t.get(u.SheetsFilterService);return{id:u.SmartToggleSheetsFilterCommand.id,type:T.MenuItemType.BUTTON_SELECTOR,icon:"FilterSingle",tooltip:"sheets-filter.toolbar.smart-toggle-filter-tooltip",hidden$:T.getMenuHiddenObservable(t,c.UniverInstanceType.UNIVER_SHEET),activated$:e.activeFilterModel$.pipe(C.map(r=>!!r)),disabled$:$.getObservableWithExclusiveRange$(t,$.getCurrentRangeDisable$(t,{worksheetTypes:[I.WorksheetFilterPermission,I.WorksheetViewPermission],rangeTypes:[I.RangeProtectionPermissionViewPoint]}))}}function dt(t){const e=t.get(u.SheetsFilterService);return{id:u.ClearSheetsFilterCriteriaCommand.id,type:T.MenuItemType.BUTTON,title:"sheets-filter.toolbar.clear-filter-criteria",hidden$:T.getMenuHiddenObservable(t,c.UniverInstanceType.UNIVER_SHEET),disabled$:e.activeFilterModel$.pipe(C.switchMap(r=>{var i;return(i=r==null?void 0:r.hasCriteria$.pipe(C.map(s=>!s)))!=null?i:C.of(!0)}))}}function ft(t){const e=t.get(u.SheetsFilterService);return{id:u.ReCalcSheetsFilterCommand.id,type:T.MenuItemType.BUTTON,title:"sheets-filter.toolbar.re-calc-filter-conditions",hidden$:T.getMenuHiddenObservable(t,c.UniverInstanceType.UNIVER_SHEET),disabled$:e.activeFilterModel$.pipe(C.switchMap(r=>{var i;return(i=r==null?void 0:r.hasCriteria$.pipe(C.map(s=>!s)))!=null?i:C.of(!0)}))}}const _t={[T.RibbonStartGroup.FORMULAS_INSERT]:{[u.SmartToggleSheetsFilterCommand.id]:{order:10,menuItemFactory:pt,[u.ClearSheetsFilterCriteriaCommand.id]:{order:0,menuItemFactory:dt},[u.ReCalcSheetsFilterCommand.id]:{order:1,menuItemFactory:ft}}}},Y=16,vt=new Path2D("M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z");class Ve{static drawNoCriteria(e,r,i,s){e.save(),ie.Rect.drawWith(e,{radius:2,width:Y,height:Y,fill:s}),e.lineCap="square",e.strokeStyle=i,e.scale(r/Y,r/Y),e.beginPath(),e.lineWidth=1,e.lineCap="round",e.moveTo(3,4),e.lineTo(13,4),e.moveTo(4.5,8),e.lineTo(11.5,8),e.moveTo(6,12),e.lineTo(10,12),e.stroke(),e.restore()}static drawHasCriteria(e,r,i,s){e.save(),ie.Rect.drawWith(e,{radius:2,width:Y,height:Y,fill:s}),e.scale(r/Y,r/Y),e.fillStyle=i,e.fill(vt),e.restore()}}var St=Object.getOwnPropertyDescriptor,gt=(t,e,r,i)=>{for(var s=i>1?void 0:i?St(e,r):e,l=t.length-1,n;l>=0;l--)(n=t[l])&&(s=n(s)||s);return s},ye=(t,e)=>(r,i)=>e(r,i,t);const j=16,fe=1;let Ae=class extends ie.Shape{constructor(e,r,i,s,l){super(e,r);S(this,"_cellWidth",0);S(this,"_cellHeight",0);S(this,"_filterParams");S(this,"_hovered",!1);this._contextService=i,this._commandService=s,this._themeService=l,this.setShapeProps(r),this.onPointerDown$.subscribeEvent(n=>this.onPointerDown(n)),this.onPointerEnter$.subscribeEvent(()=>this.onPointerEnter()),this.onPointerLeave$.subscribeEvent(()=>this.onPointerLeave())}setShapeProps(e){typeof e.cellHeight<"u"&&(this._cellHeight=e.cellHeight),typeof e.cellWidth<"u"&&(this._cellWidth=e.cellWidth),typeof e.filterParams<"u"&&(this._filterParams=e.filterParams),this.transformByState({width:e.width,height:e.height})}_draw(e){const r=this._cellHeight,i=this._cellWidth,s=j-i,l=j-r;e.save();const n=new Path2D;n.rect(s,l,i,r),e.clip(n);const{hasCriteria:o}=this._filterParams,a=this._themeService.getCurrentTheme().primaryColor,h=this._hovered?this._themeService.getCurrentTheme().grey50:"rgba(255, 255, 255, 1.0)";o?Ve.drawHasCriteria(e,j,a,h):Ve.drawNoCriteria(e,j,a,h),e.restore()}onPointerDown(e){if(e.button===2)return;const{col:r,unitId:i,subUnitId:s}=this._filterParams;this._contextService.getContextValue(z)||!this._commandService.hasCommand(oe.id)||setTimeout(()=>{this._commandService.executeCommand(oe.id,{unitId:i,subUnitId:s,col:r})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};Ae=gt([ye(2,c.IContextService),ye(3,c.ICommandService),ye(4,c.Inject(c.ThemeService))],Ae);var Ct=Object.getOwnPropertyDescriptor,Tt=(t,e,r,i)=>{for(var s=i>1?void 0:i?Ct(e,r):e,l=t.length-1,n;l>=0;l--)(n=t[l])&&(s=n(s)||s);return s},K=(t,e)=>(r,i)=>e(r,i,t);const Et=1e3,Ft=5e3;let be=class extends c.RxDisposable{constructor(e,r,i,s,l,n,o,a){super();S(this,"_filterRangeShape",null);S(this,"_buttonRenderDisposable",null);S(this,"_filterButtonShapes",[]);this._context=e,this._injector=r,this._sheetSkeletonManagerService=i,this._sheetsFilterService=s,this._themeService=l,this._sheetInterceptorService=n,this._commandService=o,this._selectionRenderService=a,this._initRenderer()}dispose(){super.dispose(),this._disposeRendering()}_initRenderer(){this._sheetSkeletonManagerService.currentSkeleton$.pipe(C.switchMap(e=>{var o,a;if(!e)return C.of(null);const{unit:r,unitId:i}=this._context,s=((o=r.getActiveSheet())==null?void 0:o.getSheetId())||"",l=(a=this._sheetsFilterService.getFilterModel(i,s))!=null?a:void 0,n=()=>({unitId:i,worksheetId:s,filterModel:l,range:l==null?void 0:l.getRange(),skeleton:e.skeleton});return c.fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(C.filter(([h])=>{var m;return h.type===c.CommandType.MUTATION&&((m=h.params)==null?void 0:m.unitId)===r.getUnitId()&&(u.FILTER_MUTATIONS.has(h.id)||h.id===I.SetRangeValuesMutation.id)}),C.throttleTime(20,void 0,{leading:!1,trailing:!0}),C.map(n),C.startWith(n()))}),C.takeUntil(this.dispose$)).subscribe(e=>{this._disposeRendering(),!(!e||!e.range)&&(this._renderRange(e.range,e.skeleton),this._renderButtons(e))})}_renderRange(e,r){const{scene:i}=this._context,{rowHeaderWidth:s,columnHeaderHeight:l}=r,n=this._filterRangeShape=new $.SelectionControl(i,Et,this._themeService,{rowHeaderWidth:s,columnHeaderHeight:l,enableAutoFill:!1,highlightHeader:!1}),o={range:e,primary:null,style:{fill:"rgba(0, 0, 0, 0.0)"}},a=$.attachSelectionWithCoord(o,r);n.updateRangeBySelectionWithCoord(a),n.setEvent(!1),i.makeDirty(!0)}_renderButtons(e){const{range:r,filterModel:i,unitId:s,skeleton:l,worksheetId:n}=e,{scene:o}=this._context;this._interceptCellContent(s,n,e.range);const{startColumn:a,endColumn:h,startRow:m}=r;for(let f=a;f<=h;f++){const F=`sheets-filter-button-${f}`,v=$.getCoordByCell(m,f,o,l),{startX:O,startY:E,endX:A,endY:P}=v,U=A-O,M=P-E;if(M<=fe||U<=fe)continue;const B=!!i.getFilterColumn(f),V=A-j-fe,Se=P-j-fe,ge={left:V,top:Se,height:j,width:j,zIndex:Ft,cellHeight:M,cellWidth:U,filterParams:{unitId:s,subUnitId:n,col:f,hasCriteria:B}},w=this._injector.createInstance(Ae,F,ge);this._filterButtonShapes.push(w)}o.addObjects(this._filterButtonShapes),o.makeDirty()}_interceptCellContent(e,r,i){const{startRow:s,startColumn:l,endColumn:n}=i;this._buttonRenderDisposable=this._sheetInterceptorService.intercept(I.INTERCEPTOR_POINT.CELL_CONTENT,{effect:c.InterceptorEffectEnum.Style,handler:(o,a,h)=>{const{row:m,col:f,unitId:F,subUnitId:v}=a;return F!==e||v!==r||m!==s||f<l||f>n?h(o):h({...o,fontRenderExtension:{...o==null?void 0:o.fontRenderExtension,rightOffset:j}})},priority:10})}_disposeRendering(){var e,r;(e=this._filterRangeShape)==null||e.dispose(),this._filterButtonShapes.forEach(i=>i.dispose()),(r=this._buttonRenderDisposable)==null||r.dispose(),this._filterRangeShape=null,this._buttonRenderDisposable=null,this._filterButtonShapes=[]}};be=Tt([K(1,c.Inject(c.Injector)),K(2,c.Inject($.SheetSkeletonManagerService)),K(3,c.Inject(u.SheetsFilterService)),K(4,c.Inject(c.ThemeService)),K(5,c.Inject(I.SheetInterceptorService)),K(6,c.ICommandService),K(7,$.ISheetSelectionRenderService)],be);var Ot=Object.getOwnPropertyDescriptor,It=(t,e,r,i)=>{for(var s=i>1?void 0:i?Ot(e,r):e,l=t.length-1,n;l>=0;l--)(n=t[l])&&(s=n(s)||s);return s},We=(t,e)=>(r,i)=>e(r,i,t);let ae=class extends c.RxDisposable{constructor(t,e){super(),this._renderManagerService=t,this._sheetsRenderService=e,[u.SetSheetsFilterRangeMutation,u.SetSheetsFilterCriteriaMutation,u.RemoveSheetsFilterMutation,u.ReCalcSheetsFilterMutation].forEach(r=>this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(r.id))),this.disposeWithMe(this._renderManagerService.registerRenderModule(c.UniverInstanceType.UNIVER_SHEET,[be]))}};ae=It([We(0,ie.IRenderManagerService),We(1,c.Inject($.SheetsRenderService))],ae);const Pt={id:u.SmartToggleSheetsFilterCommand.id,binding:T.KeyCode.L|T.MetaKeys.CTRL_COMMAND|T.MetaKeys.SHIFT,description:"sheets-filter.shortcut.smart-toggle-filter",preconditions:$.whenSheetEditorFocused,group:"4_sheet-edit"};var Nt=Object.getOwnPropertyDescriptor,yt=(t,e,r,i)=>{for(var s=i>1?void 0:i?Nt(e,r):e,l=t.length-1,n;l>=0;l--)(n=t[l])&&(s=n(s)||s);return s},D=(t,e)=>(r,i)=>e(r,i,t);const Qe="FILTER_PANEL_POPUP";let _e=class extends ae{constructor(e,r,i,s,l,n,o,a,h,m,f,F,v){super(v,F);S(this,"_popupDisposable");this._injector=e,this._componentManager=r,this._sheetsFilterPanelService=i,this._sheetCanvasPopupService=s,this._sheetsFilterService=l,this._localeService=n,this._shortcutService=o,this._commandService=a,this._menuManagerService=h,this._contextService=m,this._messageService=f,this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[Pt].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}_initCommands(){[u.SmartToggleSheetsFilterCommand,u.RemoveSheetFilterCommand,u.SetSheetFilterRangeCommand,u.SetSheetsFilterCriteriaCommand,u.ClearSheetsFilterCriteriaCommand,u.ReCalcSheetsFilterCommand,Ne,oe,J].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenuItems(){this._menuManagerService.mergeMenu(_t)}_initUI(){this.disposeWithMe(this._componentManager.register(Qe,ht)),this.disposeWithMe(this._componentManager.register("FilterSingle",Be)),this.disposeWithMe(this._contextService.subscribeContextValue$(z).pipe(C.distinctUntilChanged()).subscribe(e=>{e?this._openFilterPopup():this._closeFilterPopup()})),this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe(e=>{e&&this._messageService.show({type:L.MessageType.Error,content:this._localeService.t(e)})}))}_openFilterPopup(){const e=this._sheetsFilterPanelService.filterModel;if(!e)throw new Error("[SheetsFilterUIController]: no filter model when opening filter popup!");const r=e.getRange(),i=this._sheetsFilterPanelService.col,{startRow:s}=r;this._popupDisposable=this._sheetCanvasPopupService.attachPopupToCell(s,i,{componentKey:Qe,direction:"horizontal",onClickOutside:()=>this._commandService.syncExecuteCommand(J.id),offset:[5,0]})}_closeFilterPopup(){var e;(e=this._popupDisposable)==null||e.dispose(),this._popupDisposable=null}};_e=yt([D(0,c.Inject(c.Injector)),D(1,c.Inject(T.ComponentManager)),D(2,c.Inject(x)),D(3,c.Inject($.SheetCanvasPopManagerService)),D(4,c.Inject(u.SheetsFilterService)),D(5,c.Inject(c.LocaleService)),D(6,T.IShortcutService),D(7,c.ICommandService),D(8,T.IMenuManagerService),D(9,c.IContextService),D(10,T.IMessageService),D(11,c.Inject($.SheetsRenderService)),D(12,ie.IRenderManagerService)],_e);var At=Object.defineProperty,bt=Object.getOwnPropertyDescriptor,Rt=(t,e,r)=>e in t?At(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Mt=(t,e,r,i)=>{for(var s=i>1?void 0:i?bt(e,r):e,l=t.length-1,n;l>=0;l--)(n=t[l])&&(s=n(s)||s);return s},Re=(t,e)=>(r,i)=>e(r,i,t),je=(t,e,r)=>Rt(t,typeof e!="symbol"?e+"":e,r);const Lt="SHEET_FILTER_UI_PLUGIN";_.UniverSheetsFilterUIPlugin=class extends c.Plugin{constructor(e=ce,r,i,s){super(),this._config=e,this._injector=r,this._configService=i,this._rpcChannelService=s;const{menu:l,...n}=c.merge({},ce,this._config);l&&this._configService.setConfig("menu",l,{merge:!0}),this._configService.setConfig(Ue,n)}onStarting(){[[x],[te],[_e]].forEach(e=>this._injector.add(e)),this._config.useRemoteFilterValuesGenerator&&this._rpcChannelService&&this._injector.add([ue,{useFactory:()=>Q.toModule(this._rpcChannelService.requestChannel(Fe))}])}onReady(){this._injector.get(te)}onRendered(){this._injector.get(_e)}},je(_.UniverSheetsFilterUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),je(_.UniverSheetsFilterUIPlugin,"pluginName",Lt),_.UniverSheetsFilterUIPlugin=Mt([c.DependentOn(u.UniverSheetsFilterPlugin),Re(1,c.Inject(c.Injector)),Re(2,c.IConfigService),Re(3,c.Optional(Q.IRPCChannelService))],_.UniverSheetsFilterUIPlugin);var Ut=Object.defineProperty,wt=Object.getOwnPropertyDescriptor,$t=(t,e,r)=>e in t?Ut(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dt=(t,e,r,i)=>{for(var s=i>1?void 0:i?wt(e,r):e,l=t.length-1,n;l>=0;l--)(n=t[l])&&(s=n(s)||s);return s},Ge=(t,e)=>(r,i)=>e(r,i,t),xe=(t,e,r)=>$t(t,typeof e!="symbol"?e+"":e,r);const Ht="SHEET_FILTER_UI_PLUGIN";_.UniverSheetsFilterMobileUIPlugin=class extends c.Plugin{constructor(e=ce,r,i){super(),this._config=e,this._injector=r,this._configService=i;const{menu:s,...l}=c.merge({},ce,this._config);s&&this._configService.setConfig("menu",s,{merge:!0}),this._configService.setConfig(Ue,l)}onStarting(){[[te],[ae]].forEach(e=>this._injector.add(e))}onReady(){this._injector.get(te)}onRendered(){this._injector.get(ae)}},xe(_.UniverSheetsFilterMobileUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),xe(_.UniverSheetsFilterMobileUIPlugin,"pluginName",Ht),_.UniverSheetsFilterMobileUIPlugin=Dt([c.DependentOn(u.UniverSheetsFilterPlugin),Ge(1,c.Inject(c.Injector)),Ge(2,c.IConfigService)],_.UniverSheetsFilterMobileUIPlugin);var kt=Object.getOwnPropertyDescriptor,Bt=(t,e,r,i)=>{for(var s=i>1?void 0:i?kt(e,r):e,l=t.length-1,n;l>=0;l--)(n=t[l])&&(s=n(s)||s);return s},Ye=(t,e)=>(r,i)=>e(r,i,t);_.UniverSheetsFilterUIWorkerPlugin=(ve=class extends c.Plugin{constructor(e,r,i){super(),this._config=e,this._injector=r,this._rpcChannelService=i}onStarting(){[[ue,{useClass:Oe}]].forEach(e=>this._injector.add(e))}onReady(){this._rpcChannelService.registerChannel(Fe,Q.fromModule(this._injector.get(ue)))}},S(ve,"type",c.UniverInstanceType.UNIVER_SHEET),S(ve,"pluginName","SHEET_FILTER_UI_WORKER_PLUGIN"),ve),_.UniverSheetsFilterUIWorkerPlugin=Bt([Ye(1,c.Inject(c.Injector)),Ye(2,Q.IRPCChannelService)],_.UniverSheetsFilterUIWorkerPlugin),_.ChangeFilterByOperation=Ne,_.CloseFilterPanelOperation=J,_.OpenFilterPanelOperation=oe,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
20
+ `,children:[d.jsx("span",{className:R.sheetsFilterPanelValuesItemCount,children:`(${v.count})`}),d.jsx("a",{className:`
21
+ univer-box-border univer-hidden univer-h-4 univer-whitespace-nowrap univer-px-1.5
22
+ `,onClick:()=>{const O=[];v.children?v.children.forEach(E=>{E.children?E.children.forEach(A=>{O.push(A.key)}):O.push(E.key)}):O.push(v.key),e.onFilterOnly(O)},children:l})]})})})]})]})}function ht(){var A;const t=T.useDependency(x),e=T.useDependency(c.LocaleService),r=T.useDependency(c.ICommandService),i=T.useObservable(t.filterBy$,void 0,!0),s=T.useObservable(t.filterByModel$,void 0,!1),l=T.useObservable(()=>(s==null?void 0:s.canApply$)||C.of(!1),void 0,!1,[s]),n=mt(e),o=!T.useObservable(t.hasCriteria$),a=y.useCallback(P=>{r.executeCommand(Ne.id,{filterBy:P})},[r]),h=y.useCallback(async()=>{await(s==null?void 0:s.clear()),r.executeCommand(J.id)},[s,r]),m=y.useCallback(()=>{r.executeCommand(J.id)},[r]),f=y.useCallback(async()=>{await(s==null?void 0:s.apply()),r.executeCommand(J.id)},[s,r]),v=(A=T.useDependency(u.SheetsFilterService).activeFilterModel)==null?void 0:A.getRange(),O=t.col,E=T.useComponentsOfPart($.SheetsUIPart.FILTER_PANEL_EMBED_POINT);return d.jsxs("div",{className:R.sheetsFilterPanel,children:[d.jsx(T.ComponentContainer,{components:E,sharedProps:{range:v,colIndex:O,onClose:m}}),d.jsx("div",{className:R.sheetsFilterPanelHeader,children:d.jsx(L.Segmented,{value:i,items:n,onChange:P=>a(P)})}),s?d.jsx("div",{className:R.sheetsFilterPanelContent,children:i===me.VALUES?d.jsx(ut,{model:s}):d.jsx(at,{model:s})}):d.jsx("div",{style:{flex:1}}),d.jsxs("div",{className:R.sheetsFilterPanelFooter,children:[d.jsx(L.Button,{type:"link",onClick:h,disabled:o,children:e.t("sheets-filter.panel.clear-filter")}),d.jsxs("span",{className:R.sheetsFilterPanelFooterPrimaryButtons,children:[d.jsx(L.Button,{type:"default",onClick:m,children:e.t("sheets-filter.panel.cancel")}),d.jsx(L.Button,{disabled:!l,type:"primary",onClick:f,children:e.t("sheets-filter.panel.confirm")})]})]})]})}function mt(t){const e=t.getCurrentLocale();return y.useMemo(()=>[{label:t.t("sheets-filter.panel.by-values"),value:me.VALUES},{label:t.t("sheets-filter.panel.by-conditions"),value:me.CONDITIONS}],[e,t])}function pt(t){const e=t.get(u.SheetsFilterService);return{id:u.SmartToggleSheetsFilterCommand.id,type:T.MenuItemType.BUTTON_SELECTOR,icon:"FilterSingle",tooltip:"sheets-filter.toolbar.smart-toggle-filter-tooltip",hidden$:T.getMenuHiddenObservable(t,c.UniverInstanceType.UNIVER_SHEET),activated$:e.activeFilterModel$.pipe(C.map(r=>!!r)),disabled$:$.getObservableWithExclusiveRange$(t,$.getCurrentRangeDisable$(t,{worksheetTypes:[I.WorksheetFilterPermission,I.WorksheetViewPermission],rangeTypes:[I.RangeProtectionPermissionViewPoint]}))}}function dt(t){const e=t.get(u.SheetsFilterService);return{id:u.ClearSheetsFilterCriteriaCommand.id,type:T.MenuItemType.BUTTON,title:"sheets-filter.toolbar.clear-filter-criteria",hidden$:T.getMenuHiddenObservable(t,c.UniverInstanceType.UNIVER_SHEET),disabled$:e.activeFilterModel$.pipe(C.switchMap(r=>{var i;return(i=r==null?void 0:r.hasCriteria$.pipe(C.map(s=>!s)))!=null?i:C.of(!0)}))}}function ft(t){const e=t.get(u.SheetsFilterService);return{id:u.ReCalcSheetsFilterCommand.id,type:T.MenuItemType.BUTTON,title:"sheets-filter.toolbar.re-calc-filter-conditions",hidden$:T.getMenuHiddenObservable(t,c.UniverInstanceType.UNIVER_SHEET),disabled$:e.activeFilterModel$.pipe(C.switchMap(r=>{var i;return(i=r==null?void 0:r.hasCriteria$.pipe(C.map(s=>!s)))!=null?i:C.of(!0)}))}}const _t={[T.RibbonStartGroup.FORMULAS_INSERT]:{[u.SmartToggleSheetsFilterCommand.id]:{order:10,menuItemFactory:pt,[u.ClearSheetsFilterCriteriaCommand.id]:{order:0,menuItemFactory:dt},[u.ReCalcSheetsFilterCommand.id]:{order:1,menuItemFactory:ft}}}},Y=16,vt=new Path2D("M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z");class Ve{static drawNoCriteria(e,r,i,s){e.save(),ie.Rect.drawWith(e,{radius:2,width:Y,height:Y,fill:s}),e.lineCap="square",e.strokeStyle=i,e.scale(r/Y,r/Y),e.beginPath(),e.lineWidth=1,e.lineCap="round",e.moveTo(3,4),e.lineTo(13,4),e.moveTo(4.5,8),e.lineTo(11.5,8),e.moveTo(6,12),e.lineTo(10,12),e.stroke(),e.restore()}static drawHasCriteria(e,r,i,s){e.save(),ie.Rect.drawWith(e,{radius:2,width:Y,height:Y,fill:s}),e.scale(r/Y,r/Y),e.fillStyle=i,e.fill(vt),e.restore()}}var St=Object.getOwnPropertyDescriptor,gt=(t,e,r,i)=>{for(var s=i>1?void 0:i?St(e,r):e,l=t.length-1,n;l>=0;l--)(n=t[l])&&(s=n(s)||s);return s},ye=(t,e)=>(r,i)=>e(r,i,t);const j=16,fe=1;let Ae=class extends ie.Shape{constructor(e,r,i,s,l){super(e,r);S(this,"_cellWidth",0);S(this,"_cellHeight",0);S(this,"_filterParams");S(this,"_hovered",!1);this._contextService=i,this._commandService=s,this._themeService=l,this.setShapeProps(r),this.onPointerDown$.subscribeEvent(n=>this.onPointerDown(n)),this.onPointerEnter$.subscribeEvent(()=>this.onPointerEnter()),this.onPointerLeave$.subscribeEvent(()=>this.onPointerLeave())}setShapeProps(e){typeof e.cellHeight<"u"&&(this._cellHeight=e.cellHeight),typeof e.cellWidth<"u"&&(this._cellWidth=e.cellWidth),typeof e.filterParams<"u"&&(this._filterParams=e.filterParams),this.transformByState({width:e.width,height:e.height})}_draw(e){const r=this._cellHeight,i=this._cellWidth,s=j-i,l=j-r;e.save();const n=new Path2D;n.rect(s,l,i,r),e.clip(n);const{hasCriteria:o}=this._filterParams,a=this._themeService.getCurrentTheme().primaryColor,h=this._hovered?this._themeService.getCurrentTheme().grey50:"rgba(255, 255, 255, 1.0)";o?Ve.drawHasCriteria(e,j,a,h):Ve.drawNoCriteria(e,j,a,h),e.restore()}onPointerDown(e){if(e.button===2)return;const{col:r,unitId:i,subUnitId:s}=this._filterParams;this._contextService.getContextValue(z)||!this._commandService.hasCommand(oe.id)||setTimeout(()=>{this._commandService.executeCommand(oe.id,{unitId:i,subUnitId:s,col:r})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};Ae=gt([ye(2,c.IContextService),ye(3,c.ICommandService),ye(4,c.Inject(c.ThemeService))],Ae);var Ct=Object.getOwnPropertyDescriptor,Tt=(t,e,r,i)=>{for(var s=i>1?void 0:i?Ct(e,r):e,l=t.length-1,n;l>=0;l--)(n=t[l])&&(s=n(s)||s);return s},K=(t,e)=>(r,i)=>e(r,i,t);const Et=1e3,Ft=5e3;let be=class extends c.RxDisposable{constructor(e,r,i,s,l,n,o,a){super();S(this,"_filterRangeShape",null);S(this,"_buttonRenderDisposable",null);S(this,"_filterButtonShapes",[]);this._context=e,this._injector=r,this._sheetSkeletonManagerService=i,this._sheetsFilterService=s,this._themeService=l,this._sheetInterceptorService=n,this._commandService=o,this._selectionRenderService=a,this._initRenderer()}dispose(){super.dispose(),this._disposeRendering()}_initRenderer(){this._sheetSkeletonManagerService.currentSkeleton$.pipe(C.switchMap(e=>{var o,a;if(!e)return C.of(null);const{unit:r,unitId:i}=this._context,s=((o=r.getActiveSheet())==null?void 0:o.getSheetId())||"",l=(a=this._sheetsFilterService.getFilterModel(i,s))!=null?a:void 0,n=()=>({unitId:i,worksheetId:s,filterModel:l,range:l==null?void 0:l.getRange(),skeleton:e.skeleton});return c.fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(C.filter(([h])=>{var m;return h.type===c.CommandType.MUTATION&&((m=h.params)==null?void 0:m.unitId)===r.getUnitId()&&(u.FILTER_MUTATIONS.has(h.id)||h.id===I.SetRangeValuesMutation.id)}),C.throttleTime(20,void 0,{leading:!1,trailing:!0}),C.map(n),C.startWith(n()))}),C.takeUntil(this.dispose$)).subscribe(e=>{this._disposeRendering(),!(!e||!e.range)&&(this._renderRange(e.range,e.skeleton),this._renderButtons(e))})}_renderRange(e,r){const{scene:i}=this._context,{rowHeaderWidth:s,columnHeaderHeight:l}=r,n=this._filterRangeShape=new $.SelectionControl(i,Et,this._themeService,{rowHeaderWidth:s,columnHeaderHeight:l,enableAutoFill:!1,highlightHeader:!1}),o={range:e,primary:null,style:{fill:"rgba(0, 0, 0, 0.0)"}},a=$.attachSelectionWithCoord(o,r);n.updateRangeBySelectionWithCoord(a),n.setEvent(!1),i.makeDirty(!0)}_renderButtons(e){const{range:r,filterModel:i,unitId:s,skeleton:l,worksheetId:n}=e,{scene:o}=this._context;this._interceptCellContent(s,n,e.range);const{startColumn:a,endColumn:h,startRow:m}=r;for(let f=a;f<=h;f++){const F=`sheets-filter-button-${f}`,v=$.getCoordByCell(m,f,o,l),{startX:O,startY:E,endX:A,endY:P}=v,U=A-O,M=P-E;if(M<=fe||U<=fe)continue;const B=!!i.getFilterColumn(f),V=A-j-fe,Se=P-j-fe,ge={left:V,top:Se,height:j,width:j,zIndex:Ft,cellHeight:M,cellWidth:U,filterParams:{unitId:s,subUnitId:n,col:f,hasCriteria:B}},w=this._injector.createInstance(Ae,F,ge);this._filterButtonShapes.push(w)}o.addObjects(this._filterButtonShapes),o.makeDirty()}_interceptCellContent(e,r,i){const{startRow:s,startColumn:l,endColumn:n}=i;this._buttonRenderDisposable=this._sheetInterceptorService.intercept(I.INTERCEPTOR_POINT.CELL_CONTENT,{effect:c.InterceptorEffectEnum.Style,handler:(o,a,h)=>{const{row:m,col:f,unitId:F,subUnitId:v}=a;return F!==e||v!==r||m!==s||f<l||f>n?h(o):h({...o,fontRenderExtension:{...o==null?void 0:o.fontRenderExtension,rightOffset:j}})},priority:10})}_disposeRendering(){var e,r;(e=this._filterRangeShape)==null||e.dispose(),this._filterButtonShapes.forEach(i=>i.dispose()),(r=this._buttonRenderDisposable)==null||r.dispose(),this._filterRangeShape=null,this._buttonRenderDisposable=null,this._filterButtonShapes=[]}};be=Tt([K(1,c.Inject(c.Injector)),K(2,c.Inject($.SheetSkeletonManagerService)),K(3,c.Inject(u.SheetsFilterService)),K(4,c.Inject(c.ThemeService)),K(5,c.Inject(I.SheetInterceptorService)),K(6,c.ICommandService),K(7,$.ISheetSelectionRenderService)],be);var Ot=Object.getOwnPropertyDescriptor,It=(t,e,r,i)=>{for(var s=i>1?void 0:i?Ot(e,r):e,l=t.length-1,n;l>=0;l--)(n=t[l])&&(s=n(s)||s);return s},We=(t,e)=>(r,i)=>e(r,i,t);let ae=class extends c.RxDisposable{constructor(t,e){super(),this._renderManagerService=t,this._sheetsRenderService=e,[u.SetSheetsFilterRangeMutation,u.SetSheetsFilterCriteriaMutation,u.RemoveSheetsFilterMutation,u.ReCalcSheetsFilterMutation].forEach(r=>this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(r.id))),this.disposeWithMe(this._renderManagerService.registerRenderModule(c.UniverInstanceType.UNIVER_SHEET,[be]))}};ae=It([We(0,ie.IRenderManagerService),We(1,c.Inject($.SheetsRenderService))],ae);const Pt={id:u.SmartToggleSheetsFilterCommand.id,binding:T.KeyCode.L|T.MetaKeys.CTRL_COMMAND|T.MetaKeys.SHIFT,description:"sheets-filter.shortcut.smart-toggle-filter",preconditions:$.whenSheetEditorFocused,group:"4_sheet-edit"};var Nt=Object.getOwnPropertyDescriptor,yt=(t,e,r,i)=>{for(var s=i>1?void 0:i?Nt(e,r):e,l=t.length-1,n;l>=0;l--)(n=t[l])&&(s=n(s)||s);return s},D=(t,e)=>(r,i)=>e(r,i,t);const Qe="FILTER_PANEL_POPUP";let _e=class extends ae{constructor(e,r,i,s,l,n,o,a,h,m,f,F,v){super(v,F);S(this,"_popupDisposable");this._injector=e,this._componentManager=r,this._sheetsFilterPanelService=i,this._sheetCanvasPopupService=s,this._sheetsFilterService=l,this._localeService=n,this._shortcutService=o,this._commandService=a,this._menuManagerService=h,this._contextService=m,this._messageService=f,this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[Pt].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}_initCommands(){[u.SmartToggleSheetsFilterCommand,u.RemoveSheetFilterCommand,u.SetSheetFilterRangeCommand,u.SetSheetsFilterCriteriaCommand,u.ClearSheetsFilterCriteriaCommand,u.ReCalcSheetsFilterCommand,Ne,oe,J].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenuItems(){this._menuManagerService.mergeMenu(_t)}_initUI(){this.disposeWithMe(this._componentManager.register(Qe,ht)),this.disposeWithMe(this._componentManager.register("FilterSingle",Be)),this.disposeWithMe(this._contextService.subscribeContextValue$(z).pipe(C.distinctUntilChanged()).subscribe(e=>{e?this._openFilterPopup():this._closeFilterPopup()})),this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe(e=>{e&&this._messageService.show({type:L.MessageType.Error,content:this._localeService.t(e)})}))}_openFilterPopup(){const e=this._sheetsFilterPanelService.filterModel;if(!e)throw new Error("[SheetsFilterUIController]: no filter model when opening filter popup!");const r=e.getRange(),i=this._sheetsFilterPanelService.col,{startRow:s}=r;this._popupDisposable=this._sheetCanvasPopupService.attachPopupToCell(s,i,{componentKey:Qe,direction:"horizontal",onClickOutside:()=>this._commandService.syncExecuteCommand(J.id),offset:[5,0]})}_closeFilterPopup(){var e;(e=this._popupDisposable)==null||e.dispose(),this._popupDisposable=null}};_e=yt([D(0,c.Inject(c.Injector)),D(1,c.Inject(T.ComponentManager)),D(2,c.Inject(x)),D(3,c.Inject($.SheetCanvasPopManagerService)),D(4,c.Inject(u.SheetsFilterService)),D(5,c.Inject(c.LocaleService)),D(6,T.IShortcutService),D(7,c.ICommandService),D(8,T.IMenuManagerService),D(9,c.IContextService),D(10,T.IMessageService),D(11,c.Inject($.SheetsRenderService)),D(12,ie.IRenderManagerService)],_e);var At=Object.defineProperty,bt=Object.getOwnPropertyDescriptor,Rt=(t,e,r)=>e in t?At(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Mt=(t,e,r,i)=>{for(var s=i>1?void 0:i?bt(e,r):e,l=t.length-1,n;l>=0;l--)(n=t[l])&&(s=n(s)||s);return s},Re=(t,e)=>(r,i)=>e(r,i,t),je=(t,e,r)=>Rt(t,typeof e!="symbol"?e+"":e,r);const Lt="SHEET_FILTER_UI_PLUGIN";_.UniverSheetsFilterUIPlugin=class extends c.Plugin{constructor(e=ce,r,i,s){super(),this._config=e,this._injector=r,this._configService=i,this._rpcChannelService=s;const{menu:l,...n}=c.merge({},ce,this._config);l&&this._configService.setConfig("menu",l,{merge:!0}),this._configService.setConfig(Ue,n)}onStarting(){[[x],[te],[_e]].forEach(e=>this._injector.add(e)),this._config.useRemoteFilterValuesGenerator&&this._rpcChannelService&&this._injector.add([ue,{useFactory:()=>Q.toModule(this._rpcChannelService.requestChannel(Fe))}])}onReady(){this._injector.get(te)}onRendered(){this._injector.get(_e)}},je(_.UniverSheetsFilterUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),je(_.UniverSheetsFilterUIPlugin,"pluginName",Lt),_.UniverSheetsFilterUIPlugin=Mt([c.DependentOn(u.UniverSheetsFilterPlugin),Re(1,c.Inject(c.Injector)),Re(2,c.IConfigService),Re(3,c.Optional(Q.IRPCChannelService))],_.UniverSheetsFilterUIPlugin);var Ut=Object.defineProperty,wt=Object.getOwnPropertyDescriptor,$t=(t,e,r)=>e in t?Ut(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dt=(t,e,r,i)=>{for(var s=i>1?void 0:i?wt(e,r):e,l=t.length-1,n;l>=0;l--)(n=t[l])&&(s=n(s)||s);return s},Ge=(t,e)=>(r,i)=>e(r,i,t),xe=(t,e,r)=>$t(t,typeof e!="symbol"?e+"":e,r);const Ht="SHEET_FILTER_UI_PLUGIN";_.UniverSheetsFilterMobileUIPlugin=class extends c.Plugin{constructor(e=ce,r,i){super(),this._config=e,this._injector=r,this._configService=i;const{menu:s,...l}=c.merge({},ce,this._config);s&&this._configService.setConfig("menu",s,{merge:!0}),this._configService.setConfig(Ue,l)}onStarting(){[[te],[ae]].forEach(e=>this._injector.add(e))}onReady(){this._injector.get(te)}onRendered(){this._injector.get(ae)}},xe(_.UniverSheetsFilterMobileUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),xe(_.UniverSheetsFilterMobileUIPlugin,"pluginName",Ht),_.UniverSheetsFilterMobileUIPlugin=Dt([c.DependentOn(u.UniverSheetsFilterPlugin),Ge(1,c.Inject(c.Injector)),Ge(2,c.IConfigService)],_.UniverSheetsFilterMobileUIPlugin);var kt=Object.getOwnPropertyDescriptor,Bt=(t,e,r,i)=>{for(var s=i>1?void 0:i?kt(e,r):e,l=t.length-1,n;l>=0;l--)(n=t[l])&&(s=n(s)||s);return s},Ye=(t,e)=>(r,i)=>e(r,i,t);_.UniverSheetsFilterUIWorkerPlugin=(ve=class extends c.Plugin{constructor(e,r,i){super(),this._config=e,this._injector=r,this._rpcChannelService=i}onStarting(){[[ue,{useClass:Oe}]].forEach(e=>this._injector.add(e))}onReady(){this._rpcChannelService.registerChannel(Fe,Q.fromModule(this._injector.get(ue)))}},S(ve,"type",c.UniverInstanceType.UNIVER_SHEET),S(ve,"pluginName","SHEET_FILTER_UI_WORKER_PLUGIN"),ve),_.UniverSheetsFilterUIWorkerPlugin=Bt([Ye(1,c.Inject(c.Injector)),Ye(2,Q.IRPCChannelService)],_.UniverSheetsFilterUIWorkerPlugin),_.ChangeFilterByOperation=Ne,_.CloseFilterPanelOperation=J,_.OpenFilterPanelOperation=oe,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
21
23
 
22
24
 
23
25
  // index
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/preset-sheets-filter",
3
- "version": "0.6.7-nightly.202503291606",
3
+ "version": "0.6.7-nightly.202503311607",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -57,11 +57,11 @@
57
57
  "rxjs": ">=7.0.0"
58
58
  },
59
59
  "dependencies": {
60
- "@univerjs/sheets-filter": "0.6.7-nightly.202503291606",
61
- "@univerjs/sheets-filter-ui": "0.6.7-nightly.202503291606"
60
+ "@univerjs/sheets-filter": "0.6.7-nightly.202503311607",
61
+ "@univerjs/sheets-filter-ui": "0.6.7-nightly.202503311607"
62
62
  },
63
63
  "devDependencies": {
64
- "@univerjs/core": "0.6.7-nightly.202503291606",
64
+ "@univerjs/core": "0.6.7-nightly.202503311607",
65
65
  "react": "18.3.1",
66
66
  "react-dom": "18.3.1",
67
67
  "typescript": "^5.8.2",