@univerjs/sheets-filter-ui 0.5.5-nightly.202501220324 → 0.5.5
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/LICENSE +176 -0
- package/lib/cjs/index.js +9 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/index.js +1338 -1344
- package/lib/es/locale/en-US.js +2 -2
- package/lib/es/locale/fa-IR.js +2 -2
- package/lib/es/locale/fr-FR.js +2 -2
- package/lib/es/locale/ru-RU.js +2 -2
- package/lib/es/locale/vi-VN.js +2 -2
- package/lib/es/locale/zh-CN.js +2 -2
- package/lib/es/locale/zh-TW.js +2 -2
- package/lib/types/views/components/SheetsFilterByConditionsPanel.d.ts +2 -1
- package/lib/types/views/components/SheetsFilterByValuesPanel.d.ts +2 -1
- package/lib/types/views/components/SheetsFilterPanel.d.ts +2 -16
- package/lib/types/views/components/SheetsFilterPanel.stories.d.ts +4 -3
- package/lib/umd/index.js +9 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +10 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
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
|
package/lib/cjs/index.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core"),rpc=require("@univerjs/rpc"),sheetsFilter=require("@univerjs/sheets-filter"),sheets=require("@univerjs/sheets"),ui=require("@univerjs/ui"),sheetsUi=require("@univerjs/sheets-ui"),rxjs=require("rxjs"),design=require("@univerjs/design"),engineRender=require("@univerjs/engine-render"),jsxRuntime=require("react/jsx-runtime"),react=require("react"),SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY="sheets-filter-ui.config",defaultPluginConfig={};var OperatorOrder=(OperatorOrder2=>(OperatorOrder2[OperatorOrder2.FIRST=0]="FIRST",OperatorOrder2[OperatorOrder2.SECOND=1]="SECOND",OperatorOrder2))(OperatorOrder||{}),ExtendCustomFilterOperator=(ExtendCustomFilterOperator2=>(ExtendCustomFilterOperator2.NONE="none",ExtendCustomFilterOperator2.STARTS_WITH="startsWith",ExtendCustomFilterOperator2.DOES_NOT_START_WITH="doesNotStartWith",ExtendCustomFilterOperator2.ENDS_WITH="endsWith",ExtendCustomFilterOperator2.DOES_NOT_END_WITH="doesNotEndWith",ExtendCustomFilterOperator2.CONTAINS="contains",ExtendCustomFilterOperator2.DOES_NOT_CONTAIN="doesNotContain",ExtendCustomFilterOperator2.EQUALS="equals",ExtendCustomFilterOperator2.NOT_EQUALS="notEquals",ExtendCustomFilterOperator2.EMPTY="empty",ExtendCustomFilterOperator2.NOT_EMPTY="notEmpty",ExtendCustomFilterOperator2.BETWEEN="between",ExtendCustomFilterOperator2.NOT_BETWEEN="notBetween",ExtendCustomFilterOperator2.CUSTOM="custom",ExtendCustomFilterOperator2))(ExtendCustomFilterOperator||{}),FilterConditionItems;(FilterConditionItems2=>{FilterConditionItems2.NONE={label:"sheets-filter.conditions.none",operator:ExtendCustomFilterOperator.NONE,order:OperatorOrder.SECOND,numOfParameters:0,getDefaultFormParams:__name(()=>{throw new Error("[FilterConditionItems.NONE]: should not have initial form params!")},"getDefaultFormParams"),testMappingParams:__name(params=>params.operator1===ExtendCustomFilterOperator.NONE,"testMappingParams"),mapToFilterColumn:__name(()=>null,"mapToFilterColumn"),testMappingFilterColumn:__name(filterColumn=>!filterColumn.customFilters&&!filterColumn.filters?{}:!1,"testMappingFilterColumn")},FilterConditionItems2.EMPTY={label:"sheets-filter.conditions.empty",operator:ExtendCustomFilterOperator.EMPTY,order:OperatorOrder.SECOND,numOfParameters:0,getDefaultFormParams:__name(()=>{throw new Error("[FilterConditionItems.EMPTY]: should not have initial form params!")},"getDefaultFormParams"),testMappingParams:__name(({operator1})=>operator1===ExtendCustomFilterOperator.EMPTY,"testMappingParams"),mapToFilterColumn:__name(()=>({customFilters:{customFilters:[{val:""}]}}),"mapToFilterColumn"),testMappingFilterColumn:__name(filterColumn=>{var _a13;if(((_a13=filterColumn.customFilters)==null?void 0:_a13.customFilters.length)!==1)return!1;const firstCustomFilter=filterColumn.customFilters.customFilters[0];return firstCustomFilter.val===""&&firstCustomFilter.operator===void 0?{operator1:ExtendCustomFilterOperator.EMPTY}:!1},"testMappingFilterColumn")},FilterConditionItems2.NOT_EMPTY={label:"sheets-filter.conditions.not-empty",operator:ExtendCustomFilterOperator.NOT_EMPTY,order:OperatorOrder.SECOND,numOfParameters:0,getDefaultFormParams:__name(()=>{throw new Error("[FilterConditionItems.NOT_EMPTY]: should not have initial form params!")},"getDefaultFormParams"),testMappingParams:__name(({operator1})=>operator1===ExtendCustomFilterOperator.NOT_EMPTY,"testMappingParams"),mapToFilterColumn:__name(()=>({customFilters:{customFilters:[{val:"",operator:sheetsFilter.CustomFilterOperator.NOT_EQUALS}]}}),"mapToFilterColumn"),testMappingFilterColumn:__name(filterColumn=>{var _a13;if(((_a13=filterColumn.customFilters)==null?void 0:_a13.customFilters.length)!==1)return!1;const firstCustomFilter=filterColumn.customFilters.customFilters[0];return firstCustomFilter.val===" "&&firstCustomFilter.operator===sheetsFilter.CustomFilterOperator.NOT_EQUALS?{operator1:ExtendCustomFilterOperator.NOT_EMPTY}:!1},"testMappingFilterColumn")},FilterConditionItems2.TEXT_CONTAINS={label:"sheets-filter.conditions.text-contains",operator:ExtendCustomFilterOperator.CONTAINS,order:OperatorOrder.FIRST,numOfParameters:1,getDefaultFormParams:__name(()=>({operator1:ExtendCustomFilterOperator.CONTAINS,val1:""}),"getDefaultFormParams"),testMappingParams:__name(params=>{const[op]=getOnlyOperatorAndVal(params);return op===ExtendCustomFilterOperator.CONTAINS},"testMappingParams"),mapToFilterColumn:__name(mapParams=>{const{val1}=mapParams;return val1===""?null:{customFilters:{customFilters:[{val:`*${val1}*`}]}}},"mapToFilterColumn"),testMappingFilterColumn:__name(filterColumn=>{var _a13;if(((_a13=filterColumn.customFilters)==null?void 0:_a13.customFilters.length)!==1)return!1;const firstCustomFilter=filterColumn.customFilters.customFilters[0],valAsString=firstCustomFilter.val.toString();return!firstCustomFilter.operator&&valAsString.startsWith("*")&&valAsString.endsWith("*")?{operator1:ExtendCustomFilterOperator.CONTAINS,val1:valAsString.slice(1,-1)}:!1},"testMappingFilterColumn")},FilterConditionItems2.DOES_NOT_CONTAIN={label:"sheets-filter.conditions.does-not-contain",operator:ExtendCustomFilterOperator.DOES_NOT_CONTAIN,order:OperatorOrder.FIRST,numOfParameters:1,getDefaultFormParams:__name(()=>({operator1:ExtendCustomFilterOperator.DOES_NOT_CONTAIN,val1:""}),"getDefaultFormParams"),mapToFilterColumn:__name(mapParams=>({customFilters:{customFilters:[{val:`*${mapParams.val1}*`,operator:sheetsFilter.CustomFilterOperator.NOT_EQUALS}]}}),"mapToFilterColumn"),testMappingParams:__name(params=>{const[op]=getOnlyOperatorAndVal(params);return op===ExtendCustomFilterOperator.DOES_NOT_CONTAIN},"testMappingParams"),testMappingFilterColumn:__name(filterColumn=>{var _a13;if(((_a13=filterColumn.customFilters)==null?void 0:_a13.customFilters.length)!==1)return!1;const firstCustomFilter=filterColumn.customFilters.customFilters[0],valAsString=firstCustomFilter.val.toString();return firstCustomFilter.operator===sheetsFilter.CustomFilterOperator.NOT_EQUALS&&valAsString.startsWith("*")&&valAsString.endsWith("*")?{operator1:ExtendCustomFilterOperator.DOES_NOT_CONTAIN,val1:valAsString.slice(1,-1)}:!1},"testMappingFilterColumn")},FilterConditionItems2.STARTS_WITH={label:"sheets-filter.conditions.starts-with",operator:ExtendCustomFilterOperator.STARTS_WITH,order:OperatorOrder.FIRST,numOfParameters:1,getDefaultFormParams:__name(()=>({operator1:ExtendCustomFilterOperator.STARTS_WITH,val1:""}),"getDefaultFormParams"),mapToFilterColumn:__name(mapParams=>({customFilters:{customFilters:[{val:`${mapParams.val1}*`}]}}),"mapToFilterColumn"),testMappingParams:__name(params=>{const[op]=getOnlyOperatorAndVal(params);return op===ExtendCustomFilterOperator.STARTS_WITH},"testMappingParams"),testMappingFilterColumn:__name(filterColumn=>{var _a13;if(((_a13=filterColumn.customFilters)==null?void 0:_a13.customFilters.length)!==1)return!1;const firstCustomFilter=filterColumn.customFilters.customFilters[0],valAsString=firstCustomFilter.val.toString();return!firstCustomFilter.operator&&valAsString.endsWith("*")&&!valAsString.startsWith("*")?{operator1:ExtendCustomFilterOperator.STARTS_WITH,val1:valAsString.slice(0,-1)}:!1},"testMappingFilterColumn")},FilterConditionItems2.ENDS_WITH={label:"sheets-filter.conditions.ends-with",operator:ExtendCustomFilterOperator.ENDS_WITH,order:OperatorOrder.FIRST,numOfParameters:1,getDefaultFormParams:__name(()=>({operator1:ExtendCustomFilterOperator.ENDS_WITH,val1:""}),"getDefaultFormParams"),mapToFilterColumn:__name(mapParams=>({customFilters:{customFilters:[{val:`*${mapParams.val1}`}]}}),"mapToFilterColumn"),testMappingParams:__name(params=>{const[op]=getOnlyOperatorAndVal(params);return op===ExtendCustomFilterOperator.ENDS_WITH},"testMappingParams"),testMappingFilterColumn:__name(filterColumn=>{var _a13;if(((_a13=filterColumn.customFilters)==null?void 0:_a13.customFilters.length)!==1)return!1;const firstCustomFilter=filterColumn.customFilters.customFilters[0],valAsString=firstCustomFilter.val.toString();return!firstCustomFilter.operator&&valAsString.startsWith("*")&&!valAsString.endsWith("*")?{operator1:ExtendCustomFilterOperator.ENDS_WITH,val1:valAsString.slice(1)}:!1},"testMappingFilterColumn")},FilterConditionItems2.EQUALS={label:"sheets-filter.conditions.equals",operator:ExtendCustomFilterOperator.EQUALS,order:OperatorOrder.FIRST,numOfParameters:1,getDefaultFormParams:__name(()=>({operator1:ExtendCustomFilterOperator.EQUALS,val1:""}),"getDefaultFormParams"),testMappingParams:__name(params=>{const[op]=getOnlyOperatorAndVal(params);return op===ExtendCustomFilterOperator.EQUALS},"testMappingParams"),mapToFilterColumn:__name(mapParams=>{const{val1}=mapParams;return val1===""?null:{customFilters:{customFilters:[{val:val1}]}}},"mapToFilterColumn"),testMappingFilterColumn:__name(filterColumn=>{var _a13,_b,_c;return((_b=(_a13=filterColumn.filters)==null?void 0:_a13.filters)==null?void 0:_b.length)===1?{operator1:ExtendCustomFilterOperator.EQUALS,val1:""}:((_c=filterColumn.customFilters)==null?void 0:_c.customFilters.length)===1&&!filterColumn.customFilters.customFilters[0].operator?{operator1:ExtendCustomFilterOperator.EQUALS,val1:filterColumn.customFilters.customFilters[0].val.toString()}:!1},"testMappingFilterColumn")},FilterConditionItems2.GREATER_THAN={label:"sheets-filter.conditions.greater-than",operator:sheetsFilter.CustomFilterOperator.GREATER_THAN,numOfParameters:1,order:OperatorOrder.FIRST,getDefaultFormParams:__name(()=>({operator1:sheetsFilter.CustomFilterOperator.GREATER_THAN,val1:""}),"getDefaultFormParams"),mapToFilterColumn:__name(mapParams=>({customFilters:{customFilters:[{val:mapParams.val1,operator:sheetsFilter.CustomFilterOperator.GREATER_THAN}]}}),"mapToFilterColumn"),testMappingParams:__name(params=>{const[op]=getOnlyOperatorAndVal(params);return op===sheetsFilter.CustomFilterOperator.GREATER_THAN},"testMappingParams"),testMappingFilterColumn:__name(filterColumn=>{var _a13;if(((_a13=filterColumn.customFilters)==null?void 0:_a13.customFilters.length)!==1)return!1;const firstCustomFilter=filterColumn.customFilters.customFilters[0];return firstCustomFilter.operator!==sheetsFilter.CustomFilterOperator.GREATER_THAN?!1:{operator1:sheetsFilter.CustomFilterOperator.GREATER_THAN,val1:firstCustomFilter.val.toString()}},"testMappingFilterColumn")},FilterConditionItems2.GREATER_THAN_OR_EQUAL={label:"sheets-filter.conditions.greater-than-or-equal",operator:sheetsFilter.CustomFilterOperator.GREATER_THAN_OR_EQUAL,numOfParameters:1,order:OperatorOrder.FIRST,getDefaultFormParams:__name(()=>({operator1:sheetsFilter.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:""}),"getDefaultFormParams"),testMappingParams:__name(params=>{const[op]=getOnlyOperatorAndVal(params);return op===sheetsFilter.CustomFilterOperator.GREATER_THAN_OR_EQUAL},"testMappingParams"),mapToFilterColumn:__name(mapParams=>({customFilters:{customFilters:[{val:mapParams.val1,operator:sheetsFilter.CustomFilterOperator.GREATER_THAN_OR_EQUAL}]}}),"mapToFilterColumn"),testMappingFilterColumn:__name(filterColumn=>{var _a13;if(((_a13=filterColumn.customFilters)==null?void 0:_a13.customFilters.length)!==1)return!1;const firstCustomFilter=filterColumn.customFilters.customFilters[0];return firstCustomFilter.operator!==sheetsFilter.CustomFilterOperator.GREATER_THAN_OR_EQUAL?!1:{operator1:sheetsFilter.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:firstCustomFilter.val.toString()}},"testMappingFilterColumn")},FilterConditionItems2.LESS_THAN={label:"sheets-filter.conditions.less-than",operator:sheetsFilter.CustomFilterOperator.LESS_THAN,numOfParameters:1,order:OperatorOrder.FIRST,getDefaultFormParams:__name(()=>({operator1:sheetsFilter.CustomFilterOperator.LESS_THAN,val1:""}),"getDefaultFormParams"),testMappingParams:__name(params=>{const[op]=getOnlyOperatorAndVal(params);return op===sheetsFilter.CustomFilterOperator.LESS_THAN},"testMappingParams"),mapToFilterColumn:__name(mapParams=>({customFilters:{customFilters:[{val:mapParams.val1,operator:sheetsFilter.CustomFilterOperator.LESS_THAN}]}}),"mapToFilterColumn"),testMappingFilterColumn:__name(filterColumn=>{var _a13;if(((_a13=filterColumn.customFilters)==null?void 0:_a13.customFilters.length)!==1)return!1;const firstCustomFilter=filterColumn.customFilters.customFilters[0];return firstCustomFilter.operator!==sheetsFilter.CustomFilterOperator.LESS_THAN?!1:{operator1:sheetsFilter.CustomFilterOperator.LESS_THAN,val1:firstCustomFilter.val.toString()}},"testMappingFilterColumn")},FilterConditionItems2.LESS_THAN_OR_EQUAL={label:"sheets-filter.conditions.less-than-or-equal",operator:sheetsFilter.CustomFilterOperator.LESS_THAN_OR_EQUAL,numOfParameters:1,order:OperatorOrder.FIRST,getDefaultFormParams:__name(()=>({operator1:sheetsFilter.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:""}),"getDefaultFormParams"),testMappingParams:__name(params=>{const[op]=getOnlyOperatorAndVal(params);return op===sheetsFilter.CustomFilterOperator.LESS_THAN_OR_EQUAL},"testMappingParams"),mapToFilterColumn:__name(mapParams=>({customFilters:{customFilters:[{val:mapParams.val1,operator:sheetsFilter.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}),"mapToFilterColumn"),testMappingFilterColumn:__name(filterColumn=>{var _a13;if(((_a13=filterColumn.customFilters)==null?void 0:_a13.customFilters.length)!==1)return!1;const firstCustomFilter=filterColumn.customFilters.customFilters[0];return firstCustomFilter.operator!==sheetsFilter.CustomFilterOperator.LESS_THAN_OR_EQUAL?!1:{operator1:sheetsFilter.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:firstCustomFilter.val.toString()}},"testMappingFilterColumn")},FilterConditionItems2.EQUAL={label:"sheets-filter.conditions.equal",operator:sheetsFilter.CustomFilterOperator.EQUAL,numOfParameters:1,order:OperatorOrder.FIRST,getDefaultFormParams:__name(()=>({operator1:sheetsFilter.CustomFilterOperator.EQUAL,val1:""}),"getDefaultFormParams"),testMappingParams:__name(params=>{const[op]=getOnlyOperatorAndVal(params);return op===sheetsFilter.CustomFilterOperator.EQUAL},"testMappingParams"),mapToFilterColumn:__name(mapParams=>({customFilters:{customFilters:[{val:mapParams.val1,operator:sheetsFilter.CustomFilterOperator.EQUAL}]}}),"mapToFilterColumn"),testMappingFilterColumn:__name(filterColumn=>{var _a13;if(((_a13=filterColumn.customFilters)==null?void 0:_a13.customFilters.length)!==1)return!1;const firstCustomFilter=filterColumn.customFilters.customFilters[0];return firstCustomFilter.operator!==sheetsFilter.CustomFilterOperator.EQUAL?!1:{operator1:sheetsFilter.CustomFilterOperator.EQUAL,val1:firstCustomFilter.val.toString()}},"testMappingFilterColumn")},FilterConditionItems2.NOT_EQUAL={label:"sheets-filter.conditions.not-equal",operator:sheetsFilter.CustomFilterOperator.NOT_EQUALS,numOfParameters:1,order:OperatorOrder.FIRST,getDefaultFormParams:__name(()=>({operator1:sheetsFilter.CustomFilterOperator.NOT_EQUALS,val1:""}),"getDefaultFormParams"),testMappingParams:__name(params=>{const[op]=getOnlyOperatorAndVal(params);return op===sheetsFilter.CustomFilterOperator.NOT_EQUALS},"testMappingParams"),mapToFilterColumn:__name(mapParams=>({customFilters:{customFilters:[{val:mapParams.val1,operator:sheetsFilter.CustomFilterOperator.NOT_EQUALS}]}}),"mapToFilterColumn"),testMappingFilterColumn:__name(filterColumn=>{var _a13;if(((_a13=filterColumn.customFilters)==null?void 0:_a13.customFilters.length)!==1)return!1;const firstCustomFilter=filterColumn.customFilters.customFilters[0];return firstCustomFilter.operator!==sheetsFilter.CustomFilterOperator.NOT_EQUALS?!1:{operator1:sheetsFilter.CustomFilterOperator.NOT_EQUALS,val1:firstCustomFilter.val.toString()}},"testMappingFilterColumn")},FilterConditionItems2.BETWEEN={label:"sheets-filter.conditions.between",operator:ExtendCustomFilterOperator.BETWEEN,order:OperatorOrder.SECOND,numOfParameters:2,getDefaultFormParams:__name(()=>({and:!0,operator1:sheetsFilter.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:"",operator2:sheetsFilter.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:""}),"getDefaultFormParams"),testMappingParams:__name(params=>{const{and,operator1,operator2}=params;if(!and)return!1;const operators=[operator1,operator2];return operators.includes(sheetsFilter.CustomFilterOperator.GREATER_THAN_OR_EQUAL)&&operators.includes(sheetsFilter.CustomFilterOperator.LESS_THAN_OR_EQUAL)},"testMappingParams"),mapToFilterColumn:__name(mapParams=>{const{val1,val2,operator1}=mapParams,operator1IsGreater=operator1===sheetsFilter.CustomFilterOperator.GREATER_THAN_OR_EQUAL;return{customFilters:{and:core.BooleanNumber.TRUE,customFilters:[{val:operator1IsGreater?val1:val2,operator:sheetsFilter.CustomFilterOperator.GREATER_THAN_OR_EQUAL},{val:operator1IsGreater?val2:val1,operator:sheetsFilter.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}},"mapToFilterColumn"),testMappingFilterColumn:__name(filterColumn=>{var _a13;if(((_a13=filterColumn.customFilters)==null?void 0:_a13.customFilters.length)!==2)return!1;const[firstCustomFilter,secondCustomFilter]=filterColumn.customFilters.customFilters;return firstCustomFilter.operator===sheetsFilter.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&secondCustomFilter.operator===sheetsFilter.CustomFilterOperator.LESS_THAN_OR_EQUAL&&filterColumn.customFilters.and?{and:!0,operator1:sheetsFilter.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:firstCustomFilter.val.toString(),operator2:sheetsFilter.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:secondCustomFilter.val.toString()}:secondCustomFilter.operator===sheetsFilter.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&firstCustomFilter.operator===sheetsFilter.CustomFilterOperator.LESS_THAN_OR_EQUAL&&filterColumn.customFilters.and?{and:!0,operator1:sheetsFilter.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:secondCustomFilter.val.toString(),operator2:sheetsFilter.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:firstCustomFilter.val.toLocaleString()}:!1},"testMappingFilterColumn")},FilterConditionItems2.NOT_BETWEEN={label:"sheets-filter.conditions.not-between",operator:ExtendCustomFilterOperator.NOT_BETWEEN,order:OperatorOrder.SECOND,numOfParameters:2,getDefaultFormParams:__name(()=>({operator1:sheetsFilter.CustomFilterOperator.LESS_THAN,val1:"",operator2:sheetsFilter.CustomFilterOperator.GREATER_THAN,val2:""}),"getDefaultFormParams"),testMappingParams:__name(params=>{const{and,operator1,operator2}=params;if(and)return!1;const operators=[operator1,operator2];return operators.includes(sheetsFilter.CustomFilterOperator.GREATER_THAN)&&operators.includes(sheetsFilter.CustomFilterOperator.LESS_THAN)},"testMappingParams"),mapToFilterColumn:__name(mapParams=>{const{val1,val2,operator1}=mapParams,operator1IsGreater=operator1===sheetsFilter.CustomFilterOperator.GREATER_THAN;return{customFilters:{customFilters:[{val:operator1IsGreater?val1:val2,operator:sheetsFilter.CustomFilterOperator.GREATER_THAN},{val:operator1IsGreater?val2:val1,operator:sheetsFilter.CustomFilterOperator.LESS_THAN}]}}},"mapToFilterColumn"),testMappingFilterColumn:__name(filterColumn=>{var _a13;if(((_a13=filterColumn.customFilters)==null?void 0:_a13.customFilters.length)!==2)return!1;const[firstCustomFilter,secondCustomFilter]=filterColumn.customFilters.customFilters;return firstCustomFilter.operator===sheetsFilter.CustomFilterOperator.LESS_THAN&&secondCustomFilter.operator===sheetsFilter.CustomFilterOperator.GREATER_THAN&&!filterColumn.customFilters.and?{operator1:sheetsFilter.CustomFilterOperator.LESS_THAN,val1:firstCustomFilter.val.toString(),operator2:sheetsFilter.CustomFilterOperator.GREATER_THAN,val2:secondCustomFilter.val.toString()}:secondCustomFilter.operator===sheetsFilter.CustomFilterOperator.LESS_THAN&&firstCustomFilter.operator===sheetsFilter.CustomFilterOperator.GREATER_THAN&&!filterColumn.customFilters.and?{operator1:sheetsFilter.CustomFilterOperator.GREATER_THAN,val1:secondCustomFilter.val.toString(),operator2:sheetsFilter.CustomFilterOperator.LESS_THAN,val2:firstCustomFilter.val.toLocaleString()}:!1},"testMappingFilterColumn")},FilterConditionItems2.CUSTOM={label:"sheets-filter.conditions.custom",operator:ExtendCustomFilterOperator.CUSTOM,order:OperatorOrder.SECOND,numOfParameters:2,getDefaultFormParams:__name(()=>({operator1:ExtendCustomFilterOperator.NONE,val1:"",operator2:ExtendCustomFilterOperator.NONE,val2:""}),"getDefaultFormParams"),testMappingParams:__name(()=>!0,"testMappingParams"),mapToFilterColumn:__name(mapParams=>{const{and,val1,val2,operator1,operator2}=mapParams;function mapOperator(operator,val){for(const condition of FilterConditionItems2.ALL_CONDITIONS)if(condition.operator===operator)return condition.mapToFilterColumn({val1:val,operator1:operator})}__name(mapOperator,"mapOperator");const operator1IsNone=!operator1||operator1===FilterConditionItems2.NONE.operator,operator2IsNone=!operator2||operator2===FilterConditionItems2.NONE.operator;if(operator1IsNone&&operator2IsNone)return FilterConditionItems2.NONE.mapToFilterColumn({});if(operator1IsNone)return mapOperator(operator2,val2);if(operator2IsNone)return mapOperator(operator1,val1);const mappedCustomFilter1=mapOperator(operator1,val1),mappedCustomFilter2=mapOperator(operator2,val2),customFilters={customFilters:[mappedCustomFilter1.customFilters.customFilters[0],mappedCustomFilter2.customFilters.customFilters[0]]};return and&&(customFilters.and=core.BooleanNumber.TRUE),{customFilters}},"mapToFilterColumn"),testMappingFilterColumn:__name(filterColumn=>{var _a13;if(((_a13=filterColumn.customFilters)==null?void 0:_a13.customFilters.length)!==2)return!1;const params=filterColumn.customFilters.customFilters.map(customFilter=>testMappingFilterColumn({customFilters:{customFilters:[customFilter]}})),result={operator1:params[0][0].operator,val1:params[0][1].val1,operator2:params[1][0].operator,val2:params[1][1].val1};return filterColumn.customFilters.and&&(result.and=!0),result},"testMappingFilterColumn")},FilterConditionItems2.ALL_CONDITIONS=[FilterConditionItems2.NONE,FilterConditionItems2.EMPTY,FilterConditionItems2.NOT_EMPTY,FilterConditionItems2.TEXT_CONTAINS,FilterConditionItems2.DOES_NOT_CONTAIN,FilterConditionItems2.STARTS_WITH,FilterConditionItems2.ENDS_WITH,FilterConditionItems2.EQUALS,FilterConditionItems2.GREATER_THAN,FilterConditionItems2.GREATER_THAN_OR_EQUAL,FilterConditionItems2.LESS_THAN,FilterConditionItems2.LESS_THAN_OR_EQUAL,FilterConditionItems2.EQUAL,FilterConditionItems2.NOT_EQUAL,FilterConditionItems2.BETWEEN,FilterConditionItems2.NOT_BETWEEN,FilterConditionItems2.CUSTOM];function getItemByOperator(operator){const item=FilterConditionItems2.ALL_CONDITIONS.find(condition=>condition.operator===operator);if(!item)throw new Error(`[SheetsFilter]: no condition item found for operator: ${operator}`);return item}__name(getItemByOperator,"getItemByOperator"),FilterConditionItems2.getItemByOperator=getItemByOperator;function testMappingParams(mapParams,numOfParameters){for(const condition of FilterConditionItems2.ALL_CONDITIONS.filter(condition2=>condition2.numOfParameters===numOfParameters))if(condition.numOfParameters!==0&&condition.testMappingParams(mapParams))return condition;for(const condition of FilterConditionItems2.ALL_CONDITIONS)if(condition.testMappingParams(mapParams))return condition;throw new Error("[SheetsFilter]: no condition item can be mapped from the filter map params!")}__name(testMappingParams,"testMappingParams"),FilterConditionItems2.testMappingParams=testMappingParams;function getInitialFormParams(operator){const condition=FilterConditionItems2.ALL_CONDITIONS.find(condition2=>condition2.operator===operator);return(condition==null?void 0:condition.numOfParameters)===0?{operator1:condition.operator}:condition.getDefaultFormParams()}__name(getInitialFormParams,"getInitialFormParams"),FilterConditionItems2.getInitialFormParams=getInitialFormParams;function mapToFilterColumn(condition,mapParams){return condition.mapToFilterColumn(mapParams)}__name(mapToFilterColumn,"mapToFilterColumn"),FilterConditionItems2.mapToFilterColumn=mapToFilterColumn;function testMappingFilterColumn(filterColumn){if(!filterColumn)return[FilterConditionItems2.NONE,{}];for(const condition of FilterConditionItems2.ALL_CONDITIONS){const mapParams=condition.testMappingFilterColumn(filterColumn);if(mapParams)return[condition,mapParams]}return[FilterConditionItems2.NONE,{}]}__name(testMappingFilterColumn,"testMappingFilterColumn"),FilterConditionItems2.testMappingFilterColumn=testMappingFilterColumn})(FilterConditionItems||(FilterConditionItems={}));function getOnlyOperatorAndVal(mapParams){const{operator1,operator2,val1,val2}=mapParams;if(operator1&&operator2)throw new Error("Both operator1 and operator2 are set!");if(!operator1&&!operator2)throw new Error("Neither operator1 and operator2 and both not set!");return operator1?[operator1,val1]:[operator2,val2]}__name(getOnlyOperatorAndVal,"getOnlyOperatorAndVal");function statisticFilterByValueItems(items){const checkedItems=[],uncheckedItems=[];let checked=0,unchecked=0;function traverse(node){node.leaf&&(node.checked?(checkedItems.push(node),checked+=node.count):(uncheckedItems.push(node),unchecked+=node.count)),node.children&&node.children.forEach(traverse)}return __name(traverse,"traverse"),items.forEach(traverse),{checkedItems,uncheckedItems,checked,unchecked}}__name(statisticFilterByValueItems,"statisticFilterByValueItems");var __defProp$9=Object.defineProperty,__getOwnPropDesc$9=Object.getOwnPropertyDescriptor,__decorateClass$9=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$9(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$9(target,key,result),result},"__decorateClass$9"),__decorateParam$9=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$9");const SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME="sheets-filter.generate-filter-values.service",ISheetsGenerateFilterValuesService=core.createIdentifier(SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME),CAN_PARSE_DATE_FORMAT=["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"];var _a;let SheetsGenerateFilterValuesService=(_a=class extends core.Disposable{constructor(_localeService,_univerInstanceService,_logService){super(),this._localeService=_localeService,this._univerInstanceService=_univerInstanceService,this._logService=_logService}async getFilterValues(params){var _a13;const{unitId,subUnitId,filteredOutRowsByOtherColumns,filters,blankChecked,iterateRange,alreadyChecked}=params,workbook=this._univerInstanceService.getUnit(unitId),worksheet=(_a13=this._univerInstanceService.getUnit(unitId))==null?void 0:_a13.getSheetBySheetId(subUnitId);return!workbook||!worksheet?[]:(this._logService.debug("[SheetsGenerateFilterValuesService]","getFilterValues for",{unitId,subUnitId}),getFilterTreeByValueItems(filters,this._localeService,iterateRange,worksheet,new Set(filteredOutRowsByOtherColumns),new Set(alreadyChecked.map(String)),blankChecked,workbook.getStyles()))}},__name(_a,"SheetsGenerateFilterValuesService"),_a);SheetsGenerateFilterValuesService=__decorateClass$9([__decorateParam$9(0,core.Inject(core.LocaleService)),__decorateParam$9(1,core.IUniverInstanceService),__decorateParam$9(2,core.ILogService)],SheetsGenerateFilterValuesService);function getFilterTreeByValueItems(filters,localeService,iterateRange,worksheet,filteredOutRowsByOtherColumns,alreadyChecked,blankChecked,styles2){var _a13,_b,_c,_d,_e,_f,_g,_h,_i;const items=new Map,treeMap=new Map,DefaultPattern="yyyy-mm-dd",canSplitPatternSet=new Set(CAN_PARSE_DATE_FORMAT),EmptyKey="empty";let emptyCount=0;for(const cell of worksheet.iterateByColumn(iterateRange,!1,!1)){const{row,rowSpan=1}=cell;let rowIndex=0;for(;rowIndex<rowSpan;){const targetRow=row+rowIndex;if(filteredOutRowsByOtherColumns.has(targetRow)){rowIndex++;continue}const value=cell!=null&&cell.value?core.extractPureTextFromCell(cell.value):"";if(!value){emptyCount+=1,rowIndex+=rowSpan;continue}const fmtStr=(_a13=cell.value)!=null&&_a13.v&&!cell.value.p?(_d=(_c=styles2.get((_b=cell.value)==null?void 0:_b.s))==null?void 0:_c.n)==null?void 0:_d.pattern:"",isDateValue=fmtStr&&core.numfmt.isDate(fmtStr);if(fmtStr&&isDateValue&&canSplitPatternSet.has(fmtStr)){const originValue=(_e=worksheet.getCellRaw(cell.row,cell.col))==null?void 0:_e.v;if(!originValue){rowIndex++;continue}const valueParsedByDefaultPattern=core.numfmt.format(DefaultPattern,originValue),[year,month,day]=valueParsedByDefaultPattern.split("-").map(Number);let yearItem=items.get(`${year}`);yearItem||(yearItem={title:`${year}`,key:`${year}`,children:[],count:0,leaf:!1,checked:!1},items.set(`${year}`,yearItem),treeMap.set(`${year}`,[`${year}`]));let monthItem=(_f=yearItem.children)==null?void 0:_f.find(item=>item.key===`${year}-${month}`);monthItem||(monthItem={title:localeService.t(`sheets-filter.date.${month}`),key:`${year}-${month}`,children:[],count:0,leaf:!1,checked:!1},(_g=yearItem.children)==null||_g.push(monthItem),treeMap.set(`${year}-${month}`,[`${year}`,`${year}-${month}`]));const dayItem=(_h=monthItem==null?void 0:monthItem.children)==null?void 0:_h.find(item=>item.key===`${year}-${month}-${day}`);dayItem?(dayItem.originValues.add(value),dayItem.count++,monthItem.count++,yearItem.count++):((_i=monthItem.children)==null||_i.push({title:`${day}`,key:`${year}-${month}-${day}`,count:1,originValues:new Set([value]),leaf:!0,checked:alreadyChecked.size?alreadyChecked.has(value):!blankChecked}),monthItem.count++,yearItem.count++,treeMap.set(`${year}-${month}-${day}`,[`${year}`,`${year}-${month}`,`${year}-${month}-${day}`]))}else{const key=value;let item=items.get(key);item?item.count++:(item={title:value,leaf:!0,checked:alreadyChecked.size?alreadyChecked.has(value):!blankChecked,key,count:1},items.set(key,item),treeMap.set(key,[key]))}rowIndex++}}const initialBlankChecked=filters?blankChecked:!0;if(emptyCount>0){const item={title:localeService.t("sheets-filter.panel.empty"),count:emptyCount,leaf:!0,checked:initialBlankChecked,key:EmptyKey};items.set("empty",item),treeMap.set("empty",[EmptyKey])}return{filterTreeItems:generateFilterTreeBySort(Array.from(items.values())),filterTreeMapCache:treeMap}}__name(getFilterTreeByValueItems,"getFilterTreeByValueItems");function generateFilterTreeBySort(tree){return Array.from(tree).sort((a,b)=>a.children&&!b.children?-1:!a.children&&b.children?1:b.title.localeCompare(a.title)).map(yearItem=>(yearItem.children&&yearItem.children.sort((a,b)=>{const monthA=Number.parseInt(a.key.split("-")[1],10),monthB=Number.parseInt(b.key.split("-")[1],10);return monthA-monthB}).forEach(monthItem=>{monthItem.children&&monthItem.children.sort((a,b)=>{const dayA=Number.parseInt(a.key.split("-")[2],10),dayB=Number.parseInt(b.key.split("-")[2],10);return dayA-dayB})}),yearItem))}__name(generateFilterTreeBySort,"generateFilterTreeBySort");function findObjectByKey(data,targetKey){for(const node of data){if(node.key===targetKey)return node;if(node.children){const result=findObjectByKey(node.children,targetKey);if(result)return result}}return null}__name(findObjectByKey,"findObjectByKey");function areAllLeafNodesChecked(node){return node.leaf?node.checked:node.children?node.children.every(child=>areAllLeafNodesChecked(child)):!0}__name(areAllLeafNodesChecked,"areAllLeafNodesChecked");function updateLeafNodesCheckedStatus(node,status){node.leaf&&(status!==void 0?node.checked=status:node.checked=!node.checked),node.children&&node.children.forEach(child=>updateLeafNodesCheckedStatus(child,status))}__name(updateLeafNodesCheckedStatus,"updateLeafNodesCheckedStatus");function searchTree(items,searchKeywords){const result=[];return items.forEach(item=>{const originMatches=item.originValues?searchKeywords.some(keyword=>Array.from(item.originValues).some(value=>value.toLowerCase().includes(keyword.toLowerCase()))):!1,titleMatches=!originMatches&&searchKeywords.some(keyword=>item.title.toLowerCase().includes(keyword.toLowerCase()));if(originMatches||titleMatches)result.push({...item});else if(item.children){const filteredChildren=searchTree(item.children,searchKeywords);if(filteredChildren.length>0){const aggregatedCount=filteredChildren.reduce((sum,child)=>sum+child.count,0);result.push({...item,count:aggregatedCount,children:filteredChildren})}}}),result}__name(searchTree,"searchTree");var __defProp$8=Object.defineProperty,__getOwnPropDesc$8=Object.getOwnPropertyDescriptor,__decorateClass$8=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$8(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$8(target,key,result),result},"__decorateClass$8"),__decorateParam$8=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$8"),FilterBy=(FilterBy2=>(FilterBy2[FilterBy2.VALUES=0]="VALUES",FilterBy2[FilterBy2.CONDITIONS=1]="CONDITIONS",FilterBy2))(FilterBy||{});core.createIdentifier("sheets-filter-ui.sheets-filter-panel.service");var _a2;let SheetsFilterPanelService=(_a2=class extends core.Disposable{constructor(_injector,_refRangeService){super();__publicField(this,"_filterBy$",new rxjs.BehaviorSubject(0));__publicField(this,"filterBy$",this._filterBy$.asObservable());__publicField(this,"_filterByModel$",new rxjs.ReplaySubject(1));__publicField(this,"filterByModel$",this._filterByModel$.asObservable());__publicField(this,"_filterByModel",null);__publicField(this,"_hasCriteria$",new rxjs.BehaviorSubject(!1));__publicField(this,"hasCriteria$",this._hasCriteria$.asObservable());__publicField(this,"_filterModel",null);__publicField(this,"_col$",new rxjs.BehaviorSubject(-1));__publicField(this,"col$",this._col$.asObservable());__publicField(this,"_filterHeaderListener",null);this._injector=_injector,this._refRangeService=_refRangeService}get filterBy(){return this._filterBy$.getValue()}get filterByModel(){return this._filterByModel}set filterByModel(model){this._filterByModel=model,this._filterByModel$.next(model)}get filterModel(){return this._filterModel}get col(){return this._col$.getValue()}dispose(){this._filterBy$.complete(),this._filterByModel$.complete(),this._hasCriteria$.complete()}setupCol(filterModel,col){this.terminate(),this._filterModel=filterModel,this._col$.next(col);const filterColumn=filterModel.getFilterColumn(col);if(filterColumn){const info=filterColumn.getColumnData();if(info.customFilters){this._hasCriteria$.next(!0),this._setupByConditions(filterModel,col);return}if(info.filters){this._hasCriteria$.next(!0),this._setupByValues(filterModel,col);return}this._hasCriteria$.next(!1),this._setupByValues(filterModel,col);return}this._hasCriteria$.next(!1),this._setupByValues(filterModel,col)}changeFilterBy(filterBy){return!this._filterModel||this.col===-1?!1:(filterBy===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 _a13;(_a13=this._filterHeaderListener)==null||_a13.dispose(),this._filterHeaderListener=null}_listenToFilterHeaderChange(filterModel,col){this._disposeFilterHeaderChangeListener();const unitId=filterModel.unitId,subUnitId=filterModel.subUnitId,filterRange=filterModel.getRange(),columnHeaderRange={startColumn:col,startRow:filterRange.startRow,endRow:filterRange.startRow,endColumn:col};this._filterHeaderListener=this._refRangeService.watchRange(unitId,subUnitId,columnHeaderRange,(before,after)=>{if(!after)this.terminate();else{const offset=after.startColumn-before.startColumn;offset!==0&&this._filterByModel.deltaCol(offset)}})}async _setupByValues(filterModel,col){this._disposePreviousModel();const range=filterModel.getRange();if(range.startRow===range.endRow)return!1;const filterByModel=await ByValuesModel.fromFilterColumn(this._injector,filterModel,col);return this.filterByModel=filterByModel,this._filterBy$.next(0),this._listenToFilterHeaderChange(filterModel,col),!0}_setupByConditions(filterModel,col){this._disposePreviousModel();const range=filterModel.getRange();if(range.startRow===range.endRow)return!1;const model=ByConditionsModel.fromFilterColumn(this._injector,filterModel,col,filterModel.getFilterColumn(col));return this.filterByModel=model,this._filterBy$.next(1),this._listenToFilterHeaderChange(filterModel,col),!0}_disposePreviousModel(){var _a13;(_a13=this._filterByModel)==null||_a13.dispose(),this.filterByModel=null}},__name(_a2,"SheetsFilterPanelService"),_a2);SheetsFilterPanelService=__decorateClass$8([__decorateParam$8(0,core.Inject(core.Injector)),__decorateParam$8(1,core.Inject(sheets.RefRangeService))],SheetsFilterPanelService);var _a3;let ByConditionsModel=(_a3=class extends core.Disposable{constructor(_filterModel,col,conditionItem,conditionParams,_commandService){super();__publicField(this,"canApply$",rxjs.of(!0));__publicField(this,"_conditionItem$");__publicField(this,"conditionItem$");__publicField(this,"_filterConditionFormParams$");__publicField(this,"filterConditionFormParams$");this._filterModel=_filterModel,this.col=col,this._commandService=_commandService,this._conditionItem$=new rxjs.BehaviorSubject(conditionItem),this.conditionItem$=this._conditionItem$.asObservable(),this._filterConditionFormParams$=new rxjs.BehaviorSubject(conditionParams),this.filterConditionFormParams$=this._filterConditionFormParams$.asObservable()}static fromFilterColumn(injector,filterModel,col,filterColumn){const[conditionItem,conditionParams]=FilterConditionItems.testMappingFilterColumn(filterColumn==null?void 0:filterColumn.getColumnData());return injector.createInstance(ByConditionsModel,filterModel,col,conditionItem,conditionParams)}get conditionItem(){return this._conditionItem$.getValue()}get filterConditionFormParams(){return this._filterConditionFormParams$.getValue()}dispose(){super.dispose(),this._conditionItem$.complete(),this._filterConditionFormParams$.complete()}deltaCol(offset){this.col+=offset}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(sheetsFilter.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const filterColumn=FilterConditionItems.mapToFilterColumn(this.conditionItem,this.filterConditionFormParams);return this._commandService.executeCommand(sheetsFilter.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:filterColumn})}onPrimaryConditionChange(operator){const conditionItem=FilterConditionItems.ALL_CONDITIONS.find(item=>item.operator===operator);if(!conditionItem)throw new Error(`[ByConditionsModel]: condition item not found for operator: ${operator}!`);this._conditionItem$.next(conditionItem),this._filterConditionFormParams$.next(FilterConditionItems.getInitialFormParams(operator))}onConditionFormChange(params){const newParams={...this.filterConditionFormParams,...params};if(newParams.and!==!0&&delete newParams.and,typeof params.and<"u"||typeof params.operator1<"u"||typeof params.operator2<"u"){const conditionItem=FilterConditionItems.testMappingParams(newParams,this.conditionItem.numOfParameters);this._conditionItem$.next(conditionItem)}this._filterConditionFormParams$.next(newParams)}},__name(_a3,"ByConditionsModel"),_a3);ByConditionsModel=__decorateClass$8([__decorateParam$8(4,core.ICommandService)],ByConditionsModel);var _a4;let ByValuesModel=(_a4=class extends core.Disposable{constructor(_filterModel,col,items,cache,_commandService){super();__publicField(this,"_rawFilterItems$");__publicField(this,"rawFilterItems$");__publicField(this,"filterItems$");__publicField(this,"_filterItems",[]);__publicField(this,"_treeMapCache");__publicField(this,"canApply$");__publicField(this,"_manuallyUpdateFilterItems$");__publicField(this,"_searchString$");__publicField(this,"searchString$");this._filterModel=_filterModel,this.col=col,this._commandService=_commandService,this._treeMapCache=cache,this._searchString$=new rxjs.BehaviorSubject(""),this.searchString$=this._searchString$.asObservable(),this._rawFilterItems$=new rxjs.BehaviorSubject(items),this.rawFilterItems$=this._rawFilterItems$.asObservable(),this._manuallyUpdateFilterItems$=new rxjs.Subject,this.filterItems$=rxjs.merge(rxjs.combineLatest([this._searchString$.pipe(rxjs.throttleTime(500,void 0,{leading:!0,trailing:!0}),rxjs.startWith(void 0)),this._rawFilterItems$]).pipe(rxjs.map(([searchString,items2])=>{if(!searchString)return items2;const searchKeyWords=searchString.toLowerCase().split(/\s+/).filter(s=>!!s);return searchTree(items2,searchKeyWords)})),this._manuallyUpdateFilterItems$).pipe(rxjs.shareReplay(1)),this.canApply$=this.filterItems$.pipe(rxjs.map(items2=>statisticFilterByValueItems(items2).checked>0)),this.disposeWithMe(this.filterItems$.subscribe(items2=>this._filterItems=items2))}static async fromFilterColumn(injector,filterModel,col){var _a13;const univerInstanceService=injector.get(core.IUniverInstanceService),localeService=injector.get(core.LocaleService),generateFilterValuesService=injector.get(ISheetsGenerateFilterValuesService,core.Quantity.OPTIONAL),{unitId,subUnitId}=filterModel,workbook=univerInstanceService.getUniverSheetInstance(unitId);if(!workbook)throw new Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${unitId}!`);const worksheet=workbook==null?void 0:workbook.getSheetBySheetId(subUnitId);if(!worksheet)throw new Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${unitId} and subUnitId: ${subUnitId}!`);const range=filterModel.getRange(),column=col,filters=(_a13=filterModel.getFilterColumn(col))==null?void 0:_a13.getColumnData().filters,alreadyChecked=new Set(filters==null?void 0:filters.filters),blankChecked=!!(filters&&filters.blank),filteredOutRowsByOtherColumns=filterModel.getFilteredOutRowsExceptCol(col),iterateRange={...range,startRow:range.startRow+1,startColumn:column,endColumn:column};let items,cache;if(generateFilterValuesService){const res=await generateFilterValuesService.getFilterValues({unitId,subUnitId,filteredOutRowsByOtherColumns:Array.from(filteredOutRowsByOtherColumns),filters:!!filters,blankChecked,iterateRange,alreadyChecked:Array.from(alreadyChecked)});items=res.filterTreeItems,cache=res.filterTreeMapCache}else{const res=getFilterTreeByValueItems(!!filters,localeService,iterateRange,worksheet,filteredOutRowsByOtherColumns,alreadyChecked,blankChecked,workbook.getStyles());items=res.filterTreeItems,cache=res.filterTreeMapCache}return injector.createInstance(ByValuesModel,filterModel,col,items,cache)}get rawFilterItems(){return this._rawFilterItems$.getValue()}get filterItems(){return this._filterItems}get treeMapCache(){return this._treeMapCache}dispose(){this._rawFilterItems$.complete(),this._searchString$.complete()}deltaCol(offset){this.col+=offset}setSearchString(str){this._searchString$.next(str)}onCheckAllToggled(checked){const items=core.Tools.deepClone(this._filterItems);items.forEach(item=>updateLeafNodesCheckedStatus(item,checked)),this._manuallyUpdateFilterItems(items)}onFilterCheckToggled(item){const items=core.Tools.deepClone(this._filterItems),changedItem=findObjectByKey(items,item.key);if(!changedItem)return;const allLeafChecked=areAllLeafNodesChecked(changedItem);updateLeafNodesCheckedStatus(changedItem,!allLeafChecked),this._manuallyUpdateFilterItems(items)}onFilterOnly(itemKeys){const items=core.Tools.deepClone(this._filterItems);items.forEach(item=>updateLeafNodesCheckedStatus(item,!1)),itemKeys.forEach(key=>{const changedItem=findObjectByKey(items,key);changedItem&&updateLeafNodesCheckedStatus(changedItem,!0)}),this._manuallyUpdateFilterItems(items)}_manuallyUpdateFilterItems(items){this._manuallyUpdateFilterItems$.next(items)}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(sheetsFilter.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const statistics=statisticFilterByValueItems(this._filterItems),{checked,checkedItems}=statistics,rawFilterItems=this.rawFilterItems;let rawFilterCount=0;for(const item of rawFilterItems)rawFilterCount+=item.count;const noChecked=checked===0,allChecked=statistics.checked===rawFilterCount,criteria={colId:this.col};if(noChecked)throw new Error("[ByValuesModel]: no checked items!");if(allChecked)return this._commandService.executeCommand(sheetsFilter.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null});{criteria.filters={};const nonEmptyItems=checkedItems.filter(item=>item.key!=="empty");nonEmptyItems.length>0&&(criteria.filters={filters:nonEmptyItems.flatMap(item=>item.originValues?Array.from(item.originValues):[item.title])}),nonEmptyItems.length!==checkedItems.length&&(criteria.filters.blank=!0)}return this._commandService.executeCommand(sheetsFilter.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria})}},__name(_a4,"ByValuesModel"),_a4);ByValuesModel=__decorateClass$8([__decorateParam$8(4,core.ICommandService)],ByValuesModel);const FILTER_PANEL_OPENED_KEY="FILTER_PANEL_OPENED",OpenFilterPanelOperation={id:"sheet.operation.open-filter-panel",type:core.CommandType.OPERATION,handler:__name((accessor,params)=>{const contextService=accessor.get(core.IContextService),sheetsFilterService=accessor.get(sheetsFilter.SheetsFilterService),sheetsFilterPanelService=accessor.get(SheetsFilterPanelService);accessor.get(core.ICommandService).syncExecuteCommand(sheetsUi.SetCellEditVisibleOperation.id,{visible:!1});const{unitId,subUnitId,col}=params,filterModel=sheetsFilterService.getFilterModel(unitId,subUnitId);return filterModel?(sheetsFilterPanelService.setupCol(filterModel,col),contextService.getContextValue(FILTER_PANEL_OPENED_KEY)||contextService.setContextValue(FILTER_PANEL_OPENED_KEY,!0),!0):!1},"handler")},CloseFilterPanelOperation={id:"sheet.operation.close-filter-panel",type:core.CommandType.OPERATION,handler:__name(accessor=>{const contextService=accessor.get(core.IContextService),sheetsFilterPanelService=accessor.get(SheetsFilterPanelService),layoutService=accessor.get(ui.ILayoutService,core.Quantity.OPTIONAL);return contextService.getContextValue(FILTER_PANEL_OPENED_KEY)?(contextService.setContextValue(FILTER_PANEL_OPENED_KEY,!1),layoutService==null||layoutService.focus(),sheetsFilterPanelService.terminate()):!1},"handler")},ChangeFilterByOperation={id:"sheet.operation.apply-filter",type:core.CommandType.OPERATION,handler:__name((accessor,params)=>{const{filterBy}=params;return accessor.get(SheetsFilterPanelService).changeFilterBy(filterBy)},"handler")};var __defProp$7=Object.defineProperty,__getOwnPropDesc$7=Object.getOwnPropertyDescriptor,__decorateClass$7=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$7(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$7(target,key,result),result},"__decorateClass$7"),__decorateParam$7=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$7"),_a5;let SheetsFilterPermissionController=(_a5=class extends core.Disposable{constructor(_sheetsFilterService,_localeService,_commandService,_sheetPermissionCheckPermission,_injector,_sheetsSelectionService){super(),this._sheetsFilterService=_sheetsFilterService,this._localeService=_localeService,this._commandService=_commandService,this._sheetPermissionCheckPermission=_sheetPermissionCheckPermission,this._injector=_injector,this._sheetsSelectionService=_sheetsSelectionService,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(command=>{var _a13,_b,_c;if(command.id===sheetsFilter.SmartToggleSheetsFilterCommand.id){const univerInstanceService=this._injector.get(core.IUniverInstanceService),target=sheets.getSheetCommandTarget(univerInstanceService);if(!target)return;const{unitId,subUnitId,worksheet}=target,filterRange=(_a13=this._sheetsFilterService.getFilterModel(unitId,subUnitId))==null?void 0:_a13.getRange();let permission;if(filterRange)permission=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[sheets.RangeProtectionPermissionViewPoint],worksheetTypes:[sheets.WorksheetFilterPermission,sheets.WorksheetViewPermission]},[filterRange]);else{const range=(_b=this._sheetsSelectionService.getCurrentLastSelection())==null?void 0:_b.range;if(range){let newRange={...range};newRange=range.startColumn===range.endColumn&&range.startRow===range.endRow?sheets.expandToContinuousRange(newRange,{left:!0,right:!0,up:!0,down:!0},worksheet):newRange,permission=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[sheets.RangeProtectionPermissionViewPoint],worksheetTypes:[sheets.WorksheetViewPermission,sheets.WorksheetFilterPermission]},[newRange],unitId,subUnitId)}else permission=this._sheetPermissionCheckPermission.permissionCheckWithoutRange({rangeTypes:[sheets.RangeProtectionPermissionViewPoint],worksheetTypes:[sheets.WorksheetViewPermission,sheets.WorksheetFilterPermission]})}permission||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr"))}if(command.id===OpenFilterPanelOperation.id){const params=command.params,{unitId,subUnitId}=params,filterRange=(_c=this._sheetsFilterService.getFilterModel(unitId,subUnitId))==null?void 0:_c.getRange(),colRange=core.Tools.deepClone(filterRange);colRange&&(colRange.startColumn=params.col,colRange.endColumn=params.col,this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[sheets.RangeProtectionPermissionViewPoint],worksheetTypes:[sheets.WorksheetFilterPermission,sheets.WorksheetViewPermission]},[colRange])||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr")))}}))}},__name(_a5,"SheetsFilterPermissionController"),_a5);SheetsFilterPermissionController=__decorateClass$7([__decorateParam$7(0,core.Inject(sheetsFilter.SheetsFilterService)),__decorateParam$7(1,core.Inject(core.LocaleService)),__decorateParam$7(2,core.ICommandService),__decorateParam$7(3,core.Inject(sheets.SheetPermissionCheckController)),__decorateParam$7(4,core.Inject(core.Injector)),__decorateParam$7(5,core.Inject(sheets.SheetsSelectionsService))],SheetsFilterPermissionController);var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t},IconBase=react.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=react.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return react.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a13){var key=_a13[0],value=_a13[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a13,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a13=node.children)===null||_a13===void 0)&&_a13.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid");IconBase.displayName="UniverIcon";var element={tag:"svg",attrs:{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"}}]},FilterSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"filter-single",ref,icon:element}))});FilterSingle.displayName="FilterSingle";const sheetsFilterPanel="univer-sheets-filter-panel",sheetsFilterPanelHeader="univer-sheets-filter-panel-header",sheetsFilterPanelContent="univer-sheets-filter-panel-content",sheetsFilterPanelSelectAll="univer-sheets-filter-panel-select-all",sheetsFilterPanelSelectAllCount="univer-sheets-filter-panel-select-all-count",sheetsFilterPanelValuesContainer="univer-sheets-filter-panel-values-container",inputAffixWrapper="univer-input-affix-wrapper",select="univer-select",radioGroup="univer-radio-group",sheetsFilterPanelValuesFind="univer-sheets-filter-panel-values-find",sheetsFilterPanelValuesList="univer-sheets-filter-panel-values-list",sheetsFilterPanelValuesListInnerContainer="univer-sheets-filter-panel-values-list-inner-container",sheetsFilterPanelValuesVirtual="univer-sheets-filter-panel-values-virtual",sheetsFilterPanelValuesItem="univer-sheets-filter-panel-values-item",sheetsFilterPanelValuesItemInner="univer-sheets-filter-panel-values-item-inner",sheetsFilterPanelValuesItemCount="univer-sheets-filter-panel-values-item-count",sheetsFilterPanelValuesItemExcludeButton="univer-sheets-filter-panel-values-item-exclude-button",sheetsFilterPanelValuesItemText="univer-sheets-filter-panel-values-item-text",sheetsFilterPanelConditionsContainer="univer-sheets-filter-panel-conditions-container",sheetsFilterPanelConditionsContainerInner="univer-sheets-filter-panel-conditions-container-inner",sheetsFilterPanelConditionsDesc="univer-sheets-filter-panel-conditions-desc",sheetsFilterPanelFooter="univer-sheets-filter-panel-footer",sheetsFilterPanelFooterPrimaryButtons="univer-sheets-filter-panel-footer-primary-buttons",button="univer-button",input="univer-input",formDualColumnLayout="univer-form-dual-column-layout",sheetsFilterTreeNode="univer-sheets-filter-tree-node",sheetsFilterTreeNodeFilterOnly="univer-sheets-filter-tree-node-filter-only",sheetsFilterTreeNodeAttach="univer-sheets-filter-tree-node-attach",styles={sheetsFilterPanel,sheetsFilterPanelHeader,sheetsFilterPanelContent,sheetsFilterPanelSelectAll,sheetsFilterPanelSelectAllCount,sheetsFilterPanelValuesContainer,inputAffixWrapper,select,radioGroup,sheetsFilterPanelValuesFind,sheetsFilterPanelValuesList,sheetsFilterPanelValuesListInnerContainer,sheetsFilterPanelValuesVirtual,sheetsFilterPanelValuesItem,sheetsFilterPanelValuesItemInner,sheetsFilterPanelValuesItemCount,sheetsFilterPanelValuesItemExcludeButton,sheetsFilterPanelValuesItemText,sheetsFilterPanelConditionsContainer,sheetsFilterPanelConditionsContainerInner,sheetsFilterPanelConditionsDesc,sheetsFilterPanelFooter,sheetsFilterPanelFooterPrimaryButtons,button,input,formDualColumnLayout,sheetsFilterTreeNode,sheetsFilterTreeNodeFilterOnly,sheetsFilterTreeNodeAttach};function FilterByCondition(props){var _a13,_b;const{model}=props,localeService=core.useDependency(core.LocaleService),condition=ui.useObservable(model.conditionItem$,void 0),formParams=ui.useObservable(model.filterConditionFormParams$,void 0),radioValue=formParams!=null&&formParams.and?"AND":"OR",onRadioChange=react.useCallback(key=>{model.onConditionFormChange({and:key==="AND"})},[model]),primaryOptions=usePrimaryOptions(localeService),onPrimaryConditionChange=react.useCallback(value=>{model.onPrimaryConditionChange(value)},[model]),secondaryOptions=useSecondaryOptions(localeService),onFormParamsChange=react.useCallback(diffParams=>{model.onConditionFormChange(diffParams)},[model]),placeholder=localeService.t("sheets-filter.panel.input-values-placeholder");function renderSecondaryCondition(operator,val,name){const shouldRenderInput=FilterConditionItems.getItemByOperator(operator).numOfParameters===1;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[name==="operator2"&&jsxRuntime.jsxs(design.RadioGroup,{value:radioValue,onChange:onRadioChange,children:[jsxRuntime.jsx(design.Radio,{value:"AND",children:localeService.t("sheets-filter.panel.and")}),jsxRuntime.jsx(design.Radio,{value:"OR",children:localeService.t("sheets-filter.panel.or")})]}),jsxRuntime.jsx(design.Select,{value:operator,options:secondaryOptions,onChange:__name(operator2=>onFormParamsChange({[name]:operator2}),"onChange")}),shouldRenderInput&&jsxRuntime.jsx("div",{children:jsxRuntime.jsx(design.Input,{value:val,placeholder,onChange:__name(value=>onFormParamsChange({[name==="operator1"?"val1":"val2"]:value}),"onChange")})})]})}return __name(renderSecondaryCondition,"renderSecondaryCondition"),jsxRuntime.jsx("div",{className:styles.sheetsFilterPanelConditionsContainer,children:condition&&formParams&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(design.Select,{value:condition.operator,options:primaryOptions,onChange:onPrimaryConditionChange}),FilterConditionItems.getItemByOperator(condition.operator).numOfParameters!==0?jsxRuntime.jsxs("div",{className:styles.sheetsFilterPanelConditionsContainerInner,children:[condition.numOfParameters>=1&&renderSecondaryCondition(formParams.operator1,(_a13=formParams.val1)!=null?_a13:"","operator1"),condition.numOfParameters>=2&&renderSecondaryCondition(formParams.operator2,(_b=formParams.val2)!=null?_b:"","operator2"),jsxRuntime.jsxs("div",{className:styles.sheetsFilterPanelConditionsDesc,children:[localeService.t("sheets-filter.panel.?"),jsxRuntime.jsx("br",{}),localeService.t("sheets-filter.panel.*")]})]}):null]})})}__name(FilterByCondition,"FilterByCondition");function usePrimaryOptions(localeService){const locale=localeService.getCurrentLocale();return react.useMemo(()=>[{options:[{label:localeService.t(FilterConditionItems.NONE.label),value:FilterConditionItems.NONE.operator}]},{options:[{label:localeService.t(FilterConditionItems.EMPTY.label),value:FilterConditionItems.EMPTY.operator},{label:localeService.t(FilterConditionItems.NOT_EMPTY.label),value:FilterConditionItems.NOT_EMPTY.operator}]},{options:[{label:localeService.t(FilterConditionItems.TEXT_CONTAINS.label),value:FilterConditionItems.TEXT_CONTAINS.operator},{label:localeService.t(FilterConditionItems.DOES_NOT_CONTAIN.label),value:FilterConditionItems.DOES_NOT_CONTAIN.operator},{label:localeService.t(FilterConditionItems.STARTS_WITH.label),value:FilterConditionItems.STARTS_WITH.operator},{label:localeService.t(FilterConditionItems.ENDS_WITH.label),value:FilterConditionItems.ENDS_WITH.operator},{label:localeService.t(FilterConditionItems.EQUALS.label),value:FilterConditionItems.EQUALS.operator}]},{options:[{label:localeService.t(FilterConditionItems.GREATER_THAN.label),value:FilterConditionItems.GREATER_THAN.operator},{label:localeService.t(FilterConditionItems.GREATER_THAN_OR_EQUAL.label),value:FilterConditionItems.GREATER_THAN_OR_EQUAL.operator},{label:localeService.t(FilterConditionItems.LESS_THAN.label),value:FilterConditionItems.LESS_THAN.operator},{label:localeService.t(FilterConditionItems.LESS_THAN_OR_EQUAL.label),value:FilterConditionItems.LESS_THAN_OR_EQUAL.operator},{label:localeService.t(FilterConditionItems.EQUAL.label),value:FilterConditionItems.EQUAL.operator},{label:localeService.t(FilterConditionItems.NOT_EQUAL.label),value:FilterConditionItems.NOT_EQUAL.operator},{label:localeService.t(FilterConditionItems.BETWEEN.label),value:FilterConditionItems.BETWEEN.operator},{label:localeService.t(FilterConditionItems.NOT_BETWEEN.label),value:FilterConditionItems.NOT_BETWEEN.operator}]},{options:[{label:localeService.t(FilterConditionItems.CUSTOM.label),value:FilterConditionItems.CUSTOM.operator}]}],[locale,localeService])}__name(usePrimaryOptions,"usePrimaryOptions");function useSecondaryOptions(localeService){const locale=localeService.getCurrentLocale();return react.useMemo(()=>FilterConditionItems.ALL_CONDITIONS.filter(c=>c.numOfParameters!==2).map(c=>({label:localeService.t(c.label),value:c.operator})),[locale,localeService])}__name(useSecondaryOptions,"useSecondaryOptions");function FilterByValue(props){const{model}=props,localeService=core.useDependency(core.LocaleService),searchText=ui.useObservable(model.searchString$,"",!0),items=ui.useObservable(model.filterItems$,void 0,!0),filterOnly=localeService.t("sheets-filter.panel.filter-only"),stat=statisticFilterByValueItems(items),allChecked=stat.checked>0&&stat.unchecked===0,indeterminate=stat.checked>0&&stat.unchecked>0,treeMap=model.treeMapCache,onCheckAllToggled=react.useCallback(()=>{model.onCheckAllToggled(!allChecked)},[model,allChecked]),onSearchValueChange=react.useCallback(str=>{model.setSearchString(str)},[model]);function extractCheckedKeys(items2){let checkedKeys=[];return items2.forEach(item=>{item.checked&&checkedKeys.push(item.key),item.children&&(checkedKeys=checkedKeys.concat(extractCheckedKeys(item.children)))}),checkedKeys}return __name(extractCheckedKeys,"extractCheckedKeys"),jsxRuntime.jsxs("div",{className:styles.sheetsFilterPanelValuesContainer,children:[jsxRuntime.jsx(design.Input,{autoFocus:!0,value:searchText,placeholder:localeService.t("sheets-filter.panel.search-placeholder"),onChange:onSearchValueChange}),jsxRuntime.jsxs("div",{className:styles.sheetsFilterPanelValuesList,children:[jsxRuntime.jsx("div",{className:styles.sheetsFilterPanelValuesItem,children:jsxRuntime.jsxs("div",{className:styles.sheetsFilterPanelValuesItemInner,children:[jsxRuntime.jsx(design.Checkbox,{indeterminate,disabled:items.length===0,checked:allChecked,onChange:onCheckAllToggled}),jsxRuntime.jsx("span",{className:styles.sheetsFilterPanelValuesItemText,children:`${localeService.t("sheets-filter.panel.select-all")}`}),jsxRuntime.jsx("span",{className:styles.sheetsFilterPanelValuesItemCount,children:`(${stat.checked}/${stat.checked+stat.unchecked})`})]})}),jsxRuntime.jsx("div",{className:styles.sheetsFilterPanelValuesVirtual,children:jsxRuntime.jsx(design.Tree,{data:items,defaultExpandAll:!1,valueGroup:extractCheckedKeys(items),height:180,onChange:__name(node=>{model.onFilterCheckToggled(node)},"onChange"),defaultCache:treeMap,itemHeight:28,treeNodeClassName:styles.sheetsFilterTreeNode,attachRender:__name(item=>jsxRuntime.jsxs("div",{className:styles.sheetsFilterTreeNodeAttach,children:[jsxRuntime.jsx("span",{className:styles.sheetsFilterPanelValuesItemCount,children:`(${item.count})`}),jsxRuntime.jsx(design.Button,{className:styles.sheetsFilterTreeNodeFilterOnly,size:"small",type:"link",onClick:__name(()=>{const filterValues=[];item.children?item.children.forEach(child=>{child.children?child.children.forEach(subChild=>{filterValues.push(subChild.key)}):filterValues.push(child.key)}):filterValues.push(item.key),model.onFilterOnly(filterValues)},"onClick"),children:filterOnly})]}),"attachRender")})})]})]})}__name(FilterByValue,"FilterByValue");function FilterPanel(){var _a13;const sheetsFilterPanelService=core.useDependency(SheetsFilterPanelService),localeService=core.useDependency(core.LocaleService),commandService=core.useDependency(core.ICommandService),filterBy=ui.useObservable(sheetsFilterPanelService.filterBy$,void 0,!0),filterByModel=ui.useObservable(sheetsFilterPanelService.filterByModel$,void 0,!1),canApply=ui.useObservable(()=>(filterByModel==null?void 0:filterByModel.canApply$)||rxjs.of(!1),void 0,!1,[filterByModel]),options=useFilterByOptions(localeService),clearFilterDisabled=!ui.useObservable(sheetsFilterPanelService.hasCriteria$),onFilterByTypeChange=react.useCallback(value=>{commandService.executeCommand(ChangeFilterByOperation.id,{filterBy:value})},[commandService]),onClearCriteria=react.useCallback(async()=>{await(filterByModel==null?void 0:filterByModel.clear()),commandService.executeCommand(CloseFilterPanelOperation.id)},[filterByModel,commandService]),onCancel=react.useCallback(()=>{commandService.executeCommand(CloseFilterPanelOperation.id)},[commandService]),onApply=react.useCallback(async()=>{await(filterByModel==null?void 0:filterByModel.apply()),commandService.executeCommand(CloseFilterPanelOperation.id)},[filterByModel,commandService]),range=(_a13=core.useDependency(sheetsFilter.SheetsFilterService).activeFilterModel)==null?void 0:_a13.getRange(),colIndex=sheetsFilterPanelService.col,FilterPanelEmbedPointPart=ui.useComponentsOfPart(sheetsUi.SheetsUIPart.FILTER_PANEL_EMBED_POINT);return jsxRuntime.jsxs("div",{className:styles.sheetsFilterPanel,children:[jsxRuntime.jsx(ui.ComponentContainer,{components:FilterPanelEmbedPointPart,sharedProps:{range,colIndex,onClose:onCancel}}),jsxRuntime.jsx("div",{className:styles.sheetsFilterPanelHeader,children:jsxRuntime.jsx(design.Segmented,{value:filterBy,options,onChange:__name(value=>onFilterByTypeChange(value),"onChange")})}),filterByModel?jsxRuntime.jsx("div",{className:styles.sheetsFilterPanelContent,children:filterBy===FilterBy.VALUES?jsxRuntime.jsx(FilterByValue,{model:filterByModel}):jsxRuntime.jsx(FilterByCondition,{model:filterByModel})}):jsxRuntime.jsx("div",{style:{flex:1}}),jsxRuntime.jsxs("div",{className:styles.sheetsFilterPanelFooter,children:[jsxRuntime.jsx(design.Button,{type:"link",onClick:onClearCriteria,disabled:clearFilterDisabled,children:localeService.t("sheets-filter.panel.clear-filter")}),jsxRuntime.jsxs("span",{className:styles.sheetsFilterPanelFooterPrimaryButtons,children:[jsxRuntime.jsx(design.Button,{type:"default",onClick:onCancel,children:localeService.t("sheets-filter.panel.cancel")}),jsxRuntime.jsx(design.Button,{disabled:!canApply,type:"primary",onClick:onApply,children:localeService.t("sheets-filter.panel.confirm")})]})]})]})}__name(FilterPanel,"FilterPanel");function useFilterByOptions(localeService){const locale=localeService.getCurrentLocale();return react.useMemo(()=>[{label:localeService.t("sheets-filter.panel.by-values"),value:FilterBy.VALUES},{label:localeService.t("sheets-filter.panel.by-conditions"),value:FilterBy.CONDITIONS}],[locale,localeService])}__name(useFilterByOptions,"useFilterByOptions");function SmartToggleFilterMenuItemFactory(accessor){const sheetsFilterService=accessor.get(sheetsFilter.SheetsFilterService);return{id:sheetsFilter.SmartToggleSheetsFilterCommand.id,type:ui.MenuItemType.BUTTON_SELECTOR,icon:"FilterSingle",tooltip:"sheets-filter.toolbar.smart-toggle-filter-tooltip",hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET),activated$:sheetsFilterService.activeFilterModel$.pipe(rxjs.map(model=>!!model)),disabled$:sheetsUi.getObservableWithExclusiveRange$(accessor,sheetsUi.getCurrentRangeDisable$(accessor,{worksheetTypes:[sheets.WorksheetFilterPermission,sheets.WorksheetViewPermission],rangeTypes:[sheets.RangeProtectionPermissionViewPoint]}))}}__name(SmartToggleFilterMenuItemFactory,"SmartToggleFilterMenuItemFactory");function ClearFilterCriteriaMenuItemFactory(accessor){const sheetsFilterService=accessor.get(sheetsFilter.SheetsFilterService);return{id:sheetsFilter.ClearSheetsFilterCriteriaCommand.id,type:ui.MenuItemType.BUTTON,title:"sheets-filter.toolbar.clear-filter-criteria",hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET),disabled$:sheetsFilterService.activeFilterModel$.pipe(rxjs.switchMap(model=>{var _a13;return(_a13=model==null?void 0:model.hasCriteria$.pipe(rxjs.map(m=>!m)))!=null?_a13:rxjs.of(!0)}))}}__name(ClearFilterCriteriaMenuItemFactory,"ClearFilterCriteriaMenuItemFactory");function ReCalcFilterMenuItemFactory(accessor){const sheetsFilterService=accessor.get(sheetsFilter.SheetsFilterService);return{id:sheetsFilter.ReCalcSheetsFilterCommand.id,type:ui.MenuItemType.BUTTON,title:"sheets-filter.toolbar.re-calc-filter-conditions",hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET),disabled$:sheetsFilterService.activeFilterModel$.pipe(rxjs.switchMap(model=>{var _a13;return(_a13=model==null?void 0:model.hasCriteria$.pipe(rxjs.map(m=>!m)))!=null?_a13:rxjs.of(!0)}))}}__name(ReCalcFilterMenuItemFactory,"ReCalcFilterMenuItemFactory");const menuSchema={[ui.RibbonStartGroup.FORMULAS_INSERT]:{[sheetsFilter.SmartToggleSheetsFilterCommand.id]:{order:10,menuItemFactory:SmartToggleFilterMenuItemFactory,[sheetsFilter.ClearSheetsFilterCriteriaCommand.id]:{order:0,menuItemFactory:ClearFilterCriteriaMenuItemFactory},[sheetsFilter.ReCalcSheetsFilterCommand.id]:{order:1,menuItemFactory:ReCalcFilterMenuItemFactory}}}},BUTTON_VIEWPORT=16,FILTER_BUTTON_EMPTY=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"),_FilterButton=class _FilterButton{static drawNoCriteria(ctx,size,fgColor,bgColor){ctx.save(),engineRender.Rect.drawWith(ctx,{radius:2,width:BUTTON_VIEWPORT,height:BUTTON_VIEWPORT,fill:bgColor}),ctx.lineCap="square",ctx.strokeStyle=fgColor,ctx.scale(size/BUTTON_VIEWPORT,size/BUTTON_VIEWPORT),ctx.beginPath(),ctx.lineWidth=1,ctx.lineCap="round",ctx.moveTo(3,4),ctx.lineTo(13,4),ctx.moveTo(4.5,8),ctx.lineTo(11.5,8),ctx.moveTo(6,12),ctx.lineTo(10,12),ctx.stroke(),ctx.restore()}static drawHasCriteria(ctx,size,fgColor,bgColor){ctx.save(),engineRender.Rect.drawWith(ctx,{radius:2,width:BUTTON_VIEWPORT,height:BUTTON_VIEWPORT,fill:bgColor}),ctx.scale(size/BUTTON_VIEWPORT,size/BUTTON_VIEWPORT),ctx.fillStyle=fgColor,ctx.fill(FILTER_BUTTON_EMPTY),ctx.restore()}};__name(_FilterButton,"FilterButton");let FilterButton=_FilterButton;var __defProp$6=Object.defineProperty,__getOwnPropDesc$6=Object.getOwnPropertyDescriptor,__decorateClass$6=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$6(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$6(target,key,result),result},"__decorateClass$6"),__decorateParam$6=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$6");const FILTER_ICON_SIZE=16,FILTER_ICON_PADDING=1;var _a6;let SheetsFilterButtonShape=(_a6=class extends engineRender.Shape{constructor(key,props,_contextService,_commandService,_themeService){super(key,props);__publicField(this,"_cellWidth",0);__publicField(this,"_cellHeight",0);__publicField(this,"_filterParams");__publicField(this,"_hovered",!1);this._contextService=_contextService,this._commandService=_commandService,this._themeService=_themeService,this.setShapeProps(props),this.onPointerDown$.subscribeEvent(evt=>this.onPointerDown(evt)),this.onPointerEnter$.subscribeEvent(()=>this.onPointerEnter()),this.onPointerLeave$.subscribeEvent(()=>this.onPointerLeave())}setShapeProps(props){typeof props.cellHeight<"u"&&(this._cellHeight=props.cellHeight),typeof props.cellWidth<"u"&&(this._cellWidth=props.cellWidth),typeof props.filterParams<"u"&&(this._filterParams=props.filterParams),this.transformByState({width:props.width,height:props.height})}_draw(ctx){const cellHeight=this._cellHeight,cellWidth=this._cellWidth,left=FILTER_ICON_SIZE-cellWidth,top=FILTER_ICON_SIZE-cellHeight;ctx.save();const cellRegion=new Path2D;cellRegion.rect(left,top,cellWidth,cellHeight),ctx.clip(cellRegion);const{hasCriteria}=this._filterParams,fgColor=this._themeService.getCurrentTheme().primaryColor,bgColor=this._hovered?this._themeService.getCurrentTheme().grey50:"rgba(255, 255, 255, 1.0)";hasCriteria?FilterButton.drawHasCriteria(ctx,FILTER_ICON_SIZE,fgColor,bgColor):FilterButton.drawNoCriteria(ctx,FILTER_ICON_SIZE,fgColor,bgColor),ctx.restore()}onPointerDown(evt){if(evt.button===2)return;const{col,unitId,subUnitId}=this._filterParams;this._contextService.getContextValue(FILTER_PANEL_OPENED_KEY)||!this._commandService.hasCommand(OpenFilterPanelOperation.id)||setTimeout(()=>{this._commandService.executeCommand(OpenFilterPanelOperation.id,{unitId,subUnitId,col})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}},__name(_a6,"SheetsFilterButtonShape"),_a6);SheetsFilterButtonShape=__decorateClass$6([__decorateParam$6(2,core.IContextService),__decorateParam$6(3,core.ICommandService),__decorateParam$6(4,core.Inject(core.ThemeService))],SheetsFilterButtonShape);var __defProp$5=Object.defineProperty,__getOwnPropDesc$5=Object.getOwnPropertyDescriptor,__decorateClass$5=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$5(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$5(target,key,result),result},"__decorateClass$5"),__decorateParam$5=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$5");const DEFAULT_Z_INDEX=1e3,SHEETS_FILTER_BUTTON_Z_INDEX=5e3;var _a7;let SheetsFilterRenderController=(_a7=class extends core.RxDisposable{constructor(_context,_injector,_sheetSkeletonManagerService,_sheetsFilterService,_themeService,_sheetInterceptorService,_commandService,_selectionRenderService){super();__publicField(this,"_filterRangeShape",null);__publicField(this,"_buttonRenderDisposable",null);__publicField(this,"_filterButtonShapes",[]);this._context=_context,this._injector=_injector,this._sheetSkeletonManagerService=_sheetSkeletonManagerService,this._sheetsFilterService=_sheetsFilterService,this._themeService=_themeService,this._sheetInterceptorService=_sheetInterceptorService,this._commandService=_commandService,this._selectionRenderService=_selectionRenderService,this._initRenderer()}dispose(){super.dispose(),this._disposeRendering()}_initRenderer(){this._sheetSkeletonManagerService.currentSkeleton$.pipe(rxjs.switchMap(skeletonParams=>{var _a13,_b;if(!skeletonParams)return rxjs.of(null);const{unit:workbook,unitId}=this._context,worksheetId=((_a13=workbook.getActiveSheet())==null?void 0:_a13.getSheetId())||"",filterModel=(_b=this._sheetsFilterService.getFilterModel(unitId,worksheetId))!=null?_b:void 0,getParams=__name(()=>({unitId,worksheetId,filterModel,range:filterModel==null?void 0:filterModel.getRange(),skeleton:skeletonParams.skeleton}),"getParams");return core.fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(rxjs.filter(([command])=>{var _a14;return command.type===core.CommandType.MUTATION&&((_a14=command.params)==null?void 0:_a14.unitId)===workbook.getUnitId()&&(sheetsFilter.FILTER_MUTATIONS.has(command.id)||command.id===sheets.SetRangeValuesMutation.id)}),rxjs.throttleTime(20,void 0,{leading:!1,trailing:!0}),rxjs.map(getParams),rxjs.startWith(getParams()))}),rxjs.takeUntil(this.dispose$)).subscribe(renderParams=>{this._disposeRendering(),!(!renderParams||!renderParams.range)&&(this._renderRange(renderParams.range,renderParams.skeleton),this._renderButtons(renderParams))})}_renderRange(range,skeleton){const{scene}=this._context,{rowHeaderWidth,columnHeaderHeight}=skeleton,filterRangeShape=this._filterRangeShape=new sheetsUi.SelectionControl(scene,DEFAULT_Z_INDEX,this._themeService,{rowHeaderWidth,columnHeaderHeight,enableAutoFill:!1,highlightHeader:!1}),selectionWithStyle={range,primary:null,style:{fill:"rgba(0, 0, 0, 0.0)"}},selectionWithCoord=sheetsUi.attachSelectionWithCoord(selectionWithStyle,skeleton);filterRangeShape.updateRangeBySelectionWithCoord(selectionWithCoord),filterRangeShape.setEvent(!1),scene.makeDirty(!0)}_renderButtons(params){const{range,filterModel,unitId,skeleton,worksheetId}=params,{scene}=this._context;this._interceptCellContent(unitId,worksheetId,params.range);const{startColumn,endColumn,startRow}=range;for(let col=startColumn;col<=endColumn;col++){const key=`sheets-filter-button-${col}`,startPosition=sheetsUi.getCoordByCell(startRow,col,scene,skeleton),{startX,startY,endX,endY}=startPosition,cellWidth=endX-startX,cellHeight=endY-startY;if(cellHeight<=FILTER_ICON_PADDING||cellWidth<=FILTER_ICON_PADDING)continue;const hasCriteria=!!filterModel.getFilterColumn(col),iconStartX=endX-FILTER_ICON_SIZE-FILTER_ICON_PADDING,iconStartY=endY-FILTER_ICON_SIZE-FILTER_ICON_PADDING,props={left:iconStartX,top:iconStartY,height:FILTER_ICON_SIZE,width:FILTER_ICON_SIZE,zIndex:SHEETS_FILTER_BUTTON_Z_INDEX,cellHeight,cellWidth,filterParams:{unitId,subUnitId:worksheetId,col,hasCriteria}},buttonShape=this._injector.createInstance(SheetsFilterButtonShape,key,props);this._filterButtonShapes.push(buttonShape)}scene.addObjects(this._filterButtonShapes),scene.makeDirty()}_interceptCellContent(workbookId,worksheetId,range){const{startRow,startColumn,endColumn}=range;this._buttonRenderDisposable=this._sheetInterceptorService.intercept(sheets.INTERCEPTOR_POINT.CELL_CONTENT,{effect:core.InterceptorEffectEnum.Style,handler:__name((cell,pos,next)=>{const{row,col,unitId,subUnitId}=pos;return unitId!==workbookId||subUnitId!==worksheetId||row!==startRow||col<startColumn||col>endColumn?next(cell):next({...cell,fontRenderExtension:{...cell==null?void 0:cell.fontRenderExtension,rightOffset:FILTER_ICON_SIZE}})},"handler"),priority:10})}_disposeRendering(){var _a13,_b;(_a13=this._filterRangeShape)==null||_a13.dispose(),this._filterButtonShapes.forEach(s=>s.dispose()),(_b=this._buttonRenderDisposable)==null||_b.dispose(),this._filterRangeShape=null,this._buttonRenderDisposable=null,this._filterButtonShapes=[]}},__name(_a7,"SheetsFilterRenderController"),_a7);SheetsFilterRenderController=__decorateClass$5([__decorateParam$5(1,core.Inject(core.Injector)),__decorateParam$5(2,core.Inject(sheetsUi.SheetSkeletonManagerService)),__decorateParam$5(3,core.Inject(sheetsFilter.SheetsFilterService)),__decorateParam$5(4,core.Inject(core.ThemeService)),__decorateParam$5(5,core.Inject(sheets.SheetInterceptorService)),__decorateParam$5(6,core.ICommandService),__decorateParam$5(7,sheetsUi.ISheetSelectionRenderService)],SheetsFilterRenderController);var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__decorateClass$4=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$4(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$4(target,key,result),result},"__decorateClass$4"),__decorateParam$4=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$4"),_a8;let SheetsFilterUIMobileController=(_a8=class extends core.RxDisposable{constructor(_renderManagerService,_sheetsRenderService){super(),this._renderManagerService=_renderManagerService,this._sheetsRenderService=_sheetsRenderService,[sheetsFilter.SetSheetsFilterRangeMutation,sheetsFilter.SetSheetsFilterCriteriaMutation,sheetsFilter.RemoveSheetsFilterMutation,sheetsFilter.ReCalcSheetsFilterMutation].forEach(m=>this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(m.id))),this.disposeWithMe(this._renderManagerService.registerRenderModule(core.UniverInstanceType.UNIVER_SHEET,[SheetsFilterRenderController]))}},__name(_a8,"SheetsFilterUIMobileController"),_a8);SheetsFilterUIMobileController=__decorateClass$4([__decorateParam$4(0,engineRender.IRenderManagerService),__decorateParam$4(1,core.Inject(sheetsUi.SheetsRenderService))],SheetsFilterUIMobileController);const SmartToggleFilterShortcut={id:sheetsFilter.SmartToggleSheetsFilterCommand.id,binding:ui.KeyCode.L|ui.MetaKeys.CTRL_COMMAND|ui.MetaKeys.SHIFT,description:"sheets-filter.shortcut.smart-toggle-filter",preconditions:sheetsUi.whenSheetEditorFocused,group:"4_sheet-edit"};var __defProp$3=Object.defineProperty,__getOwnPropDesc$3=Object.getOwnPropertyDescriptor,__decorateClass$3=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$3(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$3(target,key,result),result},"__decorateClass$3"),__decorateParam$3=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$3");const FILTER_PANEL_POPUP_KEY="FILTER_PANEL_POPUP";var _a9;let SheetsFilterUIDesktopController=(_a9=class extends SheetsFilterUIMobileController{constructor(_injector,_componentManager,_sheetsFilterPanelService,_sheetCanvasPopupService,_sheetsFilterService,_localeService,_shortcutService,_commandService,_menuManagerService,_contextService,_messageService,sheetsRenderService,renderManagerService){super(renderManagerService,sheetsRenderService);__publicField(this,"_popupDisposable");this._injector=_injector,this._componentManager=_componentManager,this._sheetsFilterPanelService=_sheetsFilterPanelService,this._sheetCanvasPopupService=_sheetCanvasPopupService,this._sheetsFilterService=_sheetsFilterService,this._localeService=_localeService,this._shortcutService=_shortcutService,this._commandService=_commandService,this._menuManagerService=_menuManagerService,this._contextService=_contextService,this._messageService=_messageService,this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[SmartToggleFilterShortcut].forEach(shortcut=>{this.disposeWithMe(this._shortcutService.registerShortcut(shortcut))})}_initCommands(){[sheetsFilter.SmartToggleSheetsFilterCommand,sheetsFilter.RemoveSheetFilterCommand,sheetsFilter.SetSheetFilterRangeCommand,sheetsFilter.SetSheetsFilterCriteriaCommand,sheetsFilter.ClearSheetsFilterCriteriaCommand,sheetsFilter.ReCalcSheetsFilterCommand,ChangeFilterByOperation,OpenFilterPanelOperation,CloseFilterPanelOperation].forEach(c=>{this.disposeWithMe(this._commandService.registerCommand(c))})}_initMenuItems(){this._menuManagerService.mergeMenu(menuSchema)}_initUI(){this.disposeWithMe(this._componentManager.register(FILTER_PANEL_POPUP_KEY,FilterPanel)),this.disposeWithMe(this._componentManager.register("FilterSingle",FilterSingle)),this.disposeWithMe(this._contextService.subscribeContextValue$(FILTER_PANEL_OPENED_KEY).pipe(rxjs.distinctUntilChanged()).subscribe(open=>{open?this._openFilterPopup():this._closeFilterPopup()})),this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe(content=>{content&&this._messageService.show({type:design.MessageType.Error,content:this._localeService.t(content)})}))}_openFilterPopup(){const currentFilterModel=this._sheetsFilterPanelService.filterModel;if(!currentFilterModel)throw new Error("[SheetsFilterUIController]: no filter model when opening filter popup!");const range=currentFilterModel.getRange(),col=this._sheetsFilterPanelService.col,{startRow}=range;this._popupDisposable=this._sheetCanvasPopupService.attachPopupToCell(startRow,col,{componentKey:FILTER_PANEL_POPUP_KEY,direction:"horizontal",onClickOutside:__name(()=>this._commandService.syncExecuteCommand(CloseFilterPanelOperation.id),"onClickOutside"),offset:[5,0]})}_closeFilterPopup(){var _a13;(_a13=this._popupDisposable)==null||_a13.dispose(),this._popupDisposable=null}},__name(_a9,"SheetsFilterUIDesktopController"),_a9);SheetsFilterUIDesktopController=__decorateClass$3([__decorateParam$3(0,core.Inject(core.Injector)),__decorateParam$3(1,core.Inject(ui.ComponentManager)),__decorateParam$3(2,core.Inject(SheetsFilterPanelService)),__decorateParam$3(3,core.Inject(sheetsUi.SheetCanvasPopManagerService)),__decorateParam$3(4,core.Inject(sheetsFilter.SheetsFilterService)),__decorateParam$3(5,core.Inject(core.LocaleService)),__decorateParam$3(6,ui.IShortcutService),__decorateParam$3(7,core.ICommandService),__decorateParam$3(8,ui.IMenuManagerService),__decorateParam$3(9,core.IContextService),__decorateParam$3(10,ui.IMessageService),__decorateParam$3(11,core.Inject(sheetsUi.SheetsRenderService)),__decorateParam$3(12,engineRender.IRenderManagerService)],SheetsFilterUIDesktopController);var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__defNormalProp$1=__name((obj,key,value)=>key in obj?__defProp$2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp$1"),__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2"),__publicField$1=__name((obj,key,value)=>__defNormalProp$1(obj,typeof key!="symbol"?key+"":key,value),"__publicField$1");const NAME$1="SHEET_FILTER_UI_PLUGIN";var _a10;exports.UniverSheetsFilterUIPlugin=(_a10=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService,_rpcChannelService){super(),this._config=_config,this._injector=_injector,this._configService=_configService,this._rpcChannelService=_rpcChannelService;const{menu,...rest}=core.merge({},defaultPluginConfig,this._config);menu&&this._configService.setConfig("menu",menu,{merge:!0}),this._configService.setConfig(SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY,rest)}onStarting(){[[SheetsFilterPanelService],[SheetsFilterPermissionController],[SheetsFilterUIDesktopController]].forEach(d=>this._injector.add(d)),this._config.useRemoteFilterValuesGenerator&&this._rpcChannelService&&this._injector.add([ISheetsGenerateFilterValuesService,{useFactory:__name(()=>rpc.toModule(this._rpcChannelService.requestChannel(SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME)),"useFactory")}])}onReady(){this._injector.get(SheetsFilterPermissionController)}onRendered(){this._injector.get(SheetsFilterUIDesktopController)}},__name(_a10,"UniverSheetsFilterUIPlugin"),_a10);__publicField$1(exports.UniverSheetsFilterUIPlugin,"type",core.UniverInstanceType.UNIVER_SHEET);__publicField$1(exports.UniverSheetsFilterUIPlugin,"pluginName",NAME$1);exports.UniverSheetsFilterUIPlugin=__decorateClass$2([core.DependentOn(sheetsFilter.UniverSheetsFilterPlugin),__decorateParam$2(1,core.Inject(core.Injector)),__decorateParam$2(2,core.IConfigService),__decorateParam$2(3,core.Optional(rpc.IRPCChannelService))],exports.UniverSheetsFilterUIPlugin);var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__defNormalProp2=__name((obj,key,value)=>key in obj?__defProp$1(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1"),__publicField2=__name((obj,key,value)=>__defNormalProp2(obj,typeof key!="symbol"?key+"":key,value),"__publicField");const NAME="SHEET_FILTER_UI_PLUGIN";var _a11;exports.UniverSheetsFilterMobileUIPlugin=(_a11=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService){super(),this._config=_config,this._injector=_injector,this._configService=_configService;const{menu,...rest}=core.merge({},defaultPluginConfig,this._config);menu&&this._configService.setConfig("menu",menu,{merge:!0}),this._configService.setConfig(SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY,rest)}onStarting(){[[SheetsFilterPermissionController],[SheetsFilterUIMobileController]].forEach(d=>this._injector.add(d))}onReady(){this._injector.get(SheetsFilterPermissionController)}onRendered(){this._injector.get(SheetsFilterUIMobileController)}},__name(_a11,"UniverSheetsFilterMobileUIPlugin"),_a11);__publicField2(exports.UniverSheetsFilterMobileUIPlugin,"type",core.UniverInstanceType.UNIVER_SHEET);__publicField2(exports.UniverSheetsFilterMobileUIPlugin,"pluginName",NAME);exports.UniverSheetsFilterMobileUIPlugin=__decorateClass$1([core.DependentOn(sheetsFilter.UniverSheetsFilterPlugin),__decorateParam$1(1,core.Inject(core.Injector)),__decorateParam$1(2,core.IConfigService)],exports.UniverSheetsFilterMobileUIPlugin);var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),_a12;exports.UniverSheetsFilterUIWorkerPlugin=(_a12=class extends core.Plugin{constructor(_config,_injector,_rpcChannelService){super(),this._config=_config,this._injector=_injector,this._rpcChannelService=_rpcChannelService}onStarting(){[[ISheetsGenerateFilterValuesService,{useClass:SheetsGenerateFilterValuesService}]].forEach(d=>this._injector.add(d))}onReady(){this._rpcChannelService.registerChannel(SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME,rpc.fromModule(this._injector.get(ISheetsGenerateFilterValuesService)))}},__name(_a12,"UniverSheetsFilterUIWorkerPlugin"),__publicField(_a12,"type",core.UniverInstanceType.UNIVER_SHEET),__publicField(_a12,"pluginName","SHEET_FILTER_UI_WORKER_PLUGIN"),_a12);exports.UniverSheetsFilterUIWorkerPlugin=__decorateClass([__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,rpc.IRPCChannelService)],exports.UniverSheetsFilterUIWorkerPlugin);exports.ChangeFilterByOperation=ChangeFilterByOperation;exports.CloseFilterPanelOperation=CloseFilterPanelOperation;exports.OpenFilterPanelOperation=OpenFilterPanelOperation;
|
|
1
|
+
"use strict";var st=Object.defineProperty;var it=(t,e,r)=>e in t?st(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var S=(t,e,r)=>it(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@univerjs/core"),Fe=require("@univerjs/rpc"),u=require("@univerjs/sheets-filter"),O=require("@univerjs/sheets"),T=require("@univerjs/ui"),w=require("@univerjs/sheets-ui"),g=require("rxjs"),L=require("@univerjs/design"),ne=require("@univerjs/engine-render"),y=require("react"),We="sheets-filter-ui.config",pe={};var N=(t=>(t[t.FIRST=0]="FIRST",t[t.SECOND=1]="SECOND",t))(N||{}),v=(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))(v||{}),d;(t=>{t.NONE={label:"sheets-filter.conditions.none",operator:v.NONE,order:N.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NONE]: should not have initial form params!")},testMappingParams:s=>s.operator1===v.NONE,mapToFilterColumn:()=>null,testMappingFilterColumn:s=>!s.customFilters&&!s.filters?{}:!1},t.EMPTY={label:"sheets-filter.conditions.empty",operator:v.EMPTY,order:N.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.EMPTY]: should not have initial form params!")},testMappingParams:({operator1:s})=>s===v.EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:""}]}}),testMappingFilterColumn:s=>{var h;if(((h=s.customFilters)==null?void 0:h.customFilters.length)!==1)return!1;const o=s.customFilters.customFilters[0];return o.val===""&&o.operator===void 0?{operator1:v.EMPTY}:!1}},t.NOT_EMPTY={label:"sheets-filter.conditions.not-empty",operator:v.NOT_EMPTY,order:N.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NOT_EMPTY]: should not have initial form params!")},testMappingParams:({operator1:s})=>s===v.NOT_EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:"",operator:u.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:s=>{var h;if(((h=s.customFilters)==null?void 0:h.customFilters.length)!==1)return!1;const o=s.customFilters.customFilters[0];return o.val===" "&&o.operator===u.CustomFilterOperator.NOT_EQUALS?{operator1:v.NOT_EMPTY}:!1}},t.TEXT_CONTAINS={label:"sheets-filter.conditions.text-contains",operator:v.CONTAINS,order:N.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:v.CONTAINS,val1:""}),testMappingParams:s=>{const[o]=H(s);return o===v.CONTAINS},mapToFilterColumn:s=>{const{val1:o}=s;return o===""?null:{customFilters:{customFilters:[{val:`*${o}*`}]}}},testMappingFilterColumn:s=>{var h;if(((h=s.customFilters)==null?void 0:h.customFilters.length)!==1)return!1;const o=s.customFilters.customFilters[0],a=o.val.toString();return!o.operator&&a.startsWith("*")&&a.endsWith("*")?{operator1:v.CONTAINS,val1:a.slice(1,-1)}:!1}},t.DOES_NOT_CONTAIN={label:"sheets-filter.conditions.does-not-contain",operator:v.DOES_NOT_CONTAIN,order:N.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:v.DOES_NOT_CONTAIN,val1:""}),mapToFilterColumn:s=>({customFilters:{customFilters:[{val:`*${s.val1}*`,operator:u.CustomFilterOperator.NOT_EQUALS}]}}),testMappingParams:s=>{const[o]=H(s);return o===v.DOES_NOT_CONTAIN},testMappingFilterColumn:s=>{var h;if(((h=s.customFilters)==null?void 0:h.customFilters.length)!==1)return!1;const o=s.customFilters.customFilters[0],a=o.val.toString();return o.operator===u.CustomFilterOperator.NOT_EQUALS&&a.startsWith("*")&&a.endsWith("*")?{operator1:v.DOES_NOT_CONTAIN,val1:a.slice(1,-1)}:!1}},t.STARTS_WITH={label:"sheets-filter.conditions.starts-with",operator:v.STARTS_WITH,order:N.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:v.STARTS_WITH,val1:""}),mapToFilterColumn:s=>({customFilters:{customFilters:[{val:`${s.val1}*`}]}}),testMappingParams:s=>{const[o]=H(s);return o===v.STARTS_WITH},testMappingFilterColumn:s=>{var h;if(((h=s.customFilters)==null?void 0:h.customFilters.length)!==1)return!1;const o=s.customFilters.customFilters[0],a=o.val.toString();return!o.operator&&a.endsWith("*")&&!a.startsWith("*")?{operator1:v.STARTS_WITH,val1:a.slice(0,-1)}:!1}},t.ENDS_WITH={label:"sheets-filter.conditions.ends-with",operator:v.ENDS_WITH,order:N.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:v.ENDS_WITH,val1:""}),mapToFilterColumn:s=>({customFilters:{customFilters:[{val:`*${s.val1}`}]}}),testMappingParams:s=>{const[o]=H(s);return o===v.ENDS_WITH},testMappingFilterColumn:s=>{var h;if(((h=s.customFilters)==null?void 0:h.customFilters.length)!==1)return!1;const o=s.customFilters.customFilters[0],a=o.val.toString();return!o.operator&&a.startsWith("*")&&!a.endsWith("*")?{operator1:v.ENDS_WITH,val1:a.slice(1)}:!1}},t.EQUALS={label:"sheets-filter.conditions.equals",operator:v.EQUALS,order:N.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:v.EQUALS,val1:""}),testMappingParams:s=>{const[o]=H(s);return o===v.EQUALS},mapToFilterColumn:s=>{const{val1:o}=s;return o===""?null:{customFilters:{customFilters:[{val:o}]}}},testMappingFilterColumn:s=>{var o,a,h;return((a=(o=s.filters)==null?void 0:o.filters)==null?void 0:a.length)===1?{operator1:v.EQUALS,val1:""}:((h=s.customFilters)==null?void 0:h.customFilters.length)===1&&!s.customFilters.customFilters[0].operator?{operator1:v.EQUALS,val1:s.customFilters.customFilters[0].val.toString()}:!1}},t.GREATER_THAN={label:"sheets-filter.conditions.greater-than",operator:u.CustomFilterOperator.GREATER_THAN,numOfParameters:1,order:N.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.GREATER_THAN,val1:""}),mapToFilterColumn:s=>({customFilters:{customFilters:[{val:s.val1,operator:u.CustomFilterOperator.GREATER_THAN}]}}),testMappingParams:s=>{const[o]=H(s);return o===u.CustomFilterOperator.GREATER_THAN},testMappingFilterColumn:s=>{var a;if(((a=s.customFilters)==null?void 0:a.customFilters.length)!==1)return!1;const o=s.customFilters.customFilters[0];return o.operator!==u.CustomFilterOperator.GREATER_THAN?!1:{operator1:u.CustomFilterOperator.GREATER_THAN,val1:o.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:N.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:""}),testMappingParams:s=>{const[o]=H(s);return o===u.CustomFilterOperator.GREATER_THAN_OR_EQUAL},mapToFilterColumn:s=>({customFilters:{customFilters:[{val:s.val1,operator:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL}]}}),testMappingFilterColumn:s=>{var a;if(((a=s.customFilters)==null?void 0:a.customFilters.length)!==1)return!1;const o=s.customFilters.customFilters[0];return o.operator!==u.CustomFilterOperator.GREATER_THAN_OR_EQUAL?!1:{operator1:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:o.val.toString()}}},t.LESS_THAN={label:"sheets-filter.conditions.less-than",operator:u.CustomFilterOperator.LESS_THAN,numOfParameters:1,order:N.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.LESS_THAN,val1:""}),testMappingParams:s=>{const[o]=H(s);return o===u.CustomFilterOperator.LESS_THAN},mapToFilterColumn:s=>({customFilters:{customFilters:[{val:s.val1,operator:u.CustomFilterOperator.LESS_THAN}]}}),testMappingFilterColumn:s=>{var a;if(((a=s.customFilters)==null?void 0:a.customFilters.length)!==1)return!1;const o=s.customFilters.customFilters[0];return o.operator!==u.CustomFilterOperator.LESS_THAN?!1:{operator1:u.CustomFilterOperator.LESS_THAN,val1:o.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:N.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:""}),testMappingParams:s=>{const[o]=H(s);return o===u.CustomFilterOperator.LESS_THAN_OR_EQUAL},mapToFilterColumn:s=>({customFilters:{customFilters:[{val:s.val1,operator:u.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}),testMappingFilterColumn:s=>{var a;if(((a=s.customFilters)==null?void 0:a.customFilters.length)!==1)return!1;const o=s.customFilters.customFilters[0];return o.operator!==u.CustomFilterOperator.LESS_THAN_OR_EQUAL?!1:{operator1:u.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:o.val.toString()}}},t.EQUAL={label:"sheets-filter.conditions.equal",operator:u.CustomFilterOperator.EQUAL,numOfParameters:1,order:N.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.EQUAL,val1:""}),testMappingParams:s=>{const[o]=H(s);return o===u.CustomFilterOperator.EQUAL},mapToFilterColumn:s=>({customFilters:{customFilters:[{val:s.val1,operator:u.CustomFilterOperator.EQUAL}]}}),testMappingFilterColumn:s=>{var a;if(((a=s.customFilters)==null?void 0:a.customFilters.length)!==1)return!1;const o=s.customFilters.customFilters[0];return o.operator!==u.CustomFilterOperator.EQUAL?!1:{operator1:u.CustomFilterOperator.EQUAL,val1:o.val.toString()}}},t.NOT_EQUAL={label:"sheets-filter.conditions.not-equal",operator:u.CustomFilterOperator.NOT_EQUALS,numOfParameters:1,order:N.FIRST,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.NOT_EQUALS,val1:""}),testMappingParams:s=>{const[o]=H(s);return o===u.CustomFilterOperator.NOT_EQUALS},mapToFilterColumn:s=>({customFilters:{customFilters:[{val:s.val1,operator:u.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:s=>{var a;if(((a=s.customFilters)==null?void 0:a.customFilters.length)!==1)return!1;const o=s.customFilters.customFilters[0];return o.operator!==u.CustomFilterOperator.NOT_EQUALS?!1:{operator1:u.CustomFilterOperator.NOT_EQUALS,val1:o.val.toString()}}},t.BETWEEN={label:"sheets-filter.conditions.between",operator:v.BETWEEN,order:N.SECOND,numOfParameters:2,getDefaultFormParams:()=>({and:!0,operator1:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:"",operator2:u.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:""}),testMappingParams:s=>{const{and:o,operator1:a,operator2:h}=s;if(!o)return!1;const m=[a,h];return m.includes(u.CustomFilterOperator.GREATER_THAN_OR_EQUAL)&&m.includes(u.CustomFilterOperator.LESS_THAN_OR_EQUAL)},mapToFilterColumn:s=>{const{val1:o,val2:a,operator1:h}=s,m=h===u.CustomFilterOperator.GREATER_THAN_OR_EQUAL;return{customFilters:{and:c.BooleanNumber.TRUE,customFilters:[{val:m?o:a,operator:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL},{val:m?a:o,operator:u.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}},testMappingFilterColumn:s=>{var h;if(((h=s.customFilters)==null?void 0:h.customFilters.length)!==2)return!1;const[o,a]=s.customFilters.customFilters;return o.operator===u.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&a.operator===u.CustomFilterOperator.LESS_THAN_OR_EQUAL&&s.customFilters.and?{and:!0,operator1:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:o.val.toString(),operator2:u.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:a.val.toString()}:a.operator===u.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&o.operator===u.CustomFilterOperator.LESS_THAN_OR_EQUAL&&s.customFilters.and?{and:!0,operator1:u.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:a.val.toString(),operator2:u.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:o.val.toLocaleString()}:!1}},t.NOT_BETWEEN={label:"sheets-filter.conditions.not-between",operator:v.NOT_BETWEEN,order:N.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:u.CustomFilterOperator.LESS_THAN,val1:"",operator2:u.CustomFilterOperator.GREATER_THAN,val2:""}),testMappingParams:s=>{const{and:o,operator1:a,operator2:h}=s;if(o)return!1;const m=[a,h];return m.includes(u.CustomFilterOperator.GREATER_THAN)&&m.includes(u.CustomFilterOperator.LESS_THAN)},mapToFilterColumn:s=>{const{val1:o,val2:a,operator1:h}=s,m=h===u.CustomFilterOperator.GREATER_THAN;return{customFilters:{customFilters:[{val:m?o:a,operator:u.CustomFilterOperator.GREATER_THAN},{val:m?a:o,operator:u.CustomFilterOperator.LESS_THAN}]}}},testMappingFilterColumn:s=>{var h;if(((h=s.customFilters)==null?void 0:h.customFilters.length)!==2)return!1;const[o,a]=s.customFilters.customFilters;return o.operator===u.CustomFilterOperator.LESS_THAN&&a.operator===u.CustomFilterOperator.GREATER_THAN&&!s.customFilters.and?{operator1:u.CustomFilterOperator.LESS_THAN,val1:o.val.toString(),operator2:u.CustomFilterOperator.GREATER_THAN,val2:a.val.toString()}:a.operator===u.CustomFilterOperator.LESS_THAN&&o.operator===u.CustomFilterOperator.GREATER_THAN&&!s.customFilters.and?{operator1:u.CustomFilterOperator.GREATER_THAN,val1:a.val.toString(),operator2:u.CustomFilterOperator.LESS_THAN,val2:o.val.toLocaleString()}:!1}},t.CUSTOM={label:"sheets-filter.conditions.custom",operator:v.CUSTOM,order:N.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:v.NONE,val1:"",operator2:v.NONE,val2:""}),testMappingParams:()=>!0,mapToFilterColumn:s=>{const{and:o,val1:a,val2:h,operator1:m,operator2:p}=s;function F(M,b){for(const j of t.ALL_CONDITIONS)if(j.operator===M)return j.mapToFilterColumn({val1:b,operator1:M})}const _=!m||m===t.NONE.operator,E=!p||p===t.NONE.operator;if(_&&E)return t.NONE.mapToFilterColumn({});if(_)return F(p,h);if(E)return F(m,a);const C=F(m,a),R=F(p,h),P={customFilters:[C.customFilters.customFilters[0],R.customFilters.customFilters[0]]};return o&&(P.and=c.BooleanNumber.TRUE),{customFilters:P}},testMappingFilterColumn:s=>{var h;if(((h=s.customFilters)==null?void 0:h.customFilters.length)!==2)return!1;const o=s.customFilters.customFilters.map(m=>l({customFilters:{customFilters:[m]}})),a={operator1:o[0][0].operator,val1:o[0][1].val1,operator2:o[1][0].operator,val2:o[1][1].val1};return s.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(s){const o=t.ALL_CONDITIONS.find(a=>a.operator===s);if(!o)throw new Error(`[SheetsFilter]: no condition item found for operator: ${s}`);return o}t.getItemByOperator=e;function r(s,o){for(const a of t.ALL_CONDITIONS.filter(h=>h.numOfParameters===o))if(a.numOfParameters!==0&&a.testMappingParams(s))return a;for(const a of t.ALL_CONDITIONS)if(a.testMappingParams(s))return a;throw new Error("[SheetsFilter]: no condition item can be mapped from the filter map params!")}t.testMappingParams=r;function i(s){const o=t.ALL_CONDITIONS.find(a=>a.operator===s);return(o==null?void 0:o.numOfParameters)===0?{operator1:o.operator}:o.getDefaultFormParams()}t.getInitialFormParams=i;function n(s,o){return s.mapToFilterColumn(o)}t.mapToFilterColumn=n;function l(s){if(!s)return[t.NONE,{}];for(const o of t.ALL_CONDITIONS){const a=o.testMappingFilterColumn(s);if(a)return[o,a]}return[t.NONE,{}]}t.testMappingFilterColumn=l})(d||(d={}));function H(t){const{operator1:e,operator2:r,val1:i,val2:n}=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,i]:[r,n]}function Ne(t){const e=[],r=[];let i=0,n=0;function l(s){s.leaf&&(s.checked?(e.push(s),i+=s.count):(r.push(s),n+=s.count)),s.children&&s.children.forEach(l)}return t.forEach(l),{checkedItems:e,uncheckedItems:r,checked:i,unchecked:n}}var nt=Object.defineProperty,ot=Object.getOwnPropertyDescriptor,at=(t,e,r,i)=>{for(var n=i>1?void 0:i?ot(e,r):e,l=t.length-1,s;l>=0;l--)(s=t[l])&&(n=(i?s(e,r,n):s(n))||n);return i&&n&&nt(e,r,n),n},Ee=(t,e)=>(r,i)=>e(r,i,t);const Le="sheets-filter.generate-filter-values.service",de=c.createIdentifier(Le),lt=["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 ye=class extends c.Disposable{constructor(t,e,r){super(),this._localeService=t,this._univerInstanceService=e,this._logService=r}async getFilterValues(t){var m;const{unitId:e,subUnitId:r,filteredOutRowsByOtherColumns:i,filters:n,blankChecked:l,iterateRange:s,alreadyChecked:o}=t,a=this._univerInstanceService.getUnit(e),h=(m=this._univerInstanceService.getUnit(e))==null?void 0:m.getSheetBySheetId(r);return!a||!h?[]:(this._logService.debug("[SheetsGenerateFilterValuesService]","getFilterValues for",{unitId:e,subUnitId:r}),ke(n,this._localeService,s,h,new Set(i),new Set(o.map(String)),l,a.getStyles()))}};ye=at([Ee(0,c.Inject(c.LocaleService)),Ee(1,c.IUniverInstanceService),Ee(2,c.ILogService)],ye);function ke(t,e,r,i,n,l,s,o){var C,R,P,M,b,j,x,le,ce;const a=new Map,h=new Map,m="yyyy-mm-dd",p=new Set(lt),F="empty";let _=0;for(const U of i.iterateByColumn(r,!1,!1)){const{row:et,rowSpan:$e=1}=U;let X=0;for(;X<$e;){const tt=et+X;if(n.has(tt)){X++;continue}const Y=U!=null&&U.value?c.extractPureTextFromCell(U.value):"";if(!Y){_+=1,X+=$e;continue}const ue=(C=U.value)!=null&&C.v&&!U.value.p?(M=(P=o.get((R=U.value)==null?void 0:R.s))==null?void 0:P.n)==null?void 0:M.pattern:"",rt=ue&&c.numfmt.isDate(ue);if(ue&&rt&&p.has(ue)){const k=(b=i.getCellRaw(U.row,U.col))==null?void 0:b.v;if(!k){X++;continue}const Z=c.numfmt.format(m,k),[A,B,re]=Z.split("-").map(Number);let q=a.get(`${A}`);q||(q={title:`${A}`,key:`${A}`,children:[],count:0,leaf:!1,checked:!1},a.set(`${A}`,q),h.set(`${A}`,[`${A}`]));let V=(j=q.children)==null?void 0:j.find(Te=>Te.key===`${A}-${B}`);V||(V={title:e.t(`sheets-filter.date.${B}`),key:`${A}-${B}`,children:[],count:0,leaf:!1,checked:!1},(x=q.children)==null||x.push(V),h.set(`${A}-${B}`,[`${A}`,`${A}-${B}`]));const Ce=(le=V==null?void 0:V.children)==null?void 0:le.find(Te=>Te.key===`${A}-${B}-${re}`);Ce?(Ce.originValues.add(Y),Ce.count++,V.count++,q.count++):((ce=V.children)==null||ce.push({title:`${re}`,key:`${A}-${B}-${re}`,count:1,originValues:new Set([Y]),leaf:!0,checked:l.size?l.has(Y):!s}),V.count++,q.count++,h.set(`${A}-${B}-${re}`,[`${A}`,`${A}-${B}`,`${A}-${B}-${re}`]))}else{const k=Y;let Z=a.get(k);Z?Z.count++:(Z={title:Y,leaf:!0,checked:l.size?l.has(Y):!s,key:k,count:1},a.set(k,Z),h.set(k,[k]))}X++}}const E=t?s:!0;if(_>0){const U={title:e.t("sheets-filter.panel.empty"),count:_,leaf:!0,checked:E,key:F};a.set("empty",U),h.set("empty",[F])}return{filterTreeItems:ct(Array.from(a.values())),filterTreeMapCache:h}}function ct(t){return Array.from(t).sort((e,r)=>e.children&&!r.children?-1:!e.children&&r.children?1:r.title.localeCompare(e.title)).map(e=>(e.children&&e.children.sort((r,i)=>{const n=Number.parseInt(r.key.split("-")[1],10),l=Number.parseInt(i.key.split("-")[1],10);return n-l}).forEach(r=>{r.children&&r.children.sort((i,n)=>{const l=Number.parseInt(i.key.split("-")[2],10),s=Number.parseInt(n.key.split("-")[2],10);return l-s})}),e))}function Re(t,e){for(const r of t){if(r.key===e)return r;if(r.children){const i=Re(r.children,e);if(i)return i}}return null}function Qe(t){return t.leaf?t.checked:t.children?t.children.every(e=>Qe(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 Ge(t,e){const r=[];return t.forEach(i=>{const n=i.originValues?e.some(o=>Array.from(i.originValues).some(a=>a.toLowerCase().includes(o.toLowerCase()))):!1,l=!n&&e.some(o=>i.title.toLowerCase().includes(o.toLowerCase()));if(n||l)r.push({...i});else if(i.children){const o=Ge(i.children,e);if(o.length>0){const a=o.reduce((h,m)=>h+m.count,0);r.push({...i,count:a,children:o})}}}),r}var ut=Object.defineProperty,ht=Object.getOwnPropertyDescriptor,Me=(t,e,r,i)=>{for(var n=i>1?void 0:i?ht(e,r):e,l=t.length-1,s;l>=0;l--)(s=t[l])&&(n=(i?s(e,r,n):s(n))||n);return i&&n&&ut(e,r,n),n},fe=(t,e)=>(r,i)=>e(r,i,t),_e=(t=>(t[t.VALUES=0]="VALUES",t[t.CONDITIONS=1]="CONDITIONS",t))(_e||{});c.createIdentifier("sheets-filter-ui.sheets-filter-panel.service");let G=class extends c.Disposable{constructor(e,r){super();S(this,"_filterBy$",new g.BehaviorSubject(0));S(this,"filterBy$",this._filterBy$.asObservable());S(this,"_filterByModel$",new g.ReplaySubject(1));S(this,"filterByModel$",this._filterByModel$.asObservable());S(this,"_filterByModel",null);S(this,"_hasCriteria$",new g.BehaviorSubject(!1));S(this,"hasCriteria$",this._hasCriteria$.asObservable());S(this,"_filterModel",null);S(this,"_col$",new g.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 i=e.getFilterColumn(r);if(i){const n=i.getColumnData();if(n.customFilters){this._hasCriteria$.next(!0),this._setupByConditions(e,r);return}if(n.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 i=e.unitId,n=e.subUnitId,l=e.getRange(),s={startColumn:r,startRow:l.startRow,endRow:l.startRow,endColumn:r};this._filterHeaderListener=this._refRangeService.watchRange(i,n,s,(o,a)=>{if(!a)this.terminate();else{const h=a.startColumn-o.startColumn;h!==0&&this._filterByModel.deltaCol(h)}})}async _setupByValues(e,r){this._disposePreviousModel();const i=e.getRange();if(i.startRow===i.endRow)return!1;const n=await ve.fromFilterColumn(this._injector,e,r);return this.filterByModel=n,this._filterBy$.next(0),this._listenToFilterHeaderChange(e,r),!0}_setupByConditions(e,r){this._disposePreviousModel();const i=e.getRange();if(i.startRow===i.endRow)return!1;const n=Se.fromFilterColumn(this._injector,e,r,e.getFilterColumn(r));return this.filterByModel=n,this._filterBy$.next(1),this._listenToFilterHeaderChange(e,r),!0}_disposePreviousModel(){var e;(e=this._filterByModel)==null||e.dispose(),this.filterByModel=null}};G=Me([fe(0,c.Inject(c.Injector)),fe(1,c.Inject(O.RefRangeService))],G);let Se=class extends c.Disposable{constructor(e,r,i,n,l){super();S(this,"canApply$",g.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 g.BehaviorSubject(i),this.conditionItem$=this._conditionItem$.asObservable(),this._filterConditionFormParams$=new g.BehaviorSubject(n),this.filterConditionFormParams$=this._filterConditionFormParams$.asObservable()}static fromFilterColumn(e,r,i,n){const[l,s]=d.testMappingFilterColumn(n==null?void 0:n.getColumnData());return e.createInstance(Se,r,i,l,s)}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=d.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=d.ALL_CONDITIONS.find(i=>i.operator===e);if(!r)throw new Error(`[ByConditionsModel]: condition item not found for operator: ${e}!`);this._conditionItem$.next(r),this._filterConditionFormParams$.next(d.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 i=d.testMappingParams(r,this.conditionItem.numOfParameters);this._conditionItem$.next(i)}this._filterConditionFormParams$.next(r)}};Se=Me([fe(4,c.ICommandService)],Se);let ve=class extends c.Disposable{constructor(e,r,i,n,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=n,this._searchString$=new g.BehaviorSubject(""),this.searchString$=this._searchString$.asObservable(),this._rawFilterItems$=new g.BehaviorSubject(i),this.rawFilterItems$=this._rawFilterItems$.asObservable(),this._manuallyUpdateFilterItems$=new g.Subject,this.filterItems$=g.merge(g.combineLatest([this._searchString$.pipe(g.throttleTime(500,void 0,{leading:!0,trailing:!0}),g.startWith(void 0)),this._rawFilterItems$]).pipe(g.map(([s,o])=>{if(!s)return o;const h=s.toLowerCase().split(/\s+/).filter(m=>!!m);return Ge(o,h)})),this._manuallyUpdateFilterItems$).pipe(g.shareReplay(1)),this.canApply$=this.filterItems$.pipe(g.map(s=>Ne(s).checked>0)),this.disposeWithMe(this.filterItems$.subscribe(s=>this._filterItems=s))}static async fromFilterColumn(e,r,i){var j;const n=e.get(c.IUniverInstanceService),l=e.get(c.LocaleService),s=e.get(de,c.Quantity.OPTIONAL),{unitId:o,subUnitId:a}=r,h=n.getUniverSheetInstance(o);if(!h)throw new Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${o}!`);const m=h==null?void 0:h.getSheetBySheetId(a);if(!m)throw new Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${o} and subUnitId: ${a}!`);const p=r.getRange(),F=i,_=(j=r.getFilterColumn(i))==null?void 0:j.getColumnData().filters,E=new Set(_==null?void 0:_.filters),C=!!(_&&_.blank),R=r.getFilteredOutRowsExceptCol(i),P={...p,startRow:p.startRow+1,startColumn:F,endColumn:F};let M,b;if(s){const x=await s.getFilterValues({unitId:o,subUnitId:a,filteredOutRowsByOtherColumns:Array.from(R),filters:!!_,blankChecked:C,iterateRange:P,alreadyChecked:Array.from(E)});M=x.filterTreeItems,b=x.filterTreeMapCache}else{const x=ke(!!_,l,P,m,R,E,C,h.getStyles());M=x.filterTreeItems,b=x.filterTreeMapCache}return e.createInstance(ve,r,i,M,b)}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(i=>ie(i,e)),this._manuallyUpdateFilterItems(r)}onFilterCheckToggled(e){const r=c.Tools.deepClone(this._filterItems),i=Re(r,e.key);if(!i)return;const n=Qe(i);ie(i,!n),this._manuallyUpdateFilterItems(r)}onFilterOnly(e){const r=c.Tools.deepClone(this._filterItems);r.forEach(i=>ie(i,!1)),e.forEach(i=>{const n=Re(r,i);n&&ie(n,!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=Ne(this._filterItems),{checked:r,checkedItems:i}=e,n=this.rawFilterItems;let l=0;for(const h of n)l+=h.count;const s=r===0,o=e.checked===l,a={colId:this.col};if(s)throw new Error("[ByValuesModel]: no checked items!");if(o)return this._commandService.executeCommand(u.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null});{a.filters={};const h=i.filter(p=>p.key!=="empty");h.length>0&&(a.filters={filters:h.flatMap(p=>p.originValues?Array.from(p.originValues):[p.title])}),h.length!==i.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})}};ve=Me([fe(4,c.ICommandService)],ve);const ee="FILTER_PANEL_OPENED",oe={id:"sheet.operation.open-filter-panel",type:c.CommandType.OPERATION,handler:(t,e)=>{const r=t.get(c.IContextService),i=t.get(u.SheetsFilterService),n=t.get(G);t.get(c.ICommandService).syncExecuteCommand(w.SetCellEditVisibleOperation.id,{visible:!1});const{unitId:s,subUnitId:o,col:a}=e,h=i.getFilterModel(s,o);return h?(n.setupCol(h,a),r.getContextValue(ee)||r.setContextValue(ee,!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(G),i=t.get(T.ILayoutService,c.Quantity.OPTIONAL);return e.getContextValue(ee)?(e.setContextValue(ee,!1),i==null||i.focus(),r.terminate()):!1}},Ue={id:"sheet.operation.apply-filter",type:c.CommandType.OPERATION,handler:(t,e)=>{const{filterBy:r}=e;return t.get(G).changeFilterBy(r)}};var mt=Object.defineProperty,pt=Object.getOwnPropertyDescriptor,dt=(t,e,r,i)=>{for(var n=i>1?void 0:i?pt(e,r):e,l=t.length-1,s;l>=0;l--)(s=t[l])&&(n=(i?s(e,r,n):s(n))||n);return i&&n&&mt(e,r,n),n},J=(t,e)=>(r,i)=>e(r,i,t);let te=class extends c.Disposable{constructor(t,e,r,i,n,l){super(),this._sheetsFilterService=t,this._localeService=e,this._commandService=r,this._sheetPermissionCheckPermission=i,this._injector=n,this._sheetsSelectionService=l,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(t=>{var e,r,i;if(t.id===u.SmartToggleSheetsFilterCommand.id){const n=this._injector.get(c.IUniverInstanceService),l=O.getSheetCommandTarget(n);if(!l)return;const{unitId:s,subUnitId:o,worksheet:a}=l,h=(e=this._sheetsFilterService.getFilterModel(s,o))==null?void 0:e.getRange();let m;if(h)m=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[O.RangeProtectionPermissionViewPoint],worksheetTypes:[O.WorksheetFilterPermission,O.WorksheetViewPermission]},[h]);else{const p=(r=this._sheetsSelectionService.getCurrentLastSelection())==null?void 0:r.range;if(p){let F={...p};F=p.startColumn===p.endColumn&&p.startRow===p.endRow?O.expandToContinuousRange(F,{left:!0,right:!0,up:!0,down:!0},a):F,m=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[O.RangeProtectionPermissionViewPoint],worksheetTypes:[O.WorksheetViewPermission,O.WorksheetFilterPermission]},[F],s,o)}else m=this._sheetPermissionCheckPermission.permissionCheckWithoutRange({rangeTypes:[O.RangeProtectionPermissionViewPoint],worksheetTypes:[O.WorksheetViewPermission,O.WorksheetFilterPermission]})}m||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr"))}if(t.id===oe.id){const n=t.params,{unitId:l,subUnitId:s}=n,o=(i=this._sheetsFilterService.getFilterModel(l,s))==null?void 0:i.getRange(),a=c.Tools.deepClone(o);a&&(a.startColumn=n.col,a.endColumn=n.col,this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[O.RangeProtectionPermissionViewPoint],worksheetTypes:[O.WorksheetFilterPermission,O.WorksheetViewPermission]},[a])||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr")))}}))}};te=dt([J(0,c.Inject(u.SheetsFilterService)),J(1,c.Inject(c.LocaleService)),J(2,c.ICommandService),J(3,c.Inject(O.SheetPermissionCheckController)),J(4,c.Inject(c.Injector)),J(5,c.Inject(O.SheetsSelectionsService))],te);var D=function(){return D=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++){e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},D.apply(this,arguments)},ft=function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r},Ye=y.forwardRef(function(t,e){var r=t.icon,i=t.id,n=t.className,l=t.extend,s=ft(t,["icon","id","className","extend"]),o="univerjs-icon univerjs-icon-".concat(i," ").concat(n||"").trim(),a=y.useRef("_".concat(vt()));return qe(r,"".concat(i),{defIds:r.defIds,idSuffix:a.current},D({ref:e,className:o},s),l)});function qe(t,e,r,i,n){return y.createElement(t.tag,D(D({key:e},_t(t,r,n)),i),(St(t,r).children||[]).map(function(l,s){return qe(l,"".concat(e,"-").concat(t.tag,"-").concat(s),r,void 0,n)}))}function _t(t,e,r){var i=D({},t.attrs);r!=null&&r.colorChannel1&&i.fill==="colorChannel1"&&(i.fill=r.colorChannel1);var n=e.defIds;return!n||n.length===0||(t.tag==="use"&&i["xlink:href"]&&(i["xlink:href"]=i["xlink:href"]+e.idSuffix),Object.entries(i).forEach(function(l){var s=l[0],o=l[1];typeof o=="string"&&(i[s]=o.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),i}function St(t,e){var r,i=e.defIds;return!i||i.length===0?t:t.tag==="defs"&&(!((r=t.children)===null||r===void 0)&&r.length)?D(D({},t),{children:t.children.map(function(n){return typeof n.attrs.id=="string"&&i&&i.indexOf(n.attrs.id)>-1?D(D({},n),{attrs:D(D({},n.attrs),{id:n.attrs.id+e.idSuffix})}):n})}):t}function vt(){return Math.random().toString(36).substring(2,8)}Ye.displayName="UniverIcon";var gt={tag:"svg",attrs:{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"}}]},Ke=y.forwardRef(function(t,e){return y.createElement(Ye,Object.assign({},t,{id:"filter-single",ref:e,icon:gt}))});Ke.displayName="FilterSingle";var Oe={exports:{}},se={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var we;function Ft(){if(we)return se;we=1;var t=y,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,n=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function s(o,a,h){var m,p={},F=null,_=null;h!==void 0&&(F=""+h),a.key!==void 0&&(F=""+a.key),a.ref!==void 0&&(_=a.ref);for(m in a)i.call(a,m)&&!l.hasOwnProperty(m)&&(p[m]=a[m]);if(o&&o.defaultProps)for(m in a=o.defaultProps,a)p[m]===void 0&&(p[m]=a[m]);return{$$typeof:e,type:o,key:F,ref:_,props:p,_owner:n.current}}return se.Fragment=r,se.jsx=s,se.jsxs=s,se}var De;function Ct(){return De||(De=1,Oe.exports=Ft()),Oe.exports}var f=Ct();const Tt="univer-sheets-filter-panel",Et="univer-sheets-filter-panel-header",Ot="univer-sheets-filter-panel-content",Pt="univer-sheets-filter-panel-select-all",It="univer-sheets-filter-panel-select-all-count",Nt="univer-sheets-filter-panel-values-container",yt="univer-input-affix-wrapper",Rt="univer-select",At="univer-radio-group",bt="univer-sheets-filter-panel-values-find",Lt="univer-sheets-filter-panel-values-list",Mt="univer-sheets-filter-panel-values-list-inner-container",Ut="univer-sheets-filter-panel-values-virtual",$t="univer-sheets-filter-panel-values-item",wt="univer-sheets-filter-panel-values-item-inner",Dt="univer-sheets-filter-panel-values-item-count",Ht="univer-sheets-filter-panel-values-item-exclude-button",jt="univer-sheets-filter-panel-values-item-text",xt="univer-sheets-filter-panel-conditions-container",Bt="univer-sheets-filter-panel-conditions-container-inner",Vt="univer-sheets-filter-panel-conditions-desc",Wt="univer-sheets-filter-panel-footer",kt="univer-sheets-filter-panel-footer-primary-buttons",Qt="univer-button",Gt="univer-input",Yt="univer-form-dual-column-layout",qt="univer-sheets-filter-tree-node",Kt="univer-sheets-filter-tree-node-filter-only",Xt="univer-sheets-filter-tree-node-attach",I={sheetsFilterPanel:Tt,sheetsFilterPanelHeader:Et,sheetsFilterPanelContent:Ot,sheetsFilterPanelSelectAll:Pt,sheetsFilterPanelSelectAllCount:It,sheetsFilterPanelValuesContainer:Nt,inputAffixWrapper:yt,select:Rt,radioGroup:At,sheetsFilterPanelValuesFind:bt,sheetsFilterPanelValuesList:Lt,sheetsFilterPanelValuesListInnerContainer:Mt,sheetsFilterPanelValuesVirtual:Ut,sheetsFilterPanelValuesItem:$t,sheetsFilterPanelValuesItemInner:wt,sheetsFilterPanelValuesItemCount:Dt,sheetsFilterPanelValuesItemExcludeButton:Ht,sheetsFilterPanelValuesItemText:jt,sheetsFilterPanelConditionsContainer:xt,sheetsFilterPanelConditionsContainerInner:Bt,sheetsFilterPanelConditionsDesc:Vt,sheetsFilterPanelFooter:Wt,sheetsFilterPanelFooterPrimaryButtons:kt,button:Qt,input:Gt,formDualColumnLayout:Yt,sheetsFilterTreeNode:qt,sheetsFilterTreeNodeFilterOnly:Kt,sheetsFilterTreeNodeAttach:Xt};function Zt(t){var _,E;const{model:e}=t,r=c.useDependency(c.LocaleService),i=T.useObservable(e.conditionItem$,void 0),n=T.useObservable(e.filterConditionFormParams$,void 0),l=n!=null&&n.and?"AND":"OR",s=y.useCallback(C=>{e.onConditionFormChange({and:C==="AND"})},[e]),o=Jt(r),a=y.useCallback(C=>{e.onPrimaryConditionChange(C)},[e]),h=zt(r),m=y.useCallback(C=>{e.onConditionFormChange(C)},[e]),p=r.t("sheets-filter.panel.input-values-placeholder");function F(C,R,P){const M=d.getItemByOperator(C).numOfParameters===1;return f.jsxs(f.Fragment,{children:[P==="operator2"&&f.jsxs(L.RadioGroup,{value:l,onChange:s,children:[f.jsx(L.Radio,{value:"AND",children:r.t("sheets-filter.panel.and")}),f.jsx(L.Radio,{value:"OR",children:r.t("sheets-filter.panel.or")})]}),f.jsx(L.Select,{value:C,options:h,onChange:b=>m({[P]:b})}),M&&f.jsx("div",{children:f.jsx(L.Input,{value:R,placeholder:p,onChange:b=>m({[P==="operator1"?"val1":"val2"]:b})})})]})}return f.jsx("div",{className:I.sheetsFilterPanelConditionsContainer,children:i&&n&&f.jsxs(f.Fragment,{children:[f.jsx(L.Select,{value:i.operator,options:o,onChange:a}),d.getItemByOperator(i.operator).numOfParameters!==0?f.jsxs("div",{className:I.sheetsFilterPanelConditionsContainerInner,children:[i.numOfParameters>=1&&F(n.operator1,(_=n.val1)!=null?_:"","operator1"),i.numOfParameters>=2&&F(n.operator2,(E=n.val2)!=null?E:"","operator2"),f.jsxs("div",{className:I.sheetsFilterPanelConditionsDesc,children:[r.t("sheets-filter.panel.?"),f.jsx("br",{}),r.t("sheets-filter.panel.*")]})]}):null]})})}function Jt(t){const e=t.getCurrentLocale();return y.useMemo(()=>[{options:[{label:t.t(d.NONE.label),value:d.NONE.operator}]},{options:[{label:t.t(d.EMPTY.label),value:d.EMPTY.operator},{label:t.t(d.NOT_EMPTY.label),value:d.NOT_EMPTY.operator}]},{options:[{label:t.t(d.TEXT_CONTAINS.label),value:d.TEXT_CONTAINS.operator},{label:t.t(d.DOES_NOT_CONTAIN.label),value:d.DOES_NOT_CONTAIN.operator},{label:t.t(d.STARTS_WITH.label),value:d.STARTS_WITH.operator},{label:t.t(d.ENDS_WITH.label),value:d.ENDS_WITH.operator},{label:t.t(d.EQUALS.label),value:d.EQUALS.operator}]},{options:[{label:t.t(d.GREATER_THAN.label),value:d.GREATER_THAN.operator},{label:t.t(d.GREATER_THAN_OR_EQUAL.label),value:d.GREATER_THAN_OR_EQUAL.operator},{label:t.t(d.LESS_THAN.label),value:d.LESS_THAN.operator},{label:t.t(d.LESS_THAN_OR_EQUAL.label),value:d.LESS_THAN_OR_EQUAL.operator},{label:t.t(d.EQUAL.label),value:d.EQUAL.operator},{label:t.t(d.NOT_EQUAL.label),value:d.NOT_EQUAL.operator},{label:t.t(d.BETWEEN.label),value:d.BETWEEN.operator},{label:t.t(d.NOT_BETWEEN.label),value:d.NOT_BETWEEN.operator}]},{options:[{label:t.t(d.CUSTOM.label),value:d.CUSTOM.operator}]}],[e,t])}function zt(t){const e=t.getCurrentLocale();return y.useMemo(()=>d.ALL_CONDITIONS.filter(r=>r.numOfParameters!==2).map(r=>({label:t.t(r.label),value:r.operator})),[e,t])}function er(t){const{model:e}=t,r=c.useDependency(c.LocaleService),i=T.useObservable(e.searchString$,"",!0),n=T.useObservable(e.filterItems$,void 0,!0),l=r.t("sheets-filter.panel.filter-only"),s=Ne(n),o=s.checked>0&&s.unchecked===0,a=s.checked>0&&s.unchecked>0,h=e.treeMapCache,m=y.useCallback(()=>{e.onCheckAllToggled(!o)},[e,o]),p=y.useCallback(_=>{e.setSearchString(_)},[e]);function F(_){let E=[];return _.forEach(C=>{C.checked&&E.push(C.key),C.children&&(E=E.concat(F(C.children)))}),E}return f.jsxs("div",{className:I.sheetsFilterPanelValuesContainer,children:[f.jsx(L.Input,{autoFocus:!0,value:i,placeholder:r.t("sheets-filter.panel.search-placeholder"),onChange:p}),f.jsxs("div",{className:I.sheetsFilterPanelValuesList,children:[f.jsx("div",{className:I.sheetsFilterPanelValuesItem,children:f.jsxs("div",{className:I.sheetsFilterPanelValuesItemInner,children:[f.jsx(L.Checkbox,{indeterminate:a,disabled:n.length===0,checked:o,onChange:m}),f.jsx("span",{className:I.sheetsFilterPanelValuesItemText,children:`${r.t("sheets-filter.panel.select-all")}`}),f.jsx("span",{className:I.sheetsFilterPanelValuesItemCount,children:`(${s.checked}/${s.checked+s.unchecked})`})]})}),f.jsx("div",{className:I.sheetsFilterPanelValuesVirtual,children:f.jsx(L.Tree,{data:n,defaultExpandAll:!1,valueGroup:F(n),height:180,onChange:_=>{e.onFilterCheckToggled(_)},defaultCache:h,itemHeight:28,treeNodeClassName:I.sheetsFilterTreeNode,attachRender:_=>f.jsxs("div",{className:I.sheetsFilterTreeNodeAttach,children:[f.jsx("span",{className:I.sheetsFilterPanelValuesItemCount,children:`(${_.count})`}),f.jsx(L.Button,{className:I.sheetsFilterTreeNodeFilterOnly,size:"small",type:"link",onClick:()=>{const E=[];_.children?_.children.forEach(C=>{C.children?C.children.forEach(R=>{E.push(R.key)}):E.push(C.key)}):E.push(_.key),e.onFilterOnly(E)},children:l})]})})})]})]})}function tr(){var R;const t=c.useDependency(G),e=c.useDependency(c.LocaleService),r=c.useDependency(c.ICommandService),i=T.useObservable(t.filterBy$,void 0,!0),n=T.useObservable(t.filterByModel$,void 0,!1),l=T.useObservable(()=>(n==null?void 0:n.canApply$)||g.of(!1),void 0,!1,[n]),s=rr(e),o=!T.useObservable(t.hasCriteria$),a=y.useCallback(P=>{r.executeCommand(Ue.id,{filterBy:P})},[r]),h=y.useCallback(async()=>{await(n==null?void 0:n.clear()),r.executeCommand(z.id)},[n,r]),m=y.useCallback(()=>{r.executeCommand(z.id)},[r]),p=y.useCallback(async()=>{await(n==null?void 0:n.apply()),r.executeCommand(z.id)},[n,r]),_=(R=c.useDependency(u.SheetsFilterService).activeFilterModel)==null?void 0:R.getRange(),E=t.col,C=T.useComponentsOfPart(w.SheetsUIPart.FILTER_PANEL_EMBED_POINT);return f.jsxs("div",{className:I.sheetsFilterPanel,children:[f.jsx(T.ComponentContainer,{components:C,sharedProps:{range:_,colIndex:E,onClose:m}}),f.jsx("div",{className:I.sheetsFilterPanelHeader,children:f.jsx(L.Segmented,{value:i,options:s,onChange:P=>a(P)})}),n?f.jsx("div",{className:I.sheetsFilterPanelContent,children:i===_e.VALUES?f.jsx(er,{model:n}):f.jsx(Zt,{model:n})}):f.jsx("div",{style:{flex:1}}),f.jsxs("div",{className:I.sheetsFilterPanelFooter,children:[f.jsx(L.Button,{type:"link",onClick:h,disabled:o,children:e.t("sheets-filter.panel.clear-filter")}),f.jsxs("span",{className:I.sheetsFilterPanelFooterPrimaryButtons,children:[f.jsx(L.Button,{type:"default",onClick:m,children:e.t("sheets-filter.panel.cancel")}),f.jsx(L.Button,{disabled:!l,type:"primary",onClick:p,children:e.t("sheets-filter.panel.confirm")})]})]})]})}function rr(t){const e=t.getCurrentLocale();return y.useMemo(()=>[{label:t.t("sheets-filter.panel.by-values"),value:_e.VALUES},{label:t.t("sheets-filter.panel.by-conditions"),value:_e.CONDITIONS}],[e,t])}function sr(t){const e=t.get(u.SheetsFilterService);return{id:u.SmartToggleSheetsFilterCommand.id,type:T.MenuItemType.BUTTON_SELECTOR,icon:"FilterSingle",tooltip:"sheets-filter.toolbar.smart-toggle-filter-tooltip",hidden$:T.getMenuHiddenObservable(t,c.UniverInstanceType.UNIVER_SHEET),activated$:e.activeFilterModel$.pipe(g.map(r=>!!r)),disabled$:w.getObservableWithExclusiveRange$(t,w.getCurrentRangeDisable$(t,{worksheetTypes:[O.WorksheetFilterPermission,O.WorksheetViewPermission],rangeTypes:[O.RangeProtectionPermissionViewPoint]}))}}function ir(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(g.switchMap(r=>{var i;return(i=r==null?void 0:r.hasCriteria$.pipe(g.map(n=>!n)))!=null?i:g.of(!0)}))}}function nr(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(g.switchMap(r=>{var i;return(i=r==null?void 0:r.hasCriteria$.pipe(g.map(n=>!n)))!=null?i:g.of(!0)}))}}const or={[T.RibbonStartGroup.FORMULAS_INSERT]:{[u.SmartToggleSheetsFilterCommand.id]:{order:10,menuItemFactory:sr,[u.ClearSheetsFilterCriteriaCommand.id]:{order:0,menuItemFactory:ir},[u.ReCalcSheetsFilterCommand.id]:{order:1,menuItemFactory:nr}}}},ar={id:u.SmartToggleSheetsFilterCommand.id,binding:T.KeyCode.L|T.MetaKeys.CTRL_COMMAND|T.MetaKeys.SHIFT,description:"sheets-filter.shortcut.smart-toggle-filter",preconditions:w.whenSheetEditorFocused,group:"4_sheet-edit"},Q=16,lr=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 He{static drawNoCriteria(e,r,i,n){e.save(),ne.Rect.drawWith(e,{radius:2,width:Q,height:Q,fill:n}),e.lineCap="square",e.strokeStyle=i,e.scale(r/Q,r/Q),e.beginPath(),e.lineWidth=1,e.lineCap="round",e.moveTo(3,4),e.lineTo(13,4),e.moveTo(4.5,8),e.lineTo(11.5,8),e.moveTo(6,12),e.lineTo(10,12),e.stroke(),e.restore()}static drawHasCriteria(e,r,i,n){e.save(),ne.Rect.drawWith(e,{radius:2,width:Q,height:Q,fill:n}),e.scale(r/Q,r/Q),e.fillStyle=i,e.fill(lr),e.restore()}}var cr=Object.defineProperty,ur=Object.getOwnPropertyDescriptor,hr=(t,e,r,i)=>{for(var n=i>1?void 0:i?ur(e,r):e,l=t.length-1,s;l>=0;l--)(s=t[l])&&(n=(i?s(e,r,n):s(n))||n);return i&&n&&cr(e,r,n),n},Pe=(t,e)=>(r,i)=>e(r,i,t);const W=16,he=1;let Ae=class extends ne.Shape{constructor(e,r,i,n,l){super(e,r);S(this,"_cellWidth",0);S(this,"_cellHeight",0);S(this,"_filterParams");S(this,"_hovered",!1);this._contextService=i,this._commandService=n,this._themeService=l,this.setShapeProps(r),this.onPointerDown$.subscribeEvent(s=>this.onPointerDown(s)),this.onPointerEnter$.subscribeEvent(()=>this.onPointerEnter()),this.onPointerLeave$.subscribeEvent(()=>this.onPointerLeave())}setShapeProps(e){typeof e.cellHeight<"u"&&(this._cellHeight=e.cellHeight),typeof e.cellWidth<"u"&&(this._cellWidth=e.cellWidth),typeof e.filterParams<"u"&&(this._filterParams=e.filterParams),this.transformByState({width:e.width,height:e.height})}_draw(e){const r=this._cellHeight,i=this._cellWidth,n=W-i,l=W-r;e.save();const s=new Path2D;s.rect(n,l,i,r),e.clip(s);const{hasCriteria:o}=this._filterParams,a=this._themeService.getCurrentTheme().primaryColor,h=this._hovered?this._themeService.getCurrentTheme().grey50:"rgba(255, 255, 255, 1.0)";o?He.drawHasCriteria(e,W,a,h):He.drawNoCriteria(e,W,a,h),e.restore()}onPointerDown(e){if(e.button===2)return;const{col:r,unitId:i,subUnitId:n}=this._filterParams;this._contextService.getContextValue(ee)||!this._commandService.hasCommand(oe.id)||setTimeout(()=>{this._commandService.executeCommand(oe.id,{unitId:i,subUnitId:n,col:r})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};Ae=hr([Pe(2,c.IContextService),Pe(3,c.ICommandService),Pe(4,c.Inject(c.ThemeService))],Ae);var mr=Object.defineProperty,pr=Object.getOwnPropertyDescriptor,dr=(t,e,r,i)=>{for(var n=i>1?void 0:i?pr(e,r):e,l=t.length-1,s;l>=0;l--)(s=t[l])&&(n=(i?s(e,r,n):s(n))||n);return i&&n&&mr(e,r,n),n},K=(t,e)=>(r,i)=>e(r,i,t);const fr=1e3,_r=5e3;let be=class extends c.RxDisposable{constructor(e,r,i,n,l,s,o,a){super();S(this,"_filterRangeShape",null);S(this,"_buttonRenderDisposable",null);S(this,"_filterButtonShapes",[]);this._context=e,this._injector=r,this._sheetSkeletonManagerService=i,this._sheetsFilterService=n,this._themeService=l,this._sheetInterceptorService=s,this._commandService=o,this._selectionRenderService=a,this._initRenderer()}dispose(){super.dispose(),this._disposeRendering()}_initRenderer(){this._sheetSkeletonManagerService.currentSkeleton$.pipe(g.switchMap(e=>{var o,a;if(!e)return g.of(null);const{unit:r,unitId:i}=this._context,n=((o=r.getActiveSheet())==null?void 0:o.getSheetId())||"",l=(a=this._sheetsFilterService.getFilterModel(i,n))!=null?a:void 0,s=()=>({unitId:i,worksheetId:n,filterModel:l,range:l==null?void 0:l.getRange(),skeleton:e.skeleton});return c.fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(g.filter(([h])=>{var m;return h.type===c.CommandType.MUTATION&&((m=h.params)==null?void 0:m.unitId)===r.getUnitId()&&(u.FILTER_MUTATIONS.has(h.id)||h.id===O.SetRangeValuesMutation.id)}),g.throttleTime(20,void 0,{leading:!1,trailing:!0}),g.map(s),g.startWith(s()))}),g.takeUntil(this.dispose$)).subscribe(e=>{this._disposeRendering(),!(!e||!e.range)&&(this._renderRange(e.range,e.skeleton),this._renderButtons(e))})}_renderRange(e,r){const{scene:i}=this._context,{rowHeaderWidth:n,columnHeaderHeight:l}=r,s=this._filterRangeShape=new w.SelectionControl(i,fr,this._themeService,{rowHeaderWidth:n,columnHeaderHeight:l,enableAutoFill:!1,highlightHeader:!1}),o={range:e,primary:null,style:{fill:"rgba(0, 0, 0, 0.0)"}},a=w.attachSelectionWithCoord(o,r);s.updateRangeBySelectionWithCoord(a),s.setEvent(!1),i.makeDirty(!0)}_renderButtons(e){const{range:r,filterModel:i,unitId:n,skeleton:l,worksheetId:s}=e,{scene:o}=this._context;this._interceptCellContent(n,s,e.range);const{startColumn:a,endColumn:h,startRow:m}=r;for(let p=a;p<=h;p++){const F=`sheets-filter-button-${p}`,_=w.getCoordByCell(m,p,o,l),{startX:E,startY:C,endX:R,endY:P}=_,M=R-E,b=P-C;if(b<=he||M<=he)continue;const j=!!i.getFilterColumn(p),x=R-W-he,le=P-W-he,ce={left:x,top:le,height:W,width:W,zIndex:_r,cellHeight:b,cellWidth:M,filterParams:{unitId:n,subUnitId:s,col:p,hasCriteria:j}},U=this._injector.createInstance(Ae,F,ce);this._filterButtonShapes.push(U)}o.addObjects(this._filterButtonShapes),o.makeDirty()}_interceptCellContent(e,r,i){const{startRow:n,startColumn:l,endColumn:s}=i;this._buttonRenderDisposable=this._sheetInterceptorService.intercept(O.INTERCEPTOR_POINT.CELL_CONTENT,{effect:c.InterceptorEffectEnum.Style,handler:(o,a,h)=>{const{row:m,col:p,unitId:F,subUnitId:_}=a;return F!==e||_!==r||m!==n||p<l||p>s?h(o):h({...o,fontRenderExtension:{...o==null?void 0:o.fontRenderExtension,rightOffset:W}})},priority:10})}_disposeRendering(){var e,r;(e=this._filterRangeShape)==null||e.dispose(),this._filterButtonShapes.forEach(i=>i.dispose()),(r=this._buttonRenderDisposable)==null||r.dispose(),this._filterRangeShape=null,this._buttonRenderDisposable=null,this._filterButtonShapes=[]}};be=dr([K(1,c.Inject(c.Injector)),K(2,c.Inject(w.SheetSkeletonManagerService)),K(3,c.Inject(u.SheetsFilterService)),K(4,c.Inject(c.ThemeService)),K(5,c.Inject(O.SheetInterceptorService)),K(6,c.ICommandService),K(7,w.ISheetSelectionRenderService)],be);var Sr=Object.defineProperty,vr=Object.getOwnPropertyDescriptor,gr=(t,e,r,i)=>{for(var n=i>1?void 0:i?vr(e,r):e,l=t.length-1,s;l>=0;l--)(s=t[l])&&(n=(i?s(e,r,n):s(n))||n);return i&&n&&Sr(e,r,n),n},je=(t,e)=>(r,i)=>e(r,i,t);let ae=class extends c.RxDisposable{constructor(t,e){super(),this._renderManagerService=t,this._sheetsRenderService=e,[u.SetSheetsFilterRangeMutation,u.SetSheetsFilterCriteriaMutation,u.RemoveSheetsFilterMutation,u.ReCalcSheetsFilterMutation].forEach(r=>this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(r.id))),this.disposeWithMe(this._renderManagerService.registerRenderModule(c.UniverInstanceType.UNIVER_SHEET,[be]))}};ae=gr([je(0,ne.IRenderManagerService),je(1,c.Inject(w.SheetsRenderService))],ae);var Fr=Object.defineProperty,Cr=Object.getOwnPropertyDescriptor,Tr=(t,e,r,i)=>{for(var n=i>1?void 0:i?Cr(e,r):e,l=t.length-1,s;l>=0;l--)(s=t[l])&&(n=(i?s(e,r,n):s(n))||n);return i&&n&&Fr(e,r,n),n},$=(t,e)=>(r,i)=>e(r,i,t);const xe="FILTER_PANEL_POPUP";let ge=class extends ae{constructor(e,r,i,n,l,s,o,a,h,m,p,F,_){super(_,F);S(this,"_popupDisposable");this._injector=e,this._componentManager=r,this._sheetsFilterPanelService=i,this._sheetCanvasPopupService=n,this._sheetsFilterService=l,this._localeService=s,this._shortcutService=o,this._commandService=a,this._menuManagerService=h,this._contextService=m,this._messageService=p,this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[ar].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}_initCommands(){[u.SmartToggleSheetsFilterCommand,u.RemoveSheetFilterCommand,u.SetSheetFilterRangeCommand,u.SetSheetsFilterCriteriaCommand,u.ClearSheetsFilterCriteriaCommand,u.ReCalcSheetsFilterCommand,Ue,oe,z].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenuItems(){this._menuManagerService.mergeMenu(or)}_initUI(){this.disposeWithMe(this._componentManager.register(xe,tr)),this.disposeWithMe(this._componentManager.register("FilterSingle",Ke)),this.disposeWithMe(this._contextService.subscribeContextValue$(ee).pipe(g.distinctUntilChanged()).subscribe(e=>{e?this._openFilterPopup():this._closeFilterPopup()})),this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe(e=>{e&&this._messageService.show({type:L.MessageType.Error,content:this._localeService.t(e)})}))}_openFilterPopup(){const e=this._sheetsFilterPanelService.filterModel;if(!e)throw new Error("[SheetsFilterUIController]: no filter model when opening filter popup!");const r=e.getRange(),i=this._sheetsFilterPanelService.col,{startRow:n}=r;this._popupDisposable=this._sheetCanvasPopupService.attachPopupToCell(n,i,{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}};ge=Tr([$(0,c.Inject(c.Injector)),$(1,c.Inject(T.ComponentManager)),$(2,c.Inject(G)),$(3,c.Inject(w.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(w.SheetsRenderService)),$(12,ne.IRenderManagerService)],ge);var Xe=Object.defineProperty,Er=Object.getOwnPropertyDescriptor,Or=(t,e,r)=>e in t?Xe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Pr=(t,e,r,i)=>{for(var n=i>1?void 0:i?Er(e,r):e,l=t.length-1,s;l>=0;l--)(s=t[l])&&(n=(i?s(e,r,n):s(n))||n);return i&&n&&Xe(e,r,n),n},Ie=(t,e)=>(r,i)=>e(r,i,t),Ze=(t,e,r)=>Or(t,typeof e!="symbol"?e+"":e,r);const Ir="SHEET_FILTER_UI_PLUGIN";exports.UniverSheetsFilterUIPlugin=class extends c.Plugin{constructor(e=pe,r,i,n){super(),this._config=e,this._injector=r,this._configService=i,this._rpcChannelService=n;const{menu:l,...s}=c.merge({},pe,this._config);l&&this._configService.setConfig("menu",l,{merge:!0}),this._configService.setConfig(We,s)}onStarting(){[[G],[te],[ge]].forEach(e=>this._injector.add(e)),this._config.useRemoteFilterValuesGenerator&&this._rpcChannelService&&this._injector.add([de,{useFactory:()=>Fe.toModule(this._rpcChannelService.requestChannel(Le))}])}onReady(){this._injector.get(te)}onRendered(){this._injector.get(ge)}};Ze(exports.UniverSheetsFilterUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET);Ze(exports.UniverSheetsFilterUIPlugin,"pluginName",Ir);exports.UniverSheetsFilterUIPlugin=Pr([c.DependentOn(u.UniverSheetsFilterPlugin),Ie(1,c.Inject(c.Injector)),Ie(2,c.IConfigService),Ie(3,c.Optional(Fe.IRPCChannelService))],exports.UniverSheetsFilterUIPlugin);var Je=Object.defineProperty,Nr=Object.getOwnPropertyDescriptor,yr=(t,e,r)=>e in t?Je(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rr=(t,e,r,i)=>{for(var n=i>1?void 0:i?Nr(e,r):e,l=t.length-1,s;l>=0;l--)(s=t[l])&&(n=(i?s(e,r,n):s(n))||n);return i&&n&&Je(e,r,n),n},Be=(t,e)=>(r,i)=>e(r,i,t),ze=(t,e,r)=>yr(t,typeof e!="symbol"?e+"":e,r);const Ar="SHEET_FILTER_UI_PLUGIN";exports.UniverSheetsFilterMobileUIPlugin=class extends c.Plugin{constructor(e=pe,r,i){super(),this._config=e,this._injector=r,this._configService=i;const{menu:n,...l}=c.merge({},pe,this._config);n&&this._configService.setConfig("menu",n,{merge:!0}),this._configService.setConfig(We,l)}onStarting(){[[te],[ae]].forEach(e=>this._injector.add(e))}onReady(){this._injector.get(te)}onRendered(){this._injector.get(ae)}};ze(exports.UniverSheetsFilterMobileUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET);ze(exports.UniverSheetsFilterMobileUIPlugin,"pluginName",Ar);exports.UniverSheetsFilterMobileUIPlugin=Rr([c.DependentOn(u.UniverSheetsFilterPlugin),Be(1,c.Inject(c.Injector)),Be(2,c.IConfigService)],exports.UniverSheetsFilterMobileUIPlugin);var br=Object.defineProperty,Lr=Object.getOwnPropertyDescriptor,Mr=(t,e,r,i)=>{for(var n=i>1?void 0:i?Lr(e,r):e,l=t.length-1,s;l>=0;l--)(s=t[l])&&(n=(i?s(e,r,n):s(n))||n);return i&&n&&br(e,r,n),n},Ve=(t,e)=>(r,i)=>e(r,i,t),me;exports.UniverSheetsFilterUIWorkerPlugin=(me=class extends c.Plugin{constructor(e,r,i){super(),this._config=e,this._injector=r,this._rpcChannelService=i}onStarting(){[[de,{useClass:ye}]].forEach(e=>this._injector.add(e))}onReady(){this._rpcChannelService.registerChannel(Le,Fe.fromModule(this._injector.get(de)))}},S(me,"type",c.UniverInstanceType.UNIVER_SHEET),S(me,"pluginName","SHEET_FILTER_UI_WORKER_PLUGIN"),me);exports.UniverSheetsFilterUIWorkerPlugin=Mr([Ve(1,c.Inject(c.Injector)),Ve(2,Fe.IRPCChannelService)],exports.UniverSheetsFilterUIWorkerPlugin);exports.ChangeFilterByOperation=Ue;exports.CloseFilterPanelOperation=z;exports.OpenFilterPanelOperation=oe;
|
package/lib/cjs/locale/en-US.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const e={"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":"Toggle Filter","clear-filter-criteria":"Clear Filter Conditions","re-calc-filter-conditions":"Re-calc Filter Conditions"},command:{"not-valid-filter-range":"The selected range only has one row and not valid for filter."},shortcut:{"smart-toggle-filter":"Toggle Filter"},panel:{"clear-filter":"Clear Filter",cancel:"Cancel",confirm:"Confirm","by-values":"By Values","by-conditions":"By Conditions","filter-only":"Filter Only","search-placeholder":"Use space to separate keywords","select-all":"Select All","input-values-placeholder":"Input Values",and:"AND",or:"OR",empty:"(empty)","?":"Use “?” to represent a single character.","*":"Use “*” to represent multiple characters."},conditions:{none:"None",empty:"Is Empty","not-empty":"Is Not Empty","text-contains":"Text Contains","does-not-contain":"Text Does Not Contain","starts-with":"Text Starts With","ends-with":"Text Ends With",equals:"Text Equals","greater-than":"Greater Than","greater-than-or-equal":"Greater Than Or Equal To","less-than":"Less Than","less-than-or-equal":"Less Than Or Equal To",equal:"Equal","not-equal":"Not Equal",between:"Between","not-between":"Not Between",custom:"Custom"},msg:{"filter-header-forbidden":"You can't move the header row of a filter."},date:{1:"January",2:"February",3:"March",4:"April",5:"May",6:"June",7:"July",8:"August",9:"September",10:"October",11:"November",12:"December"}}};module.exports=e;
|
package/lib/cjs/locale/fa-IR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const e={"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:"و",or:"یا",empty:"(خالی)","?":"برای نمایش یک کاراکتر از “?” استفاده کنید.","*":"برای نمایش چندین کاراکتر از “*” استفاده کنید."},conditions:{none:"هیچ کدام",empty:"خالی است","not-empty":"خالی نیست","text-contains":"شامل متن است","does-not-contain":"شامل متن نیست","starts-with":"با متن شروع میشود","ends-with":"با متن پایان مییابد",equals:"برابر است با","greater-than":"بزرگتر از","greater-than-or-equal":"بزرگتر از یا برابر با","less-than":"کوچکتر از","less-than-or-equal":"کوچکتر از یا برابر با",equal:"برابر است با","not-equal":"برابر نیست با",between:"بین","not-between":"بین نیست",custom:"سفارشی"},msg:{"filter-header-forbidden":"شما نمیتوانید ردیف هدر یک فیلتر را جابهجا کنید."},date:{1:"ژانویه",2:"فوریه",3:"مارس",4:"آوریل",5:"مه",6:"ژوئن",7:"جولای",8:"آگوست",9:"سپتامبر",10:"اکتبر",11:"نوامبر",12:"دسامبر"}}};module.exports=e;
|
package/lib/cjs/locale/fr-FR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const e={"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":"Inverser le filtre","clear-filter-criteria":"Effacer les conditions de filtre","re-calc-filter-conditions":"Recalculer les conditions de filtre"},command:{"not-valid-filter-range":"La plage sélectionnée n'a qu'une seule ligne et n'est pas valide pour le filtre."},shortcut:{"smart-toggle-filter":"Inverser le filtre"},panel:{"clear-filter":"Effacer le filtre",cancel:"Annuler",confirm:"Confirmer","by-values":"Par valeurs","by-conditions":"Par conditions","filter-only":"Filtrer uniquement","search-placeholder":"Utilisez un espace pour séparer les mots-clés","select-all":"Tout sélectionner","input-values-placeholder":"Saisir des valeurs",and:"ET",or:"OU",empty:"(vide)","?":"Utilisez “?” pour représenter un seul caractère.","*":"Utilisez “*” pour représenter plusieurs caractères."},conditions:{none:"Aucun",empty:"Est vide","not-empty":"N'est pas vide","text-contains":"Le texte contient","does-not-contain":"Le texte ne contient pas","starts-with":"Le texte commence par","ends-with":"Le texte se termine par",equals:"Le texte est égal à","greater-than":"Supérieur à","greater-than-or-equal":"Supérieur ou égal à","less-than":"Inférieur à","less-than-or-equal":"Inférieur ou égal à",equal:"Égal à","not-equal":"Différent de",between:"Entre","not-between":"Pas entre",custom:"Personnalisé"},msg:{"filter-header-forbidden":"Vous ne pouvez pas déplacer la ligne d'en-tête d'un filtre."},date:{1:"Jan",2:"Fév",3:"Mar",4:"Avr",5:"Mai",6:"Juin",7:"Juil",8:"Août",9:"Sept",10:"Oct",11:"Nov",12:"Déc"}}};module.exports=e;
|