@univerjs/sheets-filter-ui 0.8.2 → 0.8.3-nightly.202507010644
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/cjs/index.js +2 -2
- package/lib/cjs/locale/ko-KR.js +1 -0
- package/lib/es/index.js +401 -403
- package/lib/es/locale/ko-KR.js +70 -0
- package/lib/index.css +1 -1
- package/lib/index.js +401 -403
- package/lib/locale/ko-KR.js +70 -0
- package/lib/types/index.d.ts +4 -2
- package/lib/types/locale/ko-KR.d.ts +3 -0
- package/lib/umd/index.js +2 -2
- package/lib/umd/locale/ko-KR.js +1 -0
- package/package.json +12 -12
- package/LICENSE +0 -176
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
"sheets-filter": {
|
|
3
|
+
toolbar: {
|
|
4
|
+
"smart-toggle-filter-tooltip": "필터 토글",
|
|
5
|
+
"clear-filter-criteria": "필터 조건 지우기",
|
|
6
|
+
"re-calc-filter-conditions": "필터 조건 재계산"
|
|
7
|
+
},
|
|
8
|
+
command: {
|
|
9
|
+
"not-valid-filter-range": "선택한 범위에 한 행만 있어 필터를 적용할 수 없습니다."
|
|
10
|
+
},
|
|
11
|
+
shortcut: {
|
|
12
|
+
"smart-toggle-filter": "필터 토글"
|
|
13
|
+
},
|
|
14
|
+
panel: {
|
|
15
|
+
"clear-filter": "필터 지우기",
|
|
16
|
+
cancel: "취소",
|
|
17
|
+
confirm: "확인",
|
|
18
|
+
"by-values": "값으로 필터",
|
|
19
|
+
"by-conditions": "조건으로 필터",
|
|
20
|
+
"filter-only": "필터만 보기",
|
|
21
|
+
"search-placeholder": "검색어는 공백으로 구분",
|
|
22
|
+
"select-all": "전체 선택",
|
|
23
|
+
"input-values-placeholder": "값 입력",
|
|
24
|
+
and: "AND",
|
|
25
|
+
or: "OR",
|
|
26
|
+
empty: "(빈 값)",
|
|
27
|
+
"?": "“?”는 임의의 한 문자",
|
|
28
|
+
"*": "“*”는 임의의 여러 문자"
|
|
29
|
+
},
|
|
30
|
+
conditions: {
|
|
31
|
+
none: "없음",
|
|
32
|
+
empty: "빈 셀",
|
|
33
|
+
"not-empty": "빈 셀 아님",
|
|
34
|
+
"text-contains": "텍스트 포함",
|
|
35
|
+
"does-not-contain": "텍스트 미포함",
|
|
36
|
+
"starts-with": "텍스트 시작",
|
|
37
|
+
"ends-with": "텍스트 끝",
|
|
38
|
+
equals: "텍스트 일치",
|
|
39
|
+
"greater-than": "크다",
|
|
40
|
+
"greater-than-or-equal": "크거나 같다",
|
|
41
|
+
"less-than": "작다",
|
|
42
|
+
"less-than-or-equal": "작거나 같다",
|
|
43
|
+
equal: "같음",
|
|
44
|
+
"not-equal": "같지 않음",
|
|
45
|
+
between: "범위 내",
|
|
46
|
+
"not-between": "범위 밖",
|
|
47
|
+
custom: "사용자 지정"
|
|
48
|
+
},
|
|
49
|
+
msg: {
|
|
50
|
+
"filter-header-forbidden": "필터 헤더 행은 이동할 수 없습니다."
|
|
51
|
+
},
|
|
52
|
+
date: {
|
|
53
|
+
1: "1월",
|
|
54
|
+
2: "2월",
|
|
55
|
+
3: "3월",
|
|
56
|
+
4: "4월",
|
|
57
|
+
5: "5월",
|
|
58
|
+
6: "6월",
|
|
59
|
+
7: "7월",
|
|
60
|
+
8: "8월",
|
|
61
|
+
9: "9월",
|
|
62
|
+
10: "10월",
|
|
63
|
+
11: "11월",
|
|
64
|
+
12: "12월"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
export {
|
|
69
|
+
e as default
|
|
70
|
+
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import './global.css';
|
|
17
|
-
export {
|
|
17
|
+
export { ChangeFilterByOperation, CloseFilterPanelOperation, OpenFilterPanelOperation } from './commands/operations/sheets-filter.operation';
|
|
18
|
+
export type { IOpenFilterPanelOperationParams } from './commands/operations/sheets-filter.operation';
|
|
19
|
+
export type { IUniverSheetsFilterUIConfig } from './controllers/config.schema';
|
|
18
20
|
export { UniverSheetsFilterMobileUIPlugin } from './mobile-plugin';
|
|
21
|
+
export { UniverSheetsFilterUIPlugin } from './plugin';
|
|
19
22
|
export { UniverSheetsFilterUIWorkerPlugin } from './worker/plugin';
|
|
20
|
-
export { ChangeFilterByOperation, CloseFilterPanelOperation, type IOpenFilterPanelOperationParams, OpenFilterPanelOperation, } from './commands/operations/sheets-filter.operation';
|
package/lib/umd/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(function(_,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@univerjs/core"),require("@univerjs/rpc"),require("@univerjs/sheets-filter"),require("@univerjs/sheets"),require("@univerjs/ui"),require("@univerjs/sheets-ui"),require("rxjs"),require("@univerjs/design"),require("@univerjs/engine-render"),require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/rpc","@univerjs/sheets-filter","@univerjs/sheets","@univerjs/ui","@univerjs/sheets-ui","rxjs","@univerjs/design","@univerjs/engine-render","react/jsx-runtime","react"],c):(_=typeof globalThis<"u"?globalThis:_||self,c(_.UniverSheetsFilterUi={},_.UniverCore,_.UniverRpc,_.UniverSheetsFilter,_.UniverSheets,_.UniverUi,_.UniverSheetsUi,_.rxjs,_.UniverDesign,_.UniverEngineRender,_.React,_.React))})(this,function(_,c,V,u,N,T,U,C,y,ie,d,b){"use strict";var jt=Object.defineProperty;var Gt=(_,c,V)=>c in _?jt(_,c,{enumerable:!0,configurable:!0,writable:!0,value:V}):_[c]=V;var S=(_,c,V)=>Gt(_,typeof c!="symbol"?c+"":c,V);var _e;const we="sheets-filter-ui.config",le={};var P=(t=>(t[t.FIRST=0]="FIRST",t[t.SECOND=1]="SECOND",t))(P||{}),g=(t=>(t.NONE="none",t.STARTS_WITH="startsWith",t.DOES_NOT_START_WITH="doesNotStartWith",t.ENDS_WITH="endsWith",t.DOES_NOT_END_WITH="doesNotEndWith",t.CONTAINS="contains",t.DOES_NOT_CONTAIN="doesNotContain",t.EQUALS="equals",t.NOT_EQUALS="notEquals",t.EMPTY="empty",t.NOT_EMPTY="notEmpty",t.BETWEEN="between",t.NOT_BETWEEN="notBetween",t.CUSTOM="custom",t))(g||{}),p;(t=>{t.NONE={label:"sheets-filter.conditions.none",operator:g.NONE,order:P.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NONE]: should not have initial form params!")},testMappingParams:i=>i.operator1===g.NONE,mapToFilterColumn:()=>null,testMappingFilterColumn:i=>!i.customFilters&&!i.filters?{}:!1},t.EMPTY={label:"sheets-filter.conditions.empty",operator:g.EMPTY,order:P.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===g.EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:""}]}}),testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.val===""&&s.operator===void 0?{operator1:g.EMPTY}:!1}},t.NOT_EMPTY={label:"sheets-filter.conditions.not-empty",operator:g.NOT_EMPTY,order:P.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NOT_EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===g.NOT_EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:"",operator:u.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.val===" "&&s.operator===u.CustomFilterOperator.NOT_EQUALS?{operator1:g.NOT_EMPTY}:!1}},t.TEXT_CONTAINS={label:"sheets-filter.conditions.text-contains",operator:g.CONTAINS,order:P.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:g.CONTAINS,val1:""}),testMappingParams:i=>{const[s]=k(i);return s===g.CONTAINS},mapToFilterColumn:i=>{const{val1:s}=i;return s===""?null:{customFilters:{customFilters:[{val:`*${s}*`}]}}},testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],a=s.val.toString();return!s.operator&&a.startsWith("*")&&a.endsWith("*")?{operator1:g.CONTAINS,val1:a.slice(1,-1)}:!1}},t.DOES_NOT_CONTAIN={label:"sheets-filter.conditions.does-not-contain",operator:g.DOES_NOT_CONTAIN,order:P.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:g.DOES_NOT_CONTAIN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}*`,operator:u.CustomFilterOperator.NOT_EQUALS}]}}),testMappingParams:i=>{const[s]=k(i);return s===g.DOES_NOT_CONTAIN},testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.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:g.DOES_NOT_CONTAIN,val1:a.slice(1,-1)}:!1}},t.STARTS_WITH={label:"sheets-filter.conditions.starts-with",operator:g.STARTS_WITH,order:P.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:g.STARTS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`${i.val1}*`}]}}),testMappingParams:i=>{const[s]=k(i);return s===g.STARTS_WITH},testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],a=s.val.toString();return!s.operator&&a.endsWith("*")&&!a.startsWith("*")?{operator1:g.STARTS_WITH,val1:a.slice(0,-1)}:!1}},t.ENDS_WITH={label:"sheets-filter.conditions.ends-with",operator:g.ENDS_WITH,order:P.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:g.ENDS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}`}]}}),testMappingParams:i=>{const[s]=k(i);return s===g.ENDS_WITH},testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],a=s.val.toString();return!s.operator&&a.startsWith("*")&&!a.endsWith("*")?{operator1:g.ENDS_WITH,val1:a.slice(1)}:!1}},t.EQUALS={label:"sheets-filter.conditions.equals",operator:g.EQUALS,order:P.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:g.EQUALS,val1:""}),testMappingParams:i=>{const[s]=k(i);return s===g.EQUALS},mapToFilterColumn:i=>{const{val1:s}=i;return s===""?null:{customFilters:{customFilters:[{val:s}]}}},testMappingFilterColumn:i=>{var s,a,m;return((a=(s=i.filters)==null?void 0:s.filters)==null?void 0:a.length)===1?{operator1:g.EQUALS,val1:""}:((m=i.customFilters)==null?void 0:m.customFilters.length)===1&&!i.customFilters.customFilters[0].operator?{operator1:g.EQUALS,val1:i.customFilters.customFilters[0].val.toString()}:!1}},t.GREATER_THAN={label:"sheets-filter.conditions.greater-than",operator:u.CustomFilterOperator.GREATER_THAN,numOfParameters:1,order:P.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.GREATER_THAN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:u.CustomFilterOperator.GREATER_THAN}]}}),testMappingParams:i=>{const[s]=k(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()}}},t.GREATER_THAN_OR_EQUAL={label:"sheets-filter.conditions.greater-than-or-equal",operator:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL,numOfParameters:1,order:P.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:""}),testMappingParams:i=>{const[s]=k(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()}}},t.LESS_THAN={label:"sheets-filter.conditions.less-than",operator:u.CustomFilterOperator.LESS_THAN,numOfParameters:1,order:P.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.LESS_THAN,val1:""}),testMappingParams:i=>{const[s]=k(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()}}},t.LESS_THAN_OR_EQUAL={label:"sheets-filter.conditions.less-than-or-equal",operator:u.CustomFilterOperator.LESS_THAN_OR_EQUAL,numOfParameters:1,order:P.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:""}),testMappingParams:i=>{const[s]=k(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()}}},t.EQUAL={label:"sheets-filter.conditions.equal",operator:u.CustomFilterOperator.EQUAL,numOfParameters:1,order:P.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.EQUAL,val1:""}),testMappingParams:i=>{const[s]=k(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()}}},t.NOT_EQUAL={label:"sheets-filter.conditions.not-equal",operator:u.CustomFilterOperator.NOT_EQUALS,numOfParameters:1,order:P.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.NOT_EQUALS,val1:""}),testMappingParams:i=>{const[s]=k(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()}}},t.BETWEEN={label:"sheets-filter.conditions.between",operator:g.BETWEEN,order:P.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:m}=i;if(!s)return!1;const h=[a,m];return h.includes(u.CustomFilterOperator.GREATER_THAN_OR_EQUAL)&&h.includes(u.CustomFilterOperator.LESS_THAN_OR_EQUAL)},mapToFilterColumn:i=>{const{val1:s,val2:a,operator1:m}=i,h=m===u.CustomFilterOperator.GREATER_THAN_OR_EQUAL;return{customFilters:{and:c.BooleanNumber.TRUE,customFilters:[{val:h?s:a,operator:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL},{val:h?a:s,operator:u.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}},testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.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}},t.NOT_BETWEEN={label:"sheets-filter.conditions.not-between",operator:g.NOT_BETWEEN,order:P.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.LESS_THAN,val1:"",operator2:u.CustomFilterOperator.GREATER_THAN,val2:""}),testMappingParams:i=>{const{and:s,operator1:a,operator2:m}=i;if(s)return!1;const h=[a,m];return h.includes(u.CustomFilterOperator.GREATER_THAN)&&h.includes(u.CustomFilterOperator.LESS_THAN)},mapToFilterColumn:i=>{const{val1:s,val2:a,operator1:m}=i,h=m===u.CustomFilterOperator.GREATER_THAN;return{customFilters:{customFilters:[{val:h?s:a,operator:u.CustomFilterOperator.GREATER_THAN},{val:h?a:s,operator:u.CustomFilterOperator.LESS_THAN}]}}},testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.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}},t.CUSTOM={label:"sheets-filter.conditions.custom",operator:g.CUSTOM,order:P.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:g.NONE,val1:"",operator2:g.NONE,val2:""}),testMappingParams:()=>!0,mapToFilterColumn:i=>{const{and:s,val1:a,val2:m,operator1:h,operator2:f}=i;function O(w,M){for(const H of t.ALL_CONDITIONS)if(H.operator===w)return H.mapToFilterColumn({val1:M,operator1:w})}const v=!h||h===t.NONE.operator,I=!f||f===t.NONE.operator;if(v&&I)return t.NONE.mapToFilterColumn({});if(v)return O(f,m);if(I)return O(h,a);const E=O(h,a),A=O(f,m),F={customFilters:[E.customFilters.customFilters[0],A.customFilters.customFilters[0]]};return s&&(F.and=c.BooleanNumber.TRUE),{customFilters:F}},testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.customFilters.length)!==2)return!1;const s=i.customFilters.customFilters.map(h=>l({customFilters:{customFilters:[h]}})),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}},t.ALL_CONDITIONS=[t.NONE,t.EMPTY,t.NOT_EMPTY,t.TEXT_CONTAINS,t.DOES_NOT_CONTAIN,t.STARTS_WITH,t.ENDS_WITH,t.EQUALS,t.GREATER_THAN,t.GREATER_THAN_OR_EQUAL,t.LESS_THAN,t.LESS_THAN_OR_EQUAL,t.EQUAL,t.NOT_EQUAL,t.BETWEEN,t.NOT_BETWEEN,t.CUSTOM];function e(i){const s=t.ALL_CONDITIONS.find(a=>a.operator===i);if(!s)throw new Error(`[SheetsFilter]: no condition item found for operator: ${i}`);return s}t.getItemByOperator=e;function r(i,s){for(const a of t.ALL_CONDITIONS.filter(m=>m.numOfParameters===s))if(a.numOfParameters!==0&&a.testMappingParams(i))return a;for(const a of t.ALL_CONDITIONS)if(a.testMappingParams(i))return a;throw new Error("[SheetsFilter]: no condition item can be mapped from the filter map params!")}t.testMappingParams=r;function n(i){const s=t.ALL_CONDITIONS.find(a=>a.operator===i);return(s==null?void 0:s.numOfParameters)===0?{operator1:s.operator}:s.getDefaultFormParams()}t.getInitialFormParams=n;function o(i,s){return i.mapToFilterColumn(s)}t.mapToFilterColumn=o;function l(i){if(!i)return[t.NONE,{}];for(const s of t.ALL_CONDITIONS){const a=s.testMappingFilterColumn(i);if(a)return[s,a]}return[t.NONE,{}]}t.testMappingFilterColumn=l})(p||(p={}));function k(t){const{operator1:e,operator2:r,val1:n,val2:o}=t;if(e&&r)throw new Error("Both operator1 and operator2 are set!");if(!e&&!r)throw new Error("Neither operator1 and operator2 and both not set!");return e?[e,n]:[r,o]}function Ce(t){const e=[],r=[];let n=0,o=0;function l(i){i.leaf&&(i.checked?(e.push(i),n+=i.count):(r.push(i),o+=i.count)),i.children&&i.children.forEach(l)}return t.forEach(l),{checkedItems:e,uncheckedItems:r,checked:n,unchecked:o}}var Ke=Object.getOwnPropertyDescriptor,Xe=(t,e,r,n)=>{for(var o=n>1?void 0:n?Ke(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},Te=(t,e)=>(r,n)=>e(r,n,t);const Ee="sheets-filter.generate-filter-values.service",ce=c.createIdentifier(Ee),Ze=["yyyy-mm-dd","yyyy-mm-dd;@","yyyy/mm/dd;@","yyyy/mm/dd hh:mm","yyyy-m-d am/pm h:mm","yyyy-MM-dd","yyyy/MM/dd","yyyy/mm/dd",'yyyy"年"MM"月"dd"日"',"MM-dd",'M"月"d"日"',"MM-dd A/P hh:mm"];let Oe=class extends c.Disposable{constructor(t,e,r){super(),this._localeService=t,this._univerInstanceService=e,this._logService=r}async getFilterValues(t){var h;const{unitId:e,subUnitId:r,filteredOutRowsByOtherColumns:n,filters:o,blankChecked:l,iterateRange:i,alreadyChecked:s}=t,a=this._univerInstanceService.getUnit(e),m=(h=this._univerInstanceService.getUnit(e))==null?void 0:h.getSheetBySheetId(r);return!a||!m?[]:(this._logService.debug("[SheetsGenerateFilterValuesService]","getFilterValues for",{unitId:e,subUnitId:r}),Le(o,this._localeService,i,m,new Set(n),new Set(s.map(String)),l,a.getStyles()))}};Oe=Xe([Te(0,c.Inject(c.LocaleService)),Te(1,c.IUniverInstanceService),Te(2,c.ILogService)],Oe);function Le(t,e,r,n,o,l,i,s){var E,A,F,w,M,H,B,ve,Se;const a=new Map,m=new Map,h="yyyy-mm-dd",f=new Set(Ze),O="empty";let v=0;for(const L of n.iterateByColumn(r,!1,!1)){const{row:Vt,rowSpan:qe=1}=L;let te=0;for(;te<qe;){const xt=Vt+te;if(o.has(xt)){te++;continue}const K=L!=null&&L.value?c.extractPureTextFromCell(L.value):"";if(!K){v+=1,te+=qe;continue}const ge=(E=L.value)!=null&&E.v&&!L.value.p?(w=(F=s.get((A=L.value)==null?void 0:A.s))==null?void 0:F.n)==null?void 0:w.pattern:"",Qt=ge&&c.numfmt.getFormatInfo(ge).isDate;if(ge&&Qt&&f.has(ge)){const Y=(M=n.getCellRaw(L.row,L.col))==null?void 0:M.v;if(!Y){te++;continue}const re=c.numfmt.format(h,Y),[R,W,ae]=re.split("-").map(Number);let X=a.get(`${R}`);X||(X={title:`${R}`,key:`${R}`,children:[],count:0,leaf:!1,checked:!1},a.set(`${R}`,X),m.set(`${R}`,[`${R}`]));let Q=(H=X.children)==null?void 0:H.find(Me=>Me.key===`${R}-${W}`);Q||(Q={title:e.t(`sheets-filter.date.${W}`),key:`${R}-${W}`,children:[],count:0,leaf:!1,checked:!1},(B=X.children)==null||B.push(Q),m.set(`${R}-${W}`,[`${R}`,`${R}-${W}`]));const Re=(ve=Q==null?void 0:Q.children)==null?void 0:ve.find(Me=>Me.key===`${R}-${W}-${ae}`);Re?(Re.originValues.add(K),Re.count++,Q.count++,X.count++):((Se=Q.children)==null||Se.push({title:`${ae}`,key:`${R}-${W}-${ae}`,count:1,originValues:new Set([K]),leaf:!0,checked:l.size?l.has(K):!i}),Q.count++,X.count++,m.set(`${R}-${W}-${ae}`,[`${R}`,`${R}-${W}`,`${R}-${W}-${ae}`]))}else{const Y=K;let re=a.get(Y);re?re.count++:(re={title:K,leaf:!0,checked:l.size?l.has(K):!i,key:Y,count:1},a.set(Y,re),m.set(Y,[Y]))}te++}}const I=t?i:!0;if(v>0){const L={title:e.t("sheets-filter.panel.empty"),count:v,leaf:!0,checked:I,key:O};a.set("empty",L),m.set("empty",[O])}return{filterTreeItems:ze(Array.from(a.values())),filterTreeMapCache:m}}function ze(t){return Array.from(t).sort((e,r)=>e.children&&!r.children?-1:!e.children&&r.children?1:Je(e.title,r.title)).map(e=>(e.children&&e.children.sort((r,n)=>{const o=Number.parseInt(r.key.split("-")[1],10),l=Number.parseInt(n.key.split("-")[1],10);return o-l}).forEach(r=>{r.children&&r.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 Ue=t=>!Number.isNaN(Number(t))&&!Number.isNaN(Number.parseFloat(t));function Je(t,e){const r=Ue(t),n=Ue(e);return r&&n?Number.parseFloat(t)-Number.parseFloat(e):r&&!n?-1:!r&&n?1:t.localeCompare(e)}function Ie(t,e){for(const r of t){if(r.key===e)return r;if(r.children){const n=Ie(r.children,e);if(n)return n}}return null}function $e(t){return t.leaf?t.checked:t.children?t.children.every(e=>$e(e)):!0}function ne(t,e){t.leaf&&(e!==void 0?t.checked=e:t.checked=!t.checked),t.children&&t.children.forEach(r=>ne(r,e))}function De(t,e){const r=[];return t.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)r.push({...n});else if(n.children){const s=De(n.children,e);if(s.length>0){const a=s.reduce((m,h)=>m+h.count,0);r.push({...n,count:a,children:s})}}}),r}var et=Object.getOwnPropertyDescriptor,Ne=(t,e,r,n)=>{for(var o=n>1?void 0:n?et(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},ue=(t,e)=>(r,n)=>e(r,n,t),me=(t=>(t[t.VALUES=0]="VALUES",t[t.CONDITIONS=1]="CONDITIONS",t))(me||{});c.createIdentifier("sheets-filter-ui.sheets-filter-panel.service");let j=class extends c.Disposable{constructor(e,r){super();S(this,"_filterBy$",new C.BehaviorSubject(0));S(this,"filterBy$",this._filterBy$.asObservable());S(this,"_filterByModel$",new C.ReplaySubject(1));S(this,"filterByModel$",this._filterByModel$.asObservable());S(this,"_filterByModel",null);S(this,"_hasCriteria$",new C.BehaviorSubject(!1));S(this,"hasCriteria$",this._hasCriteria$.asObservable());S(this,"_filterModel",null);S(this,"_col$",new C.BehaviorSubject(-1));S(this,"col$",this._col$.asObservable());S(this,"_filterHeaderListener",null);this._injector=e,this._refRangeService=r}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,r){this.terminate(),this._filterModel=e,this._col$.next(r);const n=e.getFilterColumn(r);if(n){const o=n.getColumnData();if(o.customFilters){this._hasCriteria$.next(!0),this._setupByConditions(e,r);return}if(o.filters){this._hasCriteria$.next(!0),this._setupByValues(e,r);return}this._hasCriteria$.next(!1),this._setupByValues(e,r);return}this._hasCriteria$.next(!1),this._setupByValues(e,r)}changeFilterBy(e){return!this._filterModel||this.col===-1?!1:(e===0?this._setupByValues(this._filterModel,this.col):this._setupByConditions(this._filterModel,this.col),!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,r){this._disposeFilterHeaderChangeListener();const n=e.unitId,o=e.subUnitId,l=e.getRange(),i={startColumn:r,startRow:l.startRow,endRow:l.startRow,endColumn:r};this._filterHeaderListener=this._refRangeService.watchRange(n,o,i,(s,a)=>{if(!a)this.terminate();else{const m=a.startColumn-s.startColumn;m!==0&&this._filterByModel.deltaCol(m)}})}async _setupByValues(e,r){this._disposePreviousModel();const n=e.getRange();if(n.startRow===n.endRow)return!1;const o=await pe.fromFilterColumn(this._injector,e,r);return this.filterByModel=o,this._filterBy$.next(0),this._listenToFilterHeaderChange(e,r),!0}_setupByConditions(e,r){this._disposePreviousModel();const n=e.getRange();if(n.startRow===n.endRow)return!1;const o=he.fromFilterColumn(this._injector,e,r,e.getFilterColumn(r));return this.filterByModel=o,this._filterBy$.next(1),this._listenToFilterHeaderChange(e,r),!0}_disposePreviousModel(){var e;(e=this._filterByModel)==null||e.dispose(),this.filterByModel=null}};j=Ne([ue(0,c.Inject(c.Injector)),ue(1,c.Inject(N.RefRangeService))],j);let he=class extends c.Disposable{constructor(e,r,n,o,l){super();S(this,"canApply$",C.of(!0));S(this,"_conditionItem$");S(this,"conditionItem$");S(this,"_filterConditionFormParams$");S(this,"filterConditionFormParams$");this._filterModel=e,this.col=r,this._commandService=l,this._conditionItem$=new C.BehaviorSubject(n),this.conditionItem$=this._conditionItem$.asObservable(),this._filterConditionFormParams$=new C.BehaviorSubject(o),this.filterConditionFormParams$=this._filterConditionFormParams$.asObservable()}static fromFilterColumn(e,r,n,o){const[l,i]=p.testMappingFilterColumn(o==null?void 0:o.getColumnData());return e.createInstance(he,r,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=p.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 r=p.ALL_CONDITIONS.find(n=>n.operator===e);if(!r)throw new Error(`[ByConditionsModel]: condition item not found for operator: ${e}!`);this._conditionItem$.next(r),this._filterConditionFormParams$.next(p.getInitialFormParams(e))}onConditionFormChange(e){const r={...this.filterConditionFormParams,...e};if(r.and!==!0&&delete r.and,typeof e.and<"u"||typeof e.operator1<"u"||typeof e.operator2<"u"){const n=p.testMappingParams(r,this.conditionItem.numOfParameters);this._conditionItem$.next(n)}this._filterConditionFormParams$.next(r)}};he=Ne([ue(4,c.ICommandService)],he);let pe=class extends c.Disposable{constructor(e,r,n,o,l){super();S(this,"_rawFilterItems$");S(this,"rawFilterItems$");S(this,"filterItems$");S(this,"_filterItems",[]);S(this,"_treeMapCache");S(this,"canApply$");S(this,"_manuallyUpdateFilterItems$");S(this,"_searchString$");S(this,"searchString$");this._filterModel=e,this.col=r,this._commandService=l,this._treeMapCache=o,this._searchString$=new C.BehaviorSubject(""),this.searchString$=this._searchString$.asObservable(),this._rawFilterItems$=new C.BehaviorSubject(n),this.rawFilterItems$=this._rawFilterItems$.asObservable(),this._manuallyUpdateFilterItems$=new C.Subject,this.filterItems$=C.merge(C.combineLatest([this._searchString$.pipe(C.throttleTime(500,void 0,{leading:!0,trailing:!0}),C.startWith(void 0)),this._rawFilterItems$]).pipe(C.map(([i,s])=>{if(!i)return s;const m=i.toLowerCase().split(/\s+/).filter(h=>!!h);return De(s,m)})),this._manuallyUpdateFilterItems$).pipe(C.shareReplay(1)),this.canApply$=this.filterItems$.pipe(C.map(i=>Ce(i).checked>0)),this.disposeWithMe(this.filterItems$.subscribe(i=>this._filterItems=i))}static async fromFilterColumn(e,r,n){var H;const o=e.get(c.IUniverInstanceService),l=e.get(c.LocaleService),i=e.get(ce,c.Quantity.OPTIONAL),{unitId:s,subUnitId:a}=r,m=o.getUniverSheetInstance(s);if(!m)throw new Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${s}!`);const h=m==null?void 0:m.getSheetBySheetId(a);if(!h)throw new Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${s} and subUnitId: ${a}!`);const f=r.getRange(),O=n,v=(H=r.getFilterColumn(n))==null?void 0:H.getColumnData().filters,I=new Set(v==null?void 0:v.filters),E=!!(v&&v.blank),A=r.getFilteredOutRowsExceptCol(n),F={...f,startRow:f.startRow+1,startColumn:O,endColumn:O};let w,M;if(i){const B=await i.getFilterValues({unitId:s,subUnitId:a,filteredOutRowsByOtherColumns:Array.from(A),filters:!!v,blankChecked:E,iterateRange:F,alreadyChecked:Array.from(I)});w=B.filterTreeItems,M=B.filterTreeMapCache}else{const B=Le(!!v,l,F,h,A,I,E,m.getStyles());w=B.filterTreeItems,M=B.filterTreeMapCache}return e.createInstance(pe,r,n,w,M)}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 r=c.Tools.deepClone(this._filterItems);r.forEach(n=>ne(n,e)),this._manuallyUpdateFilterItems(r)}onFilterCheckToggled(e){const r=c.Tools.deepClone(this._filterItems),n=Ie(r,e.key);if(!n)return;const o=$e(n);ne(n,!o),this._manuallyUpdateFilterItems(r)}onFilterOnly(e){const r=c.Tools.deepClone(this._filterItems);r.forEach(n=>ne(n,!1)),e.forEach(n=>{const o=Ie(r,n);o&&ne(o,!0)}),this._manuallyUpdateFilterItems(r)}_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=Ce(this._filterItems),{checked:r,checkedItems:n}=e,o=this.rawFilterItems;let l=0;for(const m of o)l+=m.count;const i=r===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 m=n.filter(f=>f.key!=="empty");m.length>0&&(a.filters={filters:m.flatMap(f=>f.originValues?Array.from(f.originValues):[f.title])}),m.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})}};pe=Ne([ue(4,c.ICommandService)],pe);const Z="FILTER_PANEL_OPENED",oe={id:"sheet.operation.open-filter-panel",type:c.CommandType.OPERATION,handler:(t,e)=>{const r=t.get(c.IContextService),n=t.get(u.SheetsFilterService),o=t.get(j);t.get(c.ICommandService).syncExecuteCommand(U.SetCellEditVisibleOperation.id,{visible:!1});const{unitId:i,subUnitId:s,col:a}=e,m=n.getFilterModel(i,s);return m?(o.setupCol(m,a),r.getContextValue(Z)||r.setContextValue(Z,!0),!0):!1}},z={id:"sheet.operation.close-filter-panel",type:c.CommandType.OPERATION,handler:t=>{const e=t.get(c.IContextService),r=t.get(j),n=t.get(T.ILayoutService,c.Quantity.OPTIONAL);return e.getContextValue(Z)?(e.setContextValue(Z,!1),n==null||n.focus(),r.terminate()):!1}},Fe={id:"sheet.operation.apply-filter",type:c.CommandType.OPERATION,handler:(t,e)=>{const{filterBy:r}=e;return t.get(j).changeFilterBy(r)}};var tt=Object.getOwnPropertyDescriptor,rt=(t,e,r,n)=>{for(var o=n>1?void 0:n?tt(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},J=(t,e)=>(r,n)=>e(r,n,t);let ee=class extends c.Disposable{constructor(t,e,r,n,o,l){super(),this._sheetsFilterService=t,this._localeService=e,this._commandService=r,this._sheetPermissionCheckPermission=n,this._injector=o,this._sheetsSelectionService=l,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(t=>{var e,r,n;if(t.id===u.SmartToggleSheetsFilterCommand.id){const o=this._injector.get(c.IUniverInstanceService),l=N.getSheetCommandTarget(o);if(!l)return;const{unitId:i,subUnitId:s,worksheet:a}=l,m=(e=this._sheetsFilterService.getFilterModel(i,s))==null?void 0:e.getRange();let h;if(m)h=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[N.RangeProtectionPermissionViewPoint],worksheetTypes:[N.WorksheetFilterPermission,N.WorksheetViewPermission]},[m]);else{const f=(r=this._sheetsSelectionService.getCurrentLastSelection())==null?void 0:r.range;if(f){let O={...f};O=f.startColumn===f.endColumn&&f.startRow===f.endRow?N.expandToContinuousRange(O,{left:!0,right:!0,up:!0,down:!0},a):O,h=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[N.RangeProtectionPermissionViewPoint],worksheetTypes:[N.WorksheetViewPermission,N.WorksheetFilterPermission]},[O],i,s)}else h=this._sheetPermissionCheckPermission.permissionCheckWithoutRange({rangeTypes:[N.RangeProtectionPermissionViewPoint],worksheetTypes:[N.WorksheetViewPermission,N.WorksheetFilterPermission]})}h||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr"))}if(t.id===oe.id){const o=t.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:[N.RangeProtectionPermissionViewPoint],worksheetTypes:[N.WorksheetFilterPermission,N.WorksheetViewPermission]},[a])||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr")))}}))}};ee=rt([J(0,c.Inject(u.SheetsFilterService)),J(1,c.Inject(c.LocaleService)),J(2,c.ICommandService),J(3,c.Inject(N.SheetPermissionCheckController)),J(4,c.Inject(c.Injector)),J(5,c.Inject(N.SheetsSelectionsService))],ee);var D=function(){return D=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},D.apply(this,arguments)},it=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r},ke=b.forwardRef(function(t,e){var r=t.icon,n=t.id,o=t.className,l=t.extend,i=it(t,["icon","id","className","extend"]),s="univerjs-icon univerjs-icon-".concat(n," ").concat(o||"").trim(),a=b.useRef("_".concat(st()));return He(r,"".concat(n),{defIds:r.defIds,idSuffix:a.current},D({ref:e,className:s},i),l)});function He(t,e,r,n,o){return b.createElement(t.tag,D(D({key:e},nt(t,r,o)),n),(ot(t,r).children||[]).map(function(l,i){return He(l,"".concat(e,"-").concat(t.tag,"-").concat(i),r,void 0,o)}))}function nt(t,e,r){var n=D({},t.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1),t.tag==="mask"&&n.id&&(n.id=n.id+e.idSuffix),Object.entries(n).forEach(function(l){var i=l[0],s=l[1];i==="mask"&&typeof s=="string"&&(n[i]=s.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});var o=e.defIds;return!o||o.length===0||(t.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(l){var i=l[0],s=l[1];typeof s=="string"&&(n[i]=s.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function ot(t,e){var r,n=e.defIds;return!n||n.length===0?t:t.tag==="defs"&&(!((r=t.children)===null||r===void 0)&&r.length)?D(D({},t),{children:t.children.map(function(o){return typeof o.attrs.id=="string"&&n&&n.includes(o.attrs.id)?D(D({},o),{attrs:D(D({},o.attrs),{id:o.attrs.id+e.idSuffix})}):o})}):t}function st(){return Math.random().toString(36).substring(2,8)}ke.displayName="UniverIcon";var at={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"}}]},Be=b.forwardRef(function(t,e){return b.createElement(ke,Object.assign({},t,{id:"filter-icon",ref:e,icon:at}))});Be.displayName="FilterIcon";function lt(t){var v,I;const{model:e}=t,r=T.useDependency(c.LocaleService),n=T.useObservable(e.conditionItem$,void 0),o=T.useObservable(e.filterConditionFormParams$,void 0),l=o!=null&&o.and?"AND":"OR",i=b.useCallback(E=>{e.onConditionFormChange({and:E==="AND"})},[e]),s=ct(r),a=b.useCallback(E=>{e.onPrimaryConditionChange(E)},[e]),m=ut(r),h=b.useCallback(E=>{e.onConditionFormChange(E)},[e]),f=r.t("sheets-filter.panel.input-values-placeholder");function O(E,A,F){const w=p.getItemByOperator(E).numOfParameters===1;return d.jsxs(d.Fragment,{children:[F==="operator2"&&d.jsxs(y.RadioGroup,{value:l,onChange:i,children:[d.jsx(y.Radio,{value:"AND",children:r.t("sheets-filter.panel.and")}),d.jsx(y.Radio,{value:"OR",children:r.t("sheets-filter.panel.or")})]}),d.jsx(y.Select,{value:E,options:m,onChange:M=>h({[F]:M})}),w&&d.jsx("div",{children:d.jsx(y.Input,{className:"univer-mt-2",value:A,placeholder:f,onChange:M=>h({[F==="operator1"?"val1":"val2"]:M})})})]})}return d.jsx("div",{"data-u-comp":"sheets-filter-panel-conditions-container",className:"univer-flex univer-h-full univer-flex-col",children:n&&o&&d.jsxs(d.Fragment,{children:[d.jsx(y.Select,{value:n.operator,options:s,onChange:a}),p.getItemByOperator(n.operator).numOfParameters!==0?d.jsxs("div",{"data-u-comp":"sheets-filter-panel-conditions-container-inner",className:y.clsx("univer-mt-2 univer-flex-grow univer-overflow-hidden univer-rounded-md univer-p-2",y.borderClassName),children:[n.numOfParameters>=1&&O(o.operator1,(v=o.val1)!=null?v:"","operator1"),n.numOfParameters>=2&&O(o.operator2,(I=o.val2)!=null?I:"","operator2"),d.jsxs("div",{"data-u-comp":"sheets-filter-panel-conditions-desc",className:"univer-mt-2 univer-text-xs univer-text-gray-500",children:[r.t("sheets-filter.panel.?"),d.jsx("br",{}),r.t("sheets-filter.panel.*")]})]}):null]})})}function ct(t){const e=t.getCurrentLocale();return b.useMemo(()=>[{options:[{label:t.t(p.NONE.label),value:p.NONE.operator}]},{options:[{label:t.t(p.EMPTY.label),value:p.EMPTY.operator},{label:t.t(p.NOT_EMPTY.label),value:p.NOT_EMPTY.operator}]},{options:[{label:t.t(p.TEXT_CONTAINS.label),value:p.TEXT_CONTAINS.operator},{label:t.t(p.DOES_NOT_CONTAIN.label),value:p.DOES_NOT_CONTAIN.operator},{label:t.t(p.STARTS_WITH.label),value:p.STARTS_WITH.operator},{label:t.t(p.ENDS_WITH.label),value:p.ENDS_WITH.operator},{label:t.t(p.EQUALS.label),value:p.EQUALS.operator}]},{options:[{label:t.t(p.GREATER_THAN.label),value:p.GREATER_THAN.operator},{label:t.t(p.GREATER_THAN_OR_EQUAL.label),value:p.GREATER_THAN_OR_EQUAL.operator},{label:t.t(p.LESS_THAN.label),value:p.LESS_THAN.operator},{label:t.t(p.LESS_THAN_OR_EQUAL.label),value:p.LESS_THAN_OR_EQUAL.operator},{label:t.t(p.EQUAL.label),value:p.EQUAL.operator},{label:t.t(p.NOT_EQUAL.label),value:p.NOT_EQUAL.operator},{label:t.t(p.BETWEEN.label),value:p.BETWEEN.operator},{label:t.t(p.NOT_BETWEEN.label),value:p.NOT_BETWEEN.operator}]},{options:[{label:t.t(p.CUSTOM.label),value:p.CUSTOM.operator}]}],[e,t])}function ut(t){const e=t.getCurrentLocale();return b.useMemo(()=>p.ALL_CONDITIONS.filter(r=>r.numOfParameters!==2).map(r=>({label:t.t(r.label),value:r.operator})),[e,t])}function mt(t){const{model:e}=t,r=T.useDependency(c.LocaleService),n=T.useObservable(e.searchString$,"",!0),o=T.useObservable(e.filterItems$,void 0,!0),l=r.t("sheets-filter.panel.filter-only"),i=Ce(o),s=i.checked>0&&i.unchecked===0,a=i.checked>0&&i.unchecked>0,m=e.treeMapCache,h=b.useCallback(()=>{e.onCheckAllToggled(!s)},[e,s]),f=b.useCallback(v=>{e.setSearchString(v)},[e]);function O(v){let I=[];return v.forEach(E=>{E.checked&&I.push(E.key),E.children&&(I=I.concat(O(E.children)))}),I}return d.jsxs("div",{"data-u-comp":"sheets-filter-panel-values-container",className:"univer-flex univer-h-full univer-flex-col",children:[d.jsx(y.Input,{autoFocus:!0,value:n,placeholder:r.t("sheets-filter.panel.search-placeholder"),onChange:f}),d.jsxs("div",{"data-u-comp":"sheets-filter-panel",className:y.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",y.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-pb-0 univer-pl-5 univer-pr-0.5 univer-pt-0 univer-text-sm",children:[d.jsx(y.Checkbox,{indeterminate:a,disabled:o.length===0,checked:s,onChange:h}),d.jsx("span",{"data-u-comp":"sheets-filter-panel-values-item-text",className:"univer-mx-1 univer-inline-block univer-flex-shrink univer-overflow-hidden univer-text-ellipsis univer-whitespace-nowrap univer-text-gray-900 dark:!univer-text-white",children:`${r.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(y.Tree,{data:o,defaultExpandAll:!1,valueGroup:O(o),height:180,onChange:v=>{e.onFilterCheckToggled(v)},defaultCache:m,itemHeight:28,treeNodeClassName:`
|
|
1
|
+
(function(v,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@univerjs/core"),require("@univerjs/sheets-filter"),require("@univerjs/ui"),require("@univerjs/sheets-ui"),require("@univerjs/sheets"),require("rxjs"),require("@univerjs/engine-render"),require("@univerjs/rpc"),require("@univerjs/design"),require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-filter","@univerjs/ui","@univerjs/sheets-ui","@univerjs/sheets","rxjs","@univerjs/engine-render","@univerjs/rpc","@univerjs/design","react/jsx-runtime","react"],c):(v=typeof globalThis<"u"?globalThis:v||self,c(v.UniverSheetsFilterUi={},v.UniverCore,v.UniverSheetsFilter,v.UniverUi,v.UniverSheetsUi,v.UniverSheets,v.rxjs,v.UniverEngineRender,v.UniverRpc,v.UniverDesign,v.React,v.React))})(this,function(v,c,u,T,U,N,C,re,ae,y,d,b){"use strict";var jt=Object.defineProperty;var Gt=(v,c,u)=>c in v?jt(v,c,{enumerable:!0,configurable:!0,writable:!0,value:u}):v[c]=u;var S=(v,c,u)=>Gt(v,typeof c!="symbol"?c+"":c,u);var ve;var P=(t=>(t[t.FIRST=0]="FIRST",t[t.SECOND=1]="SECOND",t))(P||{}),g=(t=>(t.NONE="none",t.STARTS_WITH="startsWith",t.DOES_NOT_START_WITH="doesNotStartWith",t.ENDS_WITH="endsWith",t.DOES_NOT_END_WITH="doesNotEndWith",t.CONTAINS="contains",t.DOES_NOT_CONTAIN="doesNotContain",t.EQUALS="equals",t.NOT_EQUALS="notEquals",t.EMPTY="empty",t.NOT_EMPTY="notEmpty",t.BETWEEN="between",t.NOT_BETWEEN="notBetween",t.CUSTOM="custom",t))(g||{}),p;(t=>{t.NONE={label:"sheets-filter.conditions.none",operator:g.NONE,order:P.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NONE]: should not have initial form params!")},testMappingParams:i=>i.operator1===g.NONE,mapToFilterColumn:()=>null,testMappingFilterColumn:i=>!i.customFilters&&!i.filters?{}:!1},t.EMPTY={label:"sheets-filter.conditions.empty",operator:g.EMPTY,order:P.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===g.EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:""}]}}),testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.val===""&&s.operator===void 0?{operator1:g.EMPTY}:!1}},t.NOT_EMPTY={label:"sheets-filter.conditions.not-empty",operator:g.NOT_EMPTY,order:P.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NOT_EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===g.NOT_EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:"",operator:u.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.val===" "&&s.operator===u.CustomFilterOperator.NOT_EQUALS?{operator1:g.NOT_EMPTY}:!1}},t.TEXT_CONTAINS={label:"sheets-filter.conditions.text-contains",operator:g.CONTAINS,order:P.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:g.CONTAINS,val1:""}),testMappingParams:i=>{const[s]=k(i);return s===g.CONTAINS},mapToFilterColumn:i=>{const{val1:s}=i;return s===""?null:{customFilters:{customFilters:[{val:`*${s}*`}]}}},testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],a=s.val.toString();return!s.operator&&a.startsWith("*")&&a.endsWith("*")?{operator1:g.CONTAINS,val1:a.slice(1,-1)}:!1}},t.DOES_NOT_CONTAIN={label:"sheets-filter.conditions.does-not-contain",operator:g.DOES_NOT_CONTAIN,order:P.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:g.DOES_NOT_CONTAIN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}*`,operator:u.CustomFilterOperator.NOT_EQUALS}]}}),testMappingParams:i=>{const[s]=k(i);return s===g.DOES_NOT_CONTAIN},testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.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:g.DOES_NOT_CONTAIN,val1:a.slice(1,-1)}:!1}},t.STARTS_WITH={label:"sheets-filter.conditions.starts-with",operator:g.STARTS_WITH,order:P.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:g.STARTS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`${i.val1}*`}]}}),testMappingParams:i=>{const[s]=k(i);return s===g.STARTS_WITH},testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],a=s.val.toString();return!s.operator&&a.endsWith("*")&&!a.startsWith("*")?{operator1:g.STARTS_WITH,val1:a.slice(0,-1)}:!1}},t.ENDS_WITH={label:"sheets-filter.conditions.ends-with",operator:g.ENDS_WITH,order:P.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:g.ENDS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}`}]}}),testMappingParams:i=>{const[s]=k(i);return s===g.ENDS_WITH},testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],a=s.val.toString();return!s.operator&&a.startsWith("*")&&!a.endsWith("*")?{operator1:g.ENDS_WITH,val1:a.slice(1)}:!1}},t.EQUALS={label:"sheets-filter.conditions.equals",operator:g.EQUALS,order:P.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:g.EQUALS,val1:""}),testMappingParams:i=>{const[s]=k(i);return s===g.EQUALS},mapToFilterColumn:i=>{const{val1:s}=i;return s===""?null:{customFilters:{customFilters:[{val:s}]}}},testMappingFilterColumn:i=>{var s,a,m;return((a=(s=i.filters)==null?void 0:s.filters)==null?void 0:a.length)===1?{operator1:g.EQUALS,val1:""}:((m=i.customFilters)==null?void 0:m.customFilters.length)===1&&!i.customFilters.customFilters[0].operator?{operator1:g.EQUALS,val1:i.customFilters.customFilters[0].val.toString()}:!1}},t.GREATER_THAN={label:"sheets-filter.conditions.greater-than",operator:u.CustomFilterOperator.GREATER_THAN,numOfParameters:1,order:P.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.GREATER_THAN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:u.CustomFilterOperator.GREATER_THAN}]}}),testMappingParams:i=>{const[s]=k(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()}}},t.GREATER_THAN_OR_EQUAL={label:"sheets-filter.conditions.greater-than-or-equal",operator:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL,numOfParameters:1,order:P.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:""}),testMappingParams:i=>{const[s]=k(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()}}},t.LESS_THAN={label:"sheets-filter.conditions.less-than",operator:u.CustomFilterOperator.LESS_THAN,numOfParameters:1,order:P.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.LESS_THAN,val1:""}),testMappingParams:i=>{const[s]=k(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()}}},t.LESS_THAN_OR_EQUAL={label:"sheets-filter.conditions.less-than-or-equal",operator:u.CustomFilterOperator.LESS_THAN_OR_EQUAL,numOfParameters:1,order:P.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:""}),testMappingParams:i=>{const[s]=k(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()}}},t.EQUAL={label:"sheets-filter.conditions.equal",operator:u.CustomFilterOperator.EQUAL,numOfParameters:1,order:P.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.EQUAL,val1:""}),testMappingParams:i=>{const[s]=k(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()}}},t.NOT_EQUAL={label:"sheets-filter.conditions.not-equal",operator:u.CustomFilterOperator.NOT_EQUALS,numOfParameters:1,order:P.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.NOT_EQUALS,val1:""}),testMappingParams:i=>{const[s]=k(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()}}},t.BETWEEN={label:"sheets-filter.conditions.between",operator:g.BETWEEN,order:P.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:m}=i;if(!s)return!1;const h=[a,m];return h.includes(u.CustomFilterOperator.GREATER_THAN_OR_EQUAL)&&h.includes(u.CustomFilterOperator.LESS_THAN_OR_EQUAL)},mapToFilterColumn:i=>{const{val1:s,val2:a,operator1:m}=i,h=m===u.CustomFilterOperator.GREATER_THAN_OR_EQUAL;return{customFilters:{and:c.BooleanNumber.TRUE,customFilters:[{val:h?s:a,operator:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL},{val:h?a:s,operator:u.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}},testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.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}},t.NOT_BETWEEN={label:"sheets-filter.conditions.not-between",operator:g.NOT_BETWEEN,order:P.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.LESS_THAN,val1:"",operator2:u.CustomFilterOperator.GREATER_THAN,val2:""}),testMappingParams:i=>{const{and:s,operator1:a,operator2:m}=i;if(s)return!1;const h=[a,m];return h.includes(u.CustomFilterOperator.GREATER_THAN)&&h.includes(u.CustomFilterOperator.LESS_THAN)},mapToFilterColumn:i=>{const{val1:s,val2:a,operator1:m}=i,h=m===u.CustomFilterOperator.GREATER_THAN;return{customFilters:{customFilters:[{val:h?s:a,operator:u.CustomFilterOperator.GREATER_THAN},{val:h?a:s,operator:u.CustomFilterOperator.LESS_THAN}]}}},testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.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}},t.CUSTOM={label:"sheets-filter.conditions.custom",operator:g.CUSTOM,order:P.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:g.NONE,val1:"",operator2:g.NONE,val2:""}),testMappingParams:()=>!0,mapToFilterColumn:i=>{const{and:s,val1:a,val2:m,operator1:h,operator2:f}=i;function O(w,M){for(const H of t.ALL_CONDITIONS)if(H.operator===w)return H.mapToFilterColumn({val1:M,operator1:w})}const _=!h||h===t.NONE.operator,I=!f||f===t.NONE.operator;if(_&&I)return t.NONE.mapToFilterColumn({});if(_)return O(f,m);if(I)return O(h,a);const E=O(h,a),A=O(f,m),F={customFilters:[E.customFilters.customFilters[0],A.customFilters.customFilters[0]]};return s&&(F.and=c.BooleanNumber.TRUE),{customFilters:F}},testMappingFilterColumn:i=>{var m;if(((m=i.customFilters)==null?void 0:m.customFilters.length)!==2)return!1;const s=i.customFilters.customFilters.map(h=>l({customFilters:{customFilters:[h]}})),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}},t.ALL_CONDITIONS=[t.NONE,t.EMPTY,t.NOT_EMPTY,t.TEXT_CONTAINS,t.DOES_NOT_CONTAIN,t.STARTS_WITH,t.ENDS_WITH,t.EQUALS,t.GREATER_THAN,t.GREATER_THAN_OR_EQUAL,t.LESS_THAN,t.LESS_THAN_OR_EQUAL,t.EQUAL,t.NOT_EQUAL,t.BETWEEN,t.NOT_BETWEEN,t.CUSTOM];function e(i){const s=t.ALL_CONDITIONS.find(a=>a.operator===i);if(!s)throw new Error(`[SheetsFilter]: no condition item found for operator: ${i}`);return s}t.getItemByOperator=e;function r(i,s){for(const a of t.ALL_CONDITIONS.filter(m=>m.numOfParameters===s))if(a.numOfParameters!==0&&a.testMappingParams(i))return a;for(const a of t.ALL_CONDITIONS)if(a.testMappingParams(i))return a;throw new Error("[SheetsFilter]: no condition item can be mapped from the filter map params!")}t.testMappingParams=r;function n(i){const s=t.ALL_CONDITIONS.find(a=>a.operator===i);return(s==null?void 0:s.numOfParameters)===0?{operator1:s.operator}:s.getDefaultFormParams()}t.getInitialFormParams=n;function o(i,s){return i.mapToFilterColumn(s)}t.mapToFilterColumn=o;function l(i){if(!i)return[t.NONE,{}];for(const s of t.ALL_CONDITIONS){const a=s.testMappingFilterColumn(i);if(a)return[s,a]}return[t.NONE,{}]}t.testMappingFilterColumn=l})(p||(p={}));function k(t){const{operator1:e,operator2:r,val1:n,val2:o}=t;if(e&&r)throw new Error("Both operator1 and operator2 are set!");if(!e&&!r)throw new Error("Neither operator1 and operator2 and both not set!");return e?[e,n]:[r,o]}function Ce(t){const e=[],r=[];let n=0,o=0;function l(i){i.leaf&&(i.checked?(e.push(i),n+=i.count):(r.push(i),o+=i.count)),i.children&&i.children.forEach(l)}return t.forEach(l),{checkedItems:e,uncheckedItems:r,checked:n,unchecked:o}}var Ke=Object.getOwnPropertyDescriptor,Xe=(t,e,r,n)=>{for(var o=n>1?void 0:n?Ke(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},Te=(t,e)=>(r,n)=>e(r,n,t);const Ee="sheets-filter.generate-filter-values.service",le=c.createIdentifier(Ee),Ze=["yyyy-mm-dd","yyyy-mm-dd;@","yyyy/mm/dd;@","yyyy/mm/dd hh:mm","yyyy-m-d am/pm h:mm","yyyy-MM-dd","yyyy/MM/dd","yyyy/mm/dd",'yyyy"年"MM"月"dd"日"',"MM-dd",'M"月"d"日"',"MM-dd A/P hh:mm"];let Oe=class extends c.Disposable{constructor(t,e,r){super(),this._localeService=t,this._univerInstanceService=e,this._logService=r}async getFilterValues(t){var h;const{unitId:e,subUnitId:r,filteredOutRowsByOtherColumns:n,filters:o,blankChecked:l,iterateRange:i,alreadyChecked:s}=t,a=this._univerInstanceService.getUnit(e),m=(h=this._univerInstanceService.getUnit(e))==null?void 0:h.getSheetBySheetId(r);return!a||!m?[]:(this._logService.debug("[SheetsGenerateFilterValuesService]","getFilterValues for",{unitId:e,subUnitId:r}),we(o,this._localeService,i,m,new Set(n),new Set(s.map(String)),l,a.getStyles()))}};Oe=Xe([Te(0,c.Inject(c.LocaleService)),Te(1,c.IUniverInstanceService),Te(2,c.ILogService)],Oe);function we(t,e,r,n,o,l,i,s){var E,A,F,w,M,H,B,_e,Se;const a=new Map,m=new Map,h="yyyy-mm-dd",f=new Set(Ze),O="empty";let _=0;for(const L of n.iterateByColumn(r,!1,!1)){const{row:xt,rowSpan:qe=1}=L;let ee=0;for(;ee<qe;){const Vt=xt+ee;if(o.has(Vt)){ee++;continue}const q=L!=null&&L.value?c.extractPureTextFromCell(L.value):"";if(!q){_+=1,ee+=qe;continue}const ge=(E=L.value)!=null&&E.v&&!L.value.p?(w=(F=s.get((A=L.value)==null?void 0:A.s))==null?void 0:F.n)==null?void 0:w.pattern:"",Qt=ge&&c.numfmt.getFormatInfo(ge).isDate;if(ge&&Qt&&f.has(ge)){const G=(M=n.getCellRaw(L.row,L.col))==null?void 0:M.v;if(!G){ee++;continue}const te=c.numfmt.format(h,G),[R,W,se]=te.split("-").map(Number);let K=a.get(`${R}`);K||(K={title:`${R}`,key:`${R}`,children:[],count:0,leaf:!1,checked:!1},a.set(`${R}`,K),m.set(`${R}`,[`${R}`]));let V=(H=K.children)==null?void 0:H.find(Me=>Me.key===`${R}-${W}`);V||(V={title:e.t(`sheets-filter.date.${W}`),key:`${R}-${W}`,children:[],count:0,leaf:!1,checked:!1},(B=K.children)==null||B.push(V),m.set(`${R}-${W}`,[`${R}`,`${R}-${W}`]));const Re=(_e=V==null?void 0:V.children)==null?void 0:_e.find(Me=>Me.key===`${R}-${W}-${se}`);Re?(Re.originValues.add(q),Re.count++,V.count++,K.count++):((Se=V.children)==null||Se.push({title:`${se}`,key:`${R}-${W}-${se}`,count:1,originValues:new Set([q]),leaf:!0,checked:l.size?l.has(q):!i}),V.count++,K.count++,m.set(`${R}-${W}-${se}`,[`${R}`,`${R}-${W}`,`${R}-${W}-${se}`]))}else{const G=q;let te=a.get(G);te?te.count++:(te={title:q,leaf:!0,checked:l.size?l.has(q):!i,key:G,count:1},a.set(G,te),m.set(G,[G]))}ee++}}const I=t?i:!0;if(_>0){const L={title:e.t("sheets-filter.panel.empty"),count:_,leaf:!0,checked:I,key:O};a.set("empty",L),m.set("empty",[O])}return{filterTreeItems:ze(Array.from(a.values())),filterTreeMapCache:m}}function ze(t){return Array.from(t).sort((e,r)=>e.children&&!r.children?-1:!e.children&&r.children?1:Je(e.title,r.title)).map(e=>(e.children&&e.children.sort((r,n)=>{const o=Number.parseInt(r.key.split("-")[1],10),l=Number.parseInt(n.key.split("-")[1],10);return o-l}).forEach(r=>{r.children&&r.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 Le=t=>!Number.isNaN(Number(t))&&!Number.isNaN(Number.parseFloat(t));function Je(t,e){const r=Le(t),n=Le(e);return r&&n?Number.parseFloat(t)-Number.parseFloat(e):r&&!n?-1:!r&&n?1:t.localeCompare(e)}function Ie(t,e){for(const r of t){if(r.key===e)return r;if(r.children){const n=Ie(r.children,e);if(n)return n}}return null}function Ue(t){return t.leaf?t.checked:t.children?t.children.every(e=>Ue(e)):!0}function ie(t,e){t.leaf&&(e!==void 0?t.checked=e:t.checked=!t.checked),t.children&&t.children.forEach(r=>ie(r,e))}function $e(t,e){const r=[];return t.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)r.push({...n});else if(n.children){const s=$e(n.children,e);if(s.length>0){const a=s.reduce((m,h)=>m+h.count,0);r.push({...n,count:a,children:s})}}}),r}var et=Object.getOwnPropertyDescriptor,Ne=(t,e,r,n)=>{for(var o=n>1?void 0:n?et(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},ce=(t,e)=>(r,n)=>e(r,n,t),ue=(t=>(t[t.VALUES=0]="VALUES",t[t.CONDITIONS=1]="CONDITIONS",t))(ue||{});c.createIdentifier("sheets-filter-ui.sheets-filter-panel.service");let Q=class extends c.Disposable{constructor(e,r){super();S(this,"_filterBy$",new C.BehaviorSubject(0));S(this,"filterBy$",this._filterBy$.asObservable());S(this,"_filterByModel$",new C.ReplaySubject(1));S(this,"filterByModel$",this._filterByModel$.asObservable());S(this,"_filterByModel",null);S(this,"_hasCriteria$",new C.BehaviorSubject(!1));S(this,"hasCriteria$",this._hasCriteria$.asObservable());S(this,"_filterModel",null);S(this,"_col$",new C.BehaviorSubject(-1));S(this,"col$",this._col$.asObservable());S(this,"_filterHeaderListener",null);this._injector=e,this._refRangeService=r}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,r){this.terminate(),this._filterModel=e,this._col$.next(r);const n=e.getFilterColumn(r);if(n){const o=n.getColumnData();if(o.customFilters){this._hasCriteria$.next(!0),this._setupByConditions(e,r);return}if(o.filters){this._hasCriteria$.next(!0),this._setupByValues(e,r);return}this._hasCriteria$.next(!1),this._setupByValues(e,r);return}this._hasCriteria$.next(!1),this._setupByValues(e,r)}changeFilterBy(e){return!this._filterModel||this.col===-1?!1:(e===0?this._setupByValues(this._filterModel,this.col):this._setupByConditions(this._filterModel,this.col),!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,r){this._disposeFilterHeaderChangeListener();const n=e.unitId,o=e.subUnitId,l=e.getRange(),i={startColumn:r,startRow:l.startRow,endRow:l.startRow,endColumn:r};this._filterHeaderListener=this._refRangeService.watchRange(n,o,i,(s,a)=>{if(!a)this.terminate();else{const m=a.startColumn-s.startColumn;m!==0&&this._filterByModel.deltaCol(m)}})}async _setupByValues(e,r){this._disposePreviousModel();const n=e.getRange();if(n.startRow===n.endRow)return!1;const o=await he.fromFilterColumn(this._injector,e,r);return this.filterByModel=o,this._filterBy$.next(0),this._listenToFilterHeaderChange(e,r),!0}_setupByConditions(e,r){this._disposePreviousModel();const n=e.getRange();if(n.startRow===n.endRow)return!1;const o=me.fromFilterColumn(this._injector,e,r,e.getFilterColumn(r));return this.filterByModel=o,this._filterBy$.next(1),this._listenToFilterHeaderChange(e,r),!0}_disposePreviousModel(){var e;(e=this._filterByModel)==null||e.dispose(),this.filterByModel=null}};Q=Ne([ce(0,c.Inject(c.Injector)),ce(1,c.Inject(N.RefRangeService))],Q);let me=class extends c.Disposable{constructor(e,r,n,o,l){super();S(this,"canApply$",C.of(!0));S(this,"_conditionItem$");S(this,"conditionItem$");S(this,"_filterConditionFormParams$");S(this,"filterConditionFormParams$");this._filterModel=e,this.col=r,this._commandService=l,this._conditionItem$=new C.BehaviorSubject(n),this.conditionItem$=this._conditionItem$.asObservable(),this._filterConditionFormParams$=new C.BehaviorSubject(o),this.filterConditionFormParams$=this._filterConditionFormParams$.asObservable()}static fromFilterColumn(e,r,n,o){const[l,i]=p.testMappingFilterColumn(o==null?void 0:o.getColumnData());return e.createInstance(me,r,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=p.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 r=p.ALL_CONDITIONS.find(n=>n.operator===e);if(!r)throw new Error(`[ByConditionsModel]: condition item not found for operator: ${e}!`);this._conditionItem$.next(r),this._filterConditionFormParams$.next(p.getInitialFormParams(e))}onConditionFormChange(e){const r={...this.filterConditionFormParams,...e};if(r.and!==!0&&delete r.and,typeof e.and<"u"||typeof e.operator1<"u"||typeof e.operator2<"u"){const n=p.testMappingParams(r,this.conditionItem.numOfParameters);this._conditionItem$.next(n)}this._filterConditionFormParams$.next(r)}};me=Ne([ce(4,c.ICommandService)],me);let he=class extends c.Disposable{constructor(e,r,n,o,l){super();S(this,"_rawFilterItems$");S(this,"rawFilterItems$");S(this,"filterItems$");S(this,"_filterItems",[]);S(this,"_treeMapCache");S(this,"canApply$");S(this,"_manuallyUpdateFilterItems$");S(this,"_searchString$");S(this,"searchString$");this._filterModel=e,this.col=r,this._commandService=l,this._treeMapCache=o,this._searchString$=new C.BehaviorSubject(""),this.searchString$=this._searchString$.asObservable(),this._rawFilterItems$=new C.BehaviorSubject(n),this.rawFilterItems$=this._rawFilterItems$.asObservable(),this._manuallyUpdateFilterItems$=new C.Subject,this.filterItems$=C.merge(C.combineLatest([this._searchString$.pipe(C.throttleTime(500,void 0,{leading:!0,trailing:!0}),C.startWith(void 0)),this._rawFilterItems$]).pipe(C.map(([i,s])=>{if(!i)return s;const m=i.toLowerCase().split(/\s+/).filter(h=>!!h);return $e(s,m)})),this._manuallyUpdateFilterItems$).pipe(C.shareReplay(1)),this.canApply$=this.filterItems$.pipe(C.map(i=>Ce(i).checked>0)),this.disposeWithMe(this.filterItems$.subscribe(i=>this._filterItems=i))}static async fromFilterColumn(e,r,n){var H;const o=e.get(c.IUniverInstanceService),l=e.get(c.LocaleService),i=e.get(le,c.Quantity.OPTIONAL),{unitId:s,subUnitId:a}=r,m=o.getUniverSheetInstance(s);if(!m)throw new Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${s}!`);const h=m==null?void 0:m.getSheetBySheetId(a);if(!h)throw new Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${s} and subUnitId: ${a}!`);const f=r.getRange(),O=n,_=(H=r.getFilterColumn(n))==null?void 0:H.getColumnData().filters,I=new Set(_==null?void 0:_.filters),E=!!(_&&_.blank),A=r.getFilteredOutRowsExceptCol(n),F={...f,startRow:f.startRow+1,startColumn:O,endColumn:O};let w,M;if(i){const B=await i.getFilterValues({unitId:s,subUnitId:a,filteredOutRowsByOtherColumns:Array.from(A),filters:!!_,blankChecked:E,iterateRange:F,alreadyChecked:Array.from(I)});w=B.filterTreeItems,M=B.filterTreeMapCache}else{const B=we(!!_,l,F,h,A,I,E,m.getStyles());w=B.filterTreeItems,M=B.filterTreeMapCache}return e.createInstance(he,r,n,w,M)}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 r=c.Tools.deepClone(this._filterItems);r.forEach(n=>ie(n,e)),this._manuallyUpdateFilterItems(r)}onFilterCheckToggled(e){const r=c.Tools.deepClone(this._filterItems),n=Ie(r,e.key);if(!n)return;const o=Ue(n);ie(n,!o),this._manuallyUpdateFilterItems(r)}onFilterOnly(e){const r=c.Tools.deepClone(this._filterItems);r.forEach(n=>ie(n,!1)),e.forEach(n=>{const o=Ie(r,n);o&&ie(o,!0)}),this._manuallyUpdateFilterItems(r)}_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=Ce(this._filterItems),{checked:r,checkedItems:n}=e,o=this.rawFilterItems;let l=0;for(const m of o)l+=m.count;const i=r===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 m=n.filter(f=>f.key!=="empty");m.length>0&&(a.filters={filters:m.flatMap(f=>f.originValues?Array.from(f.originValues):[f.title])}),m.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})}};he=Ne([ce(4,c.ICommandService)],he);const X="FILTER_PANEL_OPENED",ne={id:"sheet.operation.open-filter-panel",type:c.CommandType.OPERATION,handler:(t,e)=>{const r=t.get(c.IContextService),n=t.get(u.SheetsFilterService),o=t.get(Q);t.get(c.ICommandService).syncExecuteCommand(U.SetCellEditVisibleOperation.id,{visible:!1});const{unitId:i,subUnitId:s,col:a}=e,m=n.getFilterModel(i,s);return m?(o.setupCol(m,a),r.getContextValue(X)||r.setContextValue(X,!0),!0):!1}},Z={id:"sheet.operation.close-filter-panel",type:c.CommandType.OPERATION,handler:t=>{const e=t.get(c.IContextService),r=t.get(Q),n=t.get(T.ILayoutService,c.Quantity.OPTIONAL);return e.getContextValue(X)?(e.setContextValue(X,!1),n==null||n.focus(),r.terminate()):!1}},Fe={id:"sheet.operation.apply-filter",type:c.CommandType.OPERATION,handler:(t,e)=>{const{filterBy:r}=e;return t.get(Q).changeFilterBy(r)}},De="sheets-filter-ui.config",pe={};var tt=Object.getOwnPropertyDescriptor,rt=(t,e,r,n)=>{for(var o=n>1?void 0:n?tt(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},z=(t,e)=>(r,n)=>e(r,n,t);let J=class extends c.Disposable{constructor(t,e,r,n,o,l){super(),this._sheetsFilterService=t,this._localeService=e,this._commandService=r,this._sheetPermissionCheckPermission=n,this._injector=o,this._sheetsSelectionService=l,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(t=>{var e,r,n;if(t.id===u.SmartToggleSheetsFilterCommand.id){const o=this._injector.get(c.IUniverInstanceService),l=N.getSheetCommandTarget(o);if(!l)return;const{unitId:i,subUnitId:s,worksheet:a}=l,m=(e=this._sheetsFilterService.getFilterModel(i,s))==null?void 0:e.getRange();let h;if(m)h=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[N.RangeProtectionPermissionViewPoint],worksheetTypes:[N.WorksheetFilterPermission,N.WorksheetViewPermission]},[m]);else{const f=(r=this._sheetsSelectionService.getCurrentLastSelection())==null?void 0:r.range;if(f){let O={...f};O=f.startColumn===f.endColumn&&f.startRow===f.endRow?N.expandToContinuousRange(O,{left:!0,right:!0,up:!0,down:!0},a):O,h=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[N.RangeProtectionPermissionViewPoint],worksheetTypes:[N.WorksheetViewPermission,N.WorksheetFilterPermission]},[O],i,s)}else h=this._sheetPermissionCheckPermission.permissionCheckWithoutRange({rangeTypes:[N.RangeProtectionPermissionViewPoint],worksheetTypes:[N.WorksheetViewPermission,N.WorksheetFilterPermission]})}h||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr"))}if(t.id===ne.id){const o=t.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:[N.RangeProtectionPermissionViewPoint],worksheetTypes:[N.WorksheetFilterPermission,N.WorksheetViewPermission]},[a])||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr")))}}))}};J=rt([z(0,c.Inject(u.SheetsFilterService)),z(1,c.Inject(c.LocaleService)),z(2,c.ICommandService),z(3,c.Inject(N.SheetPermissionCheckController)),z(4,c.Inject(c.Injector)),z(5,c.Inject(N.SheetsSelectionsService))],J);const j=16,it=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 ke{static drawNoCriteria(e,r,n,o){e.save(),re.Rect.drawWith(e,{radius:2,width:j,height:j,fill:o}),e.lineCap="square",e.strokeStyle=n,e.scale(r/j,r/j),e.beginPath(),e.lineWidth=1,e.lineCap="round",e.moveTo(3,4),e.lineTo(13,4),e.moveTo(4.5,8),e.lineTo(11.5,8),e.moveTo(6,12),e.lineTo(10,12),e.stroke(),e.restore()}static drawHasCriteria(e,r,n,o){e.save(),re.Rect.drawWith(e,{radius:2,width:j,height:j,fill:o}),e.scale(r/j,r/j),e.fillStyle=n,e.fill(it),e.restore()}}var nt=Object.getOwnPropertyDescriptor,ot=(t,e,r,n)=>{for(var o=n>1?void 0:n?nt(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},ye=(t,e)=>(r,n)=>e(r,n,t);const x=16,de=1;let Pe=class extends re.Shape{constructor(e,r,n,o,l){super(e,r);S(this,"_cellWidth",0);S(this,"_cellHeight",0);S(this,"_filterParams");S(this,"_hovered",!1);this._contextService=n,this._commandService=o,this._themeService=l,this.setShapeProps(r),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 r=this._cellHeight,n=this._cellWidth,o=x-n,l=x-r;e.save();const i=new Path2D;i.rect(o,l,n,r),e.clip(i);const{hasCriteria:s}=this._filterParams,a=this._themeService.getColorFromTheme("primary.600"),m=this._hovered?this._themeService.getColorFromTheme("gray.50"):"rgba(255, 255, 255, 1.0)";s?ke.drawHasCriteria(e,x,a,m):ke.drawNoCriteria(e,x,a,m),e.restore()}onPointerDown(e){if(e.button===2)return;const{col:r,unitId:n,subUnitId:o}=this._filterParams;this._contextService.getContextValue(X)||!this._commandService.hasCommand(ne.id)||setTimeout(()=>{this._commandService.executeCommand(ne.id,{unitId:n,subUnitId:o,col:r})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};Pe=ot([ye(2,c.IContextService),ye(3,c.ICommandService),ye(4,c.Inject(c.ThemeService))],Pe);var st=Object.getOwnPropertyDescriptor,at=(t,e,r,n)=>{for(var o=n>1?void 0:n?st(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},Y=(t,e)=>(r,n)=>e(r,n,t);const lt=1e3,ct=5e3;let be=class extends c.RxDisposable{constructor(e,r,n,o,l,i,s,a){super();S(this,"_filterRangeShape",null);S(this,"_buttonRenderDisposable",null);S(this,"_filterButtonShapes",[]);this._context=e,this._injector=r,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(C.switchMap(e=>{var s,a;if(!e)return C.of(null);const{unit:r,unitId:n}=this._context,o=((s=r.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(C.filter(([m])=>{var h;return m.type===c.CommandType.MUTATION&&((h=m.params)==null?void 0:h.unitId)===r.getUnitId()&&(u.FILTER_MUTATIONS.has(m.id)||m.id===N.SetRangeValuesMutation.id)}),C.throttleTime(20,void 0,{leading:!1,trailing:!0}),C.map(i),C.startWith(i()))}),C.takeUntil(this.dispose$)).subscribe(e=>{this._disposeRendering(),!(!e||!e.range)&&(this._renderRange(e.range,e.skeleton),this._renderButtons(e))})}_renderRange(e,r){const{scene:n}=this._context,{rowHeaderWidth:o,columnHeaderHeight:l}=r,i=this._filterRangeShape=new U.SelectionControl(n,lt,this._themeService,{rowHeaderWidth:o,columnHeaderHeight:l,enableAutoFill:!1,highlightHeader:!1}),s={range:e,primary:null,style:{fill:"rgba(0, 0, 0, 0.0)"}},a=U.attachSelectionWithCoord(s,r);i.updateRangeBySelectionWithCoord(a),i.setEvent(!1),n.makeDirty(!0)}_renderButtons(e){const{range:r,filterModel:n,unitId:o,skeleton:l,worksheetId:i}=e,{scene:s}=this._context;this._interceptCellContent(o,i,e.range);const{startColumn:a,endColumn:m,startRow:h}=r;for(let f=a;f<=m;f++){const O=`sheets-filter-button-${f}`,_=U.getCoordByCell(h,f,s,l),{startX:I,startY:E,endX:A,endY:F}=_,w=A-I,M=F-E;if(M<=de||w<=de)continue;const H=!!n.getFilterColumn(f),B=A-x-de,_e=F-x-de,Se={left:B,top:_e,height:x,width:x,zIndex:ct,cellHeight:M,cellWidth:w,filterParams:{unitId:o,subUnitId:i,col:f,hasCriteria:H}},L=this._injector.createInstance(Pe,O,Se);this._filterButtonShapes.push(L)}s.addObjects(this._filterButtonShapes),s.makeDirty()}_interceptCellContent(e,r,n){const{startRow:o,startColumn:l,endColumn:i}=n;this._buttonRenderDisposable=this._sheetInterceptorService.intercept(N.INTERCEPTOR_POINT.CELL_CONTENT,{effect:c.InterceptorEffectEnum.Style,handler:(s,a,m)=>{const{row:h,col:f,unitId:O,subUnitId:_}=a;return O!==e||_!==r||h!==o||f<l||f>i||((!s||s===a.rawData)&&(s={...a.rawData}),s.fontRenderExtension={...s==null?void 0:s.fontRenderExtension,rightOffset:x}),m(s)},priority:10})}_disposeRendering(){var e,r;(e=this._filterRangeShape)==null||e.dispose(),this._filterButtonShapes.forEach(n=>n.dispose()),(r=this._buttonRenderDisposable)==null||r.dispose(),this._filterRangeShape=null,this._buttonRenderDisposable=null,this._filterButtonShapes=[]}};be=at([Y(1,c.Inject(c.Injector)),Y(2,c.Inject(U.SheetSkeletonManagerService)),Y(3,c.Inject(u.SheetsFilterService)),Y(4,c.Inject(c.ThemeService)),Y(5,c.Inject(N.SheetInterceptorService)),Y(6,c.ICommandService),Y(7,U.ISheetSelectionRenderService)],be);var ut=Object.getOwnPropertyDescriptor,mt=(t,e,r,n)=>{for(var o=n>1?void 0:n?ut(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},He=(t,e)=>(r,n)=>e(r,n,t);let oe=class extends c.RxDisposable{constructor(t,e){super(),this._renderManagerService=t,this._sheetsRenderService=e,[u.SetSheetsFilterRangeMutation,u.SetSheetsFilterCriteriaMutation,u.RemoveSheetsFilterMutation,u.ReCalcSheetsFilterMutation].forEach(r=>this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(r.id))),this.disposeWithMe(this._renderManagerService.registerRenderModule(c.UniverInstanceType.UNIVER_SHEET,[be]))}};oe=mt([He(0,re.IRenderManagerService),He(1,c.Inject(U.SheetsRenderService))],oe);var ht=Object.defineProperty,pt=Object.getOwnPropertyDescriptor,dt=(t,e,r)=>e in t?ht(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ft=(t,e,r,n)=>{for(var o=n>1?void 0:n?pt(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},Be=(t,e)=>(r,n)=>e(r,n,t),We=(t,e,r)=>dt(t,typeof e!="symbol"?e+"":e,r);const vt="SHEET_FILTER_UI_PLUGIN";v.UniverSheetsFilterMobileUIPlugin=class extends c.Plugin{constructor(e=pe,r,n){super(),this._config=e,this._injector=r,this._configService=n;const{menu:o,...l}=c.merge({},pe,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(De,l)}onStarting(){[[J],[oe]].forEach(e=>this._injector.add(e))}onReady(){this._injector.get(J)}onRendered(){this._injector.get(oe)}},We(v.UniverSheetsFilterMobileUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),We(v.UniverSheetsFilterMobileUIPlugin,"pluginName",vt),v.UniverSheetsFilterMobileUIPlugin=ft([c.DependentOn(u.UniverSheetsFilterPlugin),Be(1,c.Inject(c.Injector)),Be(2,c.IConfigService)],v.UniverSheetsFilterMobileUIPlugin);var D=function(){return D=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},D.apply(this,arguments)},_t=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r},xe=b.forwardRef(function(t,e){var r=t.icon,n=t.id,o=t.className,l=t.extend,i=_t(t,["icon","id","className","extend"]),s="univerjs-icon univerjs-icon-".concat(n," ").concat(o||"").trim(),a=b.useRef("_".concat(Ct()));return Ve(r,"".concat(n),{defIds:r.defIds,idSuffix:a.current},D({ref:e,className:s},i),l)});function Ve(t,e,r,n,o){return b.createElement(t.tag,D(D({key:e},St(t,r,o)),n),(gt(t,r).children||[]).map(function(l,i){return Ve(l,"".concat(e,"-").concat(t.tag,"-").concat(i),r,void 0,o)}))}function St(t,e,r){var n=D({},t.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1),t.tag==="mask"&&n.id&&(n.id=n.id+e.idSuffix),Object.entries(n).forEach(function(l){var i=l[0],s=l[1];i==="mask"&&typeof s=="string"&&(n[i]=s.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});var o=e.defIds;return!o||o.length===0||(t.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(l){var i=l[0],s=l[1];typeof s=="string"&&(n[i]=s.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function gt(t,e){var r,n=e.defIds;return!n||n.length===0?t:t.tag==="defs"&&(!((r=t.children)===null||r===void 0)&&r.length)?D(D({},t),{children:t.children.map(function(o){return typeof o.attrs.id=="string"&&n&&n.includes(o.attrs.id)?D(D({},o),{attrs:D(D({},o.attrs),{id:o.attrs.id+e.idSuffix})}):o})}):t}function Ct(){return Math.random().toString(36).substring(2,8)}xe.displayName="UniverIcon";var Tt={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"}}]},Qe=b.forwardRef(function(t,e){return b.createElement(xe,Object.assign({},t,{id:"filter-icon",ref:e,icon:Tt}))});Qe.displayName="FilterIcon";function Et(t){var _,I;const{model:e}=t,r=T.useDependency(c.LocaleService),n=T.useObservable(e.conditionItem$,void 0),o=T.useObservable(e.filterConditionFormParams$,void 0),l=o!=null&&o.and?"AND":"OR",i=b.useCallback(E=>{e.onConditionFormChange({and:E==="AND"})},[e]),s=Ot(r),a=b.useCallback(E=>{e.onPrimaryConditionChange(E)},[e]),m=It(r),h=b.useCallback(E=>{e.onConditionFormChange(E)},[e]),f=r.t("sheets-filter.panel.input-values-placeholder");function O(E,A,F){const w=p.getItemByOperator(E).numOfParameters===1;return d.jsxs(d.Fragment,{children:[F==="operator2"&&d.jsxs(y.RadioGroup,{value:l,onChange:i,children:[d.jsx(y.Radio,{value:"AND",children:r.t("sheets-filter.panel.and")}),d.jsx(y.Radio,{value:"OR",children:r.t("sheets-filter.panel.or")})]}),d.jsx(y.Select,{value:E,options:m,onChange:M=>h({[F]:M})}),w&&d.jsx("div",{children:d.jsx(y.Input,{className:"univer-mt-2",value:A,placeholder:f,onChange:M=>h({[F==="operator1"?"val1":"val2"]:M})})})]})}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(y.Select,{value:n.operator,options:s,onChange:a}),p.getItemByOperator(n.operator).numOfParameters!==0?d.jsxs("div",{"data-u-comp":"sheets-filter-panel-conditions-container-inner",className:y.clsx("univer-mt-2 univer-flex-grow univer-overflow-hidden univer-rounded-md univer-p-2",y.borderClassName),children:[n.numOfParameters>=1&&O(o.operator1,(_=o.val1)!=null?_:"","operator1"),n.numOfParameters>=2&&O(o.operator2,(I=o.val2)!=null?I:"","operator2"),d.jsxs("div",{"data-u-comp":"sheets-filter-panel-conditions-desc",className:"univer-mt-2 univer-text-xs univer-text-gray-500",children:[r.t("sheets-filter.panel.?"),d.jsx("br",{}),r.t("sheets-filter.panel.*")]})]}):null]})})}function Ot(t){const e=t.getCurrentLocale();return b.useMemo(()=>[{options:[{label:t.t(p.NONE.label),value:p.NONE.operator}]},{options:[{label:t.t(p.EMPTY.label),value:p.EMPTY.operator},{label:t.t(p.NOT_EMPTY.label),value:p.NOT_EMPTY.operator}]},{options:[{label:t.t(p.TEXT_CONTAINS.label),value:p.TEXT_CONTAINS.operator},{label:t.t(p.DOES_NOT_CONTAIN.label),value:p.DOES_NOT_CONTAIN.operator},{label:t.t(p.STARTS_WITH.label),value:p.STARTS_WITH.operator},{label:t.t(p.ENDS_WITH.label),value:p.ENDS_WITH.operator},{label:t.t(p.EQUALS.label),value:p.EQUALS.operator}]},{options:[{label:t.t(p.GREATER_THAN.label),value:p.GREATER_THAN.operator},{label:t.t(p.GREATER_THAN_OR_EQUAL.label),value:p.GREATER_THAN_OR_EQUAL.operator},{label:t.t(p.LESS_THAN.label),value:p.LESS_THAN.operator},{label:t.t(p.LESS_THAN_OR_EQUAL.label),value:p.LESS_THAN_OR_EQUAL.operator},{label:t.t(p.EQUAL.label),value:p.EQUAL.operator},{label:t.t(p.NOT_EQUAL.label),value:p.NOT_EQUAL.operator},{label:t.t(p.BETWEEN.label),value:p.BETWEEN.operator},{label:t.t(p.NOT_BETWEEN.label),value:p.NOT_BETWEEN.operator}]},{options:[{label:t.t(p.CUSTOM.label),value:p.CUSTOM.operator}]}],[e,t])}function It(t){const e=t.getCurrentLocale();return b.useMemo(()=>p.ALL_CONDITIONS.filter(r=>r.numOfParameters!==2).map(r=>({label:t.t(r.label),value:r.operator})),[e,t])}function Nt(t){const{model:e}=t,r=T.useDependency(c.LocaleService),n=T.useObservable(e.searchString$,"",!0),o=T.useObservable(e.filterItems$,void 0,!0),l=r.t("sheets-filter.panel.filter-only"),i=Ce(o),s=i.checked>0&&i.unchecked===0,a=i.checked>0&&i.unchecked>0,m=e.treeMapCache,h=b.useCallback(()=>{e.onCheckAllToggled(!s)},[e,s]),f=b.useCallback(_=>{e.setSearchString(_)},[e]);function O(_){let I=[];return _.forEach(E=>{E.checked&&I.push(E.key),E.children&&(I=I.concat(O(E.children)))}),I}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(y.Input,{autoFocus:!0,value:n,placeholder:r.t("sheets-filter.panel.search-placeholder"),onChange:f}),d.jsxs("div",{"data-u-comp":"sheets-filter-panel",className:y.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",y.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-pb-0 univer-pl-5 univer-pr-0.5 univer-pt-0 univer-text-sm",children:[d.jsx(y.Checkbox,{indeterminate:a,disabled:o.length===0,checked:s,onChange:h}),d.jsx("span",{"data-u-comp":"sheets-filter-panel-values-item-text",className:"univer-mx-1 univer-inline-block univer-flex-shrink univer-overflow-hidden univer-text-ellipsis univer-whitespace-nowrap univer-text-gray-900 dark:!univer-text-white",children:`${r.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(y.Tree,{data:o,defaultExpandAll:!1,valueGroup:O(o),onChange:_=>{e.onFilterCheckToggled(_)},defaultCache:m,itemHeight:28,treeNodeClassName:`
|
|
2
2
|
univer-pr-2 univer-border-box univer-max-w-[245px] univer-rounded-md
|
|
3
3
|
[&:hover_a]:univer-inline-block
|
|
4
4
|
hover:univer-bg-gray-50 univer-h-full
|
|
5
5
|
univer-text-gray-900 dark:hover:!univer-bg-gray-900
|
|
6
6
|
dark:!univer-text-white
|
|
7
|
-
`,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 I=[];v.children?v.children.forEach(E=>{E.children?E.children.forEach(A=>{I.push(A.key)}):I.push(E.key)}):I.push(v.key),e.onFilterOnly(I)},children:l})]})})})]})]})}function ht(){var A;const t=T.useDependency(j),e=T.useDependency(c.LocaleService),r=T.useDependency(c.ICommandService),n=T.useObservable(t.filterBy$,void 0,!0),o=T.useObservable(t.filterByModel$,void 0,!1),l=T.useObservable(()=>(o==null?void 0:o.canApply$)||C.of(!1),void 0,!1,[o]),i=pt(e),s=!T.useObservable(t.hasCriteria$),a=b.useCallback(F=>{r.executeCommand(Fe.id,{filterBy:F})},[r]),m=b.useCallback(async()=>{await(o==null?void 0:o.clear()),r.executeCommand(z.id)},[o,r]),h=b.useCallback(()=>{r.executeCommand(z.id)},[r]),f=b.useCallback(async()=>{await(o==null?void 0:o.apply()),r.executeCommand(z.id)},[o,r]),v=(A=T.useDependency(u.SheetsFilterService).activeFilterModel)==null?void 0:A.getRange(),I=t.col,E=T.useComponentsOfPart(U.SheetsUIPart.FILTER_PANEL_EMBED_POINT);return d.jsxs("div",{"data-u-comp":"sheets-filter-panel",className:"univer-box-border univer-flex univer-h-[442px] univer-w-[312px] 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(T.ComponentContainer,{components:E,sharedProps:{range:v,colIndex:I,onClose:h}}),d.jsx("div",{className:"univer-mb-1 univer-flex-shrink-0 univer-flex-grow-0",children:d.jsx(y.Segmented,{value:n,items:i,onChange:F=>a(F)})}),o?d.jsx("div",{"data-u-comp":"sheets-filter-panel-content",className:"univer-flex-shrink univer-flex-grow univer-pt-2",children:n===me.VALUES?d.jsx(mt,{model:o}):d.jsx(lt,{model:o})}):d.jsx("div",{className:"univer-flex-1"}),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(y.Button,{variant:"link",onClick:m,disabled:s,children:e.t("sheets-filter.panel.clear-filter")}),d.jsxs("span",{className:"univer-flex univer-gap-2",children:[d.jsx(y.Button,{variant:"default",onClick:h,children:e.t("sheets-filter.panel.cancel")}),d.jsx(y.Button,{disabled:!l,variant:"primary",onClick:f,children:e.t("sheets-filter.panel.confirm")})]})]})]})}function pt(t){const e=t.getCurrentLocale();return b.useMemo(()=>[{label:t.t("sheets-filter.panel.by-values"),value:me.VALUES},{label:t.t("sheets-filter.panel.by-conditions"),value:me.CONDITIONS}],[e,t])}function dt(t){const e=t.get(u.SheetsFilterService);return{id:u.SmartToggleSheetsFilterCommand.id,type:T.MenuItemType.BUTTON_SELECTOR,icon:"FilterIcon",tooltip:"sheets-filter.toolbar.smart-toggle-filter-tooltip",hidden$:T.getMenuHiddenObservable(t,c.UniverInstanceType.UNIVER_SHEET),activated$:e.activeFilterModel$.pipe(C.map(r=>!!r)),disabled$:U.getObservableWithExclusiveRange$(t,U.getCurrentRangeDisable$(t,{worksheetTypes:[N.WorksheetFilterPermission,N.WorksheetViewPermission],rangeTypes:[N.RangeProtectionPermissionViewPoint]}))}}function ft(t){const e=t.get(u.SheetsFilterService);return{id:u.ClearSheetsFilterCriteriaCommand.id,type:T.MenuItemType.BUTTON,title:"sheets-filter.toolbar.clear-filter-criteria",hidden$:T.getMenuHiddenObservable(t,c.UniverInstanceType.UNIVER_SHEET),disabled$:e.activeFilterModel$.pipe(C.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(C.map(o=>!o)))!=null?n:C.of(!0)}))}}function _t(t){const e=t.get(u.SheetsFilterService);return{id:u.ReCalcSheetsFilterCommand.id,type:T.MenuItemType.BUTTON,title:"sheets-filter.toolbar.re-calc-filter-conditions",hidden$:T.getMenuHiddenObservable(t,c.UniverInstanceType.UNIVER_SHEET),disabled$:e.activeFilterModel$.pipe(C.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(C.map(o=>!o)))!=null?n:C.of(!0)}))}}const vt={[T.RibbonDataGroup.ORGANIZATION]:{[u.SmartToggleSheetsFilterCommand.id]:{order:2,menuItemFactory:dt,[u.ClearSheetsFilterCriteriaCommand.id]:{order:0,menuItemFactory:ft},[u.ReCalcSheetsFilterCommand.id]:{order:1,menuItemFactory:_t}}}},G=16,St=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,r,n,o){e.save(),ie.Rect.drawWith(e,{radius:2,width:G,height:G,fill:o}),e.lineCap="square",e.strokeStyle=n,e.scale(r/G,r/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,r,n,o){e.save(),ie.Rect.drawWith(e,{radius:2,width:G,height:G,fill:o}),e.scale(r/G,r/G),e.fillStyle=n,e.fill(St),e.restore()}}var gt=Object.getOwnPropertyDescriptor,Ct=(t,e,r,n)=>{for(var o=n>1?void 0:n?gt(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},ye=(t,e)=>(r,n)=>e(r,n,t);const x=16,de=1;let Pe=class extends ie.Shape{constructor(e,r,n,o,l){super(e,r);S(this,"_cellWidth",0);S(this,"_cellHeight",0);S(this,"_filterParams");S(this,"_hovered",!1);this._contextService=n,this._commandService=o,this._themeService=l,this.setShapeProps(r),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 r=this._cellHeight,n=this._cellWidth,o=x-n,l=x-r;e.save();const i=new Path2D;i.rect(o,l,n,r),e.clip(i);const{hasCriteria:s}=this._filterParams,a=this._themeService.getColorFromTheme("primary.600"),m=this._hovered?this._themeService.getColorFromTheme("gray.50"):"rgba(255, 255, 255, 1.0)";s?We.drawHasCriteria(e,x,a,m):We.drawNoCriteria(e,x,a,m),e.restore()}onPointerDown(e){if(e.button===2)return;const{col:r,unitId:n,subUnitId:o}=this._filterParams;this._contextService.getContextValue(Z)||!this._commandService.hasCommand(oe.id)||setTimeout(()=>{this._commandService.executeCommand(oe.id,{unitId:n,subUnitId:o,col:r})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};Pe=Ct([ye(2,c.IContextService),ye(3,c.ICommandService),ye(4,c.Inject(c.ThemeService))],Pe);var Tt=Object.getOwnPropertyDescriptor,Et=(t,e,r,n)=>{for(var o=n>1?void 0:n?Tt(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},q=(t,e)=>(r,n)=>e(r,n,t);const Ot=1e3,It=5e3;let be=class extends c.RxDisposable{constructor(e,r,n,o,l,i,s,a){super();S(this,"_filterRangeShape",null);S(this,"_buttonRenderDisposable",null);S(this,"_filterButtonShapes",[]);this._context=e,this._injector=r,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(C.switchMap(e=>{var s,a;if(!e)return C.of(null);const{unit:r,unitId:n}=this._context,o=((s=r.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(C.filter(([m])=>{var h;return m.type===c.CommandType.MUTATION&&((h=m.params)==null?void 0:h.unitId)===r.getUnitId()&&(u.FILTER_MUTATIONS.has(m.id)||m.id===N.SetRangeValuesMutation.id)}),C.throttleTime(20,void 0,{leading:!1,trailing:!0}),C.map(i),C.startWith(i()))}),C.takeUntil(this.dispose$)).subscribe(e=>{this._disposeRendering(),!(!e||!e.range)&&(this._renderRange(e.range,e.skeleton),this._renderButtons(e))})}_renderRange(e,r){const{scene:n}=this._context,{rowHeaderWidth:o,columnHeaderHeight:l}=r,i=this._filterRangeShape=new U.SelectionControl(n,Ot,this._themeService,{rowHeaderWidth:o,columnHeaderHeight:l,enableAutoFill:!1,highlightHeader:!1}),s={range:e,primary:null,style:{fill:"rgba(0, 0, 0, 0.0)"}},a=U.attachSelectionWithCoord(s,r);i.updateRangeBySelectionWithCoord(a),i.setEvent(!1),n.makeDirty(!0)}_renderButtons(e){const{range:r,filterModel:n,unitId:o,skeleton:l,worksheetId:i}=e,{scene:s}=this._context;this._interceptCellContent(o,i,e.range);const{startColumn:a,endColumn:m,startRow:h}=r;for(let f=a;f<=m;f++){const O=`sheets-filter-button-${f}`,v=U.getCoordByCell(h,f,s,l),{startX:I,startY:E,endX:A,endY:F}=v,w=A-I,M=F-E;if(M<=de||w<=de)continue;const H=!!n.getFilterColumn(f),B=A-x-de,ve=F-x-de,Se={left:B,top:ve,height:x,width:x,zIndex:It,cellHeight:M,cellWidth:w,filterParams:{unitId:o,subUnitId:i,col:f,hasCriteria:H}},L=this._injector.createInstance(Pe,O,Se);this._filterButtonShapes.push(L)}s.addObjects(this._filterButtonShapes),s.makeDirty()}_interceptCellContent(e,r,n){const{startRow:o,startColumn:l,endColumn:i}=n;this._buttonRenderDisposable=this._sheetInterceptorService.intercept(N.INTERCEPTOR_POINT.CELL_CONTENT,{effect:c.InterceptorEffectEnum.Style,handler:(s,a,m)=>{const{row:h,col:f,unitId:O,subUnitId:v}=a;return O!==e||v!==r||h!==o||f<l||f>i||((!s||s===a.rawData)&&(s={...a.rawData}),s.fontRenderExtension={...s==null?void 0:s.fontRenderExtension,rightOffset:x}),m(s)},priority:10})}_disposeRendering(){var e,r;(e=this._filterRangeShape)==null||e.dispose(),this._filterButtonShapes.forEach(n=>n.dispose()),(r=this._buttonRenderDisposable)==null||r.dispose(),this._filterRangeShape=null,this._buttonRenderDisposable=null,this._filterButtonShapes=[]}};be=Et([q(1,c.Inject(c.Injector)),q(2,c.Inject(U.SheetSkeletonManagerService)),q(3,c.Inject(u.SheetsFilterService)),q(4,c.Inject(c.ThemeService)),q(5,c.Inject(N.SheetInterceptorService)),q(6,c.ICommandService),q(7,U.ISheetSelectionRenderService)],be);var Nt=Object.getOwnPropertyDescriptor,Ft=(t,e,r,n)=>{for(var o=n>1?void 0:n?Nt(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},Ve=(t,e)=>(r,n)=>e(r,n,t);let se=class extends c.RxDisposable{constructor(t,e){super(),this._renderManagerService=t,this._sheetsRenderService=e,[u.SetSheetsFilterRangeMutation,u.SetSheetsFilterCriteriaMutation,u.RemoveSheetsFilterMutation,u.ReCalcSheetsFilterMutation].forEach(r=>this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(r.id))),this.disposeWithMe(this._renderManagerService.registerRenderModule(c.UniverInstanceType.UNIVER_SHEET,[be]))}};se=Ft([Ve(0,ie.IRenderManagerService),Ve(1,c.Inject(U.SheetsRenderService))],se);const yt={id:u.SmartToggleSheetsFilterCommand.id,binding:T.KeyCode.L|T.MetaKeys.CTRL_COMMAND|T.MetaKeys.SHIFT,description:"sheets-filter.shortcut.smart-toggle-filter",preconditions:U.whenSheetEditorFocused,group:"4_sheet-edit"};var Pt=Object.getOwnPropertyDescriptor,bt=(t,e,r,n)=>{for(var o=n>1?void 0:n?Pt(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},$=(t,e)=>(r,n)=>e(r,n,t);const xe="FILTER_PANEL_POPUP";let fe=class extends se{constructor(e,r,n,o,l,i,s,a,m,h,f,O,v){super(v,O);S(this,"_popupDisposable");this._injector=e,this._componentManager=r,this._sheetsFilterPanelService=n,this._sheetCanvasPopupService=o,this._sheetsFilterService=l,this._localeService=i,this._shortcutService=s,this._commandService=a,this._menuManagerService=m,this._contextService=h,this._messageService=f,this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[yt].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}_initCommands(){[u.SmartToggleSheetsFilterCommand,u.RemoveSheetFilterCommand,u.SetSheetFilterRangeCommand,u.SetSheetsFilterCriteriaCommand,u.ClearSheetsFilterCriteriaCommand,u.ReCalcSheetsFilterCommand,Fe,oe,z].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenuItems(){this._menuManagerService.mergeMenu(vt)}_initUI(){[[xe,ht],["FilterIcon",Be]].forEach(([e,r])=>{this.disposeWithMe(this._componentManager.register(e,r))}),this.disposeWithMe(this._contextService.subscribeContextValue$(Z).pipe(C.distinctUntilChanged()).subscribe(e=>{e?this._openFilterPopup():this._closeFilterPopup()})),this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe(e=>{e&&this._messageService.show({type:y.MessageType.Error,content:this._localeService.t(e)})}))}_openFilterPopup(){const e=this._sheetsFilterPanelService.filterModel;if(!e)throw new Error("[SheetsFilterUIController]: no filter model when opening filter popup!");const r=e.getRange(),n=this._sheetsFilterPanelService.col,{startRow:o}=r;this._popupDisposable=this._sheetCanvasPopupService.attachPopupToCell(o,n,{componentKey:xe,direction:"horizontal",onClickOutside:()=>this._commandService.syncExecuteCommand(z.id),offset:[5,0]})}_closeFilterPopup(){var e;(e=this._popupDisposable)==null||e.dispose(),this._popupDisposable=null}};fe=bt([$(0,c.Inject(c.Injector)),$(1,c.Inject(T.ComponentManager)),$(2,c.Inject(j)),$(3,c.Inject(U.SheetCanvasPopManagerService)),$(4,c.Inject(u.SheetsFilterService)),$(5,c.Inject(c.LocaleService)),$(6,T.IShortcutService),$(7,c.ICommandService),$(8,T.IMenuManagerService),$(9,c.IContextService),$(10,T.IMessageService),$(11,c.Inject(U.SheetsRenderService)),$(12,ie.IRenderManagerService)],fe);var At=Object.defineProperty,Rt=Object.getOwnPropertyDescriptor,Mt=(t,e,r)=>e in t?At(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wt=(t,e,r,n)=>{for(var o=n>1?void 0:n?Rt(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},Ae=(t,e)=>(r,n)=>e(r,n,t),Qe=(t,e,r)=>Mt(t,typeof e!="symbol"?e+"":e,r);const Lt="SHEET_FILTER_UI_PLUGIN";_.UniverSheetsFilterUIPlugin=class extends c.Plugin{constructor(e=le,r,n,o){super(),this._config=e,this._injector=r,this._configService=n,this._rpcChannelService=o;const{menu:l,...i}=c.merge({},le,this._config);l&&this._configService.setConfig("menu",l,{merge:!0}),this._configService.setConfig(we,i)}onStarting(){c.registerDependencies(this._injector,[[j],[ee],[fe]]),this._config.useRemoteFilterValuesGenerator&&this._rpcChannelService&&this._injector.add([ce,{useFactory:()=>V.toModule(this._rpcChannelService.requestChannel(Ee))}])}onReady(){c.touchDependencies(this._injector,[[ee]])}onRendered(){c.touchDependencies(this._injector,[[fe]])}},Qe(_.UniverSheetsFilterUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),Qe(_.UniverSheetsFilterUIPlugin,"pluginName",Lt),_.UniverSheetsFilterUIPlugin=wt([c.DependentOn(u.UniverSheetsFilterPlugin),Ae(1,c.Inject(c.Injector)),Ae(2,c.IConfigService),Ae(3,c.Optional(V.IRPCChannelService))],_.UniverSheetsFilterUIPlugin);var Ut=Object.defineProperty,$t=Object.getOwnPropertyDescriptor,Dt=(t,e,r)=>e in t?Ut(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kt=(t,e,r,n)=>{for(var o=n>1?void 0:n?$t(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},je=(t,e)=>(r,n)=>e(r,n,t),Ge=(t,e,r)=>Dt(t,typeof e!="symbol"?e+"":e,r);const Ht="SHEET_FILTER_UI_PLUGIN";_.UniverSheetsFilterMobileUIPlugin=class extends c.Plugin{constructor(e=le,r,n){super(),this._config=e,this._injector=r,this._configService=n;const{menu:o,...l}=c.merge({},le,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(we,l)}onStarting(){[[ee],[se]].forEach(e=>this._injector.add(e))}onReady(){this._injector.get(ee)}onRendered(){this._injector.get(se)}},Ge(_.UniverSheetsFilterMobileUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),Ge(_.UniverSheetsFilterMobileUIPlugin,"pluginName",Ht),_.UniverSheetsFilterMobileUIPlugin=kt([c.DependentOn(u.UniverSheetsFilterPlugin),je(1,c.Inject(c.Injector)),je(2,c.IConfigService)],_.UniverSheetsFilterMobileUIPlugin);var Bt=Object.getOwnPropertyDescriptor,Wt=(t,e,r,n)=>{for(var o=n>1?void 0:n?Bt(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},Ye=(t,e)=>(r,n)=>e(r,n,t);_.UniverSheetsFilterUIWorkerPlugin=(_e=class extends c.Plugin{constructor(e,r,n){super(),this._config=e,this._injector=r,this._rpcChannelService=n}onStarting(){[[ce,{useClass:Oe}]].forEach(e=>this._injector.add(e))}onReady(){this._rpcChannelService.registerChannel(Ee,V.fromModule(this._injector.get(ce)))}},S(_e,"type",c.UniverInstanceType.UNIVER_SHEET),S(_e,"pluginName","SHEET_FILTER_UI_WORKER_PLUGIN"),_e),_.UniverSheetsFilterUIWorkerPlugin=Wt([Ye(1,c.Inject(c.Injector)),Ye(2,V.IRPCChannelService)],_.UniverSheetsFilterUIWorkerPlugin),_.ChangeFilterByOperation=Fe,_.CloseFilterPanelOperation=z,_.OpenFilterPanelOperation=oe,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|
|
7
|
+
`,attachRender:_=>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:`(${_.count})`}),d.jsx("a",{className:"univer-box-border univer-hidden univer-h-4 univer-whitespace-nowrap univer-px-1.5",onClick:()=>{const I=[];_.children?_.children.forEach(E=>{E.children?E.children.forEach(A=>{I.push(A.key)}):I.push(E.key)}):I.push(_.key),e.onFilterOnly(I)},children:l})]})})})]})]})}function Ft(){var A;const t=T.useDependency(Q),e=T.useDependency(c.LocaleService),r=T.useDependency(c.ICommandService),n=T.useObservable(t.filterBy$,void 0,!0),o=T.useObservable(t.filterByModel$,void 0,!1),l=T.useObservable(()=>(o==null?void 0:o.canApply$)||C.of(!1),void 0,!1,[o]),i=yt(e),s=!T.useObservable(t.hasCriteria$),a=b.useCallback(F=>{r.executeCommand(Fe.id,{filterBy:F})},[r]),m=b.useCallback(async()=>{await(o==null?void 0:o.clear()),r.executeCommand(Z.id)},[o,r]),h=b.useCallback(()=>{r.executeCommand(Z.id)},[r]),f=b.useCallback(async()=>{await(o==null?void 0:o.apply()),r.executeCommand(Z.id)},[o,r]),_=(A=T.useDependency(u.SheetsFilterService).activeFilterModel)==null?void 0:A.getRange(),I=t.col,E=T.useComponentsOfPart(U.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-[312px] 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(T.ComponentContainer,{components:E,sharedProps:{range:_,colIndex:I,onClose:h}}),d.jsx("div",{className:"univer-mb-1 univer-flex-shrink-0 univer-flex-grow-0",children:d.jsx(y.Segmented,{value:n,items:i,onChange:F=>a(F)})}),o?d.jsx("div",{"data-u-comp":"sheets-filter-panel-content",className:"univer-flex-shrink univer-flex-grow univer-pt-2",children:n===ue.VALUES?d.jsx(Nt,{model:o}):d.jsx(Et,{model:o})}):d.jsx("div",{className:"univer-flex-1"}),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(y.Button,{variant:"link",onClick:m,disabled:s,children:e.t("sheets-filter.panel.clear-filter")}),d.jsxs("span",{className:"univer-flex univer-gap-2",children:[d.jsx(y.Button,{variant:"default",onClick:h,children:e.t("sheets-filter.panel.cancel")}),d.jsx(y.Button,{disabled:!l,variant:"primary",onClick:f,children:e.t("sheets-filter.panel.confirm")})]})]})]})}function yt(t){const e=t.getCurrentLocale();return b.useMemo(()=>[{label:t.t("sheets-filter.panel.by-values"),value:ue.VALUES},{label:t.t("sheets-filter.panel.by-conditions"),value:ue.CONDITIONS}],[e,t])}function Pt(t){const e=t.get(u.SheetsFilterService);return{id:u.SmartToggleSheetsFilterCommand.id,type:T.MenuItemType.BUTTON_SELECTOR,icon:"FilterIcon",tooltip:"sheets-filter.toolbar.smart-toggle-filter-tooltip",hidden$:T.getMenuHiddenObservable(t,c.UniverInstanceType.UNIVER_SHEET),activated$:e.activeFilterModel$.pipe(C.map(r=>!!r)),disabled$:U.getObservableWithExclusiveRange$(t,U.getCurrentRangeDisable$(t,{worksheetTypes:[N.WorksheetFilterPermission,N.WorksheetViewPermission],rangeTypes:[N.RangeProtectionPermissionViewPoint]}))}}function bt(t){const e=t.get(u.SheetsFilterService);return{id:u.ClearSheetsFilterCriteriaCommand.id,type:T.MenuItemType.BUTTON,title:"sheets-filter.toolbar.clear-filter-criteria",hidden$:T.getMenuHiddenObservable(t,c.UniverInstanceType.UNIVER_SHEET),disabled$:e.activeFilterModel$.pipe(C.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(C.map(o=>!o)))!=null?n:C.of(!0)}))}}function At(t){const e=t.get(u.SheetsFilterService);return{id:u.ReCalcSheetsFilterCommand.id,type:T.MenuItemType.BUTTON,title:"sheets-filter.toolbar.re-calc-filter-conditions",hidden$:T.getMenuHiddenObservable(t,c.UniverInstanceType.UNIVER_SHEET),disabled$:e.activeFilterModel$.pipe(C.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(C.map(o=>!o)))!=null?n:C.of(!0)}))}}const Rt={[T.RibbonDataGroup.ORGANIZATION]:{[u.SmartToggleSheetsFilterCommand.id]:{order:2,menuItemFactory:Pt,[u.ClearSheetsFilterCriteriaCommand.id]:{order:0,menuItemFactory:bt},[u.ReCalcSheetsFilterCommand.id]:{order:1,menuItemFactory:At}}}},Mt={id:u.SmartToggleSheetsFilterCommand.id,binding:T.KeyCode.L|T.MetaKeys.CTRL_COMMAND|T.MetaKeys.SHIFT,description:"sheets-filter.shortcut.smart-toggle-filter",preconditions:U.whenSheetEditorFocused,group:"4_sheet-edit"};var wt=Object.getOwnPropertyDescriptor,Lt=(t,e,r,n)=>{for(var o=n>1?void 0:n?wt(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},$=(t,e)=>(r,n)=>e(r,n,t);const je="FILTER_PANEL_POPUP";let fe=class extends oe{constructor(e,r,n,o,l,i,s,a,m,h,f,O,_){super(_,O);S(this,"_popupDisposable");this._injector=e,this._componentManager=r,this._sheetsFilterPanelService=n,this._sheetCanvasPopupService=o,this._sheetsFilterService=l,this._localeService=i,this._shortcutService=s,this._commandService=a,this._menuManagerService=m,this._contextService=h,this._messageService=f,this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[Mt].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}_initCommands(){[u.SmartToggleSheetsFilterCommand,u.RemoveSheetFilterCommand,u.SetSheetFilterRangeCommand,u.SetSheetsFilterCriteriaCommand,u.ClearSheetsFilterCriteriaCommand,u.ReCalcSheetsFilterCommand,Fe,ne,Z].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenuItems(){this._menuManagerService.mergeMenu(Rt)}_initUI(){[[je,Ft],["FilterIcon",Qe]].forEach(([e,r])=>{this.disposeWithMe(this._componentManager.register(e,r))}),this.disposeWithMe(this._contextService.subscribeContextValue$(X).pipe(C.distinctUntilChanged()).subscribe(e=>{e?this._openFilterPopup():this._closeFilterPopup()})),this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe(e=>{e&&this._messageService.show({type:y.MessageType.Error,content:this._localeService.t(e)})}))}_openFilterPopup(){const e=this._sheetsFilterPanelService.filterModel;if(!e)throw new Error("[SheetsFilterUIController]: no filter model when opening filter popup!");const r=e.getRange(),n=this._sheetsFilterPanelService.col,{startRow:o}=r;this._popupDisposable=this._sheetCanvasPopupService.attachPopupToCell(o,n,{componentKey:je,direction:"horizontal",onClickOutside:()=>this._commandService.syncExecuteCommand(Z.id),offset:[5,0]})}_closeFilterPopup(){var e;(e=this._popupDisposable)==null||e.dispose(),this._popupDisposable=null}};fe=Lt([$(0,c.Inject(c.Injector)),$(1,c.Inject(T.ComponentManager)),$(2,c.Inject(Q)),$(3,c.Inject(U.SheetCanvasPopManagerService)),$(4,c.Inject(u.SheetsFilterService)),$(5,c.Inject(c.LocaleService)),$(6,T.IShortcutService),$(7,c.ICommandService),$(8,T.IMenuManagerService),$(9,c.IContextService),$(10,T.IMessageService),$(11,c.Inject(U.SheetsRenderService)),$(12,re.IRenderManagerService)],fe);var Ut=Object.defineProperty,$t=Object.getOwnPropertyDescriptor,Dt=(t,e,r)=>e in t?Ut(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kt=(t,e,r,n)=>{for(var o=n>1?void 0:n?$t(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},Ae=(t,e)=>(r,n)=>e(r,n,t),Ge=(t,e,r)=>Dt(t,typeof e!="symbol"?e+"":e,r);const Ht="SHEET_FILTER_UI_PLUGIN";v.UniverSheetsFilterUIPlugin=class extends c.Plugin{constructor(e=pe,r,n,o){super(),this._config=e,this._injector=r,this._configService=n,this._rpcChannelService=o;const{menu:l,...i}=c.merge({},pe,this._config);l&&this._configService.setConfig("menu",l,{merge:!0}),this._configService.setConfig(De,i)}onStarting(){c.registerDependencies(this._injector,[[Q],[J],[fe]]),this._config.useRemoteFilterValuesGenerator&&this._rpcChannelService&&this._injector.add([le,{useFactory:()=>ae.toModule(this._rpcChannelService.requestChannel(Ee))}])}onReady(){c.touchDependencies(this._injector,[[J]])}onRendered(){c.touchDependencies(this._injector,[[fe]])}},Ge(v.UniverSheetsFilterUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),Ge(v.UniverSheetsFilterUIPlugin,"pluginName",Ht),v.UniverSheetsFilterUIPlugin=kt([c.DependentOn(u.UniverSheetsFilterPlugin),Ae(1,c.Inject(c.Injector)),Ae(2,c.IConfigService),Ae(3,c.Optional(ae.IRPCChannelService))],v.UniverSheetsFilterUIPlugin);var Bt=Object.getOwnPropertyDescriptor,Wt=(t,e,r,n)=>{for(var o=n>1?void 0:n?Bt(e,r):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(o=i(o)||o);return o},Ye=(t,e)=>(r,n)=>e(r,n,t);v.UniverSheetsFilterUIWorkerPlugin=(ve=class extends c.Plugin{constructor(e,r,n){super(),this._config=e,this._injector=r,this._rpcChannelService=n}onStarting(){[[le,{useClass:Oe}]].forEach(e=>this._injector.add(e))}onReady(){this._rpcChannelService.registerChannel(Ee,ae.fromModule(this._injector.get(le)))}},S(ve,"type",c.UniverInstanceType.UNIVER_SHEET),S(ve,"pluginName","SHEET_FILTER_UI_WORKER_PLUGIN"),ve),v.UniverSheetsFilterUIWorkerPlugin=Wt([Ye(1,c.Inject(c.Injector)),Ye(2,ae.IRPCChannelService)],v.UniverSheetsFilterUIWorkerPlugin),v.ChangeFilterByOperation=Fe,v.CloseFilterPanelOperation=Z,v.OpenFilterPanelOperation=ne,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(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(){"use strict";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-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월"}}}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-filter-ui",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3-nightly.202507010644",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Univer Sheets Filter UI",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@univerjs/icons": "^0.4.4",
|
|
56
|
-
"@univerjs/core": "0.8.
|
|
57
|
-
"@univerjs/design": "0.8.
|
|
58
|
-
"@univerjs/
|
|
59
|
-
"@univerjs/
|
|
60
|
-
"@univerjs/sheets-filter": "0.8.
|
|
61
|
-
"@univerjs/sheets-ui": "0.8.
|
|
62
|
-
"@univerjs/
|
|
63
|
-
"@univerjs/
|
|
56
|
+
"@univerjs/core": "0.8.3-nightly.202507010644",
|
|
57
|
+
"@univerjs/design": "0.8.3-nightly.202507010644",
|
|
58
|
+
"@univerjs/engine-render": "0.8.3-nightly.202507010644",
|
|
59
|
+
"@univerjs/rpc": "0.8.3-nightly.202507010644",
|
|
60
|
+
"@univerjs/sheets-filter": "0.8.3-nightly.202507010644",
|
|
61
|
+
"@univerjs/sheets-ui": "0.8.3-nightly.202507010644",
|
|
62
|
+
"@univerjs/ui": "0.8.3-nightly.202507010644",
|
|
63
|
+
"@univerjs/sheets": "0.8.3-nightly.202507010644"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"postcss": "^8.5.6",
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"tailwindcss": "^3.4.17",
|
|
70
70
|
"typescript": "^5.8.3",
|
|
71
71
|
"vite": "^6.3.5",
|
|
72
|
-
"vitest": "^3.
|
|
73
|
-
"@univerjs-infra/shared": "0.8.
|
|
74
|
-
"@univerjs/engine-formula": "0.8.
|
|
72
|
+
"vitest": "^3.2.4",
|
|
73
|
+
"@univerjs-infra/shared": "0.8.3",
|
|
74
|
+
"@univerjs/engine-formula": "0.8.3-nightly.202507010644"
|
|
75
75
|
},
|
|
76
76
|
"scripts": {
|
|
77
77
|
"test": "vitest run",
|
package/LICENSE
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|