@univerjs/preset-sheets-filter 0.16.1 → 0.18.0
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 +1 -1
- package/lib/umd/index.js +72 -7
- package/lib/umd/locales/ca-ES.js +1 -2
- package/lib/umd/locales/en-US.js +1 -2
- package/lib/umd/locales/es-ES.js +1 -2
- package/lib/umd/locales/fa-IR.js +1 -2
- package/lib/umd/locales/fr-FR.js +1 -2
- package/lib/umd/locales/ja-JP.js +1 -2
- package/lib/umd/locales/ko-KR.js +1 -2
- package/lib/umd/locales/ru-RU.js +1 -2
- package/lib/umd/locales/sk-SK.js +1 -2
- package/lib/umd/locales/vi-VN.js +1 -2
- package/lib/umd/locales/zh-CN.js +1 -2
- package/lib/umd/locales/zh-TW.js +1 -2
- package/package.json +5 -5
package/lib/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.univer-absolute{position:absolute}.univer-relative{position:relative}.-univer-bottom-0\.5{bottom:-.125rem}.-univer-right-0\.5{right:-.125rem}.univer-mx-1{margin-left:.25rem;margin-right:.25rem}.univer-mb-1{margin-bottom:.25rem}.univer-mb-2{margin-bottom:.5rem}.univer-ml-1{margin-left:.25rem}.univer-mt-2{margin-top:.5rem}.univer-mt-4{margin-top:1rem}.univer-box-border{box-sizing:border-box}.univer-block{display:block}.univer-inline-block{display:inline-block}.univer-flex{display:flex}.univer-inline-flex{display:inline-flex}.univer-grid{display:grid}.univer-hidden{display:none}.univer-size-3{width:.75rem;height:.75rem}.univer-size-6{width:1.5rem;height:1.5rem}.univer-size-full{width:100%;height:100%}.univer-h-4{height:1rem}.univer-h-5{height:1.25rem}.univer-h-7{height:1.75rem}.univer-h-8{height:2rem}.univer-h-\[300px\]{height:300px}.univer-h-full{height:100%}.univer-max-h-\[500px\]{max-height:500px}.univer-min-h-\[300px\]{min-height:300px}.univer-w-\[400px\]{width:400px}.univer-w-full{width:100%}.univer-flex-1{flex:1
|
|
1
|
+
.univer-absolute{position:absolute}.univer-relative{position:relative}.-univer-bottom-0\.5{bottom:-.125rem}.-univer-right-0\.5{right:-.125rem}.univer-mx-1{margin-left:.25rem;margin-right:.25rem}.univer-mb-1{margin-bottom:.25rem}.univer-mb-2{margin-bottom:.5rem}.univer-ml-1{margin-left:.25rem}.univer-mt-2{margin-top:.5rem}.univer-mt-4{margin-top:1rem}.univer-box-border{box-sizing:border-box}.univer-block{display:block}.univer-inline-block{display:inline-block}.univer-flex{display:flex}.univer-inline-flex{display:inline-flex}.univer-grid{display:grid}.univer-hidden{display:none}.univer-size-3{width:.75rem;height:.75rem}.univer-size-6{width:1.5rem;height:1.5rem}.univer-size-full{width:100%;height:100%}.univer-h-4{height:1rem}.univer-h-5{height:1.25rem}.univer-h-7{height:1.75rem}.univer-h-8{height:2rem}.univer-h-\[300px\]{height:300px}.univer-h-full{height:100%}.univer-max-h-\[500px\]{max-height:500px}.univer-min-h-\[300px\]{min-height:300px}.univer-w-\[400px\]{width:400px}.univer-w-full{width:100%}.univer-flex-1{flex:1}.univer-flex-shrink{flex-shrink:1}.univer-flex-shrink-0{flex-shrink:0}.univer-flex-grow{flex-grow:1}.univer-flex-grow-0{flex-grow:0}.univer-cursor-pointer{cursor:pointer}.univer-grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.univer-flex-col{flex-direction:column}.univer-flex-nowrap{flex-wrap:nowrap}.univer-items-center{align-items:center}.univer-justify-start{justify-content:flex-start}.univer-justify-center{justify-content:center}.univer-justify-between{justify-content:space-between}.univer-gap-1{gap:.25rem}.univer-gap-2{gap:.5rem}.univer-gap-4{gap:1rem}.univer-overflow-auto{overflow:auto}.univer-overflow-hidden{overflow:hidden}.univer-truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.univer-whitespace-nowrap{white-space:nowrap}.univer-rounded-full{border-radius:9999px}.univer-rounded-lg{border-radius:.5rem}.univer-rounded-md{border-radius:.375rem}.univer-border{border-width:1px}.univer-border-solid{border-style:solid}.univer-border-\[rgba\(13\,13\,13\,0\.06\)\]{border-color:#0d0d0d0f}.univer-border-transparent{border-color:#0000}.univer-bg-gray-300{background-color:var(--univer-gray-300)}.univer-bg-white{background-color:var(--univer-white)}.univer-p-0\.5{padding:.125rem}.univer-p-2{padding:.5rem}.univer-p-4{padding:1rem}.univer-px-1\.5{padding-left:.375rem;padding-right:.375rem}.univer-px-2{padding-left:.5rem;padding-right:.5rem}.univer-py-0{padding-top:0;padding-bottom:0}.univer-py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.univer-py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.univer-pl-5{padding-left:1.25rem}.univer-pr-0\.5{padding-right:.125rem}.univer-pr-2{padding-right:.5rem}.univer-pt-2{padding-top:.5rem}.univer-text-sm{font-size:.875rem;line-height:1.25rem}.univer-text-xs{font-size:.75rem;line-height:1rem}.univer-font-bold{font-weight:700}.univer-text-\[\#418F1F\]{--univer-tw-text-opacity: 1;color:rgba(65,143,31,var(--univer-tw-text-opacity, 1))}.univer-text-gray-400{color:var(--univer-gray-400)}.univer-text-gray-500{color:var(--univer-gray-500)}.univer-text-gray-900{color:var(--univer-gray-900)}.univer-text-primary-500{color:var(--univer-primary-500)}.univer-shadow-lg{--univer-tw-shadow: 0px 4px 6px 0px #1e284d0d, 0px 10px 15px -3px #1e284d1a;--univer-tw-shadow-colored: 0px 4px 6px 0px var(--univer-tw-shadow-color), 0px 10px 15px -3px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 4px 6px #1e284d0d,0 10px 15px -3px #1e284d1a;box-shadow:var(--univer-tw-ring-offset-shadow, 0 0 #0000),var(--univer-tw-ring-shadow, 0 0 #0000),var(--univer-tw-shadow)}.univer-transition-shadow{transition-property:box-shadow;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\:univer-bg-gray-50:hover{background-color:var(--univer-gray-50)}.hover\:univer-ring-2:hover{--univer-tw-ring-offset-shadow: var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color);--univer-tw-ring-shadow: var(--univer-tw-ring-inset) 0 0 0 calc(2px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color);box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow, 0 0 #0000)}.hover\:univer-ring-offset-2:hover{--univer-tw-ring-offset-width: 2px}.hover\:univer-ring-offset-white:hover{--univer-tw-ring-offset-color: var(--univer-white)}.dark\:\!univer-border-\[rgba\(255\,255\,255\,0\.06\)\]:where(.univer-dark,.univer-dark *){border-color:#ffffff0f!important}.dark\:\!univer-border-gray-600:where(.univer-dark,.univer-dark *){border-color:var(--univer-gray-600)!important}.dark\:\!univer-bg-gray-700:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-700)!important}.dark\:\!univer-text-gray-200:where(.univer-dark,.univer-dark *){color:var(--univer-gray-200)!important}.dark\:\!univer-text-gray-500:where(.univer-dark,.univer-dark *){color:var(--univer-gray-500)!important}.dark\:\!univer-text-white:where(.univer-dark,.univer-dark *){color:var(--univer-white)!important}.dark\:hover\:\!univer-bg-gray-900:hover:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-900)!important}.\[\&\:hover_a\]\:univer-inline-block:hover a{display:inline-block}
|
package/lib/umd/index.js
CHANGED
|
@@ -1,20 +1,85 @@
|
|
|
1
1
|
// @univerjs/sheets-filter/index
|
|
2
|
-
(function(h,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("rxjs"),require("@univerjs/engine-render"),require("@univerjs/rpc"),require("@univerjs/engine-formula")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","rxjs","@univerjs/engine-render","@univerjs/rpc","@univerjs/engine-formula"],a):(h=typeof globalThis<"u"?globalThis:h||self,a(h.UniverSheetsFilter={},h.UniverCore,h.UniverSheets,h.rxjs,h.UniverEngineRender,h.UniverRpc,h.UniverEngineFormula))})(this,(function(h,a,_,I,Se,Re,J){"use strict";var Ye=Object.defineProperty;var et=(h,a,_)=>a in h?Ye(h,a,{enumerable:!0,configurable:!0,writable:!0,value:_}):h[a]=_;var v=(h,a,_)=>et(h,typeof a!="symbol"?a+"":a,_);var x;const K="sheet.mutation.set-filter-range",Z="sheet.mutation.set-filter-criteria",X="sheet.mutation.remove-filter",Y="sheet.mutation.re-calc-filter",H=new Set([K,Z,X,Y]);var N=(i=>(i[i.VALUES=0]="VALUES",i[i.COLORS=1]="COLORS",i[i.CONDITIONS=2]="CONDITIONS",i))(N||{}),A=(i=>(i.EQUAL="equal",i.GREATER_THAN="greaterThan",i.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",i.LESS_THAN="lessThan",i.LESS_THAN_OR_EQUAL="lessThanOrEqual",i.NOT_EQUALS="notEqual",i))(A||{});const ee={operator:A.GREATER_THAN,fn:(i,n)=>U(i)?i>n:!1},te={operator:A.GREATER_THAN_OR_EQUAL,fn:(i,n)=>U(i)?i>=n:!1},re={operator:A.LESS_THAN,fn:(i,n)=>U(i)?i<n:!1},ne={operator:A.LESS_THAN_OR_EQUAL,fn:(i,n)=>U(i)?i<=n:!1},ie={operator:A.EQUAL,fn:(i,n)=>U(i)?i===n:!1},z={operator:A.NOT_EQUALS,fn:(i,n)=>{if(typeof n=="string"){if(n===" ")return i!=null;const e=le(i);return e&&pe(n)?!a.createREGEXFromWildChar(n).test(e):e!==n}return U(i)?i!==n:!0}},se=new Map([]);[ee,te,re,ne,ie,z].forEach(i=>{se.set(i.operator,i)});function ve(i){return!!i}const Fe={fn:(i,n)=>{const e=le(i);return e===null?n==="":a.createREGEXFromWildChar(n).test(e)}};function V(i){return i?se.get(i):Fe}function U(i){return typeof i=="number"}function oe(i){return!!(typeof i=="number"||typeof i=="string"&&a.isNumeric(i))}function le(i){return typeof i=="boolean"||i==null?null:typeof i=="string"?i:i.toString()}function pe(i){return typeof i=="number"?!1:i.indexOf("*")!==-1||i.indexOf("?")!==-1}const W=()=>new Set;class P extends a.Disposable{constructor(e,t,r){super();v(this,"_filteredOutRows$",new I.BehaviorSubject(W()));v(this,"filteredOutRows$",this._filteredOutRows$.asObservable());v(this,"_hasCriteria$",new I.BehaviorSubject(!1));v(this,"hasCriteria$",this._hasCriteria$.asObservable());v(this,"_filterColumnByIndex",new Map);v(this,"_alreadyFilteredOutRows",W());v(this,"_range");this.unitId=e,this.subUnitId=t,this._worksheet=r}get filteredOutRows(){return this._filteredOutRows$.getValue()}set filteredOutRows(e){this._alreadyFilteredOutRows=e,this._filteredOutRows$.next(e)}dispose(){super.dispose(),this._filteredOutRows$.complete(),this._hasCriteria$.complete(),this._worksheet=null}serialize(){const e={ref:a.Rectangle.clone(this._range),filterColumns:this._getAllFilterColumns(!0).sort(([t],[r])=>t-r).map(([t,r])=>r.serialize())};return this._alreadyFilteredOutRows&&(e.cachedFilteredOut=Array.from(this._alreadyFilteredOutRows).sort()),e}static deserialize(e,t,r,s){const o=new P(e,t,r);return o._dump(s),o}_dump(e){var t;this.setRange(e.ref),(t=e.filterColumns)==null||t.filter(r=>!(!r.filters&&!r.colorFilters&&!r.customFilters)).forEach(r=>this._setCriteriaWithoutReCalc(r.colId,r)),e.cachedFilteredOut?(this._alreadyFilteredOutRows=new Set(e.cachedFilteredOut),this._emit()):e.filterColumns&&e.filterColumns.length>0&&(this._reCalcAllColumns(),this._emit()),this._emitHasCriteria()}isRowFiltered(e){return this._alreadyFilteredOutRows.has(e)}getRange(){if(!this._range)throw new Error("[FilterModel] could not get range before a range is set!");return this._range}getFilteredOutRowsExceptCol(e){return this._getAllFilterColumns(!0).filter(([t])=>t!==e).reduce((t,[,r])=>{const s=r.calc({getAlreadyFilteredOutRows:()=>t});return s?a.mergeSets(t,s):t},new Set)}setRange(e){this._range=e,this._getAllFilterColumns(!0).forEach(([t,r])=>{r.setRangeAndColumn({startRow:e.startRow,endRow:e.endRow,startColumn:t,endColumn:t},t)})}setCriteria(e,t,r=!1){if(!this._range)throw new Error("[FilterModel] could not set criteria before a range is set!");if(!t){this._removeCriteria(e),this._rebuildAlreadyFilteredOutRowsWithCache(),r&&this._reCalcAllColumns(),this._emit(),this._emitHasCriteria();return}this._setCriteriaWithoutReCalc(e,t),r&&(this._rebuildAlreadyFilteredOutRowsWithCache(),this._getAllFilterColumns().forEach(s=>s.__clearCache()),this._reCalcWithNoCacheColumns(),this._emit(),this._emitHasCriteria())}getAllFilterColumns(){return this._getAllFilterColumns(!0)}getFilterColumn(e){var t;return(t=this._filterColumnByIndex.get(e))!=null?t:null}reCalc(){this._reCalcAllColumns(),this._emit()}_getAllFilterColumns(e=!1){const t=Array.from(this._filterColumnByIndex.entries());return e?t:t.map(([r,s])=>s)}_reCalcAllColumns(){this._alreadyFilteredOutRows=W(),this._getAllFilterColumns().forEach(e=>e.__clearCache()),this._reCalcWithNoCacheColumns()}_setCriteriaWithoutReCalc(e,t){const r=this._range;if(!r)throw new Error("[FilterModel] could not set criteria before a range is set!");const{startColumn:s,endColumn:o}=r;if(e>o||e<s)throw new Error(`[FilterModel] could not set criteria on column ${e} which is out of range!`);let l;this._filterColumnByIndex.has(e)?l=this._filterColumnByIndex.get(e):(l=new ae(this.unitId,this.subUnitId,this._worksheet,t,{getAlreadyFilteredOutRows:()=>this._alreadyFilteredOutRows}),l.setRangeAndColumn(r,e),this._filterColumnByIndex.set(e,l)),l.setCriteria(t)}_removeCriteria(e){const t=this._filterColumnByIndex.get(e);t&&(t.dispose(),this._filterColumnByIndex.delete(e))}_emit(){this._filteredOutRows$.next(this._alreadyFilteredOutRows)}_emitHasCriteria(){this._hasCriteria$.next(this._filterColumnByIndex.size>0)}_rebuildAlreadyFilteredOutRowsWithCache(){const e=this._getAllFilterColumns().filter(t=>t.hasCache()).reduce((t,r)=>a.mergeSets(t,r.filteredOutRows),new Set);this._alreadyFilteredOutRows=e}_reCalcWithNoCacheColumns(){const e=this._getAllFilterColumns().filter(t=>!t.hasCache());for(const t of e){const r=t.reCalc();r&&(this._alreadyFilteredOutRows=a.mergeSets(this._alreadyFilteredOutRows,r))}}}class ae extends a.Disposable{constructor(e,t,r,s,o){super();v(this,"_filteredOutRows",null);v(this,"_filterFn",null);v(this,"_range",null);v(this,"_column",0);v(this,"_filterBy",N.VALUES);this.unitId=e,this.subUnitId=t,this._worksheet=r,this._criteria=s,this._filterColumnContext=o}get filteredOutRows(){return this._filteredOutRows}get filterBy(){return this._filterBy}dispose(){super.dispose(),this._filteredOutRows=null}__clearCache(){this._filteredOutRows=null}serialize(){if(!this._criteria)throw new Error("[FilterColumn]: could not serialize without a filter column!");return a.Tools.deepClone({...this._criteria,colId:this._column})}hasCache(){return this._filteredOutRows!==null}setRangeAndColumn(e,t){this._range=e,this._column=t}setCriteria(e){this._criteria=e,this._generateFilterFn(),this._filteredOutRows=null}getColumnData(){return a.Tools.deepClone(this._criteria)}reCalc(){return this._filteredOutRows=this.calc(this._filterColumnContext),this._filteredOutRows}calc(e){if(!this._filterFn)throw new Error("[FilterColumn] cannot calculate without a filter fn!");if(!this._range)throw new Error("[FilterColumn] cannot calculate without a range!");if(typeof this._column!="number")throw new TypeError("[FilterColumn] cannot calculate without a column offset!");const t=this._column,r={startColumn:t,endColumn:t,startRow:this._range.startRow+1,endRow:this._range.endRow},s=new Set,o=e.getAlreadyFilteredOutRows();for(const l of this._worksheet.iterateByColumn(r,!1,!1)){const{row:d,rowSpan:c,col:m}=l;if(o.has(d)&&(!c||c===1))continue;if(!(this._filterBy===N.VALUES?this._filterFn(a.extractPureTextFromCell(this._worksheet.getCell(d,m))):this._filterBy===N.COLORS?this._filterFn(this._worksheet.getComposedCellStyle(d,m)):this._filterFn(Ne(this._worksheet,d,m)))&&(s.add(d),c))for(let f=1;f<c;f++)s.add(d+f)}return s}_generateFilterFn(){this._criteria&&(this._filterFn=we(this._criteria),this._filterBy=this._criteria.filters?N.VALUES:this._criteria.colorFilters?N.COLORS:N.CONDITIONS)}}function we(i){if(i.filters)return Me(i.filters);if(i.colorFilters)return Ee(i.colorFilters);if(i.customFilters)return ye(i.customFilters);throw new Error("[FilterModel]: other types of filters are not supported yet.")}function Me(i){const n=!!i.blank,e=new Set(i.filters);return t=>t===void 0||t===""?n:e.has(typeof t=="string"?t:`${t}`)}function Ee(i){if(i.cellFillColors){const n=new Set(i.cellFillColors);return e=>{var r;if(!e||!((r=e.bg)!=null&&r.rgb))return!!n.has(null);const t=new a.ColorKit(e.bg.rgb).toRgbString();return n.has(t)}}if(i.cellTextColors){const n=new Set(i.cellTextColors);return e=>{var r;if(!e||!((r=e.cl)!=null&&r.rgb))return!!n.has(Se.COLOR_BLACK_RGB);const t=new a.ColorKit(e.cl.rgb).toRgbString();return n.has(t)}}throw new Error("[FilterModel]: color filters are not supported yet.")}function ye(i){const n=i.customFilters.map(e=>Ae(e));return Te(n)?i.and?Oe(n):Ie(n):n[0]}function Oe(i){const[n,e]=i;return t=>n(t)&&e(t)}function Ie(i){const[n,e]=i;return t=>n(t)||e(t)}function Te(i){return i.length===2}function Ae(i){const n=i.val;if(i.operator===A.NOT_EQUALS&&!oe(n))return r=>z.fn(r,n);if(ve(i.operator)){if(!oe(n))return()=>!1;const r=V(i.operator),s=Number(n);return o=>r.fn(o,s)}const e=V(i.operator);return t=>e.fn(t,n)}function Ne(i,n,e){const t=i.getCell(n,e);if(!t)return null;const r=i.getCellRaw(n,e);return t&&!r?de(t):r?t.t===a.CellValueType.NUMBER&&typeof t.v=="string"?r.v:t.t===a.CellValueType.NUMBER?Number(r.v):de(r):null}function de(i){var t,r;const n=(r=(t=i.p)==null?void 0:t.body)==null?void 0:r.dataStream;if(n)return n.trimEnd();const e=i.v;return typeof e=="string"?i.t===a.CellValueType.BOOLEAN?e.toUpperCase():e:typeof e=="number"?i.t===a.CellValueType.BOOLEAN?e?"TRUE":"FALSE":e:typeof e=="boolean"?e?"TRUE":"FALSE":""}var be=Object.getOwnPropertyDescriptor,Ue=(i,n,e,t)=>{for(var r=t>1?void 0:t?be(n,e):n,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(r)||r);return r},q=(i,n)=>(e,t)=>n(e,t,i);const k="SHEET_FILTER_PLUGIN";h.SheetsFilterService=class extends a.Disposable{constructor(e,t,r){super();v(this,"_filterModels",new Map);v(this,"_loadedUnitId$",new I.BehaviorSubject(null));v(this,"loadedUnitId$",this._loadedUnitId$.asObservable());v(this,"_errorMsg$",new I.BehaviorSubject(null));v(this,"errorMsg$",this._errorMsg$.asObservable());v(this,"_activeFilterModel$",new I.BehaviorSubject(null));v(this,"activeFilterModel$",this._activeFilterModel$.asObservable());this._resourcesManagerService=e,this._univerInstanceService=t,this._commandService=r,this._initModel(),this._initActiveFilterModel()}get activeFilterModel(){return this._activeFilterModel$.getValue()}ensureFilterModel(e,t){const r=this.getFilterModel(e,t);if(r)return r;const s=this._univerInstanceService.getUniverSheetInstance(e);if(!s)throw new Error(`[SheetsFilterService]: could not create "FilterModel" on a non-existing workbook ${e}!`);const o=s.getSheetBySheetId(t);if(!o)throw new Error(`[SheetsFilterService]: could not create "FilterModel" on a non-existing worksheet ${t}!`);const l=new P(e,t,o);return this._cacheFilterModel(e,t,l),l}getFilterModel(e,t){var r,s;return(s=(r=this._filterModels.get(e))==null?void 0:r.get(t))!=null?s:null}removeFilterModel(e,t){const r=this.getFilterModel(e,t);return r?(r.dispose(),this._filterModels.get(e).delete(t),!0):!1}setFilterErrorMsg(e){this._errorMsg$.next(e)}_updateActiveFilterModel(){let e;try{if(e=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),!e){this._activeFilterModel$.next(null);return}}catch(l){console.error("[SheetsFilterService]: could not get active workbook!",l);return}const t=e.getActiveSheet(!0);if(!t){this._activeFilterModel$.next(null);return}const r=t.getUnitId(),s=t.getSheetId(),o=this.getFilterModel(r,s);this._activeFilterModel$.next(o)}_initActiveFilterModel(){this.disposeWithMe(I.merge(a.fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(I.filter(([e])=>e.type===a.CommandType.MUTATION&&H.has(e.id))),this._univerInstanceService.getCurrentTypeOfUnit$(a.UniverInstanceType.UNIVER_SHEET).pipe(I.switchMap(e=>{var t;return(t=e==null?void 0:e.activeSheet$)!=null?t:I.of(null)}))).subscribe(()=>this._updateActiveFilterModel()))}_serializeAutoFiltersForUnit(e){const t=this._filterModels.get(e);if(!t)return"{}";const r={};return t.forEach((s,o)=>{r[o]=s.serialize()}),JSON.stringify(r)}_deserializeAutoFiltersForUnit(e,t){const r=this._univerInstanceService.getUniverSheetInstance(e);Object.keys(t).forEach(s=>{const o=t[s],l=P.deserialize(e,s,r.getSheetBySheetId(s),o);this._cacheFilterModel(e,s,l)})}dispose(){super.dispose(),this._loadedUnitId$.complete(),this._errorMsg$.complete(),this._activeFilterModel$.complete(),this._filterModels.forEach(e=>{e.forEach(t=>t.dispose()),e.clear()}),this._filterModels.clear()}_initModel(){this._resourcesManagerService.registerPluginResource({pluginName:k,businesses:[a.UniverInstanceType.UNIVER_SHEET],toJson:e=>this._serializeAutoFiltersForUnit(e),parseJson:e=>JSON.parse(e),onLoad:(e,t)=>{this._deserializeAutoFiltersForUnit(e,t),this._loadedUnitId$.next(e),this._updateActiveFilterModel()},onUnLoad:e=>{const t=this._filterModels.get(e);t&&(t.forEach(r=>r.dispose()),this._filterModels.delete(e))}})}_cacheFilterModel(e,t,r){this._filterModels.has(e)||this._filterModels.set(e,new Map),this._filterModels.get(e).set(t,r)}},h.SheetsFilterService=Ue([q(0,a.IResourceManagerService),q(1,a.IUniverInstanceService),q(2,a.ICommandService)],h.SheetsFilterService);const F={id:K,type:a.CommandType.MUTATION,handler:(i,n)=>{const{subUnitId:e,unitId:t,range:r}=n;return i.get(h.SheetsFilterService).ensureFilterModel(t,e).setRange(r),!0}},p={id:Z,type:a.CommandType.MUTATION,handler:(i,n)=>{const{subUnitId:e,unitId:t,criteria:r,col:s,reCalc:o=!0}=n,d=i.get(h.SheetsFilterService).getFilterModel(t,e);return d?(d.setCriteria(s,r,o),!0):!1}},T={id:X,type:a.CommandType.MUTATION,handler:(i,n)=>{const{unitId:e,subUnitId:t}=n;return i.get(h.SheetsFilterService).removeFilterModel(e,t)}},$={id:Y,type:a.CommandType.MUTATION,handler:(i,n)=>{const{unitId:e,subUnitId:t}=n,s=i.get(h.SheetsFilterService).getFilterModel(e,t);return s?(s.reCalc(),!0):!1}},ce={id:"sheet.command.set-filter-range",type:a.CommandType.COMMAND,handler:(i,n)=>{const e=i.get(h.SheetsFilterService),t=i.get(a.ICommandService),r=i.get(a.IUndoRedoService),s=i.get(a.IUniverInstanceService),{unitId:o,subUnitId:l,range:d}=n;if(!_.getSheetCommandTarget(s,n)||e.getFilterModel(o,l))return!1;if(d.endRow===d.startRow){const S=i.get(a.ErrorService),R=i.get(a.LocaleService);return S.emit(R.t("sheets-filter.command.not-valid-filter-range")),!1}const u={id:F.id,params:{unitId:o,subUnitId:l,range:d}},f=t.syncExecuteCommand(u.id,u.params);return f&&r.pushUndoRedo({unitID:o,undoMutations:[{id:T.id,params:{unitId:o,subUnitId:l}}],redoMutations:[u]}),f}},ue={id:"sheet.command.remove-sheet-filter",type:a.CommandType.COMMAND,handler:(i,n)=>{const e=i.get(a.IUniverInstanceService),t=i.get(h.SheetsFilterService),r=i.get(a.ICommandService),s=i.get(a.IUndoRedoService),o=_.getSheetCommandTarget(e,n);if(!o)return!1;const{unitId:l,subUnitId:d}=o,c=t.getFilterModel(l,d);if(!c)return!1;const m=c==null?void 0:c.serialize(),u=Be(l,d,m),f=r.syncExecuteCommand(T.id,{unitId:l,subUnitId:d});return f&&s.pushUndoRedo({unitID:l,undoMutations:u,redoMutations:[{id:T.id,params:{unitId:l,subUnitId:d}}]}),f}},$e={id:"sheet.command.smart-toggle-filter",type:a.CommandType.COMMAND,handler:async i=>{const n=i.get(a.IUniverInstanceService),e=i.get(h.SheetsFilterService),t=i.get(a.ICommandService),r=n.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),s=r==null?void 0:r.getActiveSheet();if(!s||!r)return!1;const o=r.getUnitId(),l=s.getSheetId();if(e.getFilterModel(o,l))return t.executeCommand(ue.id,{unitId:o,subUnitId:l});const m=i.get(_.SheetsSelectionsService).getCurrentLastSelection();if(!m)return!1;const u=m.range,f=_.isSingleCellSelection(m)?_.expandToContinuousRange(u,{left:!0,right:!0,up:!0,down:!0},s):u.startRow===u.endRow?_.expandToContinuousRange(u,{down:!0},s):u;return t.executeCommand(ce.id,{unitId:o,subUnitId:l,range:f})}},Le={id:"sheet.command.set-filter-criteria",type:a.CommandType.COMMAND,handler:(i,n)=>{const e=i.get(h.SheetsFilterService),t=i.get(a.ICommandService),r=i.get(a.IUndoRedoService),{unitId:s,subUnitId:o,col:l,criteria:d}=n,c=e.getFilterModel(s,o);if(!c)return!1;const m=c.getRange();if(!m||l<m.startColumn||l>m.endColumn)return!1;const u=c.getFilterColumn(l),f=xe(s,o,l,u),S={id:p.id,params:{unitId:s,subUnitId:o,col:l,criteria:d}},R=t.syncExecuteCommand(S.id,S.params);return R&&r.pushUndoRedo({unitID:s,undoMutations:[f],redoMutations:[S]}),R}},Pe={id:"sheet.command.clear-filter-criteria",type:a.CommandType.COMMAND,handler:(i,n)=>{const e=i.get(h.SheetsFilterService),t=i.get(a.IUndoRedoService),r=i.get(a.ICommandService),s=i.get(a.IUniverInstanceService),o=_.getSheetCommandTarget(s,n);if(!o)return!1;const{unitId:l,subUnitId:d}=o,c=e.getFilterModel(o.unitId,o.subUnitId);if(!c)return!1;const m=c.serialize(),u=he(l,d,m),f=je(l,d,m);return a.sequenceExecute(f,r).result?(t.pushUndoRedo({unitID:l,undoMutations:u,redoMutations:f}),!0):!1}},De={id:"sheet.command.re-calc-filter",type:a.CommandType.COMMAND,handler:(i,n)=>{const e=i.get(h.SheetsFilterService),t=i.get(a.ICommandService),r=i.get(a.IUniverInstanceService),s=_.getSheetCommandTarget(r,n);if(!s)return!1;const{unitId:o,subUnitId:l}=s;return e.getFilterModel(s.unitId,s.subUnitId)?t.executeCommand($.id,{unitId:o,subUnitId:l}):!1}};function Be(i,n,e){const t=[],r={id:F.id,params:{unitId:i,subUnitId:n,range:e.ref}};return t.push(r),he(i,n,e).forEach(o=>t.push(o)),t}function he(i,n,e){var r;const t=[];return(r=e.filterColumns)==null||r.forEach(s=>{const o={id:p.id,params:{unitId:i,subUnitId:n,col:s.colId,criteria:s}};t.push(o)}),t}function je(i,n,e){var r;const t=[];return(r=e.filterColumns)==null||r.forEach(s=>{const o={id:p.id,params:{unitId:i,subUnitId:n,col:s.colId,criteria:null}};t.push(o)}),t}function xe(i,n,e,t){if(!t)return{id:p.id,params:{unitId:i,subUnitId:n,col:e,criteria:null}};const r=t.serialize();return{id:p.id,params:{unitId:i,subUnitId:n,col:e,criteria:r}}}const me="sheets-filter.config",fe={};function He(i,n){for(let e=0;e<i.length;e++){let t=e;if(i[e])for(let r=e+1;r<i.length;r++)i[t]&&i[r]&&n(i[t],i[r])&&(i[t]=null,t=r)}return i.filter(e=>e!==null)}function L(i){return He(i,(n,e)=>n.id===p.id&&e.id===p.id&&n.params.unitId===e.params.unitId&&n.params.subUnitId===e.params.subUnitId&&n.params.col===e.params.col)}var ze=Object.getOwnPropertyDescriptor,Ve=(i,n,e,t)=>{for(var r=t>1?void 0:t?ze(n,e):n,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(r)||r);return r},b=(i,n)=>(e,t)=>n(e,t,i);let D=class extends a.Disposable{constructor(n,e,t,r,s,o,l){super();v(this,"_disposableCollection",new a.DisposableCollection);this._commandService=n,this._sheetInterceptorService=e,this._sheetsFilterService=t,this._univerInstanceService=r,this._refRangeService=s,this._dataSyncPrimaryController=o,this._zebraCrossingCacheController=l,this._initCommands(),this._initRowFilteredInterceptor(),this._initInterceptors(),this._commandExecutedListener(),this._initErrorHandling(),this._initZebraCrossingCacheListener()}_initZebraCrossingCacheListener(){this.disposeWithMe(this._sheetsFilterService.activeFilterModel$.subscribe(n=>{n&&this.disposeWithMe(n.filteredOutRows$.subscribe(()=>{this._zebraCrossingCacheController.updateZebraCrossingCache(n.unitId,n.subUnitId)}))}))}_initCommands(){[p,F,$,T].forEach(n=>{var e;this.disposeWithMe(this._commandService.registerCommand(n)),(e=this._dataSyncPrimaryController)==null||e.registerSyncingMutations(n)})}_initInterceptors(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:n=>this._getUpdateFilter(n)})),this.disposeWithMe(this._commandService.onCommandExecuted(n=>{if(n.id===_.SetWorksheetActiveOperation.id){const e=n.params,t=e.subUnitId,r=e.unitId;if(!t||!r)return;this._registerRefRange(r,t)}if(n.id===F.id){const e=n.params,t=e.subUnitId,r=e.unitId;if(!t||!r)return;this._registerRefRange(e.unitId,e.subUnitId)}})),this.disposeWithMe(this._sheetsFilterService.loadedUnitId$.subscribe(n=>{if(n){const e=this._univerInstanceService.getUniverSheetInstance(n),t=e==null?void 0:e.getActiveSheet();t&&this._registerRefRange(n,t.getSheetId())}}))}_registerRefRange(n,e){var l;this._disposableCollection.dispose();const t=this._univerInstanceService.getUniverSheetInstance(n),r=t==null?void 0:t.getSheetBySheetId(e);if(!t||!r)return;const s=(l=this._sheetsFilterService.getFilterModel(n,e))==null?void 0:l.getRange(),o=d=>{switch(d.id){case _.InsertRowCommand.id:{const c=d.params,m=c.unitId||n,u=c.subUnitId||e;return this._handleInsertRowCommand(c,m,u)}case _.InsertColCommand.id:{const c=d.params,m=c.unitId||n,u=c.subUnitId||e;return this.handleInsertColCommand(c.range,m,u)}case _.RemoveColCommand.id:{const c=d.params;return this.handleRemoveColCommand(c.range,n,e)}case _.RemoveRowCommand.id:{const c=d.params;return this._handleRemoveRowCommand(c,n,e)}case _.EffectRefRangId.MoveColsCommandId:{const c=d.params;return this.handleMoveColsCommand({fromRange:c.fromRange,toRange:c.toRange},n,e)}case _.EffectRefRangId.MoveRowsCommandId:{const c=d.params;return this._handleMoveRowsCommand(c,n,e)}case _.MoveRangeCommand.id:{const c=d.params;return this._handleMoveRangeCommand(c,n,e)}}return{redos:[],undos:[]}};s&&this._disposableCollection.add(this._refRangeService.registerRefRange(s,o,n,e))}_getUpdateFilter(n){const{id:e}=n;switch(e){case _.RemoveSheetCommand.id:{const t=n.params;return this._handleRemoveSheetCommand(t,t.unitId,t.subUnitId)}case _.CopySheetCommand.id:{const t=n.params,{targetSubUnitId:r,unitId:s,subUnitId:o}=t;return!s||!o||!r?this._handleNull():this._handleCopySheetCommand(s,o,r)}}return{redos:[],undos:[]}}handleInsertColCommand(n,e,t){var g;const r=this._sheetsFilterService.getFilterModel(e,t),s=(g=r==null?void 0:r.getRange())!=null?g:null;if(!r||!s)return this._handleNull();const{startColumn:o,endColumn:l}=s,{startColumn:d,endColumn:c}=n,m=c-d+1;if(c>l)return this._handleNull();const u=[],f=[],S=d,R={unitId:e,subUnitId:t,range:{...s,startColumn:d<=o?o+m:o,endColumn:l+m}},w={unitId:e,subUnitId:t,range:s};u.push({id:F.id,params:R}),f.push({id:F.id,params:w});const M=r.getAllFilterColumns().filter(C=>C[0]>=S);if(M.length!==0){const{newRange:C,oldRange:y}=this._moveCriteria(e,t,M,m);u.push(...y.redos,...C.redos),f.push(...C.undos,...y.undos)}return{redos:L(u),undos:L(f)}}_handleInsertRowCommand(n,e,t){var w;const r=this._sheetsFilterService.getFilterModel(e,t),s=(w=r==null?void 0:r.getRange())!=null?w:null;if(!r||!s)return this._handleNull();const{startRow:o,endRow:l}=s,{startRow:d,endRow:c}=n.range,m=c-d+1;if(c>l)return this._handleNull();const u=[],f=[],S={unitId:e,subUnitId:t,range:{...s,startRow:d<=o?o+m:o,endRow:l+m}},R={unitId:e,subUnitId:t,range:s};return u.push({id:F.id,params:S}),f.push({id:F.id,params:R}),{redos:L(u),undos:L(f)}}handleRemoveColCommand(n,e,t){var M;const r=this._sheetsFilterService.getFilterModel(e,t),s=(M=r==null?void 0:r.getRange())!=null?M:null;if(!r||!s)return this._handleNull();const{startColumn:o,endColumn:l}=s,{startColumn:d,endColumn:c}=n;if(d>l)return this._handleNull();const m=[],u=[],f=c<o?0:Math.min(c,l)-Math.max(d,o)+1,S=c-d+1,R=r.getAllFilterColumns();R.forEach(g=>{const[C,y]=g;C<=c&&C>=d&&(m.push({id:p.id,params:{unitId:e,subUnitId:t,col:C,criteria:null}}),u.push({id:p.id,params:{unitId:e,subUnitId:t,col:C,criteria:{...y.serialize(),colId:C}}}))});const w=R.filter(g=>{const[C,y]=g;return C>c});let E={undos:[],redos:[]};if(w.length>0){const{oldRange:g,newRange:C}=this._moveCriteria(e,t,w,-S);E=C,m.push(...g.redos),u.unshift(...g.undos)}if(f===l-o+1){const g={unitId:e,subUnitId:t};m.push({id:T.id,params:g}),u.unshift({id:F.id,params:{range:s,unitId:e,subUnitId:t}})}else{const g=o<=d?o:f===0?o-S:d,C=o<=d?l-f:l-S,y={unitId:e,subUnitId:t,range:{...s,startColumn:g,endColumn:C}};m.push({id:F.id,params:y}),u.unshift({id:F.id,params:{range:s,unitId:e,subUnitId:t}}),m.push(...E.redos),u.unshift(...E.undos)}return{undos:u,redos:m}}_handleRemoveRowCommand(n,e,t){var w;const r=this._sheetsFilterService.getFilterModel(e,t);if(!r)return this._handleNull();const s=r.getRange(),{startRow:o,endRow:l}=s,{startRow:d,endRow:c}=n.range;if(d>l)return this._handleNull();if(c<o)return{undos:[{id:F.id,params:{range:s,unitId:e,subUnitId:t}}],redos:[{id:F.id,params:{range:{...s,startRow:o-(c-d+1),endRow:l-(c-d+1)},unitId:e,subUnitId:t}}]};const m=[],u=[],f=r.getAllFilterColumns(),S=o<=c&&o>=d;u.push({id:F.id,params:{range:s,unitId:e,subUnitId:t}});const R=Math.min(c,l)-Math.max(d,o)+1;if(R===l-o+1||S){const E={unitId:e,subUnitId:t};m.push({id:T.id,params:E}),f.forEach(M=>{const[g,C]=M,y={unitId:e,subUnitId:t,col:g,criteria:{...C.serialize(),colId:g}};u.push({id:p.id,params:y})})}else{const E=(w=this._univerInstanceService.getUniverSheetInstance(e))==null?void 0:w.getSheetBySheetId(t);if(!E)return this._handleNull();const M=[];for(let O=d;O<=c;O++)E.getRowFiltered(O)&&M.push(O);const g=Math.min(o,d),C=g+(l-o)-R+M.length,y={unitId:e,subUnitId:t,range:{...s,startRow:g,endRow:C}};m.push({id:F.id,params:y})}return{undos:L(u),redos:L(m)}}handleMoveColsCommand({fromRange:n,toRange:e},t,r){var M;const s=this._sheetsFilterService.getFilterModel(t,r),o=(M=s==null?void 0:s.getRange())!=null?M:null;if(!s||!o)return this._handleNull();const{startColumn:l,endColumn:d}=o;if(n.endColumn<l&&e.startColumn<=l||n.startColumn>d&&e.endColumn>d)return this._handleNull();const c=[],m=[],u={};for(let g=l;g<=d;g++)u[g]={colIndex:g,filter:s.getFilterColumn(g)};a.moveMatrixArray(n.startColumn,n.endColumn-n.startColumn+1,e.startColumn,u);let f=o.startColumn,S=o.endColumn;l>=n.startColumn&&l<=n.endColumn&&e.startColumn>n.startColumn&&n.endColumn<d&&(f=n.endColumn+1),d>=n.startColumn&&d<=n.endColumn&&e.startColumn<n.startColumn&&n.startColumn>l&&(S=n.startColumn-1);const R=Object.keys(u).map(g=>Number(g)),w=R.find(g=>u[g].colIndex===S),E=R.find(g=>u[g].colIndex===f);if(R.forEach(g=>{var Ce,_e;const{colIndex:C,filter:y}=u[g],O=g;if(y){if(O>=E&&O<=w){const Q={unitId:t,subUnitId:r,col:O,criteria:{...y.serialize(),colId:O}},Xe={unitId:t,subUnitId:r,col:O,criteria:s.getFilterColumn(O)?{...(Ce=s.getFilterColumn(O))==null?void 0:Ce.serialize(),colId:O}:null};c.push({id:p.id,params:Q}),m.push({id:p.id,params:Xe})}if(!((_e=u[C])!=null&&_e.filter)){const Q={unitId:t,subUnitId:r,col:C,criteria:null};c.push({id:p.id,params:Q}),m.push({id:p.id,params:{unitId:t,subUnitId:r,col:C,criteria:{...y.serialize(),colId:C}}})}}}),l!==E||d!==w){const g={unitId:t,subUnitId:r,range:{...o,startColumn:E,endColumn:w}};c.unshift({id:F.id,params:g}),m.unshift({id:F.id,params:{range:o,unitId:t,subUnitId:r}})}return{undos:m,redos:c}}_handleMoveRowsCommand(n,e,t){var g;const r=this._sheetsFilterService.getFilterModel(e,t),s=(g=r==null?void 0:r.getRange())!=null?g:null;if(!r||!s)return this._handleNull();const{startRow:o,endRow:l}=s,{fromRange:d,toRange:c}=n;if(d.endRow<o&&c.startRow<=o||d.startRow>l&&c.endRow>l)return this._handleNull();const m=[],u=[],f={};for(let C=o;C<=l;C++)f[C]={oldIndex:C};const S=o;let R=l;l>=d.startRow&&l<=d.endRow&&c.startRow<d.startRow&&d.startRow>o&&(R=d.startRow-1),a.moveMatrixArray(d.startRow,d.endRow-d.startRow+1,c.startRow,f);const w=Object.keys(f).map(C=>Number(C)),E=w.find(C=>f[C].oldIndex===R),M=w.find(C=>f[C].oldIndex===S);if(o!==M||l!==E){const C={unitId:e,subUnitId:t,range:{...s,startRow:M,endRow:E}};m.push({id:F.id,params:C},{id:$.id,params:{unitId:e,subUnitId:t}}),u.push({id:F.id,params:{range:s,unitId:e,subUnitId:t}},{id:$.id,params:{unitId:e,subUnitId:t}})}return{redos:m,undos:u}}_handleMoveRangeCommand(n,e,t){const{fromRange:r,toRange:s}=n,o=this._sheetsFilterService.getFilterModel(e,t);if(!o)return this._handleNull();const l=o.getRange();if(!l)return this._handleNull();const d=[],c=[];if(a.Rectangle.contains(r,l)){const m=l.startRow-r.startRow,u=l.startColumn-r.startColumn,f={startRow:s.startRow+m,startColumn:s.startColumn+u,endRow:s.startRow+m+(l.endRow-l.startRow),endColumn:s.startColumn+u+(l.endColumn-l.startColumn)},S={id:T.id,params:{unitId:e,subUnitId:t}},R={id:F.id,params:{unitId:e,subUnitId:t,range:f}},w={id:F.id,params:{unitId:e,subUnitId:t,range:l}};d.push(S,R),c.push(S,w);const E=o.getAllFilterColumns(),M=s.startColumn-r.startColumn;E.forEach(g=>{const[C,y]=g;y&&(d.push({id:p.id,params:{unitId:e,subUnitId:t,col:C+M,criteria:{...y.serialize(),colId:C+M}}}),c.push({id:p.id,params:{unitId:e,subUnitId:t,col:C,criteria:{...y.serialize(),colId:C}}}))})}else if(a.Rectangle.intersects(s,l)){const m={...l,endRow:Math.max(l.endRow,s.endRow)};d.push({id:F.id,params:{unitId:e,subUnitId:t,range:m}}),c.push({id:F.id,params:{unitId:e,subUnitId:t,range:l}})}return{redos:d,undos:c}}_handleRemoveSheetCommand(n,e,t){const r=this._sheetsFilterService.getFilterModel(e,t);if(!r)return this._handleNull();const s=r.getRange();if(!s)return this._handleNull();const o=[],l=[];return r.getAllFilterColumns().forEach(([c,m])=>{l.push({id:p.id,params:{unitId:e,subUnitId:t,col:c,criteria:{...m.serialize(),colId:c}}})}),o.push({id:T.id,params:{unitId:e,subUnitId:t,range:s}}),l.unshift({id:F.id,params:{range:s,unitId:e,subUnitId:t}}),{undos:l,redos:o}}_handleCopySheetCommand(n,e,t){const r=this._sheetsFilterService.getFilterModel(n,e);if(!r)return this._handleNull();const s=r.getRange();if(!s)return this._handleNull();const o=[],l=[],d=[],c=[];return r.getAllFilterColumns().forEach(([u,f])=>{o.push({id:p.id,params:{unitId:n,subUnitId:t,col:u,criteria:{...f.serialize(),colId:u}}}),d.push({id:p.id,params:{unitId:n,subUnitId:t,col:u,criteria:null}})}),d.push({id:T.id,params:{unitId:n,subUnitId:t,range:s}}),o.unshift({id:F.id,params:{range:s,unitId:n,subUnitId:t}}),{undos:l,redos:o,preUndos:d,preRedos:c}}_handleNull(){return{redos:[],undos:[]}}_initRowFilteredInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(_.INTERCEPTOR_POINT.ROW_FILTERED,{handler:(n,e)=>{var t,r;return n?!0:(r=(t=this._sheetsFilterService.getFilterModel(e.unitId,e.subUnitId))==null?void 0:t.isRowFiltered(e.row))!=null?r:!1}}))}_moveCriteria(n,e,t,r){const s={unitId:n,subUnitId:e,criteria:null,col:-1},o=[],l=[],d=[],c=[];return t.forEach(m=>{const[u,f]=m;l.push({id:p.id,params:{...s,col:u}}),o.push({id:p.id,params:{...s,col:u,criteria:{...f.serialize(),colId:u}}})}),t.forEach(m=>{const[u,f]=m;c.push({id:p.id,params:{...s,col:u+r,criteria:{...f.serialize(),colId:u+r}}}),d.push({id:p.id,params:{...s,col:u+r,criteria:null}})}),{newRange:{redos:c,undos:d},oldRange:{redos:l,undos:o}}}_commandExecutedListener(){this.disposeWithMe(this._commandService.onCommandExecuted((n,e)=>{var c,m;const{unitId:t,subUnitId:r}=n.params||{},s=this._sheetsFilterService.getFilterModel(t,r);if(!s)return;const o=Array.from(s.filteredOutRows).sort((u,f)=>u-f),l=[];let d=!1;if(n.id===_.RemoveRowMutation.id){const{startRow:u,endRow:f}=n.params.range,S=o.filter(R=>R>=u&&R<=f);o.forEach(R=>{if(R<u)l.push(R);else if(d=!0,R<=f){const w=Math.max(u,l.length?l[l.length-1]+1:u);l.push(w)}else l.push(R-(f-u+1-S.length))})}if(n.id===_.InsertRowMutation.id){const{startRow:u,endRow:f}=n.params.range;o.forEach(S=>{S>=u?(d=!0,l.push(S+(f-u+1))):l.push(S)})}if(d&&(s.filteredOutRows=new Set(l)),n.id===_.SetRangeValuesMutation.id&&!(e!=null&&e.onlyLocal)){const u=this._getExtendRegion(t,r);if(u){const f=n.params.cellValue;if(f)for(let S=u.startColumn;S<=u.endColumn;S++){const R=(c=f==null?void 0:f[u.startRow])==null?void 0:c[S];if(R&&this._cellHasValue(R)){const w=(m=this._univerInstanceService.getUnit(t))==null?void 0:m.getSheetBySheetId(r);if(w){const E=_.expandToContinuousRange(u,{down:!0},w),M=this._sheetsFilterService.getFilterModel(t,r),g=M.getRange();M.setRange({...g,endRow:E.endRow}),this._registerRefRange(t,r)}}}}}}))}_getExtendRegion(n,e){var d;const t=this._sheetsFilterService.getFilterModel(n,e);if(!t)return null;const r=(d=this._univerInstanceService.getUnit(n))==null?void 0:d.getSheetBySheetId(e);if(!r)return null;const s=t.getRange();if(!s)return null;const o=r.getRowCount()-1,l=r.getRowManager();for(let c=s.endRow+1;c<=o;c++)if(l.getRowRawVisible(c))return{startRow:c,endRow:c,startColumn:s.startColumn,endColumn:s.endColumn};return null}_initErrorHandling(){this.disposeWithMe(this._commandService.beforeCommandExecuted(n=>{const e=n.params,t=_.getSheetCommandTarget(this._univerInstanceService,e);if(!t)return;const{subUnitId:r,unitId:s}=t,o=this._sheetsFilterService.getFilterModel(s,r);if(!o)return;const l=o.getRange();if(n.id===_.MoveRowsCommand.id&&e.fromRange.startRow<=l.startRow&&e.fromRange.endRow<l.endRow&&e.fromRange.endRow>=l.startRow)throw this._sheetsFilterService.setFilterErrorMsg("sheets-filter.msg.filter-header-forbidden"),new Error("[SheetsFilterController]: Cannot move header row of filter")}))}_cellHasValue(n){const e=Object.values(n);return!(e.length===0||e.every(t=>t==null))}};D=Ve([b(0,a.ICommandService),b(1,a.Inject(_.SheetInterceptorService)),b(2,a.Inject(h.SheetsFilterService)),b(3,a.IUniverInstanceService),b(4,a.Inject(_.RefRangeService)),b(5,a.Optional(Re.DataSyncPrimaryController)),b(6,a.Inject(_.ZebraCrossingCacheController))],D);var We=Object.getOwnPropertyDescriptor,qe=(i,n,e,t)=>{for(var r=t>1?void 0:t?We(n,e):n,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(r)||r);return r},G=(i,n)=>(e,t)=>n(e,t,i);const ke=[p.id,$.id],Ge=[_.InsertColMutation.id,_.RemoveColMutation.id,_.MoveColsMutation.id];h.SheetsFilterSyncController=class extends a.Disposable{constructor(e,t,r){var o;super();v(this,"_d",new a.DisposableCollection);v(this,"_visible$",new I.BehaviorSubject(!1));v(this,"visible$",this._visible$.asObservable());v(this,"_enabled$",new I.BehaviorSubject(!0));v(this,"enabled$",this._enabled$.asObservable());this._sheetsFilterController=e,this._commandService=t,this._configService=r;const s=this._configService.getConfig(me);s!=null&&s.enableSyncSwitch&&(this._visible$.next(!0),typeof s.enableSyncSwitch=="object"&&this.setEnabled((o=s.enableSyncSwitch.defaultValue)!=null?o:!0))}get visible(){return this._visible$.getValue()}get enabled(){return this._enabled$.getValue()}setEnabled(e){this._enabled$.next(e),e?this._d.dispose():this._initOnlyLocalListener()}_initOnlyLocalListener(){this._d.add(this._commandService.beforeCommandExecuted((e,t)=>{ke.includes(e.id)&&(t||(t={}),t.onlyLocal=!0)})),this._d.add(this._commandService.onCommandExecuted((e,t)=>{if(Ge.includes(e.id)&&(t!=null&&t.fromCollab)){if(e.id===_.InsertColMutation.id){const{range:r,unitId:s,subUnitId:o}=e.params,{redos:l}=this._sheetsFilterController.handleInsertColCommand(r,s,o);a.sequenceExecute(l,this._commandService,t)}else if(e.id===_.RemoveColMutation.id){const{range:r,unitId:s,subUnitId:o}=e.params,{redos:l}=this._sheetsFilterController.handleRemoveColCommand(r,s,o);a.sequenceExecute(l,this._commandService,t)}else if(e.id===_.MoveColsMutation.id){const{sourceRange:r,targetRange:s,unitId:o,subUnitId:l}=e.params,{redos:d}=this._sheetsFilterController.handleMoveColsCommand({fromRange:r,toRange:s},o,l);a.sequenceExecute(d,this._commandService,t)}}}))}},h.SheetsFilterSyncController=qe([G(0,a.Inject(D)),G(1,a.ICommandService),G(2,a.IConfigService)],h.SheetsFilterSyncController);var Qe=Object.getOwnPropertyDescriptor,Je=(i,n,e,t)=>{for(var r=t>1?void 0:t?Qe(n,e):n,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(r)||r);return r},B=(i,n)=>(e,t)=>n(e,t,i);let j=class extends a.Disposable{constructor(i,n,e,t){super(),this._activeDirtyManagerService=i,this._sheetRowFilteredService=n,this._sheetsFilterService=e,this._univerInstanceService=t,this._initFormulaDirtyRange(),this._registerSheetRowFiltered()}_initFormulaDirtyRange(){H.forEach(i=>{this._activeDirtyManagerService.register(i,{commandId:i,getDirtyData:n=>{const e=n.params,{unitId:t,subUnitId:r}=e;return{dirtyRanges:this._getHideRowMutation(t,r),clearDependencyTreeCache:{[t]:{[r]:"1"}}}}})})}_getHideRowMutation(i,n){var l,d;const e=(l=this._sheetsFilterService.getFilterModel(i,n))==null?void 0:l.getRange(),t=(d=this._univerInstanceService.getUnit(i))==null?void 0:d.getSheetBySheetId(n);if(e==null||t==null)return[];const{startRow:r,endRow:s}=e;return[{unitId:i,sheetId:n,range:{startRow:r,startColumn:0,endRow:s,endColumn:t.getColumnCount()-1}}]}_registerSheetRowFiltered(){this._sheetRowFilteredService.register((i,n,e)=>{var t,r;return(r=(t=this._sheetsFilterService.getFilterModel(i,n))==null?void 0:t.isRowFiltered(e))!=null?r:!1})}};j=Je([B(0,a.Inject(J.IActiveDirtyManagerService)),B(1,a.Inject(J.ISheetRowFilteredService)),B(2,a.Inject(h.SheetsFilterService)),B(3,a.IUniverInstanceService)],j);var Ke=Object.getOwnPropertyDescriptor,Ze=(i,n,e,t)=>{for(var r=t>1?void 0:t?Ke(n,e):n,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(r)||r);return r},ge=(i,n)=>(e,t)=>n(e,t,i);h.UniverSheetsFilterPlugin=(x=class extends a.Plugin{constructor(n=fe,e,t){super(),this._config=n,this._injector=e,this._configService=t;const{...r}=a.merge({},fe,this._config);this._configService.setConfig(me,r)}onStarting(){[[j],[h.SheetsFilterService],[D],[h.SheetsFilterSyncController]].forEach(n=>this._injector.add(n))}onReady(){a.touchDependencies(this._injector,[[j],[D],[h.SheetsFilterSyncController]])}},v(x,"type",a.UniverInstanceType.UNIVER_SHEET),v(x,"pluginName",k),x),h.UniverSheetsFilterPlugin=Ze([ge(1,a.Inject(a.Injector)),ge(2,a.IConfigService)],h.UniverSheetsFilterPlugin),h.ClearSheetsFilterCriteriaCommand=Pe,h.CustomFilterOperator=A,h.FILTER_MUTATIONS=H,h.FilterBy=N,h.FilterColumn=ae,h.FilterModel=P,h.ReCalcSheetsFilterCommand=De,h.ReCalcSheetsFilterMutation=$,h.RemoveSheetFilterCommand=ue,h.RemoveSheetsFilterMutation=T,h.SHEET_FILTER_SNAPSHOT_ID=k,h.SetSheetFilterRangeCommand=ce,h.SetSheetsFilterCriteriaCommand=Le,h.SetSheetsFilterCriteriaMutation=p,h.SetSheetsFilterRangeMutation=F,h.SmartToggleSheetsFilterCommand=$e,h.equals=ie,h.getCustomFilterFn=V,h.greaterThan=ee,h.greaterThanOrEqualTo=te,h.lessThan=re,h.lessThanOrEqualTo=ne,h.notEquals=z,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})}));
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/sheets`),require(`rxjs`),require(`@univerjs/engine-render`),require(`@univerjs/rpc`),require(`@univerjs/engine-formula`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets`,`rxjs`,`@univerjs/engine-render`,`@univerjs/rpc`,`@univerjs/engine-formula`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsFilter={},e.UniverCore,e.UniverSheets,e.rxjs,e.UniverEngineRender,e.UniverRpc,e.UniverEngineFormula))})(this,function(e,t,n,r,i,a,o){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let s=`sheet.mutation.set-filter-range`,c=`sheet.mutation.set-filter-criteria`,l=`sheet.mutation.remove-filter`,u=`sheet.mutation.re-calc-filter`,d=new Set([s,c,l,u]),f=function(e){return e[e.VALUES=0]=`VALUES`,e[e.COLORS=1]=`COLORS`,e[e.CONDITIONS=2]=`CONDITIONS`,e}({}),p=function(e){return e.EQUAL=`equal`,e.GREATER_THAN=`greaterThan`,e.GREATER_THAN_OR_EQUAL=`greaterThanOrEqual`,e.LESS_THAN=`lessThan`,e.LESS_THAN_OR_EQUAL=`lessThanOrEqual`,e.NOT_EQUALS=`notEqual`,e}({}),m={operator:p.GREATER_THAN,fn:(e,t)=>C(e)?e>t:!1},h={operator:p.GREATER_THAN_OR_EQUAL,fn:(e,t)=>C(e)?e>=t:!1},g={operator:p.LESS_THAN,fn:(e,t)=>C(e)?e<t:!1},_={operator:p.LESS_THAN_OR_EQUAL,fn:(e,t)=>C(e)?e<=t:!1},v={operator:p.EQUAL,fn:(e,t)=>C(e)?e===t:!1},y={operator:p.NOT_EQUALS,fn:(e,n)=>{if(typeof n==`string`){if(n===` `)return e!=null;let r=T(e);return r&&te(n)?!(0,t.createREGEXFromWildChar)(n).test(r):r!==n}return C(e)?e!==n:!0}},b=new Map([]);[m,h,g,_,v,y].forEach(e=>{b.set(e.operator,e)});function ee(e){return!!e}let x={fn:(e,n)=>{let r=T(e);return r===null?n===``:(0,t.createREGEXFromWildChar)(n).test(r)}};function S(e){return e?b.get(e):x}function C(e){return typeof e==`number`}function w(e){return!!(typeof e==`number`||typeof e==`string`&&(0,t.isNumeric)(e))}function T(e){return typeof e==`boolean`||e==null?null:typeof e==`string`?e:e.toString()}function te(e){return typeof e==`number`?!1:e.indexOf(`*`)!==-1||e.indexOf(`?`)!==-1}function E(e){"@babel/helpers - typeof";return E=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},E(e)}function ne(e,t){if(E(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(E(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function D(e){var t=ne(e,`string`);return E(t)==`symbol`?t:t+``}function O(e,t,n){return(t=D(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let k=()=>new Set;var A=class e extends t.Disposable{get filteredOutRows(){return this._filteredOutRows$.getValue()}set filteredOutRows(e){this._alreadyFilteredOutRows=e,this._filteredOutRows$.next(e)}constructor(e,t,n){super(),this.unitId=e,this.subUnitId=t,this._worksheet=n,O(this,`_filteredOutRows$`,new r.BehaviorSubject(k())),O(this,`filteredOutRows$`,this._filteredOutRows$.asObservable()),O(this,`_hasCriteria$`,new r.BehaviorSubject(!1)),O(this,`hasCriteria$`,this._hasCriteria$.asObservable()),O(this,`_filterColumnByIndex`,new Map),O(this,`_alreadyFilteredOutRows`,k()),O(this,`_range`,void 0)}dispose(){super.dispose(),this._filteredOutRows$.complete(),this._hasCriteria$.complete(),this._worksheet=null}serialize(){let e={ref:t.Rectangle.clone(this._range),filterColumns:this._getAllFilterColumns(!0).sort(([e],[t])=>e-t).map(([e,t])=>t.serialize())};return this._alreadyFilteredOutRows&&(e.cachedFilteredOut=Array.from(this._alreadyFilteredOutRows).sort()),e}static deserialize(t,n,r,i){let a=new e(t,n,r);return a._dump(i),a}_dump(e){var t;this.setRange(e.ref),(t=e.filterColumns)==null||t.filter(e=>!(!e.filters&&!e.colorFilters&&!e.customFilters)).forEach(e=>this._setCriteriaWithoutReCalc(e.colId,e)),e.cachedFilteredOut?(this._alreadyFilteredOutRows=new Set(e.cachedFilteredOut),this._emit()):e.filterColumns&&e.filterColumns.length>0&&(this._reCalcAllColumns(),this._emit()),this._emitHasCriteria()}isRowFiltered(e){return this._alreadyFilteredOutRows.has(e)}getRange(){if(!this._range)throw Error(`[FilterModel] could not get range before a range is set!`);return this._range}getFilteredOutRowsExceptCol(e){return this._getAllFilterColumns(!0).filter(([t])=>t!==e).reduce((e,[,n])=>{let r=n.calc({getAlreadyFilteredOutRows:()=>e});return r?(0,t.mergeSets)(e,r):e},new Set)}setRange(e){this._range=e,this._getAllFilterColumns(!0).forEach(([t,n])=>{n.setRangeAndColumn({startRow:e.startRow,endRow:e.endRow,startColumn:t,endColumn:t},t)})}setCriteria(e,t,n=!1){if(!this._range)throw Error(`[FilterModel] could not set criteria before a range is set!`);if(!t){this._removeCriteria(e),this._rebuildAlreadyFilteredOutRowsWithCache(),n&&this._reCalcAllColumns(),this._emit(),this._emitHasCriteria();return}this._setCriteriaWithoutReCalc(e,t),n&&(this._rebuildAlreadyFilteredOutRowsWithCache(),this._getAllFilterColumns().forEach(e=>e.__clearCache()),this._reCalcWithNoCacheColumns(),this._emit(),this._emitHasCriteria())}getAllFilterColumns(){return this._getAllFilterColumns(!0)}getFilterColumn(e){var t;return(t=this._filterColumnByIndex.get(e))==null?null:t}reCalc(){this._reCalcAllColumns(),this._emit()}_getAllFilterColumns(e=!1){let t=Array.from(this._filterColumnByIndex.entries());return e?t:t.map(([e,t])=>t)}_reCalcAllColumns(){this._alreadyFilteredOutRows=k(),this._getAllFilterColumns().forEach(e=>e.__clearCache()),this._reCalcWithNoCacheColumns()}_setCriteriaWithoutReCalc(e,t){let n=this._range;if(!n)throw Error(`[FilterModel] could not set criteria before a range is set!`);let{startColumn:r,endColumn:i}=n;if(e>i||e<r)throw Error(`[FilterModel] could not set criteria on column ${e} which is out of range!`);let a;this._filterColumnByIndex.has(e)?a=this._filterColumnByIndex.get(e):(a=new j(this.unitId,this.subUnitId,this._worksheet,t,{getAlreadyFilteredOutRows:()=>this._alreadyFilteredOutRows}),a.setRangeAndColumn(n,e),this._filterColumnByIndex.set(e,a)),a.setCriteria(t)}_removeCriteria(e){let t=this._filterColumnByIndex.get(e);t&&(t.dispose(),this._filterColumnByIndex.delete(e))}_emit(){this._filteredOutRows$.next(this._alreadyFilteredOutRows)}_emitHasCriteria(){this._hasCriteria$.next(this._filterColumnByIndex.size>0)}_rebuildAlreadyFilteredOutRowsWithCache(){this._alreadyFilteredOutRows=this._getAllFilterColumns().filter(e=>e.hasCache()).reduce((e,n)=>(0,t.mergeSets)(e,n.filteredOutRows),new Set)}_reCalcWithNoCacheColumns(){let e=this._getAllFilterColumns().filter(e=>!e.hasCache());for(let n of e){let e=n.reCalc();e&&(this._alreadyFilteredOutRows=(0,t.mergeSets)(this._alreadyFilteredOutRows,e))}}},j=class extends t.Disposable{get filteredOutRows(){return this._filteredOutRows}get filterBy(){return this._filterBy}constructor(e,t,n,r,i){super(),this.unitId=e,this.subUnitId=t,this._worksheet=n,this._criteria=r,this._filterColumnContext=i,O(this,`_filteredOutRows`,null),O(this,`_filterFn`,null),O(this,`_range`,null),O(this,`_column`,0),O(this,`_filterBy`,f.VALUES)}dispose(){super.dispose(),this._filteredOutRows=null}__clearCache(){this._filteredOutRows=null}serialize(){if(!this._criteria)throw Error(`[FilterColumn]: could not serialize without a filter column!`);return t.Tools.deepClone({...this._criteria,colId:this._column})}hasCache(){return this._filteredOutRows!==null}setRangeAndColumn(e,t){this._range=e,this._column=t}setCriteria(e){this._criteria=e,this._generateFilterFn(),this._filteredOutRows=null}getColumnData(){return t.Tools.deepClone(this._criteria)}reCalc(){return this._filteredOutRows=this.calc(this._filterColumnContext),this._filteredOutRows}calc(e){if(!this._filterFn)throw Error(`[FilterColumn] cannot calculate without a filter fn!`);if(!this._range)throw Error(`[FilterColumn] cannot calculate without a range!`);if(typeof this._column!=`number`)throw TypeError(`[FilterColumn] cannot calculate without a column offset!`);let n=this._column,r={startColumn:n,endColumn:n,startRow:this._range.startRow+1,endRow:this._range.endRow},i=new Set,a=e.getAlreadyFilteredOutRows();for(let e of this._worksheet.iterateByColumn(r,!1,!1)){let{row:n,rowSpan:r,col:o}=e;if(!(a.has(n)&&(!r||r===1))&&!(this._filterBy===f.VALUES?this._filterFn((0,t.extractPureTextFromCell)(this._worksheet.getCell(n,o))):this._filterBy===f.COLORS?this._filterFn(this._worksheet.getComposedCellStyle(n,o)):this._filterFn(ce(this._worksheet,n,o)))&&(i.add(n),r))for(let e=1;e<r;e++)i.add(n+e)}return i}_generateFilterFn(){this._criteria&&(this._filterFn=re(this._criteria),this._filterBy=this._criteria.filters?f.VALUES:this._criteria.colorFilters?f.COLORS:f.CONDITIONS)}};function re(e){if(e.filters)return ie(e.filters);if(e.colorFilters)return ae(e.colorFilters);if(e.customFilters)return oe(e.customFilters);throw Error(`[FilterModel]: other types of filters are not supported yet.`)}function ie(e){let t=!!e.blank,n=new Set(e.filters);return e=>e===void 0||e===``?t:n.has(typeof e==`string`?e:`${e}`)}function ae(e){if(e.cellFillColors){let n=new Set(e.cellFillColors);return e=>{var r;if(!e||!((r=e.bg)!=null&&r.rgb))return!!n.has(null);let i=new t.ColorKit(e.bg.rgb).toRgbString();return n.has(i)}}if(e.cellTextColors){let n=new Set(e.cellTextColors);return e=>{var r;if(!e||!((r=e.cl)!=null&&r.rgb))return!!n.has(i.COLOR_BLACK_RGB);let a=new t.ColorKit(e.cl.rgb).toRgbString();return n.has(a)}}throw Error(`[FilterModel]: color filters are not supported yet.`)}function oe(e){let t=e.customFilters.map(e=>P(e));return N(t)?e.and?se(t):M(t):t[0]}function se(e){let[t,n]=e;return e=>t(e)&&n(e)}function M(e){let[t,n]=e;return e=>t(e)||n(e)}function N(e){return e.length===2}function P(e){let t=e.val;if(e.operator===p.NOT_EQUALS&&!w(t))return e=>y.fn(e,t);if(ee(e.operator)){if(!w(t))return()=>!1;let n=S(e.operator),r=Number(t);return e=>n.fn(e,r)}let n=S(e.operator);return e=>n.fn(e,t)}function ce(e,n,r){let i=e.getCell(n,r);if(!i)return null;let a=e.getCellRaw(n,r);return i&&!a?F(i):a?i.t===t.CellValueType.NUMBER&&typeof i.v==`string`?a.v:i.t===t.CellValueType.NUMBER?Number(a.v):F(a):null}function F(e){var n;let r=(n=e.p)==null||(n=n.body)==null?void 0:n.dataStream;if(r)return r.trimEnd();let i=e.v;return typeof i==`string`?e.t===t.CellValueType.BOOLEAN?i.toUpperCase():i:typeof i==`number`?e.t===t.CellValueType.BOOLEAN?i?`TRUE`:`FALSE`:i:typeof i==`boolean`?i?`TRUE`:`FALSE`:``}function I(e,t){return function(n,r){t(n,r,e)}}function L(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let R=`SHEET_FILTER_PLUGIN`,z=class extends t.Disposable{get activeFilterModel(){return this._activeFilterModel$.getValue()}constructor(e,t,n){super(),this._resourcesManagerService=e,this._univerInstanceService=t,this._commandService=n,O(this,`_filterModels`,new Map),O(this,`_loadedUnitId$`,new r.BehaviorSubject(null)),O(this,`loadedUnitId$`,this._loadedUnitId$.asObservable()),O(this,`_errorMsg$`,new r.BehaviorSubject(null)),O(this,`errorMsg$`,this._errorMsg$.asObservable()),O(this,`_activeFilterModel$`,new r.BehaviorSubject(null)),O(this,`activeFilterModel$`,this._activeFilterModel$.asObservable()),this._initModel(),this._initActiveFilterModel()}ensureFilterModel(e,t){let n=this.getFilterModel(e,t);if(n)return n;let r=this._univerInstanceService.getUniverSheetInstance(e);if(!r)throw Error(`[SheetsFilterService]: could not create "FilterModel" on a non-existing workbook ${e}!`);let i=r.getSheetBySheetId(t);if(!i)throw Error(`[SheetsFilterService]: could not create "FilterModel" on a non-existing worksheet ${t}!`);let a=new A(e,t,i);return this._cacheFilterModel(e,t,a),a}getFilterModel(e,t){var n,r;return(n=(r=this._filterModels.get(e))==null?void 0:r.get(t))==null?null:n}removeFilterModel(e,t){let n=this.getFilterModel(e,t);return n?(n.dispose(),this._filterModels.get(e).delete(t),!0):!1}setFilterErrorMsg(e){this._errorMsg$.next(e)}_updateActiveFilterModel(){let e;try{if(e=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET),!e){this._activeFilterModel$.next(null);return}}catch(e){console.error(`[SheetsFilterService]: could not get active workbook!`,e);return}let n=e.getActiveSheet(!0);if(!n){this._activeFilterModel$.next(null);return}let r=n.getUnitId(),i=n.getSheetId(),a=this.getFilterModel(r,i);this._activeFilterModel$.next(a)}_initActiveFilterModel(){this.disposeWithMe((0,r.merge)((0,t.fromCallback)(this._commandService.onCommandExecuted.bind(this._commandService)).pipe((0,r.filter)(([e])=>e.type===t.CommandType.MUTATION&&d.has(e.id))),this._univerInstanceService.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET).pipe((0,r.switchMap)(e=>{var t;return(t=e==null?void 0:e.activeSheet$)==null?(0,r.of)(null):t}))).subscribe(()=>this._updateActiveFilterModel()))}_serializeAutoFiltersForUnit(e){let t=this._filterModels.get(e);if(!t)return`{}`;let n={};return t.forEach((e,t)=>{n[t]=e.serialize()}),JSON.stringify(n)}_deserializeAutoFiltersForUnit(e,t){let n=this._univerInstanceService.getUniverSheetInstance(e);Object.keys(t).forEach(r=>{let i=t[r],a=A.deserialize(e,r,n.getSheetBySheetId(r),i);this._cacheFilterModel(e,r,a)})}dispose(){super.dispose(),this._loadedUnitId$.complete(),this._errorMsg$.complete(),this._activeFilterModel$.complete(),this._filterModels.forEach(e=>{e.forEach(e=>e.dispose()),e.clear()}),this._filterModels.clear()}_initModel(){this._resourcesManagerService.registerPluginResource({pluginName:R,businesses:[t.UniverInstanceType.UNIVER_SHEET],toJson:e=>this._serializeAutoFiltersForUnit(e),parseJson:e=>JSON.parse(e),onLoad:(e,t)=>{this._deserializeAutoFiltersForUnit(e,t),this._loadedUnitId$.next(e),this._updateActiveFilterModel()},onUnLoad:e=>{let t=this._filterModels.get(e);t&&(t.forEach(e=>e.dispose()),this._filterModels.delete(e))}})}_cacheFilterModel(e,t,n){this._filterModels.has(e)||this._filterModels.set(e,new Map),this._filterModels.get(e).set(t,n)}};z=L([I(0,t.IResourceManagerService),I(1,t.IUniverInstanceService),I(2,t.ICommandService)],z);let B={id:s,type:t.CommandType.MUTATION,handler:(e,t)=>{let{subUnitId:n,unitId:r,range:i}=t;return e.get(z).ensureFilterModel(r,n).setRange(i),!0}},V={id:c,type:t.CommandType.MUTATION,handler:(e,t)=>{let{subUnitId:n,unitId:r,criteria:i,col:a,reCalc:o=!0}=t,s=e.get(z).getFilterModel(r,n);return s?(s.setCriteria(a,i,o),!0):!1}},H={id:l,type:t.CommandType.MUTATION,handler:(e,t)=>{let{unitId:n,subUnitId:r}=t;return e.get(z).removeFilterModel(n,r)}},U={id:u,type:t.CommandType.MUTATION,handler:(e,t)=>{let{unitId:n,subUnitId:r}=t,i=e.get(z).getFilterModel(n,r);return i?(i.reCalc(),!0):!1}},W={id:`sheet.command.set-filter-range`,type:t.CommandType.COMMAND,handler:(e,r)=>{let i=e.get(z),a=e.get(t.ICommandService),o=e.get(t.IUndoRedoService),s=e.get(t.IUniverInstanceService),{unitId:c,subUnitId:l,range:u}=r;if(!(0,n.getSheetCommandTarget)(s,r)||i.getFilterModel(c,l))return!1;if(u.endRow===u.startRow){let n=e.get(t.ErrorService),r=e.get(t.LocaleService);return n.emit(r.t(`sheets-filter.command.not-valid-filter-range`)),!1}let d={id:B.id,params:{unitId:c,subUnitId:l,range:u}},f=a.syncExecuteCommand(d.id,d.params);return f&&o.pushUndoRedo({unitID:c,undoMutations:[{id:H.id,params:{unitId:c,subUnitId:l}}],redoMutations:[d]}),f}},G={id:`sheet.command.remove-sheet-filter`,type:t.CommandType.COMMAND,handler:(e,r)=>{let i=e.get(t.IUniverInstanceService),a=e.get(z),o=e.get(t.ICommandService),s=e.get(t.IUndoRedoService),c=(0,n.getSheetCommandTarget)(i,r);if(!c)return!1;let{unitId:l,subUnitId:u}=c,d=a.getFilterModel(l,u);if(!d)return!1;let f=pe(l,u,d==null?void 0:d.serialize()),p=o.syncExecuteCommand(H.id,{unitId:l,subUnitId:u});return p&&s.pushUndoRedo({unitID:l,undoMutations:f,redoMutations:[{id:H.id,params:{unitId:l,subUnitId:u}}]}),p}},le={id:`sheet.command.smart-toggle-filter`,type:t.CommandType.COMMAND,handler:async e=>{let r=e.get(t.IUniverInstanceService),i=e.get(z),a=e.get(t.ICommandService),o=r.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET),s=o==null?void 0:o.getActiveSheet();if(!s||!o)return!1;let c=o.getUnitId(),l=s.getSheetId();if(i.getFilterModel(c,l))return a.executeCommand(G.id,{unitId:c,subUnitId:l});let u=e.get(n.SheetsSelectionsService).getCurrentLastSelection();if(!u)return!1;let d=u.range,f=(0,n.isSingleCellSelection)(u)?(0,n.expandToContinuousRange)(d,{left:!0,right:!0,up:!0,down:!0},s):d.startRow===d.endRow?(0,n.expandToContinuousRange)(d,{down:!0},s):d;return a.executeCommand(W.id,{unitId:c,subUnitId:l,range:f})}},ue={id:`sheet.command.set-filter-criteria`,type:t.CommandType.COMMAND,handler:(e,n)=>{let r=e.get(z),i=e.get(t.ICommandService),a=e.get(t.IUndoRedoService),{unitId:o,subUnitId:s,col:c,criteria:l}=n,u=r.getFilterModel(o,s);if(!u)return!1;let d=u.getRange();if(!d||c<d.startColumn||c>d.endColumn)return!1;let f=he(o,s,c,u.getFilterColumn(c)),p={id:V.id,params:{unitId:o,subUnitId:s,col:c,criteria:l}},m=i.syncExecuteCommand(p.id,p.params);return m&&a.pushUndoRedo({unitID:o,undoMutations:[f],redoMutations:[p]}),m}},de={id:`sheet.command.clear-filter-criteria`,type:t.CommandType.COMMAND,handler:(e,r)=>{let i=e.get(z),a=e.get(t.IUndoRedoService),o=e.get(t.ICommandService),s=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService),r);if(!s)return!1;let{unitId:c,subUnitId:l}=s,u=i.getFilterModel(s.unitId,s.subUnitId);if(!u)return!1;let d=u.serialize(),f=K(c,l,d),p=me(c,l,d);return(0,t.sequenceExecute)(p,o).result?(a.pushUndoRedo({unitID:c,undoMutations:f,redoMutations:p}),!0):!1}},fe={id:`sheet.command.re-calc-filter`,type:t.CommandType.COMMAND,handler:(e,r)=>{let i=e.get(z),a=e.get(t.ICommandService),o=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService),r);if(!o)return!1;let{unitId:s,subUnitId:c}=o;return i.getFilterModel(o.unitId,o.subUnitId)?a.executeCommand(U.id,{unitId:s,subUnitId:c}):!1}};function pe(e,t,n){let r=[],i={id:B.id,params:{unitId:e,subUnitId:t,range:n.ref}};return r.push(i),K(e,t,n).forEach(e=>r.push(e)),r}function K(e,t,n){var r;let i=[];return(r=n.filterColumns)==null||r.forEach(n=>{let r={id:V.id,params:{unitId:e,subUnitId:t,col:n.colId,criteria:n}};i.push(r)}),i}function me(e,t,n){var r;let i=[];return(r=n.filterColumns)==null||r.forEach(n=>{let r={id:V.id,params:{unitId:e,subUnitId:t,col:n.colId,criteria:null}};i.push(r)}),i}function he(e,t,n,r){if(!r)return{id:V.id,params:{unitId:e,subUnitId:t,col:n,criteria:null}};let i=r.serialize();return{id:V.id,params:{unitId:e,subUnitId:t,col:n,criteria:i}}}let q=`sheets-filter.config`;Symbol(q);let J={};function ge(e,t){for(let n=0;n<e.length;n++){let r=n;if(e[n])for(let i=n+1;i<e.length;i++)e[r]&&e[i]&&t(e[r],e[i])&&(e[r]=null,r=i)}return e.filter(e=>e!==null)}function Y(e){return ge(e,(e,t)=>e.id===V.id&&t.id===V.id&&e.params.unitId===t.params.unitId&&e.params.subUnitId===t.params.subUnitId&&e.params.col===t.params.col)}let X=class extends t.Disposable{constructor(e,n,r,i,a,o,s){super(),this._commandService=e,this._sheetInterceptorService=n,this._sheetsFilterService=r,this._univerInstanceService=i,this._refRangeService=a,this._dataSyncPrimaryController=o,this._zebraCrossingCacheController=s,O(this,`_disposableCollection`,new t.DisposableCollection),this._initCommands(),this._initRowFilteredInterceptor(),this._initInterceptors(),this._commandExecutedListener(),this._initErrorHandling(),this._initZebraCrossingCacheListener()}_initZebraCrossingCacheListener(){this.disposeWithMe(this._sheetsFilterService.activeFilterModel$.subscribe(e=>{e&&this.disposeWithMe(e.filteredOutRows$.subscribe(()=>{this._zebraCrossingCacheController.updateZebraCrossingCache(e.unitId,e.subUnitId)}))}))}_initCommands(){[V,B,U,H].forEach(e=>{var t;this.disposeWithMe(this._commandService.registerCommand(e)),(t=this._dataSyncPrimaryController)==null||t.registerSyncingMutations(e)})}_initInterceptors(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>this._getUpdateFilter(e)})),this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(e.id===n.SetWorksheetActiveOperation.id){let t=e.params,n=t.subUnitId,r=t.unitId;if(!n||!r)return;this._registerRefRange(r,n)}if(e.id===B.id){let t=e.params,n=t.subUnitId,r=t.unitId;if(!n||!r)return;this._registerRefRange(t.unitId,t.subUnitId)}})),this.disposeWithMe(this._sheetsFilterService.loadedUnitId$.subscribe(e=>{if(e){let t=this._univerInstanceService.getUniverSheetInstance(e),n=t==null?void 0:t.getActiveSheet();n&&this._registerRefRange(e,n.getSheetId())}}))}_registerRefRange(e,t){var r;this._disposableCollection.dispose();let i=this._univerInstanceService.getUniverSheetInstance(e),a=i==null?void 0:i.getSheetBySheetId(t);if(!i||!a)return;let o=(r=this._sheetsFilterService.getFilterModel(e,t))==null?void 0:r.getRange();o&&this._disposableCollection.add(this._refRangeService.registerRefRange(o,r=>{switch(r.id){case n.InsertRowCommand.id:{let n=r.params,i=n.unitId||e,a=n.subUnitId||t;return this._handleInsertRowCommand(n,i,a)}case n.InsertColCommand.id:{let n=r.params,i=n.unitId||e,a=n.subUnitId||t;return this.handleInsertColCommand(n.range,i,a)}case n.RemoveColCommand.id:{let n=r.params;return this.handleRemoveColCommand(n.range,e,t)}case n.RemoveRowCommand.id:{let n=r.params;return this._handleRemoveRowCommand(n,e,t)}case n.EffectRefRangId.MoveColsCommandId:{let n=r.params;return this.handleMoveColsCommand({fromRange:n.fromRange,toRange:n.toRange},e,t)}case n.EffectRefRangId.MoveRowsCommandId:{let n=r.params;return this._handleMoveRowsCommand(n,e,t)}case n.MoveRangeCommand.id:{let n=r.params;return this._handleMoveRangeCommand(n,e,t)}}return{redos:[],undos:[]}},e,t))}_getUpdateFilter(e){let{id:t}=e;switch(t){case n.RemoveSheetCommand.id:{let t=e.params;return this._handleRemoveSheetCommand(t,t.unitId,t.subUnitId)}case n.CopySheetCommand.id:{let{targetSubUnitId:t,unitId:n,subUnitId:r}=e.params;return!n||!r||!t?this._handleNull():this._handleCopySheetCommand(n,r,t)}}return{redos:[],undos:[]}}handleInsertColCommand(e,t,n){var r;let i=this._sheetsFilterService.getFilterModel(t,n),a=(r=i==null?void 0:i.getRange())==null?null:r;if(!i||!a)return this._handleNull();let{startColumn:o,endColumn:s}=a,{startColumn:c,endColumn:l}=e,u=l-c+1;if(l>s)return this._handleNull();let d=[],f=[],p=c,m={unitId:t,subUnitId:n,range:{...a,startColumn:c<=o?o+u:o,endColumn:s+u}},h={unitId:t,subUnitId:n,range:a};d.push({id:B.id,params:m}),f.push({id:B.id,params:h});let g=i.getAllFilterColumns().filter(e=>e[0]>=p);if(g.length!==0){let{newRange:e,oldRange:r}=this._moveCriteria(t,n,g,u);d.push(...r.redos,...e.redos),f.push(...e.undos,...r.undos)}return{redos:Y(d),undos:Y(f)}}_handleInsertRowCommand(e,t,n){var r;let i=this._sheetsFilterService.getFilterModel(t,n),a=(r=i==null?void 0:i.getRange())==null?null:r;if(!i||!a)return this._handleNull();let{startRow:o,endRow:s}=a,{startRow:c,endRow:l}=e.range,u=l-c+1;if(l>s)return this._handleNull();let d=[],f=[],p={unitId:t,subUnitId:n,range:{...a,startRow:c<=o?o+u:o,endRow:s+u}},m={unitId:t,subUnitId:n,range:a};return d.push({id:B.id,params:p}),f.push({id:B.id,params:m}),{redos:Y(d),undos:Y(f)}}handleRemoveColCommand(e,t,n){var r;let i=this._sheetsFilterService.getFilterModel(t,n),a=(r=i==null?void 0:i.getRange())==null?null:r;if(!i||!a)return this._handleNull();let{startColumn:o,endColumn:s}=a,{startColumn:c,endColumn:l}=e;if(c>s)return this._handleNull();let u=[],d=[],f=l<o?0:Math.min(l,s)-Math.max(c,o)+1,p=l-c+1,m=i.getAllFilterColumns();m.forEach(e=>{let[r,i]=e;r<=l&&r>=c&&(u.push({id:V.id,params:{unitId:t,subUnitId:n,col:r,criteria:null}}),d.push({id:V.id,params:{unitId:t,subUnitId:n,col:r,criteria:{...i.serialize(),colId:r}}}))});let h=m.filter(e=>{let[t,n]=e;return t>l}),g={undos:[],redos:[]};if(h.length>0){let{oldRange:e,newRange:r}=this._moveCriteria(t,n,h,-p);g=r,u.push(...e.redos),d.unshift(...e.undos)}if(f===s-o+1){let e={unitId:t,subUnitId:n};u.push({id:H.id,params:e}),d.unshift({id:B.id,params:{range:a,unitId:t,subUnitId:n}})}else{let e=o<=c?o:f===0?o-p:c,r=o<=c?s-f:s-p,i={unitId:t,subUnitId:n,range:{...a,startColumn:e,endColumn:r}};u.push({id:B.id,params:i}),d.unshift({id:B.id,params:{range:a,unitId:t,subUnitId:n}}),u.push(...g.redos),d.unshift(...g.undos)}return{undos:d,redos:u}}_handleRemoveRowCommand(e,t,n){let r=this._sheetsFilterService.getFilterModel(t,n);if(!r)return this._handleNull();let i=r.getRange(),{startRow:a,endRow:o}=i,{startRow:s,endRow:c}=e.range;if(s>o)return this._handleNull();if(c<a)return{undos:[{id:B.id,params:{range:i,unitId:t,subUnitId:n}}],redos:[{id:B.id,params:{range:{...i,startRow:a-(c-s+1),endRow:o-(c-s+1)},unitId:t,subUnitId:n}}]};let l=[],u=[],d=r.getAllFilterColumns(),f=a<=c&&a>=s;u.push({id:B.id,params:{range:i,unitId:t,subUnitId:n}});let p=Math.min(c,o)-Math.max(s,a)+1;if(p===o-a+1||f){let e={unitId:t,subUnitId:n};l.push({id:H.id,params:e}),d.forEach(e=>{let[r,i]=e,a={unitId:t,subUnitId:n,col:r,criteria:{...i.serialize(),colId:r}};u.push({id:V.id,params:a})})}else{var m;let e=(m=this._univerInstanceService.getUniverSheetInstance(t))==null?void 0:m.getSheetBySheetId(n);if(!e)return this._handleNull();let r=[];for(let t=s;t<=c;t++)e.getRowFiltered(t)&&r.push(t);let u=Math.min(a,s),d=u+(o-a)-p+r.length,f={unitId:t,subUnitId:n,range:{...i,startRow:u,endRow:d}};l.push({id:B.id,params:f})}return{undos:Y(u),redos:Y(l)}}handleMoveColsCommand({fromRange:e,toRange:n},r,i){var a;let o=this._sheetsFilterService.getFilterModel(r,i),s=(a=o==null?void 0:o.getRange())==null?null:a;if(!o||!s)return this._handleNull();let{startColumn:c,endColumn:l}=s;if(e.endColumn<c&&n.startColumn<=c||e.startColumn>l&&n.endColumn>l)return this._handleNull();let u=[],d=[],f={};for(let e=c;e<=l;e++)f[e]={colIndex:e,filter:o.getFilterColumn(e)};(0,t.moveMatrixArray)(e.startColumn,e.endColumn-e.startColumn+1,n.startColumn,f);let p=s.startColumn,m=s.endColumn;c>=e.startColumn&&c<=e.endColumn&&n.startColumn>e.startColumn&&e.endColumn<l&&(p=e.endColumn+1),l>=e.startColumn&&l<=e.endColumn&&n.startColumn<e.startColumn&&e.startColumn>c&&(m=e.startColumn-1);let h=Object.keys(f).map(e=>Number(e)),g=h.find(e=>f[e].colIndex===m),_=h.find(e=>f[e].colIndex===p);if(h.forEach(e=>{let{colIndex:t,filter:n}=f[e],a=e;if(n){var s;if(a>=_&&a<=g){var c;let e={unitId:r,subUnitId:i,col:a,criteria:{...n.serialize(),colId:a}},t={unitId:r,subUnitId:i,col:a,criteria:o.getFilterColumn(a)?{...(c=o.getFilterColumn(a))==null?void 0:c.serialize(),colId:a}:null};u.push({id:V.id,params:e}),d.push({id:V.id,params:t})}if(!((s=f[t])!=null&&s.filter)){let e={unitId:r,subUnitId:i,col:t,criteria:null};u.push({id:V.id,params:e}),d.push({id:V.id,params:{unitId:r,subUnitId:i,col:t,criteria:{...n.serialize(),colId:t}}})}}}),c!==_||l!==g){let e={unitId:r,subUnitId:i,range:{...s,startColumn:_,endColumn:g}};u.unshift({id:B.id,params:e}),d.unshift({id:B.id,params:{range:s,unitId:r,subUnitId:i}})}return{undos:d,redos:u}}_handleMoveRowsCommand(e,n,r){var i;let a=this._sheetsFilterService.getFilterModel(n,r),o=(i=a==null?void 0:a.getRange())==null?null:i;if(!a||!o)return this._handleNull();let{startRow:s,endRow:c}=o,{fromRange:l,toRange:u}=e;if(l.endRow<s&&u.startRow<=s||l.startRow>c&&u.endRow>c)return this._handleNull();let d=[],f=[],p={};for(let e=s;e<=c;e++)p[e]={oldIndex:e};let m=s,h=c;c>=l.startRow&&c<=l.endRow&&u.startRow<l.startRow&&l.startRow>s&&(h=l.startRow-1),(0,t.moveMatrixArray)(l.startRow,l.endRow-l.startRow+1,u.startRow,p);let g=Object.keys(p).map(e=>Number(e)),_=g.find(e=>p[e].oldIndex===h),v=g.find(e=>p[e].oldIndex===m);if(s!==v||c!==_){let e={unitId:n,subUnitId:r,range:{...o,startRow:v,endRow:_}};d.push({id:B.id,params:e},{id:U.id,params:{unitId:n,subUnitId:r}}),f.push({id:B.id,params:{range:o,unitId:n,subUnitId:r}},{id:U.id,params:{unitId:n,subUnitId:r}})}return{redos:d,undos:f}}_handleMoveRangeCommand(e,n,r){let{fromRange:i,toRange:a}=e,o=this._sheetsFilterService.getFilterModel(n,r);if(!o)return this._handleNull();let s=o.getRange();if(!s)return this._handleNull();let c=[],l=[];if(t.Rectangle.contains(i,s)){let e=s.startRow-i.startRow,t=s.startColumn-i.startColumn,u={startRow:a.startRow+e,startColumn:a.startColumn+t,endRow:a.startRow+e+(s.endRow-s.startRow),endColumn:a.startColumn+t+(s.endColumn-s.startColumn)},d={id:H.id,params:{unitId:n,subUnitId:r}},f={id:B.id,params:{unitId:n,subUnitId:r,range:u}},p={id:B.id,params:{unitId:n,subUnitId:r,range:s}};c.push(d,f),l.push(d,p);let m=o.getAllFilterColumns(),h=a.startColumn-i.startColumn;m.forEach(e=>{let[t,i]=e;i&&(c.push({id:V.id,params:{unitId:n,subUnitId:r,col:t+h,criteria:{...i.serialize(),colId:t+h}}}),l.push({id:V.id,params:{unitId:n,subUnitId:r,col:t,criteria:{...i.serialize(),colId:t}}}))})}else if(t.Rectangle.intersects(a,s)){let e={...s,endRow:Math.max(s.endRow,a.endRow)};c.push({id:B.id,params:{unitId:n,subUnitId:r,range:e}}),l.push({id:B.id,params:{unitId:n,subUnitId:r,range:s}})}return{redos:c,undos:l}}_handleRemoveSheetCommand(e,t,n){let r=this._sheetsFilterService.getFilterModel(t,n);if(!r)return this._handleNull();let i=r.getRange();if(!i)return this._handleNull();let a=[],o=[];return r.getAllFilterColumns().forEach(([e,r])=>{o.push({id:V.id,params:{unitId:t,subUnitId:n,col:e,criteria:{...r.serialize(),colId:e}}})}),a.push({id:H.id,params:{unitId:t,subUnitId:n,range:i}}),o.unshift({id:B.id,params:{range:i,unitId:t,subUnitId:n}}),{undos:o,redos:a}}_handleCopySheetCommand(e,t,n){let r=this._sheetsFilterService.getFilterModel(e,t);if(!r)return this._handleNull();let i=r.getRange();if(!i)return this._handleNull();let a=[],o=[],s=[];return r.getAllFilterColumns().forEach(([t,r])=>{a.push({id:V.id,params:{unitId:e,subUnitId:n,col:t,criteria:{...r.serialize(),colId:t}}}),s.push({id:V.id,params:{unitId:e,subUnitId:n,col:t,criteria:null}})}),s.push({id:H.id,params:{unitId:e,subUnitId:n,range:i}}),a.unshift({id:B.id,params:{range:i,unitId:e,subUnitId:n}}),{undos:o,redos:a,preUndos:s,preRedos:[]}}_handleNull(){return{redos:[],undos:[]}}_initRowFilteredInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(n.INTERCEPTOR_POINT.ROW_FILTERED,{handler:(e,t)=>{var n,r;return e?!0:(n=(r=this._sheetsFilterService.getFilterModel(t.unitId,t.subUnitId))==null?void 0:r.isRowFiltered(t.row))==null?!1:n}}))}_moveCriteria(e,t,n,r){let i={unitId:e,subUnitId:t,criteria:null,col:-1},a=[],o=[],s=[],c=[];return n.forEach(e=>{let[t,n]=e;o.push({id:V.id,params:{...i,col:t}}),a.push({id:V.id,params:{...i,col:t,criteria:{...n.serialize(),colId:t}}})}),n.forEach(e=>{let[t,n]=e;c.push({id:V.id,params:{...i,col:t+r,criteria:{...n.serialize(),colId:t+r}}}),s.push({id:V.id,params:{...i,col:t+r,criteria:null}})}),{newRange:{redos:c,undos:s},oldRange:{redos:o,undos:a}}}_commandExecutedListener(){this.disposeWithMe(this._commandService.onCommandExecuted((e,t)=>{let{unitId:r,subUnitId:i}=e.params||{},a=this._sheetsFilterService.getFilterModel(r,i);if(!a)return;let o=Array.from(a.filteredOutRows).sort((e,t)=>e-t),s=[],c=!1;if(e.id===n.RemoveRowMutation.id){let{startRow:t,endRow:n}=e.params.range,r=o.filter(e=>e>=t&&e<=n);o.forEach(e=>{if(e<t)s.push(e);else if(c=!0,e<=n){let e=Math.max(t,s.length?s[s.length-1]+1:t);s.push(e)}else s.push(e-(n-t+1-r.length))})}if(e.id===n.InsertRowMutation.id){let{startRow:t,endRow:n}=e.params.range;o.forEach(e=>{e>=t?(c=!0,s.push(e+(n-t+1))):s.push(e)})}if(c&&(a.filteredOutRows=new Set(s)),e.id===n.SetRangeValuesMutation.id&&!(t!=null&&t.onlyLocal)){let t=this._getExtendRegion(r,i);if(t){let a=e.params.cellValue;if(a)for(let e=t.startColumn;e<=t.endColumn;e++){var l;let o=a==null||(l=a[t.startRow])==null?void 0:l[e];if(o&&this._cellHasValue(o)){var u;let e=(u=this._univerInstanceService.getUnit(r))==null?void 0:u.getSheetBySheetId(i);if(e){let a=(0,n.expandToContinuousRange)(t,{down:!0},e),o=this._sheetsFilterService.getFilterModel(r,i),s=o.getRange();o.setRange({...s,endRow:a.endRow}),this._registerRefRange(r,i)}}}}}}))}_getExtendRegion(e,t){var n;let r=this._sheetsFilterService.getFilterModel(e,t);if(!r)return null;let i=(n=this._univerInstanceService.getUnit(e))==null?void 0:n.getSheetBySheetId(t);if(!i)return null;let a=r.getRange();if(!a)return null;let o=i.getRowCount()-1,s=i.getRowManager();for(let e=a.endRow+1;e<=o;e++)if(s.getRowRawVisible(e))return{startRow:e,endRow:e,startColumn:a.startColumn,endColumn:a.endColumn};return null}_initErrorHandling(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{let t=e.params,r=(0,n.getSheetCommandTarget)(this._univerInstanceService,t);if(!r)return;let{subUnitId:i,unitId:a}=r,o=this._sheetsFilterService.getFilterModel(a,i);if(!o)return;let s=o.getRange();if(e.id===n.MoveRowsCommand.id&&t.fromRange.startRow<=s.startRow&&t.fromRange.endRow<s.endRow&&t.fromRange.endRow>=s.startRow)throw this._sheetsFilterService.setFilterErrorMsg(`sheets-filter.msg.filter-header-forbidden`),Error(`[SheetsFilterController]: Cannot move header row of filter`)}))}_cellHasValue(e){let t=Object.values(e);return!(t.length===0||t.every(e=>e==null))}};X=L([I(0,t.ICommandService),I(1,(0,t.Inject)(n.SheetInterceptorService)),I(2,(0,t.Inject)(z)),I(3,t.IUniverInstanceService),I(4,(0,t.Inject)(n.RefRangeService)),I(5,(0,t.Optional)(a.DataSyncPrimaryController)),I(6,(0,t.Inject)(n.ZebraCrossingCacheController))],X);let _e=[V.id,U.id],ve=[n.InsertColMutation.id,n.RemoveColMutation.id,n.MoveColsMutation.id],Z=class extends t.Disposable{get visible(){return this._visible$.getValue()}get enabled(){return this._enabled$.getValue()}constructor(e,n,i){super(),this._sheetsFilterController=e,this._commandService=n,this._configService=i,O(this,`_d`,new t.DisposableCollection),O(this,`_visible$`,new r.BehaviorSubject(!1)),O(this,`visible$`,this._visible$.asObservable()),O(this,`_enabled$`,new r.BehaviorSubject(!0)),O(this,`enabled$`,this._enabled$.asObservable());let a=this._configService.getConfig(q);if(a!=null&&a.enableSyncSwitch&&(this._visible$.next(!0),typeof a.enableSyncSwitch==`object`)){var o;this.setEnabled((o=a.enableSyncSwitch.defaultValue)==null?!0:o)}}setEnabled(e){this._enabled$.next(e),e?this._d.dispose():this._initOnlyLocalListener()}_initOnlyLocalListener(){this._d.add(this._commandService.beforeCommandExecuted((e,t)=>{_e.includes(e.id)&&(t||(t={}),t.onlyLocal=!0)})),this._d.add(this._commandService.onCommandExecuted((e,r)=>{if(ve.includes(e.id)&&r!=null&&r.fromCollab){if(e.id===n.InsertColMutation.id){let{range:n,unitId:i,subUnitId:a}=e.params,{redos:o}=this._sheetsFilterController.handleInsertColCommand(n,i,a);(0,t.sequenceExecute)(o,this._commandService,r)}else if(e.id===n.RemoveColMutation.id){let{range:n,unitId:i,subUnitId:a}=e.params,{redos:o}=this._sheetsFilterController.handleRemoveColCommand(n,i,a);(0,t.sequenceExecute)(o,this._commandService,r)}else if(e.id===n.MoveColsMutation.id){let{sourceRange:n,targetRange:i,unitId:a,subUnitId:o}=e.params,{redos:s}=this._sheetsFilterController.handleMoveColsCommand({fromRange:n,toRange:i},a,o);(0,t.sequenceExecute)(s,this._commandService,r)}}}))}};Z=L([I(0,(0,t.Inject)(X)),I(1,t.ICommandService),I(2,t.IConfigService)],Z);var ye=`@univerjs/sheets-filter`,be=`0.18.0`;let Q=class extends t.Disposable{constructor(e,t,n,r){super(),this._activeDirtyManagerService=e,this._sheetRowFilteredService=t,this._sheetsFilterService=n,this._univerInstanceService=r,this._initFormulaDirtyRange(),this._registerSheetRowFiltered()}_initFormulaDirtyRange(){d.forEach(e=>{this._activeDirtyManagerService.register(e,{commandId:e,getDirtyData:e=>{let{unitId:t,subUnitId:n}=e.params;return{dirtyRanges:this._getHideRowMutation(t,n),clearDependencyTreeCache:{[t]:{[n]:`1`}}}}})})}_getHideRowMutation(e,t){var n,r;let i=(n=this._sheetsFilterService.getFilterModel(e,t))==null?void 0:n.getRange(),a=(r=this._univerInstanceService.getUnit(e))==null?void 0:r.getSheetBySheetId(t);if(i==null||a==null)return[];let{startRow:o,endRow:s}=i;return[{unitId:e,sheetId:t,range:{startRow:o,startColumn:0,endRow:s,endColumn:a.getColumnCount()-1}}]}_registerSheetRowFiltered(){this._sheetRowFilteredService.register((e,t,n)=>{var r,i;return(r=(i=this._sheetsFilterService.getFilterModel(e,t))==null?void 0:i.isRowFiltered(n))==null?!1:r})}};Q=L([I(0,(0,t.Inject)(o.IActiveDirtyManagerService)),I(1,(0,t.Inject)(o.ISheetRowFilteredService)),I(2,(0,t.Inject)(z)),I(3,t.IUniverInstanceService)],Q);let $=class extends t.Plugin{constructor(e=J,n,r){super(),this._config=e,this._injector=n,this._configService=r;let{...i}=(0,t.merge)({},J,this._config);this._configService.setConfig(q,i)}onStarting(){[[Q],[z],[X],[Z]].forEach(e=>this._injector.add(e))}onReady(){(0,t.touchDependencies)(this._injector,[[Q],[X],[Z]])}};O($,`type`,t.UniverInstanceType.UNIVER_SHEET),O($,`pluginName`,R),O($,`packageName`,ye),O($,`version`,be),$=L([I(1,(0,t.Inject)(t.Injector)),I(2,t.IConfigService)],$),e.ClearSheetsFilterCriteriaCommand=de,e.CustomFilterOperator=p,e.FILTER_MUTATIONS=d,e.FilterBy=f,e.FilterColumn=j,e.FilterModel=A,e.ReCalcSheetsFilterCommand=fe,e.ReCalcSheetsFilterMutation=U,e.RemoveSheetFilterCommand=G,e.RemoveSheetsFilterMutation=H,e.SHEET_FILTER_SNAPSHOT_ID=R,e.SetSheetFilterRangeCommand=W,e.SetSheetsFilterCriteriaCommand=ue,e.SetSheetsFilterCriteriaMutation=V,e.SetSheetsFilterRangeMutation=B,Object.defineProperty(e,`SheetsFilterService`,{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,`SheetsFilterSyncController`,{enumerable:!0,get:function(){return Z}}),e.SmartToggleSheetsFilterCommand=le,Object.defineProperty(e,`UniverSheetsFilterPlugin`,{enumerable:!0,get:function(){return $}}),e.equals=v,e.getCustomFilterFn=S,e.greaterThan=m,e.greaterThanOrEqualTo=h,e.lessThan=g,e.lessThanOrEqualTo=_,e.notEquals=y});
|
|
4
3
|
|
|
5
4
|
// @univerjs/sheets-filter/facade
|
|
6
|
-
(function(
|
|
7
|
-
|
|
5
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/sheets-filter`),require(`@univerjs/sheets/facade`),require(`@univerjs/core/facade`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets-filter`,`@univerjs/sheets/facade`,`@univerjs/core/facade`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsFilterFacade={},e.UniverCore,e.UniverSheetsFilter,e.UniverSheetsFacade,e.UniverCoreFacade))})(this,function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function a(e,t){return function(n,r){t(n,r,e)}}function o(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let s=class{constructor(e,t,n,r,i){this._workbook=e,this._worksheet=t,this._filterModel=n,this._injector=r,this._commandSrv=i}getFilteredOutRows(){return Array.from(this._filterModel.filteredOutRows).sort()}getColumnFilterCriteria(e){var t;return(t=this._filterModel.getFilterColumn(e))==null?void 0:t.getColumnData()}removeColumnFilterCriteria(e){return this._commandSrv.syncExecuteCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),col:e,criteria:null}),this}setColumnFilterCriteria(e,t){return this._commandSrv.syncExecuteCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),col:e,criteria:t}),this}getRange(){let e=this._filterModel.getRange();return this._injector.createInstance(r.FRange,this._workbook,this._worksheet,e)}removeFilterCriteria(){return this._commandSrv.syncExecuteCommand(n.ClearSheetsFilterCriteriaCommand.id),this}remove(){return this._commandSrv.syncExecuteCommand(n.RemoveSheetFilterCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()})}};s=o([a(3,(0,t.Inject)(t.Injector)),a(4,t.ICommandService)],s);var c=class extends r.FRange{createFilter(){return this._getFilterModel()||!this._commandService.syncExecuteCommand(n.SetSheetFilterRangeCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range})?null:this.getFilter()}getFilter(){let e=this._getFilterModel();return e?this._injector.createInstance(s,this._workbook,this._worksheet,e):null}_getFilterModel(){return this._injector.get(n.SheetsFilterService).getFilterModel(this._workbook.getUnitId(),this._worksheet.getSheetId())}};r.FRange.extend(c);var l=class extends r.FWorksheet{getFilter(){let e=this._getFilterModel();return e?this._injector.createInstance(s,this._workbook,this._worksheet,e):null}_getFilterModel(){return this._injector.get(n.SheetsFilterService).getFilterModel(this._workbook.getUnitId(),this._worksheet.getSheetId())}};r.FWorksheet.extend(l);var u=class{get CustomFilterOperator(){return n.CustomFilterOperator}};i.FEnum.extend(u);var d=class extends i.FEventName{get SheetBeforeRangeFilter(){return`SheetBeforeRangeFilter`}get SheetRangeFiltered(){return`SheetRangeFiltered`}get SheetRangeFilterCleared(){return`SheetRangeFilterCleared`}get SheetBeforeRangeFilterClear(){return`SheetBeforeRangeFilterClear`}};i.FEventName.extend(d),i.FEventName.extend(r.FSheetEventName);var f=class extends i.FUniver{_initialize(e){let r=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.SheetBeforeRangeFilter,()=>r.beforeCommandExecuted(e=>{e.id===n.SetSheetsFilterCriteriaCommand.id&&this._beforeRangeFilter(e)}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetBeforeRangeFilterClear,()=>r.beforeCommandExecuted(e=>{e.id===n.ClearSheetsFilterCriteriaCommand.id&&this._beforeRangeFilterClear()}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetRangeFiltered,()=>r.onCommandExecuted(e=>{e.id===n.SetSheetsFilterCriteriaCommand.id&&this._onRangeFiltered(e)}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetRangeFilterCleared,()=>r.onCommandExecuted(e=>{e.id===n.ClearSheetsFilterCriteriaCommand.id&&this._onRangeFilterCleared()})))}_beforeRangeFilter(e){let t=e.params,n=this.getUniverSheet(t.unitId),r={workbook:n,worksheet:n.getSheetBySheetId(t.subUnitId),col:t.col,criteria:t.criteria};if(this.fireEvent(this.Event.SheetBeforeRangeFilter,r),r.cancel)throw Error(`SetSheetsFilterCriteriaCommand canceled.`)}_onRangeFiltered(e){let t=e.params,n=this.getUniverSheet(t.unitId),r={workbook:n,worksheet:n.getSheetBySheetId(t.subUnitId),col:t.col,criteria:t.criteria};this.fireEvent(this.Event.SheetRangeFiltered,r)}_beforeRangeFilterClear(){let e=this.getActiveWorkbook();if(!e)return;let t={workbook:e,worksheet:e.getActiveSheet()};if(this.fireEvent(this.Event.SheetBeforeRangeFilterClear,t),t.cancel)throw Error(`SetSheetsFilterCriteriaCommand canceled.`)}_onRangeFilterCleared(){let e=this.getActiveWorkbook();if(!e)return;let t={workbook:e,worksheet:e.getActiveSheet()};this.fireEvent(this.Event.SheetRangeFilterCleared,t)}};i.FUniver.extend(f),Object.defineProperty(e,`FFilter`,{enumerable:!0,get:function(){return s}})});
|
|
8
6
|
|
|
9
7
|
// @univerjs/sheets-filter-ui/index
|
|
10
|
-
(function(C,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@univerjs/core"),require("@univerjs/sheets-filter"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("@univerjs/engine-render"),require("@univerjs/sheets"),require("rxjs"),require("@univerjs/rpc"),require("@univerjs/design"),require("react"),require("react/jsx-runtime")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-filter","@univerjs/sheets-ui","@univerjs/ui","@univerjs/engine-render","@univerjs/sheets","rxjs","@univerjs/rpc","@univerjs/design","react","react/jsx-runtime"],c):(C=typeof globalThis<"u"?globalThis:C||self,c(C.UniverSheetsFilterUi={},C.UniverCore,C.UniverSheetsFilter,C.UniverSheetsUi,C.UniverUi,C.UniverEngineRender,C.UniverSheets,C.rxjs,C.UniverRpc,C.UniverDesign,C.React,C.React))})(this,(function(C,c,u,$,g,K,y,S,me,N,F,d){"use strict";var ir=Object.defineProperty;var nr=(C,c,u)=>c in C?ir(C,c,{enumerable:!0,configurable:!0,writable:!0,value:u}):C[c]=u;var _=(C,c,u)=>nr(C,typeof c!="symbol"?c+"":c,u);var Te;var R=(r=>(r[r.FIRST=0]="FIRST",r[r.SECOND=1]="SECOND",r))(R||{}),E=(r=>(r.NONE="none",r.STARTS_WITH="startsWith",r.DOES_NOT_START_WITH="doesNotStartWith",r.ENDS_WITH="endsWith",r.DOES_NOT_END_WITH="doesNotEndWith",r.CONTAINS="contains",r.DOES_NOT_CONTAIN="doesNotContain",r.EQUALS="equals",r.NOT_EQUALS="notEquals",r.EMPTY="empty",r.NOT_EMPTY="notEmpty",r.BETWEEN="between",r.NOT_BETWEEN="notBetween",r.CUSTOM="custom",r))(E||{}),f;(r=>{r.NONE={label:"sheets-filter.conditions.none",operator:E.NONE,order:R.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NONE]: should not have initial form params!")},testMappingParams:i=>i.operator1===E.NONE,mapToFilterColumn:()=>null,testMappingFilterColumn:i=>!i.customFilters&&!i.filters?{}:!1},r.EMPTY={label:"sheets-filter.conditions.empty",operator:E.EMPTY,order:R.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===E.EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:""}]}}),testMappingFilterColumn:i=>{var h;if(((h=i.customFilters)==null?void 0:h.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.val===""&&s.operator===void 0?{operator1:E.EMPTY}:!1}},r.NOT_EMPTY={label:"sheets-filter.conditions.not-empty",operator:E.NOT_EMPTY,order:R.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NOT_EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===E.NOT_EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:"",operator:u.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:i=>{var h;if(((h=i.customFilters)==null?void 0:h.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.val===" "&&s.operator===u.CustomFilterOperator.NOT_EQUALS?{operator1:E.NOT_EMPTY}:!1}},r.TEXT_CONTAINS={label:"sheets-filter.conditions.text-contains",operator:E.CONTAINS,order:R.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:E.CONTAINS,val1:""}),testMappingParams:i=>{const[s]=D(i);return s===E.CONTAINS},mapToFilterColumn:i=>{const{val1:s}=i;return s===""?null:{customFilters:{customFilters:[{val:`*${s}*`}]}}},testMappingFilterColumn:i=>{var h;if(((h=i.customFilters)==null?void 0:h.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],a=s.val.toString();return!s.operator&&a.startsWith("*")&&a.endsWith("*")?{operator1:E.CONTAINS,val1:a.slice(1,-1)}:!1}},r.DOES_NOT_CONTAIN={label:"sheets-filter.conditions.does-not-contain",operator:E.DOES_NOT_CONTAIN,order:R.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:E.DOES_NOT_CONTAIN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}*`,operator:u.CustomFilterOperator.NOT_EQUALS}]}}),testMappingParams:i=>{const[s]=D(i);return s===E.DOES_NOT_CONTAIN},testMappingFilterColumn:i=>{var h;if(((h=i.customFilters)==null?void 0:h.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],a=s.val.toString();return s.operator===u.CustomFilterOperator.NOT_EQUALS&&a.startsWith("*")&&a.endsWith("*")?{operator1:E.DOES_NOT_CONTAIN,val1:a.slice(1,-1)}:!1}},r.STARTS_WITH={label:"sheets-filter.conditions.starts-with",operator:E.STARTS_WITH,order:R.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:E.STARTS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`${i.val1}*`}]}}),testMappingParams:i=>{const[s]=D(i);return s===E.STARTS_WITH},testMappingFilterColumn:i=>{var h;if(((h=i.customFilters)==null?void 0:h.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],a=s.val.toString();return!s.operator&&a.endsWith("*")&&!a.startsWith("*")?{operator1:E.STARTS_WITH,val1:a.slice(0,-1)}:!1}},r.ENDS_WITH={label:"sheets-filter.conditions.ends-with",operator:E.ENDS_WITH,order:R.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:E.ENDS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}`}]}}),testMappingParams:i=>{const[s]=D(i);return s===E.ENDS_WITH},testMappingFilterColumn:i=>{var h;if(((h=i.customFilters)==null?void 0:h.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],a=s.val.toString();return!s.operator&&a.startsWith("*")&&!a.endsWith("*")?{operator1:E.ENDS_WITH,val1:a.slice(1)}:!1}},r.EQUALS={label:"sheets-filter.conditions.equals",operator:E.EQUALS,order:R.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:E.EQUALS,val1:""}),testMappingParams:i=>{const[s]=D(i);return s===E.EQUALS},mapToFilterColumn:i=>{const{val1:s}=i;return s===""?null:{customFilters:{customFilters:[{val:s}]}}},testMappingFilterColumn:i=>{var s,a,h;return((a=(s=i.filters)==null?void 0:s.filters)==null?void 0:a.length)===1?{operator1:E.EQUALS,val1:""}:((h=i.customFilters)==null?void 0:h.customFilters.length)===1&&!i.customFilters.customFilters[0].operator?{operator1:E.EQUALS,val1:i.customFilters.customFilters[0].val.toString()}:!1}},r.GREATER_THAN={label:"sheets-filter.conditions.greater-than",operator:u.CustomFilterOperator.GREATER_THAN,numOfParameters:1,order:R.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.GREATER_THAN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:u.CustomFilterOperator.GREATER_THAN}]}}),testMappingParams:i=>{const[s]=D(i);return s===u.CustomFilterOperator.GREATER_THAN},testMappingFilterColumn:i=>{var a;if(((a=i.customFilters)==null?void 0:a.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==u.CustomFilterOperator.GREATER_THAN?!1:{operator1:u.CustomFilterOperator.GREATER_THAN,val1:s.val.toString()}}},r.GREATER_THAN_OR_EQUAL={label:"sheets-filter.conditions.greater-than-or-equal",operator:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL,numOfParameters:1,order:R.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:""}),testMappingParams:i=>{const[s]=D(i);return s===u.CustomFilterOperator.GREATER_THAN_OR_EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL}]}}),testMappingFilterColumn:i=>{var a;if(((a=i.customFilters)==null?void 0:a.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==u.CustomFilterOperator.GREATER_THAN_OR_EQUAL?!1:{operator1:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:s.val.toString()}}},r.LESS_THAN={label:"sheets-filter.conditions.less-than",operator:u.CustomFilterOperator.LESS_THAN,numOfParameters:1,order:R.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.LESS_THAN,val1:""}),testMappingParams:i=>{const[s]=D(i);return s===u.CustomFilterOperator.LESS_THAN},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:u.CustomFilterOperator.LESS_THAN}]}}),testMappingFilterColumn:i=>{var a;if(((a=i.customFilters)==null?void 0:a.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==u.CustomFilterOperator.LESS_THAN?!1:{operator1:u.CustomFilterOperator.LESS_THAN,val1:s.val.toString()}}},r.LESS_THAN_OR_EQUAL={label:"sheets-filter.conditions.less-than-or-equal",operator:u.CustomFilterOperator.LESS_THAN_OR_EQUAL,numOfParameters:1,order:R.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:""}),testMappingParams:i=>{const[s]=D(i);return s===u.CustomFilterOperator.LESS_THAN_OR_EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:u.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}),testMappingFilterColumn:i=>{var a;if(((a=i.customFilters)==null?void 0:a.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==u.CustomFilterOperator.LESS_THAN_OR_EQUAL?!1:{operator1:u.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:s.val.toString()}}},r.EQUAL={label:"sheets-filter.conditions.equal",operator:u.CustomFilterOperator.EQUAL,numOfParameters:1,order:R.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.EQUAL,val1:""}),testMappingParams:i=>{const[s]=D(i);return s===u.CustomFilterOperator.EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:u.CustomFilterOperator.EQUAL}]}}),testMappingFilterColumn:i=>{var a;if(((a=i.customFilters)==null?void 0:a.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==u.CustomFilterOperator.EQUAL?!1:{operator1:u.CustomFilterOperator.EQUAL,val1:s.val.toString()}}},r.NOT_EQUAL={label:"sheets-filter.conditions.not-equal",operator:u.CustomFilterOperator.NOT_EQUALS,numOfParameters:1,order:R.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.NOT_EQUALS,val1:""}),testMappingParams:i=>{const[s]=D(i);return s===u.CustomFilterOperator.NOT_EQUALS},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:u.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:i=>{var a;if(((a=i.customFilters)==null?void 0:a.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==u.CustomFilterOperator.NOT_EQUALS?!1:{operator1:u.CustomFilterOperator.NOT_EQUALS,val1:s.val.toString()}}},r.BETWEEN={label:"sheets-filter.conditions.between",operator:E.BETWEEN,order:R.SECOND,numOfParameters:2,getDefaultFormParams:()=>({and:!0,operator1:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:"",operator2:u.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:""}),testMappingParams:i=>{const{and:s,operator1:a,operator2:h}=i;if(!s)return!1;const m=[a,h];return m.includes(u.CustomFilterOperator.GREATER_THAN_OR_EQUAL)&&m.includes(u.CustomFilterOperator.LESS_THAN_OR_EQUAL)},mapToFilterColumn:i=>{const{val1:s,val2:a,operator1:h}=i,m=h===u.CustomFilterOperator.GREATER_THAN_OR_EQUAL;return{customFilters:{and:c.BooleanNumber.TRUE,customFilters:[{val:m?s:a,operator:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL},{val:m?a:s,operator:u.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}},testMappingFilterColumn:i=>{var h;if(((h=i.customFilters)==null?void 0:h.customFilters.length)!==2)return!1;const[s,a]=i.customFilters.customFilters;return s.operator===u.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&a.operator===u.CustomFilterOperator.LESS_THAN_OR_EQUAL&&i.customFilters.and?{and:!0,operator1:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:s.val.toString(),operator2:u.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:a.val.toString()}:a.operator===u.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&s.operator===u.CustomFilterOperator.LESS_THAN_OR_EQUAL&&i.customFilters.and?{and:!0,operator1:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:a.val.toString(),operator2:u.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:s.val.toLocaleString()}:!1}},r.NOT_BETWEEN={label:"sheets-filter.conditions.not-between",operator:E.NOT_BETWEEN,order:R.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.LESS_THAN,val1:"",operator2:u.CustomFilterOperator.GREATER_THAN,val2:""}),testMappingParams:i=>{const{and:s,operator1:a,operator2:h}=i;if(s)return!1;const m=[a,h];return m.includes(u.CustomFilterOperator.GREATER_THAN)&&m.includes(u.CustomFilterOperator.LESS_THAN)},mapToFilterColumn:i=>{const{val1:s,val2:a,operator1:h}=i,m=h===u.CustomFilterOperator.GREATER_THAN;return{customFilters:{customFilters:[{val:m?s:a,operator:u.CustomFilterOperator.GREATER_THAN},{val:m?a:s,operator:u.CustomFilterOperator.LESS_THAN}]}}},testMappingFilterColumn:i=>{var h;if(((h=i.customFilters)==null?void 0:h.customFilters.length)!==2)return!1;const[s,a]=i.customFilters.customFilters;return s.operator===u.CustomFilterOperator.LESS_THAN&&a.operator===u.CustomFilterOperator.GREATER_THAN&&!i.customFilters.and?{operator1:u.CustomFilterOperator.LESS_THAN,val1:s.val.toString(),operator2:u.CustomFilterOperator.GREATER_THAN,val2:a.val.toString()}:a.operator===u.CustomFilterOperator.LESS_THAN&&s.operator===u.CustomFilterOperator.GREATER_THAN&&!i.customFilters.and?{operator1:u.CustomFilterOperator.GREATER_THAN,val1:a.val.toString(),operator2:u.CustomFilterOperator.LESS_THAN,val2:s.val.toLocaleString()}:!1}},r.CUSTOM={label:"sheets-filter.conditions.custom",operator:E.CUSTOM,order:R.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:E.NONE,val1:"",operator2:E.NONE,val2:""}),testMappingParams:()=>!0,mapToFilterColumn:i=>{const{and:s,val1:a,val2:h,operator1:m,operator2:p}=i;function O(M,L){for(const U of r.ALL_CONDITIONS)if(U.operator===M)return U.mapToFilterColumn({val1:L,operator1:M})}const v=!m||m===r.NONE.operator,T=!p||p===r.NONE.operator;if(v&&T)return r.NONE.mapToFilterColumn({});if(v)return O(p,h);if(T)return O(m,a);const I=O(m,a),P=O(p,h),A={customFilters:[I.customFilters.customFilters[0],P.customFilters.customFilters[0]]};return s&&(A.and=c.BooleanNumber.TRUE),{customFilters:A}},testMappingFilterColumn:i=>{var h;if(((h=i.customFilters)==null?void 0:h.customFilters.length)!==2)return!1;const s=i.customFilters.customFilters.map(m=>l({customFilters:{customFilters:[m]}})),a={operator1:s[0][0].operator,val1:s[0][1].val1,operator2:s[1][0].operator,val2:s[1][1].val1};return i.customFilters.and&&(a.and=!0),a}},r.ALL_CONDITIONS=[r.NONE,r.EMPTY,r.NOT_EMPTY,r.TEXT_CONTAINS,r.DOES_NOT_CONTAIN,r.STARTS_WITH,r.ENDS_WITH,r.EQUALS,r.GREATER_THAN,r.GREATER_THAN_OR_EQUAL,r.LESS_THAN,r.LESS_THAN_OR_EQUAL,r.EQUAL,r.NOT_EQUAL,r.BETWEEN,r.NOT_BETWEEN,r.CUSTOM];function e(i){const s=r.ALL_CONDITIONS.find(a=>a.operator===i);if(!s)throw new Error(`[SheetsFilter]: no condition item found for operator: ${i}`);return s}r.getItemByOperator=e;function t(i,s){for(const a of r.ALL_CONDITIONS.filter(h=>h.numOfParameters===s))if(a.numOfParameters!==0&&a.testMappingParams(i))return a;for(const a of r.ALL_CONDITIONS)if(a.testMappingParams(i))return a;throw new Error("[SheetsFilter]: no condition item can be mapped from the filter map params!")}r.testMappingParams=t;function n(i){const s=r.ALL_CONDITIONS.find(a=>a.operator===i);return(s==null?void 0:s.numOfParameters)===0?{operator1:s.operator}:s.getDefaultFormParams()}r.getInitialFormParams=n;function o(i,s){return i.mapToFilterColumn(s)}r.mapToFilterColumn=o;function l(i){if(!i)return[r.NONE,{}];for(const s of r.ALL_CONDITIONS){const a=s.testMappingFilterColumn(i);if(a)return[s,a]}return[r.NONE,{}]}r.testMappingFilterColumn=l})(f||(f={}));function D(r){const{operator1:e,operator2:t,val1:n,val2:o}=r;if(e&&t)throw new Error("Both operator1 and operator2 are set!");if(!e&&!t)throw new Error("Neither operator1 and operator2 and both not set!");return e?[e,n]:[t,o]}function Ie(r){const e=[],t=[];let n=0,o=0;function l(i){i.leaf&&(i.checked?(e.push(i),n+=i.count):(t.push(i),o+=i.count)),i.children&&i.children.forEach(l)}return r.forEach(l),{checkedItems:e,uncheckedItems:t,checked:n,unchecked:o}}var nt=Object.getOwnPropertyDescriptor,ot=(r,e,t,n)=>{for(var o=n>1?void 0:n?nt(e,t):e,l=r.length-1,i;l>=0;l--)(i=r[l])&&(o=i(o)||o);return o},Fe=(r,e)=>(t,n)=>e(t,n,r);const Ne="sheets-filter.generate-filter-values.service",pe=c.createIdentifier(Ne);let be=class extends c.Disposable{constructor(r,e,t){super(),this._localeService=r,this._univerInstanceService=e,this._logService=t}async getFilterValues(r){var p;const{unitId:e,subUnitId:t,filteredOutRowsByOtherColumns:n,filterColumn:o,filters:l,blankChecked:i,iterateRange:s,alreadyChecked:a}=r,h=this._univerInstanceService.getUnit(e),m=(p=this._univerInstanceService.getUnit(e))==null?void 0:p.getSheetBySheetId(t);return!h||!m?[]:(this._logService.debug("[SheetsGenerateFilterValuesService]","getFilterValues for",{unitId:e,subUnitId:t}),ke(l,this._localeService,s,m,new Set(n),o,new Set(a.map(String)),i,h.getStyles()))}};be=ot([Fe(0,c.Inject(c.LocaleService)),Fe(1,c.IUniverInstanceService),Fe(2,c.ILogService)],be);function ke(r,e,t,n,o,l,i,s,a){var P,A,M,L,U,B,Y,q,oe,H;const h=new Map,m=new Map,p="yyyy-mm-dd",O="empty",v=!r&&((l==null?void 0:l.filterBy)===u.FilterBy.COLORS||(l==null?void 0:l.filterBy)===u.FilterBy.CONDITIONS)&&((P=l.filteredOutRows)==null?void 0:P.size);let T=0;for(const b of n.iterateByColumn(t,!1,!1)){const{row:$e,rowSpan:Ee=1}=b;let se=0;for(;se<Ee;){const rr=$e+se;if(o.has(rr)){se++;continue}const X=b!=null&&b.value?c.extractPureTextFromCell(b.value):"";if(!X){T+=1,se+=Ee;continue}const Oe=(A=b.value)!=null&&A.v&&!b.value.p?(U=(L=a.get((M=b.value)==null?void 0:M.s))==null?void 0:L.n)==null?void 0:U.pattern:"",rt=Oe&&c.numfmt.getFormatInfo(Oe).isDate;let it=!1;if(rt){const{year:W,month:Z,day:w}=c.numfmt.getFormatDateInfo(Oe);it=W||Z||w}if(Oe&&rt&&it){const W=(B=n.getCellRaw(b.row,b.col))==null?void 0:B.v;if(!W){se++;continue}const Z=c.numfmt.format(p,Number(W)),[w,V,de]=Z.split("-").map(Number);let J=h.get(`${w}`);J||(J={title:`${w}`,key:`${w}`,children:[],count:0,leaf:!1,checked:!1},h.set(`${w}`,J),m.set(`${w}`,[`${w}`]));let j=(Y=J.children)==null?void 0:Y.find(Ue=>Ue.key===`${w}-${V}`);j||(j={title:e.t(`sheets-filter.date.${V}`),key:`${w}-${V}`,children:[],count:0,leaf:!1,checked:!1},(q=J.children)==null||q.push(j),m.set(`${w}-${V}`,[`${w}`,`${w}-${V}`]));const Me=(oe=j==null?void 0:j.children)==null?void 0:oe.find(Ue=>Ue.key===`${w}-${V}-${de}`);Me?(Me.originValues.add(X),Me.count++,j.count++,J.count++):((H=j.children)==null||H.push({title:`${de}`,key:`${w}-${V}-${de}`,count:1,originValues:new Set([X]),leaf:!0,checked:v?!1:i.size?i.has(X):!s}),j.count++,J.count++,m.set(`${w}-${V}-${de}`,[`${w}`,`${w}-${V}`,`${w}-${V}-${de}`]))}else{const W=X;let Z=h.get(W);Z?Z.count++:(Z={title:X,leaf:!0,checked:v?!1:i.size?i.has(X):!s,key:W,count:1},h.set(W,Z),m.set(W,[W]))}se++}}const I=v?!1:r?s:!0;if(T>0){const b={title:e.t("sheets-filter.panel.empty"),count:T,leaf:!0,checked:I,key:O};h.set("empty",b),m.set("empty",[O])}return{filterTreeItems:st(Array.from(h.values())),filterTreeMapCache:m}}function st(r){return Array.from(r).sort((e,t)=>e.children&&!t.children?-1:!e.children&&t.children?1:at(e.title,t.title)).map(e=>(e.children&&e.children.sort((t,n)=>{const o=Number.parseInt(t.key.split("-")[1],10),l=Number.parseInt(n.key.split("-")[1],10);return o-l}).forEach(t=>{t.children&&t.children.sort((n,o)=>{const l=Number.parseInt(n.key.split("-")[2],10),i=Number.parseInt(o.key.split("-")[2],10);return l-i})}),e))}const Be=r=>!Number.isNaN(Number(r))&&!Number.isNaN(Number.parseFloat(r));function at(r,e){const t=Be(r),n=Be(e);return t&&n?Number.parseFloat(r)-Number.parseFloat(e):t&&!n?-1:!t&&n?1:r.localeCompare(e)}function ye(r,e){for(const t of r){if(t.key===e)return t;if(t.children){const n=ye(t.children,e);if(n)return n}}return null}function De(r){return r.leaf?r.checked:r.children?r.children.every(e=>De(e)):!0}function ae(r,e){r.leaf&&(e!==void 0?r.checked=e:r.checked=!r.checked),r.children&&r.children.forEach(t=>ae(t,e))}function He(r,e){const t=[];return r.forEach(n=>{const o=n.originValues?e.some(s=>Array.from(n.originValues).some(a=>a.toLowerCase().includes(s.toLowerCase()))):!1,l=!o&&e.some(s=>n.title.toLowerCase().includes(s.toLowerCase()));if(o||l)t.push({...n});else if(n.children){const s=He(n.children,e);if(s.length>0){const a=s.reduce((h,m)=>h+m.count,0);t.push({...n,count:a,children:s})}}}),t}var lt=Object.getOwnPropertyDescriptor,fe=(r,e,t,n)=>{for(var o=n>1?void 0:n?lt(e,t):e,l=r.length-1,i;l>=0;l--)(i=r[l])&&(o=i(o)||o);return o},le=(r,e)=>(t,n)=>e(t,n,r);c.createIdentifier("sheets-filter-ui.sheets-filter-panel.service");let Q=class extends c.Disposable{constructor(e,t){super();_(this,"_filterBy$",new S.BehaviorSubject(u.FilterBy.VALUES));_(this,"filterBy$",this._filterBy$.asObservable());_(this,"_filterByModel$",new S.ReplaySubject(1));_(this,"filterByModel$",this._filterByModel$.asObservable());_(this,"_filterByModel",null);_(this,"_hasCriteria$",new S.BehaviorSubject(!1));_(this,"hasCriteria$",this._hasCriteria$.asObservable());_(this,"_filterModel",null);_(this,"_col$",new S.BehaviorSubject(-1));_(this,"col$",this._col$.asObservable());_(this,"_filterHeaderListener",null);this._injector=e,this._refRangeService=t}get filterBy(){return this._filterBy$.getValue()}get filterByModel(){return this._filterByModel}set filterByModel(e){this._filterByModel=e,this._filterByModel$.next(e)}get filterModel(){return this._filterModel}get col(){return this._col$.getValue()}dispose(){this._filterBy$.complete(),this._filterByModel$.complete(),this._hasCriteria$.complete()}setupCol(e,t){this.terminate(),this._filterModel=e,this._col$.next(t);const n=e.getFilterColumn(t);if(n){const o=n.getColumnData();if(o.customFilters){this._hasCriteria$.next(!0),this._setupByConditions(e,t);return}if(o.colorFilters){this._hasCriteria$.next(!0),this._setupByColors(e,t);return}if(o.filters){this._hasCriteria$.next(!0),this._setupByValues(e,t);return}this._hasCriteria$.next(!1),this._setupByValues(e,t);return}this._hasCriteria$.next(!1),this._setupByValues(e,t)}changeFilterBy(e){if(!this._filterModel||this.col===-1)return!1;switch(e){case u.FilterBy.VALUES:this._setupByValues(this._filterModel,this.col);break;case u.FilterBy.COLORS:this._setupByColors(this._filterModel,this.col);break;case u.FilterBy.CONDITIONS:this._setupByConditions(this._filterModel,this.col);break}return!0}terminate(){return this._filterModel=null,this._col$.next(-1),this._disposeFilterHeaderChangeListener(),!0}_disposeFilterHeaderChangeListener(){var e;(e=this._filterHeaderListener)==null||e.dispose(),this._filterHeaderListener=null}_listenToFilterHeaderChange(e,t){this._disposeFilterHeaderChangeListener();const n=e.unitId,o=e.subUnitId,l=e.getRange(),i={startColumn:t,startRow:l.startRow,endRow:l.startRow,endColumn:t};this._filterHeaderListener=this._refRangeService.watchRange(n,o,i,(s,a)=>{if(!a)this.terminate();else{const h=a.startColumn-s.startColumn;h!==0&&this._filterByModel.deltaCol(h)}})}async _setupByValues(e,t){this._disposePreviousModel();const n=e.getRange();if(n.startRow===n.endRow)return!1;const o=await _e.fromFilterColumn(this._injector,e,t);return this.filterByModel=o,this._filterBy$.next(u.FilterBy.VALUES),this._listenToFilterHeaderChange(e,t),!0}async _setupByColors(e,t){this._disposePreviousModel();const n=e.getRange();if(n.startRow===n.endRow)return!1;const o=await ge.fromFilterColumn(this._injector,e,t);return this.filterByModel=o,this._filterBy$.next(u.FilterBy.COLORS),this._listenToFilterHeaderChange(e,t),!0}_setupByConditions(e,t){this._disposePreviousModel();const n=e.getRange();if(n.startRow===n.endRow)return!1;const o=ve.fromFilterColumn(this._injector,e,t,e.getFilterColumn(t));return this.filterByModel=o,this._filterBy$.next(u.FilterBy.CONDITIONS),this._listenToFilterHeaderChange(e,t),!0}_disposePreviousModel(){var e;(e=this._filterByModel)==null||e.dispose(),this.filterByModel=null}};Q=fe([le(0,c.Inject(c.Injector)),le(1,c.Inject(y.RefRangeService))],Q);let ve=class extends c.Disposable{constructor(e,t,n,o,l){super();_(this,"canApply$",S.of(!0));_(this,"_conditionItem$");_(this,"conditionItem$");_(this,"_filterConditionFormParams$");_(this,"filterConditionFormParams$");this._filterModel=e,this.col=t,this._commandService=l,this._conditionItem$=new S.BehaviorSubject(n),this.conditionItem$=this._conditionItem$.asObservable(),this._filterConditionFormParams$=new S.BehaviorSubject(o),this.filterConditionFormParams$=this._filterConditionFormParams$.asObservable()}static fromFilterColumn(e,t,n,o){const[l,i]=f.testMappingFilterColumn(o==null?void 0:o.getColumnData());return e.createInstance(ve,t,n,l,i)}get conditionItem(){return this._conditionItem$.getValue()}get filterConditionFormParams(){return this._filterConditionFormParams$.getValue()}dispose(){super.dispose(),this._conditionItem$.complete(),this._filterConditionFormParams$.complete()}deltaCol(e){this.col+=e}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(u.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const e=f.mapToFilterColumn(this.conditionItem,this.filterConditionFormParams);return this._commandService.executeCommand(u.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:e})}onPrimaryConditionChange(e){const t=f.ALL_CONDITIONS.find(n=>n.operator===e);if(!t)throw new Error(`[ByConditionsModel]: condition item not found for operator: ${e}!`);this._conditionItem$.next(t),this._filterConditionFormParams$.next(f.getInitialFormParams(e))}onConditionFormChange(e){const t={...this.filterConditionFormParams,...e};if(t.and!==!0&&delete t.and,typeof e.and<"u"||typeof e.operator1<"u"||typeof e.operator2<"u"){const n=f.testMappingParams(t,this.conditionItem.numOfParameters);this._conditionItem$.next(n)}this._filterConditionFormParams$.next(t)}};ve=fe([le(4,c.ICommandService)],ve);let _e=class extends c.Disposable{constructor(e,t,n,o,l){super();_(this,"_rawFilterItems$");_(this,"rawFilterItems$");_(this,"filterItems$");_(this,"_filterItems",[]);_(this,"_treeMapCache");_(this,"canApply$");_(this,"_manuallyUpdateFilterItems$");_(this,"_searchString$");_(this,"searchString$");this._filterModel=e,this.col=t,this._commandService=l,this._treeMapCache=o,this._searchString$=new S.BehaviorSubject(""),this.searchString$=this._searchString$.asObservable(),this._rawFilterItems$=new S.BehaviorSubject(n),this.rawFilterItems$=this._rawFilterItems$.asObservable(),this._manuallyUpdateFilterItems$=new S.Subject,this.filterItems$=S.merge(S.combineLatest([this._searchString$.pipe(S.throttleTime(500,void 0,{leading:!0,trailing:!0}),S.startWith(void 0)),this._rawFilterItems$]).pipe(S.map(([i,s])=>{if(!i)return s;const h=i.toLowerCase().split(/\s+/).filter(m=>!!m);return He(s,h)})),this._manuallyUpdateFilterItems$).pipe(S.shareReplay(1)),this.canApply$=this.filterItems$.pipe(S.map(i=>Ie(i).checked>0)),this.disposeWithMe(this.filterItems$.subscribe(i=>this._filterItems=i))}static async fromFilterColumn(e,t,n){const o=e.get(c.IUniverInstanceService),l=e.get(c.LocaleService),i=e.get(pe,c.Quantity.OPTIONAL),{unitId:s,subUnitId:a}=t,h=o.getUniverSheetInstance(s);if(!h)throw new Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${s}!`);const m=h==null?void 0:h.getSheetBySheetId(a);if(!m)throw new Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${s} and subUnitId: ${a}!`);const p=t.getRange(),O=n,v=t.getFilterColumn(n),T=v==null?void 0:v.getColumnData().filters,I=new Set(T==null?void 0:T.filters),P=!!(T&&T.blank),A=t.getFilteredOutRowsExceptCol(n),M={...p,startRow:p.startRow+1,startColumn:O,endColumn:O};let L,U;if(i){const B=await i.getFilterValues({unitId:s,subUnitId:a,filteredOutRowsByOtherColumns:Array.from(A),filterColumn:v,filters:!!T,blankChecked:P,iterateRange:M,alreadyChecked:Array.from(I)});L=B.filterTreeItems,U=B.filterTreeMapCache}else{const B=ke(!!T,l,M,m,A,v,I,P,h.getStyles());L=B.filterTreeItems,U=B.filterTreeMapCache}return e.createInstance(_e,t,n,L,U)}get rawFilterItems(){return this._rawFilterItems$.getValue()}get filterItems(){return this._filterItems}get treeMapCache(){return this._treeMapCache}dispose(){this._rawFilterItems$.complete(),this._searchString$.complete()}deltaCol(e){this.col+=e}setSearchString(e){this._searchString$.next(e)}onCheckAllToggled(e){const t=c.Tools.deepClone(this._filterItems);t.forEach(n=>ae(n,e)),this._manuallyUpdateFilterItems(t)}onFilterCheckToggled(e){const t=c.Tools.deepClone(this._filterItems),n=ye(t,e.key);if(!n)return;const o=De(n);ae(n,!o),this._manuallyUpdateFilterItems(t)}onFilterOnly(e){const t=c.Tools.deepClone(this._filterItems);t.forEach(n=>ae(n,!1)),e.forEach(n=>{const o=ye(t,n);o&&ae(o,!0)}),this._manuallyUpdateFilterItems(t)}_manuallyUpdateFilterItems(e){this._manuallyUpdateFilterItems$.next(e)}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(u.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const e=Ie(this._filterItems),{checked:t,checkedItems:n}=e,o=this.rawFilterItems;let l=0;for(const h of o)l+=h.count;const i=t===0,s=e.checked===l,a={colId:this.col};if(i)throw new Error("[ByValuesModel]: no checked items!");if(s)return this._commandService.executeCommand(u.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null});{a.filters={};const h=n.filter(p=>p.key!=="empty");h.length>0&&(a.filters={filters:h.flatMap(p=>p.originValues?Array.from(p.originValues):[p.title])}),h.length!==n.length&&(a.filters.blank=!0)}return this._commandService.executeCommand(u.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:a})}};_e=fe([le(4,c.ICommandService)],_e);let ge=class extends c.Disposable{constructor(e,t,n,o,l){super();_(this,"canApply$",S.of(!0));_(this,"_cellFillColors$");_(this,"cellFillColors$");_(this,"_cellTextColors$");_(this,"cellTextColors$");this._filterModel=e,this.col=t,this._commandService=l,this._cellFillColors$=new S.BehaviorSubject(Array.from(n.values())),this.cellFillColors$=this._cellFillColors$.asObservable(),this._cellTextColors$=new S.BehaviorSubject(Array.from(o.values())),this.cellTextColors$=this._cellTextColors$.asObservable()}static async fromFilterColumn(e,t,n){var M,L,U;const o=e.get(c.IUniverInstanceService),{unitId:l,subUnitId:i}=t,s=o.getUniverSheetInstance(l);if(!s)throw new Error(`[ByColorsModel]: Workbook not found for filter model with unitId: ${l}!`);const a=s==null?void 0:s.getSheetBySheetId(i);if(!a)throw new Error(`[ByColorsModel]: Worksheet not found for filter model with unitId: ${l} and subUnitId: ${i}!`);const h=t.getRange(),m=n,p=(M=t.getFilterColumn(n))==null?void 0:M.getColumnData().colorFilters,O=t.getFilteredOutRowsExceptCol(n),v={...h,startRow:h.startRow+1,startColumn:m,endColumn:m},T=new Map,I=new Set((L=p==null?void 0:p.cellFillColors)!=null?L:[]),P=new Map,A=new Set((U=p==null?void 0:p.cellTextColors)!=null?U:[]);for(const B of a.iterateByColumn(v,!1,!0)){const{row:Y,col:q,value:oe}=B;if(O.has(Y))continue;const H=a.getComposedCellStyleByCellData(Y,q,oe);if(H.bg&&H.bg.rgb){const b=new c.ColorKit(H.bg.rgb).toRgbString();T.has(b)||T.set(b,{color:b,checked:I.has(b)})}else T.set("default-fill-color",{color:null,checked:I.has(null)});if(H.cl&&H.cl.rgb){const b=new c.ColorKit(H.cl.rgb).toRgbString();P.has(b)||P.set(b,{color:b,checked:A.has(b)})}else P.set("default-font-color",{color:K.COLOR_BLACK_RGB,checked:A.has(K.COLOR_BLACK_RGB)})}return e.createInstance(ge,t,n,T,P)}get cellFillColors(){return this._cellFillColors$.getValue()}get cellTextColors(){return this._cellTextColors$.getValue()}dispose(){super.dispose(),this._cellFillColors$.complete()}deltaCol(e){this.col+=e}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(u.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}onFilterCheckToggled(e,t=!0){const n=t?this.cellFillColors:this.cellTextColors,o=[];let l=!1;for(let i=0;i<n.length;i++){const s=n[i];if(s.color===e.color){l=!0,o.push({color:s.color,checked:!s.checked});continue}o.push({color:s.color,checked:s.checked})}l&&(this._resetColorsCheckedStatus(!t),t?this._cellFillColors$.next([...o]):this._cellTextColors$.next([...o]))}_resetColorsCheckedStatus(e=!0){const t=e?this.cellFillColors:this.cellTextColors,n=[];for(let o=0;o<t.length;o++)n.push({color:t[o].color,checked:!1});e?this._cellFillColors$.next([...n]):this._cellTextColors$.next([...n])}async apply(){if(this._disposed)return!1;const e=this.cellFillColors.filter(o=>o.checked).map(o=>o.color),t=this.cellTextColors.filter(o=>o.checked).map(o=>o.color);if(e.length===0&&t.length===0)return this._commandService.executeCommand(u.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null});const n={colId:this.col};return e.length>0?n.colorFilters={cellFillColors:e}:t.length>0&&(n.colorFilters={cellTextColors:t}),this._commandService.executeCommand(u.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:n})}};ge=fe([le(4,c.ICommandService)],ge);const ee="FILTER_PANEL_OPENED",ce={id:"sheet.operation.open-filter-panel",type:c.CommandType.OPERATION,handler:(r,e)=>{const t=r.get(c.IContextService),n=r.get(u.SheetsFilterService),o=r.get(Q),l=r.get(c.ICommandService),i=r.has($.IEditorBridgeService)?r.get($.IEditorBridgeService):null;i!=null&&i.isVisible().visible&&l.syncExecuteCommand($.SetCellEditVisibleOperation.id,{visible:!1});const{unitId:s,subUnitId:a,col:h}=e,m=n.getFilterModel(s,a);return m?(o.setupCol(m,h),t.getContextValue(ee)||t.setContextValue(ee,!0),!0):!1}},te={id:"sheet.operation.close-filter-panel",type:c.CommandType.OPERATION,handler:r=>{const e=r.get(c.IContextService),t=r.get(Q),n=r.get(g.ILayoutService,c.Quantity.OPTIONAL);return e.getContextValue(ee)?(e.setContextValue(ee,!1),n==null||n.focus(),t.terminate()):!1}},Pe={id:"sheet.operation.apply-filter",type:c.CommandType.OPERATION,handler:(r,e)=>{const{filterBy:t}=e;return r.get(Q).changeFilterBy(t)}},xe="sheets-filter-ui.config",Ce={};var ct=Object.getOwnPropertyDescriptor,ut=(r,e,t,n)=>{for(var o=n>1?void 0:n?ct(e,t):e,l=r.length-1,i;l>=0;l--)(i=r[l])&&(o=i(o)||o);return o},re=(r,e)=>(t,n)=>e(t,n,r);let ie=class extends c.Disposable{constructor(r,e,t,n,o,l){super(),this._sheetsFilterService=r,this._localeService=e,this._commandService=t,this._sheetPermissionCheckPermission=n,this._injector=o,this._sheetsSelectionService=l,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(r=>{var e,t,n;if(r.id===u.SmartToggleSheetsFilterCommand.id){const o=this._injector.get(c.IUniverInstanceService),l=y.getSheetCommandTarget(o);if(!l)return;const{unitId:i,subUnitId:s,worksheet:a}=l,h=(e=this._sheetsFilterService.getFilterModel(i,s))==null?void 0:e.getRange();let m;if(h)m=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[y.RangeProtectionPermissionViewPoint],worksheetTypes:[y.WorksheetFilterPermission,y.WorksheetViewPermission]},[h],i,s);else{const p=(t=this._sheetsSelectionService.getCurrentLastSelection())==null?void 0:t.range;if(p){let O={...p};O=p.startColumn===p.endColumn&&p.startRow===p.endRow?y.expandToContinuousRange(O,{left:!0,right:!0,up:!0,down:!0},a):O,m=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[y.RangeProtectionPermissionViewPoint],worksheetTypes:[y.WorksheetViewPermission,y.WorksheetFilterPermission]},[O],i,s)}else m=this._sheetPermissionCheckPermission.permissionCheckWithoutRange({rangeTypes:[y.RangeProtectionPermissionViewPoint],worksheetTypes:[y.WorksheetViewPermission,y.WorksheetFilterPermission]})}m||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr"))}if(r.id===ce.id){const o=r.params,{unitId:l,subUnitId:i}=o,s=(n=this._sheetsFilterService.getFilterModel(l,i))==null?void 0:n.getRange(),a=c.Tools.deepClone(s);a&&(a.startColumn=o.col,a.endColumn=o.col,this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[y.RangeProtectionPermissionViewPoint],worksheetTypes:[y.WorksheetFilterPermission,y.WorksheetViewPermission]},[a],l,i)||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr")))}}))}};ie=ut([re(0,c.Inject(u.SheetsFilterService)),re(1,c.Inject(c.LocaleService)),re(2,c.ICommandService),re(3,c.Inject(y.SheetPermissionCheckController)),re(4,c.Inject(c.Injector)),re(5,c.Inject(y.SheetsSelectionsService))],ie);const G=16,ht=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 We{static drawNoCriteria(e,t,n,o){e.save(),K.Rect.drawWith(e,{radius:2,width:G,height:G,fill:o}),e.lineCap="square",e.strokeStyle=n,e.scale(t/G,t/G),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,t,n,o){e.save(),K.Rect.drawWith(e,{radius:2,width:G,height:G,fill:o}),e.scale(t/G,t/G),e.fillStyle=n,e.fill(ht),e.restore()}}var dt=Object.getOwnPropertyDescriptor,mt=(r,e,t,n)=>{for(var o=n>1?void 0:n?dt(e,t):e,l=r.length-1,i;l>=0;l--)(i=r[l])&&(o=i(o)||o);return o},Ae=(r,e)=>(t,n)=>e(t,n,r);const x=16,ue=1;let we=class extends K.Shape{constructor(e,t,n,o,l){super(e,t);_(this,"_cellWidth",0);_(this,"_cellHeight",0);_(this,"_filterParams");_(this,"_hovered",!1);this._contextService=n,this._commandService=o,this._themeService=l,this.setShapeProps(t),this.onPointerDown$.subscribeEvent(i=>this.onPointerDown(i)),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 t=this._cellHeight,n=this._cellWidth,o=x-n,l=x-t;e.save();const i=new Path2D;i.rect(o,l,n,t),e.clip(i);const{hasCriteria:s}=this._filterParams,a=this._themeService.getColorFromTheme("primary.600"),h=this._hovered?this._themeService.getColorFromTheme("gray.50"):"rgba(255, 255, 255, 1.0)";s?We.drawHasCriteria(e,x,a,h):We.drawNoCriteria(e,x,a,h),e.restore()}onPointerDown(e){if(e.button===2)return;const{col:t,unitId:n,subUnitId:o}=this._filterParams;this._contextService.getContextValue(ee)||!this._commandService.hasCommand(ce.id)||setTimeout(()=>{this._commandService.executeCommand(ce.id,{unitId:n,subUnitId:o,col:t})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};we=mt([Ae(2,c.IContextService),Ae(3,c.ICommandService),Ae(4,c.Inject(c.ThemeService))],we);var pt=Object.getOwnPropertyDescriptor,ft=(r,e,t,n)=>{for(var o=n>1?void 0:n?pt(e,t):e,l=r.length-1,i;l>=0;l--)(i=r[l])&&(o=i(o)||o);return o},z=(r,e)=>(t,n)=>e(t,n,r);const vt=1e3,_t=5e3;function gt(r,e,t,n){switch(n){case c.VerticalAlign.TOP:return r+ue;case c.VerticalAlign.MIDDLE:return r+Math.max(0,(t-x)/2);case c.VerticalAlign.BOTTOM:default:return e-x-ue}}let Re=class extends c.RxDisposable{constructor(e,t,n,o,l,i,s,a){super();_(this,"_filterRangeShape",null);_(this,"_buttonRenderDisposable",null);_(this,"_filterButtonShapes",[]);this._context=e,this._injector=t,this._sheetSkeletonManagerService=n,this._sheetsFilterService=o,this._themeService=l,this._sheetInterceptorService=i,this._commandService=s,this._selectionRenderService=a,this._initRenderer()}dispose(){super.dispose(),this._disposeRendering()}_initRenderer(){this._sheetSkeletonManagerService.currentSkeleton$.pipe(S.switchMap(e=>{var s,a;if(!e)return S.of(null);const{unit:t,unitId:n}=this._context,o=((s=t.getActiveSheet())==null?void 0:s.getSheetId())||"",l=(a=this._sheetsFilterService.getFilterModel(n,o))!=null?a:void 0,i=()=>({unitId:n,worksheetId:o,filterModel:l,range:l==null?void 0:l.getRange(),skeleton:e.skeleton});return c.fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(S.filter(([h])=>{var m;return h.type===c.CommandType.MUTATION&&((m=h.params)==null?void 0:m.unitId)===t.getUnitId()&&(u.FILTER_MUTATIONS.has(h.id)||h.id===y.SetRangeValuesMutation.id)}),S.throttleTime(20,void 0,{leading:!1,trailing:!0}),S.map(i),S.startWith(i()))}),S.takeUntil(this.dispose$)).subscribe(e=>{this._disposeRendering(),!(!e||!e.range)&&(this._renderRange(e.range,e.skeleton),this._renderButtons(e))})}_renderRange(e,t){const{scene:n}=this._context,{rowHeaderWidth:o,columnHeaderHeight:l}=t,i=this._filterRangeShape=new $.SelectionControl(n,vt,this._themeService,{rowHeaderWidth:o,columnHeaderHeight:l,enableAutoFill:!1,highlightHeader:!1}),s={range:e,primary:null,style:{fill:"rgba(0, 0, 0, 0.0)"}},a=$.attachSelectionWithCoord(s,t);i.updateRangeBySelectionWithCoord(a),i.setEvent(!1),n.makeDirty(!0)}_renderButtons(e){const{range:t,filterModel:n,unitId:o,skeleton:l,worksheetId:i}=e,{unit:s,scene:a}=this._context,h=s.getSheetBySheetId(i);if(!h)return;this._interceptCellContent(o,i,e.range);const{startColumn:m,endColumn:p,startRow:O}=t;for(let v=m;v<=p;v++){const T=`sheets-filter-button-${v}`,I=$.getCoordByCell(O,v,a,l),P=h.getComposedCellStyle(O,v),A=(P==null?void 0:P.vt)||c.VerticalAlign.BOTTOM,{startX:M,startY:L,endX:U,endY:B}=I,Y=U-M,q=B-L;if(q<=ue||Y<=ue)continue;const oe=!!n.getFilterColumn(v),H=U-x-ue,b=gt(L,B,q,A),$e={left:H,top:b,height:x,width:x,zIndex:_t,cellHeight:q,cellWidth:Y,filterParams:{unitId:o,subUnitId:i,col:v,hasCriteria:oe}},Ee=this._injector.createInstance(we,T,$e);this._filterButtonShapes.push(Ee)}a.addObjects(this._filterButtonShapes),a.makeDirty()}_interceptCellContent(e,t,n){const{startRow:o,startColumn:l,endColumn:i}=n;this._buttonRenderDisposable=this._sheetInterceptorService.intercept(y.INTERCEPTOR_POINT.CELL_CONTENT,{effect:c.InterceptorEffectEnum.Style,handler:(s,a,h)=>{const{row:m,col:p,unitId:O,subUnitId:v}=a;return O!==e||v!==t||m!==o||p<l||p>i||((!s||s===a.rawData)&&(s={...a.rawData}),s.fontRenderExtension={...s==null?void 0:s.fontRenderExtension,rightOffset:x}),h(s)},priority:10})}_disposeRendering(){var e,t;(e=this._filterRangeShape)==null||e.dispose(),this._filterButtonShapes.forEach(n=>n.dispose()),(t=this._buttonRenderDisposable)==null||t.dispose(),this._filterRangeShape=null,this._buttonRenderDisposable=null,this._filterButtonShapes=[]}};Re=ft([z(1,c.Inject(c.Injector)),z(2,c.Inject($.SheetSkeletonManagerService)),z(3,c.Inject(u.SheetsFilterService)),z(4,c.Inject(c.ThemeService)),z(5,c.Inject(y.SheetInterceptorService)),z(6,c.ICommandService),z(7,$.ISheetSelectionRenderService)],Re);var Ct=Object.getOwnPropertyDescriptor,St=(r,e,t,n)=>{for(var o=n>1?void 0:n?Ct(e,t):e,l=r.length-1,i;l>=0;l--)(i=r[l])&&(o=i(o)||o);return o},Ve=(r,e)=>(t,n)=>e(t,n,r);let he=class extends c.RxDisposable{constructor(r,e){super(),this._renderManagerService=r,this._sheetsRenderService=e,[u.SetSheetsFilterRangeMutation,u.SetSheetsFilterCriteriaMutation,u.RemoveSheetsFilterMutation,u.ReCalcSheetsFilterMutation].forEach(t=>this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(t.id))),this.disposeWithMe(this._renderManagerService.registerRenderModule(c.UniverInstanceType.UNIVER_SHEET,[Re]))}};he=St([Ve(0,K.IRenderManagerService),Ve(1,c.Inject($.SheetsRenderService))],he);var Tt=Object.defineProperty,Et=Object.getOwnPropertyDescriptor,Ot=(r,e,t)=>e in r?Tt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,It=(r,e,t,n)=>{for(var o=n>1?void 0:n?Et(e,t):e,l=r.length-1,i;l>=0;l--)(i=r[l])&&(o=i(o)||o);return o},je=(r,e)=>(t,n)=>e(t,n,r),Qe=(r,e,t)=>Ot(r,typeof e!="symbol"?e+"":e,t);const Ft="SHEET_FILTER_UI_PLUGIN";C.UniverSheetsFilterMobileUIPlugin=class extends c.Plugin{constructor(e=Ce,t,n){super(),this._config=e,this._injector=t,this._configService=n;const{menu:o,...l}=c.merge({},Ce,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(xe,l)}onStarting(){[[ie],[he]].forEach(e=>this._injector.add(e))}onReady(){this._injector.get(ie)}onRendered(){this._injector.get(he)}},Qe(C.UniverSheetsFilterMobileUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),Qe(C.UniverSheetsFilterMobileUIPlugin,"pluginName",Ft),C.UniverSheetsFilterMobileUIPlugin=It([c.DependentOn(u.UniverSheetsFilterPlugin),je(1,c.Inject(c.Injector)),je(2,c.IConfigService)],C.UniverSheetsFilterMobileUIPlugin);function ne({ref:r,...e}){const{icon:t,id:n,className:o,extend:l,...i}=e,s=`univerjs-icon univerjs-icon-${n} ${o||""}`.trim(),a=F.useRef(`_${yt()}`);return Ge(t,`${n}`,{defIds:t.defIds,idSuffix:a.current},{ref:r,className:s,...i},l)}function Ge(r,e,t,n,o){return F.createElement(r.tag,{key:e,...Nt(r,t,o),...n},(bt(r,t).children||[]).map((l,i)=>Ge(l,`${e}-${r.tag}-${i}`,t,void 0,o)))}function Nt(r,e,t){const n={...r.attrs};t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1),r.tag==="mask"&&n.id&&(n.id=n.id+e.idSuffix),Object.entries(n).forEach(([l,i])=>{l==="mask"&&typeof i=="string"&&(n[l]=i.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))});const{defIds:o}=e;return!o||o.length===0||(r.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(([l,i])=>{typeof i=="string"&&(n[l]=i.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))})),n}function bt(r,e){var n;const{defIds:t}=e;return!t||t.length===0?r:r.tag==="defs"&&((n=r.children)!=null&&n.length)?{...r,children:r.children.map(o=>typeof o.attrs.id=="string"&&t&&t.includes(o.attrs.id)?{...o,attrs:{...o.attrs,id:o.attrs.id+e.idSuffix}}:o)}:r}function yt(){return Math.random().toString(36).substring(2,8)}ne.displayName="UniverIcon";const Pt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M10 1.05957C10.356 1.05957 10.6816 1.26162 10.8408 1.58008L18.8408 17.5801L18.8799 17.668C19.0486 18.1134 18.8551 18.6232 18.4199 18.8408C17.9557 19.0727 17.3913 18.8841 17.1592 18.4199L10 4.10156L2.84082 18.4199C2.60871 18.8841 2.04434 19.0727 1.58008 18.8408C1.11587 18.6087 0.92731 18.0443 1.15918 17.5801L9.15918 1.58008C9.31841 1.26162 9.64395 1.05957 10 1.05957Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M15.3337 11.7261L15.4294 11.731C15.9035 11.779 16.2732 12.1798 16.2732 12.6665C16.2732 13.1532 15.9035 13.554 15.4294 13.602L15.3337 13.6069H4.66675C4.1476 13.6069 3.72632 13.1856 3.72632 12.6665C3.72632 12.1474 4.1476 11.7261 4.66675 11.7261H15.3337Z"}}]},Ye=F.forwardRef(function(e,t){return F.createElement(ne,Object.assign({},e,{id:"a-icon",ref:t,icon:Pt}))});Ye.displayName="AIcon";const At={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M17.0596 10C17.0596 6.10087 13.8992 2.94043 10 2.94043C6.10087 2.94043 2.94043 6.10087 2.94043 10C2.94043 13.8992 6.10087 17.0596 10 17.0596C13.8992 17.0596 17.0596 13.8992 17.0596 10ZM18.9404 10C18.9404 14.9374 14.9374 18.9404 10 18.9404C5.06257 18.9404 1.05957 14.9374 1.05957 10C1.05957 5.06257 5.06257 1.05957 10 1.05957C14.9374 1.05957 18.9404 5.06257 18.9404 10Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.29492 4.13476C4.63911 3.79057 5.1845 3.76906 5.55371 4.07031L5.625 4.13476L16.0244 14.5352L16.0889 14.6064C16.3902 14.9757 16.3686 15.52 16.0244 15.8643C15.6573 16.2313 15.0624 16.2313 14.6953 15.8643L4.29492 5.46484L4.23047 5.39355C3.92922 5.02434 3.95073 4.47895 4.29492 4.13476Z"}}]},qe=F.forwardRef(function(e,t){return F.createElement(ne,Object.assign({},e,{id:"ban-icon",ref:t,icon:At}))});qe.displayName="BanIcon";const wt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.32182 2.60967C2.98161 2.60967 2.79671 3.0074 3.01601 3.2675L6.85819 7.8246C6.94943 7.93282 6.99947 8.06981 6.99947 8.21136V12.7338C6.99947 12.898 7.0998 13.0455 7.2525 13.1058L8.73833 13.6928C9.00085 13.7965 9.28531 13.6031 9.28531 13.3208V8.21136C9.28531 8.06981 9.33535 7.93282 9.42659 7.8246L13.2688 3.2675C13.4881 3.0074 13.3032 2.60967 12.963 2.60967H3.32182ZM2.09858 4.04101C1.22139 3.0006 1.96097 1.40967 3.32182 1.40967H12.963C14.3238 1.40967 15.0634 3.0006 14.1862 4.04101L10.4853 8.43054V13.3208C10.4853 14.4498 9.34747 15.2237 8.29742 14.8089L6.81158 14.2219C6.20078 13.9806 5.79947 13.3905 5.79947 12.7338V8.43054L2.09858 4.04101Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ze=F.forwardRef(function(e,t){return F.createElement(ne,Object.assign({},e,{id:"filter-icon",ref:t,icon:wt}))});Ze.displayName="FilterIcon";const Rt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.00016 1.33203C6.68162 1.33203 5.39269 1.72302 4.29636 2.45557C3.20004 3.18811 2.34555 4.2293 1.84097 5.44747C1.33638 6.66565 1.20436 8.00609 1.4616 9.2993C1.71883 10.5925 2.35377 11.7804 3.28612 12.7127C4.21847 13.6451 5.40636 14.28 6.69956 14.5373C7.99277 14.7945 9.33321 14.6625 10.5514 14.1579C11.7696 13.6533 12.8108 12.7988 13.5433 11.7025C14.2758 10.6062 14.6668 9.31724 14.6668 7.9987C14.6649 6.23118 13.9619 4.53662 12.7121 3.2868C11.4622 2.03697 9.76768 1.33397 8.00016 1.33203ZM7.66683 3.9987C7.86461 3.9987 8.05795 4.05735 8.2224 4.16723C8.38685 4.27711 8.51502 4.43329 8.59071 4.61601C8.6664 4.79874 8.6862 4.99981 8.64762 5.19379C8.60903 5.38777 8.51379 5.56595 8.37394 5.7058C8.23409 5.84566 8.0559 5.9409 7.86192 5.97948C7.66794 6.01807 7.46687 5.99826 7.28415 5.92258C7.10142 5.84689 6.94524 5.71872 6.83536 5.55427C6.72548 5.38982 6.66683 5.19648 6.66683 4.9987C6.66683 4.73348 6.77219 4.47913 6.95972 4.29159C7.14726 4.10405 7.40162 3.9987 7.66683 3.9987ZM9.3335 11.332H6.66683C6.49002 11.332 6.32045 11.2618 6.19543 11.1368C6.0704 11.0117 6.00016 10.8422 6.00016 10.6654C6.00016 10.4886 6.0704 10.319 6.19543 10.194C6.32045 10.0689 6.49002 9.9987 6.66683 9.9987H7.3335V7.9987H6.66683C6.49002 7.9987 6.32045 7.92846 6.19543 7.80343C6.0704 7.67841 6.00016 7.50884 6.00016 7.33203C6.00016 7.15522 6.0704 6.98565 6.19543 6.86063C6.32045 6.7356 6.49002 6.66536 6.66683 6.66536H8.00016C8.17698 6.66536 8.34655 6.7356 8.47157 6.86063C8.59659 6.98565 8.66683 7.15522 8.66683 7.33203V9.9987H9.3335C9.51031 9.9987 9.67988 10.0689 9.8049 10.194C9.92993 10.319 10.0002 10.4886 10.0002 10.6654C10.0002 10.8422 9.92993 11.0117 9.8049 11.1368C9.67988 11.2618 9.51031 11.332 9.3335 11.332Z"}}]},Ke=F.forwardRef(function(e,t){return F.createElement(ne,Object.assign({},e,{id:"info-icon",ref:t,icon:Rt}))});Ke.displayName="InfoIcon";const Lt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15ZM11.7245 6.42417C11.9588 6.18985 11.9588 5.80995 11.7245 5.57564C11.4901 5.34132 11.1102 5.34132 10.8759 5.57564L7.3002 9.15137L5.72446 7.57564C5.49014 7.34132 5.11025 7.34132 4.87593 7.57564C4.64162 7.80995 4.64162 8.18985 4.87593 8.42417L6.87593 10.4242C7.11025 10.6585 7.49014 10.6585 7.72446 10.4242L11.7245 6.42417Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ze=F.forwardRef(function(e,t){return F.createElement(ne,Object.assign({},e,{id:"success-icon",ref:t,icon:Lt}))});ze.displayName="SuccessIcon";function $t(r){const{model:e}=r,t=g.useDependency(c.LocaleService),n=g.useObservable(e.cellFillColors$,[],!0),o=g.useObservable(e.cellTextColors$,[],!0),l=F.useCallback(s=>{e.onFilterCheckToggled(s)},[e]),i=F.useCallback(s=>{e.onFilterCheckToggled(s,!1)},[e]);return d.jsx("div",{"data-u-comp":"sheets-filter-panel-colors-container",className:"univer-flex univer-h-full univer-min-h-[300px] univer-flex-col",children:d.jsxs("div",{"data-u-comp":"sheets-filter-panel",className:N.clsx("univer-mt-2 univer-box-border univer-flex univer-h-[300px] univer-flex-grow univer-flex-col univer-gap-4 univer-overflow-auto univer-rounded-md univer-px-2 univer-py-2.5",N.borderClassName),children:[n.length>1&&d.jsxs("div",{children:[d.jsx("div",{className:"univer-mb-2 univer-text-sm univer-text-gray-900 dark:!univer-text-white",children:t.t("sheets-filter.panel.filter-by-cell-fill-color")}),d.jsx("div",{className:"univer-grid univer-grid-cols-8 univer-items-center univer-justify-start univer-gap-2",children:n.map((s,a)=>d.jsxs("div",{className:"univer-relative univer-size-6",onClick:()=>l(s),children:[s.color?d.jsx("button",{type:"button",className:N.clsx("univer-box-border univer-size-6 univer-cursor-pointer univer-rounded-full univer-border univer-border-solid univer-border-transparent univer-bg-gray-300 univer-transition-shadow hover:univer-ring-2 hover:univer-ring-offset-2 hover:univer-ring-offset-white"),style:{backgroundColor:s.color}}):d.jsx(qe,{className:"univer-size-6 univer-cursor-pointer univer-rounded-full hover:univer-ring-2 hover:univer-ring-offset-2 hover:univer-ring-offset-white"}),s.checked&&d.jsx(Xe,{})]},`sheets-filter-cell-fill-color-${a}`))})]}),o.length>1&&d.jsxs("div",{children:[d.jsx("div",{className:"univer-mb-2 univer-text-sm univer-text-gray-900 dark:!univer-text-white",children:t.t("sheets-filter.panel.filter-by-cell-text-color")}),d.jsx("div",{className:"univer-grid univer-grid-cols-8 univer-items-center univer-justify-start univer-gap-2",children:o.map((s,a)=>d.jsxs("div",{className:"univer-relative univer-size-6",onClick:()=>i(s),children:[d.jsx("div",{className:"univer-box-border univer-flex univer-size-full univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-full univer-border univer-border-solid univer-border-[rgba(13,13,13,0.06)] univer-p-0.5 hover:univer-ring-2 hover:univer-ring-offset-2 hover:univer-ring-offset-white dark:!univer-border-[rgba(255,255,255,0.06)]",children:d.jsx(Ye,{style:{color:s.color}})}),s.checked&&d.jsx(Xe,{})]},`sheets-filter-cell-text-color-${a}`))})]}),n.length<=1&&o.length<=1&&d.jsx("div",{className:"univer-flex univer-size-full univer-items-center univer-justify-center univer-text-sm univer-text-gray-900 dark:!univer-text-gray-200",children:t.t("sheets-filter.panel.filter-by-color-none")})]})})}function Xe(){return d.jsx("div",{className:"univer-absolute -univer-bottom-0.5 -univer-right-0.5 univer-flex univer-size-3 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-full univer-bg-white",children:d.jsx(ze,{className:"univer-size-full univer-font-bold univer-text-[#418F1F]"})})}function Mt(r){var v,T;const{model:e}=r,t=g.useDependency(c.LocaleService),n=g.useObservable(e.conditionItem$,void 0),o=g.useObservable(e.filterConditionFormParams$,void 0),l=o!=null&&o.and?"AND":"OR",i=F.useCallback(I=>{e.onConditionFormChange({and:I==="AND"})},[e]),s=Ut(t),a=F.useCallback(I=>{e.onPrimaryConditionChange(I)},[e]),h=kt(t),m=F.useCallback(I=>{e.onConditionFormChange(I)},[e]),p=t.t("sheets-filter.panel.input-values-placeholder");function O(I,P,A){const M=f.getItemByOperator(I).numOfParameters===1;return d.jsxs(d.Fragment,{children:[A==="operator2"&&d.jsxs(N.RadioGroup,{value:l,onChange:i,children:[d.jsx(N.Radio,{value:"AND",children:t.t("sheets-filter.panel.and")}),d.jsx(N.Radio,{value:"OR",children:t.t("sheets-filter.panel.or")})]}),d.jsx(N.Select,{value:I,options:h,onChange:L=>m({[A]:L})}),M&&d.jsx("div",{children:d.jsx(N.Input,{className:"univer-mt-2",value:P,placeholder:p,onChange:L=>m({[A==="operator1"?"val1":"val2"]:L})})})]})}return d.jsx("div",{"data-u-comp":"sheets-filter-panel-conditions-container",className:"univer-flex univer-h-full univer-min-h-[300px] univer-flex-col",children:n&&o&&d.jsxs(d.Fragment,{children:[d.jsx(N.Select,{value:n.operator,options:s,onChange:a}),f.getItemByOperator(n.operator).numOfParameters!==0?d.jsxs("div",{"data-u-comp":"sheets-filter-panel-conditions-container-inner",className:N.clsx("univer-mt-2 univer-flex-grow univer-overflow-hidden univer-rounded-md univer-p-2",N.borderClassName),children:[n.numOfParameters>=1&&O(o.operator1,(v=o.val1)!=null?v:"","operator1"),n.numOfParameters>=2&&O(o.operator2,(T=o.val2)!=null?T:"","operator2"),d.jsxs("div",{"data-u-comp":"sheets-filter-panel-conditions-desc",className:"univer-mt-2 univer-text-xs univer-text-gray-500",children:[t.t("sheets-filter.panel.?"),d.jsx("br",{}),t.t("sheets-filter.panel.*")]})]}):null]})})}function Ut(r){const e=r.getCurrentLocale();return F.useMemo(()=>[{options:[{label:r.t(f.NONE.label),value:f.NONE.operator}]},{options:[{label:r.t(f.EMPTY.label),value:f.EMPTY.operator},{label:r.t(f.NOT_EMPTY.label),value:f.NOT_EMPTY.operator}]},{options:[{label:r.t(f.TEXT_CONTAINS.label),value:f.TEXT_CONTAINS.operator},{label:r.t(f.DOES_NOT_CONTAIN.label),value:f.DOES_NOT_CONTAIN.operator},{label:r.t(f.STARTS_WITH.label),value:f.STARTS_WITH.operator},{label:r.t(f.ENDS_WITH.label),value:f.ENDS_WITH.operator},{label:r.t(f.EQUALS.label),value:f.EQUALS.operator}]},{options:[{label:r.t(f.GREATER_THAN.label),value:f.GREATER_THAN.operator},{label:r.t(f.GREATER_THAN_OR_EQUAL.label),value:f.GREATER_THAN_OR_EQUAL.operator},{label:r.t(f.LESS_THAN.label),value:f.LESS_THAN.operator},{label:r.t(f.LESS_THAN_OR_EQUAL.label),value:f.LESS_THAN_OR_EQUAL.operator},{label:r.t(f.EQUAL.label),value:f.EQUAL.operator},{label:r.t(f.NOT_EQUAL.label),value:f.NOT_EQUAL.operator},{label:r.t(f.BETWEEN.label),value:f.BETWEEN.operator},{label:r.t(f.NOT_BETWEEN.label),value:f.NOT_BETWEEN.operator}]},{options:[{label:r.t(f.CUSTOM.label),value:f.CUSTOM.operator}]}],[e,r])}function kt(r){const e=r.getCurrentLocale();return F.useMemo(()=>f.ALL_CONDITIONS.filter(t=>t.numOfParameters!==2).map(t=>({label:r.t(t.label),value:t.operator})),[e,r])}function Bt(r){const{model:e}=r,t=g.useDependency(c.LocaleService),n=g.useObservable(e.searchString$,"",!0),o=g.useObservable(e.filterItems$,void 0,!0),l=t.t("sheets-filter.panel.filter-only"),i=Ie(o),s=i.checked>0&&i.unchecked===0,a=i.checked>0&&i.unchecked>0,h=e.treeMapCache,m=F.useCallback(()=>{e.onCheckAllToggled(!s)},[e,s]),p=F.useCallback(v=>{e.setSearchString(v)},[e]);function O(v){let T=[];return v.forEach(I=>{I.checked&&T.push(I.key),I.children&&(T=T.concat(O(I.children)))}),T}return d.jsxs("div",{"data-u-comp":"sheets-filter-panel-values-container",className:"univer-flex univer-h-full univer-min-h-[300px] univer-flex-col",children:[d.jsx(N.Input,{autoFocus:!0,value:n,placeholder:t.t("sheets-filter.panel.search-placeholder"),onChange:p}),d.jsxs("div",{"data-u-comp":"sheets-filter-panel",className:N.clsx("univer-mt-2 univer-box-border univer-flex univer-flex-grow univer-flex-col univer-overflow-hidden univer-rounded-md univer-px-2 univer-py-2.5",N.borderClassName),children:[d.jsx("div",{"data-u-comp":"sheets-filter-panel-values-item",className:"univer-box-border univer-h-8 univer-w-full univer-py-0.5",children:d.jsxs("div",{"data-u-comp":"sheets-filter-panel-values-item-inner",className:"univer-box-border univer-flex univer-h-7 univer-items-center univer-rounded-md univer-py-0 univer-pl-5 univer-pr-0.5 univer-text-sm",children:[d.jsx(N.Checkbox,{indeterminate:a,disabled:o.length===0,checked:s,onChange:m}),d.jsx("span",{"data-u-comp":"sheets-filter-panel-values-item-text",className:"univer-mx-1 univer-inline-block univer-flex-shrink univer-truncate univer-text-gray-900 dark:!univer-text-white",children:`${t.t("sheets-filter.panel.select-all")}`}),d.jsx("span",{"data-u-comp":"sheets-filter-panel-values-item-count",className:"univer-text-gray-400 dark:!univer-text-gray-500",children:`(${i.checked}/${i.checked+i.unchecked})`})]})}),d.jsx("div",{"data-u-comp":"sheets-filter-panel-values-virtual",className:"univer-flex-grow",children:d.jsx(N.Tree,{data:o,defaultExpandAll:!1,valueGroup:O(o),onChange:v=>{e.onFilterCheckToggled(v)},defaultCache:h,itemHeight:28,treeNodeClassName:`
|
|
8
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/sheets-filter`),require(`@univerjs/sheets-ui`),require(`@univerjs/ui`),require(`@univerjs/engine-render`),require(`@univerjs/sheets`),require(`rxjs`),require(`@univerjs/rpc`),require(`@univerjs/design`),require(`react`),require(`react/jsx-runtime`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets-filter`,`@univerjs/sheets-ui`,`@univerjs/ui`,`@univerjs/engine-render`,`@univerjs/sheets`,`rxjs`,`@univerjs/rpc`,`@univerjs/design`,`react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsFilterUi={},e.UniverCore,e.UniverSheetsFilter,e.UniverSheetsUi,e.UniverUi,e.UniverEngineRender,e.UniverSheets,e.rxjs,e.UniverRpc,e.UniverDesign,e.React,e.React))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let f=function(e){return e[e.FIRST=0]=`FIRST`,e[e.SECOND=1]=`SECOND`,e}({}),p=function(e){return e.NONE=`none`,e.STARTS_WITH=`startsWith`,e.DOES_NOT_START_WITH=`doesNotStartWith`,e.ENDS_WITH=`endsWith`,e.DOES_NOT_END_WITH=`doesNotEndWith`,e.CONTAINS=`contains`,e.DOES_NOT_CONTAIN=`doesNotContain`,e.EQUALS=`equals`,e.NOT_EQUALS=`notEquals`,e.EMPTY=`empty`,e.NOT_EMPTY=`notEmpty`,e.BETWEEN=`between`,e.NOT_BETWEEN=`notBetween`,e.CUSTOM=`custom`,e}({}),m;(function(e){let r=e.NONE={label:`sheets-filter.conditions.none`,operator:p.NONE,order:f.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw Error(`[FilterConditionItems.NONE]: should not have initial form params!`)},testMappingParams:e=>e.operator1===p.NONE,mapToFilterColumn:()=>null,testMappingFilterColumn:e=>!e.customFilters&&!e.filters?{}:!1},i=e.ALL_CONDITIONS=[r,e.EMPTY={label:`sheets-filter.conditions.empty`,operator:p.EMPTY,order:f.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw Error(`[FilterConditionItems.EMPTY]: should not have initial form params!`)},testMappingParams:({operator1:e})=>e===p.EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:``}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0];return n.val===``&&n.operator===void 0?{operator1:p.EMPTY}:!1}},e.NOT_EMPTY={label:`sheets-filter.conditions.not-empty`,operator:p.NOT_EMPTY,order:f.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw Error(`[FilterConditionItems.NOT_EMPTY]: should not have initial form params!`)},testMappingParams:({operator1:e})=>e===p.NOT_EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:``,operator:n.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.val===` `&&r.operator===n.CustomFilterOperator.NOT_EQUALS?{operator1:p.NOT_EMPTY}:!1}},e.TEXT_CONTAINS={label:`sheets-filter.conditions.text-contains`,operator:p.CONTAINS,order:f.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:p.CONTAINS,val1:``}),testMappingParams:e=>{let[t]=h(e);return t===p.CONTAINS},mapToFilterColumn:e=>{let{val1:t}=e;return t===``?null:{customFilters:{customFilters:[{val:`*${t}*`}]}}},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0],r=n.val.toString();return!n.operator&&r.startsWith(`*`)&&r.endsWith(`*`)?{operator1:p.CONTAINS,val1:r.slice(1,-1)}:!1}},e.DOES_NOT_CONTAIN={label:`sheets-filter.conditions.does-not-contain`,operator:p.DOES_NOT_CONTAIN,order:f.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:p.DOES_NOT_CONTAIN,val1:``}),mapToFilterColumn:e=>({customFilters:{customFilters:[{val:`*${e.val1}*`,operator:n.CustomFilterOperator.NOT_EQUALS}]}}),testMappingParams:e=>{let[t]=h(e);return t===p.DOES_NOT_CONTAIN},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0],i=r.val.toString();return r.operator===n.CustomFilterOperator.NOT_EQUALS&&i.startsWith(`*`)&&i.endsWith(`*`)?{operator1:p.DOES_NOT_CONTAIN,val1:i.slice(1,-1)}:!1}},e.STARTS_WITH={label:`sheets-filter.conditions.starts-with`,operator:p.STARTS_WITH,order:f.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:p.STARTS_WITH,val1:``}),mapToFilterColumn:e=>({customFilters:{customFilters:[{val:`${e.val1}*`}]}}),testMappingParams:e=>{let[t]=h(e);return t===p.STARTS_WITH},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0],r=n.val.toString();return!n.operator&&r.endsWith(`*`)&&!r.startsWith(`*`)?{operator1:p.STARTS_WITH,val1:r.slice(0,-1)}:!1}},e.ENDS_WITH={label:`sheets-filter.conditions.ends-with`,operator:p.ENDS_WITH,order:f.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:p.ENDS_WITH,val1:``}),mapToFilterColumn:e=>({customFilters:{customFilters:[{val:`*${e.val1}`}]}}),testMappingParams:e=>{let[t]=h(e);return t===p.ENDS_WITH},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0],r=n.val.toString();return!n.operator&&r.startsWith(`*`)&&!r.endsWith(`*`)?{operator1:p.ENDS_WITH,val1:r.slice(1)}:!1}},e.EQUALS={label:`sheets-filter.conditions.equals`,operator:p.EQUALS,order:f.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:p.EQUALS,val1:``}),testMappingParams:e=>{let[t]=h(e);return t===p.EQUALS},mapToFilterColumn:e=>{let{val1:t}=e;return t===``?null:{customFilters:{customFilters:[{val:t}]}}},testMappingFilterColumn:e=>{var t,n;return((t=e.filters)==null||(t=t.filters)==null?void 0:t.length)===1?{operator1:p.EQUALS,val1:``}:((n=e.customFilters)==null?void 0:n.customFilters.length)===1&&!e.customFilters.customFilters[0].operator?{operator1:p.EQUALS,val1:e.customFilters.customFilters[0].val.toString()}:!1}},e.GREATER_THAN={label:`sheets-filter.conditions.greater-than`,operator:n.CustomFilterOperator.GREATER_THAN,numOfParameters:1,order:f.FIRST,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.GREATER_THAN,val1:``}),mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.GREATER_THAN}]}}),testMappingParams:e=>{let[t]=h(e);return t===n.CustomFilterOperator.GREATER_THAN},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.GREATER_THAN?{operator1:n.CustomFilterOperator.GREATER_THAN,val1:r.val.toString()}:!1}},e.GREATER_THAN_OR_EQUAL={label:`sheets-filter.conditions.greater-than-or-equal`,operator:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,numOfParameters:1,order:f.FIRST,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:``}),testMappingParams:e=>{let[t]=h(e);return t===n.CustomFilterOperator.GREATER_THAN_OR_EQUAL},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.GREATER_THAN_OR_EQUAL?{operator1:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:r.val.toString()}:!1}},e.LESS_THAN={label:`sheets-filter.conditions.less-than`,operator:n.CustomFilterOperator.LESS_THAN,numOfParameters:1,order:f.FIRST,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.LESS_THAN,val1:``}),testMappingParams:e=>{let[t]=h(e);return t===n.CustomFilterOperator.LESS_THAN},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.LESS_THAN}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.LESS_THAN?{operator1:n.CustomFilterOperator.LESS_THAN,val1:r.val.toString()}:!1}},e.LESS_THAN_OR_EQUAL={label:`sheets-filter.conditions.less-than-or-equal`,operator:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,numOfParameters:1,order:f.FIRST,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:``}),testMappingParams:e=>{let[t]=h(e);return t===n.CustomFilterOperator.LESS_THAN_OR_EQUAL},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.LESS_THAN_OR_EQUAL?{operator1:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:r.val.toString()}:!1}},e.EQUAL={label:`sheets-filter.conditions.equal`,operator:n.CustomFilterOperator.EQUAL,numOfParameters:1,order:f.FIRST,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.EQUAL,val1:``}),testMappingParams:e=>{let[t]=h(e);return t===n.CustomFilterOperator.EQUAL},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.EQUAL}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.EQUAL?{operator1:n.CustomFilterOperator.EQUAL,val1:r.val.toString()}:!1}},e.NOT_EQUAL={label:`sheets-filter.conditions.not-equal`,operator:n.CustomFilterOperator.NOT_EQUALS,numOfParameters:1,order:f.FIRST,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.NOT_EQUALS,val1:``}),testMappingParams:e=>{let[t]=h(e);return t===n.CustomFilterOperator.NOT_EQUALS},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.NOT_EQUALS?{operator1:n.CustomFilterOperator.NOT_EQUALS,val1:r.val.toString()}:!1}},e.BETWEEN={label:`sheets-filter.conditions.between`,operator:p.BETWEEN,order:f.SECOND,numOfParameters:2,getDefaultFormParams:()=>({and:!0,operator1:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:``,operator2:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:``}),testMappingParams:e=>{let{and:t,operator1:r,operator2:i}=e;if(!t)return!1;let a=[r,i];return a.includes(n.CustomFilterOperator.GREATER_THAN_OR_EQUAL)&&a.includes(n.CustomFilterOperator.LESS_THAN_OR_EQUAL)},mapToFilterColumn:e=>{let{val1:r,val2:i,operator1:a}=e,o=a===n.CustomFilterOperator.GREATER_THAN_OR_EQUAL;return{customFilters:{and:t.BooleanNumber.TRUE,customFilters:[{val:o?r:i,operator:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL},{val:o?i:r,operator:n.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==2)return!1;let[r,i]=e.customFilters.customFilters;return r.operator===n.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&i.operator===n.CustomFilterOperator.LESS_THAN_OR_EQUAL&&e.customFilters.and?{and:!0,operator1:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:r.val.toString(),operator2:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:i.val.toString()}:i.operator===n.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&r.operator===n.CustomFilterOperator.LESS_THAN_OR_EQUAL&&e.customFilters.and?{and:!0,operator1:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:i.val.toString(),operator2:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:r.val.toLocaleString()}:!1}},e.NOT_BETWEEN={label:`sheets-filter.conditions.not-between`,operator:p.NOT_BETWEEN,order:f.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.LESS_THAN,val1:``,operator2:n.CustomFilterOperator.GREATER_THAN,val2:``}),testMappingParams:e=>{let{and:t,operator1:r,operator2:i}=e;if(t)return!1;let a=[r,i];return a.includes(n.CustomFilterOperator.GREATER_THAN)&&a.includes(n.CustomFilterOperator.LESS_THAN)},mapToFilterColumn:e=>{let{val1:t,val2:r,operator1:i}=e,a=i===n.CustomFilterOperator.GREATER_THAN;return{customFilters:{customFilters:[{val:a?t:r,operator:n.CustomFilterOperator.GREATER_THAN},{val:a?r:t,operator:n.CustomFilterOperator.LESS_THAN}]}}},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==2)return!1;let[r,i]=e.customFilters.customFilters;return r.operator===n.CustomFilterOperator.LESS_THAN&&i.operator===n.CustomFilterOperator.GREATER_THAN&&!e.customFilters.and?{operator1:n.CustomFilterOperator.LESS_THAN,val1:r.val.toString(),operator2:n.CustomFilterOperator.GREATER_THAN,val2:i.val.toString()}:i.operator===n.CustomFilterOperator.LESS_THAN&&r.operator===n.CustomFilterOperator.GREATER_THAN&&!e.customFilters.and?{operator1:n.CustomFilterOperator.GREATER_THAN,val1:i.val.toString(),operator2:n.CustomFilterOperator.LESS_THAN,val2:r.val.toLocaleString()}:!1}},e.CUSTOM={label:`sheets-filter.conditions.custom`,operator:p.CUSTOM,order:f.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:p.NONE,val1:``,operator2:p.NONE,val2:``}),testMappingParams:()=>!0,mapToFilterColumn:e=>{let{and:n,val1:a,val2:o,operator1:s,operator2:c}=e;function l(e,t){for(let n of i)if(n.operator===e)return n.mapToFilterColumn({val1:t,operator1:e})}let u=!s||s===m.NONE.operator,d=!c||c===m.NONE.operator;if(u&&d)return r.mapToFilterColumn({});if(u)return l(c,o);if(d)return l(s,a);let f=l(s,a),p=l(c,o),h={customFilters:[f.customFilters.customFilters[0],p.customFilters.customFilters[0]]};return n&&(h.and=t.BooleanNumber.TRUE),{customFilters:h}},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==2)return!1;let n=e.customFilters.customFilters.map(e=>l({customFilters:{customFilters:[e]}})),r={operator1:n[0][0].operator,val1:n[0][1].val1,operator2:n[1][0].operator,val2:n[1][1].val1};return e.customFilters.and&&(r.and=!0),r}}];function a(e){let t=i.find(t=>t.operator===e);if(!t)throw Error(`[SheetsFilter]: no condition item found for operator: ${e}`);return t}e.getItemByOperator=a;function o(e,t){for(let n of i.filter(e=>e.numOfParameters===t))if(n.numOfParameters!==0&&n.testMappingParams(e))return n;for(let t of i)if(t.testMappingParams(e))return t;throw Error(`[SheetsFilter]: no condition item can be mapped from the filter map params!`)}e.testMappingParams=o;function s(e){let t=i.find(t=>t.operator===e);return(t==null?void 0:t.numOfParameters)===0?{operator1:t.operator}:t.getDefaultFormParams()}e.getInitialFormParams=s;function c(e,t){return e.mapToFilterColumn(t)}e.mapToFilterColumn=c;function l(e){if(!e)return[r,{}];for(let t of i){let n=t.testMappingFilterColumn(e);if(n)return[t,n]}return[r,{}]}e.testMappingFilterColumn=l})(m||(m={}));function h(e){let{operator1:t,operator2:n,val1:r,val2:i}=e;if(t&&n)throw Error(`Both operator1 and operator2 are set!`);if(!t&&!n)throw Error(`Neither operator1 and operator2 and both not set!`);return t?[t,r]:[n,i]}function g(e){let t=[],n=[],r=0,i=0;function a(e){e.leaf&&(e.checked?(t.push(e),r+=e.count):(n.push(e),i+=e.count)),e.children&&e.children.forEach(a)}return e.forEach(a),{checkedItems:t,uncheckedItems:n,checked:r,unchecked:i}}function _(e,t){return function(n,r){t(n,r,e)}}function v(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let y=`sheets-filter.generate-filter-values.service`,b=(0,t.createIdentifier)(y),x=class extends t.Disposable{constructor(e,t,n){super(),this._localeService=e,this._univerInstanceService=t,this._logService=n}async getFilterValues(e){var t;let{unitId:n,subUnitId:r,filteredOutRowsByOtherColumns:i,filterColumn:a,filters:o,blankChecked:s,iterateRange:c,alreadyChecked:l}=e,u=this._univerInstanceService.getUnit(n),d=(t=this._univerInstanceService.getUnit(n))==null?void 0:t.getSheetBySheetId(r);return!u||!d?[]:(this._logService.debug(`[SheetsGenerateFilterValuesService]`,`getFilterValues for`,{unitId:n,subUnitId:r}),S(o,this._localeService,c,d,new Set(i),a,new Set(l.map(String)),s,u.getStyles()))}};x=v([_(0,(0,t.Inject)(t.LocaleService)),_(1,t.IUniverInstanceService),_(2,t.ILogService)],x);function S(e,r,i,a,o,s,c,l,u){var d;let f=new Map,p=new Map,m=`empty`,h=!e&&((s==null?void 0:s.filterBy)===n.FilterBy.COLORS||(s==null?void 0:s.filterBy)===n.FilterBy.CONDITIONS)&&((d=s.filteredOutRows)==null?void 0:d.size),g=0;for(let e of a.iterateByColumn(i,!1,!1)){let{row:n,rowSpan:i=1}=e,s=0;for(;s<i;){var _,v,y;let d=n+s;if(o.has(d)){s++;continue}let m=e!=null&&e.value?(0,t.extractPureTextFromCell)(e.value):``;if(!m){g+=1,s+=i;continue}let C=(_=e.value)!=null&&_.v&&!e.value.p?(v=u.get((y=e.value)==null?void 0:y.s))==null||(v=v.n)==null?void 0:v.pattern:``,E=C&&t.numfmt.getFormatInfo(C).isDate,D=!1;if(E){let{year:e,month:n,day:r}=t.numfmt.getFormatDateInfo(C);D=e||n||r}if(C&&E&&D){var b,x,S;let n=(b=a.getCellRaw(e.row,e.col))==null?void 0:b.v;if(!n){s++;continue}let[i,o,u]=t.numfmt.format(`yyyy-mm-dd`,Number(n)).split(`-`).map(Number),d=f.get(`${i}`);d||(d={title:`${i}`,key:`${i}`,children:[],count:0,leaf:!1,checked:!1},f.set(`${i}`,d),p.set(`${i}`,[`${i}`]));let g=(x=d.children)==null?void 0:x.find(e=>e.key===`${i}-${o}`);if(!g){var w;g={title:r.t(`sheets-filter.date.${o}`),key:`${i}-${o}`,children:[],count:0,leaf:!1,checked:!1},(w=d.children)==null||w.push(g),p.set(`${i}-${o}`,[`${i}`,`${i}-${o}`])}let _=g==null||(S=g.children)==null?void 0:S.find(e=>e.key===`${i}-${o}-${u}`);if(_)_.originValues.add(m),_.count++,g.count++,d.count++;else{var T;(T=g.children)==null||T.push({title:`${u}`,key:`${i}-${o}-${u}`,count:1,originValues:new Set([m]),leaf:!0,checked:h?!1:c.size?c.has(m):!l}),g.count++,d.count++,p.set(`${i}-${o}-${u}`,[`${i}`,`${i}-${o}`,`${i}-${o}-${u}`])}}else{let e=m,t=f.get(e);t?t.count++:(t={title:m,leaf:!0,checked:h?!1:c.size?c.has(m):!l,key:e,count:1},f.set(e,t),p.set(e,[e]))}s++}}let E=h?!1:e?l:!0;if(g>0){let e={title:r.t(`sheets-filter.panel.empty`),count:g,leaf:!0,checked:E,key:m};f.set(`empty`,e),p.set(`empty`,[m])}return{filterTreeItems:C(Array.from(f.values())),filterTreeMapCache:p}}function C(e){return Array.from(e).sort((e,t)=>e.children&&!t.children?-1:!e.children&&t.children?1:T(e.title,t.title)).map(e=>(e.children&&e.children.sort((e,t)=>Number.parseInt(e.key.split(`-`)[1],10)-Number.parseInt(t.key.split(`-`)[1],10)).forEach(e=>{e.children&&e.children.sort((e,t)=>Number.parseInt(e.key.split(`-`)[2],10)-Number.parseInt(t.key.split(`-`)[2],10))}),e))}let w=e=>!Number.isNaN(Number(e))&&!Number.isNaN(Number.parseFloat(e));function T(e,t){let n=w(e),r=w(t);return n&&r?Number.parseFloat(e)-Number.parseFloat(t):n&&!r?-1:!n&&r?1:e.localeCompare(t)}function E(e,t){for(let n of e){if(n.key===t)return n;if(n.children){let e=E(n.children,t);if(e)return e}}return null}function D(e){return e.leaf?e.checked:e.children?e.children.every(e=>D(e)):!0}function O(e,t){e.leaf&&(t===void 0?e.checked=!e.checked:e.checked=t),e.children&&e.children.forEach(e=>O(e,t))}function ee(e,t){let n=[];return e.forEach(e=>{let r=e.originValues?t.some(t=>Array.from(e.originValues).some(e=>e.toLowerCase().includes(t.toLowerCase()))):!1,i=!r&&t.some(t=>e.title.toLowerCase().includes(t.toLowerCase()));if(r||i)n.push({...e});else if(e.children){let r=ee(e.children,t);if(r.length>0){let t=r.reduce((e,t)=>e+t.count,0);n.push({...e,count:t,children:r})}}}),n}function k(e){"@babel/helpers - typeof";return k=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},k(e)}function te(e,t){if(k(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(k(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ne(e){var t=te(e,`string`);return k(t)==`symbol`?t:t+``}function A(e,t,n){return(t=ne(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var j,M,N;(0,t.createIdentifier)(`sheets-filter-ui.sheets-filter-panel.service`);let P=class extends t.Disposable{get filterBy(){return this._filterBy$.getValue()}get filterByModel(){return this._filterByModel}set filterByModel(e){this._filterByModel=e,this._filterByModel$.next(e)}get filterModel(){return this._filterModel}get col(){return this._col$.getValue()}constructor(e,t){super(),this._injector=e,this._refRangeService=t,A(this,`_filterBy$`,new s.BehaviorSubject(n.FilterBy.VALUES)),A(this,`filterBy$`,this._filterBy$.asObservable()),A(this,`_filterByModel$`,new s.ReplaySubject(1)),A(this,`filterByModel$`,this._filterByModel$.asObservable()),A(this,`_filterByModel`,null),A(this,`_hasCriteria$`,new s.BehaviorSubject(!1)),A(this,`hasCriteria$`,this._hasCriteria$.asObservable()),A(this,`_filterModel`,null),A(this,`_col$`,new s.BehaviorSubject(-1)),A(this,`col$`,this._col$.asObservable()),A(this,`_filterHeaderListener`,null)}dispose(){this._filterBy$.complete(),this._filterByModel$.complete(),this._hasCriteria$.complete()}setupCol(e,t){this.terminate(),this._filterModel=e,this._col$.next(t);let n=e.getFilterColumn(t);if(n){let r=n.getColumnData();if(r.customFilters){this._hasCriteria$.next(!0),this._setupByConditions(e,t);return}if(r.colorFilters){this._hasCriteria$.next(!0),this._setupByColors(e,t);return}if(r.filters){this._hasCriteria$.next(!0),this._setupByValues(e,t);return}this._hasCriteria$.next(!1),this._setupByValues(e,t);return}this._hasCriteria$.next(!1),this._setupByValues(e,t)}changeFilterBy(e){if(!this._filterModel||this.col===-1)return!1;switch(e){case n.FilterBy.VALUES:this._setupByValues(this._filterModel,this.col);break;case n.FilterBy.COLORS:this._setupByColors(this._filterModel,this.col);break;case n.FilterBy.CONDITIONS:this._setupByConditions(this._filterModel,this.col);break}return!0}terminate(){return this._filterModel=null,this._col$.next(-1),this._disposeFilterHeaderChangeListener(),!0}_disposeFilterHeaderChangeListener(){var e;(e=this._filterHeaderListener)==null||e.dispose(),this._filterHeaderListener=null}_listenToFilterHeaderChange(e,t){this._disposeFilterHeaderChangeListener();let n=e.unitId,r=e.subUnitId,i=e.getRange(),a={startColumn:t,startRow:i.startRow,endRow:i.startRow,endColumn:t};this._filterHeaderListener=this._refRangeService.watchRange(n,r,a,(e,t)=>{if(!t)this.terminate();else{let n=t.startColumn-e.startColumn;n!==0&&this._filterByModel.deltaCol(n)}})}async _setupByValues(e,t){this._disposePreviousModel();let r=e.getRange();return r.startRow===r.endRow?!1:(this.filterByModel=await I.fromFilterColumn(this._injector,e,t),this._filterBy$.next(n.FilterBy.VALUES),this._listenToFilterHeaderChange(e,t),!0)}async _setupByColors(e,t){this._disposePreviousModel();let r=e.getRange();return r.startRow===r.endRow?!1:(this.filterByModel=await re.fromFilterColumn(this._injector,e,t),this._filterBy$.next(n.FilterBy.COLORS),this._listenToFilterHeaderChange(e,t),!0)}_setupByConditions(e,t){this._disposePreviousModel();let r=e.getRange();return r.startRow===r.endRow?!1:(this.filterByModel=F.fromFilterColumn(this._injector,e,t,e.getFilterColumn(t)),this._filterBy$.next(n.FilterBy.CONDITIONS),this._listenToFilterHeaderChange(e,t),!0)}_disposePreviousModel(){var e;(e=this._filterByModel)==null||e.dispose(),this.filterByModel=null}};P=v([_(0,(0,t.Inject)(t.Injector)),_(1,(0,t.Inject)(o.RefRangeService))],P);let F=j=class extends t.Disposable{static fromFilterColumn(e,t,n,r){let[i,a]=m.testMappingFilterColumn(r==null?void 0:r.getColumnData());return e.createInstance(j,t,n,i,a)}get conditionItem(){return this._conditionItem$.getValue()}get filterConditionFormParams(){return this._filterConditionFormParams$.getValue()}constructor(e,t,n,r,i){super(),this._filterModel=e,this.col=t,this._commandService=i,A(this,`canApply$`,(0,s.of)(!0)),A(this,`_conditionItem$`,void 0),A(this,`conditionItem$`,void 0),A(this,`_filterConditionFormParams$`,void 0),A(this,`filterConditionFormParams$`,void 0),this._conditionItem$=new s.BehaviorSubject(n),this.conditionItem$=this._conditionItem$.asObservable(),this._filterConditionFormParams$=new s.BehaviorSubject(r),this.filterConditionFormParams$=this._filterConditionFormParams$.asObservable()}dispose(){super.dispose(),this._conditionItem$.complete(),this._filterConditionFormParams$.complete()}deltaCol(e){this.col+=e}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;let e=m.mapToFilterColumn(this.conditionItem,this.filterConditionFormParams);return this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:e})}onPrimaryConditionChange(e){let t=m.ALL_CONDITIONS.find(t=>t.operator===e);if(!t)throw Error(`[ByConditionsModel]: condition item not found for operator: ${e}!`);this._conditionItem$.next(t),this._filterConditionFormParams$.next(m.getInitialFormParams(e))}onConditionFormChange(e){let t={...this.filterConditionFormParams,...e};if(t.and!==!0&&delete t.and,e.and!==void 0||e.operator1!==void 0||e.operator2!==void 0){let e=m.testMappingParams(t,this.conditionItem.numOfParameters);this._conditionItem$.next(e)}this._filterConditionFormParams$.next(t)}};F=j=v([_(4,t.ICommandService)],F);let I=M=class extends t.Disposable{static async fromFilterColumn(e,n,r){let i=e.get(t.IUniverInstanceService),a=e.get(t.LocaleService),o=e.get(b,t.Quantity.OPTIONAL),{unitId:s,subUnitId:c}=n,l=i.getUniverSheetInstance(s);if(!l)throw Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${s}!`);let u=l==null?void 0:l.getSheetBySheetId(c);if(!u)throw Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${s} and subUnitId: ${c}!`);let d=n.getRange(),f=r,p=n.getFilterColumn(r),m=p==null?void 0:p.getColumnData().filters,h=new Set(m==null?void 0:m.filters),g=!!(m&&m.blank),_=n.getFilteredOutRowsExceptCol(r),v={...d,startRow:d.startRow+1,startColumn:f,endColumn:f},y,x;if(o){let e=await o.getFilterValues({unitId:s,subUnitId:c,filteredOutRowsByOtherColumns:Array.from(_),filterColumn:p,filters:!!m,blankChecked:g,iterateRange:v,alreadyChecked:Array.from(h)});y=e.filterTreeItems,x=e.filterTreeMapCache}else{let e=S(!!m,a,v,u,_,p,h,g,l.getStyles());y=e.filterTreeItems,x=e.filterTreeMapCache}return e.createInstance(M,n,r,y,x)}get rawFilterItems(){return this._rawFilterItems$.getValue()}get filterItems(){return this._filterItems}get treeMapCache(){return this._treeMapCache}constructor(e,t,n,r,i){super(),this._filterModel=e,this.col=t,this._commandService=i,A(this,`_rawFilterItems$`,void 0),A(this,`rawFilterItems$`,void 0),A(this,`filterItems$`,void 0),A(this,`_filterItems`,[]),A(this,`_treeMapCache`,void 0),A(this,`canApply$`,void 0),A(this,`_manuallyUpdateFilterItems$`,void 0),A(this,`_searchString$`,void 0),A(this,`searchString$`,void 0),this._treeMapCache=r,this._searchString$=new s.BehaviorSubject(``),this.searchString$=this._searchString$.asObservable(),this._rawFilterItems$=new s.BehaviorSubject(n),this.rawFilterItems$=this._rawFilterItems$.asObservable(),this._manuallyUpdateFilterItems$=new s.Subject,this.filterItems$=(0,s.merge)((0,s.combineLatest)([this._searchString$.pipe((0,s.throttleTime)(500,void 0,{leading:!0,trailing:!0}),(0,s.startWith)(void 0)),this._rawFilterItems$]).pipe((0,s.map)(([e,t])=>e?ee(t,e.toLowerCase().split(/\s+/).filter(e=>!!e)):t)),this._manuallyUpdateFilterItems$).pipe((0,s.shareReplay)(1)),this.canApply$=this.filterItems$.pipe((0,s.map)(e=>g(e).checked>0)),this.disposeWithMe(this.filterItems$.subscribe(e=>this._filterItems=e))}dispose(){this._rawFilterItems$.complete(),this._searchString$.complete()}deltaCol(e){this.col+=e}setSearchString(e){this._searchString$.next(e)}onCheckAllToggled(e){let n=t.Tools.deepClone(this._filterItems);n.forEach(t=>O(t,e)),this._manuallyUpdateFilterItems(n)}onFilterCheckToggled(e){let n=t.Tools.deepClone(this._filterItems),r=E(n,e.key);r&&(O(r,!D(r)),this._manuallyUpdateFilterItems(n))}onFilterOnly(e){let n=t.Tools.deepClone(this._filterItems);n.forEach(e=>O(e,!1)),e.forEach(e=>{let t=E(n,e);t&&O(t,!0)}),this._manuallyUpdateFilterItems(n)}_manuallyUpdateFilterItems(e){this._manuallyUpdateFilterItems$.next(e)}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;let e=g(this._filterItems),{checked:t,checkedItems:r}=e,i=this.rawFilterItems,a=0;for(let e of i)a+=e.count;let o=t===0,s=e.checked===a,c={colId:this.col};if(o)throw Error(`[ByValuesModel]: no checked items!`);if(s)return this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null});{c.filters={};let e=r.filter(e=>e.key!==`empty`);e.length>0&&(c.filters={filters:e.flatMap(e=>e.originValues?Array.from(e.originValues):[e.title])}),e.length!==r.length&&(c.filters.blank=!0)}return this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:c})}};I=M=v([_(4,t.ICommandService)],I);let re=N=class extends t.Disposable{static async fromFilterColumn(e,n,r){var i,o,s;let c=e.get(t.IUniverInstanceService),{unitId:l,subUnitId:u}=n,d=c.getUniverSheetInstance(l);if(!d)throw Error(`[ByColorsModel]: Workbook not found for filter model with unitId: ${l}!`);let f=d==null?void 0:d.getSheetBySheetId(u);if(!f)throw Error(`[ByColorsModel]: Worksheet not found for filter model with unitId: ${l} and subUnitId: ${u}!`);let p=n.getRange(),m=r,h=(i=n.getFilterColumn(r))==null?void 0:i.getColumnData().colorFilters,g=n.getFilteredOutRowsExceptCol(r),_={...p,startRow:p.startRow+1,startColumn:m,endColumn:m},v=new Map,y=new Set((o=h==null?void 0:h.cellFillColors)==null?[]:o),b=new Map,x=new Set((s=h==null?void 0:h.cellTextColors)==null?[]:s);for(let e of f.iterateByColumn(_,!1,!0)){let{row:n,col:r,value:i}=e;if(g.has(n))continue;let o=f.getComposedCellStyleByCellData(n,r,i);if(o.bg&&o.bg.rgb){let e=new t.ColorKit(o.bg.rgb).toRgbString();v.has(e)||v.set(e,{color:e,checked:y.has(e)})}else v.set(`default-fill-color`,{color:null,checked:y.has(null)});if(o.cl&&o.cl.rgb){let e=new t.ColorKit(o.cl.rgb).toRgbString();b.has(e)||b.set(e,{color:e,checked:x.has(e)})}else b.set(`default-font-color`,{color:a.COLOR_BLACK_RGB,checked:x.has(a.COLOR_BLACK_RGB)})}return e.createInstance(N,n,r,v,b)}get cellFillColors(){return this._cellFillColors$.getValue()}get cellTextColors(){return this._cellTextColors$.getValue()}constructor(e,t,n,r,i){super(),this._filterModel=e,this.col=t,this._commandService=i,A(this,`canApply$`,(0,s.of)(!0)),A(this,`_cellFillColors$`,void 0),A(this,`cellFillColors$`,void 0),A(this,`_cellTextColors$`,void 0),A(this,`cellTextColors$`,void 0),this._cellFillColors$=new s.BehaviorSubject(Array.from(n.values())),this.cellFillColors$=this._cellFillColors$.asObservable(),this._cellTextColors$=new s.BehaviorSubject(Array.from(r.values())),this.cellTextColors$=this._cellTextColors$.asObservable()}dispose(){super.dispose(),this._cellFillColors$.complete()}deltaCol(e){this.col+=e}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}onFilterCheckToggled(e,t=!0){let n=t?this.cellFillColors:this.cellTextColors,r=[],i=!1;for(let t=0;t<n.length;t++){let a=n[t];if(a.color===e.color){i=!0,r.push({color:a.color,checked:!a.checked});continue}r.push({color:a.color,checked:a.checked})}i&&(this._resetColorsCheckedStatus(!t),t?this._cellFillColors$.next([...r]):this._cellTextColors$.next([...r]))}_resetColorsCheckedStatus(e=!0){let t=e?this.cellFillColors:this.cellTextColors,n=[];for(let e=0;e<t.length;e++)n.push({color:t[e].color,checked:!1});e?this._cellFillColors$.next([...n]):this._cellTextColors$.next([...n])}async apply(){if(this._disposed)return!1;let e=this.cellFillColors.filter(e=>e.checked).map(e=>e.color),t=this.cellTextColors.filter(e=>e.checked).map(e=>e.color);if(e.length===0&&t.length===0)return this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null});let r={colId:this.col};return e.length>0?r.colorFilters={cellFillColors:e}:t.length>0&&(r.colorFilters={cellTextColors:t}),this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:r})}};re=N=v([_(4,t.ICommandService)],re);let L=`FILTER_PANEL_OPENED`,R={id:`sheet.operation.open-filter-panel`,type:t.CommandType.OPERATION,handler:(e,i)=>{let a=e.get(t.IContextService),o=e.get(n.SheetsFilterService),s=e.get(P),c=e.get(t.ICommandService),l=e.has(r.IEditorBridgeService)?e.get(r.IEditorBridgeService):null;l!=null&&l.isVisible().visible&&c.syncExecuteCommand(r.SetCellEditVisibleOperation.id,{visible:!1});let{unitId:u,subUnitId:d,col:f}=i,p=o.getFilterModel(u,d);return p?(s.setupCol(p,f),a.getContextValue(`FILTER_PANEL_OPENED`)||a.setContextValue(L,!0),!0):!1}},z={id:`sheet.operation.close-filter-panel`,type:t.CommandType.OPERATION,handler:e=>{let n=e.get(t.IContextService),r=e.get(P),a=e.get(i.ILayoutService,t.Quantity.OPTIONAL);return n.getContextValue(`FILTER_PANEL_OPENED`)?(n.setContextValue(L,!1),a==null||a.focus(),r.terminate()):!1}},B={id:`sheet.operation.apply-filter`,type:t.CommandType.OPERATION,handler:(e,t)=>{let{filterBy:n}=t;return e.get(P).changeFilterBy(n)}};var V=`@univerjs/sheets-filter-ui`,H=`0.18.0`;let U=`sheets-filter-ui.config`;Symbol(U);let W={},G=class extends t.Disposable{constructor(e,t,n,r,i,a){super(),this._sheetsFilterService=e,this._localeService=t,this._commandService=n,this._sheetPermissionCheckPermission=r,this._injector=i,this._sheetsSelectionService=a,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{if(e.id===n.SmartToggleSheetsFilterCommand.id){var r;let e=(0,o.getSheetCommandTarget)(this._injector.get(t.IUniverInstanceService));if(!e)return;let{unitId:n,subUnitId:a,worksheet:s}=e,c=(r=this._sheetsFilterService.getFilterModel(n,a))==null?void 0:r.getRange(),l;if(c)l=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[o.RangeProtectionPermissionViewPoint],worksheetTypes:[o.WorksheetFilterPermission,o.WorksheetViewPermission]},[c],n,a);else{var i;let e=(i=this._sheetsSelectionService.getCurrentLastSelection())==null?void 0:i.range;if(e){let t={...e};t=e.startColumn===e.endColumn&&e.startRow===e.endRow?(0,o.expandToContinuousRange)(t,{left:!0,right:!0,up:!0,down:!0},s):t,l=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[o.RangeProtectionPermissionViewPoint],worksheetTypes:[o.WorksheetViewPermission,o.WorksheetFilterPermission]},[t],n,a)}else l=this._sheetPermissionCheckPermission.permissionCheckWithoutRange({rangeTypes:[o.RangeProtectionPermissionViewPoint],worksheetTypes:[o.WorksheetViewPermission,o.WorksheetFilterPermission]})}l||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.filterErr`))}if(e.id===R.id){var a;let n=e.params,{unitId:r,subUnitId:i}=n,s=(a=this._sheetsFilterService.getFilterModel(r,i))==null?void 0:a.getRange(),c=t.Tools.deepClone(s);c&&(c.startColumn=n.col,c.endColumn=n.col,this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[o.RangeProtectionPermissionViewPoint],worksheetTypes:[o.WorksheetFilterPermission,o.WorksheetViewPermission]},[c],r,i)||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.filterErr`)))}}))}};G=v([_(0,(0,t.Inject)(n.SheetsFilterService)),_(1,(0,t.Inject)(t.LocaleService)),_(2,t.ICommandService),_(3,(0,t.Inject)(o.SheetPermissionCheckController)),_(4,(0,t.Inject)(t.Injector)),_(5,(0,t.Inject)(o.SheetsSelectionsService))],G);let ie=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`);var ae=class{static drawNoCriteria(e,t,n,r){e.save(),a.Rect.drawWith(e,{radius:2,width:16,height:16,fill:r}),e.lineCap=`square`,e.strokeStyle=n,e.scale(t/16,t/16),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,t,n,r){e.save(),a.Rect.drawWith(e,{radius:2,width:16,height:16,fill:r}),e.scale(t/16,t/16),e.fillStyle=n,e.fill(ie),e.restore()}};let K=class extends a.Shape{constructor(e,t,n,r,i){super(e,t),this._contextService=n,this._commandService=r,this._themeService=i,A(this,`_cellWidth`,0),A(this,`_cellHeight`,0),A(this,`_filterParams`,void 0),A(this,`_hovered`,!1),this.setShapeProps(t),this.onPointerDown$.subscribeEvent(e=>this.onPointerDown(e)),this.onPointerEnter$.subscribeEvent(()=>this.onPointerEnter()),this.onPointerLeave$.subscribeEvent(()=>this.onPointerLeave())}setShapeProps(e){e.cellHeight!==void 0&&(this._cellHeight=e.cellHeight),e.cellWidth!==void 0&&(this._cellWidth=e.cellWidth),e.filterParams!==void 0&&(this._filterParams=e.filterParams),this.transformByState({width:e.width,height:e.height})}_draw(e){let t=this._cellHeight,n=this._cellWidth,r=16-n,i=16-t;e.save();let a=new Path2D;a.rect(r,i,n,t),e.clip(a);let{hasCriteria:o}=this._filterParams,s=this._themeService.getColorFromTheme(`primary.600`),c=this._hovered?this._themeService.getColorFromTheme(`gray.50`):`rgba(255, 255, 255, 1.0)`;o?ae.drawHasCriteria(e,16,s,c):ae.drawNoCriteria(e,16,s,c),e.restore()}onPointerDown(e){if(e.button===2)return;let{col:t,unitId:n,subUnitId:r}=this._filterParams;this._contextService.getContextValue(`FILTER_PANEL_OPENED`)||!this._commandService.hasCommand(R.id)||setTimeout(()=>{this._commandService.executeCommand(R.id,{unitId:n,subUnitId:r,col:t})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};K=v([_(2,t.IContextService),_(3,t.ICommandService),_(4,(0,t.Inject)(t.ThemeService))],K);function oe(e,n,r,i){switch(i){case t.VerticalAlign.TOP:return e+1;case t.VerticalAlign.MIDDLE:return e+Math.max(0,(r-16)/2);case t.VerticalAlign.BOTTOM:default:return n-16-1}}let q=class extends t.RxDisposable{constructor(e,t,n,r,i,a,o,s){super(),this._context=e,this._injector=t,this._sheetSkeletonManagerService=n,this._sheetsFilterService=r,this._themeService=i,this._sheetInterceptorService=a,this._commandService=o,this._selectionRenderService=s,A(this,`_filterRangeShape`,null),A(this,`_buttonRenderDisposable`,null),A(this,`_filterButtonShapes`,[]),this._initRenderer()}dispose(){super.dispose(),this._disposeRendering()}_initRenderer(){this._sheetSkeletonManagerService.currentSkeleton$.pipe((0,s.switchMap)(e=>{var r,i;if(!e)return(0,s.of)(null);let{unit:a,unitId:c}=this._context,l=((r=a.getActiveSheet())==null?void 0:r.getSheetId())||``,u=(i=this._sheetsFilterService.getFilterModel(c,l))==null?void 0:i,d=()=>({unitId:c,worksheetId:l,filterModel:u,range:u==null?void 0:u.getRange(),skeleton:e.skeleton});return(0,t.fromCallback)(this._commandService.onCommandExecuted.bind(this._commandService)).pipe((0,s.filter)(([e])=>{var r;return e.type===t.CommandType.MUTATION&&((r=e.params)==null?void 0:r.unitId)===a.getUnitId()&&(n.FILTER_MUTATIONS.has(e.id)||e.id===o.SetRangeValuesMutation.id)}),(0,s.throttleTime)(20,void 0,{leading:!1,trailing:!0}),(0,s.map)(d),(0,s.startWith)(d()))}),(0,s.takeUntil)(this.dispose$)).subscribe(e=>{this._disposeRendering(),!(!e||!e.range)&&(this._renderRange(e.range,e.skeleton),this._renderButtons(e))})}_renderRange(e,t){let{scene:n}=this._context,{rowHeaderWidth:i,columnHeaderHeight:a}=t,o=this._filterRangeShape=new r.SelectionControl(n,1e3,this._themeService,{rowHeaderWidth:i,columnHeaderHeight:a,enableAutoFill:!1,highlightHeader:!1}),s=(0,r.attachSelectionWithCoord)({range:e,primary:null,style:{fill:`rgba(0, 0, 0, 0.0)`}},t);o.updateRangeBySelectionWithCoord(s),o.setEvent(!1),n.makeDirty(!0)}_renderButtons(e){let{range:n,filterModel:i,unitId:a,skeleton:o,worksheetId:s}=e,{unit:c,scene:l}=this._context,u=c.getSheetBySheetId(s);if(!u)return;this._interceptCellContent(a,s,e.range);let{startColumn:d,endColumn:f,startRow:p}=n;for(let e=d;e<=f;e++){let n=`sheets-filter-button-${e}`,c=(0,r.getCoordByCell)(p,e,l,o),d=u.getComposedCellStyle(p,e),f=(d==null?void 0:d.vt)||t.VerticalAlign.BOTTOM,{startX:m,startY:h,endX:g,endY:_}=c,v=g-m,y=_-h;if(y<=1||v<=1)continue;let b=!!i.getFilterColumn(e),x={left:g-16-1,top:oe(h,_,y,f),height:16,width:16,zIndex:5e3,cellHeight:y,cellWidth:v,filterParams:{unitId:a,subUnitId:s,col:e,hasCriteria:b}},S=this._injector.createInstance(K,n,x);this._filterButtonShapes.push(S)}l.addObjects(this._filterButtonShapes),l.makeDirty()}_interceptCellContent(e,n,r){let{startRow:i,startColumn:a,endColumn:s}=r;this._buttonRenderDisposable=this._sheetInterceptorService.intercept(o.INTERCEPTOR_POINT.CELL_CONTENT,{effect:t.InterceptorEffectEnum.Style,handler:(t,r,o)=>{let{row:c,col:l,unitId:u,subUnitId:d}=r;return u!==e||d!==n||c!==i||l<a||l>s?o(t):((!t||t===r.rawData)&&(t={...r.rawData}),t.fontRenderExtension={...t==null?void 0:t.fontRenderExtension,rightOffset:16},o(t))},priority:10})}_disposeRendering(){var e,t;(e=this._filterRangeShape)==null||e.dispose(),this._filterButtonShapes.forEach(e=>e.dispose()),(t=this._buttonRenderDisposable)==null||t.dispose(),this._filterRangeShape=null,this._buttonRenderDisposable=null,this._filterButtonShapes=[]}};q=v([_(1,(0,t.Inject)(t.Injector)),_(2,(0,t.Inject)(r.SheetSkeletonManagerService)),_(3,(0,t.Inject)(n.SheetsFilterService)),_(4,(0,t.Inject)(t.ThemeService)),_(5,(0,t.Inject)(o.SheetInterceptorService)),_(6,t.ICommandService),_(7,r.ISheetSelectionRenderService)],q);let J=class extends t.RxDisposable{constructor(e,r){super(),this._renderManagerService=e,this._sheetsRenderService=r,[n.SetSheetsFilterRangeMutation,n.SetSheetsFilterCriteriaMutation,n.RemoveSheetsFilterMutation,n.ReCalcSheetsFilterMutation].forEach(e=>this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(e.id))),this.disposeWithMe(this._renderManagerService.registerRenderModule(t.UniverInstanceType.UNIVER_SHEET,[q]))}};J=v([_(0,a.IRenderManagerService),_(1,(0,t.Inject)(r.SheetsRenderService))],J);let Y=class extends t.Plugin{constructor(e=W,n,r){super(),this._config=e,this._injector=n,this._configService=r;let{menu:i,...a}=(0,t.merge)({},W,this._config);i&&this._configService.setConfig(`menu`,i,{merge:!0}),this._configService.setConfig(U,a)}onStarting(){[[G],[J]].forEach(e=>this._injector.add(e))}onReady(){this._injector.get(G)}onRendered(){this._injector.get(J)}};A(Y,`type`,t.UniverInstanceType.UNIVER_SHEET),A(Y,`pluginName`,`SHEET_FILTER_UI_PLUGIN`),A(Y,`packageName`,V),A(Y,`version`,H),Y=v([(0,t.DependentOn)(n.UniverSheetsFilterPlugin),_(1,(0,t.Inject)(t.Injector)),_(2,t.IConfigService)],Y);function X({ref:e,...t}){let{icon:n,id:r,className:i,extend:a,...o}=t,s=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),c=(0,u.useRef)(`_${ue()}`);return se(n,`${r}`,{defIds:n.defIds,idSuffix:c.current},{ref:e,className:s,...o},a)}function se(e,t,n,r,i){return(0,u.createElement)(e.tag,{key:t,...ce(e,n,i),...r},(le(e,n).children||[]).map((r,a)=>se(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function ce(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function le(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function ue(){return Math.random().toString(36).substring(2,8)}X.displayName=`UniverIcon`;let de={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 20 20`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M10 1.05957C10.356 1.05957 10.6816 1.26162 10.8408 1.58008L18.8408 17.5801L18.8799 17.668C19.0486 18.1134 18.8551 18.6232 18.4199 18.8408C17.9557 19.0727 17.3913 18.8841 17.1592 18.4199L10 4.10156L2.84082 18.4199C2.60871 18.8841 2.04434 19.0727 1.58008 18.8408C1.11587 18.6087 0.92731 18.0443 1.15918 17.5801L9.15918 1.58008C9.31841 1.26162 9.64395 1.05957 10 1.05957Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M15.3337 11.7261L15.4294 11.731C15.9035 11.779 16.2732 12.1798 16.2732 12.6665C16.2732 13.1532 15.9035 13.554 15.4294 13.602L15.3337 13.6069H4.66675C4.1476 13.6069 3.72632 13.1856 3.72632 12.6665C3.72632 12.1474 4.1476 11.7261 4.66675 11.7261H15.3337Z`}}]},fe=(0,u.forwardRef)(function(e,t){return(0,u.createElement)(X,Object.assign({},e,{id:`a-icon`,ref:t,icon:de}))});fe.displayName=`AIcon`;let pe={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 20 20`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M17.0596 10C17.0596 6.10087 13.8992 2.94043 10 2.94043C6.10087 2.94043 2.94043 6.10087 2.94043 10C2.94043 13.8992 6.10087 17.0596 10 17.0596C13.8992 17.0596 17.0596 13.8992 17.0596 10ZM18.9404 10C18.9404 14.9374 14.9374 18.9404 10 18.9404C5.06257 18.9404 1.05957 14.9374 1.05957 10C1.05957 5.06257 5.06257 1.05957 10 1.05957C14.9374 1.05957 18.9404 5.06257 18.9404 10Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M4.29492 4.13476C4.63911 3.79057 5.1845 3.76906 5.55371 4.07031L5.625 4.13476L16.0244 14.5352L16.0889 14.6064C16.3902 14.9757 16.3686 15.52 16.0244 15.8643C15.6573 16.2313 15.0624 16.2313 14.6953 15.8643L4.29492 5.46484L4.23047 5.39355C3.92922 5.02434 3.95073 4.47895 4.29492 4.13476Z`}}]},me=(0,u.forwardRef)(function(e,t){return(0,u.createElement)(X,Object.assign({},e,{id:`ban-icon`,ref:t,icon:pe}))});me.displayName=`BanIcon`;let he={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M3.32182 2.60967C2.98161 2.60967 2.79671 3.0074 3.01601 3.2675L6.85819 7.8246C6.94943 7.93282 6.99947 8.06981 6.99947 8.21136V12.7338C6.99947 12.898 7.0998 13.0455 7.2525 13.1058L8.73833 13.6928C9.00085 13.7965 9.28531 13.6031 9.28531 13.3208V8.21136C9.28531 8.06981 9.33535 7.93282 9.42659 7.8246L13.2688 3.2675C13.4881 3.0074 13.3032 2.60967 12.963 2.60967H3.32182ZM2.09858 4.04101C1.22139 3.0006 1.96097 1.40967 3.32182 1.40967H12.963C14.3238 1.40967 15.0634 3.0006 14.1862 4.04101L10.4853 8.43054V13.3208C10.4853 14.4498 9.34747 15.2237 8.29742 14.8089L6.81158 14.2219C6.20078 13.9806 5.79947 13.3905 5.79947 12.7338V8.43054L2.09858 4.04101Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},ge=(0,u.forwardRef)(function(e,t){return(0,u.createElement)(X,Object.assign({},e,{id:`filter-icon`,ref:t,icon:he}))});ge.displayName=`FilterIcon`;let _e={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M8.00016 1.33203C6.68162 1.33203 5.39269 1.72302 4.29636 2.45557C3.20004 3.18811 2.34555 4.2293 1.84097 5.44747C1.33638 6.66565 1.20436 8.00609 1.4616 9.2993C1.71883 10.5925 2.35377 11.7804 3.28612 12.7127C4.21847 13.6451 5.40636 14.28 6.69956 14.5373C7.99277 14.7945 9.33321 14.6625 10.5514 14.1579C11.7696 13.6533 12.8108 12.7988 13.5433 11.7025C14.2758 10.6062 14.6668 9.31724 14.6668 7.9987C14.6649 6.23118 13.9619 4.53662 12.7121 3.2868C11.4622 2.03697 9.76768 1.33397 8.00016 1.33203ZM7.66683 3.9987C7.86461 3.9987 8.05795 4.05735 8.2224 4.16723C8.38685 4.27711 8.51502 4.43329 8.59071 4.61601C8.6664 4.79874 8.6862 4.99981 8.64762 5.19379C8.60903 5.38777 8.51379 5.56595 8.37394 5.7058C8.23409 5.84566 8.0559 5.9409 7.86192 5.97948C7.66794 6.01807 7.46687 5.99826 7.28415 5.92258C7.10142 5.84689 6.94524 5.71872 6.83536 5.55427C6.72548 5.38982 6.66683 5.19648 6.66683 4.9987C6.66683 4.73348 6.77219 4.47913 6.95972 4.29159C7.14726 4.10405 7.40162 3.9987 7.66683 3.9987ZM9.3335 11.332H6.66683C6.49002 11.332 6.32045 11.2618 6.19543 11.1368C6.0704 11.0117 6.00016 10.8422 6.00016 10.6654C6.00016 10.4886 6.0704 10.319 6.19543 10.194C6.32045 10.0689 6.49002 9.9987 6.66683 9.9987H7.3335V7.9987H6.66683C6.49002 7.9987 6.32045 7.92846 6.19543 7.80343C6.0704 7.67841 6.00016 7.50884 6.00016 7.33203C6.00016 7.15522 6.0704 6.98565 6.19543 6.86063C6.32045 6.7356 6.49002 6.66536 6.66683 6.66536H8.00016C8.17698 6.66536 8.34655 6.7356 8.47157 6.86063C8.59659 6.98565 8.66683 7.15522 8.66683 7.33203V9.9987H9.3335C9.51031 9.9987 9.67988 10.0689 9.8049 10.194C9.92993 10.319 10.0002 10.4886 10.0002 10.6654C10.0002 10.8422 9.92993 11.0117 9.8049 11.1368C9.67988 11.2618 9.51031 11.332 9.3335 11.332Z`}}]},ve=(0,u.forwardRef)(function(e,t){return(0,u.createElement)(X,Object.assign({},e,{id:`info-icon`,ref:t,icon:_e}))});ve.displayName=`InfoIcon`;let ye={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15ZM11.7245 6.42417C11.9588 6.18985 11.9588 5.80995 11.7245 5.57564C11.4901 5.34132 11.1102 5.34132 10.8759 5.57564L7.3002 9.15137L5.72446 7.57564C5.49014 7.34132 5.11025 7.34132 4.87593 7.57564C4.64162 7.80995 4.64162 8.18985 4.87593 8.42417L6.87593 10.4242C7.11025 10.6585 7.49014 10.6585 7.72446 10.4242L11.7245 6.42417Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},be=(0,u.forwardRef)(function(e,t){return(0,u.createElement)(X,Object.assign({},e,{id:`success-icon`,ref:t,icon:ye}))});be.displayName=`SuccessIcon`;function xe(e){let a=e.get(n.SheetsFilterService);return{id:n.SmartToggleSheetsFilterCommand.id,type:i.MenuItemType.BUTTON_SELECTOR,icon:`FilterIcon`,tooltip:`sheets-filter.toolbar.smart-toggle-filter-tooltip`,hidden$:(0,i.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),activated$:a.activeFilterModel$.pipe((0,s.map)(e=>!!e)),disabled$:(0,r.getObservableWithExclusiveRange$)(e,(0,r.getCurrentRangeDisable$)(e,{worksheetTypes:[o.WorksheetFilterPermission,o.WorksheetViewPermission],rangeTypes:[o.RangeProtectionPermissionViewPoint]}))}}function Se(e){let r=e.get(n.SheetsFilterService);return{id:n.ClearSheetsFilterCriteriaCommand.id,type:i.MenuItemType.BUTTON,title:`sheets-filter.toolbar.clear-filter-criteria`,hidden$:(0,i.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:r.activeFilterModel$.pipe((0,s.switchMap)(e=>{var t;return(t=e==null?void 0:e.hasCriteria$.pipe((0,s.map)(e=>!e)))==null?(0,s.of)(!0):t}))}}function Ce(e){let r=e.get(n.SheetsFilterService);return{id:n.ReCalcSheetsFilterCommand.id,type:i.MenuItemType.BUTTON,title:`sheets-filter.toolbar.re-calc-filter-conditions`,hidden$:(0,i.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:r.activeFilterModel$.pipe((0,s.switchMap)(e=>{var t;return(t=e==null?void 0:e.hasCriteria$.pipe((0,s.map)(e=>!e)))==null?(0,s.of)(!0):t}))}}let we={[i.RibbonDataGroup.ORGANIZATION]:{[n.SmartToggleSheetsFilterCommand.id]:{order:2,menuItemFactory:xe,[n.ClearSheetsFilterCriteriaCommand.id]:{order:0,menuItemFactory:Se},[n.ReCalcSheetsFilterCommand.id]:{order:1,menuItemFactory:Ce}}}};function Te(e){let{model:n}=e,r=(0,i.useDependency)(t.LocaleService),a=(0,i.useObservable)(n.cellFillColors$,[],!0),o=(0,i.useObservable)(n.cellTextColors$,[],!0),s=(0,u.useCallback)(e=>{n.onFilterCheckToggled(e)},[n]),c=(0,u.useCallback)(e=>{n.onFilterCheckToggled(e,!1)},[n]);return(0,d.jsx)(`div`,{"data-u-comp":`sheets-filter-panel-colors-container`,className:`univer-flex univer-h-full univer-min-h-[300px] univer-flex-col`,children:(0,d.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel`,className:(0,l.clsx)(`
|
|
9
|
+
univer-mt-2 univer-box-border univer-flex univer-h-[300px] univer-flex-grow univer-flex-col
|
|
10
|
+
univer-gap-4 univer-overflow-auto univer-rounded-md univer-px-2 univer-py-2.5
|
|
11
|
+
`,l.borderClassName),children:[a.length>1&&(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`
|
|
12
|
+
univer-mb-2 univer-text-sm univer-text-gray-900
|
|
13
|
+
dark:!univer-text-white
|
|
14
|
+
`,children:r.t(`sheets-filter.panel.filter-by-cell-fill-color`)}),(0,d.jsx)(`div`,{className:`
|
|
15
|
+
univer-grid univer-grid-cols-8 univer-items-center univer-justify-start univer-gap-2
|
|
16
|
+
`,children:a.map((e,t)=>(0,d.jsxs)(`div`,{className:`univer-relative univer-size-6`,onClick:()=>s(e),children:[e.color?(0,d.jsx)(`button`,{type:`button`,className:(0,l.clsx)(`
|
|
17
|
+
univer-box-border univer-size-6 univer-cursor-pointer
|
|
18
|
+
univer-rounded-full univer-border univer-border-solid
|
|
19
|
+
univer-border-transparent univer-bg-gray-300 univer-transition-shadow
|
|
20
|
+
hover:univer-ring-2 hover:univer-ring-offset-2
|
|
21
|
+
hover:univer-ring-offset-white
|
|
22
|
+
`),style:{backgroundColor:e.color}}):(0,d.jsx)(me,{className:`
|
|
23
|
+
univer-size-6 univer-cursor-pointer univer-rounded-full
|
|
24
|
+
hover:univer-ring-2 hover:univer-ring-offset-2
|
|
25
|
+
hover:univer-ring-offset-white
|
|
26
|
+
`}),e.checked&&(0,d.jsx)(Ee,{})]},`sheets-filter-cell-fill-color-${t}`))})]}),o.length>1&&(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`
|
|
27
|
+
univer-mb-2 univer-text-sm univer-text-gray-900
|
|
28
|
+
dark:!univer-text-white
|
|
29
|
+
`,children:r.t(`sheets-filter.panel.filter-by-cell-text-color`)}),(0,d.jsx)(`div`,{className:`
|
|
30
|
+
univer-grid univer-grid-cols-8 univer-items-center univer-justify-start univer-gap-2
|
|
31
|
+
`,children:o.map((e,t)=>(0,d.jsxs)(`div`,{className:`univer-relative univer-size-6`,onClick:()=>c(e),children:[(0,d.jsx)(`div`,{className:`
|
|
32
|
+
univer-box-border univer-flex univer-size-full univer-cursor-pointer
|
|
33
|
+
univer-items-center univer-justify-center univer-rounded-full univer-border
|
|
34
|
+
univer-border-solid univer-border-[rgba(13,13,13,0.06)] univer-p-0.5
|
|
35
|
+
hover:univer-ring-2 hover:univer-ring-offset-2 hover:univer-ring-offset-white
|
|
36
|
+
dark:!univer-border-[rgba(255,255,255,0.06)]
|
|
37
|
+
`,children:(0,d.jsx)(fe,{style:{color:e.color}})}),e.checked&&(0,d.jsx)(Ee,{})]},`sheets-filter-cell-text-color-${t}`))})]}),a.length<=1&&o.length<=1&&(0,d.jsx)(`div`,{className:`
|
|
38
|
+
univer-flex univer-size-full univer-items-center univer-justify-center univer-text-sm
|
|
39
|
+
univer-text-gray-900
|
|
40
|
+
dark:!univer-text-gray-200
|
|
41
|
+
`,children:r.t(`sheets-filter.panel.filter-by-color-none`)})]})})}function Ee(){return(0,d.jsx)(`div`,{className:`
|
|
42
|
+
univer-absolute -univer-bottom-0.5 -univer-right-0.5 univer-flex univer-size-3 univer-cursor-pointer
|
|
43
|
+
univer-items-center univer-justify-center univer-rounded-full univer-bg-white
|
|
44
|
+
`,children:(0,d.jsx)(be,{className:`univer-size-full univer-font-bold univer-text-[#418F1F]`})})}function De(e){var n,r;let{model:a}=e,o=(0,i.useDependency)(t.LocaleService),s=(0,i.useObservable)(a.conditionItem$,void 0),c=(0,i.useObservable)(a.filterConditionFormParams$,void 0),f=c!=null&&c.and?`AND`:`OR`,p=(0,u.useCallback)(e=>{a.onConditionFormChange({and:e===`AND`})},[a]),h=Oe(o),g=(0,u.useCallback)(e=>{a.onPrimaryConditionChange(e)},[a]),_=ke(o),v=(0,u.useCallback)(e=>{a.onConditionFormChange(e)},[a]),y=o.t(`sheets-filter.panel.input-values-placeholder`);function b(e,t,n){let r=m.getItemByOperator(e).numOfParameters===1;return(0,d.jsxs)(d.Fragment,{children:[n===`operator2`&&(0,d.jsxs)(l.RadioGroup,{value:f,onChange:p,children:[(0,d.jsx)(l.Radio,{value:`AND`,children:o.t(`sheets-filter.panel.and`)}),(0,d.jsx)(l.Radio,{value:`OR`,children:o.t(`sheets-filter.panel.or`)})]}),(0,d.jsx)(l.Select,{value:e,options:_,onChange:e=>v({[n]:e})}),r&&(0,d.jsx)(`div`,{children:(0,d.jsx)(l.Input,{className:`univer-mt-2`,value:t,placeholder:y,onChange:e=>v({[n===`operator1`?`val1`:`val2`]:e})})})]})}return(0,d.jsx)(`div`,{"data-u-comp":`sheets-filter-panel-conditions-container`,className:`univer-flex univer-h-full univer-min-h-[300px] univer-flex-col`,children:s&&c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l.Select,{value:s.operator,options:h,onChange:g}),m.getItemByOperator(s.operator).numOfParameters===0?null:(0,d.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel-conditions-container-inner`,className:(0,l.clsx)(`
|
|
45
|
+
univer-mt-2 univer-flex-grow univer-overflow-hidden univer-rounded-md univer-p-2
|
|
46
|
+
`,l.borderClassName),children:[s.numOfParameters>=1&&b(c.operator1,(n=c.val1)==null?``:n,`operator1`),s.numOfParameters>=2&&b(c.operator2,(r=c.val2)==null?``:r,`operator2`),(0,d.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel-conditions-desc`,className:`univer-mt-2 univer-text-xs univer-text-gray-500`,children:[o.t(`sheets-filter.panel.?`),(0,d.jsx)(`br`,{}),o.t(`sheets-filter.panel.*`)]})]})]})})}function Oe(e){return(0,u.useMemo)(()=>[{options:[{label:e.t(m.NONE.label),value:m.NONE.operator}]},{options:[{label:e.t(m.EMPTY.label),value:m.EMPTY.operator},{label:e.t(m.NOT_EMPTY.label),value:m.NOT_EMPTY.operator}]},{options:[{label:e.t(m.TEXT_CONTAINS.label),value:m.TEXT_CONTAINS.operator},{label:e.t(m.DOES_NOT_CONTAIN.label),value:m.DOES_NOT_CONTAIN.operator},{label:e.t(m.STARTS_WITH.label),value:m.STARTS_WITH.operator},{label:e.t(m.ENDS_WITH.label),value:m.ENDS_WITH.operator},{label:e.t(m.EQUALS.label),value:m.EQUALS.operator}]},{options:[{label:e.t(m.GREATER_THAN.label),value:m.GREATER_THAN.operator},{label:e.t(m.GREATER_THAN_OR_EQUAL.label),value:m.GREATER_THAN_OR_EQUAL.operator},{label:e.t(m.LESS_THAN.label),value:m.LESS_THAN.operator},{label:e.t(m.LESS_THAN_OR_EQUAL.label),value:m.LESS_THAN_OR_EQUAL.operator},{label:e.t(m.EQUAL.label),value:m.EQUAL.operator},{label:e.t(m.NOT_EQUAL.label),value:m.NOT_EQUAL.operator},{label:e.t(m.BETWEEN.label),value:m.BETWEEN.operator},{label:e.t(m.NOT_BETWEEN.label),value:m.NOT_BETWEEN.operator}]},{options:[{label:e.t(m.CUSTOM.label),value:m.CUSTOM.operator}]}],[e.getCurrentLocale(),e])}function ke(e){return(0,u.useMemo)(()=>m.ALL_CONDITIONS.filter(e=>e.numOfParameters!==2).map(t=>({label:e.t(t.label),value:t.operator})),[e.getCurrentLocale(),e])}function Ae(e){let{model:n}=e,r=(0,i.useDependency)(t.LocaleService),a=(0,i.useObservable)(n.searchString$,``,!0),o=(0,i.useObservable)(n.filterItems$,void 0,!0),s=r.t(`sheets-filter.panel.filter-only`),c=g(o),f=c.checked>0&&c.unchecked===0,p=c.checked>0&&c.unchecked>0,m=n.treeMapCache,h=(0,u.useCallback)(()=>{n.onCheckAllToggled(!f)},[n,f]),_=(0,u.useCallback)(e=>{n.setSearchString(e)},[n]);function v(e){let t=[];return e.forEach(e=>{e.checked&&t.push(e.key),e.children&&(t=t.concat(v(e.children)))}),t}return(0,d.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel-values-container`,className:`univer-flex univer-h-full univer-min-h-[300px] univer-flex-col`,children:[(0,d.jsx)(l.Input,{autoFocus:!0,value:a,placeholder:r.t(`sheets-filter.panel.search-placeholder`),onChange:_}),(0,d.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel`,className:(0,l.clsx)(`
|
|
47
|
+
univer-mt-2 univer-box-border univer-flex univer-flex-grow univer-flex-col univer-overflow-hidden
|
|
48
|
+
univer-rounded-md univer-px-2 univer-py-2.5
|
|
49
|
+
`,l.borderClassName),children:[(0,d.jsx)(`div`,{"data-u-comp":`sheets-filter-panel-values-item`,className:`univer-box-border univer-h-8 univer-w-full univer-py-0.5`,children:(0,d.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel-values-item-inner`,className:`
|
|
50
|
+
univer-box-border univer-flex univer-h-7 univer-items-center univer-rounded-md univer-py-0
|
|
51
|
+
univer-pl-5 univer-pr-0.5 univer-text-sm
|
|
52
|
+
`,children:[(0,d.jsx)(l.Checkbox,{indeterminate:p,disabled:o.length===0,checked:f,onChange:h}),(0,d.jsx)(`span`,{"data-u-comp":`sheets-filter-panel-values-item-text`,className:`
|
|
53
|
+
univer-mx-1 univer-inline-block univer-flex-shrink univer-truncate univer-text-gray-900
|
|
54
|
+
dark:!univer-text-white
|
|
55
|
+
`,children:`${r.t(`sheets-filter.panel.select-all`)}`}),(0,d.jsx)(`span`,{"data-u-comp":`sheets-filter-panel-values-item-count`,className:`
|
|
56
|
+
univer-text-gray-400
|
|
57
|
+
dark:!univer-text-gray-500
|
|
58
|
+
`,children:`(${c.checked}/${c.checked+c.unchecked})`})]})}),(0,d.jsx)(`div`,{"data-u-comp":`sheets-filter-panel-values-virtual`,className:`univer-flex-grow`,children:(0,d.jsx)(l.Tree,{data:o,defaultExpandAll:!1,valueGroup:v(o),onChange:e=>{n.onFilterCheckToggled(e)},defaultCache:m,itemHeight:28,treeNodeClassName:`
|
|
11
59
|
univer-pr-2 univer-border-box univer-rounded-md
|
|
12
60
|
[&:hover_a]:univer-inline-block
|
|
13
61
|
hover:univer-bg-gray-50 univer-h-full
|
|
14
62
|
univer-text-gray-900 dark:hover:!univer-bg-gray-900
|
|
15
63
|
dark:!univer-text-white
|
|
16
|
-
`,attachRender:v=>d.jsxs("div",{className:"univer-ml-1 univer-flex univer-h-5 univer-flex-1 univer-cursor-pointer univer-items-center univer-justify-between univer-text-sm univer-text-primary-500",children:[d.jsx("span",{"data-u-comp":"sheets-filter-panel-values-item-count",className:"univer-text-gray-400 dark:!univer-text-gray-500",children:`(${v.count})`}),d.jsx("a",{className:"univer-box-border univer-hidden univer-h-4 univer-whitespace-nowrap univer-px-1.5",onClick:()=>{const T=[];v.children?v.children.forEach(I=>{I.children?I.children.forEach(P=>{T.push(P.key)}):T.push(I.key)}):T.push(v.key),e.onFilterOnly(T)},children:l})]})})})]})]})}function Dt(){const r=g.useDependency(u.SheetsFilterSyncController);if(!g.useObservable(r.visible$,void 0,!0))return null;const t=g.useDependency(c.LocaleService),n=g.useDependency(g.IMessageService),o=g.useObservable(r.enabled$,void 0,!0);return d.jsxs("div",{className:"univer-mt-2 univer-flex univer-items-center univer-justify-between univer-text-sm univer-text-gray-900 dark:!univer-text-gray-200",children:[d.jsxs("div",{className:"univer-flex univer-items-center univer-gap-1",children:[d.jsx("span",{children:t.t("sheets-filter.sync.title")}),d.jsx(N.Tooltip,{title:o?t.t("sheets-filter.sync.statusTips.off"):t.t("sheets-filter.sync.statusTips.on"),asChild:!0,children:d.jsx(Ke,{className:"univer-block"})})]}),d.jsx(N.Switch,{defaultChecked:o,onChange:l=>{const i=l?t.t("sheets-filter.sync.switchTips.on"):t.t("sheets-filter.sync.switchTips.off");r.setEnabled(l),n.show({content:i,type:N.MessageType.Success,duration:2e3})}})]})}function Ht(){var P;const r=g.useDependency(Q),e=g.useDependency(c.LocaleService),t=g.useDependency(c.ICommandService),n=g.useObservable(r.filterBy$,void 0,!0),o=g.useObservable(r.filterByModel$,void 0,!1),l=g.useObservable(()=>(o==null?void 0:o.canApply$)||S.of(!1),void 0,!1,[o]),i=xt(e),s=!g.useObservable(r.hasCriteria$),a=F.useCallback(A=>{t.executeCommand(Pe.id,{filterBy:A})},[t]),h=F.useCallback(async()=>{await(o==null?void 0:o.clear()),t.executeCommand(te.id)},[o,t]),m=F.useCallback(()=>{t.executeCommand(te.id)},[t]),p=F.useCallback(async()=>{await(o==null?void 0:o.apply()),t.executeCommand(te.id)},[o,t]),v=(P=g.useDependency(u.SheetsFilterService).activeFilterModel)==null?void 0:P.getRange(),T=r.col,I=g.useComponentsOfPart($.SheetsUIPart.FILTER_PANEL_EMBED_POINT);return d.jsxs("div",{"data-u-comp":"sheets-filter-panel",className:"univer-box-border univer-flex univer-max-h-[500px] univer-w-[400px] univer-flex-col univer-rounded-lg univer-bg-white univer-p-4 univer-shadow-lg dark:!univer-border-gray-600 dark:!univer-bg-gray-700",children:[d.jsx(g.ComponentContainer,{components:I,sharedProps:{range:v,colIndex:T,onClose:m}}),d.jsx("div",{className:"univer-mb-1 univer-flex-shrink-0 univer-flex-grow-0",children:d.jsx(N.Segmented,{value:n,items:i,onChange:A=>a(A)})}),o?d.jsx("div",{"data-u-comp":"sheets-filter-panel-content",className:"univer-flex-shrink univer-flex-grow univer-pt-2",children:n===u.FilterBy.VALUES?d.jsx(Bt,{model:o}):n===u.FilterBy.COLORS?d.jsx($t,{model:o}):d.jsx(Mt,{model:o})}):d.jsx("div",{className:"univer-flex-1"}),d.jsx(Dt,{}),d.jsxs("div",{"data-u-comp":"sheets-filter-panel-footer",className:"univer-mt-4 univer-inline-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-nowrap univer-justify-between univer-overflow-hidden",children:[d.jsx(N.Button,{variant:"link",onClick:h,disabled:s,children:e.t("sheets-filter.panel.clear-filter")}),d.jsxs("span",{className:"univer-flex univer-gap-2",children:[d.jsx(N.Button,{variant:"default",onClick:m,children:e.t("sheets-filter.panel.cancel")}),d.jsx(N.Button,{disabled:!l,variant:"primary",onClick:p,children:e.t("sheets-filter.panel.confirm")})]})]})]})}function xt(r){const e=r.getCurrentLocale();return F.useMemo(()=>[{label:r.t("sheets-filter.panel.by-values"),value:u.FilterBy.VALUES},{label:r.t("sheets-filter.panel.by-colors"),value:u.FilterBy.COLORS},{label:r.t("sheets-filter.panel.by-conditions"),value:u.FilterBy.CONDITIONS}],[e,r])}function Wt(r){const e=r.get(u.SheetsFilterService);return{id:u.SmartToggleSheetsFilterCommand.id,type:g.MenuItemType.BUTTON_SELECTOR,icon:"FilterIcon",tooltip:"sheets-filter.toolbar.smart-toggle-filter-tooltip",hidden$:g.getMenuHiddenObservable(r,c.UniverInstanceType.UNIVER_SHEET),activated$:e.activeFilterModel$.pipe(S.map(t=>!!t)),disabled$:$.getObservableWithExclusiveRange$(r,$.getCurrentRangeDisable$(r,{worksheetTypes:[y.WorksheetFilterPermission,y.WorksheetViewPermission],rangeTypes:[y.RangeProtectionPermissionViewPoint]}))}}function Vt(r){const e=r.get(u.SheetsFilterService);return{id:u.ClearSheetsFilterCriteriaCommand.id,type:g.MenuItemType.BUTTON,title:"sheets-filter.toolbar.clear-filter-criteria",hidden$:g.getMenuHiddenObservable(r,c.UniverInstanceType.UNIVER_SHEET),disabled$:e.activeFilterModel$.pipe(S.switchMap(t=>{var n;return(n=t==null?void 0:t.hasCriteria$.pipe(S.map(o=>!o)))!=null?n:S.of(!0)}))}}function jt(r){const e=r.get(u.SheetsFilterService);return{id:u.ReCalcSheetsFilterCommand.id,type:g.MenuItemType.BUTTON,title:"sheets-filter.toolbar.re-calc-filter-conditions",hidden$:g.getMenuHiddenObservable(r,c.UniverInstanceType.UNIVER_SHEET),disabled$:e.activeFilterModel$.pipe(S.switchMap(t=>{var n;return(n=t==null?void 0:t.hasCriteria$.pipe(S.map(o=>!o)))!=null?n:S.of(!0)}))}}const Qt={[g.RibbonDataGroup.ORGANIZATION]:{[u.SmartToggleSheetsFilterCommand.id]:{order:2,menuItemFactory:Wt,[u.ClearSheetsFilterCriteriaCommand.id]:{order:0,menuItemFactory:Vt},[u.ReCalcSheetsFilterCommand.id]:{order:1,menuItemFactory:jt}}}},Gt={id:u.SmartToggleSheetsFilterCommand.id,binding:g.KeyCode.L|g.MetaKeys.CTRL_COMMAND|g.MetaKeys.SHIFT,description:"sheets-filter.shortcut.smart-toggle-filter",preconditions:$.whenSheetEditorFocused,group:"4_sheet-edit"};var Yt=Object.getOwnPropertyDescriptor,qt=(r,e,t,n)=>{for(var o=n>1?void 0:n?Yt(e,t):e,l=r.length-1,i;l>=0;l--)(i=r[l])&&(o=i(o)||o);return o},k=(r,e)=>(t,n)=>e(t,n,r);const Je="FILTER_PANEL_POPUP";let Se=class extends he{constructor(e,t,n,o,l,i,s,a,h,m,p,O,v){super(v,O);_(this,"_popupDisposable");this._injector=e,this._componentManager=t,this._sheetsFilterPanelService=n,this._sheetCanvasPopupService=o,this._sheetsFilterService=l,this._localeService=i,this._shortcutService=s,this._commandService=a,this._menuManagerService=h,this._contextService=m,this._messageService=p,this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[Gt].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}_initCommands(){[u.SmartToggleSheetsFilterCommand,u.RemoveSheetFilterCommand,u.SetSheetFilterRangeCommand,u.SetSheetsFilterCriteriaCommand,u.ClearSheetsFilterCriteriaCommand,u.ReCalcSheetsFilterCommand,Pe,ce,te].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenuItems(){this._menuManagerService.mergeMenu(Qt)}_initUI(){[[Je,Ht],["FilterIcon",Ze]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))}),this.disposeWithMe(this._contextService.subscribeContextValue$(ee).pipe(S.distinctUntilChanged()).subscribe(e=>{e?this._openFilterPopup():this._closeFilterPopup()})),this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe(e=>{e&&this._messageService.show({type:N.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 t=e.getRange(),n=this._sheetsFilterPanelService.col,{startRow:o}=t;this._popupDisposable=this._sheetCanvasPopupService.attachPopupToCell(o,n,{componentKey:Je,direction:"horizontal",onClickOutside:()=>this._commandService.syncExecuteCommand(te.id),offset:[5,0]})}_closeFilterPopup(){var e;(e=this._popupDisposable)==null||e.dispose(),this._popupDisposable=null}};Se=qt([k(0,c.Inject(c.Injector)),k(1,c.Inject(g.ComponentManager)),k(2,c.Inject(Q)),k(3,c.Inject($.SheetCanvasPopManagerService)),k(4,c.Inject(u.SheetsFilterService)),k(5,c.Inject(c.LocaleService)),k(6,g.IShortcutService),k(7,c.ICommandService),k(8,g.IMenuManagerService),k(9,c.IContextService),k(10,g.IMessageService),k(11,c.Inject($.SheetsRenderService)),k(12,K.IRenderManagerService)],Se);var Zt=Object.defineProperty,Kt=Object.getOwnPropertyDescriptor,zt=(r,e,t)=>e in r?Zt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Xt=(r,e,t,n)=>{for(var o=n>1?void 0:n?Kt(e,t):e,l=r.length-1,i;l>=0;l--)(i=r[l])&&(o=i(o)||o);return o},Le=(r,e)=>(t,n)=>e(t,n,r),et=(r,e,t)=>zt(r,typeof e!="symbol"?e+"":e,t);const Jt="SHEET_FILTER_UI_PLUGIN";C.UniverSheetsFilterUIPlugin=class extends c.Plugin{constructor(e=Ce,t,n,o){super(),this._config=e,this._injector=t,this._configService=n,this._rpcChannelService=o;const{menu:l,...i}=c.merge({},Ce,this._config);l&&this._configService.setConfig("menu",l,{merge:!0}),this._configService.setConfig(xe,i)}onStarting(){c.registerDependencies(this._injector,[[Q],[ie],[Se]]),this._config.useRemoteFilterValuesGenerator&&this._rpcChannelService&&this._injector.add([pe,{useFactory:()=>me.toModule(this._rpcChannelService.requestChannel(Ne))}])}onReady(){c.touchDependencies(this._injector,[[ie]])}onRendered(){c.touchDependencies(this._injector,[[Se]])}},et(C.UniverSheetsFilterUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),et(C.UniverSheetsFilterUIPlugin,"pluginName",Jt),C.UniverSheetsFilterUIPlugin=Xt([c.DependentOn(u.UniverSheetsFilterPlugin),Le(1,c.Inject(c.Injector)),Le(2,c.IConfigService),Le(3,c.Optional(me.IRPCChannelService))],C.UniverSheetsFilterUIPlugin);var er=Object.getOwnPropertyDescriptor,tr=(r,e,t,n)=>{for(var o=n>1?void 0:n?er(e,t):e,l=r.length-1,i;l>=0;l--)(i=r[l])&&(o=i(o)||o);return o},tt=(r,e)=>(t,n)=>e(t,n,r);C.UniverSheetsFilterUIWorkerPlugin=(Te=class extends c.Plugin{constructor(e,t,n){super(),this._config=e,this._injector=t,this._rpcChannelService=n}onStarting(){[[pe,{useClass:be}]].forEach(e=>this._injector.add(e))}onReady(){this._rpcChannelService.registerChannel(Ne,me.fromModule(this._injector.get(pe)))}},_(Te,"type",c.UniverInstanceType.UNIVER_SHEET),_(Te,"pluginName","SHEET_FILTER_UI_WORKER_PLUGIN"),Te),C.UniverSheetsFilterUIWorkerPlugin=tr([tt(1,c.Inject(c.Injector)),tt(2,me.IRPCChannelService)],C.UniverSheetsFilterUIWorkerPlugin),C.ChangeFilterByOperation=Pe,C.CloseFilterPanelOperation=te,C.OpenFilterPanelOperation=ce,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})}));
|
|
17
|
-
|
|
64
|
+
`,attachRender:e=>(0,d.jsxs)(`div`,{className:`
|
|
65
|
+
univer-ml-1 univer-flex univer-h-5 univer-flex-1 univer-cursor-pointer
|
|
66
|
+
univer-items-center univer-justify-between univer-text-sm univer-text-primary-500
|
|
67
|
+
`,children:[(0,d.jsx)(`span`,{"data-u-comp":`sheets-filter-panel-values-item-count`,className:`
|
|
68
|
+
univer-text-gray-400
|
|
69
|
+
dark:!univer-text-gray-500
|
|
70
|
+
`,children:`(${e.count})`}),(0,d.jsx)(`a`,{className:`
|
|
71
|
+
univer-box-border univer-hidden univer-h-4 univer-whitespace-nowrap univer-px-1.5
|
|
72
|
+
`,onClick:()=>{let t=[];e.children?e.children.forEach(e=>{e.children?e.children.forEach(e=>{t.push(e.key)}):t.push(e.key)}):t.push(e.key),n.onFilterOnly(t)},children:s})]})})})]})]})}function je(){let e=(0,i.useDependency)(n.SheetsFilterSyncController);if(!(0,i.useObservable)(e.visible$,void 0,!0))return null;let r=(0,i.useDependency)(t.LocaleService),a=(0,i.useDependency)(i.IMessageService),o=(0,i.useObservable)(e.enabled$,void 0,!0);return(0,d.jsxs)(`div`,{className:`
|
|
73
|
+
univer-mt-2 univer-flex univer-items-center univer-justify-between univer-text-sm univer-text-gray-900
|
|
74
|
+
dark:!univer-text-gray-200
|
|
75
|
+
`,children:[(0,d.jsxs)(`div`,{className:`univer-flex univer-items-center univer-gap-1`,children:[(0,d.jsx)(`span`,{children:r.t(`sheets-filter.sync.title`)}),(0,d.jsx)(l.Tooltip,{title:o?r.t(`sheets-filter.sync.statusTips.off`):r.t(`sheets-filter.sync.statusTips.on`),asChild:!0,children:(0,d.jsx)(ve,{className:`univer-block`})})]}),(0,d.jsx)(l.Switch,{defaultChecked:o,onChange:t=>{let n=t?r.t(`sheets-filter.sync.switchTips.on`):r.t(`sheets-filter.sync.switchTips.off`);e.setEnabled(t),a.show({content:n,type:l.MessageType.Success,duration:2e3})}})]})}function Me(){var e;let a=(0,i.useDependency)(P),o=(0,i.useDependency)(t.LocaleService),c=(0,i.useDependency)(t.ICommandService),f=(0,i.useObservable)(a.filterBy$,void 0,!0),p=(0,i.useObservable)(a.filterByModel$,void 0,!1),m=(0,i.useObservable)(()=>(p==null?void 0:p.canApply$)||(0,s.of)(!1),void 0,!1,[p]),h=Ne(o),g=!(0,i.useObservable)(a.hasCriteria$),_=(0,u.useCallback)(e=>{c.executeCommand(B.id,{filterBy:e})},[c]),v=(0,u.useCallback)(async()=>{await(p==null?void 0:p.clear()),c.executeCommand(z.id)},[p,c]),y=(0,u.useCallback)(()=>{c.executeCommand(z.id)},[c]),b=(0,u.useCallback)(async()=>{await(p==null?void 0:p.apply()),c.executeCommand(z.id)},[p,c]),x=(e=(0,i.useDependency)(n.SheetsFilterService).activeFilterModel)==null?void 0:e.getRange(),S=a.col,C=(0,i.useComponentsOfPart)(r.SheetsUIPart.FILTER_PANEL_EMBED_POINT);return(0,d.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel`,className:`
|
|
76
|
+
univer-box-border univer-flex univer-max-h-[500px] univer-w-[400px] univer-flex-col univer-rounded-lg
|
|
77
|
+
univer-bg-white univer-p-4 univer-shadow-lg
|
|
78
|
+
dark:!univer-border-gray-600 dark:!univer-bg-gray-700
|
|
79
|
+
`,children:[(0,d.jsx)(i.ComponentContainer,{components:C,sharedProps:{range:x,colIndex:S,onClose:y}}),(0,d.jsx)(`div`,{className:`univer-mb-1 univer-flex-shrink-0 univer-flex-grow-0`,children:(0,d.jsx)(l.Segmented,{value:f,items:h,onChange:e=>_(e)})}),p?(0,d.jsx)(`div`,{"data-u-comp":`sheets-filter-panel-content`,className:`univer-flex-shrink univer-flex-grow univer-pt-2`,children:f===n.FilterBy.VALUES?(0,d.jsx)(Ae,{model:p}):f===n.FilterBy.COLORS?(0,d.jsx)(Te,{model:p}):(0,d.jsx)(De,{model:p})}):(0,d.jsx)(`div`,{className:`univer-flex-1`}),(0,d.jsx)(je,{}),(0,d.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel-footer`,className:`
|
|
80
|
+
univer-mt-4 univer-inline-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-nowrap
|
|
81
|
+
univer-justify-between univer-overflow-hidden
|
|
82
|
+
`,children:[(0,d.jsx)(l.Button,{variant:`link`,onClick:v,disabled:g,children:o.t(`sheets-filter.panel.clear-filter`)}),(0,d.jsxs)(`span`,{className:`univer-flex univer-gap-2`,children:[(0,d.jsx)(l.Button,{variant:`default`,onClick:y,children:o.t(`sheets-filter.panel.cancel`)}),(0,d.jsx)(l.Button,{disabled:!m,variant:`primary`,onClick:b,children:o.t(`sheets-filter.panel.confirm`)})]})]})]})}function Ne(e){return(0,u.useMemo)(()=>[{label:e.t(`sheets-filter.panel.by-values`),value:n.FilterBy.VALUES},{label:e.t(`sheets-filter.panel.by-colors`),value:n.FilterBy.COLORS},{label:e.t(`sheets-filter.panel.by-conditions`),value:n.FilterBy.CONDITIONS}],[e.getCurrentLocale(),e])}let Pe={id:n.SmartToggleSheetsFilterCommand.id,binding:i.KeyCode.L|i.MetaKeys.CTRL_COMMAND|i.MetaKeys.SHIFT,description:`sheets-filter.shortcut.smart-toggle-filter`,preconditions:r.whenSheetEditorFocused,group:`4_sheet-edit`},Fe=`FILTER_PANEL_POPUP`,Z=class extends J{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f){super(f,d),this._injector=e,this._componentManager=t,this._sheetsFilterPanelService=n,this._sheetCanvasPopupService=r,this._sheetsFilterService=i,this._localeService=a,this._shortcutService=o,this._commandService=s,this._menuManagerService=c,this._contextService=l,this._messageService=u,A(this,`_popupDisposable`,void 0),this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[Pe].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}_initCommands(){[n.SmartToggleSheetsFilterCommand,n.RemoveSheetFilterCommand,n.SetSheetFilterRangeCommand,n.SetSheetsFilterCriteriaCommand,n.ClearSheetsFilterCriteriaCommand,n.ReCalcSheetsFilterCommand,B,R,z].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenuItems(){this._menuManagerService.mergeMenu(we)}_initUI(){[[Fe,Me],[`FilterIcon`,ge]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))}),this.disposeWithMe(this._contextService.subscribeContextValue$(L).pipe((0,s.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(){let e=this._sheetsFilterPanelService.filterModel;if(!e)throw Error(`[SheetsFilterUIController]: no filter model when opening filter popup!`);let t=e.getRange(),n=this._sheetsFilterPanelService.col,{startRow:r}=t;this._popupDisposable=this._sheetCanvasPopupService.attachPopupToCell(r,n,{componentKey:Fe,direction:`horizontal`,onClickOutside:()=>this._commandService.syncExecuteCommand(z.id),offset:[5,0]})}_closeFilterPopup(){var e;(e=this._popupDisposable)==null||e.dispose(),this._popupDisposable=null}};Z=v([_(0,(0,t.Inject)(t.Injector)),_(1,(0,t.Inject)(i.ComponentManager)),_(2,(0,t.Inject)(P)),_(3,(0,t.Inject)(r.SheetCanvasPopManagerService)),_(4,(0,t.Inject)(n.SheetsFilterService)),_(5,(0,t.Inject)(t.LocaleService)),_(6,i.IShortcutService),_(7,t.ICommandService),_(8,i.IMenuManagerService),_(9,t.IContextService),_(10,i.IMessageService),_(11,(0,t.Inject)(r.SheetsRenderService)),_(12,a.IRenderManagerService)],Z);let Q=class extends t.Plugin{constructor(e=W,n,r,i){super(),this._config=e,this._injector=n,this._configService=r,this._rpcChannelService=i;let{menu:a,...o}=(0,t.merge)({},W,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(U,o)}onStarting(){(0,t.registerDependencies)(this._injector,[[P],[G],[Z]]),this._config.useRemoteFilterValuesGenerator&&this._rpcChannelService&&this._injector.add([b,{useFactory:()=>(0,c.toModule)(this._rpcChannelService.requestChannel(y))}])}onReady(){(0,t.touchDependencies)(this._injector,[[G]])}onRendered(){(0,t.touchDependencies)(this._injector,[[Z]])}};A(Q,`type`,t.UniverInstanceType.UNIVER_SHEET),A(Q,`pluginName`,`SHEET_FILTER_UI_PLUGIN`),A(Q,`packageName`,V),A(Q,`version`,H),Q=v([(0,t.DependentOn)(n.UniverSheetsFilterPlugin),_(1,(0,t.Inject)(t.Injector)),_(2,t.IConfigService),_(3,(0,t.Optional)(c.IRPCChannelService))],Q);let $=class extends t.Plugin{constructor(e,t,n){super(),this._config=e,this._injector=t,this._rpcChannelService=n}onStarting(){[[b,{useClass:x}]].forEach(e=>this._injector.add(e))}onReady(){this._rpcChannelService.registerChannel(y,(0,c.fromModule)(this._injector.get(b)))}};A($,`type`,t.UniverInstanceType.UNIVER_SHEET),A($,`pluginName`,`SHEET_FILTER_UI_WORKER_PLUGIN`),A($,`packageName`,V),A($,`version`,H),$=v([_(1,(0,t.Inject)(t.Injector)),_(2,c.IRPCChannelService)],$),e.ChangeFilterByOperation=B,e.CloseFilterPanelOperation=z,e.OpenFilterPanelOperation=R,Object.defineProperty(e,`UniverSheetsFilterMobileUIPlugin`,{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,`UniverSheetsFilterUIPlugin`,{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,`UniverSheetsFilterUIWorkerPlugin`,{enumerable:!0,get:function(){return $}})});
|
|
18
83
|
|
|
19
84
|
// index
|
|
20
85
|
(function(e,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/sheets-filter"),require("@univerjs/sheets-filter-ui"),require("@univerjs/sheets-filter/lib/facade")):typeof define=="function"&&define.amd?define(["exports","@univerjs/sheets-filter","@univerjs/sheets-filter-ui","@univerjs/sheets-filter/lib/facade"],i):(e=typeof globalThis<"u"?globalThis:e||self,i(e.UniverPresetSheetsFilter={},e.UniverSheetsFilter,e.UniverSheetsFilterUi))})(this,(function(e,i,t){"use strict";function r(s={}){const{enableSyncSwitch:n}=s;return{plugins:[[i.UniverSheetsFilterPlugin,{enableSyncSwitch:n}],t.UniverSheetsFilterUIPlugin].filter(u=>!!u)}}e.UniverSheetsFilterPreset=r,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
package/lib/umd/locales/ca-ES.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/sheets-filter-ui/locale/ca-ES
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsFilterUiCaES=t())})(this,function(){return{"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":`Alterna el filtre`,"clear-filter-criteria":`Neteja les condicions del filtre`,"re-calc-filter-conditions":`Recalcula les condicions del filtre`},command:{"not-valid-filter-range":`L’interval seleccionat només té una fila i no és vàlid per filtrar.`},shortcut:{"smart-toggle-filter":`Alterna el filtre`},panel:{"clear-filter":`Neteja el filtre`,cancel:`Cancel·la`,confirm:`Confirma`,"by-values":`Per valors`,"by-colors":`Per colors`,"filter-by-cell-fill-color":`Filtra per color de fons de la cel·la`,"filter-by-cell-text-color":`Filtra per color de text de la cel·la`,"filter-by-color-none":`La columna només conté un color`,"by-conditions":`Per condicions`,"filter-only":`Només filtra`,"search-placeholder":`Utilitza espai per separar paraules clau`,"select-all":`Selecciona-ho tot`,"input-values-placeholder":`Introdueix valors`,and:`I`,or:`O`,empty:`(buit)`,"?":`Utilitza “?” per representar un sol caràcter.`,"*":`Utilitza “*” per representar diversos caràcters.`},conditions:{none:`Cap`,empty:`Està buit`,"not-empty":`No està buit`,"text-contains":`El text conté`,"does-not-contain":`El text no conté`,"starts-with":`El text comença amb`,"ends-with":`El text acaba amb`,equals:`El text és igual a`,"greater-than":`Més gran que`,"greater-than-or-equal":`Més gran o igual que`,"less-than":`Menys que`,"less-than-or-equal":`Menys o igual que`,equal:`Igual`,"not-equal":`No igual`,between:`Entre`,"not-between":`No entre`,custom:`Personalitzat`},msg:{"filter-header-forbidden":`No pots moure la fila de capçalera d’un filtre.`},date:{1:`Gener`,2:`Febrer`,3:`Març`,4:`Abril`,5:`Maig`,6:`Juny`,7:`Juliol`,8:`Agost`,9:`Setembre`,10:`Octubre`,11:`Novembre`,12:`Desembre`},sync:{title:`El filtre és visible per a tothom`,statusTips:{on:`Un cop activat, tots els col·laboradors veuran els resultats del filtre`,off:`Un cop desactivat, només tu veuràs els resultats del filtre`},switchTips:{on:`S’ha activat "El filtre és visible per a tothom", tots els col·laboradors veuran els resultats del filtre`,off:`S’ha desactivat "El filtre és visible per a tothom", només tu veuràs els resultats del filtre`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/ca-ES
|
|
6
5
|
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@univerjs/core"),require("@univerjs/sheets-filter-ui/locale/ca-ES")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-filter-ui/locale/ca-ES"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsFilterCaES=i(e.UniverCore,e.UniverSheetsFilterUiCaES))})(this,(function(e,i){"use strict";return e.mergeLocales(i)}));
|
package/lib/umd/locales/en-US.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/sheets-filter-ui/locale/en-US
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsFilterUiEnUS=t())})(this,function(){return{"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":`Toggle Filter`,"clear-filter-criteria":`Clear Filter Conditions`,"re-calc-filter-conditions":`Re-calc Filter Conditions`},command:{"not-valid-filter-range":`The selected range only has one row and not valid for filter.`},shortcut:{"smart-toggle-filter":`Toggle Filter`},panel:{"clear-filter":`Clear Filter`,cancel:`Cancel`,confirm:`Confirm`,"by-values":`By Values`,"by-colors":`By Colors`,"filter-by-cell-fill-color":`Filter by cell fill color`,"filter-by-cell-text-color":`Filter by cell text color`,"filter-by-color-none":`The column contains only one color`,"by-conditions":`By Conditions`,"filter-only":`Filter Only`,"search-placeholder":`Use space to separate keywords`,"select-all":`Select All`,"input-values-placeholder":`Input Values`,and:`AND`,or:`OR`,empty:`(empty)`,"?":`Use “?” to represent a single character.`,"*":`Use “*” to represent multiple characters.`},conditions:{none:`None`,empty:`Is Empty`,"not-empty":`Is Not Empty`,"text-contains":`Text Contains`,"does-not-contain":`Text Does Not Contain`,"starts-with":`Text Starts With`,"ends-with":`Text Ends With`,equals:`Text Equals`,"greater-than":`Greater Than`,"greater-than-or-equal":`Greater Than Or Equal To`,"less-than":`Less Than`,"less-than-or-equal":`Less Than Or Equal To`,equal:`Equal`,"not-equal":`Not Equal`,between:`Between`,"not-between":`Not Between`,custom:`Custom`},msg:{"filter-header-forbidden":`You can't move the header row of a filter.`},date:{1:`January`,2:`February`,3:`March`,4:`April`,5:`May`,6:`June`,7:`July`,8:`August`,9:`September`,10:`October`,11:`November`,12:`December`},sync:{title:`Filter is visible to everyone`,statusTips:{on:`Once on, all collaborators will see the filter results`,off:`Once off, only you will see the filter results`},switchTips:{on:`"Filter is visible to everyone" is turned on, all collaborators will see the filter results`,off:`"Filter is visible to everyone" is turned off, only you will see the filter results`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/en-US
|
|
6
5
|
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@univerjs/core"),require("@univerjs/sheets-filter-ui/locale/en-US")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-filter-ui/locale/en-US"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsFilterEnUS=i(e.UniverCore,e.UniverSheetsFilterUiEnUS))})(this,(function(e,i){"use strict";return e.mergeLocales(i)}));
|
package/lib/umd/locales/es-ES.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/sheets-filter-ui/locale/es-ES
|
|
2
|
-
(function(e,
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsFilterUiEsES=t())})(this,function(){return{"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":`Alternar filtro`,"clear-filter-criteria":`Borrar condiciones de filtro`,"re-calc-filter-conditions":`Recalcular condiciones de filtro`},command:{"not-valid-filter-range":`El rango seleccionado solo tiene una fila y no es válido para filtrar.`},shortcut:{"smart-toggle-filter":`Alternar filtro`},panel:{"clear-filter":`Borrar filtro`,cancel:`Cancelar`,confirm:`Confirmar`,"by-values":`Por valores`,"by-colors":`Por colores`,"filter-by-cell-fill-color":`Filtrar por color de relleno de celda`,"filter-by-cell-text-color":`Filtrar por color de texto de celda`,"filter-by-color-none":`La columna contiene solo un color`,"by-conditions":`Por condiciones`,"filter-only":`Solo filtrar`,"search-placeholder":`Usa espacio para separar palabras clave`,"select-all":`Seleccionar todo`,"input-values-placeholder":`Introducir valores`,and:`Y`,or:`O`,empty:`(vacío)`,"?":`Usa “?” para representar un solo carácter.`,"*":`Usa “*” para representar varios caracteres.`},conditions:{none:`Ninguno`,empty:`Está vacío`,"not-empty":`No está vacío`,"text-contains":`El texto contiene`,"does-not-contain":`El texto no contiene`,"starts-with":`El texto comienza con`,"ends-with":`El texto termina con`,equals:`El texto es igual a`,"greater-than":`Mayor que`,"greater-than-or-equal":`Mayor o igual que`,"less-than":`Menor que`,"less-than-or-equal":`Menor o igual que`,equal:`Igual`,"not-equal":`No igual`,between:`Entre`,"not-between":`No entre`,custom:`Personalizado`},msg:{"filter-header-forbidden":`No puedes mover la fila de encabezado de un filtro.`},date:{1:`Enero`,2:`Febrero`,3:`Marzo`,4:`Abril`,5:`Mayo`,6:`Junio`,7:`Julio`,8:`Agosto`,9:`Septiembre`,10:`Octubre`,11:`Noviembre`,12:`Diciembre`},sync:{title:`El filtro es visible para todos`,statusTips:{on:`Una vez activado, todos los colaboradores verán los resultados del filtro`,off:`Una vez desactivado, solo tú verás los resultados del filtro`},switchTips:{on:`"El filtro es visible para todos" está activado, todos los colaboradores verán los resultados del filtro`,off:`"El filtro es visible para todos" está desactivado, solo tú verás los resultados del filtro`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/es-ES
|
|
6
5
|
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@univerjs/core"),require("@univerjs/sheets-filter-ui/locale/es-ES")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-filter-ui/locale/es-ES"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsFilterEsES=i(e.UniverCore,e.UniverSheetsFilterUiEsES))})(this,(function(e,i){"use strict";return e.mergeLocales(i)}));
|
package/lib/umd/locales/fa-IR.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/sheets-filter-ui/locale/fa-IR
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsFilterUiFaIR=t())})(this,function(){return{"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":`تغییر حالت فیلتر`,"clear-filter-criteria":`پاک کردن شرایط فیلتر`,"re-calc-filter-conditions":`بازمحاسبه شرایط فیلتر`},command:{"not-valid-filter-range":`محدوده انتخاب شده فقط یک ردیف دارد و برای فیلتر معتبر نیست.`},shortcut:{"smart-toggle-filter":`تغییر حالت فیلتر`},panel:{"clear-filter":`پاک کردن فیلتر`,cancel:`انصراف`,confirm:`تایید`,"by-values":`بر اساس مقادیر`,"by-colors":`بر اساس رنگها`,"filter-by-cell-fill-color":`فیلتر بر اساس رنگ پر کردن سلول`,"filter-by-cell-text-color":`فیلتر بر اساس رنگ متن سلول`,"filter-by-color-none":`این ستون فقط شامل یک رنگ است`,"by-conditions":`بر اساس شرایط`,"filter-only":`فقط فیلتر`,"search-placeholder":`برای جداسازی کلیدواژهها از فاصله استفاده کنید`,"select-all":`انتخاب همه`,"input-values-placeholder":`ورود مقادیر`,and:`و`,or:`یا`,empty:`(خالی)`,"?":`برای نمایش یک کاراکتر از “?” استفاده کنید.`,"*":`برای نمایش چندین کاراکتر از “*” استفاده کنید.`},conditions:{none:`هیچ کدام`,empty:`خالی است`,"not-empty":`خالی نیست`,"text-contains":`شامل متن است`,"does-not-contain":`شامل متن نیست`,"starts-with":`با متن شروع میشود`,"ends-with":`با متن پایان مییابد`,equals:`برابر است با`,"greater-than":`بزرگتر از`,"greater-than-or-equal":`بزرگتر از یا برابر با`,"less-than":`کوچکتر از`,"less-than-or-equal":`کوچکتر از یا برابر با`,equal:`برابر است با`,"not-equal":`برابر نیست با`,between:`بین`,"not-between":`بین نیست`,custom:`سفارشی`},msg:{"filter-header-forbidden":`شما نمیتوانید ردیف هدر یک فیلتر را جابهجا کنید.`},date:{1:`ژانویه`,2:`فوریه`,3:`مارس`,4:`آوریل`,5:`مه`,6:`ژوئن`,7:`جولای`,8:`آگوست`,9:`سپتامبر`,10:`اکتبر`,11:`نوامبر`,12:`دسامبر`},sync:{title:`فیلتر برای همه قابل مشاهده است`,statusTips:{on:`پس از روشن شدن، همه همکاران نتایج فیلتر را مشاهده خواهند کرد`,off:`پس از خاموش شدن، فقط شما نتایج فیلتر را مشاهده خواهید کرد`},switchTips:{on:`گزینه "فیلتر برای همه قابل مشاهده است" روشن است، همه همکاران نتایج فیلتر را مشاهده خواهند کرد`,off:`گزینه "فیلتر برای همه قابل مشاهده است" خاموش است، فقط شما نتایج فیلتر را مشاهده خواهید کرد`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/fa-IR
|
|
6
5
|
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@univerjs/core"),require("@univerjs/sheets-filter-ui/locale/fa-IR")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-filter-ui/locale/fa-IR"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsFilterFaIR=i(e.UniverCore,e.UniverSheetsFilterUiFaIR))})(this,(function(e,i){"use strict";return e.mergeLocales(i)}));
|
package/lib/umd/locales/fr-FR.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/sheets-filter-ui/locale/fr-FR
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsFilterUiFrFR=t())})(this,function(){return{"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":`Inverser le filtre`,"clear-filter-criteria":`Effacer les conditions de filtre`,"re-calc-filter-conditions":`Recalculer les conditions de filtre`},command:{"not-valid-filter-range":`La plage sélectionnée n'a qu'une seule ligne et n'est pas valide pour le filtre.`},shortcut:{"smart-toggle-filter":`Inverser le filtre`},panel:{"clear-filter":`Effacer le filtre`,cancel:`Annuler`,confirm:`Confirmer`,"by-values":`Par valeurs`,"by-colors":`Par couleurs`,"filter-by-cell-fill-color":`Filtrer par couleur de remplissage de cellule`,"filter-by-cell-text-color":`Filtrer par couleur de texte de cellule`,"filter-by-color-none":`Cette colonne ne contient qu'une seule couleur`,"by-conditions":`Par conditions`,"filter-only":`Filtrer uniquement`,"search-placeholder":`Utilisez un espace pour séparer les mots-clés`,"select-all":`Tout sélectionner`,"input-values-placeholder":`Saisir des valeurs`,and:`ET`,or:`OU`,empty:`(vide)`,"?":`Utilisez “?” pour représenter un seul caractère.`,"*":`Utilisez “*” pour représenter plusieurs caractères.`},conditions:{none:`Aucun`,empty:`Est vide`,"not-empty":`N'est pas vide`,"text-contains":`Le texte contient`,"does-not-contain":`Le texte ne contient pas`,"starts-with":`Le texte commence par`,"ends-with":`Le texte se termine par`,equals:`Le texte est égal à`,"greater-than":`Supérieur à`,"greater-than-or-equal":`Supérieur ou égal à`,"less-than":`Inférieur à`,"less-than-or-equal":`Inférieur ou égal à`,equal:`Égal à`,"not-equal":`Différent de`,between:`Entre`,"not-between":`Pas entre`,custom:`Personnalisé`},msg:{"filter-header-forbidden":`Vous ne pouvez pas déplacer la ligne d'en-tête d'un filtre.`},date:{1:`Jan`,2:`Fév`,3:`Mar`,4:`Avr`,5:`Mai`,6:`Juin`,7:`Juil`,8:`Août`,9:`Sept`,10:`Oct`,11:`Nov`,12:`Déc`},sync:{title:`Le filtre est visible par tous`,statusTips:{on:`Une fois activé, tous les collaborateurs verront les résultats du filtre`,off:`Une fois désactivé, seul vous verrez les résultats du filtre`},switchTips:{on:`“Le filtre est visible par tous” est activé, tous les collaborateurs verront les résultats du filtre`,off:`“Le filtre est visible par tous” est désactivé, seul vous verrez les résultats du filtre`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/fr-FR
|
|
6
5
|
(function(e,r){typeof exports=="object"&&typeof module<"u"?module.exports=r(require("@univerjs/core"),require("@univerjs/sheets-filter-ui/locale/fr-FR")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-filter-ui/locale/fr-FR"],r):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsFilterFrFR=r(e.UniverCore,e.UniverSheetsFilterUiFrFR))})(this,(function(e,r){"use strict";return e.mergeLocales(r)}));
|
package/lib/umd/locales/ja-JP.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/sheets-filter-ui/locale/ja-JP
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsFilterUiJaJP=t())})(this,function(){return{"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":`フィルタの切替`,"clear-filter-criteria":`フィルタ条件をクリア`,"re-calc-filter-conditions":`フィルタ条件を再計算`},command:{"not-valid-filter-range":`選択範囲に1行しか含まれていないため、フィルタを適用できません。`},shortcut:{"smart-toggle-filter":`フィルタの切替`},panel:{"clear-filter":`フィルタをクリア`,cancel:`キャンセル`,confirm:`確認`,"by-values":`値でフィルタ`,"by-colors":`色でフィルタ`,"filter-by-cell-fill-color":`セルの塗りつぶし色でフィルタ`,"filter-by-cell-text-color":`セルの文字色でフィルタ`,"filter-by-color-none":`この列は単一の色のみを含んでいます`,"by-conditions":`条件でフィルタ`,"filter-only":`フィルタのみ表示`,"search-placeholder":`検索語はスペースで区切る`,"select-all":`すべて選択`,"input-values-placeholder":`値を入力`,and:`AND`,or:`OR`,empty:`(空白)`,"?":`「?」は任意の1文字`,"*":`「*」は任意の複数文字`},conditions:{none:`なし`,empty:`空白セル`,"not-empty":`空白ではない`,"text-contains":`文字列を含む`,"does-not-contain":`文字列を含まない`,"starts-with":`前方一致`,"ends-with":`後方一致`,equals:`一致`,"greater-than":`より大きい`,"greater-than-or-equal":`以上`,"less-than":`より小さい`,"less-than-or-equal":`以下`,equal:`等しい`,"not-equal":`等しくない`,between:`範囲内`,"not-between":`範囲外`,custom:`カスタム`},msg:{"filter-header-forbidden":`フィルタヘッダー行は移動できません。`},date:{1:`1月`,2:`2月`,3:`3月`,4:`4月`,5:`5月`,6:`6月`,7:`7月`,8:`8月`,9:`9月`,10:`10月`,11:`11月`,12:`12月`},sync:{title:`フィルタを全員が表示可能`,statusTips:{on:`有効にすると、すべての共同作業者がフィルタ結果を表示できます。`,off:`無効にすると、自分のみフィルタ結果を表示できます。`},switchTips:{on:`「フィルタを全員が表示可能」が有効な場合、すべての共同作業者がフィルタ結果を表示できます。`,off:`「フィルタを全員が表示可能」が無効な場合、自分のみフィルタ結果を表示できます。`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/ja-JP
|
|
6
5
|
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@univerjs/core"),require("@univerjs/sheets-filter-ui/locale/ja-JP")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-filter-ui/locale/ja-JP"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsFilterJaJP=i(e.UniverCore,e.UniverSheetsFilterUiJaJP))})(this,(function(e,i){"use strict";return e.mergeLocales(i)}));
|
package/lib/umd/locales/ko-KR.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/sheets-filter-ui/locale/ko-KR
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsFilterUiKoKR=t())})(this,function(){return{"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":`필터 토글`,"clear-filter-criteria":`필터 조건 지우기`,"re-calc-filter-conditions":`필터 조건 재계산`},command:{"not-valid-filter-range":`선택한 범위에 한 행만 있어 필터를 적용할 수 없습니다.`},shortcut:{"smart-toggle-filter":`필터 토글`},panel:{"clear-filter":`필터 지우기`,cancel:`취소`,confirm:`확인`,"by-values":`값으로 필터`,"by-colors":`색상으로 필터`,"filter-by-cell-fill-color":`셀 채우기 색상으로 필터`,"filter-by-cell-text-color":`셀 텍스트 색상으로 필터`,"filter-by-color-none":`이 열은 단일 색상만 포함합니다`,"by-conditions":`조건으로 필터`,"filter-only":`필터만 보기`,"search-placeholder":`검색어는 공백으로 구분`,"select-all":`전체 선택`,"input-values-placeholder":`값 입력`,and:`AND`,or:`OR`,empty:`(빈 값)`,"?":`“?”는 임의의 한 문자`,"*":`“*”는 임의의 여러 문자`},conditions:{none:`없음`,empty:`빈 셀`,"not-empty":`빈 셀 아님`,"text-contains":`텍스트 포함`,"does-not-contain":`텍스트 미포함`,"starts-with":`텍스트 시작`,"ends-with":`텍스트 끝`,equals:`텍스트 일치`,"greater-than":`크다`,"greater-than-or-equal":`크거나 같다`,"less-than":`작다`,"less-than-or-equal":`작거나 같다`,equal:`같음`,"not-equal":`같지 않음`,between:`범위 내`,"not-between":`범위 밖`,custom:`사용자 지정`},msg:{"filter-header-forbidden":`필터 헤더 행은 이동할 수 없습니다.`},date:{1:`1월`,2:`2월`,3:`3월`,4:`4월`,5:`5월`,6:`6월`,7:`7월`,8:`8월`,9:`9월`,10:`10월`,11:`11월`,12:`12월`},sync:{title:`필터를 모든 사용자가 볼 수 있음`,statusTips:{on:`활성화하면 모든 협업자가 필터 결과를 볼 수 있습니다.`,off:`비활성화하면 나만 필터 결과를 볼 수 있습니다.`},switchTips:{on:`"필터를 모든 사용자가 볼 수 있음"이 활성화되어 모든 협업자가 필터 결과를 볼 수 있습니다.`,off:`"필터를 모든 사용자가 볼 수 있음"이 비활성화되어 나만 필터 결과를 볼 수 있습니다.`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/ko-KR
|
|
6
5
|
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@univerjs/core"),require("@univerjs/sheets-filter-ui/locale/ko-KR")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-filter-ui/locale/ko-KR"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsFilterKoKR=i(e.UniverCore,e.UniverSheetsFilterUiKoKR))})(this,(function(e,i){"use strict";return e.mergeLocales(i)}));
|
package/lib/umd/locales/ru-RU.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/sheets-filter-ui/locale/ru-RU
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsFilterUiRuRU=t())})(this,function(){return{"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":`Переключить фильтр`,"clear-filter-criteria":`Очистить условия фильтра`,"re-calc-filter-conditions":`Пересчитать условия фильтра`},command:{"not-valid-filter-range":`Выбранный диапазон содержит только одну строку и не подходит для фильтра.`},shortcut:{"smart-toggle-filter":`Переключить фильтр`},panel:{"clear-filter":`Очистить фильтр`,cancel:`Отмена`,confirm:`Подтвердить`,"by-values":`По значениям`,"by-colors":`По цветам`,"filter-by-cell-fill-color":`Фильтр по цвету заливки ячейки`,"filter-by-cell-text-color":`Фильтр по цвету текста ячейки`,"filter-by-color-none":`Этот столбец содержит только один цвет`,"by-conditions":`По условиям`,"filter-only":`Только фильтр`,"search-placeholder":`Используйте пробел для разделения ключевых слов`,"select-all":`Выбрать все`,"input-values-placeholder":`Введите значения`,and:`И`,or:`ИЛИ`,empty:`(пусто)`,"?":`Используйте “?” для обозначения одного символа.`,"*":`Используйте “*” для обозначения нескольких символов.`},conditions:{none:`Нет`,empty:`Пусто`,"not-empty":`Не пусто`,"text-contains":`Содержит текст`,"does-not-contain":`Не содержит текст`,"starts-with":`Начинается с`,"ends-with":`Заканчивается на`,equals:`Равно`,"greater-than":`Больше чем`,"greater-than-or-equal":`Больше или равно`,"less-than":`Меньше чем`,"less-than-or-equal":`Меньше или равно`,equal:`Равно`,"not-equal":`Не равно`,between:`Между`,"not-between":`Не между`,custom:`Пользовательский`},msg:{"filter-header-forbidden":`Вы не можете переместить строку заголовка фильтра.`},date:{1:`Январь`,2:`Февраль`,3:`Март`,4:`Апрель`,5:`Май`,6:`Июнь`,7:`Июль`,8:`Август`,9:`Сентябрь`,10:`Октябрь`,11:`Ноябрь`,12:`Декабрь`},sync:{title:`Фильтр виден всем`,statusTips:{on:`После включения все сотрудники увидят результаты фильтрации`,off:`После отключения только вы увидите результаты фильтрации`},switchTips:{on:`Функция "Фильтр виден всем" включена, все сотрудники увидят результаты фильтрации`,off:`Функция "Фильтр виден всем" отключена, только вы увидите результаты фильтрации`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/ru-RU
|
|
6
5
|
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@univerjs/core"),require("@univerjs/sheets-filter-ui/locale/ru-RU")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-filter-ui/locale/ru-RU"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsFilterRuRU=i(e.UniverCore,e.UniverSheetsFilterUiRuRU))})(this,(function(e,i){"use strict";return e.mergeLocales(i)}));
|
package/lib/umd/locales/sk-SK.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/sheets-filter-ui/locale/sk-SK
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsFilterUiSkSK=t())})(this,function(){return{"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":`Prepnúť filter`,"clear-filter-criteria":`Vymazať podmienky filtra`,"re-calc-filter-conditions":`Prepočítať podmienky filtra`},command:{"not-valid-filter-range":`Vybraný rozsah má iba jeden riadok a nie je vhodný na filtrovanie.`},shortcut:{"smart-toggle-filter":`Prepnúť filter`},panel:{"clear-filter":`Vymazať filter`,cancel:`Zrušiť`,confirm:`Potvrdiť`,"by-values":`Podľa hodnôt`,"by-colors":`Podľa farieb`,"filter-by-cell-fill-color":`Filtrovať podľa farby výplne bunky`,"filter-by-cell-text-color":`Filtrovať podľa farby textu bunky`,"filter-by-color-none":`Stĺpec obsahuje iba jednu farbu`,"by-conditions":`Podľa podmienok`,"filter-only":`Len filtrovať`,"search-placeholder":`Použite medzeru na oddelenie kľúčových slov`,"select-all":`Vybrať všetko`,"input-values-placeholder":`Zadajte hodnoty`,and:`A`,or:`ALEBO`,empty:`(prázdne)`,"?":`Použite „?“ na označenie jedného znaku.`,"*":`Použite „*“ na označenie viacerých znakov.`},conditions:{none:`Žiadne`,empty:`Je prázdne`,"not-empty":`Nie je prázdne`,"text-contains":`Text obsahuje`,"does-not-contain":`Text neobsahuje`,"starts-with":`Text začína na`,"ends-with":`Text končí na`,equals:`Text sa rovná`,"greater-than":`Väčšie ako`,"greater-than-or-equal":`Väčšie alebo rovné`,"less-than":`Menšie ako`,"less-than-or-equal":`Menšie alebo rovné`,equal:`Rovné`,"not-equal":`Nie je rovné`,between:`Medzi`,"not-between":`Nie medzi`,custom:`Vlastné`},msg:{"filter-header-forbidden":`Riadok hlavičky filtra sa nedá presunúť.`},date:{1:`Január`,2:`Február`,3:`Marec`,4:`Apríl`,5:`Máj`,6:`Jún`,7:`Júl`,8:`August`,9:`September`,10:`Október`,11:`November`,12:`December`},sync:{title:`Filter je viditeľný pre všetkých`,statusTips:{on:`Po zapnutí budú všetci spolupracovníci vidieť výsledky filtra`,off:`Po vypnutí budete výsledky filtra vidieť iba vy`},switchTips:{on:`"Filter je viditeľný pre všetkých" je zapnutý, všetci spolupracovníci uvidia výsledky filtra`,off:`"Filter je viditeľný pre všetkých" je vypnutý, výsledky filtra uvidíte iba vy`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/sk-SK
|
|
6
5
|
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@univerjs/core"),require("@univerjs/sheets-filter-ui/locale/sk-SK")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-filter-ui/locale/sk-SK"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsFilterSkSK=i(e.UniverCore,e.UniverSheetsFilterUiSkSK))})(this,(function(e,i){"use strict";return e.mergeLocales(i)}));
|
package/lib/umd/locales/vi-VN.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/sheets-filter-ui/locale/vi-VN
|
|
2
|
-
(function(
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsFilterUiViVN=t())})(this,function(){return{"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":`Lọc`,"clear-filter-criteria":`Xóa điều kiện lọc`,"re-calc-filter-conditions":`Tính toán lại`},command:{"not-valid-filter-range":`Khu vực được chọn chỉ có một hàng, không thể lọc`},shortcut:{"smart-toggle-filter":`Chuyển đổi lọc`},panel:{"clear-filter":`Xóa lọc`,cancel:`Hủy bỏ`,confirm:`Xác nhận`,"by-values":`Theo giá trị`,"by-colors":`Theo màu sắc`,"filter-by-cell-fill-color":`Lọc theo màu nền ô`,"filter-by-cell-text-color":`Lọc theo màu chữ ô`,"filter-by-color-none":`Cột này chỉ chứa một màu`,"by-conditions":`Theo điều kiện`,"filter-only":`Chỉ lọc`,"search-placeholder":`Sử dụng khoảng trắng để tách các từ khóa`,"select-all":`Chọn tất cả`,"input-values-placeholder":`Vui lòng nhập`,or:`hoặc`,and:`và`,empty:`(Trống)`,"?":`Sử dụng ? để đại diện cho một ký tự`,"*":`Sử dụng * để đại diện cho nhiều ký tự`},conditions:{none:`Không`,empty:`Trống`,"not-empty":`Không trống`,"text-contains":`Văn bản chứa`,"does-not-contain":`Văn bản không chứa`,"starts-with":`Văn bản bắt đầu với`,"ends-with":`Văn bản kết thúc với`,equals:`Văn bản khớp`,"greater-than":`Lớn hơn`,"greater-than-or-equal":`Lớn hơn hoặc bằng`,"less-than":`Nhỏ hơn`,"less-than-or-equal":`Nhỏ hơn hoặc bằng`,equal:`Bằng`,"not-equal":`Không bằng`,between:`Giữa`,"not-between":`Không giữa`,custom:`Tùy chỉnh`},msg:{"filter-header-forbidden":`Không thể di chuyển hàng đầu lọc`},date:{1:`Tháng 1`,2:`Tháng 2`,3:`Tháng 3`,4:`Tháng 4`,5:`Tháng 5`,6:`Tháng 6`,7:`Tháng 7`,8:`Tháng 8`,9:`Tháng 9`,10:`Tháng 10`,11:`Tháng 11`,12:`Tháng 12`},sync:{title:`Lọc cho tất cả mọi người đều thấy`,statusTips:{on:`Khi bật, tất cả cộng tác viên sẽ thấy kết quả lọc`,off:`Khi tắt, chỉ bạn mới thấy kết quả lọc`},switchTips:{on:`Đã bật "Lọc cho tất cả mọi người đều thấy", tất cả cộng tác viên sẽ thấy kết quả lọc`,off:`Đã tắt "Lọc cho tất cả mọi người đều thấy", chỉ bạn mới thấy kết quả lọc`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/vi-VN
|
|
6
5
|
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@univerjs/core"),require("@univerjs/sheets-filter-ui/locale/vi-VN")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-filter-ui/locale/vi-VN"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsFilterViVN=i(e.UniverCore,e.UniverSheetsFilterUiViVN))})(this,(function(e,i){"use strict";return e.mergeLocales(i)}));
|
package/lib/umd/locales/zh-CN.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/sheets-filter-ui/locale/zh-CN
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsFilterUiZhCN=t())})(this,function(){return{"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":`筛选`,"clear-filter-criteria":`清除筛选条件`,"re-calc-filter-conditions":`重新计算`},command:{"not-valid-filter-range":`选中的区域只有一行,无法进行筛选`},shortcut:{"smart-toggle-filter":`切换筛选`},panel:{"clear-filter":`清除筛选`,cancel:`取消`,confirm:`确认`,"by-values":`按值`,"by-colors":`按颜色`,"filter-by-cell-fill-color":`按单元格填充颜色筛选`,"filter-by-cell-text-color":`按单元格文本颜色筛选`,"filter-by-color-none":`该列仅包含一种颜色`,"by-conditions":`按条件`,"filter-only":`仅筛选`,"search-placeholder":`使用空格分隔关键字`,"select-all":`全选`,"input-values-placeholder":`请输入`,or:`或`,and:`和`,empty:`(空白)`,"?":`可用 ? 代表单个字符`,"*":`可用 * 代表任意多个字符`},conditions:{none:`无`,empty:`为空`,"not-empty":`不为空`,"text-contains":`文本包含`,"does-not-contain":`文本不包含`,"starts-with":`文本开头`,"ends-with":`文本结尾`,equals:`文本相符`,"greater-than":`大于`,"greater-than-or-equal":`大于等于`,"less-than":`小于`,"less-than-or-equal":`小于等于`,equal:`等于`,"not-equal":`不等于`,between:`介于`,"not-between":`不介于`,custom:`自定义`},msg:{"filter-header-forbidden":`无法移动筛选行头`},date:{1:`1月`,2:`2月`,3:`3月`,4:`4月`,5:`5月`,6:`6月`,7:`7月`,8:`8月`,9:`9月`,10:`10月`,11:`11月`,12:`12月`},sync:{title:`筛选对所有人可见`,statusTips:{on:`开启后,所有协作者都将看到此次筛选结果`,off:`关闭后,仅你可见此次筛选结果`},switchTips:{on:`已开启“筛选对所有人可见”,所有协作者都将看到此次筛选结果`,off:`已关闭“筛选对所有人可见”,仅你可见此次筛选结果`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/zh-CN
|
|
6
5
|
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@univerjs/core"),require("@univerjs/sheets-filter-ui/locale/zh-CN")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-filter-ui/locale/zh-CN"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsFilterZhCN=i(e.UniverCore,e.UniverSheetsFilterUiZhCN))})(this,(function(e,i){"use strict";return e.mergeLocales(i)}));
|
package/lib/umd/locales/zh-TW.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @univerjs/sheets-filter-ui/locale/zh-TW
|
|
2
|
-
(function(e,t){typeof exports
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsFilterUiZhTW=t())})(this,function(){return{"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":`篩選`,"clear-filter-criteria":`清除篩選條件`,"re-calc-filter-conditions":`重新計算`},command:{"not-valid-filter-range":`選取的區域只有一列,無法進行篩選`},shortcut:{"smart-toggle-filter":`切換篩選`},panel:{"clear-filter":`清除篩選`,cancel:`取消`,confirm:`確認`,"by-values":`按值`,"by-colors":`按顏色`,"filter-by-cell-fill-color":`按儲存格填充顏色篩選`,"filter-by-cell-text-color":`按儲存格文字顏色篩選`,"filter-by-color-none":`該欄僅包含一種顏色`,"by-conditions":`按條件`,"filter-only":`僅篩選`,"search-placeholder":`使用空格分隔關鍵字`,"select-all":`全選`,"input-values-placeholder":`請輸入`,or:`或`,and:`和`,empty:`(空白)`,"?":`可用 ? 代表單一字元`,"*":`可用 * 代表任意多個字元`},conditions:{none:`無`,empty:`為空`,"not-empty":`不為空`,"text-contains":`文字包含`,"does-not-contain":`文字不包含`,"starts-with":`文字開頭`,"ends-with":`文字結尾`,equals:`文字相符`,"greater-than":`大於`,"greater-than-or-equal":`大於等於`,"less-than":`小於`,"less-than-or-equal":`小於等於`,equal:`等於`,"not-equal":`不等於`,between:`介於`,"not-between":`不介於`,custom:`自訂`},msg:{"filter-header-forbidden":`無法移動篩選列頭`},date:{1:`1月`,2:`2月`,3:`3月`,4:`4月`,5:`5月`,6:`6月`,7:`7月`,8:`8月`,9:`9月`,10:`10月`,11:`11月`,12:`12月`},sync:{title:`篩選對所有人可見`,statusTips:{on:`開啟後,所有協作者都將看到此次篩選結果`,off:`關閉後,僅你可見此次篩選結果`},switchTips:{on:`已開啟“篩選對所有人可見”,所有協作者都將看到此次篩選結果`,off:`已關閉“篩選對所有人可見”,僅你可見此次篩選結果`}}}}});
|
|
4
3
|
|
|
5
4
|
// locale/zh-TW
|
|
6
5
|
(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@univerjs/core"),require("@univerjs/sheets-filter-ui/locale/zh-TW")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-filter-ui/locale/zh-TW"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsFilterZhTW=i(e.UniverCore,e.UniverSheetsFilterUiZhTW))})(this,(function(e,i){"use strict";return e.mergeLocales(i)}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/preset-sheets-filter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
|
|
@@ -63,16 +63,16 @@
|
|
|
63
63
|
"rxjs": ">=7.0.0"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@univerjs/sheets-filter": "0.
|
|
67
|
-
"@univerjs/sheets-filter-ui": "0.
|
|
66
|
+
"@univerjs/sheets-filter": "0.18.0",
|
|
67
|
+
"@univerjs/sheets-filter-ui": "0.18.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@univerjs/core": "0.
|
|
70
|
+
"@univerjs/core": "0.18.0",
|
|
71
71
|
"react": "18.3.1",
|
|
72
72
|
"react-dom": "18.3.1",
|
|
73
73
|
"rxjs": "7.8.2",
|
|
74
74
|
"typescript": "^5.9.3",
|
|
75
|
-
"@univerjs-infra/shared": "0.
|
|
75
|
+
"@univerjs-infra/shared": "0.18.0"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"prebuild:preset": "tsx prepare.ts",
|